Commit Graph

6378 Commits

Author SHA1 Message Date
Alex Gaynor fe79f54817
feature gate deprecated APIs for `GILPool` (#4181) 2024-05-17 11:31:52 +00:00
Bruno Kolenbrander fff053bde7
Emit a better error for abi3 inheritance (#4185)
* Emit a better error for abi3 inheritance

* Update tests/test_compile_error.rs

---------

Co-authored-by: David Hewitt <mail@davidhewitt.dev>
2024-05-17 10:55:41 +00:00
Alex Gaynor 1c64a03ea0
Move GIL counting from GILPool to GILGuard (#4188) 2024-05-17 04:25:41 +00:00
newcomertv 88f2f6f4d5
feat: support pyclass on tuple enums (#4072)
* feat: support pyclass on tuple enums

* cargo fmt

* changelog

* ruff format

* rebase with adaptation for FnArg refactor

* fix class.md from pr comments

* add enum tuple variant getitem implementation

* fmt

* progress toward getitem and len impl on derive pyclass for complex enum tuple

* working getitem and len slots for complex tuple enum pyclass derivation

* refactor code generation

* address PR concerns
- take py from function argument on get_item
- make more general slot def implementation
- remove unnecessary function arguments
- add testcases for uncovered cases including future feature match_args

* add tracking issue

* fmt

* ruff

* remove me

* support match_args for tuple enum

* integrate FnArg now takes Cow

* fix empty and single element tuples

* use impl_py_slot_def for cimplex tuple enum slots

* reverse erroneous doc change

* Address latest comments

* formatting suggestion

* fix :
- clippy beta
- better compile error (+related doc and test)

---------

Co-authored-by: Chris Arderne <chris@translucent.app>
2024-05-17 02:59:00 +00:00
Alex Gaynor 8de1787580
Change `GILGuard` to be able to represent a GIL that was already held (#4187)
See #4181
2024-05-16 21:55:05 +00:00
David Hewitt 7790dab480
emit rustc-check-cfg only on rust 1.80+ (#4168) 2024-05-15 11:11:49 +00:00
Icxolu 10152a7078
feature gate `PyCell` (#4177)
* feature gate `PyCell`

* feature gate `HasPyGilRef` completely

* bump version
2024-05-12 18:30:08 +00:00
Alex Gaynor 57500d9b09
Updates comments regarding the reference pool that were inaccurate (#4176) 2024-05-11 16:48:38 +00:00
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 033caa8fd1
split more impl blocks (#4175) 2024-05-11 13:48:17 +00:00
Icxolu 444be3bafa
feature gate deprecated APIs for `Python` (#4173) 2024-05-10 18:28:30 +00:00
Icxolu 1e8e09dce3
feature gate `as/into_gil_ref` APIs (Part 3) (#4172) 2024-05-10 17:03:57 +00:00
Icxolu aef0a05719
deprecate implicit default for trailing optional arguments (#4078)
* deprecate "trailing optional arguments" implicit default behaviour

* add newsfragment

* generate individual deprecation messages per function

* add migration guide entry
2024-05-10 10:34:58 +00:00
Alex Gaynor 104328ce14
feature gate deprecated more APIs for `Py` (#4169) 2024-05-10 05:54:08 +00:00
David Hewitt f3c7b90def
remove function pointer wrappers no longer needed for MSRV (#4167) 2024-05-09 22:22:17 +00:00
Icxolu 21c02484d0
feature gate APIs using `into_gil_ref` (Part 2) (#4166) 2024-05-09 22:21:48 +00:00
Icxolu 7beb64a8ca
allow constructor customization of complex enum variants (#4158)
* allow `#[pyo3(signature = ...)]` on complex enum variants to specify constructor signature

* rename keyword to `constructor`

* review feedback

* add docs in guide

* add newsfragment
2024-05-09 21:08:23 +00:00
David Matos 2d19b7e2a7
Add `num-rational` support for Python's `fractions.Fraction` type (#4148)
* Add `num-rational` support for Python's `fractions.Fraction` type

* Add newsfragment

* Use Bound instead

* Handle objs which atts are incorrect

* Add extra test

* Add tests for wasm32 arch

* add type for wasm32 clipppy
2024-05-09 15:37:53 +00:00
Icxolu 635cb8075c
feature gate APIs using `into_gil_ref` (Part 1) (#4160) 2024-05-09 07:58:44 +00:00
Icxolu d803f7f8df
store the `FnArg` ident as a `Cow` instead of a reference (#4157)
This allow also storing idents that were generated
as part of the macro instead of only ones the were
present in the source code. This is needed for
example in complex enum tuple variants.
2024-05-08 08:04:42 +00:00
Icxolu 72be1cddba
emit `cargo:rustc-check-cfg=CHECK_CFG` for `pyo3`s config names (#4163) 2024-05-08 05:46:00 +00:00
Icxolu 7263fa92ef
feature gate deprecated APIs for `PyBool` (#4159) 2024-05-04 17:45:27 +00:00
deedy5 ef13bc66e9
Add `pyreqwest_impersonate` to example projects (#4123) 2024-05-04 07:48:15 +00:00
Icxolu e835ff0ec3
handle `#[pyo3(from_py_with = ...)]` on dunder (`__magic__`) methods (#4117)
* handle `#[pyo3(from_py_with = ...)]` on dunder (__magic__) methods

* add newsfragment
2024-05-04 07:39:40 +00:00
Heran Lin c10c7429d8
docs: Remove out-dated information for pyenv (#4138) 2024-05-04 07:32:27 +00:00
Alex Gaynor d1a0c7278f
feature gate deprecated APIs for `PyCFunction` (#4154) 2024-05-03 19:50:38 +00:00
Icxolu c08f6c77a6
feature gate deprecated APIs for `marshal` (#4149) 2024-05-03 18:15:25 +00:00
Alex Gaynor f3ab62cb7e
feature gate deprecated APIs for `PyModule` (#4151) 2024-05-03 17:10:49 +00:00
Alex Gaynor 93cfb51ebb
feature gate deprecated APIs for `PyMemoryView` (#4152) 2024-05-03 16:02:19 +00:00
Icxolu 7cbb85476c
fix `check-guide` ci workflow (#4146) 2024-05-03 10:17:14 +00:00
Icxolu cd3f3ed67c
ci: updates for Rust 1.78 (#4150)
* ci: updates for Rust 1.78

* ci: fix clippy

* restrict `invalid_pymethods_duplicates` to unlimited api with `full`
2024-05-03 07:42:30 +00:00
Icxolu 9a808c35c6
fix `clippy-beta` ci workflow (#4147) 2024-05-01 19:05:51 +00:00
Icxolu a454f6e9cc
feature gate deprecated APIs for `PyFloat` and `PyComplex` (#4145) 2024-05-01 17:13:49 +00:00
Alex Gaynor 5534a7bee8
feature gate deprecated APIs for `PyBuffer` (#4144) 2024-05-01 12:18:12 +00:00
Icxolu dc9a41521a
feature gate deprecated APIs for `Py` (#4142) 2024-05-01 10:57:03 +00:00
Alex Gaynor 261d27d197
feature gate deprecated APIs for `PySlice` (#4141) 2024-04-30 23:55:43 +00:00
Icxolu 2f3a33fda1
feature gate deprecated APIs for `PyList` (#4127) 2024-04-30 22:00:31 +00:00
Icxolu 82c00a2fe4
port `PyAny` tests to `Bound` API (#4140) 2024-04-30 21:49:00 +00:00
Icxolu 4616838ee1
port `PySequence` tests to `Bound` API (#4139) 2024-04-30 18:53:40 +00:00
Icxolu 22c5cff039
feature gate deprecated APIs for `PyErr` and exceptions (#4136) 2024-04-30 16:58:53 +00:00
Icxolu d5452bcd8d
feature gate deprecated APIs for `PyType`, `PyTypeInfo` and `PySuper` (#4134) 2024-04-28 21:03:51 +00:00
Alex Gaynor 9e1960ea34
Update MSRV to 1.63 (#4129)
* Bump MSRV to 1.63

* Drop parking_lot in favor of std::sync

* Make portable-atomic dep conditional

* Remove no longer required cfg
2024-04-28 16:11:28 +00:00
Icxolu 6fb972b232
feature gate deprecated APIs for `PyEllipsis`, `PyNone` and `PyNotImplemented` (#4132) 2024-04-27 15:34:13 +00:00
Icxolu 059c8b3862
feature gate deprecated APIs for `PyBytes` and `PyPyByteArray` (#4131) 2024-04-27 11:34:27 +00:00
Alex Gaynor 8ff5e5b0ab
Fix lychee for guide (#4130)
* Fix lychee for guide

* Update nightly in netlify
2024-04-27 05:12:11 +00:00
David Matos c66ed292ec
Disable PyUnicode_DATA on PyPy (#4116)
* Disable PYUNICODE_DATA on PyPy

* Add newsfragment

* Adjust import on PyString
2024-04-26 06:00:13 +00:00
Icxolu 8734b76f60
feature gate deprecated APIs for `PyIterator` (#4119) 2024-04-25 17:44:42 +00:00
Alexander Clausen 3cb286e0d2
docs: fix typo in trait-bounds.md (#4124) 2024-04-25 15:36:29 +00:00
Icxolu 6c2e6f8bcc
feature gate deprecated APIs for `PyFrozenSet` (#4118) 2024-04-24 21:13:27 +00:00
Icxolu c951bf86de
feature gate deprecated APIs for `PyCapsule` (#4112) 2024-04-24 17:34:19 +00:00