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
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
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
David Hewitt
a010da2c58
Merge pull request #3647 from PyO3/fix-msrv
...
Fix the Crossbeam ecosystem to point releases before it required Rust 1.61.
2023-12-14 10:58:30 +00:00
Adam Reichold
97e0998ac2
Fix the Crossbeam ecosystem to point releases before it required Rust 1.61.
2023-12-14 11:35:20 +01:00
messense
42601f3af9
Merge pull request #3642 from PyO3/dependabot/github_actions/actions/setup-python-5
...
build(deps): bump actions/setup-python from 4 to 5
2023-12-12 02:55:22 +00:00
dependabot[bot]
20e9680a81
build(deps): bump actions/setup-python from 4 to 5
...
Bumps [actions/setup-python](https://github.com/actions/setup-python ) from 4 to 5.
- [Release notes](https://github.com/actions/setup-python/releases )
- [Commits](https://github.com/actions/setup-python/compare/v4...v5 )
---
updated-dependencies:
- dependency-name: actions/setup-python
dependency-type: direct:production
update-type: version-update:semver-major
...
Signed-off-by: dependabot[bot] <support@github.com>
2023-12-11 20:04:18 +00:00
Adam Reichold
b0d4ef3525
Expand guide on async methods borrowing self.
2023-12-10 16:37:39 +01:00
David Hewitt
24d9113974
Merge pull request #3632 from messense/extract-frozen-set
...
Add support for extracting Rust set types from `frozenset`
2023-12-07 16:17:51 +00:00
messense
601d9573c8
Merge pull request #3631 from wyfo/doc_typo
...
docs: fix typos
2023-12-07 12:29:00 +00:00
messense
c21a84d999
Add support for extracting Rust set types from `frozenset`
2023-12-07 20:25:31 +08:00
Joseph Perez
e73c795967
docs: fix typos
2023-12-07 10:10:15 +01: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
856c573231
Merge pull request #3600 from davidhewitt/pytypecheck
...
replace `PyTryFrom` by splitting `PyTypeInfo`
2023-12-05 09:52:35 +00:00
David Hewitt
de6d8b7d30
Merge pull request #3629 from davidhewitt/pytests-debug
...
ci: fixup pytests to compile in debug
2023-12-05 05:30:57 +00:00
David Hewitt
ed87637ebb
replace `PyTryFrom` by splitting `PyTypeInfo`
2023-12-05 08:01:30 +03:00
David Hewitt
5326bce57f
ci: fixup pytests to compile in debug
2023-12-05 08:01:02 +03:00
David Hewitt
93370d9f6c
Merge pull request #3627 from davidhewitt/codspeed-fixup
...
try to debug codspeed issue
2023-12-04 22:51:55 +00:00