Commit Graph

210 Commits

Author SHA1 Message Date
David Hewitt c47565666d add `PyString::new_bound` 2024-01-29 13:14:00 +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 50e33d86c7 add `call_bound` and `call_method_bound` 2024-01-03 13:24:14 +00:00
David Hewitt e42d8cf612 ci: updates for Rust 1.75 2023-12-29 13:36:46 +00:00
David Hewitt 0f242c399d make `DowncastError` and `DowncastIntoError` public 2023-12-21 13:03:59 +00:00
David Hewitt 1451418ee4 Add `Py2` variants of `PyDowncastError` 2023-12-19 20:59:57 +00:00
Joseph Perez 8a674c2bd3
feat: add `coroutine::CancelHandle` 2023-12-04 07:46:51 +01:00
David Hewitt 5c6d49084f remove all functionality deprecated in 0.19 2023-11-27 22:02:19 +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 29ad73b6d5 ci: updates for rust 1.74 2023-11-16 16:06:01 +00: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
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 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 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
David Hewitt b65cbb958b ci: updates for rust 1.71 2023-07-14 12:10:37 +01:00
David Hewitt 56b7c38e24 improve error span for mutable access to `#[pyclass(frozen)]` 2023-07-11 22:34:53 +01:00
David Hewitt bf2f441567 prefer inner / _private naming 2023-07-04 21:03:24 +01:00
mejrs 51a6863440 Give a better error message for Python in traverse 2023-06-19 23:25:51 +02:00
David Hewitt 4f3fcdbf0f remove all functionality deprecated in PyO3 0.18 2023-06-13 22:27:43 +01:00
Adam Reichold 0d30bb7d3d Bump Rust edition to 2021 and make current Clippy happy. 2023-06-07 21:15:38 +02:00
David Hewitt 8850d5d384 support ordering magic methods for `#[pyclass]` 2023-06-04 13:58:18 +01:00
Adam Reichold 90fcc63eda Replace the nightly UI tests by doctests since we cannot keep up with the changing error outputs of nightly in any case. 2023-05-25 21:37:32 +02:00
Adam Reichold 18397828e5 Move locking the GIL and handling the resulting panics into a library function. 2023-05-25 20:01:35 +02:00
Adam Reichold 62f424b690 Drop EnsureGIL to remove one layer of indirection from the implementation of Python::with_gil 2023-05-23 23:31:47 +02:00
Adam Reichold b9766cfa11 Add PyClass::get and Py::get for GIL-independent access to frozen classes. 2023-05-18 08:57:55 +02:00
Stu Hood 20c5618160
Add support for combining the `#[new]` and `#[classmethod]` method types. 2023-05-16 15:51:14 -07:00
David Hewitt dd24c9ea71 remove `Python::acquire_gil` 2023-05-09 09:39:23 +02:00
bors[bot] 1cdac4fde4
Merge #2980
2980: support `text_signature` on `#[new]` r=adamreichold a=davidhewitt

Closes #2866 

This is a breaking change for 0.19.0, because it starts autogenerating `text_signature` for `#[new]`. This could affect runtime behaviour if the user is relying on the class docs at runtime for some reason.

Guide & tests all updated accordingly.

`#[pyclass(text_signature = "...")]` is deprecated by this PR, however if it's set, it will be used in preference to `#[new]`.

(The signature / `text_signature` from `#[new]` will simply be ignored in this case. I figure that when users fix their deprecation warnings by removing `#[pyclass(text_signature = "...")]` then the `#[new]` signatures will start flowing properly, and this is good enough.)

Co-authored-by: David Hewitt <1939362+davidhewitt@users.noreply.github.com>
Co-authored-by: Adam Reichold <adam.reichold@t-online.de>
2023-05-04 16:51:54 +00:00
David Hewitt 8bd17f02c7 support `text_signature` on `#[new]` 2023-05-04 07:15:11 +01:00
BlueGlassBlock f75ea3d93a
test: improve cov 2023-04-27 12:44:38 +08:00
BlueGlassBlock 28cc9e3f6c
chore: EOF ui test 2023-04-26 20:08:46 +08:00
BlueGlassBlock 158410fc77
fix: ui test stderr 2023-04-26 20:05:43 +08:00
BlueGlassBlock 1d6ab21781
fix: change to from_item_all 2023-04-26 19:47:07 +08:00
BlueGlassBlock c415d79bf7
test(ui): TRYBUILD=overwrite 2023-04-26 13:02:22 +08:00
BlueGlassBlock 5f4acd72d0
test: add ui tests 2023-04-26 12:48:12 +08:00
Adam Reichold 04d962e2ed Update UI tests for Rust 1.69.0. 2023-04-21 16:22:42 +02:00
mejrs 1ecc71638d Emit a better error for bad argument names 2023-03-23 07:43:54 +00:00
David Hewitt cd36c6fc21 fix clippy and ui tests for Rust 1.68 2023-03-09 23:41:26 +00:00
David Hewitt 96efb0eda9 add better error message for Python in signature 2023-02-03 06:57:30 +00:00