GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||||||||
GeezerVison is showing github.com — [3.13] gh-150157: add critical section for `PyDict_Next` in `_pickle.c` by KowalskiThomas · Pull Request #150951 · python/cpython Conversation
|
Documentation build overview
456 files changed ·
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Something is wrong with the change. Example on the Windows CI: |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
42d3ef5 to
afd0746
Compare
|
Indeed, I got a bit too trigger-happy on the |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Try to avoid force push, it makes reviews harder to follow in GitHub. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Noted, I'll keep that in mind for the future. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
CI is green now, thanks for the heads up! :) |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| int error = 0; | ||
| i = 0; | ||
| Py_BEGIN_CRITICAL_SECTION(modules); | ||
| while (PyDict_Next(modules, &i, &module_name, &module)) { |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
In the main branch, the code creates explicitly strong references:
Py_INCREF(module_name);
Py_INCREF(module);
@serhiy-storchaka: You added these Py_INCREF() calls in commit 1bb955a. Do you think that we should backport them?
It seems like _checkmodule() can call arbitrary Python code, especially in getattribute(). So it would be safer to hold strong references, no?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
There was no critical section in that code, so the original issue is not applicable here. This code is just not free-threading ready. Adding a critical section would be a new feature. Adding |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
I see -- if I understand correctly there should never have been a 3.13 backport because the function wasn't supposed to support free-threading in 3.13, right? Do you want me to change the PR to remove the current changes and make the function hold strong references or should this go to a different PR altogether (and this one be closed)? (I feel like the usual practice on CPython would be the latter, but asking anyway.) |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Yes, a different PR would be better. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.