You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
introduce immutable_type option for pyclasses (PyO3#5101)
* introduce `immutable_type` option for pyclasses
* allow `immutable_type` from 3.10 on the unlimited api
* fix `is_abi3_before` check
---------
Co-authored-by: David Hewitt <[email protected]>
Copy file name to clipboardExpand all lines: guide/pyclass-parameters.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,6 +12,7 @@
12
12
| <spanstyle="white-space: pre">`frozen`</span> | Declares that your pyclass is immutable. It removes the borrow checker overhead when retrieving a shared reference to the Rust struct, but disables the ability to get a mutable reference. |
13
13
|`get_all`| Generates getters for all fields of the pyclass. |
14
14
|`hash`| Implements `__hash__` using the `Hash` implementation of the underlying Rust datatype. |
15
+
|`immutable_type`| Makes the type object immutable. Supported on 3.14+ with the `abi3` feature active, or 3.10+ otherwise. |
15
16
|`mapping`| Inform PyO3 that this class is a [`Mapping`][params-mapping], and so leave its implementation of sequence C-API slots empty. |
16
17
| <spanstyle="white-space: pre">`module = "module_name"`</span> | Python code will see the class as being defined in this module. Defaults to `builtins`. |
17
18
| <spanstyle="white-space: pre">`name = "python_name"`</span> | Sets the name that Python sees this class as. Defaults to the name of the Rust struct. |
0 commit comments