drop PyNativeException
This commit is contained in:
parent
85baa8bfce
commit
21939c4d8b
|
@ -1,12 +1,5 @@
|
||||||
// Copyright (c) 2017-present PyO3 Project and Contributors
|
// Copyright (c) 2017-present PyO3 Project and Contributors
|
||||||
|
|
||||||
use std;
|
|
||||||
use ffi;
|
|
||||||
use err::PyErr;
|
|
||||||
use typeob::PyTypeObject;
|
|
||||||
use conversion::ToPyObject;
|
|
||||||
use python::{Python, IntoPyPointer};
|
|
||||||
|
|
||||||
/// Defines rust type for exception defined in Python code.
|
/// Defines rust type for exception defined in Python code.
|
||||||
///
|
///
|
||||||
/// # Syntax
|
/// # Syntax
|
||||||
|
@ -17,8 +10,9 @@ use python::{Python, IntoPyPointer};
|
||||||
///
|
///
|
||||||
/// # Example
|
/// # Example
|
||||||
/// ```
|
/// ```
|
||||||
/// #[macro_use]
|
/// #![feature(const_fn)]
|
||||||
/// extern crate pyo3;
|
///
|
||||||
|
/// #[macro_use] extern crate pyo3;
|
||||||
///
|
///
|
||||||
/// use pyo3::{Python, PyDict};
|
/// use pyo3::{Python, PyDict};
|
||||||
///
|
///
|
||||||
|
@ -39,7 +33,7 @@ macro_rules! import_exception {
|
||||||
#[allow(non_camel_case_types)]
|
#[allow(non_camel_case_types)]
|
||||||
pub struct $name;
|
pub struct $name;
|
||||||
|
|
||||||
impl $crate::std::convert::From<$name> for $crate::PyErr {
|
impl ::std::convert::From<$name> for $crate::PyErr {
|
||||||
fn from(_err: $name) -> $crate::PyErr {
|
fn from(_err: $name) -> $crate::PyErr {
|
||||||
$crate::PyErr::new::<$name, _>(())
|
$crate::PyErr::new::<$name, _>(())
|
||||||
}
|
}
|
||||||
|
@ -53,11 +47,6 @@ macro_rules! import_exception {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl $crate::PyNativeException for $name {
|
|
||||||
const MOD: &'static str = stringify!($module);
|
|
||||||
const NAME: &'static str = stringify!($name);
|
|
||||||
}
|
|
||||||
|
|
||||||
impl $crate::typeob::PyTypeObject for $name {
|
impl $crate::typeob::PyTypeObject for $name {
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
fn init_type() {}
|
fn init_type() {}
|
||||||
|
@ -65,8 +54,7 @@ macro_rules! import_exception {
|
||||||
#[inline]
|
#[inline]
|
||||||
fn type_object() -> $crate::Py<$crate::PyType> {
|
fn type_object() -> $crate::Py<$crate::PyType> {
|
||||||
use $crate::IntoPyPointer;
|
use $crate::IntoPyPointer;
|
||||||
static mut TYPE_OBJECT: *mut $crate::ffi::PyTypeObject =
|
static mut TYPE_OBJECT: *mut $crate::ffi::PyTypeObject = ::std::ptr::null_mut();
|
||||||
$crate::std::ptr::null_mut();
|
|
||||||
|
|
||||||
unsafe {
|
unsafe {
|
||||||
if TYPE_OBJECT.is_null() {
|
if TYPE_OBJECT.is_null() {
|
||||||
|
|
|
@ -15,7 +15,6 @@ pub use self::sequence::PySequence;
|
||||||
pub use self::slice::{PySlice, PySliceIndices};
|
pub use self::slice::{PySlice, PySliceIndices};
|
||||||
pub use self::set::{PySet, PyFrozenSet};
|
pub use self::set::{PySet, PyFrozenSet};
|
||||||
pub use self::stringdata::PyStringData;
|
pub use self::stringdata::PyStringData;
|
||||||
pub use self::exc_impl::PyNativeException;
|
|
||||||
|
|
||||||
#[cfg(Py_3)]
|
#[cfg(Py_3)]
|
||||||
pub use self::string::{PyBytes, PyString};
|
pub use self::string::{PyBytes, PyString};
|
||||||
|
|
Loading…
Reference in a new issue