Skip to content

test_listcomps fails when run with -We #109182

Closed
@AlexWaygood

Description

@AlexWaygood

Bug report

Bug description:

python -m test test_listcomps causes SyntaxWarnings to be emitted on main, and fails when run with -We:

Without -We:

0:00:00 Run tests sequentially
0:00:00 [1/1] test_listcomps
<string>:4: SyntaxWarning: 'set' object is not callable; perhaps you missed a comma?
<string>:6: SyntaxWarning: 'set' object is not callable; perhaps you missed a comma?
<string>:6: SyntaxWarning: 'set' object is not callable; perhaps you missed a comma?

== Tests result: SUCCESS ==

1 test OK.

Total duration: 230 ms
Total tests: run=49
Total test files: run=1/1
Result: SUCCESS

With -We:

======================================================================
ERROR: test_comp_in_try_finally (test.test_listcomps.ListComprehensionTest.test_comp_in_try_finally) (scope='module')
----------------------------------------------------------------------
Traceback (most recent call last):
  File "C:\Users\alexw\coding\cpython\Lib\test\test_listcomps.py", line 122, in _check_in_scopes
    exec(newcode, newns)
  File "<string>", line 4
SyntaxError: 'set' object is not callable; perhaps you missed a comma?

======================================================================
ERROR: test_comp_in_try_finally (test.test_listcomps.ListComprehensionTest.test_comp_in_try_finally) (scope='class')
----------------------------------------------------------------------
Traceback (most recent call last):
  File "C:\Users\alexw\coding\cpython\Lib\test\test_listcomps.py", line 122, in _check_in_scopes
    exec(newcode, newns)
  File "<string>", line 6
SyntaxError: 'set' object is not callable; perhaps you missed a comma?

======================================================================
ERROR: test_comp_in_try_finally (test.test_listcomps.ListComprehensionTest.test_comp_in_try_finally) (scope='function')
----------------------------------------------------------------------
Traceback (most recent call last):
  File "C:\Users\alexw\coding\cpython\Lib\test\test_listcomps.py", line 122, in _check_in_scopes
    exec(newcode, newns)
  File "<string>", line 6
SyntaxError: 'set' object is not callable; perhaps you missed a comma?

----------------------------------------------------------------------

The problematic test is test_listcomps.ListComprehensionTest.test_comp_in_try_finally, which was added in d52c448 last week

CPython versions tested on:

CPython main branch

Operating systems tested on:

Windows

Linked PRs

Metadata

Metadata

Assignees

Labels

3.12only security fixes3.13bugs and security fixestestsTests in the Lib/test dirtype-bugAn unexpected behavior, bug, or error

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions