-
Notifications
You must be signed in to change notification settings - Fork 53
[deps]: Update Rust crate pyo3 to 0.24.0 [SECURITY] #1226
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
base: main
Are you sure you want to change the base?
Conversation
|
Great job, no security vulnerabilities found in this Pull Request |
Edited/Blocked NotificationRenovate will not automatically rebase this PR, because it does not recognize the last commit author and assumes somebody else may have edited the PR. You can manually request rebase by checking the rebase/retry box above. |
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #1226 +/- ##
=======================================
Coverage 10.17% 10.17%
=======================================
Files 19 19
Lines 1101 1101
=======================================
Hits 112 112
Misses 989 989 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This PR contains the following updates:
0.22.1
->0.24.0
GitHub Vulnerability Alerts
GHSA-pph8-gcv7-4qj5
PyString::from_object
took&str
arguments and forwarded them directly to the Python C API without checking for terminating nul bytes. This could lead the Python interpreter to read beyond the end of the&str
data and potentially leak contents of the out-of-bounds read (by raising a Python exception containing a copy of the data including the overflow).In PyO3 0.24.1 this function will now allocate a
CString
to guarantee a terminating nul bytes. PyO3 0.25 will likely offer an alternative API which takes&CStr
arguments.Release Notes
pyo3/pyo3 (pyo3)
v0.24.1
Compare Source
This release is a security fix for the
PyString::from_object
method, which passed&str
data to the Python C API without checking for a terminating nul byte. All historical PyO3 versions are affected, and we recommend you upgrade if you are usingPyString::from_object
. Thank you to @vthib for the report and @Dr-Emann for the fix. A RUSTSEC advisory will be published shortly.Aside from the security fix, this release contains a number of other non-breaking additions:
abi3-py313
feature to support compiling with the Python 3.13 stable ABI.PyAnyMethods::getattr_opt
to get optional attributes without paying the cost of a Python exception when the attribute in question does not exist.PyInt::new
.with_critical_section2
for locking two objects at the same time on the free-threaded build.Option<&str>
andOption<&T>
(whereT: PyClass
) function arguments no longer being permittedThere are also a few other small bug fixes for edge cases, mostly related to compile errors from PyO3's macro code.
Thank you to the following contributors for the improvements:
@bschoenmaeckers
@davidhewitt
@Dr-Emann
@emmagordon
@epontan
@Icxolu
@IvanIsCoding
@jelmer
@jonaspleyer
@ngoldbaum
@Owen-CH-Leung
@Tpt
@Trolldemorted
@XuehaiPan
v0.24.0
Compare Source
Packaging
target-lexicon
dependency to 0.13. #4822jiff
dependency to add conversions forjiff
datetime types. #4823inventory
version to 0.3.5. #4954Added
PyIterator::send
method to allow sending values into a python generator. #4746PyCallArgs
trait for passing arguments into the Python calling protocol. This enabled using a faster calling convention for certain types, improving performance. #4768#[pyo3(default = ...']
option for#[derive(FromPyObject)]
to set a default value for extracted fields of named structs. #4829#[pyo3(into_py_with = ...)]
option for#[derive(IntoPyObject, IntoPyObjectRef)]
. #4850PyThreadState_GetFrame
andPyFrame_GetBack
. #4866last
forBoundListIterator
,BoundTupleIterator
andBorrowedTupleIterator
. #4878Iterator::count()
forPyDict
,PyList
,PyTuple
&PySet
. #4878nth
,nth_back
,advance_by
andadvance_back_by
forBoundTupleIterator
#4897types.GenericAlias
aspyo3::types::PyGenericAlias
. #4917MutextExt
trait to help avoid deadlocks with the GIL while locking astd::sync::Mutex
. #4934#[pyo3(rename_all = "...")]
option for#[derive(FromPyObject)]
. #4941Changed
nth
,nth_back
,advance_by
andadvance_back_by
forBoundListIterator
. #4810DerefToPyAny
in blanket implementations ofFrom<Py<T>>
andFrom<Bound<'py, T>>
forPyObject
. #4593io::ErrorKind::IsADirectory
/NotADirectory
to the corresponding Python exception on Rust 1.83+. #4747PyAnyMethods::call
and friends now requirePyCallArgs
for their positional arguments. #4768PyObject_Vectorcall(Method)
on the stable abi on 3.12+. #4853#[pyo3(from_py_with = ...)]
now take a path rather than a string literal #4860PathBuf
&Path
into Pythonpathlib.Path
instead ofPyString
. #4925pthread_exit
trying to acquire the GIL when the interpreter is shutting down. This mimics the Python 3.14 behavior and avoids undefined behavior and crashes. #4874Removed
Deref
forPyAny
and other "native" types. #4593Fixed
PyIter_Send
to return aPySendResult
. #4746v0.23.5
Compare Source
Packaging
Fixed
__builtins__
to__globals__
in code executed byPython::py_run
(was removed in PyO3 0.23.0). #4921v0.23.4
Compare Source
Added
PyList::locked_for_each
, which uses a critical section to lock the list on the free-threaded build. #4789pyo3_build_config::add_python_framework_link_args
build script API to set rpath when using macOS system Python. #4833Changed
datetime.fold
to distinguish ambiguous datetimes when converting to and fromchrono::DateTime<Tz>
(rather than erroring). #4791Fixed
py.allow_threads
GIL-switch when attempting to access contents of aPyErr
which originated from Python (could lead to unintended deadlocks). #4766BoundDictIterator
on the free-threaded build. #4788BoundDictIterator
on the free-threaded build. #4788chrono::DateTime<Tz>
to-Python conversion whenTz
ischrono_tz::Tz
. #4790#[pyclass]
not being able to be namedProbe
. #4794abi3
feature is enabled. #4806abi3
feature is enabled. #4808r#box
inderive(FromPyObject)
. #4814#[pyclass]
enum variants with more than 12 fields. #4832v0.23.3
Compare Source
Packaging
python3-dll-a
dependency to 0.2.11. #4749Fixed
abi3
features enabled. #4733generate-import-lib
feature. #4749PYO3_CONFIG_FILE
would not reconfigure PyO3 for the new interpreter. #4758v0.23.2
Compare Source
Added
IntoPyObjectExt
trait. #4708Fixed
abi3
orabi3-pyxx
features are enabled. #4719ambiguous_associated_items
lint error in#[pyclass]
and#[derive(IntoPyObject)]
macros. #4725v0.23.1
Compare Source
Re-release of 0.23.0 with fixes to docs.rs build.
v0.23.0
Compare Source
Packaging
hashbrown
optional dependency to include version 0.15. #4604eyre
optional dependency to 0.6.8. #4617hashbrown
optional dependency to 0.14.5. #4617indexmap
optional dependency to 2.5.0. #4617num-complex
optional dependency to 0.4.6. #4617chrono-tz
optional dependency to 0.10. #4617Added
IntoPyObject
(fallible) conversion trait to convert from Rust to Python values. #4060#[pyclass(str="<format string>")]
option to generate__str__
based on aDisplay
implementation or format string. #4233PartialEq
forBound<'py, PyInt>
withu8
,u16
,u32
,u64
,u128
,usize
,i8
,i16
,i32
,i64
,i128
andisize
. #4317PartialEq<f64>
andPartialEq<f32>
forBound<'py, PyFloat>
. #4348as_super
andinto_super
methods forBound<T: PyClass>
. #4351PyCFunctionFast
andPyCFunctionFastWithKeywords
#4415PyMutex
on Python 3.13 and newer. #4421PyDict::locked_for_each
to iterate efficiently on freethreaded Python. #4439PyObject_GetOptionalAttr
,PyObject_GetOptionalAttrString
,PyObject_HasAttrWithError
,PyObject_HasAttrStringWithError
,Py_CONSTANT_*
constants,Py_GetConstant
,Py_GetConstantBorrowed
, andPyType_GetModuleByDef
on Python 3.13 and newer. #4447IntoPyObject
. #4495Borrowed::as_ptr
. #4520PyImport_AddModuleRef
. #4529PyAnyMethods::try_iter
. #4553pyo3::sync::with_critical_section
, a wrapper around the Python Critical Section API added in Python 3.13. #4587#[pymodule(gil_used = false)]
option to declare that a module supports the free-threaded build. #4588PyModule::gil_used
method to declare that a module supports the free-threaded build. #4588PyDateTime_CAPSULE_NAME
. #4634PyMappingProxy
type to represent themappingproxy
Python class. #4644PyList_Extend
andPyList_Clear
. #4667IntoPyObjectRef
. #4674pyo3::sync::OnceExt
andpyo3::sync::OnceLockExt
traits. #4676Changed
IntoPyObject
overIntoPy<Py<PyAny>>>
for#[pyfunction]
and#[pymethods]
return types. #4060#[pyclass]
and#[pyo3(..)]
attributes. #4243#[pymodule]
are automatically treated as submodules (noPyInit_
entrypoint is created). #4308PyAnyMethods::is_ellipsis
(Py::is_ellipsis
was deprecated in PyO3 0.20). #4322PyLong
in favor ofPyInt
. #4347IntoPyDict::into_py_dict_bound
toIntoPyDict::into_py_dict
. #4388PyModule::from_code
now expects&CStr
as arguments instead of&str
. #4404#[pyfunction]
s when compiling on abi3 for Python 3.10 and up. #4415Copy
andClone
fromPyObject
struct FFI definition. #4434Python::eval
andPython::run
now take a&CStr
instead of&str
. #4435IPowModulo
,PyClassAttributeDef
,PyGetterDef
,PyMethodDef
,PyMethodDefType
, andPySetterDef
from PyO3's public API. #4441IntoPyObject
impls forVec<u8>
,&[u8]
,[u8; N]
,Cow<[u8]>
andSmallVec<[u8; N]>
now convert into Pythonbytes
rather than alist
of integers. #4442IntoPyDict::into_py_dict
is now fallible due toIntoPyObject
migration. #4493abi3
feature will now override config files provided viaPYO3_BUILD_CONFIG
. #4497GILProtected
struct on free-threaded Python. #4504PyListMethods::get_item_unchecked
on free-threaded Python. #4539GILOnceCell::import
. #4542PyAnyMethods::iter
in favour ofPyAnyMethods::try_iter
. #4553#[pyclass]
macro now requires a types to beSync
. (Except for#[pyclass(unsendable)]
types). #4566PyList::new
andPyTuple::new
are now fallible due toIntoPyObject
migration. #4580PyErr::matches
is now fallible due toIntoPyObject
migration. #4595ToPyObject
in favour ofIntoPyObject
#4595PyWeakrefMethods::get_option
. #4597PyWeakrefMethods
trait. #4598PyNativeTypeInitializer
andPyObjectInit
from the PyO3 public API. #4611IntoPy
in favor ofIntoPyObject
#4618PyErr::take()
andPyErr::fetch()
on Python 3.11 and older. #4655IntoPy::type_output
toIntoPyObject::type_output
. #4657PyMapping::keys
,PyMapping::values
andPyMapping::items
toBound<'py, PyList>
instead ofBound<'py, PySequence>
. #4661IntoPyObject
by reference or by value together withClone
. This makesPy<T>
available as field type. #4694Removed
PyUnicode
in favour ofPyString
. #4370gil-refs
feature. #4378_Py_IMMORTAL_REFCNT
,_Py_IsImmortal
,_Py_TPFLAGS_STATIC_BUILTIN
,_Py_Dealloc
,_Py_IncRef
,_Py_DecRef
. #4447_Py_c_sum
,_Py_c_diff
,_Py_c_neg
,_Py_c_prod
,_Py_c_quot
,_Py_c_pow
,_Py_c_abs
. #4521_borrowed
methods ofPyWeakRef
andPyWeakRefProxy
. #4528_PyErr_ChainExceptions
. #4534Fixed
lib_dir
when cross-compiling. #4389Py_Is
for PyPy on 3.10 to call the function defined by PyPy. #4447#[cfg]
attributes for simple enum variants. #4509non_snake_case
method names inside#[pymethods]
generated code. #4567#[derive(FromPyObject)]
generic struct with trait bounds. #4645#[classmethod]
and#[staticmethod]
on magic methods. #4654unsafe_op_in_unsafe_fn
in generated macro code. #4674#[pyclass] enum
s with custom__eq__
implementation. #4692non_upper_case_globals
lint firing for generated__match_args__
on complex enums. #4705v0.22.6
: PyO3 0.22.6Compare Source
This release corrects the check for free-threaded Python introduced in PyO3 0.22.2 to prevent users accidentally installing PyO3 packages on Python 3.13t; PyO3 0.22 does not support free-threaded Python. (Stay tuned for the 0.23 release coming very soon!)
Thanks @minrk for the report and @davidhewitt for the fix!
v0.22.5
Compare Source
Fixed
__clear__
slot andclear
method generated code. #4619Configuration
📅 Schedule: Branch creation - "" (UTC), Automerge - At any time (no schedule defined).
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR was generated by Mend Renovate. View the repository job log.