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

seal PyWeakrefMethods #4598

Merged
merged 2 commits into from
Oct 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions newsfragments/4598.changed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Seal `PyWeakrefMethods` trait.
4 changes: 4 additions & 0 deletions src/sealed.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use crate::types::{
PyBool, PyByteArray, PyBytes, PyCapsule, PyComplex, PyDict, PyFloat, PyFrozenSet, PyList,
PyMapping, PyModule, PySequence, PySet, PySlice, PyString, PyTraceback, PyTuple, PyType,
PyWeakref, PyWeakrefProxy, PyWeakrefReference,
};
use crate::{ffi, Bound, PyAny, PyResult};

Expand Down Expand Up @@ -32,3 +33,6 @@ impl Sealed for Bound<'_, PyString> {}
impl Sealed for Bound<'_, PyTraceback> {}
impl Sealed for Bound<'_, PyTuple> {}
impl Sealed for Bound<'_, PyType> {}
impl Sealed for Bound<'_, PyWeakref> {}
impl Sealed for Bound<'_, PyWeakrefProxy> {}
impl Sealed for Bound<'_, PyWeakrefReference> {}
2 changes: 1 addition & 1 deletion src/types/weakref/anyref.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ impl PyTypeCheck for PyWeakref {
/// syntax these methods are separated into a trait, because stable Rust does not yet support
/// `arbitrary_self_types`.
#[doc(alias = "PyWeakref")]
pub trait PyWeakrefMethods<'py> {
pub trait PyWeakrefMethods<'py>: crate::sealed::Sealed {
/// Upgrade the weakref to a direct Bound object reference.
///
/// It is named `upgrade` to be inline with [rust's `Weak::upgrade`](std::rc::Weak::upgrade).
Expand Down
Loading