Skip to content

Commit 71b10b8

Browse files
authored
reintroduce weakref constructors (#4491)
1 parent c26bc3d commit 71b10b8

File tree

3 files changed

+128
-98
lines changed

3 files changed

+128
-98
lines changed

src/types/weakref/anyref.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ pub trait PyWeakrefMethods<'py> {
7171
/// # fn main() -> PyResult<()> {
7272
/// Python::with_gil(|py| {
7373
/// let data = Bound::new(py, Foo{})?;
74-
/// let reference = PyWeakrefReference::new_bound(&data)?;
74+
/// let reference = PyWeakrefReference::new(&data)?;
7575
///
7676
/// assert_eq!(
7777
/// parse_data(reference.as_borrowed())?,
@@ -147,7 +147,7 @@ pub trait PyWeakrefMethods<'py> {
147147
/// # fn main() -> PyResult<()> {
148148
/// Python::with_gil(|py| {
149149
/// let data = Bound::new(py, Foo{})?;
150-
/// let reference = PyWeakrefReference::new_bound(&data)?;
150+
/// let reference = PyWeakrefReference::new(&data)?;
151151
///
152152
/// assert_eq!(
153153
/// parse_data(reference.as_borrowed())?,
@@ -232,7 +232,7 @@ pub trait PyWeakrefMethods<'py> {
232232
/// # fn main() -> PyResult<()> {
233233
/// Python::with_gil(|py| {
234234
/// let data = Bound::new(py, Foo{})?;
235-
/// let reference = PyWeakrefReference::new_bound(&data)?;
235+
/// let reference = PyWeakrefReference::new(&data)?;
236236
///
237237
/// assert_eq!(
238238
/// parse_data(reference.as_borrowed()),
@@ -306,7 +306,7 @@ pub trait PyWeakrefMethods<'py> {
306306
/// # fn main() -> PyResult<()> {
307307
/// Python::with_gil(|py| {
308308
/// let data = Bound::new(py, Foo{})?;
309-
/// let reference = PyWeakrefReference::new_bound(&data)?;
309+
/// let reference = PyWeakrefReference::new(&data)?;
310310
///
311311
/// assert_eq!(
312312
/// parse_data(reference.as_borrowed()),
@@ -379,7 +379,7 @@ pub trait PyWeakrefMethods<'py> {
379379
/// # fn main() -> PyResult<()> {
380380
/// Python::with_gil(|py| {
381381
/// let data = Bound::new(py, Foo{})?;
382-
/// let reference = PyWeakrefReference::new_bound(&data)?;
382+
/// let reference = PyWeakrefReference::new(&data)?;
383383
///
384384
/// assert_eq!(
385385
/// parse_data(reference.as_borrowed())?,
@@ -455,7 +455,7 @@ pub trait PyWeakrefMethods<'py> {
455455
/// # fn main() -> PyResult<()> {
456456
/// Python::with_gil(|py| {
457457
/// let data = Bound::new(py, Foo{})?;
458-
/// let reference = PyWeakrefReference::new_bound(&data)?;
458+
/// let reference = PyWeakrefReference::new(&data)?;
459459
///
460460
/// assert_eq!(
461461
/// parse_data(reference.as_borrowed())?,
@@ -530,7 +530,7 @@ pub trait PyWeakrefMethods<'py> {
530530
/// # fn main() -> PyResult<()> {
531531
/// Python::with_gil(|py| {
532532
/// let data = Bound::new(py, Foo{})?;
533-
/// let reference = PyWeakrefReference::new_bound(&data)?;
533+
/// let reference = PyWeakrefReference::new(&data)?;
534534
///
535535
/// assert_eq!(
536536
/// parse_data(reference.as_borrowed())?,
@@ -600,7 +600,7 @@ pub trait PyWeakrefMethods<'py> {
600600
/// # fn main() -> PyResult<()> {
601601
/// Python::with_gil(|py| {
602602
/// let data = Bound::new(py, Foo{})?;
603-
/// let reference = PyWeakrefReference::new_bound(&data)?;
603+
/// let reference = PyWeakrefReference::new(&data)?;
604604
///
605605
/// assert_eq!(
606606
/// parse_data(reference.as_borrowed())?,
@@ -672,7 +672,7 @@ pub trait PyWeakrefMethods<'py> {
672672
/// # fn main() -> PyResult<()> {
673673
/// Python::with_gil(|py| {
674674
/// let object = Bound::new(py, Foo{})?;
675-
/// let reference = PyWeakrefReference::new_bound(&object)?;
675+
/// let reference = PyWeakrefReference::new(&object)?;
676676
///
677677
/// assert_eq!(
678678
/// get_class(reference.as_borrowed())?,
@@ -733,7 +733,7 @@ pub trait PyWeakrefMethods<'py> {
733733
/// # fn main() -> PyResult<()> {
734734
/// Python::with_gil(|py| {
735735
/// let object = Bound::new(py, Foo{})?;
736-
/// let reference = PyWeakrefReference::new_bound(&object)?;
736+
/// let reference = PyWeakrefReference::new(&object)?;
737737
///
738738
/// assert_eq!(
739739
/// get_class(reference.as_borrowed())?,
@@ -776,12 +776,12 @@ mod tests {
776776
use crate::{Bound, PyResult, Python};
777777

778778
fn new_reference<'py>(object: &Bound<'py, PyAny>) -> PyResult<Bound<'py, PyWeakref>> {
779-
let reference = PyWeakrefReference::new_bound(object)?;
779+
let reference = PyWeakrefReference::new(object)?;
780780
reference.into_any().downcast_into().map_err(Into::into)
781781
}
782782

783783
fn new_proxy<'py>(object: &Bound<'py, PyAny>) -> PyResult<Bound<'py, PyWeakref>> {
784-
let reference = PyWeakrefProxy::new_bound(object)?;
784+
let reference = PyWeakrefProxy::new(object)?;
785785
reference.into_any().downcast_into().map_err(Into::into)
786786
}
787787

0 commit comments

Comments
 (0)