-
Notifications
You must be signed in to change notification settings - Fork 909
Closed
Description
The following code panics due to a failed assertion when imported (e.g. with import repr_171)
#![feature(proc_macro, specialization)]
#[macro_use]
extern crate pyo3;
use pyo3::prelude::*;
use pyo3::py::modinit;
py_exception!(repr_171, JSONDecodeError);
#[modinit(repr_171)]
fn init_mod(py: Python, m: &PyModule) -> PyResult<()> {
m.add("JSONDecodeError", py.get_type::<JSONDecodeError>());
Ok(())
}Backtrace:
thread '<unnamed>' panicked at 'assertion failed: `(left != right)`
left: `0`,
right: `0`', /home/konsti/.cargo/registry/src/github.com-1ecc6299db9ec823/pyo3-0.2.7/src/pythonrun.rs:42:13
stack backtrace:
0: std::sys::unix::backtrace::tracing::imp::unwind_backtrace
at libstd/sys/unix/backtrace/tracing/gcc_s.rs:49
1: std::sys_common::backtrace::print
at libstd/sys_common/backtrace.rs:71
at libstd/sys_common/backtrace.rs:59
2: std::panicking::default_hook::{{closure}}
at libstd/panicking.rs:211
3: std::panicking::default_hook
at libstd/panicking.rs:227
4: std::panicking::rust_panic_with_hook
at libstd/panicking.rs:511
5: std::panicking::continue_panic_fmt
at libstd/panicking.rs:426
6: std::panicking::begin_panic_fmt
at libstd/panicking.rs:413
7: pyo3::pythonrun::prepare_freethreaded_python::{{closure}}
at /home/konsti/.cargo/registry/src/github.com-1ecc6299db9ec823/pyo3-0.2.7/src/pythonrun.rs:42
8: std::sync::once::Once::call_once::{{closure}}
at /checkout/src/libstd/sync/once.rs:228
9: std::sync::once::Once::call_inner
at libstd/sync/once.rs:341
10: std::sync::once::Once::call_once
at /checkout/src/libstd/sync/once.rs:228
11: pyo3::pythonrun::prepare_freethreaded_python
at /home/konsti/.cargo/registry/src/github.com-1ecc6299db9ec823/pyo3-0.2.7/src/pythonrun.rs:38
12: pyo3::pythonrun::GILGuard::acquire
at /home/konsti/.cargo/registry/src/github.com-1ecc6299db9ec823/pyo3-0.2.7/src/pythonrun.rs:257
13: pyo3::python::Python::acquire_gil
at /home/konsti/.cargo/registry/src/github.com-1ecc6299db9ec823/pyo3-0.2.7/src/python.rs:106
14: repr_171::init_mod::JSONDecodeError::type_object
at ./<py_exception macros>:18
15: <repr_171::init_mod::JSONDecodeError as pyo3::typeob::PyTypeObject>::type_object
at src/lib.rs:10
16: pyo3::python::Python::get_type
at /home/konsti/.cargo/registry/src/github.com-1ecc6299db9ec823/pyo3-0.2.7/src/python.rs:169
17: repr_171::init_mod
at src/lib.rs:10
18: PyInit_repr_171
at src/lib.rs:10
19: _PyImport_LoadDynamicModuleWithSpec
20: <unknown>
21: PyCFunction_Call
22: PyEval_EvalFrameEx
23: <unknown>
24: PyEval_EvalFrameEx
25: PyEval_EvalFrameEx
26: PyEval_EvalFrameEx
27: PyEval_EvalFrameEx
28: PyEval_EvalFrameEx
29: PyEval_EvalCodeEx
30: <unknown>
31: PyObject_Call
32: _PyObject_CallMethodIdObjArgs
33: PyImport_ImportModuleLevelObject
34: <unknown>
35: PyCFunction_Call
36: PyObject_Call
37: PyEval_CallObjectWithKeywords
38: PyEval_EvalFrameEx
39: <unknown>
40: PyEval_EvalCode
41: <unknown>
42: PyRun_FileExFlags
43: PyRun_SimpleFileExFlags
44: Py_Main
45: main
46: __libc_start_main
47: _start
fatal runtime error: failed to initiate panic, error 5
The panic is reproducible on linux with both python 3.5 and 3.6. This issue was discovered my @mre in #171.
Metadata
Metadata
Assignees
Labels
No labels