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
Adam Reichold
ee54132ff6
Merge pull request #3671 from davidhewitt/dh/downcast-error-split
...
Add `Py2` variants of `PyDowncastError`
2023-12-19 21:31:38 +00:00
David Hewitt
1451418ee4
Add `Py2` variants of `PyDowncastError`
2023-12-19 20:59:57 +00:00
David Hewitt
54ba6e82ca
Merge pull request #3651 from davidhewitt/bytes2
...
implement `PyBytesMethods` and `PyByteArrayMethods`
2023-12-19 19:56:16 +00:00
David Hewitt
35f7f1a78c
use Py2Borrowed to make PyBytesMethods slightly nicer
2023-12-19 19:02:23 +00: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
57002d2389
Align error message when no method __bool__ is defined with CPython's general style.
2023-12-19 18:55:28 +01:00
Adam Reichold
3e10d64fa2
Avoid attribute lookup overhead for __bool__ if the unlimited API is available.
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
David Hewitt
c5dce0172b
implement `PyBytesMethods` and `PyByteArrayMethods`
2023-12-19 17:26:52 +00:00
Adam Reichold
87e42c96be
Merge pull request #3660 from PyO3/type-name-fast-path
...
Rename name to qualname and add name to better match Python and ensure abi3 fallbacks.
2023-12-19 16:36:44 +00:00
Adam Reichold
68f417fb1c
Defend against mutable type objects when extracting their full name.
2023-12-19 16:51:24 +01: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
86989a7329
Merge pull request #3667 from PyO3/extend-holder-lifetime-redux
...
Bring back holder bindings as prerequiste to specialization on return value types
2023-12-19 15:46:15 +00:00
Adam Reichold
f03ccf204c
Also apply holder lifetime extension to slot implementations.
2023-12-19 16:29:43 +01:00
Adam Reichold
27019b5523
Use local variables to extend lifetime of holder references.
2023-12-19 16:21:18 +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
David Hewitt
1dca87972a
Merge pull request #3662 from Tpt/chrono-test
...
Chrono: makes test independent of datetime C-API
2023-12-19 08:26:21 +00:00
David Hewitt
12b44ea16d
Merge pull request #3663 from Tpt/chrono-generic-datetime
...
Chrono: makes FromPyObject impl on DateTime generic
2023-12-19 08:22:47 +00:00
Tpt
0d2387e858
Chrono: makes FromPyObject impl on DateTime generic
...
ToPyObject was already generic
2023-12-18 20:12:30 +01:00
Tpt
7705181049
Chrono: makes test independent of datetime C-API
2023-12-18 17:12:39 +01:00
Adam Reichold
ff50285d1f
Merge pull request #3657 from PyO3/is-truthy
...
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 13:16:49 +00: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
867a273afc
Merge pull request #3648 from Tpt/timezone-constructor
...
Adds internal timezone_from_offset function
2023-12-15 16:12:32 +00:00
Tpt
dcaed199c7
Adds internal timezone_from_offset function
...
It allows to build conversions from chrono without direct access to the C API
2023-12-15 17:00:25 +01:00
Adam Reichold
118d578ac1
Merge pull request #3652 from davidhewitt/bool2
...
implement `PyBoolMethods`
2023-12-15 14:55:56 +00:00
David Hewitt
d7adc74ba5
implement `PyBoolMethods`
2023-12-15 14:39:04 +00:00
David Hewitt
97cf9b834c
Merge pull request #3653 from davidhewitt/native-type-source
...
Add `AsRefSource` to `PyNativeType`.
2023-12-14 22:33:49 +00:00
David Hewitt
ef8532b175
Add `AsRefSource` to `PyNativeType`.
2023-12-14 18:35:06 +00:00
Adam Reichold
d1b4b9e7d4
Merge pull request #3650 from davidhewitt/float2
...
implement `PyFloatMethods`
2023-12-14 18:07:32 +00:00
David Hewitt
8a7c5002bd
rename `floatob.rs` to `float.rs`
2023-12-14 17:14:17 +00:00
David Hewitt
8bdae345f3
implement `PyFloatMethods`
2023-12-14 17:12:06 +00:00
Adam Reichold
763ecb381b
Merge pull request #3649 from davidhewitt/module-name-lifetime
...
hold onto module name properly in `PyCFunction::internal_new`
2023-12-14 16:54:23 +00:00
David Hewitt
015f028589
hold onto module name properly in `PyCFunction::internal_new`
2023-12-14 16:23:53 +00:00
David Hewitt
79a54cfc05
Merge pull request #3572 from davidhewitt/sequence2-try2
...
implement `PySequenceMethods`, try 2
2023-12-14 13:27:32 +00:00
David Hewitt
82ac801be4
introduce traits to make ffi ptr handling cleaner
2023-12-14 13:00:45 +00:00
David Hewitt
ac4ee2841b
implement `PySequenceMethods`
2023-12-14 13:00:45 +00:00
Adam Reichold
fc82c9f870
Merge pull request #3636 from PyO3/more-async-self-hints
...
Expand guide on async methods borrowing self.
2023-12-14 10:58:48 +00:00