-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
test_sqlite_isolation fails with Python 3.11 #2580
Comments
I don't see anything in the python 3.11 changelog that looks promising, any ideas? |
I'm going to try bisecting it. |
And here it is:
|
Thanks @mgorny very nice! My sense is that this may be a bug in |
Can you report this on the CPython bug tracker? Please include a minimal (bare-bones) reproducer and as much information about your environment as possible. Thanks! |
Sure I'll report and send a test if it's indeed a cpython issue. My sense is that it is but I'll let you know early next week |
Great, thanks. FYI, beta 4 is over-due, but is currently on hold bco. release blockers. I've notified the RM about this (possible) issue; if we could pin-point a minimal reproducer pretty quick, we could add this to the beta 4 release blockers, so we'd get a fix in the upcoming (b4) release. I've tried to create a repro, but it's a little bit hard, since I've never used peewee, and I don't know its internal workings :( |
No worries, I'll take a look tomorrow (Mon) morning and let you know asap. Thx! |
Welp, I have managed to reproduce and think it has something to do with cursor garbage collection. Something quite strange is going on that I haven't so far experienced in all the time I've used Python. Here's what I've observed with peewee:
Example of breakpoint + continue -> passing:
Example of breakpoint + next -> fails again:
I cannot understand why it is passing when there's a breakpoint and then I select "continue" but using "next" makes it fail again! Repro with stdlib sqlite3Here is my repro. It took a while to get it to reproduce, but I had a feeling it had something to do (possibly) with garbage collection or cursors. Keeping the cursors around in memory seems to cause the problem to manifest, but if you comment-out the line indicated below then the tests will pass. Note that Peewee doesn't do anything weird like keep the cursors in memory, this was just the first way I've been able to successfully reproduce the issue. @erlend-aasland
Lastly, just as a sanity-check, the above script runs without error on Python 2.7, 3.6, 3.9 and 3.10 -- it only fails on 3.11.0b3. |
@erlend-aasland - I've created a new ticket on the CPython issue tracker, linked above python/cpython#94028 . As I mentioned on the cpython issue, this really is bizarre:
|
Since this seems to me quite definitively a CPython / sqlite3 issue, I will close here. |
Thanks a lot for your investigations, @coleifer! I've marked python/cpython#94028 as a release blocker. Hopefully we'll find a solution within the next few days. |
I have a fix for this in python/cpython#94042. If you have the possibility to test the fix before I merge it, I'd appreciate it, @mgorny. |
I can confirm that applying this patch to cpython causes peewee tests to pass. |
(I've applied it on top of 3.11.0b3) |
Great, thank you! |
Thank you both @mgorny and @erlend-aasland for the help finding and fixing this. |
FYI, the fix has been merged and will appear in the upcoming beta 4 release. |
When running tests with Python 3.11.0b3, I get the following failure:
The text was updated successfully, but these errors were encountered: