Commit Graph

80 Commits

Author SHA1 Message Date
Icxolu ee89b2e8e2
deprecate `wrap_pyfunction` with `py` argument (#3954)
* deprecate `wrap_pyfunction` with `py` argument

The Python token in `wrap_pyfunction` is not handled automatically by
`WrapPyFunctionArg`, for backwards compatibility. This uses deref
specialization to deprecate this variant.

* merge `Extractor`s

* add deprecation ui test, revert closure variant due to test failure

* fix nightly
2024-03-12 22:57:03 +00:00
Icxolu 908e661237
deprecate gil-refs in "self" position (#3943)
* deprecate gil-refs in "self" position

* feature gate explicit gil-ref tests

* fix MSRV

* adjust bracketing

---------

Co-authored-by: David Hewitt <mail@davidhewitt.dev>
2024-03-09 09:52:12 +00:00
Icxolu 61bc02d927
deprecate `PyCell::new` in favor of `Py::new` or `Bound::new` (#3872)
* deprecate `PyCell::new` in favor of `Py::new` or `Bound::new`

* update deprecation warning

Co-authored-by: David Hewitt <mail@davidhewitt.dev>

---------

Co-authored-by: David Hewitt <mail@davidhewitt.dev>
2024-02-20 07:45:47 +00:00
Lily Foote 76dabd4e60
Replace as_ref(py) with Bound APIs (#3863) 2024-02-19 22:39:54 +00:00
David Hewitt 4efc4b82a3
ci: fix redundant import warnings on nightly (#3873) 2024-02-19 22:07:05 +00:00
Icxolu 4ce9c35983
port `Python::get_type` to `Bound` API (#3846)
* port `Python::get_type` to `Bound` API

* fix `is_subclass_and_is_instance` FIXME
2024-02-18 18:27:19 +00:00
David Hewitt ec6d587218
support `Bound` for `classmethod` and `pass_module` (#3831)
* support `Bound` for `classmethod` and `pass_module`

* `from_ref_to_ptr` -> `ref_from_ptr`

* add detailed docs to `ref_from_ptr`
2024-02-16 00:36:11 +00:00
Icxolu e45fbe493c port `IntoPyDict` to `Bound` API 2024-02-10 15:47:26 +01:00
David Hewitt eed196329d add list bound constructors 2024-01-27 21:12:55 +00:00
Adam Reichold 416d3c488f Rename name to qualname and full_name to name to better match Python 2023-12-19 16:51:24 +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 7d486bb72a tests/common.rs -> src/tests/common.rs 2023-09-24 13:34:53 +01:00
David Hewitt 4f3fcdbf0f remove all functionality deprecated in PyO3 0.18 2023-06-13 22:27:43 +01:00
Kang Seonghoon 24343f2caa Fix a span site of `_slf` for custom receivers. 2023-05-23 10:25:57 +09:00
David Hewitt 7a2b1f0e13 fix `non_snake_case` lint for `#[pyfunction]` generated code 2023-02-28 08:44:17 +00:00
David Hewitt 226bf97ec0 Fix `clippy::redundant_closure` lint firing for pyfunction defaults 2023-02-27 22:10:06 +00:00
David Hewitt 33871b7aea allow **kwargs to take arguments which conflict with positional-only parameters 2022-12-17 07:22:28 +00:00
David Hewitt 8e8b484169
add `#[pyo3(signature = (...))]` attribute (#2702) 2022-10-25 07:23:21 +01:00
David Hewitt c445eba28d pyfunction: fix compile error for Option<&T> argument with a default 2022-09-20 15:44:55 +02:00
mejrs 984fdf57c7 Use Python:;with_gil in tests 2022-07-19 19:34:23 +02: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
cuishuang 19e32a0621 fix some typos
Signed-off-by: cuishuang <imcusg@gmail.com>
2022-04-24 22:06:32 +08:00
mejrs 6f1cf1b662 Add more lints 2022-03-23 08:07:28 +01:00
David Hewitt ddf13ea98f clippy: enable some more lints 2022-03-03 07:23:28 +00:00
David Hewitt 6433d884fc dev: remove self dev dependency 2021-12-08 07:48:58 +00:00
David Hewitt 4b2345fe80 pymethods: support __call__ proto 2021-10-23 00:06:46 +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
scalexm 7e8eeec02f Add a test 2021-06-25 00:18:53 +02:00
David Hewitt ce851ad7d9 1506: fixes to macro hygiene 2021-03-28 11:01:51 +01:00
David Hewitt e34e87ad4a 1505: add CHANGELOG and test 2021-03-20 08:36:19 +00:00
kngwyu 9b88a452e2 Refactor tests to use shorter macros 2021-03-14 23:43:53 +09:00
David Hewitt 29a525b327 pyfunction: refactor argument extraction 2021-03-01 17:49:46 +00:00
David Hewitt ffd5874c3a pyfunction: fix args conflicting with keyword only arg 2021-03-01 17:49:46 +00:00
David Hewitt b2675b11fe rust 1.50: clippy and lint fixes 2021-02-11 22:03:34 +00:00
David Hewitt 9807ef8ed4 macros-backend: fix raw idents in pymethods 2021-01-12 22:01:11 +00:00
Alex Gaynor 140790b15f Merge branch 'master' into abi3-merge-master 2020-10-10 10:11:49 -04:00
dvermd df984ec8df
Keyword only arguments (#1209)
* allow keyword arguments without default value

* allow keyword-only arguments
2020-10-01 13:34:54 +09:00
Alex Gaynor 117f60bed0 Make PyType::name abi3 compatible
The implementation is more complex, because there's no equivalent to tp_name in the limited API
2020-09-08 12:22:59 -04:00
kngwyu f5f2e84f4b Enable &Self in #[pymethods] again 2020-07-28 20:55:38 +09:00
David Hewitt 4ed9748b45 Rename exceptions to PyException etc; reintroduce deprecated ones 2020-07-18 06:02:57 +01:00
kngwyu 1e39071c04 Retrieve FromPyObject implementation for &PySequence 2020-03-22 20:00:21 +09:00
kngwyu cea707dd1c Inhibit positional args after * 2020-03-06 14:01:27 +09:00
kngwyu 25069baef4 Fix the interpretation of '*' 2020-03-04 23:48:46 +09:00
kngwyu 96115eaaaa Refactor some tests in test_methods 2020-03-04 20:35:46 +09:00
kngwyu bbe4393b1e Add more tests in method_with_pyclassarg 2020-03-04 20:25:30 +09:00
kngwyu e63e0cbf5a Make it enable to take &PyClass as arguments as pyfunctions/methods 2020-03-04 13:37:26 +09:00
kngwyu 2fd2185052 Merge branch 'master' into pycell 2020-02-17 00:07:15 +09:00
kngwyu 8f8b42591a Fix PySelf and AsPyRef 2020-02-16 23:54:55 +09:00
David Hewitt d5509424b2 Make #[pymethods] aware of #[cfg] 2020-02-15 14:07:48 +00:00
kngwyu a2408cacbb Rename PyClassShell with PyCell 2020-02-08 15:05:13 +09:00