Skip to content

initialize_generic should use repr rather than attr("__repr__") #1691

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

Closed
asadchev opened this issue Feb 12, 2019 · 2 comments
Closed

initialize_generic should use repr rather than attr("__repr__") #1691

asadchev opened this issue Feb 12, 2019 · 2 comments

Comments

@asadchev
Copy link

in pybind11.h, in initialize_generic the relevant line should be
a.descr = strdup(repr(a.value).cast<std::string>().c_str());
otherwise error is thrown with for example type objects
ImportError: TypeError: descriptor '__repr__' of 'float' object needs an argument

@bstaletic
Copy link
Collaborator

This is a duplicate of #2028

@YannickJadoul
Copy link
Collaborator

This one was first, though, so thanks for reporting, @asadchev! :-)

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

3 participants