Whole file

PyCQA/pyflakes

The author described this change as Fix global removing all UndefinedName. It counts as a record because the check below fails on the code as it stood at 9a4d45c12 and passes on 4feb31f04, with nothing else changed between the two runs.

Fix saved2015-11-12
Sharing licenceMIT · LICENSE
Change size+4 2

What the code was meant to do, written into the code itself as a save note

Fix global removing all UndefinedName

The change

693693 node_value = Assignment(node_name, node)
694694
695695 # Remove UndefinedName messages already reported for this name.
696+ # TODO: if the global is not used in this scope, it does not
697+ # become a globally defined name. See test_unused_global.
696698 self.messages = [
697699 m for m in self.messages if not
698- isinstance(m, messages.UndefinedName) and not
699- m.message_args[0] == node_name]
700+ isinstance(m, messages.UndefinedName) or
701+ m.message_args[0] != node_name]
700702
701703 # Bind name to global scope if it doesn't exist already.
702704 global_scope.setdefault(node_name, node_value)

The check that tells the two apart

failpass·pyflakes/test/test_undefined_names.py::Test::test_global_reset_name_only

Check file pyflakes/test/test_undefined_names.py, taken without changes from the fix and copied onto the older code, so the exact same check runs against both versions.

Origin and history

The code before it9a4d45c12e86cbb9effd749bd13ba48927063c23
Broken version dated2015-11-08
Modulepyflakes.checker
Units changedChecker
Fingerprintb52f84d49d1c2b2c
Checked2026-08-18 by goldset/0.1

Every field above is generated by our program. None of it is written by hand.

Other bugs found in PyCQA/pyflakes