cpython/Include
Guido van Rossum 8746082175 Patch by Tim Peters:
Introduce a new builtin exception, UnboundLocalError, raised when ceval.c
tries to retrieve or delete a local name that isn't bound to a value.
Currently raises NameError, which makes this behavior a FAQ since the same
error is raised for "missing" global names too:  when the user has a global
of the same name as the unbound local, NameError makes no sense to them.
Even in the absence of shadowing, knowing whether a bogus name is local or
global is a real aid to quick understanding.

Example:

D:\src\PCbuild>type local.py
x = 42

def f():
    print x
    x = 13
    return x

f()

D:\src\PCbuild>python local.py
Traceback (innermost last):
  File "local.py", line 8, in ?
    f()
  File "local.py", line 4, in f
    print x
UnboundLocalError: x

D:\src\PCbuild>

Note that UnboundLocalError is a subclass of NameError, for compatibility
with existing class-exception code that may be trying to catch this as a
NameError.  Unfortunately, I see no way to make this wholly compatible
with -X (see comments in bltinmodule.c):  under -X, [UnboundLocalError
is an alias for NameError --GvR].

[The ceval.c patch differs slightly from the second version that Tim
submitted; I decided not to raise UnboundLocalError for DELETE_NAME,
only for DELETE_LOCAL.  DELETE_NAME is only generated at the module
level, and since at that level a NameError is raised for referencing
an undefined name, it should also be raised for deleting one.]
1999-06-22 14:47:32 +00:00
..
Makefile
Python.h New version identification scheme. 1999-01-03 12:40:24 +00:00
abstract.h Add DLL level b/w compat for PySequence_In and PyEval_CallObject 1999-03-17 18:44:39 +00:00
bitset.h New permission notice, includes CNRI. 1996-10-25 14:44:06 +00:00
bufferobject.h Add DL_IMPORT(returntype) for all officially exported functions. 1998-12-04 18:48:25 +00:00
cStringIO.h There's a macro PycString_IMPORT which the documentation listed as 1999-01-25 21:36:13 +00:00
ceval.h Add DLL level b/w compat for PySequence_In and PyEval_CallObject 1999-03-17 18:44:39 +00:00
classobject.h Add DL_IMPORT(returntype) for all officially exported functions. 1998-12-04 18:48:25 +00:00
cobject.h Add DL_IMPORT(returntype) for all officially exported functions. 1998-12-04 18:48:25 +00:00
compile.h Add DL_IMPORT(returntype) for all officially exported functions. 1998-12-04 18:48:25 +00:00
complexobject.h Add DL_IMPORT(returntype) for all officially exported functions. 1998-12-04 18:48:25 +00:00
config.h
dictobject.h Add DL_IMPORT(returntype) for all officially exported functions. 1998-12-04 18:48:25 +00:00
errcode.h Add E_INDENT -- new error to check for bad indentation 1998-04-09 21:37:20 +00:00
eval.h Add DL_IMPORT(returntype) for all officially exported functions. 1998-12-04 18:48:25 +00:00
fileobject.h Add DL_IMPORT(returntype) for all officially exported functions. 1998-12-04 18:48:25 +00:00
floatobject.h Add DL_IMPORT(returntype) for all officially exported functions. 1998-12-04 18:48:25 +00:00
frameobject.h Add DL_IMPORT(returntype) for all officially exported functions. 1998-12-04 18:48:25 +00:00
funcobject.h Add DL_IMPORT(returntype) for all officially exported functions. 1998-12-04 18:48:25 +00:00
graminit.h Added assert grammar. 1997-04-02 05:24:08 +00:00
grammar.h Added prototype for PyGrammar_RemoveAccelerators(). 1997-08-12 14:57:08 +00:00
import.h Chris Herborth writes: 1999-01-04 16:39:38 +00:00
intobject.h Add prototypes for PyOS_strto[u]l -- Chris Herborth. 1998-12-10 16:54:17 +00:00
intrcheck.h Add DL_IMPORT(returntype) for all officially exported functions. 1998-12-04 18:48:25 +00:00
listobject.h Add DL_IMPORT(returntype) for all officially exported functions. 1998-12-04 18:48:25 +00:00
longintrepr.h Add DL_IMPORT(returntype) for all officially exported functions. 1998-12-04 18:48:25 +00:00
longobject.h Changes for long file support by Steve Clift. 1999-01-06 18:39:42 +00:00
marshal.h Add DL_IMPORT(returntype) for all officially exported functions. 1998-12-04 18:48:25 +00:00
metagrammar.h New permission notice, includes CNRI. 1996-10-25 14:44:06 +00:00
methodobject.h Add DL_IMPORT(returntype) for all officially exported functions. 1998-12-04 18:48:25 +00:00
modsupport.h New version identification scheme. 1999-01-03 12:40:24 +00:00
moduleobject.h Add PyModule_GetFilename(). 1999-02-15 14:43:11 +00:00
mymalloc.h Add DL_IMPORT(returntype) for all officially exported functions. 1998-12-04 18:48:25 +00:00
mymath.h Metrowerks PRO4 finally fixes the hypot snafu. (Jack Jansen) 1998-11-02 16:21:39 +00:00
myproto.h Oops, rename2.h was included by some other headers. 1997-05-07 23:50:40 +00:00
myselect.h Move the #include of <sys/select> to *after* mytime.h (or <time.h>), 1998-09-28 22:05:22 +00:00
mytime.h New permission notice, includes CNRI. 1996-10-25 14:44:06 +00:00
node.h Add DL_IMPORT(returntype) for all officially exported functions. 1998-12-04 18:48:25 +00:00
object.h Add DL_IMPORT(returntype) for all officially exported functions. 1998-12-04 18:48:25 +00:00
objimpl.h Add DL_IMPORT(returntype) for all officially exported functions. 1998-12-04 18:48:25 +00:00
opcode.h Get rid of some obsolete opcodes. 1998-07-07 14:58:39 +00:00
osdefs.h Use the proper OS2 test symbol: PYOS_OS2. 1997-12-05 21:39:25 +00:00
parsetok.h Add DL_IMPORT(returntype) for all officially exported functions. 1998-12-04 18:48:25 +00:00
patchlevel.h Set PATCHLEVEL and PY_VERSION (string version only) to 1.5.2+ to 1999-06-09 15:16:18 +00:00
pgenheaders.h Add DL_IMPORT(returntype) for all officially exported functions. 1998-12-04 18:48:25 +00:00
pydebug.h Add DL_IMPORT(returntype) for all officially exported functions. 1998-12-04 18:48:25 +00:00
pyerrors.h Patch by Tim Peters: 1999-06-22 14:47:32 +00:00
pyfpe.h Some patches to Lee Busby's fpectl mods that accidentally didn't make it 1997-10-20 23:50:01 +00:00
pystate.h I can't seem to do anything right :-) 1998-12-21 20:21:19 +00:00
pythonrun.h Add DL_IMPORT(returntype) for all officially exported functions. 1998-12-04 18:48:25 +00:00
pythread.h Conform to standard boilerplate. 1999-03-24 19:02:09 +00:00
rangeobject.h Add DL_IMPORT(returntype) for all officially exported functions. 1998-12-04 18:48:25 +00:00
rename1.h
rename2.h Oops, another forgotten renaming: varobject -> PyVarObject. 1997-05-15 21:31:03 +00:00
sliceobject.h Add DL_IMPORT(returntype) for all officially exported functions. 1998-12-04 18:48:25 +00:00
stringobject.h Add DL_IMPORT(returntype) for all officially exported functions. 1998-12-04 18:48:25 +00:00
structmember.h Add DL_IMPORT(returntype) for all officially exported functions. 1998-12-04 18:48:25 +00:00
sysmodule.h Add DL_IMPORT(returntype) for all officially exported functions. 1998-12-04 18:48:25 +00:00
thread.h Adding thread.h -- unused but for b/w compatibility. 1999-03-22 22:25:39 +00:00
token.h Add DL_IMPORT(returntype) for all officially exported functions. 1998-12-04 18:48:25 +00:00
traceback.h Add DL_IMPORT(returntype) for all officially exported functions. 1998-12-04 18:48:25 +00:00
tupleobject.h Add DL_IMPORT(returntype) for all officially exported functions. 1998-12-04 18:48:25 +00:00