[Patches] [ python-Patches-711861 ] Replace LOAD_GLOBAL "None" with LOAD_CONST Py_None

SourceForge.net noreply@sourceforge.net
Sat, 29 Mar 2003 13:19:50 -0800


Patches item #711861, was opened at 2003-03-29 12:27
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=711861&group_id=5470

Category: Core (C code)
Group: Python 2.3
Status: Open
>Resolution: Later
Priority: 5
Submitted By: Raymond Hettinger (rhettinger)
>Assigned to: Raymond Hettinger (rhettinger)
>Summary: Replace LOAD_GLOBAL "None" with LOAD_CONST Py_None

Initial Comment:
Okay, here's one __builtin__ that's guaranteed not to 
change or be shadowed.

----------------------------------------------------------------------

>Comment By: Raymond Hettinger (rhettinger)
Date: 2003-03-29 16:19

Message:
Logged In: YES 
user_id=80475

Hmm, in Py2.3a2+, it only gives a warning.
Putting this one on hold until I can find out
why it was safe for the compiler to return
a None constant at the end of a function.

----------------------------------------------------------------------

Comment By: Raymond Hettinger (rhettinger)
Date: 2003-03-29 13:05

Message:
Logged In: YES 
user_id=80475

Python 2.3a2 (#39, Feb 19 2003, 17:58:58) [MSC v.1200 
32 bit (Intel)] on win32
Type "copyright", "credits" or "license" for more information.
IDLE 0.8 -- press F1 for help
>>> None = 1
SyntaxError: assignment to None (<pyshell#0>, line 1)


In addition, the compiler already makes this assumption 
elsewhere.  Every function ends with:
  2           0 LOAD_CONST               0 (None)
              3 RETURN_VALUE 

----------------------------------------------------------------------

Comment By: Martin v. Löwis (loewis)
Date: 2003-03-29 12:37

Message:
Logged In: YES 
user_id=21627

Where do you get this guarantee from?

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=711861&group_id=5470