David Hewitt
226bf97ec0
Fix clippy::redundant_closure
lint firing for pyfunction defaults
2023-02-27 22:10:06 +00:00
David Hewitt
c7cc48f8e4
use PyO3 types within LazyTypeObject
2023-02-18 09:06:36 +00:00
David Hewitt
00ddd21535
change PyModule::add_class to return an error if class creation fails
2023-02-14 22:08:35 +00:00
David Hewitt
201964ce3b
don't parse doc attributes unnecessarily
2023-02-13 21:05:44 +00:00
David Hewitt
dbeb3b4453
move some private internals out of public implementation
2023-02-11 21:28:27 +00:00
David Hewitt
92cca896de
release notes for 0.18.1
2023-02-07 21:38:07 +00:00
David Hewitt
96efb0eda9
add better error message for Python in signature
2023-02-03 06:57:30 +00:00
bors[bot]
d118ee3a73
Merge #2923 #2924
...
2923: hygiene: fix `#[pymethods(crate = "...")]` r=davidhewitt a=davidhewitt
Got to the bottom of the hygiene issue in test of #2914
Turns out that `#[pymethods] #[pyo3(crate = "...")]` works, but `#[pymethods(crate = "...")]` was ignoring the argument.
Added a tweak to fix this and a snippet in the hygiene test (which fails on `main`).
2924: remove unneeded into_iter calls r=davidhewitt a=davidhewitt
Clippy complaining about these to me this morning locally.
Co-authored-by: David Hewitt <1939362+davidhewitt@users.noreply.github.com>
2023-01-27 09:31:20 +00:00
David Hewitt
1a4153f718
remove unneeded into_iter calls
2023-01-27 08:20:03 +00:00
David Hewitt
e4a3d2893a
refactor docstring generation code
2023-01-27 06:38:04 +00:00
David Hewitt
89d4ae1dbf
rename wrap_pyfunction
impl to wrap_pyfunction_impl
2023-01-19 08:51:44 +00:00
David Hewitt
224a4160b4
release: 0.18.0
2023-01-17 19:04:30 +00:00
Sunyeop Lee
8026f3521e
Improve derive(FromPyObject) to apply intern! when applicable
2023-01-15 13:39:06 +00:00
David Hewitt
8f48d157d6
deprecate required arguments after option arguments without signature
2023-01-15 10:17:20 +00:00
bors[bot]
8af48bbb53
Merge #2796
...
2796: Forward cfgs on pyclass fields to the method defs r=davidhewitt a=mejrs
With this and the cfg_attr PR, I don't need cfg_eval at all anymore :)
- [x] needs some more tests
Co-authored-by: mejrs <>
2022-12-29 16:28:26 +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
mejrs
44310ec7e0
Forward cfgs on pyclass fields to the method defs
2022-12-06 22:38:32 +01:00
bors[bot]
08423557d4
Merge #2739
...
2739: error when `#[pyo3(signature = ())]` used on invalid methods r=davidhewitt a=davidhewitt
A follow-up to #2702 to reject some invalid applications of `#[pyo3(signature = (...))]` attribute, specifically on magic methods and getters / setters / class attributes.
Co-authored-by: David Hewitt <1939362+davidhewitt@users.noreply.github.com>
2022-11-22 19:41:27 +00:00
David Hewitt
8ca41be87b
Merge pull request #2749 from PyO3/2748-fix
...
Fix being able to call arg-less `#[new]` with any args from Python
2022-11-20 11:39:42 +00:00
Georg Brandl
ea9da80ab1
macros: fix the check for applying METH_NOARGS
...
to only consider the Python argument list.
Fixes #2750
2022-11-20 09:00:42 +01:00
Georg Brandl
2a630a2a52
Fix being able to call arg-less #[new]
with any args from Python
...
Fixes #2748
2022-11-20 08:25:19 +01:00
David Hewitt
00fc0358b9
error when #[pyo3(signature = ())]
used on invalid methods
2022-11-17 08:28:34 +00:00
David Hewitt
548e90fcec
release: 0.17.3
2022-11-01 20:47:46 +00: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
bd40011e93
release: 0.17.2
2022-10-04 08:13:53 +01: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
David Hewitt
c445eba28d
pyfunction: fix compile error for Option<&T> argument with a default
2022-09-20 15:44:55 +02:00
Jonathan Coates
26a9603519
Some improvements to __richcmp__ on enums
...
- Implement __ne__ as well as __eq__.
- Return NotImplemented when types cannot be converted, rather than
throwing.
- Compare the integer ids inside the __eq__/__ne__ implementation.
Previously a match block was generated.
2022-09-16 15:30:56 +01:00
David Hewitt
5718adeec7
pyproto: remove deprecated feature
2022-09-06 08:38:44 +01:00
David Hewitt
caaf7bbda7
release: 0.17.1
2022-08-28 08:27:56 +01:00
David Hewitt
058af11c4d
pyfunction: fix clippy lint on **kwargs argument
2022-08-26 20:27:44 +01:00
David Hewitt
9d543b3f4b
pyfunction: fix from_py_with on Option<T> argument
2022-08-25 18:57:17 +01:00
David Hewitt
04c1ac87f1
release: 0.17.0
2022-08-23 21:21:19 +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
David Hewitt
a3f093d7f0
safety: abort on uncaught panics
2022-08-14 13:47:46 +01:00
David Hewitt
fa19f322d2
Merge pull request #2503 from davidhewitt/extract_argument_holder
...
pyfunction: use extract_argument with holder to avoid extractext
2022-07-17 07:14:53 +01:00
David Hewitt
d5e99b635d
refactor: remove all 0.15 deprecations
2022-07-15 06:33:14 +01:00
David Hewitt
209c942277
pyfunction: use extract_argument with holder to avoid extractext
2022-07-14 08:42:22 +01:00
David Hewitt
c4a2c6c912
clippy: fix some warnings from beta toolchain
2022-07-12 23:02:47 +01:00
David Hewitt
4da9c3a55f
llvm-lines: use iterator to collect class items
2022-06-25 22:03:28 +01:00
David Hewitt
e8e1729723
Merge pull request #2470 from davidhewitt/monomorphizations
...
opt: remove some generic code bloat
2022-06-22 23:44:57 +01:00
David Hewitt
3d9b78062e
opt: remove some generic code bloat
2022-06-22 22:53:32 +01:00
Gabriel Smith
75656949f9
macros: Support #[pyo3(name)] on enum variants
2022-06-22 09:36:40 -04:00
Gabriel Smith
2122faa547
macros: Use macro-defined name for enums in __repr__
2022-06-21 16:31:23 -04: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
0aa4f95a98
frompyobject: improve error messages of derived impls
2022-06-02 11:13:35 +01:00
David Hewitt
e4ec720d51
frompyobject: tidy up generated code
2022-06-02 08:54:20 +01:00
David Hewitt
cfb91057af
frompyobject: improve error message for tuple case
2022-06-02 08:54:20 +01:00
David Hewitt
eafbbc5417
Merge pull request #2399 from davidhewitt/avoid-duplicate-pymethods
...
pymethods: prevent methods sharing the same name
2022-05-24 22:22:31 +01:00
David Hewitt
879eb14e27
Merge pull request #2395 from davidhewitt/fix-class-raw-ident
...
macros: fix raw-ident pyclasses having r# at the start of the Python name
2022-05-24 22:08:56 +01:00
David Hewitt
71abeeff8b
macros: fix raw-ident pyclasses having r# at the start of the Python name
2022-05-24 21:34:23 +01:00
David Hewitt
a306365db8
pymethods: prevent methods sharing the same name
2022-05-24 21:15:30 +01:00
David Hewitt
126bf49b8b
Merge pull request #2377 from herquan/herquan_cr1
...
Add macro append_to_inittab (issue #2359 )
2022-05-24 08:02:47 +01:00
herquan
2ec477344d
Add macro append_to_inittab
...
Sometimes we need to debug in a real environment with our module installed. `append_to_inittab` will be a wrapper for PyImport_AppendInittab (https://docs.python.org/3/c-api/import.html#c.PyImport_AppendInittab ) and help us to do this
2022-05-24 07:42:15 +01:00
David Hewitt
0de0e3f8d6
Allow #[classattr]
methods to be fallible
2022-05-17 21:19:41 +01:00
David Hewitt
3dcbcb7a95
update main to reflect 0.16.5 release
2022-05-15 20:31:00 +01:00
David Hewitt
7a9e70e2c7
wrap_x: change macros back to macro_rules!
2022-05-14 20:42:07 +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
e9bd41efb2
better mutability inheritance rules
2022-04-21 20:51:28 +01:00
David Hewitt
7118e94947
Merge branch 'main' into immutable
2022-04-19 19:00:33 +01:00
Adam Reichold
d2caa056e9
release: 0.16.4
2022-04-14 07:56:42 +01: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
David Hewitt
1ae0971a09
release: 0.16.3
2022-04-05 04:05:57 +01:00
David Hewitt
9774a7c1c1
Merge pull request #2273 from PyO3/dog-food-intern
...
Make use of intern! macro for attribute names used internally
2022-04-05 00:41:35 +01:00
Adam Reichold
2c95b3abb4
Intern the attribute names used by the derive macro for FromPyObject.
2022-04-04 22:26:14 +02:00
David Hewitt
981eb2d90e
Merge pull request #2265 from davidhewitt/pyclass-mapping
...
pyclass: mapping flag
2022-04-04 19:54:37 +01:00
Adam Reichold
d3dcbd72ba
Add PyString::intern to enable access to Python's built-in string interning. ( #2268 )
2022-04-03 21:07:58 +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
mejrs
00ea040834
Feedback
2022-03-23 13:30:32 +01:00
mejrs
1b9763fef2
Fix merge conflict
2022-03-23 10:10:35 +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
Sergey Kvachonok
7a44aa1070
pyo3-macros-backend: Replace pyo3-build-config
with abi3
feature
...
Python 3.6 and older are not supported by the current PyO3 version,
so the removed interpreter version check was a no-op.
`pyo3_build_config::get()` attempts to read a config file from disk
when PyO3 is cross-compiling, which is probably bad for rust-analyzer
and other IDEs that attempt to sandbox the proc macro code.
2022-03-23 09:48:15 +03:00
David Hewitt
87c79c0319
Merge pull request #2234 from davidhewitt/pyclass-args-refactor
...
pyclass: unify pyclass with its pyo3 arguments
2022-03-22 11:38:05 +00:00
David Hewitt
c734b116f9
macros: fix syn patch version
2022-03-21 23:53:08 +00:00
David Hewitt
5cc3ce99f1
pyclass: unify pyclass with its pyo3 arguments
2022-03-20 08:24:09 +00:00
Adam Reichold
922bbfc92d
release: 0.16.2
2022-03-15 19:20:00 +01:00
David Hewitt
7056bae21f
release: 0.16.1
2022-03-05 16:21:44 +00:00
David Hewitt
ddf13ea98f
clippy: enable some more lints
2022-03-03 07:23:28 +00:00
David Hewitt
4c434a21bd
release: 0.16.0
2022-02-27 20:28:51 +00:00
David Hewitt
b59ee9b54b
misc: tidy ups pre 0.16
2022-02-27 10:02:28 +00: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
7c865fcc25
Merge pull request #2173 from davidhewitt/deprecate-pyproto
...
pyproto: deprecate protocol traits
2022-02-24 23:54:40 +00:00
David Hewitt
424644181b
pymethods: add support for inplace concat & repeat
2022-02-24 23:07:24 +00:00
Rico Hageman
76233e1924
Address pull request comments
2022-02-24 11:27:53 +01:00
Rico Hageman
10804b0d65
Support from_py_with on struct tuples
2022-02-24 00:06:33 +01:00
David Hewitt
6af47c78f1
pymethods: more tests for magic methods
2022-02-16 07:42:25 +00:00
David Hewitt
79123b396c
pyclass: deprecate gc option
2022-02-15 08:01:46 +00:00
David Hewitt
676295b8de
pymethods: support gc protocol
2022-02-15 08:01:23 +00:00
mejrs
a8ec8b4176
Make Pyo3MethodsInventoryFor<class>::new public
2022-02-14 23:27:54 +01: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
75e44585de
refactor: pass tp_alloc and tp_free via slots
2022-02-09 08:07:14 +00:00
David Hewitt
4d471077b4
refactor: inline pyclass_default_items trait
2022-02-08 19:39:37 +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
b05902132
78f5afc82e
Finish implementation for pyclass enums
2022-02-07 22:17:11 +00:00
David Hewitt
e39881c208
refactor: inline pyclass_intrinsic_items
2022-02-06 23:26:57 +00:00
David Hewitt
ecfd2c2434
pyclass: simplify generated code for PyClassImpl
2022-02-05 16:58:01 +00:00
David Hewitt
558549e1c2
pyproto: split into new feature
2022-02-05 16:51:31 +00:00
David Hewitt
53c170078d
pymethods: seq methods from mapping methods
2022-02-05 15:59:22 +00:00
David Hewitt
1beb2bbb2d
opt: optimize argument extraction
2022-02-04 20:53:49 +00:00
David Hewitt
dc8032a5ff
pyfunction: allow required positional after option
2022-01-11 00:44:41 +00:00
David Hewitt
de8174684f
pyfunction: allow wrap_pyfunction to work on imports (even cross-crate)
2022-01-07 08:43:05 +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
David Hewitt
a9b98b7433
pymethods: __ipow__ always receive None on Python 3.7
2022-01-04 22:59:08 +00: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
David Hewitt
807e126178
pyclass: no need to try inherit base dict and weaklist
2021-12-30 14:17:58 +00:00
David Hewitt
ff37f24625
macros: accept paths in wrap_x macros
2021-12-30 12:46:57 +00:00
Bruno Kolenbrander
4d1d859a64
Merge branch 'main' into aliases
2021-12-24 22:28:22 +01:00
David Hewitt
90479ddae4
opt: make argument extraction code smaller
2021-12-24 01:52:15 +00:00
mejrs
6afd80a26f
Create full feature and change doc rendering
2021-12-22 12:09:16 +01:00
David Hewitt
492b7e4c0f
macros: optimize generated code for #[derive(FromPyObject)]
2021-12-22 08:34:05 +00:00
David Hewitt
469d72a001
Merge pull request #2022 from PyO3/pyo3_path
...
Hygiene: offer a way to set path to pyo3 crate
2021-12-09 20:27:48 +00:00
Juniper Parsons
47cf13239f
Disallow positional args after optional args
2021-12-09 10:01:59 -05:00
Georg Brandl
d0381c25e5
pyo3_path: rename internal types/variables to Crate/krate
2021-12-09 09:06:58 +01:00
Daniel Henry-Mantilla
2d49dc33b7
Fix the #[macro_export]
absolute path within the same crate issue
2021-12-09 07:36:48 +01:00
Georg Brandl
a5b76bc365
pyo3_path, part 4: rename to crate
to keep consistent with serde
2021-12-09 07:36:48 +01:00
Georg Brandl
e4f608f605
pyo3_path, part 2: add pyo3_path options and use them.
2021-12-09 07:24:18 +01:00
Georg Brandl
e2c0e34837
pyo3_path, part 1: mechanical replacement ::pyo3
-> _pyo3
2021-12-09 07:24:18 +01:00
David Hewitt
4c8abd1426
rust: support 1.57
2021-12-08 07:10:16 +00:00
b05902132
aac0e566b0
Allow default implementation of slots. Add default __repr__ for enums.
2021-11-29 17:35:18 +08:00
mejrs
64d85e5ebf
part 3
2021-11-27 22:50:01 +01:00
David Hewitt
2ac30ec411
err: tweak names, inlining and docs
2021-11-27 08:26:04 +00:00
mejrs
5648815fff
part1
2021-11-26 17:16:05 +01:00
Georg Brandl
9990bf9d31
Fix some clippy and dead code warnings.
2021-11-24 09:11:39 +01:00
David Hewitt
f17e0d35cd
inventory: update to 0.2
2021-11-22 22:57:58 +00:00
b05902132
d339cd0dc9
Let #[pyclass] reject empty enums.
2021-11-23 01:15:07 +08:00
mejrs
a44e2f8eea
Fix formatting.
2021-11-22 10:19:46 +01:00
Bruno Kolenbrander
3bf9ef0706
Merge branch 'main' into immutable
2021-11-22 10:08:51 +01:00
mejrs
0fa03a67cd
Implement opt-in immutable pyclasses
2021-11-22 09:26:34 +01:00