Commit Graph

382 Commits

Author SHA1 Message Date
Paul Stemmet 338c71d0ad
src/impl_: add ff unsafe-allow-subinterpreters
Allow the subinterpreter safeguards to be disabled, so that applications
like Ceph's manager can continue to use pyo3 modules without soft
crashing.

Enabling this feature should be done with caution, as any storage of Py
objects in rust statics can lead to undefined behavior.

However, not all consumers of pyo3 use global state, and thus a subset
of them (such as python-bcrypt) are safe to use in subinterpreter
contexts.

References: https://github.com/bazaah/aur-ceph/issues/20
References: https://github.com/PyO3/pyo3/pull/2523
References: https://github.com/pyca/cryptography/issues/9016
References: https://github.com/PyO3/pyo3/discussions/2346#discussioncomment-3246505
References: https://github.com/PyO3/pyo3/discussions/2346#discussioncomment-2911159
References: https://github.com/PyO3/pyo3/issues/3451
Signed-off-by: Paul Stemmet <github@luxolus.com>
2024-03-16 16:12:25 +00:00
David Hewitt a22e4f6005 release: 0.20.3 2024-02-23 11:59:20 +00:00
David Hewitt 5f65a97bdc ci: workaround more aggressive nightly rust lints 2024-02-23 11:59:20 +00:00
David Hewitt 3447f0e77d fix `either` feature conditional compilation, again (#3834)
* fix `either` feature conditional compilation, again

* test feature powerset in CI

* install `rust-src` for feature powerset tests

* review: adamreichold feedback

* Fix one more case of redundant imports.

* just check feature powerset for now

---------

Co-authored-by: Adam Reichold <adam.reichold@t-online.de>
2024-02-23 11:59:20 +00:00
David Hewitt 5157a45b39 add maximum Python version check (#3821)
* add maximum Python version check

* restore dependency of `pyo3-macros-backend` on `pyo3-build-config`

* fix clippy-all noxfile job
2024-02-23 11:59:20 +00:00
Adam Reichold f7afb8157d Use portable-atomic for targets which lack 64-bit atomics used to check interpreter ID.
I chose to make the dependency mandatory instead of optional as portable-atomic
itself just forwards to the native atomics when they are available so making
that choice part of our build system is not really necessary. Personally, I was
unable to perceive any noticeable compile-time hit from adding it.
2024-02-23 11:59:20 +00:00
David Hewitt bcef18b988 release: 0.20.2 2024-01-03 13:20:28 +00:00
Adam Reichold fa6d60b77e Use a definite version specification when depending on pyo3-build-config.
We already do this for other internal pyo3-* dependencies and it seems prudent
to apply this to pyo3-build-config as well.
2024-01-03 13:14:34 +00:00
Adam Reichold 9120b35f35
Include the experimental-inspect feature for the docs.rs build thereby making it equivalent to a full build. 2024-01-02 18:55:13 +01:00
David Hewitt d3f034a80f release: 0.20.1 2023-12-30 21:20:06 +00:00
Alex Gaynor b84271140e Fixes #3645 -- added `abi3-py312` feature 2023-12-29 22:59:22 +00:00
Ivan Smirnov 2312270ec1 add conversion support for `either::Either` 2023-12-29 22:49:07 +00:00
David Hewitt bbc5404297 ci: move lints to new 1.74 cargo.toml tables 2023-12-29 22:46:39 +00:00
David Hewitt 8c272a6ef2 ci: tidy up some dev deps 2023-12-29 22:43:32 +00:00
Adam Reichold d468f570ae Align chrono dev and runtime dependency version specifications. 2023-12-29 22:40:02 +00:00
Orhun Parmaksız 826fa973b6 Set version of smallvec to 1.0 2023-12-29 22:39:53 +00:00
Orhun Parmaksız 427b2e9386 Add support for `SmallVec` in conversion traits (#3440) 2023-12-29 22:39:09 +00:00
David Hewitt c77deee18e release: 0.20.0 2023-10-11 14:39:19 +02:00
David Hewitt 9e089a5538 fix chrono deprecation warnings 2023-09-02 20:55:53 +01:00
DataTriny 3c3e9401a3 Dual-license 2023-08-15 23:39:45 +02:00
David Hewitt 284c42d840 release: 0.19.2 2023-08-01 07:29:04 +01:00
David Hewitt c2e8ba3c14 move benches to subdirectory 2023-07-30 07:36:47 +01:00
David Hewitt 7d357ad992 release: 0.19.1 2023-07-03 16:18:24 +01:00
David Hewitt 1d56cfef47
Merge pull request #3278 from davidhewitt/ffi-check-ci
decouple pyo3-ffi-check from MSRV
2023-06-28 08:10:54 +00:00
David Hewitt 48c16a6878 move pyo3-ffi-check into its own workspace 2023-06-27 22:54:10 +01:00
Adam Reichold b5a1ca058d Extended range of supported versions of `indexmap` optional dependency to include version 2. 2023-06-26 23:23:12 +02:00
Adam Reichold 71ed4e17c7
Merge pull request #3256 from PyO3/dependabot/cargo/unindent-0.2.1
Update unindent requirement from 0.1.4 to 0.2.1
2023-06-20 20:05:17 +00:00
dependabot[bot] 27549304ae
Update hashbrown requirement from >= 0.9, < 0.14 to >= 0.9, < 0.15
Updates the requirements on [hashbrown](https://github.com/rust-lang/hashbrown) to permit the latest version.
- [Changelog](https://github.com/rust-lang/hashbrown/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/hashbrown/compare/v0.9.0...v0.14.0)

---
updated-dependencies:
- dependency-name: hashbrown
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-06-19 20:58:37 +00:00
dependabot[bot] b222542229
Update unindent requirement from 0.1.4 to 0.2.1
Updates the requirements on [unindent](https://github.com/dtolnay/indoc) to permit the latest version.
- [Release notes](https://github.com/dtolnay/indoc/releases)
- [Commits](https://github.com/dtolnay/indoc/compare/0.1.4...0.2.1)

---
updated-dependencies:
- dependency-name: unindent
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-06-19 20:57:35 +00:00
dependabot[bot] da0f40332a
Update indoc requirement from 1.0.3 to 2.0.1
Updates the requirements on [indoc](https://github.com/dtolnay/indoc) to permit the latest version.
- [Release notes](https://github.com/dtolnay/indoc/releases)
- [Commits](https://github.com/dtolnay/indoc/compare/1.0.3...2.0.1)

---
updated-dependencies:
- dependency-name: indoc
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-06-13 07:40:16 +00:00
Adam Reichold 0d30bb7d3d Bump Rust edition to 2021 and make current Clippy happy. 2023-06-07 21:15:38 +02:00
bors[bot] 894b62fba7
Merge #3211
3211: Enable v2 resolver on the workspace to enable dropping PYO3_CI workaround r=davidhewitt a=adamreichold



Co-authored-by: Adam Reichold <adam.reichold@t-online.de>
2023-06-05 18:47:00 +00:00
Adam Reichold f6e1f26676 Enable v2 resolver on the workspace to enable dropping PYO3_CI workaround. 2023-06-05 18:54:35 +02:00
Adam Reichold b816d4d561 Drop the xtask helper as it is superseded by Nox.
While the xtask code base is better engineered than our slightly messy Nox
manifest, all functionality is available via Nox including some that is not
available via xtask. Finally, only the Nox sessions are used in the CI by now so
that xtask does not see regular automated usage.
2023-06-05 17:41:41 +02:00
bors[bot] e1f028f3e5
Merge #3209
3209: Remove the conditional compilation flags which are made redundant  by the MSRV bump r=davidhewitt a=adamreichold



Co-authored-by: Adam Reichold <adam.reichold@t-online.de>
2023-06-05 14:09:05 +00:00
Adam Reichold edf50eec17 Bump proptest which is possible after the MSRV bump. 2023-06-05 15:10:00 +02:00
Adam Reichold eb292711a7 Drop test indirection required only until Rust 1.54. 2023-06-05 12:43:15 +02:00
bors[bot] dbf7b233aa
Merge #3203
3203: support ordering magic methods for `#[pyclass]` r=adamreichold a=davidhewitt

Closes #2089 

This adds `__lt__`, `__le__`, `__eq__`, `__ne__`, `__gt__`, and `__ge__` as per the Python implementations of what we call `__richcmp__`.

There's a UI test confirming that the user cannot implement split forms and `__richcmp__` simultaneously.

There's also a benchmark comparing implementing these split methods against using `__richcmp__`. I couldn't see a meaningful performance difference, so I'm tempted to deprecate `__richcmp__`, given that's not a magic method which exists in Python. Potentially we can provide options such as the opt-in `#[pyclass(eq, ord)]` to avoid boilerplate for people who don't want to implement six different methods.



Co-authored-by: David Hewitt <1939362+davidhewitt@users.noreply.github.com>
2023-06-05 07:13:23 +00:00
Adam Reichold 5738edfdd4 Bump MSRV to 1.56 2023-06-04 23:02:30 +01:00
David Hewitt 8850d5d384 support ordering magic methods for `#[pyclass]` 2023-06-04 13:58:18 +01:00
David Hewitt 2500e22e13 release: 0.19.0 2023-05-31 13:53:37 +01:00
Adam Reichold f0b7399705 Add benchmark showing that extract::<i64> is costly due to PyNumber_Index trying hard. 2023-05-26 07:47:45 +02:00
Adam Reichold c34870cb73 Remove compiler UI tests from package distribution since they only work reliably using the current stable version Rust, e.g. in our CI. 2023-05-25 21:37:05 +02:00
est31 6fcc790f8b Update memoffset to 0.9 2023-05-21 09:56:55 +02:00
David Hewitt 941ee18d22 add benchmark for isinstance chain 2023-05-18 22:10:45 +01:00
David Hewitt dd24c9ea71 remove `Python::acquire_gil` 2023-05-09 09:39:23 +02:00
Doug Goldstein 8e0bde14c9 implement Decimal to rust_decimal conversions
Implement conversion between rust_decimal::Decimal and decimal.Decimal
from Python's stdlib. The C API does not appear to be exposed on the
Python side so we need to call into it via Python.
2023-04-22 19:55:21 +02:00
David Hewitt bfcc1f8c27 update release notes for 0.18.3 2023-04-13 22:47:55 +01:00
David Hewitt e7e58ba51e update release notes for 0.18.2 2023-03-24 20:40:06 +00:00
messense 2ac6006ec8
Disable default features of `chrono`
To avoid bringing `time` v0.1.x into dependency graph, see https://github.com/time-rs/time/issues/293
2023-02-09 21:27:31 +08:00