new slot tp_iter in type object, plus new flag Py_TPFLAGS_HAVE_ITER
new C API PyObject_GetIter(), calls tp_iter
new builtin iter(), with two forms: iter(obj), and iter(function, sentinel)
new internal object types iterobject and calliterobject
new exception StopIteration
new opcodes for "for" loops, GET_ITER and FOR_ITER (also supported by dis.py)
new magic number for .pyc files
new special method for instances: __iter__() returns an iterator
iteration over dictionaries: "for x in dict" iterates over the keys
iteration over files: "for x in file" iterates over lines
TODO:
documentation
test suite
decide whether to use a different way to spell iter(function, sentinal)
decide whether "for key in dict" is a good idea
use iterators in map/filter/reduce, min/max, and elsewhere (in/not in?)
speed tuning (make next() a slot tp_next???)
The changes cause compilation failures in any file in the Python
installation lib directory to cause the install to fail. It looks
like compileall.py intended to behave this way, but a change to
py_compile.py and a separate bug defeated it.
Fixes SF bug #412436
This change affects the test suite, which contains several files that
contain intentional errors. The solution is to extend compileall.py
with the ability to skip compilation of selected files.
NB compileall.py is changed so that compile_dir() returns success only
if all recursive calls to compile_dir() also check success.
think that a command starting with '#' is a comment, so move the one
comment in such a position (in the rule for building $(LIBRARY)) to a
harmless position.
- Add CONFIG_ARGS variable and use it to re-run configure rather than
using config.status. This prevents an infinite loop if configure
dies while re-configuring.
into Makefile.pre.in; the configure script will only determine the basename
of the file.
This fixes installation of a Python built using C++, reported by Greg
Wilson.
find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f
to remove all .py[co] files before testing, rather than just those in
the Lib/test directory. "find" is used all over the Makefile so I
suppose it's safe; how about xargs?
Makefile.pre.in: add target future.o
Include/compile.h: define PyFutureFeaters and PyNode_Future()
add c_future slot to struct compiling
Include/symtable.h: add st_future slot to struct symtable
Python/future.c: implementation of PyNode_Future()
Python/compile.c: use PyNode_Future() for nested_scopes support
Python/symtable.c: include compile.h to pick up PyFutureFeatures decl
value for it, as suggested in bug #129854. This prevents an old
PYTHONPATH confusing setup.py (say, if it results in Python finding
an old version of the Distutils)
of nested functions. Either is allowed in a function if it contains
no defs or lambdas or the defs and lambdas it contains have no free
variables. If a function is itself nested and has free variables,
either is illegal.
Revise the symtable to use a PySymtableEntryObject, which holds all
the revelent information for a scope, rather than using a bunch of
st_cur_XXX pointers in the symtable struct. The changes simplify the
internal management of the current symtable scope and of the stack.
Added new C source file: Python/symtable.c. (Does the Windows build
process need to be updated?)
As part of these changes, the initial _symtable module interface
introduced in 2.1a2 is replaced. A dictionary of
PySymtableEntryObjects are returned.
trigger my arbitrary exlusion rule, which is: takes more than 10
seconds of wall clock time on my machine. If these tests are going to
be skipped, then a boatload of slower tests should be skipped, too.
run setup.py with the --install-platlib flag so you can override
'prefix' when running make (e.g. make prefix=/tmp/python/usr/local install)
Instead of using mkdir to create directories, use install -d (mkdir -p
apparently isn't portable)
Emacs make-mode reported line 371 as suspicious; removed the whitespace from
that line.