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.

classification
Title: spurious SyntaxWarning
Type: Stage:
Components: Interpreter Core Versions: Python 2.3
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: jhylton, loewis, skip.montanaro
Priority: normal Keywords:

Created on 2002-09-03 16:05 by skip.montanaro, last changed 2022-04-10 16:05 by admin. This issue is now closed.

Messages (5)
msg12246 - (view) Author: Skip Montanaro (skip.montanaro) * (Python triager) Date: 2002-09-03 16:05
The compiler now warns about assignment to None, however it trips 
up on this innocuous optimization:

    from __builtin__ import None
msg12247 - (view) Author: Jeremy Hylton (jhylton) (Python triager) Date: 2002-09-03 22:21
Logged In: YES 
user_id=31392

Maybe it isn't innocuous.
msg12248 - (view) Author: Skip Montanaro (skip.montanaro) * (Python triager) Date: 2002-09-03 22:35
Logged In: YES 
user_id=44345

Granted, perhaps it's not.  In this case it is.  The programmer was 
copying None from builtins to the local scope to speed up access to that 
object.  If they had done something like

    None = 87

I would have expected a warning.
msg12249 - (view) Author: Jeremy Hylton (jhylton) (Python triager) Date: 2002-09-03 22:38
Logged In: YES 
user_id=31392

Right, in this particular case it is safe.  The programmer
can also use the warnings module to stop the warning about
the optimization.  The same would happen is someone used
"None=None" in an argument list.
msg12250 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2002-09-11 16:49
Logged In: YES 
user_id=21627

This is not a bug (IMO). The SyntaxWarning is a step on the
way of making None a keyword, at which point " from
__builtin__ import None" will become a SyntaxError.
Therefore, the compiler must warn about that today,
according to PEP 5.
History
Date User Action Args
2022-04-10 16:05:38adminsetgithub: 37127
2002-09-03 16:05:47skip.montanarocreate