Commit Graph

65 Commits

Author SHA1 Message Date
Adam Reichold c5f9001985
Remove deferred reference count increments and make the global reference pool optional (#4095)
* Add feature controlling the global reference pool to enable avoiding its overhead.

* Document reference-pool feature in the performance guide.

* Invert semantics of feature to disable reference pool so the new behaviour becomes opt-in

* Remove delayed reference count increments as we cannot prevent reference count errors as long as these are available

* Adjust tests to be compatible with disable-reference-pool feature

* Adjust tests to be compatible with py-clone feature

* Adjust the GIL benchmark to the updated reference pool semantics.

* Further extend and clarify the documentation of the py-clone and disable-reference-pool features

* Replace disable-reference-pool feature by pyo3_disable_reference_pool conditional compilation flag

Such a flag is harder to use and thereby also harder to abuse. This seems
appropriate as this is purely a performance-oriented change which show only be
enabled by leaf crates and brings with it additional highly implicit sources of
process aborts.

* Add pyo3_leak_on_drop_without_reference_pool to turn aborts into leaks when the global reference pool is disabled and the GIL is not held
2024-05-11 14:48:45 +00:00
Icxolu 70a7aa808d
deprecate the use of `PyCell` in favor of `Bound` and `Py` (#3916)
* deprecate the use of `PyCell` in favor of `Bound` and `Py`

* update `FromPyObject` for `T: PyClass + Clone` impl

* move `PyCell` deprecation to the `gil-refs` feature gate and add a migration note
2024-03-03 14:47:25 +00:00
Icxolu f3ddd023c9
convert `PyBuffer` to `Bound` API (#3836) 2024-02-14 22:10:59 +00:00
Icxolu e45fbe493c port `IntoPyDict` to `Bound` API 2024-02-10 15:47:26 +01:00
David Hewitt 87e0610b58 remove internal uses of `_Py_NewRef` 2024-01-27 12:07:46 +00:00
David Hewitt 7d486bb72a tests/common.rs -> src/tests/common.rs 2023-09-24 13:34:53 +01:00
David Hewitt 64adab1a76 add as_ptr and into_ptr inherent methods 2023-08-11 10:49:42 +01:00
Adam Reichold e85bfcc3bf Factor out UnraisableCapture helper type and use it to check that dropping unsendable elsewhere calls into sys.unraisablehook 2023-05-25 20:17:55 +02:00
David Hewitt 586fed2c4b send errors in `__releasebuffer__` to `sys.unraisablehook` 2023-01-19 19:10:06 +00:00
mejrs 984fdf57c7 Use Python:;with_gil in tests 2022-07-19 19:34:23 +02:00
mejrs 6f1cf1b662 Add more lints 2022-03-23 08:07:28 +01:00
David Hewitt f75579a489 python-3.11: support buffer API on abi3 2022-02-06 22:46:45 +00:00
David Hewitt cf965155f4 pymethods: support buffer protocol 2021-12-30 15:48:55 +00:00
David Hewitt 5cab5d4da3 misc: remove some more *const -> *mut pointer casts 2021-12-20 20:36:46 +00:00
David Hewitt 6433d884fc dev: remove self dev dependency 2021-12-08 07:48:58 +00:00
David Hewitt 03ba4a5597 ffi: use _Py_NewRef for clarity 2021-09-29 08:02:08 +01:00
kngwyu 9b88a452e2 Refactor tests to use shorter macros 2021-03-14 23:43:53 +09:00
Alex Gaynor ba1056006a Get all the tests building, everythign except doctests passes! 2020-09-16 08:42:22 -04:00
David Hewitt b9e95dc7c9 Implement std::error::Error for PyErr 2020-09-10 19:04:24 +01:00
David Hewitt 4ed9748b45 Rename exceptions to PyException etc; reintroduce deprecated ones 2020-07-18 06:02:57 +01:00
David Hewitt a9c7e12be0 Allow skipping the return type completely for `#[pyproto]` methods returning `()`. 2020-06-23 11:51:02 +01:00
kngwyu 688021315e Typed PyBuffer 2020-06-04 22:03:53 +09:00
kngwyu 6c652dff8c Merge branch 'master' into pycell 2020-02-25 20:15:17 +09:00
Andrew Whitehead ca6cb99a4b
Implement buffer release for PyBufferProtocol; change callback signatures to pass PyClassShell
Signed-off-by: Andrew Whitehead <cywolf@gmail.com>
2020-02-20 12:48:22 -08:00
ijl 2bb0d05a30 Drop support for python2 2019-03-29 12:37:26 +00:00
konstin 97189a16b9 Try fixing cargo fmt on travis ci 2019-03-24 17:19:15 +01:00
konstin f75f742c58 Fix CStr usages 2019-03-20 21:48:41 +01:00
Miles Granger 711155d7ad Update tests & docs with IntoPyDict::into_py_dict(py) 2019-03-20 20:04:00 +01:00
konstin 6cb098ee12 Replace py.init_[ref|mut] with Py[Ref|Mut]::new 2019-02-13 21:52:21 +01:00
konstin 1a489d2829 Make the init methods use a value instead of a function 2019-02-13 13:59:47 +01:00
konstin 9e53418aad Less feature(specialization) 2019-02-01 18:09:51 +01:00
konstin 936f0153e8 Migrate to rust 2018 2019-02-01 14:23:29 +01:00
konstin 57afb51604 Remove PyToken completely; Fixes #94 2018-11-12 14:42:21 +01:00
konstin fb2349b6ec Remove PyToken usages from tests 2018-11-12 14:41:29 +01:00
konstin 3a95d163ca New rustfmt version
You might need to upgrade to the latest nightly to get the same results
2018-09-28 23:34:57 +02:00
konstin 302c099a76 Big refactoring to shrink the prelude 2018-09-21 23:34:28 +02:00
konstin 771d59b913 Fix another bunch of clippy lints 2018-08-21 23:51:13 +02:00
konstin 991a8b94d2 More nightly fixes 2018-08-19 20:42:17 +02:00
konstin fe8a719ee1 Rustfmt all the things ✔️ 2018-07-30 23:05:10 +02:00
konstin d59bebcc38 Upgrade from proc_macro to use_extern_macros 2018-07-18 13:08:05 +02:00
konstin 4013d40897 Add `py` prefix to the proc macros and move them into the root module
This is important because `proc_macro_path_invoc` isn't going to be stabilized soon.
2018-07-08 23:33:48 +02:00
konstin 6645708e4f Get rid of #[py*] methods 2018-07-03 20:42:02 +02:00
konstin 80096ae143 rudtfmt the tests
With some careful refactoring alongside
2018-06-15 21:21:12 +02:00
konstin 3e8a36b297 Split up test_class into multiple files 2018-05-02 20:56:11 +02:00
konstin d0c42dfcc1 Fix compilation on nightly 2018-05-01 15:44:38 +02:00
messense 703883687a
Add features to tests 2017-09-19 20:03:03 +08:00
Nikolay Kim a120bbf15e Refactor implementation. Drop parameter from constructor 2017-07-26 01:11:00 -07:00
Nikolay Kim 98bdf63a4d use const_fn for type size and offset calculation 2017-07-21 09:48:48 -07:00
messense 39a78aa407
Use is_null() to check whether a ptr is null 2017-07-18 22:32:31 +08:00
Nikolay Kim 4daac50781 remove associated_consts feature 2017-07-14 03:17:57 -07:00