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

Revert soft-duplicated for Py::new #974

Merged
merged 1 commit into from
Jun 13, 2020
Merged

Conversation

kngwyu
Copy link
Member

@kngwyu kngwyu commented Jun 13, 2020

Since PyCell is registered to GILPool, Py<T>::new can be more efficient especially when the object is directly returned to Python.
E.g.,

#[pyfunction] 
fn new_class(py: Python) -> Py<MyClass> {
    Py::new(py, ...)
}

@davidhewitt
Copy link
Member

That's a fair point 👍 . Perhaps we should update docs to recommend Py::new instead of PyCell::new in most cases?

@kngwyu
Copy link
Member Author

kngwyu commented Jun 13, 2020

Perhaps we should update docs to recommend Py::new instead of PyCell::new in most cases?

Yeah, but I'm not sure where they are

@kngwyu kngwyu merged commit f2f0ccd into PyO3:master Jun 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants