Alex Gaynor
830b3bb814
fixes #3561 -- silence new clippy warning
2023-12-29 22:49:42 +00:00
David Hewitt
e0513d74f5
improve error for invalid `#[classmethod]` receivers
2023-12-29 22:48:25 +00:00
David Hewitt
25b8a37521
remove type_is_pymodule
2023-12-29 22:47:39 +00:00
Joseph Perez
466359a1c8
feat: allow `classmethod`/`pass_module` to receive owned types
...
This is necessary for async functions
2023-12-29 22:47:16 +00:00
David Hewitt
bbc5404297
ci: move lints to new 1.74 cargo.toml tables
2023-12-29 22:46:39 +00:00
David Hewitt
c77deee18e
release: 0.20.0
2023-10-11 14:39:19 +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
b3ee70db40
refactor `parse_fn_type`
2023-10-08 21:31:59 +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
6c0386ec7e
remove branches for dead `call` and `init` attrs
2023-09-27 08:52:56 +01:00
David Hewitt
5798caf1f8
better `Some`-wrapping for default arguments
2023-09-21 21:14:44 +01:00
David Hewitt
e28403e772
call PyObject_GC_Untrack before deallocating
2023-09-09 22:29:58 +01:00
David Hewitt
4c46d81afd
simplify thread checker implementation
2023-09-03 14:15:26 +01:00
David Hewitt
f7503afbc8
remove all #py quoting
2023-08-18 14:04:38 +01:00
Adam Reichold
9363491d54
Merge pull request #3384 from DataTriny/pyclass_rename_variants
...
Add `rename_all` attribute to `#[pyclass]`
2023-08-16 19:06:37 +00:00
David Hewitt
eba2c59778
tidy up some file locations after dual licensing
2023-08-16 08:22:51 +01:00
DataTriny
3c3e9401a3
Dual-license
2023-08-15 23:39:45 +02:00
DataTriny
1a73ce6e60
Address review comments
2023-08-15 20:56:13 +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
a9e9ec628d
Add attribute to
2023-08-13 18:25:07 +02:00
David Hewitt
64adab1a76
add as_ptr and into_ptr inherent methods
2023-08-11 10:49:42 +01:00
David Hewitt
284c42d840
release: 0.19.2
2023-08-01 07:29:04 +01:00
David Hewitt
686fe0aac2
add macro quotes module for common snippets
2023-07-29 21:24:11 +01:00
David Hewitt
e86dbab387
macros: `_py` -> `py`
2023-07-29 21:24:11 +01:00
David Hewitt
c1126740c5
fix compile failure for getter with return lifetime of self
2023-07-29 21:20:10 +01:00
David Hewitt
45ff25cd2a
clippy: deny / fix used-underscope-binding lint
2023-07-16 20:49:45 +01:00
David Hewitt
52cd9cbc90
macros: change self_arg to be an expression
2023-07-14 13:18:57 +01:00
David Hewitt
b65cbb958b
ci: updates for rust 1.71
2023-07-14 12:10:37 +01:00
David Hewitt
bb05896324
Merge pull request #3311 from davidhewitt/frozen-receiver-error
...
improve error span for mutable access to `#[pyclass(frozen)]`
2023-07-12 06:21:25 +00:00
David Hewitt
56b7c38e24
improve error span for mutable access to `#[pyclass(frozen)]`
2023-07-11 22:34:53 +01:00
David Hewitt
a5d97b3ad0
remove some dead fields from FnArg
2023-07-11 19:59:12 +01:00
Adam Reichold
bd7aed4b12
Add implementation of Iterator::size_hint for PyIterator
...
When the Python iterator backing `PyIterator` has a `__length_hint__` special
method, we can use this as a lower bound for Rust's `Iterator::size_hint` to
e.g. support pre-allocation of collections.
This is implemented using `PyObject_LengthHint` which is not available in the
stable ABI and hence so is `Iterator::size_hint`. This should be fine since this
is an optimization in any case and the stable ABI is expected to have slightly
worse performance overall.
2023-07-09 10:16:20 +02:00
David Hewitt
bf2f441567
prefer inner / _private naming
2023-07-04 21:03:24 +01:00
David Hewitt
7d357ad992
release: 0.19.1
2023-07-03 16:18:24 +01:00
mejrs
51a6863440
Give a better error message for Python in traverse
2023-06-19 23:25:51 +02:00
Alex Gaynor
afbb1d435c
Upgrade to syn 2
2023-06-14 07:03:33 -04: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
bors[bot]
dbf7b233aa
Merge #3203
...
3203: support ordering magic methods for `#[pyclass]` r=adamreichold a=davidhewitt
Closes #2089
This adds `__lt__`, `__le__`, `__eq__`, `__ne__`, `__gt__`, and `__ge__` as per the Python implementations of what we call `__richcmp__`.
There's a UI test confirming that the user cannot implement split forms and `__richcmp__` simultaneously.
There's also a benchmark comparing implementing these split methods against using `__richcmp__`. I couldn't see a meaningful performance difference, so I'm tempted to deprecate `__richcmp__`, given that's not a magic method which exists in Python. Potentially we can provide options such as the opt-in `#[pyclass(eq, ord)]` to avoid boilerplate for people who don't want to implement six different methods.
Co-authored-by: David Hewitt <1939362+davidhewitt@users.noreply.github.com>
2023-06-05 07:13:23 +00:00
Adam Reichold
5738edfdd4
Bump MSRV to 1.56
2023-06-04 23:02:30 +01:00
David Hewitt
8850d5d384
support ordering magic methods for `#[pyclass]`
2023-06-04 13:58:18 +01:00
David Hewitt
45b5ede26a
remove copyright headers from source files
2023-06-03 22:38:54 +01:00
David Hewitt
2500e22e13
release: 0.19.0
2023-05-31 13:53:37 +01:00
Kang Seonghoon
c2d4e8ad1f
Use a full path for `#[new]` method which is also `#[classmethod]`.
2023-05-29 11:01:48 +09: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
810ad00a76
Do not apply deferred ref count updates and prevent the GIL from being acquired inside of implementations.
2023-05-25 20:01:35 +02:00
Kang Seonghoon
24343f2caa
Fix a span site of `_slf` for custom receivers.
2023-05-23 10:25:57 +09:00