Skip to content

Commit ab430d4

Browse files
authored
Add PyTracebackObject struct definition (#5980)
* Add PyTracebackObject struct definition * Add traceback module to cpython mod.rs * news * fmt * Remove unnecessary whitespace in traceback.rs
1 parent 2c1358d commit ab430d4

3 files changed

Lines changed: 15 additions & 0 deletions

File tree

newsfragments/5980.added.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Add `PyTracebackObject` struct definition

pyo3-ffi/src/cpython/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ pub(crate) mod pythonrun;
4040
pub(crate) mod floatobject;
4141
pub(crate) mod pyframe;
4242
pub(crate) mod pyhash;
43+
pub(crate) mod traceback;
4344
pub(crate) mod tupleobject;
4445
pub(crate) mod unicodeobject;
4546
pub(crate) mod weakrefobject;
@@ -83,6 +84,7 @@ pub use self::pylifecycle::*;
8384
pub use self::pymem::*;
8485
pub use self::pystate::*;
8586
pub use self::pythonrun::*;
87+
pub use self::traceback::*;
8688
pub use self::tupleobject::*;
8789
pub use self::unicodeobject::*;
8890
#[cfg(not(any(PyPy, GraalPy)))]

pyo3-ffi/src/cpython/traceback.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
use crate::object::PyObject;
2+
use crate::PyFrameObject;
3+
use std::ffi::c_int;
4+
5+
#[repr(C)]
6+
pub struct PyTracebackObject {
7+
ob_base: PyObject,
8+
tb_next: *mut PyTracebackObject,
9+
tb_frame: *mut PyFrameObject,
10+
tb_lasti: c_int,
11+
tb_lineno: c_int,
12+
}

0 commit comments

Comments
 (0)