-
-
Notifications
You must be signed in to change notification settings - Fork 31.9k
gh-121459: Add missing return to _PyDict_LoadGlobalStackRef #124085
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1550,7 +1550,12 @@ _Py_dict_lookup_threadsafe_stackref(PyDictObject *mp, PyObject *key, Py_hash_t h | |
{ | ||
PyObject *val; | ||
Py_ssize_t ix = _Py_dict_lookup(mp, key, hash, &val); | ||
*value_addr = val == NULL ? PyStackRef_NULL : PyStackRef_FromPyObjectNew(val); | ||
if (val == NULL) { | ||
*value_addr = PyStackRef_NULL; | ||
} | ||
else { | ||
*value_addr = PyStackRef_FromPyObjectNew(val); | ||
} | ||
Comment on lines
+1553
to
+1558
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So... I think MSVC 1916 (Visual Studio 2017) on the Windows 10 buildbot is just really buggy and miscompiles the ternary if... There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ugh, MSVC miscompiles this up through v19.27 (fixed in v19.28): |
||
return ix; | ||
} | ||
|
||
|
@@ -2483,7 +2488,7 @@ _PyDict_LoadGlobalStackRef(PyDictObject *globals, PyDictObject *builtins, PyObje | |
/* namespace 1: globals */ | ||
ix = _Py_dict_lookup_threadsafe_stackref(globals, key, hash, res); | ||
if (ix == DKIX_ERROR) { | ||
*res = PyStackRef_NULL; | ||
return; | ||
} | ||
if (ix != DKIX_EMPTY && !PyStackRef_IsNull(*res)) { | ||
return; | ||
|
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.
@fiona02 - Please do not post AI-generated PR reviews.