[Patches] [ python-Patches-736730 ] Trivial improvement to NameError message

SourceForge.net noreply@sourceforge.net
Mon, 12 May 2003 15:52:44 -0700


Patches item #736730, was opened at 2003-05-12 17:52
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=736730&group_id=5470

Category: Core (C code)
Group: Python 2.3
Status: Open
Resolution: None
Priority: 5
Submitted By: Skip Montanaro (montanaro)
Assigned to: Nobody/Anonymous (nobody)
Summary: Trivial improvement to NameError message

Initial Comment:
This is a trivial change, but since code may depend on the
exact wording, I'm submitting a patch for review.

The compiler knows when there's no locally bound name
and generates LOAD_GLOBAL.  If a NameError is raised
during that instruction, it generates an error message like

    global name 'XYZ' is not defined

This can be misleading to new users.  The fact that the
name is not found by LOAD_GLOBAL is strictly an
optimization detail.  I think something like the attached
patch would be better.


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

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