support for PEP 572 assignment expressions

Bug #2002855 reported by Chris Johnston
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
pyflakes (Ubuntu)
Fix Released
Low
Unassigned
Focal
Fix Released
Low
Chris Johnston

Bug Description

[ Impact ]

Pyflakes is missing PEP572 support, which causes failed validation for valid code. Support has been added upstream [1] to support PEP572 expressions.

[ Test Plan ]

Create a simple test.py:

def f(x):
    if (y := x.upper()) :
        print()

Run `flake8 test.py`

Result:

"pyflakes" failed during execution due to "'FlakesChecker' object has no attribute 'NAMEDEXPR'"
Run flake8 with greater verbosity to see more details
test.py:2:10: E203 whitespace before ':'
test.py:2:11: E231 missing whitespace after ':'
test.py:2:24: E203 whitespace before ':'

After applying this patch, the error should go away.

[ Where problems could occur ]

The risks related to this patch are minimal due to only adding support for new expressions.

[1] https://github.com/PyCQA/pyflakes/pull/457/files

Jeremy Bícha (jbicha)
Changed in pyflakes (Ubuntu Focal):
importance: Undecided → Low
Changed in pyflakes (Ubuntu):
status: New → Fix Released
importance: Undecided → Low
Changed in pyflakes (Ubuntu Focal):
status: New → In Progress
assignee: nobody → Chris Johnston (cjohnston)
Revision history for this message
Chris Halse Rogers (raof) wrote : Please test proposed package

Hello Chris, or anyone else affected,

Accepted pyflakes into focal-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/pyflakes/2.1.1-2ubuntu1 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation on how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, what testing has been performed on the package and change the tag from verification-needed-focal to verification-done-focal. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-focal. In either case, without details of your testing we will not be able to proceed.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance for helping!

N.B. The updated package will be released to -updates after the bug(s) fixed by this package have been verified and the package has been in -proposed for a minimum of 7 days.

Changed in pyflakes (Ubuntu Focal):
status: In Progress → Fix Committed
tags: added: verification-needed verification-needed-focal
description: updated
Revision history for this message
Chris Johnston (cjohnston) wrote :

Testing done.

Before upgrade:

ubuntu@elastic-1:~$ dpkg -l | grep pyflakes
ii flake8 3.7.9-2 all code checker using pycodestyle and pyflakes
ii pyflakes 2.1.1-2 all passive checker of Python 2 programs
ii pyflakes3 2.1.1-2 all passive checker of Python 3 programs
ii python-pyflakes 2.1.1-2 all passive checker of Python 2 programs - Python modules
ii python3-flake8 3.7.9-2 all code checker using pycodestyle and pyflakes - Python 3.x
ii python3-pyflakes 2.1.1-2 all passive checker of Python 3 programs - Python modules
ubuntu@elastic-1:~$ flake8 test.py
"pyflakes" failed during execution due to "'FlakesChecker' object has no attribute 'NAMEDEXPR'"
Run flake8 with greater verbosity to see more details
test.py:2:10: E203 whitespace before ':'
test.py:2:11: E231 missing whitespace after ':'
test.py:2:24: E203 whitespace before ':'

After upgrade:

ubuntu@elastic-1:~$ dpkg -l | grep pyflakes
ii flake8 3.7.9-2 all code checker using pycodestyle and pyflakes
ii pyflakes 2.1.1-2ubuntu1 all passive checker of Python 2 programs
ii pyflakes3 2.1.1-2ubuntu1 all passive checker of Python 3 programs
ii python-pyflakes 2.1.1-2ubuntu1 all passive checker of Python 2 programs - Python modules
ii python3-flake8 3.7.9-2 all code checker using pycodestyle and pyflakes - Python 3.x
ii python3-pyflakes 2.1.1-2ubuntu1 all passive checker of Python 3 programs - Python modules
ubuntu@elastic-1:~$ flake8 test.py
test.py:2:9: F841 local variable 'y' is assigned to but never used
test.py:2:10: E203 whitespace before ':'
test.py:2:11: E231 missing whitespace after ':'
test.py:2:24: E203 whitespace before ':'

tags: added: verification-done verification-done-focal
removed: verification-needed verification-needed-focal
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package pyflakes - 2.1.1-2ubuntu1

---------------
pyflakes (2.1.1-2ubuntu1) focal; urgency=medium

  * Cherry-pick patch to add support for PEP 572 assignment expressions
    (LP: #2002855)

 -- Jeremy Bicha <email address hidden> Fri, 13 Jan 2023 14:38:01 -0500

Changed in pyflakes (Ubuntu Focal):
status: Fix Committed → Fix Released
Revision history for this message
Brian Murray (brian-murray) wrote : Update Released

The verification of the Stable Release Update for pyflakes has completed successfully and the package is now being released to -updates. Subsequently, the Ubuntu Stable Release Updates Team is being unsubscribed and will not receive messages about this bug report. In the event that you encounter a regression using the package from -updates please report a new bug using ubuntu-bug and tag the bug report regression-update so we can easily find any regressions.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.