Skip to content

add Bound::as_unbound#3973

Merged
davidhewitt merged 2 commits intoPyO3:mainfrom
davidhewitt:as-unbound
Mar 20, 2024
Merged

add Bound::as_unbound#3973
davidhewitt merged 2 commits intoPyO3:mainfrom
davidhewitt:as-unbound

Conversation

@davidhewitt
Copy link
Copy Markdown
Member

This adds &Bound<T> -> &Py<T> conversion, I called it .as_unbound().

&Py<T> is generally not that useful but it does have some applications, such as Py::get can be used to read frozen pyclass data without the GIL.

So this can help to write select bits of code which don't want to care about the 'py lifetime. I would have used this in pydantic-core just a couple of times.

@davidhewitt davidhewitt added the CI-skip-changelog Skip checking changelog entry label Mar 20, 2024
Comment thread src/instance.rs Outdated
@davidhewitt davidhewitt enabled auto-merge March 20, 2024 12:38
@davidhewitt davidhewitt added this pull request to the merge queue Mar 20, 2024
Merged via the queue into PyO3:main with commit cedac43 Mar 20, 2024
@davidhewitt davidhewitt deleted the as-unbound branch March 20, 2024 13:37
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.

2 participants