Commit Graph

643 Commits

Author SHA1 Message Date
David Hewitt 23778f5386 pymethods: test and document opt-out of protos 2021-11-10 23:28:01 +00:00
Bruno Kolenbrander 7b9ae8e663
Clean up `Python` documentation (#1963)
* Clean up `Python` documentation

* Apply suggestion

Co-authored-by: David Hewitt <1939362+davidhewitt@users.noreply.github.com>

* Fix some things

* Fix PyPy link

Co-authored-by: David Hewitt <1939362+davidhewitt@users.noreply.github.com>
2021-11-02 23:05:44 +00:00
David Hewitt 3ab32ff01f guide: magic methods in pymethods 2021-10-24 15:59:22 +01:00
David Hewitt 0236879e8e pymethods: test __delete__ 2021-10-24 09:40:32 +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
David Hewitt 54ddd5aad7 tests: move ui tests updated for rust 1.56 to new section 2021-10-22 23:16:39 +01:00
messense d6401966f9 Update UI tests output 2021-10-22 16:40:57 +08: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 5a1660f7c8
Merge pull request #1924 from davidhewitt/rtruediv-rfloordiv
pymethods: support __rtruediv__ and __rfloordiv__
2021-10-17 10:00:11 +01:00
David Hewitt 212404bc23 pymethods: support __rtruediv__ and __rfloordiv__ 2021-10-17 08:33:46 +01:00
laurent 2042906832 pycfunction: add PyCFunction::new_closure rust defined closures 2021-10-17 07:59:50 +01:00
Chris Laplante 3b94f4b70c
Add `anyhow-integration` feature which implements From<anyhow::Error> for PyErr (#1822)
* Add 'anyhow' feature which provides simple From<anyhow::Error> for PyErr impl

This makes it possible to use anyhow::Result<T> as the return type for
methods and functions exposed to Python.

The current implementation just stringifies the anyhow::Error before
shoving it into a PyRuntimeError. Conversion back to the anyhow::Error
is not possible, but it is better than nothing.

Signed-off-by: Chris Laplante <chris.laplante@agilent.com>

* Document `anyhow` feature in the guide

Signed-off-by: Chris Laplante <chris.laplante@agilent.com>

* update changelog to document anyhow feature

* WIP adding tests

* Finish up anyhow feature

* Fix formatting

* Fix tests

* Fix tests

* Apply review suggestions

Co-authored-by: Bruno Kolenbrander <59372212+mejrs@users.noreply.github.com>
Co-authored-by: mejrs <brunokolenbrander@hotmail.com>
2021-10-17 07:54:29 +01:00
Ashley Anderson a21e57a9d3 Fix additional tests after trybuild update 2021-10-11 20:52:24 -04:00
Bruno Kolenbrander 49570db3fc
chore: pin trybuild version (#1906)
chore: pin trybuild version to 1.0.49
2021-10-10 17:22:29 +02:00
mejrs c78b239586 Fix import 2021-10-03 02:30:13 +02:00
mejrs 22b9519f89 Avoid calling IntoIter on array in msrv 2021-10-03 02:09:53 +02:00
mejrs 31589f09e3 Skip pymethods hygiene on `multiple-pymethods` 2021-10-03 01:41:22 +02:00
mejrs af67acb644 Fix ci and add more pymodule tests 2021-10-02 21:04:22 +02:00
mejrs e3477c3cb7 Add to and restructure hygiene tests 2021-10-02 20:44:32 +02:00
David Hewitt c986b5d4ae
Merge pull request #1889 from davidhewitt/py310
packaging: formal support for Python 3.10
2021-09-29 19:36:52 +01:00
David Hewitt 03ba4a5597 ffi: use _Py_NewRef for clarity 2021-09-29 08:02:08 +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 9fa0abe85d
Merge pull request #1864 from davidhewitt/pymethods-protos
pymethods: add support for protocol methods
2021-09-24 22:22:16 +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 70d829de66 gil: try to initialize threads on Python 3.6 if possible 2021-09-17 08:48:21 +01:00
David Hewitt 92e2156161 pymethods: support inplace numerical operations 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
mejrs 4cd9f4b570 import FromPyObject into crate root 2021-09-14 14:07:23 +02:00
mejrs d6973b1b6a clean up lib.rs 2021-09-13 22:58:15 +02:00
mejrs 68cba78a44
chore: update rust 1.55 (#1865)
* chore: update rust 1.55

* move test to 1.55 only

* make ci happy

* make ci happy

* make ci happy

* make ci happy

* make clippy happy

* make ci happy

* formatting
2021-09-12 18:07:24 +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
Georg Brandl 381eb9c501
Apply suggestions from code review
Co-authored-by: mejrs <59372212+mejrs@users.noreply.github.com>
2021-08-29 08:30:05 +02: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 604b28451b
Merge pull request #1841 from PyO3/exception_hygiene
more macro hygiene cleanup: test the exception macros
2021-08-29 07:14:36 +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
Georg Brandl db00a34a56 more macro hygiene cleanup: test the exception macros 2021-08-28 15:45:49 +02:00
David Hewitt 313610993a pyo3-macros-backend: more tests for macro hygiene 2021-08-28 10:28:27 +01:00
Georg Brandl 2979fb8268 tests: fix new clippy warning (does not like Foo::foo) 2021-08-23 15:47:09 +02: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 f79420dabd remove shadowing 2021-08-17 21:38:28 +02:00
mejrs 3be3af4121 fix extends param 2021-08-17 15:19:19 +02:00