David Hewitt
5dbb51b9ce
Merge pull request #3784 from davidhewitt/more-extract-bound
...
migrate many `FromPyObject` implementations to `Bound` API
2024-02-04 15:58:22 +00:00
Icxolu
304c8e655a
convert marshal
to Bound
API
2024-02-04 16:25:00 +01:00
David Hewitt
0d4df9c19d
adjust FromPyObject
implementations to always use 'py
lifetime
2024-02-04 14:22:03 +00:00
David Hewitt
2a741a21e6
migrate many FromPyObject
implementations to Bound
API
2024-02-04 14:22:03 +00:00
Blaž Šnuderl
d1e967e9ea
Uncomment a test
2024-02-04 07:31:29 +01:00
Blaž Šnuderl
eca943ea35
Add new get_bound and mark old get as deprecated
2024-02-04 07:30:28 +01:00
Blaž Šnuderl
7efd412a63
Merge branch 'main' into PyNone-new-api
2024-02-04 07:29:32 +01:00
David Hewitt
76d1b34cd5
Revert "Merge pull request #3578 from davidhewitt/typed-helpers"
...
This reverts commit 7b07d6d21b
, reversing
changes made to 99858236bd
.
2024-02-03 20:56:23 +00:00
Blaz Snuderl
b1863c73df
clippy
2024-02-03 21:25:47 +01:00
Blaz Snuderl
507ea28b27
test
2024-02-03 21:14:31 +01:00
Blaž Šnuderl
9641b11752
hmm
2024-02-03 20:57:46 +01:00
Blaž Šnuderl
a2a6062adc
fmt
2024-02-03 20:48:25 +01:00
Blaž Šnuderl
5e9d97d1c6
Implement new API for PyNone #3684
2024-02-03 19:09:12 +01:00
David Hewitt
d8c5e7943c
Merge pull request #3790 from Icxolu/bool
...
add `Bound` constructor for `PyBool`
2024-02-03 13:10:30 +00:00
Icxolu
af21a9dc74
add Bound
constructor for PyBool
2024-02-03 12:06:50 +01:00
David Hewitt
8f8d4d33fa
Merge pull request #3776 from davidhewitt/bound-extract
...
migrate `FromPyObject` for `Bound` and `Py` to new APIs
2024-02-02 23:10:47 +00:00
David Hewitt
57735540e8
Merge pull request #3736 from Tpt/tpt/systemtime
...
Adds conversion between SystemTime and datetime
2024-02-01 14:05:51 +00:00
David Hewitt
a60c1821af
implement PyFunctionArgument
for &Bound<T>
2024-02-01 13:22:53 +00:00
David Hewitt
d35a6a1fd6
Merge pull request #3785 from davidhewitt/bound-as-any
...
add `Bound::as_any` and `Bound::into_any` (and same for `Py`)
2024-02-01 10:52:25 +00:00
David Hewitt
49a57dfd18
clean up implementations in src/instance.rs
2024-02-01 10:14:58 +00:00
David Hewitt
4437e8f616
add Py::as_any
and Py::into_any
2024-02-01 09:07:36 +00:00
David Hewitt
cbc97f8ea9
add Bound::as_any
and Bound::into_any
2024-02-01 09:01:33 +00:00
David Hewitt
4c94be51a7
add PyBytes::new_bound
2024-02-01 08:52:28 +00:00
Icxolu
b14dbcf29f
add Bound
constructors for PyMemoryView
2024-01-30 22:52:31 +01:00
Icxolu
e704a760b7
add Bound
constructors for PyByteArray
2024-01-30 22:52:31 +01:00
David Hewitt
2f00eb1423
for now just change return type of intern!
2024-01-30 13:28:07 +00:00
David Hewitt
aa139ad422
add intern_bound!
macro
2024-01-30 10:58:19 +00:00
David Hewitt
fed8bcadaf
add remaining bound string constructors
2024-01-30 09:13:24 +00:00
David Hewitt
718be9fac5
Merge pull request #3770 from Icxolu/capsule
...
implement `PyCapsuleMethods`
2024-01-29 21:23:43 +00:00
Icxolu
e323fcbb9e
implement PyCapsuleMethods
2024-01-29 18:22:40 +01:00
David Hewitt
a3eb328378
migrate FromPyObject
for Bound
and Py
to extract_bound
2024-01-29 13:46:46 +00:00
David Hewitt
c47565666d
add PyString::new_bound
2024-01-29 13:14:00 +00:00
David Hewitt
7549a21154
Merge pull request #3773 from davidhewitt/float-new-bound
...
add `PyFloat::new_bound`
2024-01-29 11:52:45 +00:00
David Hewitt
345e122bbf
add PyFloat::new_bound
2024-01-29 11:06:34 +00:00
David Hewitt
d4d08b24b0
add PyDict::new_bound
without deprecation
2024-01-29 10:17:54 +00:00
David Hewitt
ffaa03e3f1
Migrate some conversions to extract_bound
2024-01-28 07:22:51 +00:00
David Hewitt
595ca4b3c1
Add extract_bound
method to FromPyObject
2024-01-28 07:22:51 +00:00
David Hewitt
ed7263faa2
Merge pull request #3767 from Icxolu/complex
...
implement `PyComplexMethods`
2024-01-27 22:06:02 +00:00
Icxolu
37e2a4d9c9
implement PyComplexMethods
2024-01-27 22:26:53 +01:00
David Hewitt
1657109ae0
documentation updates for PyList::new_bound
2024-01-27 21:12:55 +00:00
David Hewitt
674f7282d8
ToPyObject
and IntoPy
for Borrowed
2024-01-27 21:12:55 +00:00
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
Tpt
f83544910f
Adds conversion between SystemTime and datetime
2024-01-27 17:43:51 +01: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
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
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
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
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
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
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
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
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
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
David Hewitt
015f028589
hold onto module name properly in PyCFunction::internal_new
2023-12-14 16:23:53 +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
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
16ae0e2efe
Merge pull request #3608 from wyfo/remove_futures
...
refactor: drop futures_util dependency
2023-12-04 19:17:43 +00:00
Joseph Perez
2ca9f59d6f
refactor: drop futures_util dependency
2023-12-04 18:56:34 +01: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
Alex Gaynor
dd6e0339d3
Refactor create_type_object so that most of the code is monomorphic
...
In pyca/cryptography this function is the #1 source of lines of generated LLVM IR, because it is duplicated 42x (and growing!). By rewriting it so most of the logic is monomorphic, we reduce the generated LLVM IR for this function by 4x.
2023-11-28 20:09:34 -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
Adam Reichold
81bc838acd
Merge pull request #3577 from davidhewitt/none-typeinfo
...
Implement `PyTypeInfo` for `PyEllipsis`, `PyNone`, and `PyNotImplemented`
2023-11-25 09:36:43 +00:00
David Hewitt
9f66846238
Merge pull request #3595 from davidhewitt/ok-wrap
...
refactor `OkWrap` to not call `.into_py(py)`
2023-11-25 05:43:54 +00:00
David Hewitt
cd8526ecc6
Implement PyTypeInfo
for PyEllipsis
, PyNone
, and PyNotImplemented
2023-11-24 22:31:39 +00:00
David Hewitt
bead83f4b0
docs: fixup docs for smallvec feature
2023-11-24 22:11:40 +00:00
Ivan Smirnov
a75464ee26
add conversion support for either::Either
2023-11-24 22:09:34 +00:00
David Hewitt
c814078866
refactor OkWrap
to not call .into_py(py)
2023-11-24 10:41:08 +00:00
Joseph Perez
627841f1e2
feat: support async fn
in macros with coroutine implementation
2023-11-22 20:25:36 +01:00
David Hewitt
7b07d6d21b
Merge pull request #3578 from davidhewitt/typed-helpers
...
Change return types of `py.None()`, `py.NotImplemented()` and `py.Ellipsis()` to typed singletons
2023-11-20 07:07:12 +00: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
David Hewitt
a9305ab389
ci: move lints to new 1.74 cargo.toml tables
2023-11-17 15:41:52 +00:00
Joseph Perez
1fd4090bd4
refactor: remove useless unsafe
in get_mut
2023-10-29 13:50:36 +01:00
Joseph Perez
bb1cc93797
feat: add take
and into_inner
methods to GILOnceCell
2023-10-29 08:33:04 +01:00
David Hewitt
572a27d2d3
ci: fix nightly unused import warnings
2023-10-25 23:30:14 +01:00
David Hewitt
d895734499
change PyDict::from_sequence
to take just &PyAny
2023-10-20 11:59:26 +01:00
David Hewitt
2ca8e573a4
remove comparison to rust-cpython
2023-10-15 22:03:24 +01:00
David Hewitt
f12f928bd5
Merge pull request #3514 from messense/memoryview
...
Add `PyMemoryView` type
2023-10-15 15:08:50 +00:00
David Hewitt
aa28cec893
Merge pull request #3507 from orhun/feat/support_smallvec_conversion
...
Add support for `SmallVec` in conversion traits (#3440 )
2023-10-15 14:43:55 +00:00
messense
f4e64aadef
Add test cases for new TryFrom
impls
2023-10-15 21:53:31 +08:00
messense
d4ed66fff0
Add TryFrom
impls for PyByteArray
and PyMemoryView
2023-10-15 17:39:01 +08:00
messense
5b94241bd7
Add PyMemoryView
type
2023-10-15 17:32:09 +08:00
Orhun Parmaksız
31acf0dc6f
Add an entry to features table in lib
2023-10-13 13:35:30 +03:00
David Hewitt
cac95f31c7
add Py2 as an internal API for optimization and dogfooding
2023-10-13 08:10:37 +02:00
Orhun Parmaksız
dfeae473e5
Add support for SmallVec
in conversion traits ( #3440 )
2023-10-11 17:14:23 +03:00
David Hewitt
e1d4173827
Fix bug in default implementation of __ne__
2023-10-11 09:48:06 +01:00
David Hewitt
76bf521ed0
Merge pull request #3505 from davidhewitt/deprecate_dunder_new
...
deprecate undocumented `#[__new__]` form of `#[new]`
2023-10-10 21:35:10 +00:00
David Hewitt
6c90325a1c
deprecate undocumented #[__new__]
form of #[new]
2023-10-10 08:47:03 +01:00
David Hewitt
c0b5004cfa
Merge pull request #3455 from davidhewitt/normalized-exceptions
...
also use `PyErr::SetObject` on Python versions before 3.12
2023-10-10 07:44:39 +00:00
mejrs
6ca573b9d0
Update clippy
2023-10-06 23:31:06 +02:00
David Hewitt
2daddb4734
unify 3.12 and pre-3.12 exception handling pathways
2023-09-30 23:27:27 +01:00
David Hewitt
f335f42197
Merge pull request #3446 from davidhewitt/relax-import-check
...
relax multiple-import check to only prevent subinterpreters
2023-09-29 16:35:31 +00:00
David Hewitt
b9e9859082
Merge pull request #3478 from mejrs/auto
...
Don't let auto trait syntax bleed through on stable Rust
2023-09-29 16:35:05 +00:00
mejrs
0c8ab98760
move it into the inline module.
2023-09-29 17:22:27 +02:00
David Hewitt
1a349c2eb7
adjust cfgs for windows 3.9
2023-09-29 14:23:18 +01:00
David Hewitt
50cb41dd0b
Merge pull request #3458 from davidhewitt/truncate-leap-seconds
...
truncate leap seconds on `chrono` to `datetime` conversions
2023-09-29 11:47:27 +00:00
David Hewitt
4b5ff05721
Merge pull request #3471 from davidhewitt/normalized-exceptions-2
...
always normalize exceptions before raising
2023-09-28 20:27:18 +00:00
mejrs
d0d4b9d3fb
Dont let auto trait syntax bleed through on stable
2023-09-28 12:26:09 +02:00
David Hewitt
0459532f69
truncate leap seconds on chrono
to datetime
conversions
2023-09-24 20:28:43 +01:00
David Hewitt
673c45aac3
Merge pull request #3470 from davidhewitt/tests-capture-warnings
...
add `assert_warnings` test helper
2023-09-24 13:09:01 +00:00
David Hewitt
1e8833e15e
always normalize exceptions before raising
2023-09-24 13:38:23 +01:00
David Hewitt
7d486bb72a
tests/common.rs -> src/tests/common.rs
2023-09-24 13:34:53 +01:00
David Hewitt
42f9cd4476
Merge pull request #3469 from davidhewitt/chrono-tidy-up
...
refactor chrono implementation to be more DRY
2023-09-24 09:32:43 +00:00
David Hewitt
f691a68b46
Merge pull request #3472 from davidhewitt/normalized-exceptions-3
...
unify 3.12 / non-3.12 error handling branches
2023-09-23 21:45:25 +00:00
David Hewitt
d089c92680
unify 3.12 / non-3.12 error handling branches
2023-09-23 22:18:59 +01:00
David Hewitt
97ee5967e0
increase test coverage of chrono
feature
2023-09-23 13:51:38 +01:00
David Hewitt
20378a607b
Merge pull request #3466 from davidhewitt/docs-only-prs
...
docs: skip changelog check for docs-only PRs
2023-09-23 12:26:37 +00:00
David Hewitt
c8f82be32c
add assert_warnings test helper
2023-09-23 13:14:18 +01:00
David Hewitt
ccc22a905d
allow invalid_from_utf8 lint in tests
2023-09-23 12:54:53 +01:00
David Hewitt
2d61a73b02
refactor chrono implementation to be more DRY
2023-09-23 12:46:45 +01:00
David Hewitt
f17e703167
return existing module on Python 3.9 and up
2023-09-23 11:13:39 +01:00
David Hewitt
1338020511
relax multiple-import check to only prevent subinterpreters
2023-09-23 11:13:39 +01:00
David Hewitt
5798caf1f8
better Some
-wrapping for default arguments
2023-09-21 21:14:44 +01:00
David Hewitt
1ec3c5a4fd
ci: adjust tests to avoid chrono panics
2023-09-21 08:34:45 +01:00
David Hewitt
bcb01049cc
Merge pull request #3404 from davidhewitt/fix-dealloc
...
call PyObject_GC_Untrack before deallocating
2023-09-11 05:18:34 +00:00
David Hewitt
932c5c7061
workaround BaseException issue on Python versions before 3.11
2023-09-10 22:16:17 +02:00
David Hewitt
e28403e772
call PyObject_GC_Untrack before deallocating
2023-09-09 22:29:58 +01:00
David Hewitt
8ddfef04bc
add detail to documentation for PyDict::get_item
2023-09-09 12:23:06 +01:00
David Hewitt
8a60540e25
amend code for PyDict::get_item
change
2023-09-09 12:23:06 +01:00
David Hewitt
16728c4da2
move PyDict::get_item_with_error to PyDict::get_item
2023-09-09 12:23:06 +01:00
David Hewitt
f0f15edc4e
remove some redundant explicit doc links
2023-09-08 15:36:24 +01:00
David Hewitt
e67b283b25
Merge pull request #3358 from alex/ptr-unsafe-trait
...
fixes #3325 -- mark `AsPyPointer` as `unsafe trait`
2023-09-04 05:05:56 +00:00
David Hewitt
4c46d81afd
simplify thread checker implementation
2023-09-03 14:15:26 +01:00
David Hewitt
9e089a5538
fix chrono deprecation warnings
2023-09-02 20:55:53 +01:00
Ryan Lowe
b3cf61cea6
add types for built-in singletons
2023-08-26 08:57:34 -04:00
David Hewitt
a5d0a16b21
ci: updates for Rust 1.72
2023-08-25 12:30:34 +01:00
Adam Reichold
12183ad3ed
Merge pull request #3379 from iliya-malecki/main
...
BigInt speedup
2023-08-19 12:09:28 +00:00
David Hewitt
9604957c72
further refactor num-bigint conversion
2023-08-18 22:27:47 +01:00
Adam Reichold
94f15679ab
Merge pull request #3402 from Tpt/io-err-unwrap
...
Unwrap the underlying PyErr when converting an io::Error back to a PyErr
2023-08-18 16:56:53 +00:00
David Hewitt
15388fd53b
Merge pull request #3401 from messense/fix-issue-3400
...
Fix memory leak in `PyTypeBuilder::build`
2023-08-18 14:28:36 +00:00
Alex Gaynor
df5aa77800
fixes #3325 -- mark AsPyPointer
as unsafe trait
2023-08-18 10:16:34 -04:00
Tpt
6d8e8b302f
Unwrap the underlying PyErr when converting an io::Error back to a PyErr
...
Exposes it directly instead of loosing all information outside the message
2023-08-18 15:56:25 +02:00
messense
2dc1e9a2b7
Fix memory leak in PyTypeBuilder::build
2023-08-18 21:13:13 +08:00
David Hewitt
c03c787a91
Merge pull request #3393 from alex/drop-other-trait
...
Remove usage of `AsPyPointer` in `IntoPy<PyObject>` trait implementation
2023-08-18 12:58:07 +00:00
David Hewitt
7f32ed96db
Merge pull request #3396 from Tpt/IntoInnerError
...
Uses io::Error code when converting io::IntoInnerError to PyErr
2023-08-18 08:27:35 +00:00
Tpt
1062f244ea
Pick a relevant ErrorKind when building an io::Error from a OSError subclass
2023-08-17 18:33:51 +02:00
Tpt
7c366cb930
Uses io::Error code when converting io::IntoInnerError to PyErr
2023-08-17 18:25:36 +02:00
Alex Gaynor
9f1b56b659
Remove usage of AsPyPointer
in IntoPy<PyObject>
trait implementation
2023-08-17 07:05:52 -04:00
Iliya Malecki
d1f0561036
added speedy BigInt extraction
2023-08-17 08:15:50 +01:00
Alex Gaynor
c259e77ca2
Remove usage of AsPyPointer
in traits for convergint to PyObject
...
Refs #3358
2023-08-16 07:03:57 -04:00
Alex Gaynor
1a904a7429
Migrate PyIterator::from_object
and PyByteArray::from
from AsPyPointer
to &PyAny
2023-08-15 18:03:56 -04:00
Alex Gaynor
5061b501a9
Remove IntoPyPointer
...
it wasn't used in any public APIs following #3359
2023-08-14 16:28:20 -04:00
David Hewitt
a541925f00
Merge pull request #3359 from davidhewitt/py-pointer-methods
...
add as_ptr and into_ptr inherent methods
2023-08-11 19:50:22 +00:00
David Hewitt
8031794f2a
Merge pull request #3378 from GoldsteinE/implicit-builtins
...
add `__builtins__` to globals in `py.run()` if they're missing
2023-08-11 14:11:31 +00:00
Goldstein
0be94a5442
add __builtins__
to globals in py.run()
if they're missing
...
Python code doesn't like to run without `__builtins__`, so adding them
if missing seems to be a good idea. Also that's what CPython >3.10 does.
See https://github.com/python/cpython/pull/24564
Resolves #3370
2023-08-11 15:48:05 +03:00
David Hewitt
64adab1a76
add as_ptr and into_ptr inherent methods
2023-08-11 10:49:42 +01:00
Tpt
1e5a49557d
Makes PathBuf FromPyObject implementation work on all os.PathLike
...
PyOS_FSPath is in abi3-py36
2023-08-08 22:15:56 +02:00
Adam Reichold
a371fbe4f8
Implement DoubleEndedIterator for PyListIterator by caching the length while still validating it before access.
2023-08-07 21:37:50 +02:00
Adam Reichold
4ce3e9649f
Implement DoubleEndedIterator for PyTupleIterator
2023-08-07 21:37:50 +02:00
David Hewitt
ef43731993
update tests of refcounting to use a non-immortal object
2023-07-30 15:37:06 +01:00