-
Notifications
You must be signed in to change notification settings - Fork 676
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Remove function `PyTuple_ClearFreeList` from python 3.9 above * Move non-limited api into ffi/cpython/
- Loading branch information
Showing
4 changed files
with
49 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
use crate::ffi::object::*; | ||
#[cfg(not(PyPy))] | ||
use crate::ffi::pyport::Py_ssize_t; | ||
|
||
#[repr(C)] | ||
pub struct PyTupleObject { | ||
pub ob_base: PyVarObject, | ||
pub ob_item: [*mut PyObject; 1], | ||
} | ||
|
||
// skipped _PyTuple_Resize | ||
// skipped _PyTuple_MaybeUntrack | ||
|
||
/// Macro, trading safety for speed | ||
|
||
// skipped _PyTuple_CAST | ||
|
||
#[inline] | ||
#[cfg(not(PyPy))] | ||
pub unsafe fn PyTuple_GET_SIZE(op: *mut PyObject) -> Py_ssize_t { | ||
Py_SIZE(op) | ||
} | ||
|
||
#[inline] | ||
#[cfg(not(PyPy))] | ||
pub unsafe fn PyTuple_GET_ITEM(op: *mut PyObject, i: Py_ssize_t) -> *mut PyObject { | ||
*(*(op as *mut PyTupleObject)) | ||
.ob_item | ||
.as_ptr() | ||
.offset(i as isize) | ||
} | ||
|
||
/// Macro, *only* to be used to fill in brand new tuples | ||
#[inline] | ||
#[cfg(not(PyPy))] | ||
pub unsafe fn PyTuple_SET_ITEM(op: *mut PyObject, i: Py_ssize_t, v: *mut PyObject) { | ||
*(*(op as *mut PyTupleObject)) | ||
.ob_item | ||
.as_mut_ptr() | ||
.offset(i as isize) = v; | ||
} | ||
|
||
// skipped _PyTuple_DebugMallocStats |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters