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

Remove the BoundObject impl for &Bound, use Borrowed instead #4487

Merged

Conversation

ChayimFriedman2
Copy link
Contributor

@ChayimFriedman2 ChayimFriedman2 commented Aug 24, 2024

For rationale see #4467.

I chose to make bound_object_sealed::Sealed unsafe instead of BoundObject so that users won't see the # Safety
section, as it's not relevant for them.

Closes #4467.

@ChayimFriedman2 ChayimFriedman2 force-pushed the remove-impl-boundobject-for-ref-bound branch from c726f8c to 2bc8b06 Compare August 24, 2024 19:00
@ChayimFriedman2 ChayimFriedman2 force-pushed the remove-impl-boundobject-for-ref-bound branch from 2bc8b06 to e67b728 Compare August 24, 2024 19:40
For rationale see PyO3#4467.

I chose to make `bound_object_sealed::Sealed` unsafe instead of `BoundObject` so that users won't see the `# Safety`
section, as it's not relevant for them.
@ChayimFriedman2 ChayimFriedman2 force-pushed the remove-impl-boundobject-for-ref-bound branch from e67b728 to 809f0d5 Compare August 24, 2024 23:10
Copy link
Member

Choose a reason for hiding this comment

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

No need for this as BoundObject is new in this release; users will never see this change.

@davidhewitt davidhewitt added the CI-skip-changelog Skip checking changelog entry label Aug 25, 2024
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.

Looks great to me, thanks! 👍

/// # Safety
///
/// Type must be layout-compatible with `*mut ffi::PyObject`.
pub unsafe trait Sealed {}
Copy link
Member

Choose a reason for hiding this comment

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

Yep I'm happy with the unsafe guarantee going here where users will never see it 😂

@davidhewitt davidhewitt added this pull request to the merge queue Aug 25, 2024
Merged via the queue into PyO3:main with commit c26bc3d Aug 25, 2024
42 of 43 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.

Do not implement BoundObject for &Bound
3 participants