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
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
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
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
Icxolu
c359f5ca1d
deprecate `PyDict::new` constructor ( #3823 )
...
* deprecate `PyDict::new`
* update benchmarks
* convert `test_frompyobject`
2024-02-11 23:55:56 +00:00
Icxolu
4d423b0c67
port `Python::run` to `Bound` API
2024-02-09 22:09:16 +01:00
David Hewitt
de93d15eeb
ci: fix beta clippy `map_clone` warning
2024-02-05 07:57:27 +00:00
David Hewitt
eed196329d
add list bound constructors
2024-01-27 21:12:55 +00: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
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
7d486bb72a
tests/common.rs -> src/tests/common.rs
2023-09-24 13:34:53 +01:00
David Hewitt
a15614844d
add PyErr::display
2023-07-24 22:14:55 +01:00
David Hewitt
45ff25cd2a
clippy: deny / fix used-underscope-binding lint
2023-07-16 20:49:45 +01:00
David Hewitt
5bc3e6f15e
fix clippy warnings uncovered by msrv bump
2023-06-05 07:08:27 +01:00
Georg Brandl
c489809938
Py/PyAny: deprecate cast_as() in favor of downcast()
...
They are (practically) identical on PyAny, and `downcast()` is the more
useful name.
2022-11-18 07:00:40 +01:00
Ashley Anderson
5d88e1d1c4
Update PyTryFrom for PyMapping and PySequence to more accurately check types ( #2477 )
...
Co-authored-by: David Hewitt <1939362+davidhewitt@users.noreply.github.com>
2022-08-10 21:03:18 +01:00
mejrs
984fdf57c7
Use Python:;with_gil in tests
2022-07-19 19:34:23 +02:00
David Hewitt
d5e99b635d
refactor: remove all 0.15 deprecations
2022-07-15 06:33:14 +01:00
Hood Chatham
da5b9814cc
Set up CI for wasm32-emscripten target ( #2436 )
...
* ci: test on emscripten target
This adds CI to build libpython3.11 for wasm32-emscripten and
running tests against it. We need to patch instant to work
around the emscripten_get_now:
https://github.com/sebcrozet/instant/pull/47
We also have to patch emscripten to work aroung the "undefined
symbol gxx_personality_v0" error:
https://github.com/emscripten-core/emscripten/issues/17128
I set up a nox file to download and install emscripten,
download and build cpython, set appropriate environment variables
then run cargo test. The workflow just installs python, rust,
node, and nox and runs the nox session.
I xfailed all the test failures. There are problems with datetime.
iter_dict_nosegv and test_filenotfounderror should probably be
fixable. The tests that involve threads or asyncio probably can't
be fixed.
* Some cleanup
* Remove instant patch
* Add explanations for xfails
2022-06-08 05:59:18 +01:00
mejrs
6f1cf1b662
Add more lints
2022-03-23 08:07:28 +01:00
Georg Brandl
0678f11266
Protocols: implement __getattribute__
...
converting tp_getattro to a shared slot
Fixes #2186
2022-02-26 20:05:50 +01:00
David Hewitt
6af47c78f1
pymethods: more tests for magic methods
2022-02-16 07:42:25 +00:00
David Hewitt
53c170078d
pymethods: seq methods from mapping methods
2022-02-05 15:59:22 +00:00
David Hewitt
6433d884fc
dev: remove self dev dependency
2021-12-08 07:48:58 +00:00
Georg Brandl
43893158b1
switch is_instance/is_instance_of, is_subclass/is_subclass_of
2021-11-20 13:18:43 +00:00
David Hewitt
26ccc1ab37
macros: fix panic in __get__ implementation
2021-11-15 16:02:59 +00:00
David Hewitt
23778f5386
pymethods: test and document opt-out of protos
2021-11-10 23:28:01 +00:00
David Hewitt
0236879e8e
pymethods: test __delete__
2021-10-24 09:40:32 +01:00
David Hewitt
0e0e6f8bf5
pymethods: support protocols with `multiple-pymethods` feature
2021-10-23 00:07:35 +01:00
David Hewitt
4b2345fe80
pymethods: support __call__ proto
2021-10-23 00:06:46 +01:00
David Hewitt
179b5d1f47
pymethods: fix support for MSRV
2021-09-18 16:42:02 +01:00
David Hewitt
592c98c722
pymethods: disable protocols with multiple-pymethods for now
2021-09-18 13:08:24 +01:00
David Hewitt
a551b005b4
pymethods: finish support for number protocol
2021-09-18 12:59:25 +01:00
David Hewitt
c2d78ca76e
pymethods: faster compilation for protos, tidy ups
2021-09-18 09:49:05 +01:00
David Hewitt
43eb762346
pymethods: support most numerical methods
2021-09-18 00:31:17 +01:00
David Hewitt
92e2156161
pymethods: support inplace numerical operations
2021-09-17 08:13:54 +01:00
David Hewitt
b544b5a6d7
pymethods: support iter and async protocols
2021-09-17 08:13:54 +01:00
David Hewitt
8408328cb3
pymethods: add support for protocol methods
2021-09-17 08:13:54 +01:00