Skip to content

Misc cleanups#5970

Merged
davidhewitt merged 8 commits intoPyO3:mainfrom
mejrs:cleanups
Apr 14, 2026
Merged

Misc cleanups#5970
davidhewitt merged 8 commits intoPyO3:mainfrom
mejrs:cleanups

Conversation

@mejrs
Copy link
Copy Markdown
Member

@mejrs mejrs commented Apr 13, 2026

I've been re-familiarizing myself with pyo3 a bit :) While doing so I found some cleanups here and there.

@mejrs mejrs added the CI-skip-changelog Skip checking changelog entry label Apr 13, 2026
Copy link
Copy Markdown
Member

@bschoenmaeckers bschoenmaeckers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great to see you back!

Copy link
Copy Markdown
Member

@davidhewitt davidhewitt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the cleanups & welcome back :)

Comment thread src/impl_/pyclass.rs Outdated
message = "pyclass `{Self}` cannot be subclassed",
label = "required for `#[pyclass(extends={Self})]`",
note = "`{Self}` must have `#[pyclass(subclass)]` to be eligible for subclassing",
note = "with the `abi3` feature enabled, PyO3 does not support subclassing native types",
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually since #5733 we do support on 3.12+ 🎉

Suggested change
note = "with the `abi3` feature enabled, PyO3 does not support subclassing native types",
note = "subclassing native types requires Python >= 3.12 when using the `abi3` feature",

(suggested phrasing matches some similar messages in src/impl_/pyclass/assertions.rs)

@mejrs
Copy link
Copy Markdown
Member Author

mejrs commented Apr 14, 2026

FWIW I haven't blessed the ui tests, so if CI succeeds then something went wrong.

@mejrs
Copy link
Copy Markdown
Member Author

mejrs commented Apr 14, 2026

Trying again; this one should fail as well.

#[cfg(not(any(Py_LIMITED_API, feature = "experimental-inspect")))]
t.pass("tests/ui/forbid_unsafe.rs");
#[cfg(all(Py_LIMITED_API, not(Py_3_12), not(feature = "experimental-async")))]
#[cfg(all(Py_LIMITED_API, not(Py_3_12), feature = "experimental-async"))]
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like this used to be never true? I've inverted the predicate and now it seems to run again.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is probably related to #5913

I am also beginning to play with #5863 which might allow us some room for improvements here.

@davidhewitt davidhewitt added this pull request to the merge queue Apr 14, 2026
Merged via the queue into PyO3:main with commit 251ce29 Apr 14, 2026
46 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CI-skip-changelog Skip checking changelog entry

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants