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
8fa5294d93
release notes for 0.20.1
2023-12-30 21:34: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
3da1aac2dd
add gil-refs
feature to aid migration
2023-12-29 14:42:31 +00:00
David Hewitt
1b61cb015a
Add .as_borrowed()
conversion from gil-refs to Bound<T>
2023-12-26 09:49:03 +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
a115877bba
Merge pull request #3686 from davidhewitt/bound
...
make Bound and Borrowed types public API
2023-12-21 16:25:01 +00:00
Alex Gaynor
d92792f8ad
Fixes #3645 -- added abi3-py312
feature
2023-12-21 10:40:14 -05:00
David Hewitt
a09b9f8834
make Bound
and Borrowed
types public API
2023-12-21 12:20:33 +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
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
Adam Reichold
a605308cee
Add change log and migration guide entries.
2023-12-20 13:07:14 +01:00
David Hewitt
bc87b7bac6
deprecate PyTryFrom
and PyTryInto
2023-12-20 11:28:24 +00:00
Tpt
8b614745cf
Adds std::duration::Duration from/to Python conversions
2023-12-20 08:57:26 +01:00
Adam Reichold
8bb64377b8
Merge pull request #3638 from PyO3/call-op-bool
...
Try harder by looking for a __bool__ magic method when extracing bool values from Python objects.
2023-12-19 18:52:55 +00:00
Adam Reichold
4177dfcc81
Apply __bool__ conversion only to numpy.bool_ to avoid false positives.
2023-12-19 18:55:28 +01:00
Adam Reichold
8133aaa5d8
Try harder by looking for a __bool__ magic method when extracing bool values from Python objects.
...
I decided to not implement the full protocol for truth value testing [1] as it
seems confusing in the context of function arguments if basically any instance
of custom class or non-empty collection turns into `true`.
[1] https://docs.python.org/3/library/stdtypes.html#truth
2023-12-19 18:55:28 +01:00
David Hewitt
e727640ef3
Merge pull request #3664 from Tpt/chrono-abi3
...
Chrono: compatibility with abi3
2023-12-19 17:53:30 +00:00
Adam Reichold
416d3c488f
Rename name to qualname and full_name to name to better match Python
2023-12-19 16:51:24 +01:00
Adam Reichold
2fdd52003e
Add PyType::full_name which is tp_name and has an abi3 fallback.
2023-12-19 15:47:21 +01:00
Tpt
d7eac6527b
Chrono: compatibility with abi3
2023-12-19 14:53:14 +01:00
Tpt
0d2387e858
Chrono: makes FromPyObject impl on DateTime generic
...
ToPyObject was already generic
2023-12-18 20:12:30 +01:00
Adam Reichold
ced97f80d1
Transition is_true to is_truthy to clarify that the test is not based on identity with or equality to the True singleton.
2023-12-16 14:04:37 +01:00
David Hewitt
ef8532b175
Add AsRefSource
to PyNativeType
.
2023-12-14 18:35:06 +00:00
messense
c21a84d999
Add support for extracting Rust set types from frozenset
2023-12-07 20:25:31 +08:00
David Hewitt
07726aefc4
Merge pull request #3609 from wyfo/async_receiver
...
feat: allow async methods to accept `&self`/`&mut self`
2023-12-07 07:38:25 +00:00
Joseph Perez
f34c70c2da
feat: allow async methods to accept &self
/&mut self
2023-12-07 07:42:10 +01:00
Adam Reichold
4baf0235c3
Merge pull request #3616 from neachdainn/3615-gilprotected-pyvisit
...
Enable `GILProtected` access via `PyVisit`
2023-12-05 20:43:38 +00:00
Nathan Kent
3249feb85c
Enable GILProtected
access via PyVisit
...
Closes #3615
This simply adds a new method which uses the existence of a `PyVisit`
object as proof that the GIL is held instead of a `Python` object. This
allows `GILProtected` to be used in instances where contained Python
objects need to participate in garbage collection. Usage in this
situation should be valid since no Python calls are made and this does
not provide any additional mechanism for accessing a `Python` object.
2023-12-05 11:10:00 -08:00
David Hewitt
ed87637ebb
replace PyTryFrom
by splitting PyTypeInfo
2023-12-05 08:01:30 +03:00
David Hewitt
e8f852bce7
Merge pull request #3599 from wyfo/coroutine_cancel
...
feat: add `coroutine::CancelHandle`
2023-12-04 12:44:36 +00:00
Joseph Perez
8a674c2bd3
feat: add coroutine::CancelHandle
2023-12-04 07:46:51 +01:00
Adam Reichold
e6457c5e99
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.
2023-12-02 07:57:00 +01:00
David Hewitt
e62e6cad5d
Merge pull request #3603 from davidhewitt/0.19-deprecations
...
remove all functionality deprecated in 0.19
2023-11-28 06:47:30 +00:00
Alex Gaynor
fae209419c
fixes #3561 -- silence new clippy warning
2023-11-27 17:06:59 -05:00
David Hewitt
5c6d49084f
remove all functionality deprecated in 0.19
2023-11-27 22:02:19 +00:00
David Hewitt
d8002c4b2b
Merge pull request #3588 from wyfo/coroutine_name
...
feat: add coroutine `__name__`/`__qualname__`
2023-11-26 09:23:29 +00:00
Joseph Perez
781b9e3983
feat: add coroutine __name__
/__qualname__
and not-awaited warning
2023-11-25 21:51:20 +01:00
Adam Reichold
1203921d5c
Merge pull request #3456 from aldanor/feature/either
...
Add conversion support for `either::Either`
2023-11-25 09:37:49 +00:00
David Hewitt
cd8526ecc6
Implement PyTypeInfo
for PyEllipsis
, PyNone
, and PyNotImplemented
2023-11-24 22:31:39 +00:00
Ivan Smirnov
a75464ee26
add conversion support for either::Either
2023-11-24 22:09:34 +00:00
David Hewitt
69870d2298
Merge pull request #3540 from wyfo/coroutine
...
feat: support `async fn` in macros with coroutine implementation
2023-11-22 19:52:15 +00:00
David Hewitt
3f0dfa9698
Merge pull request #3587 from wyfo/classmethod_into
...
feat: allow classmethods to receive `Py<PyType>`
2023-11-22 19:34:19 +00:00
Joseph Perez
627841f1e2
feat: support async fn
in macros with coroutine implementation
2023-11-22 20:25:36 +01:00
Joseph Perez
744de3a142
feat: allow classmethod
/pass_module
to receive owned types
...
This is necessary for async functions
2023-11-22 07:45:59 +01:00
David Hewitt
bd0174aa5d
Change return types of py.None()
, py.NotImplemented()
and py.Ellipsis()
to typed singletons
2023-11-17 16:16:19 +00:00