Checkpoint. 218 tests are okay; 53 are failing. Done so far:

- all classes are new-style (but ripping out classobject.[ch] isn't done)
- int/int -> float
- all exceptions must derive from BaseException
- absolute import
- 'as' and 'with' are keywords
This commit is contained in:
Guido van Rossum 2006-03-15 04:58:47 +00:00
parent f3175f6341
commit 45aecf451a
24 changed files with 87 additions and 6365 deletions

View File

@ -7,18 +7,6 @@
# with someone who can; ask around on python-dev for help. Fred # with someone who can; ask around on python-dev for help. Fred
# Drake <fdrake@acm.org> will probably be listening there. # Drake <fdrake@acm.org> will probably be listening there.
# Commands for Kees Blom's railroad program
#diagram:token NAME
#diagram:token NUMBER
#diagram:token STRING
#diagram:token NEWLINE
#diagram:token ENDMARKER
#diagram:token INDENT
#diagram:output\input python.bla
#diagram:token DEDENT
#diagram:output\textwidth 20.04cm\oddsidemargin 0.0cm\evensidemargin 0.0cm
#diagram:rules
# Start symbols for the grammar: # Start symbols for the grammar:
# single_input is a single interactive statement; # single_input is a single interactive statement;
# file_input is a module or sequence of commands read from an input file; # file_input is a module or sequence of commands read from an input file;
@ -61,8 +49,8 @@ import_stmt: import_name | import_from
import_name: 'import' dotted_as_names import_name: 'import' dotted_as_names
import_from: ('from' ('.'* dotted_name | '.') import_from: ('from' ('.'* dotted_name | '.')
'import' ('*' | '(' import_as_names ')' | import_as_names)) 'import' ('*' | '(' import_as_names ')' | import_as_names))
import_as_name: NAME [('as' | NAME) NAME] import_as_name: NAME ['as' NAME]
dotted_as_name: dotted_name [('as' | NAME) NAME] dotted_as_name: dotted_name ['as' NAME]
import_as_names: import_as_name (',' import_as_name)* [','] import_as_names: import_as_name (',' import_as_name)* [',']
dotted_as_names: dotted_as_name (',' dotted_as_name)* dotted_as_names: dotted_as_name (',' dotted_as_name)*
dotted_name: NAME ('.' NAME)* dotted_name: NAME ('.' NAME)*
@ -80,7 +68,7 @@ try_stmt: ('try' ':' suite
['finally' ':' suite] | ['finally' ':' suite] |
'finally' ':' suite)) 'finally' ':' suite))
with_stmt: 'with' test [ with_var ] ':' suite with_stmt: 'with' test [ with_var ] ':' suite
with_var: ('as' | NAME) expr with_var: 'as' expr
# NB compile.c makes sure that the default except clause is last # NB compile.c makes sure that the default except clause is last
except_clause: 'except' [test [',' test]] except_clause: 'except' [test [',' test]]
suite: simple_stmt | NEWLINE INDENT stmt+ DEDENT suite: simple_stmt | NEWLINE INDENT stmt+ DEDENT

View File

@ -41,17 +41,17 @@ typedef struct {
#define CO_NOFREE 0x0040 #define CO_NOFREE 0x0040
#if 0 #if 0
/* This is no longer used. Stopped defining in 2.5, do not re-use. */ /* These are no longer used. */
#define CO_GENERATOR_ALLOWED 0x1000 #define CO_GENERATOR_ALLOWED 0x1000
#endif
#define CO_FUTURE_DIVISION 0x2000 #define CO_FUTURE_DIVISION 0x2000
#define CO_FUTURE_ABSIMPORT 0x4000 /* absolute import by default */ #define CO_FUTURE_ABSIMPORT 0x4000 /* absolute import by default */
#define CO_FUTURE_WITH_STATEMENT 0x8000 #define CO_FUTURE_WITH_STATEMENT 0x8000
#endif
/* This should be defined if a future statement modifies the syntax. /* This should be defined if a future statement modifies the syntax.
For example, when a keyword is added. For example, when a keyword is added.
*/ */
#define PY_PARSER_REQUIRES_FUTURE_KEYWORD /* #define PY_PARSER_REQUIRES_FUTURE_KEYWORD */
#define CO_MAXBLOCKS 20 /* Max static block nesting within a function */ #define CO_MAXBLOCKS 20 /* Max static block nesting within a function */

View File

@ -23,7 +23,9 @@ typedef struct {
#define PyPARSE_DONT_IMPLY_DEDENT 0x0002 #define PyPARSE_DONT_IMPLY_DEDENT 0x0002
#if 0
#define PyPARSE_WITH_IS_KEYWORD 0x0003 #define PyPARSE_WITH_IS_KEYWORD 0x0003
#endif
PyAPI_FUNC(node *) PyParser_ParseString(const char *, grammar *, int, PyAPI_FUNC(node *) PyParser_ParseString(const char *, grammar *, int,
perrdetail *); perrdetail *);

View File

@ -1,9 +1,5 @@
/* Newfangled version identification scheme. /* Python version identification scheme.
This scheme was added in Python 1.5.2b2; before that time, only PATCHLEVEL
was available. To test for presence of the scheme, test for
defined(PY_MAJOR_VERSION).
When the major or minor version changes, the VERSION variable in When the major or minor version changes, the VERSION variable in
configure.in must also be changed. configure.in must also be changed.
@ -19,14 +15,14 @@
/* Higher for patch releases */ /* Higher for patch releases */
/* Version parsed out into numeric values */ /* Version parsed out into numeric values */
#define PY_MAJOR_VERSION 2 #define PY_MAJOR_VERSION 0
#define PY_MINOR_VERSION 5 #define PY_MINOR_VERSION 0
#define PY_MICRO_VERSION 0 #define PY_MICRO_VERSION 0
#define PY_RELEASE_LEVEL PY_RELEASE_LEVEL_ALPHA #define PY_RELEASE_LEVEL PY_RELEASE_LEVEL_ALPHA
#define PY_RELEASE_SERIAL 0 #define PY_RELEASE_SERIAL 0
/* Version as a string */ /* Version as a string */
#define PY_VERSION "2.5a0" #define PY_VERSION "3.0x"
/* Subversion Revision number of this file (not of the repository) */ /* Subversion Revision number of this file (not of the repository) */
#define PY_PATCHLEVEL_REVISION "$Revision$" #define PY_PATCHLEVEL_REVISION "$Revision$"

View File

@ -28,25 +28,18 @@ PyAPI_FUNC(void) PyErr_NormalizeException(PyObject**, PyObject**, PyObject**);
/* */ /* */
#define PyExceptionClass_Check(x) \ #define PyExceptionClass_Check(x) \
(PyClass_Check((x)) \ (PyType_Check((x)) && PyType_IsSubtype( \
|| (PyType_Check((x)) && PyType_IsSubtype( \ (PyTypeObject*)(x), (PyTypeObject*)PyExc_BaseException))
(PyTypeObject*)(x), (PyTypeObject*)PyExc_BaseException)))
#define PyExceptionInstance_Check(x) \ #define PyExceptionInstance_Check(x) \
(PyInstance_Check((x)) || \ (PyType_IsSubtype((x)->ob_type, (PyTypeObject*)PyExc_BaseException))
(PyType_IsSubtype((x)->ob_type, (PyTypeObject*)PyExc_BaseException)))
#define PyExceptionClass_Name(x) \ #define PyExceptionClass_Name(x) \
(PyClass_Check((x)) \ ((char *)(((PyTypeObject*)(x))->tp_name))
? PyString_AS_STRING(((PyClassObject*)(x))->cl_name) \
: (char *)(((PyTypeObject*)(x))->tp_name))
#define PyExceptionInstance_Class(x) \ #define PyExceptionInstance_Class(x) ((PyObject*)((x)->ob_type))
((PyInstance_Check((x)) \
? (PyObject*)((PyInstanceObject*)(x))->in_class \
: (PyObject*)((x)->ob_type)))
/* Predefined exceptions */ /* Predefined exceptions */

View File

@ -7,9 +7,8 @@
extern "C" { extern "C" {
#endif #endif
#define PyCF_MASK (CO_FUTURE_DIVISION | CO_FUTURE_ABSIMPORT | \ #define PyCF_MASK 0
CO_FUTURE_WITH_STATEMENT) #define PyCF_MASK_OBSOLETE 0
#define PyCF_MASK_OBSOLETE (CO_NESTED)
#define PyCF_SOURCE_IS_UTF8 0x0100 #define PyCF_SOURCE_IS_UTF8 0x0100
#define PyCF_DONT_IMPLY_DEDENT 0x0200 #define PyCF_DONT_IMPLY_DEDENT 0x0200
#define PyCF_ONLY_AST 0x0400 #define PyCF_ONLY_AST 0x0400

View File

@ -4,17 +4,12 @@ This is only useful to add pickle support for extension types defined in
C, not for instances of user-defined classes. C, not for instances of user-defined classes.
""" """
from types import ClassType as _ClassType
__all__ = ["pickle", "constructor", __all__ = ["pickle", "constructor",
"add_extension", "remove_extension", "clear_extension_cache"] "add_extension", "remove_extension", "clear_extension_cache"]
dispatch_table = {} dispatch_table = {}
def pickle(ob_type, pickle_function, constructor_ob=None): def pickle(ob_type, pickle_function, constructor_ob=None):
if type(ob_type) is _ClassType:
raise TypeError("copy_reg is not intended for use with classes")
if not callable(pickle_function): if not callable(pickle_function):
raise TypeError("reduction functions must be callable") raise TypeError("reduction functions must be callable")
dispatch_table[ob_type] = pickle_function dispatch_table[ob_type] = pickle_function

View File

@ -16,7 +16,7 @@ import re
import string import string
import sys import sys
from errors import DistutilsPlatformError from .errors import DistutilsPlatformError
# These are needed in a couple of spots, so just compute them once. # These are needed in a couple of spots, so just compute them once.
PREFIX = os.path.normpath(sys.prefix) PREFIX = os.path.normpath(sys.prefix)

View File

@ -27,7 +27,8 @@ Written by Marc-Andre Lemburg (mal@lemburg.com).
"""#" """#"
import codecs, types, aliases import codecs, types
from . import aliases
_cache = {} _cache = {}
_unknown = '--unknown--' _unknown = '--unknown--'

View File

@ -25,9 +25,9 @@ if n != 90:
print '2.2 raise class exceptions' print '2.2 raise class exceptions'
class AClass: pass class AClass(Exception): pass
class BClass(AClass): pass class BClass(AClass): pass
class CClass: pass class CClass(Exception): pass
class DClass(AClass): class DClass(AClass):
def __init__(self, ignore): def __init__(self, ignore):
pass pass
@ -58,8 +58,8 @@ except AClass, v:
if v != b: raise TestFailed, "v!=b AClass" if v != b: raise TestFailed, "v!=b AClass"
# not enough arguments # not enough arguments
try: raise BClass, a ##try: raise BClass, a
except TypeError: pass ##except TypeError: pass
try: raise DClass, a try: raise DClass, a
except DClass, v: except DClass, v:

6223
Misc/NEWS

File diff suppressed because it is too large Load Diff

View File

@ -2,7 +2,6 @@
#include "Python.h" #include "Python.h"
#include "osdefs.h" #include "osdefs.h"
#include "code.h" /* For CO_FUTURE_DIVISION */
#include "import.h" #include "import.h"
#ifdef __VMS #ifdef __VMS
@ -34,7 +33,7 @@ static char **orig_argv;
static int orig_argc; static int orig_argc;
/* command line options */ /* command line options */
#define BASE_OPTS "c:dEhim:OQ:StuUvVW:xX" #define BASE_OPTS "c:dEhim:OStuvVW:xX"
#ifndef RISCOS #ifndef RISCOS
#define PROGRAM_OPTS BASE_OPTS #define PROGRAM_OPTS BASE_OPTS
@ -64,7 +63,6 @@ static char *usage_2 = "\
-m mod : run library module as a script (terminates option list)\n\ -m mod : run library module as a script (terminates option list)\n\
-O : optimize generated bytecode (a tad; also PYTHONOPTIMIZE=x)\n\ -O : optimize generated bytecode (a tad; also PYTHONOPTIMIZE=x)\n\
-OO : remove doc-strings in addition to the -O optimizations\n\ -OO : remove doc-strings in addition to the -O optimizations\n\
-Q arg : division options: -Qold (default), -Qwarn, -Qwarnall, -Qnew\n\
-S : don't imply 'import site' on initialization\n\ -S : don't imply 'import site' on initialization\n\
-t : issue warnings about inconsistent tab usage (-tt: issue errors)\n\ -t : issue warnings about inconsistent tab usage (-tt: issue errors)\n\
-u : unbuffered binary stdout and stderr (also PYTHONUNBUFFERED=x)\n\ -u : unbuffered binary stdout and stderr (also PYTHONUNBUFFERED=x)\n\
@ -220,33 +218,6 @@ Py_Main(int argc, char **argv)
Py_DebugFlag++; Py_DebugFlag++;
break; break;
case 'Q':
if (strcmp(_PyOS_optarg, "old") == 0) {
Py_DivisionWarningFlag = 0;
break;
}
if (strcmp(_PyOS_optarg, "warn") == 0) {
Py_DivisionWarningFlag = 1;
break;
}
if (strcmp(_PyOS_optarg, "warnall") == 0) {
Py_DivisionWarningFlag = 2;
break;
}
if (strcmp(_PyOS_optarg, "new") == 0) {
/* This only affects __main__ */
cf.cf_flags |= CO_FUTURE_DIVISION;
/* And this tells the eval loop to treat
BINARY_DIVIDE as BINARY_TRUE_DIVIDE */
_Py_QnewFlag = 1;
break;
}
fprintf(stderr,
"-Q option should be `-Qold', "
"`-Qwarn', `-Qwarnall', or `-Qnew' only\n");
return usage(2, argv[0]);
/* NOTREACHED */
case 'i': case 'i':
inspect++; inspect++;
saw_inspect_flag = 1; saw_inspect_flag = 1;
@ -288,12 +259,10 @@ Py_Main(int argc, char **argv)
skipfirstline = 1; skipfirstline = 1;
break; break;
case 'U':
Py_UnicodeFlag++;
break;
case 'h': case 'h':
help++; help++;
break; break;
case 'V': case 'V':
version++; version++;
break; break;

View File

@ -2106,12 +2106,7 @@ recursive_isinstance(PyObject *inst, PyObject *cls, int recursion_depth)
return -1; return -1;
} }
if (PyClass_Check(cls) && PyInstance_Check(inst)) { if (PyType_Check(cls)) {
PyObject *inclass =
(PyObject*)((PyInstanceObject*)inst)->in_class;
retval = PyClass_IsSubclass(inclass, cls);
}
else if (PyType_Check(cls)) {
retval = PyObject_TypeCheck(inst, (PyTypeObject *)cls); retval = PyObject_TypeCheck(inst, (PyTypeObject *)cls);
if (retval == 0) { if (retval == 0) {
PyObject *c = PyObject_GetAttr(inst, __class__); PyObject *c = PyObject_GetAttr(inst, __class__);
@ -2177,7 +2172,7 @@ recursive_issubclass(PyObject *derived, PyObject *cls, int recursion_depth)
{ {
int retval; int retval;
if (!PyClass_Check(derived) || !PyClass_Check(cls)) { {
if (!check_class(derived, if (!check_class(derived,
"issubclass() arg 1 must be a class")) "issubclass() arg 1 must be a class"))
return -1; return -1;
@ -2212,11 +2207,6 @@ recursive_issubclass(PyObject *derived, PyObject *cls, int recursion_depth)
retval = abstract_issubclass(derived, cls); retval = abstract_issubclass(derived, cls);
} }
else {
/* shortcut */
if (!(retval = (derived == cls)))
retval = PyClass_IsSubclass(derived, cls);
}
return retval; return retval;
} }

View File

@ -149,6 +149,7 @@ classify(parser_state *ps, int type, char *str)
strcmp(l->lb_str, s) != 0) strcmp(l->lb_str, s) != 0)
continue; continue;
#ifdef PY_PARSER_REQUIRES_FUTURE_KEYWORD #ifdef PY_PARSER_REQUIRES_FUTURE_KEYWORD
/* Leaving this in as an example */
if (!(ps->p_flags & CO_FUTURE_WITH_STATEMENT)) { if (!(ps->p_flags & CO_FUTURE_WITH_STATEMENT)) {
if (s[0] == 'w' && strcmp(s, "with") == 0) if (s[0] == 'w' && strcmp(s, "with") == 0)
break; /* not a keyword yet */ break; /* not a keyword yet */
@ -177,6 +178,7 @@ classify(parser_state *ps, int type, char *str)
} }
#ifdef PY_PARSER_REQUIRES_FUTURE_KEYWORD #ifdef PY_PARSER_REQUIRES_FUTURE_KEYWORD
/* Leaving this in as an example */
static void static void
future_hack(parser_state *ps) future_hack(parser_state *ps)
{ {

View File

@ -192,7 +192,8 @@ parsetok(struct tok_state *tok, grammar *g, int start, perrdetail *err_ret,
col_offset = -1; col_offset = -1;
if ((err_ret->error = if ((err_ret->error =
PyParser_AddToken(ps, (int)type, str, tok->lineno, col_offset, PyParser_AddToken(ps, (int)type, str,
tok->lineno, col_offset,
&(err_ret->expected))) != E_OK) { &(err_ret->expected))) != E_OK) {
if (err_ret->error != E_DONE) if (err_ret->error != E_DONE)
PyObject_FREE(str); PyObject_FREE(str);

View File

@ -3025,15 +3025,7 @@ do_raise(PyObject *type, PyObject *value, PyObject *tb)
Py_DECREF(tmp); Py_DECREF(tmp);
} }
if (PyString_CheckExact(type)) { if (PyExceptionClass_Check(type))
/* Raising builtin string is deprecated but still allowed --
* do nothing. Raising an instance of a new-style str
* subclass is right out. */
if (PyErr_Warn(PyExc_DeprecationWarning,
"raising a string exception is deprecated"))
goto raise_error;
}
else if (PyExceptionClass_Check(type))
PyErr_NormalizeException(&type, &value, &tb); PyErr_NormalizeException(&type, &value, &tb);
else if (PyExceptionInstance_Check(type)) { else if (PyExceptionInstance_Check(type)) {
@ -3054,10 +3046,8 @@ do_raise(PyObject *type, PyObject *value, PyObject *tb)
else { else {
/* Not something you can raise. You get an exception /* Not something you can raise. You get an exception
anyway, just not what you specified :-) */ anyway, just not what you specified :-) */
PyErr_Format(PyExc_TypeError, PyErr_SetString(PyExc_TypeError,
"exceptions must be classes, instances, or " "exceptions must derive from BaseException");
"strings (deprecated), not %s",
type->ob_type->tp_name);
goto raise_error; goto raise_error;
} }
PyErr_Restore(type, value, tb); PyErr_Restore(type, value, tb);
@ -4148,7 +4138,7 @@ build_class(PyObject *methods, PyObject *bases, PyObject *name)
if (g != NULL && PyDict_Check(g)) if (g != NULL && PyDict_Check(g))
metaclass = PyDict_GetItemString(g, "__metaclass__"); metaclass = PyDict_GetItemString(g, "__metaclass__");
if (metaclass == NULL) if (metaclass == NULL)
metaclass = (PyObject *) &PyClass_Type; metaclass = (PyObject *) &PyType_Type;
Py_INCREF(metaclass); Py_INCREF(metaclass);
} }
result = PyObject_CallFunction(metaclass, "OOO", name, bases, methods); result = PyObject_CallFunction(metaclass, "OOO", name, bases, methods);

View File

@ -2464,11 +2464,7 @@ compiler_import(struct compiler *c, stmt_ty s)
int r; int r;
PyObject *level; PyObject *level;
if (c->c_flags && (c->c_flags->cf_flags & CO_FUTURE_ABSIMPORT)) level = PyInt_FromLong(0);
level = PyInt_FromLong(0);
else
level = PyInt_FromLong(-1);
if (level == NULL) if (level == NULL)
return 0; return 0;
@ -2511,12 +2507,7 @@ compiler_from_import(struct compiler *c, stmt_ty s)
if (!names) if (!names)
return 0; return 0;
if (s->v.ImportFrom.level == 0 && c->c_flags && level = PyInt_FromLong(s->v.ImportFrom.level);
!(c->c_flags->cf_flags & CO_FUTURE_ABSIMPORT))
level = PyInt_FromLong(-1);
else
level = PyInt_FromLong(s->v.ImportFrom.level);
if (!level) { if (!level) {
Py_DECREF(names); Py_DECREF(names);
return 0; return 0;
@ -2746,10 +2737,7 @@ binop(struct compiler *c, operator_ty op)
case Mult: case Mult:
return BINARY_MULTIPLY; return BINARY_MULTIPLY;
case Div: case Div:
if (c->c_flags && c->c_flags->cf_flags & CO_FUTURE_DIVISION) return BINARY_TRUE_DIVIDE;
return BINARY_TRUE_DIVIDE;
else
return BINARY_DIVIDE;
case Mod: case Mod:
return BINARY_MODULO; return BINARY_MODULO;
case Pow: case Pow:
@ -2809,10 +2797,7 @@ inplace_binop(struct compiler *c, operator_ty op)
case Mult: case Mult:
return INPLACE_MULTIPLY; return INPLACE_MULTIPLY;
case Div: case Div:
if (c->c_flags && c->c_flags->cf_flags & CO_FUTURE_DIVISION) return INPLACE_TRUE_DIVIDE;
return INPLACE_TRUE_DIVIDE;
else
return INPLACE_DIVIDE;
case Mod: case Mod:
return INPLACE_MODULO; return INPLACE_MODULO;
case Pow: case Pow:

View File

@ -557,7 +557,8 @@ PyErr_NewException(char *name, PyObject *base, PyObject *dict)
bases = PyTuple_Pack(1, base); bases = PyTuple_Pack(1, base);
if (bases == NULL) if (bases == NULL)
goto failure; goto failure;
result = PyClass_New(bases, dict, classname); result = PyObject_CallFunction((PyObject *) (base->ob_type),
"OOO", classname, bases, dict);
failure: failure:
Py_XDECREF(bases); Py_XDECREF(bases);
Py_XDECREF(mydict); Py_XDECREF(mydict);

View File

@ -28,11 +28,11 @@ future_check_features(PyFutureFeatures *ff, stmt_ty s, const char *filename)
} else if (strcmp(feature, FUTURE_GENERATORS) == 0) { } else if (strcmp(feature, FUTURE_GENERATORS) == 0) {
continue; continue;
} else if (strcmp(feature, FUTURE_DIVISION) == 0) { } else if (strcmp(feature, FUTURE_DIVISION) == 0) {
ff->ff_features |= CO_FUTURE_DIVISION; continue;
} else if (strcmp(feature, FUTURE_ABSIMPORT) == 0) { } else if (strcmp(feature, FUTURE_ABSIMPORT) == 0) {
ff->ff_features |= CO_FUTURE_ABSIMPORT; continue;
} else if (strcmp(feature, FUTURE_WITH_STATEMENT) == 0) { } else if (strcmp(feature, FUTURE_WITH_STATEMENT) == 0) {
ff->ff_features |= CO_FUTURE_WITH_STATEMENT; continue;
} else if (strcmp(feature, "braces") == 0) { } else if (strcmp(feature, "braces") == 0) {
PyErr_SetString(PyExc_SyntaxError, PyErr_SetString(PyExc_SyntaxError,
"not a chance"); "not a chance");

View File

@ -486,15 +486,16 @@ converterr(const char *expected, PyObject *arg, char *msgbuf, size_t bufsize)
#define CONV_UNICODE "(unicode conversion error)" #define CONV_UNICODE "(unicode conversion error)"
/* explicitly check for float arguments when integers are expected. For now /* Explicitly check for float arguments when integers are expected.
* signal a warning. Returns true if an exception was raised. */ Return 1 for error, 0 if ok. */
static int static int
float_argument_error(PyObject *arg) float_argument_error(PyObject *arg)
{ {
if (PyFloat_Check(arg) && if (PyFloat_Check(arg)) {
PyErr_Warn(PyExc_DeprecationWarning, PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" )) "integer argument expected, got float" );
return 1; return 1;
}
else else
return 0; return 0;
} }

View File

@ -556,9 +556,8 @@ static state states_26[9] = {
static arc arcs_27_0[1] = { static arc arcs_27_0[1] = {
{19, 1}, {19, 1},
}; };
static arc arcs_27_1[3] = { static arc arcs_27_1[2] = {
{78, 2}, {78, 2},
{19, 2},
{0, 1}, {0, 1},
}; };
static arc arcs_27_2[1] = { static arc arcs_27_2[1] = {
@ -569,16 +568,15 @@ static arc arcs_27_3[1] = {
}; };
static state states_27[4] = { static state states_27[4] = {
{1, arcs_27_0}, {1, arcs_27_0},
{3, arcs_27_1}, {2, arcs_27_1},
{1, arcs_27_2}, {1, arcs_27_2},
{1, arcs_27_3}, {1, arcs_27_3},
}; };
static arc arcs_28_0[1] = { static arc arcs_28_0[1] = {
{12, 1}, {12, 1},
}; };
static arc arcs_28_1[3] = { static arc arcs_28_1[2] = {
{78, 2}, {78, 2},
{19, 2},
{0, 1}, {0, 1},
}; };
static arc arcs_28_2[1] = { static arc arcs_28_2[1] = {
@ -589,7 +587,7 @@ static arc arcs_28_3[1] = {
}; };
static state states_28[4] = { static state states_28[4] = {
{1, arcs_28_0}, {1, arcs_28_0},
{3, arcs_28_1}, {2, arcs_28_1},
{1, arcs_28_2}, {1, arcs_28_2},
{1, arcs_28_3}, {1, arcs_28_3},
}; };
@ -917,9 +915,8 @@ static state states_40[6] = {
{1, arcs_40_4}, {1, arcs_40_4},
{1, arcs_40_5}, {1, arcs_40_5},
}; };
static arc arcs_41_0[2] = { static arc arcs_41_0[1] = {
{78, 1}, {78, 1},
{19, 1},
}; };
static arc arcs_41_1[1] = { static arc arcs_41_1[1] = {
{82, 2}, {82, 2},
@ -928,7 +925,7 @@ static arc arcs_41_2[1] = {
{0, 2}, {0, 2},
}; };
static state states_41[3] = { static state states_41[3] = {
{2, arcs_41_0}, {1, arcs_41_0},
{1, arcs_41_1}, {1, arcs_41_1},
{1, arcs_41_2}, {1, arcs_41_2},
}; };
@ -1870,7 +1867,7 @@ static dfa dfas[84] = {
{296, "with_stmt", 0, 6, states_40, {296, "with_stmt", 0, 6, states_40,
"\000\000\000\000\000\000\000\000\000\000\000\000\010\000\000\000\000\000\000\000\000"}, "\000\000\000\000\000\000\000\000\000\000\000\000\010\000\000\000\000\000\000\000\000"},
{297, "with_var", 0, 3, states_41, {297, "with_var", 0, 3, states_41,
"\000\000\010\000\000\000\000\000\000\100\000\000\000\000\000\000\000\000\000\000\000"}, "\000\000\000\000\000\000\000\000\000\100\000\000\000\000\000\000\000\000\000\000\000"},
{298, "except_clause", 0, 5, states_42, {298, "except_clause", 0, 5, states_42,
"\000\000\000\000\000\000\000\000\000\000\000\000\040\000\000\000\000\000\000\000\000"}, "\000\000\000\000\000\000\000\000\000\000\000\000\040\000\000\000\000\000\000\000\000"},
{299, "suite", 0, 5, states_43, {299, "suite", 0, 5, states_43,

View File

@ -28,7 +28,7 @@ extern time_t PyOS_GetLastModificationTime(char *, FILE *);
a .pyc file in text mode the magic number will be wrong; also, the a .pyc file in text mode the magic number will be wrong; also, the
Apple MPW compiler swaps their values, botching string constants. Apple MPW compiler swaps their values, botching string constants.
The magic numbers must be spaced apart atleast 2 values, as the The magic numbers must be spaced apart at least 2 values, as the
-U interpeter flag will cause MAGIC+1 being used. They have been -U interpeter flag will cause MAGIC+1 being used. They have been
odd numbers for some time now. odd numbers for some time now.
@ -56,9 +56,10 @@ extern time_t PyOS_GetLastModificationTime(char *, FILE *);
Python 2.5a0: 62081 (ast-branch) Python 2.5a0: 62081 (ast-branch)
Python 2.5a0: 62091 (with) Python 2.5a0: 62091 (with)
Python 2.5a0: 62092 (changed WITH_CLEANUP opcode) Python 2.5a0: 62092 (changed WITH_CLEANUP opcode)
Python 3000: 3000
. .
*/ */
#define MAGIC (62092 | ((long)'\r'<<16) | ((long)'\n'<<24)) #define MAGIC (3000 | ((long)'\r'<<16) | ((long)'\n'<<24))
/* Magic word as global; note that _PyImport_Init() can change the /* Magic word as global; note that _PyImport_Init() can change the
value of this global to accommodate for alterations of how the value of this global to accommodate for alterations of how the

View File

@ -696,9 +696,7 @@ PyRun_InteractiveLoopFlags(FILE *fp, const char *filename, PyCompilerFlags *flag
/* compute parser flags based on compiler flags */ /* compute parser flags based on compiler flags */
#define PARSER_FLAGS(flags) \ #define PARSER_FLAGS(flags) \
((flags) ? ((((flags)->cf_flags & PyCF_DONT_IMPLY_DEDENT) ? \ ((flags) ? ((((flags)->cf_flags & PyCF_DONT_IMPLY_DEDENT) ? \
PyPARSE_DONT_IMPLY_DEDENT : 0) \ PyPARSE_DONT_IMPLY_DEDENT : 0)) : 0)
| ((flags)->cf_flags & CO_FUTURE_WITH_STATEMENT ? \
PyPARSE_WITH_IS_KEYWORD : 0)) : 0)
int int
PyRun_InteractiveOneFlags(FILE *fp, const char *filename, PyCompilerFlags *flags) PyRun_InteractiveOneFlags(FILE *fp, const char *filename, PyCompilerFlags *flags)

4
README
View File

@ -1,5 +1,5 @@
This is Python version 2.5 alpha 0 This is Python 3000 -- unversioned (branched off 2.5 pre alpha 1)
================================== =================================================================
Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006 Python Software Foundation. Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006 Python Software Foundation.
All rights reserved. All rights reserved.