diff --git a/tests/small_samples/d88dbf79f1c03ac9d231408b03584e8396ab41a959edecfde86b82df8ee7c918.py b/tests/small_samples/d88dbf79f1c03ac9d231408b03584e8396ab41a959edecfde86b82df8ee7c918.py new file mode 100644 index 0000000..310fff5 --- /dev/null +++ b/tests/small_samples/d88dbf79f1c03ac9d231408b03584e8396ab41a959edecfde86b82df8ee7c918.py @@ -0,0 +1,5 @@ +def test_getsource_on_class_without_firstlineno(): + __firstlineno__ = 0 + + class C: + nonlocal __firstlineno__ diff --git a/tests/test_main.py b/tests/test_main.py index 21b1b12..8309a71 100644 --- a/tests/test_main.py +++ b/tests/test_main.py @@ -1213,10 +1213,10 @@ def check_code(self, code, nodes, decorators, check_names): continue if ( - inst.opname == "STORE_NAME" + inst.opname in ("STORE_NAME", "STORE_DEREF") and hasattr(inst, "positions") and inst.positions.col_offset == inst.positions.end_col_offset == 0 - and inst.argval in ("__module__", "__qualname__") + and inst.argval in ("__module__", "__qualname__", "__firstlineno__") ): continue