Package: py3k_extension
################################################################################REVISION DATE: 20081023AUTHOR: kai zhu - kaizhu@hpc.usc.eduHOMEPAGE: http://www-rcf.usc.edu/~kaizhu/work/py3to2/old/extensionABSTRACT:this is a minimal, standalone, proof-of-concept extension module forpython2.6, emulating limited python3.0 syntax behavior, thru usage of somebackported opcodes from python3.0.  it is intended as a curiousity for hackers.this module is derived from py3to2.  the difference is that this is astandalone module which requires no patching of python2.6 to work.the tradeoff is that it is not 100& py3k language compliant, as py3to2nearly is (see LIMITATIONS).i wrote this module b/c i kno many ppl r loathe to patch their python-2.6 srcin order to run py3to2.  this is a compromise, but plz note it has severelimitations.MECHANISM:1. upon init, py3k_extension starts up a py3k server w/ pipe io.2. -> received via pipe io from py3k_extension, the py3k server 1stnatively compiles the src code into a py3k codeobj, then converts itto py2x format w/ the addition of the backported opcodes.3. <- the serialized py2x codeobj is piped back to py3k_extension,which unserializes it & eval/exec it as normal.in theory, this mechanism should transparently implement any bytecode-level py3klanguage feature.  performance and robustness should b minimally impacted, sincethe compiled code is directly run as native 2.x++ bytecode.BACKWARD COMPATIBILITY:since this is a standalone extension module which doesn't modify python'ssource code in any way, there shouldn't b any backward compatibility issues aslong as the module is not imported################################################################################LIMITATIONS:as a minimal extension module, this module DOES NOT SUPPORT CLASSES,IMPORTING PY3K MODULES, OR FUNCTION KEYWORD-ONLY ARGUMENTS.any py3k code containing classes will not work.PY3K FEATURES TESTED TO WORK:pep3104  Access to Names in Outer Scopespep3112  Bytes literals in Python 3000pep3113  Removal of Tuple Parameter Unpackingpep3132  Extended Iterable UnpackingREQUIREMENTS:* linux / unix (windows has io problems w/ py3k server)BUILD/INSTALL: python setup.py build installUSAGE:this module provides 3 wrapper functions similar to what's in python-3.0'sbuiltins:- py3k_compile(code, filename, mode, flags, dont_inherit)- py3k_eval(code, globals = None, locals = None)- py3k_exec(code, globals = None, locals = None)EXAMPLE:Python 2.6 (r26:66714, Oct 19 2008, 02:49:13)[GCC 3.4.6 20060404 (Red Hat 3.4.6-10)] on linux2Type "help", "copyright", "credits" or "license" for more information.>>>>>> import py3k_extensioncreated read/write pipes: (4, 5)py3k server starting with pipes in/out/err: 7 5 -2py3k server: Python 3.0rc1 (r30rc1:66499, Oct 15 2008, 15:43:09)py3k server: [GCC 3.4.6 20060404 (Red Hat 3.4.6-10)] on linux2py3k server: Type "help", "copyright", "credits" or "license" for moreinformation.py3k server: >>> ''>>>>>> py3k_exec( "a, *b = 1,2,3" ) # pep3132  Extended Iterable Unpacking>>> print a, b1 [2, 3]>>>################################################################################CHANGELOG:20081023created a standalone extension module w/ limited capabilities20081019ported to python-2.6consolidate & simplify patches to 1 file: ceval.ccreated extension module builtins_py3krevamped import hook againremoved unicode support & restrict source code to ascii-only20080727revampled import hook20080911consolidate patches to 2 files: bltinmodule.c & ceval.c20080828add kwonlyargcount 'attr' to codeobjadd __annotations__ & __kwdefaults__ attr to funcobjadd __pseudomethod__ feature to baseobj20080819pure python import hook - removed magic comment & use magic path insteadrevamped str & bytes handlingrevamped py3k .pyc file handling20080802pep3135  New Super20080717pep3107  Function Annotationspep3120  Using UTF-8 as the default source encodingpep3131  Supporting Non-ASCII Identifiers20080713import / reload works transparently on py3k scripts using a magic commentadded pep3102  Keyword-Only Arguments20080709 added a py3k preparser20080702rewrote py3k server's pipe io.  implemented partial bytearray & bytes class.wrote a few simple tests20080630__build_class__ function to bltmodule.c.  tested class decorators to b working.################################################################################