Merge #2772
2772: fix PyUnicodeDecodeError_Create r=davidhewitt a=mejrs Fixes https://github.com/PyO3/pyo3/issues/2770 Co-authored-by: mejrs <> Co-authored-by: David Hewitt <1939362+davidhewitt@users.noreply.github.com>
This commit is contained in:
commit
1598991a05
1
newsfragments/2772.fixed.md
Normal file
1
newsfragments/2772.fixed.md
Normal file
|
@ -0,0 +1 @@
|
|||
Fix `PyUnicodeDecodeError_Create` failing unconditionally with a TypeError on PyPy.
|
|
@ -85,18 +85,17 @@ pub unsafe fn PyUnicodeDecodeError_Create(
|
|||
length: Py_ssize_t,
|
||||
start: Py_ssize_t,
|
||||
end: Py_ssize_t,
|
||||
_reason: *const c_char,
|
||||
reason: *const c_char,
|
||||
) -> *mut PyObject {
|
||||
crate::PyObject_CallFunction(
|
||||
PyExc_UnicodeDecodeError,
|
||||
std::ffi::CStr::from_bytes_with_nul(b"sy#nns\0")
|
||||
.unwrap()
|
||||
.as_ptr(),
|
||||
b"sy#nns\0".as_ptr().cast::<c_char>(),
|
||||
encoding,
|
||||
object,
|
||||
length,
|
||||
start,
|
||||
end,
|
||||
reason,
|
||||
)
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue