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

Avoid attr("__repr__") in initialize_generic #2317

Merged
merged 1 commit into from
Jul 24, 2020

Conversation

bstaletic
Copy link
Collaborator

If the default argument value is a class, and not an instance of a
class, a.value.attr("__repr__") raises a ValueError. Switching to
repr(a.value) makes this use case work.

Fixes #2028

Copy link
Collaborator

@YannickJadoul YannickJadoul left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AppVeyor failure seems to be a fluke?

@bstaletic
Copy link
Collaborator Author

Appveyor forgot how to use git and didn't clone the repository in one build. It's just a flake.

@bstaletic bstaletic force-pushed the arg_v-repr branch 4 times, most recently from a9d4734 to 2d4a04b Compare July 24, 2020 08:31
If the default argument value is a class, and not an instance of a
class, `a.value.attr("__repr__")` raises a `ValueError`. Switching to
`repr(a.value)` makes this use case work.

Fixes pybind#2028
@bstaletic
Copy link
Collaborator Author

Green CI!

@YannickJadoul
Copy link
Collaborator

Green, green, green. Everything green! Thanks, Boris! :-)

@YannickJadoul YannickJadoul merged commit 2819ce6 into pybind:master Jul 24, 2020
@bstaletic bstaletic deleted the arg_v-repr branch December 24, 2020 15:29
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 this pull request may close these issues.

Cannot use a python class as a default argument
2 participants