← Back to team overview

divmod-dev team mailing list archive

[Bug 885140] [NEW] using del in if clause confuses pyflakes

 

Public bug reported:

code:

----------------------------------------
test = True
if False:
    del(test)
assert(test)
----------------------------------------

pyflakes complains:
[...].py:4: undefined name 'test'


i guess this may be too hard for a static analysier, in which case, how about

----------------------------------------
test = True
if False:
    del(test)
else:
    assert(test)
----------------------------------------

where the usage is in a different else branch to the del

output:
[...].py:5: undefined name 'test'

** Affects: pyflakes
     Importance: Undecided
         Status: New

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

Title:
  using del in if clause confuses pyflakes

Status in Pyflakes:
  New

Bug description:
  code:

  ----------------------------------------
  test = True
  if False:
      del(test)
  assert(test)
  ----------------------------------------

  pyflakes complains:
  [...].py:4: undefined name 'test'

  
  i guess this may be too hard for a static analysier, in which case, how about

  ----------------------------------------
  test = True
  if False:
      del(test)
  else:
      assert(test)
  ----------------------------------------

  where the usage is in a different else branch to the del

  output:
  [...].py:5: undefined name 'test'

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


Follow ups

References