Commit Graph

382 Commits

Author SHA1 Message Date
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
b05902132 b7419b5278 Refactor #[pyclass] and now it supports enum.
There's no functionality since it does not generate __richcmp__.

Also it only works on enums with only variants, and does not support
C-like enums.
2021-11-21 20:05:53 +08:00
mejrs a28be4d9bf Revert "Implement by default immutable pyclasses"
This reverts commit 7f31000be2.
2021-11-20 14:58:56 +01:00
David Hewitt c9a4cd1f87 deprecations: remove items deprecated in PyO3 0.14 2021-11-19 16:33:29 +00:00
David Hewitt 6a65f98bd2 msrv: bump to 1.48 2021-11-19 10:10:59 +00:00
David Hewitt eb5059acc7 release: 0.15.1 2021-11-18 07:34:22 +00:00
David Hewitt 26ccc1ab37 macros: fix panic in __get__ implementation 2021-11-15 16:02:59 +00:00
David Hewitt 23778f5386 pymethods: test and document opt-out of protos 2021-11-10 23:28:01 +00:00
mejrs 7f31000be2 Implement by default immutable pyclasses 2021-11-10 15:28:19 +01:00
David Hewitt 47747444c7 release: 0.15.0 2021-11-03 23:00:38 +00:00
David Hewitt 6a3e1e7339 macros: clean up protocol argument extraction a bit 2021-10-31 11:30:34 +00:00
David Hewitt 3ab32ff01f guide: magic methods in pymethods 2021-10-24 15:59:22 +01:00
David Hewitt 0e0e6f8bf5 pymethods: support protocols with `multiple-pymethods` feature 2021-10-23 00:07:35 +01:00
David Hewitt 4b2345fe80 pymethods: support __call__ proto 2021-10-23 00:06:46 +01:00
Azat Ibrakov 7349513f5b
Add fallback for `__mod__` magic method (#1934)
* Add fallback for `__mod__` magic method

* Add 'CHANGELOG' entry

* Complete tests
2021-10-19 23:14:26 +01:00
Ashley Anderson bf26daec2d
Positional-only args (#1925)
* Add support for positional-only args

* Update changelog. Add a few more tests. Run rust-fmt.

* Fix test.

* Fix tests again.

* Update CHANGELOG.md to link PR instead of issue

* Update guide to mention positional-only params

* Add unreachable!() per code review

* Update and expand tests for pos args.

* Fix tests, lint, add UI tests.

Co-authored-by: David Hewitt <1939362+davidhewitt@users.noreply.github.com>
2021-10-19 23:13:27 +01:00
David Hewitt 212404bc23 pymethods: support __rtruediv__ and __rfloordiv__ 2021-10-17 08:33:46 +01:00
Bruno Kolenbrander 8a57fe2d20
Clean up doctests, deny some lints (#1900)
* Clean up doctests, deny some lints

* Apply suggestions from review.

* replace \" with '

* Fix some more doc examples

* Fix formatting

* Fix some more things

* Remove unused parentheses

* Only test class sig on supported abi/platforms

* Only test class signature on correct versions

* Fix tests to compile on msrv

* msrv strikes yet again

* Add feedback

* Pin `half` to 1.7.1 on msrv
2021-10-14 22:15:25 +01:00
mejrs ed991d23a3 Fix ambiguous imports 2021-10-02 19:00:51 +02:00
Mo Mirza 4a34cc63a6
Remove use of unwrap (#1888)
* Remove use of unwrap

* Update changelog

* Update CHANGELOG.md

Co-authored-by: Mo Mirza <mo.mirza@iwoca.co.uk>
Co-authored-by: David Hewitt <1939362+davidhewitt@users.noreply.github.com>
2021-09-26 09:01:23 +01:00
David Hewitt 9e80f3dfdd pep 604: use `T | U` instead of `Union[T, U]` in messaging 2021-09-24 22:46:25 +01:00
David Hewitt 179b5d1f47 pymethods: fix support for MSRV 2021-09-18 16:42:02 +01:00
David Hewitt 592c98c722 pymethods: disable protocols with multiple-pymethods for now 2021-09-18 13:08:24 +01:00
David Hewitt a551b005b4 pymethods: finish support for number protocol 2021-09-18 12:59:25 +01:00
David Hewitt c2d78ca76e pymethods: faster compilation for protos, tidy ups 2021-09-18 09:49:05 +01:00
David Hewitt 43eb762346 pymethods: support most numerical methods 2021-09-18 00:31:17 +01:00
David Hewitt 92e2156161 pymethods: support inplace numerical operations 2021-09-17 08:13:54 +01:00
David Hewitt c090b6581d pymethods: fix clippy errors 2021-09-17 08:13:54 +01:00
David Hewitt 5210517695 pymethods: implement more mapping methods 2021-09-17 08:13:54 +01:00
David Hewitt fda18b07d7 pymethods: implement some mapping methods 2021-09-17 08:13:54 +01:00
David Hewitt b544b5a6d7 pymethods: support iter and async protocols 2021-09-17 08:13:54 +01:00
David Hewitt 8408328cb3 pymethods: add support for protocol methods 2021-09-17 08:13:54 +01:00
David Hewitt dca02a92ce changelog: updates for 0.14.5 backports 2021-09-05 15:19:36 +01:00
Gregory Szorc 1e951d5d8b pyo3-build-config: add a crate feature to control build script
I have a use case in PyOxidizer where I want to use the
pyo3-build-config crate as a library crate so I can access the
`InterpreterConfig` struct so I can read/write config files without
reinventing the wheel.

This is doable before this commit. But it requires that the
build environment have a Python interpreter. This is undesirable
for library usage.

This commit introduces a cargo feature flag to control whether the
build script does anything. The feature flag must be present for
the build script to resolve a config. The feature flag is enabled
by default for backwards compatibility. The pyo3 and pyo3-macros-backend
crates use this feature by default, for backwards compatibility and
because it is the reasonable default.

This is probably room to conditionalize some APIs and other behavior
based on this feature flag. But we stop short of doing that for
the time being.
2021-09-01 19:44:54 -07:00
David Hewitt b7c62b8a53
Merge pull request #1846 from davidhewitt/changelog-release-0.14.4
changelog: updates for 0.14.4
2021-08-30 08:19:53 +01:00
David Hewitt f4c834f5fc
Merge pull request #1843 from PyO3/pymethods_hygiene
more macro hygiene cleanup: test #[pymethods] and more arg parsing and protos
2021-08-29 11:26:10 +01:00
David Hewitt 5119bad580 changelog: updates for 0.14.4 2021-08-29 08:07:44 +01:00
David Hewitt 95a11d0725
Merge pull request #1842 from PyO3/frompyobject_hygiene
more macro hygiene cleanup: test the FromPyObject derive macro
2021-08-29 07:15:16 +01:00
David Hewitt f76535fd07 pyo3-macros-backend: support macros inside doc attributes 2021-08-28 22:47:20 +01:00
Georg Brandl 6f75fc8eb7 more macro hygiene cleanup: test #[pymethods] and more arg parsing and protos 2021-08-28 18:05:32 +02:00
Georg Brandl 585487c3c1 more macro hygiene cleanup: test the FromPyObject derive macro 2021-08-28 16:42:29 +02:00
David Hewitt 313610993a pyo3-macros-backend: more tests for macro hygiene 2021-08-28 10:28:27 +01:00
David Hewitt bc1a983371 changelog: update for 0.14.3 release 2021-08-22 01:25:29 +01:00
David Hewitt 0613b5a8f8
Merge pull request #1805 from mejrs/proc_macro_hygiene
Test proc macro hygiene for `#[pyclass]` macro.
2021-08-18 19:08:41 +01:00
mejrs 21196e68e2 fully disambiguate types 2021-08-17 22:32:41 +02:00
Aviram Hassan c6255e6734 - `PyList`, `PyTuple` and `PySequence`'s `get_item` now accepts only `usize` indices instead of `isize`.
- `PyList` and `PyTuple`'s `get_item` now always uses the safe API. See `get_item_unchecked` for retrieving index without checks.
2021-08-17 15:01:22 +01:00
mejrs 370968b595 test macro hygiene for pyclass 2021-08-16 16:32:11 +02:00
Gregory Szorc 410c9f13c9 macros: raise AttributeError on property deletion requests
The setter function will receive a NULL value on deletion requests.
This wasn't properly handled before, leading to a panic.

The new code raises AttributeError in this scenario instead.

A test for the behavior has been added. Documentation has also
been updated to reflect the behavior.
2021-08-13 21:01:00 -07:00
David Hewitt 1873264b7d release: 0.14.2 2021-08-09 07:58:31 +01:00
Dean Li 1086fdb965
fix compiler warning
Fix issue [link](https://github.com/rust-lang/rust/issues/79813) which
will eventually deny trailing semicolons in expression macro in rust compiler.
2021-08-07 16:31:54 +08:00
R2D2 d809e50c9b Replaced require_gil with Python::with_gil in test_frompyobject.rs. Removed all unsafe code from macro generated code. Two other small fixes 2021-08-02 09:49:13 +02:00
R2D2 5b8efdd6e2 Refactored to prevent re-acquiring the gil 2021-08-01 22:38:34 +02:00
R2D2 3cfc76ae93 Reworked struct error messages to use the of an error rather than concatenating all error messages 2021-07-31 23:21:07 +02:00
R2D2 403d882d6c Merge branch 'main' of https://github.com/PyO3/pyo3 into enhanced_extract_type_errors 2021-07-31 21:21:10 +02:00
R2D2 a42447bfe2 Small refactor 2021-07-31 21:20:57 +02:00
Jacob Turner 363383ea84
Update pyo3-macros-backend/src/from_pyobject.rs
Co-authored-by: David Hewitt <1939362+davidhewitt@users.noreply.github.com>
2021-07-31 20:38:44 +02:00
David Hewitt ee9a1678d5 rust: updates for rust & clippy 1.54 2021-07-31 08:19:38 +01:00
David Hewitt a7244b864d testing: use `mod tests` instead of `mod test` 2021-07-26 18:19:53 +01:00
Alex Gaynor 82697bfec0
workaround an issue that causes function arguments to show up as if they are uncovered
https://github.com/rust-lang/rust/issues/86972 describes this issue in some detail and links to a minimal reproducer

making this change, and this change alone, resolves the coverage issues
2021-07-14 23:38:08 -04:00
David Hewitt d11943ab6d macros-backend: don't error on #[doc(hidden)] 2021-07-08 23:41:24 +01:00
David Hewitt 3f8c4ad38e release: 0.14.1 2021-07-04 16:49:36 +01:00
David Hewitt adf6bdba8e release: 0.14.0 2021-07-03 08:37:00 +01:00
mejrs c07c5a4c93 Add full path for PyCell 2021-07-03 07:51:18 +01:00
David Hewitt 542a6124b1
Merge pull request #1696 from scalexm/unwrap
Unwrap `syn::*::Group` in a few places
2021-06-29 22:12:49 +01:00
David Hewitt 8fb4ce6fbc pyo3-build-config: fix cross compilation 2021-06-26 14:19:03 +01:00
scalexm 20fa398fdb Unwrap `syn::*::Group` in a few places 2021-06-25 00:12:38 +02:00
scalexm 53773d5484 Use explicit lifetimes in proc-macro expansion 2021-06-25 00:02:21 +02:00
David Hewitt 67948a24f7 while let unwrap_group 2021-06-24 09:11:27 +01:00
Giles Cope aaad7ffd63 Need to be able to create structs via macro_rules
(Currently only possible using tt escape type.)
2021-06-24 08:40:49 +01:00
David Hewitt f916867375 pyclass: refactor initialization, call native type dealloc 2021-06-23 07:45:51 +01:00
R2D2 ec40446fa3 Removed stray newline character from error message 2021-06-09 14:23:16 +02:00
R2D2 e6da1ebc73 Fixed formatting of error messages and tests 2021-06-09 11:40:14 +02:00
David Hewitt b081e37de5
Merge pull request #1665 from PyO3/kwds_varargs
Argument parsing: use VARARGS for *any* function taking **kwds
2021-06-07 23:23:05 +01:00
R2D2 35060f4693 Removed unused custom keyword in macros 2021-06-07 11:50:15 +02:00
R2D2 0b3fbb5533 Fixed formatting 2021-06-07 10:26:58 +02:00
R2D2 973f0a5bae Removed the custom error messages from the macro api 2021-06-07 10:18:38 +02:00
Georg Brandl b60a56d9fd Reorganize method wrapper generation
Remove unneded splitting of functions in two, and reorder the
functions to order of the main match {} in gen_py_method().
2021-06-07 07:33:28 +02:00
Georg Brandl f12c1a4005 Argument parsing: use VARARGS for *any* function taking **kwds 2021-06-06 15:58:19 +02:00
David Hewitt 18e0aa17e0 pymodule: accept `#[pyo3(name = "...")]` option 2021-06-06 08:41:20 +01:00
Georg Brandl bd6788b2fa Argument parsing: optimize the f(*args, **kwds) case.
Use the VARARGS calling convention and just pass through the two objects.
2021-06-06 07:48:38 +02:00
Georg Brandl c670c57ddb Refactor PyMethodDef creation too. 2021-06-06 07:07:48 +02:00
Georg Brandl a8d2649032 Refactor wrapper generation, and enable fastcall for static/class methods. 2021-06-06 07:07:46 +02:00
David Hewitt 9b8b133905 pyfunction: document `#[pyo3(pass_module)]` 2021-06-05 17:36:50 +01:00
David Hewitt cec4c2d2e9 text_signature: move to `#[pyo3(text_signature = "...")]` 2021-06-05 16:33:03 +01:00
Georg Brandl 3e8d003faf Implement METH_FASTCALL for pyfunctions and pymethods. 2021-06-05 12:57:22 +02:00
David Hewitt d011467e63 pyclass: allow `#[pyo3(get, set, name = "foo")]` 2021-06-04 11:30:40 +01:00
R2D2 416b1132b4 Added custom error messages to enum fields and container types. Covered with tests. Fixed formatting and linting issues 2021-06-01 22:44:16 +02:00
R2D2 1a8fec2e88 Added detailed TypeError messages to enums with derive(FromPyOjbect) 2021-05-31 17:38:15 +02:00
R2D2 4a99bfaaba Fixed tests after modifying TypeErrors originating from structs. Started work on TypeError message on Enums 2021-05-31 00:28:53 +02:00
Tim Robinson 1ba32178dd Method and slot visitors accept slices instead of individual items 2021-05-29 09:38:15 +01:00
Tim Robinson 030aa43544 Simplify code generated for for_each_method_def and for_each_proto_slot 2021-05-29 09:10:38 +01:00
R2D2 1843ff20fd Added support for enhanced errors for the FromPyObject trait derived on tuples and newtype structs/tuples 2021-05-28 00:38:32 +02:00
R2D2 8981b84b79 Added customizable conversion error message for type errors encounted in FromPyObject::extract 2021-05-28 00:24:47 +02:00
R2D2 d71d4329ae Changed format of TypeError messages 2021-05-27 22:36:19 +02:00
R2D2 f68ab481ba Added improved error messages to the derive FromPyObject macro for basic structs and enums 2021-05-27 15:42:57 +02:00
messense 5523ad6d5b
Merge pull request #1633 from davidhewitt/async-fn-error
pyfunction: better error message with `async fn`
2021-05-26 14:33:52 +08:00
David Hewitt 9f74336bc9 pyfunction: better error message with `async fn` 2021-05-25 11:32:52 +01:00
David Hewitt 355bd0c336 pymodule: tidy up module init 2021-05-25 10:54:16 +01:00
David Hewitt 9a4e7b5877
Merge pull request #1622 from davidhewitt/pyo3-build-config
pyo3-build-config: new crate to re-use build.rs across crates
2021-05-25 07:11:24 +01:00
David Hewitt 284ad1f98a pyo3-build-config: fix build 2021-05-21 23:05:36 +01:00
David Hewitt 825ec08681 pyo3-build-config: docs wip 2021-05-21 08:34:51 +01:00
David Hewitt 79c7149d52 pyo3-build-config: new crate to re-use build.rs across crates 2021-05-20 09:03:33 +01:00
David Hewitt a109640850 pyfn: deprecate name argument 2021-05-20 08:54:29 +01:00
Georg Brandl f6e4399f26 pyfunction: use METH_NOARGS for no-argument functions
As suggested in #1607.

If I ran the benchmarks correctly, this shaves only about 5ns from
the noargs case.  But since it's relatively easy to do...
2021-05-17 07:53:24 +02:00
Tim Robinson 735a9a1156 Update for_each_proto_slot for consistency 2021-05-13 17:32:59 +01:00
Tim Robinson c3b935f06c Reduce size of compiled code for class initialization 2021-05-13 13:08:58 +01:00
Tim Robinson 32dc93e389 Shorten typical argument extraction checks 2021-05-13 13:06:38 +01:00
David Hewitt 48e98818cf [review] kngwyu 2021-05-07 22:35:52 +01:00
David Hewitt 4d46abde73 macros: support `#[pyo3(name = "...")]` 2021-05-07 22:35:52 +01:00
David Hewitt 4613b3dd7e
Merge pull request #1596 from davidhewitt/remove-pytypeinfo-layout
type_object: remove layout and base type from PyTypeInfo
2021-05-07 22:32:24 +01:00
David Hewitt 7536554ceb type_object: remove layout and base type from PyTypeInfo 2021-05-04 21:39:42 +01:00
mejrs 78c2d40cb8 install doc_cfg feature and workflow 2021-05-02 21:10:53 +02:00
David Hewitt 48823e22d6 pyproto: deprecate py_methods 2021-04-20 00:21:19 +01:00
David Hewitt ce851ad7d9 1506: fixes to macro hygiene 2021-03-28 11:01:51 +01:00
David Hewitt 246335bee2
Merge pull request #1505 from scalexm/macro
Ignore `syn::Type::Group` in `is_python`
2021-03-20 11:09:04 +00:00
Yuji Kanagawa f0763f069e
Merge pull request #1507 from scalexm/getter-name
Allow `#[name]` with `#[getter]` and `#[setter]`
2021-03-20 16:23:07 +09:00
messense 2cec240b0e Ban pyo3(get, set) on tuple struct field 2021-03-19 10:17:06 +08:00
messense 773a371ba5 Add tuple and unit struct support for pyclass macro 2021-03-19 10:17:06 +08:00
scalexm b27ee3fd64 Allow `#[name]` with `#[getter]` and `#[setter]` 2021-03-18 19:35:17 +01:00
scalexm adc6e6fe4e Ignore `syn::Type::Group` in `is_python` 2021-03-18 18:56:53 +01:00
Yuji Kanagawa 6137e3a726
Merge pull request #1456 from davidhewitt/pyclass-impl-flags
pyclass: move flags to PyClassImpl
2021-03-17 12:50:49 +09:00
David Hewitt dab62a5835
Merge pull request #1495 from davidhewitt/macros-wrapper-expressions
macros-backend: make __wrap fns expressions
2021-03-16 07:26:15 +00:00
messense e6374240b1 Get rid of _LOCATION 2021-03-15 16:47:25 +08:00
messense 10339ea61f Add `()` inside of `FunctionDescription::full_name()`
Co-authored-by: David Hewitt <1939362+davidhewitt@users.noreply.github.com>
2021-03-15 16:20:55 +08:00
messense c70eba1aaa Fix wrong class name in function call error message 2021-03-15 14:24:19 +08:00
David Hewitt 3891788aa7 macros-backend: make __wrap fns expressions 2021-03-14 17:21:57 +00:00
David Hewitt d9fe404d69 [review] kngwyu 2021-03-14 00:50:59 +00:00
David Hewitt 66b3022d0e
Merge pull request #1483 from davidhewitt/macros-tidy-ups
pymethods: macros tidy-ups
2021-03-14 00:09:23 +00:00
David Hewitt 31c7af2ac7 pyclass: move flags to PyClassImpl 2021-03-13 22:44:53 +00:00
David Hewitt e55fe205ed msrv: remove use of matches! macro 2021-03-12 07:28:49 +00:00
David Hewitt 9613228a0c pyfunction: reject generic functions 2021-03-09 23:47:47 +00:00
David Hewitt 78080ebbd2 macros-backend: support noargs for pyproto py_methods 2021-03-08 23:56:08 +00:00