David Hewitt
2e56f659ed
split PyCell
and PyClassObject
concepts ( #3917 )
...
* add test for refguard ref counting
* split `PyCell` and `PyClassObject` concepts
* rework `create_cell` to `create_class_object`
* Apply suggestions from code review
Co-authored-by: Icxolu <10486322+Icxolu@users.noreply.github.com>
* review: Icxolu feedback
---------
Co-authored-by: Icxolu <10486322+Icxolu@users.noreply.github.com>
2024-03-03 07:00:59 +00:00
Lily Foote
d94827720e
Delete duplicate test code ( #3926 )
...
These used to explicitly call `.iter()`, but that was removed in b65cbb9
to remove lints.
2024-03-02 22:53:28 +00:00
Icxolu
1c5265e1c2
deprecate from_borrowed_ptr
methods ( #3915 )
...
* deprecate `from_borrowed_ptr` methods
This deprecates the methods on the `Python`
marker, aswell as `FromPyPointer`
* use `BoundRef` to defer ref cnt inc until after the error case
2024-03-01 20:51:53 +00:00
Icxolu
1d224610c3
docs: update Python classes
section of the guide ( #3914 )
...
* docs: update `Python classes` section of the guide
* review feedback davidhewitt
* migration guide entry
2024-03-01 09:21:47 +00:00
Lily Foote
56683ed553
deprecate Py::as_ref ( #3864 )
...
* Deprecate Py::as_ref
* Reword as_ref deprecation note
Co-authored-by: David Hewitt <mail@davidhewitt.dev>
* Tidy up remaining uses of Py::as_ref
Co-authored-by: David Hewitt <mail@davidhewitt.dev>
* Pass hello into println! explicitly
---------
Co-authored-by: David Hewitt <mail@davidhewitt.dev>
2024-02-29 07:15:34 +00:00
Matthew Neeley
68ec6de0c9
Use single-arg form of #[pymodule]
function in docs and tests ( #3899 )
...
* Use single-arg form for `#[pymodule]` functions in docs and tests
* Update guide/src/function.md
Co-authored-by: Icxolu <10486322+Icxolu@users.noreply.github.com>
* Add test of two-argument module function
* Fix new test
---------
Co-authored-by: Icxolu <10486322+Icxolu@users.noreply.github.com>
2024-02-28 22:36:50 +00:00
Icxolu
55833365b5
seals PyAnyMethods
and friends ( #3909 )
...
* seals `PyAnyMethods` and friends
This seals these new traits, preventing downstream
crates from implementing them on their types.
These traits are mainly a workaround for arbitrary
self receiver types, so this gives us more
flexibility if these need to be changed in the
future.
* move `PyResultExt` seal
2024-02-28 19:36:55 +00:00
David Hewitt
8a12970c96
update extract_argument
to use Bound APIs ( #3708 )
...
* update `extract_argument` to use `Bound` APIs
* tidy up borrow in macros expression
* update `trybuild` output
* more concise form for `DowncastError::new`
Co-authored-by: Lily Foote <code@lilyf.org>
* use `Borrowed` instead of newtype
* use `Borrowed::from_ptr` methods in extract_argument
* update UI tests
* avoid double-negative `#[cfg]` clauses
Co-authored-by: Lily Foote <code@lilyf.org>
* review: LilyFoote, Icxolu feedback
---------
Co-authored-by: Lily Foote <code@lilyf.org>
2024-02-28 19:36:20 +00:00
Matthew Neeley
a15e4b1a11
Allow pymodule functions to take a single Bound<'_, PyModule> arg ( #3905 )
2024-02-27 22:24:14 +00:00
Icxolu
6f03a5464f
cleans up PyCFunction::internal_new
( #3910 )
...
This deduplicates some code around `PyCFunction::internal_new`
2024-02-27 22:15:35 +00:00
Lily Foote
a3ad28b70c
Pymodule bound ( #3897 )
...
* Support Bound in pymodule and pyfunction macros
Co-authored-by: David Hewitt <mail@davidhewitt.dev>
* Remove spurious $ character
Co-authored-by: Matthew Neeley <mneeley@gmail.com>
* Rework PyCFunction::new_bound signatures
This allows us to remove the awkward `PyFunctionArgumentsBound` enum.
* Use BoundRef instead of BoundModule
* support argument deduction for `wrap_pyfunction_bound!`
* support `wrap_pyfunction!` with `Bound` input/output
* Fix docs link to `wrap_pyfunction_bound!`
* Revert back to wrap_pyfunction!
---------
Co-authored-by: David Hewitt <mail@davidhewitt.dev>
Co-authored-by: Matthew Neeley <mneeley@gmail.com>
2024-02-27 19:19:52 +00:00
David Hewitt
93704047a5
store Bound<T>
inside PyRef
and PyRefMut
( #3860 )
...
* store `Bound<T>` inside `PyRef` and `PyRefMut`
* update `FromPyObject` for `PyRef` to use `extract_bound`
* review: Icxolu feedback
2024-02-27 18:56:22 +00:00
Lily Foote
5c41ea0ade
Implement From<Bound<'py, T>>
for PyErr ( #3881 )
...
* Implement `From<Bound<'py, T>>` for PyErr
* Replace PyErr::from_value_bound calls with .into
* Fix From<MyError> expected error message
* Add a trait bound to From<Bound<'py, T>> for PyErr
2024-02-26 23:14:41 +00:00
David Hewitt
8e2219b0d9
silence non-local-definitions nightly lint ( #3901 )
...
* silence non-local-definitions nightly lint
* add newsfragment
* add FIXMEs for `non_local_definitions`
* also allow `non_local_definitions` in doctests
2024-02-26 20:28:04 +00:00
Icxolu
7c10ff4327
allow Bound<'_, T>
in #[pymethods] self
position ( #3896 )
...
* allow `Bound<'_, T>` in #[pymethods] `self` position
* rename `TryFromPyCell` -> `TryFromBoundRef`
* remove unneccessary unsafe
2024-02-25 07:13:36 +00:00
Thomas Tanon
e0e3981e17
#[pymodule] mod some_module { ... } v3 ( #3815 )
...
* #[pymodule] mod some_module { ... } v3
Based on #2367 and #3294
Allows to export classes, native classes, functions and submodules and provide an init function
See test/test_module.rs for an example
Future work:
- update examples, README and guide
- investigate having #[pyclass] and #[pyfunction] directly in the #[pymodule]
Co-authored-by: David Hewitt <mail@davidhewitt.dev>
Co-authored-by: Georg Brandl <georg@python.org>
* tests: group exported imports
* Consolidate pymodule macro code to avoid duplicates
* Makes pymodule_init take Bound<'_, PyModule>
* Renames #[pyo3] to #[pymodule_export]
* Gates #[pymodule] mod behind the experimental-declarative-modules feature
* Properly fails on functions inside of declarative modules
---------
Co-authored-by: David Hewitt <mail@davidhewitt.dev>
Co-authored-by: Georg Brandl <georg@python.org>
2024-02-24 13:50:18 +00:00
Icxolu
c06bb8f1f1
reexport PyAnyMethods
and friends from pyo3::types
( #3895 )
...
* reexport `PyAnyMethods` and friends from `pyo3::types`
* remove duplicated imports
2024-02-24 13:46:59 +00:00
David Matos
0f29feca8f
Tidy up deprecation message on bound api ( #3893 )
2024-02-24 13:25:06 +00:00
Lily Foote
e145ae851a
Update new_closure_bound closure signature ( #3883 )
...
* Update new_closure_bound closure signature
Co-authored-by: Icxolu <10486322+Icxolu@users.noreply.github.com>
* Use anonymous lifetimes in closure bounds
Co-authored-by: David Hewitt <mail@davidhewitt.dev>
* Take &Bound in PyCFunction closures
---------
Co-authored-by: Icxolu <10486322+Icxolu@users.noreply.github.com>
Co-authored-by: David Hewitt <mail@davidhewitt.dev>
2024-02-23 14:07:54 +00:00
Icxolu
6a815875a0
port PyErr::from_type
to Bound
API ( #3885 )
2024-02-23 06:31:51 +00:00
David Hewitt
5ca810236d
ci: rework GitHub caching strategy ( #3886 )
...
* ci: rework GitHub caching strategy
* clean up some more redundant imports flagged by nightly
2024-02-23 00:51:50 +00:00
Lily Foote
22a23ffb31
Tidy some usage of py.from_borrowed_ptr
and py.from_borrowed_ptr_or_opt
( #3877 )
...
* Tidy some usage of py.from_borrowed_ptr
* Add BoundRef::ref_from_ptr_or_opt
2024-02-22 23:06:55 +00:00
Icxolu
8bd82da939
add missing deprecation for PyDict::from_sequence
( #3884 )
2024-02-22 22:52:25 +00:00
Icxolu
4f8ee96881
fix AsRef
and Deref
impls on Bound<T>
( #3879 )
...
* fix `AsRef` and `Deref` of `Bound<T>` to `Bound<PyAny>`
* cleanup unnessesary `.as_any()` calls
* remove trait bound on `AsRef` impl
* add comment for `Deref` trait bound
* rename marker trait
2024-02-22 22:38:42 +00:00
David Hewitt
9e74c858c2
add PyModule::new_bound
and PyModule::import_bound
( #3775 )
...
* add `PyModule::new` and `PyModule::import_bound`
* review: Icxolu feedback
2024-02-22 09:35:47 +00:00
David Hewitt
c4f66657c5
fix either
feature conditional compilation, again ( #3834 )
...
* fix `either` feature conditional compilation, again
* test feature powerset in CI
* install `rust-src` for feature powerset tests
* review: adamreichold feedback
* Fix one more case of redundant imports.
* just check feature powerset for now
---------
Co-authored-by: Adam Reichold <adam.reichold@t-online.de>
2024-02-22 08:05:37 +00:00
Lily Foote
5ddcd46980
Deprecate py.from_owned_ptr
methods ( #3875 )
...
* Deprecate `py.from_owned_ptr` methods
* Refactor PyString.to_str
Co-authored-by: David Hewitt <mail@davidhewitt.dev>
---------
Co-authored-by: David Hewitt <mail@davidhewitt.dev>
2024-02-22 00:05:08 +00:00
Juniper Tyree
885883bf68
Add Py::drop_ref
method ( #3871 )
...
* add Py::drop_ref method
* add changelog entry
* fix ffi import
* integrate review feedback
* Add a test
* Fix some build errors
* Fix some more build errors
2024-02-21 22:56:03 +00:00
Icxolu
61bc02d927
deprecate PyCell::new
in favor of Py::new
or Bound::new
( #3872 )
...
* deprecate `PyCell::new` in favor of `Py::new` or `Bound::new`
* update deprecation warning
Co-authored-by: David Hewitt <mail@davidhewitt.dev>
---------
Co-authored-by: David Hewitt <mail@davidhewitt.dev>
2024-02-20 07:45:47 +00:00
Lily Foote
a93900686e
Deprecate Py::into_ref ( #3867 )
...
* Migrate into_ref calls to Bound api
* Mark Py::into_ref as deprecated
2024-02-20 07:10:45 +00:00
David Hewitt
8ac7834f98
docs: update example for storing Py<T> in structs ( #3876 )
2024-02-20 07:08:49 +00:00
Lily Foote
76dabd4e60
Replace as_ref(py) with Bound APIs ( #3863 )
2024-02-19 22:39:54 +00:00
David Hewitt
96b8c9facf
migrate some final FromPyObject
implementations to the Bound
API ( #3869 )
...
* update `Py::extract` to use `extract_bound`
* update docstring of `FromPyObject`
* move `Option` conversions to new module & update
* move `Cell` conversions to new module & update
2024-02-19 22:14:26 +00:00
David Hewitt
4efc4b82a3
ci: fix redundant import warnings on nightly ( #3873 )
2024-02-19 22:07:05 +00:00
Icxolu
0bb9cab6d3
port PyComplex::from_complex
to Bound
API ( #3866 )
...
* port `PyComplex::from_complex` to `Bound` API
* add `PyComplexMethods` to the prelude
2024-02-18 23:37:02 +00:00
David Hewitt
a85ed34c45
add Bound API constructors from borrowed pointers ( #3858 )
...
* make `Borrowed` ptr constructors public
* introduce `Bound::from_borrowed_ptr` constructors
* clippy `assert_eq` -> `assert`
* rerrange function order and correct docstrings
2024-02-18 22:03:43 +00:00
Lily Foote
b4dc854585
Convert LazyTypeObject to use the Bound API ( #3855 )
2024-02-18 22:01:50 +00:00
Icxolu
4ce9c35983
port Python::get_type
to Bound
API ( #3846 )
...
* port `Python::get_type` to `Bound` API
* fix `is_subclass_and_is_instance` FIXME
2024-02-18 18:27:19 +00:00
David Hewitt
f04ad56df4
implement PyTypeMethods
( #3705 )
...
* implement `PyTypeMethods`
* introduce `PyType` bound constructors
* `from_type_ptr_bound` instead of `from_type_ptr_borrowed`
* correct conditional code
* just make `from_type_ptr_bound` create an owned `Bound`
* correct docstrings
Co-authored-by: Icxolu <10486322+Icxolu@users.noreply.github.com>
* Rework as `PyType::from_borrowed_type_ptr`
* correct doc link to `from_borrowed_type_ptr`
Co-authored-by: Lily Foote <code@lilyf.org>
* remove unneeded lifetime name
---------
Co-authored-by: Icxolu <10486322+Icxolu@users.noreply.github.com>
Co-authored-by: Lily Foote <code@lilyf.org>
2024-02-18 03:07:48 +00:00
Icxolu
1d295a12a0
port PyObject::downcast
to Bound
API ( #3856 )
...
* port `PyObject::downcast` to `Bound` API
* relax traits bounds for unchecked variant in `Bound` API
* deprecate `Python::(checked_)cast_as`
* reword deprecation warning
2024-02-18 01:11:43 +00:00
Lily Foote
0dd568d397
Use the new bound API instead of .as_ref(py) ( #3853 )
...
* Use the new bound API instead of .as_ref(py)
* Move import into a nested scope
* Use to_cow instead of to_str for compatibility
`to_str` is not available before Python 3.10 on the limited api.
* Relax &self lifetimes
* Use Bound<'py, PyAny> in test Mapping signatures
* Use .as_bytes(py)
* Simplify ThrowCallback::throw signature
* Avoid .as_any call with Py api instead of Bound
2024-02-18 00:09:56 +00:00
Lily Foote
5f42c02e4f
Remove stray " character from docstring ( #3852 )
2024-02-17 17:04:35 +00:00
Icxolu
c33d330b18
deprecate PyFrozenSet::empty
( #3851 )
2024-02-17 13:40:54 +00:00
Icxolu
1d8d81db2d
port PyFrozenSetBuilder
to Bound
API ( #3850 )
2024-02-17 12:21:41 +00:00
David Hewitt
eb90b81d44
always use a Python iterator for sets and frozensets ( #3849 )
...
* always use a Python iterator for sets and frozensets
* add newsfragment
2024-02-17 10:57:53 +00:00
Lily Foote
940804fe0d
Pyerr value bound ( #3820 )
...
* Implement PyErr::value_bound
* Use PyErr::value_bound in conversions
* Implement PyErr::from_value_bound
* Remove unnecessary clone
* Return a reference from PyErr::value_bound
* Avoid clone in PyErr::from_value_bound
* Use PyErr::from_value_bound instead of from_value
* Remove unnecessary .as_borrowed() calls
* Remove unused import
* Simplify UnraisableCapture.hook
* Use Bound::from_owned_ptr_or_opt in fn cause
* Update PyErrState::lazy to take Py<PyAny>
This is easier to work with elsewhere than `&PyAny` or
`Bound<'py, PyAny>`.
* Add Bound PyUnicodeDecodeError constructors
* Update PyErr::from_value_bound to take Bound
* Simplify PyErr::from_value
* Simplify PyErr::value
* Remove unnecessary reference
* Simplify Pyerr::cause implementation
* Simplify PyUnicodeDecodeError::new_bound
2024-02-17 00:27:45 +00:00
David Hewitt
ec6d587218
support Bound
for classmethod
and pass_module
( #3831 )
...
* support `Bound` for `classmethod` and `pass_module`
* `from_ref_to_ptr` -> `ref_from_ptr`
* add detailed docs to `ref_from_ptr`
2024-02-16 00:36:11 +00:00
Icxolu
05aedc9032
port PyErr::warn
to Bound
API ( #3842 )
...
* port `PyErr::new_type`
* port `PyErr::warn` and `PyErr::warn_explicit`
2024-02-16 00:12:43 +00:00
David Hewitt
dc8b948201
add PyBackedStr
and PyBackedBytes
( #3802 )
...
* add `PyBackedStr` and `PyBackedBytes`
* review: adamreichold feedback
* use `NonNull<[u8]>`
* clippy and newsfragment
* drop binding unused after refactoring
---------
Co-authored-by: Adam Reichold <adam.reichold@t-online.de>
2024-02-15 07:58:20 +00:00
Icxolu
f3ddd023c9
convert PyBuffer
to Bound
API ( #3836 )
2024-02-14 22:10:59 +00:00
Icxolu
9902633116
allow from_py_with
on function args to take a fn(&Bound) -> PyResult
( #3837 )
2024-02-14 22:03:04 +00:00
Icxolu
0c12d9137f
port Python::import
to Bound
API ( #3832 )
...
* port `Python::import` to `Bound` API
* tidy up imports in tests/test_datetime_import.rs
---------
Co-authored-by: David Hewitt <mail@davidhewitt.dev>
2024-02-14 00:24:37 +00:00
Icxolu
fbfeb2ff03
update #[derive(FromPyObject)]
to use extract_bound
( #3828 )
...
* update `#[derive(FromPyObject)]` to use `extract_bound`
* type inference for `from_py_with` using function pointers
2024-02-13 00:09:41 +00:00
David Hewitt
94b7d7e434
add DowncastIntoError::into_inner
( #3829 )
2024-02-12 21:40:05 +00:00
David Hewitt
5b9b76fe58
add _bound
constructors for datetime types ( #3778 )
...
* add `_bound` constructors for datetime types
* review: Icxolu feedback
* update uses of deprecated timezone_utc
2024-02-12 20:49:58 +00:00
Lily Foote
1279467d27
Pyerr isinstance ( #3826 )
...
* Implement PyErr::is_instance_bound
* Update is_instance_bound to take a reference
Co-authored-by: David Hewitt <mail@davidhewitt.dev>
* Remove spurious clone
---------
Co-authored-by: David Hewitt <mail@davidhewitt.dev>
2024-02-12 08:32:51 +00:00
Icxolu
c359f5ca1d
deprecate PyDict::new
constructor ( #3823 )
...
* deprecate `PyDict::new`
* update benchmarks
* convert `test_frompyobject`
2024-02-11 23:55:56 +00:00
Lily Foote
baf5c8ec0a
Implement PyErr::get_type_bound ( #3819 )
...
* Implement PyErr::get_type_bound
* Update docs for PyErr::get_type_bound
* Fix doctest for cloning PyErr
* Import the whole prelude in docs example
Co-authored-by: David Hewitt <mail@davidhewitt.dev>
* Remove unnecessary self lifetime
Co-authored-by: David Hewitt <mail@davidhewitt.dev>
* Remove more unnecessary self lifetimes
* Use variables to avoid dangling pointers
Co-authored-by: David Hewitt <mail@davidhewitt.dev>
* Avoid using ffi in fn ptype on Py_3_12
Co-authored-by: David Hewitt <mail@davidhewitt.dev>
* Add missing imports to fn ptype
---------
Co-authored-by: David Hewitt <mail@davidhewitt.dev>
2024-02-11 21:07:28 +00:00
David Hewitt
55488d3880
Merge pull request #3818 from davidhewitt/datetime-segv
...
fix segmentation fault when `datetime` module is invalid
2024-02-11 09:04:32 +00:00
David Hewitt
5b1104131f
fix segmentation fault when datetime
module is invalid
2024-02-11 02:44:31 +00:00
David Hewitt
07ea89d460
Merge pull request #3817 from Icxolu/into-pydict
...
port `IntoPyDict` to `Bound` API
2024-02-11 02:26:03 +00:00
Icxolu
e45fbe493c
port IntoPyDict
to Bound
API
2024-02-10 15:47:26 +01:00
David Hewitt
fa53d81e5f
Merge pull request #3801 from davidhewitt/encode-utf8
...
add `PyStringMethods::encode_utf8`
2024-02-10 14:16:32 +00:00
Icxolu
4d423b0c67
port Python::run
to Bound
API
2024-02-09 22:09:16 +01:00
David Hewitt
b7fb9e672e
Merge pull request #3782 from davidhewitt/type-check-bound
...
add `bound` method variants for `PyTypeInfo`
2024-02-09 20:22:44 +00:00
Icxolu
33dc33ecec
port Python::eval
to Bound
API
2024-02-09 17:52:00 +01:00
David Hewitt
367eeaeeab
add bound
method variants for PyTypeInfo
2024-02-08 22:27:05 +00:00
David Hewitt
3541506a16
ci: allow some dead code warnings on nightly
2024-02-08 20:52:03 +00:00
David Hewitt
030a618e0d
Merge pull request #3800 from snuderl/PyCFunction-bound-api
...
PyCFunction bound api
2024-02-06 18:28:40 +00:00
Blaž Šnuderl
aa3c938b5e
PyCFunction bound api
2024-02-06 18:44:53 +01:00
David Hewitt
86f294f6e6
expose Bound::from_owned_ptr
etc
2024-02-05 18:27:43 +00:00
David Hewitt
662eecfb44
add PyStringMethods::encode_utf8
2024-02-05 13:28:46 +00:00
David Hewitt
02f1df69b5
Merge pull request #3792 from davidhewitt/bound-pyclass-2
...
pyclass methods for `Bound`
2024-02-05 10:38:30 +00:00
Adam Reichold
c995426c81
Merge pull request #3799 from davidhewitt/move-cow
...
move `Cow[u8]` conversions into `conversions::std::slice` module
2024-02-05 10:18:33 +00:00
David Hewitt
42843de47b
pyclass methods for Bound
2024-02-05 09:41:22 +00:00
David Hewitt
7281268840
move Cow[u8]
conversions into conversions::std::slice
module
2024-02-05 08:52:07 +00:00
Bruno Kolenbrander
7938d4cadc
Merge pull request #3798 from davidhewitt/beta-map-clone
...
ci: fix beta clippy `map_clone` warning
2024-02-05 08:48:14 +00:00
David Hewitt
de93d15eeb
ci: fix beta clippy map_clone
warning
2024-02-05 07:57:27 +00:00
Blaž Šnuderl
f1384f3582
Implement PyNone.get() using PyNone.get_bound()
2024-02-05 08:06:59 +01:00
Blaž Šnuderl
1fd0aa2b19
Use new method to implement old
2024-02-05 08:03:25 +01:00
Blaz Snuderl
8388b14369
PyNotImplemented get_bound
2024-02-04 20:08:52 +01:00
Blaz Snuderl
8354590ae6
PyEllipsis get_bound method
2024-02-04 20:01:15 +01:00
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