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

Bindings for super() #2049

Closed
davidhewitt opened this issue Dec 13, 2021 · 0 comments · Fixed by #2486
Closed

Bindings for super() #2049

davidhewitt opened this issue Dec 13, 2021 · 0 comments · Fixed by #2486

Comments

@davidhewitt
Copy link
Member

I don't think PyO3 currently exposes an API to get super() from Rust.

As far as I'm aware there aren't special C APIs to call super(), instead I think ffi::PySuper_Type can be cast to &PyType and we can then use .call1((type, obj)) to fill in the arguments. I think we'd always need to use the two-argument form as I don't think the PEP 3135 syntax sugar can apply here.

Some ideas what could be done:

  • Add a PySuper type to pyo3::types, with constructors like PySuper::new(ty: &PyType, obj: &PyAny) -> PyResult<PySuper>
  • Maybe add PyAny::super() which calls PySuper::new with the object and its type for convenience.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant