-
Notifications
You must be signed in to change notification settings - Fork 784
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
fix PyUnicodeDecodeError_Create #2772
Conversation
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.
Do we have a test that should have failed?
Line 993 in b485199
?? |
So are we not running this on the right PyPy version or why was this not visible in the CI? |
It looks for a quick inspection like both pyo3 and pydantic-core (where I found the error), test with the same three pypy versions: - 'pypy3.7'
- 'pypy3.8'
- 'pypy3.9' However it seems tests are not actually being run, either on merge with main or on pull requests, see this build. But it seems that changed yesterday, so not sure about the problem going back further. Maybe @messense has some idea on what's going on in CI? |
We switched to use bors, full test matrix run in staging branch, like this one: https://github.com/PyO3/pyo3/actions/runs/3522833722 |
I think tests like |
that would explain it. |
Yes, they are also not being run before the bors change: https://github.com/PyO3/pyo3/actions/runs/3507802969/jobs/5875825394 |
I guess we need to add a test in the |
The idea might be bonkers: But Rust unit tests are basically a automatically generated Could we somehow package ourselves up into an extension that exposes a single function to execute all the unit tests? Can we get at the main function generated by I think the above is problematic as we would want to do this for all unit tests, not just this particular one. But |
Hmm, that's an interesting idea. The amount of dark magic involved scares me a little. I think the best solution would be for PyPy to implement I have mostly taken the approach that if it works on CPython it should work on PyPy. We at least link all tests on PyPy (even if we can't run them) which should demonstrate we're at least hitting valid PyPy APIs. There are of course edge cases like this, so I kinda feel like it's ok for us to just add |
The good news is that there is an active Tracking issue: https://foss.heptapod.net/pypy/pypy/-/issues/3837 |
Actually, IMO having tests separately (in whatever form...) would speed things up, since edits to the inline If, as a nice side-effect, the same tests can also be compiled in a way that works on PyPy, so much the better. |
@adamreichold my opinion here is let's merge this for 0.18? Regarding the wider issue of testing on PyPy - I've offered to help out on their branch. So in the short term I'd rather we didn't change anything in PyO3, and hopefully in the longer term testing on PyPy should "just work" the same as it does in CPython 😄 |
Agreed. |
Rebased, added changelog entry, and will merge. |
bors r+ |
@@ -0,0 +1 @@ | |||
Fix `PyUnicodeDecodeError_Create` failing unconditionally with a TypeError on PyPy. |
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.
Wouldn't this be a result of undefined behavior? i.e. isn't this a soundness fix?
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.
Ah, yes, it's not super clear from the Python docs. It looks like it might be, so I'll amend this in a follow-up PR.
Build succeeded: |
Fixes #2770