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
Lily Foote
76dabd4e60
Replace as_ref(py) with Bound APIs ( #3863 )
2024-02-19 22:39:54 +00:00
David Hewitt
4efc4b82a3
ci: fix redundant import warnings on nightly ( #3873 )
2024-02-19 22:07:05 +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
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
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
f3ddd023c9
convert `PyBuffer` to `Bound` API ( #3836 )
2024-02-14 22:10:59 +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
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
Icxolu
c359f5ca1d
deprecate `PyDict::new` constructor ( #3823 )
...
* deprecate `PyDict::new`
* update benchmarks
* convert `test_frompyobject`
2024-02-11 23:55:56 +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
Icxolu
e45fbe493c
port `IntoPyDict` to `Bound` API
2024-02-10 15:47:26 +01:00
Icxolu
4d423b0c67
port `Python::run` to `Bound` API
2024-02-09 22:09:16 +01:00
Icxolu
33dc33ecec
port `Python::eval` to `Bound` API
2024-02-09 17:52:00 +01:00
David Hewitt
bcb7b88c23
ci: updates for rust 1.76
2024-02-08 21:13:58 +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
de93d15eeb
ci: fix beta clippy `map_clone` warning
2024-02-05 07:57:27 +00: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
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
a60c1821af
implement `PyFunctionArgument` for `&Bound<T>`
2024-02-01 13:22:53 +00:00
David Hewitt
4c94be51a7
add `PyBytes::new_bound`
2024-02-01 08:52:28 +00:00
David Hewitt
c47565666d
add `PyString::new_bound`
2024-01-29 13:14:00 +00:00
David Hewitt
eb8d11f42f
Merge pull request #3769 from davidhewitt/remove-test-pep-587
...
remove `test_pep_587`
2024-01-27 22:33:35 +00:00
David Hewitt
5ccc46e459
remove `test_pep_587`
2024-01-27 21:57:43 +00:00
David Hewitt
eed196329d
add list bound constructors
2024-01-27 21:12:55 +00: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
7fddd983b4
update `test_compile_error` ui test output
2024-01-27 12:37:26 +01:00
Mate Kovacs
3ed5ddb0ec
feat: support pyclass on complex enums
2024-01-18 22:04:42 +09:00
David Hewitt
4504a7c96e
fix some nightly lints 2024-01-12
2024-01-12 13:34:17 +00:00
David Hewitt
50e33d86c7
add `call_bound` and `call_method_bound`
2024-01-03 13:24:14 +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
e852a4b502
be more lax with ordering in `invalid_result_conversion` ui test
2023-12-29 22:06:33 +00:00
David Hewitt
3da1aac2dd
add `gil-refs` feature to aid migration
2023-12-29 14:42:31 +00:00
David Hewitt
e42d8cf612
ci: updates for Rust 1.75
2023-12-29 13:36:46 +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
David Hewitt
d9cc0c0f24
introduce `PySuper::new_bound`
2023-12-24 20:04:15 +00:00
David Hewitt
877e34ac86
implement `PyErr::write_unraisable_bound`
2023-12-24 19:35:29 +00: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