Re/Unresolved bug?

John Machin sjmachin at lexicon.net
Mon Jun 30 14:07:30 CEST 2003


Steven Taschuk <staschuk at telusplanet.net> wrote in message news:<mailman.1056912287.3256.python-list at python.org>...

> Having had some spare time today, I've done this for you.  Here's
> the (not *quite* minimal, actually) result:
> 
>     def addroutes(IP, METHOD):
>         global METHOD
> 
>     def main():
>         global VERBOSE
>         VERBOSE = '1'
>         global VERBOSE
> 
>     print 'foo'
> 
> On my machine, with 2.2.2 this code issues the SyntaxWarning and
> then segfaults, and on 2.3 issues the SyntaxWarning and dies
> without printing 'foo'.

With the above code in a file called fugly.py, here are some perhaps
illuminating results from the Win32 2.2.3 Python:

C:\junk>python fugly.py
fugly.py:4: SyntaxWarning: name 'VERBOSE' is assigned to before global
declaration
  def main():

C:\junk>python
Python 2.2.3 (#42, May 30 2003, 18:12:08) [MSC 32 bit (Intel)] on
win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import fugly
XXX rd_object called with exception set
warning: name 'VERBOSE' is assigned to before global declaration
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "fugly.py", line 1
    def addroutes(IP, METHOD):
SyntaxError: name 'METHOD' is local and global
>>> 

N.B. no crashes.

Hope this helps,
John




More information about the Python-list mailing list