Uh oh!
There was an error while loading. Please reload this page.
gh-120198: Stop the world when setting __class__ on free-threaded build - #120672
Conversation
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
| return -1; | ||
| goto err; | ||
| } | ||
| err: |
There was a problem hiding this comment.
To have a more regular try: ... finally: _PyEval_StartTheWorld() pattern, you can add an int res = -1; variable, replace goto err with goto done, and set res to 0 on success (3 lines above).
There was a problem hiding this comment.
I think @vstinner's suggestion is fine. Or you can refactor the parts that should be in a stop-the-world call into it's own function, like we often do for locks.
Another advantage of moving the body to a separate function is that it makes it more clear what data crosses the stop-the-world boundary -- some data loaded before the stop-the-world call may not be valid after it.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
| int | ||
| _PyDict_DetachFromObject(PyDictObject *dict, PyObject *obj); | ||
| PyDictObject *_PyObject_materialize_managed_dict_lock_held(PyObject *); |
There was a problem hiding this comment.
Let's name this like the other functions: _PyObject_MaterializeManagedDict_LockHeld and move the definition up next to _PyObject_MaterializeManagedDict.
Uh oh!
There was an error while loading. Please reload this page.
| return -1; | ||
| goto err; | ||
| } | ||
| err: |
There was a problem hiding this comment.
I think @vstinner's suggestion is fine. Or you can refactor the parts that should be in a stop-the-world call into it's own function, like we often do for locks.
Another advantage of moving the body to a separate function is that it makes it more clear what data crosses the stop-the-world boundary -- some data loaded before the stop-the-world call may not be valid after it.
colesbury
left a comment
There was a problem hiding this comment.
LGTM with a few comments about comments.
I think this should be backported to 3.13
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Thanks @Fidget-Spinner for the PR 🌮🎉.. I'm working now to backport this PR to: 3.13. |
Sorry, @Fidget-Spinner, I could not cleanly backport this to |
Uh oh!
There was an error while loading. Please reload this page.