Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff -x 'config.status*' -x Makefile.pre -x 'graminit.*' -urN Python-2.6.2/Grammar/Grammar Python-2.6.2.modified/Grammar/Grammar
- --- Python-2.6.2/Grammar/Grammar 2008-08-20 04:52:46.000000000 +0900
- +++ Python-2.6.2.modified/Grammar/Grammar 2009-09-08 01:42:08.766227422 +0900
- @@ -27,14 +27,14 @@
- # file_input is a module or sequence of commands read from an input file;
- # eval_input is the input for the eval() and input() functions.
- # NB: compound_stmt in single_input is followed by extra NEWLINE!
- -single_input: NEWLINE | simple_stmt | compound_stmt NEWLINE
- -file_input: (NEWLINE | stmt)* ENDMARKER
- +single_input: ';'* (stmt ';'+)* [stmt] NEWLINE
- +file_input: separator* (stmt separator+)* [stmt] ENDMARKER
- eval_input: testlist NEWLINE* ENDMARKER
- decorator: '@' dotted_name [ '(' [arglist] ')' ] NEWLINE
- decorators: decorator+
- decorated: decorators (classdef | funcdef)
- -funcdef: 'def' NAME parameters ':' suite
- +funcdef: 'def' NAME parameters suite 'end'
- parameters: '(' [varargslist] ')'
- varargslist: ((fpdef ['=' test] ',')*
- ('*' NAME [',' '**' NAME] | '**' NAME) |
- @@ -42,8 +42,8 @@
- fpdef: NAME | '(' fplist ')'
- fplist: fpdef (',' fpdef)* [',']
- -stmt: simple_stmt | compound_stmt
- -simple_stmt: small_stmt (';' small_stmt)* [';'] NEWLINE
- +stmt: small_stmt | compound_stmt
- +separator: ';'|NEWLINE
- small_stmt: (expr_stmt | print_stmt | del_stmt | pass_stmt | flow_stmt |
- import_stmt | global_stmt | exec_stmt | assert_stmt)
- expr_stmt: testlist (augassign (yield_expr|testlist) |
- @@ -75,19 +75,20 @@
- assert_stmt: 'assert' test [',' test]
- compound_stmt: if_stmt | while_stmt | for_stmt | try_stmt | with_stmt | funcdef | classdef | decorated
- -if_stmt: 'if' test ':' suite ('elif' test ':' suite)* ['else' ':' suite]
- -while_stmt: 'while' test ':' suite ['else' ':' suite]
- -for_stmt: 'for' exprlist 'in' testlist ':' suite ['else' ':' suite]
- -try_stmt: ('try' ':' suite
- - ((except_clause ':' suite)+
- - ['else' ':' suite]
- - ['finally' ':' suite] |
- - 'finally' ':' suite))
- -with_stmt: 'with' test [ with_var ] ':' suite
- +if_stmt: 'if' test suite ('elsif' test suite)* ['else' suite] 'end'
- +while_stmt: 'while' test suite ['else' suite] 'end'
- +for_stmt: 'for' exprlist 'in' testlist suite ['else' suite] 'end'
- +try_stmt: ('try' suite
- + ((except_clause suite)+
- + ['else' suite]
- + ['finally' suite] |
- + 'finally' suite) 'end')
- +with_stmt: 'with' test [ with_var ] suite 'end'
- with_var: 'as' expr
- # NB compile.c makes sure that the default except clause is last
- except_clause: 'except' [test [('as' | ',') test]]
- -suite: simple_stmt | NEWLINE INDENT stmt+ DEDENT
- +suite: separator+ (stmt separator+)*
- +block: '{' separator* (stmt separator+)* [stmt] '}'
- # Backward compatibility cruft to support:
- # [ x for x in lambda: True, lambda: False if x() ]
- @@ -95,8 +96,7 @@
- # lambda x: 5 if x else 2
- # (But not a mix of the two)
- testlist_safe: old_test [(',' old_test)+ [',']]
- -old_test: or_test | old_lambdef
- -old_lambdef: 'lambda' [varargslist] ':' old_test
- +old_test: or_test | lambdef
- test: or_test ['if' or_test 'else' test] | lambdef
- or_test: and_test ('or' and_test)*
- @@ -119,21 +119,21 @@
- NAME | NUMBER | STRING+)
- listmaker: test ( list_for | (',' test)* [','] )
- testlist_gexp: test ( gen_for | (',' test)* [','] )
- -lambdef: 'lambda' [varargslist] ':' test
- +lambdef: 'lambda' [varargslist] '{' test '}'
- trailer: '(' [arglist] ')' | '[' subscriptlist ']' | '.' NAME
- subscriptlist: subscript (',' subscript)* [',']
- subscript: '.' '.' '.' | test | [test] ':' [test] [sliceop]
- sliceop: ':' [test]
- exprlist: expr (',' expr)* [',']
- testlist: test (',' test)* [',']
- -dictmaker: test ':' test (',' test ':' test)* [',']
- +dictmaker: test '=>' test (',' test '=>' test)* [',']
- -classdef: 'class' NAME ['(' [testlist] ')'] ':' suite
- +classdef: 'class' NAME ['(' [testlist] ')'] suite 'end'
- arglist: (argument ',')* (argument [',']
- |'*' test (',' argument)* [',' '**' test]
- |'**' test)
- -argument: test [gen_for] | test '=' test # Really [keyword '='] test
- +argument: test [gen_for] | test '=>' test # Really [keyword '='] test
- list_iter: list_for | list_if
- list_for: 'for' exprlist 'in' testlist_safe [list_iter]
- diff -x 'config.status*' -x Makefile.pre -x 'graminit.*' -urN Python-2.6.2/Include/token.h Python-2.6.2.modified/Include/token.h
- --- Python-2.6.2/Include/token.h 2004-08-02 15:10:11.000000000 +0900
- +++ Python-2.6.2.modified/Include/token.h 2009-09-08 01:42:08.775225459 +0900
- @@ -12,8 +12,6 @@
- #define NUMBER 2
- #define STRING 3
- #define NEWLINE 4
- -#define INDENT 5
- -#define DEDENT 6
- #define LPAR 7
- #define RPAR 8
- #define LSQB 9
- @@ -58,10 +56,11 @@
- #define DOUBLESLASH 48
- #define DOUBLESLASHEQUAL 49
- #define AT 50
- +#define RDOUBLEARROW 51
- /* Don't forget to update the table _PyParser_TokenNames in tokenizer.c! */
- -#define OP 51
- -#define ERRORTOKEN 52
- -#define N_TOKENS 53
- +#define OP 52
- +#define ERRORTOKEN 53
- +#define N_TOKENS 54
- /* Special definitions for cooperation with parser */
- diff -x 'config.status*' -x Makefile.pre -x 'graminit.*' -urN Python-2.6.2/Makefile.pre.in Python-2.6.2.modified/Makefile.pre.in
- --- Python-2.6.2/Makefile.pre.in 2009-02-24 20:07:44.000000000 +0900
- +++ Python-2.6.2.modified/Makefile.pre.in 2009-09-08 01:59:59.078226650 +0900
- @@ -392,10 +392,10 @@
- # Build the shared modules
- -sharedmods: $(BUILDPYTHON)
- +sharedmods: $(BUILDPYTHON) convert-to-pb
- @case $$MAKEFLAGS in \
- - *s*) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' ./$(BUILDPYTHON) -E $(srcdir)/setup.py -q build;; \
- - *) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' ./$(BUILDPYTHON) -E $(srcdir)/setup.py build;; \
- + *s*) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' ./$(BUILDPYTHON) -E $(srcdir)/setup.pb -q build;; \
- + *) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' ./$(BUILDPYTHON) -E $(srcdir)/setup.pb build;; \
- esac
- # Build static library
- @@ -675,17 +675,17 @@
- # sample data.
- TESTOPTS= -l $(EXTRATESTOPTS)
- -TESTPROG= $(srcdir)/Lib/test/regrtest.py
- +TESTPROG= $(srcdir)/Lib/test/regrtest.pb
- TESTPYTHON= $(RUNSHARED) ./$(BUILDPYTHON) -E -tt
- test: all platform
- - -find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f
- + -find $(srcdir)/Lib -name '*.pb[co]' -o -iname "*.py[co]" -print | xargs rm -f
- -$(TESTPYTHON) $(TESTPROG) $(TESTOPTS)
- $(TESTPYTHON) $(TESTPROG) $(TESTOPTS)
- testall: all platform
- - -find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f
- - $(TESTPYTHON) $(srcdir)/Lib/compileall.py
- - -find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f
- + -find $(srcdir)/Lib -name '*.pb[co]' -o -iname "*.py[co]" -print | xargs rm -f
- + $(TESTPYTHON) $(srcdir)/Lib/compileall.pb
- + -find $(srcdir)/Lib -name '*.pb[co]' -o -iname "*.py[co]" -print | xargs rm -f
- -$(TESTPYTHON) $(TESTPROG) $(TESTOPTS) -uall
- $(TESTPYTHON) $(TESTPROG) $(TESTOPTS) -uall
- @@ -714,14 +714,14 @@
- test_unicodedata test_re test_sre test_select test_poll \
- test_linuxaudiodev test_struct test_sunaudiodev test_zlib
- quicktest: all platform
- - -find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f
- + -find $(srcdir)/Lib -name '*.pb[co]' -o -iname "*.py[co]" -print | xargs rm -f
- -$(TESTPYTHON) $(TESTPROG) $(QUICKTESTOPTS)
- $(TESTPYTHON) $(TESTPROG) $(QUICKTESTOPTS)
- MEMTESTOPTS= $(QUICKTESTOPTS) -x test_dl test___all__ test_fork1 \
- test_longexp
- memtest: all platform
- - -rm -f $(srcdir)/Lib/test/*.py[co]
- + -rm -f $(srcdir)/Lib/test/*.pb[co] $(srcdir)/Lib/test/*.py[co]
- -$(TESTPYTHON) $(TESTPROG) $(MEMTESTOPTS)
- $(TESTPYTHON) $(TESTPROG) $(MEMTESTOPTS)
- @@ -850,7 +850,7 @@
- else true; \
- fi; \
- done
- - @for i in $(srcdir)/Lib/*.py $(srcdir)/Lib/*.doc $(srcdir)/Lib/*.egg-info ; \
- + @for i in $(srcdir)/Lib/*.pb $(srcdir)/Lib/*.py $(srcdir)/Lib/*.doc $(srcdir)/Lib/*.egg-info ; \
- do \
- if test -x $$i; then \
- $(INSTALL_SCRIPT) $$i $(DESTDIR)$(LIBDEST); \
- @@ -871,6 +871,7 @@
- case $$i in \
- *CVS) ;; \
- *.py[co]) ;; \
- + *.pb[co]) ;; \
- *.orig) ;; \
- *~) ;; \
- *) \
- @@ -887,19 +888,19 @@
- done
- $(INSTALL_DATA) $(srcdir)/LICENSE $(DESTDIR)$(LIBDEST)/LICENSE.txt
- PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
- - ./$(BUILDPYTHON) -Wi -tt $(DESTDIR)$(LIBDEST)/compileall.py \
- + ./$(BUILDPYTHON) -Wi -tt $(DESTDIR)$(LIBDEST)/compileall.pb \
- -d $(LIBDEST) -f \
- -x 'bad_coding|badsyntax|site-packages' $(DESTDIR)$(LIBDEST)
- PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
- - ./$(BUILDPYTHON) -Wi -tt -O $(DESTDIR)$(LIBDEST)/compileall.py \
- + ./$(BUILDPYTHON) -Wi -tt -O $(DESTDIR)$(LIBDEST)/compileall.pb \
- -d $(LIBDEST) -f \
- -x 'bad_coding|badsyntax|site-packages' $(DESTDIR)$(LIBDEST)
- -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
- - ./$(BUILDPYTHON) -Wi -t $(DESTDIR)$(LIBDEST)/compileall.py \
- + ./$(BUILDPYTHON) -Wi -t $(DESTDIR)$(LIBDEST)/compileall.pb \
- -d $(LIBDEST)/site-packages -f \
- -x badsyntax $(DESTDIR)$(LIBDEST)/site-packages
- -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
- - ./$(BUILDPYTHON) -Wi -t -O $(DESTDIR)$(LIBDEST)/compileall.py \
- + ./$(BUILDPYTHON) -Wi -t -O $(DESTDIR)$(LIBDEST)/compileall.pb \
- -d $(LIBDEST)/site-packages -f \
- -x badsyntax $(DESTDIR)$(LIBDEST)/site-packages
- -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
- @@ -1001,7 +1002,7 @@
- # Install the dynamically loadable modules
- # This goes into $(exec_prefix)
- sharedinstall:
- - $(RUNSHARED) ./$(BUILDPYTHON) -E $(srcdir)/setup.py install \
- + $(RUNSHARED) ./$(BUILDPYTHON) -E $(srcdir)/setup.pb install \
- --prefix=$(prefix) \
- --install-scripts=$(BINDIR) \
- --install-platlib=$(DESTSHARED) \
- @@ -1081,7 +1082,7 @@
- # This installs a few of the useful scripts in Tools/scripts
- scriptsinstall:
- SRCDIR=$(srcdir) $(RUNSHARED) \
- - ./$(BUILDPYTHON) $(srcdir)/Tools/scripts/setup.py install \
- + ./$(BUILDPYTHON) $(srcdir)/Tools/scripts/setup.pb install \
- --prefix=$(prefix) \
- --install-scripts=$(BINDIR) \
- --root=/$(DESTDIR)
- @@ -1133,13 +1134,13 @@
- # Sanitation targets -- clean leaves libraries, executables and tags
- # files, which clobber removes those as well
- pycremoval:
- - find $(srcdir) -name '*.py[co]' -exec rm -f {} ';'
- + find $(srcdir) -name '*.pb[co]' -o -iname "*.py[co]" -exec rm -f {} ';'
- clean: pycremoval
- find . -name '*.o' -exec rm -f {} ';'
- find . -name '*.s[ol]' -exec rm -f {} ';'
- find $(srcdir)/build -name 'fficonfig.h' -exec rm -f {} ';' || true
- - find $(srcdir)/build -name 'fficonfig.py' -exec rm -f {} ';' || true
- + find $(srcdir)/build -name 'fficonfig.p?' -exec rm -f {} ';' || true
- profile-removal:
- find . -name '*.gc??' -exec rm -f {} ';'
- @@ -1172,6 +1173,7 @@
- funny:
- find $(DISTDIRS) -type d \
- -o -name '*.[chs]' \
- + -o -name '*.pb' \
- -o -name '*.py' \
- -o -name '*.doc' \
- -o -name '*.sty' \
- @@ -1199,12 +1201,27 @@
- # Perform some verification checks on any modified files.
- patchcheck:
- - $(RUNSHARED) ./$(BUILDPYTHON) $(srcdir)/Tools/scripts/patchcheck.py
- + $(RUNSHARED) ./$(BUILDPYTHON) $(srcdir)/Tools/scripts/patchcheck.pb
- # Dependencies
- Python/thread.o: @THREADHEADERS@
- +convert-to-pb: convert-to-pb-do
- + -patch -p0 -f -s < ./retouch.patch
- +
- +convert-to-pb-do: $(BUILDPYTHON)
- + find . -iname "*.py" -print | while read file; do \
- + dest=`echo $$file | sed -e 's/py$$/pb/g'`; \
- + if test ! -e $$dest -o $$file -nt $$dest; then \
- + if ./pbtrans.py < $$file > $$dest; then \
- + echo "successfully converted $$file"; \
- + else \
- + echo "failed to convert $$file"; \
- + fi; \
- + fi; \
- + done
- +
- # Declare targets that aren't real files
- .PHONY: all build_all sharedmods oldsharedmods test quicktest memtest
- .PHONY: install altinstall oldsharedinstall bininstall altbininstall
- @@ -1213,5 +1230,6 @@
- .PHONY: frameworkinstallmaclib frameworkinstallapps frameworkinstallunixtools
- .PHONY: frameworkaltinstallunixtools recheck autoconf clean clobber distclean
- .PHONY: smelly funny patchcheck
- +.PHONY: convert-to-pb converted-to-pb-do
- # IF YOU PUT ANYTHING HERE IT WILL GO AWAY
- diff -x 'config.status*' -x Makefile.pre -x 'graminit.*' -urN Python-2.6.2/Modules/_bsddb.c Python-2.6.2.modified/Modules/_bsddb.c
- --- Python-2.6.2/Modules/_bsddb.c 2008-09-24 03:54:08.000000000 +0900
- +++ Python-2.6.2.modified/Modules/_bsddb.c 2009-09-08 01:42:08.791229814 +0900
- @@ -7470,8 +7470,8 @@
- * from both DBError and KeyError, since the API only supports
- * using one base class. */
- PyDict_SetItemString(d, "KeyError", PyExc_KeyError);
- - PyRun_String("class DBNotFoundError(DBError, KeyError): pass\n"
- - "class DBKeyEmptyError(DBError, KeyError): pass",
- + PyRun_String("class DBNotFoundError(DBError, KeyError); end\n"
- + "class DBKeyEmptyError(DBError, KeyError); end",
- Py_file_input, d, d);
- DBNotFoundError = PyDict_GetItemString(d, "DBNotFoundError");
- DBKeyEmptyError = PyDict_GetItemString(d, "DBKeyEmptyError");
- diff -x 'config.status*' -x Makefile.pre -x 'graminit.*' -urN Python-2.6.2/Modules/cPickle.c Python-2.6.2.modified/Modules/cPickle.c
- --- Python-2.6.2/Modules/cPickle.c 2009-01-25 06:30:14.000000000 +0900
- +++ Python-2.6.2.modified/Modules/cPickle.c 2009-09-08 01:42:08.795225613 +0900
- @@ -5772,8 +5772,9 @@
- if (!( t=PyDict_New())) return -1;
- if (!( r=PyRun_String(
- - "def __str__(self):\n"
- - " return self.args and ('%s' % self.args[0]) or '(what)'\n",
- + "def __str__(self)\n"
- + " return self.args and ('%s' % self.args[0]) or '(what)'\n"
- + "end\n",
- Py_file_input,
- module_dict, t) )) return -1;
- Py_DECREF(r);
- @@ -5791,10 +5792,11 @@
- if (!( t=PyDict_New())) return -1;
- if (!( r=PyRun_String(
- - "def __str__(self):\n"
- + "def __str__(self)\n"
- " a=self.args\n"
- " a=a and type(a[0]) or '(what)'\n"
- " return 'Cannot pickle %s objects' % a\n"
- + "end\n"
- , Py_file_input,
- module_dict, t) )) return -1;
- Py_DECREF(r);
- diff -x 'config.status*' -x Makefile.pre -x 'graminit.*' -urN Python-2.6.2/Modules/_elementtree.c Python-2.6.2.modified/Modules/_elementtree.c
- --- Python-2.6.2/Modules/_elementtree.c 2008-06-09 13:58:54.000000000 +0900
- +++ Python-2.6.2.modified/Modules/_elementtree.c 2009-09-08 01:42:08.799229531 +0900
- @@ -1810,7 +1810,7 @@
- static PyMethodDef treebuilder_methods[] = {
- {"data", (PyCFunction) treebuilder_data, METH_VARARGS},
- {"start", (PyCFunction) treebuilder_start, METH_VARARGS},
- - {"end", (PyCFunction) treebuilder_end, METH_VARARGS},
- + {"end_", (PyCFunction) treebuilder_end, METH_VARARGS},
- {"xml", (PyCFunction) treebuilder_xml, METH_VARARGS},
- {"close", (PyCFunction) treebuilder_close, METH_VARARGS},
- {NULL, NULL}
- @@ -2285,7 +2285,7 @@
- self->handle_xml = PyObject_GetAttrString(target, "xml");
- self->handle_start = PyObject_GetAttrString(target, "start");
- self->handle_data = PyObject_GetAttrString(target, "data");
- - self->handle_end = PyObject_GetAttrString(target, "end");
- + self->handle_end = PyObject_GetAttrString(target, "end_");
- self->handle_comment = PyObject_GetAttrString(target, "comment");
- self->handle_pi = PyObject_GetAttrString(target, "pi");
- @@ -2502,8 +2502,8 @@
- Py_XDECREF(target->end_ns_event_obj); target->end_ns_event_obj = NULL;
- if (event_set == Py_None) {
- - /* default is "end" only */
- - target->end_event_obj = PyString_FromString("end");
- + /* default is "end_" only */
- + target->end_event_obj = PyString_FromString("end_");
- Py_RETURN_NONE;
- }
- @@ -2519,7 +2519,7 @@
- if (strcmp(event, "start") == 0) {
- Py_INCREF(item);
- target->start_event_obj = item;
- - } else if (strcmp(event, "end") == 0) {
- + } else if (strcmp(event, "end_") == 0) {
- Py_INCREF(item);
- Py_XDECREF(target->end_event_obj);
- target->end_event_obj = item;
- diff -x 'config.status*' -x Makefile.pre -x 'graminit.*' -urN Python-2.6.2/Modules/main.c Python-2.6.2.modified/Modules/main.c
- --- Python-2.6.2/Modules/main.c 2009-02-19 08:12:48.000000000 +0900
- +++ Python-2.6.2.modified/Modules/main.c 2009-09-08 01:42:08.803225531 +0900
- @@ -375,10 +375,6 @@
- Py_IgnoreEnvironmentFlag++;
- break;
- - case 't':
- - Py_TabcheckFlag++;
- - break;
- -
- case 'u':
- unbuffered++;
- saw_unbuffered_flag = 1;
- diff -x 'config.status*' -x Makefile.pre -x 'graminit.*' -urN Python-2.6.2/Modules/_sre.c Python-2.6.2.modified/Modules/_sre.c
- --- Python-2.6.2/Modules/_sre.c 2008-09-10 23:27:00.000000000 +0900
- +++ Python-2.6.2.modified/Modules/_sre.c 2009-09-08 01:42:08.807231689 +0900
- @@ -3411,7 +3411,7 @@
- Py_ssize_t index;
- PyObject* index_ = Py_False; /* zero */
- - if (!PyArg_UnpackTuple(args, "end", 0, 1, &index_))
- + if (!PyArg_UnpackTuple(args, "end_", 0, 1, &index_))
- return NULL;
- index = match_getindex(self, index_);
- @@ -3561,7 +3561,7 @@
- static PyMethodDef match_methods[] = {
- {"group", (PyCFunction) match_group, METH_VARARGS},
- {"start", (PyCFunction) match_start, METH_VARARGS},
- - {"end", (PyCFunction) match_end, METH_VARARGS},
- + {"end_", (PyCFunction) match_end, METH_VARARGS},
- {"span", (PyCFunction) match_span, METH_VARARGS},
- {"groups", (PyCFunction) match_groups, METH_VARARGS|METH_KEYWORDS},
- {"groupdict", (PyCFunction) match_groupdict, METH_VARARGS|METH_KEYWORDS},
- diff -x 'config.status*' -x Makefile.pre -x 'graminit.*' -urN Python-2.6.2/Modules/zipimport.c Python-2.6.2.modified/Modules/zipimport.c
- --- Python-2.6.2/Modules/zipimport.c 2008-12-14 20:30:16.000000000 +0900
- +++ Python-2.6.2.modified/Modules/zipimport.c 2009-09-08 01:42:08.811236006 +0900
- @@ -20,12 +20,12 @@
- are swapped by initzipimport() if we run in optimized mode. Also,
- '/' is replaced by SEP there. */
- static struct st_zip_searchorder zip_searchorder[] = {
- - {"/__init__.pyc", IS_PACKAGE | IS_BYTECODE},
- - {"/__init__.pyo", IS_PACKAGE | IS_BYTECODE},
- - {"/__init__.py", IS_PACKAGE | IS_SOURCE},
- - {".pyc", IS_BYTECODE},
- - {".pyo", IS_BYTECODE},
- - {".py", IS_SOURCE},
- + {"/__init__.pbc", IS_PACKAGE | IS_BYTECODE},
- + {"/__init__.pbo", IS_PACKAGE | IS_BYTECODE},
- + {"/__init__.pb", IS_PACKAGE | IS_SOURCE},
- + {".pbc", IS_BYTECODE},
- + {".pbo", IS_BYTECODE},
- + {".pb", IS_SOURCE},
- {"", 0}
- };
- @@ -496,10 +496,10 @@
- if (mi == MI_PACKAGE) {
- path[len] = SEP;
- - strcpy(path + len + 1, "__init__.py");
- + strcpy(path + len + 1, "__init__.pb");
- }
- else
- - strcpy(path + len, ".py");
- + strcpy(path + len, ".pb");
- toc_entry = PyDict_GetItemString(self->files, path);
- if (toc_entry != NULL)
- diff -x 'config.status*' -x Makefile.pre -x 'graminit.*' -urN Python-2.6.2/Objects/exceptions.c Python-2.6.2.modified/Objects/exceptions.c
- --- Python-2.6.2/Objects/exceptions.c 2008-07-31 02:45:10.000000000 +0900
- +++ Python-2.6.2.modified/Objects/exceptions.c 2009-09-08 01:42:08.815223367 +0900
- @@ -1580,7 +1580,7 @@
- PyDoc_STR("exception object")},
- {"start", T_PYSSIZET, offsetof(PyUnicodeErrorObject, start), 0,
- PyDoc_STR("exception start")},
- - {"end", T_PYSSIZET, offsetof(PyUnicodeErrorObject, end), 0,
- + {"end_", T_PYSSIZET, offsetof(PyUnicodeErrorObject, end), 0,
- PyDoc_STR("exception end")},
- {"reason", T_OBJECT, offsetof(PyUnicodeErrorObject, reason), 0,
- PyDoc_STR("exception reason")},
- diff -x 'config.status*' -x Makefile.pre -x 'graminit.*' -urN Python-2.6.2/Parser/listnode.c Python-2.6.2.modified/Parser/listnode.c
- --- Python-2.6.2/Parser/listnode.c 2000-09-02 08:29:29.000000000 +0900
- +++ Python-2.6.2.modified/Parser/listnode.c 2009-09-08 01:42:08.815223367 +0900
- @@ -37,12 +37,6 @@
- }
- else if (ISTERMINAL(TYPE(n))) {
- switch (TYPE(n)) {
- - case INDENT:
- - ++level;
- - break;
- - case DEDENT:
- - --level;
- - break;
- default:
- if (atbol) {
- int i;
- diff -x 'config.status*' -x Makefile.pre -x 'graminit.*' -urN Python-2.6.2/Parser/parsetok.c Python-2.6.2.modified/Parser/parsetok.c
- --- Python-2.6.2/Parser/parsetok.c 2008-03-27 07:20:26.000000000 +0900
- +++ Python-2.6.2.modified/Parser/parsetok.c 2009-09-08 01:42:08.815223367 +0900
- @@ -10,9 +10,6 @@
- #include "errcode.h"
- #include "graminit.h"
- -int Py_TabcheckFlag;
- -
- -
- /* Forward */
- static node *parsetok(struct tok_state *, grammar *, int, perrdetail *, int *);
- static void initerr(perrdetail *err_ret, const char* filename);
- @@ -56,12 +53,7 @@
- return NULL;
- }
- - tok->filename = filename ? filename : "<string>";
- - if (Py_TabcheckFlag || Py_VerboseFlag) {
- - tok->altwarning = (tok->filename != NULL);
- - if (Py_TabcheckFlag >= 2)
- - tok->alterror++;
- - }
- + tok->filename = filename ? filename : "<string>";
- return parsetok(tok, g, start, err_ret, flags);
- }
- @@ -97,11 +89,6 @@
- return NULL;
- }
- tok->filename = filename;
- - if (Py_TabcheckFlag || Py_VerboseFlag) {
- - tok->altwarning = (filename != NULL);
- - if (Py_TabcheckFlag >= 2)
- - tok->alterror++;
- - }
- return parsetok(tok, g, start, err_ret, flags);
- }
- @@ -168,12 +155,6 @@
- /* Add the right number of dedent tokens,
- except if a certain flag is given --
- codeop.py uses this. */
- - if (tok->indent &&
- - !(*flags & PyPARSE_DONT_IMPLY_DEDENT))
- - {
- - tok->pendin = -tok->indent;
- - tok->indent = 0;
- - }
- }
- else
- started = 1;
- diff -x 'config.status*' -x Makefile.pre -x 'graminit.*' -urN Python-2.6.2/Parser/tokenizer.c Python-2.6.2.modified/Parser/tokenizer.c
- --- Python-2.6.2/Parser/tokenizer.c 2008-08-05 11:05:23.000000000 +0900
- +++ Python-2.6.2.modified/Parser/tokenizer.c 2009-09-08 01:42:08.819228125 +0900
- @@ -40,8 +40,8 @@
- "NUMBER",
- "STRING",
- "NEWLINE",
- - "INDENT",
- - "DEDENT",
- + NULL,
- + NULL,
- "LPAR",
- "RPAR",
- "LSQB",
- @@ -86,6 +86,7 @@
- "DOUBLESLASH",
- "DOUBLESLASHEQUAL",
- "AT",
- + "RDOUBLEARROW",
- /* This table must match the #defines in token.h! */
- "OP",
- "<ERRORTOKEN>",
- @@ -105,24 +106,16 @@
- tok->buf = tok->cur = tok->end = tok->inp = tok->start = NULL;
- tok->done = E_OK;
- tok->fp = NULL;
- - tok->tabsize = TABSIZE;
- - tok->indent = 0;
- - tok->indstack[0] = 0;
- tok->atbol = 1;
- - tok->pendin = 0;
- tok->prompt = tok->nextprompt = NULL;
- tok->lineno = 0;
- tok->level = 0;
- tok->filename = NULL;
- - tok->altwarning = 0;
- - tok->alterror = 0;
- - tok->alttabsize = 1;
- - tok->altindstack[0] = 0;
- tok->decoding_state = 0;
- tok->decoding_erred = 0;
- tok->read_coding_spec = 0;
- tok->encoding = NULL;
- - tok->cont_line = 0;
- + tok->cont_line = 0;
- #ifndef PGEN
- tok->decoding_readline = NULL;
- tok->decoding_buffer = NULL;
- @@ -978,6 +971,7 @@
- case '=':
- switch (c2) {
- case '=': return EQEQUAL;
- + case '>': return RDOUBLEARROW;
- }
- break;
- case '!':
- @@ -1092,22 +1086,6 @@
- return OP;
- }
- -static int
- -indenterror(struct tok_state *tok)
- -{
- - if (tok->alterror) {
- - tok->done = E_TABSPACE;
- - tok->cur = tok->inp;
- - return 1;
- - }
- - if (tok->altwarning) {
- - PySys_WriteStderr("%s: inconsistent use of tabs and spaces "
- - "in indentation\n", tok->filename);
- - tok->altwarning = 0;
- - }
- - return 0;
- -}
- -
- /* Get next token, after space stripping etc. */
- @@ -1122,96 +1100,8 @@
- tok->start = NULL;
- blankline = 0;
- - /* Get indentation level */
- - if (tok->atbol) {
- - register int col = 0;
- - register int altcol = 0;
- - tok->atbol = 0;
- - for (;;) {
- - c = tok_nextc(tok);
- - if (c == ' ')
- - col++, altcol++;
- - else if (c == '\t') {
- - col = (col/tok->tabsize + 1) * tok->tabsize;
- - altcol = (altcol/tok->alttabsize + 1)
- - * tok->alttabsize;
- - }
- - else if (c == '\014') /* Control-L (formfeed) */
- - col = altcol = 0; /* For Emacs users */
- - else
- - break;
- - }
- - tok_backup(tok, c);
- - if (c == '#' || c == '\n') {
- - /* Lines with only whitespace and/or comments
- - shouldn't affect the indentation and are
- - not passed to the parser as NEWLINE tokens,
- - except *totally* empty lines in interactive
- - mode, which signal the end of a command group. */
- - if (col == 0 && c == '\n' && tok->prompt != NULL)
- - blankline = 0; /* Let it through */
- - else
- - blankline = 1; /* Ignore completely */
- - /* We can't jump back right here since we still
- - may need to skip to the end of a comment */
- - }
- - if (!blankline && tok->level == 0) {
- - if (col == tok->indstack[tok->indent]) {
- - /* No change */
- - if (altcol != tok->altindstack[tok->indent]) {
- - if (indenterror(tok))
- - return ERRORTOKEN;
- - }
- - }
- - else if (col > tok->indstack[tok->indent]) {
- - /* Indent -- always one */
- - if (tok->indent+1 >= MAXINDENT) {
- - tok->done = E_TOODEEP;
- - tok->cur = tok->inp;
- - return ERRORTOKEN;
- - }
- - if (altcol <= tok->altindstack[tok->indent]) {
- - if (indenterror(tok))
- - return ERRORTOKEN;
- - }
- - tok->pendin++;
- - tok->indstack[++tok->indent] = col;
- - tok->altindstack[tok->indent] = altcol;
- - }
- - else /* col < tok->indstack[tok->indent] */ {
- - /* Dedent -- any number, must be consistent */
- - while (tok->indent > 0 &&
- - col < tok->indstack[tok->indent]) {
- - tok->pendin--;
- - tok->indent--;
- - }
- - if (col != tok->indstack[tok->indent]) {
- - tok->done = E_DEDENT;
- - tok->cur = tok->inp;
- - return ERRORTOKEN;
- - }
- - if (altcol != tok->altindstack[tok->indent]) {
- - if (indenterror(tok))
- - return ERRORTOKEN;
- - }
- - }
- - }
- - }
- -
- tok->start = tok->cur;
- - /* Return pending indents/dedents */
- - if (tok->pendin != 0) {
- - if (tok->pendin < 0) {
- - tok->pendin++;
- - return DEDENT;
- - }
- - else {
- - tok->pendin--;
- - return INDENT;
- - }
- - }
- -
- again:
- tok->start = NULL;
- /* Skip spaces */
- @@ -1224,36 +1114,6 @@
- /* Skip comment, while looking for tab-setting magic */
- if (c == '#') {
- - static char *tabforms[] = {
- - "tab-width:", /* Emacs */
- - ":tabstop=", /* vim, full form */
- - ":ts=", /* vim, abbreviated form */
- - "set tabsize=", /* will vi never die? */
- - /* more templates can be added here to support other editors */
- - };
- - char cbuf[80];
- - char *tp, **cp;
- - tp = cbuf;
- - do {
- - *tp++ = c = tok_nextc(tok);
- - } while (c != EOF && c != '\n' &&
- - (size_t)(tp - cbuf + 1) < sizeof(cbuf));
- - *tp = '\0';
- - for (cp = tabforms;
- - cp < tabforms + sizeof(tabforms)/sizeof(tabforms[0]);
- - cp++) {
- - if ((tp = strstr(cbuf, *cp))) {
- - int newsize = atoi(tp + strlen(*cp));
- -
- - if (newsize >= 1 && newsize <= 40) {
- - tok->tabsize = newsize;
- - if (Py_VerboseFlag)
- - PySys_WriteStderr(
- - "Tab size set to %d\n",
- - newsize);
- - }
- - }
- - }
- while (c != EOF && c != '\n')
- c = tok_nextc(tok);
- }
- diff -x 'config.status*' -x Makefile.pre -x 'graminit.*' -urN Python-2.6.2/Parser/tokenizer.h Python-2.6.2.modified/Parser/tokenizer.h
- --- Python-2.6.2/Parser/tokenizer.h 2008-01-08 03:41:34.000000000 +0900
- +++ Python-2.6.2.modified/Parser/tokenizer.h 2009-09-08 01:42:08.819228125 +0900
- @@ -24,21 +24,13 @@
- int done; /* E_OK normally, E_EOF at EOF, otherwise error code */
- /* NB If done != E_OK, cur must be == inp!!! */
- FILE *fp; /* Rest of input; NULL if tokenizing a string */
- - int tabsize; /* Tab spacing */
- - int indent; /* Current indentation index */
- - int indstack[MAXINDENT]; /* Stack of indents */
- int atbol; /* Nonzero if at begin of new line */
- - int pendin; /* Pending indents (if > 0) or dedents (if < 0) */
- char *prompt, *nextprompt; /* For interactive prompting */
- int lineno; /* Current line number */
- int level; /* () [] {} Parentheses nesting level */
- /* Used to allow free continuations inside them */
- /* Stuff for checking on different tab sizes */
- const char *filename; /* For error messages */
- - int altwarning; /* Issue warning if alternate tabs don't match */
- - int alterror; /* Issue error if alternate tabs don't match */
- - int alttabsize; /* Alternate tab spacing */
- - int altindstack[MAXINDENT]; /* Stack of alternate indents */
- /* Stuff for PEP 0263 */
- int decoding_state; /* -1:decoding, 0:init, 1:raw */
- int decoding_erred; /* whether erred in decoding */
- diff -x 'config.status*' -x Makefile.pre -x 'graminit.*' -urN Python-2.6.2/pbtrans.py Python-2.6.2.modified/pbtrans.py
- --- Python-2.6.2/pbtrans.py 1970-01-01 09:00:00.000000000 +0900
- +++ Python-2.6.2.modified/pbtrans.py 2009-09-08 00:52:17.000000000 +0900
- @@ -0,0 +1,194 @@
- +#!/usr/bin/env python
- +import sys
- +from token import *
- +from tokenize import generate_tokens, COMMENT, NL
- +
- +def untokenize(tokens):
- + retval = ''
- + state = 1
- + for _ in tokens:
- + token = _[0]
- + image = _[1]
- + if token == OP:
- + if image == '[':
- + token = LSQB
- + elif image == ']':
- + token = RSQB
- + elif image == '(':
- + token = LPAR
- + elif image == ')':
- + token = RPAR
- + elif image == '{':
- + token = LBRACE
- + elif image == '}':
- + token = RBRACE
- + elif image == '.':
- + token = DOT
- + elif image == ',':
- + token = COMMA
- + if token in (LSQB, LPAR, DOT):
- + if state == 2:
- + retval += ' '
- + retval += image
- + state = 1
- + elif token in (RPAR, RSQB, COMMA):
- + retval += image
- + elif token == OP or token == NAME and image in ('in', 'not', 'and', 'or'):
- + retval += ' '
- + retval += image
- + state = 2
- + else:
- + if image == 'elif':
- + image = 'elsif'
- + elif image == 'end':
- + image = 'end_'
- + if state != 1 and (state != 3 or token != STRING):
- + retval += ' '
- + retval += image
- + if image == 'b' or image == 'u':
- + state = 3
- + else:
- + state = 0
- + return retval
- +
- +partypes = { ')': '(', ']': '[', '}': '{' }
- +
- +state = 0
- +prev_t = None
- +atbol = True
- +indstack = ['']
- +stmtstack = []
- +parstatestack = []
- +build_line = []
- +skip = False
- +t_is_newline = False
- +lambdastack = []
- +skipped_newlines = 0
- +prev_t_is_newline = False
- +partype = ''
- +singlelined = False
- +lambdastate = 0
- +
- +for t in generate_tokens(sys.stdin.readline):
- + t_is_newline = t[0] in (NEWLINE, NL)
- +
- + if t[0] == NAME and t[1] == 'lambda':
- + assert lambdastate != 1
- + lambdastate = 1
- + lambdastack.append(len(parstatestack))
- +
- + if lambdastate == 1:
- + if t[1] == ':':
- + skip = True
- + build_line.append((OP, '{'))
- + lambdastate = 2
- + elif lambdastate == 2:
- + if lambdastack[-1] == len(parstatestack) and \
- + (t[0] == NEWLINE or t[1] == ';' or t[1] == ',' or partypes.get(t[1], None) == partype):
- + build_line.append((OP, '}'))
- + lambdastack.pop()
- + if not lambdastack:
- + lambdastate = 0
- +
- + if state == 0:
- + if t_is_newline and not parstatestack:
- + print indstack[-1] + untokenize(build_line)
- + if atbol:
- + if t[0] == NAME and not parstatestack:
- + if t[1] in ('if', 'while', 'for', 'try', 'with', 'def', 'class'):
- + if (singlelined or (prev_t is not None and prev_t[0] == DEDENT)):
- + stmtstack.pop()
- + print indstack[-1] + 'end'
- + if not singlelined:
- + for i in range(skipped_newlines):
- + print
- + skipped_newlines = 0
- + state = 1
- + stmtstack.append((len(indstack), t[1]))
- + elif stmtstack:
- + if stmtstack[-1][1] == 'if':
- + if t[1] in ('else', 'elif'):
- + state = 1
- + elif stmtstack[-1][1] in ('while', 'for'):
- + if t[1] in ('else', ):
- + state = 1
- + elif stmtstack[-1][1] == 'try':
- + if t[1] in ('except', 'else', 'finally'):
- + state = 1
- + if state != 1 and (singlelined or (prev_t is not None and prev_t[0] == DEDENT)):
- + stmtstack.pop()
- + print indstack[-1] + 'end'
- + if not singlelined and t[0] != DEDENT:
- + for i in range(skipped_newlines):
- + print
- + skipped_newlines = 0
- + singlelined = False
- + else:
- + if partype == '(' and t[0] == OP and t[1] == '=':
- + t = (t[0], '=>')
- + elif state == 1:
- + if t[1] == ':' and not parstatestack:
- + state = 2
- + skip = True
- + elif state == 2:
- + if t[0] == NEWLINE:
- + print indstack[-1] + untokenize(build_line)
- + state = 0
- + elif t[0] != COMMENT:
- + build_line.append((SEMI, ';'))
- + state = 3
- + if t[0] == NAME and t[1] == 'pass':
- + skip = True
- + elif state == 3:
- + assert t[0] != INDENT
- + if t[0] == NEWLINE:
- + print indstack[-1] + untokenize(build_line)
- + singlelined = True
- + state = 0
- + elif t[0] == NAME and t[1] == 'pass':
- + skip = True
- +
- + if t[0] == OP:
- + if t[1] == '{' or t[1] == '(' or t[1] == '[':
- + parstatestack.append(partype)
- + partype = t[1]
- + elif t[1] == '}':
- + assert partype == '{'
- + partype = parstatestack.pop()
- + elif t[1] == ')':
- + assert partype == '('
- + partype = parstatestack.pop()
- + elif t[1] == ']':
- + assert partype == '['
- + partype = parstatestack.pop()
- + elif t[1] == ':':
- + if not parstatestack:
- + skip = True
- + elif partype == '{':
- + t = (t[0], '=>')
- +
- + if t[0] == DEDENT:
- + indstack.pop()
- + elif t[0] == INDENT:
- + indstack.append(t[1])
- + atbol = t_is_newline or t[0] in (COMMENT, INDENT, DEDENT)
- + skip = atbol or skip
- +
- + if t_is_newline:
- + if prev_t_is_newline:
- + skipped_newlines += 1
- + else:
- + skipped_newlines = 0
- + if not parstatestack:
- + build_line = []
- + else:
- + if not skip:
- + build_line.append(t)
- +
- + prev_t = t
- + prev_t_is_newline = t_is_newline
- + skip = False
- +
- +assert len(stmtstack) == 0
- +#if build_line:
- +# print indstack[-1] + untokenize(build_line)
- diff -x 'config.status*' -x Makefile.pre -x 'graminit.*' -urN Python-2.6.2/Python/ast.c Python-2.6.2.modified/Python/ast.c
- --- Python-2.6.2/Python/ast.c 2008-12-06 03:01:46.000000000 +0900
- +++ Python-2.6.2.modified/Python/ast.c 2009-09-08 01:42:08.823226644 +0900
- @@ -160,11 +160,9 @@
- switch (TYPE(n)) {
- case single_input:
- - if (TYPE(CHILD(n, 0)) == NEWLINE)
- - return 0;
- - else
- - return num_stmts(CHILD(n, 0));
- case file_input:
- + case block:
- + case suite:
- l = 0;
- for (i = 0; i < NCH(n); i++) {
- ch = CHILD(n, i);
- @@ -174,19 +172,9 @@
- return l;
- case stmt:
- return num_stmts(CHILD(n, 0));
- + case small_stmt:
- case compound_stmt:
- return 1;
- - case simple_stmt:
- - return NCH(n) / 2; /* Divide by 2 to remove count of semi-colons */
- - case suite:
- - if (NCH(n) == 1)
- - return num_stmts(CHILD(n, 0));
- - else {
- - l = 0;
- - for (i = 2; i < (NCH(n) - 1); i++)
- - l += num_stmts(CHILD(n, i));
- - return l;
- - }
- default: {
- char buf[128];
- @@ -206,7 +194,7 @@
- PyAST_FromNode(const node *n, PyCompilerFlags *flags, const char *filename,
- PyArena *arena)
- {
- - int i, j, k, num;
- + int i, k;
- asdl_seq *stmts = NULL;
- stmt_ty s;
- node *ch;
- @@ -236,26 +224,12 @@
- return NULL;
- for (i = 0; i < NCH(n) - 1; i++) {
- ch = CHILD(n, i);
- - if (TYPE(ch) == NEWLINE)
- + if (TYPE(ch) != stmt)
- continue;
- - REQ(ch, stmt);
- - num = num_stmts(ch);
- - if (num == 1) {
- - s = ast_for_stmt(&c, ch);
- - if (!s)
- - goto error;
- - asdl_seq_SET(stmts, k++, s);
- - }
- - else {
- - ch = CHILD(ch, 0);
- - REQ(ch, simple_stmt);
- - for (j = 0; j < num; j++) {
- - s = ast_for_stmt(&c, CHILD(ch, j * 2));
- - if (!s)
- - goto error;
- - asdl_seq_SET(stmts, k++, s);
- - }
- - }
- + s = ast_for_stmt(&c, ch);
- + if (!s)
- + goto error;
- + asdl_seq_SET(stmts, k++, s);
- }
- return Module(stmts, arena);
- case eval_input: {
- @@ -268,43 +242,19 @@
- return Expression(testlist_ast, arena);
- }
- case single_input:
- - if (TYPE(CHILD(n, 0)) == NEWLINE) {
- - stmts = asdl_seq_new(1, arena);
- - if (!stmts)
- - goto error;
- - asdl_seq_SET(stmts, 0, Pass(n->n_lineno, n->n_col_offset,
- - arena));
- - if (!asdl_seq_GET(stmts, 0))
- - goto error;
- - return Interactive(stmts, arena);
- - }
- - else {
- - n = CHILD(n, 0);
- - num = num_stmts(n);
- - stmts = asdl_seq_new(num, arena);
- - if (!stmts)
- + stmts = asdl_seq_new(num_stmts(n), arena);
- + if (!stmts)
- + goto error;
- + for (i = 0; i < NCH(n) - 1; i++) {
- + ch = CHILD(n, i);
- + if (TYPE(ch) != stmt)
- + continue;
- + s = ast_for_stmt(&c, ch);
- + if (!s)
- goto error;
- - if (num == 1) {
- - s = ast_for_stmt(&c, n);
- - if (!s)
- - goto error;
- - asdl_seq_SET(stmts, 0, s);
- - }
- - else {
- - /* Only a simple_stmt can contain multiple statements. */
- - REQ(n, simple_stmt);
- - for (i = 0; i < NCH(n); i += 2) {
- - if (TYPE(CHILD(n, i)) == NEWLINE)
- - break;
- - s = ast_for_stmt(&c, CHILD(n, i));
- - if (!s)
- - goto error;
- - asdl_seq_SET(stmts, i / 2, s);
- - }
- - }
- -
- - return Interactive(stmts, arena);
- + asdl_seq_SET(stmts, k++, s);
- }
- + return Interactive(stmts, arena);
- default:
- PyErr_Format(PyExc_SystemError,
- "invalid node %d for PyAST_FromNode", TYPE(n));
- @@ -862,7 +812,7 @@
- static stmt_ty
- ast_for_funcdef(struct compiling *c, const node *n, asdl_seq *decorator_seq)
- {
- - /* funcdef: 'def' NAME parameters ':' suite */
- + /* funcdef: 'def' NAME parameters suite 'end' */
- identifier name;
- arguments_ty args;
- asdl_seq *body;
- @@ -878,7 +828,7 @@
- args = ast_for_arguments(c, CHILD(n, name_i + 1));
- if (!args)
- return NULL;
- - body = ast_for_suite(c, CHILD(n, name_i + 3));
- + body = ast_for_suite(c, CHILD(n, name_i + 2));
- if (!body)
- return NULL;
- @@ -919,11 +869,11 @@
- static expr_ty
- ast_for_lambdef(struct compiling *c, const node *n)
- {
- - /* lambdef: 'lambda' [varargslist] ':' test */
- + /* lambdef: 'lambda' [varargslist] '{' test */
- arguments_ty args;
- expr_ty expression;
- - if (NCH(n) == 3) {
- + if (NCH(n) == 4) {
- args = arguments(NULL, NULL, NULL, NULL, c->c_arena);
- if (!args)
- return NULL;
- @@ -1737,8 +1687,7 @@
- switch (TYPE(n)) {
- case test:
- case old_test:
- - if (TYPE(CHILD(n, 0)) == lambdef ||
- - TYPE(CHILD(n, 0)) == old_lambdef)
- + if (TYPE(CHILD(n, 0)) == lambdef)
- return ast_for_lambdef(c, CHILD(n, 0));
- else if (NCH(n) > 1)
- return ast_for_ifexpr(c, n);
- @@ -2606,64 +2555,30 @@
- static asdl_seq *
- ast_for_suite(struct compiling *c, const node *n)
- {
- - /* suite: simple_stmt | NEWLINE INDENT stmt+ DEDENT */
- + /* suite: separator+ (stmt separator)* */
- asdl_seq *seq;
- stmt_ty s;
- - int i, total, num, end, pos = 0;
- + int i, total, pos = 0;
- node *ch;
- - REQ(n, suite);
- -
- - total = num_stmts(n);
- + total = 0;
- + for (i = 1; i < NCH(n); i++) {
- + ch = CHILD(n, i);
- + if (TYPE(ch) != stmt)
- + continue;
- + total += num_stmts(ch);
- + }
- seq = asdl_seq_new(total, c->c_arena);
- if (!seq)
- return NULL;
- - if (TYPE(CHILD(n, 0)) == simple_stmt) {
- - n = CHILD(n, 0);
- - /* simple_stmt always ends with a NEWLINE,
- - and may have a trailing SEMI
- - */
- - end = NCH(n) - 1;
- - if (TYPE(CHILD(n, end - 1)) == SEMI)
- - end--;
- - /* loop by 2 to skip semi-colons */
- - for (i = 0; i < end; i += 2) {
- - ch = CHILD(n, i);
- - s = ast_for_stmt(c, ch);
- - if (!s)
- - return NULL;
- - asdl_seq_SET(seq, pos++, s);
- - }
- - }
- - else {
- - for (i = 2; i < (NCH(n) - 1); i++) {
- - ch = CHILD(n, i);
- - REQ(ch, stmt);
- - num = num_stmts(ch);
- - if (num == 1) {
- - /* small_stmt or compound_stmt with only one child */
- - s = ast_for_stmt(c, ch);
- - if (!s)
- - return NULL;
- - asdl_seq_SET(seq, pos++, s);
- - }
- - else {
- - int j;
- - ch = CHILD(ch, 0);
- - REQ(ch, simple_stmt);
- - for (j = 0; j < NCH(ch); j += 2) {
- - /* statement terminates with a semi-colon ';' */
- - if (NCH(CHILD(ch, j)) == 0) {
- - assert((j + 1) == NCH(ch));
- - break;
- - }
- - s = ast_for_stmt(c, CHILD(ch, j));
- - if (!s)
- - return NULL;
- - asdl_seq_SET(seq, pos++, s);
- - }
- - }
- - }
- + for (i = 1; i < NCH(n); i++) {
- + ch = CHILD(n, i);
- + if (TYPE(ch) != stmt)
- + continue;
- + s = ast_for_stmt(c, ch);
- + if (!s)
- + return NULL;
- + asdl_seq_SET(seq, pos++, s);
- }
- assert(pos == seq->size);
- return seq;
- @@ -2672,8 +2587,8 @@
- static stmt_ty
- ast_for_if_stmt(struct compiling *c, const node *n)
- {
- - /* if_stmt: 'if' test ':' suite ('elif' test ':' suite)*
- - ['else' ':' suite]
- + /* if_stmt: 'if' test suite ('elif' test suite)*
- + ['else' suite] 'end'
- */
- char *s;
- @@ -2686,50 +2601,50 @@
- expression = ast_for_expr(c, CHILD(n, 1));
- if (!expression)
- return NULL;
- - suite_seq = ast_for_suite(c, CHILD(n, 3));
- + suite_seq = ast_for_suite(c, CHILD(n, 2));
- if (!suite_seq)
- return NULL;
- -
- +
- return If(expression, suite_seq, NULL, LINENO(n), n->n_col_offset,
- c->c_arena);
- }
- - s = STR(CHILD(n, 4));
- + s = STR(CHILD(n, 3));
- /* s[2], the third character in the string, will be
- - 's' for el_s_e, or
- - 'i' for el_i_f
- + 'e' for else, or
- + 'i' for elsif
- */
- - if (s[2] == 's') {
- + if (s[3] == 'e') {
- expr_ty expression;
- asdl_seq *seq1, *seq2;
- expression = ast_for_expr(c, CHILD(n, 1));
- if (!expression)
- return NULL;
- - seq1 = ast_for_suite(c, CHILD(n, 3));
- + seq1 = ast_for_suite(c, CHILD(n, 2));
- if (!seq1)
- return NULL;
- - seq2 = ast_for_suite(c, CHILD(n, 6));
- + seq2 = ast_for_suite(c, CHILD(n, 4));
- if (!seq2)
- return NULL;
- return If(expression, seq1, seq2, LINENO(n), n->n_col_offset,
- c->c_arena);
- }
- - else if (s[2] == 'i') {
- + else if (s[3] == 'i') {
- int i, n_elif, has_else = 0;
- expr_ty expression;
- asdl_seq *suite_seq;
- asdl_seq *orelse = NULL;
- - n_elif = NCH(n) - 4;
- + n_elif = NCH(n) - 4; /* 'else' suite 'end' minus one token */
- /* must reference the child n_elif+1 since 'else' token is third,
- not fourth, child from the end. */
- if (TYPE(CHILD(n, (n_elif + 1))) == NAME
- - && STR(CHILD(n, (n_elif + 1)))[2] == 's') {
- + && STR(CHILD(n, (n_elif + 1)))[3] == 'e') {
- has_else = 1;
- - n_elif -= 3;
- + n_elif -= 2;
- }
- - n_elif /= 4;
- + n_elif /= 3;
- if (has_else) {
- asdl_seq *suite_seq2;
- @@ -2737,34 +2652,34 @@
- orelse = asdl_seq_new(1, c->c_arena);
- if (!orelse)
- return NULL;
- - expression = ast_for_expr(c, CHILD(n, NCH(n) - 6));
- + expression = ast_for_expr(c, CHILD(n, NCH(n) - 5));
- if (!expression)
- return NULL;
- suite_seq = ast_for_suite(c, CHILD(n, NCH(n) - 4));
- if (!suite_seq)
- return NULL;
- - suite_seq2 = ast_for_suite(c, CHILD(n, NCH(n) - 1));
- + suite_seq2 = ast_for_suite(c, CHILD(n, NCH(n) - 2));
- if (!suite_seq2)
- return NULL;
- asdl_seq_SET(orelse, 0,
- If(expression, suite_seq, suite_seq2,
- - LINENO(CHILD(n, NCH(n) - 6)),
- - CHILD(n, NCH(n) - 6)->n_col_offset,
- + LINENO(CHILD(n, NCH(n) - 5)),
- + CHILD(n, NCH(n) - 5)->n_col_offset,
- c->c_arena));
- /* the just-created orelse handled the last elif */
- n_elif--;
- }
- for (i = 0; i < n_elif; i++) {
- - int off = 5 + (n_elif - i - 1) * 4;
- + int off = 4 + (n_elif - i - 1) * 3;
- asdl_seq *newobj = asdl_seq_new(1, c->c_arena);
- if (!newobj)
- return NULL;
- expression = ast_for_expr(c, CHILD(n, off));
- if (!expression)
- return NULL;
- - suite_seq = ast_for_suite(c, CHILD(n, off + 2));
- + suite_seq = ast_for_suite(c, CHILD(n, off + 1));
- if (!suite_seq)
- return NULL;
- @@ -2777,22 +2692,22 @@
- expression = ast_for_expr(c, CHILD(n, 1));
- if (!expression)
- return NULL;
- - suite_seq = ast_for_suite(c, CHILD(n, 3));
- + suite_seq = ast_for_suite(c, CHILD(n, 2));
- if (!suite_seq)
- return NULL;
- return If(expression, suite_seq, orelse,
- LINENO(n), n->n_col_offset, c->c_arena);
- - }
- -
- - PyErr_Format(PyExc_SystemError,
- - "unexpected token in 'if' statement: %s", s);
- + } else if (s[3] != '\0' && s[2] != 'd') {
- + PyErr_Format(PyExc_SystemError,
- + "unexpected token in 'if' statement: %s", s);
- + }
- return NULL;
- }
- static stmt_ty
- ast_for_while_stmt(struct compiling *c, const node *n)
- {
- - /* while_stmt: 'while' test ':' suite ['else' ':' suite] */
- + /* while_stmt: 'while' test suite ['else' suite] 'end' */
- REQ(n, while_stmt);
- if (NCH(n) == 4) {
- @@ -2802,23 +2717,23 @@
- expression = ast_for_expr(c, CHILD(n, 1));
- if (!expression)
- return NULL;
- - suite_seq = ast_for_suite(c, CHILD(n, 3));
- + suite_seq = ast_for_suite(c, CHILD(n, 2));
- if (!suite_seq)
- return NULL;
- return While(expression, suite_seq, NULL, LINENO(n), n->n_col_offset,
- c->c_arena);
- }
- - else if (NCH(n) == 7) {
- + else if (NCH(n) == 6) {
- expr_ty expression;
- asdl_seq *seq1, *seq2;
- expression = ast_for_expr(c, CHILD(n, 1));
- if (!expression)
- return NULL;
- - seq1 = ast_for_suite(c, CHILD(n, 3));
- + seq1 = ast_for_suite(c, CHILD(n, 2));
- if (!seq1)
- return NULL;
- - seq2 = ast_for_suite(c, CHILD(n, 6));
- + seq2 = ast_for_suite(c, CHILD(n, 4));
- if (!seq2)
- return NULL;
- @@ -2839,11 +2754,11 @@
- expr_ty expression;
- expr_ty target;
- const node *node_target;
- - /* for_stmt: 'for' exprlist 'in' testlist ':' suite ['else' ':' suite] */
- + /* for_stmt: 'for' exprlist 'in' testlist suite ['else' suite] 'end' */
- REQ(n, for_stmt);
- - if (NCH(n) == 9) {
- - seq = ast_for_suite(c, CHILD(n, 8));
- + if (NCH(n) == 7) {
- + seq = ast_for_suite(c, CHILD(n, 6));
- if (!seq)
- return NULL;
- }
- @@ -2862,7 +2777,7 @@
- expression = ast_for_testlist(c, CHILD(n, 3));
- if (!expression)
- return NULL;
- - suite_seq = ast_for_suite(c, CHILD(n, 5));
- + suite_seq = ast_for_suite(c, CHILD(n, 4));
- if (!suite_seq)
- return NULL;
- @@ -2928,18 +2843,18 @@
- ast_for_try_stmt(struct compiling *c, const node *n)
- {
- const int nch = NCH(n);
- - int n_except = (nch - 3)/3;
- + int n_except = (nch - 3)/2;
- asdl_seq *body, *orelse = NULL, *finally = NULL;
- REQ(n, try_stmt);
- - body = ast_for_suite(c, CHILD(n, 2));
- + body = ast_for_suite(c, CHILD(n, 1));
- if (body == NULL)
- return NULL;
- if (TYPE(CHILD(n, nch - 3)) == NAME) {
- if (strcmp(STR(CHILD(n, nch - 3)), "finally") == 0) {
- - if (nch >= 9 && TYPE(CHILD(n, nch - 6)) == NAME) {
- + if (nch >= 9 && TYPE(CHILD(n, nch - 5)) == NAME) {
- /* we can assume it's an "else",
- because nch >= 9 for try-else-finally and
- it would otherwise have a type of except_clause */
- @@ -2949,7 +2864,7 @@
- n_except--;
- }
- - finally = ast_for_suite(c, CHILD(n, nch - 1));
- + finally = ast_for_suite(c, CHILD(n, nch - 2));
- if (finally == NULL)
- return NULL;
- n_except--;
- @@ -2957,7 +2872,7 @@
- else {
- /* we can assume it's an "else",
- otherwise it would have a type of except_clause */
- - orelse = ast_for_suite(c, CHILD(n, nch - 1));
- + orelse = ast_for_suite(c, CHILD(n, nch - 2));
- if (orelse == NULL)
- return NULL;
- n_except--;
- @@ -2977,8 +2892,8 @@
- return NULL;
- for (i = 0; i < n_except; i++) {
- - excepthandler_ty e = ast_for_except_clause(c, CHILD(n, 3 + i * 3),
- - CHILD(n, 5 + i * 3));
- + excepthandler_ty e = ast_for_except_clause(c, CHILD(n, 2 + i * 2),
- + CHILD(n, 3 + i * 2));
- if (!e)
- return NULL;
- asdl_seq_SET(handlers, i, e);
- @@ -3014,7 +2929,7 @@
- ast_for_with_stmt(struct compiling *c, const node *n)
- {
- expr_ty context_expr, optional_vars = NULL;
- - int suite_index = 3; /* skip 'with', test, and ':' */
- + int suite_index = 2; /* skip 'with', test, and ':' */
- asdl_seq *suite_seq;
- assert(TYPE(n) == with_stmt);
- @@ -3030,7 +2945,7 @@
- if (!set_context(c, optional_vars, Store, n)) {
- return NULL;
- }
- - suite_index = 4;
- + suite_index = 3;
- }
- suite_seq = ast_for_suite(c, CHILD(n, suite_index));
- @@ -3044,7 +2959,7 @@
- static stmt_ty
- ast_for_classdef(struct compiling *c, const node *n, asdl_seq *decorator_seq)
- {
- - /* classdef: 'class' NAME ['(' testlist ')'] ':' suite */
- + /* classdef: 'class' NAME ['(' testlist ')'] suite 'end' */
- PyObject *classname;
- asdl_seq *bases, *s;
- @@ -3054,7 +2969,7 @@
- return NULL;
- if (NCH(n) == 4) {
- - s = ast_for_suite(c, CHILD(n, 3));
- + s = ast_for_suite(c, CHILD(n, 2));
- if (!s)
- return NULL;
- classname = NEW_IDENTIFIER(CHILD(n, 1));
- @@ -3064,8 +2979,8 @@
- n->n_col_offset, c->c_arena);
- }
- /* check for empty base list */
- - if (TYPE(CHILD(n,3)) == RPAR) {
- - s = ast_for_suite(c, CHILD(n,5));
- + if (TYPE(CHILD(n, 3)) == RPAR) {
- + s = ast_for_suite(c, CHILD(n, 4));
- if (!s)
- return NULL;
- classname = NEW_IDENTIFIER(CHILD(n, 1));
- @@ -3080,7 +2995,7 @@
- if (!bases)
- return NULL;
- - s = ast_for_suite(c, CHILD(n, 6));
- + s = ast_for_suite(c, CHILD(n, 5));
- if (!s)
- return NULL;
- classname = NEW_IDENTIFIER(CHILD(n, 1));
- @@ -3097,10 +3012,6 @@
- assert(NCH(n) == 1);
- n = CHILD(n, 0);
- }
- - if (TYPE(n) == simple_stmt) {
- - assert(num_stmts(n) == 1);
- - n = CHILD(n, 0);
- - }
- if (TYPE(n) == small_stmt) {
- REQ(n, small_stmt);
- n = CHILD(n, 0);
- diff -x 'config.status*' -x Makefile.pre -x 'graminit.*' -urN Python-2.6.2/Python/bltinmodule.c Python-2.6.2.modified/Python/bltinmodule.c
- --- Python-2.6.2/Python/bltinmodule.c 2009-02-03 07:44:06.000000000 +0900
- +++ Python-2.6.2.modified/Python/bltinmodule.c 2009-09-08 01:42:08.827227682 +0900
- @@ -1555,7 +1555,7 @@
- static PyObject *
- builtin_print(PyObject *self, PyObject *args, PyObject *kwds)
- {
- - static char *kwlist[] = {"sep", "end", "file", 0};
- + static char *kwlist[] = {"sep", "end_", "file", 0};
- static PyObject *dummy_args;
- PyObject *sep = NULL, *end = NULL, *file = NULL;
- int i, err;
- diff -x 'config.status*' -x Makefile.pre -x 'graminit.*' -urN Python-2.6.2/Python/compile.c Python-2.6.2.modified/Python/compile.c
- --- Python-2.6.2/Python/compile.c 2008-06-11 16:41:16.000000000 +0900
- +++ Python-2.6.2.modified/Python/compile.c 2009-09-08 01:42:08.831236000 +0900
- @@ -1374,7 +1374,7 @@
- arguments_ty args = s->v.FunctionDef.args;
- asdl_seq* decos = s->v.FunctionDef.decorator_list;
- stmt_ty st;
- - int i, n, docstring;
- + int i, n, docstring = 0;
- assert(s->kind == FunctionDef_kind);
- @@ -1386,20 +1386,22 @@
- s->lineno))
- return 0;
- - st = (stmt_ty)asdl_seq_GET(s->v.FunctionDef.body, 0);
- - docstring = compiler_isdocstring(st);
- - if (docstring && Py_OptimizeFlag < 2)
- - first_const = st->v.Expr.value->v.Str.s;
- - if (compiler_add_o(c, c->u->u_consts, first_const) < 0) {
- - compiler_exit_scope(c);
- - return 0;
- - }
- + n = asdl_seq_LEN(s->v.FunctionDef.body);
- + if (n > 0) {
- + st = (stmt_ty)asdl_seq_GET(s->v.FunctionDef.body, 0);
- + docstring = compiler_isdocstring(st);
- + if (docstring && Py_OptimizeFlag < 2)
- + first_const = st->v.Expr.value->v.Str.s;
- + if (compiler_add_o(c, c->u->u_consts, first_const) < 0) {
- + compiler_exit_scope(c);
- + return 0;
- + }
- + }
- /* unpack nested arguments */
- compiler_arguments(c, args);
- c->u->u_argcount = asdl_seq_LEN(args->args);
- - n = asdl_seq_LEN(s->v.FunctionDef.body);
- /* if there was a docstring, we need to skip the first statement */
- for (i = docstring; i < n; i++) {
- st = (stmt_ty)asdl_seq_GET(s->v.FunctionDef.body, i);
- diff -x 'config.status*' -x Makefile.pre -x 'graminit.*' -urN Python-2.6.2/Python/import.c Python-2.6.2.modified/Python/import.c
- --- Python-2.6.2/Python/import.c 2009-01-14 09:00:17.000000000 +0900
- +++ Python-2.6.2.modified/Python/import.c 2009-09-08 01:42:08.839235957 +0900
- @@ -95,17 +95,17 @@
- #ifdef RISCOS
- static const struct filedescr _PyImport_StandardFiletab[] = {
- - {"/py", "U", PY_SOURCE},
- - {"/pyc", "rb", PY_COMPILED},
- + {"/pb", "U", PY_SOURCE},
- + {"/pbc", "rb", PY_COMPILED},
- {0, 0}
- };
- #else
- static const struct filedescr _PyImport_StandardFiletab[] = {
- - {".py", "U", PY_SOURCE},
- + {".pb", "U", PY_SOURCE},
- #ifdef MS_WINDOWS
- - {".pyw", "U", PY_SOURCE},
- + {".pbw", "U", PY_SOURCE},
- #endif
- - {".pyc", "rb", PY_COMPILED},
- + {".pbc", "rb", PY_COMPILED},
- {0, 0}
- };
- #endif
- @@ -144,14 +144,14 @@
- _PyImport_Filetab = filetab;
- if (Py_OptimizeFlag) {
- - /* Replace ".pyc" with ".pyo" in _PyImport_Filetab */
- + /* Replace ".pbc" with ".pbo" in _PyImport_Filetab */
- for (; filetab->suffix != NULL; filetab++) {
- #ifndef RISCOS
- - if (strcmp(filetab->suffix, ".pyc") == 0)
- - filetab->suffix = ".pyo";
- + if (strcmp(filetab->suffix, ".pbc") == 0)
- + filetab->suffix = ".pbo";
- #else
- - if (strcmp(filetab->suffix, "/pyc") == 0)
- - filetab->suffix = "/pyo";
- + if (strcmp(filetab->suffix, "/pbc") == 0)
- + filetab->suffix = "/pbo";
- #endif
- }
- }
- @@ -1394,14 +1394,14 @@
- if (stat(buf, &statbuf) == 0 && /* it exists */
- S_ISDIR(statbuf.st_mode) && /* it's a directory */
- case_ok(buf, len, namelen, name)) { /* case matches */
- - if (find_init_module(buf)) { /* and has __init__.py */
- + if (find_init_module(buf)) { /* and has __init__.pb */
- Py_XDECREF(copy);
- return &fd_package;
- }
- else {
- char warnstr[MAXPATHLEN+80];
- sprintf(warnstr, "Not importing directory "
- - "'%.*s': missing __init__.py",
- + "'%.*s': missing __init__.pb",
- MAXPATHLEN, buf);
- if (PyErr_Warn(PyExc_ImportWarning,
- warnstr)) {
- @@ -1422,7 +1422,7 @@
- else {
- char warnstr[MAXPATHLEN+80];
- sprintf(warnstr, "Not importing directory "
- - "'%.*s': missing __init__.py",
- + "'%.*s': missing __init__.pb",
- MAXPATHLEN, buf);
- if (PyErr_Warn(PyExc_ImportWarning,
- warnstr)) {
- @@ -1709,7 +1709,7 @@
- #ifdef HAVE_STAT
- -/* Helper to look for __init__.py or __init__.py[co] in potential package */
- +/* Helper to look for __init__.pb or __init__.pb[co] in potential package */
- static int
- find_init_module(char *buf)
- {
- @@ -1730,7 +1730,7 @@
- return 0;
- buf[i++] = SEP;
- pname = buf + i;
- - strcpy(pname, "__init__.py");
- + strcpy(pname, "__init__.pb");
- if (stat(buf, &statbuf) == 0) {
- if (case_ok(buf,
- save_len + 9, /* len("/__init__") */
- @@ -1768,7 +1768,7 @@
- if (save_len + 13 >= MAXPATHLEN)
- return 0;
- buf[i++] = SEP;
- - strcpy(buf+i, "__init__/py");
- + strcpy(buf+i, "__init__/pb");
- if (isfile(buf)) {
- buf[save_len] = '\0';
- return 1;
- @@ -2192,7 +2192,7 @@
- /* Return the package that an import is being performed in. If globals comes
- from the module foo.bar.bat (not itself a package), this returns the
- - sys.modules entry for foo.bar. If globals is from a package's __init__.py,
- + sys.modules entry for foo.bar. If globals is from a package's __init__.pb,
- the package's entry in sys.modules is returned, as a borrowed reference.
- The *name* of the returned package is returned in buf, with the length of
- @@ -3110,7 +3110,7 @@
- PyDoc_STRVAR(doc_get_magic,
- "get_magic() -> string\n\
- -Return the magic number for .pyc or .pyo files.");
- +Return the magic number for .pbc or .pbo files.");
- PyDoc_STRVAR(doc_get_suffixes,
- "get_suffixes() -> [(suffix, mode, type), ...]\n\
- diff -x 'config.status*' -x Makefile.pre -x 'graminit.*' -urN Python-2.6.2/Python/pythonrun.c Python-2.6.2.modified/Python/pythonrun.c
- --- Python-2.6.2/Python/pythonrun.c 2009-04-04 23:19:56.000000000 +0900
- +++ Python-2.6.2.modified/Python/pythonrun.c 2009-09-08 01:42:08.839235957 +0900
- @@ -1541,16 +1541,8 @@
- switch (err->error) {
- case E_SYNTAX:
- errtype = PyExc_IndentationError;
- - if (err->expected == INDENT)
- - msg = "expected an indented block";
- - else if (err->token == INDENT)
- - msg = "unexpected indent";
- - else if (err->token == DEDENT)
- - msg = "unexpected unindent";
- - else {
- - errtype = PyExc_SyntaxError;
- - msg = "invalid syntax";
- - }
- + errtype = PyExc_SyntaxError;
- + msg = "invalid syntax";
- break;
- case E_TOKEN:
- msg = "invalid token";
- diff -x 'config.status*' -x Makefile.pre -x 'graminit.*' -urN Python-2.6.2/Python/sysmodule.c Python-2.6.2.modified/Python/sysmodule.c
- --- Python-2.6.2/Python/sysmodule.c 2009-01-14 09:08:09.000000000 +0900
- +++ Python-2.6.2.modified/Python/sysmodule.c 2009-09-08 01:42:08.843231156 +0900
- @@ -1262,7 +1262,6 @@
- SetFlag(Py_NoUserSiteDirectory);
- SetFlag(Py_NoSiteFlag);
- SetFlag(Py_IgnoreEnvironmentFlag);
- - SetFlag(Py_TabcheckFlag);
- SetFlag(Py_VerboseFlag);
- #ifdef RISCOS
- SetFlag(Py_RISCOSWimpFlag);
- diff -x 'config.status*' -x Makefile.pre -x 'graminit.*' -urN Python-2.6.2/Python/_warnings.c Python-2.6.2.modified/Python/_warnings.c
- --- Python-2.6.2/Python/_warnings.c 2008-10-03 04:49:47.000000000 +0900
- +++ Python-2.6.2.modified/Python/_warnings.c 2009-09-08 01:42:08.847225435 +0900
- @@ -194,7 +194,7 @@
- if (len < 0)
- return NULL;
- if (len >= 3 &&
- - strncmp(mod_str + (len - 3), ".py", 3) == 0) {
- + strncmp(mod_str + (len - 3), ".pb", 3) == 0) {
- module = PyString_FromStringAndSize(mod_str, len-3);
- }
- else {
- @@ -513,11 +513,11 @@
- if (file_str == NULL || (len < 0 && PyErr_Occurred()))
- goto handle_error;
- - /* if filename.lower().endswith((".pyc", ".pyo")): */
- + /* if filename.lower().endswith((".pbc", ".pbo")): */
- if (len >= 4 &&
- file_str[len-4] == '.' &&
- tolower(file_str[len-3]) == 'p' &&
- - tolower(file_str[len-2]) == 'y' &&
- + tolower(file_str[len-2]) == 'b' &&
- (tolower(file_str[len-1]) == 'c' ||
- tolower(file_str[len-1]) == 'o'))
- {
- diff -x 'config.status*' -x Makefile.pre -x 'graminit.*' -urN Python-2.6.2/retouch.patch Python-2.6.2.modified/retouch.patch
- --- Python-2.6.2/retouch.patch 1970-01-01 09:00:00.000000000 +0900
- +++ Python-2.6.2.modified/retouch.patch 2009-09-08 01:57:34.451231183 +0900
- @@ -0,0 +1,11 @@
- +--- setup.pb 2009-09-08 01:57:04.670228285 +0900
- ++++ setup.pb 2009-09-08 01:57:09.978426876 +0900
- +@@ -1374,7 +1374,7 @@
- + (srcdir,) = sysconfig.get_config_vars('srcdir')
- + ffi_builddir = os.path.join(self.build_temp, 'libffi')
- + ffi_srcdir = os.path.abspath(os.path.join(srcdir, 'Modules', '_ctypes', 'libffi'))
- +- ffi_configfile = os.path.join(ffi_builddir, 'fficonfig.py')
- ++ ffi_configfile = os.path.join(ffi_builddir, 'fficonfig.pb')
- +
- + from distutils.dep_util import newer_group
- +
- diff -x 'config.status*' -x Makefile.pre -x 'graminit.*' -urN Python-2.6.2/RISCOS/Modules/swimodule.c Python-2.6.2.modified/RISCOS/Modules/swimodule.c
- --- Python-2.6.2/RISCOS/Modules/swimodule.c 2008-06-09 13:58:54.000000000 +0900
- +++ Python-2.6.2.modified/RISCOS/Modules/swimodule.c 2009-09-08 01:42:08.847225435 +0900
- @@ -292,13 +292,13 @@
- {
- if (!strcmp(name, "length")) return PyInt_FromLong((long)s->length);
- if (!strcmp(name, "start")) return PyInt_FromLong((long)s->block);
- - if (!strcmp(name,"end")) return PyInt_FromLong(((long)(s->block)+s->length));
- + if (!strcmp(name,"end_")) return PyInt_FromLong(((long)(s->block)+s->length));
- if (!strcmp(name, "__members__"))
- { PyObject *list = PyList_New(3);
- if (list)
- { PyList_SetItem(list, 0, PyString_FromString("length"));
- PyList_SetItem(list, 1, PyString_FromString("start"));
- - PyList_SetItem(list, 2, PyString_FromString("end"));
- + PyList_SetItem(list, 2, PyString_FromString("end_"));
- if (PyErr_Occurred()) { Py_DECREF(list);list = NULL;}
- }
- return list;
- diff -x 'config.status*' -x Makefile.pre -x 'graminit.*' -urN Python-2.6.2/setup.py Python-2.6.2.modified/setup.py
- --- Python-2.6.2/setup.py 2009-04-01 03:20:48.000000000 +0900
- +++ Python-2.6.2.modified/setup.py 2009-09-08 01:42:08.851261910 +0900
- @@ -508,9 +508,6 @@
- # select(2); not on ancient System V
- exts.append( Extension('select', ['selectmodule.c']) )
- - # Fred Drake's interface to the Python parser
- - exts.append( Extension('parser', ['parsermodule.c']) )
- -
- # cStringIO and cPickle
- exts.append( Extension('cStringIO', ['cStringIO.c']) )
- exts.append( Extension('cPickle', ['cPickle.c']) )
- --- Python-2.6.2/Lib/compileall.py 2008-03-05 06:14:04.000000000 +0900
- +++ Python-2.6.2.modified/Lib/compileall.py 2009-09-08 02:37:28.296334022 +0900
- @@ -53,7 +53,7 @@
- continue
- if os.path.isfile(fullname):
- head, tail = name[:-3], name[-3:]
- - if tail == '.py':
- + if tail == '.pb':
- cfile = fullname + (__debug__ and 'c' or 'o')
- ftime = os.stat(fullname).st_mtime
- try: ctime = os.stat(cfile).st_mtime
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement