Commit Graph

5228 Commits

Author SHA1 Message Date
bors[bot] edb9522331
Merge #3152
3152: Fix patch version of our dependency on syn. r=davidhewitt a=adamreichold

Closes #3151 

Co-authored-by: Adam Reichold <adam.reichold@t-online.de>
2023-05-10 20:32:33 +00:00
Adam Reichold 91cdfe4f7d Fix patch version of our dependency on syn. 2023-05-10 22:31:15 +02:00
bors[bot] c7d541b9ad
Merge #3150
3150: Fix Clippy CI job cache to really include the platform. r=messense a=adamreichold

Doesn't really matter since we never build the same target on different platforms, but fixing it will prevent future confusion when reading it. Sorry for the extra lap. 😫

Co-authored-by: Adam Reichold <adam.reichold@t-online.de>
2023-05-10 06:36:01 +00:00
Adam Reichold 9257e78e90 Fix Clippy CI job cache to really include the platform. 2023-05-10 07:59:01 +02:00
bors[bot] 4a0bea2e93
Merge #3062
3062: Stop panic on `fmt::Display` r=davidhewitt a=samuelcolvin

Closes #3060

Co-authored-by: Samuel Colvin <s@muelcolvin.com>
2023-05-10 05:52:40 +00:00
bors[bot] 77b3496f26
Merge #3149
3149: Enable rust-cache on clippy CI jobs as we do for build CI jobs. r=davidhewitt a=adamreichold

Not sure if there was a reason we did not enable this for the Clippy jobs?

Co-authored-by: Adam Reichold <adam.reichold@t-online.de>
2023-05-09 21:15:44 +00:00
bors[bot] 633b592ed5
Merge #2593
2593: docs: mention PyBuffer r=adamreichold a=davidhewitt

Uses PEP 688 `types.Buffer` to describe `PyBuffer<T>` in the conversion tables. Will leave as draft until PEP 688 is finalised.

Closes #954 

Co-authored-by: David Hewitt <1939362+davidhewitt@users.noreply.github.com>
Co-authored-by: Adam Reichold <adam.reichold@t-online.de>
2023-05-09 20:24:37 +00:00
Adam Reichold 0f12d72f7a Enable rust-cache on clippy CI jobs as we do for build CI jobs. 2023-05-09 22:05:57 +02:00
Adam Reichold d29b8a487f Pin web-sys, js-sys and wasm-bindgen to avoid syn 2.0 as it is incompatible with our MSRV. 2023-05-09 22:04:23 +02:00
David Hewitt 7c231a2372 docs: mention PyBuffer 2023-05-09 19:53:39 +01:00
bors[bot] 23e764d1ea
Merge #3146
3146: Added a few lines to document the main difference between maturin and… r=adamreichold a=why-not-try-calmer

… setuptools-rust as far as building manylinux-compliant wheels is concerned.

Co-authored-by: Adrien <mrnycticorax@gmail.com>
2023-05-09 12:55:25 +00:00
Adrien 1676100dfd Added a few lines to document the main difference between maturin and setuptools-rust as far as building manylinux-compliant wheels is concerned.
Added newfragment
2023-05-09 14:54:30 +02:00
Samuel Colvin 5aff2ccc9e stop panic on to_string, report using write_unraisable instead 2023-05-09 12:54:56 +02:00
bors[bot] c27a6333d6
Merge #3029
3029: use dynamic trampoline for all getters and setters r=adamreichold a=davidhewitt

This is an extension to the "trampoline" changes made in #2705 to re-use a single trampoline for all `#[getter]`s (and similar for all `#[setters]`). It works by setting the currently-unused `closure` member of the `ffi::PyGetSetDef` structure to point at a new `struct GetSetDefClosure` which contains function pointers to the `getter` / `setter` implementations.

A universal trampoline for all `getter`, for example, then works by reading the actual getter implementation out of the `GetSetDefClosure`.

Advantages of doing this:
- Very minimal simplification to the macro code / generated code size. It made a 4.4% reduction to `test_getter_setter` generated size, which is an exaggerated result as most code will probably have lots of bulk that isn't just the macro code.

Disadvantages:
- Additional level of complexity in the `getter` and `setter` trampolines and accompanying code.
- To keep the `GetSetDefClosure` objects alive, I've added them to the static `LazyTypeObject` inner.
- Very slight performance overhead at runtime (shouldn't be more than an additional pointer read). It's so slight I couldn't measure it.

Overall I'm happy to either merge or close this based on what reviewers think!

Co-authored-by: David Hewitt <1939362+davidhewitt@users.noreply.github.com>
2023-05-09 08:50:45 +00:00
bors[bot] 7b443cf813
Merge #2981
2981: Remove 0.17 deprecations r=adamreichold,davidhewitt a=davidhewitt

Since #2980 starts a breaking change for 0.19, let's also clean up all 0.17's deprecations.

I've removed `Python::acquire_gil` in its own commit, as that was a reasonably chunky removal.

Co-authored-by: Adam Reichold <adam.reichold@t-online.de>
Co-authored-by: David Hewitt <1939362+davidhewitt@users.noreply.github.com>
2023-05-09 08:08:06 +00:00
Adam Reichold 3343d683da Explicitly install the rust-src component as we repeatedly had CI failures when this was installed on-demand in the MSRV Clippy job. 2023-05-09 09:39:23 +02:00
David Hewitt 77eb9bd480 news entry for 0.17 deprecations removals 2023-05-09 09:39:23 +02:00
David Hewitt 996305ac62 remove other deprecations from 0.17 2023-05-09 09:39:23 +02:00
David Hewitt dd24c9ea71 remove `Python::acquire_gil` 2023-05-09 09:39:23 +02:00
Adam Reichold 3c634dd9a9 Add migration guide entry on replacing acquire_gil by with_gil. 2023-05-09 09:39:23 +02:00
bors[bot] c9f383a735
Merge #3142
3142: Do not store return values in locals so that holders benefit from lifetime extension for temporaries. r=davidhewitt a=adamreichold

Closes #3138

Co-authored-by: Adam Reichold <adam.reichold@t-online.de>
2023-05-09 07:23:55 +00:00
David Hewitt 1ea57cb9ad use dynamic trampoline for all getters and setters 2023-05-09 08:09:59 +01:00
bors[bot] 6281b47954
Merge #3004
3004: Unwrap dynamic error types when inner is simple `PyErr` r=davidhewitt,adamreichold,mejrs a=BlueGlassBlock

This is the first part of suggested improvements in #2998.

This change will make bubbled `PyErr` wrapped in `eyre::Report` / `anyhow::Error` bubble up unchanged, instead of being wrapped in a `PyRuntimeError`.

Co-authored-by: BlueGlassBlock <blueglassblock@outlook.com>
2023-05-09 06:18:33 +00:00
BlueGlassBlock fdd43d0685 feat: unwrap dyn Err when inner is simple PyErr 2023-05-09 07:17:10 +01:00
bors[bot] 8ab3f5fc47
Merge #3141
3141: Add BaseExceptionGroup for Python >= 3.11 r=adamreichold a=adriangb

Not sure if this is totally off base, but it looks like it may be this easy to add support for ExceptionGroup?

Co-authored-by: Adrian Garcia Badaracco <1755071+adriangb@users.noreply.github.com>
2023-05-08 08:39:21 +00:00
Adrian Garcia Badaracco 16d333f9d0
Add BaseExceptionGroup for Python >= 3.11 2023-05-07 15:08:43 -05:00
Adam Reichold a60945faa2 Do not store return values in locals so that holders benefit from lifetime extension for temporaries. 2023-05-06 16:26:18 +02:00
Adam Reichold 0773651407 Add test case requiring the maximum lifetime of the holder references. 2023-05-06 12:42:05 +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
Adam Reichold bd4b550495 Do not assert class text signature using the limited API before version 3.10 as we do not support it. 2023-05-04 18:28:43 +02:00
bors[bot] 22e77b0213
Merge #3131
3131: Extend lifetime of GIL token associated with PyRef(Mut). r=mejrs a=adamreichold



Co-authored-by: Adam Reichold <adam.reichold@t-online.de>
2023-05-04 11:46:09 +00:00
bors[bot] 6356acb2f9
Merge #3120
3120: feat: add #[pyo3(from_item_all)] for FromPyObject r=davidhewitt a=BlueGlassBlock

This PR addresses #3112 by implementing ~~`#[pyo3(item_all)]`~~ `#[pyo3(from_item_all)]`.

Co-authored-by: BlueGlassBlock <blueglassblock@outlook.com>
2023-05-04 07:10:21 +00:00
David Hewitt 8bd17f02c7 support `text_signature` on `#[new]` 2023-05-04 07:15:11 +01:00
bors[bot] 157e0b4ad6
Merge #3129
3129: Fix a crate doc link for IterNextOutput r=adamreichold a=cfour2

This should fix the links [1](https://docs.rs/pyo3/0.18.3/pyo3/pyclass/enum.IterNextOutput.html#:~:text=See%20PyIterProtocol%20for%20an%20example.) and [2](https://pyo3.rs/v0.18.3/class/protocols#:~:text=PyO3%20provides%20the-,IterNextOutput,-enum%20to%20both).

They originally point to, which do not exist now:
1. https://docs.rs/pyo3/0.18.3/pyo3/pyclass/trait.PyIterProtocol.html
2. https://docs.rs/pyo3/0.18.3/pyo3/class/iter/enum.IterNextOutput.html

Co-authored-by: cfour2 <cfour2@protonmail.com>
2023-05-02 18:48:51 +00:00
cfour2 04f129f70f Refine the example for `IterNextOutput`
* Remove the (eventually) stale ref link;
* Typo: couter -> counter;
* Fix the formatting with `cargo fmt`;
2023-05-02 15:15:55 +08:00
cfour2 1ca1dc3ccb Copy an example for `IterNextOutput` from pytests with comments 2023-05-02 15:05:53 +08:00
cfour2 559b540b5c Fix a crate doc link for IterNextOutput 2023-05-02 15:05:53 +08:00
Adam Reichold 63a9093510 Extend lifetime of GIL token associated with PyRef(Mut). 2023-05-01 20:57:08 +02:00
bors[bot] f9cb5e5cb0
Merge #3130
3130: Make sure to upgrade pip before trying to install nox. r=adamreichold a=adamreichold



Co-authored-by: Adam Reichold <adam.reichold@t-online.de>
2023-05-01 16:35:08 +00:00
Adam Reichold b52730ac27 Make sure to upgrade pip before trying to install nox. 2023-05-01 18:13:49 +02:00
Adam Reichold ed997ed178 venv_backend syntax for set_minimal_package_versions nox session. 2023-05-01 17:53:43 +02: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
BlueGlassBlock f58f55dab4
doc: add news frags 2023-04-25 19:40:59 +08:00
BlueGlassBlock 30b2ed1d85
feat: add #[pyo3(item_all)] for FromPyObject 2023-04-25 19:37:05 +08:00
bors[bot] f060088792
Merge #3119
3119: Fix crate docs links in python_from_rust.md r=adamreichold a=xcharleslin

Thank you for contributing to pyo3!

Please consider adding the following to your pull request:
 - an entry for this PR in newsfragments - see [https://pyo3.rs/main/contributing.html#documenting-changes]
 - docs to all new functions and / or detail in the guide
 - tests for all new or changed functions

PyO3's CI pipeline will check your pull request. To run its tests
locally, you can run ```cargo xtask ci```. See its documentation
 [here](https://github.com/PyO3/pyo3/tree/main/xtask#readme).


Co-authored-by: xcharleslin <4212216+xcharleslin@users.noreply.github.com>
2023-04-25 04:23:38 +00:00