Commit Graph

6167 Commits

Author SHA1 Message Date
David Hewitt 1004ffa7d6 export `Bound` and `Borrowed` from lib.rs 2023-12-24 19:35:50 +00:00
David Hewitt 877e34ac86 implement `PyErr::write_unraisable_bound` 2023-12-24 19:35:29 +00:00
David Hewitt 214ed29bbb
Merge pull request #3699 from davidhewitt/tzinfo
partially revert changes to `PyTzInfoAccess` trait
2023-12-24 15:25:45 +00:00
David Hewitt f5b18468bc partially revert changes to `PyTzInfoAccess` trait 2023-12-24 15:07:42 +00:00
Adam Reichold 7d245842d4
Merge pull request #3669 from davidhewitt/gevent
add test which is broken with gevent
2023-12-24 09:25:29 +00:00
David Hewitt 49d7718823 demonstrate switching to `Bound` API resolves `gevent` crash 2023-12-23 22:10:01 +00:00
David Hewitt 46fa1b2b80 add test which is broken with gevent 2023-12-23 22:07:48 +00:00
Adam Reichold e99058a442
Merge pull request #3679 from davidhewitt/datetime2
implement datetime traits for `Bound`
2023-12-23 14:54:30 +00:00
David Hewitt 6832bf88f2 implement datetime traits for Py2 2023-12-23 15:34:07 +01:00
Adam Reichold 8bef6e3398
Merge pull request #3689 from PyO3/unsendable-threadsafe-traverse
Turn calls of __traverse__ into no-ops for unsendable pyclass if on the wrong thread
2023-12-23 14:13:46 +00:00
Adam Reichold 4dc6c1643e Turn calls of __traverse__ into no-ops for unsendable pyclass if on the wrong thread
Adds a "threadsafe" variant of `PyCell::try_borrow` which will fail instead of
panicking if called on the wrong thread and use it in `call_traverse` to turn GC
traversals of unsendable pyclasses into no-ops if on the wrong thread.

This can imply leaking the underlying resource if the originator thread has
already exited so that the GC will never run there again, but it does avoid hard
aborts as we cannot raise an exception from within `call_traverse`.
2023-12-23 15:01:08 +01:00
David Hewitt 65f25d4133
Merge pull request #3690 from PyO3/check-signal-docs
Copy note on using check_signals on non-main thread/interpreter from Python docs.
2023-12-22 22:50:22 +00:00
Adam Reichold e58b251fef Copy note on using check_signals on non-main thread/interpreter from Python docs. 2023-12-22 12:08:37 +01:00
Adam Reichold a115877bba
Merge pull request #3686 from davidhewitt/bound
make Bound and Borrowed types public API
2023-12-21 16:25:01 +00:00
Adam Reichold 1fa47b0409
Merge pull request #3687 from alex/abi3-py312
added `abi3-py312` feature
2023-12-21 16:05:34 +00:00
David Hewitt 4ac6a6bf15 add safety note to `downcast_into_unchecked` 2023-12-21 15:51:56 +00:00
Alex Gaynor d92792f8ad Fixes #3645 -- added `abi3-py312` feature 2023-12-21 10:40:14 -05:00
David Hewitt 3092289020 expose `BoundDictIterator` and `BoundListIterator` 2023-12-21 13:09:22 +00:00
David Hewitt e8e6fb93d7 Add `Py::bind`, `Py::into_bound`, and `Py::bind_borrowed` 2023-12-21 13:03:59 +00:00
David Hewitt 0f242c399d make `DowncastError` and `DowncastIntoError` public 2023-12-21 13:03:59 +00:00
David Hewitt c08c6c0a41 make new downcast errors public API 2023-12-21 12:28:12 +00:00
David Hewitt a09b9f8834 make `Bound` and `Borrowed` types public API 2023-12-21 12:20:33 +00:00
David Hewitt 704e9fc7b5 `Py2` -> `Bound` 2023-12-21 12:04:45 +00:00
David Hewitt 2f080f4075 `Py2Borrowed` -> `Borrowed` 2023-12-21 12:02:56 +00:00
David Hewitt 2788f4a110
Merge pull request #3680 from davidhewitt/list2
implement `PyListMethods`
2023-12-21 11:13:04 +00:00
Adam Reichold 5b12cf1b8a
Merge pull request #3683 from PyO3/use-type-ref-helper
Some boy scouting w.r.t. usage of our internal helper functions when handling collection ABC
2023-12-21 10:46:56 +00:00
David Hewitt ee1272ed76 implement `Copy` for `Py2Borrowed` 2023-12-21 10:44:39 +00:00
David Hewitt de82e2d6e2 add `Py2Borrowed::to_owned` 2023-12-21 10:44:39 +00:00
David Hewitt 337e48328f implement `PyListMethods` 2023-12-21 10:44:37 +00:00
Adam Reichold 3c97167fd1 Use write_unraisable to report errors loading type objects for ABC checks. 2023-12-21 11:33:26 +01:00
Adam Reichold c1f4db0a9b Increase use of common get_or_try_init_type_ref helper when caching type objects. 2023-12-21 11:33:25 +01:00
Adam Reichold 7f626b26d4
Merge pull request #3678 from davidhewitt/mapping2
implement `PyMappingMethods`
2023-12-21 09:47:35 +00:00
David Hewitt 43827e39ee
Merge pull request #3677 from davidhewitt/string2
implement `PyStringMethods`
2023-12-20 22:04:23 +00:00
David Hewitt f4f3169cad implement `PyStringMethods` 2023-12-20 16:19:18 +00:00
David Hewitt 8bd2972201
Merge pull request #3675 from davidhewitt/dict2-try2
implement `PyDictMethods`
2023-12-20 14:59:15 +00:00
David Hewitt 8e7c90733d implement `PyMappingMethods` 2023-12-20 14:39:40 +00:00
David Hewitt 15d309eb1f implement `PyDictMethods` 2023-12-20 14:18:45 +00:00
Adam Reichold fd2fc983b1
Merge pull request #3676 from davidhewitt/any-iter
tidy up some Py2 <-> gil-ref conversions
2023-12-20 13:31:15 +00:00
Adam Reichold 1b3dc6d7ac
Merge pull request #3661 from PyO3/iter-output-type
Replace (A)IterNextOutput by autoref-based specialization to allow returning arbitrary value
2023-12-20 12:53:42 +00:00
David Hewitt 5181e35a61 tidy up some Py2 <-> gil-ref conversions 2023-12-20 12:50:15 +00:00
Adam Reichold 5528895f3e Relax the error type in the Result<Option<T>, E>> specializations for __(a)next__. 2023-12-20 13:12:16 +01:00
Adam Reichold a605308cee Add change log and migration guide entries. 2023-12-20 13:07:14 +01:00
David Hewitt a3c92fa319
Merge pull request #3601 from davidhewitt/deprecate-pytryfrom
deprecate `PyTryFrom` and `PyTryInto`
2023-12-20 11:55:35 +00:00
David Hewitt bc87b7bac6 deprecate `PyTryFrom` and `PyTryInto` 2023-12-20 11:28:24 +00:00
Adam Reichold 83697f0c62 Also replace IterANextOutput by autoref-based specialization to allow returning arbitrary values 2023-12-20 09:56:16 +01:00
Adam Reichold ca7d90dcf3 Replace IterNextOutput by autoref-based specialization to allow returning arbitrary values 2023-12-20 09:56:16 +01:00
Adam Reichold d75d4bdf81 Fix some holdouts from using argument holders for lifetime extensions. 2023-12-20 09:56:16 +01:00
Adam Reichold 3583b9ac67
Merge pull request #3670 from Tpt/duration
Adds std::duration::Duration from/to Python conversions
2023-12-20 08:10:55 +00:00
Tpt 0752942c3f Duration: drops truncation warning 2023-12-20 08:57:26 +01:00
Tpt 8b614745cf Adds std::duration::Duration from/to Python conversions 2023-12-20 08:57:26 +01:00