Skip to content

Commit 5f6fe84

Browse files
Do not double-count names.
1 parent ae1efb3 commit 5f6fe84

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

Objects/codeobject.c

+4-4
Original file line numberDiff line numberDiff line change
@@ -1760,20 +1760,20 @@ identify_unbound_names(PyThreadState *tstate, PyCodeObject *co,
17601760
}
17611761
unbound.total += 1;
17621762
unbound.globals.total += 1;
1763-
unbound.globals.numunknown += 1;
17641763
if (globalsns != NULL && PyDict_Contains(globalsns, name)) {
17651764
if (_PyErr_Occurred(tstate)) {
17661765
return -1;
17671766
}
17681767
unbound.globals.numglobal += 1;
1769-
unbound.globals.numunknown -= 1;
17701768
}
1771-
if (builtinsns != NULL && PyDict_Contains(builtinsns, name)) {
1769+
else if (builtinsns != NULL && PyDict_Contains(builtinsns, name)) {
17721770
if (_PyErr_Occurred(tstate)) {
17731771
return -1;
17741772
}
17751773
unbound.globals.numbuiltin += 1;
1776-
unbound.globals.numunknown -= 1;
1774+
}
1775+
else {
1776+
unbound.globals.numunknown += 1;
17771777
}
17781778
if (PySet_Add(globalnames, name) < 0) {
17791779
return -1;

0 commit comments

Comments
 (0)