From 7c231a23728bb117deb62d6d27f3c275fad0ba58 Mon Sep 17 00:00:00 2001 From: David Hewitt <1939362+davidhewitt@users.noreply.github.com> Date: Thu, 25 Aug 2022 19:06:22 +0100 Subject: [PATCH 1/2] docs: mention PyBuffer --- guide/src/conversions/tables.md | 1 + src/buffer.rs | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/guide/src/conversions/tables.md b/guide/src/conversions/tables.md index 0b5d5973..38ed27c1 100644 --- a/guide/src/conversions/tables.md +++ b/guide/src/conversions/tables.md @@ -33,6 +33,7 @@ The table below contains the Python type and the corresponding function argument | `datetime.time` | - | `&PyTime` | | `datetime.tzinfo` | - | `&PyTzInfo` | | `datetime.timedelta` | - | `&PyDelta` | +| `collections.abc.Buffer` | - | `PyBuffer` | | `typing.Optional[T]` | `Option` | - | | `typing.Sequence[T]` | `Vec` | `&PySequence` | | `typing.Mapping[K, V]` | `HashMap`, `BTreeMap`, `hashbrown::HashMap`[^2], `indexmap::IndexMap`[^3] | `&PyMapping` | diff --git a/src/buffer.rs b/src/buffer.rs index f567176f..d3be9ee6 100644 --- a/src/buffer.rs +++ b/src/buffer.rs @@ -189,7 +189,7 @@ impl<'source, T: Element> FromPyObject<'source> for PyBuffer { } impl PyBuffer { - /// Get the underlying buffer from the specified python object. + /// Gets the underlying buffer from the specified python object. pub fn get(obj: &PyAny) -> PyResult> { // TODO: use nightly API Box::new_uninit() once stable let mut buf = Box::new(mem::MaybeUninit::uninit()); @@ -616,8 +616,10 @@ impl PyBuffer { } } - /// Release the buffer object, freeing the reference to the Python object + /// Releases the buffer object, freeing the reference to the Python object /// which owns the buffer. + /// + /// This will automatically be called on drop. pub fn release(self, _py: Python<'_>) { // First move self into a ManuallyDrop, so that PyBuffer::drop will // never be called. (It would acquire the GIL and call PyBuffer_Release From d29b8a487f1de324bf45a0c5d60e93a015bfa038 Mon Sep 17 00:00:00 2001 From: Adam Reichold Date: Tue, 9 May 2023 21:49:47 +0200 Subject: [PATCH 2/2] Pin web-sys, js-sys and wasm-bindgen to avoid syn 2.0 as it is incompatible with our MSRV. --- noxfile.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/noxfile.py b/noxfile.py index db75ac57..f068492d 100644 --- a/noxfile.py +++ b/noxfile.py @@ -452,6 +452,9 @@ def set_minimal_package_versions(session: nox.Session): "cxx": "1.0.92", "cxxbridge-macro": "1.0.92", "cxx-build": "1.0.92", + "web-sys": "0.3.61", + "js-sys": "0.3.61", + "wasm-bindgen": "0.2.84", "syn": "1.0.109", }