-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Add check if str(handle)
correctly converted the object, and throw py::error_already_set if not
#2392
Add check if str(handle)
correctly converted the object, and throw py::error_already_set if not
#2392
Conversation
Also note that by checking always checking the result after calling |
Of course. I tried this locally based on #2380, but |
235168a
to
d58307d
Compare
f38fafc
to
6cd4552
Compare
7eee06e
to
366f713
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, apart from that sys.version.major
thing.
1d553e4
to
0b49467
Compare
366f713
to
6452317
Compare
@YannickJadoul if you used |
This might benefit from being rebased after #2397 |
6452317
to
b25eace
Compare
OK, you win this one ;-) |
b25eace
to
f7d376c
Compare
0b49467
to
0ab4b97
Compare
…py::error_already_set if not
f7d376c
to
8e53b83
Compare
8e53b83
to
3dbafa6
Compare
Fixed this. It's quite a minor PR, so a few more quick checks (@bstaletic & @henryiii, the things you mentioned should be fixed). |
LGTM. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great, thanks Yannick!
I'll hold off merging only because I'm still unclear why the current str-bytes-cleanup
branch fails to pass some tests in the Google environment (I didn't get a chance to work on it at all yesterday).
(For completeness: the failing tests are NOT pybind11 unit tests.)
For future reference: the test failure was due to accidental |
… py::error_already_set if not. Similar to pybind#2392, but does not depend on pybind#2409. Splitting out this PR from pybind#2409 to make that PR as simple as possible. Net effects of this PR: * Adds missing test coverage. * Changes TypeError to UnicodeDecodeError for Python 2. This PR has two commits. Please do not squash, to make the behavior change obvious in the commit history.
Only problematic on Python 2, I think. Discovered here: #2380 (comment)