Message75016
ported to python-2.6 & is a bit more stable (written a few py3k programs
w/ it). the patches have been simplified & consolidated to a single
file: ceval.c
u can also test out scripts generated by 2to3 by adding to them the
magic line:
"from __future__ import py3k_syntax"
an example "python-2.6" script using "python-3.0" language syntax (&
numpy if its installed) is provided @:
http://www-rcf.usc.edu/~kaizhu/work/py3to2/current/example_py3k.py
new features added by patch to python-2.6 (under py3k_syntax mode):
pep3102 Keyword-Only Arguments
pep3104 Access to Names in Outer Scopes
pep3107 Function Annotations
pep3111 Simple input built-in in Python 3000
pep3113 Removal of Tuple Parameter Unpacking
pep3114 Renaming iterator.next() to iterator.__next__()
pep3115 Metaclasses in Python 3000
pep3127 Integer Literal Support and Syntax
- oct() functions differently in py3k_syntax mode
pep3129 Class Decorators
pep3132 Extended Iterable Unpacking
pep3135 New Super
misc exec becomes a function
sans unicode & py3k's builtins module, the above (plus __future__)
implements pretty much all of py3k's language syntax
py3k_syntax mode:
a special bitflag is embedded in codeobj->co_argcount, which triggers
PyEval_EvalFrameEx to enable the backported opcodes (which r disabled by
default) & use an alternate py3k __builtin__.
codeobj->co_argcount now limited to range 0-0xffff with upper bits
reserved for py3k flags
codeobj->co_kwonlyargcount (limited to range 0-0xff) is embedded in
upper bits of codeobj->co_argcount
most of the trouble have been gettin kwonlyarg, annotations, & classes
to work.
there is one unrelated opcode (LOAD_ATTR_py3k) added to ceval.c for my
personal use (curries attributes as a universal function), but can b
safely disabled by commenting its case out of PyEvalFrameEx in ceval.c &
deleting it from dict opnew_py2x in py3to2.py |
|
Date |
User |
Action |
Args |
2008-10-20 23:39:33 | kaizhu | set | recipients:
+ kaizhu, loewis, collinwinter, pitrou, benjamin.peterson |
2008-10-20 23:39:32 | kaizhu | set | messageid: <1224545972.64.0.648780688676.issue3238@psf.upfronthosting.co.za> |
2008-10-20 23:39:31 | kaizhu | link | issue3238 messages |
2008-10-20 23:39:30 | kaizhu | create | |
|