Commit graph

2444 commits

Author SHA1 Message Date
David Hewitt eed196329d add list bound constructors 2024-01-27 21:12:55 +00:00
David Hewitt 0973da27e9
Merge pull request #3743 from davidhewitt/set-bound-constructors
add bound constructors for `PySet` and `PyFrozenSet`
2024-01-27 17:55:42 +00:00
David Hewitt 5f320d7a04
Merge pull request #3765 from davidhewitt/remove-py-newref
remove internal uses of `_Py_NewRef`
2024-01-27 13:35:29 +00:00
David Hewitt 87e0610b58 remove internal uses of _Py_NewRef 2024-01-27 12:07:46 +00:00
Icxolu 7918815cee implement PySliceMethods 2024-01-27 11:34:32 +01:00
Icxolu f86053e2c2 implement PyTracebackMethods 2024-01-27 11:34:32 +01:00
David Hewitt 06c95432c6 set & frozenset bound constructors 2024-01-17 09:45:41 +00:00
David Hewitt 43504cd15a
Merge pull request #3742 from samuelcolvin/int-extraction-performance
improve performance of successful int extract by ~30% by avoiding calls to `__index__` where redundant
2024-01-16 17:14:39 +00:00
Samuel Colvin 0e876d94d6
improve performance of successful int extract by ~30%
add newsfragment

formatting

skip slow path on 3.8+

formatting

cfg if,else

formatting again

dedicated macro, change int_convert_u64_or_i64 too

add float tests

force index call for PyLong_AsUnsignedLongLong

perform PyLong check for 3.8 too

perform PyLong check for <3.10
2024-01-16 13:51:19 +00:00
David Hewitt 7366b1a386
Merge pull request #3730 from Tpt/chrono-tz
Conversion between chrono_tz::Tz and zoneinfo.ZoneInfo
2024-01-15 14:48:27 +00:00
David Hewitt ab699a0727 allow dead_code in IPowModulo 2024-01-12 15:55:21 +00:00
David Hewitt 4504a7c96e fix some nightly lints 2024-01-12 2024-01-12 13:34:17 +00:00
Tpt 72f0c73925 Conversion between chrono_tz::Tz and zoneinfo.ZoneInfo 2024-01-08 15:19:49 +01:00
David Hewitt 50e33d86c7 add call_bound and call_method_bound 2024-01-03 13:24:14 +00:00
Adam Reichold e2c6eb86f9 Fix missing feature flags in implementation of Either conversion. 2024-01-02 20:47:42 +00:00
David Hewitt eceb28bc79
Merge pull request #3702 from davidhewitt/bound-iterator-constructor
introduce PyIterator::from_bound_object
2024-01-02 15:34:54 +00:00
David Hewitt 783e98b1a8 introduce PyIterator::from_bound_object 2024-01-02 14:11:26 +00:00
David Hewitt 4cf58c8303 implement IntoPy<Py<PyTuple>> for Bound<PyTuple> 2023-12-30 21:37:46 +00:00
David Hewitt 823b5feed3 improve tuple methods test coverage 2023-12-30 21:37:46 +00:00
David Hewitt 53d25f7ff2 add new PyTuple constructors 2023-12-30 21:37:46 +00:00
David Hewitt 375e3d4eee implement PyTupleMethods 2023-12-30 21:37:46 +00:00
Alex Gaynor 54390bc50b
Merge pull request #3712 from alex/binops
add PyAnyMethods for binary operators
2023-12-30 13:56:45 +00:00
Alex Gaynor 339660c117 add PyAnyMethods for binary operators
also pow

fixes #3709
2023-12-29 18:45:18 -05:00
David Hewitt 9a5668572b implement PyModuleMethods 2023-12-29 21:46:46 +00:00
David Hewitt 3da1aac2dd add gil-refs feature to aid migration 2023-12-29 14:42:31 +00:00
David Hewitt 442d13dab3 introduce Bound::unbind 2023-12-26 13:17:12 +00:00
David Hewitt e4fd557d2a remove IntoIterator for &Bound 2023-12-26 13:10:36 +00:00
David Hewitt 8a28a69c3d implement PyFrozenSetMethods 2023-12-26 13:10:36 +00:00
David Hewitt 271cbf9edb implement PySetMethods 2023-12-26 13:10:36 +00:00
David Hewitt d36ad8f61f introduce Bound::as_borrowed 2023-12-26 09:49:03 +00:00
David Hewitt 1b61cb015a Add .as_borrowed() conversion from gil-refs to Bound<T> 2023-12-26 09:49:03 +00:00
Adam Reichold f37c682f8c
Merge pull request #3700 from davidhewitt/super-bound
introduce `PySuper::new_bound`
2023-12-25 09:48:39 +00:00
Adam Reichold ff373eb1c6
Merge pull request #3697 from davidhewitt/as-gil-ref
expose `Bound::as_gil_ref` and `Bound::into_gil_ref`
2023-12-25 09:48:23 +00:00
Adam Reichold bd660537d8
Merge pull request #3695 from davidhewitt/bound-iterator
implement iterator for `Bound` iterator
2023-12-25 09:46:01 +00:00
David Hewitt 38abfd2eed expose Bound::as_gil_ref and Bound::into_gil_ref 2023-12-24 22:10:09 +00:00
David Hewitt d9cc0c0f24 introduce PySuper::new_bound 2023-12-24 20:04:15 +00:00
David Hewitt 6ca63b5772
Merge pull request #3698 from davidhewitt/unraisable-bound
implement `PyErr::write_unraisable_bound`
2023-12-24 19:54:27 +00:00
David Hewitt d669a943f7 implement iterator for Bound iterator 2023-12-24 19:52:36 +00:00
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 f5b18468bc partially revert changes to PyTzInfoAccess trait 2023-12-24 15:07:42 +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 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
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
David Hewitt 4ac6a6bf15 add safety note to downcast_into_unchecked 2023-12-21 15:51:56 +00: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