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
mejrs
2052269aea
Update rust 1.67
2023-01-26 21:44:05 +01:00
David Hewitt
8f48d157d6
deprecate required arguments after option arguments without signature
2023-01-15 10:17:20 +00:00
David Hewitt
f2608a923c
remove functionality deprecated in 0.16
2022-12-28 12:23:53 +00:00
David Hewitt
5039fd746a
add automatic text signature generation
2022-12-24 09:43:02 +00:00
David Hewitt
f01b245d85
update ui tests for Rust 1.66
2022-12-16 20:56:15 +00:00
David Hewitt
00fc0358b9
error when `#[pyo3(signature = ())]` used on invalid methods
2022-11-17 08:28:34 +00:00
Bruno Kolenbrander
6766d9f93b
Merge pull request #2686 from dalcde/closure-name-doc
...
Support passing name and doc to new_closure.
2022-11-06 17:35:20 +01:00
messense
0e770a8458
Update ui tests for Rust 1.65.0
2022-11-04 06:35:30 +00:00
Dexter Chua
9201a7dd48
Support passing name and doc to PyCFunction::new_closure. Fixes #2665
2022-10-29 12:26:09 +08:00
David Hewitt
8e8b484169
add `#[pyo3(signature = (...))]` attribute ( #2702 )
2022-10-25 07:23:21 +01:00
David Hewitt
747d791f1f
introduce trampolines for methods ( #2705 )
2022-10-25 07:22:36 +01:00
David Hewitt
446c0e82f0
Merge pull request #2692 from mejrs/all
...
Implement get/set all on pyclass
2022-10-18 21:39:44 +01:00
mejrs
08c8b845aa
Create better error spans/messages
2022-10-18 21:14:22 +02:00
mejrs
d254134154
Implement get/set all on pyclass
2022-10-17 02:37:43 +02:00
Bruno Kolenbrander
4a04603c2c
Don't use intocallback in method macros ( #2664 )
...
* Don't use intocallback in method macros
Co-authored-by: mejrs <>
2022-10-16 10:35:58 +01:00
David Hewitt
8102ad1a1b
rust: updates for 1.64
2022-09-22 21:03:34 +02:00
David Hewitt
c5ba1f0632
pyclass: better error and explanation why lifetimes are disallowed ( #2633 )
...
* pyclass: better error and explanation why lifetimes are disallowed
* extend detail on lifetimes
2022-09-22 11:14:06 +02:00
Ivan “CLOVIS” Canet
d7c1a2906a
IntoPy and FromPyObject allow the retrieval of the type information
2022-09-06 21:30:36 +02:00
David Hewitt
5718adeec7
pyproto: remove deprecated feature
2022-09-06 08:38:44 +01:00
David Hewitt
36ecadd69f
ci: unpin serde, fixup nightly ui tests
2022-08-23 08:07:26 +01:00
David Hewitt
d0492b7c72
Merge pull request #2570 from davidhewitt/pyclass-frozen-tidy
...
pyclass: tidy up frozen implementation
2022-08-21 09:35:51 +01:00
David Hewitt
24456f3f41
pyclass: tidy up frozen implementation
2022-08-21 08:21:06 +01:00
David Hewitt
fd8026c7bb
pyclass: add `sequence` option to implement `sq_length`
2022-08-20 07:14:26 +01:00
mejrs
fc6121eafe
Deprecate acquire_gil
2022-08-15 03:34:47 +02:00
David Hewitt
987858f5fa
ci: ui tests for 1.63
2022-08-12 07:26:29 +01:00
David Hewitt
d5e99b635d
refactor: remove all 0.15 deprecations
2022-07-15 06:33:14 +01:00
David Hewitt
97ce1f6892
ci: fix nightly UI tests
2022-07-13 08:06:14 +01:00
Bruno Kolenbrander
58d4ba833e
Rust 1.62 ( #2489 )
...
* Rust 1.62
* Make rust happy
* Just use a doctest instead
Co-authored-by: mejrs <>
2022-07-02 16:08:01 +01:00
David Hewitt
4da9c3a55f
llvm-lines: use iterator to collect class items
2022-06-25 22:03:28 +01:00
David Hewitt
62f27caffe
ci: fix nightly ui tests
2022-06-25 21:12:14 +01:00
David Hewitt
7725f17c46
pyclass: switch from immutable to frozen
2022-06-19 21:18:15 +01:00
David Hewitt
f81a01b604
macros: emit pymethod associated methods as a single block
2022-06-16 22:15:29 +01:00
Ivan Krivosheev
f19561c745
Allow #[classattr] take Python argument
2022-06-16 13:08:53 +03:00
David Hewitt
7c56a03d64
frompyobject: fix `from_py_with` ignored for transparent structs
2022-06-09 06:49:25 +01:00
David Hewitt
261c0c5f56
macros: simpler expansion for `intern!`
2022-06-02 09:57:58 +01:00
David Hewitt
a306365db8
pymethods: prevent methods sharing the same name
2022-05-24 21:15:30 +01:00
Bruno Kolenbrander
c57e5098b8
Fix IntoPyCallbackOutput paper cuts ( #2326 )
...
* Implement IntoPy for arrays of IntoPy
* Improve `IntoPyCallbackOutput` compile error
2022-05-09 18:15:43 +01:00
David Hewitt
4168feed1b
opt: tidy some generic code bloat
2022-04-26 05:36:57 +01:00
David Hewitt
e9bd41efb2
better mutability inheritance rules
2022-04-21 20:51:28 +01:00
mejrs
53a642eda7
Fix ui test
2022-04-12 15:49:23 +02:00
Bruno Kolenbrander
bc6bd6099c
Merge branch 'main' into immutable
2022-04-12 14:22:33 +02:00
mejrs
b7745dffc8
Fix everything
2022-04-12 14:19:02 +02:00
mejrs
4fc0cdd636
Fix ui test
2022-04-07 23:56:15 +02:00
David Hewitt
c16cc35b30
pyclass: mapping flag
2022-04-02 16:15:44 +01:00
mejrs
086424b88c
Merge branch 'main' of https://github.com/mejrs/pyo3 into immutable
2022-04-01 23:11:02 +02:00
mejrs
9ab1e6927a
Merge branch 'immutable' of https://github.com/mejrs/pyo3 into immutable
2022-04-01 22:59:59 +02:00
Bruno Kolenbrander
43944aef76
Create a better error message for moving self ( #2238 )
2022-03-24 10:27:37 +01:00
Bruno Kolenbrander
fb689340b4
Merge branch 'main' into lint-more
2022-03-23 09:34:31 +01:00
mejrs
6f1cf1b662
Add more lints
2022-03-23 08:07:28 +01:00
David Hewitt
5cc3ce99f1
pyclass: unify pyclass with its pyo3 arguments
2022-03-20 08:24:09 +00:00
David Hewitt
d8ee35e19c
Merge pull request #2165 from mejrs/auto_trait
...
Implement Auto trait
2022-02-23 07:16:17 +00:00
mejrs
ec275d49cb
Explicitly (un)implement Ungil
2022-02-22 22:43:40 +01:00
mejrs
9e29c1058c
Gut specialization and implement auto trait
...
Implement auto trait
Implement auto trait
Undo oopsie
Fix versions
Fix CI errors
Fix CI
Remove more specialization remnants
2022-02-22 22:43:23 +01:00
David Hewitt
79123b396c
pyclass: deprecate gc option
2022-02-15 08:01:46 +00:00
David Hewitt
c93ee00130
refactor: inline handle_panic into macro output
2022-02-10 20:20:03 +00:00
David Hewitt
f5b2a88a70
refactor: include __new__ as slot
2022-02-09 08:07:14 +00:00
David Hewitt
6f39deaa37
finish off implementation
2022-02-08 18:17:44 +00:00
mejrs
7520b49ac1
Implement opt-in immutable pyclasses
2022-02-08 18:08:18 +00:00
David Hewitt
558549e1c2
pyproto: split into new feature
2022-02-05 16:51:31 +00:00
David Hewitt
1beb2bbb2d
opt: optimize argument extraction
2022-02-04 20:53:49 +00:00
mejrs
f7d7da9b7a
Try fix the ci some more
2022-01-13 23:11:33 +01:00
mejrs
2006ee0d21
Fix ci
2022-01-13 22:25:23 +01:00
David Hewitt
dc8032a5ff
pyfunction: allow required positional after option
2022-01-11 00:44:41 +00:00
David Hewitt
2cee7feaaf
Merge pull request #2083 from aviramha/magic_methods
...
verify py method args count
2022-01-07 00:13:05 +00:00
Aviram Hassan
9ae31f2b87
fix tests
2022-01-06 09:59:10 +02:00
David Hewitt
be70e5441b
Merge pull request #2085 from davidhewitt/opt-argument-extraction
...
opt: move fastcall boilerplate out of generated code
2022-01-03 08:13:31 +00:00
Aviram Hassan
50659b6b02
`__ipow__` now supports modulo argument on Python 3.8+.
...
`pyo3-macros-backend` is now compiled with PyO3 cfgs to enable different magic method definitions based on version.
Add check for correct number of arguments on magic methods.
2022-01-03 09:53:56 +02:00
David Hewitt
1a782ce4db
opt: move fastcall boilerplate out of generated code
2022-01-03 00:07:32 +00:00
David Hewitt
cf965155f4
pymethods: support buffer protocol
2021-12-30 15:48:55 +00:00
David Hewitt
e33b3e6a5b
opt: don't emit T::dict_offset and T::weakref_offset without attributes
2021-12-30 14:57:27 +00:00