diff --git a/pyo3-ffi/src/abstract_.rs b/pyo3-ffi/src/abstract_.rs index 8f2b4831231..a1eb2366d43 100644 --- a/pyo3-ffi/src/abstract_.rs +++ b/pyo3-ffi/src/abstract_.rs @@ -54,21 +54,13 @@ extern "C" { ... ) -> *mut PyObject; - #[cfg(not(Py_3_13))] + #[cfg(PyPy)] #[cfg_attr(PyPy, link_name = "_PyPyObject_CallFunction_SizeT")] - pub fn _PyObject_CallFunction_SizeT( + pub(crate) fn _PyObject_CallFunction_SizeT( callable_object: *mut PyObject, format: *const c_char, ... ) -> *mut PyObject; - #[cfg(not(Py_3_13))] - #[cfg_attr(PyPy, link_name = "_PyPyObject_CallMethod_SizeT")] - pub fn _PyObject_CallMethod_SizeT( - o: *mut PyObject, - method: *const c_char, - format: *const c_char, - ... - ) -> *mut PyObject; #[cfg_attr(PyPy, link_name = "PyPyObject_CallFunctionObjArgs")] pub fn PyObject_CallFunctionObjArgs(callable: *mut PyObject, ...) -> *mut PyObject; diff --git a/pyo3-ffi/src/cpython/abstract_.rs b/pyo3-ffi/src/cpython/abstract_.rs index 53ef71e0710..a20bf19b190 100644 --- a/pyo3-ffi/src/cpython/abstract_.rs +++ b/pyo3-ffi/src/cpython/abstract_.rs @@ -14,17 +14,14 @@ use crate::{ #[cfg(Py_3_8)] use libc::size_t; -extern "C" { - #[cfg(all(Py_3_8, not(any(PyPy, GraalPy))))] - pub fn _PyStack_AsDict(values: *const *mut PyObject, kwnames: *mut PyObject) -> *mut PyObject; -} +// skipped private _PyStack_AsDict #[cfg(all(Py_3_8, not(any(PyPy, GraalPy))))] const _PY_FASTCALL_SMALL_STACK: size_t = 5; extern "C" { #[cfg(all(Py_3_8, not(PyPy)))] - pub fn _Py_CheckFunctionResult( + fn _Py_CheckFunctionResult( tstate: *mut PyThreadState, callable: *mut PyObject, result: *mut PyObject, @@ -32,7 +29,7 @@ extern "C" { ) -> *mut PyObject; #[cfg(all(Py_3_8, not(PyPy)))] - pub fn _PyObject_MakeTpCall( + fn _PyObject_MakeTpCall( tstate: *mut PyThreadState, callable: *mut PyObject, args: *const *mut PyObject, @@ -69,7 +66,7 @@ pub unsafe fn PyVectorcall_Function(callable: *mut PyObject) -> Option *mut PyObject; } -#[cfg(all(Py_3_8, not(any(PyPy, GraalPy))))] -#[inline(always)] -pub unsafe fn _PyObject_FastCallTstate( - tstate: *mut PyThreadState, - func: *mut PyObject, - args: *const *mut PyObject, - nargs: Py_ssize_t, -) -> *mut PyObject { - _PyObject_VectorcallTstate(tstate, func, args, nargs as size_t, std::ptr::null_mut()) -} - -#[cfg(all(Py_3_8, not(any(PyPy, GraalPy))))] -#[inline(always)] -pub unsafe fn _PyObject_FastCall( - func: *mut PyObject, - args: *const *mut PyObject, - nargs: Py_ssize_t, -) -> *mut PyObject { - _PyObject_FastCallTstate(PyThreadState_GET(), func, args, nargs) -} - -#[cfg(all(Py_3_8, not(PyPy)))] -#[inline(always)] -pub unsafe fn _PyObject_CallNoArg(func: *mut PyObject) -> *mut PyObject { - _PyObject_VectorcallTstate( - PyThreadState_GET(), - func, - std::ptr::null_mut(), - 0, - std::ptr::null_mut(), - ) -} - -extern "C" { - #[cfg(PyPy)] - #[link_name = "_PyPyObject_CallNoArg"] - pub fn _PyObject_CallNoArg(func: *mut PyObject) -> *mut PyObject; -} +// skipped private _PyObject_FastCallTstate +// skipped private _PyObject_FastCall +// skipped private _PyObject_CallNoArg #[cfg(all(Py_3_8, not(PyPy)))] #[inline(always)] @@ -290,14 +252,7 @@ pub const PY_ITERSEARCH_COUNT: c_int = 1; pub const PY_ITERSEARCH_INDEX: c_int = 2; pub const PY_ITERSEARCH_CONTAINS: c_int = 3; -extern "C" { - #[cfg(not(any(PyPy, GraalPy)))] - pub fn _PySequence_IterSearch( - seq: *mut PyObject, - obj: *mut PyObject, - operation: c_int, - ) -> Py_ssize_t; -} +// skipped private _PySequence_IterSearch // skipped _PyObject_RealIsInstance // skipped _PyObject_RealIsSubclass diff --git a/pyo3-ffi/src/cpython/bytesobject.rs b/pyo3-ffi/src/cpython/bytesobject.rs index 56344d35dd9..8acaaf270a6 100644 --- a/pyo3-ffi/src/cpython/bytesobject.rs +++ b/pyo3-ffi/src/cpython/bytesobject.rs @@ -1,8 +1,6 @@ use crate::object::*; -use crate::Py_ssize_t; #[cfg(not(Py_LIMITED_API))] use std::ffi::c_char; -use std::ffi::c_int; #[cfg(not(any(PyPy, GraalPy, Py_LIMITED_API)))] #[repr(C)] @@ -19,10 +17,7 @@ pub struct PyBytesObject { #[cfg(any(PyPy, GraalPy, Py_LIMITED_API))] opaque_struct!(pub PyBytesObject); -extern "C" { - #[cfg_attr(PyPy, link_name = "_PyPyBytes_Resize")] - pub fn _PyBytes_Resize(bytes: *mut *mut PyObject, newsize: Py_ssize_t) -> c_int; -} +// skipped private _PyBytes_Resize #[cfg(not(Py_LIMITED_API))] #[inline] diff --git a/pyo3-ffi/src/cpython/ceval.rs b/pyo3-ffi/src/cpython/ceval.rs index cbec47195ec..502f33b7e55 100644 --- a/pyo3-ffi/src/cpython/ceval.rs +++ b/pyo3-ffi/src/cpython/ceval.rs @@ -1,21 +1,13 @@ use crate::cpython::pystate::Py_tracefunc; -use crate::object::{freefunc, PyObject}; -use std::ffi::c_int; +use crate::object::PyObject; extern "C" { - // skipped non-limited _PyEval_CallTracing + // skipped private _PyEval_CallTracing - #[cfg(not(Py_3_11))] - pub fn _PyEval_EvalFrameDefault(arg1: *mut crate::PyFrameObject, exc: c_int) -> *mut PyObject; + // skipped private _PyEval_EvalFrameDefault - #[cfg(Py_3_11)] - pub fn _PyEval_EvalFrameDefault( - tstate: *mut crate::PyThreadState, - frame: *mut crate::_PyInterpreterFrame, - exc: c_int, - ) -> *mut crate::PyObject; + // skipped private _PyEval_RequestCodeExtraIndex - pub fn _PyEval_RequestCodeExtraIndex(func: freefunc) -> c_int; pub fn PyEval_SetProfile(trace_func: Option, arg1: *mut PyObject); pub fn PyEval_SetTrace(trace_func: Option, arg1: *mut PyObject); } diff --git a/pyo3-ffi/src/cpython/code.rs b/pyo3-ffi/src/cpython/code.rs index 3be303fb38a..ff655ba68c9 100644 --- a/pyo3-ffi/src/cpython/code.rs +++ b/pyo3-ffi/src/cpython/code.rs @@ -144,10 +144,7 @@ extern "C" { names: *mut PyObject, lnotab: *mut PyObject, ) -> *mut PyObject; - pub fn _PyCode_GetExtra( - code: *mut PyObject, - index: Py_ssize_t, - extra: *const *mut c_void, - ) -> c_int; - pub fn _PyCode_SetExtra(code: *mut PyObject, index: Py_ssize_t, extra: *mut c_void) -> c_int; + + // skipped private _Py_GetExtra + // skipped private _Py_SetExtra } diff --git a/pyo3-ffi/src/cpython/import.rs b/pyo3-ffi/src/cpython/import.rs index 3b9374f68e3..3fd63a03739 100644 --- a/pyo3-ffi/src/cpython/import.rs +++ b/pyo3-ffi/src/cpython/import.rs @@ -6,27 +6,14 @@ use std::ffi::{c_char, c_int}; // skipped PyInit__imp extern "C" { - pub fn _PyImport_IsInitialized(state: *mut PyInterpreterState) -> c_int; + // skipped private _PyImport_IsInitialized // skipped _PyImport_GetModuleId - pub fn _PyImport_SetModule(name: *mut PyObject, module: *mut PyObject) -> c_int; - pub fn _PyImport_SetModuleString(name: *const c_char, module: *mut PyObject) -> c_int; - pub fn _PyImport_AcquireLock(); - pub fn _PyImport_ReleaseLock() -> c_int; - #[cfg(not(Py_3_9))] - pub fn _PyImport_FindBuiltin(name: *const c_char, modules: *mut PyObject) -> *mut PyObject; - #[cfg(not(Py_3_11))] - pub fn _PyImport_FindExtensionObject(a: *mut PyObject, b: *mut PyObject) -> *mut PyObject; - pub fn _PyImport_FixupBuiltin( - module: *mut PyObject, - name: *const c_char, - modules: *mut PyObject, - ) -> c_int; - pub fn _PyImport_FixupExtensionObject( - a: *mut PyObject, - b: *mut PyObject, - c: *mut PyObject, - d: *mut PyObject, - ) -> c_int; + // skipped private _PyImport_SetModule + // skipped private _PyImport_SetModuleString + // skipped private _PyImport_AcquireLock + // skipped private _PyImport_ReleaseLock + // skipped private _PyImport_FixupBuiltin + // skipped private _PyImport_FixupExtensionObject } #[cfg(not(PyPy))] diff --git a/pyo3-ffi/src/cpython/initconfig.rs b/pyo3-ffi/src/cpython/initconfig.rs index 6b0ae2e5dec..8c8bad64ee0 100644 --- a/pyo3-ffi/src/cpython/initconfig.rs +++ b/pyo3-ffi/src/cpython/initconfig.rs @@ -6,7 +6,7 @@ use std::ffi::{c_char, c_int, c_ulong}; #[repr(C)] #[derive(Copy, Clone, Debug, PartialEq, Eq)] -pub enum _PyStatus_TYPE { +enum _PyStatus_TYPE { _PyStatus_TYPE_OK = 0, _PyStatus_TYPE_ERROR = 1, _PyStatus_TYPE_EXIT = 2, @@ -15,7 +15,7 @@ pub enum _PyStatus_TYPE { #[repr(C)] #[derive(Copy, Clone)] pub struct PyStatus { - pub _type: _PyStatus_TYPE, + _type: _PyStatus_TYPE, pub func: *const c_char, pub err_msg: *const c_char, pub exitcode: c_int, diff --git a/pyo3-ffi/src/cpython/objimpl.rs b/pyo3-ffi/src/cpython/objimpl.rs index 71087d28d2c..0275c966e65 100644 --- a/pyo3-ffi/src/cpython/objimpl.rs +++ b/pyo3-ffi/src/cpython/objimpl.rs @@ -10,11 +10,6 @@ use crate::object::*; // skipped _PyObject_SIZE // skipped _PyObject_VAR_SIZE -#[cfg(not(Py_3_11))] -extern "C" { - pub fn _Py_GetAllocatedBlocks() -> crate::Py_ssize_t; -} - #[cfg(not(any(PyPy, GraalPy)))] #[repr(C)] #[derive(Copy, Clone)] @@ -52,12 +47,6 @@ pub unsafe fn PyObject_IS_GC(o: *mut PyObject) -> c_int { }) as c_int } -#[cfg(not(Py_3_11))] -extern "C" { - pub fn _PyObject_GC_Malloc(size: size_t) -> *mut PyObject; - pub fn _PyObject_GC_Calloc(size: size_t) -> *mut PyObject; -} - #[inline] pub unsafe fn PyType_SUPPORTS_WEAKREFS(t: *mut PyTypeObject) -> c_int { ((*t).tp_weaklistoffset > 0) as c_int diff --git a/pyo3-ffi/src/cpython/pyframe.rs b/pyo3-ffi/src/cpython/pyframe.rs index 6da9ecd5b53..a6f3b54091f 100644 --- a/pyo3-ffi/src/cpython/pyframe.rs +++ b/pyo3-ffi/src/cpython/pyframe.rs @@ -6,9 +6,7 @@ use std::ffi::c_char; use std::ffi::c_int; use std::ptr::addr_of_mut; -// NB used in `_PyEval_EvalFrameDefault`, maybe we remove this too. -#[cfg(all(Py_3_11, not(PyPy)))] -opaque_struct!(pub _PyInterpreterFrame); +// skipped private _PyInterpreterFrame #[cfg_attr(windows, link(name = "pythonXY"))] extern "C" { diff --git a/pyo3-ffi/src/cpython/pythonrun.rs b/pyo3-ffi/src/cpython/pythonrun.rs index db3767cb60c..3e6560fc6ab 100644 --- a/pyo3-ffi/src/cpython/pythonrun.rs +++ b/pyo3-ffi/src/cpython/pythonrun.rs @@ -9,7 +9,7 @@ use std::ffi::{c_char, c_int}; extern "C" { pub fn PyRun_SimpleStringFlags(arg1: *const c_char, arg2: *mut PyCompilerFlags) -> c_int; - pub fn _PyRun_SimpleFileObject( + fn _PyRun_SimpleFileObject( fp: *mut FILE, filename: *mut PyObject, closeit: c_int, @@ -21,7 +21,7 @@ extern "C" { closeit: c_int, flags: *mut PyCompilerFlags, ) -> c_int; - pub fn _PyRun_AnyFileObject( + fn _PyRun_AnyFileObject( fp: *mut FILE, filename: *mut PyObject, closeit: c_int, @@ -48,7 +48,7 @@ extern "C" { filename: *const c_char, flags: *mut PyCompilerFlags, ) -> c_int; - pub fn _PyRun_InteractiveLoopObject( + fn _PyRun_InteractiveLoopObject( fp: *mut FILE, filename: *mut PyObject, flags: *mut PyCompilerFlags, diff --git a/pyo3-ffi/src/cpython/unicodeobject.rs b/pyo3-ffi/src/cpython/unicodeobject.rs index cf0ef54484e..cba8c9bfa62 100644 --- a/pyo3-ffi/src/cpython/unicodeobject.rs +++ b/pyo3-ffi/src/cpython/unicodeobject.rs @@ -460,7 +460,7 @@ pub struct PyUnicodeObject { extern "C" { #[cfg(not(any(PyPy, GraalPy)))] - pub fn _PyUnicode_CheckConsistency(op: *mut PyObject, check_content: c_int) -> c_int; + fn _PyUnicode_CheckConsistency(op: *mut PyObject, check_content: c_int) -> c_int; } // skipped PyUnicode_GET_SIZE @@ -538,9 +538,9 @@ pub unsafe fn PyUnicode_KIND(op: *mut PyObject) -> c_uint { (*(op as *mut PyASCIIObject)).kind() } -#[cfg(not(any(GraalPy, Py_3_14)))] +#[cfg(not(any(GraalPy, PyPy, Py_3_14)))] #[inline] -pub unsafe fn _PyUnicode_COMPACT_DATA(op: *mut PyObject) -> *mut c_void { +unsafe fn _PyUnicode_COMPACT_DATA(op: *mut PyObject) -> *mut c_void { if PyUnicode_IS_ASCII(op) != 0 { (op as *mut PyASCIIObject).offset(1) as *mut c_void } else { @@ -548,9 +548,9 @@ pub unsafe fn _PyUnicode_COMPACT_DATA(op: *mut PyObject) -> *mut c_void { } } -#[cfg(not(any(GraalPy, PyPy)))] +#[cfg(not(any(GraalPy, PyPy, Py_3_14)))] #[inline] -pub unsafe fn _PyUnicode_NONCOMPACT_DATA(op: *mut PyObject) -> *mut c_void { +unsafe fn _PyUnicode_NONCOMPACT_DATA(op: *mut PyObject) -> *mut c_void { debug_assert!(!(*(op as *mut PyUnicodeObject)).data.any.is_null()); (*(op as *mut PyUnicodeObject)).data.any @@ -628,7 +628,8 @@ extern "C" { #[cfg_attr(PyPy, link_name = "PyPyUnicode_New")] pub fn PyUnicode_New(size: Py_ssize_t, maxchar: Py_UCS4) -> *mut PyObject; #[cfg_attr(PyPy, link_name = "_PyPyUnicode_Ready")] - pub fn _PyUnicode_Ready(unicode: *mut PyObject) -> c_int; + #[cfg(not(any(Py_3_12, GraalPy)))] + fn _PyUnicode_Ready(unicode: *mut PyObject) -> c_int; // skipped _PyUnicode_Copy diff --git a/pyo3-ffi/src/datetime.rs b/pyo3-ffi/src/datetime.rs index dc3a8b32dec..e3a356eca5f 100644 --- a/pyo3-ffi/src/datetime.rs +++ b/pyo3-ffi/src/datetime.rs @@ -33,19 +33,10 @@ pub struct PyDateTime_Delta { pub microseconds: c_int, } -// skipped non-limited PyDateTime_TZInfo -// skipped non-limited _PyDateTime_BaseTZInfo +// skipped PyDateTime_TZInfo +// skipped private _PyDateTime_BaseTZInfo -#[cfg(not(any(PyPy, GraalPy)))] -#[repr(C)] -#[derive(Debug)] -/// Structure representing a `datetime.time` without a `tzinfo` member. -pub struct _PyDateTime_BaseTime { - pub ob_base: PyObject, - pub hashcode: Py_hash_t, - pub hastzinfo: c_char, - pub data: [c_uchar; _PyDateTime_TIME_DATASIZE], -} +// skipped private _PyDateTime_BaseTime #[repr(C)] #[derive(Debug)] @@ -79,16 +70,7 @@ pub struct PyDateTime_Date { pub data: [c_uchar; _PyDateTime_DATE_DATASIZE], } -#[cfg(not(any(PyPy, GraalPy)))] -#[repr(C)] -#[derive(Debug)] -/// Structure representing a `datetime.datetime` without a `tzinfo` member. -pub struct _PyDateTime_BaseDateTime { - pub ob_base: PyObject, - pub hashcode: Py_hash_t, - pub hastzinfo: c_char, - pub data: [c_uchar; _PyDateTime_DATETIME_DATASIZE], -} +// skipped private _PyDateTime_BaseDateTime #[repr(C)] #[derive(Debug)] @@ -469,7 +451,7 @@ pub unsafe fn PyDateTime_DELTA_GET_MICROSECONDS(o: *mut PyObject) -> c_int { #[cfg(PyPy)] extern "C" { - // skipped _PyDateTime_HAS_TZINFO (not in PyPy) + // skipped private _PyDateTime_HAS_TZINFO #[link_name = "PyPyDateTime_GET_YEAR"] pub fn PyDateTime_GET_YEAR(o: *mut PyObject) -> c_int; #[link_name = "PyPyDateTime_GET_MONTH"] diff --git a/pyo3-ffi/src/pyerrors.rs b/pyo3-ffi/src/pyerrors.rs index 557f314c7cb..47ec5b98e96 100644 --- a/pyo3-ffi/src/pyerrors.rs +++ b/pyo3-ffi/src/pyerrors.rs @@ -298,9 +298,25 @@ extern "C" { arg2: *mut PyObject, arg3: *mut PyObject, ) -> *mut PyObject; + #[cfg(PyPy)] #[cfg_attr(PyPy, link_name = "PyPyErr_BadInternalCall")] pub fn PyErr_BadInternalCall(); - pub fn _PyErr_BadInternalCall(filename: *const c_char, lineno: c_int); + #[cfg(not(PyPy))] + fn _PyErr_BadInternalCall(filename: *const c_char, lineno: c_int); +} + +#[inline] +#[cfg(not(PyPy))] +#[track_caller] +pub unsafe fn PyErr_BadInternalCall() { + let location = std::panic::Location::caller(); + // TODO: nightly API file_as_c_str could be used here + let filename = std::ffi::CString::new(location.file()).ok(); + let lineno = location.line().try_into().unwrap_or(0); + _PyErr_BadInternalCall(filename.as_deref().unwrap_or(c"").as_ptr(), lineno); +} + +extern "C" { #[cfg_attr(PyPy, link_name = "PyPyErr_NewException")] pub fn PyErr_NewException( name: *const c_char, @@ -316,6 +332,7 @@ extern "C" { ) -> *mut PyObject; #[cfg_attr(PyPy, link_name = "PyPyErr_WriteUnraisable")] pub fn PyErr_WriteUnraisable(arg1: *mut PyObject); + #[cfg_attr(PyPy, link_name = "PyPyErr_CheckSignals")] pub fn PyErr_CheckSignals() -> c_int; #[cfg_attr(PyPy, link_name = "PyPyErr_SetInterrupt")] @@ -323,12 +340,14 @@ extern "C" { #[cfg(Py_3_10)] #[cfg_attr(PyPy, link_name = "PyPyErr_SetInterruptEx")] pub fn PyErr_SetInterruptEx(signum: c_int); + #[cfg_attr(PyPy, link_name = "PyPyErr_SyntaxLocation")] pub fn PyErr_SyntaxLocation(filename: *const c_char, lineno: c_int); #[cfg_attr(PyPy, link_name = "PyPyErr_SyntaxLocationEx")] pub fn PyErr_SyntaxLocationEx(filename: *const c_char, lineno: c_int, col_offset: c_int); #[cfg_attr(PyPy, link_name = "PyPyErr_ProgramText")] pub fn PyErr_ProgramText(filename: *const c_char, lineno: c_int) -> *mut PyObject; + #[cfg(not(PyPy))] pub fn PyUnicodeDecodeError_Create( encoding: *const c_char, @@ -338,27 +357,38 @@ extern "C" { end: Py_ssize_t, reason: *const c_char, ) -> *mut PyObject; + pub fn PyUnicodeEncodeError_GetEncoding(arg1: *mut PyObject) -> *mut PyObject; pub fn PyUnicodeDecodeError_GetEncoding(arg1: *mut PyObject) -> *mut PyObject; + pub fn PyUnicodeEncodeError_GetObject(arg1: *mut PyObject) -> *mut PyObject; pub fn PyUnicodeDecodeError_GetObject(arg1: *mut PyObject) -> *mut PyObject; pub fn PyUnicodeTranslateError_GetObject(arg1: *mut PyObject) -> *mut PyObject; + pub fn PyUnicodeEncodeError_GetStart(arg1: *mut PyObject, arg2: *mut Py_ssize_t) -> c_int; pub fn PyUnicodeDecodeError_GetStart(arg1: *mut PyObject, arg2: *mut Py_ssize_t) -> c_int; pub fn PyUnicodeTranslateError_GetStart(arg1: *mut PyObject, arg2: *mut Py_ssize_t) -> c_int; + pub fn PyUnicodeEncodeError_SetStart(arg1: *mut PyObject, arg2: Py_ssize_t) -> c_int; pub fn PyUnicodeDecodeError_SetStart(arg1: *mut PyObject, arg2: Py_ssize_t) -> c_int; pub fn PyUnicodeTranslateError_SetStart(arg1: *mut PyObject, arg2: Py_ssize_t) -> c_int; + pub fn PyUnicodeEncodeError_GetEnd(arg1: *mut PyObject, arg2: *mut Py_ssize_t) -> c_int; pub fn PyUnicodeDecodeError_GetEnd(arg1: *mut PyObject, arg2: *mut Py_ssize_t) -> c_int; pub fn PyUnicodeTranslateError_GetEnd(arg1: *mut PyObject, arg2: *mut Py_ssize_t) -> c_int; + pub fn PyUnicodeEncodeError_SetEnd(arg1: *mut PyObject, arg2: Py_ssize_t) -> c_int; pub fn PyUnicodeDecodeError_SetEnd(arg1: *mut PyObject, arg2: Py_ssize_t) -> c_int; pub fn PyUnicodeTranslateError_SetEnd(arg1: *mut PyObject, arg2: Py_ssize_t) -> c_int; + pub fn PyUnicodeEncodeError_GetReason(arg1: *mut PyObject) -> *mut PyObject; pub fn PyUnicodeDecodeError_GetReason(arg1: *mut PyObject) -> *mut PyObject; pub fn PyUnicodeTranslateError_GetReason(arg1: *mut PyObject) -> *mut PyObject; + pub fn PyUnicodeEncodeError_SetReason(exc: *mut PyObject, reason: *const c_char) -> c_int; pub fn PyUnicodeDecodeError_SetReason(exc: *mut PyObject, reason: *const c_char) -> c_int; pub fn PyUnicodeTranslateError_SetReason(exc: *mut PyObject, reason: *const c_char) -> c_int; + + // skipped PyOS_snprintf + // skipped PyOS_vsnprintf } diff --git a/pyo3-ffi/src/pyhash.rs b/pyo3-ffi/src/pyhash.rs index 4fab07d00d4..f089e3a1bd1 100644 --- a/pyo3-ffi/src/pyhash.rs +++ b/pyo3-ffi/src/pyhash.rs @@ -3,7 +3,7 @@ use crate::pyport::{Py_hash_t, Py_ssize_t}; #[cfg(not(any(Py_LIMITED_API, PyPy)))] use std::ffi::c_void; -use std::ffi::{c_int, c_ulong}; +use std::ffi::c_int; extern "C" { // skipped non-limited _Py_HashDouble @@ -11,14 +11,12 @@ extern "C" { // skipped non-limited _Py_HashPointerRaw #[cfg(not(any(Py_LIMITED_API, PyPy)))] - pub fn _Py_HashBytes(src: *const c_void, len: Py_ssize_t) -> Py_hash_t; + pub(crate) fn _Py_HashBytes(src: *const c_void, len: Py_ssize_t) -> Py_hash_t; } -pub const _PyHASH_MULTIPLIER: c_ulong = 1000003; - -// skipped _PyHASH_BITS - -// skipped non-limited _Py_HashSecret_t +// skipped private _PyHASH_MULTIPLIER +// skipped private _PyHASH_BITS +// skipped private _Py_HashSecret_t // skipped Py_HASH_CUTOFF diff --git a/pyo3-ffi/src/setobject.rs b/pyo3-ffi/src/setobject.rs index 4c32952238c..43b5517cb16 100644 --- a/pyo3-ffi/src/setobject.rs +++ b/pyo3-ffi/src/setobject.rs @@ -41,18 +41,8 @@ pub unsafe fn PySet_GET_SIZE(so: *mut PyObject) -> Py_ssize_t { // skipped _PySet_Dummy -extern "C" { - #[cfg(not(Py_LIMITED_API))] - #[cfg_attr(PyPy, link_name = "_PyPySet_NextEntry")] - pub fn _PySet_NextEntry( - set: *mut PyObject, - pos: *mut Py_ssize_t, - key: *mut *mut PyObject, - hash: *mut super::Py_hash_t, - ) -> c_int; - - // skipped non-limited _PySet_Update -} +// skipped private _PySet_NextEntry +// skipped private _PySet_Update #[cfg_attr(windows, link(name = "pythonXY"))] extern "C" {