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

Allow #[new] to return arbitrary objects #3291

Open
davidhewitt opened this issue Jul 3, 2023 · 0 comments
Open

Allow #[new] to return arbitrary objects #3291

davidhewitt opened this issue Jul 3, 2023 · 0 comments

Comments

@davidhewitt
Copy link
Member

Since #3287 #[new] is now able to return Py<T> to return an existing Python object (e.g. for singleton classes).

In pure-python code I believe the return value of __new__ is not restricted at all, so it may be elegant in PyO3 if similarly any T: IntoPy<PyObject> could be returned from #[new]. This should be possible as a pure addition without backwards-compatibility concerns.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant