This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author xtreak
Recipients Greg Price, serhiy.storchaka, vstinner, xtreak
Date 2018-09-21.12:16:19
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1537532179.11.0.956365154283.issue26452@psf.upfronthosting.co.za>
In-reply-to
Content
I think there have been some improvements merged with https://bugs.python.org/issue12458 . I am not sure if the patch covers more cases. I ran the tests attached in the patch and some of them cause RuntimeError in master.

# bpo26452.py

def f():
    return [j
            for i in range(3)
            if i]

f()

# Master 

./python.exe
Python 3.8.0a0 (heads/master:c510c6b8b6, Sep 21 2018, 11:10:24)
[Clang 7.0.2 (clang-700.1.81)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>

./python.exe ../backups/bpo26452.py
Traceback (most recent call last):
  File "../backups/bpo26452.py", line 6, in <module>
    f()
  File "../backups/bpo26452.py", line 2, in f
    return [j
  File "../backups/bpo26452.py", line 2, in <listcomp>
    return [j
NameError: name 'j' is not defined


# Python 3.7

python3.7 ../backups/bpo26452.py
Traceback (most recent call last):
  File "../backups/bpo26452.py", line 6, in <module>
    f()
  File "../backups/bpo26452.py", line 3, in f
    for i in range(3)
  File "../backups/bpo26452.py", line 4, in <listcomp>
    if i]
NameError: name 'j' is not defined

# Tests

./python.exe ../backups/test26452.py
..F
======================================================================
FAIL: test_operators (__main__.TestPEP380Operation)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "../backups/test26452.py", line 21, in expect_line
    f()
  File "../backups/test26452.py", line 98, in f
    -
RuntimeError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "../backups/test26452.py", line 100, in test_operators
    self.expect_line(f, 3) # want 2
  File "../backups/test26452.py", line 26, in expect_line
    self.assertEqual(relative_line, expected_relative_line)
AssertionError: 2 != 3

----------------------------------------------------------------------
Ran 3 tests in 0.001s

FAILED (failures=1)


Thanks
History
Date User Action Args
2018-09-21 12:16:19xtreaksetrecipients: + xtreak, vstinner, serhiy.storchaka, Greg Price
2018-09-21 12:16:19xtreaksetmessageid: <1537532179.11.0.956365154283.issue26452@psf.upfronthosting.co.za>
2018-09-21 12:16:19xtreaklinkissue26452 messages
2018-09-21 12:16:19xtreakcreate