2833: ci: fix flaky test_pyobject_drop_without_gil_doesnt_decrease_refcnt r=adamreichold a=davidhewitt
Closes#2723
I think `@adamreichold` is correct in what causes the flakiness, and the solution in this case seems straightforward enough - just pass `reference` off to another thread to drop it (as that thread won't have the GIL), no events needed.
Co-authored-by: David Hewitt <1939362+davidhewitt@users.noreply.github.com>
2398: Add `GILOnceCell::get_or_try_init` r=mejrs a=a1phyr
This is similar to [`OnceCell::get_or_try_init`](https://docs.rs/once_cell/latest/once_cell/sync/struct.OnceCell.html#method.get_or_try_init) and is very useful for fallible initialization.
Co-authored-by: Benoît du Garreau <bdgdlm@outlook.com>
Co-authored-by: David Hewitt <1939362+davidhewitt@users.noreply.github.com>
2832: newsfragments: remove incorrect fragment r=davidhewitt a=davidhewitt
Accidentally left this entry in #2826 after splitting out #2827.
Co-authored-by: David Hewitt <1939362+davidhewitt@users.noreply.github.com>
2831: add gh-pages content directly in netlify site r=davidhewitt a=davidhewitt
Last attempt to find a solution for #2819.
By adding the GitHub pages content directly to the netlify site during build, netlify should be able to make better URL redirects.
Co-authored-by: David Hewitt <1939362+davidhewitt@users.noreply.github.com>
2813: ci: run pyo3-ffi-check using nox r=davidhewitt a=davidhewitt
Makes it easier to run pyo3-ffi-check locally :)
Co-authored-by: David Hewitt <1939362+davidhewitt@users.noreply.github.com>
2826: ci: run checks for all platforms on PR r=adamreichold a=davidhewitt
I've been struggling a little to merge PRs with the new bors workflow; overall I think the lighter PR workflow is better but the number of combinations of older pythons / platforms not covered makes it easy for the bors step to fail.
This PR tries to improve the situation by merging the `clippy` and `check-target` job and running it for all supported platforms on PR. Hopefully if these are green, then there's high likelihood that tests will build and should pass unless there's logic errors.
While creating this I found a build error on PyPy which made me notice we can support `PyList::get_item_unchecked` for PyPy, so I added it.
Co-authored-by: David Hewitt <1939362+davidhewitt@users.noreply.github.com>
2784: Automatically generate `__text_signature__` for all functions r=davidhewitt a=davidhewitt
This PR makes it so that PyO3 generates `__text_signature__` by default for all functions. It also introduces `#[pyo3(text_signature = false)]` to disable the built-in generation.
There are a few limitations which we can improve later:
- All default values are currently set to `...`. I think this is ok because `.pyi` files often do the same. Maybe for numbers, strings, `None` and `True`/`False` we could render these in a future PR.
- No support for `#[new]` yet.
Alternative design ideas:
- Only autogenerate for methods with `#[pyo3(signature = (...))]` annotation. I started with this, and then decided it made sense to do it for everything.
- Opt-out with `#[pyo3(text_signature = None)]`. This is slightly harder to parse in the macro, but matches the final result in Python better, so if this looks preferable to others, I can change from `text_signature = false` to `text_signature = None`.
There's some small tidying up / refactoring to do before this merges (happy to take suggestions on this), however the general logic, design and docs are ready for review.
2827: pypy: enable `PyList::get_item_unchecked` r=adamreichold a=davidhewitt
Split out from #2826. Approved previously as part of that review.
Co-authored-by: David Hewitt <1939362+davidhewitt@users.noreply.github.com>
2828: move set-minimal-package-versions to nox r=adamreichold a=davidhewitt
Split from #2826 because #2827 couldn't merge due to `hermit-abi` MSRV break, which this PR also fixes (by pinning its dependent `num_cpus` back).
Co-authored-by: David Hewitt <1939362+davidhewitt@users.noreply.github.com>
2820: netlify: remove trailing slash rewrites r=davidhewitt a=davidhewitt
So adding rewrite rules in #2819 didn't work, created infinite redirect loops. Instead I've enabled the pretty URLs at https://docs.netlify.com/routing/redirects/redirect-options/#trailing-slash, let's see if that works.
Co-authored-by: David Hewitt <1939362+davidhewitt@users.noreply.github.com>
2821: ci: pin more to 3.11.0 r=davidhewitt a=davidhewitt
Still getting some windows failures due to #2817. Pin more stuff for now :(
Co-authored-by: David Hewitt <1939362+davidhewitt@users.noreply.github.com>
2818: pin CI to 3.11.0 as workaround for 2817 r=davidhewitt a=davidhewitt
While we have issues with 3.11.1, let's run 3.11.0 for now in tests so that we can make progress.
2819: netlify: add additional redirects to gh-pages r=davidhewitt a=davidhewitt
Just noticed that https://pyo3.rs/dev/bench has probably been broken since the move to netlify, and that https://pyo3.rs/v0.17.3 doesn't render nicely.
Add some redirects to netlify configuration to handle these cases.
Co-authored-by: David Hewitt <1939362+davidhewitt@users.noreply.github.com>
2800: allow `**kwargs` to take arguments which conflict with positional-only parameters r=davidhewitt a=davidhewitt
Closes#2799
I did a little bit of refactoring at the same time, sorry! The bit which changes behaviour is that in the now-factored-out `handle_kwargs` method, if the keyword argument name is found in the positional-only range then the varkeywords handler is now given a chance to accept it. (Lines 387-390 in new `extract_argument.rs`.)
Co-authored-by: David Hewitt <1939362+davidhewitt@users.noreply.github.com>
2805: check changelog using nox r=messense a=davidhewitt
I wanted to get the green tick when the `CI-skip-changelog` label was applied 😝
... and I didn't think it hurt to use the same tech we use for the rest of the pipeline.
Co-authored-by: David Hewitt <1939362+davidhewitt@users.noreply.github.com>
2806: add .python-version file r=messense a=davidhewitt
This looks like it's recommended for `actions/setup-python` if we don't specify a version in the CI.yml
It may also be helpful for contributors testing using pyenv?
Co-authored-by: David Hewitt <1939362+davidhewitt@users.noreply.github.com>
2795: accept any iterator for `PySet::new` and `PyFrozenSet::new` r=birkenfeld a=davidhewitt
Closes#2789
Looks like it's about 20% faster in the case I benchmarked to use `PySet_Add` directly without the intermediate list.
Co-authored-by: David Hewitt <1939362+davidhewitt@users.noreply.github.com>