From 06b15862dcf86ae9cfce49dad42416ce194b516c Mon Sep 17 00:00:00 2001 From: David Hewitt <1939362+davidhewitt@users.noreply.github.com> Date: Fri, 9 Oct 2020 22:13:21 +0100 Subject: [PATCH 01/11] contributing.md: add note on benchmarking --- Contributing.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Contributing.md b/Contributing.md index d3ed21fb04b..c271d9fc11e 100644 --- a/Contributing.md +++ b/Contributing.md @@ -60,3 +60,13 @@ However, there will always be support for at least the last few Rust compiler ve If your PR needs to bump the minimum supported Rust version, this is acceptable with the following conditions: - Any changes which require a more recent version than what is [currently available on stable Red Hat Enterprise Linux](https://access.redhat.com/documentation/en-us/red_hat_developer_tools/1/) will be postponed. (This is to allow package managers to update support for newer `rustc` versions; RHEL was arbitrarily picked because their update policy is clear.) - You might be asked to do extra work to tidy up other parts of the PyO3 codebase which can use the compiler version bump :) + +## Benchmarking + +PyO3 has two sets of benchmarks for evaluating some aspects of its performance. The benchmark suite is currently very small - please feel welcome to open PRs with new benchmarks if you're interested in helping to expand it! + +First, there are Rust-based benchmarks located in the `benches` subdirectory. As long as you have a nightly rust compiler available on your system, you can run these benchmarks with: + + cargo +nightly bench + +Second, there is a Python-based benchmark contained in the `word-count` example. You can read more about it [here](examples/word-count#benchmark). From 23d9d259a7073915eb1d69f8659bd08c96056a00 Mon Sep 17 00:00:00 2001 From: David Hewitt <1939362+davidhewitt@users.noreply.github.com> Date: Sat, 10 Oct 2020 06:16:56 +0100 Subject: [PATCH 02/11] migration guide: tiny typo fix --- guide/src/migration.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/guide/src/migration.md b/guide/src/migration.md index 535bc97a32a..c1eb7a7b1ff 100644 --- a/guide/src/migration.md +++ b/guide/src/migration.md @@ -64,7 +64,7 @@ let err: PyErr = TypeError::py_err("error message"); After: -``` +```rust # use pyo3::{PyErr, PyResult, Python, type_object::PyTypeObject}; # use pyo3::exceptions::{PyBaseException, PyTypeError}; # Python::with_gil(|py| -> PyResult<()> { From f6644d51f379c39588e95e837b41c86d669674ee Mon Sep 17 00:00:00 2001 From: David Hewitt <1939362+davidhewitt@users.noreply.github.com> Date: Sat, 10 Oct 2020 06:37:15 +0100 Subject: [PATCH 03/11] Tweak doc for PyDowncastError --- src/err/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/err/mod.rs b/src/err/mod.rs index 724ce0caecf..294cbe9bcb8 100644 --- a/src/err/mod.rs +++ b/src/err/mod.rs @@ -40,7 +40,7 @@ unsafe impl Sync for PyErr {} /// Represents the result of a Python call. pub type PyResult = Result; -/// Marker type that indicates an error while downcasting +/// Error that indicates a failure to convert a PyAny to a more specific Python type. #[derive(Debug)] pub struct PyDowncastError<'a> { from: &'a PyAny, From bac1771de8044d8b7e7dd8cf180a4e492d95b276 Mon Sep 17 00:00:00 2001 From: David Hewitt <1939362+davidhewitt@users.noreply.github.com> Date: Sat, 10 Oct 2020 10:34:37 +0100 Subject: [PATCH 04/11] Update Python versions on CI --- .github/workflows/ci.yml | 4 ++-- Contributing.md | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cf73f8c34f9..4a347c0ff1e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -45,7 +45,7 @@ jobs: fail-fast: false # If one platform fails, allow the rest to keep testing. matrix: rust: [stable] - python-version: [3.5, 3.6, 3.7, 3.8, 3.9-dev, pypy3] + python-version: [3.5, 3.6, 3.7, 3.8, 3.9, pypy3] platform: [ { os: "macOS-latest", python-architecture: "x64", rust-target: "x86_64-apple-darwin" }, { os: "ubuntu-latest", python-architecture: "x64", rust-target: "x86_64-unknown-linux-gnu" }, @@ -59,7 +59,7 @@ jobs: include: # Test minimal supported Rust version - rust: 1.39.0 - python-version: 3.8 + python-version: 3.9 platform: { os: "ubuntu-latest", python-architecture: "x64", rust-target: "x86_64-unknown-linux-gnu" } msrv: "MSRV" diff --git a/Contributing.md b/Contributing.md index c271d9fc11e..a8cedffe125 100644 --- a/Contributing.md +++ b/Contributing.md @@ -49,7 +49,7 @@ Here are a few things to note when you are writing PRs. The PyO3 repo uses Github Actions. PRs are blocked from merging if CI is not successful. -Formatting, linting and tests are checked for all Rust and Python code. Tests run with all supported Python versions with the latest stable Rust compiler, as well as for Python 3.8 with the minimum supported Rust version. +Formatting, linting and tests are checked for all Rust and Python code. Tests run with all supported Python versions with the latest stable Rust compiler, as well as for Python 3.9 with the minimum supported Rust version. ### Minimum supported Rust version From f45242f0533971091706f3cdcd990eab293aea67 Mon Sep 17 00:00:00 2001 From: kngwyu Date: Mon, 12 Oct 2020 13:59:52 +0900 Subject: [PATCH 05/11] Move From<&T> for Py impl to pyobject_native_type_core --- src/types/mod.rs | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/src/types/mod.rs b/src/types/mod.rs index b3915a8f33f..3cccd86ec9a 100644 --- a/src/types/mod.rs +++ b/src/types/mod.rs @@ -72,15 +72,6 @@ macro_rules! pyobject_native_type_named ( unsafe { $crate::Py::from_borrowed_ptr(py, self.as_ptr()) } } } - - impl<$($type_param,)*> From<&'_ $name> for $crate::Py<$name> { - #[inline] - fn from(other: &$name) -> Self { - use $crate::AsPyPointer; - use $crate::PyNativeType; - unsafe { $crate::Py::from_borrowed_ptr(other.py(), other.as_ptr()) } - } - } }; ); @@ -97,6 +88,18 @@ macro_rules! pyobject_native_type_core { unsafe{&*(ob as *const $name as *const $crate::PyAny)} } } + + + // TODO: Rust>=1.40 allows this impl for rust-numpy. + // So we should move this to `named` or `convert` when we bump MSRV. + impl<$($type_param,)*> From<&'_ $name> for $crate::Py<$name> { + #[inline] + fn from(other: &$name) -> Self { + use $crate::AsPyPointer; + use $crate::PyNativeType; + unsafe { $crate::Py::from_borrowed_ptr(other.py(), other.as_ptr()) } + } + } } } From 1cecad884a2a8f4f4c981ab2d85659d8cd9efaa4 Mon Sep 17 00:00:00 2001 From: David Hewitt <1939362+davidhewitt@users.noreply.github.com> Date: Sat, 10 Oct 2020 08:59:33 +0100 Subject: [PATCH 06/11] Release 0.12.2 --- CHANGELOG.md | 12 ++++++------ Cargo.toml | 4 ++-- README.md | 4 ++-- pyo3-derive-backend/Cargo.toml | 2 +- pyo3cls/Cargo.toml | 4 ++-- src/lib.rs | 4 ++-- 6 files changed, 15 insertions(+), 15 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 52a4d7b23c1..83879dc2ebd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,16 +5,15 @@ PyO3 versions, please see the [migration guide](https://pyo3.rs/master/migration The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). -## [Unreleased] +## [0.12.2] - 2020-10-12 ### Added - Add support for keyword-only arguments without default values in `#[pyfunction]`. [#1209](https://github.com/PyO3/pyo3/pull/1209) -- Add a wrapper for `PyErr_CheckSignals()` as `Python::check_signals()`. [#1214](https://github.com/PyO3/pyo3/pull/1214) - -### Changed -- Fields of `PyMethodDef`, `PyGetterDef`, `PySetterDef`, and `PyClassAttributeDef` are now private. [#1169](https://github.com/PyO3/pyo3/pull/1169) +- Add `Python::check_signals()` as a safe a wrapper for `PyErr_CheckSignals()`. [#1214](https://github.com/PyO3/pyo3/pull/1214) ### Fixed - Fix invalid document for protocol methods. [#1169](https://github.com/PyO3/pyo3/pull/1169) +- Hide docs of PyO3 private implementation details in `pyo3::class::methods`. [#1169](https://github.com/PyO3/pyo3/pull/1169) +- Fix unnecessary rebuild on PATH changes when the python interpreter is provided by PYO3_PYTHON. [#1231](https://github.com/PyO3/pyo3/pull/1231) ## [0.12.1] - 2020-09-16 ### Fixed @@ -512,7 +511,8 @@ Yanked ### Added - Initial release -[Unreleased]: https://github.com/pyo3/pyo3/compare/v0.12.1...HEAD +[Unreleased]: https://github.com/pyo3/pyo3/compare/v0.12.2...HEAD +[0.12.2]: https://github.com/pyo3/pyo3/compare/v0.12.1...v0.12.2 [0.12.1]: https://github.com/pyo3/pyo3/compare/v0.12.0...v0.12.1 [0.12.0]: https://github.com/pyo3/pyo3/compare/v0.11.1...v0.12.0 [0.11.1]: https://github.com/pyo3/pyo3/compare/v0.11.0...v0.11.1 diff --git a/Cargo.toml b/Cargo.toml index fa32107d245..74d12c66b6c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pyo3" -version = "0.12.1" +version = "0.12.2" description = "Bindings to Python interpreter" authors = ["PyO3 Project and Contributors "] readme = "README.md" @@ -23,7 +23,7 @@ parking_lot = "0.11.0" num-bigint = { version = "0.3", optional = true } num-complex = { version = "0.3", optional = true } paste = { version = "1.0.1", optional = true } -pyo3cls = { path = "pyo3cls", version = "=0.12.1", optional = true } +pyo3cls = { path = "pyo3cls", version = "=0.12.2", optional = true } unindent = { version = "0.1.4", optional = true } hashbrown = { version = "0.9", optional = true } diff --git a/README.md b/README.md index e33f7614ff1..5a8eff9497f 100644 --- a/README.md +++ b/README.md @@ -48,7 +48,7 @@ name = "string_sum" crate-type = ["cdylib"] [dependencies.pyo3] -version = "0.12.1" +version = "0.12.2" features = ["extension-module"] ``` @@ -99,7 +99,7 @@ use it to run Python code, add `pyo3` to your `Cargo.toml` like this: ```toml [dependencies] -pyo3 = "0.12.1" +pyo3 = "0.12.2" ``` Example program displaying the value of `sys.version` and the current user name: diff --git a/pyo3-derive-backend/Cargo.toml b/pyo3-derive-backend/Cargo.toml index 80ef5d1f18d..d7f2949226c 100644 --- a/pyo3-derive-backend/Cargo.toml +++ b/pyo3-derive-backend/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pyo3-derive-backend" -version = "0.12.1" +version = "0.12.2" description = "Code generation for PyO3 package" authors = ["PyO3 Project and Contributors "] keywords = ["pyo3", "python", "cpython", "ffi"] diff --git a/pyo3cls/Cargo.toml b/pyo3cls/Cargo.toml index 40113998945..ece0719f4be 100644 --- a/pyo3cls/Cargo.toml +++ b/pyo3cls/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pyo3cls" -version = "0.12.1" +version = "0.12.2" description = "Proc macros for PyO3 package" authors = ["PyO3 Project and Contributors "] keywords = ["pyo3", "python", "cpython", "ffi"] @@ -16,4 +16,4 @@ proc-macro = true [dependencies] quote = "1" syn = { version = "1", features = ["full", "extra-traits"] } -pyo3-derive-backend = { path = "../pyo3-derive-backend", version = "=0.12.1" } +pyo3-derive-backend = { path = "../pyo3-derive-backend", version = "=0.12.2" } diff --git a/src/lib.rs b/src/lib.rs index f591ad236cc..4009887bbda 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -52,7 +52,7 @@ //! crate-type = ["cdylib"] //! //! [dependencies.pyo3] -//! version = "0.12.1" +//! version = "0.12.2" //! features = ["extension-module"] //! ``` //! @@ -109,7 +109,7 @@ //! //! ```toml //! [dependencies] -//! pyo3 = "0.12.1" +//! pyo3 = "0.12.2" //! ``` //! //! Example program displaying the value of `sys.version`: From 41cfa6b2e929b1c1ac98f35d31ba19ead784c14a Mon Sep 17 00:00:00 2001 From: kngwyu Date: Mon, 12 Oct 2020 23:02:59 +0900 Subject: [PATCH 07/11] Don't watch PYTHON_SYS_EXECUTABLE and PATH when unnecessary --- build.rs | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/build.rs b/build.rs index 0e2ce15fa2f..05d90f477d9 100644 --- a/build.rs +++ b/build.rs @@ -893,17 +893,20 @@ fn main() -> Result<()> { // TODO: Find out how we can set -undefined dynamic_lookup here (if this is possible) } - let env_vars = [ - "LD_LIBRARY_PATH", - "PATH", - "PYTHON_SYS_EXECUTABLE", - "PYO3_PYTHON", - "LIB", - ]; - - for var in env_vars.iter() { + for var in ["LIB", "LD_LIBRARY_PATH", "PYO3_PYTHON"].iter() { println!("cargo:rerun-if-env-changed={}", var); } + if env::var_os("PYO3_PYTHON").is_none() { + // When PYO3_PYTHON is not used, PYTHON_SYS_EXECUTABLE has the highest priority. + // Let's watch it. + println!("cargo:rerun-if-env-changed=PYTHON_SYS_EXECUTABLE"); + if env::var_os("PYTHON_SYS_EXECUTABLE").is_none() { + // When PYTHON_SYS_EXECUTABLE is also not used, then we use PATH. + // Let's watch this, too. + println!("cargo:rerun-if-env-changed=PATH"); + } + } + Ok(()) } From 7b3dd68bfbdf4c0212f4a92c223fdbba67278114 Mon Sep 17 00:00:00 2001 From: David Hewitt <1939362+davidhewitt@users.noreply.github.com> Date: Mon, 12 Oct 2020 14:51:45 +0100 Subject: [PATCH 08/11] Fix support for MSRV Co-authored-by: Alex Gaynor --- .github/workflows/ci.yml | 13 ++++++------- CHANGELOG.md | 4 ++++ Cargo.toml | 2 +- tests/test_compile_error.rs | 2 +- 4 files changed, 12 insertions(+), 9 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c0ff89e506c..2886d489c05 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -78,26 +78,25 @@ jobs: toolchain: ${{ matrix.rust }} target: ${{ matrix.platform.rust-target }} profile: minimal + default: true - if: matrix.platform.os == 'ubuntu-latest' name: Prepare LD_LIBRARY_PATH (Ubuntu only) - run: echo LD_LIBRARY_PATH=${pythonLocation}/lib > $GITHUB_ENV - - - run: rustup set default-host ${{ matrix.platform.rust-target }} + run: echo LD_LIBRARY_PATH=${pythonLocation}/lib >> $GITHUB_ENV - name: Build without default features - run: cargo build --no-default-features --verbose + run: cargo build --no-default-features --verbose --target ${{ matrix.platform.rust-target }} - name: Build with default features - run: cargo build --features "num-bigint num-complex" --verbose + run: cargo build --features "num-bigint num-complex" --verbose --target ${{ matrix.platform.rust-target }} # Run tests (except on PyPy, because no embedding API). - if: matrix.python-version != 'pypy3' name: Test - run: cargo test --features "num-bigint num-complex" + run: cargo test --features "num-bigint num-complex" --target ${{ matrix.platform.rust-target }} - name: Test proc-macro code - run: cargo test --manifest-path=pyo3-derive-backend/Cargo.toml + run: cargo test --manifest-path=pyo3-derive-backend/Cargo.toml --target ${{ matrix.platform.rust-target }} - name: Install python test dependencies run: | diff --git a/CHANGELOG.md b/CHANGELOG.md index 83879dc2ebd..7d59efef142 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,10 @@ PyO3 versions, please see the [migration guide](https://pyo3.rs/master/migration The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). +## [Unreleased] +### Fixed +- Fix support for Rust versions 1.39 to 1.44, broken by an incorrect internal update to paste 1.0 which was done in PyO3 0.12.2. [#1234](https://github.com/PyO3/pyo3/pull/1234) + ## [0.12.2] - 2020-10-12 ### Added - Add support for keyword-only arguments without default values in `#[pyfunction]`. [#1209](https://github.com/PyO3/pyo3/pull/1209) diff --git a/Cargo.toml b/Cargo.toml index 74d12c66b6c..e8a5b23b9d9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -22,7 +22,7 @@ libc = "0.2.62" parking_lot = "0.11.0" num-bigint = { version = "0.3", optional = true } num-complex = { version = "0.3", optional = true } -paste = { version = "1.0.1", optional = true } +paste = { version = "0.1.6", optional = true } pyo3cls = { path = "pyo3cls", version = "=0.12.2", optional = true } unindent = { version = "0.1.4", optional = true } hashbrown = { version = "0.9", optional = true } diff --git a/tests/test_compile_error.rs b/tests/test_compile_error.rs index 5d02b8e8991..3cf71bd0980 100644 --- a/tests/test_compile_error.rs +++ b/tests/test_compile_error.rs @@ -2,7 +2,6 @@ #[test] fn test_compile_errors() { let t = trybuild::TestCases::new(); - t.compile_fail("tests/ui/invalid_frompy_derive.rs"); t.compile_fail("tests/ui/invalid_macro_args.rs"); t.compile_fail("tests/ui/invalid_need_module_arg_position.rs"); t.compile_fail("tests/ui/invalid_property_args.rs"); @@ -23,6 +22,7 @@ fn test_compile_errors() { #[rustversion::since(1.46)] fn tests_rust_1_46(t: &trybuild::TestCases) { + t.compile_fail("tests/ui/invalid_frompy_derive.rs"); t.compile_fail("tests/ui/invalid_pymethod_receiver.rs"); t.compile_fail("tests/ui/invalid_result_conversion.rs"); t.compile_fail("tests/ui/missing_clone.rs"); From f855daf7e234299695f32715138f06f58250dad3 Mon Sep 17 00:00:00 2001 From: Alex Gaynor Date: Mon, 12 Oct 2020 16:19:34 -0400 Subject: [PATCH 09/11] Update environment setting for Github Actions API updates --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4a347c0ff1e..c0ff89e506c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -81,7 +81,7 @@ jobs: - if: matrix.platform.os == 'ubuntu-latest' name: Prepare LD_LIBRARY_PATH (Ubuntu only) - run: echo ::set-env name=LD_LIBRARY_PATH::${pythonLocation}/lib + run: echo LD_LIBRARY_PATH=${pythonLocation}/lib > $GITHUB_ENV - run: rustup set default-host ${{ matrix.platform.rust-target }} From 50603791856166f0c92fe090022063c18f0f9806 Mon Sep 17 00:00:00 2001 From: Alex Gaynor Date: Mon, 12 Oct 2020 18:11:38 -0400 Subject: [PATCH 10/11] Fix changelog --- CHANGELOG.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bc395b2d271..c05b6f6fe8d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,10 +6,6 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). ## [Unreleased] -### Fixed -- Fix support for Rust versions 1.39 to 1.44, broken by an incorrect internal update to paste 1.0 which was done in PyO3 0.12.2. [#1234](https://github.com/PyO3/pyo3/pull/1234) - -## [0.12.2] - 2020-10-12 ### Added - Add support for building for CPython limited API. This required a few minor changes to runtime behaviour of of pyo3 `#[pyclass]` types. See the migration guide for full details. [#1152](https://github.com/PyO3/pyo3/pull/1152) @@ -18,6 +14,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - `#[pyclass(subclass)]` is now required for subclassing from Rust (was previously just required for subclassing from Python). [#1152](https://github.com/PyO3/pyo3/pull/1152) ## [Unreleased] +### Fixed +- Fix support for Rust versions 1.39 to 1.44, broken by an incorrect internal update to paste 1.0 which was done in PyO3 0.12.2. [#1234](https://github.com/PyO3/pyo3/pull/1234) + +## [0.12.2] - 2020-10-12 ### Added - Add support for keyword-only arguments without default values in `#[pyfunction]`. [#1209](https://github.com/PyO3/pyo3/pull/1209) - Add `Python::check_signals()` as a safe a wrapper for `PyErr_CheckSignals()`. [#1214](https://github.com/PyO3/pyo3/pull/1214) From 2923b4dff14469e6e74fe9703c258433feb3f4c3 Mon Sep 17 00:00:00 2001 From: Alex Gaynor Date: Mon, 12 Oct 2020 18:19:50 -0400 Subject: [PATCH 11/11] Fix for MSRV --- src/pyclass.rs | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/src/pyclass.rs b/src/pyclass.rs index e7f68cd865c..c13f717592a 100644 --- a/src/pyclass.rs +++ b/src/pyclass.rs @@ -259,16 +259,18 @@ fn tp_init_additional(type_object: *mut ffi::PyTypeObject) { // Running this causes PyPy to segfault. #[cfg(all(not(PyPy), not(Py_3_10)))] - if T::DESCRIPTION != "\0" { - unsafe { - // Until CPython 3.10, tp_doc was treated specially for heap-types, - // and it removed the text_signature value from it. We go in after - // the fact and replace tp_doc with something that _does_ include - // the text_signature value! - ffi::PyObject_Free((*type_object).tp_doc as _); - let data = ffi::PyObject_Malloc(T::DESCRIPTION.len()); - data.copy_from(T::DESCRIPTION.as_ptr() as _, T::DESCRIPTION.len()); - (*type_object).tp_doc = data as _; + { + if T::DESCRIPTION != "\0" { + unsafe { + // Until CPython 3.10, tp_doc was treated specially for + // heap-types, and it removed the text_signature value from it. + // We go in after the fact and replace tp_doc with something + // that _does_ include the text_signature value! + ffi::PyObject_Free((*type_object).tp_doc as _); + let data = ffi::PyObject_Malloc(T::DESCRIPTION.len()); + data.copy_from(T::DESCRIPTION.as_ptr() as _, T::DESCRIPTION.len()); + (*type_object).tp_doc = data as _; + } } }