Commit Graph

933 Commits

Author SHA1 Message Date
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
David Hewitt 0f242c399d make `DowncastError` and `DowncastIntoError` public 2023-12-21 13:03:59 +00:00
Adam Reichold ca7d90dcf3 Replace IterNextOutput by autoref-based specialization to allow returning arbitrary values 2023-12-20 09:56:16 +01:00
David Hewitt 1451418ee4 Add `Py2` variants of `PyDowncastError` 2023-12-19 20:59:57 +00: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 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 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
David Hewitt ed87637ebb replace `PyTryFrom` by splitting `PyTypeInfo` 2023-12-05 08:01:30 +03:00
Joseph Perez 2ca9f59d6f
refactor: drop futures_util dependency 2023-12-04 18:56:34 +01:00
Joseph Perez 8a674c2bd3
feat: add `coroutine::CancelHandle` 2023-12-04 07:46:51 +01:00
David Hewitt 81ad2e8bab
Merge pull request #3598 from davidhewitt/clippy-beta
ci: run beta clippy as an allowed-to-fail job
2023-11-29 06:47:21 +00:00
David Hewitt cf67c2ce46 fix test-serde beta clippy warning 2023-11-28 07:29:45 +00:00
David Hewitt 5c6d49084f remove all functionality deprecated in 0.19 2023-11-27 22:02:19 +00:00
Joseph Perez 781b9e3983
feat: add coroutine `__name__`/`__qualname__` and not-awaited warning 2023-11-25 21:51:20 +01: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 c814078866 refactor `OkWrap` to not call `.into_py(py)` 2023-11-24 10:41:08 +00:00
David Hewitt 5ac56b8eb0 improve error for invalid `#[classmethod]` receivers 2023-11-24 03:24:46 +00:00
David Hewitt aba3a3552d remove type_is_pymodule 2023-11-22 21:30:10 +00:00
David Hewitt 69870d2298
Merge pull request #3540 from wyfo/coroutine
feat: support `async fn` in macros with coroutine implementation
2023-11-22 19:52:15 +00:00
David Hewitt 3f0dfa9698
Merge pull request #3587 from wyfo/classmethod_into
feat: allow classmethods to receive `Py<PyType>`
2023-11-22 19:34:19 +00:00
Joseph Perez 627841f1e2
feat: support `async fn` in macros with coroutine implementation 2023-11-22 20:25:36 +01:00
Joseph Perez 744de3a142
feat: allow `classmethod`/`pass_module` to receive owned types
This is necessary for async functions
2023-11-22 07:45:59 +01: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 29ad73b6d5 ci: updates for rust 1.74 2023-11-16 16:06:01 +00:00
David Hewitt cac95f31c7 add Py2 as an internal API for optimization and dogfooding 2023-10-13 08:10:37 +02:00
David Hewitt b73c06948c
Merge pull request #3504 from davidhewitt/classmethod-receiver
emit helpful error hint for classmethod with receiver
2023-10-10 21:35:34 +00:00
David Hewitt 6c90325a1c deprecate undocumented `#[__new__]` form of `#[new]` 2023-10-10 08:47:03 +01:00
David Hewitt ddc04ea093 emit helpful error hint for classmethod with receiver 2023-10-10 06:30:19 +01:00
David Hewitt 1158c08f42 error on passing arguments to `#[new]` and similar attributes 2023-10-08 21:31:59 +01:00
mejrs d6e22a9972 Only run invalid_result_conversion on linux 2023-10-08 04:23:05 +02:00
David Hewitt a1d333a563 emit compile errors on macros inside `#[pymethods]`
Co-authored-by: Bruno Kolenbrander <59372212+mejrs@users.noreply.github.com>
2023-10-02 22:15:29 +01:00
David Hewitt 7d486bb72a tests/common.rs -> src/tests/common.rs 2023-09-24 13:34:53 +01:00
David Hewitt c8f82be32c add assert_warnings test helper 2023-09-23 13:14:18 +01:00
David Hewitt 5798caf1f8 better `Some`-wrapping for default arguments 2023-09-21 21:14:44 +01:00
David Hewitt 8a60540e25 amend code for `PyDict::get_item` change 2023-09-09 12:23:06 +01:00
David Hewitt 4c46d81afd simplify thread checker implementation 2023-09-03 14:15:26 +01:00
David Hewitt a5d0a16b21 ci: updates for Rust 1.72 2023-08-25 12:30:34 +01:00
DataTriny 6c70db1e0b Test renaming rules 2023-08-16 18:24:19 +02:00
DataTriny f02fe9478d
Make rename_all accept a renaming rule, allow applying it to classes as well 2023-08-15 10:15:48 +02:00
DataTriny 57505cb1a1
Fix tests 2023-08-13 18:54:55 +02:00