[issue3238] backport python 3.0 language functionality to python 2.6 by adding 7 opcodes to ceval.c

kai zhu report at bugs.python.org
Wed Jul 9 13:27:53 CEST 2008


kai zhu <davidbranniganz at gmail.com> added the comment:

update: these 3k language features have been tested to work in python
2.5.2 w/ the backported opcodes

   pep3104  Access to Names in Outer Scopes
   pep3105  Make print a function
   pep3111  Simple input built-in in Python 3000
   pep3113  Removal of Tuple Parameter Unpacking
   pep3114  Renaming iterator.next() to .__next__()
   pep3115  Metaclasses in Python 3000
   pep3127  Integer Literal Support and Syntax
   pep3129  Class Decorators
   pep3132  Extended Iterable Unpacking

had to backport __build_class__ in bltinmodule.c to get metaclasses
working.  u can go to http://www-rcf.usc.edu/~kaizhu/work/py3to2/ for
more info

install/usage summary:
  1. build python 2.5.2 w/ patched ceval.c & bltinmodule.c
  2. download scripts: py3to2.py & _py3to2.py
  3. ln -s python3.0 python3k
  4. run python2.5 & type 'import py3to2' # it will automatically run
the pep tests

the script provides 3 functions similar to those in __builtin__:
compile_py3k, exec_py3k, eval_py3k

right now, working on backporting pep 3102 & 3107 - annotations &
keyword-only arguments.  apparently appending the co_kwonlyargcount attr
to codeobject in 2.5.2 doesn't seem to affect the build

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue3238>
_______________________________________


More information about the Python-bugs-list mailing list