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

ToPyObject example incorrect for PyString #228

Open
stuhood opened this issue May 23, 2020 · 2 comments
Open

ToPyObject example incorrect for PyString #228

stuhood opened this issue May 23, 2020 · 2 comments

Comments

@stuhood
Copy link
Contributor

stuhood commented May 23, 2020

ToPyObject indicates that:

You can always calls val.to_py_object(py).into_py_object() in order to obtain PyObject (the second into_py_object() call via the PythonObject trait corresponds to the upcast from PyList to PyObject).

But this doesn't seem to be the case for PyString, for which the ToPyObject impl targets itself, making the into_py_object call a noop.

@markbt
Copy link
Collaborator

markbt commented Jan 15, 2021

You should be able to use into_object() to convert a PyString to a PyObject. (into_py_object() just converts to the downcasted type, which is already PyString).

@markbt
Copy link
Collaborator

markbt commented Jan 15, 2021

(I'll update the docs later)

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

No branches or pull requests

2 participants