Open
Conversation
davidhewitt
reviewed
Mar 25, 2026
Member
davidhewitt
left a comment
There was a problem hiding this comment.
Thanks, a couple of these seals are probably not needed, the rest look good to me!
Comment on lines
+1138
to
+1144
| mod pyclass_base_type { | ||
| use crate::impl_::pyclass::PyClassBaseType; | ||
|
|
||
| pub trait Sealed {} | ||
|
|
||
| impl<T: PyClassBaseType> Sealed for T {} | ||
| } |
Member
There was a problem hiding this comment.
This seal doesn't achieve anything it seals PyClassBaseType so creates circular logic.
I think it's ok to leave this trait un-sealed, any user-defined type could in principle implement it (maybe let's document it as such).
| /// Users are discouraged from implementing this trait manually; it is a PyO3 implementation detail | ||
| /// and may be changed at any time. | ||
| pub trait PyClassImpl: Sized + 'static { | ||
| pub trait PyClassImpl: Sized + 'static + generic_pyclass::Sealed { |
Member
There was a problem hiding this comment.
It is expected for user-defined types to implement this trait (via the macros), so there's no point sealing it (it's not a closed set of implementations).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #3908
Adds Sealed to traits in
impl_/pyclass.rs