← Back to team overview

divmod-dev team mailing list archive

[Bug 901235] [NEW] Warns after using a variable that was deleted in a conditional

 

Public bug reported:

Consider this snippet:

    def f():
        x = 1
        if False:
            del x
        x

It is entirely appropriate to use 'x' after that conditional, but
pyflakes warns with "undefined name 'x'". Instead it should not warn at
all.

See http://bazaar.launchpad.net/~testtools-
committers/testtools/trunk/view/head:/testtools/matchers.py#L789 for a
real world example.

** Affects: pyflakes
     Importance: Undecided
         Status: New

** Branch linked: lp:~jml/divmod.org/undefined-after-conditional-del

-- 
You received this bug notification because you are a member of Divmod-
dev, which is the registrant for Pyflakes.
https://bugs.launchpad.net/bugs/901235

Title:
  Warns after using a variable that was deleted in a conditional

Status in Pyflakes:
  New

Bug description:
  Consider this snippet:

      def f():
          x = 1
          if False:
              del x
          x

  It is entirely appropriate to use 'x' after that conditional, but
  pyflakes warns with "undefined name 'x'". Instead it should not warn
  at all.

  See http://bazaar.launchpad.net/~testtools-
  committers/testtools/trunk/view/head:/testtools/matchers.py#L789 for a
  real world example.

To manage notifications about this bug go to:
https://bugs.launchpad.net/pyflakes/+bug/901235/+subscriptions


Follow ups

References