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

#[new] which is also a #[classmethod] #3077

Closed
davidhewitt opened this issue Apr 1, 2023 Discussed in #3075 · 3 comments · Fixed by #3157
Closed

#[new] which is also a #[classmethod] #3077

davidhewitt opened this issue Apr 1, 2023 Discussed in #3075 · 3 comments · Fixed by #3157

Comments

@davidhewitt
Copy link
Member

Discussed in #3075

Originally posted by adriangb March 29, 2023
As far as I can tell, #[new] has to be a static method. It's a classmethod in Python, could it be made the same in PyO3? Context: I'd like to get the class name as seen by Python for the failure case of calling new.

@davidhewitt davidhewitt changed the title #[new] which is also a classmethod #[classmethod] #[new] which is also a #[classmethod] Apr 1, 2023
@davidhewitt davidhewitt mentioned this issue May 15, 2023
7 tasks
@stuhood
Copy link
Contributor

stuhood commented May 16, 2023

Have you already started this? I can look at it today if not.

@davidhewitt
Copy link
Member Author

I have not, please go ahead, thanks! I think the challenge is that we currently special case new in the backend (see FnType enum iirc). Any refactoring you fancy is welcome, and feel free to post questions here or in a PR; I'll answer when I can...

@stuhood
Copy link
Contributor

stuhood commented May 16, 2023

Posted over here: #3157 ... thanks!

@bors bors bot closed this as completed in 3b4c7d3 May 17, 2023
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 a pull request may close this issue.

2 participants