Skip to content

fix clippy::clone_on_copy firing on #[pyclass(from_py_object)] + Copy classes - #6309

Merged
davidhewitt merged 3 commits into
PyO3:mainfrom
alex:fix-clone-on-copy-from-py-object
Aug 8, 2026
Merged

fix clippy::clone_on_copy firing on #[pyclass(from_py_object)] + Copy classes#6309
davidhewitt merged 3 commits into
PyO3:mainfrom
alex:fix-clone-on-copy-from-py-object

Conversation

@alex

@alex alex commented Aug 8, 2026

Copy link
Copy Markdown
Member

Move the clone out of the generated FromPyObject impl into a generic helper where the type is only known to be Clone, so the lint cannot trigger. Fixes #6308.

@alex
alex force-pushed the fix-clone-on-copy-from-py-object branch 2 times, most recently from 4f663c2 to b983002 Compare August 8, 2026 12:46
@alex

alex commented Aug 8, 2026

Copy link
Copy Markdown
Member Author
  error: File not found: `.github/uv-constraints.txt`

hmm, looks like there's some other CI issue?

…`Copy` classes

Move the clone out of the generated `FromPyObject` impl into a generic
helper where the type is only known to be `Clone`, so the lint cannot
trigger. Fixes PyO3#6308.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@alex
alex force-pushed the fix-clone-on-copy-from-py-object branch from b983002 to 08d75b0 Compare August 8, 2026 12:48
alex and others added 2 commits August 8, 2026 09:06
The generated `extract` body no longer references `FromPyObject` items
inline, which changes how rustc renders the trait path in unrelated
diagnostics in the same crate.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Same trimmed-path diagnostic drift as the `inspect` revision; this
snapshot only runs without `experimental-inspect` enabled.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

@mejrs mejrs left a comment

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.

Thanks!

@mejrs
mejrs added this pull request to the merge queue Aug 8, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Aug 8, 2026
@alex

alex commented Aug 8, 2026

Copy link
Copy Markdown
Member Author

Failures don't look related. Are these known flakes or did somehting else break?

@alex
alex added this pull request to the merge queue Aug 8, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Aug 8, 2026
@alex

alex commented Aug 8, 2026

Copy link
Copy Markdown
Member Author

(Will have a PR up shortly fixing the MQ)

@davidhewitt
davidhewitt added this pull request to the merge queue Aug 8, 2026
Merged via the queue into PyO3:main with commit 1914ce3 Aug 8, 2026
50 checks passed
@alex
alex deleted the fix-clone-on-copy-from-py-object branch August 8, 2026 22:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

from_py_object on enums which derive Copy trigger new nightly clippy warning

3 participants