Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix SystemError raised from PyUnicodeDecodeError_Create on PyPy 3.10 #3297

Merged
merged 1 commit into from
Jul 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions newsfragments/3297.added.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add FFI definitions `_PyObject_CallFunction_SizeT` and `_PyObject_CallMethod_SizeT`.
1 change: 1 addition & 0 deletions newsfragments/3297.fixed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix `SystemError` raised in `PyUnicodeDecodeError_Create` on PyPy 3.10.
17 changes: 15 additions & 2 deletions pyo3-ffi/src/abstract_.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,21 @@ extern "C" {
...
) -> *mut PyObject;

// skipped _PyObject_CallFunction_SizeT
// skipped _PyObject_CallMethod_SizeT
#[cfg(not(Py_3_13))]
#[cfg_attr(PyPy, link_name = "_PyPyObject_CallFunction_SizeT")]
pub 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;
Expand Down
2 changes: 1 addition & 1 deletion pyo3-ffi/src/pyerrors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ pub unsafe fn PyUnicodeDecodeError_Create(
end: Py_ssize_t,
reason: *const c_char,
) -> *mut PyObject {
crate::PyObject_CallFunction(
crate::_PyObject_CallFunction_SizeT(
PyExc_UnicodeDecodeError,
b"sy#nns\0".as_ptr().cast::<c_char>(),
encoding,
Expand Down
Loading