Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Python-ref cloning GILOnceCell::<Py<T>>::clone_ref #4511

Merged
merged 1 commit into from
Sep 3, 2024

Conversation

jakelishman
Copy link
Contributor

This adds a helper method to GILOnceCell containing Py pointers, allowing a cheap clone by Python-space incref. This might want to be supplanted/supplemented by a derive macro as part of #4133.

Close #4428

As an aside: I'm on an Intel Mac and wasn't able to run nox -s clippy-all due to pre-existing failures in some sort of macro expansion such as:

nox > cargo clippy '--features=full multiple-pymethods' --all-targets --workspace -- --deny=warnings
error: custom attribute panicked
   --> src/coroutine.rs:125:1
    |
125 | #[pymethods(crate = "crate")]
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = help: message: Unrecognized literal: `c"__name__"`
    = note: this error originates in the macro `crate::inventory::submit` which comes from the expansion of the attribute macro `pymethods` (in Nightly builds, run with -Z macro-backtrace for more info)

I assume this is what you were seeing in CI prior to #3985.

Copy link
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, this seems a reasonable short-term addition even if the future for GILOnceCell is unclear...

@davidhewitt davidhewitt added this pull request to the merge queue Sep 3, 2024
@davidhewitt
Copy link
Member

Not sure about your local clippy issue. Does running cargo update resolve it?

Merged via the queue into PyO3:main with commit 1a96d97 Sep 3, 2024
42 of 43 checks passed
@jakelishman jakelishman deleted the giloncecell-clone_ref branch September 3, 2024 06:47
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.

Clone (or alternative) on GILOnceCell
2 participants