From tismer at codespeak.net Sun May 1 00:58:38 2005 From: tismer at codespeak.net (tismer at codespeak.net) Date: Sun, 1 May 2005 00:58:38 +0200 (CEST) Subject: [pypy-svn] r11667 - pypy/dist/pypy/objspace/flow Message-ID: <20050430225838.CD92C27BB0@code1.codespeak.net> Author: tismer Date: Sun May 1 00:58:38 2005 New Revision: 11667 Modified: pypy/dist/pypy/objspace/flow/objspace.py Log: added op_appendices to flow/objspace. These are the needed operation name manglings for certain exceptions. Modified: pypy/dist/pypy/objspace/flow/objspace.py ============================================================================== --- pypy/dist/pypy/objspace/flow/objspace.py (original) +++ pypy/dist/pypy/objspace/flow/objspace.py Sun May 1 00:58:38 2005 @@ -396,22 +396,39 @@ # ______________________________________________________________________ -implicit_exceptions = { - 'getitem': [IndexError, KeyError], - 'delitem': [IndexError, KeyError], - # no implicit exceptions for setitem - 'getattr': [AttributeError], - 'delattr': [AttributeError], - 'iter' : [TypeError], - 'coerce' : [TypeError], - } -# continuing like above, but in a more programmatic style. +op_appendices = {} +for _name, _exc in( + ('ovf', OverflowError), + ('idx', IndexError), + ('key', KeyError), + ('att', AttributeError), + ('typ', TypeError), + ('zer', ZeroDivisionError), + ('val', ValueError), + ('flo', FloatingPointError) + ): + op_appendices[_exc] = _name +del _name, _exc + +implicit_exceptions = {} + def _add_exceptions(names, exc): for name in names.split(): lis = implicit_exceptions.setdefault(name, []) if exc in lis: raise ValueError, "your list is causing duplication!" lis.append(exc) + assert exc in op_appendices + +for _err in IndexError, KeyError: + _add_exceptions("""getitem""", _err) + _add_exceptions("""delitem""", _err) + # no implicit exceptions for setitem +for _name in 'getattr', 'delattr': + _add_exceptions(_name, AttributeError) +for _name in 'iter', 'coerce': + _add_exceptions(_name, TypeError) +del _name, _err _add_exceptions("""div mod divmod truediv floordiv pow inplace_div inplace_mod inplace_divmod inplace_truediv From tismer at codespeak.net Sun May 1 01:12:19 2005 From: tismer at codespeak.net (tismer at codespeak.net) Date: Sun, 1 May 2005 01:12:19 +0200 (CEST) Subject: [pypy-svn] r11670 - pypy/dist/pypy/translator Message-ID: <20050430231219.6BA6E27BBA@code1.codespeak.net> Author: tismer Date: Sun May 1 01:12:19 2005 New Revision: 11670 Modified: pypy/dist/pypy/translator/transform.py Log: added a (really a little complicated) transformation that replaces ovfcheck function calls by short checks and operations. The goal would work now with annotatednow (tested), if mul_ovf was defined. I'm now proceeding to add the needed operations to ctyper.py Modified: pypy/dist/pypy/translator/transform.py ============================================================================== --- pypy/dist/pypy/translator/transform.py (original) +++ pypy/dist/pypy/translator/transform.py Sun May 1 01:12:19 2005 @@ -71,6 +71,87 @@ op2.result) block.operations[i+1:i+2] = [new_op] +# try: +# z = ovfcheck(x y) +# except OverflowError: +# # and in some cases also +# except ZeroDivisionError: +# --> +# z = (x, y) +# +# v = ovfcheck(z) +# +# --> +# z = _ovf(x, y) +# + +def transform_ovfcheck(self): + """Transforms ovfcheck(x y) to _ofv(x, y).""" + from pypy.tool.rarithmetic import ovfcheck, ovfcheck_lshift + from pypy.objspace.flow.objspace import op_appendices + covf = Constant(ovfcheck), Constant(ovfcheck_lshift) + covfExc = Constant(OverflowError) + def is_ovfcheck(bl): + ops = bl.operations + return (ops and ops[-1].opname == "simple_call" + and ops[-1].args[0] in covf) + def is_single(bl): + return is_ovfcheck(bl) and len(bl.operations) > 1 + def is_paired(bl): + return bl.exits and is_ovfcheck(bl.exits[0].target) + def rename(v): + return renaming.get(v, v) + for block in fully_annotated_blocks(self): + renaming = {} + if is_single(block): + print 100*"*" + print block.operations[-2] + delop = block.operations.pop() + op = block.operations[-1] + assert len(delop.args) == 2 + renaming[delop.result] = delop.args[1] + exits = [] + for exit in block.exits: + args = [rename(a) for a in exit.args] + exits.append(Link(args, exit.target, exit.exitcase)) + elif is_paired(block): + print 100*"+" + print block.operations[-1] + ovfblock = block.exits[0].target + assert len(ovfblock.operations) == 1 + op = block.operations[-1] + exits = list(block.exits) + # shortcut the "no exception" path + exits[0].target = ovfblock.exits[0].target + if len(ovfblock.exits) > 1: + # merge the exception link + assert len(ovfblock.exits) == 2 + ovexp = ovfblock.exits[1] + # space from block, last_ from ovfblock + args = exits[0].args[:1] + ovexp.args[1:] + exits.append(Link(args, ovexp.target, ovexp.exitcase)) + block.exitswitch = ovfblock.exitswitch + else: + continue + # replace the generic exception handler by the direct case + for exit in exits: + if exit.exitcase is Exception: + bl = exit.target + while len(bl.exits) == 2: + if bl.operations[0].args[-1] == covfExc: + exit.exitcase = OverflowError + exit.target = bl.exits[1].target + assert len(exit.target.inputargs) == 1 + del exit.args[1:] # space only + break + else: + bl = bl.exits[0].target + block.exits = [] + block.recloseblock(*exits) + # finally, mangle the operation name + apps = [op_appendices[exit.exitcase] for exit in block.exits[1:]] + apps.sort() + op.opname = '_'.join([op.opname]+apps) # a(*b) # --> # c = newtuple(*b) @@ -310,12 +391,17 @@ def transform_graph(ann): """Apply set of transformations available.""" # WARNING: this produces incorrect results if the graph has been - # modified by t.simplify() after is had been annotated. + # modified by t.simplify() after it had been annotated. if ann.translator: ann.translator.checkgraphs() transform_dead_code(ann) transform_allocate(ann) transform_slice(ann) + # testing the is_single case: + #from pypy.translator.simplify import join_blocks + #for graph in ann.translator.flowgraphs.values(): + # join_blocks(graph) + transform_ovfcheck(ann) ##transform_listextend(ann) # do this last, after the previous transformations had a # chance to remove dependency on certain variables From tismer at codespeak.net Sun May 1 01:29:36 2005 From: tismer at codespeak.net (tismer at codespeak.net) Date: Sun, 1 May 2005 01:29:36 +0200 (CEST) Subject: [pypy-svn] r11673 - pypy/dist/pypy/translator Message-ID: <20050430232936.37E2027BD3@code1.codespeak.net> Author: tismer Date: Sun May 1 01:29:36 2005 New Revision: 11673 Modified: pypy/dist/pypy/translator/transform.py Log: added another join_blocks step after ovfcheck and friends are resolved Modified: pypy/dist/pypy/translator/transform.py ============================================================================== --- pypy/dist/pypy/translator/transform.py (original) +++ pypy/dist/pypy/translator/transform.py Sun May 1 01:29:36 2005 @@ -397,14 +397,18 @@ transform_dead_code(ann) transform_allocate(ann) transform_slice(ann) + from pypy.translator.simplify import join_blocks # testing the is_single case: - #from pypy.translator.simplify import join_blocks - #for graph in ann.translator.flowgraphs.values(): - # join_blocks(graph) + #if ann.translator: + # for graph in ann.translator.flowgraphs.values(): + # join_blocks(graph) transform_ovfcheck(ann) ##transform_listextend(ann) # do this last, after the previous transformations had a # chance to remove dependency on certain variables transform_dead_op_vars(ann) if ann.translator: + # see again if we caused trivial blocks + for graph in ann.translator.flowgraphs.values(): + join_blocks(graph) ann.translator.checkgraphs() From hpk at codespeak.net Sun May 1 01:47:07 2005 From: hpk at codespeak.net (hpk at codespeak.net) Date: Sun, 1 May 2005 01:47:07 +0200 (CEST) Subject: [pypy-svn] r11675 - pypy/dist/lib-python-2.3.4/test Message-ID: <20050430234707.E7E3627BDA@code1.codespeak.net> Author: hpk Date: Sun May 1 01:47:07 2005 New Revision: 11675 Modified: pypy/dist/lib-python-2.3.4/test/conftest.py Log: enabled a few tests, from skimming http://codespeak.net/~hpk/pypy-testresult/ Modified: pypy/dist/lib-python-2.3.4/test/conftest.py ============================================================================== --- pypy/dist/lib-python-2.3.4/test/conftest.py (original) +++ pypy/dist/lib-python-2.3.4/test/conftest.py Sun May 1 01:47:07 2005 @@ -303,19 +303,19 @@ testmap = [ RegrTest('test___all__.py', enabled=False), - RegrTest('test___future__.py', enabled=False, dumbtest=1), + RegrTest('test___future__.py', enabled=True, dumbtest=1), RegrTest('test_aepack.py', enabled=False), RegrTest('test_al.py', enabled=False, dumbtest=1), - RegrTest('test_anydbm.py', enabled=False), + RegrTest('test_anydbm.py', enabled=True), RegrTest('test_array.py', enabled=False), #rev 10840: Uncaught interp-level exception: Same place as test_cfgparser RegrTest('test_asynchat.py', enabled=False), RegrTest('test_atexit.py', enabled=False, dumbtest=1), RegrTest('test_audioop.py', enabled=False, dumbtest=1), - RegrTest('test_augassign.py', enabled=False), + RegrTest('test_augassign.py', enabled=True), RegrTest('test_base64.py', enabled=True), - RegrTest('test_bastion.py', enabled=False, dumbtest=1), + RegrTest('test_bastion.py', enabled=True, dumbtest=1), RegrTest('test_binascii.py', enabled=False), #rev 10840: 2 of 8 tests fail @@ -343,7 +343,7 @@ #raise UnwrapError('calling %s: %s' % (self.code.cpy_callable, e)) #pypy.objspace.std.model.UnwrapError: calling : cannot unwrap > - RegrTest('test_cgi.py', enabled=False), + RegrTest('test_cgi.py', enabled=True), RegrTest('test_charmapcodec.py', enabled=True), RegrTest('test_cl.py', enabled=False, dumbtest=1), RegrTest('test_class.py', enabled=False, oldstyle=True), @@ -363,7 +363,7 @@ RegrTest('test_complex.py', enabled=False), #rev 10840: at least one test fails, after several hours I gave up waiting for the rest - RegrTest('test_contains.py', enabled=False, dumbtest=1), + RegrTest('test_contains.py', enabled=True, dumbtest=1), RegrTest('test_cookie.py', enabled=False), RegrTest('test_copy.py', enabled=True), RegrTest('test_copy_reg.py', enabled=True), @@ -379,17 +379,17 @@ RegrTest('test_descrtut.py', enabled=False), #rev 10840: 19 of 96 tests fail - RegrTest('test_difflib.py', enabled=False, dumbtest=1), + RegrTest('test_difflib.py', enabled=True, dumbtest=1), RegrTest('test_dircache.py', enabled=True), RegrTest('test_dis.py', enabled=True), RegrTest('test_dl.py', enabled=False, dumbtest=1), RegrTest('test_doctest.py', enabled=True), RegrTest('test_doctest2.py', enabled=True), - RegrTest('test_dumbdbm.py', enabled=False), + RegrTest('test_dumbdbm.py', enabled=True), #rev 10840: 5 of 7 tests fail RegrTest('test_dummy_thread.py', enabled=True), - RegrTest('test_dummy_threading.py', enabled=False, dumbtest=1), + RegrTest('test_dummy_threading.py', enabled=True, dumbtest=1), RegrTest('test_email.py', enabled=False), #rev 10840: Uncaught interp-level exception @@ -398,22 +398,22 @@ RegrTest('test_eof.py', enabled=False), #rev 10840: some error strings differ slightly XXX - RegrTest('test_errno.py', enabled=False, dumbtest=1), + RegrTest('test_errno.py', enabled=True, dumbtest=1), RegrTest('test_exceptions.py', enabled=False), RegrTest('test_extcall.py', enabled=False), RegrTest('test_fcntl.py', enabled=False, dumbtest=1), RegrTest('test_file.py', enabled=False, dumbtest=1), - RegrTest('test_filecmp.py', enabled=False), - RegrTest('test_fileinput.py', enabled=False, dumbtest=1), + RegrTest('test_filecmp.py', enabled=True), + RegrTest('test_fileinput.py', enabled=True, dumbtest=1), RegrTest('test_fnmatch.py', enabled=True), RegrTest('test_fork1.py', enabled=False, dumbtest=1), RegrTest('test_format.py', enabled=False, dumbtest=1), RegrTest('test_fpformat.py', enabled=True), RegrTest('test_frozen.py', enabled=False), - RegrTest('test_funcattrs.py', enabled=False, dumbtest=1), - RegrTest('test_future.py', enabled=False), - RegrTest('test_future1.py', enabled=False, dumbtest=1), - RegrTest('test_future2.py', enabled=False, dumbtest=1), + RegrTest('test_funcattrs.py', enabled=True, dumbtest=1), + RegrTest('test_future.py', enabled=True), + RegrTest('test_future1.py', enabled=True, dumbtest=1), + RegrTest('test_future2.py', enabled=True, dumbtest=1), RegrTest('test_future3.py', enabled=True), RegrTest('test_gc.py', enabled=False, dumbtest=1), RegrTest('test_gdbm.py', enabled=False, dumbtest=1), @@ -424,7 +424,7 @@ RegrTest('test_getargs2.py', enabled=False), #rev 10840: ImportError: _testcapi - RegrTest('test_getopt.py', enabled=False, dumbtest=1), + RegrTest('test_getopt.py', enabled=True, dumbtest=1), RegrTest('test_gettext.py', enabled=False), #rev 10840: 28 of 28 tests fail @@ -461,13 +461,13 @@ RegrTest('test_itertools.py', enabled=True), # modified version in pypy/lib/test2 - RegrTest('test_largefile.py', enabled=False, dumbtest=1), + RegrTest('test_largefile.py', enabled=True, dumbtest=1), RegrTest('test_linuxaudiodev.py', enabled=False), RegrTest('test_locale.py', enabled=False, dumbtest=1), RegrTest('test_logging.py', enabled=False), RegrTest('test_long.py', enabled=True, dumbtest=1), RegrTest('test_long_future.py', enabled=False, dumbtest=1), - RegrTest('test_longexp.py', enabled=False), + RegrTest('test_longexp.py', enabled=True), RegrTest('test_macfs.py', enabled=False), RegrTest('test_macostools.py', enabled=False), RegrTest('test_macpath.py', enabled=False), @@ -478,7 +478,7 @@ RegrTest('test_mhlib.py', enabled=True), RegrTest('test_mimetools.py', enabled=True), RegrTest('test_mimetypes.py', enabled=True), - RegrTest('test_MimeWriter.py', enabled=False), + RegrTest('test_MimeWriter.py', enabled=True), RegrTest('test_minidom.py', enabled=False, dumbtest=1), RegrTest('test_mmap.py', enabled=False), RegrTest('test_module.py', enabled=False, dumbtest=1), @@ -490,7 +490,7 @@ RegrTest('test_nis.py', enabled=False), RegrTest('test_normalization.py', enabled=False), RegrTest('test_ntpath.py', enabled=False, dumbtest=1), - RegrTest('test_opcodes.py', enabled=False), + RegrTest('test_opcodes.py', enabled=True), RegrTest('test_openpty.py', enabled=False), RegrTest('test_operations.py', enabled=False), RegrTest('test_operator.py', enabled=True), @@ -501,7 +501,7 @@ #rev 10840: 18 of 18 tests fail RegrTest('test_pep247.py', enabled=False, dumbtest=1), - RegrTest('test_pep263.py', enabled=False, dumbtest=1), + RegrTest('test_pep263.py', enabled=True, dumbtest=1), RegrTest('test_pep277.py', enabled=False), # XXX this test is _also_ an output test, damn it # seems to be the only one that invokes run_unittest @@ -512,8 +512,8 @@ RegrTest('test_pkgimport.py', enabled=True), RegrTest('test_plistlib.py', enabled=False), RegrTest('test_poll.py', enabled=False), - RegrTest('test_popen.py', enabled=False), - RegrTest('test_popen2.py', enabled=False), + RegrTest('test_popen.py', enabled=True), + RegrTest('test_popen2.py', enabled=True), RegrTest('test_posix.py', enabled=True), RegrTest('test_posixpath.py', enabled=True), RegrTest('test_pow.py', enabled=True), From hpk at codespeak.net Sun May 1 01:59:04 2005 From: hpk at codespeak.net (hpk at codespeak.net) Date: Sun, 1 May 2005 01:59:04 +0200 (CEST) Subject: [pypy-svn] r11676 - pypy/dist/lib-python-2.3.4/test Message-ID: <20050430235904.3489127BDA@code1.codespeak.net> Author: hpk Date: Sun May 1 01:59:04 2005 New Revision: 11676 Modified: pypy/dist/lib-python-2.3.4/test/conftest.py Log: enabled a couple of more tests Modified: pypy/dist/lib-python-2.3.4/test/conftest.py ============================================================================== --- pypy/dist/lib-python-2.3.4/test/conftest.py (original) +++ pypy/dist/lib-python-2.3.4/test/conftest.py Sun May 1 01:59:04 2005 @@ -324,7 +324,7 @@ RegrTest('test_binop.py', enabled=True), RegrTest('test_bisect.py', enabled=True), - RegrTest('test_bool.py', enabled=False), + RegrTest('test_bool.py', enabled=True), #rev 10840: Infinite recursion in DescrOperation.is_true RegrTest('test_bsddb.py', enabled=False), @@ -445,9 +445,9 @@ RegrTest('test_htmllib.py', enabled=True), RegrTest('test_htmlparser.py', enabled=True), - RegrTest('test_httplib.py', enabled=False), + RegrTest('test_httplib.py', enabled=True), RegrTest('test_imageop.py', enabled=False, dumbtest=1), - RegrTest('test_imaplib.py', enabled=False, dumbtest=1), + RegrTest('test_imaplib.py', enabled=True, dumbtest=1), RegrTest('test_imgfile.py', enabled=False, dumbtest=1), RegrTest('test_imp.py', enabled=False), RegrTest('test_import.py', enabled=False, dumbtest=1), @@ -470,9 +470,9 @@ RegrTest('test_longexp.py', enabled=True), RegrTest('test_macfs.py', enabled=False), RegrTest('test_macostools.py', enabled=False), - RegrTest('test_macpath.py', enabled=False), + RegrTest('test_macpath.py', enabled=True), RegrTest('test_mailbox.py', enabled=True), - RegrTest('test_marshal.py', enabled=False, dumbtest=1), + RegrTest('test_marshal.py', enabled=True, dumbtest=1), RegrTest('test_math.py', enabled=False), RegrTest('test_md5.py', enabled=False), RegrTest('test_mhlib.py', enabled=True), @@ -489,7 +489,7 @@ RegrTest('test_new.py', enabled=False), RegrTest('test_nis.py', enabled=False), RegrTest('test_normalization.py', enabled=False), - RegrTest('test_ntpath.py', enabled=False, dumbtest=1), + RegrTest('test_ntpath.py', enabled=True, dumbtest=1), RegrTest('test_opcodes.py', enabled=True), RegrTest('test_openpty.py', enabled=False), RegrTest('test_operations.py', enabled=False), @@ -527,7 +527,7 @@ RegrTest('test_pyclbr.py', enabled=False), RegrTest('test_pyexpat.py', enabled=False), RegrTest('test_queue.py', enabled=False, dumbtest=1), - RegrTest('test_quopri.py', enabled=False), + RegrTest('test_quopri.py', enabled=True), RegrTest('test_random.py', enabled=False), #rev 10840: Uncaught app-level exception: #class WichmannHill_TestBasicOps(TestBasicOps): @@ -563,7 +563,7 @@ RegrTest('test_shlex.py', enabled=True), RegrTest('test_shutil.py', enabled=True), RegrTest('test_signal.py', enabled=False), - RegrTest('test_slice.py', enabled=False, dumbtest=1), + RegrTest('test_slice.py', enabled=True, dumbtest=1), RegrTest('test_socket.py', enabled=False), #rev 10840: ImportError: thread @@ -571,7 +571,7 @@ RegrTest('test_socketserver.py', enabled=False), #rev 10840: ImportError: thread - RegrTest('test_softspace.py', enabled=False, dumbtest=1), + RegrTest('test_softspace.py', enabled=True, dumbtest=1), RegrTest('test_sort.py', enabled=False, dumbtest=1), RegrTest('test_str.py', enabled=False), #rev 10840: at least two tests fail, after several hours I gave up waiting for the rest @@ -579,7 +579,7 @@ RegrTest('test_strftime.py', enabled=False, dumbtest=1), RegrTest('test_string.py', enabled=True), RegrTest('test_StringIO.py', enabled=True), - RegrTest('test_stringprep.py', enabled=False, dumbtest=1), + RegrTest('test_stringprep.py', enabled=True, dumbtest=1), RegrTest('test_strop.py', enabled=False), #rev 10840: ImportError: strop @@ -630,19 +630,13 @@ RegrTest('test_unicode_file.py', enabled=False), RegrTest('test_unicodedata.py', enabled=False), RegrTest('test_univnewlines.py', enabled=True), - RegrTest('test_unpack.py', enabled=False, dumbtest=1), + RegrTest('test_unpack.py', enabled=True, dumbtest=1), RegrTest('test_urllib.py', enabled=True), - #rev 10840: 10 of 10 tests fail - - RegrTest('test_urllib2.py', enabled=False, dumbtest=1), + RegrTest('test_urllib2.py', enabled=True, dumbtest=1), RegrTest('test_urllibnet.py', enabled=False), RegrTest('test_urlparse.py', enabled=True), RegrTest('test_userdict.py', enabled=True), - #rev 10840: 5 of 25 tests fail - - RegrTest('test_userlist.py', enabled=False), - #rev 10840: at least two tests fail, after several hours I gave up waiting for the rest - + RegrTest('test_userlist.py', enabled=True), RegrTest('test_userstring.py', enabled=False), RegrTest('test_uu.py', enabled=False), #rev 10840: 1 of 9 test fails @@ -652,7 +646,7 @@ RegrTest('test_weakref.py', enabled=False), #rev 10840: ImportError: _weakref - RegrTest('test_whichdb.py', enabled=False), + RegrTest('test_whichdb.py', enabled=True), RegrTest('test_winreg.py', enabled=False), RegrTest('test_winsound.py', enabled=False), RegrTest('test_xmllib.py', enabled=False), From hpk at codespeak.net Sun May 1 13:38:15 2005 From: hpk at codespeak.net (hpk at codespeak.net) Date: Sun, 1 May 2005 13:38:15 +0200 (CEST) Subject: [pypy-svn] r11684 - in pypy/dist: . lib-python lib-python-2.3.4 lib-python/2.3.4 lib-python/2.3.4/test lib-python/attic lib-python/modified-2.3.4 lib-python/modified-2.3.4/test pypy/lib pypy/lib/test2 pypy/module/sys2 Message-ID: <20050501113815.00CA027BE2@code1.codespeak.net> Author: hpk Date: Sun May 1 13:38:15 2005 New Revision: 11684 Added: pypy/dist/lib-python/ pypy/dist/lib-python/2.3.4/ - copied from r11683, pypy/dist/lib-python-2.3.4/ pypy/dist/lib-python/attic/ pypy/dist/lib-python/attic/README.regex - copied unchanged from r11683, pypy/dist/pypy/lib/README.regex pypy/dist/lib-python/attic/dumbre.py - copied unchanged from r11683, pypy/dist/pypy/lib/dumbre.py pypy/dist/lib-python/attic/plexre.py - copied unchanged from r11683, pypy/dist/pypy/lib/plexre.py pypy/dist/lib-python/attic/re.py - copied unchanged from r11683, pypy/dist/pypy/lib/_re_bak.py pypy/dist/lib-python/attic/sre_adapt.py - copied unchanged from r11683, pypy/dist/pypy/lib/sre_adapt.py pypy/dist/lib-python/attic/test_cmathmodule.py - copied unchanged from r11683, pypy/dist/pypy/lib/test2/test_cmathmodule.py pypy/dist/lib-python/conftest.py - copied, changed from r11683, pypy/dist/lib-python-2.3.4/test/conftest.py pypy/dist/lib-python/modified-2.3.4/ (props changed) pypy/dist/lib-python/modified-2.3.4/codecs.py (props changed) - copied unchanged from r11683, pypy/dist/pypy/lib/codecs.py pypy/dist/lib-python/modified-2.3.4/test/ (props changed) pypy/dist/lib-python/modified-2.3.4/test/__init__.py (contents, props changed) pypy/dist/lib-python/modified-2.3.4/test/pickletester.py - copied unchanged from r11683, pypy/dist/pypy/lib/test2/pickletester.py pypy/dist/lib-python/modified-2.3.4/test/pystone.py - copied unchanged from r11683, pypy/dist/pypy/lib/test2/pystone.py pypy/dist/lib-python/modified-2.3.4/test/test_class.py (props changed) - copied unchanged from r11683, pypy/dist/pypy/lib/test2/test_class.py pypy/dist/lib-python/modified-2.3.4/test/test_codeccallbacks.py - copied unchanged from r11683, pypy/dist/pypy/lib/test2/test_codeccallbacks.py pypy/dist/lib-python/modified-2.3.4/test/test_coercion.py - copied unchanged from r11683, pypy/dist/pypy/lib/test2/test_coercion.py pypy/dist/lib-python/modified-2.3.4/test/test_enumerate.py (props changed) - copied unchanged from r11683, pypy/dist/pypy/lib/test2/test_enumerate.py pypy/dist/lib-python/modified-2.3.4/test/test_funcattrs.py - copied unchanged from r11683, pypy/dist/pypy/lib/test2/test_funcattrs.py pypy/dist/lib-python/modified-2.3.4/test/test_itertools.py - copied unchanged from r11683, pypy/dist/pypy/lib/test2/test_itertools.py pypy/dist/lib-python/modified-2.3.4/test/test_optparse.py - copied unchanged from r11683, pypy/dist/pypy/lib/test2/test_optparse.py pypy/dist/lib-python/modified-2.3.4/test/test_sha.py - copied unchanged from r11683, pypy/dist/pypy/lib/test2/test_sha.py pypy/dist/lib-python/modified-2.3.4/test/test_struct.py - copied unchanged from r11683, pypy/dist/pypy/lib/test2/test_struct.py pypy/dist/lib-python/modified-2.3.4/test/test_types.py - copied unchanged from r11683, pypy/dist/pypy/lib/test2/test_types.py pypy/dist/lib-python/modified-2.3.4/traceback.py - copied unchanged from r11683, pypy/dist/pypy/lib/traceback.py pypy/dist/lib-python/modified-2.3.4/types.py - copied unchanged from r11683, pypy/dist/pypy/lib/types.py pypy/dist/lib-python/modified-2.3.4/warnings.py - copied unchanged from r11683, pypy/dist/pypy/lib/warnings.py pypy/dist/pypy/lib/test2/FIXME_test_binascii_extra.py - copied unchanged from r11683, pypy/dist/pypy/lib/test2/test_binascii_extra.py pypy/dist/pypy/lib/test2/FIXME_test_file_extra.py - copied unchanged from r11683, pypy/dist/pypy/lib/test2/test_file.py pypy/dist/pypy/lib/test2/FIXME_test_sio.py - copied unchanged from r11683, pypy/dist/pypy/lib/test2/test_sio.py pypy/dist/pypy/lib/test2/test_exceptions_extra.py - copied, changed from r11683, pypy/dist/pypy/lib/test2/test_exceptions.py Removed: pypy/dist/lib-python-2.3.4/ pypy/dist/lib-python/2.3.4/test/conftest.py pypy/dist/lib-python/2.3.4/test/pypy_unittest.py pypy/dist/pypy/lib/README.regex pypy/dist/pypy/lib/_re_bak.py pypy/dist/pypy/lib/codecs.py pypy/dist/pypy/lib/dumbre.py pypy/dist/pypy/lib/plexre.py pypy/dist/pypy/lib/sre_adapt.py pypy/dist/pypy/lib/test2/autopath.py pypy/dist/pypy/lib/test2/conftest.py pypy/dist/pypy/lib/test2/pickletester.py pypy/dist/pypy/lib/test2/pystone.py pypy/dist/pypy/lib/test2/support_tests.py pypy/dist/pypy/lib/test2/test_binascii_extra.py pypy/dist/pypy/lib/test2/test_class.py pypy/dist/pypy/lib/test2/test_cmathmodule.py pypy/dist/pypy/lib/test2/test_codeccallbacks.py pypy/dist/pypy/lib/test2/test_coercion.py pypy/dist/pypy/lib/test2/test_enumerate.py pypy/dist/pypy/lib/test2/test_exceptions.py pypy/dist/pypy/lib/test2/test_file.py pypy/dist/pypy/lib/test2/test_funcattrs.py pypy/dist/pypy/lib/test2/test_itertools.py pypy/dist/pypy/lib/test2/test_optparse.py pypy/dist/pypy/lib/test2/test_sha.py pypy/dist/pypy/lib/test2/test_sio.py pypy/dist/pypy/lib/test2/test_struct.py pypy/dist/pypy/lib/test2/test_types.py pypy/dist/pypy/lib/traceback.py pypy/dist/pypy/lib/types.py pypy/dist/pypy/lib/warnings.py Modified: pypy/dist/ (props changed) pypy/dist/lib-python/2.3.4/test/ (props changed) pypy/dist/pypy/module/sys2/state.py Log: reshuffling and clean up of directory hierarchy with special respect to modified modules for pypy this is the new structure lib-python/2.3.4 # unmodified standard python library lib-python/modified-2.3.4 # slightly modified modules and tests pypy/lib/*.py # PyPy's reimplementation of (usually C-) modules for more info follow pypy-dev ... (holger, armin) Deleted: /pypy/dist/lib-python-2.3.4/test/conftest.py ============================================================================== --- /pypy/dist/lib-python-2.3.4/test/conftest.py Sun May 1 13:38:15 2005 +++ (empty file) @@ -1,839 +0,0 @@ -import py -import sys -import pypy -from pypy.interpreter.gateway import ApplevelClass -from pypy.interpreter.error import OperationError -from pypy.tool import pytestsupport -from pypy.interpreter.module import Module as PyPyModule -from pypy.interpreter.main import run_string, run_file - -# the following adds command line options as a side effect! -from pypy.conftest import gettestobjspace, option as pypy_option -from test.regrtest import reportdiff -from test import pystone - -# -# Interfacing/Integrating with py.test's collection process -# - -# XXX no nice way to implement a --listpassing py.test option?! -#option = py.test.addoptions("compliance testing options", -# py.test.Option('-L', '--listpassing', action="store", default=None, -# type="string", dest="listpassing", -# help="just display the list of expected-to-pass tests.") - -Option = py.test.Config.Option -option = py.test.Config.addoptions("compliance testing options", - Option('-D', '--withdisabled', action="store_true", - default=False, dest="withdisabled", - help="include all disabled tests in the test run."), - Option('-E', '--extracttests', action="store_true", - default=False, dest="extracttests", - help="try to extract single tests and run them via py.test/PyPy"), - Option('-T', '--timeout', action="store", type="string", - default="100mp", dest="timeout", - help="fail a test module after the given timeout. " - "specify in seconds or 'XXXmp' aka Mega-Pystones") - ) - -def gettimeout(): - timeout = option.timeout.lower() - if timeout.endswith('mp'): - megapystone = float(timeout[:-2]) - t, stone = pystone.Proc0(10000) - pystonetime = t/stone - seconds = megapystone * 1000000 * pystonetime - return seconds - return float(timeout) - -mydir = py.magic.autopath().dirpath() -pypydir = py.path.local(pypy.__file__).dirpath() - -def callex(space, func, *args, **kwargs): - try: - return func(*args, **kwargs) - except OperationError, e: - ilevelinfo = py.code.ExceptionInfo() - if e.match(space, space.w_KeyboardInterrupt): - raise KeyboardInterrupt - appexcinfo=pytestsupport.AppExceptionInfo(space, e) - if appexcinfo.traceback: - print "appexcinfo.traceback:" - py.std.pprint.pprint(appexcinfo.traceback) - raise py.test.Item.Failed(excinfo=appexcinfo) - raise py.test.Item.Failed(excinfo=ilevelinfo) - -# -# compliance modules where we invoke test_main() usually call into -# test_support.(run_suite|run_doctests) -# we intercept those calls and use the provided information -# for our collection process. This allows us to run all the -# tests one by one. -# - -app = ApplevelClass(''' - #NOT_RPYTHON - - import unittest - from test import test_support - import sys - - def getmethods(suite_or_class): - """ flatten out suites down to TestCase instances/methods. """ - if isinstance(suite_or_class, unittest.TestCase): - res = [suite_or_class] - elif isinstance(suite_or_class, unittest.TestSuite): - res = [] - for x in suite_or_class._tests: - res.extend(getmethods(x)) - elif isinstance(suite_or_class, list): - res = [] - for x in suite_or_class: - res.extend(getmethods(x)) - else: - raise TypeError, "expected TestSuite or TestClass, got %r" %(suite_or_class) - return res - - # - # exported API - # - - def intercept_test_support(): - """ intercept calls to test_support.run_doctest and run_suite. - Return doctestmodules, suites which will hold collected - items from these test_support invocations. - """ - suites = [] - doctestmodules = [] - def hack_run_doctest(module, verbose=None): - doctestmodules.append(module) - test_support.run_doctest = hack_run_doctest - - def hack_run_suite(suite, testclass=None): - suites.append(suite) - test_support.run_suite = hack_run_suite - return suites, doctestmodules - - def collect_intercepted(suites, doctestmodules): - namemethodlist = [] - for method in getmethods(suites): - name = (method.__class__.__name__ + '.' + - method._TestCase__testMethodName) - namemethodlist.append((name, method)) - doctestlist = [] - for mod in doctestmodules: - doctestlist.append((mod.__name__, mod)) - return namemethodlist, doctestlist - - def run_testcase_method(method): - method.setUp() - try: - method() - finally: - method.tearDown() - - def set_argv(filename): - sys.argv[:] = ['python', filename] -''') - -intercept_test_support = app.interphook('intercept_test_support') -collect_intercepted = app.interphook('collect_intercepted') -run_testcase_method = app.interphook('run_testcase_method') -set_argv = app.interphook('set_argv') - -def start_intercept(space): - w_suites, w_doctestmodules = space.unpacktuple(intercept_test_support(space)) - return w_suites, w_doctestmodules - -def collect_intercept(space, w_suites, w_doctestmodules): - w_result = callex(space, collect_intercepted, space, w_suites, w_doctestmodules) - w_namemethods, w_doctestlist = space.unpacktuple(w_result) - return w_namemethods, w_doctestlist - -class SimpleRunItem(py.test.Item): - """ Run a module file and compare its output - to the expected output in the output/ directory. - """ - def call_capture(self, space, func, *args): - regrtest = self.parent.regrtest - oldsysout = sys.stdout - sys.stdout = capturesysout = py.std.cStringIO.StringIO() - try: - try: - res = regrtest.run_file(space) - except: - print capturesysout.getvalue() - raise - else: - return res, capturesysout.getvalue() - finally: - sys.stdout = oldsysout - - def run(self): - # XXX integrate this into InterceptedRunModule - # but we want a py.test refactoring towards - # more autonomy of colitems regarding - # their representations - regrtest = self.parent.regrtest - space = gettestobjspace() - res, output = self.call_capture(space, regrtest.run_file, space) - - outputpath = regrtest.getoutputpath() - if outputpath: - # we want to compare outputs - # regrtest itself prepends the test_name to the captured output - result = outputpath.purebasename + "\n" + output - expected = outputpath.read(mode='r') - if result != expected: - reportdiff(expected, result) - py.test.fail("output check failed: %s" % (self.fspath.basename,)) - if output: - print output, - -# -class InterceptedRunModule(py.test.collect.Module): - """ special handling for tests with a proper 'def test_main(): ' - definition invoking test_support.run_suite or run_unittest - (XXX add support for test_support.run_doctest). - """ - def __init__(self, name, parent, regrtest): - super(InterceptedRunModule, self).__init__(name, parent) - self.regrtest = regrtest - self.fspath = regrtest.getfspath() - - def _prepare(self): - if hasattr(self, 'name2item'): - return - self.name2item = {} - space = gettestobjspace() - if self.regrtest.dumbtest or self.regrtest.getoutputpath(): - self.name2item['output'] = SimpleRunItem('output', self) - return - - tup = start_intercept(space) - self.regrtest.run_file(space) - w_namemethods, w_doctestlist = collect_intercept(space, *tup) - - # setup {name -> wrapped testcase method} - for w_item in space.unpackiterable(w_namemethods): - w_name, w_method = space.unpacktuple(w_item) - name = space.str_w(w_name) - testitem = AppTestCaseMethod(name, parent=self, w_method=w_method) - self.name2item[name] = testitem - - # setup {name -> wrapped doctest module} - for w_item in space.unpackiterable(w_doctestlist): - w_name, w_module = space.unpacktuple(w_item) - name = space.str_w(w_name) - testitem = AppDocTestModule(name, parent=self, w_module=w_module) - self.name2item[name] = testitem - - def run(self): - self._prepare() - keys = self.name2item.keys() - keys.sort(lambda x,y: cmp(x.lower(), y.lower())) - return keys - - def join(self, name): - self._prepare() - try: - return self.name2item[name] - except KeyError: - pass - -class AppDocTestModule(py.test.Item): - def __init__(self, name, parent, w_module): - super(AppDocTestModule, self).__init__(name, parent) - self.w_module = w_module - - def run(self): - py.test.skip("application level doctest modules not supported yet.") - -class AppTestCaseMethod(py.test.Item): - def __init__(self, name, parent, w_method): - super(AppTestCaseMethod, self).__init__(name, parent) - self.space = gettestobjspace() - self.w_method = w_method - - def run(self): - space = self.space - filename = str(self.fspath) - callex(space, set_argv, space, space.wrap(filename)) - callex(space, run_testcase_method, space, self.w_method) - -# ________________________________________________________________________ -# -# classification of all tests files (this is ongoing work) -# - -class RegrTest: - """ Regression Test Declaration.""" - modifiedtestdir = pypydir.join('lib', 'test2') - def __init__(self, basename, enabled=False, dumbtest=False, oldstyle=False): - self.basename = basename - self.enabled = enabled - self.dumbtest = dumbtest - self.oldstyle = oldstyle - - def ismodified(self): - return self.modifiedtestdir.join(self.basename).check() - - def getfspath(self): - fn = self.modifiedtestdir.join(self.basename) - if fn.check(): - return fn - fn = mydir.join(self.basename) - return fn - - def getoutputpath(self): - p = mydir.join('output', self.basename).new(ext='') - if p.check(file=1): - return p - - def run_file(self, space): - fspath = self.getfspath() - assert fspath.check() - if self.oldstyle or pypy_option.oldstyle: - space.enable_old_style_classes_as_default_metaclass() - try: - callex(space, run_file, str(fspath), space) - finally: - if not pypy_option.oldstyle: - space.enable_new_style_classes_as_default_metaclass() - -testmap = [ - RegrTest('test___all__.py', enabled=False), - RegrTest('test___future__.py', enabled=True, dumbtest=1), - RegrTest('test_aepack.py', enabled=False), - RegrTest('test_al.py', enabled=False, dumbtest=1), - RegrTest('test_anydbm.py', enabled=True), - RegrTest('test_array.py', enabled=False), - #rev 10840: Uncaught interp-level exception: Same place as test_cfgparser - - RegrTest('test_asynchat.py', enabled=False), - RegrTest('test_atexit.py', enabled=False, dumbtest=1), - RegrTest('test_audioop.py', enabled=False, dumbtest=1), - RegrTest('test_augassign.py', enabled=True), - RegrTest('test_base64.py', enabled=True), - RegrTest('test_bastion.py', enabled=True, dumbtest=1), - RegrTest('test_binascii.py', enabled=False), - #rev 10840: 2 of 8 tests fail - - RegrTest('test_binhex.py', enabled=False), - #rev 10840: 1 of 1 test fails - - RegrTest('test_binop.py', enabled=True), - RegrTest('test_bisect.py', enabled=True), - RegrTest('test_bool.py', enabled=True), - #rev 10840: Infinite recursion in DescrOperation.is_true - - RegrTest('test_bsddb.py', enabled=False), - RegrTest('test_bsddb185.py', enabled=False), - RegrTest('test_bsddb3.py', enabled=False), - RegrTest('test_bufio.py', enabled=False, dumbtest=1), - RegrTest('test_builtin.py', enabled=True), - RegrTest('test_bz2.py', enabled=False), - RegrTest('test_calendar.py', enabled=True), - RegrTest('test_call.py', enabled=True), - RegrTest('test_capi.py', enabled=False, dumbtest=1), - RegrTest('test_cd.py', enabled=False, dumbtest=1), - RegrTest('test_cfgparser.py', enabled=False), - #rev 10840: Uncaught interp-level exception: - #File "pypy/objspace/std/fake.py", line 133, in setfastscope - #raise UnwrapError('calling %s: %s' % (self.code.cpy_callable, e)) - #pypy.objspace.std.model.UnwrapError: calling : cannot unwrap > - - RegrTest('test_cgi.py', enabled=True), - RegrTest('test_charmapcodec.py', enabled=True), - RegrTest('test_cl.py', enabled=False, dumbtest=1), - RegrTest('test_class.py', enabled=False, oldstyle=True), - RegrTest('test_cmath.py', enabled=True, dumbtest=1), - RegrTest('test_codeccallbacks.py', enabled=False), - #rev 10840: Uncaught interp-level exception: Same place as test_cfgparser - - RegrTest('test_codecs.py', enabled=False), - #rev 10840: Uncaught interp-level exception: Same place as test_cfgparser - - RegrTest('test_codeop.py', enabled=True), - RegrTest('test_coercion.py', enabled=False, oldstyle=True), - # needed changes because our exceptions are new-style and so have a different str(.) behavior - RegrTest('test_commands.py', enabled=True), - RegrTest('test_compare.py', enabled=True, oldstyle=True), - RegrTest('test_compile.py', enabled=True), - RegrTest('test_complex.py', enabled=False), - #rev 10840: at least one test fails, after several hours I gave up waiting for the rest - - RegrTest('test_contains.py', enabled=True, dumbtest=1), - RegrTest('test_cookie.py', enabled=False), - RegrTest('test_copy.py', enabled=True), - RegrTest('test_copy_reg.py', enabled=True), - RegrTest('test_cpickle.py', enabled=False), - RegrTest('test_crypt.py', enabled=False, dumbtest=1), - RegrTest('test_csv.py', enabled=False), - #rev 10840: ImportError: _csv - - RegrTest('test_curses.py', enabled=False, dumbtest=1), - RegrTest('test_datetime.py', enabled=True), - RegrTest('test_dbm.py', enabled=False, dumbtest=1), - RegrTest('test_descr.py', enabled=False), - RegrTest('test_descrtut.py', enabled=False), - #rev 10840: 19 of 96 tests fail - - RegrTest('test_difflib.py', enabled=True, dumbtest=1), - RegrTest('test_dircache.py', enabled=True), - RegrTest('test_dis.py', enabled=True), - RegrTest('test_dl.py', enabled=False, dumbtest=1), - RegrTest('test_doctest.py', enabled=True), - RegrTest('test_doctest2.py', enabled=True), - RegrTest('test_dumbdbm.py', enabled=True), - #rev 10840: 5 of 7 tests fail - - RegrTest('test_dummy_thread.py', enabled=True), - RegrTest('test_dummy_threading.py', enabled=True, dumbtest=1), - RegrTest('test_email.py', enabled=False), - #rev 10840: Uncaught interp-level exception - - RegrTest('test_email_codecs.py', enabled=False, dumbtest=1), - RegrTest('test_enumerate.py', enabled=True), - RegrTest('test_eof.py', enabled=False), - #rev 10840: some error strings differ slightly XXX - - RegrTest('test_errno.py', enabled=True, dumbtest=1), - RegrTest('test_exceptions.py', enabled=False), - RegrTest('test_extcall.py', enabled=False), - RegrTest('test_fcntl.py', enabled=False, dumbtest=1), - RegrTest('test_file.py', enabled=False, dumbtest=1), - RegrTest('test_filecmp.py', enabled=True), - RegrTest('test_fileinput.py', enabled=True, dumbtest=1), - RegrTest('test_fnmatch.py', enabled=True), - RegrTest('test_fork1.py', enabled=False, dumbtest=1), - RegrTest('test_format.py', enabled=False, dumbtest=1), - RegrTest('test_fpformat.py', enabled=True), - RegrTest('test_frozen.py', enabled=False), - RegrTest('test_funcattrs.py', enabled=True, dumbtest=1), - RegrTest('test_future.py', enabled=True), - RegrTest('test_future1.py', enabled=True, dumbtest=1), - RegrTest('test_future2.py', enabled=True, dumbtest=1), - RegrTest('test_future3.py', enabled=True), - RegrTest('test_gc.py', enabled=False, dumbtest=1), - RegrTest('test_gdbm.py', enabled=False, dumbtest=1), - RegrTest('test_generators.py', enabled=False), - #rev 10840: 30 of 152 tests fail - - RegrTest('test_getargs.py', enabled=False, dumbtest=1), - RegrTest('test_getargs2.py', enabled=False), - #rev 10840: ImportError: _testcapi - - RegrTest('test_getopt.py', enabled=True, dumbtest=1), - RegrTest('test_gettext.py', enabled=False), - #rev 10840: 28 of 28 tests fail - - RegrTest('test_gl.py', enabled=False, dumbtest=1), - RegrTest('test_glob.py', enabled=True), - RegrTest('test_global.py', enabled=False), - RegrTest('test_grammar.py', enabled=False), - RegrTest('test_grp.py', enabled=False), - #rev 10840: ImportError: grp - - RegrTest('test_gzip.py', enabled=False, dumbtest=1), - RegrTest('test_hash.py', enabled=True), - RegrTest('test_heapq.py', enabled=True), - RegrTest('test_hexoct.py', enabled=True), - RegrTest('test_hmac.py', enabled=True), - RegrTest('test_hotshot.py', enabled=False), - #rev 10840: ImportError: _hotshot - - RegrTest('test_htmllib.py', enabled=True), - RegrTest('test_htmlparser.py', enabled=True), - RegrTest('test_httplib.py', enabled=True), - RegrTest('test_imageop.py', enabled=False, dumbtest=1), - RegrTest('test_imaplib.py', enabled=True, dumbtest=1), - RegrTest('test_imgfile.py', enabled=False, dumbtest=1), - RegrTest('test_imp.py', enabled=False), - RegrTest('test_import.py', enabled=False, dumbtest=1), - RegrTest('test_importhooks.py', enabled=False), - RegrTest('test_inspect.py', enabled=False, dumbtest=1), - RegrTest('test_ioctl.py', enabled=False), - RegrTest('test_isinstance.py', enabled=True), - RegrTest('test_iter.py', enabled=False), - #rev 10840: Uncaught interp-level exception: Same place as test_cfgparser - - RegrTest('test_itertools.py', enabled=True), - # modified version in pypy/lib/test2 - - RegrTest('test_largefile.py', enabled=True, dumbtest=1), - RegrTest('test_linuxaudiodev.py', enabled=False), - RegrTest('test_locale.py', enabled=False, dumbtest=1), - RegrTest('test_logging.py', enabled=False), - RegrTest('test_long.py', enabled=True, dumbtest=1), - RegrTest('test_long_future.py', enabled=False, dumbtest=1), - RegrTest('test_longexp.py', enabled=True), - RegrTest('test_macfs.py', enabled=False), - RegrTest('test_macostools.py', enabled=False), - RegrTest('test_macpath.py', enabled=True), - RegrTest('test_mailbox.py', enabled=True), - RegrTest('test_marshal.py', enabled=True, dumbtest=1), - RegrTest('test_math.py', enabled=False), - RegrTest('test_md5.py', enabled=False), - RegrTest('test_mhlib.py', enabled=True), - RegrTest('test_mimetools.py', enabled=True), - RegrTest('test_mimetypes.py', enabled=True), - RegrTest('test_MimeWriter.py', enabled=True), - RegrTest('test_minidom.py', enabled=False, dumbtest=1), - RegrTest('test_mmap.py', enabled=False), - RegrTest('test_module.py', enabled=False, dumbtest=1), - RegrTest('test_mpz.py', enabled=False, dumbtest=1), - RegrTest('test_multifile.py', enabled=True), - RegrTest('test_mutants.py', enabled=False, dumbtest=1), - RegrTest('test_netrc.py', enabled=True), - RegrTest('test_new.py', enabled=False), - RegrTest('test_nis.py', enabled=False), - RegrTest('test_normalization.py', enabled=False), - RegrTest('test_ntpath.py', enabled=True, dumbtest=1), - RegrTest('test_opcodes.py', enabled=True), - RegrTest('test_openpty.py', enabled=False), - RegrTest('test_operations.py', enabled=False), - RegrTest('test_operator.py', enabled=True), - RegrTest('test_optparse.py', enabled=False), - RegrTest('test_os.py', enabled=True), - RegrTest('test_ossaudiodev.py', enabled=False), - RegrTest('test_parser.py', enabled=True), - #rev 10840: 18 of 18 tests fail - - RegrTest('test_pep247.py', enabled=False, dumbtest=1), - RegrTest('test_pep263.py', enabled=True, dumbtest=1), - RegrTest('test_pep277.py', enabled=False), - # XXX this test is _also_ an output test, damn it - # seems to be the only one that invokes run_unittest - # and is an unittest - RegrTest('test_pickle.py', enabled=False), - RegrTest('test_pickletools.py', enabled=False, dumbtest=1), - RegrTest('test_pkg.py', enabled=False), - RegrTest('test_pkgimport.py', enabled=True), - RegrTest('test_plistlib.py', enabled=False), - RegrTest('test_poll.py', enabled=False), - RegrTest('test_popen.py', enabled=True), - RegrTest('test_popen2.py', enabled=True), - RegrTest('test_posix.py', enabled=True), - RegrTest('test_posixpath.py', enabled=True), - RegrTest('test_pow.py', enabled=True), - RegrTest('test_pprint.py', enabled=True), - RegrTest('test_profile.py', enabled=True), - RegrTest('test_profilehooks.py', enabled=True), - RegrTest('test_pty.py', enabled=False), - RegrTest('test_pwd.py', enabled=False), - #rev 10840: ImportError: pwd - - RegrTest('test_pyclbr.py', enabled=False), - RegrTest('test_pyexpat.py', enabled=False), - RegrTest('test_queue.py', enabled=False, dumbtest=1), - RegrTest('test_quopri.py', enabled=True), - RegrTest('test_random.py', enabled=False), - #rev 10840: Uncaught app-level exception: - #class WichmannHill_TestBasicOps(TestBasicOps): - #File "test_random.py", line 125 in WichmannHill_TestBasicOps - #gen = random.WichmannHill() - #AttributeError: 'module' object has no attribute 'WichmannHill' - - RegrTest('test_re.py', enabled=False), - #rev 10840: 7 of 47 tests fail - - RegrTest('test_regex.py', enabled=False), - RegrTest('test_repr.py', enabled=False), - #rev 10840: 6 of 12 tests fail. Always minor stuff like - #'' != '' - - RegrTest('test_resource.py', enabled=False), - RegrTest('test_rfc822.py', enabled=True), - RegrTest('test_rgbimg.py', enabled=False), - RegrTest('test_richcmp.py', enabled=False), - #rev 10840: 1 of 11 test fails. The failing one had an infinite recursion. - - RegrTest('test_robotparser.py', enabled=True), - RegrTest('test_rotor.py', enabled=False), - RegrTest('test_sax.py', enabled=False, dumbtest=1), - RegrTest('test_scope.py', enabled=True), - RegrTest('test_scriptpackages.py', enabled=False), - RegrTest('test_select.py', enabled=False, dumbtest=1), - RegrTest('test_sets.py', enabled=True), - RegrTest('test_sgmllib.py', enabled=True), - RegrTest('test_sha.py', enabled=True), - # one test is taken out (too_slow_test_case_3), rest passses - RegrTest('test_shelve.py', enabled=True), - RegrTest('test_shlex.py', enabled=True), - RegrTest('test_shutil.py', enabled=True), - RegrTest('test_signal.py', enabled=False), - RegrTest('test_slice.py', enabled=True, dumbtest=1), - RegrTest('test_socket.py', enabled=False), - #rev 10840: ImportError: thread - - RegrTest('test_socket_ssl.py', enabled=False), - RegrTest('test_socketserver.py', enabled=False), - #rev 10840: ImportError: thread - - RegrTest('test_softspace.py', enabled=True, dumbtest=1), - RegrTest('test_sort.py', enabled=False, dumbtest=1), - RegrTest('test_str.py', enabled=False), - #rev 10840: at least two tests fail, after several hours I gave up waiting for the rest - - RegrTest('test_strftime.py', enabled=False, dumbtest=1), - RegrTest('test_string.py', enabled=True), - RegrTest('test_StringIO.py', enabled=True), - RegrTest('test_stringprep.py', enabled=True, dumbtest=1), - RegrTest('test_strop.py', enabled=False), - #rev 10840: ImportError: strop - - RegrTest('test_strptime.py', enabled=False), - #rev 10840: 1 of 42 test fails: seems to be some regex problem - - RegrTest('test_struct.py', enabled=False, dumbtest=1), - RegrTest('test_structseq.py', enabled=False, dumbtest=1), - RegrTest('test_sunaudiodev.py', enabled=False, dumbtest=1), - RegrTest('test_sundry.py', enabled=False, dumbtest=1), - # test_support is not a test - RegrTest('test_symtable.py', enabled=False, dumbtest=1), - RegrTest('test_syntax.py', enabled=True), - RegrTest('test_sys.py', enabled=True), - RegrTest('test_tarfile.py', enabled=False), - #rev 10840: 13 of 13 test fail - - RegrTest('test_tempfile.py', enabled=False), - #rev 10840: Uncaught interp-level exception: Same place as test_cfgparser - - RegrTest('test_textwrap.py', enabled=True), - RegrTest('test_thread.py', enabled=False), - RegrTest('test_threaded_import.py', enabled=False), - RegrTest('test_threadedtempfile.py', enabled=False), - #rev 10840: ImportError: thread - - RegrTest('test_threading.py', enabled=False, dumbtest=1), - #rev 10840: ImportError: thread - - RegrTest('test_time.py', enabled=True), - RegrTest('test_timeout.py', enabled=False), - #rev 10840: Uncaught interp-level exception: Same place as test_cfgparser - - RegrTest('test_timing.py', enabled=False, dumbtest=1), - RegrTest('test_tokenize.py', enabled=False), - RegrTest('test_trace.py', enabled=True), - RegrTest('test_traceback.py', enabled=False), - #rev 10840: 2 of 2 tests fail - - RegrTest('test_types.py', enabled=True), - #rev 11598: one of the mod related to dict iterators is questionable - # and questions whether how we implement them is meaningful in the - # long run - - RegrTest('test_ucn.py', enabled=False), - RegrTest('test_unary.py', enabled=True), - RegrTest('test_unicode.py', enabled=False), - RegrTest('test_unicode_file.py', enabled=False), - RegrTest('test_unicodedata.py', enabled=False), - RegrTest('test_univnewlines.py', enabled=True), - RegrTest('test_unpack.py', enabled=True, dumbtest=1), - RegrTest('test_urllib.py', enabled=True), - RegrTest('test_urllib2.py', enabled=True, dumbtest=1), - RegrTest('test_urllibnet.py', enabled=False), - RegrTest('test_urlparse.py', enabled=True), - RegrTest('test_userdict.py', enabled=True), - RegrTest('test_userlist.py', enabled=True), - RegrTest('test_userstring.py', enabled=False), - RegrTest('test_uu.py', enabled=False), - #rev 10840: 1 of 9 test fails - - RegrTest('test_warnings.py', enabled=True), - RegrTest('test_wave.py', enabled=False, dumbtest=1), - RegrTest('test_weakref.py', enabled=False), - #rev 10840: ImportError: _weakref - - RegrTest('test_whichdb.py', enabled=True), - RegrTest('test_winreg.py', enabled=False), - RegrTest('test_winsound.py', enabled=False), - RegrTest('test_xmllib.py', enabled=False), - RegrTest('test_xmlrpc.py', enabled=False), - #rev 10840: 2 of 5 tests fail - - RegrTest('test_xpickle.py', enabled=False), - RegrTest('test_xreadline.py', enabled=False), - RegrTest('test_zipfile.py', enabled=False, dumbtest=1), - RegrTest('test_zipimport.py', enabled=False), - #rev 10840: ImportError: zlib - - RegrTest('test_zlib.py', enabled=False), - #rev 10840: ImportError: zlib -] - -class RegrDirectory(py.test.collect.Directory): - """ The central hub for gathering CPython's compliance tests - Basically we work off the above 'testmap' - which describes for all test modules their specific - type. XXX If you find errors in the classification - please correct them! - """ - testmap = testmap - - def get(self, name, cache={}): - if not cache: - for x in testmap: - cache[x.basename] = x - return cache.get(name, None) - - def run(self): - return [x.basename for x in self.testmap - if x.enabled or pypy_option.withdisabled] - - def join(self, name): - regrtest = self.get(name) - if regrtest is not None: - if not option.extracttests: - return RunFileExternal(name, parent=self, regrtest=regrtest) - else: - return InterceptedRunModule(name, self, regrtest) - -Directory = RegrDirectory - - -def getrev(path): - try: - return py.path.svnwc(mydir).info().rev - except: - return 'unknown' # on windows people not always have 'svn' in their path - -class RunFileExternal(py.test.collect.Module): - def __init__(self, name, parent, regrtest): - super(RunFileExternal, self).__init__(name, parent) - self.regrtest = regrtest - self.fspath = regrtest.getfspath() - - def tryiter(self, stopitems=()): - # shortcut pre-counting of items - return [] - - def run(self): - if self.regrtest.ismodified(): - return ['modified'] - return ['unmodified'] - - def join(self, name): - return ReallyRunFileExternal(name, parent=self) - -class ReallyRunFileExternal(py.test.Item): - def run(self): - """ invoke a subprocess running the test file via PyPy. - record its output into the 'result/user at host' subdirectory. - (we might want to create subdirectories for - each user, because we will probably all produce - such result runs and they will not be the same - i am afraid. - """ - import os - import time - import socket - import getpass - regrtest = self.parent.regrtest - fspath = regrtest.getfspath() - python = sys.executable - pypy_dir = py.path.local(pypy.__file__).dirpath() - pypy_script = pypy_dir.join('interpreter', 'py.py') - alarm_script = pypy_dir.join('tool', 'alarm.py') - pypy_options = [] - if regrtest.oldstyle or pypy_option.oldstyle: - pypy_options.append('--oldstyle') - sopt = " ".join(pypy_options) - - TIMEOUT = gettimeout() - cmd = "%s %s %d %s %s %s" %(python, alarm_script, TIMEOUT, pypy_script, sopt, fspath) - try: - username = getpass.getuser() - except: - username = 'unknown' - userhost = '%s@%s' % (username, socket.gethostname()) - - if not mydir.join('result').check(dir=1): - py.test.skip("""'result' subdirectory not found. - To run tests in reporting mode (without -E), you first have to - check it out as follows into the current directory: - svn co http://codespeak.net/svn/pypy/testresult result""") - resultdir = mydir.join('result', userhost) - resultdir.ensure(dir=1) - resultfilename = resultdir.join(fspath.new(ext='.txt').basename) - resultfile = resultfilename.open('w') - if regrtest.getoutputpath(): - outputfilename = resultfilename.new(ext='.out') - outputfile = outputfilename.open('w') - print >> outputfile, self.fspath.purebasename - outputfile.close() - else: - outputfilename = None - - print >> resultfile, "testreport-version: 1.0" - print >> resultfile, "command:", cmd - print >> resultfile, "run by: %s" % userhost - print >> resultfile, "sys.platform:", sys.platform - print >> resultfile, "sys.version_info:", sys.version_info - info = try_getcpuinfo() - if info is not None: - print >>resultfile, "cpu model:", info['model name'] - print >>resultfile, "cpu mhz:", info['cpu mhz'] - - print >> resultfile, "oldstyle:", regrtest.oldstyle and 'yes' or 'no' - print >> resultfile, 'pypy-revision:', getrev(pypydir) - print >> resultfile, "startdate:", time.ctime() - print >> resultfile, "timeout: %s seconds" %(TIMEOUT,) - - print >> resultfile - if outputfilename: - print >> resultfile, "OUTPUT TEST" - print >> resultfile, "see output in:", str(outputfilename) - print >> resultfile, '='*60 - print "executing", cmd - starttime = time.time() - resultfile.close() - - if outputfilename: - status = os.system("%s >>%s 2>>%s" %(cmd, outputfilename, - resultfilename) ) - else: - status = os.system("%s >>%s 2>&1" %(cmd, resultfilename) ) - if os.WIFEXITED(status): - status = os.WEXITSTATUS(status) - else: - status = 'abnormal termination 0x%x' % status - - failure = None - resultfile = resultfilename.open('a') - if outputfilename: - expectedfilename = regrtest.getoutputpath() - expected = expectedfilename.read(mode='r') - result = outputfilename.read(mode='r') - if result != expected: - reportdiff(expected, result) - failure = "output check failed: %s" % (fspath.basename,) - print >> resultfile, 'FAILED: test output differs' - else: - print >> resultfile, 'OK' - print >> resultfile, '='*26, 'closed', '='*26 - print >> resultfile, 'execution time:', time.time() - starttime, 'seconds' - print >> resultfile, 'exit status:', status - resultfile.close() - if status != 0: - failure = "exitstatus is %d" %(status,) - #print output - if failure: - time.sleep(0.5) # time for a Ctrl-C to reach us :-) - py.test.fail(failure) - - -# -# -# -def try_getcpuinfo(): - if sys.platform.startswith('linux'): - cpuinfopath = py.path.local('/proc/cpuinfo') - d = {} - for line in cpuinfopath.readlines(): - if line.strip(): - name, value = line.split(':', 1) - name = name.strip().lower() - d[name] = value.strip() - return d Deleted: /pypy/dist/lib-python-2.3.4/test/pypy_unittest.py ============================================================================== --- /pypy/dist/lib-python-2.3.4/test/pypy_unittest.py Sun May 1 13:38:15 2005 +++ (empty file) @@ -1,66 +0,0 @@ -class TestCase: - """compatibility class of unittest's TestCase. """ - def setUp(self): - pass - - def tearDown(self): - pass - - def assertEqual(self, x, y, msg=None): - if msg: - assert x == y, msg - else: - assert x == y - - def assertNotEqual(self, x, y, msg=None): - if msg: - assert x != y, msg - else: - assert x != y - - def failIfEqual(self, x, y, msg=None): - if msg: - assert not x == y, msg - else: - assert not x == y - - def failUnless(self, expr, msg=None): - if msg is None: - assert expr - else: - assert expr, msg - - def failIf(self, expr, msg=None): - if msg is None: - assert not expr - else: - assert not expr, msg - - def fail(self, msg): - raise AssertionError(msg) - - def assertRaises(self, exc, call, *args, **kwargs): - raises(exc, call, *args, **kwargs) - - def assertAlmostEqual(self, x, y, places=7, msg=None): - if msg is None: - msg = '%r != %r within %r places' %(x, y, places) - assert round(y-x, places) == 0, msg - - def assertNotAlmostEqual(self, x, y, places=7, msg=None): - if msg is None: - msg = '%r == %r within %r places' %(x, y, places) - assert round(y-x, places) != 0, msg - - assertEquals = assertEqual - assertNotEquals = assertNotEqual - failUnlessRaises = assertRaises - failUnlessEqual = assertEqual - failIfAlmostEqual = assertNotAlmostEqual - failUnlessAlmostEqual = assertAlmostEqual - - def assert_(self, expr, msg=None): - if msg: - assert expr, msg - else: - assert expr Copied: pypy/dist/lib-python/conftest.py (from r11683, pypy/dist/lib-python-2.3.4/test/conftest.py) ============================================================================== --- pypy/dist/lib-python-2.3.4/test/conftest.py (original) +++ pypy/dist/lib-python/conftest.py Sun May 1 13:38:15 2005 @@ -46,8 +46,10 @@ return seconds return float(timeout) -mydir = py.magic.autopath().dirpath() pypydir = py.path.local(pypy.__file__).dirpath() +libpythondir = pypydir.dirpath('lib-python') +testdir = libpythondir.join('2.3.4', 'test') +modtestdir = libpythondir.join('modified-2.3.4', 'test') def callex(space, func, *args, **kwargs): try: @@ -268,7 +270,6 @@ class RegrTest: """ Regression Test Declaration.""" - modifiedtestdir = pypydir.join('lib', 'test2') def __init__(self, basename, enabled=False, dumbtest=False, oldstyle=False): self.basename = basename self.enabled = enabled @@ -276,17 +277,17 @@ self.oldstyle = oldstyle def ismodified(self): - return self.modifiedtestdir.join(self.basename).check() + return modtestdir.join(self.basename).check() def getfspath(self): - fn = self.modifiedtestdir.join(self.basename) + fn = modtestdir.join(self.basename) if fn.check(): return fn - fn = mydir.join(self.basename) + fn = testdir.join(self.basename) return fn def getoutputpath(self): - p = mydir.join('output', self.basename).new(ext='') + p = testdir.join('output', self.basename).new(ext='') if p.check(file=1): return p @@ -695,7 +696,7 @@ def getrev(path): try: - return py.path.svnwc(mydir).info().rev + return py.path.svnwc(testdir).info().rev except: return 'unknown' # on windows people not always have 'svn' in their path @@ -749,12 +750,14 @@ username = 'unknown' userhost = '%s@%s' % (username, socket.gethostname()) - if not mydir.join('result').check(dir=1): - py.test.skip("""'result' subdirectory not found. + testresultdir = pypydir.dirpath('testresult') + if not testresultdir.check(dir=1): + py.test.skip("""'testresult' directory not found. To run tests in reporting mode (without -E), you first have to - check it out as follows into the current directory: - svn co http://codespeak.net/svn/pypy/testresult result""") - resultdir = mydir.join('result', userhost) + check it out as follows: + svn co http://codespeak.net/svn/pypy/testresult %s""" % ( + testresultdir, )) + resultdir = testresultdir.join(userhost) resultdir.ensure(dir=1) resultfilename = resultdir.join(fspath.new(ext='.txt').basename) resultfile = resultfilename.open('w') Added: pypy/dist/lib-python/modified-2.3.4/test/__init__.py ============================================================================== --- (empty file) +++ pypy/dist/lib-python/modified-2.3.4/test/__init__.py Sun May 1 13:38:15 2005 @@ -0,0 +1,11 @@ +""" +This package only contains the tests that we have modified for PyPy. +It uses the 'official' hack to include the rest of the standard +'test' package from CPython. + +This assumes that sys.path is configured to contain +'lib-python/modified-2.3.4' before 'lib-python/2.3.4'. +""" + +from pkgutil import extend_path +__path__ = extend_path(__path__, __name__) Deleted: /pypy/dist/pypy/lib/README.regex ============================================================================== --- /pypy/dist/pypy/lib/README.regex Sun May 1 13:38:15 2005 +++ (empty file) @@ -1,32 +0,0 @@ -Regular Expression related modules in PyPy - -History - Seo Sanghyeon, 2005-02-01 - -See also - http://codespeak.net/pipermail/pypy-dev/2005q1/001794.html - -Following files in this directory are related to regular expression -in PyPy: re.py, dumbre.py, plexre.py, sre_adapt.py, sre_parse.py. - -re.py contains backend-neutral interfaces and utilities. - -re.py imports Pattern class, with signature __init__(self, pattern, flags), -from backends. Pattern class implements methods of _sre.SRE_Pattern, -like match and search. - -dumbre.py is a backend that exits as soon as regular expression is met. -plexre.py uses Plex module to implement regular expression. sre_adapt.py -cheats and imports CPython _sre. - -Following information is now out-of-date and incorrect: - -(fixed in r8876) -Importing CPython _sre doesn't work currently, because C types are not -succesfully faked. The reason seems to be the lack of __dict__. This is -also why we have pure Python random.py from 2.2 in this directory. - -(fixed in r8873) -sre_parse.py is patched because it uses deprecated __getslice__ in -a special way, and PyPy fails to interpret it correctly. Delete this -file when this is fixed. Deleted: /pypy/dist/pypy/lib/_re_bak.py ============================================================================== --- /pypy/dist/pypy/lib/_re_bak.py Sun May 1 13:38:15 2005 +++ (empty file) @@ -1,43 +0,0 @@ -from sre import * - -''' -# from dumbre import Pattern -# from plexre import Pattern -# from sre_adapt import Pattern - - -# Constants, from CPython -I = IGNORECASE = 2 -L = LOCALE = 4 -M = MULTILINE = 8 -S = DOTALL = 16 -U = UNICODE = 32 -X = VERBOSE = 64 - - -# From CPython -def escape(pattern): - "Escape all non-alphanumeric characters in pattern." - s = list(pattern) - for i in range(len(pattern)): - c = pattern[i] - if not ("a" <= c <= "z" or "A" <= c <= "Z" or "0" <= c <= "9"): - if c == "\000": - s[i] = "\\000" - else: - s[i] = "\\" + c - return ''.join(s) - - -_cache = {} - -def compile(pattern, flags=0): - if (pattern, flags) in _cache: - return _cache[pattern, flags] - compiled = Pattern(pattern, flags) - _cache[pattern, flags] = compiled - return compiled - -def match(pattern, string, flags=0): - return compile(pattern, flags).match(string) -''' Deleted: /pypy/dist/pypy/lib/codecs.py ============================================================================== --- /pypy/dist/pypy/lib/codecs.py Sun May 1 13:38:15 2005 +++ (empty file) @@ -1,750 +0,0 @@ -""" codecs -- Python Codec Registry, API and helpers. - - -Written by Marc-Andre Lemburg (mal at lemburg.com). - -(c) Copyright CNRI, All Rights Reserved. NO WARRANTY. - -"""#" - -import __builtin__, sys - -### Registry and builtin stateless codec functions - -try: - import sys - if sys.path[0] != r'd:\projects\pypy_co': - sys.path.insert(0,r'd:\projects\pypy_co') - from pypy.lib import _codecs - reload(_codecs) - del _codecs - from pypy.lib._codecs import * -except ImportError, why: - raise SystemError,\ - 'Failed to load the builtin codecs: %s' % why - -__all__ = ["register", "lookup", "open", "EncodedFile", "BOM", "BOM_BE", - "BOM_LE", "BOM32_BE", "BOM32_LE", "BOM64_BE", "BOM64_LE", - "BOM_UTF8", "BOM_UTF16", "BOM_UTF16_LE", "BOM_UTF16_BE", - "BOM_UTF32", "BOM_UTF32_LE", "BOM_UTF32_BE", - "strict_errors", "ignore_errors", "replace_errors", - "xmlcharrefreplace_errors", - "register_error", "lookup_error"] - -### Constants - -# -# Byte Order Mark (BOM = ZERO WIDTH NO-BREAK SPACE = U+FEFF) -# and its possible byte string values -# for UTF8/UTF16/UTF32 output and little/big endian machines -# - -# UTF-8 -BOM_UTF8 = '\xef\xbb\xbf' - -# UTF-16, little endian -BOM_LE = BOM_UTF16_LE = '\xff\xfe' - -# UTF-16, big endian -BOM_BE = BOM_UTF16_BE = '\xfe\xff' - -# UTF-32, little endian -BOM_UTF32_LE = '\xff\xfe\x00\x00' - -# UTF-32, big endian -BOM_UTF32_BE = '\x00\x00\xfe\xff' - -if sys.byteorder == 'little': - - # UTF-16, native endianness - BOM = BOM_UTF16 = BOM_UTF16_LE - - # UTF-32, native endianness - BOM_UTF32 = BOM_UTF32_LE - -else: - - # UTF-16, native endianness - BOM = BOM_UTF16 = BOM_UTF16_BE - - # UTF-32, native endianness - BOM_UTF32 = BOM_UTF32_BE - -# Old broken names (don't use in new code) -BOM32_LE = BOM_UTF16_LE -BOM32_BE = BOM_UTF16_BE -BOM64_LE = BOM_UTF32_LE -BOM64_BE = BOM_UTF32_BE - - -### Codec base classes (defining the API) - -class Codec: - - """ Defines the interface for stateless encoders/decoders. - - The .encode()/.decode() methods may use different error - handling schemes by providing the errors argument. These - string values are predefined: - - 'strict' - raise a ValueError error (or a subclass) - 'ignore' - ignore the character and continue with the next - 'replace' - replace with a suitable replacement character; - Python will use the official U+FFFD REPLACEMENT - CHARACTER for the builtin Unicode codecs on - decoding and '?' on encoding. - 'xmlcharrefreplace' - Replace with the appropriate XML - character reference (only for encoding). - 'backslashreplace' - Replace with backslashed escape sequences - (only for encoding). - - The set of allowed values can be extended via register_error. - - """ - def encode(self, input, errors='strict'): - - """ Encodes the object input and returns a tuple (output - object, length consumed). - - errors defines the error handling to apply. It defaults to - 'strict' handling. - - The method may not store state in the Codec instance. Use - StreamCodec for codecs which have to keep state in order to - make encoding/decoding efficient. - - The encoder must be able to handle zero length input and - return an empty object of the output object type in this - situation. - - """ - raise NotImplementedError - - def decode(self, input, errors='strict'): - - """ Decodes the object input and returns a tuple (output - object, length consumed). - - input must be an object which provides the bf_getreadbuf - buffer slot. Python strings, buffer objects and memory - mapped files are examples of objects providing this slot. - - errors defines the error handling to apply. It defaults to - 'strict' handling. - - The method may not store state in the Codec instance. Use - StreamCodec for codecs which have to keep state in order to - make encoding/decoding efficient. - - The decoder must be able to handle zero length input and - return an empty object of the output object type in this - situation. - - """ - raise NotImplementedError - -# -# The StreamWriter and StreamReader class provide generic working -# interfaces which can be used to implement new encoding submodules -# very easily. See encodings/utf_8.py for an example on how this is -# done. -# - -class StreamWriter(Codec): - - def __init__(self, stream, errors='strict'): - - """ Creates a StreamWriter instance. - - stream must be a file-like object open for writing - (binary) data. - - The StreamWriter may use different error handling - schemes by providing the errors keyword argument. These - parameters are predefined: - - 'strict' - raise a ValueError (or a subclass) - 'ignore' - ignore the character and continue with the next - 'replace'- replace with a suitable replacement character - 'xmlcharrefreplace' - Replace with the appropriate XML - character reference. - 'backslashreplace' - Replace with backslashed escape - sequences (only for encoding). - - The set of allowed parameter values can be extended via - register_error. - """ - self.stream = stream - self.errors = errors - - def write(self, object): - - """ Writes the object's contents encoded to self.stream. - """ - data, consumed = self.encode(object, self.errors) - print type(data) - self.stream.write(data) - - def writelines(self, list): - - """ Writes the concatenated list of strings to the stream - using .write(). - """ - self.write(''.join(list)) - - def reset(self): - - """ Flushes and resets the codec buffers used for keeping state. - - Calling this method should ensure that the data on the - output is put into a clean state, that allows appending - of new fresh data without having to rescan the whole - stream to recover state. - - """ - pass - - def __getattr__(self, name, - getattr=getattr): - - """ Inherit all other methods from the underlying stream. - """ - return getattr(self.stream, name) - -### - -class StreamReader(Codec): - - def __init__(self, stream, errors='strict'): - - """ Creates a StreamReader instance. - - stream must be a file-like object open for reading - (binary) data. - - The StreamReader may use different error handling - schemes by providing the errors keyword argument. These - parameters are predefined: - - 'strict' - raise a ValueError (or a subclass) - 'ignore' - ignore the character and continue with the next - 'replace'- replace with a suitable replacement character; - - The set of allowed parameter values can be extended via - register_error. - """ - self.stream = stream - self.errors = errors - self.bytebuffer = "" - self.charbuffer = u"" - self.atcr = False - - def decode(self, input, errors='strict'): - raise NotImplementedError - - def read(self, size=-1, chars=-1): - - """ Decodes data from the stream self.stream and returns the - resulting object. - - chars indicates the number of characters to read from the - stream. read() will never return more than chars - characters, but it might return less, if there are not enough - characters available. - - size indicates the approximate maximum number of bytes to - read from the stream for decoding purposes. The decoder - can modify this setting as appropriate. The default value - -1 indicates to read and decode as much as possible. size - is intended to prevent having to decode huge files in one - step. - - The method should use a greedy read strategy meaning that - it should read as much data as is allowed within the - definition of the encoding and the given size, e.g. if - optional encoding endings or state markers are available - on the stream, these should be read too. - """ - # read until we get the required number of characters (if available) - while True: - # can the request can be satisfied from the character buffer? - if chars < 0: - if self.charbuffer: - break - else: - if len(self.charbuffer) >= chars: - break - # we need more data - if size < 0: - newdata = self.stream.read() - else: - newdata = self.stream.read(size) - # decode bytes (those remaining from the last call included) - data = self.bytebuffer + newdata - newchars, decodedbytes = self.decode(data, self.errors) - # keep undecoded bytes until the next call - self.bytebuffer = data[decodedbytes:] - # put new characters in the character buffer - self.charbuffer += newchars - # there was no data available - if not newdata: - break - if chars < 0: - # Return everything we've got - result = self.charbuffer - self.charbuffer = u"" - else: - # Return the first chars characters - result = self.charbuffer[:chars] - self.charbuffer = self.charbuffer[chars:] - return result - - def readline(self, size=None, keepends=True): - - """ Read one line from the input stream and return the - decoded data. - - size, if given, is passed as size argument to the - read() method. - - """ - readsize = size or 72 - line = u"" - # If size is given, we call read() only once - while True: - data = self.read(readsize) - if self.atcr and data.startswith(u"\n"): - data = data[1:] - if data: - self.atcr = data.endswith(u"\r") - line += data - lines = line.splitlines(True) - if lines: - line0withend = lines[0] - line0withoutend = lines[0].splitlines(False)[0] - if line0withend != line0withoutend: # We really have a line end - # Put the rest back together and keep it until the next call - self.charbuffer = u"".join(lines[1:]) + self.charbuffer - if keepends: - line = line0withend - else: - line = line0withoutend - break - # we didn't get anything or this was our only try - elif not data or size is not None: - if line and not keepends: - line = line.splitlines(False)[0] - break - if readsize<8000: - readsize *= 2 - return line - - def readlines(self, sizehint=None, keepends=True): - - """ Read all lines available on the input stream - and return them as list of lines. - - Line breaks are implemented using the codec's decoder - method and are included in the list entries. - - sizehint, if given, is ignored since there is no efficient - way to finding the true end-of-line. - - """ - data = self.read() - return data.splitlines(keepends) - - def reset(self): - - """ Resets the codec buffers used for keeping state. - - Note that no stream repositioning should take place. - This method is primarily intended to be able to recover - from decoding errors. - - """ - pass - - def next(self): - - """ Return the next decoded line from the input stream.""" - line = self.readline() - if line: - return line - raise StopIteration - - def __iter__(self): - return self - - def __getattr__(self, name, - getattr=getattr): - - """ Inherit all other methods from the underlying stream. - """ - return getattr(self.stream, name) - -### - -class StreamReaderWriter: - - """ StreamReaderWriter instances allow wrapping streams which - work in both read and write modes. - - The design is such that one can use the factory functions - returned by the codec.lookup() function to construct the - instance. - - """ - # Optional attributes set by the file wrappers below - encoding = 'unknown' - - def __init__(self, stream, Reader, Writer, errors='strict'): - - """ Creates a StreamReaderWriter instance. - - stream must be a Stream-like object. - - Reader, Writer must be factory functions or classes - providing the StreamReader, StreamWriter interface resp. - - Error handling is done in the same way as defined for the - StreamWriter/Readers. - - """ - self.stream = stream - self.reader = Reader(stream, errors) - self.writer = Writer(stream, errors) - self.errors = errors - - def read(self, size=-1): - - return self.reader.read(size) - - def readline(self, size=None): - - return self.reader.readline(size) - - def readlines(self, sizehint=None): - - return self.reader.readlines(sizehint) - - def next(self): - - """ Return the next decoded line from the input stream.""" - return self.reader.next() - - def __iter__(self): - return self - - def write(self, data): - - return self.writer.write(data) - - def writelines(self, list): - - return self.writer.writelines(list) - - def reset(self): - - self.reader.reset() - self.writer.reset() - - def __getattr__(self, name, - getattr=getattr): - - """ Inherit all other methods from the underlying stream. - """ - return getattr(self.stream, name) - -### - -class StreamRecoder: - - """ StreamRecoder instances provide a frontend - backend - view of encoding data. - - They use the complete set of APIs returned by the - codecs.lookup() function to implement their task. - - Data written to the stream is first decoded into an - intermediate format (which is dependent on the given codec - combination) and then written to the stream using an instance - of the provided Writer class. - - In the other direction, data is read from the stream using a - Reader instance and then return encoded data to the caller. - - """ - # Optional attributes set by the file wrappers below - data_encoding = 'unknown' - file_encoding = 'unknown' - - def __init__(self, stream, encode, decode, Reader, Writer, - errors='strict'): - - """ Creates a StreamRecoder instance which implements a two-way - conversion: encode and decode work on the frontend (the - input to .read() and output of .write()) while - Reader and Writer work on the backend (reading and - writing to the stream). - - You can use these objects to do transparent direct - recodings from e.g. latin-1 to utf-8 and back. - - stream must be a file-like object. - - encode, decode must adhere to the Codec interface, Reader, - Writer must be factory functions or classes providing the - StreamReader, StreamWriter interface resp. - - encode and decode are needed for the frontend translation, - Reader and Writer for the backend translation. Unicode is - used as intermediate encoding. - - Error handling is done in the same way as defined for the - StreamWriter/Readers. - - """ - self.stream = stream - self.encode = encode - self.decode = decode - self.reader = Reader(stream, errors) - self.writer = Writer(stream, errors) - self.errors = errors - - def read(self, size=-1): - - data = self.reader.read(size) - data, bytesencoded = self.encode(data, self.errors) - return data - - def readline(self, size=None): - - if size is None: - data = self.reader.readline() - else: - data = self.reader.readline(size) - data, bytesencoded = self.encode(data, self.errors) - return data - - def readlines(self, sizehint=None): - - data = self.reader.read() - data, bytesencoded = self.encode(data, self.errors) - return data.splitlines(1) - - def next(self): - - """ Return the next decoded line from the input stream.""" - return self.reader.next() - - def __iter__(self): - return self - - def write(self, data): - - data, bytesdecoded = self.decode(data, self.errors) - return self.writer.write(data) - - def writelines(self, list): - - data = ''.join(list) - data, bytesdecoded = self.decode(data, self.errors) - return self.writer.write(data) - - def reset(self): - - self.reader.reset() - self.writer.reset() - - def __getattr__(self, name, - getattr=getattr): - - """ Inherit all other methods from the underlying stream. - """ - return getattr(self.stream, name) - -### Shortcuts - -def open(filename, mode='rb', encoding=None, errors='strict', buffering=1): - - """ Open an encoded file using the given mode and return - a wrapped version providing transparent encoding/decoding. - - Note: The wrapped version will only accept the object format - defined by the codecs, i.e. Unicode objects for most builtin - codecs. Output is also codec dependent and will usually by - Unicode as well. - - Files are always opened in binary mode, even if no binary mode - was specified. This is done to avoid data loss due to encodings - using 8-bit values. The default file mode is 'rb' meaning to - open the file in binary read mode. - - encoding specifies the encoding which is to be used for the - file. - - errors may be given to define the error handling. It defaults - to 'strict' which causes ValueErrors to be raised in case an - encoding error occurs. - - buffering has the same meaning as for the builtin open() API. - It defaults to line buffered. - - The returned wrapped file object provides an extra attribute - .encoding which allows querying the used encoding. This - attribute is only available if an encoding was specified as - parameter. - - """ - if encoding is not None and \ - 'b' not in mode: - # Force opening of the file in binary mode - mode = mode + 'b' - file = __builtin__.open(filename, mode, buffering) - if encoding is None: - return file - (e, d, sr, sw) = lookup(encoding) - srw = StreamReaderWriter(file, sr, sw, errors) - # Add attributes to simplify introspection - srw.encoding = encoding - return srw - -def EncodedFile(file, data_encoding, file_encoding=None, errors='strict'): - - """ Return a wrapped version of file which provides transparent - encoding translation. - - Strings written to the wrapped file are interpreted according - to the given data_encoding and then written to the original - file as string using file_encoding. The intermediate encoding - will usually be Unicode but depends on the specified codecs. - - Strings are read from the file using file_encoding and then - passed back to the caller as string using data_encoding. - - If file_encoding is not given, it defaults to data_encoding. - - errors may be given to define the error handling. It defaults - to 'strict' which causes ValueErrors to be raised in case an - encoding error occurs. - - The returned wrapped file object provides two extra attributes - .data_encoding and .file_encoding which reflect the given - parameters of the same name. The attributes can be used for - introspection by Python programs. - - """ - if file_encoding is None: - file_encoding = data_encoding - encode, decode = lookup(data_encoding)[:2] - Reader, Writer = lookup(file_encoding)[2:] - sr = StreamRecoder(file, - encode, decode, Reader, Writer, - errors) - # Add attributes to simplify introspection - sr.data_encoding = data_encoding - sr.file_encoding = file_encoding - return sr - -### Helpers for codec lookup - -def getencoder(encoding): - - """ Lookup up the codec for the given encoding and return - its encoder function. - - Raises a LookupError in case the encoding cannot be found. - - """ - return lookup(encoding)[0] - -def getdecoder(encoding): - - """ Lookup up the codec for the given encoding and return - its decoder function. - - Raises a LookupError in case the encoding cannot be found. - - """ - return lookup(encoding)[1] - -def getreader(encoding): - - """ Lookup up the codec for the given encoding and return - its StreamReader class or factory function. - - Raises a LookupError in case the encoding cannot be found. - - """ - return lookup(encoding)[2] - -def getwriter(encoding): - - """ Lookup up the codec for the given encoding and return - its StreamWriter class or factory function. - - Raises a LookupError in case the encoding cannot be found. - - """ - return lookup(encoding)[3] - -### Helpers for charmap-based codecs - -def make_identity_dict(rng): - - """ make_identity_dict(rng) -> dict - - Return a dictionary where elements of the rng sequence are - mapped to themselves. - - """ - res = {} - for i in rng: - res[i]=i - return res - -def make_encoding_map(decoding_map): - - """ Creates an encoding map from a decoding map. - - If a target mapping in the decoding map occurs multiple - times, then that target is mapped to None (undefined mapping), - causing an exception when encountered by the charmap codec - during translation. - - One example where this happens is cp875.py which decodes - multiple character to \u001a. - - """ - m = {} - for k,v in decoding_map.items(): - if not v in m: - m[v] = k - else: - m[v] = None - return m - -### error handlers - -strict_errors = lookup_error("strict") -ignore_errors = lookup_error("ignore") -replace_errors = lookup_error("replace") -xmlcharrefreplace_errors = lookup_error("xmlcharrefreplace") -backslashreplace_errors = lookup_error("backslashreplace") - -# Tell modulefinder that using codecs probably needs the encodings -# package -_false = 1 -if _false: - import encodings - -### Tests - -if __name__ == '__main__': - - # Make stdout translate Latin-1 output into UTF-8 output - sys.stdout = EncodedFile(sys.stdout, 'latin-1', 'utf-8') - - # Have stdin translate Latin-1 input into UTF-8 input - sys.stdin = EncodedFile(sys.stdin, 'utf-8', 'latin-1') Deleted: /pypy/dist/pypy/lib/dumbre.py ============================================================================== --- /pypy/dist/pypy/lib/dumbre.py Sun May 1 13:38:15 2005 +++ (empty file) @@ -1,5 +0,0 @@ -class Pattern: - def __init__(self, pattern, flags): - print 'regex', pattern - print 'killed' - raise SystemExit Deleted: /pypy/dist/pypy/lib/plexre.py ============================================================================== --- /pypy/dist/pypy/lib/plexre.py Sun May 1 13:38:15 2005 +++ (empty file) @@ -1,15 +0,0 @@ -from StringIO import StringIO -from Pyrex.Plex import Scanner, Lexicon, Traditional, Errors -class Pattern: - def __init__(self, pattern, flags): - compiled = Traditional.re(pattern) - lexicon = Lexicon([(compiled, None)]) - self.lexicon = lexicon - def match(self, string): - stream = StringIO(string) - scanner = Scanner(self.lexicon, stream) - try: - scanner.read() - return 1 - except Errors.UnrecognizedInput: - return 0 Deleted: /pypy/dist/pypy/lib/sre_adapt.py ============================================================================== --- /pypy/dist/pypy/lib/sre_adapt.py Sun May 1 13:38:15 2005 +++ (empty file) @@ -1,2 +0,0 @@ -import sre_compile -Pattern = sre_compile.compile Deleted: /pypy/dist/pypy/lib/test2/autopath.py ============================================================================== --- /pypy/dist/pypy/lib/test2/autopath.py Sun May 1 13:38:15 2005 +++ (empty file) @@ -1,117 +0,0 @@ -""" -self cloning, automatic path configuration - -copy this into any subdirectory of pypy from which scripts need -to be run, typically all of the test subdirs. -The idea is that any such script simply issues - - import autopath - -and this will make sure that the parent directory containing "pypy" -is in sys.path. - -If you modify the master "autopath.py" version (in pypy/tool/autopath.py) -you can directly run it which will copy itself on all autopath.py files -it finds under the pypy root directory. - -This module always provides these attributes: - - pypydir pypy root directory path - this_dir directory where this autopath.py resides - -""" - - -def __dirinfo(part): - """ return (partdir, this_dir) and insert parent of partdir - into sys.path. If the parent directories don't have the part - an EnvironmentError is raised.""" - - import sys, os - try: - head = this_dir = os.path.realpath(os.path.dirname(__file__)) - except NameError: - head = this_dir = os.path.realpath(os.path.dirname(sys.argv[0])) - - while head: - partdir = head - head, tail = os.path.split(head) - if tail == part: - break - else: - raise EnvironmentError, "'%s' missing in '%r'" % (partdir, this_dir) - - checkpaths = sys.path[:] - pypy_root = os.path.join(head, '') - - while checkpaths: - orig = checkpaths.pop() - fullorig = os.path.join(os.path.realpath(orig), '') - if fullorig.startswith(pypy_root): - if os.path.exists(os.path.join(fullorig, '__init__.py')): - sys.path.remove(orig) - if head not in sys.path: - sys.path.insert(0, head) - - munged = {} - for name, mod in sys.modules.items(): - fn = getattr(mod, '__file__', None) - if '.' in name or not isinstance(fn, str): - continue - newname = os.path.splitext(os.path.basename(fn))[0] - if not newname.startswith(part + '.'): - continue - path = os.path.join(os.path.dirname(os.path.realpath(fn)), '') - if path.startswith(pypy_root) and newname != part: - modpaths = os.path.normpath(path[len(pypy_root):]).split(os.sep) - if newname != '__init__': - modpaths.append(newname) - modpath = '.'.join(modpaths) - if modpath not in sys.modules: - munged[modpath] = mod - - for name, mod in munged.iteritems(): - if name not in sys.modules: - sys.modules[name] = mod - if '.' in name: - prename = name[:name.rfind('.')] - postname = name[len(prename)+1:] - if prename not in sys.modules: - __import__(prename) - if not hasattr(sys.modules[prename], postname): - setattr(sys.modules[prename], postname, mod) - - return partdir, this_dir - -def __clone(): - """ clone master version of autopath.py into all subdirs """ - from os.path import join, walk - if not this_dir.endswith(join('pypy','tool')): - raise EnvironmentError("can only clone master version " - "'%s'" % join(pypydir, 'tool',_myname)) - - - def sync_walker(arg, dirname, fnames): - if _myname in fnames: - fn = join(dirname, _myname) - f = open(fn, 'rwb+') - try: - if f.read() == arg: - print "checkok", fn - else: - print "syncing", fn - f = open(fn, 'w') - f.write(arg) - finally: - f.close() - s = open(join(pypydir, 'tool', _myname), 'rb').read() - walk(pypydir, sync_walker, s) - -_myname = 'autopath.py' - -# set guaranteed attributes - -pypydir, this_dir = __dirinfo('pypy') - -if __name__ == '__main__': - __clone() Deleted: /pypy/dist/pypy/lib/test2/conftest.py ============================================================================== --- /pypy/dist/pypy/lib/test2/conftest.py Sun May 1 13:38:15 2005 +++ (empty file) @@ -1,114 +0,0 @@ -import autopath -import sys -import py -import pypy -from pypy.conftest import gettestobjspace, option - -# XXX do something for running doctests from regrtests! - -ModuleType = type(sys) - -def make_cpy_module(dottedname, filepath, force=True): - try: - if force: - raise KeyError - return sys.modules[dottedname] - except KeyError: - mod = ModuleType(dottedname) - execfile(str(filepath), mod.__dict__) - #print "setting sys.modules[%s] = %s" % (dottedname, mod) - sys.modules[dottedname] = mod - return mod - -pypydir = py.path.local(pypy.__file__).dirpath() - -# hack out pypy/lib -> XXX we need to restructure our test2 situation -#pypylibdir = pypydir.join('lib') -#if str(pypylibdir) in sys.path: -# print "warning, %s on sys.path at cpython level, removing it" % pypylibdir -# sys.path.remove(str(pypylibdir)) -#assert str(pypylibdir) not in sys.path - -libtestdir = pypydir.dirpath('lib-python-2.3.4', 'test') -libconftest = libtestdir.join('conftest.py').getpymodule() # read()) -libconftest.option.extracttests = True - -testlist = None -doctestmodulelist = None - -def hack_test_support_cpython(): - global testlist, doctestmodulelist - if testlist is None: - testlist = [] - doctestmodulelist = [] - mod = make_cpy_module('unittest', libtestdir.join('pypy_unittest.py', force=True)) - mod.raises = py.test.raises - - def hack_run_unittest(*classes): - testlist.extend(list(classes)) - def hack_run_doctest(name, verbose=None): - doctestmodulelist.append(name) - - from test import test_support - test_support.run_unittest = hack_run_unittest - test_support.run_doctest = hack_run_doctest - - return sys.modules['unittest'] - -class UTModuleOnCPython(py.test.collect.Module): - def __init__(self, fspath, parent, testdecl): - super(UTModuleOnCPython, self).__init__(fspath, parent) - self.testdecl = testdecl - mod = hack_test_support_cpython() - self.TestCaseClass = getattr(mod, 'TestCase') - - name = self.fspath.purebasename - mod = self._obj = make_cpy_module(name, self.fspath, force=True) - - # hack out the test case classes for this module - testlist[:] = [] - mod.test_main() - - self._testcases = [(cls.__name__, cls) for cls in testlist] - self._testcases.sort() - - def run(self): - return [x[0] for x in self._testcases] - - def join(self, name): - for x,cls in self._testcases: - if x == name: - return UTTestCase(name, parent=self, cls=cls) - -class UTTestCaseMethod(py.test.Function): - def run(self): - method = self.obj - setup = method.im_self.setUp - teardown = method.im_self.tearDown - setup() - try: - method() - finally: - teardown() - -class UTTestCaseInstance(py.test.collect.Instance): - Function = UTTestCaseMethod - -class UTTestCase(py.test.collect.Class): - Instance = UTTestCaseInstance - - def __init__(self, name, parent, cls): - super(UTTestCase, self).__init__(name, parent) - self._obj = cls - -#testmap = { -# 'test_itertools.py' : TestDecl(True, UTModuleOnCPython), -# 'test_sha.py' : TestDecl(True, UTModuleOnCPython), -#} - -class Directory(libconftest.Directory): - - def run(self): - py.test.skip("running modified tests on native cpython not supported currently.") - - Deleted: /pypy/dist/pypy/lib/test2/pickletester.py ============================================================================== --- /pypy/dist/pypy/lib/test2/pickletester.py Sun May 1 13:38:15 2005 +++ (empty file) @@ -1,964 +0,0 @@ -# Notes about changes in this file: -# a prefix of "dont_" means the test makes no sense, -# because we don't use cPickle at all. -# "xxx_" means it works and can be done, but takes ages. -# When PyPy gets really fast, we should remove "xxx_". - -import unittest -import pickle -import cPickle -import pickletools -import copy_reg - -from test.test_support import TestFailed, have_unicode, TESTFN - -# Tests that try a number of pickle protocols should have a -# for proto in protocols: -# kind of outer loop. -assert pickle.HIGHEST_PROTOCOL == cPickle.HIGHEST_PROTOCOL == 2 -protocols = range(pickle.HIGHEST_PROTOCOL + 1) - - -# Return True if opcode code appears in the pickle, else False. -def opcode_in_pickle(code, pickle): - for op, dummy, dummy in pickletools.genops(pickle): - if op.code == code: - return True - return False - -# Return the number of times opcode code appears in pickle. -def count_opcode(code, pickle): - n = 0 - for op, dummy, dummy in pickletools.genops(pickle): - if op.code == code: - n += 1 - return n - -# We can't very well test the extension registry without putting known stuff -# in it, but we have to be careful to restore its original state. Code -# should do this: -# -# e = ExtensionSaver(extension_code) -# try: -# fiddle w/ the extension registry's stuff for extension_code -# finally: -# e.restore() - -class ExtensionSaver: - # Remember current registration for code (if any), and remove it (if - # there is one). - def __init__(self, code): - self.code = code - if code in copy_reg._inverted_registry: - self.pair = copy_reg._inverted_registry[code] - copy_reg.remove_extension(self.pair[0], self.pair[1], code) - else: - self.pair = None - - # Restore previous registration for code. - def restore(self): - code = self.code - curpair = copy_reg._inverted_registry.get(code) - if curpair is not None: - copy_reg.remove_extension(curpair[0], curpair[1], code) - pair = self.pair - if pair is not None: - copy_reg.add_extension(pair[0], pair[1], code) - -class C: - def __cmp__(self, other): - return cmp(self.__dict__, other.__dict__) - -import __main__ -__main__.C = C -C.__module__ = "__main__" - -class myint(int): - def __init__(self, x): - self.str = str(x) - -class initarg(C): - - def __init__(self, a, b): - self.a = a - self.b = b - - def __getinitargs__(self): - return self.a, self.b - -class metaclass(type): - pass - -class use_metaclass(object): - __metaclass__ = metaclass - -# DATA0 .. DATA2 are the pickles we expect under the various protocols, for -# the object returned by create_data(). - -# break into multiple strings to avoid confusing font-lock-mode -DATA0 = """(lp1 -I0 -aL1L -aF2 -ac__builtin__ -complex -p2 -""" + \ -"""(F3 -F0 -tRp3 -aI1 -aI-1 -aI255 -aI-255 -aI-256 -aI65535 -aI-65535 -aI-65536 -aI2147483647 -aI-2147483647 -aI-2147483648 -a""" + \ -"""(S'abc' -p4 -g4 -""" + \ -"""(i__main__ -C -p5 -""" + \ -"""(dp6 -S'foo' -p7 -I1 -sS'bar' -p8 -I2 -sbg5 -tp9 -ag9 -aI5 -a. -""" - -# Disassembly of DATA0. -DATA0_DIS = """\ - 0: ( MARK - 1: l LIST (MARK at 0) - 2: p PUT 1 - 5: I INT 0 - 8: a APPEND - 9: L LONG 1L - 13: a APPEND - 14: F FLOAT 2.0 - 17: a APPEND - 18: c GLOBAL '__builtin__ complex' - 39: p PUT 2 - 42: ( MARK - 43: F FLOAT 3.0 - 46: F FLOAT 0.0 - 49: t TUPLE (MARK at 42) - 50: R REDUCE - 51: p PUT 3 - 54: a APPEND - 55: I INT 1 - 58: a APPEND - 59: I INT -1 - 63: a APPEND - 64: I INT 255 - 69: a APPEND - 70: I INT -255 - 76: a APPEND - 77: I INT -256 - 83: a APPEND - 84: I INT 65535 - 91: a APPEND - 92: I INT -65535 - 100: a APPEND - 101: I INT -65536 - 109: a APPEND - 110: I INT 2147483647 - 122: a APPEND - 123: I INT -2147483647 - 136: a APPEND - 137: I INT -2147483648 - 150: a APPEND - 151: ( MARK - 152: S STRING 'abc' - 159: p PUT 4 - 162: g GET 4 - 165: ( MARK - 166: i INST '__main__ C' (MARK at 165) - 178: p PUT 5 - 181: ( MARK - 182: d DICT (MARK at 181) - 183: p PUT 6 - 186: S STRING 'foo' - 193: p PUT 7 - 196: I INT 1 - 199: s SETITEM - 200: S STRING 'bar' - 207: p PUT 8 - 210: I INT 2 - 213: s SETITEM - 214: b BUILD - 215: g GET 5 - 218: t TUPLE (MARK at 151) - 219: p PUT 9 - 222: a APPEND - 223: g GET 9 - 226: a APPEND - 227: I INT 5 - 230: a APPEND - 231: . STOP -highest protocol among opcodes = 0 -""" - -DATA1 = (']q\x01(K\x00L1L\nG@\x00\x00\x00\x00\x00\x00\x00' - 'c__builtin__\ncomplex\nq\x02(G@\x08\x00\x00\x00\x00\x00' - '\x00G\x00\x00\x00\x00\x00\x00\x00\x00tRq\x03K\x01J\xff\xff' - '\xff\xffK\xffJ\x01\xff\xff\xffJ\x00\xff\xff\xffM\xff\xff' - 'J\x01\x00\xff\xffJ\x00\x00\xff\xffJ\xff\xff\xff\x7fJ\x01\x00' - '\x00\x80J\x00\x00\x00\x80(U\x03abcq\x04h\x04(c__main__\n' - 'C\nq\x05oq\x06}q\x07(U\x03fooq\x08K\x01U\x03barq\tK\x02ubh' - '\x06tq\nh\nK\x05e.' - ) - -# Disassembly of DATA1. -DATA1_DIS = """\ - 0: ] EMPTY_LIST - 1: q BINPUT 1 - 3: ( MARK - 4: K BININT1 0 - 6: L LONG 1L - 10: G BINFLOAT 2.0 - 19: c GLOBAL '__builtin__ complex' - 40: q BINPUT 2 - 42: ( MARK - 43: G BINFLOAT 3.0 - 52: G BINFLOAT 0.0 - 61: t TUPLE (MARK at 42) - 62: R REDUCE - 63: q BINPUT 3 - 65: K BININT1 1 - 67: J BININT -1 - 72: K BININT1 255 - 74: J BININT -255 - 79: J BININT -256 - 84: M BININT2 65535 - 87: J BININT -65535 - 92: J BININT -65536 - 97: J BININT 2147483647 - 102: J BININT -2147483647 - 107: J BININT -2147483648 - 112: ( MARK - 113: U SHORT_BINSTRING 'abc' - 118: q BINPUT 4 - 120: h BINGET 4 - 122: ( MARK - 123: c GLOBAL '__main__ C' - 135: q BINPUT 5 - 137: o OBJ (MARK at 122) - 138: q BINPUT 6 - 140: } EMPTY_DICT - 141: q BINPUT 7 - 143: ( MARK - 144: U SHORT_BINSTRING 'foo' - 149: q BINPUT 8 - 151: K BININT1 1 - 153: U SHORT_BINSTRING 'bar' - 158: q BINPUT 9 - 160: K BININT1 2 - 162: u SETITEMS (MARK at 143) - 163: b BUILD - 164: h BINGET 6 - 166: t TUPLE (MARK at 112) - 167: q BINPUT 10 - 169: h BINGET 10 - 171: K BININT1 5 - 173: e APPENDS (MARK at 3) - 174: . STOP -highest protocol among opcodes = 1 -""" - -DATA2 = ('\x80\x02]q\x01(K\x00\x8a\x01\x01G@\x00\x00\x00\x00\x00\x00\x00' - 'c__builtin__\ncomplex\nq\x02G@\x08\x00\x00\x00\x00\x00\x00G\x00' - '\x00\x00\x00\x00\x00\x00\x00\x86Rq\x03K\x01J\xff\xff\xff\xffK' - '\xffJ\x01\xff\xff\xffJ\x00\xff\xff\xffM\xff\xffJ\x01\x00\xff\xff' - 'J\x00\x00\xff\xffJ\xff\xff\xff\x7fJ\x01\x00\x00\x80J\x00\x00\x00' - '\x80(U\x03abcq\x04h\x04(c__main__\nC\nq\x05oq\x06}q\x07(U\x03foo' - 'q\x08K\x01U\x03barq\tK\x02ubh\x06tq\nh\nK\x05e.') - -# Disassembly of DATA2. -DATA2_DIS = """\ - 0: \x80 PROTO 2 - 2: ] EMPTY_LIST - 3: q BINPUT 1 - 5: ( MARK - 6: K BININT1 0 - 8: \x8a LONG1 1L - 11: G BINFLOAT 2.0 - 20: c GLOBAL '__builtin__ complex' - 41: q BINPUT 2 - 43: G BINFLOAT 3.0 - 52: G BINFLOAT 0.0 - 61: \x86 TUPLE2 - 62: R REDUCE - 63: q BINPUT 3 - 65: K BININT1 1 - 67: J BININT -1 - 72: K BININT1 255 - 74: J BININT -255 - 79: J BININT -256 - 84: M BININT2 65535 - 87: J BININT -65535 - 92: J BININT -65536 - 97: J BININT 2147483647 - 102: J BININT -2147483647 - 107: J BININT -2147483648 - 112: ( MARK - 113: U SHORT_BINSTRING 'abc' - 118: q BINPUT 4 - 120: h BINGET 4 - 122: ( MARK - 123: c GLOBAL '__main__ C' - 135: q BINPUT 5 - 137: o OBJ (MARK at 122) - 138: q BINPUT 6 - 140: } EMPTY_DICT - 141: q BINPUT 7 - 143: ( MARK - 144: U SHORT_BINSTRING 'foo' - 149: q BINPUT 8 - 151: K BININT1 1 - 153: U SHORT_BINSTRING 'bar' - 158: q BINPUT 9 - 160: K BININT1 2 - 162: u SETITEMS (MARK at 143) - 163: b BUILD - 164: h BINGET 6 - 166: t TUPLE (MARK at 112) - 167: q BINPUT 10 - 169: h BINGET 10 - 171: K BININT1 5 - 173: e APPENDS (MARK at 5) - 174: . STOP -highest protocol among opcodes = 2 -""" - -def create_data(): - c = C() - c.foo = 1 - c.bar = 2 - x = [0, 1L, 2.0, 3.0+0j] - # Append some integer test cases at cPickle.c's internal size - # cutoffs. - uint1max = 0xff - uint2max = 0xffff - int4max = 0x7fffffff - x.extend([1, -1, - uint1max, -uint1max, -uint1max-1, - uint2max, -uint2max, -uint2max-1, - int4max, -int4max, -int4max-1]) - y = ('abc', 'abc', c, c) - x.append(y) - x.append(y) - x.append(5) - return x - -class AbstractPickleTests(unittest.TestCase): - # Subclass must define self.dumps, self.loads, self.error. - - _testdata = create_data() - - def setUp(self): - pass - - def test_misc(self): - # test various datatypes not tested by testdata - for proto in protocols: - x = myint(4) - s = self.dumps(x, proto) - y = self.loads(s) - self.assertEqual(x, y) - - x = (1, ()) - s = self.dumps(x, proto) - y = self.loads(s) - self.assertEqual(x, y) - - x = initarg(1, x) - s = self.dumps(x, proto) - y = self.loads(s) - self.assertEqual(x, y) - - # XXX test __reduce__ protocol? - - def test_roundtrip_equality(self): - expected = self._testdata - for proto in protocols: - s = self.dumps(expected, proto) - got = self.loads(s) - self.assertEqual(expected, got) - - def test_load_from_canned_string(self): - expected = self._testdata - for canned in DATA0, DATA1, DATA2: - got = self.loads(canned) - self.assertEqual(expected, got) - - # There are gratuitous differences between pickles produced by - # pickle and cPickle, largely because cPickle starts PUT indices at - # 1 and pickle starts them at 0. See XXX comment in cPickle's put2() -- - # there's a comment with an exclamation point there whose meaning - # is a mystery. cPickle also suppresses PUT for objects with a refcount - # of 1. - def dont_test_disassembly(self): - from cStringIO import StringIO - from pickletools import dis - - for proto, expected in (0, DATA0_DIS), (1, DATA1_DIS): - s = self.dumps(self._testdata, proto) - filelike = StringIO() - dis(s, out=filelike) - got = filelike.getvalue() - self.assertEqual(expected, got) - - def test_recursive_list(self): - l = [] - l.append(l) - for proto in protocols: - s = self.dumps(l, proto) - x = self.loads(s) - self.assertEqual(x, l) - self.assertEqual(x, x[0]) - self.assertEqual(id(x), id(x[0])) - - def test_recursive_dict(self): - d = {} - d[1] = d - for proto in protocols: - s = self.dumps(d, proto) - x = self.loads(s) - self.assertEqual(x, d) - self.assertEqual(x[1], x) - self.assertEqual(id(x[1]), id(x)) - - def test_recursive_inst(self): - i = C() - i.attr = i - for proto in protocols: - s = self.dumps(i, 2) - x = self.loads(s) - self.assertEqual(x, i) - self.assertEqual(x.attr, x) - self.assertEqual(id(x.attr), id(x)) - - def test_recursive_multi(self): - l = [] - d = {1:l} - i = C() - i.attr = d - l.append(i) - for proto in protocols: - s = self.dumps(l, proto) - x = self.loads(s) - self.assertEqual(x, l) - self.assertEqual(x[0], i) - self.assertEqual(x[0].attr, d) - self.assertEqual(x[0].attr[1], x) - self.assertEqual(x[0].attr[1][0], i) - self.assertEqual(x[0].attr[1][0].attr, d) - - def test_garyp(self): - self.assertRaises(self.error, self.loads, 'garyp') - - def test_insecure_strings(self): - insecure = ["abc", "2 + 2", # not quoted - #"'abc' + 'def'", # not a single quoted string - "'abc", # quote is not closed - "'abc\"", # open quote and close quote don't match - "'abc' ?", # junk after close quote - "'\\'", # trailing backslash - # some tests of the quoting rules - #"'abc\"\''", - #"'\\\\a\'\'\'\\\'\\\\\''", - ] - for s in insecure: - buf = "S" + s + "\012p0\012." - self.assertRaises(ValueError, self.loads, buf) - - if have_unicode: - def test_unicode(self): - endcases = [unicode(''), unicode('<\\u>'), unicode('<\\\u1234>'), - unicode('<\n>'), unicode('<\\>')] - for proto in protocols: - for u in endcases: - p = self.dumps(u, proto) - u2 = self.loads(p) - self.assertEqual(u2, u) - - def test_ints(self): - import sys - for proto in protocols: - n = sys.maxint - while n: - for expected in (-n, n): - s = self.dumps(expected, proto) - n2 = self.loads(s) - self.assertEqual(expected, n2) - n = n >> 1 - - def test_maxint64(self): - maxint64 = (1L << 63) - 1 - data = 'I' + str(maxint64) + '\n.' - got = self.loads(data) - self.assertEqual(got, maxint64) - - # Try too with a bogus literal. - data = 'I' + str(maxint64) + 'JUNK\n.' - self.assertRaises(ValueError, self.loads, data) - - def xxx_test_long(self): - for proto in protocols: - # 256 bytes is where LONG4 begins. - for nbits in 1, 8, 8*254, 8*255, 8*256, 8*257: - nbase = 1L << nbits - for npos in nbase-1, nbase, nbase+1: - for n in npos, -npos: - pickle = self.dumps(n, proto) - got = self.loads(pickle) - self.assertEqual(n, got) - # Try a monster. This is quadratic-time in protos 0 & 1, so don't - # bother with those. - nbase = long("deadbeeffeedface", 16) - nbase += nbase << 1000000 - for n in nbase, -nbase: - p = self.dumps(n, 2) - got = self.loads(p) - self.assertEqual(n, got) - - def test_reduce(self): - pass - - def test_getinitargs(self): - pass - - def test_metaclass(self): - a = use_metaclass() - for proto in protocols: - s = self.dumps(a, proto) - b = self.loads(s) - self.assertEqual(a.__class__, b.__class__) - - def test_structseq(self): - import time - import os - - t = time.localtime() - for proto in protocols: - s = self.dumps(t, proto) - u = self.loads(s) - self.assertEqual(t, u) - if hasattr(os, "stat"): - t = os.stat(os.curdir) - s = self.dumps(t, proto) - u = self.loads(s) - self.assertEqual(t, u) - if hasattr(os, "statvfs"): - t = os.statvfs(os.curdir) - s = self.dumps(t, proto) - u = self.loads(s) - self.assertEqual(t, u) - - # Tests for protocol 2 - - def test_proto(self): - build_none = pickle.NONE + pickle.STOP - for proto in protocols: - expected = build_none - if proto >= 2: - expected = pickle.PROTO + chr(proto) + expected - p = self.dumps(None, proto) - self.assertEqual(p, expected) - - oob = protocols[-1] + 1 # a future protocol - badpickle = pickle.PROTO + chr(oob) + build_none - try: - self.loads(badpickle) - except ValueError, detail: - self.failUnless(str(detail).startswith( - "unsupported pickle protocol")) - else: - self.fail("expected bad protocol number to raise ValueError") - - def test_long1(self): - x = 12345678910111213141516178920L - for proto in protocols: - s = self.dumps(x, proto) - y = self.loads(s) - self.assertEqual(x, y) - self.assertEqual(opcode_in_pickle(pickle.LONG1, s), proto >= 2) - - def test_long4(self): - x = 12345678910111213141516178920L << (256*8) - for proto in protocols: - s = self.dumps(x, proto) - y = self.loads(s) - self.assertEqual(x, y) - self.assertEqual(opcode_in_pickle(pickle.LONG4, s), proto >= 2) - - def test_short_tuples(self): - # Map (proto, len(tuple)) to expected opcode. - expected_opcode = {(0, 0): pickle.TUPLE, - (0, 1): pickle.TUPLE, - (0, 2): pickle.TUPLE, - (0, 3): pickle.TUPLE, - (0, 4): pickle.TUPLE, - - (1, 0): pickle.EMPTY_TUPLE, - (1, 1): pickle.TUPLE, - (1, 2): pickle.TUPLE, - (1, 3): pickle.TUPLE, - (1, 4): pickle.TUPLE, - - (2, 0): pickle.EMPTY_TUPLE, - (2, 1): pickle.TUPLE1, - (2, 2): pickle.TUPLE2, - (2, 3): pickle.TUPLE3, - (2, 4): pickle.TUPLE, - } - a = () - b = (1,) - c = (1, 2) - d = (1, 2, 3) - e = (1, 2, 3, 4) - for proto in protocols: - for x in a, b, c, d, e: - s = self.dumps(x, proto) - y = self.loads(s) - self.assertEqual(x, y, (proto, x, s, y)) - expected = expected_opcode[proto, len(x)] - self.assertEqual(opcode_in_pickle(expected, s), True) - - def test_singletons(self): - # Map (proto, singleton) to expected opcode. - expected_opcode = {(0, None): pickle.NONE, - (1, None): pickle.NONE, - (2, None): pickle.NONE, - - (0, True): pickle.INT, - (1, True): pickle.INT, - (2, True): pickle.NEWTRUE, - - (0, False): pickle.INT, - (1, False): pickle.INT, - (2, False): pickle.NEWFALSE, - } - for proto in protocols: - for x in None, False, True: - s = self.dumps(x, proto) - y = self.loads(s) - self.assert_(x is y, (proto, x, s, y)) - expected = expected_opcode[proto, x] - self.assertEqual(opcode_in_pickle(expected, s), True) - - def test_newobj_tuple(self): - x = MyTuple([1, 2, 3]) - x.foo = 42 - x.bar = "hello" - for proto in protocols: - s = self.dumps(x, proto) - y = self.loads(s) - self.assertEqual(tuple(x), tuple(y)) - self.assertEqual(x.__dict__, y.__dict__) - - def test_newobj_list(self): - x = MyList([1, 2, 3]) - x.foo = 42 - x.bar = "hello" - for proto in protocols: - s = self.dumps(x, proto) - y = self.loads(s) - self.assertEqual(list(x), list(y)) - self.assertEqual(x.__dict__, y.__dict__) - - def test_newobj_generic(self): - for proto in protocols: - for C in myclasses: - B = C.__base__ - x = C(C.sample) - x.foo = 42 - s = self.dumps(x, proto) - y = self.loads(s) - detail = (proto, C, B, x, y, type(y)) - self.assertEqual(B(x), B(y), detail) - self.assertEqual(x.__dict__, y.__dict__, detail) - - # Register a type with copy_reg, with extension code extcode. Pickle - # an object of that type. Check that the resulting pickle uses opcode - # (EXT[124]) under proto 2, and not in proto 1. - - def produce_global_ext(self, extcode, opcode): - e = ExtensionSaver(extcode) - try: - copy_reg.add_extension(__name__, "MyList", extcode) - x = MyList([1, 2, 3]) - x.foo = 42 - x.bar = "hello" - - # Dump using protocol 1 for comparison. - s1 = self.dumps(x, 1) - self.assert_(__name__ in s1) - self.assert_("MyList" in s1) - self.assertEqual(opcode_in_pickle(opcode, s1), False) - - y = self.loads(s1) - self.assertEqual(list(x), list(y)) - self.assertEqual(x.__dict__, y.__dict__) - - # Dump using protocol 2 for test. - s2 = self.dumps(x, 2) - self.assert_(__name__ not in s2) - self.assert_("MyList" not in s2) - self.assertEqual(opcode_in_pickle(opcode, s2), True) - - y = self.loads(s2) - self.assertEqual(list(x), list(y)) - self.assertEqual(x.__dict__, y.__dict__) - - finally: - e.restore() - - def test_global_ext1(self): - self.produce_global_ext(0x00000001, pickle.EXT1) # smallest EXT1 code - self.produce_global_ext(0x000000ff, pickle.EXT1) # largest EXT1 code - - def test_global_ext2(self): - self.produce_global_ext(0x00000100, pickle.EXT2) # smallest EXT2 code - self.produce_global_ext(0x0000ffff, pickle.EXT2) # largest EXT2 code - self.produce_global_ext(0x0000abcd, pickle.EXT2) # check endianness - - def test_global_ext4(self): - self.produce_global_ext(0x00010000, pickle.EXT4) # smallest EXT4 code - self.produce_global_ext(0x7fffffff, pickle.EXT4) # largest EXT4 code - self.produce_global_ext(0x12abcdef, pickle.EXT4) # check endianness - - def xxx_test_list_chunking(self): - n = 10 # too small to chunk - x = range(n) - for proto in protocols: - s = self.dumps(x, proto) - y = self.loads(s) - self.assertEqual(x, y) - num_appends = count_opcode(pickle.APPENDS, s) - self.assertEqual(num_appends, proto > 0) - - n = 2500 # expect at least two chunks when proto > 0 - x = range(n) - for proto in protocols: - s = self.dumps(x, proto) - y = self.loads(s) - self.assertEqual(x, y) - num_appends = count_opcode(pickle.APPENDS, s) - if proto == 0: - self.assertEqual(num_appends, 0) - else: - self.failUnless(num_appends >= 2) - - def xxx_test_dict_chunking(self): - n = 10 # too small to chunk - x = dict.fromkeys(range(n)) - for proto in protocols: - s = self.dumps(x, proto) - y = self.loads(s) - self.assertEqual(x, y) - num_setitems = count_opcode(pickle.SETITEMS, s) - self.assertEqual(num_setitems, proto > 0) - - n = 2500 # expect at least two chunks when proto > 0 - x = dict.fromkeys(range(n)) - for proto in protocols: - s = self.dumps(x, proto) - y = self.loads(s) - self.assertEqual(x, y) - num_setitems = count_opcode(pickle.SETITEMS, s) - if proto == 0: - self.assertEqual(num_setitems, 0) - else: - self.failUnless(num_setitems >= 2) - - def test_simple_newobj(self): - x = object.__new__(SimpleNewObj) # avoid __init__ - x.abc = 666 - for proto in protocols: - s = self.dumps(x, proto) - self.assertEqual(opcode_in_pickle(pickle.NEWOBJ, s), proto >= 2) - y = self.loads(s) # will raise TypeError if __init__ called - self.assertEqual(y.abc, 666) - self.assertEqual(x.__dict__, y.__dict__) - - def test_newobj_list_slots(self): - x = SlotList([1, 2, 3]) - x.foo = 42 - x.bar = "hello" - s = self.dumps(x, 2) - y = self.loads(s) - self.assertEqual(list(x), list(y)) - self.assertEqual(x.__dict__, y.__dict__) - self.assertEqual(x.foo, y.foo) - self.assertEqual(x.bar, y.bar) - - def test_reduce_overrides_default_reduce_ex(self): - for proto in 0, 1, 2: - x = REX_one() - self.assertEqual(x._reduce_called, 0) - s = self.dumps(x, proto) - self.assertEqual(x._reduce_called, 1) - y = self.loads(s) - self.assertEqual(y._reduce_called, 0) - - def test_reduce_ex_called(self): - for proto in 0, 1, 2: - x = REX_two() - self.assertEqual(x._proto, None) - s = self.dumps(x, proto) - self.assertEqual(x._proto, proto) - y = self.loads(s) - self.assertEqual(y._proto, None) - - def test_reduce_ex_overrides_reduce(self): - for proto in 0, 1, 2: - x = REX_three() - self.assertEqual(x._proto, None) - s = self.dumps(x, proto) - self.assertEqual(x._proto, proto) - y = self.loads(s) - self.assertEqual(y._proto, None) - -# Test classes for reduce_ex - -class REX_one(object): - _reduce_called = 0 - def __reduce__(self): - self._reduce_called = 1 - return REX_one, () - # No __reduce_ex__ here, but inheriting it from object - -class REX_two(object): - _proto = None - def __reduce_ex__(self, proto): - self._proto = proto - return REX_two, () - # No __reduce__ here, but inheriting it from object - -class REX_three(object): - _proto = None - def __reduce_ex__(self, proto): - self._proto = proto - return REX_two, () - def __reduce__(self): - raise TestFailed, "This __reduce__ shouldn't be called" - -# Test classes for newobj - -class MyInt(int): - sample = 1 - -class MyLong(long): - sample = 1L - -class MyFloat(float): - sample = 1.0 - -class MyComplex(complex): - sample = 1.0 + 0.0j - -class MyStr(str): - sample = "hello" - -class MyUnicode(unicode): - sample = u"hello \u1234" - -class MyTuple(tuple): - sample = (1, 2, 3) - -class MyList(list): - sample = [1, 2, 3] - -class MyDict(dict): - sample = {"a": 1, "b": 2} - -myclasses = [MyInt, MyLong, MyFloat, - MyComplex, - MyStr, MyUnicode, - MyTuple, MyList, MyDict] - - -class SlotList(MyList): - __slots__ = ["foo"] - -class SimpleNewObj(object): - def __init__(self, a, b, c): - # raise an error, to make sure this isn't called - raise TypeError("SimpleNewObj.__init__() didn't expect to get called") - -class AbstractPickleModuleTests(unittest.TestCase): - - def test_dump_closed_file(self): - import os - f = open(TESTFN, "w") - try: - f.close() - self.assertRaises(ValueError, self.module.dump, 123, f) - finally: - os.remove(TESTFN) - - def test_load_closed_file(self): - import os - f = open(TESTFN, "w") - try: - f.close() - self.assertRaises(ValueError, self.module.dump, 123, f) - finally: - os.remove(TESTFN) - - def test_highest_protocol(self): - # Of course this needs to be changed when HIGHEST_PROTOCOL changes. - self.assertEqual(self.module.HIGHEST_PROTOCOL, 2) - - -class AbstractPersistentPicklerTests(unittest.TestCase): - - # This class defines persistent_id() and persistent_load() - # functions that should be used by the pickler. All even integers - # are pickled using persistent ids. - - def persistent_id(self, object): - if isinstance(object, int) and object % 2 == 0: - self.id_count += 1 - return str(object) - else: - return None - - def persistent_load(self, oid): - self.load_count += 1 - object = int(oid) - assert object % 2 == 0 - return object - - def test_persistence(self): - self.id_count = 0 - self.load_count = 0 - L = range(10) - self.assertEqual(self.loads(self.dumps(L)), L) - self.assertEqual(self.id_count, 5) - self.assertEqual(self.load_count, 5) - - def test_bin_persistence(self): - self.id_count = 0 - self.load_count = 0 - L = range(10) - self.assertEqual(self.loads(self.dumps(L, 1)), L) - self.assertEqual(self.id_count, 5) - self.assertEqual(self.load_count, 5) Deleted: /pypy/dist/pypy/lib/test2/pystone.py ============================================================================== --- /pypy/dist/pypy/lib/test2/pystone.py Sun May 1 13:38:15 2005 +++ (empty file) @@ -1,267 +0,0 @@ -#! /usr/bin/env python - -""" -"PYSTONE" Benchmark Program - -Version: Python/1.1 (corresponds to C/1.1 plus 2 Pystone fixes) - -Author: Reinhold P. Weicker, CACM Vol 27, No 10, 10/84 pg. 1013. - - Translated from ADA to C by Rick Richardson. - Every method to preserve ADA-likeness has been used, - at the expense of C-ness. - - Translated from C to Python by Guido van Rossum. - -Version History: - - Version 1.1 corrects two bugs in version 1.0: - - First, it leaked memory: in Proc1(), NextRecord ends - up having a pointer to itself. I have corrected this - by zapping NextRecord.PtrComp at the end of Proc1(). - - Second, Proc3() used the operator != to compare a - record to None. This is rather inefficient and not - true to the intention of the original benchmark (where - a pointer comparison to None is intended; the != - operator attempts to find a method __cmp__ to do value - comparison of the record). Version 1.1 runs 5-10 - percent faster than version 1.0, so benchmark figures - of different versions can't be compared directly. - -""" - -LOOPS = 50000 - -from time import clock - -__version__ = "1.1" - -[Ident1, Ident2, Ident3, Ident4, Ident5] = range(1, 6) - -class Record: - - def __init__(self, PtrComp = None, Discr = 0, EnumComp = 0, - IntComp = 0, StringComp = 0): - self.PtrComp = PtrComp - self.Discr = Discr - self.EnumComp = EnumComp - self.IntComp = IntComp - self.StringComp = StringComp - - def copy(self): - return Record(self.PtrComp, self.Discr, self.EnumComp, - self.IntComp, self.StringComp) - -TRUE = 1 -FALSE = 0 - -def main(loops=LOOPS): - benchtime, stones = pystones(loops) - print "Pystone(%s) time for %d passes = %g" % \ - (__version__, loops, benchtime) - print "This machine benchmarks at %g pystones/second" % stones - - -def pystones(loops=LOOPS): - return Proc0(loops) - -IntGlob = 0 -BoolGlob = FALSE -Char1Glob = '\0' -Char2Glob = '\0' -Array1Glob = [0]*51 -Array2Glob = map(lambda x: x[:], [Array1Glob]*51) -PtrGlb = None -PtrGlbNext = None - -def Proc0(loops=LOOPS): - global IntGlob - global BoolGlob - global Char1Glob - global Char2Glob - global Array1Glob - global Array2Glob - global PtrGlb - global PtrGlbNext - - starttime = clock() - for i in range(loops): - pass - nulltime = clock() - starttime - - PtrGlbNext = Record() - PtrGlb = Record() - PtrGlb.PtrComp = PtrGlbNext - PtrGlb.Discr = Ident1 - PtrGlb.EnumComp = Ident3 - PtrGlb.IntComp = 40 - PtrGlb.StringComp = "DHRYSTONE PROGRAM, SOME STRING" - String1Loc = "DHRYSTONE PROGRAM, 1'ST STRING" - Array2Glob[8][7] = 10 - - starttime = clock() - - for i in range(loops): - Proc5() - Proc4() - IntLoc1 = 2 - IntLoc2 = 3 - String2Loc = "DHRYSTONE PROGRAM, 2'ND STRING" - EnumLoc = Ident2 - BoolGlob = not Func2(String1Loc, String2Loc) - while IntLoc1 < IntLoc2: - IntLoc3 = 5 * IntLoc1 - IntLoc2 - IntLoc3 = Proc7(IntLoc1, IntLoc2) - IntLoc1 = IntLoc1 + 1 - Proc8(Array1Glob, Array2Glob, IntLoc1, IntLoc3) - PtrGlb = Proc1(PtrGlb) - CharIndex = 'A' - while CharIndex <= Char2Glob: - if EnumLoc == Func1(CharIndex, 'C'): - EnumLoc = Proc6(Ident1) - CharIndex = chr(ord(CharIndex)+1) - IntLoc3 = IntLoc2 * IntLoc1 - IntLoc2 = IntLoc3 / IntLoc1 - IntLoc2 = 7 * (IntLoc3 - IntLoc2) - IntLoc1 - IntLoc1 = Proc2(IntLoc1) - - benchtime = clock() - starttime - nulltime - return benchtime, (loops / benchtime) - -def Proc1(PtrParIn): - PtrParIn.PtrComp = NextRecord = PtrGlb.copy() - PtrParIn.IntComp = 5 - NextRecord.IntComp = PtrParIn.IntComp - NextRecord.PtrComp = PtrParIn.PtrComp - NextRecord.PtrComp = Proc3(NextRecord.PtrComp) - if NextRecord.Discr == Ident1: - NextRecord.IntComp = 6 - NextRecord.EnumComp = Proc6(PtrParIn.EnumComp) - NextRecord.PtrComp = PtrGlb.PtrComp - NextRecord.IntComp = Proc7(NextRecord.IntComp, 10) - else: - PtrParIn = NextRecord.copy() - NextRecord.PtrComp = None - return PtrParIn - -def Proc2(IntParIO): - IntLoc = IntParIO + 10 - while 1: - if Char1Glob == 'A': - IntLoc = IntLoc - 1 - IntParIO = IntLoc - IntGlob - EnumLoc = Ident1 - if EnumLoc == Ident1: - break - return IntParIO - -def Proc3(PtrParOut): - global IntGlob - - if PtrGlb is not None: - PtrParOut = PtrGlb.PtrComp - else: - IntGlob = 100 - PtrGlb.IntComp = Proc7(10, IntGlob) - return PtrParOut - -def Proc4(): - global Char2Glob - - BoolLoc = Char1Glob == 'A' - BoolLoc = BoolLoc or BoolGlob - Char2Glob = 'B' - -def Proc5(): - global Char1Glob - global BoolGlob - - Char1Glob = 'A' - BoolGlob = FALSE - -def Proc6(EnumParIn): - EnumParOut = EnumParIn - if not Func3(EnumParIn): - EnumParOut = Ident4 - if EnumParIn == Ident1: - EnumParOut = Ident1 - elif EnumParIn == Ident2: - if IntGlob > 100: - EnumParOut = Ident1 - else: - EnumParOut = Ident4 - elif EnumParIn == Ident3: - EnumParOut = Ident2 - elif EnumParIn == Ident4: - pass - elif EnumParIn == Ident5: - EnumParOut = Ident3 - return EnumParOut - -def Proc7(IntParI1, IntParI2): - IntLoc = IntParI1 + 2 - IntParOut = IntParI2 + IntLoc - return IntParOut - -def Proc8(Array1Par, Array2Par, IntParI1, IntParI2): - global IntGlob - - IntLoc = IntParI1 + 5 - Array1Par[IntLoc] = IntParI2 - Array1Par[IntLoc+1] = Array1Par[IntLoc] - Array1Par[IntLoc+30] = IntLoc - for IntIndex in range(IntLoc, IntLoc+2): - Array2Par[IntLoc][IntIndex] = IntLoc - Array2Par[IntLoc][IntLoc-1] = Array2Par[IntLoc][IntLoc-1] + 1 - Array2Par[IntLoc+20][IntLoc] = Array1Par[IntLoc] - IntGlob = 5 - -def Func1(CharPar1, CharPar2): - CharLoc1 = CharPar1 - CharLoc2 = CharLoc1 - if CharLoc2 != CharPar2: - return Ident1 - else: - return Ident2 - -def Func2(StrParI1, StrParI2): - IntLoc = 1 - while IntLoc <= 1: - if Func1(StrParI1[IntLoc], StrParI2[IntLoc+1]) == Ident1: - CharLoc = 'A' - IntLoc = IntLoc + 1 - if CharLoc >= 'W' and CharLoc <= 'Z': - IntLoc = 7 - if CharLoc == 'X': - return TRUE - else: - if StrParI1 > StrParI2: - IntLoc = IntLoc + 7 - return TRUE - else: - return FALSE - -def Func3(EnumParIn): - EnumLoc = EnumParIn - if EnumLoc == Ident3: return TRUE - return FALSE - -if __name__ == '__main__': - import sys - def error(msg): - print >>sys.stderr, msg, - print >>sys.stderr, "usage: %s [number_of_loops]" % sys.argv[0] - sys.exit(100) - nargs = len(sys.argv) - 1 - if nargs > 1: - error("%d arguments are too many;" % nargs) - elif nargs == 1: - try: loops = int(sys.argv[1]) - except ValueError: - error("Invalid argument %r;" % sys.argv[1]) - else: - loops = LOOPS - main(loops) - Deleted: /pypy/dist/pypy/lib/test2/support_tests.py ============================================================================== --- /pypy/dist/pypy/lib/test2/support_tests.py Sun May 1 13:38:15 2005 +++ (empty file) @@ -1,184 +0,0 @@ -"""Supporting definitions for the Python regression tests.""" - -''' -if __name__ != 'test.test_support': - raise ImportError, 'test_support must be imported from the test package' -''' - -import sys, os -from os import unlink - -try: - tmpdir = sys.pypy_getudir() -except AttributeError: - import py - tmpdir = str(py.test.ensuretemp('support_tests_tempdir')) -TESTFN = os.path.join(tmpdir, '@test') - -class Error(Exception): - """Base class for regression test exceptions.""" - -class TestFailed(Error): - """Test failed.""" - -class TestSkipped(Error): - """Test skipped. - - This can be raised to indicate that a test was deliberatly - skipped, but not because a feature wasn't available. For - example, if some resource can't be used, such as the network - appears to be unavailable, this should be raised instead of - TestFailed. - """ - -class ResourceDenied(TestSkipped): - """Test skipped because it requested a disallowed resource. - - This is raised when a test calls requires() for a resource that - has not be enabled. It is used to distinguish between expected - and unexpected skips. - """ - -verbose = 0 # Flag set to 0 by regrtest.py -use_resources = None # Flag set to [] by regrtest.py - -# _original_stdout is meant to hold stdout at the time regrtest began. -# This may be "the real" stdout, or IDLE's emulation of stdout, or whatever. -# The point is to have some flavor of stdout the user can actually see. -_original_stdout = None -def record_original_stdout(stdout): - global _original_stdout - _original_stdout = stdout - -def get_original_stdout(): - return _original_stdout or sys.stdout - -def unload(name): - try: - del sys.modules[name] - except KeyError: - pass - -def forget(modname): - '''"Forget" a module was ever imported by removing it from sys.modules and - deleting any .pyc and .pyo files.''' - unload(modname) - import os - for dirname in sys.path: - try: - os.unlink(os.path.join(dirname, modname + os.extsep + 'pyc')) - except os.error: - pass - # Deleting the .pyo file cannot be within the 'try' for the .pyc since - # the chance exists that there is no .pyc (and thus the 'try' statement - # is exited) but there is a .pyo file. - try: - os.unlink(os.path.join(dirname, modname + os.extsep + 'pyo')) - except os.error: - pass - -def is_resource_enabled(resource): - """Test whether a resource is enabled. Known resources are set by - regrtest.py.""" - return use_resources is not None and resource in use_resources - -def requires(resource, msg=None): - """Raise ResourceDenied if the specified resource is not available. - - If the caller's module is __main__ then automatically return True. The - possibility of False being returned occurs when regrtest.py is executing.""" - # see if the caller's module is __main__ - if so, treat as if - # the resource was set - if sys._getframe().f_back.f_globals.get("__name__") == "__main__": - return - if not is_resource_enabled(resource): - if msg is None: - msg = "Use of the `%s' resource not enabled" % resource - raise ResourceDenied(msg) - -FUZZ = 1e-6 - -def fcmp(x, y): # fuzzy comparison function - if type(x) == type(0.0) or type(y) == type(0.0): - try: - x, y = float(x), float(y) - fuzz = (abs(x) + abs(y)) * FUZZ - if abs(x-y) <= fuzz: - return 0 - except: - pass - elif type(x) == type(y) and type(x) in (type(()), type([])): - for i in range(min(len(x), len(y))): - outcome = fcmp(x[i], y[i]) - if outcome != 0: - return outcome - return cmp(len(x), len(y)) - return cmp(x, y) - -try: - unicode - have_unicode = 0 # XXX UNICODE 1 -except NameError: - have_unicode = 0 - -is_jython = sys.platform.startswith('java') - - - -##if fp is not None: -## fp.close() -##del fp - -def findfile(file, here=__file__): - """Try to find a file on sys.path and the working directory. If it is not - found the argument passed to the function is returned (this does not - necessarily signal failure; could still be the legitimate path).""" - import os - if os.path.isabs(file): - return file - path = sys.path - path = [os.path.dirname(here)] + path - for dn in path: - fn = os.path.join(dn, file) - if os.path.exists(fn): return fn - return file - -def verify(condition, reason='test failed'): - """Verify that condition is true. If not, raise TestFailed. - - The optional argument reason can be given to provide - a better error text. - """ - - if not condition: - raise TestFailed(reason) - -def vereq(a, b): - """Raise TestFailed if a == b is false. - - This is better than verify(a == b) because, in case of failure, the - error message incorporates repr(a) and repr(b) so you can see the - inputs. - - Note that "not (a == b)" isn't necessarily the same as "a != b"; the - former is tested. - """ - - if not (a == b): - raise TestFailed, "%r == %r" % (a, b) - -def sortdict(dict): - "Like repr(dict), but in sorted order." - items = dict.items() - items.sort() - reprpairs = ["%r: %r" % pair for pair in items] - withcommas = ", ".join(reprpairs) - return "{%s}" % withcommas - -def check_syntax(statement): - try: - compile(statement, '', 'exec') - except SyntaxError: - pass - else: - print 'Missing SyntaxError: "%s"' % statement Deleted: /pypy/dist/pypy/lib/test2/test_binascii_extra.py ============================================================================== --- /pypy/dist/pypy/lib/test2/test_binascii_extra.py Sun May 1 13:38:15 2005 +++ (empty file) @@ -1,21 +0,0 @@ - -import unittest -import binascii - -class TestBinAscii(unittest.TestCase): - def test_uu(self): - assert binascii.b2a_uu('1234567') == "',3(S-#4V-P \n" - assert binascii.b2a_uu('123456789012345678901234567890123456789012345') == 'M,3(S-#4V-S at Y,#$R,S0U-C> 1 -1 >> testme - -testme << 1 -1 << testme - -testme & 1 -1 & testme - -testme | 1 -1 | testme - -testme ^ 1 -1 ^ testme - - -# List/dict operations - -1 in testme - -testme[1] -testme[1] = 1 -del testme[1] - -testme[:42] -testme[:42] = "The Answer" -del testme[:42] - -testme[2:1024:10] -testme[2:1024:10] = "A lot" -del testme[2:1024:10] - -testme[:42, ..., :24:, 24, 100] -testme[:42, ..., :24:, 24, 100] = "Strange" -del testme[:42, ..., :24:, 24, 100] - - -# Now remove the slice hooks to see if converting normal slices to slice -# object works. - -del AllTests.__getslice__ -del AllTests.__setslice__ -del AllTests.__delslice__ - -import sys -if sys.platform[:4] != 'java': - testme[:42] - testme[:42] = "The Answer" - del testme[:42] -else: - # This works under Jython, but the actual slice values are - # different. - print "__getitem__: (slice(0, 42, None),)" - print "__setitem__: (slice(0, 42, None), 'The Answer')" - print "__delitem__: (slice(0, 42, None),)" - -# Unary operations - --testme -+testme -abs(testme) -int(testme) -long(testme) -float(testme) -oct(testme) -hex(testme) - -# And the rest... - -hash(testme) -repr(testme) -str(testme) - -testme == 1 -testme < 1 -testme > 1 -testme <> 1 -testme != 1 -1 == testme -1 < testme -1 > testme -1 <> testme -1 != testme - -# This test has to be last (duh.) - -del testme -if sys.platform[:4] == 'java': - import java - java.lang.System.gc() - -# Interfering tests - -class ExtraTests: - def __getattr__(self, *args): - print "__getattr__:", args - return "SomeVal" - - def __setattr__(self, *args): - print "__setattr__:", args - - def __delattr__(self, *args): - print "__delattr__:", args - -testme = ExtraTests() -testme.spam -testme.eggs = "spam, spam, spam and ham" -del testme.cardinal - - -# return values of some method are type-checked -class BadTypeClass: - def __int__(self): - return None - __float__ = __int__ - __long__ = __int__ - __str__ = __int__ - __repr__ = __int__ - __oct__ = __int__ - __hex__ = __int__ - -def check_exc(stmt, exception): - """Raise TestFailed if executing 'stmt' does not raise 'exception' - """ - try: - exec stmt - except exception: - pass - else: - raise TestFailed, "%s should raise %s" % (stmt, exception) - -check_exc("int(BadTypeClass())", TypeError) -check_exc("float(BadTypeClass())", TypeError) -check_exc("long(BadTypeClass())", TypeError) -check_exc("str(BadTypeClass())", TypeError) -check_exc("repr(BadTypeClass())", TypeError) -check_exc("oct(BadTypeClass())", TypeError) -check_exc("hex(BadTypeClass())", TypeError) - -# mixing up ints and longs is okay -class IntLongMixClass: - def __int__(self): - return 0L - - def __long__(self): - return 0 - -try: - int(IntLongMixClass()) -except TypeError: - raise TestFailed, "TypeError should not be raised" - -try: - long(IntLongMixClass()) -except TypeError: - raise TestFailed, "TypeError should not be raised" - - -# Test correct errors from hash() on objects with comparisons but no __hash__ - -class C0: - pass - -hash(C0()) # This should work; the next two should raise TypeError - -class C1: - def __cmp__(self, other): return 0 - -check_exc("hash(C1())", TypeError) - -class C2: - def __eq__(self, other): return 1 - -check_exc("hash(C2())", TypeError) - -# Test for SF bug 532646 - -class A: - pass -A.__call__ = A() -a = A() -try: - a() # This should not segfault -except RuntimeError: - pass -else: - raise TestFailed, "how could this not have overflowed the stack?" - - -# Tests for exceptions raised in instance_getattr2(). - -def booh(self): - raise AttributeError, "booh" - -class A: - a = property(booh) -try: - A().a # Raised AttributeError: A instance has no attribute 'a' -except AttributeError, x: - if str(x) is not "booh": - print "attribute error for A().a got masked:", str(x) - -class E: - __eq__ = property(booh) -E() == E() # In debug mode, caused a C-level assert() to fail - -class I: - __init__ = property(booh) -try: - I() # In debug mode, printed XXX undetected error and raises AttributeError -except AttributeError, x: - pass -else: - print "attribute error for I.__init__ got masked" Deleted: /pypy/dist/pypy/lib/test2/test_cmathmodule.py ============================================================================== --- /pypy/dist/pypy/lib/test2/test_cmathmodule.py Sun May 1 13:38:15 2005 +++ (empty file) @@ -1,62 +0,0 @@ -#!/usr/bin/env python - -# taken from CPython 2.3 - -""" -Test module for functions in cmathmodule.py - -It seems the log and log10 functions are generating errors -due to numerical problems with floor() in complex.__div__. -""" - -import math -import cmath -import sys -import unittest -import autopath - -from pypy.appspace import cmathmodule -from pypy.appspace.test.test_complexobject import equal - -def enumerate(): - valueRange = [-12.34, -3, -1, -0.5, 0, 0.5, 1, 3, 12.34] - res = [] - for x0 in valueRange: - for y0 in valueRange: - z = complex(x0,y0) - res.append(z) - return res - - - -class TestCMathModule: - - def assertAEqual(self, a, b): - if not equal(a, b): - raise self.failureException, '%s ~== %s'%(a, b) - - def test_funcs(self): - "Compare many functions with CPython." - - for z in enumerate(): - - for op in "sqrt acos acosh asin asinh atan atanh cos cosh exp".split(): - if op == "atan" and equal(z, complex(0,-1)) or equal(z, complex(0,1)): - continue - if op == "atanh" and equal(z, complex(-1,0)) or equal(z, complex(1,0)): - continue - op0 = cmath.__dict__[op](z) - op1 = cmathmodule.__dict__[op](z) - self.assertAEqual(op0, op1) - - - def test_log_log10(self): - "Compare log/log10 functions with CPython." - - for z in enumerate(): - for op in "log log10".split(): - if z != 0: - op0 = cmath.__dict__[op](z) - op1 = cmathmodule.__dict__[op](z) - self.assertAEqual(op0, op1) - Deleted: /pypy/dist/pypy/lib/test2/test_codeccallbacks.py ============================================================================== --- /pypy/dist/pypy/lib/test2/test_codeccallbacks.py Sun May 1 13:38:15 2005 +++ (empty file) @@ -1,712 +0,0 @@ -import test.test_support, unittest -import sys, codecs, htmlentitydefs, unicodedata - -class PosReturn: - # this can be used for configurable callbacks - - def __init__(self): - self.pos = 0 - - def handle(self, exc): - oldpos = self.pos - realpos = oldpos - if realpos<0: - realpos = len(exc.object) + realpos - # if we don't advance this time, terminate on the next call - # otherwise we'd get an endless loop - if realpos <= exc.start: - self.pos = len(exc.object) - return (u"", oldpos) - -class CodecCallbackTest(unittest.TestCase): - - def test_xmlcharrefreplace(self): - # replace unencodable characters which numeric character entities. - # For ascii, latin-1 and charmaps this is completely implemented - # in C and should be reasonably fast. - s = u"\u30b9\u30d1\u30e2 \xe4nd eggs" - self.assertEqual( - s.encode("ascii", "xmlcharrefreplace"), - "スパモ änd eggs" - ) - self.assertEqual( - s.encode("latin-1", "xmlcharrefreplace"), - "スパモ \xe4nd eggs" - ) - - def test_xmlcharnamereplace(self): - # This time use a named character entity for unencodable - # characters, if one is available. - - def xmlcharnamereplace(exc): - if not isinstance(exc, UnicodeEncodeError): - raise TypeError("don't know how to handle %r" % exc) - l = [] - for c in exc.object[exc.start:exc.end]: - try: - l.append(u"&%s;" % htmlentitydefs.codepoint2name[ord(c)]) - except KeyError: - l.append(u"&#%d;" % ord(c)) - return (u"".join(l), exc.end) - - codecs.register_error( - "test.xmlcharnamereplace", xmlcharnamereplace) - - sin = u"\xab\u211c\xbb = \u2329\u1234\u20ac\u232a" - sout = "«ℜ» = ⟨ሴ€⟩" - self.assertEqual(codecs.encode(sin,"ascii", "test.xmlcharnamereplace"), sout) - sout = "\xabℜ\xbb = ⟨ሴ€⟩" - self.assertEqual(codecs.encode(sin,"latin-1", "test.xmlcharnamereplace"), sout) - sout = "\xabℜ\xbb = ⟨ሴ\xa4⟩" - self.assertEqual(codecs.encode(sin,"iso-8859-15", "test.xmlcharnamereplace"), sout) - - def test_uninamereplace(self): - # We're using the names from the unicode database this time, - # and we're doing "syntax highlighting" here, i.e. we include - # the replaced text in ANSI escape sequences. For this it is - # useful that the error handler is not called for every single - # unencodable character, but for a complete sequence of - # unencodable characters, otherwise we would output many - # unneccessary escape sequences. - - def uninamereplace(exc): - if not isinstance(exc, UnicodeEncodeError): - raise TypeError("don't know how to handle %r" % exc) - l = [] - for c in exc.object[exc.start:exc.end]: - l.append(unicodedata.name(c, u"0x%x" % ord(c))) - return (u"\033[1m%s\033[0m" % u", ".join(l), exc.end) - - codecs.register_error( - "test.uninamereplace", uninamereplace) - - sin = u"\xac\u1234\u20ac\u8000" - sout = "\033[1mNOT SIGN, ETHIOPIC SYLLABLE SEE, EURO SIGN, CJK UNIFIED IDEOGRAPH-8000\033[0m" - self.assertEqual(codecs.encode(sin,"ascii", "test.uninamereplace"), sout) - - sout = "\xac\033[1mETHIOPIC SYLLABLE SEE, EURO SIGN, CJK UNIFIED IDEOGRAPH-8000\033[0m" - self.assertEqual(codecs.encode(sin,"latin-1", "test.uninamereplace"), sout) - - sout = "\xac\033[1mETHIOPIC SYLLABLE SEE\033[0m\xa4\033[1mCJK UNIFIED IDEOGRAPH-8000\033[0m" - self.assertEqual(codecs.encode(sin,"iso-8859-15", "test.uninamereplace"), sout) - - def test_backslashescape(self): - # Does the same as the "unicode-escape" encoding, but with different - # base encodings. - sin = u"a\xac\u1234\u20ac\u8000" - if sys.maxunicode > 0xffff: - sin += unichr(sys.maxunicode) - sout = "a\\xac\\u1234\\u20ac\\u8000" - if sys.maxunicode > 0xffff: - sout += "\\U%08x" % sys.maxunicode - self.assertEqual(codecs.encode(sin,"ascii", "backslashreplace"), sout) - - sout = "a\xac\\u1234\\u20ac\\u8000" - if sys.maxunicode > 0xffff: - sout += "\\U%08x" % sys.maxunicode - self.assertEqual(codecs.encode(sin,"latin-1", "backslashreplace"), sout) - - sout = "a\xac\\u1234\xa4\\u8000" - if sys.maxunicode > 0xffff: - sout += "\\U%08x" % sys.maxunicode - self.assertEqual(codecs.encode(sin,"iso-8859-15", "backslashreplace"), sout) - - def test_relaxedutf8(self): - # This is the test for a decoding callback handler, - # that relaxes the UTF-8 minimal encoding restriction. - # A null byte that is encoded as "\xc0\x80" will be - # decoded as a null byte. All other illegal sequences - # will be handled strictly. - def relaxedutf8(exc): - if not isinstance(exc, UnicodeDecodeError): - raise TypeError("don't know how to handle %r" % exc) - if exc.object[exc.start:exc.end].startswith("\xc0\x80"): - return (u"\x00", exc.start+2) # retry after two bytes - else: - raise exc - - codecs.register_error( - "test.relaxedutf8", relaxedutf8) - - sin = "a\x00b\xc0\x80c\xc3\xbc\xc0\x80\xc0\x80" - sout = u"a\x00b\x00c\xfc\x00\x00" - self.assertEqual(codecs.decode(sin,"utf-8", "test.relaxedutf8"), sout) - sin = "\xc0\x80\xc0\x81" - self.assertRaises(UnicodeError, codecs.decode,sin, "utf-8", "test.relaxedutf8") - - def test_charmapencode(self): - # For charmap encodings the replacement string will be - # mapped through the encoding again. This means, that - # to be able to use e.g. the "replace" handler, the - # charmap has to have a mapping for "?". - charmap = dict([ (ord(c), 2*c.upper()) for c in "abcdefgh"]) - sin = u"abc" - sout = "AABBCC" - self.assertEquals(codecs.charmap_encode(sin, "strict", charmap)[0], sout) - - sin = u"abcA" - self.assertRaises(UnicodeError, codecs.charmap_encode, sin, "strict", charmap) - - charmap[ord("?")] = "XYZ" - sin = u"abcDEF" - sout = "AABBCCXYZXYZXYZ" - self.assertEquals(codecs.charmap_encode(sin, "replace", charmap)[0], sout) - - charmap[ord("?")] = u"XYZ" - self.assertRaises(TypeError, codecs.charmap_encode, sin, "replace", charmap) - - charmap[ord("?")] = u"XYZ" - self.assertRaises(TypeError, codecs.charmap_encode, sin, "replace", charmap) - - def test_callbacks(self): - def handler1(exc): - if not isinstance(exc, UnicodeEncodeError) \ - and not isinstance(exc, UnicodeDecodeError): - raise TypeError("don't know how to handle %r" % exc) - l = [u"<%d>" % ord(exc.object[pos]) for pos in xrange(exc.start, exc.end)] - return (u"[%s]" % u"".join(l), exc.end) - - codecs.register_error("test.handler1", handler1) - - def handler2(exc): - if not isinstance(exc, UnicodeDecodeError): - raise TypeError("don't know how to handle %r" % exc) - l = [u"<%d>" % ord(exc.object[pos]) for pos in xrange(exc.start, exc.end)] - return (u"[%s]" % u"".join(l), exc.end+1) # skip one character - - codecs.register_error("test.handler2", handler2) - - s = "\x00\x81\x7f\x80\xff" - - self.assertEqual( - codecs.decode(s,"ascii", "test.handler1"), - u"\x00[<129>]\x7f[<128>][<255>]" - ) - self.assertEqual( - codecs.decode(s,"ascii", "test.handler2"), - u"\x00[<129>][<128>]" - ) - - self.assertEqual( - codecs.decode("\\u3042\u3xxx","unicode-escape", "test.handler1"), - u"\u3042[<92><117><51><120>]xx" - ) - - self.assertEqual( - codecs.decode("\\u3042\u3xx","unicode-escape", "test.handler1"), - u"\u3042[<92><117><51><120><120>]" - ) - - self.assertEqual( - codecs.charmap_decode("abc", "test.handler1", {ord("a"): u"z"})[0], - u"z[<98>][<99>]" - ) - - self.assertEqual( - codecs.encode(u"g\xfc\xdfrk","ascii", "test.handler1"), - u"g[<252><223>]rk" - ) - - self.assertEqual( - codecs.encode(u"g\xfc\xdf","ascii", "test.handler1"), - u"g[<252><223>]" - ) - - def test_longstrings(self): - # test long strings to check for memory overflow problems - errors = [ "strict", "ignore", "replace", "xmlcharrefreplace", "backslashreplace"] - # register the handlers under different names, - # to prevent the codec from recognizing the name - for err in errors: - codecs.register_error("test." + err, codecs.lookup_error(err)) - l = 1000 - errors += [ "test." + err for err in errors ] - for uni in [ s*l for s in (u"x", u"\u3042", u"a\xe4") ]: - for enc in ("ascii", "latin-1", "iso-8859-1", "iso-8859-15", "utf-8", "utf-7", "utf-16"): - for err in errors: - try: - codecs.encode(uni,enc, err) - except UnicodeError: - pass - - def check_exceptionobjectargs(self, exctype, args, msg): - # Test UnicodeError subclasses: construction, attribute assignment and __str__ conversion - # check with one missing argument - self.assertRaises(TypeError, exctype, *args[:-1]) - # check with one argument too much - self.assertRaises(TypeError, exctype, *(args + ["too much"])) - # check with one argument of the wrong type - wrongargs = [ "spam", u"eggs", 42, 1.0, None ] - for i in xrange(len(args)): - for wrongarg in wrongargs: - if type(wrongarg) is type(args[i]): - continue - # build argument array - callargs = [] - for j in xrange(len(args)): - if i==j: - callargs.append(wrongarg) - else: - callargs.append(args[i]) - self.assertRaises(TypeError, exctype, *callargs) - - # check with the correct number and type of arguments - exc = exctype(*args) - self.assertEquals(str(exc), msg) - - def test_unicodeencodeerror(self): - self.check_exceptionobjectargs( - UnicodeEncodeError, - ["ascii", u"g\xfcrk", 1, 2, "ouch"], - "'ascii' codec can't encode character u'\\xfc' in position 1: ouch" - ) - self.check_exceptionobjectargs( - UnicodeEncodeError, - ["ascii", u"g\xfcrk", 1, 4, "ouch"], - "'ascii' codec can't encode characters in position 1-3: ouch" - ) - self.check_exceptionobjectargs( - UnicodeEncodeError, - ["ascii", u"\xfcx", 0, 1, "ouch"], - "'ascii' codec can't encode character u'\\xfc' in position 0: ouch" - ) - self.check_exceptionobjectargs( - UnicodeEncodeError, - ["ascii", u"\u0100x", 0, 1, "ouch"], - "'ascii' codec can't encode character u'\\u0100' in position 0: ouch" - ) - self.check_exceptionobjectargs( - UnicodeEncodeError, - ["ascii", u"\uffffx", 0, 1, "ouch"], - "'ascii' codec can't encode character u'\\uffff' in position 0: ouch" - ) - if sys.maxunicode > 0xffff: - self.check_exceptionobjectargs( - UnicodeEncodeError, - ["ascii", u"\U00010000x", 0, 1, "ouch"], - "'ascii' codec can't encode character u'\\U00010000' in position 0: ouch" - ) - - def test_unicodedecodeerror(self): - self.check_exceptionobjectargs( - UnicodeDecodeError, - ["ascii", "g\xfcrk", 1, 2, "ouch"], - "'ascii' codec can't decode byte 0xfc in position 1: ouch" - ) - self.check_exceptionobjectargs( - UnicodeDecodeError, - ["ascii", "g\xfcrk", 1, 3, "ouch"], - "'ascii' codec can't decode bytes in position 1-2: ouch" - ) - - def test_unicodetranslateerror(self): - self.check_exceptionobjectargs( - UnicodeTranslateError, - [u"g\xfcrk", 1, 2, "ouch"], - "can't translate character u'\\xfc' in position 1: ouch" - ) - self.check_exceptionobjectargs( - UnicodeTranslateError, - [u"g\u0100rk", 1, 2, "ouch"], - "can't translate character u'\\u0100' in position 1: ouch" - ) - self.check_exceptionobjectargs( - UnicodeTranslateError, - [u"g\uffffrk", 1, 2, "ouch"], - "can't translate character u'\\uffff' in position 1: ouch" - ) - if sys.maxunicode > 0xffff: - self.check_exceptionobjectargs( - UnicodeTranslateError, - [u"g\U00010000rk", 1, 2, "ouch"], - "can't translate character u'\\U00010000' in position 1: ouch" - ) - self.check_exceptionobjectargs( - UnicodeTranslateError, - [u"g\xfcrk", 1, 3, "ouch"], - "can't translate characters in position 1-2: ouch" - ) - - def test_badandgoodstrictexceptions(self): - # "strict" complains about a non-exception passed in - self.assertRaises( - TypeError, - codecs.strict_errors, - 42 - ) - # "strict" complains about the wrong exception type - self.assertRaises( - Exception, - codecs.strict_errors, - Exception("ouch") - ) - - # If the correct exception is passed in, "strict" raises it - self.assertRaises( - UnicodeEncodeError, - codecs.strict_errors, - UnicodeEncodeError("ascii", u"\u3042", 0, 1, "ouch") - ) - - def test_badandgoodignoreexceptions(self): - # "ignore" complains about a non-exception passed in - self.assertRaises( - TypeError, - codecs.ignore_errors, - 42 - ) - # "ignore" complains about the wrong exception type - self.assertRaises( - TypeError, - codecs.ignore_errors, - UnicodeError("ouch") - ) - # If the correct exception is passed in, "ignore" returns an empty replacement - self.assertEquals( - codecs.ignore_errors(UnicodeEncodeError("ascii", u"\u3042", 0, 1, "ouch")), - (u"", 1) - ) - self.assertEquals( - codecs.ignore_errors(UnicodeDecodeError("ascii", "\xff", 0, 1, "ouch")), - (u"", 1) - ) - self.assertEquals( - codecs.ignore_errors(UnicodeTranslateError(u"\u3042", 0, 1, "ouch")), - (u"", 1) - ) - - def test_badandgoodreplaceexceptions(self): - # "replace" complains about a non-exception passed in - self.assertRaises( - TypeError, - codecs.replace_errors, - 42 - ) - # "replace" complains about the wrong exception type - self.assertRaises( - TypeError, - codecs.replace_errors, - UnicodeError("ouch") - ) - # With the correct exception, "ignore" returns an empty replacement - self.assertEquals( - codecs.replace_errors(UnicodeEncodeError("ascii", u"\u3042", 0, 1, "ouch")), - (u"?", 1) - ) - self.assertEquals( - codecs.replace_errors(UnicodeDecodeError("ascii", "\xff", 0, 1, "ouch")), - (u"\ufffd", 1) - ) - self.assertEquals( - codecs.replace_errors(UnicodeTranslateError(u"\u3042", 0, 1, "ouch")), - (u"\ufffd", 1) - ) - - def test_badandgoodxmlcharrefreplaceexceptions(self): - # "xmlcharrefreplace" complains about a non-exception passed in - self.assertRaises( - TypeError, - codecs.xmlcharrefreplace_errors, - 42 - ) - # "xmlcharrefreplace" complains about the wrong exception types - self.assertRaises( - TypeError, - codecs.xmlcharrefreplace_errors, - UnicodeError("ouch") - ) - # "xmlcharrefreplace" can only be used for encoding - self.assertRaises( - TypeError, - codecs.xmlcharrefreplace_errors, - UnicodeDecodeError("ascii", "\xff", 0, 1, "ouch") - ) - self.assertRaises( - TypeError, - codecs.xmlcharrefreplace_errors, - UnicodeTranslateError(u"\u3042", 0, 1, "ouch") - ) - # Use the correct exception - self.assertEquals( - codecs.xmlcharrefreplace_errors(UnicodeEncodeError("ascii", u"\u3042", 0, 1, "ouch")), - (u"&#%d;" % 0x3042, 1) - ) - - def test_badandgoodbackslashreplaceexceptions(self): - # "backslashreplace" complains about a non-exception passed in - self.assertRaises( - TypeError, - codecs.backslashreplace_errors, - 42 - ) - # "backslashreplace" complains about the wrong exception types - self.assertRaises( - TypeError, - codecs.backslashreplace_errors, - UnicodeError("ouch") - ) - # "backslashreplace" can only be used for encoding - self.assertRaises( - TypeError, - codecs.backslashreplace_errors, - UnicodeDecodeError("ascii", "\xff", 0, 1, "ouch") - ) - self.assertRaises( - TypeError, - codecs.backslashreplace_errors, - UnicodeTranslateError(u"\u3042", 0, 1, "ouch") - ) - # Use the correct exception - self.assertEquals( - codecs.backslashreplace_errors(UnicodeEncodeError("ascii", u"\u3042", 0, 1, "ouch")), - (u"\\u3042", 1) - ) - self.assertEquals( - codecs.backslashreplace_errors(UnicodeEncodeError("ascii", u"\x00", 0, 1, "ouch")), - (u"\\x00", 1) - ) - self.assertEquals( - codecs.backslashreplace_errors(UnicodeEncodeError("ascii", u"\xff", 0, 1, "ouch")), - (u"\\xff", 1) - ) - self.assertEquals( - codecs.backslashreplace_errors(UnicodeEncodeError("ascii", u"\u0100", 0, 1, "ouch")), - (u"\\u0100", 1) - ) - self.assertEquals( - codecs.backslashreplace_errors(UnicodeEncodeError("ascii", u"\uffff", 0, 1, "ouch")), - (u"\\uffff", 1) - ) - if sys.maxunicode>0xffff: - self.assertEquals( - codecs.backslashreplace_errors(UnicodeEncodeError("ascii", u"\U00010000", 0, 1, "ouch")), - (u"\\U00010000", 1) - ) - self.assertEquals( - codecs.backslashreplace_errors(UnicodeEncodeError("ascii", u"\U0010ffff", 0, 1, "ouch")), - (u"\\U0010ffff", 1) - ) - - def test_badhandlerresults(self): - results = ( 42, u"foo", (1,2,3), (u"foo", 1, 3), (u"foo", None), (u"foo",), ("foo", 1, 3), ("foo", None), ("foo",) ) - encs = ("ascii", "latin-1", "iso-8859-1", "iso-8859-15") - - for res in results: - codecs.register_error("test.badhandler", lambda: res) - for enc in encs: - self.assertRaises( - TypeError, - codecs.encode, - u"\u3042", - enc, - "test.badhandler" - ) - for (enc, bytes) in ( - ("ascii", "\xff"), - ("utf-8", "\xff"), - ("utf-7", "+x-") - ): - self.assertRaises( - TypeError, - codecs.decode, - bytes, - enc, - "test.badhandler" - ) - - def test_lookup(self): - self.assertEquals(codecs.strict_errors, codecs.lookup_error("strict")) - self.assertEquals(codecs.ignore_errors, codecs.lookup_error("ignore")) - self.assertEquals(codecs.strict_errors, codecs.lookup_error("strict")) - self.assertEquals( - codecs.xmlcharrefreplace_errors, - codecs.lookup_error("xmlcharrefreplace") - ) - self.assertEquals( - codecs.backslashreplace_errors, - codecs.lookup_error("backslashreplace") - ) - - def test_unencodablereplacement(self): - def unencrepl(exc): - if isinstance(exc, UnicodeEncodeError): - return (u"\u4242", exc.end) - else: - raise TypeError("don't know how to handle %r" % exc) - codecs.register_error("test.unencreplhandler", unencrepl) - for enc in ("ascii", "iso-8859-1", "iso-8859-15"): - self.assertRaises( - UnicodeEncodeError, - codecs.encode, - u"\u4242", - enc, - "test.unencreplhandler" - ) - - def test_badregistercall(self): - # enhance coverage of: - # Modules/_codecsmodule.c::register_error() - # Python/codecs.c::PyCodec_RegisterError() - self.assertRaises(TypeError, codecs.register_error, 42) - self.assertRaises(TypeError, codecs.register_error, "test.dummy", 42) - - def test_unknownhandler(self): - # enhance coverage of: - # Modules/_codecsmodule.c::lookup_error() - self.assertRaises(LookupError, codecs.lookup_error, "test.unknown") - - def test_xmlcharrefvalues(self): - # enhance coverage of: - # Python/codecs.c::PyCodec_XMLCharRefReplaceErrors() - # and inline implementations - v = (1, 5, 10, 50, 100, 500, 1000, 5000, 10000, 50000) - if sys.maxunicode>=100000: - v += (100000, 500000, 1000000) - s = u"".join([unichr(x) for x in v]) - codecs.register_error("test.xmlcharrefreplace", codecs.xmlcharrefreplace_errors) - for enc in ("ascii", "iso-8859-15"): - for err in ("xmlcharrefreplace", "test.xmlcharrefreplace"): - codecs.encode(s,enc, err) - - def test_decodehelper(self): - # enhance coverage of: - # Objects/unicodeobject.c::unicode_decode_call_errorhandler() - # and callers - self.assertRaises(LookupError, codecs.decode,"\xff", "ascii", "test.unknown") - - def baddecodereturn1(exc): - return 42 - codecs.register_error("test.baddecodereturn1", baddecodereturn1) - self.assertRaises(TypeError, codecs.decode, "\xff", "ascii", "test.baddecodereturn1") - self.assertRaises(TypeError, codecs.decode, "\\", "unicode-escape", "test.baddecodereturn1") - self.assertRaises(TypeError, codecs.decode, "\\x0", "unicode-escape", "test.baddecodereturn1") - self.assertRaises(TypeError, codecs.decode, "\\x0y", "unicode-escape", "test.baddecodereturn1") - self.assertRaises(TypeError, codecs.decode, "\\Uffffeeee", "unicode-escape", "test.baddecodereturn1") - self.assertRaises(TypeError, codecs.decode, "\\uyyyy", "raw-unicode-escape", "test.baddecodereturn1") - - def baddecodereturn2(exc): - return (u"?", None) - codecs.register_error("test.baddecodereturn2", baddecodereturn2) - self.assertRaises(TypeError, codecs.decode, "\xff", "ascii", "test.baddecodereturn2") - - handler = PosReturn() - codecs.register_error("test.posreturn", handler.handle) - - # Valid negative position - handler.pos = -1 - self.assertEquals(codecs.decode( "\xff0","ascii", "test.posreturn"), u"0") - - # Valid negative position - handler.pos = -2 - self.assertEquals(codecs.decode("\xff0","ascii", "test.posreturn"), u"") - - # Negative position out of bounds - handler.pos = -3 - self.assertRaises(IndexError, codecs.decode,"\xff0", "ascii", "test.posreturn") - - # Valid positive position - handler.pos = 1 - self.assertEquals(codecs.decode("\xff0","ascii", "test.posreturn"), u"0") - - # Largest valid positive position (one beyond end of input - handler.pos = 2 - self.assertEquals(codecs.decode("\xff0","ascii", "test.posreturn"), u"") - - # Invalid positive position - handler.pos = 3 - self.assertRaises(IndexError, codecs.decode,"\xff0", "ascii", "test.posreturn") - - # Restart at the "0" - handler.pos = 6 - self.assertEquals(codecs.decode("\\uyyyy0","raw-unicode-escape", "test.posreturn"), u"0") - - class D(dict): - def __getitem__(self, key): - raise ValueError - self.assertRaises(UnicodeError, codecs.charmap_decode, "\xff", "strict", {0xff: None}) - self.assertRaises(ValueError, codecs.charmap_decode, "\xff", "strict", D()) - self.assertRaises(TypeError, codecs.charmap_decode, "\xff", "strict", {0xff: sys.maxunicode+1}) - - def test_encodehelper(self): - # enhance coverage of: - # Objects/unicodeobject.c::unicode_encode_call_errorhandler() - # and callers - self.assertRaises(LookupError, codecs.decode,u"\xff", "ascii", "test.unknown") - - def badencodereturn1(exc): - return 42 - codecs.register_error("test.badencodereturn1", badencodereturn1) - self.assertRaises(TypeError, codecs.decode, u"\xff", "ascii", "test.badencodereturn1") - - def badencodereturn2(exc): - return (u"?", None) - codecs.register_error("test.badencodereturn2", badencodereturn2) - self.assertRaises(TypeError, codecs.decode,u"\xff", "ascii", "test.badencodereturn2") - - handler = PosReturn() - codecs.register_error("test.posreturn", handler.handle) - - # Valid negative position - handler.pos = -1 - self.assertEquals(u"\xff0".encode("ascii", "test.posreturn"), "0") - - # Valid negative position - handler.pos = -2 - self.assertEquals(u"\xff0".encode("ascii", "test.posreturn"), "") - - # Negative position out of bounds - handler.pos = -3 - self.assertRaises(IndexError, u"\xff0".encode, "ascii", "test.posreturn") - - # Valid positive position - handler.pos = 1 - self.assertEquals(u"\xff0".encode("ascii", "test.posreturn"), "0") - - # Largest valid positive position (one beyond end of input - handler.pos = 2 - self.assertEquals(u"\xff0".encode("ascii", "test.posreturn"), "") - - # Invalid positive position - handler.pos = 3 - self.assertRaises(IndexError, u"\xff0".encode, "ascii", "test.posreturn") - - handler.pos = 0 - - class D(dict): - def __getitem__(self, key): - raise ValueError - for err in ("strict", "replace", "xmlcharrefreplace", "backslashreplace", "test.posreturn"): - self.assertRaises(UnicodeError, codecs.charmap_encode, u"\xff", err, {0xff: None}) - self.assertRaises(ValueError, codecs.charmap_encode, u"\xff", err, D()) - self.assertRaises(TypeError, codecs.charmap_encode, u"\xff", err, {0xff: 300}) - - def test_translatehelper(self): - # enhance coverage of: - # Objects/unicodeobject.c::unicode_encode_call_errorhandler() - # and callers - # (Unfortunately the errors argument is not directly accessible - # from Python, so we can't test that much) - class D(dict): - def __getitem__(self, key): - raise ValueError - self.assertRaises(ValueError, u"\xff".translate, D()) - self.assertRaises(TypeError, u"\xff".translate, {0xff: sys.maxunicode+1}) - self.assertRaises(TypeError, u"\xff".translate, {0xff: ()}) - - def test_bug828737(self): - charmap = { - ord("&"): u"&", - ord("<"): u"<", - ord(">"): u">", - ord('"'): u""", - } - - for n in (1, 10, 100, 1000): - text = u'abcghi'*n - text.translate(charmap) - -def test_main(): - test.test_support.run_unittest(CodecCallbackTest) - -if __name__ == "__main__": - test_main() Deleted: /pypy/dist/pypy/lib/test2/test_coercion.py ============================================================================== --- /pypy/dist/pypy/lib/test2/test_coercion.py Sun May 1 13:38:15 2005 +++ (empty file) @@ -1,118 +0,0 @@ -import copy -import sys -import warnings - -# Fake a number that implements numeric methods through __coerce__ -class CoerceNumber: - def __init__(self, arg): - self.arg = arg - - def __repr__(self): - return '' % repr(self.arg) - - def __coerce__(self, other): - if isinstance(other, CoerceNumber): - return self.arg, other.arg - else: - return (self.arg, other) - - -# Fake a number that implements numeric ops through methods. -class MethodNumber: - - def __init__(self,arg): - self.arg = arg - - def __repr__(self): - return '' % repr(self.arg) - - def __add__(self,other): - return self.arg + other - - def __radd__(self,other): - return other + self.arg - - def __sub__(self,other): - return self.arg - other - - def __rsub__(self,other): - return other - self.arg - - def __mul__(self,other): - return self.arg * other - - def __rmul__(self,other): - return other * self.arg - - def __div__(self,other): - return self.arg / other - - def __rdiv__(self,other): - return other / self.arg - - def __pow__(self,other): - return self.arg ** other - - def __rpow__(self,other): - return other ** self.arg - - def __mod__(self,other): - return self.arg % other - - def __rmod__(self,other): - return other % self.arg - - def __cmp__(self, other): - return cmp(self.arg, other) - - -candidates = [ 2, 4.0, 2L, 2+0j, [1], (2,), None, - MethodNumber(1), CoerceNumber(2)] - -infix_binops = [ '+', '-', '*', '/', '**', '%' ] -prefix_binops = [ 'divmod' ] - -def do_infix_binops(): - for a in candidates: - for b in candidates: - for op in infix_binops: - print '%s %s %s' % (a, op, b), - try: - x = eval('a %s b' % op) - except: - error = sys.exc_info()[:2] - print '... exceptions.%s' % error[0].__name__ - else: - print '=', x - try: - z = copy.copy(a) - except copy.Error: - z = a # assume it has no inplace ops - print '%s %s= %s' % (a, op, b), - try: - exec('z %s= b' % op) - except: - error = sys.exc_info()[:2] - print '... exceptions.%s' % error[0].__name__ - else: - print '=>', z - -def do_prefix_binops(): - for a in candidates: - for b in candidates: - for op in prefix_binops: - print '%s(%s, %s)' % (op, a, b), - try: - x = eval('%s(a, b)' % op) - except: - error = sys.exc_info()[:2] - print '... exceptions.%s' % error[0].__name__ - else: - print '=', x - -warnings.filterwarnings("ignore", - r'complex divmod\(\), // and % are deprecated', - DeprecationWarning, - r'test.test_coercion$') -do_infix_binops() -do_prefix_binops() Deleted: /pypy/dist/pypy/lib/test2/test_enumerate.py ============================================================================== --- /pypy/dist/pypy/lib/test2/test_enumerate.py Sun May 1 13:38:15 2005 +++ (empty file) @@ -1,146 +0,0 @@ -import unittest -from sets import Set - -from test import test_support - -class G: - 'Sequence using __getitem__' - def __init__(self, seqn): - self.seqn = seqn - def __getitem__(self, i): - return self.seqn[i] - -class I: - 'Sequence using iterator protocol' - def __init__(self, seqn): - self.seqn = seqn - self.i = 0 - def __iter__(self): - return self - def next(self): - if self.i >= len(self.seqn): raise StopIteration - v = self.seqn[self.i] - self.i += 1 - return v - -class Ig: - 'Sequence using iterator protocol defined with a generator' - def __init__(self, seqn): - self.seqn = seqn - self.i = 0 - def __iter__(self): - for val in self.seqn: - yield val - -class X: - 'Missing __getitem__ and __iter__' - def __init__(self, seqn): - self.seqn = seqn - self.i = 0 - def next(self): - if self.i >= len(self.seqn): raise StopIteration - v = self.seqn[self.i] - self.i += 1 - return v - -class E: - 'Test propagation of exceptions' - def __init__(self, seqn): - self.seqn = seqn - self.i = 0 - def __iter__(self): - return self - def next(self): - 3/0 - -class N: - 'Iterator missing next()' - def __init__(self, seqn): - self.seqn = seqn - self.i = 0 - def __iter__(self): - return self - -class EnumerateTestCase(unittest.TestCase): - - enum = enumerate - seq, res = 'abc', [(0,'a'), (1,'b'), (2,'c')] - - def test_basicfunction(self): - self.assertEqual(type(self.enum(self.seq)), self.enum) - e = self.enum(self.seq) - self.assertEqual(iter(e), e) - self.assertEqual(list(self.enum(self.seq)), self.res) - self.enum.__doc__ - - def test_getitemseqn(self): - self.assertEqual(list(self.enum(G(self.seq))), self.res) - e = self.enum(G('')) - self.assertRaises(StopIteration, e.next) - - def test_iteratorseqn(self): - self.assertEqual(list(self.enum(I(self.seq))), self.res) - e = self.enum(I('')) - self.assertRaises(StopIteration, e.next) - - def test_iteratorgenerator(self): - self.assertEqual(list(self.enum(Ig(self.seq))), self.res) - e = self.enum(Ig('')) - self.assertRaises(StopIteration, e.next) - - def test_noniterable(self): - self.assertRaises(TypeError, self.enum, X(self.seq)) - - def test_illformediterable(self): - self.assertRaises(TypeError, list, self.enum(N(self.seq))) - - def test_exception_propagation(self): - self.assertRaises(ZeroDivisionError, list, self.enum(E(self.seq))) - - def test_argumentcheck(self): - self.assertRaises(TypeError, self.enum) # no arguments - self.assertRaises(TypeError, self.enum, 1) # wrong type (not iterable) - self.assertRaises(TypeError, self.enum, 'abc', 2) # too many arguments - - #Don't test this in PyPy, since the tuple can't be reused - def DONOT_test_tuple_reuse(self): - # Tests an implementation detail where tuple is reused - # whenever nothing else holds a reference to it - self.assertEqual(len(Set(map(id, list(enumerate(self.seq))))), len(self.seq)) - self.assertEqual(len(Set(map(id, enumerate(self.seq)))), min(1,len(self.seq))) - -class MyEnum(enumerate): - pass - -class SubclassTestCase(EnumerateTestCase): - - enum = MyEnum - -class TestEmpty(EnumerateTestCase): - - seq, res = '', [] - -class TestBig(EnumerateTestCase): - ##original test (takes too long in PyPy): - #seq = range(10,20000, 2) - #res = zip(range(20000), seq) - - seq = range(10, 200, 2) - res = zip(range(200), seq) - - -def test_main(verbose=None): - testclasses = (EnumerateTestCase, SubclassTestCase, TestEmpty, TestBig) - test_support.run_unittest(*testclasses) - - # verify reference counting - import sys - if verbose and hasattr(sys, "gettotalrefcount"): - counts = [None] * 5 - for i in xrange(len(counts)): - test_support.run_unittest(*testclasses) - counts[i] = sys.gettotalrefcount() - print counts - -if __name__ == "__main__": - test_main(verbose=True) Deleted: /pypy/dist/pypy/lib/test2/test_exceptions.py ============================================================================== --- /pypy/dist/pypy/lib/test2/test_exceptions.py Sun May 1 13:38:15 2005 +++ (empty file) @@ -1,5 +0,0 @@ -import autopath - -def failing_app_test_import(): - import exceptions - assert exceptions.SyntaxError is SyntaxError Copied: pypy/dist/pypy/lib/test2/test_exceptions_extra.py (from r11683, pypy/dist/pypy/lib/test2/test_exceptions.py) ============================================================================== --- pypy/dist/pypy/lib/test2/test_exceptions.py (original) +++ pypy/dist/pypy/lib/test2/test_exceptions_extra.py Sun May 1 13:38:15 2005 @@ -1,5 +1,4 @@ -import autopath -def failing_app_test_import(): +def app_test_import(): import exceptions assert exceptions.SyntaxError is SyntaxError Deleted: /pypy/dist/pypy/lib/test2/test_file.py ============================================================================== --- /pypy/dist/pypy/lib/test2/test_file.py Sun May 1 13:38:15 2005 +++ (empty file) @@ -1,193 +0,0 @@ -import os -import autopath -# from pypy.appspace import _file -from pypy.tool.udir import udir -import py -import unittest - -class TestFile: - def setup_method(self, method): - filename = os.path.join(autopath.this_dir, 'test_file.py') - self.fd = file(filename, 'r') - - def teardown_method(self, method): - self.fd.close() - - def test_case_1(self): - assert self.fd.tell() == 0 - - def test_case_readonly(self): - fn = str(udir.join('temptestfile')) - f=file(fn, 'w') - assert f.name == fn - assert f.mode == 'w' - assert f.closed == False - assert f.encoding == None # Fix when we find out what this is - py.test.raises(TypeError, setattr, f, 'name', 42) - - - def test_from_cpython(self): - - from test.test_support import verify, TESTFN, TestFailed - from UserList import UserList - - # verify expected attributes exist - f = file(TESTFN, 'w') - softspace = f.softspace - f.name # merely shouldn't blow up - f.mode # ditto - f.closed # ditto - - # verify softspace is writable - f.softspace = softspace # merely shouldn't blow up - - # verify the others aren't - for attr in 'name', 'mode', 'closed': - try: - setattr(f, attr, 'oops') - except TypeError: - pass - else: - raise TestFailed('expected TypeError setting file attr %r' % attr) - f.close() - - # verify writelines with instance sequence - l = UserList(['1', '2']) - f = open(TESTFN, 'wb') - f.writelines(l) - f.close() - f = open(TESTFN, 'rb') - buf = f.read() - f.close() - verify(buf == '12') - - # verify writelines with integers - f = open(TESTFN, 'wb') - try: - f.writelines([1, 2, 3]) - except TypeError: - pass - else: - print "writelines accepted sequence of integers" - f.close() - - # verify writelines with integers in UserList - f = open(TESTFN, 'wb') - l = UserList([1,2,3]) - try: - f.writelines(l) - except TypeError: - pass - else: - print "writelines accepted sequence of integers" - f.close() - - # verify writelines with non-string object - class NonString: pass - - f = open(TESTFN, 'wb') - try: - f.writelines([NonString(), NonString()]) - except TypeError: - pass - else: - print "writelines accepted sequence of non-string objects" - f.close() - - # verify that we get a sensible error message for bad mode argument - bad_mode = "qwerty" - try: - open(TESTFN, bad_mode) - except IOError, msg: - pass # We have problems with Exceptions - if msg[0] != 0: - s = str(msg) - if s.find(TESTFN) != -1 or s.find(bad_mode) == -1: - print "bad error message for invalid mode: %s" % s - # if msg[0] == 0, we're probably on Windows where there may be - # no obvious way to discover why open() failed. - else: - print "no error for invalid mode: %s" % bad_mode - - f = open(TESTFN) - if f.name != TESTFN: - raise TestFailed, 'file.name should be "%s"' % TESTFN - - if f.isatty(): - raise TestFailed, 'file.isatty() should be false' - - if f.closed: - raise TestFailed, 'file.closed should be false' - - - f.close() - if not f.closed: - raise TestFailed, 'file.closed should be true' - - # make sure that explicitly setting the buffer size doesn't cause - # misbehaviour especially with repeated close() calls - for s in (-1, 0, 1, 512): - try: - f = open(TESTFN, 'w', s) - f.write(str(s)) - f.close() - f.close() - f = open(TESTFN, 'r', s) - d = int(f.read()) - f.close() - f.close() - except IOError, msg: - raise TestFailed, 'error setting buffer size %d: %s' % (s, str(msg)) - if d != s: - raise TestFailed, 'readback failure using buffer size %d' - - methods = ['fileno', 'flush', 'isatty', 'next', 'read', 'readline', - 'readlines', 'seek', 'tell', 'truncate', 'write', - 'xreadlines', '__iter__'] - - for methodname in methods: - method = getattr(f, methodname) - try: - method() - except ValueError: - pass - else: - raise TestFailed, 'file.%s() on a closed file should raise a ValueError' % methodname - - try: - f.writelines([]) - except ValueError: - pass - else: - raise TestFailed, 'file.writelines([]) on a closed file should raise a ValueError' - - os.unlink(TESTFN) - - def bug801631(): - # SF bug - # "file.truncate fault on windows" - f = file(TESTFN, 'wb') - f.write('12345678901') # 11 bytes - f.close() - - f = file(TESTFN,'rb+') - data = f.read(5) - if data != '12345': - raise TestFailed("Read on file opened for update failed %r" % data) - if f.tell() != 5: - raise TestFailed("File pos after read wrong %d" % f.tell()) - - f.truncate() - if f.tell() != 5: - raise TestFailed("File pos after ftruncate wrong %d" % f.tell()) - - f.close() - size = os.path.getsize(TESTFN) - if size != 5: - raise TestFailed("File size after ftruncate wrong %d" % size) - - try: - bug801631() - finally: - os.unlink(TESTFN) - Deleted: /pypy/dist/pypy/lib/test2/test_funcattrs.py ============================================================================== --- /pypy/dist/pypy/lib/test2/test_funcattrs.py Sun May 1 13:38:15 2005 +++ (empty file) @@ -1,383 +0,0 @@ -from test.test_support import verbose, TestFailed, verify -import types - -class F: - def a(self): - pass - -def b(): - 'my docstring' - pass - -# __module__ is a special attribute -verify(b.__module__ == __name__) -verify(verify.__module__ == "test.test_support") - -# setting attributes on functions -try: - b.publish -except AttributeError: pass -else: raise TestFailed, 'expected AttributeError' - -if b.__dict__ <> {}: - raise TestFailed, 'expected unassigned func.__dict__ to be {}' - -b.publish = 1 -if b.publish <> 1: - raise TestFailed, 'function attribute not set to expected value' - -docstring = 'its docstring' -b.__doc__ = docstring -if b.__doc__ <> docstring: - raise TestFailed, 'problem with setting __doc__ attribute' - -if 'publish' not in dir(b): - raise TestFailed, 'attribute not in dir()' - -try: - del b.__dict__ -except (AttributeError, TypeError): pass -else: raise TestFailed, 'expected AttributeError or TypeError' - -b.publish = 1 -try: - b.__dict__ = None -except TypeError: pass -else: raise TestFailed, 'func.__dict__ = None expected TypeError' - -d = {'hello': 'world'} -b.__dict__ = d -if b.func_dict is not d: - raise TestFailed, 'func.__dict__ assignment to dictionary failed' -if b.hello <> 'world': - raise TestFailed, 'attribute after func.__dict__ assignment failed' - -f1 = F() -f2 = F() - -try: - F.a.publish -except AttributeError: pass -else: raise TestFailed, 'expected AttributeError' - -try: - f1.a.publish -except AttributeError: pass -else: raise TestFailed, 'expected AttributeError' - -# In Python 2.1 beta 1, we disallowed setting attributes on unbound methods -# (it was already disallowed on bound methods). See the PEP for details. -try: - F.a.publish = 1 -except (AttributeError, TypeError): pass -else: raise TestFailed, 'expected AttributeError or TypeError' - -# But setting it explicitly on the underlying function object is okay. -F.a.im_func.publish = 1 - -if F.a.publish <> 1: - raise TestFailed, 'unbound method attribute not set to expected value' - -if f1.a.publish <> 1: - raise TestFailed, 'bound method attribute access did not work' - -if f2.a.publish <> 1: - raise TestFailed, 'bound method attribute access did not work' - -if 'publish' not in dir(F.a): - raise TestFailed, 'attribute not in dir()' - -try: - f1.a.publish = 0 -except (AttributeError, TypeError): pass -else: raise TestFailed, 'expected AttributeError or TypeError' - -# See the comment above about the change in semantics for Python 2.1b1 -try: - F.a.myclass = F -except (AttributeError, TypeError): pass -else: raise TestFailed, 'expected AttributeError or TypeError' - -F.a.im_func.myclass = F - -f1.a.myclass -f2.a.myclass -f1.a.myclass -F.a.myclass - -if f1.a.myclass is not f2.a.myclass or \ - f1.a.myclass is not F.a.myclass: - raise TestFailed, 'attributes were not the same' - -# try setting __dict__ -try: - F.a.__dict__ = (1, 2, 3) -except (AttributeError, TypeError): pass -else: raise TestFailed, 'expected TypeError or AttributeError' - -F.a.im_func.__dict__ = {'one': 11, 'two': 22, 'three': 33} - -if f1.a.two <> 22: - raise TestFailed, 'setting __dict__' - -from UserDict import UserDict -d = UserDict({'four': 44, 'five': 55}) - -try: - F.a.__dict__ = d -except (AttributeError, TypeError): pass -else: raise TestFailed - -if f2.a.one <> f1.a.one <> F.a.one <> 11: - raise TestFailed - -# im_func may not be a Python method! -import new -F.id = new.instancemethod(id, None, F) - -eff = F() -if eff.id() <> id(eff): - raise TestFailed - -try: - F.id.foo -except AttributeError: pass -else: raise TestFailed - -try: - F.id.foo = 12 -except (AttributeError, TypeError): pass -else: raise TestFailed - -try: - F.id.foo -except AttributeError: pass -else: raise TestFailed - -try: - eff.id.foo -except AttributeError: pass -else: raise TestFailed - -try: - eff.id.foo = 12 -except (AttributeError, TypeError): pass -else: raise TestFailed - -try: - eff.id.foo -except AttributeError: pass -else: raise TestFailed - -# Regression test for a crash in pre-2.1a1 -def another(): - pass - -try: - del another.__dict__ -except (TypeError, AttributeError): pass -else: raise TestFailed, 'del another.__dict__ did not fail' - -try: - del another.func_dict -except (TypeError, AttributeError): pass -else: raise TestFailed, 'del another.func_dict did not fail' - -try: - another.func_dict = None -except TypeError: pass -else: raise TestFailed - -try: - del another.bar -except AttributeError: pass -else: raise TestFailed - -# This isn't specifically related to function attributes, but it does test a -# core dump regression in funcobject.c -del another.func_defaults - -def foo(): - pass - -def bar(): - pass - -def temp(): - print 1 - -if foo==bar: - raise TestFailed - -d={} -d[foo] = 1 - -foo.func_code = temp.func_code - -d[foo] - -# Test all predefined function attributes systematically - -def cantset(obj, name, value): - verify(hasattr(obj, name)) # Otherwise it's probably a typo - try: - setattr(obj, name, value) - except (AttributeError, TypeError): - pass - else: - raise TestFailed, "shouldn't be able to set %s to %r" % (name, value) - try: - delattr(obj, name) - except (AttributeError, TypeError): - pass - else: - raise TestFailed, "shouldn't be able to del %s" % name - -def test_func_closure(): - a = 12 - def f(): print a - c = f.func_closure - verify(isinstance(c, tuple)) - verify(len(c) == 1) - verify(c[0].__class__.__name__ == "cell") # don't have a type object handy - cantset(f, "func_closure", c) - -def test_func_doc(): - def f(): pass - verify(f.__doc__ is None) - verify(f.func_doc is None) - f.__doc__ = "hello" - verify(f.__doc__ == "hello") - verify(f.func_doc == "hello") - del f.__doc__ - verify(f.__doc__ is None) - verify(f.func_doc is None) - f.func_doc = "world" - verify(f.__doc__ == "world") - verify(f.func_doc == "world") - del f.func_doc - verify(f.func_doc is None) - verify(f.__doc__ is None) - -def test_func_globals(): - def f(): pass - verify(f.func_globals is globals()) - cantset(f, "func_globals", globals()) - -def test_func_name(): - def f(): pass - verify(f.__name__ == "f") - verify(f.func_name == "f") - cantset(f, "func_name", "f") - cantset(f, "__name__", "f") - -def test_func_code(): - def f(): pass - def g(): print 12 - verify(type(f.func_code) is types.CodeType) - f.func_code = g.func_code - cantset(f, "func_code", None) - -def test_func_defaults(): - def f(a, b): return (a, b) - verify(f.func_defaults is None) - f.func_defaults = (1, 2) - verify(f.func_defaults == (1, 2)) - verify(f(10) == (10, 2)) - def g(a=1, b=2): return (a, b) - verify(g.func_defaults == (1, 2)) - del g.func_defaults - verify(g.func_defaults is None) - try: - g() - except TypeError: - pass - else: - raise TestFailed, "shouldn't be allowed to call g() w/o defaults" - -def test_func_dict(): - def f(): pass - a = f.__dict__ - b = f.func_dict - verify(a == {}) - verify(a is b) - f.hello = 'world' - verify(a == {'hello': 'world'}) - verify(f.func_dict is a is f.__dict__) - f.func_dict = {} - verify(not hasattr(f, "hello")) - f.__dict__ = {'world': 'hello'} - verify(f.world == "hello") - verify(f.__dict__ is f.func_dict == {'world': 'hello'}) - cantset(f, "func_dict", None) - cantset(f, "__dict__", None) - -def test_im_class(): - class C: - def foo(self): pass - verify(C.foo.im_class is C) - verify(C().foo.im_class is C) - cantset(C.foo, "im_class", C) - cantset(C().foo, "im_class", C) - -def test_im_func(): - def foo(self): pass - class C: - pass - C.foo = foo - verify(C.foo.im_func is foo) - verify(C().foo.im_func is foo) - cantset(C.foo, "im_func", foo) - cantset(C().foo, "im_func", foo) - -def test_im_self(): - class C: - def foo(self): pass - verify(C.foo.im_self is None) - c = C() - verify(c.foo.im_self is c) - cantset(C.foo, "im_self", None) - cantset(c.foo, "im_self", c) - -def test_im_dict(): - class C: - def foo(self): pass - foo.bar = 42 - verify(C.foo.__dict__ == {'bar': 42}) - verify(C().foo.__dict__ == {'bar': 42}) - cantset(C.foo, "__dict__", C.foo.__dict__) - cantset(C().foo, "__dict__", C.foo.__dict__) - -def test_im_doc(): - class C: - def foo(self): "hello" - verify(C.foo.__doc__ == "hello") - verify(C().foo.__doc__ == "hello") - cantset(C.foo, "__doc__", "hello") - cantset(C().foo, "__doc__", "hello") - -def test_im_name(): - class C: - def foo(self): pass - verify(C.foo.__name__ == "foo") - verify(C().foo.__name__ == "foo") - cantset(C.foo, "__name__", "foo") - cantset(C().foo, "__name__", "foo") - -def testmore(): - test_func_closure() - test_func_doc() - test_func_globals() - test_func_name() - test_func_code() - test_func_defaults() - test_func_dict() - # Tests for instance method attributes - test_im_class() - test_im_func() - test_im_self() - test_im_dict() - test_im_doc() - test_im_name() - -testmore() Deleted: /pypy/dist/pypy/lib/test2/test_itertools.py ============================================================================== --- /pypy/dist/pypy/lib/test2/test_itertools.py Sun May 1 13:38:15 2005 +++ (empty file) @@ -1,654 +0,0 @@ -import unittest -from test import test_support -from itertools import * -import sys -import operator - -def onearg(x): - 'Test function of one argument' - return 2*x - -def errfunc(*args): - 'Test function that raises an error' - raise ValueError - -def gen3(): - 'Non-restartable source sequence' - for i in (0, 1, 2): - yield i - -def isEven(x): - 'Test predicate' - return x%2==0 - -def isOdd(x): - 'Test predicate' - return x%2==1 - -class StopNow: - 'Class emulating an empty iterable.' - def __iter__(self): - return self - def next(self): - raise StopIteration - -def take(n, seq): - 'Convenience function for partially consuming a long of infinite iterable' - return list(islice(seq, n)) - -class TestBasicOps(unittest.TestCase): - def test_chain(self): - self.assertEqual(list(chain('abc', 'def')), list('abcdef')) - self.assertEqual(list(chain('abc')), list('abc')) - self.assertEqual(list(chain('')), []) - self.assertEqual(take(4, chain('abc', 'def')), list('abcd')) - self.assertRaises(TypeError, chain, 2, 3) - - def test_count(self): - self.assertEqual(zip('abc',count()), [('a', 0), ('b', 1), ('c', 2)]) - self.assertEqual(zip('abc',count(3)), [('a', 3), ('b', 4), ('c', 5)]) - self.assertEqual(take(2, zip('abc',count(3))), [('a', 3), ('b', 4)]) - self.assertRaises(TypeError, count, 2, 3) - self.assertRaises(TypeError, count, 'a') - c = count(sys.maxint-2) # verify that rollover doesn't crash - c.next(); c.next(); c.next(); c.next(); c.next() - - def test_cycle(self): - self.assertEqual(take(10, cycle('abc')), list('abcabcabca')) - self.assertEqual(list(cycle('')), []) - self.assertRaises(TypeError, cycle) - self.assertRaises(TypeError, cycle, 5) - self.assertEqual(list(islice(cycle(gen3()),10)), [0,1,2,0,1,2,0,1,2,0]) - - def test_ifilter(self): - self.assertEqual(list(ifilter(isEven, range(6))), [0,2,4]) - self.assertEqual(list(ifilter(None, [0,1,0,2,0])), [1,2]) - self.assertEqual(take(4, ifilter(isEven, count())), [0,2,4,6]) - self.assertRaises(TypeError, ifilter) - self.assertRaises(TypeError, ifilter, lambda x:x) - self.assertRaises(TypeError, ifilter, lambda x:x, range(6), 7) - self.assertRaises(TypeError, ifilter, isEven, 3) - self.assertRaises(TypeError, ifilter(range(6), range(6)).next) - - def test_ifilterfalse(self): - self.assertEqual(list(ifilterfalse(isEven, range(6))), [1,3,5]) - self.assertEqual(list(ifilterfalse(None, [0,1,0,2,0])), [0,0,0]) - self.assertEqual(take(4, ifilterfalse(isEven, count())), [1,3,5,7]) - self.assertRaises(TypeError, ifilterfalse) - self.assertRaises(TypeError, ifilterfalse, lambda x:x) - self.assertRaises(TypeError, ifilterfalse, lambda x:x, range(6), 7) - self.assertRaises(TypeError, ifilterfalse, isEven, 3) - self.assertRaises(TypeError, ifilterfalse(range(6), range(6)).next) - - def test_izip(self): - ans = [(x,y) for x, y in izip('abc',count())] - self.assertEqual(ans, [('a', 0), ('b', 1), ('c', 2)]) - self.assertEqual(list(izip('abc', range(6))), zip('abc', range(6))) - self.assertEqual(list(izip('abcdef', range(3))), zip('abcdef', range(3))) - self.assertEqual(take(3,izip('abcdef', count())), zip('abcdef', range(3))) - self.assertEqual(list(izip('abcdef')), zip('abcdef')) - self.assertEqual(list(izip()), []) - self.assertRaises(TypeError, izip, 3) - self.assertRaises(TypeError, izip, range(3), 3) - # Check tuple re-use (implementation detail) - self.assertEqual([tuple(list(pair)) for pair in izip('abc', 'def')], - zip('abc', 'def')) - self.assertEqual([pair for pair in izip('abc', 'def')], - zip('abc', 'def')) - # the following test deals with a specific implementation detail, - # that izip "reuses" the SAME tuple object each time when it can; - # it does not apply correctly to pypy, so I'm commenting it -- AM - # ids = map(id, izip('abc', 'def')) - # self.assertEqual(min(ids), max(ids)) - ids = map(id, list(izip('abc', 'def'))) - self.assertEqual(len(dict.fromkeys(ids)), len(ids)) - - def test_repeat(self): - self.assertEqual(zip(xrange(3),repeat('a')), - [(0, 'a'), (1, 'a'), (2, 'a')]) - self.assertEqual(list(repeat('a', 3)), ['a', 'a', 'a']) - self.assertEqual(take(3, repeat('a')), ['a', 'a', 'a']) - self.assertEqual(list(repeat('a', 0)), []) - self.assertEqual(list(repeat('a', -3)), []) - self.assertRaises(TypeError, repeat) - self.assertRaises(TypeError, repeat, None, 3, 4) - self.assertRaises(TypeError, repeat, None, 'a') - - def test_imap(self): - self.assertEqual(list(imap(operator.pow, range(3), range(1,7))), - [0**1, 1**2, 2**3]) - self.assertEqual(list(imap(None, 'abc', range(5))), - [('a',0),('b',1),('c',2)]) - self.assertEqual(list(imap(None, 'abc', count())), - [('a',0),('b',1),('c',2)]) - self.assertEqual(take(2,imap(None, 'abc', count())), - [('a',0),('b',1)]) - self.assertEqual(list(imap(operator.pow, [])), []) - self.assertRaises(TypeError, imap) - self.assertRaises(TypeError, imap, operator.neg) - self.assertRaises(TypeError, imap(10, range(5)).next) - self.assertRaises(ValueError, imap(errfunc, [4], [5]).next) - self.assertRaises(TypeError, imap(onearg, [4], [5]).next) - - def test_starmap(self): - self.assertEqual(list(starmap(operator.pow, zip(range(3), range(1,7)))), - [0**1, 1**2, 2**3]) - self.assertEqual(take(3, starmap(operator.pow, izip(count(), count(1)))), - [0**1, 1**2, 2**3]) - self.assertEqual(list(starmap(operator.pow, [])), []) - self.assertRaises(TypeError, list, starmap(operator.pow, [[4,5]])) - self.assertRaises(TypeError, starmap) - self.assertRaises(TypeError, starmap, operator.pow, [(4,5)], 'extra') - self.assertRaises(TypeError, starmap(10, [(4,5)]).next) - self.assertRaises(ValueError, starmap(errfunc, [(4,5)]).next) - self.assertRaises(TypeError, starmap(onearg, [(4,5)]).next) - - def test_islice(self): - for args in [ # islice(args) should agree with range(args) - (10, 20, 3), - (10, 3, 20), - (10, 20), - (10, 3), - (20,) - ]: - self.assertEqual(list(islice(xrange(100), *args)), range(*args)) - - for args, tgtargs in [ # Stop when seqn is exhausted - ((10, 110, 3), ((10, 100, 3))), - ((10, 110), ((10, 100))), - ((110,), (100,)) - ]: - self.assertEqual(list(islice(xrange(100), *args)), range(*tgtargs)) - - # Test stop=None - self.assertEqual(list(islice(xrange(10), None)), range(10)) - self.assertEqual(list(islice(xrange(10), 2, None)), range(2, 10)) - self.assertEqual(list(islice(xrange(10), 1, None, 2)), range(1, 10, 2)) - - # Test invalid arguments - self.assertRaises(TypeError, islice, xrange(10)) - self.assertRaises(TypeError, islice, xrange(10), 1, 2, 3, 4) - self.assertRaises(ValueError, islice, xrange(10), -5, 10, 1) - self.assertRaises(ValueError, islice, xrange(10), 1, -5, -1) - self.assertRaises(ValueError, islice, xrange(10), 1, 10, -1) - self.assertRaises(ValueError, islice, xrange(10), 1, 10, 0) - self.assertRaises(ValueError, islice, xrange(10), 'a') - self.assertRaises(ValueError, islice, xrange(10), 'a', 1) - self.assertRaises(ValueError, islice, xrange(10), 1, 'a') - self.assertRaises(ValueError, islice, xrange(10), 'a', 1, 1) - self.assertRaises(ValueError, islice, xrange(10), 1, 'a', 1) - # too slow to test on pypy, weakened...: - # self.assertEqual(len(list(islice(count(), 1, 10, sys.maxint))), 1) - self.assertEqual(len(list(islice(count(), 1, 10, 99))), 1) - - def test_takewhile(self): - data = [1, 3, 5, 20, 2, 4, 6, 8] - underten = lambda x: x<10 - self.assertEqual(list(takewhile(underten, data)), [1, 3, 5]) - self.assertEqual(list(takewhile(underten, [])), []) - self.assertRaises(TypeError, takewhile) - self.assertRaises(TypeError, takewhile, operator.pow) - self.assertRaises(TypeError, takewhile, operator.pow, [(4,5)], 'extra') - self.assertRaises(TypeError, takewhile(10, [(4,5)]).next) - self.assertRaises(ValueError, takewhile(errfunc, [(4,5)]).next) - - def test_dropwhile(self): - data = [1, 3, 5, 20, 2, 4, 6, 8] - underten = lambda x: x<10 - self.assertEqual(list(dropwhile(underten, data)), [20, 2, 4, 6, 8]) - self.assertEqual(list(dropwhile(underten, [])), []) - self.assertRaises(TypeError, dropwhile) - self.assertRaises(TypeError, dropwhile, operator.pow) - self.assertRaises(TypeError, dropwhile, operator.pow, [(4,5)], 'extra') - self.assertRaises(TypeError, dropwhile(10, [(4,5)]).next) - self.assertRaises(ValueError, dropwhile(errfunc, [(4,5)]).next) - - def test_StopIteration(self): - self.assertRaises(StopIteration, izip().next) - - for f in (chain, cycle, izip): - self.assertRaises(StopIteration, f([]).next) - self.assertRaises(StopIteration, f(StopNow()).next) - - self.assertRaises(StopIteration, islice([], None).next) - self.assertRaises(StopIteration, islice(StopNow(), None).next) - - self.assertRaises(StopIteration, repeat(None, 0).next) - - for f in (ifilter, ifilterfalse, imap, takewhile, dropwhile, starmap): - self.assertRaises(StopIteration, f(lambda x:x, []).next) - self.assertRaises(StopIteration, f(lambda x:x, StopNow()).next) - -def R(seqn): - 'Regular generator' - for i in seqn: - yield i - -class G: - 'Sequence using __getitem__' - def __init__(self, seqn): - self.seqn = seqn - def __getitem__(self, i): - return self.seqn[i] - -class I: - 'Sequence using iterator protocol' - def __init__(self, seqn): - self.seqn = seqn - self.i = 0 - def __iter__(self): - return self - def next(self): - if self.i >= len(self.seqn): raise StopIteration - v = self.seqn[self.i] - self.i += 1 - return v - -class Ig: - 'Sequence using iterator protocol defined with a generator' - def __init__(self, seqn): - self.seqn = seqn - self.i = 0 - def __iter__(self): - for val in self.seqn: - yield val - -class X: - 'Missing __getitem__ and __iter__' - def __init__(self, seqn): - self.seqn = seqn - self.i = 0 - def next(self): - if self.i >= len(self.seqn): raise StopIteration - v = self.seqn[self.i] - self.i += 1 - return v - -class N: - 'Iterator missing next()' - def __init__(self, seqn): - self.seqn = seqn - self.i = 0 - def __iter__(self): - return self - -class E: - 'Test propagation of exceptions' - def __init__(self, seqn): - self.seqn = seqn - self.i = 0 - def __iter__(self): - return self - def next(self): - 3/0 - -class S: - 'Test immediate stop' - def __init__(self, seqn): - pass - def __iter__(self): - return self - def next(self): - raise StopIteration - -def L(seqn): - 'Test multiple tiers of iterators' - return chain(imap(lambda x:x, R(Ig(G(seqn))))) - -class TestGC(unittest.TestCase): - - def makecycle(self, iterator, container): - container.append(iterator) - iterator.next() - del container, iterator - - def test_chain(self): - a = [] - self.makecycle(chain(a), a) - - def test_cycle(self): - a = [] - self.makecycle(cycle([a]*2), a) - - def test_ifilter(self): - a = [] - self.makecycle(ifilter(lambda x:True, [a]*2), a) - - def test_ifilterfalse(self): - a = [] - self.makecycle(ifilterfalse(lambda x:False, a), a) - - def test_izip(self): - a = [] - self.makecycle(izip([a]*2, [a]*3), a) - - def test_imap(self): - a = [] - self.makecycle(imap(lambda x:x, [a]*2), a) - - def test_islice(self): - a = [] - self.makecycle(islice([a]*2, None), a) - - def test_starmap(self): - a = [] - self.makecycle(starmap(lambda *t: t, [(a,a)]*2), a) - - -class TestVariousIteratorArgs(unittest.TestCase): - - def test_chain(self): - for s in ("123", "", range(6), ('do', 1.2), xrange(2000,2030,5)): - for g in (G, I, Ig, S, L, R): - self.assertEqual(list(chain(g(s))), list(g(s))) - self.assertEqual(list(chain(g(s), g(s))), list(g(s))+list(g(s))) - self.assertRaises(TypeError, chain, X(s)) - self.assertRaises(TypeError, list, chain(N(s))) - self.assertRaises(ZeroDivisionError, list, chain(E(s))) - - def test_cycle(self): - for s in ("123", "", range(6), ('do', 1.2), xrange(2000,2030,5)): - for g in (G, I, Ig, S, L, R): - tgtlen = len(s) * 3 - expected = list(g(s))*3 - actual = list(islice(cycle(g(s)), tgtlen)) - self.assertEqual(actual, expected) - self.assertRaises(TypeError, cycle, X(s)) - self.assertRaises(TypeError, list, cycle(N(s))) - self.assertRaises(ZeroDivisionError, list, cycle(E(s))) - - def test_ifilter(self): - for s in (range(10), range(0), range(6), (7,11), xrange(2000,2030,5)): - for g in (G, I, Ig, S, L, R): - self.assertEqual(list(ifilter(isEven, g(s))), filter(isEven, g(s))) - self.assertRaises(TypeError, ifilter, isEven, X(s)) - self.assertRaises(TypeError, list, ifilter(isEven, N(s))) - self.assertRaises(ZeroDivisionError, list, ifilter(isEven, E(s))) - - def test_ifilterfalse(self): - for s in (range(10), range(0), range(10), (7,11), xrange(2000,2030,5)): - for g in (G, I, Ig, S, L, R): - self.assertEqual(list(ifilterfalse(isEven, g(s))), filter(isOdd, g(s))) - self.assertRaises(TypeError, ifilterfalse, isEven, X(s)) - self.assertRaises(TypeError, list, ifilterfalse(isEven, N(s))) - self.assertRaises(ZeroDivisionError, list, ifilterfalse(isEven, E(s))) - - def test_izip(self): - for s in ("123", "", range(10), ('do', 1.2), xrange(2000,2030,5)): - for g in (G, I, Ig, S, L, R): - self.assertEqual(list(izip(g(s))), zip(g(s))) - self.assertEqual(list(izip(g(s), g(s))), zip(g(s), g(s))) - self.assertRaises(TypeError, izip, X(s)) - self.assertRaises(TypeError, list, izip(N(s))) - self.assertRaises(ZeroDivisionError, list, izip(E(s))) - - def test_imap(self): - for s in (range(10), range(0), range(100), (7,11), xrange(20,50,5)): - for g in (G, I, Ig, S, L, R): - self.assertEqual(list(imap(onearg, g(s))), map(onearg, g(s))) - self.assertEqual(list(imap(operator.pow, g(s), g(s))), map(operator.pow, g(s), g(s))) - self.assertRaises(TypeError, imap, onearg, X(s)) - self.assertRaises(TypeError, list, imap(onearg, N(s))) - self.assertRaises(ZeroDivisionError, list, imap(onearg, E(s))) - - def test_islice(self): - for s in ("12345", "", range(10), ('do', 1.2), xrange(2000,2030,5)): - for g in (G, I, Ig, S, L, R): - self.assertEqual(list(islice(g(s),1,None,2)), list(g(s))[1::2]) - self.assertRaises(TypeError, islice, X(s), 10) - self.assertRaises(TypeError, list, islice(N(s), 10)) - self.assertRaises(ZeroDivisionError, list, islice(E(s), 10)) - - def test_starmap(self): - for s in (range(10), range(0), range(100), (7,11), xrange(20,50,5)): - for g in (G, I, Ig, S, L, R): - ss = zip(s, s) - self.assertEqual(list(starmap(operator.pow, g(ss))), map(operator.pow, g(s), g(s))) - self.assertRaises(TypeError, starmap, operator.pow, X(ss)) - self.assertRaises(TypeError, list, starmap(operator.pow, N(ss))) - self.assertRaises(ZeroDivisionError, list, starmap(operator.pow, E(ss))) - - def test_takewhile(self): - for s in (range(10), range(0), range(10), (7,11), xrange(2000,2030,5)): - for g in (G, I, Ig, S, L, R): - tgt = [] - for elem in g(s): - if not isEven(elem): break - tgt.append(elem) - self.assertEqual(list(takewhile(isEven, g(s))), tgt) - self.assertRaises(TypeError, takewhile, isEven, X(s)) - self.assertRaises(TypeError, list, takewhile(isEven, N(s))) - self.assertRaises(ZeroDivisionError, list, takewhile(isEven, E(s))) - - def test_dropwhile(self): - for s in (range(10), range(0), range(10), (7,11), xrange(2000,2030,5)): - for g in (G, I, Ig, S, L, R): - tgt = [] - for elem in g(s): - if not tgt and isOdd(elem): continue - tgt.append(elem) - self.assertEqual(list(dropwhile(isOdd, g(s))), tgt) - self.assertRaises(TypeError, dropwhile, isOdd, X(s)) - self.assertRaises(TypeError, list, dropwhile(isOdd, N(s))) - self.assertRaises(ZeroDivisionError, list, dropwhile(isOdd, E(s))) - -class RegressionTests(unittest.TestCase): - - def test_sf_793826(self): - # Fix Armin Rigo's successful efforts to wreak havoc - - def mutatingtuple(tuple1, f, tuple2): - # this builds a tuple t which is a copy of tuple1, - # then calls f(t), then mutates t to be equal to tuple2 - # (needs len(tuple1) == len(tuple2)). - def g(value, first=[1]): - if first: - del first[:] - f(z.next()) - return value - items = list(tuple2) - items[1:1] = list(tuple1) - gen = imap(g, items) - z = izip(*[gen]*len(tuple1)) - z.next() - - def f(t): - global T - T = t - first[:] = list(T) - - first = [] - mutatingtuple((1,2,3), f, (4,5,6)) - second = list(T) - self.assertEqual(first, second) - - - def test_sf_950057(self): - # Make sure that chain() and cycle() catch exceptions immediately - # rather than when shifting between input sources - - def gen1(): - hist.append(0) - yield 1 - hist.append(1) - assert False - hist.append(2) - - def gen2(x): - hist.append(3) - yield 2 - hist.append(4) - if x: - raise StopIteration - - hist = [] - self.assertRaises(AssertionError, list, chain(gen1(), gen2(False))) - self.assertEqual(hist, [0,1]) - - hist = [] - self.assertRaises(AssertionError, list, chain(gen1(), gen2(True))) - self.assertEqual(hist, [0,1]) - - hist = [] - self.assertRaises(AssertionError, list, cycle(gen1())) - self.assertEqual(hist, [0,1]) - -libreftest = """ Doctest for examples in the library reference: libitertools.tex - - ->>> amounts = [120.15, 764.05, 823.14] ->>> for checknum, amount in izip(count(1200), amounts): -... print 'Check %d is for $%.2f' % (checknum, amount) -... -Check 1200 is for $120.15 -Check 1201 is for $764.05 -Check 1202 is for $823.14 - ->>> import operator ->>> for cube in imap(operator.pow, xrange(1,4), repeat(3)): -... print cube -... -1 -8 -27 - ->>> reportlines = ['EuroPython', 'Roster', '', 'alex', '', 'laura', '', 'martin', '', 'walter', '', 'samuele'] ->>> for name in islice(reportlines, 3, None, 2): -... print name.title() -... -Alex -Laura -Martin -Walter -Samuele - ->>> def enumerate(iterable): -... return izip(count(), iterable) - ->>> def tabulate(function): -... "Return function(0), function(1), ..." -... return imap(function, count()) - ->>> def iteritems(mapping): -... return izip(mapping.iterkeys(), mapping.itervalues()) - ->>> def nth(iterable, n): -... "Returns the nth item" -... return list(islice(iterable, n, n+1)) - ->>> def all(seq, pred=bool): -... "Returns True if pred(x) is True for every element in the iterable" -... return False not in imap(pred, seq) - ->>> def any(seq, pred=bool): -... "Returns True if pred(x) is True for at least one element in the iterable" -... return True in imap(pred, seq) - ->>> def no(seq, pred=bool): -... "Returns True if pred(x) is False for every element in the iterable" -... return True not in imap(pred, seq) - ->>> def quantify(seq, pred=bool): -... "Count how many times the predicate is True in the sequence" -... return sum(imap(pred, seq)) - ->>> def padnone(seq): -... "Returns the sequence elements and then returns None indefinitely" -... return chain(seq, repeat(None)) - ->>> def ncycles(seq, n): -... "Returns the sequence elements n times" -... return chain(*repeat(seq, n)) - ->>> def dotproduct(vec1, vec2): -... return sum(imap(operator.mul, vec1, vec2)) - ->>> def window(seq, n=2): -... "Returns a sliding window (of width n) over data from the iterable" -... " s -> (s0,s1,...s[n-1]), (s1,s2,...,sn), ... " -... it = iter(seq) -... result = tuple(islice(it, n)) -... if len(result) == n: -... yield result -... for elem in it: -... result = result[1:] + (elem,) -... yield result - ->>> def take(n, seq): -... return list(islice(seq, n)) - -This is not part of the examples but it tests to make sure the definitions -perform as purported. - ->>> list(enumerate('abc')) -[(0, 'a'), (1, 'b'), (2, 'c')] - ->>> list(islice(tabulate(lambda x: 2*x), 4)) -[0, 2, 4, 6] - ->>> nth('abcde', 3) -['d'] - ->>> all([2, 4, 6, 8], lambda x: x%2==0) -True - ->>> all([2, 3, 6, 8], lambda x: x%2==0) -False - ->>> any([2, 4, 6, 8], lambda x: x%2==0) -True - ->>> any([1, 3, 5, 9], lambda x: x%2==0,) -False - ->>> no([1, 3, 5, 9], lambda x: x%2==0) -True - ->>> no([1, 2, 5, 9], lambda x: x%2==0) -False - ->>> quantify(xrange(99), lambda x: x%2==0) -50 - ->>> list(window('abc')) -[('a', 'b'), ('b', 'c')] - ->>> list(window('abc',5)) -[] - ->>> list(islice(padnone('abc'), 0, 6)) -['a', 'b', 'c', None, None, None] - ->>> list(ncycles('abc', 3)) -['a', 'b', 'c', 'a', 'b', 'c', 'a', 'b', 'c'] - ->>> dotproduct([1,2,3], [4,5,6]) -32 - ->>> take(10, count()) -[0, 1, 2, 3, 4, 5, 6, 7, 8, 9] - -""" - -__test__ = {'libreftest' : libreftest} - -def test_main(verbose=None): - test_classes = (TestBasicOps, TestVariousIteratorArgs, TestGC, - RegressionTests) - test_support.run_unittest(*test_classes) - - # verify reference counting - if verbose and hasattr(sys, "gettotalrefcount"): - import gc - counts = [None] * 5 - for i in xrange(len(counts)): - test_support.run_unittest(*test_classes) - gc.collect() - counts[i] = sys.gettotalrefcount() - print counts - - # doctest the examples in the library reference - test_support.run_doctest(sys.modules[__name__], verbose) - -if __name__ == "__main__": - test_main(verbose=True) Deleted: /pypy/dist/pypy/lib/test2/test_optparse.py ============================================================================== --- /pypy/dist/pypy/lib/test2/test_optparse.py Sun May 1 13:38:15 2005 +++ (empty file) @@ -1,1220 +0,0 @@ -#!/usr/bin/python - -# -# Test suite for Optik. Supplied by Johannes Gijsbers -# (taradino at softhome.net) -- translated from the original Optik -# test suite to this PyUnit-based version. -# -# $Id: test_optparse.py,v 1.2.8.2 2004/04/01 07:38:49 fdrake Exp $ -# - -import sys -import os -import copy -import unittest - -from cStringIO import StringIO -from pprint import pprint -from test import test_support - -from optparse import make_option, Option, IndentedHelpFormatter, \ - TitledHelpFormatter, OptionParser, OptionContainer, OptionGroup, \ - SUPPRESS_HELP, SUPPRESS_USAGE, OptionError, OptionConflictError, \ - BadOptionError, OptionValueError -from optparse import _match_abbrev - -# Do the right thing with boolean values for all known Python versions. -try: - True, False -except NameError: - (True, False) = (1, 0) - -class BaseTest(unittest.TestCase): - def assertParseOK(self, args, expected_opts, expected_positional_args): - """Assert the options are what we expected when parsing arguments. - - Otherwise, fail with a nicely formatted message. - - Keyword arguments: - args -- A list of arguments to parse with OptionParser. - expected_opts -- The options expected. - expected_positional_args -- The positional arguments expected. - - Returns the options and positional args for further testing. - """ - - (options, positional_args) = self.parser.parse_args(args) - optdict = vars(options) - - self.assertEqual(optdict, expected_opts, - """ -Options are %(optdict)s. -Should be %(expected_opts)s. -Args were %(args)s.""" % locals()) - - self.assertEqual(positional_args, expected_positional_args, - """ -Positional arguments are %(positional_args)s. -Should be %(expected_positional_args)s. -Args were %(args)s.""" % locals ()) - - return (options, positional_args) - - def assertRaises(self, func, expected_exception, expected_output, - get_output=None, - funcargs=[], funckwargs={}): - """Assert the expected exception is raised when calling a function. - - Also check whether the right error message is given for a given error. - - Keyword arguments: - func -- The function to be called. - expected_exception -- The exception that should be raised. - expected_output -- The output we expect to see. - get_output -- The function to call to get the output. - funcargs -- The arguments `func` should be called with. - funckwargs -- The keyword arguments `func` should be called with. - - Returns the exception raised for further testing. - """ - if get_output is None: - get_output = self.exception - - try: - out = func(*funcargs, **funckwargs) - except expected_exception, err: - output = get_output(err) - - self.failUnless(output.find(expected_output) != -1, - """ -Message was: -%(output)s -Should contain: -%(expected_output)s -Function called: -%(func)s -With args/kwargs: -%(funcargs)s/%(funckwargs)s""" % locals()) - - return err - else: - self.fail(""" -No %(expected_exception)s raised. -Function called: -%(func)s -With args/kwargs: -%(funcargs)s/%(funckwargs)s""" % locals ()) - - # -- Functions to be used as the get_output argument to assertRaises ------ - - def exception(self, err): - return str(err) - - def redirected_stdout(self, err): - return sys.stdout.getvalue() - - # -- Assertions used in more than one class -------------------- - - def assertParseFail(self, cmdline_args, expected_output): - """Assert the parser fails with the expected message.""" - self.assertRaises(self.parser.parse_args, SystemExit, expected_output, - funcargs=[cmdline_args]) - - def assertStdoutEquals(self, cmdline_args, expected_output): - """Assert the parser prints the expected output on stdout.""" - sys.stdout = StringIO() - self.assertRaises(self.parser.parse_args, SystemExit, expected_output, - self.redirected_stdout, [cmdline_args]) - sys.stdout = sys.__stdout__ - - def assertTypeError(self, func, expected_output, *args): - """Assert a TypeError is raised when executing func.""" - self.assertRaises(func, TypeError, expected_output, funcargs=args) - -# -- Test make_option() aka Option ------------------------------------- - -# It's not necessary to test correct options here. All the tests in the -# parser.parse_args() section deal with those, because they're needed -# there. Duplication makes no sense to me. - -class TestOptionChecks(BaseTest): - def setUp(self): - self.parser = OptionParser(usage=SUPPRESS_USAGE) - - def assertOptionError(self, expected_output, args=[], kwargs={}): - self.assertRaises(make_option, OptionError, expected_output, - funcargs=args, funckwargs=kwargs) - - def test_opt_string_empty(self): - self.assertTypeError(make_option, - "at least one option string must be supplied") - - def test_opt_string_too_short(self): - self.assertOptionError("invalid option string 'b': " - "must be at least two characters long", - ["b"]) - - def test_opt_string_short_invalid(self): - self.assertOptionError("invalid short option string '--': must be " - "of the form -x, (x any non-dash char)", - ["--"]) - - def test_opt_string_long_invalid(self): - self.assertOptionError("invalid long option string '---': " - "must start with --, followed by non-dash", - ["---"]) - - # this test originally relied on the order of dict keys. - def test_attr_invalid(self): - self.assertOptionError("invalid keyword arguments:", - ["-b"], {'foo': None, 'bar': None}) - - def test_action_invalid(self): - self.assertOptionError("invalid action: 'foo'", - ["-b"], {'action': 'foo'}) - - def test_type_invalid(self): - self.assertOptionError("invalid option type: 'foo'", - ["-b"], {'type': 'foo'}) - - def test_no_type_for_action(self): - self.assertOptionError("must not supply a type for action 'count'", - ["-b"], {'action': 'count', 'type': 'int'}) - - def test_no_choices_list(self): - self.assertOptionError("must supply a list of " - "choices for type 'choice'", - ["-b", "--bad"], {'type': "choice"}) - - def test_bad_choices_list(self): - typename = type('').__name__ - self.assertOptionError("choices must be a list of " - "strings ('%s' supplied)" % typename, - ["-b", "--bad"], - {'type': "choice", 'choices':"bad choices"}) - - def test_no_choices_for_type(self): - self.assertOptionError("must not supply choices for type 'int'", - ["-b"], {'type': 'int', 'choices':"bad"}) - - def test_no_const_for_action(self): - self.assertOptionError("'const' must not be supplied for action " - "'store'", - ["-b"], {'action': 'store', 'const': 1}) - - def test_no_nargs_for_action(self): - self.assertOptionError("'nargs' must not be supplied for action " - "'count'", - ["-b"], {'action': 'count', 'nargs': 2}) - - def test_callback_not_callable(self): - self.assertOptionError("callback not callable: 'foo'", - ["-b"], {'action': 'callback', - 'callback': 'foo'}) - - def dummy(self): - pass - - def test_callback_args_no_tuple(self): - self.assertOptionError("callback_args, if supplied, must be a tuple: " - "not 'foo'", - ["-b"], {'action': 'callback', - 'callback': self.dummy, - 'callback_args': 'foo'}) - - def test_callback_kwargs_no_dict(self): - self.assertOptionError("callback_kwargs, if supplied, must be a dict: " - "not 'foo'", - ["-b"], {'action': 'callback', - 'callback': self.dummy, - 'callback_kwargs': 'foo'}) - - def test_no_callback_for_action(self): - self.assertOptionError("callback supplied ('foo') for " - "non-callback option", - ["-b"], {'action': 'store', - 'callback': 'foo'}) - - def test_no_callback_args_for_action(self): - self.assertOptionError("callback_args supplied for non-callback " - "option", - ["-b"], {'action': 'store', - 'callback_args': 'foo'}) - - def test_no_callback_kwargs_for_action(self): - self.assertOptionError("callback_kwargs supplied for non-callback " - "option", - ["-b"], {'action': 'store', - 'callback_kwargs': 'foo'}) - -class TestOptionParser(BaseTest): - def setUp(self): - self.parser = OptionParser() - self.parser.add_option("-v", "--verbose", "-n", "--noisy", - action="store_true", dest="verbose") - self.parser.add_option("-q", "--quiet", "--silent", - action="store_false", dest="verbose") - - def test_add_option_no_Option(self): - self.assertTypeError(self.parser.add_option, - "not an Option instance: None", None) - - def test_add_option_invalid_arguments(self): - self.assertTypeError(self.parser.add_option, - "invalid arguments", None, None) - - def test_get_option(self): - opt1 = self.parser.get_option("-v") - self.assert_(isinstance(opt1, Option)) - self.assertEqual(opt1._short_opts, ["-v", "-n"]) - self.assertEqual(opt1._long_opts, ["--verbose", "--noisy"]) - self.assertEqual(opt1.action, "store_true") - self.assertEqual(opt1.dest, "verbose") - - def test_get_option_equals(self): - opt1 = self.parser.get_option("-v") - opt2 = self.parser.get_option("--verbose") - opt3 = self.parser.get_option("-n") - opt4 = self.parser.get_option("--noisy") - self.assert_(opt1 is opt2 is opt3 is opt4) - - def test_has_option(self): - self.assert_(self.parser.has_option("-v")) - self.assert_(self.parser.has_option("--verbose")) - - def assert_removed(self): - self.assert_(self.parser.get_option("-v") is None) - self.assert_(self.parser.get_option("--verbose") is None) - self.assert_(self.parser.get_option("-n") is None) - self.assert_(self.parser.get_option("--noisy") is None) - - self.failIf(self.parser.has_option("-v")) - self.failIf(self.parser.has_option("--verbose")) - self.failIf(self.parser.has_option("-n")) - self.failIf(self.parser.has_option("--noisy")) - - self.assert_(self.parser.has_option("-q")) - self.assert_(self.parser.has_option("--silent")) - - def test_remove_short_opt(self): - self.parser.remove_option("-n") - self.assert_removed() - - def test_remove_long_opt(self): - self.parser.remove_option("--verbose") - self.assert_removed() - - def test_remove_nonexistent(self): - self.assertRaises(self.parser.remove_option, ValueError, - "no such option 'foo'", funcargs=['foo']) - -# -- Test parser.parse_args() ------------------------------------------ - -class TestStandard(BaseTest): - def setUp(self): - options = [make_option("-a", type="string"), - make_option("-b", "--boo", type="int", dest='boo'), - make_option("--foo", action="append")] - - self.parser = OptionParser(usage=SUPPRESS_USAGE, option_list=options) - - def test_required_value(self): - self.assertParseFail(["-a"], "-a option requires a value") - - def test_invalid_integer(self): - self.assertParseFail(["-b", "5x"], - "option -b: invalid integer value: '5x'") - - def test_no_such_option(self): - self.assertParseFail(["--boo13"], "no such option: --boo13") - - def test_long_invalid_integer(self): - self.assertParseFail(["--boo=x5"], - "option --boo: invalid integer value: 'x5'") - - def test_empty(self): - self.assertParseOK([], {'a': None, 'boo': None, 'foo': None}, []) - - def test_shortopt_empty_longopt_append(self): - self.assertParseOK(["-a", "", "--foo=blah", "--foo="], - {'a': "", 'boo': None, 'foo': ["blah", ""]}, - []) - - def test_long_option_append(self): - self.assertParseOK(["--foo", "bar", "--foo", "", "--foo=x"], - {'a': None, - 'boo': None, - 'foo': ["bar", "", "x"]}, - []) - - def test_option_argument_joined(self): - self.assertParseOK(["-abc"], - {'a': "bc", 'boo': None, 'foo': None}, - []) - - def test_option_argument_split(self): - self.assertParseOK(["-a", "34"], - {'a': "34", 'boo': None, 'foo': None}, - []) - - def test_option_argument_joined_integer(self): - self.assertParseOK(["-b34"], - {'a': None, 'boo': 34, 'foo': None}, - []) - - def test_option_argument_split_negative_integer(self): - self.assertParseOK(["-b", "-5"], - {'a': None, 'boo': -5, 'foo': None}, - []) - - def test_long_option_argument_joined(self): - self.assertParseOK(["--boo=13"], - {'a': None, 'boo': 13, 'foo': None}, - []) - - def test_long_option_argument_split(self): - self.assertParseOK(["--boo", "111"], - {'a': None, 'boo': 111, 'foo': None}, - []) - - def test_long_option_short_option(self): - self.assertParseOK(["--foo=bar", "-axyz"], - {'a': 'xyz', 'boo': None, 'foo': ["bar"]}, - []) - - def test_abbrev_long_option(self): - self.assertParseOK(["--f=bar", "-axyz"], - {'a': 'xyz', 'boo': None, 'foo': ["bar"]}, - []) - - def test_defaults(self): - (options, args) = self.parser.parse_args([]) - defaults = self.parser.get_default_values() - self.assertEqual(vars(defaults), vars(options)) - - def test_ambiguous_option(self): - self.parser.add_option("--foz", action="store", - type="string", dest="foo") - possibilities = ", ".join({"--foz": None, "--foo": None}.keys()) - self.assertParseFail(["--f=bar"], - "ambiguous option: --f (%s?)" % possibilities) - - - def test_short_and_long_option_split(self): - self.assertParseOK(["-a", "xyz", "--foo", "bar"], - {'a': 'xyz', 'boo': None, 'foo': ["bar"]}, - []), - - def test_short_option_split_long_option_append(self): - self.assertParseOK(["--foo=bar", "-b", "123", "--foo", "baz"], - {'a': None, 'boo': 123, 'foo': ["bar", "baz"]}, - []) - - def test_short_option_split_one_positional_arg(self): - self.assertParseOK(["-a", "foo", "bar"], - {'a': "foo", 'boo': None, 'foo': None}, - ["bar"]), - - def test_short_option_consumes_separator(self): - self.assertParseOK(["-a", "--", "foo", "bar"], - {'a': "--", 'boo': None, 'foo': None}, - ["foo", "bar"]), - - def test_short_option_joined_and_separator(self): - self.assertParseOK(["-ab", "--", "--foo", "bar"], - {'a': "b", 'boo': None, 'foo': None}, - ["--foo", "bar"]), - - def test_invalid_option_becomes_positional_arg(self): - self.assertParseOK(["-ab", "-", "--foo", "bar"], - {'a': "b", 'boo': None, 'foo': ["bar"]}, - ["-"]) - - def test_no_append_versus_append(self): - self.assertParseOK(["-b3", "-b", "5", "--foo=bar", "--foo", "baz"], - {'a': None, 'boo': 5, 'foo': ["bar", "baz"]}, - []) - - def test_option_consumes_optionlike_string(self): - self.assertParseOK(["-a", "-b3"], - {'a': "-b3", 'boo': None, 'foo': None}, - []) - -class TestBool(BaseTest): - def setUp(self): - options = [make_option("-v", - "--verbose", - action="store_true", - dest="verbose", - default=''), - make_option("-q", - "--quiet", - action="store_false", - dest="verbose")] - self.parser = OptionParser(option_list = options) - - def test_bool_default(self): - self.assertParseOK([], - {'verbose': ''}, - []) - - def test_bool_false(self): - (options, args) = self.assertParseOK(["-q"], - {'verbose': 0}, - []) - if hasattr(__builtins__, 'False'): - self.failUnless(options.verbose is False) - - def test_bool_true(self): - (options, args) = self.assertParseOK(["-v"], - {'verbose': 1}, - []) - if hasattr(__builtins__, 'True'): - self.failUnless(options.verbose is True) - - def test_bool_flicker_on_and_off(self): - self.assertParseOK(["-qvq", "-q", "-v"], - {'verbose': 1}, - []) - -class TestChoice(BaseTest): - def setUp(self): - self.parser = OptionParser(usage=SUPPRESS_USAGE) - self.parser.add_option("-c", action="store", type="choice", - dest="choice", choices=["one", "two", "three"]) - - def test_valid_choice(self): - self.assertParseOK(["-c", "one", "xyz"], - {'choice': 'one'}, - ["xyz"]) - - def test_invalid_choice(self): - self.assertParseFail(["-c", "four", "abc"], - "option -c: invalid choice: 'four' " - "(choose from 'one', 'two', 'three')") - - def test_add_choice_option(self): - self.parser.add_option("-d", "--default", - choices=["four", "five", "six"]) - opt = self.parser.get_option("-d") - self.assertEqual(opt.type, "choice") - self.assertEqual(opt.action, "store") - -class TestCount(BaseTest): - def setUp(self): - self.parser = OptionParser(usage=SUPPRESS_USAGE) - self.v_opt = make_option("-v", action="count", dest="verbose") - self.parser.add_option(self.v_opt) - self.parser.add_option("--verbose", type="int", dest="verbose") - self.parser.add_option("-q", "--quiet", - action="store_const", dest="verbose", const=0) - - def test_empty(self): - self.assertParseOK([], {'verbose': None}, []) - - def test_count_one(self): - self.assertParseOK(["-v"], {'verbose': 1}, []) - - def test_count_three(self): - self.assertParseOK(["-vvv"], {'verbose': 3}, []) - - def test_count_three_apart(self): - self.assertParseOK(["-v", "-v", "-v"], {'verbose': 3}, []) - - def test_count_override_amount(self): - self.assertParseOK(["-vvv", "--verbose=2"], {'verbose': 2}, []) - - def test_count_override_quiet(self): - self.assertParseOK(["-vvv", "--verbose=2", "-q"], {'verbose': 0}, []) - - def test_count_overriding(self): - self.assertParseOK(["-vvv", "--verbose=2", "-q", "-v"], - {'verbose': 1}, []) - - def test_count_interspersed_args(self): - self.assertParseOK(["--quiet", "3", "-v"], - {'verbose': 1}, - ["3"]) - - def test_count_no_interspersed_args(self): - self.parser.disable_interspersed_args() - self.assertParseOK(["--quiet", "3", "-v"], - {'verbose': 0}, - ["3", "-v"]) - - def test_count_no_such_option(self): - self.assertParseFail(["-q3", "-v"], "no such option: -3") - - def test_count_option_no_value(self): - self.assertParseFail(["--quiet=3", "-v"], - "--quiet option does not take a value") - - def test_count_with_default(self): - self.parser.set_default('verbose', 0) - self.assertParseOK([], {'verbose':0}, []) - - def test_count_overriding_default(self): - self.parser.set_default('verbose', 0) - self.assertParseOK(["-vvv", "--verbose=2", "-q", "-v"], - {'verbose': 1}, []) - -class TestNArgs(BaseTest): - def setUp(self): - self.parser = OptionParser(usage=SUPPRESS_USAGE) - self.parser.add_option("-p", "--point", - action="store", nargs=3, type="float", dest="point") - - def test_nargs_with_positional_args(self): - self.assertParseOK(["foo", "-p", "1", "2.5", "-4.3", "xyz"], - {'point': (1.0, 2.5, -4.3)}, - ["foo", "xyz"]) - - def test_nargs_long_opt(self): - self.assertParseOK(["--point", "-1", "2.5", "-0", "xyz"], - {'point': (-1.0, 2.5, -0.0)}, - ["xyz"]) - - def test_nargs_invalid_float_value(self): - self.assertParseFail(["-p", "1.0", "2x", "3.5"], - "option -p: " - "invalid floating-point value: '2x'") - - def test_nargs_required_values(self): - self.assertParseFail(["--point", "1.0", "3.5"], - "--point option requires 3 values") - -class TestNArgsAppend(BaseTest): - def setUp(self): - self.parser = OptionParser(usage=SUPPRESS_USAGE) - self.parser.add_option("-p", "--point", action="store", nargs=3, - type="float", dest="point") - self.parser.add_option("-f", "--foo", action="append", nargs=2, - type="int", dest="foo") - - def test_nargs_append(self): - self.assertParseOK(["-f", "4", "-3", "blah", "--foo", "1", "666"], - {'point': None, 'foo': [(4, -3), (1, 666)]}, - ["blah"]) - - def test_nargs_append_required_values(self): - self.assertParseFail(["-f4,3"], - "-f option requires 2 values") - - def test_nargs_append_simple(self): - self.assertParseOK(["--foo=3", "4"], - {'point': None, 'foo':[(3, 4)]}, - []) - -class TestVersion(BaseTest): - def test_version(self): - oldargv = sys.argv[0] - sys.argv[0] = os.path.join(os.curdir, "foo", "bar") - self.parser = OptionParser(usage=SUPPRESS_USAGE, version="%prog 0.1") - self.assertStdoutEquals(["--version"], "bar 0.1\n") - sys.argv[0] = oldargv - - def test_version_with_prog_keyword(self): - oldargv = sys.argv[0] - sys.argv[0] = "./foo/bar" - self.parser = OptionParser(usage=SUPPRESS_USAGE, version="%prog 0.1", - prog="splat") - self.assertStdoutEquals(["--version"], "splat 0.1\n") - sys.argv[0] = oldargv - - def test_version_with_prog_attribute(self): - oldargv = sys.argv[0] - sys.argv[0] = "./foo/bar" - self.parser = OptionParser(usage=SUPPRESS_USAGE, version="%prog 0.1") - self.parser.prog = "splat" - self.assertStdoutEquals(["--version"], "splat 0.1\n") - sys.argv[0] = oldargv - - def test_no_version(self): - self.parser = OptionParser(usage=SUPPRESS_USAGE) - self.assertParseFail(["--version"], - "no such option: --version") - -# -- Test conflicting default values and parser.parse_args() ----------- - -class TestConflictingDefaults(BaseTest): - """Conflicting default values: the last one should win.""" - def setUp(self): - self.parser = OptionParser(option_list=[ - make_option("-v", action="store_true", dest="verbose", default=1)]) - - def test_conflict_default(self): - self.parser.add_option("-q", action="store_false", dest="verbose", - default=0) - self.assertParseOK([], {'verbose': 0}, []) - - def test_conflict_default_none(self): - self.parser.add_option("-q", action="store_false", dest="verbose", - default=None) - self.assertParseOK([], {'verbose': None}, []) - -class TestOptionGroup(BaseTest): - def setUp(self): - self.parser = OptionParser(usage=SUPPRESS_USAGE) - - def test_option_group_create_instance(self): - group = OptionGroup(self.parser, "Spam") - self.parser.add_option_group(group) - group.add_option("--spam", action="store_true", - help="spam spam spam spam") - self.assertParseOK(["--spam"], {'spam': 1}, []) - - def test_add_group_no_group(self): - self.assertTypeError(self.parser.add_option_group, - "not an OptionGroup instance: None", None) - - def test_add_group_invalid_arguments(self): - self.assertTypeError(self.parser.add_option_group, - "invalid arguments", None, None) - - def test_add_group_wrong_parser(self): - group = OptionGroup(self.parser, "Spam") - group.parser = OptionParser() - self.assertRaises(self.parser.add_option_group, ValueError, - "invalid OptionGroup (wrong parser)", funcargs=[group]) - - def test_group_manipulate(self): - group = self.parser.add_option_group("Group 2", - description="Some more options") - group.set_title("Bacon") - group.add_option("--bacon", type="int") - self.assert_(self.parser.get_option_group("--bacon"), group) - -# -- Test extending and parser.parse_args() ---------------------------- - -class TestExtendAddTypes(BaseTest): - def setUp(self): - self.parser = OptionParser(usage=SUPPRESS_USAGE, - option_class=self.MyOption) - self.parser.add_option("-a", None, type="string", dest="a") - self.parser.add_option("-f", "--file", type="file", dest="file") - - class MyOption (Option): - def check_file (option, opt, value): - if not os.path.exists(value): - raise OptionValueError("%s: file does not exist" % value) - elif not os.path.isfile(value): - raise OptionValueError("%s: not a regular file" % value) - return value - - TYPES = Option.TYPES + ("file",) - TYPE_CHECKER = copy.copy(Option.TYPE_CHECKER) - TYPE_CHECKER["file"] = check_file - - def test_extend_file(self): - open(test_support.TESTFN, "w").close() - self.assertParseOK(["--file", test_support.TESTFN, "-afoo"], - {'file': test_support.TESTFN, 'a': 'foo'}, - []) - - os.unlink(test_support.TESTFN) - - def test_extend_file_nonexistent(self): - self.assertParseFail(["--file", test_support.TESTFN, "-afoo"], - "%s: file does not exist" % - test_support.TESTFN) - - def test_file_irregular(self): - os.mkdir(test_support.TESTFN) - self.assertParseFail(["--file", test_support.TESTFN, "-afoo"], - "%s: not a regular file" % - test_support.TESTFN) - os.rmdir(test_support.TESTFN) - -class TestExtendAddActions(BaseTest): - def setUp(self): - options = [self.MyOption("-a", "--apple", action="extend", - type="string", dest="apple")] - self.parser = OptionParser(option_list=options) - - class MyOption (Option): - ACTIONS = Option.ACTIONS + ("extend",) - STORE_ACTIONS = Option.STORE_ACTIONS + ("extend",) - TYPED_ACTIONS = Option.TYPED_ACTIONS + ("extend",) - - def take_action (self, action, dest, opt, value, values, parser): - if action == "extend": - lvalue = value.split(",") - values.ensure_value(dest, []).extend(lvalue) - else: - Option.take_action(self, action, dest, opt, parser, value, - values) - - def test_extend_add_action(self): - self.assertParseOK(["-afoo,bar", "--apple=blah"], - {'apple': ["foo", "bar", "blah"]}, - []) - - def test_extend_add_action_normal(self): - self.assertParseOK(["-a", "foo", "-abar", "--apple=x,y"], - {'apple': ["foo", "bar", "x", "y"]}, - []) - -# -- Test callbacks and parser.parse_args() ---------------------------- - -class TestCallback(BaseTest): - def setUp(self): - options = [make_option("-x", - None, - action="callback", - callback=self.process_opt), - make_option("-f", - "--file", - action="callback", - callback=self.process_opt, - type="string", - dest="filename")] - self.parser = OptionParser(option_list=options) - - def process_opt(self, option, opt, value, parser_): - if opt == "-x": - self.assertEqual(option._short_opts, ["-x"]) - self.assertEqual(option._long_opts, []) - self.assert_(parser_ is self.parser) - self.assert_(value is None) - self.assertEqual(vars(parser_.values), {'filename': None}) - - parser_.values.x = 42 - elif opt == "--file": - self.assertEqual(option._short_opts, ["-f"]) - self.assertEqual(option._long_opts, ["--file"]) - self.assert_(parser_ is self.parser) - self.assertEqual(value, "foo") - self.assertEqual(vars(parser_.values), {'filename': None, 'x': 42}) - - setattr(parser_.values, option.dest, value) - else: - self.fail("Unknown option %r in process_opt." % opt) - - def test_callback(self): - self.assertParseOK(["-x", "--file=foo"], - {'filename': "foo", 'x': 42}, - []) - -class TestCallBackExtraArgs(BaseTest): - def setUp(self): - options = [make_option("-p", "--point", action="callback", - callback=self.process_tuple, - callback_args=(3, int), type="string", - dest="points", default=[])] - self.parser = OptionParser(option_list=options) - - def process_tuple (self, option, opt, value, parser_, len, type): - self.assertEqual(len, 3) - self.assert_(type is int) - - if opt == "-p": - self.assertEqual(value, "1,2,3") - elif opt == "--point": - self.assertEqual(value, "4,5,6") - - value = tuple(map(type, value.split(","))) - getattr(parser_.values, option.dest).append(value) - - def test_callback_extra_args(self): - self.assertParseOK(["-p1,2,3", "--point", "4,5,6"], - {'points': [(1,2,3), (4,5,6)]}, - []) - -class TestCallBackMeddleArgs(BaseTest): - def setUp(self): - options = [make_option(str(x), action="callback", - callback=self.process_n, dest='things') - for x in range(-1, -6, -1)] - self.parser = OptionParser(option_list=options) - - # Callback that meddles in rargs, largs - def process_n (self, option, opt, value, parser_): - # option is -3, -5, etc. - nargs = int(opt[1:]) - rargs = parser_.rargs - if len(rargs) < nargs: - self.fail("Expected %d arguments for %s option." % (nargs, opt)) - dest = parser_.values.ensure_value(option.dest, []) - dest.append(tuple(rargs[0:nargs])) - parser_.largs.append(nargs) - del rargs[0:nargs] - - def test_callback_meddle_args(self): - self.assertParseOK(["-1", "foo", "-3", "bar", "baz", "qux"], - {'things': [("foo",), ("bar", "baz", "qux")]}, - [1, 3]) - - def test_callback_meddle_args_separator(self): - self.assertParseOK(["-2", "foo", "--"], - {'things': [('foo', '--')]}, - [2]) - -class TestCallBackManyArgs(BaseTest): - def setUp(self): - options = [make_option("-a", "--apple", action="callback", nargs=2, - callback=self.process_many, type="string"), - make_option("-b", "--bob", action="callback", nargs=3, - callback=self.process_many, type="int")] - self.parser = OptionParser(option_list=options) - - def process_many (self, option, opt, value, parser_): - if opt == "-a": - self.assertEqual(value, ("foo", "bar")) - elif opt == "--apple": - self.assertEqual(value, ("ding", "dong")) - elif opt == "-b": - self.assertEqual(value, (1, 2, 3)) - elif opt == "--bob": - self.assertEqual(value, (-666, 42, 0)) - - def test_many_args(self): - self.assertParseOK(["-a", "foo", "bar", "--apple", "ding", "dong", - "-b", "1", "2", "3", "--bob", "-666", "42", - "0"], - {}, - []) - -class TestCallBackCheckAbbrev(BaseTest): - def setUp(self): - self.parser = OptionParser() - self.parser.add_option("--foo-bar", action="callback", - callback=self.check_abbrev) - - def check_abbrev (self, option, opt, value, parser): - self.assertEqual(opt, "--foo-bar") - - def test_abbrev_callback_expansion(self): - self.assertParseOK(["--foo"], {}, []) - -class TestCallBackVarArgs(BaseTest): - def setUp(self): - options = [make_option("-a", type="int", nargs=2, dest="a"), - make_option("-b", action="store_true", dest="b"), - make_option("-c", "--callback", action="callback", - callback=self.variable_args, dest="c")] - self.parser = OptionParser(usage=SUPPRESS_USAGE, option_list=options) - - def variable_args (self, option, opt, value, parser): - self.assert_(value is None) - done = 0 - value = [] - rargs = parser.rargs - while rargs: - arg = rargs[0] - if ((arg[:2] == "--" and len(arg) > 2) or - (arg[:1] == "-" and len(arg) > 1 and arg[1] != "-")): - break - else: - value.append(arg) - del rargs[0] - setattr(parser.values, option.dest, value) - - def test_variable_args(self): - self.assertParseOK(["-a3", "-5", "--callback", "foo", "bar"], - {'a': (3, -5), 'b': None, 'c': ["foo", "bar"]}, - []) - - def test_consume_separator_stop_at_option(self): - self.assertParseOK(["-c", "37", "--", "xxx", "-b", "hello"], - {'a': None, - 'b': True, - 'c': ["37", "--", "xxx"]}, - ["hello"]) - - def test_positional_arg_and_variable_args(self): - self.assertParseOK(["hello", "-c", "foo", "-", "bar"], - {'a': None, - 'b': None, - 'c':["foo", "-", "bar"]}, - ["hello"]) - - def test_stop_at_option(self): - self.assertParseOK(["-c", "foo", "-b"], - {'a': None, 'b': True, 'c': ["foo"]}, - []) - - def test_stop_at_invalid_option(self): - self.assertParseFail(["-c", "3", "-5", "-a"], "no such option: -5") - - -# -- Test conflict handling and parser.parse_args() -------------------- - -class ConflictBase(BaseTest): - def setUp(self): - options = [make_option("-v", "--verbose", action="count", - dest="verbose", help="increment verbosity")] - self.parser = OptionParser(usage=SUPPRESS_USAGE, option_list=options) - - def show_version (self, option, opt, value, parser): - parser.values.show_version = 1 - -class TestConflict(ConflictBase): - """Use the default conflict resolution for Optik 1.2: error.""" - def assert_conflict_error(self, func): - err = self.assertRaises(func, OptionConflictError, - "option -v/--version: conflicting option " - "string(s): -v", - funcargs=["-v", "--version"], - funckwargs={'action':"callback", - 'callback':self.show_version, - 'help':"show version"}) - - self.assertEqual(err.msg, "conflicting option string(s): -v") - self.assertEqual(err.option_id, "-v/--version") - - def test_conflict_error(self): - self.assert_conflict_error(self.parser.add_option) - - def test_conflict_error_group(self): - group = OptionGroup(self.parser, "Group 1") - self.assert_conflict_error(group.add_option) - - def test_no_such_conflict_handler(self): - self.assertRaises(self.parser.set_conflict_handler, ValueError, - "invalid conflict_resolution value 'foo'", - funcargs=['foo']) - - -class TestConflictIgnore(ConflictBase): - """Test the old (Optik <= 1.1 behaviour) -- arguably broken, but - still available so should be tested. - """ - - def setUp(self): - ConflictBase.setUp(self) - self.parser.set_conflict_handler("ignore") - self.parser.add_option("-v", "--version", action="callback", - callback=self.show_version, help="show version") - - def test_conflict_ignore(self): - v_opt = self.parser.get_option("-v") - verbose_opt = self.parser.get_option("--verbose") - version_opt = self.parser.get_option("--version") - - self.assert_(v_opt is version_opt) - self.assert_(v_opt is not verbose_opt) - self.assertEqual(v_opt._long_opts, ["--version"]) - self.assertEqual(version_opt._short_opts, ["-v"]) - self.assertEqual(verbose_opt._short_opts, ["-v"]) - - def test_conflict_ignore_help(self): - self.assertStdoutEquals(["-h"], """\ -options: - -v, --verbose increment verbosity - -h, --help show this help message and exit - -v, --version show version -""") - - def test_conflict_ignore_short_opt(self): - self.assertParseOK(["-v"], - {'show_version': 1, 'verbose': None}, - []) - -class TestConflictResolve(ConflictBase): - def setUp(self): - ConflictBase.setUp(self) - self.parser.set_conflict_handler("resolve") - self.parser.add_option("-v", "--version", action="callback", - callback=self.show_version, help="show version") - - def test_conflict_resolve(self): - v_opt = self.parser.get_option("-v") - verbose_opt = self.parser.get_option("--verbose") - version_opt = self.parser.get_option("--version") - - self.assert_(v_opt is version_opt) - self.assert_(v_opt is not verbose_opt) - self.assertEqual(v_opt._long_opts, ["--version"]) - self.assertEqual(version_opt._short_opts, ["-v"]) - self.assertEqual(version_opt._long_opts, ["--version"]) - self.assertEqual(verbose_opt._short_opts, []) - self.assertEqual(verbose_opt._long_opts, ["--verbose"]) - - def test_conflict_resolve_help(self): - self.assertStdoutEquals(["-h"], """\ -options: - --verbose increment verbosity - -h, --help show this help message and exit - -v, --version show version -""") - - def test_conflict_resolve_short_opt(self): - self.assertParseOK(["-v"], - {'verbose': None, 'show_version': 1}, - []) - - def test_conflict_resolve_long_opt(self): - self.assertParseOK(["--verbose"], - {'verbose': 1}, - []) - - def test_conflict_resolve_long_opts(self): - self.assertParseOK(["--verbose", "--version"], - {'verbose': 1, 'show_version': 1}, - []) - -class TestConflictOverride(BaseTest): - def setUp(self): - self.parser = OptionParser(usage=SUPPRESS_USAGE) - self.parser.set_conflict_handler("resolve") - self.parser.add_option("-n", "--dry-run", - action="store_true", dest="dry_run", - help="don't do anything") - self.parser.add_option("--dry-run", "-n", - action="store_const", const=42, dest="dry_run", - help="dry run mode") - - def test_conflict_override_opts(self): - opt = self.parser.get_option("--dry-run") - self.assertEqual(opt._short_opts, ["-n"]) - self.assertEqual(opt._long_opts, ["--dry-run"]) - - def test_conflict_override_help(self): - self.assertStdoutEquals(["-h"], """\ -options: - -h, --help show this help message and exit - -n, --dry-run dry run mode -""") - - def test_conflict_override_args(self): - self.assertParseOK(["-n"], - {'dry_run': 42}, - []) - -# -- Other testing. ---------------------------------------------------- - -class TestHelp(BaseTest): - def setUp(self): - options = [ - make_option("-a", type="string", dest='a', - metavar="APPLE", help="throw APPLEs at basket"), - make_option("-b", "--boo", type="int", dest='boo', - metavar="NUM", - help= - "shout \"boo!\" NUM times (in order to frighten away " - "all the evil spirits that cause trouble and mayhem)"), - make_option("--foo", action="append", type="string", dest='foo', - help="store FOO in the foo list for later fooing"), - ] - - usage = "%prog [options]" - self.parser = OptionParser(usage=usage, option_list=options) - - def assertHelpEquals(self, expected_output): - # This trick is used to make optparse believe bar.py is being executed. - oldargv = sys.argv[0] - sys.argv[0] = os.path.join(os.curdir, "foo", "bar.py") - - self.assertStdoutEquals(["-h"], expected_output) - - sys.argv[0] = oldargv - - def test_help(self): - self.assertHelpEquals("""\ -usage: bar.py [options] - -options: - -aAPPLE throw APPLEs at basket - -bNUM, --boo=NUM shout "boo!" NUM times (in order to frighten away all - the evil spirits that cause trouble and mayhem) - --foo=FOO store FOO in the foo list for later fooing - -h, --help show this help message and exit -""") - - def test_help_old_usage(self): - self.parser.set_usage("usage: %prog [options]") - self.assertHelpEquals("""\ -usage: bar.py [options] - -options: - -aAPPLE throw APPLEs at basket - -bNUM, --boo=NUM shout "boo!" NUM times (in order to frighten away all - the evil spirits that cause trouble and mayhem) - --foo=FOO store FOO in the foo list for later fooing - -h, --help show this help message and exit -""") - - def test_help_long_opts_first(self): - self.parser.formatter.short_first = 0 - self.assertHelpEquals("""\ -usage: bar.py [options] - -options: - -aAPPLE throw APPLEs at basket - --boo=NUM, -bNUM shout "boo!" NUM times (in order to frighten away all - the evil spirits that cause trouble and mayhem) - --foo=FOO store FOO in the foo list for later fooing - --help, -h show this help message and exit -""") - - def test_help_title_formatter(self): - self.parser.formatter = TitledHelpFormatter() - self.assertHelpEquals("""\ -Usage -===== - bar.py [options] - -options -======= --aAPPLE throw APPLEs at basket ---boo=NUM, -bNUM shout "boo!" NUM times (in order to frighten away all - the evil spirits that cause trouble and mayhem) ---foo=FOO store FOO in the foo list for later fooing ---help, -h show this help message and exit -""") - - def test_help_description_groups(self): - self.parser.set_description( - "This is the program description. This program has " - "an option group as well as single options.") - - group = OptionGroup( - self.parser, "Dangerous Options", - "Caution: use of these options is at your own risk. " - "It is believed that some of them bite.") - group.add_option("-g", action="store_true", help="Group option.") - self.parser.add_option_group(group) - - self.assertHelpEquals("""\ -usage: bar.py [options] - -This is the program description. This program has an option group as well as -single options. -options: - -aAPPLE throw APPLEs at basket - -bNUM, --boo=NUM shout "boo!" NUM times (in order to frighten away all - the evil spirits that cause trouble and mayhem) - --foo=FOO store FOO in the foo list for later fooing - -h, --help show this help message and exit - - Dangerous Options: - Caution: use of these options is at your own risk. It is believed that - some of them bite. - -g Group option. -""") - -class TestMatchAbbrev(BaseTest): - def test_match_abbrev(self): - self.assertEqual(_match_abbrev("--f", - {"--foz": None, - "--foo": None, - "--fie": None, - "--f": None}), - "--f") - - def test_match_abbrev_error(self): - s = "--f" - wordmap = {"--foz": None, "--foo": None, "--fie": None} - possibilities = ", ".join(wordmap.keys()) - self.assertRaises(_match_abbrev, BadOptionError, - "ambiguous option: --f (%s?)" % possibilities, - funcargs=[s, wordmap]) - -def test_main(): - mod = sys.modules[__name__] - test_support.run_unittest( - *[getattr(mod, name) for name in dir(mod) if name.startswith('Test')] - ) - -if __name__ == '__main__': - unittest.main() Deleted: /pypy/dist/pypy/lib/test2/test_sha.py ============================================================================== --- /pypy/dist/pypy/lib/test2/test_sha.py Sun May 1 13:38:15 2005 +++ (empty file) @@ -1,35 +0,0 @@ -# Testing sha module (NIST's Secure Hash Algorithm) - -# use the three examples from Federal Information Processing Standards -# Publication 180-1, Secure Hash Standard, 1995 April 17 -# http://www.itl.nist.gov/div897/pubs/fip180-1.htm - -import sha -import unittest -from test import test_support - - -class SHATestCase(unittest.TestCase): - def check(self, data, digest): - computed = sha.new(data).hexdigest() - self.assert_(computed == digest) - - def test_case_1(self): - self.check("abc", - "a9993e364706816aba3e25717850c26c9cd0d89d") - - def test_case_2(self): - self.check("abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq", - "84983e441c3bd26ebaae4aa1f95129e5e54670f1") - - def too_slow_test_case_3(self): - self.check("a" * 1000000, - "34aa973cd4c4daa4f61eeb2bdbad27316534016f") - - -def test_main(): - test_support.run_unittest(SHATestCase) - - -if __name__ == "__main__": - test_main() Deleted: /pypy/dist/pypy/lib/test2/test_sio.py ============================================================================== --- /pypy/dist/pypy/lib/test2/test_sio.py Sun May 1 13:38:15 2005 +++ (empty file) @@ -1,738 +0,0 @@ -"""Unit tests for sio (new standard I/O).""" - -import os -import time -from pypy.tool.udir import udir - -class TestSource(object): - - def __init__(self, packets): - for x in packets: - assert x - self.orig_packets = list(packets) - self.packets = list(packets) - self.pos = 0 - - def tell(self): - return self.pos - - def seek(self, offset, whence=0): - if whence == 1: - offset += self.pos - elif whence == 2: - for packet in self.orig_packets: - offset += len(packet) - else: - assert whence == 0 - self.packets = list(self.orig_packets) - self.pos = 0 - while self.pos < offset: - data = self.read(offset - self.pos) - if not data: - break - assert self.pos == offset - - def read(self, n): - try: - data = self.packets.pop(0) - except IndexError: - return "" - if len(data) > n: - data, rest = data[:n], data[n:] - self.packets.insert(0, rest) - self.pos += len(data) - return data - - def close(self): - pass - -class TestReader(object): - - def __init__(self, packets): - for x in packets: - assert x - self.orig_packets = list(packets) - self.packets = list(packets) - self.pos = 0 - - def tell(self): - return self.pos - - def seek(self, offset, whence=0): - if whence == 1: - offset += self.pos - elif whence == 2: - for packet in self.orig_packets: - offset += len(packet) - else: - assert whence == 0 - self.packets = list(self.orig_packets) - self.pos = 0 - while self.pos < offset: - data = self.read(offset - self.pos) - if not data: - break - assert self.pos == offset - - def read(self, n): - try: - data = self.packets.pop(0) - except IndexError: - return "" - if len(data) > n: - data, rest = data[:n], data[n:] - self.packets.insert(0, rest) - self.pos += len(data) - return data - - def close(self): - pass - - def flush(self): - pass -class TestWriter(object): - - def __init__(self, data=''): - self.buf = data - self.pos = 0 - - def write(self, data): - if self.pos >= len(self.buf): - self.buf += "\0" * (self.pos - len(self.buf)) + data - self.pos = len(self.buf) - else: - self.buf = (self.buf[:self.pos] + data + - self.buf[self.pos + len(data):]) - self.pos += len(data) - - def tell(self): - return self.pos - - def seek(self, offset, whence=0): - if whence == 0: - pass - elif whence == 1: - offset += self.pos - elif whence == 2: - offset += len(self.buf) - else: - raise ValueError, "whence should be 0, 1 or 2" - if offset < 0: - offset = 0 - self.pos = offset - - def close(self): - pass - - def truncate(self, size=None): - if size is None: - size = self.pos - if size <= len(self.buf): - self.buf = self.buf[:size] - else: - self.buf += '\0' * (size - len(self.buf)) - - def flush(self): - pass - -class TestReaderWriter(TestWriter): - - def read(self, n=-1): - if n < 1: - result = self.buf[self.pos: ] - self.pos = len(self.buf) - else: - if self.pos + n > len(self.buf): - n = len(self.buf) - self.pos - result = self.buf[self.pos: self.pos+n] - self.pos += n - return result - -class TestBufferingInputStreamTests: - - packets = ["a", "b", "\n", "def", "\nxy\npq\nuv", "wx"] - lines = ["ab\n", "def\n", "xy\n", "pq\n", "uvwx"] - - def makeStream(self, tell=False, seek=False, bufsize=None): - base = TestSource(self.packets) - if not tell: - base.tell = None - if not seek: - base.seek = None - return sio.BufferingInputStream(base, bufsize) - - def test_readline(self): - file = self.makeStream() - assert list(iter(file.readline, "")) == self.lines - - def test_readlines(self): - # This also tests next() and __iter__() - file = self.makeStream() - assert file.readlines() == self.lines - - def test_readlines_small_bufsize(self): - file = self.makeStream(bufsize=1) - assert list(file) == self.lines - - def test_readall(self): - file = self.makeStream() - assert file.readall() == "".join(self.lines) - - def test_readall_small_bufsize(self): - file = self.makeStream(bufsize=1) - assert file.readall() == "".join(self.lines) - - def test_readall_after_readline(self): - file = self.makeStream() - assert file.readline() == self.lines[0] - assert file.readline() == self.lines[1] - assert file.readall() == "".join(self.lines[2:]) - - def test_read_1_after_readline(self): - file = self.makeStream() - assert file.readline() == "ab\n" - assert file.readline() == "def\n" - blocks = [] - while 1: - block = file.read(1) - if not block: - break - blocks.append(block) - assert file.read(0) == "" - assert blocks == list("".join(self.lines)[7:]) - - def test_read_1(self): - file = self.makeStream() - blocks = [] - while 1: - block = file.read(1) - if not block: - break - blocks.append(block) - assert file.read(0) == "" - assert blocks == list("".join(self.lines)) - - def test_read_2(self): - file = self.makeStream() - blocks = [] - while 1: - block = file.read(2) - if not block: - break - blocks.append(block) - assert file.read(0) == "" - assert blocks == ["ab", "\nd", "ef", "\nx", "y\n", "pq", - "\nu", "vw", "x"] - - def test_read_4(self): - file = self.makeStream() - blocks = [] - while 1: - block = file.read(4) - if not block: - break - blocks.append(block) - assert file.read(0) == "" - assert blocks == ["ab\nd", "ef\nx", "y\npq", "\nuvw", "x"] - - def test_read_4_after_readline(self): - file = self.makeStream() - assert file.readline() == "ab\n" - assert file.readline() == "def\n" - blocks = [file.read(4)] - while 1: - block = file.read(4) - if not block: - break - blocks.append(block) - assert file.read(0) == "" - assert blocks == ["xy\np", "q\nuv", "wx"] - - def test_read_4_small_bufsize(self): - file = self.makeStream(bufsize=1) - blocks = [] - while 1: - block = file.read(4) - if not block: - break - blocks.append(block) - assert blocks == ["ab\nd", "ef\nx", "y\npq", "\nuvw", "x"] - - def test_tell_1(self): - file = self.makeStream(tell=True) - pos = 0 - while 1: - assert file.tell() == pos - n = len(file.read(1)) - if not n: - break - pos += n - - def test_tell_1_after_readline(self): - file = self.makeStream(tell=True) - pos = 0 - pos += len(file.readline()) - assert file.tell() == pos - pos += len(file.readline()) - assert file.tell() == pos - while 1: - assert file.tell() == pos - n = len(file.read(1)) - if not n: - break - pos += n - - def test_tell_2(self): - file = self.makeStream(tell=True) - pos = 0 - while 1: - assert file.tell() == pos - n = len(file.read(2)) - if not n: - break - pos += n - - def test_tell_4(self): - file = self.makeStream(tell=True) - pos = 0 - while 1: - assert file.tell() == pos - n = len(file.read(4)) - if not n: - break - pos += n - - def test_tell_readline(self): - file = self.makeStream(tell=True) - pos = 0 - while 1: - assert file.tell() == pos - n = len(file.readline()) - if not n: - break - pos += n - - def test_seek(self): - file = self.makeStream(tell=True, seek=True) - all = file.readall() - end = len(all) - for readto in range(0, end+1): - for seekto in range(0, end+1): - for whence in 0, 1, 2: - file.seek(0) - assert file.tell() == 0 - head = file.read(readto) - assert head == all[:readto] - if whence == 1: - offset = seekto - readto - elif whence == 2: - offset = seekto - end - else: - offset = seekto - file.seek(offset, whence) - here = file.tell() - assert here == seekto - rest = file.readall() - assert rest == all[seekto:] - - def test_seek_noseek(self): - file = self.makeStream() - all = file.readall() - end = len(all) - for readto in range(0, end+1): - for seekto in range(readto, end+1): - for whence in 1, 2: - file = self.makeStream() - head = file.read(readto) - assert head == all[:readto] - if whence == 1: - offset = seekto - readto - elif whence == 2: - offset = seekto - end - file.seek(offset, whence) - rest = file.readall() - assert rest == all[seekto:] - -class TestBufferingOutputStream: - - def test_write(self): - base = TestWriter() - filter = sio.BufferingOutputStream(base, 4) - filter.write("123") - assert base.buf == "" - assert filter.tell() == 3 - filter.write("456") - assert base.buf == "1234" - filter.write("789ABCDEF") - assert base.buf == "123456789ABC" - filter.write("0123") - assert base.buf == "123456789ABCDEF0" - assert filter.tell() == 19 - filter.close() - assert base.buf == "123456789ABCDEF0123" - - def test_write_seek(self): - base = TestWriter() - filter = sio.BufferingOutputStream(base, 4) - filter.write("x"*6) - filter.seek(3) - filter.write("y"*2) - filter.close() - assert base.buf == "x"*3 + "y"*2 + "x"*1 - - def test_write_seek_beyond_end(self): - "Linux behaviour. May be different on other platforms." - base = TestWriter() - filter = sio.BufferingOutputStream(base, 4) - filter.seek(3) - filter.write("y"*2) - filter.close() - assert base.buf == "\0"*3 + "y"*2 - - def test_truncate(self): - "Linux behaviour. May be different on other platforms." - base = TestWriter() - filter = sio.BufferingOutputStream(base, 4) - filter.write('x') - filter.truncate(4) - filter.write('y') - filter.close() - assert base.buf == 'xy' + '\0' * 2 - - def test_truncate2(self): - "Linux behaviour. May be different on other platforms." - base = TestWriter() - filter = sio.BufferingOutputStream(base, 4) - filter.write('12345678') - filter.truncate(4) - filter.write('y') - filter.close() - assert base.buf == '1234' + '\0' * 4 + 'y' - -class TestLineBufferingOutputStreamTests: - - def test_write(self): - base = TestWriter() - filter = sio.LineBufferingOutputStream(base) - filter.bufsize = 4 # More handy for testing than the default - filter.write("123") - assert base.buf == "" - assert filter.tell() == 3 - filter.write("456") - assert base.buf == "1234" - filter.write("789ABCDEF\n") - assert base.buf == "123456789ABCDEF\n" - filter.write("0123") - assert base.buf == "123456789ABCDEF\n0123" - assert filter.tell() == 20 - filter.close() - assert base.buf == "123456789ABCDEF\n0123" - - def xtest_write_seek(self): - base = TestWriter() - filter = sio.BufferingOutputStream(base, 4) - filter.write("x"*6) - filter.seek(3) - filter.write("y"*2) - filter.close() - assert base.buf == "x"*3 + "y"*2 + "x"*1 - -class TestBufferingInputOutputStreamTests: - - def test_write(self): - base = TestReaderWriter() - filter = sio.BufferingInputOutputStream(base, 4) - filter.write("123456789") - assert base.buf == "12345678" - s = filter.read() - assert base.buf == "123456789" - filter.write("01234") - assert base.buf == "1234567890123" - filter.seek(4,0) - assert base.buf == "12345678901234" - assert filter.read(3) == "567" - filter.write('x') - filter.flush() - assert base.buf == "1234567x901234" - - def test_write_seek_beyond_end(self): - "Linux behaviour. May be different on other platforms." - base = TestReaderWriter() - filter = sio.BufferingInputOutputStream(base, 4) - filter.seek(3) - filter.write("y"*2) - filter.close() - assert base.buf == "\0"*3 + "y"*2 - -class TestCRLFFilter: - - def test_filter(self): - packets = ["abc\ndef\rghi\r\nxyz\r", "123\r", "\n456"] - expected = ["abc\ndef\nghi\nxyz\n", "123\n", "456"] - crlf = sio.CRLFFilter(TestSource(packets)) - blocks = [] - while 1: - block = crlf.read(100) - if not block: - break - blocks.append(block) - assert blocks == expected - -class TestMMapFile(TestBufferingInputStreamTests): - tfn = None - Counter = 0 - - def teardown_method(self, method): - tfn = self.tfn - if tfn: - self.tfn = None - try: - os.remove(tfn) - except os.error, msg: - print "can't remove %s: %s" % (tfn, msg) - - def makeStream(self, tell=None, seek=None, bufsize=None, mode="r"): - self.teardown_method(None) # for tests calling makeStream() several time - self.tfn = str(udir.join('sio%03d' % TestMMapFile.Counter)) - TestMMapFile.Counter += 1 - f = open(self.tfn, "wb") - f.writelines(self.packets) - f.close() - return sio.MMapFile(self.tfn, mode) - - def test_write(self): - if os.name == "posix": - return # write() does't work on Unix :-( - file = self.makeStream(mode="w") - file.write("BooHoo\n") - file.write("Barf\n") - file.writelines(["a\n", "b\n", "c\n"]) - assert file.tell() == len("BooHoo\nBarf\na\nb\nc\n") - file.seek(0) - assert file.read() == "BooHoo\nBarf\na\nb\nc\n" - file.seek(0) - assert file.readlines() == ( - ["BooHoo\n", "Barf\n", "a\n", "b\n", "c\n"]) - assert file.tell() == len("BooHoo\nBarf\na\nb\nc\n") - -class TestTextInputFilter: - - packets = [ - "foo\r", - "bar\r", - "\nfoo\r\n", - "abc\ndef\rghi\r\nxyz", - "\nuvw\npqr\r", - "\n", - "abc\n", - ] - expected = [ - ("foo\n", 4), - ("bar\n", 9), - ("foo\n", 14), - ("abc\ndef\nghi\nxyz", 30), - ("\nuvw\npqr\n", 40), - ("abc\n", 44), - ("", 44), - ("", 44), - ] - - expected_with_tell = [ - ("foo\n", 4), - ("b", 5), - ("ar\n", 9), - ("foo\n", 14), - ("abc\ndef\nghi\nxyz", 30), - ("\nuvw\npqr\n", 40), - ("abc\n", 44), - ("", 44), - ("", 44), - ] - - expected_newlines = [ - (["abcd"], [None]), - (["abcd\n"], ["\n"]), - (["abcd\r\n"],["\r\n"]), - (["abcd\r"],[None]), # wrong, but requires precognition to fix - (["abcd\r", "\nefgh"], [None, "\r\n"]), - (["abcd", "\nefg\r", "hij", "k\r\n"], [None, "\n", ("\r", "\n"), - ("\r", "\n", "\r\n")]), - (["abcd", "\refg\r", "\nhij", "k\n"], [None, "\r", ("\r", "\r\n"), - ("\r", "\n", "\r\n")]) - ] - - def test_read(self): - base = TestReader(self.packets) - filter = sio.TextInputFilter(base) - for data, pos in self.expected: - assert filter.read(100) == data - - def test_read_tell(self): - base = TestReader(self.packets) - filter = sio.TextInputFilter(base) - for data, pos in self.expected_with_tell: - assert filter.read(100) == data - assert filter.tell() == pos - assert filter.tell() == pos # Repeat the tell() ! - - def test_seek(self): - base = TestReader(self.packets) - filter = sio.TextInputFilter(base) - sofar = "" - pairs = [] - while True: - pairs.append((sofar, filter.tell())) - c = filter.read(1) - if not c: - break - assert len(c) == 1 - sofar += c - all = sofar - for i in range(len(pairs)): - sofar, pos = pairs[i] - filter.seek(pos) - assert filter.tell() == pos - assert filter.tell() == pos - bufs = [sofar] - while True: - data = filter.read(100) - if not data: - assert filter.read(100) == "" - break - bufs.append(data) - assert "".join(bufs) == all - - def test_newlines_attribute(self): - - for packets, expected in self.expected_newlines: - base = TestReader(packets) - filter = sio.TextInputFilter(base) - for e in expected: - filter.read(100) - assert filter.newlines == e - -class TestTextOutputFilter: - - def test_write_nl(self): - base = TestWriter() - filter = sio.TextOutputFilter(base, linesep="\n") - filter.write("abc") - filter.write("def\npqr\nuvw") - filter.write("\n123\n") - assert base.buf == "abcdef\npqr\nuvw\n123\n" - - def test_write_cr(self): - base = TestWriter() - filter = sio.TextOutputFilter(base, linesep="\r") - filter.write("abc") - filter.write("def\npqr\nuvw") - filter.write("\n123\n") - assert base.buf == "abcdef\rpqr\ruvw\r123\r" - - def test_write_crnl(self): - base = TestWriter() - filter = sio.TextOutputFilter(base, linesep="\r\n") - filter.write("abc") - filter.write("def\npqr\nuvw") - filter.write("\n123\n") - assert base.buf == "abcdef\r\npqr\r\nuvw\r\n123\r\n" - - def test_write_tell_nl(self): - base = TestWriter() - filter = sio.TextOutputFilter(base, linesep="\n") - filter.write("xxx") - assert filter.tell() == 3 - filter.write("\nabc\n") - assert filter.tell() == 8 - - def test_write_tell_cr(self): - base = TestWriter() - filter = sio.TextOutputFilter(base, linesep="\r") - filter.write("xxx") - assert filter.tell() == 3 - filter.write("\nabc\n") - assert filter.tell() == 8 - - def test_write_tell_crnl(self): - base = TestWriter() - filter = sio.TextOutputFilter(base, linesep="\r\n") - filter.write("xxx") - assert filter.tell() == 3 - filter.write("\nabc\n") - assert filter.tell() == 10 - - def test_write_seek(self): - base = TestWriter() - filter = sio.TextOutputFilter(base, linesep="\n") - filter.write("x"*100) - filter.seek(50) - filter.write("y"*10) - assert base.buf == "x"*50 + "y"*10 + "x"*40 - -class TestDecodingInputFilter: - - def test_read(self): - chars = u"abc\xff\u1234\u4321\x80xyz" - data = chars.encode("utf8") - base = TestReader([data]) - filter = sio.DecodingInputFilter(base) - bufs = [] - for n in range(1, 11): - while 1: - c = filter.read(n) - assert type(c) == unicode - if not c: - break - bufs.append(c) - assert u"".join(bufs) == chars - -class TestEncodingOutputFilterTests: - - def test_write(self): - chars = u"abc\xff\u1234\u4321\x80xyz" - data = chars.encode("utf8") - for n in range(1, 11): - base = TestWriter() - filter = sio.EncodingOutputFilter(base) - pos = 0 - while 1: - c = chars[pos:pos+n] - if not c: - break - pos += len(c) - filter.write(c) - assert base.buf == data - -# Speed test - -FN = "BIG" - -def timeit(fn=FN, opener=sio.MMapFile): - f = opener(fn, "r") - lines = bytes = 0 - t0 = time.clock() - for line in f: - lines += 1 - bytes += len(line) - t1 = time.clock() - print "%d lines (%d bytes) in %.3f seconds for %s" % ( - lines, bytes, t1-t0, opener.__name__) - -def speed_main(): - def diskopen(fn, mode): - base = sio.DiskFile(fn, mode) - return sio.BufferingInputStream(base) - timeit(opener=diskopen) - timeit(opener=sio.MMapFile) - timeit(opener=open) - -# Functional test - -def functional_main(): - f = sio.DiskFile("sio.py") - f = sio.DecodingInputFilter(f) - f = sio.TextInputFilter(f) - f = sio.BufferingInputStream(f) - for i in range(10): - print repr(f.readline()) - Deleted: /pypy/dist/pypy/lib/test2/test_struct.py ============================================================================== --- /pypy/dist/pypy/lib/test2/test_struct.py Sun May 1 13:38:15 2005 +++ (empty file) @@ -1,448 +0,0 @@ -from test.test_support import TestFailed, verbose, verify -import struct - -import sys -ISBIGENDIAN = sys.byteorder == "big" -del sys -verify((struct.pack('=i', 1)[0] == chr(0)) == ISBIGENDIAN, - "bigendian determination appears wrong") - -def string_reverse(s): - chars = list(s) - chars.reverse() - return "".join(chars) - -def bigendian_to_native(value): - if ISBIGENDIAN: - return value - else: - return string_reverse(value) - -def simple_err(func, *args): - try: - func(*args) - except struct.error: - pass - else: - raise TestFailed, "%s%s did not raise struct.error" % ( - func.__name__, args) - -def any_err(func, *args): - try: - func(*args) - except (struct.error, OverflowError, TypeError): - pass - else: - raise TestFailed, "%s%s did not raise error" % ( - func.__name__, args) - - -simple_err(struct.calcsize, 'Z') - -sz = struct.calcsize('i') -if sz * 3 != struct.calcsize('iii'): - raise TestFailed, 'inconsistent sizes' - -fmt = 'cbxxxxxxhhhhiillffd' -fmt3 = '3c3b18x12h6i6l6f3d' -sz = struct.calcsize(fmt) -sz3 = struct.calcsize(fmt3) -if sz * 3 != sz3: - raise TestFailed, 'inconsistent sizes (3*%s -> 3*%d = %d, %s -> %d)' % ( - `fmt`, sz, 3*sz, `fmt3`, sz3) - -simple_err(struct.pack, 'iii', 3) -simple_err(struct.pack, 'i', 3, 3, 3) -simple_err(struct.pack, 'i', 'foo') -simple_err(struct.unpack, 'd', 'flap') -s = struct.pack('ii', 1, 2) -simple_err(struct.unpack, 'iii', s) -simple_err(struct.unpack, 'i', s) - -c = 'a' -b = 1 -h = 255 -i = 65535 -l = 65536 -f = 3.1415 -d = 3.1415 - -for prefix in ('', '@', '<', '>', '=', '!'): - for format in ('xcbhilfd', 'xcBHILfd'): - format = prefix + format - if verbose: - print "trying:", format - s = struct.pack(format, c, b, h, i, l, f, d) - cp, bp, hp, ip, lp, fp, dp = struct.unpack(format, s) - if (cp != c or bp != b or hp != h or ip != i or lp != l or - int(100 * fp) != int(100 * f) or int(100 * dp) != int(100 * d)): - # ^^^ calculate only to two decimal places - raise TestFailed, "unpack/pack not transitive (%s, %s)" % ( - str(format), str((cp, bp, hp, ip, lp, fp, dp))) - -# Test some of the new features in detail - -# (format, argument, big-endian result, little-endian result, asymmetric) -tests = [ - ('c', 'a', 'a', 'a', 0), - ('xc', 'a', '\0a', '\0a', 0), - ('cx', 'a', 'a\0', 'a\0', 0), - ('s', 'a', 'a', 'a', 0), - ('0s', 'helloworld', '', '', 1), - ('1s', 'helloworld', 'h', 'h', 1), - ('9s', 'helloworld', 'helloworl', 'helloworl', 1), - ('10s', 'helloworld', 'helloworld', 'helloworld', 0), - ('11s', 'helloworld', 'helloworld\0', 'helloworld\0', 1), - ('20s', 'helloworld', 'helloworld'+10*'\0', 'helloworld'+10*'\0', 1), - ('b', 7, '\7', '\7', 0), - ('b', -7, '\371', '\371', 0), - ('B', 7, '\7', '\7', 0), - ('B', 249, '\371', '\371', 0), - ('h', 700, '\002\274', '\274\002', 0), - ('h', -700, '\375D', 'D\375', 0), - ('H', 700, '\002\274', '\274\002', 0), - ('H', 0x10000-700, '\375D', 'D\375', 0), - ('i', 70000000, '\004,\035\200', '\200\035,\004', 0), - ('i', -70000000, '\373\323\342\200', '\200\342\323\373', 0), - ('I', 70000000L, '\004,\035\200', '\200\035,\004', 0), - ('I', 0x100000000L-70000000, '\373\323\342\200', '\200\342\323\373', 0), - ('l', 70000000, '\004,\035\200', '\200\035,\004', 0), - ('l', -70000000, '\373\323\342\200', '\200\342\323\373', 0), - ('L', 70000000L, '\004,\035\200', '\200\035,\004', 0), - ('L', 0x100000000L-70000000, '\373\323\342\200', '\200\342\323\373', 0), - ('f', 2.0, '@\000\000\000', '\000\000\000@', 0), - ('d', 2.0, '@\000\000\000\000\000\000\000', - '\000\000\000\000\000\000\000@', 0), - ('f', -2.0, '\300\000\000\000', '\000\000\000\300', 0), - ('d', -2.0, '\300\000\000\000\000\000\000\000', - '\000\000\000\000\000\000\000\300', 0), -] - -for fmt, arg, big, lil, asy in tests: - if verbose: - print `fmt`, `arg`, `big`, `lil` - for (xfmt, exp) in [('>'+fmt, big), ('!'+fmt, big), ('<'+fmt, lil), - ('='+fmt, ISBIGENDIAN and big or lil)]: - res = struct.pack(xfmt, arg) - if res != exp: - raise TestFailed, "pack(%s, %s) -> %s # expected %s" % ( - `fmt`, `arg`, `res`, `exp`) - n = struct.calcsize(xfmt) - if n != len(res): - raise TestFailed, "calcsize(%s) -> %d # expected %d" % ( - `xfmt`, n, len(res)) - rev = struct.unpack(xfmt, res)[0] - if rev != arg and not asy: - raise TestFailed, "unpack(%s, %s) -> (%s,) # expected (%s,)" % ( - `fmt`, `res`, `rev`, `arg`) - -########################################################################### -# Simple native q/Q tests. - -has_native_qQ = 1 -try: - struct.pack("q", 5) -except struct.error: - has_native_qQ = 0 - -if verbose: - print "Platform has native q/Q?", has_native_qQ and "Yes." or "No." - -any_err(struct.pack, "Q", -1) # can't pack -1 as unsigned regardless -simple_err(struct.pack, "q", "a") # can't pack string as 'q' regardless -simple_err(struct.pack, "Q", "a") # ditto, but 'Q' - -def test_native_qQ(): - bytes = struct.calcsize('q') - # The expected values here are in big-endian format, primarily because - # I'm on a little-endian machine and so this is the clearest way (for - # me) to force the code to get exercised. - for format, input, expected in ( - ('q', -1, '\xff' * bytes), - ('q', 0, '\x00' * bytes), - ('Q', 0, '\x00' * bytes), - ('q', 1L, '\x00' * (bytes-1) + '\x01'), - ('Q', (1L << (8*bytes))-1, '\xff' * bytes), - ('q', (1L << (8*bytes-1))-1, '\x7f' + '\xff' * (bytes - 1))): - got = struct.pack(format, input) - native_expected = bigendian_to_native(expected) - verify(got == native_expected, - "%r-pack of %r gave %r, not %r" % - (format, input, got, native_expected)) - retrieved = struct.unpack(format, got)[0] - verify(retrieved == input, - "%r-unpack of %r gave %r, not %r" % - (format, got, retrieved, input)) - -if has_native_qQ: - test_native_qQ() - -########################################################################### -# Standard integer tests (bBhHiIlLqQ). - -import binascii - -class IntTester: - - # XXX Most std integer modes fail to test for out-of-range. - # The "i" and "l" codes appear to range-check OK on 32-bit boxes, but - # fail to check correctly on some 64-bit ones (Tru64 Unix + Compaq C - # reported by Mark Favas). - BUGGY_RANGE_CHECK = "bBhHiIlL" - - def __init__(self, formatpair, bytesize): - assert len(formatpair) == 2 - self.formatpair = formatpair - for direction in "<>!=": - for code in formatpair: - format = direction + code - verify(struct.calcsize(format) == bytesize) - self.bytesize = bytesize - self.bitsize = bytesize * 8 - self.signed_code, self.unsigned_code = formatpair - self.unsigned_min = 0 - self.unsigned_max = 2L**self.bitsize - 1 - self.signed_min = -(2L**(self.bitsize-1)) - self.signed_max = 2L**(self.bitsize-1) - 1 - - def test_one(self, x, pack=struct.pack, - unpack=struct.unpack, - unhexlify=binascii.unhexlify): - if verbose: - print "trying std", self.formatpair, "on", x, "==", hex(x) - - # Try signed. - code = self.signed_code - if self.signed_min <= x <= self.signed_max: - # Try big-endian. - expected = long(x) - if x < 0: - expected += 1L << self.bitsize - assert expected > 0 - expected = hex(expected)[2:-1] # chop "0x" and trailing 'L' - if len(expected) & 1: - expected = "0" + expected - expected = unhexlify(expected) - expected = "\x00" * (self.bytesize - len(expected)) + expected - - # Pack work? - format = ">" + code - got = pack(format, x) - verify(got == expected, - "'%s'-pack of %r gave %r, not %r" % - (format, x, got, expected)) - - # Unpack work? - retrieved = unpack(format, got)[0] - verify(x == retrieved, - "'%s'-unpack of %r gave %r, not %r" % - (format, got, retrieved, x)) - - # Adding any byte should cause a "too big" error. - any_err(unpack, format, '\x01' + got) - - # Try little-endian. - format = "<" + code - expected = string_reverse(expected) - - # Pack work? - got = pack(format, x) - verify(got == expected, - "'%s'-pack of %r gave %r, not %r" % - (format, x, got, expected)) - - # Unpack work? - retrieved = unpack(format, got)[0] - verify(x == retrieved, - "'%s'-unpack of %r gave %r, not %r" % - (format, got, retrieved, x)) - - # Adding any byte should cause a "too big" error. - any_err(unpack, format, '\x01' + got) - - else: - # x is out of range -- verify pack realizes that. - if code in self.BUGGY_RANGE_CHECK: - if verbose: - print "Skipping buggy range check for code", code - else: - any_err(pack, ">" + code, x) - any_err(pack, "<" + code, x) - - # Much the same for unsigned. - code = self.unsigned_code - if self.unsigned_min <= x <= self.unsigned_max: - # Try big-endian. - format = ">" + code - expected = long(x) - expected = hex(expected)[2:-1] # chop "0x" and trailing 'L' - if len(expected) & 1: - expected = "0" + expected - expected = unhexlify(expected) - expected = "\x00" * (self.bytesize - len(expected)) + expected - - # Pack work? - got = pack(format, x) - verify(got == expected, - "'%s'-pack of %r gave %r, not %r" % - (format, x, got, expected)) - - # Unpack work? - retrieved = unpack(format, got)[0] - verify(x == retrieved, - "'%s'-unpack of %r gave %r, not %r" % - (format, got, retrieved, x)) - - # Adding any byte should cause a "too big" error. - any_err(unpack, format, '\x01' + got) - - # Try little-endian. - format = "<" + code - expected = string_reverse(expected) - - # Pack work? - got = pack(format, x) - verify(got == expected, - "'%s'-pack of %r gave %r, not %r" % - (format, x, got, expected)) - - # Unpack work? - retrieved = unpack(format, got)[0] - verify(x == retrieved, - "'%s'-unpack of %r gave %r, not %r" % - (format, got, retrieved, x)) - - # Adding any byte should cause a "too big" error. - any_err(unpack, format, '\x01' + got) - - else: - # x is out of range -- verify pack realizes that. - if code in self.BUGGY_RANGE_CHECK: - if verbose: - print "Skipping buggy range check for code", code - else: - any_err(pack, ">" + code, x) - any_err(pack, "<" + code, x) - - def run(self): - from random import randrange - - # Create all interesting powers of 2. - allvalues = [] - for exp in range(self.bitsize + 3): - allvalues.append(1L << exp) - - # reduce the number of values again - values = [] - i = 1 - while i <= len(allvalues): - values.append(allvalues[i-1]) - i *= 2 - - # Add some random values. - # - # XXX doesn't seem like good practice to run with random values - # - #for i in range(self.bitsize): - # val = 0L - # for j in range(self.bytesize): - # val = (val << 8) | randrange(256) - # values.append(val) - - # Try all those, and their negations, and +-1 from them. Note - # that this tests all power-of-2 boundaries in range, and a few out - # of range, plus +-(2**n +- 1). - for base in values: - for val in -base, base: - for incr in -1, 0, 1: - x = val + incr - try: - x = int(x) - except OverflowError: - pass - self.test_one(x) - - # Some error cases. - for direction in "<>": - for code in self.formatpair: - for badobject in "a string", 3+42j, randrange: - any_err(struct.pack, direction + code, badobject) - -for args in [("bB", 1), - ("hH", 2), - ("iI", 4), - ("lL", 4), - ("qQ", 8)]: - t = IntTester(*args) - t.run() - - -########################################################################### -# The p ("Pascal string") code. - -def test_p_code(): - for code, input, expected, expectedback in [ - ('p','abc', '\x00', ''), - ('1p', 'abc', '\x00', ''), - ('2p', 'abc', '\x01a', 'a'), - ('3p', 'abc', '\x02ab', 'ab'), - ('4p', 'abc', '\x03abc', 'abc'), - ('5p', 'abc', '\x03abc\x00', 'abc'), - ('6p', 'abc', '\x03abc\x00\x00', 'abc'), - ('1000p', 'x'*1000, '\xff' + 'x'*999, 'x'*255)]: - got = struct.pack(code, input) - if got != expected: - raise TestFailed("pack(%r, %r) == %r but expected %r" % - (code, input, got, expected)) - (got,) = struct.unpack(code, got) - if got != expectedback: - raise TestFailed("unpack(%r, %r) == %r but expected %r" % - (code, input, got, expectedback)) - -test_p_code() - - -########################################################################### -# SF bug 705836. "f" had a severe rounding bug, where a carry -# from the low-order discarded bits could propagate into the exponent -# field, causing the result to be wrong by a factor of 2. - -def test_705836(): - import math - - for base in range(1, 33): - # smaller <- largest representable float less than base. - delta = 0.5 - while base - delta / 2.0 != base: - delta /= 2.0 - smaller = base - delta - # Packing this rounds away a solid string of trailing 1 bits. - packed = struct.pack("f", smaller) - verify(bigpacked == string_reverse(packed), - ">f pack should be byte-reversal of f", bigpacked)[0] - verify(base == unpacked) - - # Largest finite IEEE single. - big = (1 << 24) - 1 - big = math.ldexp(big, 127 - 23) - packed = struct.pack(">f", big) - unpacked = struct.unpack(">f", packed)[0] - verify(big == unpacked) - - # The same, but tack on a 1 bit so it rounds up to infinity. - big = (1 << 25) - 1 - big = math.ldexp(big, 127 - 24) - try: - packed = struct.pack(">f", big) - except OverflowError: - pass - else: - TestFailed("expected OverflowError") - -test_705836() Deleted: /pypy/dist/pypy/lib/test2/test_types.py ============================================================================== --- /pypy/dist/pypy/lib/test2/test_types.py Sun May 1 13:38:15 2005 +++ (empty file) @@ -1,760 +0,0 @@ -# Python test set -- part 6, built-in types - -from test.test_support import * - -print '6. Built-in types' - -print '6.1 Truth value testing' -if None: raise TestFailed, 'None is true instead of false' -if 0: raise TestFailed, '0 is true instead of false' -if 0L: raise TestFailed, '0L is true instead of false' -if 0.0: raise TestFailed, '0.0 is true instead of false' -if '': raise TestFailed, '\'\' is true instead of false' -if (): raise TestFailed, '() is true instead of false' -if []: raise TestFailed, '[] is true instead of false' -if {}: raise TestFailed, '{} is true instead of false' -if not 1: raise TestFailed, '1 is false instead of true' -if not 1L: raise TestFailed, '1L is false instead of true' -if not 1.0: raise TestFailed, '1.0 is false instead of true' -if not 'x': raise TestFailed, '\'x\' is false instead of true' -if not (1, 1): raise TestFailed, '(1, 1) is false instead of true' -if not [1]: raise TestFailed, '[1] is false instead of true' -if not {'x': 1}: raise TestFailed, '{\'x\': 1} is false instead of true' -def f(): pass -class C: pass -import sys -x = C() -if not f: raise TestFailed, 'f is false instead of true' -if not C: raise TestFailed, 'C is false instead of true' -if not sys: raise TestFailed, 'sys is false instead of true' -if not x: raise TestFailed, 'x is false instead of true' - -print '6.2 Boolean operations' -if 0 or 0: raise TestFailed, '0 or 0 is true instead of false' -if 1 and 1: pass -else: raise TestFailed, '1 and 1 is false instead of true' -if not 1: raise TestFailed, 'not 1 is true instead of false' - -print '6.3 Comparisons' -if 0 < 1 <= 1 == 1 >= 1 > 0 != 1: pass -else: raise TestFailed, 'int comparisons failed' -if 0L < 1L <= 1L == 1L >= 1L > 0L != 1L: pass -else: raise TestFailed, 'long int comparisons failed' -if 0.0 < 1.0 <= 1.0 == 1.0 >= 1.0 > 0.0 != 1.0: pass -else: raise TestFailed, 'float comparisons failed' -if '' < 'a' <= 'a' == 'a' < 'abc' < 'abd' < 'b': pass -else: raise TestFailed, 'string comparisons failed' -if 0 in [0] and 0 not in [1]: pass -else: raise TestFailed, 'membership test failed' -if None is None and [] is not []: pass -else: raise TestFailed, 'identity test failed' - -try: float('') -except ValueError: pass -else: raise TestFailed, "float('') didn't raise ValueError" - -try: float('5\0') -except ValueError: pass -else: raise TestFailed, "float('5\0') didn't raise ValueError" - -try: 5.0 / 0.0 -except ZeroDivisionError: pass -else: raise TestFailed, "5.0 / 0.0 didn't raise ZeroDivisionError" - -try: 5.0 // 0.0 -except ZeroDivisionError: pass -else: raise TestFailed, "5.0 // 0.0 didn't raise ZeroDivisionError" - -try: 5.0 % 0.0 -except ZeroDivisionError: pass -else: raise TestFailed, "5.0 % 0.0 didn't raise ZeroDivisionError" - -try: 5 / 0L -except ZeroDivisionError: pass -else: raise TestFailed, "5 / 0L didn't raise ZeroDivisionError" - -try: 5 // 0L -except ZeroDivisionError: pass -else: raise TestFailed, "5 // 0L didn't raise ZeroDivisionError" - -try: 5 % 0L -except ZeroDivisionError: pass -else: raise TestFailed, "5 % 0L didn't raise ZeroDivisionError" - -print '6.4 Numeric types (mostly conversions)' -if 0 != 0L or 0 != 0.0 or 0L != 0.0: raise TestFailed, 'mixed comparisons' -if 1 != 1L or 1 != 1.0 or 1L != 1.0: raise TestFailed, 'mixed comparisons' -if -1 != -1L or -1 != -1.0 or -1L != -1.0: - raise TestFailed, 'int/long/float value not equal' -# calling built-in types without argument must return 0 -if int() != 0: raise TestFailed, 'int() does not return 0' -if long() != 0L: raise TestFailed, 'long() does not return 0L' -if float() != 0.0: raise TestFailed, 'float() does not return 0.0' -if int(1.9) == 1 == int(1.1) and int(-1.1) == -1 == int(-1.9): pass -else: raise TestFailed, 'int() does not round properly' -if long(1.9) == 1L == long(1.1) and long(-1.1) == -1L == long(-1.9): pass -else: raise TestFailed, 'long() does not round properly' -if float(1) == 1.0 and float(-1) == -1.0 and float(0) == 0.0: pass -else: raise TestFailed, 'float() does not work properly' -print '6.4.1 32-bit integers' -if 12 + 24 != 36: raise TestFailed, 'int op' -if 12 + (-24) != -12: raise TestFailed, 'int op' -if (-12) + 24 != 12: raise TestFailed, 'int op' -if (-12) + (-24) != -36: raise TestFailed, 'int op' -if not 12 < 24: raise TestFailed, 'int op' -if not -24 < -12: raise TestFailed, 'int op' -# Test for a particular bug in integer multiply -xsize, ysize, zsize = 238, 356, 4 -if not (xsize*ysize*zsize == zsize*xsize*ysize == 338912): - raise TestFailed, 'int mul commutativity' -# And another. -m = -sys.maxint - 1 -for divisor in 1, 2, 4, 8, 16, 32: - j = m // divisor - prod = divisor * j - if prod != m: - raise TestFailed, "%r * %r == %r != %r" % (divisor, j, prod, m) - if type(prod) is not int: - raise TestFailed, ("expected type(prod) to be int, not %r" % - type(prod)) -# Check for expected * overflow to long. -for divisor in 1, 2, 4, 8, 16, 32: - j = m // divisor - 1 - prod = divisor * j - if type(prod) is not long: - raise TestFailed, ("expected type(%r) to be long, not %r" % - (prod, type(prod))) -# Check for expected * overflow to long. -m = sys.maxint -for divisor in 1, 2, 4, 8, 16, 32: - j = m // divisor + 1 - prod = divisor * j - if type(prod) is not long: - raise TestFailed, ("expected type(%r) to be long, not %r" % - (prod, type(prod))) - -print '6.4.2 Long integers' -if 12L + 24L != 36L: raise TestFailed, 'long op' -if 12L + (-24L) != -12L: raise TestFailed, 'long op' -if (-12L) + 24L != 12L: raise TestFailed, 'long op' -if (-12L) + (-24L) != -36L: raise TestFailed, 'long op' -if not 12L < 24L: raise TestFailed, 'long op' -if not -24L < -12L: raise TestFailed, 'long op' -x = sys.maxint -if int(long(x)) != x: raise TestFailed, 'long op' -try: y = int(long(x)+1L) -except OverflowError: raise TestFailed, 'long op' -if not isinstance(y, long): raise TestFailed, 'long op' -x = -x -if int(long(x)) != x: raise TestFailed, 'long op' -x = x-1 -if int(long(x)) != x: raise TestFailed, 'long op' -try: y = int(long(x)-1L) -except OverflowError: raise TestFailed, 'long op' -if not isinstance(y, long): raise TestFailed, 'long op' - -try: 5 << -5 -except ValueError: pass -else: raise TestFailed, 'int negative shift <<' - -try: 5L << -5L -except ValueError: pass -else: raise TestFailed, 'long negative shift <<' - -try: 5 >> -5 -except ValueError: pass -else: raise TestFailed, 'int negative shift >>' - -try: 5L >> -5L -except ValueError: pass -else: raise TestFailed, 'long negative shift >>' - -print '6.4.3 Floating point numbers' -if 12.0 + 24.0 != 36.0: raise TestFailed, 'float op' -if 12.0 + (-24.0) != -12.0: raise TestFailed, 'float op' -if (-12.0) + 24.0 != 12.0: raise TestFailed, 'float op' -if (-12.0) + (-24.0) != -36.0: raise TestFailed, 'float op' -if not 12.0 < 24.0: raise TestFailed, 'float op' -if not -24.0 < -12.0: raise TestFailed, 'float op' - -print '6.5 Sequence types' - -print '6.5.1 Strings' -if len('') != 0: raise TestFailed, 'len(\'\')' -if len('a') != 1: raise TestFailed, 'len(\'a\')' -if len('abcdef') != 6: raise TestFailed, 'len(\'abcdef\')' -if 'xyz' + 'abcde' != 'xyzabcde': raise TestFailed, 'string concatenation' -if 'xyz'*3 != 'xyzxyzxyz': raise TestFailed, 'string repetition *3' -if 0*'abcde' != '': raise TestFailed, 'string repetition 0*' -if min('abc') != 'a' or max('abc') != 'c': raise TestFailed, 'min/max string' -if 'a' in 'abc' and 'b' in 'abc' and 'c' in 'abc' and 'd' not in 'abc': pass -else: raise TestFailed, 'in/not in string' -x = 'x'*103 -if '%s!'%x != x+'!': raise TestFailed, 'nasty string formatting bug' - -#extended slices for strings -a = '0123456789' -vereq(a[::], a) -vereq(a[::2], '02468') -vereq(a[1::2], '13579') -vereq(a[::-1],'9876543210') -vereq(a[::-2], '97531') -vereq(a[3::-2], '31') -vereq(a[-100:100:], a) -vereq(a[100:-100:-1], a[::-1]) -vereq(a[-100L:100L:2L], '02468') - -if have_unicode: - a = unicode('0123456789', 'ascii') - vereq(a[::], a) - vereq(a[::2], unicode('02468', 'ascii')) - vereq(a[1::2], unicode('13579', 'ascii')) - vereq(a[::-1], unicode('9876543210', 'ascii')) - vereq(a[::-2], unicode('97531', 'ascii')) - vereq(a[3::-2], unicode('31', 'ascii')) - vereq(a[-100:100:], a) - vereq(a[100:-100:-1], a[::-1]) - vereq(a[-100L:100L:2L], unicode('02468', 'ascii')) - - -print '6.5.2 Tuples' -# calling built-in types without argument must return empty -if tuple() != (): raise TestFailed,'tuple() does not return ()' -if len(()) != 0: raise TestFailed, 'len(())' -if len((1,)) != 1: raise TestFailed, 'len((1,))' -if len((1,2,3,4,5,6)) != 6: raise TestFailed, 'len((1,2,3,4,5,6))' -if (1,2)+(3,4) != (1,2,3,4): raise TestFailed, 'tuple concatenation' -if (1,2)*3 != (1,2,1,2,1,2): raise TestFailed, 'tuple repetition *3' -if 0*(1,2,3) != (): raise TestFailed, 'tuple repetition 0*' -if min((1,2)) != 1 or max((1,2)) != 2: raise TestFailed, 'min/max tuple' -if 0 in (0,1,2) and 1 in (0,1,2) and 2 in (0,1,2) and 3 not in (0,1,2): pass -else: raise TestFailed, 'in/not in tuple' -try: ()[0] -except IndexError: pass -else: raise TestFailed, "tuple index error didn't raise IndexError" -x = () -x += () -if x != (): raise TestFailed, 'tuple inplace add from () to () failed' -x += (1,) -if x != (1,): raise TestFailed, 'tuple resize from () failed' - -# extended slicing - subscript only for tuples -a = (0,1,2,3,4) -vereq(a[::], a) -vereq(a[::2], (0,2,4)) -vereq(a[1::2], (1,3)) -vereq(a[::-1], (4,3,2,1,0)) -vereq(a[::-2], (4,2,0)) -vereq(a[3::-2], (3,1)) -vereq(a[-100:100:], a) -vereq(a[100:-100:-1], a[::-1]) -vereq(a[-100L:100L:2L], (0,2,4)) - -# Check that a specific bug in _PyTuple_Resize() is squashed. -def f(): - for i in range(1000): - yield i -vereq(list(tuple(f())), range(1000)) - -# xxx PyPy behaves differently on this detail -## Verify that __getitem__ overrides are not recognized by __iter__ -#class T(tuple): -# def __getitem__(self, key): -# return str(key) + '!!!' -#vereq(iter(T((1,2))).next(), 1) - -print '6.5.3 Lists' -# calling built-in types without argument must return empty -if list() != []: raise TestFailed,'list() does not return []' -if len([]) != 0: raise TestFailed, 'len([])' -if len([1,]) != 1: raise TestFailed, 'len([1,])' -if len([1,2,3,4,5,6]) != 6: raise TestFailed, 'len([1,2,3,4,5,6])' -if [1,2]+[3,4] != [1,2,3,4]: raise TestFailed, 'list concatenation' -if [1,2]*3 != [1,2,1,2,1,2]: raise TestFailed, 'list repetition *3' -if [1,2]*3L != [1,2,1,2,1,2]: raise TestFailed, 'list repetition *3L' -if 0*[1,2,3] != []: raise TestFailed, 'list repetition 0*' -if 0L*[1,2,3] != []: raise TestFailed, 'list repetition 0L*' -if min([1,2]) != 1 or max([1,2]) != 2: raise TestFailed, 'min/max list' -if 0 in [0,1,2] and 1 in [0,1,2] and 2 in [0,1,2] and 3 not in [0,1,2]: pass -else: raise TestFailed, 'in/not in list' -a = [1, 2, 3, 4, 5] -a[:-1] = a -if a != [1, 2, 3, 4, 5, 5]: - raise TestFailed, "list self-slice-assign (head)" -a = [1, 2, 3, 4, 5] -a[1:] = a -if a != [1, 1, 2, 3, 4, 5]: - raise TestFailed, "list self-slice-assign (tail)" -a = [1, 2, 3, 4, 5] -a[1:-1] = a -if a != [1, 1, 2, 3, 4, 5, 5]: - raise TestFailed, "list self-slice-assign (center)" -try: [][0] -except IndexError: pass -else: raise TestFailed, "list index error didn't raise IndexError" -try: [][0] = 5 -except IndexError: pass -else: raise TestFailed, "list assignment index error didn't raise IndexError" -try: [].pop() -except IndexError: pass -else: raise TestFailed, "empty list.pop() didn't raise IndexError" -try: [1].pop(5) -except IndexError: pass -else: raise TestFailed, "[1].pop(5) didn't raise IndexError" -try: [][0:1] = 5 -except TypeError: pass -else: raise TestFailed, "bad list slice assignment didn't raise TypeError" -try: [].extend(None) -except TypeError: pass -else: raise TestFailed, "list.extend(None) didn't raise TypeError" -a = [1, 2, 3, 4] -a *= 0 -if a != []: - raise TestFailed, "list inplace repeat" - -a = [] -a[:] = tuple(range(10)) -if a != range(10): - raise TestFailed, "assigning tuple to slice" - -print '6.5.3a Additional list operations' -a = [0,1,2,3,4] -a[0L] = 1 -a[1L] = 2 -a[2L] = 3 -if a != [1,2,3,3,4]: raise TestFailed, 'list item assignment [0L], [1L], [2L]' -a[0] = 5 -a[1] = 6 -a[2] = 7 -if a != [5,6,7,3,4]: raise TestFailed, 'list item assignment [0], [1], [2]' -a[-2L] = 88 -a[-1L] = 99 -if a != [5,6,7,88,99]: raise TestFailed, 'list item assignment [-2L], [-1L]' -a[-2] = 8 -a[-1] = 9 -if a != [5,6,7,8,9]: raise TestFailed, 'list item assignment [-2], [-1]' -a[:2] = [0,4] -a[-3:] = [] -a[1:1] = [1,2,3] -if a != [0,1,2,3,4]: raise TestFailed, 'list slice assignment' -a[ 1L : 4L] = [7,8,9] -if a != [0,7,8,9,4]: raise TestFailed, 'list slice assignment using long ints' -del a[1:4] -if a != [0,4]: raise TestFailed, 'list slice deletion' -del a[0] -if a != [4]: raise TestFailed, 'list item deletion [0]' -del a[-1] -if a != []: raise TestFailed, 'list item deletion [-1]' -a=range(0,5) -del a[1L:4L] -if a != [0,4]: raise TestFailed, 'list slice deletion' -del a[0L] -if a != [4]: raise TestFailed, 'list item deletion [0]' -del a[-1L] -if a != []: raise TestFailed, 'list item deletion [-1]' -a.append(0) -a.append(1) -a.append(2) -if a != [0,1,2]: raise TestFailed, 'list append' -a.insert(0, -2) -a.insert(1, -1) -a.insert(2,0) -if a != [-2,-1,0,0,1,2]: raise TestFailed, 'list insert' -b = a[:] -b.insert(-2, "foo") -b.insert(-200, "left") -b.insert(200, "right") -if b != ["left",-2,-1,0,0,"foo",1,2,"right"]: raise TestFailed, 'list insert2' -# a = [-2,-1,0,0,1,2] -if a.count(0) != 2: raise TestFailed, ' list count' -if a.index(0) != 2: raise TestFailed, 'list index' -if a.index(0,2) != 2: raise TestFailed, 'list index, start argument' -if a.index(0,-4) != 2: raise TestFailed, 'list index, -start argument' -if a.index(-2,-10) != 0: raise TestFailed, 'list index, very -start argument' -if a.index(0,3) != 3: raise TestFailed, 'list index, start argument' -if a.index(0,-3) != 3: raise TestFailed, 'list index, -start argument' -if a.index(0,3,4) != 3: raise TestFailed, 'list index, stop argument' -if a.index(0,-3,-2) != 3: raise TestFailed, 'list index, -stop argument' -if a.index(0,-4*sys.maxint,4*sys.maxint) != 2: - raise TestFailed, 'list index, -maxint, maxint argument' -try: - a.index(0, 4*sys.maxint,-4*sys.maxint) -except ValueError: - pass -else: - raise TestFailed, 'list index, maxint,-maxint argument' - -try: - a.index(2,0,-10) -except ValueError: - pass -else: - raise TestFailed, 'list index, very -stop argument' -a.remove(0) -try: - a.index(2,0,4) -except ValueError: - pass -else: - raise TestFailed, 'list index, stop argument.' -if a != [-2,-1,0,1,2]: raise TestFailed, 'list remove' -a.reverse() -if a != [2,1,0,-1,-2]: raise TestFailed, 'list reverse' -a.sort() -if a != [-2,-1,0,1,2]: raise TestFailed, 'list sort' -def revcmp(a, b): return cmp(b, a) -a.sort(revcmp) -if a != [2,1,0,-1,-2]: raise TestFailed, 'list sort with cmp func' -# The following dumps core in unpatched Python 1.5: -def myComparison(x,y): - return cmp(x%3, y%7) -z = range(12) -z.sort(myComparison) - -try: z.sort(2) -except TypeError: pass -else: raise TestFailed, 'list sort compare function is not callable' - -def selfmodifyingComparison(x,y): - z.append(1) - return cmp(x, y) -try: z.sort(selfmodifyingComparison) -except ValueError: pass -else: raise TestFailed, 'modifying list during sort' - - -try: z.sort(lambda x, y: 's') -except TypeError: pass -else: raise TestFailed, 'list sort compare function does not return int' - -# Test extreme cases with long ints -a = [0,1,2,3,4] -if a[ -pow(2,128L): 3 ] != [0,1,2]: - raise TestFailed, "list slicing with too-small long integer" -if a[ 3: pow(2,145L) ] != [3,4]: - raise TestFailed, "list slicing with too-large long integer" - - -# extended slicing - -# subscript -a = [0,1,2,3,4] -vereq(a[::], a) -vereq(a[::2], [0,2,4]) -vereq(a[1::2], [1,3]) -vereq(a[::-1], [4,3,2,1,0]) -vereq(a[::-2], [4,2,0]) -vereq(a[3::-2], [3,1]) -vereq(a[-100:100:], a) -vereq(a[100:-100:-1], a[::-1]) -vereq(a[-100L:100L:2L], [0,2,4]) -vereq(a[1000:2000:2], []) -vereq(a[-1000:-2000:-2], []) -# deletion -del a[::2] -vereq(a, [1,3]) -a = range(5) -del a[1::2] -vereq(a, [0,2,4]) -a = range(5) -del a[1::-2] -vereq(a, [0,2,3,4]) -a = range(10) -del a[::1000] -vereq(a, [1, 2, 3, 4, 5, 6, 7, 8, 9]) -# assignment -a = range(10) -a[::2] = [-1]*5 -vereq(a, [-1, 1, -1, 3, -1, 5, -1, 7, -1, 9]) -a = range(10) -a[::-4] = [10]*3 -vereq(a, [0, 10, 2, 3, 4, 10, 6, 7, 8 ,10]) -a = range(4) -a[::-1] = a -vereq(a, [3, 2, 1, 0]) -a = range(10) -b = a[:] -c = a[:] -a[2:3] = ["two", "elements"] -b[slice(2,3)] = ["two", "elements"] -c[2:3:] = ["two", "elements"] -vereq(a, b) -vereq(a, c) -a = range(10) -a[::2] = tuple(range(5)) -vereq(a, [0, 1, 1, 3, 2, 5, 3, 7, 4, 9]) - -# xxx PyPy behaves differently on this detail -## Verify that __getitem__ overrides are not recognized by __iter__ -#class L(list): -# def __getitem__(self, key): -# return str(key) + '!!!' -#vereq(iter(L([1,2])).next(), 1) - - -print '6.6 Mappings == Dictionaries' -# calling built-in types without argument must return empty -if dict() != {}: raise TestFailed,'dict() does not return {}' -d = {} -if d.keys() != []: raise TestFailed, '{}.keys()' -if d.values() != []: raise TestFailed, '{}.values()' -if d.items() != []: raise TestFailed, '{}.items()' -if d.has_key('a') != 0: raise TestFailed, '{}.has_key(\'a\')' -if ('a' in d) != 0: raise TestFailed, "'a' in {}" -if ('a' not in d) != 1: raise TestFailed, "'a' not in {}" -if len(d) != 0: raise TestFailed, 'len({})' -d = {'a': 1, 'b': 2} -if len(d) != 2: raise TestFailed, 'len(dict)' -k = d.keys() -k.sort() -if k != ['a', 'b']: raise TestFailed, 'dict keys()' -if d.has_key('a') and d.has_key('b') and not d.has_key('c'): pass -else: raise TestFailed, 'dict keys()' -if 'a' in d and 'b' in d and 'c' not in d: pass -else: raise TestFailed, 'dict keys() # in/not in version' -if d['a'] != 1 or d['b'] != 2: raise TestFailed, 'dict item' -d['c'] = 3 -d['a'] = 4 -if d['c'] != 3 or d['a'] != 4: raise TestFailed, 'dict item assignment' -del d['b'] -if d != {'a': 4, 'c': 3}: raise TestFailed, 'dict item deletion' -# dict.clear() -d = {1:1, 2:2, 3:3} -d.clear() -if d != {}: raise TestFailed, 'dict clear' -# dict.update() -d.update({1:100}) -d.update({2:20}) -d.update({1:1, 2:2, 3:3}) -if d != {1:1, 2:2, 3:3}: raise TestFailed, 'dict update' -d.clear() -try: d.update(None) -except AttributeError: pass -else: raise TestFailed, 'dict.update(None), AttributeError expected' -class SimpleUserDict: - def __init__(self): - self.d = {1:1, 2:2, 3:3} - def keys(self): - return self.d.keys() - def __getitem__(self, i): - return self.d[i] -d.update(SimpleUserDict()) -if d != {1:1, 2:2, 3:3}: raise TestFailed, 'dict.update(instance)' -d.clear() -class FailingUserDict: - def keys(self): - raise ValueError -try: d.update(FailingUserDict()) -except ValueError: pass -else: raise TestFailed, 'dict.keys() expected ValueError' -class FailingUserDict: - def keys(self): - class BogonIter: - def __iter__(self): - raise ValueError - return BogonIter() -try: d.update(FailingUserDict()) -except ValueError: pass -else: raise TestFailed, 'iter(dict.keys()) expected ValueError' -class FailingUserDict: - def keys(self): - class BogonIter: - def __init__(self): - self.i = 1 - def __iter__(self): - return self - def next(self): - if self.i: - self.i = 0 - return 'a' - raise ValueError - return BogonIter() - def __getitem__(self, key): - return key -try: d.update(FailingUserDict()) -except ValueError: pass -else: raise TestFailed, 'iter(dict.keys()).next() expected ValueError' -class FailingUserDict: - def keys(self): - class BogonIter: - def __init__(self): - self.i = ord('a') - def __iter__(self): - return self - def next(self): - if self.i <= ord('z'): - rtn = chr(self.i) - self.i += 1 - return rtn - raise StopIteration - return BogonIter() - def __getitem__(self, key): - raise ValueError -try: d.update(FailingUserDict()) -except ValueError: pass -else: raise TestFailed, 'dict.update(), __getitem__ expected ValueError' -# dict.fromkeys() -if dict.fromkeys('abc') != {'a':None, 'b':None, 'c':None}: - raise TestFailed, 'dict.fromkeys did not work as a class method' -d = {} -if d.fromkeys('abc') is d: - raise TestFailed, 'dict.fromkeys did not return a new dict' -if d.fromkeys('abc') != {'a':None, 'b':None, 'c':None}: - raise TestFailed, 'dict.fromkeys failed with default value' -if d.fromkeys((4,5),0) != {4:0, 5:0}: - raise TestFailed, 'dict.fromkeys failed with specified value' -if d.fromkeys([]) != {}: - raise TestFailed, 'dict.fromkeys failed with null sequence' -def g(): - yield 1 -if d.fromkeys(g()) != {1:None}: - raise TestFailed, 'dict.fromkeys failed with a generator' -try: {}.fromkeys(3) -except TypeError: pass -else: raise TestFailed, 'dict.fromkeys failed to raise TypeError' -class dictlike(dict): pass -if dictlike.fromkeys('a') != {'a':None}: - raise TestFailed, 'dictsubclass.fromkeys did not inherit' -if dictlike().fromkeys('a') != {'a':None}: - raise TestFailed, 'dictsubclass.fromkeys did not inherit' -if type(dictlike.fromkeys('a')) is not dictlike: - raise TestFailed, 'dictsubclass.fromkeys created wrong type' -if type(dictlike().fromkeys('a')) is not dictlike: - raise TestFailed, 'dictsubclass.fromkeys created wrong type' -from UserDict import UserDict -class mydict(dict): - def __new__(cls): - return UserDict() -ud = mydict.fromkeys('ab') -if ud != {'a':None, 'b':None} or not isinstance(ud,UserDict): - raise TestFailed, 'fromkeys did not instantiate using __new__' -# dict.copy() -d = {1:1, 2:2, 3:3} -if d.copy() != {1:1, 2:2, 3:3}: raise TestFailed, 'dict copy' -if {}.copy() != {}: raise TestFailed, 'empty dict copy' -# dict.get() -d = {} -if d.get('c') is not None: raise TestFailed, 'missing {} get, no 2nd arg' -if d.get('c', 3) != 3: raise TestFailed, 'missing {} get, w/ 2nd arg' -d = {'a' : 1, 'b' : 2} -if d.get('c') is not None: raise TestFailed, 'missing dict get, no 2nd arg' -if d.get('c', 3) != 3: raise TestFailed, 'missing dict get, w/ 2nd arg' -if d.get('a') != 1: raise TestFailed, 'present dict get, no 2nd arg' -if d.get('a', 3) != 1: raise TestFailed, 'present dict get, w/ 2nd arg' -# dict.setdefault() -d = {} -if d.setdefault('key0') is not None: - raise TestFailed, 'missing {} setdefault, no 2nd arg' -if d.setdefault('key0') is not None: - raise TestFailed, 'present {} setdefault, no 2nd arg' -d.setdefault('key', []).append(3) -if d['key'][0] != 3: - raise TestFailed, 'missing {} setdefault, w/ 2nd arg' -d.setdefault('key', []).append(4) -if len(d['key']) != 2: - raise TestFailed, 'present {} setdefault, w/ 2nd arg' -# dict.popitem() -for copymode in -1, +1: - # -1: b has same structure as a - # +1: b is a.copy() - for log2size in range(12): - size = 2**log2size - a = {} - b = {} - for i in range(size): - a[`i`] = i - if copymode < 0: - b[`i`] = i - if copymode > 0: - b = a.copy() - for i in range(size): - ka, va = ta = a.popitem() - if va != int(ka): raise TestFailed, "a.popitem: %s" % str(ta) - kb, vb = tb = b.popitem() - if vb != int(kb): raise TestFailed, "b.popitem: %s" % str(tb) - if copymode < 0 and ta != tb: - raise TestFailed, "a.popitem != b.popitem: %s, %s" % ( - str(ta), str(tb)) - if a: raise TestFailed, 'a not empty after popitems: %s' % str(a) - if b: raise TestFailed, 'b not empty after popitems: %s' % str(b) - -d.clear() -try: d.popitem() -except KeyError: pass -else: raise TestFailed, "{}.popitem doesn't raise KeyError" - -# Tests for pop with specified key -d.clear() -k, v = 'abc', 'def' -d[k] = v -try: d.pop('ghi') -except KeyError: pass -else: raise TestFailed, "{}.pop(k) doesn't raise KeyError when k not in dictionary" - -if d.pop(k) != v: raise TestFailed, "{}.pop(k) doesn't find known key/value pair" -if len(d) > 0: raise TestFailed, "{}.pop(k) failed to remove the specified pair" - -try: d.pop(k) -except KeyError: pass -else: raise TestFailed, "{}.pop(k) doesn't raise KeyError when dictionary is empty" - -# verify longs/ints get same value when key > 32 bits (for 64-bit archs) -# see SF bug #689659 -x = 4503599627370496L -y = 4503599627370496 -h = {x: 'anything', y: 'something else'} -if h[x] != h[y]: - raise TestFailed, "long/int key should match" - -if d.pop(k, v) != v: raise TestFailed, "{}.pop(k, v) doesn't return default value" -d[k] = v -if d.pop(k, 1) != v: raise TestFailed, "{}.pop(k, v) doesn't find known key/value pair" - - -# xxx PyPy: what do to about this? we iterate over the keys as they were at iter creation time -# -#d[1] = 1 -#try: -# for i in d: -# d[i+1] = 1 -#except RuntimeError: -# pass -#else: -# raise TestFailed, "changing dict size during iteration doesn't raise Error" - -try: type(1, 2) -except TypeError: pass -else: raise TestFailed, 'type(), w/2 args expected TypeError' - -try: type(1, 2, 3, 4) -except TypeError: pass -else: raise TestFailed, 'type(), w/4 args expected TypeError' - -print 'Buffers' -try: buffer('asdf', -1) -except ValueError: pass -else: raise TestFailed, "buffer('asdf', -1) should raise ValueError" - -try: buffer(None) -except TypeError: pass -else: raise TestFailed, "buffer(None) should raise TypeError" - -a = buffer('asdf') -hash(a) -b = a * 5 -if a == b: - raise TestFailed, 'buffers should not be equal' -if str(b) != ('asdf' * 5): - raise TestFailed, 'repeated buffer has wrong content' -if str(a * 0) != '': - raise TestFailed, 'repeated buffer zero times has wrong content' -if str(a + buffer('def')) != 'asdfdef': - raise TestFailed, 'concatenation of buffers yields wrong content' - -try: a[1] = 'g' -except TypeError: pass -else: raise TestFailed, "buffer assignment should raise TypeError" - -try: a[0:1] = 'g' -except TypeError: pass -else: raise TestFailed, "buffer slice assignment should raise TypeError" Deleted: /pypy/dist/pypy/lib/traceback.py ============================================================================== --- /pypy/dist/pypy/lib/traceback.py Sun May 1 13:38:15 2005 +++ (empty file) @@ -1,284 +0,0 @@ -"""Extract, format and print information about Python stack traces.""" - -import linecache -import sys -import types - -__all__ = ['extract_stack', 'extract_tb', 'format_exception', - 'format_exception_only', 'format_list', 'format_stack', - 'format_tb', 'print_exc', 'print_exception', 'print_last', - 'print_stack', 'print_tb', 'tb_lineno'] - -def _print(file, str='', terminator='\n'): - file.write(str+terminator) - - -def print_list(extracted_list, file=None): - """Print the list of tuples as returned by extract_tb() or - extract_stack() as a formatted stack trace to the given file.""" - if file is None: - file = sys.stderr - for filename, lineno, name, line in extracted_list: - _print(file, - ' File "%s", line %d, in %s' % (filename,lineno,name)) - if line: - _print(file, ' %s' % line.strip()) - -def format_list(extracted_list): - """Format a list of traceback entry tuples for printing. - - Given a list of tuples as returned by extract_tb() or - extract_stack(), return a list of strings ready for printing. - Each string in the resulting list corresponds to the item with the - same index in the argument list. Each string ends in a newline; - the strings may contain internal newlines as well, for those items - whose source text line is not None. - """ - list = [] - for filename, lineno, name, line in extracted_list: - item = ' File "%s", line %d, in %s\n' % (filename,lineno,name) - if line: - item = item + ' %s\n' % line.strip() - list.append(item) - return list - - -def print_tb(tb, limit=None, file=None): - """Print up to 'limit' stack trace entries from the traceback 'tb'. - - If 'limit' is omitted or None, all entries are printed. If 'file' - is omitted or None, the output goes to sys.stderr; otherwise - 'file' should be an open file or file-like object with a write() - method. - """ - if file is None: - file = sys.stderr - if limit is None: - if hasattr(sys, 'tracebacklimit'): - limit = sys.tracebacklimit - n = 0 - while tb is not None and (limit is None or n < limit): - f = tb.tb_frame - lineno = tb.tb_lineno - co = f.f_code - filename = co.co_filename - name = co.co_name - _print(file, - ' File "%s", line %d, in %s' % (filename,lineno,name)) - line = linecache.getline(filename, lineno) - if line: _print(file, ' ' + line.strip()) - tb = tb.tb_next - n = n+1 - -def format_tb(tb, limit = None): - """A shorthand for 'format_list(extract_stack(f, limit)).""" - return format_list(extract_tb(tb, limit)) - -def extract_tb(tb, limit = None): - """Return list of up to limit pre-processed entries from traceback. - - This is useful for alternate formatting of stack traces. If - 'limit' is omitted or None, all entries are extracted. A - pre-processed stack trace entry is a quadruple (filename, line - number, function name, text) representing the information that is - usually printed for a stack trace. The text is a string with - leading and trailing whitespace stripped; if the source is not - available it is None. - """ - if limit is None: - if hasattr(sys, 'tracebacklimit'): - limit = sys.tracebacklimit - list = [] - n = 0 - while tb is not None and (limit is None or n < limit): - f = tb.tb_frame - lineno = tb.tb_lineno - co = f.f_code - filename = co.co_filename - name = co.co_name - line = linecache.getline(filename, lineno) - if line: line = line.strip() - else: line = None - list.append((filename, lineno, name, line)) - tb = tb.tb_next - n = n+1 - return list - - -def print_exception(etype, value, tb, limit=None, file=None): - """Print exception up to 'limit' stack trace entries from 'tb' to 'file'. - - This differs from print_tb() in the following ways: (1) if - traceback is not None, it prints a header "Traceback (most recent - call last):"; (2) it prints the exception type and value after the - stack trace; (3) if type is SyntaxError and value has the - appropriate format, it prints the line where the syntax error - occurred with a caret on the next line indicating the approximate - position of the error. - """ - if file is None: - file = sys.stderr - if tb: - _print(file, 'Traceback (most recent call last):') - print_tb(tb, limit, file) - lines = format_exception_only(etype, value) - for line in lines[:-1]: - _print(file, line, ' ') - _print(file, lines[-1], '') - -def format_exception(etype, value, tb, limit = None): - """Format a stack trace and the exception information. - - The arguments have the same meaning as the corresponding arguments - to print_exception(). The return value is a list of strings, each - ending in a newline and some containing internal newlines. When - these lines are concatenated and printed, exactly the same text is - printed as does print_exception(). - """ - if tb: - list = ['Traceback (most recent call last):\n'] - list = list + format_tb(tb, limit) - else: - list = [] - list = list + format_exception_only(etype, value) - return list - -def format_exception_only(etype, value): - """Format the exception part of a traceback. - - The arguments are the exception type and value such as given by - sys.last_type and sys.last_value. The return value is a list of - strings, each ending in a newline. Normally, the list contains a - single string; however, for SyntaxError exceptions, it contains - several lines that (when printed) display detailed information - about where the syntax error occurred. The message indicating - which exception occurred is the always last string in the list. - """ - list = [] - if isinstance(etype, (type, types.ClassType)): - stype = etype.__name__ - else: - stype = etype - if value is None: - list.append(str(stype) + '\n') - else: - if etype is SyntaxError: - try: - msg, (filename, lineno, offset, line) = value - except: - pass - else: - if not filename: filename = "" - list.append(' File "%s", line %d\n' % - (filename, lineno)) - if line is not None: - i = 0 - while i < len(line) and line[i].isspace(): - i = i+1 - list.append(' %s\n' % line.strip()) - if offset is not None: - s = ' ' - for c in line[i:offset-1]: - if c.isspace(): - s = s + c - else: - s = s + ' ' - list.append('%s^\n' % s) - value = msg - s = _some_str(value) - if s: - list.append('%s: %s\n' % (str(stype), s)) - else: - list.append('%s\n' % str(stype)) - return list - -def _some_str(value): - try: - return str(value) - except: - return '' % type(value).__name__ - - -def print_exc(limit=None, file=None): - """Shorthand for 'print_exception(sys.exc_type, sys.exc_value, sys.exc_traceback, limit, file)'. - (In fact, it uses sys.exc_info() to retrieve the same information - in a thread-safe way.)""" - if file is None: - file = sys.stderr - try: - etype, value, tb = sys.exc_info() - print_exception(etype, value, tb, limit, file) - finally: - etype = value = tb = None - -def print_last(limit=None, file=None): - """This is a shorthand for 'print_exception(sys.last_type, - sys.last_value, sys.last_traceback, limit, file)'.""" - if file is None: - file = sys.stderr - print_exception(sys.last_type, sys.last_value, sys.last_traceback, - limit, file) - - -def print_stack(f=None, limit=None, file=None): - """Print a stack trace from its invocation point. - - The optional 'f' argument can be used to specify an alternate - stack frame at which to start. The optional 'limit' and 'file' - arguments have the same meaning as for print_exception(). - """ - if f is None: - try: - raise ZeroDivisionError - except ZeroDivisionError: - f = sys.exc_info()[2].tb_frame.f_back - print_list(extract_stack(f, limit), file) - -def format_stack(f=None, limit=None): - """Shorthand for 'format_list(extract_stack(f, limit))'.""" - if f is None: - try: - raise ZeroDivisionError - except ZeroDivisionError: - f = sys.exc_info()[2].tb_frame.f_back - return format_list(extract_stack(f, limit)) - -def extract_stack(f=None, limit = None): - """Extract the raw traceback from the current stack frame. - - The return value has the same format as for extract_tb(). The - optional 'f' and 'limit' arguments have the same meaning as for - print_stack(). Each item in the list is a quadruple (filename, - line number, function name, text), and the entries are in order - from oldest to newest stack frame. - """ - if f is None: - try: - raise ZeroDivisionError - except ZeroDivisionError: - f = sys.exc_info()[2].tb_frame.f_back - if limit is None: - if hasattr(sys, 'tracebacklimit'): - limit = sys.tracebacklimit - list = [] - n = 0 - while f is not None and (limit is None or n < limit): - lineno = f.f_lineno - co = f.f_code - filename = co.co_filename - name = co.co_name - line = linecache.getline(filename, lineno) - if line: line = line.strip() - else: line = None - list.append((filename, lineno, name, line)) - f = f.f_back - n = n+1 - list.reverse() - return list - -def tb_lineno(tb): - """Calculate correct line number of traceback given in tb. - - Obsolete in 2.3. - """ - return tb.tb_lineno Deleted: /pypy/dist/pypy/lib/types.py ============================================================================== --- /pypy/dist/pypy/lib/types.py Sun May 1 13:38:15 2005 +++ (empty file) @@ -1,120 +0,0 @@ -"""Appspace types module. - -!! This file has been copied practicaly verbatim from the CPython source. -!! See http://www.python.org/2.3.2/license.html for licensing info. - -Define names for all type symbols known in the standard interpreter. - -Types that are part of optional modules (e.g. array) are not listed. -""" -from __future__ import generators - -import sys - -# Iterators in Python aren't a matter of type but of protocol. A large -# and changing number of builtin types implement *some* flavor of -# iterator. Don't check the type! Use hasattr to check for both -# "__iter__" and "next" attributes instead. - -NoneType = type(None) -TypeType = type -ObjectType = object - -IntType = int -try: - LongType = long -except NameError: - pass -FloatType = float -try: - BooleanType = bool -except NameError: - pass -try: - ComplexType = complex -except NameError: - pass - -StringType = str -try: - UnicodeType = unicode - StringTypes = (StringType, UnicodeType) -except NameError: - StringTypes = (StringType,) - -try: - BufferType = buffer -except NameError: - pass - -TupleType = tuple -ListType = list -DictType = DictionaryType = dict - -def _f(): pass -FunctionType = type(_f) -LambdaType = type(lambda: None) # Same as FunctionType -try: - CodeType = type(_f.func_code) -except RuntimeError: - # Execution in restricted environment - pass - -def g(): - yield 1 -try: - GeneratorType = type(g()) -except: - # Refusing generators - pass -del g - -# checking whether we can make copy_reg happy -class _C: - def _m(self): pass - -ClassType = _classobj # from builtins -try: - UnboundMethodType = type(_C._m) # Same as MethodType -except AttributeError: - pass -_x = _C() -InstanceType = _instance # from builtins -MethodType = type(_x._m) - -BuiltinFunctionType = type(len) -BuiltinMethodType = type([].append) # Same as BuiltinFunctionType - -ModuleType = type(sys) -try: - FileType = file -except NameError: - pass -try: - XRangeType = type(xrange(0)) -except NameError: - pass - -try: - raise TypeError -except TypeError: - try: - tb = sys.exc_info()[2] - TracebackType = type(tb) - FrameType = type(tb.tb_frame) - except AttributeError: - # In the restricted environment, exc_info returns (None, None, - # None) Then, tb.tb_frame gives an attribute error - pass - tb = None; del tb - -SliceType = type(slice(0)) -EllipsisType = type(Ellipsis) - -DictProxyType = type(TypeType.__dict__) -try: - NotImplementedType = type(NotImplemented) -except NameError: - pass - -del sys, _f, _C, _x#, generators # Not for export Deleted: /pypy/dist/pypy/lib/warnings.py ============================================================================== --- /pypy/dist/pypy/lib/warnings.py Sun May 1 13:38:15 2005 +++ (empty file) @@ -1,253 +0,0 @@ -"""Python part of the warnings subsystem.""" - -# Note: function level imports should *not* be used -# in this module as it may cause import lock deadlock. -# See bug 683658. -import sys, types -import linecache - -__all__ = ["warn", "showwarning", "formatwarning", "filterwarnings", - "resetwarnings"] - -# filters contains a sequence of filter 5-tuples -# The components of the 5-tuple are: -# - an action: error, ignore, always, default, module, or once -# - a compiled regex that must match the warning message -# - a class representing the warning category -# - a compiled regex that must match the module that is being warned -# - a line number for the line being warning, or 0 to mean any line -# If either if the compiled regexs are None, match anything. -filters = [] -defaultaction = "default" -onceregistry = {} - -def warn(message, category=None, stacklevel=1): - """Issue a warning, or maybe ignore it or raise an exception.""" - # Check if message is already a Warning object - if isinstance(message, Warning): - category = message.__class__ - # Check category argument - if category is None: - category = UserWarning - assert issubclass(category, Warning) - # Get context information - try: - caller = sys._getframe(stacklevel) - except ValueError: - globals = sys.__dict__ - lineno = 1 - else: - globals = caller.f_globals - lineno = caller.f_lineno - if '__name__' in globals: - module = globals['__name__'] - else: - module = "" - filename = globals.get('__file__') - if filename: - fnl = filename.lower() - if fnl.endswith(".pyc") or fnl.endswith(".pyo"): - filename = filename[:-1] - else: - if module == "__main__": - filename = sys.argv[0] - if not filename: - filename = module - registry = globals.setdefault("__warningregistry__", {}) - warn_explicit(message, category, filename, lineno, module, registry) - -def warn_explicit(message, category, filename, lineno, - module=None, registry=None): - if module is None: - module = filename - if module[-3:].lower() == ".py": - module = module[:-3] # XXX What about leading pathname? - if registry is None: - registry = {} - if isinstance(message, Warning): - text = str(message) - category = message.__class__ - else: - text = message - message = category(message) - key = (text, category, lineno) - # Quick test for common case - if registry.get(key): - return - # Search the filters - for item in filters: - action, msg, cat, mod, ln = item - if ((msg is None or msg.match(text)) and - issubclass(category, cat) and - (msg is None or mod.match(module)) and - (ln == 0 or lineno == ln)): - break - else: - action = defaultaction - # Early exit actions - if action == "ignore": - registry[key] = 1 - return - if action == "error": - raise message - # Other actions - if action == "once": - registry[key] = 1 - oncekey = (text, category) - if onceregistry.get(oncekey): - return - onceregistry[oncekey] = 1 - elif action == "always": - pass - elif action == "module": - registry[key] = 1 - altkey = (text, category, 0) - if registry.get(altkey): - return - registry[altkey] = 1 - elif action == "default": - registry[key] = 1 - else: - # Unrecognized actions are errors - raise RuntimeError( - "Unrecognized action (%s) in warnings.filters:\n %s" % - (`action`, str(item))) - # Print message and context - showwarning(message, category, filename, lineno) - -def showwarning(message, category, filename, lineno, file=None): - """Hook to write a warning to a file; replace if you like.""" - if file is None: - file = sys.stderr - try: - file.write(formatwarning(message, category, filename, lineno)) - except IOError: - pass # the file (probably stderr) is invalid - this warning gets lost. - -def formatwarning(message, category, filename, lineno): - """Function to format a warning the standard way.""" - s = "%s:%s: %s: %s\n" % (filename, lineno, category.__name__, message) - line = linecache.getline(filename, lineno).strip() - if line: - s = s + " " + line + "\n" - return s - -def filterwarnings(action, message="", category=Warning, module="", lineno=0, - append=0): - """Insert an entry into the list of warnings filters (at the front). - - Use assertions to check that all arguments have the right type.""" - import re - assert action in ("error", "ignore", "always", "default", "module", - "once"), "invalid action: %s" % `action` - assert isinstance(message, basestring), "message must be a string" - #assert isinstance(category, types.ClassType), "category must be a class" - assert issubclass(category, Warning), "category must be a Warning subclass" - assert isinstance(module, basestring), "module must be a string" - assert isinstance(lineno, int) and lineno >= 0, \ - "lineno must be an int >= 0" - item = (action, re.compile(message, re.I), category, - re.compile(module), lineno) - if append: - filters.append(item) - else: - filters.insert(0, item) - -def simplefilter(action, category=Warning, lineno=0, append=0): - """Insert a simple entry into the list of warnings filters (at the front). - - A simple filter matches all modules and messages. - """ - assert action in ("error", "ignore", "always", "default", "module", - "once"), "invalid action: %s" % `action` - assert isinstance(lineno, int) and lineno >= 0, \ - "lineno must be an int >= 0" - item = (action, None, category, None, lineno) - if append: - filters.append(item) - else: - filters.insert(0, item) - -def resetwarnings(): - """Clear the list of warning filters, so that no filters are active.""" - filters[:] = [] - -class _OptionError(Exception): - """Exception used by option processing helpers.""" - pass - -# Helper to process -W options passed via sys.warnoptions -def _processoptions(args): - for arg in args: - try: - _setoption(arg) - except _OptionError, msg: - print >>sys.stderr, "Invalid -W option ignored:", msg - -# Helper for _processoptions() -def _setoption(arg): - import re - parts = arg.split(':') - if len(parts) > 5: - raise _OptionError("too many fields (max 5): %s" % `arg`) - while len(parts) < 5: - parts.append('') - action, message, category, module, lineno = [s.strip() - for s in parts] - action = _getaction(action) - message = re.escape(message) - category = _getcategory(category) - module = re.escape(module) - if module: - module = module + '$' - if lineno: - try: - lineno = int(lineno) - if lineno < 0: - raise ValueError - except (ValueError, OverflowError): - raise _OptionError("invalid lineno %s" % `lineno`) - else: - lineno = 0 - filterwarnings(action, message, category, module, lineno) - -# Helper for _setoption() -def _getaction(action): - if not action: - return "default" - if action == "all": return "always" # Alias - for a in ['default', 'always', 'ignore', 'module', 'once', 'error']: - if a.startswith(action): - return a - raise _OptionError("invalid action: %s" % `action`) - -# Helper for _setoption() -def _getcategory(category): - import re - if not category: - return Warning - if re.match("^[a-zA-Z0-9_]+$", category): - try: - cat = eval(category) - except NameError: - raise _OptionError("unknown warning category: %s" % `category`) - else: - i = category.rfind(".") - module = category[:i] - klass = category[i+1:] - try: - m = __import__(module, None, None, [klass]) - except ImportError: - raise _OptionError("invalid module name: %s" % `module`) - try: - cat = getattr(m, klass) - except AttributeError: - raise _OptionError("unknown warning category: %s" % `category`) - if not issubclass(cat, Warning): # or not isinstance(cat, types.ClassType) - raise _OptionError("invalid warning category: %s" % `category`) - return cat - -# Module initialization -_processoptions(sys.warnoptions) -simplefilter("ignore", category=OverflowWarning, append=1) -simplefilter("ignore", category=PendingDeprecationWarning, append=1) Modified: pypy/dist/pypy/module/sys2/state.py ============================================================================== --- pypy/dist/pypy/module/sys2/state.py (original) +++ pypy/dist/pypy/module/sys2/state.py Sun May 1 13:38:15 2005 @@ -57,11 +57,16 @@ from pypy.interpreter import autopath srcdir = os.path.dirname(autopath.pypydir) python_std_lib = os.path.normpath( - os.path.join(autopath.pypydir, os.pardir,'lib-python-2.3.4')) - pypy_override_lib = os.path.join(autopath.pypydir, 'lib') + os.path.join(autopath.pypydir, os.pardir,'lib-python', '2.3.4')) + python_std_lib_modified = os.path.normpath( + os.path.join(autopath.pypydir, os.pardir,'lib-python', 'modified-2.3.4')) + + pypy_lib = os.path.join(autopath.pypydir, 'lib') assert os.path.exists(python_std_lib) + assert os.path.exists(python_std_lib_modified) self.w_path = space.newlist([space.wrap(''), - space.wrap(pypy_override_lib), + space.wrap(pypy_lib), + space.wrap(python_std_lib_modified), space.wrap(python_std_lib), ] + [space.wrap(p) for p in sys.path if p!= srcdir]) From arigo at codespeak.net Sun May 1 14:03:09 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Sun, 1 May 2005 14:03:09 +0200 (CEST) Subject: [pypy-svn] r11685 - pypy/dist/lib-python/modified-2.3.4/test Message-ID: <20050501120309.ED1CA27BE8@code1.codespeak.net> Author: arigo Date: Sun May 1 14:03:09 2005 New Revision: 11685 Added: pypy/dist/lib-python/modified-2.3.4/test/test_descrtut.py - copied, changed from r11684, pypy/dist/lib-python/2.3.4/test/test_descrtut.py Log: An updated version of test_descrtut.py no longer depending on dict order or the exact details of dir(list). Copied: pypy/dist/lib-python/modified-2.3.4/test/test_descrtut.py (from r11684, pypy/dist/lib-python/2.3.4/test/test_descrtut.py) ============================================================================== --- pypy/dist/lib-python/2.3.4/test/test_descrtut.py (original) +++ pypy/dist/lib-python/modified-2.3.4/test/test_descrtut.py Sun May 1 14:03:09 2005 @@ -72,8 +72,8 @@ [1, 2] >>> exec "x = 3; print x" in a 3 - >>> print sorted(a.keys()) - [1, 2, '__builtins__', 'x'] + >>> print sorted([str(key) for key in a.keys()]) + ['1', '2', '__builtins__', 'x'] >>> print a['x'] 3 >>> @@ -184,48 +184,14 @@ Instead, you can get the same information from the list type: - >>> pprint.pprint(dir(list)) # like list.__dict__.keys(), but sorted - ['__add__', - '__class__', - '__contains__', - '__delattr__', - '__delitem__', - '__delslice__', - '__doc__', - '__eq__', - '__ge__', - '__getattribute__', - '__getitem__', - '__getslice__', - '__gt__', - '__hash__', - '__iadd__', - '__imul__', - '__init__', - '__iter__', - '__le__', - '__len__', - '__lt__', - '__mul__', - '__ne__', - '__new__', - '__reduce__', - '__reduce_ex__', - '__repr__', - '__rmul__', - '__setattr__', - '__setitem__', - '__setslice__', - '__str__', - 'append', - 'count', - 'extend', - 'index', - 'insert', - 'pop', - 'remove', - 'reverse', - 'sort'] + >>> 'append' in dir(list) # like list.__dict__.keys(), but sorted + True + >>> 'sort' in dir(list) + True + >>> 'pop' in dir(list) + True + >>> '__getitem__' in dir(list) + True The new introspection API gives more information than the old one: in addition to the regular methods, it also shows the methods that are From arigo at codespeak.net Sun May 1 15:04:46 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Sun, 1 May 2005 15:04:46 +0200 (CEST) Subject: [pypy-svn] r11696 - pypy/dist/pypy/lib/test2 Message-ID: <20050501130446.8974427C06@code1.codespeak.net> Author: arigo Date: Sun May 1 15:04:46 2005 New Revision: 11696 Added: pypy/dist/pypy/lib/test2/no_test_pickle_extra.py - copied, changed from r11684, pypy/dist/pypy/lib/test2/test_pickle_extra.py pypy/dist/pypy/lib/test2/support.py (contents, props changed) pypy/dist/pypy/lib/test2/test_binascii_extra.py - copied, changed from r11684, pypy/dist/pypy/lib/test2/FIXME_test_binascii_extra.py pypy/dist/pypy/lib/test2/test_string_extra.py - copied, changed from r11684, pypy/dist/pypy/lib/test2/no_test_stringmodule.py pypy/dist/pypy/lib/test2/test_struct_extra.py (contents, props changed) Removed: pypy/dist/pypy/lib/test2/FIXME_test_binascii_extra.py pypy/dist/pypy/lib/test2/no_test_stringmodule.py pypy/dist/pypy/lib/test2/test_iter_extra.py pypy/dist/pypy/lib/test2/test_pickle_extra.py Log: Partial clean up of lib/test2. Deleted: /pypy/dist/pypy/lib/test2/FIXME_test_binascii_extra.py ============================================================================== --- /pypy/dist/pypy/lib/test2/FIXME_test_binascii_extra.py Sun May 1 15:04:46 2005 +++ (empty file) @@ -1,21 +0,0 @@ - -import unittest -import binascii - -class TestBinAscii(unittest.TestCase): - def test_uu(self): - assert binascii.b2a_uu('1234567') == "',3(S-#4V-P \n" - assert binascii.b2a_uu('123456789012345678901234567890123456789012345') == 'M,3(S-#4V-S at Y,#$R,S0U-C\n2:<%s>' % (c_py_res, pypy_res)) - - - def test_maketrans(self): - self.regression('maketrans','','') - self.regression('maketrans','a','b') - self.regression('maketrans','aa','bb') - self.regression('maketrans','aa','') - - -if __name__ == "__main__": - testit.main() \ No newline at end of file Added: pypy/dist/pypy/lib/test2/support.py ============================================================================== --- (empty file) +++ pypy/dist/pypy/lib/test2/support.py Sun May 1 15:04:46 2005 @@ -0,0 +1,34 @@ +import sys, os, new + +this_dir = os.path.normpath(os.path.dirname(os.path.abspath(__file__))) +lib_dir = os.path.dirname(this_dir) +pypy_dir = os.path.dirname(lib_dir) +dist_dir = os.path.dirname(pypy_dir) + +if dist_dir not in sys.path: + sys.path.insert(0, dist_dir) + +def cleanup_path(): + # the 'pypy/lib' directory should always be last in CPython's sys.path, + # after the standard library! + sys.path[:] = [p for p in sys.path + if os.path.normpath(os.path.abspath(p)) != lib_dir] + sys.path.append(lib_dir) + +cleanup_path() + + +def libmodule(modname): + """Get a module from the pypy/lib directory, without going through the + import machinery. + """ + # forces the real CPython module to be imported first, to avoid strange + # interactions later + cleanup_path() + cpython_mod = __import__(modname) + assert os.path.dirname(cpython_mod.__file__) != lib_dir + filename = os.path.join(lib_dir, modname + '.py') + mod = new.module(modname) + mod.__file__ = filename + execfile(filename, mod.__dict__) + return mod Copied: pypy/dist/pypy/lib/test2/test_binascii_extra.py (from r11684, pypy/dist/pypy/lib/test2/FIXME_test_binascii_extra.py) ============================================================================== --- pypy/dist/pypy/lib/test2/FIXME_test_binascii_extra.py (original) +++ pypy/dist/pypy/lib/test2/test_binascii_extra.py Sun May 1 15:04:46 2005 @@ -1,21 +1,20 @@ +import support +binascii = support.libmodule('binascii') -import unittest -import binascii -class TestBinAscii(unittest.TestCase): - def test_uu(self): - assert binascii.b2a_uu('1234567') == "',3(S-#4V-P \n" - assert binascii.b2a_uu('123456789012345678901234567890123456789012345') == 'M,3(S-#4V-S at Y,#$R,S0U-C\n2:<%s>' % (c_py_res, pypy_res)) - - - def test_maketrans(self): - self.regression('maketrans','','') - self.regression('maketrans','a','b') - self.regression('maketrans','aa','bb') - self.regression('maketrans','aa','') - - -if __name__ == "__main__": - testit.main() \ No newline at end of file +def app_test_maketrans(): + import string + assert string.maketrans('', '') == ( + '\x00\x01\x02\x03\x04\x05\x06\x07\x08\t\n\x0b\x0c\r\x0e\x0f\x10\x11\x12' + '\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f !"#$%&\'()*+,-./0' + '123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstu' + 'vwxyz{|}~\x7f\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d' + '\x8e\x8f\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e' + '\x9f\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7\xa8\xa9\xaa\xab\xac\xad\xae\xaf' + '\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf\xc0' + '\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf\xd0\xd1' + '\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf\xe0\xe1\xe2' + '\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef\xf0\xf1\xf2\xf3' + '\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff') + assert string.maketrans('a', 'b') == ( + '\x00\x01\x02\x03\x04\x05\x06\x07\x08\t\n\x0b\x0c\r\x0e\x0f\x10\x11\x12' + '\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f !"#$%&\'()*+,-./0' + '123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`bbcdefghijklmnopqrstu' + 'vwxyz{|}~\x7f\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d' + '\x8e\x8f\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e' + '\x9f\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7\xa8\xa9\xaa\xab\xac\xad\xae\xaf' + '\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf\xc0' + '\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf\xd0\xd1' + '\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf\xe0\xe1\xe2' + '\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef\xf0\xf1\xf2\xf3' + '\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff') + assert string.maketrans('ab', 'cd') == ( + '\x00\x01\x02\x03\x04\x05\x06\x07\x08\t\n\x0b\x0c\r\x0e\x0f\x10\x11\x12' + '\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f !"#$%&\'()*+,-./0' + '123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`cdcdefghijklmnopqrstu' + 'vwxyz{|}~\x7f\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d' + '\x8e\x8f\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e' + '\x9f\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7\xa8\xa9\xaa\xab\xac\xad\xae\xaf' + '\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf\xc0' + '\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf\xd0\xd1' + '\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf\xe0\xe1\xe2' + '\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef\xf0\xf1\xf2\xf3' + '\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff') + raises(ValueError, string.maketrans, 'aa', '') Added: pypy/dist/pypy/lib/test2/test_struct_extra.py ============================================================================== --- (empty file) +++ pypy/dist/pypy/lib/test2/test_struct_extra.py Sun May 1 15:04:46 2005 @@ -0,0 +1,9 @@ +import support +struct = support.libmodule('struct') + + +def test_simple(): + morezeros = '\x00' * (struct.calcsize('l')-4) + assert struct.pack(' Author: arigo Date: Sun May 1 15:10:00 2005 New Revision: 11698 Modified: pypy/dist/pypy/lib/struct.py pypy/dist/pypy/lib/test2/test_struct_extra.py Log: Bug fix in struct.py, with a corresponding test. It used 'args.pop()' thinking it was removing the 1st element of the list... Modified: pypy/dist/pypy/lib/struct.py ============================================================================== --- pypy/dist/pypy/lib/struct.py (original) +++ pypy/dist/pypy/lib/struct.py Sun May 1 15:10:00 2005 @@ -105,14 +105,14 @@ return ''.join(res) def pack_signed_int(number,size,le): - if type(number) not in [int,long]: + if not isinstance(number, (int,long)): raise StructError,"argument for i,I,l,L,q,Q,h,H must be integer" if number > 2**(8*size-1)-1 or number < -1*2**(8*size-1): raise OverflowError,"Number:%i to large to convert" % number return pack_int(number,size,le) def pack_unsigned_int(number,size,le): - if type(number) not in [int,long]: + if not isinstance(number, (int,long)): raise StructError,"argument for i,I,l,L,q,Q,h,H must be integer" if number < 0: raise TypeError,"can't convert negative long to unsigned" @@ -241,7 +241,7 @@ def pack(fmt,*args): """pack(fmt, v1, v2, ...) -> string Return string containing values v1, v2, ... packed according to fmt. - See struct.__doc__ for more on format strings.""" + See struct.__doc__ for more on format strings.""" formatdef,endianness,i = getmode(fmt) args = list(args) n_args = len(args) @@ -262,17 +262,14 @@ if cur == 'x': result += ['\0'*num] elif cur == 's': - if type(args[0]) == str: + if isinstance(args[0], str): padding = num - len(args[0]) - if padding >=0: - result += [args[0][:num] + '\0'*padding] - else: - result += [args[0][:num]] - args.pop() + result += [args[0][:num] + '\0'*padding] + args.pop(0) else: raise StructError,"arg for string format not a string" elif cur == 'p': - if type(args[0]) == str: + if isinstance(args[0], str): padding = num - len(args[0]) - 1 if padding > 0: @@ -282,7 +279,7 @@ result += [chr(num-1) + args[0][:num-1]] else: result += [chr(255) + args[0][:num-1]] - args.pop() + args.pop(0) else: raise StructError,"arg for string format not a string" Modified: pypy/dist/pypy/lib/test2/test_struct_extra.py ============================================================================== --- pypy/dist/pypy/lib/test2/test_struct_extra.py (original) +++ pypy/dist/pypy/lib/test2/test_struct_extra.py Sun May 1 15:10:00 2005 @@ -6,4 +6,4 @@ morezeros = '\x00' * (struct.calcsize('l')-4) assert struct.pack(' Author: arigo Date: Sun May 1 16:41:37 2005 New Revision: 11701 Added: pypy/dist/lib-python/modified-2.3.4/test/test_tempfile.py - copied, changed from r11698, pypy/dist/lib-python/2.3.4/test/test_tempfile.py Log: Found out why this test fails. Copied: pypy/dist/lib-python/modified-2.3.4/test/test_tempfile.py (from r11698, pypy/dist/lib-python/2.3.4/test/test_tempfile.py) ============================================================================== --- pypy/dist/lib-python/2.3.4/test/test_tempfile.py (original) +++ pypy/dist/lib-python/modified-2.3.4/test/test_tempfile.py Sun May 1 16:41:37 2005 @@ -1,3 +1,8 @@ +# +# XXX THIS FAILS BECAUSE IT SETS OS.UNLINK AS A CLASS ATTRIBUTE +# GRUMBLE GRUMBLE GRUMBLE. SEE ALSO THE SAME IN TEMPFILE.PY ITSELF. +# + # tempfile.py unit tests. import tempfile From pedronis at codespeak.net Sun May 1 17:01:06 2005 From: pedronis at codespeak.net (pedronis at codespeak.net) Date: Sun, 1 May 2005 17:01:06 +0200 (CEST) Subject: [pypy-svn] r11703 - pypy/dist/lib-python Message-ID: <20050501150106.CE13F27C19@code1.codespeak.net> Author: pedronis Date: Sun May 1 17:01:06 2005 New Revision: 11703 Modified: pypy/dist/lib-python/conftest.py Log: added core= flag to test declarations Modified: pypy/dist/lib-python/conftest.py ============================================================================== --- pypy/dist/lib-python/conftest.py (original) +++ pypy/dist/lib-python/conftest.py Sun May 1 17:01:06 2005 @@ -270,11 +270,12 @@ class RegrTest: """ Regression Test Declaration.""" - def __init__(self, basename, enabled=False, dumbtest=False, oldstyle=False): + def __init__(self, basename, enabled=False, dumbtest=False, oldstyle=False, core=False): self.basename = basename self.enabled = enabled self.dumbtest = dumbtest self.oldstyle = oldstyle + self.core = core def ismodified(self): return modtestdir.join(self.basename).check() @@ -303,18 +304,20 @@ space.enable_new_style_classes_as_default_metaclass() testmap = [ - RegrTest('test___all__.py', enabled=False), - RegrTest('test___future__.py', enabled=True, dumbtest=1), + RegrTest('test___all__.py', enabled=False, core=True), + # fixable + RegrTest('test___future__.py', enabled=True, dumbtest=1, core=True), RegrTest('test_aepack.py', enabled=False), RegrTest('test_al.py', enabled=False, dumbtest=1), - RegrTest('test_anydbm.py', enabled=True), + RegrTest('test_anydbm.py', enabled=True, core=True), RegrTest('test_array.py', enabled=False), - #rev 10840: Uncaught interp-level exception: Same place as test_cfgparser + # c-extension + #rev 10840: Uncaught interp-level exception: Same place as test_cfgparser RegrTest('test_asynchat.py', enabled=False), - RegrTest('test_atexit.py', enabled=False, dumbtest=1), + RegrTest('test_atexit.py', enabled=False, dumbtest=1, core=True), RegrTest('test_audioop.py', enabled=False, dumbtest=1), - RegrTest('test_augassign.py', enabled=True), + RegrTest('test_augassign.py', enabled=True, core=True), RegrTest('test_base64.py', enabled=True), RegrTest('test_bastion.py', enabled=True, dumbtest=1), RegrTest('test_binascii.py', enabled=False), @@ -323,182 +326,178 @@ RegrTest('test_binhex.py', enabled=False), #rev 10840: 1 of 1 test fails - RegrTest('test_binop.py', enabled=True), - RegrTest('test_bisect.py', enabled=True), - RegrTest('test_bool.py', enabled=True), - #rev 10840: Infinite recursion in DescrOperation.is_true - + RegrTest('test_binop.py', enabled=True, core=True), + RegrTest('test_bisect.py', enabled=True, core=True), + RegrTest('test_bool.py', enabled=True, core=True), RegrTest('test_bsddb.py', enabled=False), RegrTest('test_bsddb185.py', enabled=False), RegrTest('test_bsddb3.py', enabled=False), - RegrTest('test_bufio.py', enabled=False, dumbtest=1), - RegrTest('test_builtin.py', enabled=True), + RegrTest('test_bufio.py', enabled=False, dumbtest=1, core=True), + RegrTest('test_builtin.py', enabled=True, core=True), RegrTest('test_bz2.py', enabled=False), - RegrTest('test_calendar.py', enabled=True), - RegrTest('test_call.py', enabled=True), + RegrTest('test_calendar.py', enabled=True, core=True), + RegrTest('test_call.py', enabled=True, core=True), RegrTest('test_capi.py', enabled=False, dumbtest=1), RegrTest('test_cd.py', enabled=False, dumbtest=1), - RegrTest('test_cfgparser.py', enabled=False), + RegrTest('test_cfgparser.py', enabled=False, core=True), #rev 10840: Uncaught interp-level exception: #File "pypy/objspace/std/fake.py", line 133, in setfastscope #raise UnwrapError('calling %s: %s' % (self.code.cpy_callable, e)) #pypy.objspace.std.model.UnwrapError: calling : cannot unwrap > - RegrTest('test_cgi.py', enabled=True), + RegrTest('test_cgi.py', enabled=True, , core=True), RegrTest('test_charmapcodec.py', enabled=True), RegrTest('test_cl.py', enabled=False, dumbtest=1), - RegrTest('test_class.py', enabled=False, oldstyle=True), - RegrTest('test_cmath.py', enabled=True, dumbtest=1), + RegrTest('test_class.py', enabled=False, oldstyle=True, core=True), + RegrTest('test_cmath.py', enabled=True, dumbtest=1, core=True), RegrTest('test_codeccallbacks.py', enabled=False), #rev 10840: Uncaught interp-level exception: Same place as test_cfgparser RegrTest('test_codecs.py', enabled=False), #rev 10840: Uncaught interp-level exception: Same place as test_cfgparser - RegrTest('test_codeop.py', enabled=True), - RegrTest('test_coercion.py', enabled=False, oldstyle=True), + RegrTest('test_codeop.py', enabled=True, core=True), + RegrTest('test_coercion.py', enabled=False, oldstyle=True, core=True), # needed changes because our exceptions are new-style and so have a different str(.) behavior RegrTest('test_commands.py', enabled=True), - RegrTest('test_compare.py', enabled=True, oldstyle=True), - RegrTest('test_compile.py', enabled=True), - RegrTest('test_complex.py', enabled=False), + RegrTest('test_compare.py', enabled=True, oldstyle=True, core=True), + RegrTest('test_compile.py', enabled=True, core=True), + RegrTest('test_complex.py', enabled=False, core=True), #rev 10840: at least one test fails, after several hours I gave up waiting for the rest - RegrTest('test_contains.py', enabled=True, dumbtest=1), - RegrTest('test_cookie.py', enabled=False), - RegrTest('test_copy.py', enabled=True), - RegrTest('test_copy_reg.py', enabled=True), - RegrTest('test_cpickle.py', enabled=False), + RegrTest('test_contains.py', enabled=True, dumbtest=1, core=True), + RegrTest('test_cookie.py', enabled=False, core=True), + RegrTest('test_copy.py', enabled=True, core=True), + RegrTest('test_copy_reg.py', enabled=True, core=True), + RegrTest('test_cpickle.py', enabled=False, core=True), RegrTest('test_crypt.py', enabled=False, dumbtest=1), RegrTest('test_csv.py', enabled=False), #rev 10840: ImportError: _csv RegrTest('test_curses.py', enabled=False, dumbtest=1), - RegrTest('test_datetime.py', enabled=True), + RegrTest('test_datetime.py', enabled=True, core=True), RegrTest('test_dbm.py', enabled=False, dumbtest=1), - RegrTest('test_descr.py', enabled=False), - RegrTest('test_descrtut.py', enabled=False), + RegrTest('test_descr.py', enabled=False, core=True), + RegrTest('test_descrtut.py', enabled=False, core=True), #rev 10840: 19 of 96 tests fail - RegrTest('test_difflib.py', enabled=True, dumbtest=1), - RegrTest('test_dircache.py', enabled=True), + RegrTest('test_difflib.py', enabled=True, dumbtest=1, core=True), + RegrTest('test_dircache.py', enabled=True, core=True), RegrTest('test_dis.py', enabled=True), RegrTest('test_dl.py', enabled=False, dumbtest=1), - RegrTest('test_doctest.py', enabled=True), - RegrTest('test_doctest2.py', enabled=True), - RegrTest('test_dumbdbm.py', enabled=True), - #rev 10840: 5 of 7 tests fail - - RegrTest('test_dummy_thread.py', enabled=True), - RegrTest('test_dummy_threading.py', enabled=True, dumbtest=1), + RegrTest('test_doctest.py', enabled=True, core=True), + RegrTest('test_doctest2.py', enabled=True, core=True), + RegrTest('test_dumbdbm.py', enabled=True, core=True), + RegrTest('test_dummy_thread.py', enabled=True, core=True), + RegrTest('test_dummy_threading.py', enabled=True, dumbtest=1, core=True), RegrTest('test_email.py', enabled=False), #rev 10840: Uncaught interp-level exception RegrTest('test_email_codecs.py', enabled=False, dumbtest=1), - RegrTest('test_enumerate.py', enabled=True), - RegrTest('test_eof.py', enabled=False), + RegrTest('test_enumerate.py', enabled=True, core=True), + RegrTest('test_eof.py', enabled=False, core=True), #rev 10840: some error strings differ slightly XXX RegrTest('test_errno.py', enabled=True, dumbtest=1), - RegrTest('test_exceptions.py', enabled=False), - RegrTest('test_extcall.py', enabled=False), + RegrTest('test_exceptions.py', enabled=False, core=True), + RegrTest('test_extcall.py', enabled=False, core=True), RegrTest('test_fcntl.py', enabled=False, dumbtest=1), - RegrTest('test_file.py', enabled=False, dumbtest=1), - RegrTest('test_filecmp.py', enabled=True), - RegrTest('test_fileinput.py', enabled=True, dumbtest=1), - RegrTest('test_fnmatch.py', enabled=True), + RegrTest('test_file.py', enabled=False, dumbtest=1, core=True), + RegrTest('test_filecmp.py', enabled=True, core=True), + RegrTest('test_fileinput.py', enabled=True, dumbtest=1, core=True), + RegrTest('test_fnmatch.py', enabled=True, core=True), RegrTest('test_fork1.py', enabled=False, dumbtest=1), - RegrTest('test_format.py', enabled=False, dumbtest=1), - RegrTest('test_fpformat.py', enabled=True), + RegrTest('test_format.py', enabled=False, dumbtest=1, core=True), + RegrTest('test_fpformat.py', enabled=True, core=True), RegrTest('test_frozen.py', enabled=False), - RegrTest('test_funcattrs.py', enabled=True, dumbtest=1), - RegrTest('test_future.py', enabled=True), - RegrTest('test_future1.py', enabled=True, dumbtest=1), - RegrTest('test_future2.py', enabled=True, dumbtest=1), - RegrTest('test_future3.py', enabled=True), + RegrTest('test_funcattrs.py', enabled=True, dumbtest=1, core=True), + RegrTest('test_future.py', enabled=True, core=True), + RegrTest('test_future1.py', enabled=True, dumbtest=1, core=True), + RegrTest('test_future2.py', enabled=True, dumbtest=1, core=True), + RegrTest('test_future3.py', enabled=True, core=True), RegrTest('test_gc.py', enabled=False, dumbtest=1), RegrTest('test_gdbm.py', enabled=False, dumbtest=1), - RegrTest('test_generators.py', enabled=False), + RegrTest('test_generators.py', enabled=False, core=True), #rev 10840: 30 of 152 tests fail RegrTest('test_getargs.py', enabled=False, dumbtest=1), RegrTest('test_getargs2.py', enabled=False), #rev 10840: ImportError: _testcapi - RegrTest('test_getopt.py', enabled=True, dumbtest=1), + RegrTest('test_getopt.py', enabled=True, dumbtest=1, core=True), RegrTest('test_gettext.py', enabled=False), #rev 10840: 28 of 28 tests fail RegrTest('test_gl.py', enabled=False, dumbtest=1), - RegrTest('test_glob.py', enabled=True), - RegrTest('test_global.py', enabled=False), - RegrTest('test_grammar.py', enabled=False), + RegrTest('test_glob.py', enabled=True, core=True), + RegrTest('test_global.py', enabled=False, core=True), + RegrTest('test_grammar.py', enabled=False, core=True), RegrTest('test_grp.py', enabled=False), #rev 10840: ImportError: grp RegrTest('test_gzip.py', enabled=False, dumbtest=1), - RegrTest('test_hash.py', enabled=True), - RegrTest('test_heapq.py', enabled=True), - RegrTest('test_hexoct.py', enabled=True), - RegrTest('test_hmac.py', enabled=True), + RegrTest('test_hash.py', enabled=True, core=True), + RegrTest('test_heapq.py', enabled=True, core=True), + RegrTest('test_hexoct.py', enabled=True, core=True), + RegrTest('test_hmac.py', enabled=True, core=True), RegrTest('test_hotshot.py', enabled=False), #rev 10840: ImportError: _hotshot - RegrTest('test_htmllib.py', enabled=True), - RegrTest('test_htmlparser.py', enabled=True), - RegrTest('test_httplib.py', enabled=True), + RegrTest('test_htmllib.py', enabled=True, core=True), + RegrTest('test_htmlparser.py', enabled=True, core=True), + RegrTest('test_httplib.py', enabled=True, core=True), RegrTest('test_imageop.py', enabled=False, dumbtest=1), - RegrTest('test_imaplib.py', enabled=True, dumbtest=1), + RegrTest('test_imaplib.py', enabled=True, dumbtest=1, core=True), RegrTest('test_imgfile.py', enabled=False, dumbtest=1), - RegrTest('test_imp.py', enabled=False), - RegrTest('test_import.py', enabled=False, dumbtest=1), - RegrTest('test_importhooks.py', enabled=False), - RegrTest('test_inspect.py', enabled=False, dumbtest=1), + RegrTest('test_imp.py', enabled=False, , core="maybe"), + RegrTest('test_import.py', enabled=False, dumbtest=1, core="possibly"), + RegrTest('test_importhooks.py', enabled=False, core="possibly"), + RegrTest('test_inspect.py', enabled=False, dumbtest=1, core="maybe"), RegrTest('test_ioctl.py', enabled=False), - RegrTest('test_isinstance.py', enabled=True), - RegrTest('test_iter.py', enabled=False), + RegrTest('test_isinstance.py', enabled=True, core=True), + RegrTest('test_iter.py', enabled=False, core=True), #rev 10840: Uncaught interp-level exception: Same place as test_cfgparser - RegrTest('test_itertools.py', enabled=True), + RegrTest('test_itertools.py', enabled=True, core=True), # modified version in pypy/lib/test2 RegrTest('test_largefile.py', enabled=True, dumbtest=1), RegrTest('test_linuxaudiodev.py', enabled=False), RegrTest('test_locale.py', enabled=False, dumbtest=1), RegrTest('test_logging.py', enabled=False), - RegrTest('test_long.py', enabled=True, dumbtest=1), - RegrTest('test_long_future.py', enabled=False, dumbtest=1), - RegrTest('test_longexp.py', enabled=True), + RegrTest('test_long.py', enabled=True, dumbtest=1, core=True), + RegrTest('test_long_future.py', enabled=False, dumbtest=1, core=True), + RegrTest('test_longexp.py', enabled=True, core=True), RegrTest('test_macfs.py', enabled=False), RegrTest('test_macostools.py', enabled=False), RegrTest('test_macpath.py', enabled=True), RegrTest('test_mailbox.py', enabled=True), - RegrTest('test_marshal.py', enabled=True, dumbtest=1), - RegrTest('test_math.py', enabled=False), + RegrTest('test_marshal.py', enabled=True, dumbtest=1, core=True), + RegrTest('test_math.py', enabled=False, core=True), RegrTest('test_md5.py', enabled=False), RegrTest('test_mhlib.py', enabled=True), - RegrTest('test_mimetools.py', enabled=True), - RegrTest('test_mimetypes.py', enabled=True), - RegrTest('test_MimeWriter.py', enabled=True), + RegrTest('test_mimetools.py', enabled=True, core=True), + RegrTest('test_mimetypes.py', enabled=True, core=True), + RegrTest('test_MimeWriter.py', enabled=True, core=True), RegrTest('test_minidom.py', enabled=False, dumbtest=1), RegrTest('test_mmap.py', enabled=False), - RegrTest('test_module.py', enabled=False, dumbtest=1), + RegrTest('test_module.py', enabled=False, dumbtest=1, core=True), RegrTest('test_mpz.py', enabled=False, dumbtest=1), - RegrTest('test_multifile.py', enabled=True), - RegrTest('test_mutants.py', enabled=False, dumbtest=1), - RegrTest('test_netrc.py', enabled=True), - RegrTest('test_new.py', enabled=False), + RegrTest('test_multifile.py', enabled=True, core=True), + RegrTest('test_mutants.py', enabled=False, dumbtest=1, core="possibly"), + RegrTest('test_netrc.py', enabled=True, core=True), + RegrTest('test_new.py', enabled=False, core=True), RegrTest('test_nis.py', enabled=False), RegrTest('test_normalization.py', enabled=False), RegrTest('test_ntpath.py', enabled=True, dumbtest=1), - RegrTest('test_opcodes.py', enabled=True), + RegrTest('test_opcodes.py', enabled=True, core=True), RegrTest('test_openpty.py', enabled=False), - RegrTest('test_operations.py', enabled=False), - RegrTest('test_operator.py', enabled=True), - RegrTest('test_optparse.py', enabled=False), - RegrTest('test_os.py', enabled=True), + RegrTest('test_operations.py', enabled=False, core=True), + RegrTest('test_operator.py', enabled=True, core=True), + RegrTest('test_optparse.py', enabled=False, core="maybe"), + RegrTest('test_os.py', enabled=True, core=True), RegrTest('test_ossaudiodev.py', enabled=False), - RegrTest('test_parser.py', enabled=True), + RegrTest('test_parser.py', enabled=False), #rev 10840: 18 of 18 tests fail RegrTest('test_pep247.py', enabled=False, dumbtest=1), @@ -507,25 +506,25 @@ # XXX this test is _also_ an output test, damn it # seems to be the only one that invokes run_unittest # and is an unittest - RegrTest('test_pickle.py', enabled=False), - RegrTest('test_pickletools.py', enabled=False, dumbtest=1), - RegrTest('test_pkg.py', enabled=False), - RegrTest('test_pkgimport.py', enabled=True), + RegrTest('test_pickle.py', enabled=False, core=True), + RegrTest('test_pickletools.py', enabled=False, dumbtest=1, core=True), + RegrTest('test_pkg.py', enabled=False, core=True), + RegrTest('test_pkgimport.py', enabled=True, core=True), RegrTest('test_plistlib.py', enabled=False), RegrTest('test_poll.py', enabled=False), RegrTest('test_popen.py', enabled=True), RegrTest('test_popen2.py', enabled=True), RegrTest('test_posix.py', enabled=True), RegrTest('test_posixpath.py', enabled=True), - RegrTest('test_pow.py', enabled=True), - RegrTest('test_pprint.py', enabled=True), - RegrTest('test_profile.py', enabled=True), - RegrTest('test_profilehooks.py', enabled=True), + RegrTest('test_pow.py', enabled=True, core=True), + RegrTest('test_pprint.py', enabled=True, core=True), + RegrTest('test_profile.py', enabled=True, core="maybe"), + RegrTest('test_profilehooks.py', enabled=True, core=True), RegrTest('test_pty.py', enabled=False), RegrTest('test_pwd.py', enabled=False), #rev 10840: ImportError: pwd - RegrTest('test_pyclbr.py', enabled=False), + RegrTest('test_pyclbr.py', enabled=False, core="maybe"), RegrTest('test_pyexpat.py', enabled=False), RegrTest('test_queue.py', enabled=False, dumbtest=1), RegrTest('test_quopri.py', enabled=True), @@ -540,31 +539,31 @@ #rev 10840: 7 of 47 tests fail RegrTest('test_regex.py', enabled=False), - RegrTest('test_repr.py', enabled=False), + RegrTest('test_repr.py', enabled=False, core="ill-defined"), #rev 10840: 6 of 12 tests fail. Always minor stuff like #'' != '' RegrTest('test_resource.py', enabled=False), - RegrTest('test_rfc822.py', enabled=True), + RegrTest('test_rfc822.py', enabled=True, core=True), RegrTest('test_rgbimg.py', enabled=False), - RegrTest('test_richcmp.py', enabled=False), + RegrTest('test_richcmp.py', enabled=False, core=True), #rev 10840: 1 of 11 test fails. The failing one had an infinite recursion. - RegrTest('test_robotparser.py', enabled=True), + RegrTest('test_robotparser.py', enabled=True, core=True), RegrTest('test_rotor.py', enabled=False), RegrTest('test_sax.py', enabled=False, dumbtest=1), - RegrTest('test_scope.py', enabled=True), + RegrTest('test_scope.py', enabled=True, core=True), RegrTest('test_scriptpackages.py', enabled=False), RegrTest('test_select.py', enabled=False, dumbtest=1), - RegrTest('test_sets.py', enabled=True), - RegrTest('test_sgmllib.py', enabled=True), + RegrTest('test_sets.py', enabled=True, core=True), + RegrTest('test_sgmllib.py', enabled=True, core=True), RegrTest('test_sha.py', enabled=True), # one test is taken out (too_slow_test_case_3), rest passses - RegrTest('test_shelve.py', enabled=True), - RegrTest('test_shlex.py', enabled=True), - RegrTest('test_shutil.py', enabled=True), + RegrTest('test_shelve.py', enabled=True, core=True), + RegrTest('test_shlex.py', enabled=True, core=True), + RegrTest('test_shutil.py', enabled=True, core=True), RegrTest('test_signal.py', enabled=False), - RegrTest('test_slice.py', enabled=True, dumbtest=1), + RegrTest('test_slice.py', enabled=True, dumbtest=1, core=True), RegrTest('test_socket.py', enabled=False), #rev 10840: ImportError: thread @@ -572,14 +571,14 @@ RegrTest('test_socketserver.py', enabled=False), #rev 10840: ImportError: thread - RegrTest('test_softspace.py', enabled=True, dumbtest=1), - RegrTest('test_sort.py', enabled=False, dumbtest=1), - RegrTest('test_str.py', enabled=False), + RegrTest('test_softspace.py', enabled=True, dumbtest=1, core=True), + RegrTest('test_sort.py', enabled=False, dumbtest=1, core=True), + RegrTest('test_str.py', enabled=False, core=True), #rev 10840: at least two tests fail, after several hours I gave up waiting for the rest RegrTest('test_strftime.py', enabled=False, dumbtest=1), - RegrTest('test_string.py', enabled=True), - RegrTest('test_StringIO.py', enabled=True), + RegrTest('test_string.py', enabled=True, core=True), + RegrTest('test_StringIO.py', enabled=True, core=True), RegrTest('test_stringprep.py', enabled=True, dumbtest=1), RegrTest('test_strop.py', enabled=False), #rev 10840: ImportError: strop @@ -593,15 +592,16 @@ RegrTest('test_sundry.py', enabled=False, dumbtest=1), # test_support is not a test RegrTest('test_symtable.py', enabled=False, dumbtest=1), - RegrTest('test_syntax.py', enabled=True), - RegrTest('test_sys.py', enabled=True), - RegrTest('test_tarfile.py', enabled=False), + RegrTest('test_syntax.py', enabled=True, core=True), + RegrTest('test_sys.py', enabled=True, core=True), + RegrTest('test_tarfile.py', enabled=False, core="possibly"), #rev 10840: 13 of 13 test fail - RegrTest('test_tempfile.py', enabled=False), + RegrTest('test_tempfile.py', enabled=False, core=True) + # tempfile does: class ... unlink = _os.unlink!!! #rev 10840: Uncaught interp-level exception: Same place as test_cfgparser - RegrTest('test_textwrap.py', enabled=True), + RegrTest('test_textwrap.py', enabled=True, core=True), RegrTest('test_thread.py', enabled=False), RegrTest('test_threaded_import.py', enabled=False), RegrTest('test_threadedtempfile.py', enabled=False), @@ -610,44 +610,45 @@ RegrTest('test_threading.py', enabled=False, dumbtest=1), #rev 10840: ImportError: thread - RegrTest('test_time.py', enabled=True), + RegrTest('test_time.py', enabled=True, core=True), RegrTest('test_timeout.py', enabled=False), #rev 10840: Uncaught interp-level exception: Same place as test_cfgparser RegrTest('test_timing.py', enabled=False, dumbtest=1), - RegrTest('test_tokenize.py', enabled=False), - RegrTest('test_trace.py', enabled=True), - RegrTest('test_traceback.py', enabled=False), + RegrTest('test_tokenize.py', enabled=False, core=True), + RegrTest('test_trace.py', enabled=True, core=True), + RegrTest('test_traceback.py', enabled=False, core=True), #rev 10840: 2 of 2 tests fail - RegrTest('test_types.py', enabled=True), + RegrTest('test_types.py', enabled=True, core=True), #rev 11598: one of the mod related to dict iterators is questionable # and questions whether how we implement them is meaningful in the # long run RegrTest('test_ucn.py', enabled=False), - RegrTest('test_unary.py', enabled=True), + RegrTest('test_unary.py', enabled=True, core=True), RegrTest('test_unicode.py', enabled=False), RegrTest('test_unicode_file.py', enabled=False), RegrTest('test_unicodedata.py', enabled=False), - RegrTest('test_univnewlines.py', enabled=True), - RegrTest('test_unpack.py', enabled=True, dumbtest=1), - RegrTest('test_urllib.py', enabled=True), - RegrTest('test_urllib2.py', enabled=True, dumbtest=1), + RegrTest('test_univnewlines.py', enabled=True, core=True), + RegrTest('test_unpack.py', enabled=True, dumbtest=1, core=True), + RegrTest('test_urllib.py', enabled=True, core=True), + RegrTest('test_urllib2.py', enabled=True, dumbtest=1, core=True), RegrTest('test_urllibnet.py', enabled=False), - RegrTest('test_urlparse.py', enabled=True), - RegrTest('test_userdict.py', enabled=True), - RegrTest('test_userlist.py', enabled=True), - RegrTest('test_userstring.py', enabled=False), + # try to understand failure!!! + RegrTest('test_urlparse.py', enabled=True, core=True), + RegrTest('test_userdict.py', enabled=True, core=True), + RegrTest('test_userlist.py', enabled=True, core=True), + RegrTest('test_userstring.py', enabled=False, core=True), RegrTest('test_uu.py', enabled=False), #rev 10840: 1 of 9 test fails - RegrTest('test_warnings.py', enabled=True), + RegrTest('test_warnings.py', enabled=True, core=True), RegrTest('test_wave.py', enabled=False, dumbtest=1), RegrTest('test_weakref.py', enabled=False), #rev 10840: ImportError: _weakref - RegrTest('test_whichdb.py', enabled=True), + RegrTest('test_whichdb.py', enabled=True, core=True), RegrTest('test_winreg.py', enabled=False), RegrTest('test_winsound.py', enabled=False), RegrTest('test_xmllib.py', enabled=False), From arigo at codespeak.net Sun May 1 17:16:25 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Sun, 1 May 2005 17:16:25 +0200 (CEST) Subject: [pypy-svn] r11704 - pypy/dist/lib-python Message-ID: <20050501151625.A8EA327C25@code1.codespeak.net> Author: arigo Date: Sun May 1 17:16:25 2005 New Revision: 11704 Modified: pypy/dist/lib-python/conftest.py Log: - syntax typos! - by default, run all the tests flagged 'core=True'. 'enabled' is ignored. Modified: pypy/dist/lib-python/conftest.py ============================================================================== --- pypy/dist/lib-python/conftest.py (original) +++ pypy/dist/lib-python/conftest.py Sun May 1 17:16:25 2005 @@ -24,9 +24,9 @@ Option = py.test.Config.Option option = py.test.Config.addoptions("compliance testing options", - Option('-D', '--withdisabled', action="store_true", - default=False, dest="withdisabled", - help="include all disabled tests in the test run."), + Option('-A', '--all', action="store_true", + default=False, dest="withall", + help="include all tests (instead of just core tests)."), Option('-E', '--extracttests', action="store_true", default=False, dest="extracttests", help="try to extract single tests and run them via py.test/PyPy"), @@ -345,7 +345,7 @@ #raise UnwrapError('calling %s: %s' % (self.code.cpy_callable, e)) #pypy.objspace.std.model.UnwrapError: calling : cannot unwrap > - RegrTest('test_cgi.py', enabled=True, , core=True), + RegrTest('test_cgi.py', enabled=True, core=True), RegrTest('test_charmapcodec.py', enabled=True), RegrTest('test_cl.py', enabled=False, dumbtest=1), RegrTest('test_class.py', enabled=False, oldstyle=True, core=True), @@ -449,7 +449,7 @@ RegrTest('test_imageop.py', enabled=False, dumbtest=1), RegrTest('test_imaplib.py', enabled=True, dumbtest=1, core=True), RegrTest('test_imgfile.py', enabled=False, dumbtest=1), - RegrTest('test_imp.py', enabled=False, , core="maybe"), + RegrTest('test_imp.py', enabled=False, core="maybe"), RegrTest('test_import.py', enabled=False, dumbtest=1, core="possibly"), RegrTest('test_importhooks.py', enabled=False, core="possibly"), RegrTest('test_inspect.py', enabled=False, dumbtest=1, core="maybe"), @@ -597,7 +597,7 @@ RegrTest('test_tarfile.py', enabled=False, core="possibly"), #rev 10840: 13 of 13 test fail - RegrTest('test_tempfile.py', enabled=False, core=True) + RegrTest('test_tempfile.py', enabled=False, core=True), # tempfile does: class ... unlink = _os.unlink!!! #rev 10840: Uncaught interp-level exception: Same place as test_cfgparser @@ -682,7 +682,7 @@ def run(self): return [x.basename for x in self.testmap - if x.enabled or pypy_option.withdisabled] + if x.core or pypy_option.withall] def join(self, name): regrtest = self.get(name) From arigo at codespeak.net Sun May 1 17:52:35 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Sun, 1 May 2005 17:52:35 +0200 (CEST) Subject: [pypy-svn] r11707 - in pypy/dist/pypy/lib: . test2 Message-ID: <20050501155235.21CDA27C23@code1.codespeak.net> Author: arigo Date: Sun May 1 17:52:34 2005 New Revision: 11707 Added: pypy/dist/pypy/lib/test2/test_imp_extra.py (contents, props changed) Modified: pypy/dist/pypy/lib/imp.py pypy/dist/pypy/lib/test2/support.py Log: Added dummy lock functions to the imp module. Fixed support.py and wrote a short test for the imp module. Modified: pypy/dist/pypy/lib/imp.py ============================================================================== --- pypy/dist/pypy/lib/imp.py (original) +++ pypy/dist/pypy/lib/imp.py Sun May 1 17:52:34 2005 @@ -9,9 +9,14 @@ import sys, os -PY_SOURCE = 1 -PKG_DIRECTORY = 5 -C_BUILTIN = 6 +PY_SOURCE = 1 +PY_COMPILED = 2 +C_EXTENSION = 3 +PY_RESOURCE = 4 +PKG_DIRECTORY = 5 +C_BUILTIN = 6 +PY_FROZEN = 7 +PY_CODERESOURCE = 8 def get_magic(): return '\x3b\xf2\x0d\x0a' @@ -70,3 +75,12 @@ return module raise ValueError, 'invalid description argument: %r' % (description,) + + +# XXX needs to be implemented when we have threads +def lock_held(): + return False +def acquire_lock(): + pass +def release_lock(): + pass Modified: pypy/dist/pypy/lib/test2/support.py ============================================================================== --- pypy/dist/pypy/lib/test2/support.py (original) +++ pypy/dist/pypy/lib/test2/support.py Sun May 1 17:52:34 2005 @@ -26,7 +26,8 @@ # interactions later cleanup_path() cpython_mod = __import__(modname) - assert os.path.dirname(cpython_mod.__file__) != lib_dir + if hasattr(cpython_mod, '__file__'): + assert os.path.dirname(cpython_mod.__file__) != lib_dir filename = os.path.join(lib_dir, modname + '.py') mod = new.module(modname) mod.__file__ = filename Added: pypy/dist/pypy/lib/test2/test_imp_extra.py ============================================================================== --- (empty file) +++ pypy/dist/pypy/lib/test2/test_imp_extra.py Sun May 1 17:52:34 2005 @@ -0,0 +1,25 @@ +import support +imp = support.libmodule('imp') + +import os + + +def test_find_module(): + file, pathname, description = imp.find_module('StringIO') + assert file is not None + file.close() + assert os.path.exists(pathname) + pathname = pathname.lower() + assert (pathname.endswith('.py') or pathname.endswith('.pyc') + or pathname.endswith('.pyo')) + assert description in imp.get_suffixes() + + +def test_suffixes(): + for suffix, mode, type in imp.get_suffixes(): + if mode == imp.PY_SOURCE: + assert suffix == '.py' + assert type == 'r' + elif mode == imp.PY_COMPILED: + assert suffix in ('.pyc', '.pyo') + assert type == 'rb' From arigo at codespeak.net Sun May 1 18:27:58 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Sun, 1 May 2005 18:27:58 +0200 (CEST) Subject: [pypy-svn] r11708 - pypy/dist/pypy/objspace/std Message-ID: <20050501162758.7A7D027C23@code1.codespeak.net> Author: arigo Date: Sun May 1 18:27:58 2005 New Revision: 11708 Modified: pypy/dist/pypy/objspace/std/fake.py Log: fake.py: Produce a warning message for a case we cannot really handle. Modified: pypy/dist/pypy/objspace/std/fake.py ============================================================================== --- pypy/dist/pypy/objspace/std/fake.py (original) +++ pypy/dist/pypy/objspace/std/fake.py Sun May 1 18:27:58 2005 @@ -39,6 +39,8 @@ if not key.startswith('_'): space.setattr(w_value, space.wrap(key), space.wrap(value)) else: + debug_print('likely crashes because of faked exception %s: %s' % ( + exc.__name__, value)) w_exc = space.wrap(exc) w_value = space.wrap(value) raise OperationError, OperationError(w_exc, w_value), tb From arigo at codespeak.net Sun May 1 18:28:51 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Sun, 1 May 2005 18:28:51 +0200 (CEST) Subject: [pypy-svn] r11709 - in pypy/dist/pypy/objspace/std: . test Message-ID: <20050501162851.9F8E927C23@code1.codespeak.net> Author: arigo Date: Sun May 1 18:28:51 2005 New Revision: 11709 Modified: pypy/dist/pypy/objspace/std/test/test_typeobject.py pypy/dist/pypy/objspace/std/typeobject.py Log: Bug fix. Modified: pypy/dist/pypy/objspace/std/test/test_typeobject.py ============================================================================== --- pypy/dist/pypy/objspace/std/test/test_typeobject.py (original) +++ pypy/dist/pypy/objspace/std/test/test_typeobject.py Sun May 1 18:28:51 2005 @@ -279,4 +279,10 @@ assert repr(A) == "" assert repr(type(type)) == "" - + def test_invalid_mro(self): + class A(object): + pass + raises(TypeError, "class B(A, A): pass") + class C(A): + pass + raises(TypeError, "class D(A, C): pass") Modified: pypy/dist/pypy/objspace/std/typeobject.py ============================================================================== --- pypy/dist/pypy/objspace/std/typeobject.py (original) +++ pypy/dist/pypy/objspace/std/typeobject.py Sun May 1 18:28:51 2005 @@ -350,7 +350,7 @@ return GOODCANDIDATE # good candidate def _getname(space, w_cls): - return space.getattr(w_cls, space.wrap('__name__')) + return space.str_w(space.getattr(w_cls, space.wrap('__name__'))) def mro_error(space, orderlists): cycle = [] From arigo at codespeak.net Sun May 1 18:53:11 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Sun, 1 May 2005 18:53:11 +0200 (CEST) Subject: [pypy-svn] r11710 - pypy/dist/lib-python/modified-2.3.4/test Message-ID: <20050501165311.EBD2727C23@code1.codespeak.net> Author: arigo Date: Sun May 1 18:53:11 2005 New Revision: 11710 Added: pypy/dist/lib-python/modified-2.3.4/test/string_tests.py - copied, changed from r11709, pypy/dist/lib-python/2.3.4/test/string_tests.py Log: test_floatformatting expects float formatting to raise OverflowError (internal buffer limit) in very precise cases. Doesn't make sense. Also simplified the test to make it run faster. Copied: pypy/dist/lib-python/modified-2.3.4/test/string_tests.py (from r11709, pypy/dist/lib-python/2.3.4/test/string_tests.py) ============================================================================== --- pypy/dist/lib-python/2.3.4/test/string_tests.py (original) +++ pypy/dist/lib-python/modified-2.3.4/test/string_tests.py Sun May 1 18:53:11 2005 @@ -571,19 +571,21 @@ def test_floatformatting(self): # float formatting - for prec in xrange(100): + # XXX changed for PyPy to be faster + for prec, value in [(0, 3.141592655), + (1, 0.01), + (2, 120394), + (5, 23.01958), + (20, 141414.51321098), + (49, 0.01), + (50, 1e50), + (99, 123)]: format = '%%.%if' % prec - value = 0.01 - for x in xrange(60): - value = value * 3.141592655 / 3.0 * 10.0 - # The formatfloat() code in stringobject.c and - # unicodeobject.c uses a 120 byte buffer and switches from - # 'f' formatting to 'g' at precision 50, so we expect - # OverflowErrors for the ranges x < 50 and prec >= 67. - if x < 50 and prec >= 67: - self.checkraises(OverflowError, format, "__mod__", value) - else: - self.checkcall(format, "__mod__", value) + try: + self.checkcall(format, "__mod__", value) + except OverflowError: + self.failUnless(abs(value) < 1e25 and prec >= 67, + "OverflowError on small examples") class MixinStrStringUserStringTest: # Additional tests for 8bit strings, i.e. str, UserString and From pedronis at codespeak.net Sun May 1 19:13:06 2005 From: pedronis at codespeak.net (pedronis at codespeak.net) Date: Sun, 1 May 2005 19:13:06 +0200 (CEST) Subject: [pypy-svn] r11711 - pypy/testresult/pedronis@Samuele-Pedronis-Computer.local Message-ID: <20050501171306.C174227C23@code1.codespeak.net> Author: pedronis Date: Sun May 1 19:13:06 2005 New Revision: 11711 Added: pypy/testresult/pedronis at Samuele-Pedronis-Computer.local/ pypy/testresult/pedronis at Samuele-Pedronis-Computer.local/test_descrtut.txt Log: new result for test_descrtut with less failures Added: pypy/testresult/pedronis at Samuele-Pedronis-Computer.local/test_descrtut.txt ============================================================================== --- (empty file) +++ pypy/testresult/pedronis at Samuele-Pedronis-Computer.local/test_descrtut.txt Sun May 1 19:13:06 2005 @@ -0,0 +1,58 @@ +testreport-version: 1.0 +command: /usr/bin/python2.3 /Users/pedronis/PyPy/dist/pypy/tool/alarm.py 2208 /Users/pedronis/PyPy/dist/pypy/interpreter/py.py --oldstyle /Users/pedronis/PyPy/dist/lib-python/modified-2.3.4/test/test_descrtut.py +run by: pedronis at Samuele-Pedronis-Computer.local +sys.platform: darwin +sys.version_info: (2, 3, 0, 'final', 0) +oldstyle: yes +pypy-revision: 11708 +startdate: Sun May 1 18:50:38 2005 +timeout: 2209.0 seconds + +============================================================ +faking +faking +faking +faking +faking +faking +faking +faking +faking +Traceback (application-level): + File "/Users/pedronis/PyPy/dist/lib-python/modified-2.3.4/test/test_descrtut.py", line 469 in ? + test_main(1) + File "/Users/pedronis/PyPy/dist/lib-python/modified-2.3.4/test/test_descrtut.py", line 465 in test_main + test_support.run_doctest(test_descrtut, verbose) + File "/Users/pedronis/PyPy/dist/lib-python/2.3.4/test/test_support.py", line 290 in run_doctest + raise TestFailed("%d of %d doctests failed" % (f, t)) +TestFailed: 3 of 99 doctests failed +***************************************************************** +Failure in example: exec "print foo" in a +from line #49 of test.test_descrtut.__test__.tut1 +Expected: +Traceback (most recent call last): + File "", line 1, in ? + File "", line 1, in ? +NameError: name 'foo' is not defined +Got: 0.0 +***************************************************************** +Failure in example: property +from line #50 of test.test_descrtut.__test__.tut5 +Expected: +Got: +***************************************************************** +Failure in example: C().foo() +from line #15 of test.test_descrtut.__test__.tut8 +Expected: +TypeError: unbound method foo() must be called with B instance as first argument (got C instance instead) +Got: +TypeError: unbound method must be called with instance as first argument +***************************************************************** +3 items had failures: + 1 of 30 in test.test_descrtut.__test__.tut1 + 1 of 15 in test.test_descrtut.__test__.tut5 + 1 of 6 in test.test_descrtut.__test__.tut8 +***Test Failed*** 3 failures. +========================== closed ========================== +execution time: 1052.46314812 seconds +exit status: 1 From pedronis at codespeak.net Sun May 1 19:13:37 2005 From: pedronis at codespeak.net (pedronis at codespeak.net) Date: Sun, 1 May 2005 19:13:37 +0200 (CEST) Subject: [pypy-svn] r11712 - pypy/dist/lib-python Message-ID: <20050501171337.EAD0827C23@code1.codespeak.net> Author: pedronis Date: Sun May 1 19:13:37 2005 New Revision: 11712 Modified: pypy/dist/lib-python/conftest.py Log: test_descrtut needs oldstyle classes Modified: pypy/dist/lib-python/conftest.py ============================================================================== --- pypy/dist/lib-python/conftest.py (original) +++ pypy/dist/lib-python/conftest.py Sun May 1 19:13:37 2005 @@ -378,7 +378,7 @@ RegrTest('test_datetime.py', enabled=True, core=True), RegrTest('test_dbm.py', enabled=False, dumbtest=1), RegrTest('test_descr.py', enabled=False, core=True), - RegrTest('test_descrtut.py', enabled=False, core=True), + RegrTest('test_descrtut.py', enabled=False, core=True, oldstyle=True), #rev 10840: 19 of 96 tests fail RegrTest('test_difflib.py', enabled=True, dumbtest=1, core=True), From arigo at codespeak.net Sun May 1 19:15:23 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Sun, 1 May 2005 19:15:23 +0200 (CEST) Subject: [pypy-svn] r11713 - pypy/testresult/arigo@tismerysoft.de Message-ID: <20050501171523.634B927C23@code1.codespeak.net> Author: arigo Date: Sun May 1 19:15:22 2005 New Revision: 11713 Modified: pypy/testresult/arigo at tismerysoft.de/test___all__.txt pypy/testresult/arigo at tismerysoft.de/test___future__.txt pypy/testresult/arigo at tismerysoft.de/test_anydbm.txt pypy/testresult/arigo at tismerysoft.de/test_atexit.txt pypy/testresult/arigo at tismerysoft.de/test_augassign.txt pypy/testresult/arigo at tismerysoft.de/test_binop.txt pypy/testresult/arigo at tismerysoft.de/test_bisect.txt pypy/testresult/arigo at tismerysoft.de/test_bool.txt pypy/testresult/arigo at tismerysoft.de/test_bufio.txt pypy/testresult/arigo at tismerysoft.de/test_builtin.txt pypy/testresult/arigo at tismerysoft.de/test_calendar.txt pypy/testresult/arigo at tismerysoft.de/test_call.txt pypy/testresult/arigo at tismerysoft.de/test_cfgparser.txt pypy/testresult/arigo at tismerysoft.de/test_cgi.txt pypy/testresult/arigo at tismerysoft.de/test_class.txt pypy/testresult/arigo at tismerysoft.de/test_cmath.txt pypy/testresult/arigo at tismerysoft.de/test_codeop.txt pypy/testresult/arigo at tismerysoft.de/test_coercion.txt pypy/testresult/arigo at tismerysoft.de/test_compare.txt pypy/testresult/arigo at tismerysoft.de/test_compile.txt pypy/testresult/arigo at tismerysoft.de/test_complex.txt pypy/testresult/arigo at tismerysoft.de/test_contains.txt pypy/testresult/arigo at tismerysoft.de/test_cookie.txt pypy/testresult/arigo at tismerysoft.de/test_copy.txt pypy/testresult/arigo at tismerysoft.de/test_copy_reg.txt pypy/testresult/arigo at tismerysoft.de/test_cpickle.txt pypy/testresult/arigo at tismerysoft.de/test_datetime.txt pypy/testresult/arigo at tismerysoft.de/test_descr.txt pypy/testresult/arigo at tismerysoft.de/test_descrtut.txt pypy/testresult/arigo at tismerysoft.de/test_difflib.txt pypy/testresult/arigo at tismerysoft.de/test_dircache.txt pypy/testresult/arigo at tismerysoft.de/test_doctest.txt pypy/testresult/arigo at tismerysoft.de/test_doctest2.txt pypy/testresult/arigo at tismerysoft.de/test_dumbdbm.txt pypy/testresult/arigo at tismerysoft.de/test_dummy_thread.txt pypy/testresult/arigo at tismerysoft.de/test_dummy_threading.txt Log: Partial check-in of core tests. Modified: pypy/testresult/arigo at tismerysoft.de/test___all__.txt ============================================================================== --- pypy/testresult/arigo at tismerysoft.de/test___all__.txt (original) +++ pypy/testresult/arigo at tismerysoft.de/test___all__.txt Sun May 1 19:15:22 2005 @@ -1,14 +1,14 @@ testreport-version: 1.0 -command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 575 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python-2.3.4/test/test___all__.py +command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 529 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/2.3.4/test/test___all__.py run by: arigo at tismerysoft.de sys.platform: linux2 sys.version_info: (2, 3, 5, 'final', 0) cpu model: AMD Athlon(tm) XP 3000+ cpu mhz: 2166.513 oldstyle: no -pypy-revision: 11638 -startdate: Sat Apr 30 01:22:33 2005 -timeout: 576.0 seconds +pypy-revision: 11706 +startdate: Sun May 1 19:48:53 2005 +timeout: 529.0 seconds ============================================================ faking @@ -24,27 +24,23 @@ faking faking Traceback (application-level): - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test___all__.py", line 205 in ? + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test___all__.py", line 205 in ? test_main() - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test___all__.py", line 202 in test_main + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test___all__.py", line 202 in test_main test_support.run_unittest(AllTest) - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_support.py", line 262 in run_unittest + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_support.py", line 262 in run_unittest run_suite(suite, testclass) - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_support.py", line 247 in run_suite + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_support.py", line 247 in run_suite raise TestFailed(err) TestFailed: Traceback (most recent call last): - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test___all__.py", line 159, in test_all - self.check_all("smtplib") - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test___all__.py", line 21, in check_all + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test___all__.py", line 77, in test_all + self.check_all("codecs") + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test___all__.py", line 21, in check_all exec "import %s" % modname in names File "", line 1, in ? - File "/home/arigo/pypysrc/lib-python-2.3.4/smtplib.py", line 49, in ? - from email.base64MIME import encode as encode_base64 - File "/home/arigo/pypysrc/lib-python-2.3.4/email/__init__.py", line 69, in ? - from encodings.aliases import aliases # The aliases dictionary - File "/home/arigo/pypysrc/lib-python-2.3.4/encodings/__init__.py", line 137, in ? - codecs.register(search_function) -TypeError: argument must be callable + File "/home/arigo/pypysrc/lib-python/modified-2.3.4/codecs.py", line 23, in ? + raise SystemError,\ +SystemError: Failed to load the builtin codecs: pypy test_all (__main__.AllTest) ... ERROR @@ -52,23 +48,19 @@ ERROR: test_all (__main__.AllTest) ---------------------------------------------------------------------- Traceback (most recent call last): - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test___all__.py", line 159, in test_all - self.check_all("smtplib") - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test___all__.py", line 21, in check_all + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test___all__.py", line 77, in test_all + self.check_all("codecs") + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test___all__.py", line 21, in check_all exec "import %s" % modname in names File "", line 1, in ? - File "/home/arigo/pypysrc/lib-python-2.3.4/smtplib.py", line 49, in ? - from email.base64MIME import encode as encode_base64 - File "/home/arigo/pypysrc/lib-python-2.3.4/email/__init__.py", line 69, in ? - from encodings.aliases import aliases # The aliases dictionary - File "/home/arigo/pypysrc/lib-python-2.3.4/encodings/__init__.py", line 137, in ? - codecs.register(search_function) -TypeError: argument must be callable + File "/home/arigo/pypysrc/lib-python/modified-2.3.4/codecs.py", line 23, in ? + raise SystemError,\ +SystemError: Failed to load the builtin codecs: pypy ---------------------------------------------------------------------- -Ran 1 test in 322.316s +Ran 1 test in 56.144s FAILED (errors=1) ========================== closed ========================== -execution time: 335.976537943 seconds +execution time: 69.2770738602 seconds exit status: 1 Modified: pypy/testresult/arigo at tismerysoft.de/test___future__.txt ============================================================================== --- pypy/testresult/arigo at tismerysoft.de/test___future__.txt (original) +++ pypy/testresult/arigo at tismerysoft.de/test___future__.txt Sun May 1 19:15:22 2005 @@ -1,14 +1,14 @@ testreport-version: 1.0 -command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 575 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/2.3.4/test/test___future__.py +command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 529 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/2.3.4/test/test___future__.py run by: arigo at tismerysoft.de sys.platform: linux2 sys.version_info: (2, 3, 5, 'final', 0) cpu model: AMD Athlon(tm) XP 3000+ cpu mhz: 2166.513 oldstyle: no -pypy-revision: 11698 -startdate: Sun May 1 17:26:22 2005 -timeout: 576.0 seconds +pypy-revision: 11706 +startdate: Sun May 1 19:50:03 2005 +timeout: 529.0 seconds ============================================================ faking @@ -20,5 +20,5 @@ Checking __future__ generators value _Feature((2, 2, 0, 'alpha', 1), (2, 3, 0, 'final', 0), 4096) Checking __future__ division value _Feature((2, 2, 0, 'alpha', 2), (3, 0, 0, 'alpha', 0), 8192) ========================== closed ========================== -execution time: 6.58015489578 seconds +execution time: 6.56034111977 seconds exit status: 0 Modified: pypy/testresult/arigo at tismerysoft.de/test_anydbm.txt ============================================================================== --- pypy/testresult/arigo at tismerysoft.de/test_anydbm.txt (original) +++ pypy/testresult/arigo at tismerysoft.de/test_anydbm.txt Sun May 1 19:15:22 2005 @@ -1,13 +1,13 @@ testreport-version: 1.0 -command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 529 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/2.3.4/test/test_anydbm.py +command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 528 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/2.3.4/test/test_anydbm.py run by: arigo at tismerysoft.de sys.platform: linux2 sys.version_info: (2, 3, 5, 'final', 0) cpu model: AMD Athlon(tm) XP 3000+ cpu mhz: 2166.513 oldstyle: no -pypy-revision: 11698 -startdate: Sun May 1 17:26:28 2005 +pypy-revision: 11706 +startdate: Sun May 1 19:50:10 2005 timeout: 529.0 seconds ============================================================ @@ -26,9 +26,9 @@ test_anydbm_read (__main__.AnyDBMTestCase) ... ok ---------------------------------------------------------------------- -Ran 4 tests in 23.492s +Ran 4 tests in 23.570s OK ========================== closed ========================== -execution time: 34.3674750328 seconds +execution time: 34.445319891 seconds exit status: 0 Modified: pypy/testresult/arigo at tismerysoft.de/test_atexit.txt ============================================================================== --- pypy/testresult/arigo at tismerysoft.de/test_atexit.txt (original) +++ pypy/testresult/arigo at tismerysoft.de/test_atexit.txt Sun May 1 19:15:22 2005 @@ -1,14 +1,14 @@ testreport-version: 1.0 -command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 529 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python-2.3.4/test/test_atexit.py +command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 575 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/2.3.4/test/test_atexit.py run by: arigo at tismerysoft.de sys.platform: linux2 sys.version_info: (2, 3, 5, 'final', 0) cpu model: AMD Athlon(tm) XP 3000+ cpu mhz: 2166.513 oldstyle: no -pypy-revision: 11638 -startdate: Sat Apr 30 01:30:27 2005 -timeout: 529.0 seconds +pypy-revision: 11706 +startdate: Sun May 1 19:50:44 2005 +timeout: 576.0 seconds ============================================================ faking @@ -20,11 +20,11 @@ faking faking Traceback (application-level): - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_atexit.py", line 37 in ? + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_atexit.py", line 37 in ? """) - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_support.py", line 194 in vereq + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_support.py", line 194 in vereq raise TestFailed, "%r == %r" % (a, b) TestFailed: '' == "handler2 (7,) {'kw': 'abc'}\nhandler2 () {}\nhandler1\n" ========================== closed ========================== -execution time: 6.0517771244 seconds +execution time: 6.70999288559 seconds exit status: 1 Modified: pypy/testresult/arigo at tismerysoft.de/test_augassign.txt ============================================================================== --- pypy/testresult/arigo at tismerysoft.de/test_augassign.txt (original) +++ pypy/testresult/arigo at tismerysoft.de/test_augassign.txt Sun May 1 19:15:22 2005 @@ -1,14 +1,14 @@ testreport-version: 1.0 -command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 575 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/2.3.4/test/test_augassign.py +command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 528 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/2.3.4/test/test_augassign.py run by: arigo at tismerysoft.de sys.platform: linux2 sys.version_info: (2, 3, 5, 'final', 0) cpu model: AMD Athlon(tm) XP 3000+ cpu mhz: 2166.513 oldstyle: no -pypy-revision: 11698 -startdate: Sun May 1 17:27:03 2005 -timeout: 576.0 seconds +pypy-revision: 11706 +startdate: Sun May 1 19:50:52 2005 +timeout: 529.0 seconds OUTPUT TEST see output in: /home/arigo/pypysrc/testresult/arigo at tismerysoft.de/test_augassign.out @@ -18,5 +18,5 @@ faking OK ========================== closed ========================== -execution time: 2.24147582054 seconds +execution time: 2.2424249649 seconds exit status: 0 Modified: pypy/testresult/arigo at tismerysoft.de/test_binop.txt ============================================================================== --- pypy/testresult/arigo at tismerysoft.de/test_binop.txt (original) +++ pypy/testresult/arigo at tismerysoft.de/test_binop.txt Sun May 1 19:15:22 2005 @@ -6,8 +6,8 @@ cpu model: AMD Athlon(tm) XP 3000+ cpu mhz: 2166.513 oldstyle: no -pypy-revision: 11698 -startdate: Sun May 1 17:27:15 2005 +pypy-revision: 11706 +startdate: Sun May 1 19:50:54 2005 timeout: 529.0 seconds ============================================================ @@ -27,9 +27,9 @@ test_sub (__main__.RatTestCase) ... ok ---------------------------------------------------------------------- -Ran 9 tests in 21.390s +Ran 9 tests in 21.494s OK ========================== closed ========================== -execution time: 28.7773020267 seconds +execution time: 28.8837430477 seconds exit status: 0 Modified: pypy/testresult/arigo at tismerysoft.de/test_bisect.txt ============================================================================== --- pypy/testresult/arigo at tismerysoft.de/test_bisect.txt (original) +++ pypy/testresult/arigo at tismerysoft.de/test_bisect.txt Sun May 1 19:15:22 2005 @@ -1,14 +1,14 @@ testreport-version: 1.0 -command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 575 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/2.3.4/test/test_bisect.py +command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 528 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/2.3.4/test/test_bisect.py run by: arigo at tismerysoft.de sys.platform: linux2 sys.version_info: (2, 3, 5, 'final', 0) cpu model: AMD Athlon(tm) XP 3000+ cpu mhz: 2166.513 oldstyle: no -pypy-revision: 11698 -startdate: Sun May 1 17:27:44 2005 -timeout: 576.0 seconds +pypy-revision: 11706 +startdate: Sun May 1 19:51:23 2005 +timeout: 529.0 seconds ============================================================ faking @@ -28,10 +28,10 @@ test_vsListSort (__main__.TestInsort) ... ok ---------------------------------------------------------------------- -Ran 6 tests in 93.023s +Ran 6 tests in 93.573s OK doctest (test.test_bisect) ... 14 tests with zero failures ========================== closed ========================== -execution time: 180.428861141 seconds +execution time: 181.200967073 seconds exit status: 0 Modified: pypy/testresult/arigo at tismerysoft.de/test_bool.txt ============================================================================== --- pypy/testresult/arigo at tismerysoft.de/test_bool.txt (original) +++ pypy/testresult/arigo at tismerysoft.de/test_bool.txt Sun May 1 19:15:22 2005 @@ -1,14 +1,14 @@ testreport-version: 1.0 -command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 575 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/2.3.4/test/test_bool.py +command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 528 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/2.3.4/test/test_bool.py run by: arigo at tismerysoft.de sys.platform: linux2 sys.version_info: (2, 3, 5, 'final', 0) cpu model: AMD Athlon(tm) XP 3000+ cpu mhz: 2166.513 oldstyle: no -pypy-revision: 11698 -startdate: Sun May 1 17:30:45 2005 -timeout: 576.0 seconds +pypy-revision: 11706 +startdate: Sun May 1 19:54:25 2005 +timeout: 529.0 seconds ============================================================ faking @@ -44,9 +44,9 @@ test_subclass (__main__.BoolTest) ... ok ---------------------------------------------------------------------- -Ran 22 tests in 18.786s +Ran 22 tests in 18.813s OK ========================== closed ========================== -execution time: 26.4066901207 seconds +execution time: 26.4379918575 seconds exit status: 0 Modified: pypy/testresult/arigo at tismerysoft.de/test_bufio.txt ============================================================================== --- pypy/testresult/arigo at tismerysoft.de/test_bufio.txt (original) +++ pypy/testresult/arigo at tismerysoft.de/test_bufio.txt Sun May 1 19:15:22 2005 @@ -1,14 +1,14 @@ testreport-version: 1.0 -command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 575 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python-2.3.4/test/test_bufio.py +command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 528 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/2.3.4/test/test_bufio.py run by: arigo at tismerysoft.de sys.platform: linux2 sys.version_info: (2, 3, 5, 'final', 0) cpu model: AMD Athlon(tm) XP 3000+ cpu mhz: 2166.513 oldstyle: no -pypy-revision: 11638 -startdate: Sat Apr 30 01:36:08 2005 -timeout: 576.0 seconds +pypy-revision: 11706 +startdate: Sun May 1 19:54:52 2005 +timeout: 529.0 seconds ============================================================ faking @@ -18,11 +18,9 @@ faking ==========================timeout========================== Traceback (application-level): - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_bufio.py", line 54 in ? + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_bufio.py", line 54 in ? drive_one(nullpat, size) - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_bufio.py", line 19 in drive_one - try_one(teststring[:-1]) KeyboardInterrupt ========================== closed ========================== -execution time: 575.733605146 seconds +execution time: 528.728464127 seconds exit status: 1 Modified: pypy/testresult/arigo at tismerysoft.de/test_builtin.txt ============================================================================== --- pypy/testresult/arigo at tismerysoft.de/test_builtin.txt (original) +++ pypy/testresult/arigo at tismerysoft.de/test_builtin.txt Sun May 1 19:15:22 2005 @@ -1,14 +1,14 @@ testreport-version: 1.0 -command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 528 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/2.3.4/test/test_builtin.py +command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 575 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/2.3.4/test/test_builtin.py run by: arigo at tismerysoft.de sys.platform: linux2 sys.version_info: (2, 3, 5, 'final', 0) cpu model: AMD Athlon(tm) XP 3000+ cpu mhz: 2166.513 oldstyle: no -pypy-revision: 11698 -startdate: Sun May 1 17:31:11 2005 -timeout: 529.0 seconds +pypy-revision: 11706 +startdate: Sun May 1 20:03:41 2005 +timeout: 576.0 seconds ============================================================ faking @@ -74,9 +74,9 @@ test_zip (__main__.BuiltinTest) ... ok ---------------------------------------------------------------------- -Ran 50 tests in 380.739s +Ran 50 tests in 411.514s OK ========================== closed ========================== -execution time: 394.31276989 seconds +execution time: 432.663619041 seconds exit status: 0 Modified: pypy/testresult/arigo at tismerysoft.de/test_calendar.txt ============================================================================== --- pypy/testresult/arigo at tismerysoft.de/test_calendar.txt (original) +++ pypy/testresult/arigo at tismerysoft.de/test_calendar.txt Sun May 1 19:15:22 2005 @@ -1,14 +1,14 @@ testreport-version: 1.0 -command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 575 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/2.3.4/test/test_calendar.py +command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 528 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/2.3.4/test/test_calendar.py run by: arigo at tismerysoft.de sys.platform: linux2 sys.version_info: (2, 3, 5, 'final', 0) cpu model: AMD Athlon(tm) XP 3000+ cpu mhz: 2166.513 oldstyle: no -pypy-revision: 11698 -startdate: Sun May 1 17:37:46 2005 -timeout: 576.0 seconds +pypy-revision: 11706 +startdate: Sun May 1 20:10:54 2005 +timeout: 529.0 seconds ============================================================ faking @@ -24,9 +24,9 @@ test_setfirstweekday (__main__.CalendarTestCase) ... ok ---------------------------------------------------------------------- -Ran 5 tests in 38.539s +Ran 5 tests in 53.920s OK ========================== closed ========================== -execution time: 48.1396071911 seconds +execution time: 63.5932409763 seconds exit status: 0 Modified: pypy/testresult/arigo at tismerysoft.de/test_call.txt ============================================================================== --- pypy/testresult/arigo at tismerysoft.de/test_call.txt (original) +++ pypy/testresult/arigo at tismerysoft.de/test_call.txt Sun May 1 19:15:22 2005 @@ -1,14 +1,14 @@ testreport-version: 1.0 -command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 528 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/2.3.4/test/test_call.py +command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 575 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/2.3.4/test/test_call.py run by: arigo at tismerysoft.de sys.platform: linux2 sys.version_info: (2, 3, 5, 'final', 0) cpu model: AMD Athlon(tm) XP 3000+ cpu mhz: 2166.513 oldstyle: no -pypy-revision: 11698 -startdate: Sun May 1 17:38:34 2005 -timeout: 529.0 seconds +pypy-revision: 11706 +startdate: Sun May 1 20:11:58 2005 +timeout: 576.0 seconds ============================================================ faking @@ -45,9 +45,9 @@ test_varargs2_kw (__main__.CFunctionCalls) ... ok ---------------------------------------------------------------------- -Ran 27 tests in 8.517s +Ran 27 tests in 16.890s OK ========================== closed ========================== -execution time: 16.3052940369 seconds +execution time: 30.3874931335 seconds exit status: 0 Modified: pypy/testresult/arigo at tismerysoft.de/test_cfgparser.txt ============================================================================== --- pypy/testresult/arigo at tismerysoft.de/test_cfgparser.txt (original) +++ pypy/testresult/arigo at tismerysoft.de/test_cfgparser.txt Sun May 1 19:15:22 2005 @@ -1,13 +1,13 @@ testreport-version: 1.0 -command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 576 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python-2.3.4/test/test_cfgparser.py +command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 576 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/2.3.4/test/test_cfgparser.py run by: arigo at tismerysoft.de sys.platform: linux2 sys.version_info: (2, 3, 5, 'final', 0) cpu model: AMD Athlon(tm) XP 3000+ cpu mhz: 2166.513 oldstyle: no -pypy-revision: 11638 -startdate: Sat Apr 30 01:53:42 2005 +pypy-revision: 11706 +startdate: Sun May 1 20:12:29 2005 timeout: 576.0 seconds ============================================================ @@ -286,5 +286,5 @@ raise UnwrapError('calling %s: %s' % (self.code.cpy_callable, e)) pypy.objspace.std.model.UnwrapError: calling : cannot unwrap > ========================== closed ========================== -execution time: 55.25827384 seconds +execution time: 133.413197994 seconds exit status: 1 Modified: pypy/testresult/arigo at tismerysoft.de/test_cgi.txt ============================================================================== --- pypy/testresult/arigo at tismerysoft.de/test_cgi.txt (original) +++ pypy/testresult/arigo at tismerysoft.de/test_cgi.txt Sun May 1 19:15:22 2005 @@ -1,14 +1,14 @@ testreport-version: 1.0 -command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 576 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/2.3.4/test/test_cgi.py +command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 528 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/2.3.4/test/test_cgi.py run by: arigo at tismerysoft.de sys.platform: linux2 sys.version_info: (2, 3, 5, 'final', 0) cpu model: AMD Athlon(tm) XP 3000+ cpu mhz: 2166.513 oldstyle: no -pypy-revision: 11698 -startdate: Sun May 1 17:38:51 2005 -timeout: 576.0 seconds +pypy-revision: 11706 +startdate: Sun May 1 20:14:43 2005 +timeout: 529.0 seconds OUTPUT TEST see output in: /home/arigo/pypysrc/testresult/arigo at tismerysoft.de/test_cgi.out @@ -23,5 +23,5 @@ faking OK ========================== closed ========================== -execution time: 41.4339399338 seconds +execution time: 95.7012350559 seconds exit status: 0 Modified: pypy/testresult/arigo at tismerysoft.de/test_class.txt ============================================================================== --- pypy/testresult/arigo at tismerysoft.de/test_class.txt (original) +++ pypy/testresult/arigo at tismerysoft.de/test_class.txt Sun May 1 19:15:22 2005 @@ -1,17 +1,17 @@ testreport-version: 1.0 -command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 576 /home/arigo/pypysrc/pypy/interpreter/py.py --oldstyle /home/arigo/pypysrc/pypy/lib/test2/test_class.py +command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 576 /home/arigo/pypysrc/pypy/interpreter/py.py --oldstyle /home/arigo/pypysrc/lib-python/modified-2.3.4/test/test_class.py run by: arigo at tismerysoft.de sys.platform: linux2 sys.version_info: (2, 3, 5, 'final', 0) cpu model: AMD Athlon(tm) XP 3000+ cpu mhz: 2166.513 oldstyle: yes -pypy-revision: 11646 -startdate: Sat Apr 30 17:53:54 2005 +pypy-revision: 11706 +startdate: Sun May 1 20:16:19 2005 timeout: 576.0 seconds OUTPUT TEST -see output in: /home/arigo/pypysrc/lib-python-2.3.4/test/result/arigo at tismerysoft.de/test_class.out +see output in: /home/arigo/pypysrc/testresult/arigo at tismerysoft.de/test_class.out ============================================================ faking faking @@ -21,5 +21,5 @@ faking FAILED: test output differs ========================== closed ========================== -execution time: 69.1717600822 seconds +execution time: 177.131189108 seconds exit status: 0 Modified: pypy/testresult/arigo at tismerysoft.de/test_cmath.txt ============================================================================== --- pypy/testresult/arigo at tismerysoft.de/test_cmath.txt (original) +++ pypy/testresult/arigo at tismerysoft.de/test_cmath.txt Sun May 1 19:15:22 2005 @@ -1,14 +1,14 @@ testreport-version: 1.0 -command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 576 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/2.3.4/test/test_cmath.py +command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 841 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/2.3.4/test/test_cmath.py run by: arigo at tismerysoft.de sys.platform: linux2 sys.version_info: (2, 3, 5, 'final', 0) cpu model: AMD Athlon(tm) XP 3000+ cpu mhz: 2166.513 oldstyle: no -pypy-revision: 11698 -startdate: Sun May 1 17:39:47 2005 -timeout: 576.0 seconds +pypy-revision: 11706 +startdate: Sun May 1 20:19:17 2005 +timeout: 841.0 seconds ============================================================ faking @@ -35,5 +35,5 @@ PI = 3.14159265358 E = 2.71828182845 ========================== closed ========================== -execution time: 22.0528421402 seconds +execution time: 53.3827400208 seconds exit status: 0 Modified: pypy/testresult/arigo at tismerysoft.de/test_codeop.txt ============================================================================== --- pypy/testresult/arigo at tismerysoft.de/test_codeop.txt (original) +++ pypy/testresult/arigo at tismerysoft.de/test_codeop.txt Sun May 1 19:15:22 2005 @@ -1,14 +1,14 @@ testreport-version: 1.0 -command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 484 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/2.3.4/test/test_codeop.py +command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 528 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/2.3.4/test/test_codeop.py run by: arigo at tismerysoft.de sys.platform: linux2 sys.version_info: (2, 3, 5, 'final', 0) cpu model: AMD Athlon(tm) XP 3000+ cpu mhz: 2166.513 oldstyle: no -pypy-revision: 11698 -startdate: Sun May 1 17:40:09 2005 -timeout: 484.0 seconds +pypy-revision: 11706 +startdate: Sun May 1 20:20:11 2005 +timeout: 529.0 seconds ============================================================ faking @@ -22,9 +22,9 @@ test_valid (__main__.CodeopTests) ... ok ---------------------------------------------------------------------- -Ran 4 tests in 4.112s +Ran 4 tests in 9.600s OK ========================== closed ========================== -execution time: 11.5050919056 seconds +execution time: 27.3503229618 seconds exit status: 0 Modified: pypy/testresult/arigo at tismerysoft.de/test_coercion.txt ============================================================================== --- pypy/testresult/arigo at tismerysoft.de/test_coercion.txt (original) +++ pypy/testresult/arigo at tismerysoft.de/test_coercion.txt Sun May 1 19:15:22 2005 @@ -1,17 +1,17 @@ testreport-version: 1.0 -command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 576 /home/arigo/pypysrc/pypy/interpreter/py.py --oldstyle /home/arigo/pypysrc/pypy/lib/test2/test_coercion.py +command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 528 /home/arigo/pypysrc/pypy/interpreter/py.py --oldstyle /home/arigo/pypysrc/lib-python/modified-2.3.4/test/test_coercion.py run by: arigo at tismerysoft.de sys.platform: linux2 sys.version_info: (2, 3, 5, 'final', 0) cpu model: AMD Athlon(tm) XP 3000+ cpu mhz: 2166.513 oldstyle: yes -pypy-revision: 11638 -startdate: Sat Apr 30 01:56:51 2005 -timeout: 576.0 seconds +pypy-revision: 11706 +startdate: Sun May 1 20:20:39 2005 +timeout: 529.0 seconds OUTPUT TEST -see output in: /home/arigo/pypysrc/lib-python-2.3.4/test/result/arigo at tismerysoft.de/test_coercion.out +see output in: /home/arigo/pypysrc/testresult/arigo at tismerysoft.de/test_coercion.out ============================================================ faking faking @@ -22,15 +22,17 @@ faking faking faking -/home/arigo/pypysrc/pypy/lib/test2/test_coercion.py:0: DeprecationWarning: complex divmod(), // and % are deprecated -/home/arigo/pypysrc/pypy/lib/test2/test_coercion.py:1: DeprecationWarning: complex divmod(), // and % are deprecated +/home/arigo/pypysrc/lib-python/modified-2.3.4/test/test_coercion.py:0: DeprecationWarning: complex divmod(), // and % are deprecated +/home/arigo/pypysrc/lib-python/modified-2.3.4/test/test_coercion.py:1: DeprecationWarning: complex divmod(), // and % are deprecated import copy -/home/arigo/pypysrc/pypy/lib/test2/test_coercion.py:63: DeprecationWarning: complex divmod(), // and % are deprecated - return other % self.arg ==========================timeout========================== -/home/arigo/pypysrc/pypy/lib/test2/test_coercion.py:60: DeprecationWarning: complex divmod(), // and % are deprecated - return self.arg % other +Traceback (application-level): + File "/home/arigo/pypysrc/lib-python/modified-2.3.4/test/test_coercion.py", line 117 in ? +do_infix_binops() + File "/home/arigo/pypysrc/lib-python/modified-2.3.4/test/test_coercion.py", line 98 in do_infix_binops + print '=>', z +KeyboardInterrupt FAILED: test output differs ========================== closed ========================== -execution time: 875.814987183 seconds -exit status: 0 +execution time: 530.744036198 seconds +exit status: 1 Modified: pypy/testresult/arigo at tismerysoft.de/test_compare.txt ============================================================================== --- pypy/testresult/arigo at tismerysoft.de/test_compare.txt (original) +++ pypy/testresult/arigo at tismerysoft.de/test_compare.txt Sun May 1 19:15:22 2005 @@ -1,14 +1,14 @@ testreport-version: 1.0 -command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 575 /home/arigo/pypysrc/pypy/interpreter/py.py --oldstyle /home/arigo/pypysrc/lib-python/2.3.4/test/test_compare.py +command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 625 /home/arigo/pypysrc/pypy/interpreter/py.py --oldstyle /home/arigo/pypysrc/lib-python/2.3.4/test/test_compare.py run by: arigo at tismerysoft.de sys.platform: linux2 sys.version_info: (2, 3, 5, 'final', 0) cpu model: AMD Athlon(tm) XP 3000+ cpu mhz: 2166.513 oldstyle: yes -pypy-revision: 11698 -startdate: Sun May 1 17:40:36 2005 -timeout: 576.0 seconds +pypy-revision: 11706 +startdate: Sun May 1 20:29:30 2005 +timeout: 625.0 seconds OUTPUT TEST see output in: /home/arigo/pypysrc/testresult/arigo at tismerysoft.de/test_compare.out @@ -18,5 +18,5 @@ faking OK ========================== closed ========================== -execution time: 112.098046064 seconds +execution time: 211.350155115 seconds exit status: 0 Modified: pypy/testresult/arigo at tismerysoft.de/test_compile.txt ============================================================================== --- pypy/testresult/arigo at tismerysoft.de/test_compile.txt (original) +++ pypy/testresult/arigo at tismerysoft.de/test_compile.txt Sun May 1 19:15:22 2005 @@ -1,14 +1,14 @@ testreport-version: 1.0 -command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 529 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/2.3.4/test/test_compile.py +command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 625 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/2.3.4/test/test_compile.py run by: arigo at tismerysoft.de sys.platform: linux2 sys.version_info: (2, 3, 5, 'final', 0) cpu model: AMD Athlon(tm) XP 3000+ cpu mhz: 2166.513 oldstyle: no -pypy-revision: 11698 -startdate: Sun May 1 17:42:28 2005 -timeout: 529.0 seconds +pypy-revision: 11706 +startdate: Sun May 1 20:33:02 2005 +timeout: 625.0 seconds ============================================================ faking @@ -33,9 +33,9 @@ test_unary_minus (__main__.TestSpecifics) ... ok ---------------------------------------------------------------------- -Ran 11 tests in 7.263s +Ran 11 tests in 15.510s OK ========================== closed ========================== -execution time: 14.9446339607 seconds +execution time: 29.748488903 seconds exit status: 0 Modified: pypy/testresult/arigo at tismerysoft.de/test_complex.txt ============================================================================== --- pypy/testresult/arigo at tismerysoft.de/test_complex.txt (original) +++ pypy/testresult/arigo at tismerysoft.de/test_complex.txt Sun May 1 19:15:22 2005 @@ -1,13 +1,13 @@ testreport-version: 1.0 -command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 576 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python-2.3.4/test/test_complex.py +command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 575 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/2.3.4/test/test_complex.py run by: arigo at tismerysoft.de sys.platform: linux2 sys.version_info: (2, 3, 5, 'final', 0) cpu model: AMD Athlon(tm) XP 3000+ cpu mhz: 2166.513 oldstyle: no -pypy-revision: 11638 -startdate: Sat Apr 30 02:13:49 2005 +pypy-revision: 11706 +startdate: Sun May 1 20:33:32 2005 timeout: 576.0 seconds ============================================================ @@ -22,26 +22,30 @@ faking ==========================timeout========================== Traceback (application-level): - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_complex.py", line 316 in ? + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_complex.py", line 316 in ? test_main() - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_complex.py", line 313 in test_main + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_complex.py", line 313 in test_main test_support.run_unittest(ComplexTest) - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_support.py", line 262 in run_unittest + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_support.py", line 262 in run_unittest run_suite(suite, testclass) - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_support.py", line 234 in run_suite + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_support.py", line 234 in run_suite result = runner.run(suite) - File "/home/arigo/pypysrc/lib-python-2.3.4/unittest.py", line 658 in run + File "/home/arigo/pypysrc/lib-python/2.3.4/unittest.py", line 658 in run test(result) - File "/home/arigo/pypysrc/lib-python-2.3.4/unittest.py", line 389 in __call__ + File "/home/arigo/pypysrc/lib-python/2.3.4/unittest.py", line 389 in __call__ test(result) - File "/home/arigo/pypysrc/lib-python-2.3.4/unittest.py", line 389 in __call__ + File "/home/arigo/pypysrc/lib-python/2.3.4/unittest.py", line 389 in __call__ test(result) - File "/home/arigo/pypysrc/lib-python-2.3.4/unittest.py", line 229 in __call__ + File "/home/arigo/pypysrc/lib-python/2.3.4/unittest.py", line 229 in __call__ testMethod() - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_complex.py", line 75 in test_div + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_complex.py", line 75 in test_div self.check_div(x, y) - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_complex.py", line 61 in check_div + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_complex.py", line 57 in check_div self.assertClose(q, y) + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_complex.py", line 47 in assertClose + self.assertCloseAbs(x.imag, y.imag, eps) + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_complex.py", line 42 in assertCloseAbs + self.assert_(abs((x-y)/y) < eps) KeyboardInterrupt test_abs (__main__.ComplexTest) ... ok test_boolcontext (__main__.ComplexTest) ... ok @@ -49,5 +53,5 @@ test_conjugate (__main__.ComplexTest) ... ok test_constructor (__main__.ComplexTest) ... FAIL test_div (__main__.ComplexTest) ... ========================== closed ========================== -execution time: 576.14718008 seconds +execution time: 575.737567902 seconds exit status: 1 Modified: pypy/testresult/arigo at tismerysoft.de/test_contains.txt ============================================================================== --- pypy/testresult/arigo at tismerysoft.de/test_contains.txt (original) +++ pypy/testresult/arigo at tismerysoft.de/test_contains.txt Sun May 1 19:15:22 2005 @@ -1,14 +1,14 @@ testreport-version: 1.0 -command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 576 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/2.3.4/test/test_contains.py +command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 729 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/2.3.4/test/test_contains.py run by: arigo at tismerysoft.de sys.platform: linux2 sys.version_info: (2, 3, 5, 'final', 0) cpu model: AMD Athlon(tm) XP 3000+ cpu mhz: 2166.513 oldstyle: no -pypy-revision: 11698 -startdate: Sun May 1 17:42:43 2005 -timeout: 576.0 seconds +pypy-revision: 11706 +startdate: Sun May 1 20:43:09 2005 +timeout: 729.0 seconds ============================================================ faking @@ -17,5 +17,5 @@ faking faking ========================== closed ========================== -execution time: 9.00034689903 seconds +execution time: 33.4829180241 seconds exit status: 0 Modified: pypy/testresult/arigo at tismerysoft.de/test_cookie.txt ============================================================================== --- pypy/testresult/arigo at tismerysoft.de/test_cookie.txt (original) +++ pypy/testresult/arigo at tismerysoft.de/test_cookie.txt Sun May 1 19:15:22 2005 @@ -1,17 +1,17 @@ testreport-version: 1.0 -command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 575 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python-2.3.4/test/test_cookie.py +command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 625 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/2.3.4/test/test_cookie.py run by: arigo at tismerysoft.de sys.platform: linux2 sys.version_info: (2, 3, 5, 'final', 0) cpu model: AMD Athlon(tm) XP 3000+ cpu mhz: 2166.513 oldstyle: no -pypy-revision: 11638 -startdate: Sat Apr 30 02:23:34 2005 -timeout: 576.0 seconds +pypy-revision: 11706 +startdate: Sun May 1 20:43:43 2005 +timeout: 625.0 seconds OUTPUT TEST -see output in: /home/arigo/pypysrc/lib-python-2.3.4/test/result/arigo at tismerysoft.de/test_cookie.out +see output in: /home/arigo/pypysrc/testresult/arigo at tismerysoft.de/test_cookie.out ============================================================ faking faking @@ -23,12 +23,12 @@ faking faking Traceback (application-level): - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_cookie.py", line 52 in ? + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_cookie.py", line 52 in ? run_doctest(Cookie) - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_support.py", line 290 in run_doctest + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_support.py", line 290 in run_doctest raise TestFailed("%d of %d doctests failed" % (f, t)) TestFailed: 1 of 46 doctests failed FAILED: test output differs ========================== closed ========================== -execution time: 139.921151876 seconds +execution time: 320.626571894 seconds exit status: 1 Modified: pypy/testresult/arigo at tismerysoft.de/test_copy.txt ============================================================================== --- pypy/testresult/arigo at tismerysoft.de/test_copy.txt (original) +++ pypy/testresult/arigo at tismerysoft.de/test_copy.txt Sun May 1 19:15:22 2005 @@ -1,14 +1,14 @@ testreport-version: 1.0 -command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 576 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/2.3.4/test/test_copy.py +command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 529 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/2.3.4/test/test_copy.py run by: arigo at tismerysoft.de sys.platform: linux2 sys.version_info: (2, 3, 5, 'final', 0) cpu model: AMD Athlon(tm) XP 3000+ cpu mhz: 2166.513 oldstyle: no -pypy-revision: 11698 -startdate: Sun May 1 17:42:53 2005 -timeout: 576.0 seconds +pypy-revision: 11706 +startdate: Sun May 1 20:49:04 2005 +timeout: 529.0 seconds ============================================================ faking @@ -72,9 +72,9 @@ test_reduce_5tuple (__main__.TestCopy) ... ok ---------------------------------------------------------------------- -Ran 54 tests in 25.546s +Ran 54 tests in 25.491s OK ========================== closed ========================== -execution time: 34.225468874 seconds +execution time: 34.1689450741 seconds exit status: 0 Modified: pypy/testresult/arigo at tismerysoft.de/test_copy_reg.txt ============================================================================== --- pypy/testresult/arigo at tismerysoft.de/test_copy_reg.txt (original) +++ pypy/testresult/arigo at tismerysoft.de/test_copy_reg.txt Sun May 1 19:15:22 2005 @@ -6,8 +6,8 @@ cpu model: AMD Athlon(tm) XP 3000+ cpu mhz: 2166.513 oldstyle: no -pypy-revision: 11698 -startdate: Sun May 1 17:43:27 2005 +pypy-revision: 11706 +startdate: Sun May 1 20:49:38 2005 timeout: 529.0 seconds ============================================================ @@ -27,9 +27,9 @@ test_noncallable_reduce (__main__.CopyRegTestCase) ... ok ---------------------------------------------------------------------- -Ran 5 tests in 4.002s +Ran 5 tests in 3.973s OK ========================== closed ========================== -execution time: 24.7980768681 seconds +execution time: 24.8548140526 seconds exit status: 0 Modified: pypy/testresult/arigo at tismerysoft.de/test_cpickle.txt ============================================================================== --- pypy/testresult/arigo at tismerysoft.de/test_cpickle.txt (original) +++ pypy/testresult/arigo at tismerysoft.de/test_cpickle.txt Sun May 1 19:15:22 2005 @@ -1,14 +1,14 @@ testreport-version: 1.0 -command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 576 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python-2.3.4/test/test_cpickle.py +command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 483 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/2.3.4/test/test_cpickle.py run by: arigo at tismerysoft.de sys.platform: linux2 sys.version_info: (2, 3, 5, 'final', 0) cpu model: AMD Athlon(tm) XP 3000+ cpu mhz: 2166.513 oldstyle: no -pypy-revision: 11638 -startdate: Sat Apr 30 02:26:53 2005 -timeout: 576.0 seconds +pypy-revision: 11706 +startdate: Sun May 1 20:50:03 2005 +timeout: 484.0 seconds ============================================================ faking @@ -22,33 +22,31 @@ faking ==========================timeout========================== Traceback (application-level): - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_cpickle.py", line 103 in ? + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_cpickle.py", line 103 in ? test_main() - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_cpickle.py", line 99 in test_main + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_cpickle.py", line 99 in test_main cPickleFastPicklerTests - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_support.py", line 262 in run_unittest + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_support.py", line 262 in run_unittest run_suite(suite, testclass) - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_support.py", line 234 in run_suite + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_support.py", line 234 in run_suite result = runner.run(suite) - File "/home/arigo/pypysrc/lib-python-2.3.4/unittest.py", line 658 in run + File "/home/arigo/pypysrc/lib-python/2.3.4/unittest.py", line 658 in run test(result) - File "/home/arigo/pypysrc/lib-python-2.3.4/unittest.py", line 389 in __call__ + File "/home/arigo/pypysrc/lib-python/2.3.4/unittest.py", line 389 in __call__ test(result) - File "/home/arigo/pypysrc/lib-python-2.3.4/unittest.py", line 389 in __call__ + File "/home/arigo/pypysrc/lib-python/2.3.4/unittest.py", line 389 in __call__ test(result) - File "/home/arigo/pypysrc/lib-python-2.3.4/unittest.py", line 229 in __call__ + File "/home/arigo/pypysrc/lib-python/2.3.4/unittest.py", line 229 in __call__ testMethod() File "pickletester.py", line 779 in test_dict_chunking num_setitems = count_opcode(pickle.SETITEMS, s) File "pickletester.py", line 26 in count_opcode for op, dummy, dummy in pickletools.genops(pickle): - File "/home/arigo/pypysrc/lib-python-2.3.4/pickletools.py", line 1855 in genops - arg = opcode.arg.reader(pickle) - File "/home/arigo/pypysrc/lib-python-2.3.4/pickletools.py", line 495 in read_decimalnl_short - s = read_stringnl(f, decode=False, stripquotes=False) - File "/home/arigo/pypysrc/lib-python-2.3.4/pickletools.py", line 290 in read_stringnl - data = data[:-1] # lose the newline + File "/home/arigo/pypysrc/lib-python/2.3.4/pickletools.py", line 1842 in genops + pos = getpos() + File "/home/arigo/pypysrc/lib-python/2.3.4/StringIO.py", line 97 in tell + if self.closed: KeyboardInterrupt test_dict_chunking (__main__.cPickleTests) ... ========================== closed ========================== -execution time: 576.230476856 seconds +execution time: 483.285461903 seconds exit status: 1 Modified: pypy/testresult/arigo at tismerysoft.de/test_datetime.txt ============================================================================== --- pypy/testresult/arigo at tismerysoft.de/test_datetime.txt (original) +++ pypy/testresult/arigo at tismerysoft.de/test_datetime.txt Sun May 1 19:15:22 2005 @@ -1,14 +1,14 @@ testreport-version: 1.0 -command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 528 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/2.3.4/test/test_datetime.py +command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 576 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/2.3.4/test/test_datetime.py run by: arigo at tismerysoft.de sys.platform: linux2 sys.version_info: (2, 3, 5, 'final', 0) cpu model: AMD Athlon(tm) XP 3000+ cpu mhz: 2166.513 oldstyle: no -pypy-revision: 11698 -startdate: Sun May 1 17:43:52 2005 -timeout: 529.0 seconds +pypy-revision: 11706 +startdate: Sun May 1 20:58:07 2005 +timeout: 576.0 seconds ============================================================ faking @@ -38,8 +38,12 @@ test(result) File "/home/arigo/pypysrc/lib-python/2.3.4/unittest.py", line 229 in __call__ testMethod() - File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_datetime.py", line 560 in test_ordinal_conversions - for year in xrange(MINYEAR, MAXYEAR+1, 7): + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_datetime.py", line 583 in test_ordinal_conversions + self.assertEqual(d, self.theclass.fromordinal(n)) + File "/home/arigo/pypysrc/pypy/lib/datetime.py", line 768 in fromordinal + y, m, d = _ord2ymd(n) + File "/home/arigo/pypysrc/pypy/lib/datetime.py", line 137 in _ord2ymd + year += n100 * 100 + n4 * 4 + n1 KeyboardInterrupt test_constants (__main__.TestModule) ... ok test_non_abstractness (__main__.TestTZInfo) ... ok @@ -83,5 +87,5 @@ test_isoformat (__main__.TestDate) ... ok test_mixed_compare (__main__.TestDate) ... ok test_ordinal_conversions (__main__.TestDate) ... ========================== closed ========================== -execution time: 529.727066994 seconds +execution time: 576.220052958 seconds exit status: 1 Modified: pypy/testresult/arigo at tismerysoft.de/test_descr.txt ============================================================================== --- pypy/testresult/arigo at tismerysoft.de/test_descr.txt (original) +++ pypy/testresult/arigo at tismerysoft.de/test_descr.txt Sun May 1 19:15:22 2005 @@ -1,13 +1,13 @@ testreport-version: 1.0 -command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 529 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python-2.3.4/test/test_descr.py +command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 529 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/2.3.4/test/test_descr.py run by: arigo at tismerysoft.de sys.platform: linux2 sys.version_info: (2, 3, 5, 'final', 0) cpu model: AMD Athlon(tm) XP 3000+ cpu mhz: 2166.513 oldstyle: no -pypy-revision: 11638 -startdate: Sat Apr 30 02:46:24 2005 +pypy-revision: 11706 +startdate: Sun May 1 21:07:44 2005 timeout: 529.0 seconds ============================================================ @@ -19,16 +19,16 @@ faking faking Traceback (application-level): - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_descr.py", line 4050 in ? + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_descr.py", line 4050 in ? test_main() - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_descr.py", line 3956 in test_main + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_descr.py", line 3956 in test_main weakref_segfault() # Must be first, somehow - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_descr.py", line 3924 in weakref_segfault + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_descr.py", line 3924 in weakref_segfault import weakref - File "/home/arigo/pypysrc/lib-python-2.3.4/weakref.py", line 14 in ? + File "/home/arigo/pypysrc/lib-python/2.3.4/weakref.py", line 14 in ? from _weakref import \ ImportError: _weakref Testing weakref segfault... ========================== closed ========================== -execution time: 11.833245039 seconds +execution time: 12.5322868824 seconds exit status: 1 Modified: pypy/testresult/arigo at tismerysoft.de/test_descrtut.txt ============================================================================== --- pypy/testresult/arigo at tismerysoft.de/test_descrtut.txt (original) +++ pypy/testresult/arigo at tismerysoft.de/test_descrtut.txt Sun May 1 19:15:22 2005 @@ -1,14 +1,14 @@ testreport-version: 1.0 -command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 576 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python-2.3.4/test/test_descrtut.py +command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 528 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/modified-2.3.4/test/test_descrtut.py run by: arigo at tismerysoft.de sys.platform: linux2 sys.version_info: (2, 3, 5, 'final', 0) cpu model: AMD Athlon(tm) XP 3000+ cpu mhz: 2166.513 oldstyle: no -pypy-revision: 11638 -startdate: Sat Apr 30 02:46:36 2005 -timeout: 576.0 seconds +pypy-revision: 11706 +startdate: Sun May 1 21:07:58 2005 +timeout: 529.0 seconds ============================================================ faking @@ -20,31 +20,14 @@ faking faking faking -***************************************************************** -Failure in example: print defaultdict # show our type -from line #4 of test.test_descrtut.__test__.tut1 -Expected: -Got: -***************************************************************** -Failure in example: print type(defaultdict) # its metatype -from line #6 of test.test_descrtut.__test__.tut1 -Expected: -Got: -***************************************************************** -Failure in example: print type(a) # show its type -from line #11 of test.test_descrtut.__test__.tut1 -Expected: -Got: -***************************************************************** -Failure in example: print a.__class__ # show its class -from line #13 of test.test_descrtut.__test__.tut1 -Expected: -Got: -***************************************************************** -Failure in example: print sorted(a.keys()) -from line #40 of test.test_descrtut.__test__.tut1 -Expected: [1, 2, '__builtins__', 'x'] -Got: ['__builtins__', 'x', 1, 2] +Traceback (application-level): + File "/home/arigo/pypysrc/lib-python/modified-2.3.4/test/test_descrtut.py", line 469 in ? + test_main(1) + File "/home/arigo/pypysrc/lib-python/modified-2.3.4/test/test_descrtut.py", line 465 in test_main + test_support.run_doctest(test_descrtut, verbose) + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_support.py", line 290 in run_doctest + raise TestFailed("%d of %d doctests failed" % (f, t)) +TestFailed: 10 of 99 doctests failed ***************************************************************** Failure in example: exec "print foo" in a from line #49 of test.test_descrtut.__test__.tut1 @@ -55,134 +38,25 @@ NameError: name 'foo' is not defined Got: 0.0 ***************************************************************** -Failure in example: type([]) -from line #6 of test.test_descrtut.__test__.tut3 -Expected: -Got: -***************************************************************** -Failure in example: [].__class__ -from line #8 of test.test_descrtut.__test__.tut3 -Expected: -Got: -***************************************************************** -Failure in example: list -from line #10 of test.test_descrtut.__test__.tut3 -Expected: -Got: -***************************************************************** -Failure in example: -pprint.pprint(dir(list)) # like list.__dict__.keys(), but sorted -from line #30 of test.test_descrtut.__test__.tut3 -Expected: -['__add__', - '__class__', - '__contains__', - '__delattr__', - '__delitem__', - '__delslice__', - '__doc__', - '__eq__', - '__ge__', - '__getattribute__', - '__getitem__', - '__getslice__', - '__gt__', - '__hash__', - '__iadd__', - '__imul__', - '__init__', - '__iter__', - '__le__', - '__len__', - '__lt__', - '__mul__', - '__ne__', - '__new__', - '__reduce__', - '__reduce_ex__', - '__repr__', - '__rmul__', - '__setattr__', - '__setitem__', - '__setslice__', - '__str__', - 'append', - 'count', - 'extend', - 'index', - 'insert', - 'pop', - 'remove', - 'reverse', - 'sort'] -Got: -['__add__', - '__class__', - '__contains__', - '__delattr__', - '__delitem__', - '__eq__', - '__ge__', - '__getattribute__', - '__getitem__', - '__gt__', - '__hash__', - '__iadd__', - '__imul__', - '__init__', - '__iter__', - '__le__', - '__len__', - '__lt__', - '__mul__', - '__ne__', - '__new__', - '__radd__', - '__reduce__', - '__reduce_ex__', - '__repr__', - '__reversed__', - '__rmul__', - '__setattr__', - '__setitem__', - '__str__', - 'append', - 'count', - 'extend', - 'index', - 'insert', - 'pop', - 'remove', - 'reverse', - 'sort'] -***************************************************************** Failure in example: C.foo(1) from line #28 of test.test_descrtut.__test__.tut4 Expected: classmethod test.test_descrtut.C 1 -Got: classmethod 1 +Got: classmethod 1 ***************************************************************** Failure in example: c.foo(1) from line #31 of test.test_descrtut.__test__.tut4 Expected: classmethod test.test_descrtut.C 1 -Got: classmethod 1 +Got: classmethod 1 ***************************************************************** Failure in example: D.foo(1) from line #37 of test.test_descrtut.__test__.tut4 Expected: classmethod test.test_descrtut.D 1 -Got: classmethod 1 -************Traceback (application-level): - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_descrtut.py", line 503 in ? - test_main(1) - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_descrtut.py", line 499 in test_main - test_support.run_doctest(test_descrtut, verbose) - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_support.py", line 290 in run_doctest - raise TestFailed("%d of %d doctests failed" % (f, t)) -TestFailed: 19 of 96 doctests failed -***************************************************** +Got: classmethod 1 +***************************************************************** Failure in example: d.foo(1) from line #40 of test.test_descrtut.__test__.tut4 Expected: classmethod test.test_descrtut.D 1 -Got: classmethod 1 +Got: classmethod 1 ***************************************************************** Failure in example: E.foo(1) from line #55 of test.test_descrtut.__test__.tut4 @@ -191,7 +65,7 @@ classmethod test.test_descrtut.C 1 Got: E.foo() called -classmethod 1 +classmethod 1 ***************************************************************** Failure in example: e.foo(1) from line #59 of test.test_descrtut.__test__.tut4 @@ -200,12 +74,12 @@ classmethod test.test_descrtut.C 1 Got: E.foo() called -classmethod 1 +classmethod 1 ***************************************************************** Failure in example: property from line #50 of test.test_descrtut.__test__.tut5 Expected: -Got: +Got: ***************************************************************** Failure in example: D().save() from line #17 of test.test_descrtut.__test__.tut6 @@ -219,14 +93,13 @@ Got: TypeError: unbound method must be called with instance as first argument ***************************************************************** -6 items had failures: - 6 of 30 in test.test_descrtut.__test__.tut1 - 4 of 13 in test.test_descrtut.__test__.tut3 +5 items had failures: + 1 of 30 in test.test_descrtut.__test__.tut1 6 of 16 in test.test_descrtut.__test__.tut4 1 of 15 in test.test_descrtut.__test__.tut5 1 of 10 in test.test_descrtut.__test__.tut6 1 of 6 in test.test_descrtut.__test__.tut8 -***Test Failed*** 19 failures. +***Test Failed*** 10 failures. ========================== closed ========================== -execution time: 106.93188715 seconds +execution time: 103.152239084 seconds exit status: 1 Modified: pypy/testresult/arigo at tismerysoft.de/test_difflib.txt ============================================================================== --- pypy/testresult/arigo at tismerysoft.de/test_difflib.txt (original) +++ pypy/testresult/arigo at tismerysoft.de/test_difflib.txt Sun May 1 19:15:22 2005 @@ -1,13 +1,13 @@ testreport-version: 1.0 -command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 529 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/2.3.4/test/test_difflib.py +command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 528 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/2.3.4/test/test_difflib.py run by: arigo at tismerysoft.de sys.platform: linux2 sys.version_info: (2, 3, 5, 'final', 0) cpu model: AMD Athlon(tm) XP 3000+ cpu mhz: 2166.513 oldstyle: no -pypy-revision: 11698 -startdate: Sun May 1 17:52:43 2005 +pypy-revision: 11706 +startdate: Sun May 1 21:09:42 2005 timeout: 529.0 seconds ============================================================ @@ -44,9 +44,9 @@ doctest of difflib.unified_diff ... ok ---------------------------------------------------------------------- -Ran 22 tests in 66.811s +Ran 22 tests in 66.803s OK ========================== closed ========================== -execution time: 143.89794898 seconds +execution time: 143.926800013 seconds exit status: 0 Modified: pypy/testresult/arigo at tismerysoft.de/test_dircache.txt ============================================================================== --- pypy/testresult/arigo at tismerysoft.de/test_dircache.txt (original) +++ pypy/testresult/arigo at tismerysoft.de/test_dircache.txt Sun May 1 19:15:22 2005 @@ -1,14 +1,14 @@ testreport-version: 1.0 -command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 529 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/2.3.4/test/test_dircache.py +command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 576 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/2.3.4/test/test_dircache.py run by: arigo at tismerysoft.de sys.platform: linux2 sys.version_info: (2, 3, 5, 'final', 0) cpu model: AMD Athlon(tm) XP 3000+ cpu mhz: 2166.513 oldstyle: no -pypy-revision: 11698 -startdate: Sun May 1 17:55:07 2005 -timeout: 529.0 seconds +pypy-revision: 11706 +startdate: Sun May 1 21:12:06 2005 +timeout: 576.0 seconds ============================================================ faking @@ -20,9 +20,9 @@ test_listdir (__main__.DircacheTests) ... ok ---------------------------------------------------------------------- -Ran 2 tests in 2.033s +Ran 2 tests in 2.044s OK ========================== closed ========================== -execution time: 9.27300000191 seconds +execution time: 9.28582811356 seconds exit status: 0 Modified: pypy/testresult/arigo at tismerysoft.de/test_doctest.txt ============================================================================== --- pypy/testresult/arigo at tismerysoft.de/test_doctest.txt (original) +++ pypy/testresult/arigo at tismerysoft.de/test_doctest.txt Sun May 1 19:15:22 2005 @@ -1,14 +1,14 @@ testreport-version: 1.0 -command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 528 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/2.3.4/test/test_doctest.py +command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 575 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/2.3.4/test/test_doctest.py run by: arigo at tismerysoft.de sys.platform: linux2 sys.version_info: (2, 3, 5, 'final', 0) cpu model: AMD Athlon(tm) XP 3000+ cpu mhz: 2166.513 oldstyle: no -pypy-revision: 11698 -startdate: Sun May 1 17:55:35 2005 -timeout: 529.0 seconds +pypy-revision: 11706 +startdate: Sun May 1 21:12:15 2005 +timeout: 576.0 seconds ============================================================ faking @@ -476,5 +476,5 @@ Test passed. doctest (doctest) ... 71 tests with zero failures ========================== closed ========================== -execution time: 118.438398123 seconds +execution time: 118.487788916 seconds exit status: 0 Modified: pypy/testresult/arigo at tismerysoft.de/test_doctest2.txt ============================================================================== --- pypy/testresult/arigo at tismerysoft.de/test_doctest2.txt (original) +++ pypy/testresult/arigo at tismerysoft.de/test_doctest2.txt Sun May 1 19:15:22 2005 @@ -1,14 +1,14 @@ testreport-version: 1.0 -command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 529 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/2.3.4/test/test_doctest2.py +command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 576 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/2.3.4/test/test_doctest2.py run by: arigo at tismerysoft.de sys.platform: linux2 sys.version_info: (2, 3, 5, 'final', 0) cpu model: AMD Athlon(tm) XP 3000+ cpu mhz: 2166.513 oldstyle: no -pypy-revision: 11698 -startdate: Sun May 1 17:57:34 2005 -timeout: 529.0 seconds +pypy-revision: 11706 +startdate: Sun May 1 21:14:14 2005 +timeout: 576.0 seconds ============================================================ faking @@ -120,5 +120,5 @@ Test passed. doctest (test.test_doctest2) ... 19 tests with zero failures ========================== closed ========================== -execution time: 83.3889701366 seconds +execution time: 83.1734199524 seconds exit status: 0 Modified: pypy/testresult/arigo at tismerysoft.de/test_dumbdbm.txt ============================================================================== --- pypy/testresult/arigo at tismerysoft.de/test_dumbdbm.txt (original) +++ pypy/testresult/arigo at tismerysoft.de/test_dumbdbm.txt Sun May 1 19:15:22 2005 @@ -1,14 +1,14 @@ testreport-version: 1.0 -command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 484 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/2.3.4/test/test_dumbdbm.py +command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 529 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/2.3.4/test/test_dumbdbm.py run by: arigo at tismerysoft.de sys.platform: linux2 sys.version_info: (2, 3, 5, 'final', 0) cpu model: AMD Athlon(tm) XP 3000+ cpu mhz: 2166.513 oldstyle: no -pypy-revision: 11698 -startdate: Sun May 1 17:58:57 2005 -timeout: 484.0 seconds +pypy-revision: 11706 +startdate: Sun May 1 21:15:37 2005 +timeout: 529.0 seconds ============================================================ faking @@ -25,9 +25,9 @@ test_write_write_read (__main__.DumbDBMTestCase) ... ok ---------------------------------------------------------------------- -Ran 7 tests in 214.810s +Ran 7 tests in 212.214s OK ========================== closed ========================== -execution time: 222.313758135 seconds +execution time: 219.735015154 seconds exit status: 0 Modified: pypy/testresult/arigo at tismerysoft.de/test_dummy_thread.txt ============================================================================== --- pypy/testresult/arigo at tismerysoft.de/test_dummy_thread.txt (original) +++ pypy/testresult/arigo at tismerysoft.de/test_dummy_thread.txt Sun May 1 19:15:22 2005 @@ -1,13 +1,13 @@ testreport-version: 1.0 -command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 575 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/2.3.4/test/test_dummy_thread.py +command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 576 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/2.3.4/test/test_dummy_thread.py run by: arigo at tismerysoft.de sys.platform: linux2 sys.version_info: (2, 3, 5, 'final', 0) cpu model: AMD Athlon(tm) XP 3000+ cpu mhz: 2166.513 oldstyle: no -pypy-revision: 11698 -startdate: Sun May 1 18:02:40 2005 +pypy-revision: 11706 +startdate: Sun May 1 21:19:17 2005 timeout: 576.0 seconds ============================================================ @@ -41,9 +41,9 @@ ok ---------------------------------------------------------------------- -Ran 15 tests in 6.005s +Ran 15 tests in 6.015s OK ========================== closed ========================== -execution time: 16.9045801163 seconds +execution time: 16.9442791939 seconds exit status: 0 Modified: pypy/testresult/arigo at tismerysoft.de/test_dummy_threading.txt ============================================================================== --- pypy/testresult/arigo at tismerysoft.de/test_dummy_threading.txt (original) +++ pypy/testresult/arigo at tismerysoft.de/test_dummy_threading.txt Sun May 1 19:15:22 2005 @@ -1,14 +1,14 @@ testreport-version: 1.0 -command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 576 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/2.3.4/test/test_dummy_threading.py +command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 529 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/2.3.4/test/test_dummy_threading.py run by: arigo at tismerysoft.de sys.platform: linux2 sys.version_info: (2, 3, 5, 'final', 0) cpu model: AMD Athlon(tm) XP 3000+ cpu mhz: 2166.513 oldstyle: no -pypy-revision: 11698 -startdate: Sun May 1 18:02:57 2005 -timeout: 576.0 seconds +pypy-revision: 11706 +startdate: Sun May 1 21:19:35 2005 +timeout: 529.0 seconds ============================================================ faking @@ -59,5 +59,5 @@ waiting for all tasks to complete all tasks done ========================== closed ========================== -execution time: 14.2151808739 seconds +execution time: 14.262234211 seconds exit status: 0 From arigo at codespeak.net Sun May 1 19:56:09 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Sun, 1 May 2005 19:56:09 +0200 (CEST) Subject: [pypy-svn] r11717 - in pypy/dist/pypy/objspace/std: . test Message-ID: <20050501175609.9A1FB27C1F@code1.codespeak.net> Author: arigo Date: Sun May 1 19:56:09 2005 New Revision: 11717 Modified: pypy/dist/pypy/objspace/std/listobject.py pypy/dist/pypy/objspace/std/test/test_listobject.py Log: Try harder to keep to None all the items in lists after the ob_size. This avoids unnecessary references kept around. Modified: pypy/dist/pypy/objspace/std/listobject.py ============================================================================== --- pypy/dist/pypy/objspace/std/listobject.py (original) +++ pypy/dist/pypy/objspace/std/listobject.py Sun May 1 19:56:09 2005 @@ -288,14 +288,15 @@ oldsize = w_list.ob_size delta = len2 - slicelength newsize = oldsize + delta - _list_resize(w_list, newsize) - w_list.ob_size = newsize - r = range(start+len2, newsize) - if delta > 0: - r.reverse() - items = w_list.ob_item - for i in r: - items[i] = items[i-delta] + if delta >= 0: + _list_resize(w_list, newsize) + w_list.ob_size = newsize + items = w_list.ob_item + for i in range(newsize-1, start+len2-1, -1): + items[i] = items[i-delta] + else: + # shrinking requires the careful memory management of _del_slice() + _del_slice(w_list, start, start-delta) elif len2 != slicelength: # No resize for extended slices raise OperationError(space.w_ValueError, space.wrap("attempt to " "assign sequence of size %d to extended slice of size %d" % @@ -453,7 +454,11 @@ for i in range(ilow, w_list.ob_size - d): items[i] = items[i+d] items[i+d] = None + # make sure entries after ob_size-d are None, to avoid keeping references + # (the above loop already set to None all items[ilow+d:old_style]) w_list.ob_size -= d + for i in range(w_list.ob_size, ilow + d): + items[i] = None # now we can destruct recycle safely, regardless of # side-effects to the list del recycle[:] Modified: pypy/dist/pypy/objspace/std/test/test_listobject.py ============================================================================== --- pypy/dist/pypy/objspace/std/test/test_listobject.py (original) +++ pypy/dist/pypy/objspace/std/test/test_listobject.py Sun May 1 19:56:09 2005 @@ -266,6 +266,27 @@ assert self.space.eq_w(self.space.le(w_list4, w_list3), self.space.w_True) + def test_no_unneeded_refs(self): + space = self.space + w = space.wrap + w_empty = W_ListObject(space, []) + + w_list = W_ListObject(space, [w(5), w(3), w(99)]) + space.setitem(w_list, space.newslice(w(0), w(3), w(None)), w_empty) + assert w_list.ob_item == [None]*len(w_list.ob_item) + + w_list = W_ListObject(space, [w(5), w(3), w(99)]) + space.delitem(w_list, space.newslice(w(0), w(3), w(None))) + assert w_list.ob_item == [None]*len(w_list.ob_item) + + w_list = W_ListObject(space, [w(5), w(3), w(99)]) + space.call_method(w_list, 'pop') + assert w_list.ob_item[2] is None + space.call_method(w_list, 'pop') + assert w_list.ob_item[1] is None + space.call_method(w_list, 'pop') + assert w_list.ob_item == [None]*len(w_list.ob_item) + class AppTestW_ListObject: def test_explicit_new_init(self): l = l0 = list.__new__(list) From arigo at codespeak.net Sun May 1 20:04:05 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Sun, 1 May 2005 20:04:05 +0200 (CEST) Subject: [pypy-svn] r11718 - pypy/dist/pypy/interpreter Message-ID: <20050501180405.C31ED27C29@code1.codespeak.net> Author: arigo Date: Sun May 1 20:04:05 2005 New Revision: 11718 Modified: pypy/dist/pypy/interpreter/error.py pypy/dist/pypy/interpreter/py.py Log: Recording interp-level tracebacks has the bad side effects of keeping more objects alive than generally expected (at least by CPython's tests). So don't record them unless py.py runs in verbose mode (-v option or PYPY_TB env var). These tracebacks are not visible without verbose mode, anyway -- not to mention not very useful at all. Modified: pypy/dist/pypy/interpreter/error.py ============================================================================== --- pypy/dist/pypy/interpreter/error.py (original) +++ pypy/dist/pypy/interpreter/error.py Sun May 1 20:04:05 2005 @@ -2,6 +2,7 @@ import os, sys AUTO_DEBUG = os.getenv('PYPY_DEBUG') +RECORD_INTERPLEVEL_TRACEBACK = False class OperationError(Exception): @@ -64,10 +65,11 @@ return None def record_interpreter_traceback(self): - """NOT_RPYTHON: Records the current traceback inside the interpreter. + """Records the current traceback inside the interpreter. This traceback is only useful to debug the interpreter, not the application.""" - self.debug_excs.append(sys.exc_info()) + if RECORD_INTERPLEVEL_TRACEBACK: + self.debug_excs.append(sys.exc_info()) def print_application_traceback(self, space, file=None): "NOT_RPYTHON: Dump a standard application-level traceback." Modified: pypy/dist/pypy/interpreter/py.py ============================================================================== --- pypy/dist/pypy/interpreter/py.py (original) +++ pypy/dist/pypy/interpreter/py.py Sun May 1 20:04:05 2005 @@ -65,6 +65,8 @@ "running py.py should not import pypy.tool.udir, which is\n" "only for testing or translating purposes.") go_interactive = Options.interactive + if Options.verbose: + error.RECORD_INTERPLEVEL_TRACEBACK = True banner = '' space.setitem(space.sys.w_dict,space.wrap('executable'),space.wrap(argv[0])) if Options.command: From arigo at codespeak.net Sun May 1 20:13:53 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Sun, 1 May 2005 20:13:53 +0200 (CEST) Subject: [pypy-svn] r11721 - pypy/dist/pypy/objspace/std/test Message-ID: <20050501181353.492E527C28@code1.codespeak.net> Author: arigo Date: Sun May 1 20:13:53 2005 New Revision: 11721 Modified: pypy/dist/pypy/objspace/std/test/test_intobject.py pypy/dist/pypy/objspace/std/test/test_strutil.py Log: 32-vs-64-bit portability. Modified: pypy/dist/pypy/objspace/std/test/test_intobject.py ============================================================================== --- pypy/dist/pypy/objspace/std/test/test_intobject.py (original) +++ pypy/dist/pypy/objspace/std/test/test_intobject.py Sun May 1 20:13:53 2005 @@ -333,6 +333,7 @@ assert int("10000000000") == 10000000000L def test_int_subclass_ctr(self): + import sys class j(int): pass assert j(100) == 100 @@ -341,8 +342,8 @@ assert j("100") == 100 assert j("100",2) == 4 assert isinstance(j("100",2),j) - raises(OverflowError,j,10000000000) - raises(OverflowError,j,"10000000000") + raises(OverflowError,j,sys.maxint+1) + raises(OverflowError,j,str(sys.maxint+1)) def test_special_int(self): class a: Modified: pypy/dist/pypy/objspace/std/test/test_strutil.py ============================================================================== --- pypy/dist/pypy/objspace/std/test/test_strutil.py (original) +++ pypy/dist/pypy/objspace/std/test/test_strutil.py Sun May 1 20:13:53 2005 @@ -85,8 +85,10 @@ raises(ParseStringError, string_to_int, space, '-'+s) def test_string_to_int_overflow(self): + import sys space = self.space - raises(ParseStringOverflowError, string_to_int, space,'1891234174197319') + raises(ParseStringOverflowError, string_to_int, space, + str(sys.maxint*17)) def test_string_to_int_base_error(self): space = self.space From pedronis at codespeak.net Sun May 1 20:14:40 2005 From: pedronis at codespeak.net (pedronis at codespeak.net) Date: Sun, 1 May 2005 20:14:40 +0200 (CEST) Subject: [pypy-svn] r11722 - in pypy/dist/pypy: interpreter translator Message-ID: <20050501181440.4961627C2F@code1.codespeak.net> Author: pedronis Date: Sun May 1 20:14:40 2005 New Revision: 11722 Modified: pypy/dist/pypy/interpreter/gateway.py pypy/dist/pypy/translator/geninterplevel.py pypy/dist/pypy/translator/gensupp.py Log: let all applevel helpers' module be called __builtin__ changes to geninterplevel to be able to translate a module with __name__='__builtin__' Modified: pypy/dist/pypy/interpreter/gateway.py ============================================================================== --- pypy/dist/pypy/interpreter/gateway.py (original) +++ pypy/dist/pypy/interpreter/gateway.py Sun May 1 20:14:40 2005 @@ -532,6 +532,7 @@ "NOT_RPYTHON" code = self._buildcode(space, self.code) w_glob = space.newdict([]) + space.setitem(w_glob, space.wrap('__name__'), space.wrap('__builtin__')) space.exec_(code, w_glob, w_glob) return w_glob @@ -569,7 +570,7 @@ """ NOT_RPYTHON_ATTRIBUTES = ['cache_path', 'known_source'] - def __init__(self, source, filename = None, modname = 'applevelinterp', do_imports=False): + def __init__(self, source, filename = None, modname = '__builtin__', do_imports=False): "NOT_RPYTHON" self.filename = filename self.source = source @@ -686,7 +687,7 @@ _setup = classmethod(_setup) def applevel(source, filename = None, - modname = 'applevelinterp', do_imports=False): + modname = '__builtin__', do_imports=False): # look at the first three lines first = source.split("\n", 3)[:3] klass = ApplevelInterpClass Modified: pypy/dist/pypy/translator/geninterplevel.py ============================================================================== --- pypy/dist/pypy/translator/geninterplevel.py (original) +++ pypy/dist/pypy/translator/geninterplevel.py Sun May 1 20:14:40 2005 @@ -19,6 +19,7 @@ from __future__ import generators import autopath, os, sys, exceptions, inspect, types import cPickle as pickle, __builtin__ +from copy_reg import _HEAPTYPE from pypy.objspace.flow.model import Variable, Constant, SpaceOperation from pypy.objspace.flow.model import FunctionGraph, Block, Link from pypy.objspace.flow.model import last_exception, last_exc_value @@ -41,7 +42,7 @@ import pypy # __path__ import py.path -GI_VERSION = '1.0.3' # bump this for substantial changes +GI_VERSION = '1.0.5' # bump this for substantial changes # ____________________________________________________________ def eval_helper(self, typename, expr): @@ -576,10 +577,10 @@ break else: raise Exception, '%r not found in any built-in module' % (func,) - if modname == '__builtin__': - # be lazy - return "(space.builtin.get(space.str_w(%s)))" % self.nameof(func.__name__) - elif modname == 'sys': + #if modname == '__builtin__': + # # be lazy + # return "(space.builtin.get(space.str_w(%s)))" % self.nameof(func.__name__) + if modname == 'sys': # be lazy return "(space.sys.get(space.str_w(%s)))" % self.nameof(func.__name__) else: @@ -729,7 +730,7 @@ if type(ret) is tuple: ret = ret[0](self, ret[1], ret[2]) return ret - assert cls.__module__ != '__builtin__', ( + assert cls.__module__ != '__builtin__' or cls.__flags__&_HEAPTYPE, ( "built-in class %r not found in typename_mapping " "while compiling %s" % (cls, self.currentfunc and self.currentfunc.__name__ or "*no function at all*")) Modified: pypy/dist/pypy/translator/gensupp.py ============================================================================== --- pypy/dist/pypy/translator/gensupp.py (original) +++ pypy/dist/pypy/translator/gensupp.py Sun May 1 20:14:40 2005 @@ -54,7 +54,8 @@ def builtin_base(obj): typ = type(obj) - while typ.__module__ != '__builtin__': + from copy_reg import _HEAPTYPE + while typ.__flags__&_HEAPTYPE: typ = typ.__base__ return typ From pedronis at codespeak.net Sun May 1 20:24:51 2005 From: pedronis at codespeak.net (pedronis at codespeak.net) Date: Sun, 1 May 2005 20:24:51 +0200 (CEST) Subject: [pypy-svn] r11723 - in pypy/dist/pypy/objspace/std: . test Message-ID: <20050501182451.883E927C31@code1.codespeak.net> Author: pedronis Date: Sun May 1 20:24:51 2005 New Revision: 11723 Modified: pypy/dist/pypy/objspace/std/test/test_typeobject.py pypy/dist/pypy/objspace/std/typeobject.py Log: if a type live in __builtin__ then always use type (not class) in its repr Modified: pypy/dist/pypy/objspace/std/test/test_typeobject.py ============================================================================== --- pypy/dist/pypy/objspace/std/test/test_typeobject.py (original) +++ pypy/dist/pypy/objspace/std/test/test_typeobject.py Sun May 1 20:24:51 2005 @@ -278,6 +278,8 @@ pass assert repr(A) == "" assert repr(type(type)) == "" + assert repr(complex) == "" + assert repr(property) == "" def test_invalid_mro(self): class A(object): Modified: pypy/dist/pypy/objspace/std/typeobject.py ============================================================================== --- pypy/dist/pypy/objspace/std/typeobject.py (original) +++ pypy/dist/pypy/objspace/std/typeobject.py Sun May 1 20:24:51 2005 @@ -253,10 +253,10 @@ mod = None else: mod = space.str_w(w_mod) - if w_obj.is_heaptype(): - kind = 'class' - else: + if not w_obj.is_heaptype() or (mod is not None and mod == '__builtin__'): kind = 'type' + else: + kind = 'class' if mod is not None and mod !='__builtin__': return space.wrap("<%s '%s.%s'>" % (kind, mod, w_obj.name)) else: From arigo at codespeak.net Sun May 1 20:42:18 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Sun, 1 May 2005 20:42:18 +0200 (CEST) Subject: [pypy-svn] r11724 - in pypy/dist: lib-python pypy pypy/tool Message-ID: <20050501184218.A2C9727C34@code1.codespeak.net> Author: arigo Date: Sun May 1 20:42:18 2005 New Revision: 11724 Modified: pypy/dist/lib-python/conftest.py pypy/dist/pypy/conftest.py pypy/dist/pypy/tool/option.py Log: Added a '--file' option similar to '--oldclass', that enables our custom file implementation. This is needed when faking isn't good enough, e.g. as in test_iter.py which does 'f.writelines()'. Modified: pypy/dist/lib-python/conftest.py ============================================================================== --- pypy/dist/lib-python/conftest.py (original) +++ pypy/dist/lib-python/conftest.py Sun May 1 20:42:18 2005 @@ -270,12 +270,14 @@ class RegrTest: """ Regression Test Declaration.""" - def __init__(self, basename, enabled=False, dumbtest=False, oldstyle=False, core=False): + def __init__(self, basename, enabled=False, dumbtest=False, + oldstyle=False, core=False, uselibfile=False): self.basename = basename self.enabled = enabled self.dumbtest = dumbtest self.oldstyle = oldstyle self.core = core + self.uselibfile = uselibfile def ismodified(self): return modtestdir.join(self.basename).check() @@ -297,11 +299,22 @@ assert fspath.check() if self.oldstyle or pypy_option.oldstyle: space.enable_old_style_classes_as_default_metaclass() + if self.uselibfile or pypy_option.uselibfile: + w_original_faked_file = space.appexec([], '''(): + from _file import file + prev = __builtins__.file + __builtins__.file = __builtins__.open = file + return prev + ''') try: callex(space, run_file, str(fspath), space) finally: if not pypy_option.oldstyle: space.enable_new_style_classes_as_default_metaclass() + if self.uselibfile and not pypy_option.uselibfile: + space.appexec([w_original_faked_file], '''(prev): + __builtins__.file = __builtins__.open = prev + ''') testmap = [ RegrTest('test___all__.py', enabled=False, core=True), @@ -455,7 +468,7 @@ RegrTest('test_inspect.py', enabled=False, dumbtest=1, core="maybe"), RegrTest('test_ioctl.py', enabled=False), RegrTest('test_isinstance.py', enabled=True, core=True), - RegrTest('test_iter.py', enabled=False, core=True), + RegrTest('test_iter.py', enabled=False, core=True, uselibfile=True), #rev 10840: Uncaught interp-level exception: Same place as test_cfgparser RegrTest('test_itertools.py', enabled=True, core=True), @@ -741,6 +754,8 @@ pypy_options = [] if regrtest.oldstyle or pypy_option.oldstyle: pypy_options.append('--oldstyle') + if regrtest.uselibfile or pypy_option.uselibfile: + pypy_options.append('--file') sopt = " ".join(pypy_options) TIMEOUT = gettimeout() @@ -781,6 +796,7 @@ print >>resultfile, "cpu mhz:", info['cpu mhz'] print >> resultfile, "oldstyle:", regrtest.oldstyle and 'yes' or 'no' + print >> resultfile, "uselibfile:", regrtest.uselibfile and 'yes' or 'no' print >> resultfile, 'pypy-revision:', getrev(pypydir) print >> resultfile, "startdate:", time.ctime() print >> resultfile, "timeout: %s seconds" %(TIMEOUT,) Modified: pypy/dist/pypy/conftest.py ============================================================================== --- pypy/dist/pypy/conftest.py (original) +++ pypy/dist/pypy/conftest.py Sun May 1 20:42:18 2005 @@ -22,6 +22,8 @@ help="object space to run tests on."), Option('--oldstyle', action="store_true",dest="oldstyle", default=False, help="enable oldstyle classes as default metaclass (std objspace only)"), + Option('--file', action="store_true",dest="uselibfile", default=False, + help="enable our custom file implementation"), Option('--allpypy', action="store_true",dest="allpypy", default=False, help="run everything possible on top of PyPy."), ) @@ -61,6 +63,11 @@ _spacecache[name] = space if name == 'std' and option.oldstyle: space.enable_old_style_classes_as_default_metaclass() + if option.uselibfile: + space.appexec([], '''(): + from _file import file + __builtins__.file = __builtins__.open = file + ''') if name != 'flow': # not sensible for flow objspace case space.setitem(space.builtin.w_dict, space.wrap('AssertionError'), pytestsupport.build_pytest_assertion(space)) Modified: pypy/dist/pypy/tool/option.py ============================================================================== --- pypy/dist/pypy/tool/option.py (original) +++ pypy/dist/pypy/tool/option.py Sun May 1 20:42:18 2005 @@ -6,6 +6,7 @@ showwarning = 0 spaces = [] oldstyle = 0 + uselibfile = 0 def run_tb_server(option, opt, value, parser): from pypy.tool import tb_server @@ -26,6 +27,9 @@ '--oldstyle', action="store_true",dest="oldstyle", help="enable oldstyle classes as default metaclass (std objspace only)")) options.append(make_option( + '--file', action="store_true",dest="uselibfile", + help="enable our custom file implementation")) + options.append(make_option( '-w', action="store_true", dest="showwarning", help="enable warnings (disabled by default)")) options.append(make_option( @@ -63,4 +67,9 @@ space = Space() if name == 'std' and Options.oldstyle: space.enable_old_style_classes_as_default_metaclass() + if Options.uselibfile: + space.appexec([], '''(): + from _file import file + __builtins__.file = __builtins__.open = file + ''') return _spacecache.setdefault(name, space) From arigo at codespeak.net Sun May 1 20:58:01 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Sun, 1 May 2005 20:58:01 +0200 (CEST) Subject: [pypy-svn] r11725 - pypy/testresult/arigo@code1.codespeak.net Message-ID: <20050501185801.8EFC527BE1@code1.codespeak.net> Author: arigo Date: Sun May 1 20:58:01 2005 New Revision: 11725 Added: pypy/testresult/arigo at code1.codespeak.net/ pypy/testresult/arigo at code1.codespeak.net/test_iter.txt Log: test_iter passes. Added: pypy/testresult/arigo at code1.codespeak.net/test_iter.txt ============================================================================== --- (empty file) +++ pypy/testresult/arigo at code1.codespeak.net/test_iter.txt Sun May 1 20:58:01 2005 @@ -0,0 +1,73 @@ +testreport-version: 1.0 +command: /usr/bin/python /home/arigo/svn/pypy/dist/pypy/tool/alarm.py 899 /home/arigo/svn/pypy/dist/pypy/interpreter/py.py --file /home/arigo/svn/pypy/dist/lib-python/2.3.4/test/test_iter.py +run by: arigo at code1.codespeak.net +sys.platform: linux2 +sys.version_info: (2, 3, 5, 'final', 0) +cpu model: AMD Opteron(tm) Processor 242 +cpu mhz: 1603.694 +oldstyle: no +uselibfile: yes +pypy-revision: 11724 +startdate: Sun May 1 20:50:29 2005 +timeout: 900.0 seconds + +============================================================ +faking +faking +faking +faking +faking +test_builtin_filter (__main__.TestCase) ... ok +test_builtin_list (__main__.TestCase) ... ok +test_builtin_map (__main__.TestCase) ... ok +test_builtin_max_min (__main__.TestCase) ... ok +test_builtin_reduce (__main__.TestCase) ... ok +test_builtin_tuple (__main__.TestCase) ... ok +test_builtin_zip (__main__.TestCase) ... ok +test_countOf (__main__.TestCase) ... ok +test_exception_function (__main__.TestCase) ... ok +test_exception_sequence (__main__.TestCase) ... ok +test_in_and_not_in (__main__.TestCase) ... ok +test_indexOf (__main__.TestCase) ... ok +test_iter_basic (__main__.TestCase) ... ok +test_iter_big_range (__main__.TestCase) ... ok +test_iter_callable (__main__.TestCase) ... ok +test_iter_class_for (__main__.TestCase) ... ok +test_iter_class_iter (__main__.TestCase) ... ok +test_iter_dict (__main__.TestCase) ... ok +test_iter_empty (__main__.TestCase) ... ok +test_iter_file (__main__.TestCase) ... ok +test_iter_for_loop (__main__.TestCase) ... ok +test_iter_function (__main__.TestCase) ... ok +test_iter_function_stop (__main__.TestCase) ... ok +test_iter_idempotency (__main__.TestCase) ... ok +test_iter_independence (__main__.TestCase) ... ok +test_iter_string (__main__.TestCase) ... ok +test_iter_tuple (__main__.TestCase) ... ok +test_iter_unicode (__main__.TestCase) ... ok +test_iter_xrange (__main__.TestCase) ... ok +test_nested_comprehensions_for (__main__.TestCase) ... ok +test_nested_comprehensions_iter (__main__.TestCase) ... ok +test_seq_class_for (__main__.TestCase) ... ok +test_seq_class_iter (__main__.TestCase) ... ok +test_sinkstate_callable (__main__.TestCase) ... ok +test_sinkstate_dict (__main__.TestCase) ... ok +test_sinkstate_enumerate (__main__.TestCase) ... ok +test_sinkstate_list (__main__.TestCase) ... ok +test_sinkstate_range (__main__.TestCase) ... ok +test_sinkstate_sequence (__main__.TestCase) ... ok +test_sinkstate_string (__main__.TestCase) ... ok +test_sinkstate_tuple (__main__.TestCase) ... ok +test_sinkstate_yield (__main__.TestCase) ... ok +test_stop_sequence (__main__.TestCase) ... ok +test_unicode_join_endcase (__main__.TestCase) ... ok +test_unpack_iter (__main__.TestCase) ... ok +test_writelines (__main__.TestCase) ... ok + +---------------------------------------------------------------------- +Ran 46 tests in 161.537s + +OK +========================== closed ========================== +execution time: 330.436001062 seconds +exit status: 0 From arigo at codespeak.net Sun May 1 21:16:18 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Sun, 1 May 2005 21:16:18 +0200 (CEST) Subject: [pypy-svn] r11726 - pypy/testresult/arigo@tismerysoft.de Message-ID: <20050501191618.0203A27C0F@code1.codespeak.net> Author: arigo Date: Sun May 1 21:16:18 2005 New Revision: 11726 Added: pypy/testresult/arigo at tismerysoft.de/test_mutants.txt Modified: pypy/testresult/arigo at tismerysoft.de/test_MimeWriter.txt pypy/testresult/arigo at tismerysoft.de/test_coercion.out pypy/testresult/arigo at tismerysoft.de/test_enumerate.txt pypy/testresult/arigo at tismerysoft.de/test_eof.txt pypy/testresult/arigo at tismerysoft.de/test_exceptions.out pypy/testresult/arigo at tismerysoft.de/test_exceptions.txt pypy/testresult/arigo at tismerysoft.de/test_extcall.txt pypy/testresult/arigo at tismerysoft.de/test_file.txt pypy/testresult/arigo at tismerysoft.de/test_filecmp.txt pypy/testresult/arigo at tismerysoft.de/test_fileinput.txt pypy/testresult/arigo at tismerysoft.de/test_fnmatch.txt pypy/testresult/arigo at tismerysoft.de/test_format.txt pypy/testresult/arigo at tismerysoft.de/test_fpformat.txt pypy/testresult/arigo at tismerysoft.de/test_funcattrs.txt pypy/testresult/arigo at tismerysoft.de/test_future.txt pypy/testresult/arigo at tismerysoft.de/test_future1.txt pypy/testresult/arigo at tismerysoft.de/test_future2.txt pypy/testresult/arigo at tismerysoft.de/test_future3.txt pypy/testresult/arigo at tismerysoft.de/test_generators.txt pypy/testresult/arigo at tismerysoft.de/test_getopt.txt pypy/testresult/arigo at tismerysoft.de/test_glob.txt pypy/testresult/arigo at tismerysoft.de/test_global.txt pypy/testresult/arigo at tismerysoft.de/test_grammar.txt pypy/testresult/arigo at tismerysoft.de/test_hash.txt pypy/testresult/arigo at tismerysoft.de/test_heapq.txt pypy/testresult/arigo at tismerysoft.de/test_hexoct.txt pypy/testresult/arigo at tismerysoft.de/test_hmac.txt pypy/testresult/arigo at tismerysoft.de/test_htmllib.txt pypy/testresult/arigo at tismerysoft.de/test_htmlparser.txt pypy/testresult/arigo at tismerysoft.de/test_httplib.txt pypy/testresult/arigo at tismerysoft.de/test_imaplib.txt pypy/testresult/arigo at tismerysoft.de/test_imp.txt pypy/testresult/arigo at tismerysoft.de/test_import.txt pypy/testresult/arigo at tismerysoft.de/test_importhooks.txt pypy/testresult/arigo at tismerysoft.de/test_inspect.txt pypy/testresult/arigo at tismerysoft.de/test_isinstance.txt pypy/testresult/arigo at tismerysoft.de/test_iter.txt pypy/testresult/arigo at tismerysoft.de/test_itertools.txt pypy/testresult/arigo at tismerysoft.de/test_long.txt pypy/testresult/arigo at tismerysoft.de/test_long_future.txt pypy/testresult/arigo at tismerysoft.de/test_longexp.txt pypy/testresult/arigo at tismerysoft.de/test_marshal.txt pypy/testresult/arigo at tismerysoft.de/test_math.txt pypy/testresult/arigo at tismerysoft.de/test_mimetools.txt pypy/testresult/arigo at tismerysoft.de/test_mimetypes.txt pypy/testresult/arigo at tismerysoft.de/test_module.txt pypy/testresult/arigo at tismerysoft.de/test_multifile.txt pypy/testresult/arigo at tismerysoft.de/test_netrc.txt pypy/testresult/arigo at tismerysoft.de/test_new.out pypy/testresult/arigo at tismerysoft.de/test_new.txt pypy/testresult/arigo at tismerysoft.de/test_opcodes.txt pypy/testresult/arigo at tismerysoft.de/test_operations.txt pypy/testresult/arigo at tismerysoft.de/test_operator.txt pypy/testresult/arigo at tismerysoft.de/test_optparse.txt pypy/testresult/arigo at tismerysoft.de/test_os.txt pypy/testresult/arigo at tismerysoft.de/test_pickle.txt pypy/testresult/arigo at tismerysoft.de/test_pickletools.txt pypy/testresult/arigo at tismerysoft.de/test_pkg.out pypy/testresult/arigo at tismerysoft.de/test_pkg.txt pypy/testresult/arigo at tismerysoft.de/test_pkgimport.txt pypy/testresult/arigo at tismerysoft.de/test_pow.txt pypy/testresult/arigo at tismerysoft.de/test_pprint.txt pypy/testresult/arigo at tismerysoft.de/test_profile.txt pypy/testresult/arigo at tismerysoft.de/test_profilehooks.txt pypy/testresult/arigo at tismerysoft.de/test_pyclbr.txt pypy/testresult/arigo at tismerysoft.de/test_repr.txt pypy/testresult/arigo at tismerysoft.de/test_rfc822.txt pypy/testresult/arigo at tismerysoft.de/test_richcmp.txt pypy/testresult/arigo at tismerysoft.de/test_robotparser.txt Log: More test results. Modified: pypy/testresult/arigo at tismerysoft.de/test_MimeWriter.txt ============================================================================== --- pypy/testresult/arigo at tismerysoft.de/test_MimeWriter.txt (original) +++ pypy/testresult/arigo at tismerysoft.de/test_MimeWriter.txt Sun May 1 21:16:18 2005 @@ -6,8 +6,8 @@ cpu model: AMD Athlon(tm) XP 3000+ cpu mhz: 2166.513 oldstyle: no -pypy-revision: 11698 -startdate: Sun May 1 18:58:42 2005 +pypy-revision: 11706 +startdate: Sun May 1 22:26:19 2005 timeout: 529.0 seconds OUTPUT TEST @@ -20,5 +20,5 @@ faking OK ========================== closed ========================== -execution time: 7.15724897385 seconds +execution time: 7.13438200951 seconds exit status: 0 Modified: pypy/testresult/arigo at tismerysoft.de/test_coercion.out ============================================================================== --- pypy/testresult/arigo at tismerysoft.de/test_coercion.out (original) +++ pypy/testresult/arigo at tismerysoft.de/test_coercion.out Sun May 1 21:16:18 2005 @@ -354,701 +354,4 @@ (2+0j) * 2 = (4+0j) (2+0j) *= 2 => (4+0j) (2+0j) / 2 = (1+0j) -(2+0j) /= 2 => (1+0j) -(2+0j) ** 2 = (4+0j) -(2+0j) **= 2 => (4+0j) -(2+0j) % 2 = 0j -(2+0j) %= 2 => 0j -(2+0j) + (2+0j) = (4+0j) -(2+0j) += (2+0j) => (4+0j) -(2+0j) - (2+0j) = 0j -(2+0j) -= (2+0j) => 0j -(2+0j) * (2+0j) = (4+0j) -(2+0j) *= (2+0j) => (4+0j) -(2+0j) / (2+0j) = (1+0j) -(2+0j) /= (2+0j) => (1+0j) -(2+0j) ** (2+0j) = (4+0j) -(2+0j) **= (2+0j) => (4+0j) -(2+0j) % (2+0j) = 0j -(2+0j) %= (2+0j) => 0j -(2+0j) + [1] ... exceptions.TypeError -(2+0j) += [1] ... exceptions.TypeError -(2+0j) - [1] ... exceptions.TypeError -(2+0j) -= [1] ... exceptions.TypeError -(2+0j) * [1] ... exceptions.TypeError -(2+0j) *= [1] ... exceptions.TypeError -(2+0j) / [1] ... exceptions.TypeError -(2+0j) /= [1] ... exceptions.TypeError -(2+0j) ** [1] ... exceptions.TypeError -(2+0j) **= [1] ... exceptions.TypeError -(2+0j) % [1] ... exceptions.TypeError -(2+0j) %= [1] ... exceptions.TypeError -(2+0j) + (2,) ... exceptions.TypeError -(2+0j) += (2,) ... exceptions.TypeError -(2+0j) - (2,) ... exceptions.TypeError -(2+0j) -= (2,) ... exceptions.TypeError -(2+0j) * (2,) ... exceptions.TypeError -(2+0j) *= (2,) ... exceptions.TypeError -(2+0j) / (2,) ... exceptions.TypeError -(2+0j) /= (2,) ... exceptions.TypeError -(2+0j) ** (2,) ... exceptions.TypeError -(2+0j) **= (2,) ... exceptions.TypeError -(2+0j) % (2,) ... exceptions.TypeError -(2+0j) %= (2,) ... exceptions.TypeError -(2+0j) + None ... exceptions.TypeError -(2+0j) += None ... exceptions.TypeError -(2+0j) - None ... exceptions.TypeError -(2+0j) -= None ... exceptions.TypeError -(2+0j) * None ... exceptions.TypeError -(2+0j) *= None ... exceptions.TypeError -(2+0j) / None ... exceptions.TypeError -(2+0j) /= None ... exceptions.TypeError -(2+0j) ** None ... exceptions.TypeError -(2+0j) **= None ... exceptions.TypeError -(2+0j) % None ... exceptions.TypeError -(2+0j) %= None ... exceptions.TypeError -(2+0j) + = (3+0j) -(2+0j) += => (3+0j) -(2+0j) - = (1+0j) -(2+0j) -= => (1+0j) -(2+0j) * = (2+0j) -(2+0j) *= => (2+0j) -(2+0j) / = (2+0j) -(2+0j) /= => (2+0j) -(2+0j) ** = (2+0j) -(2+0j) **= => (2+0j) -(2+0j) % = 0j -(2+0j) %= => 0j -(2+0j) + = (4+0j) -(2+0j) += => (4+0j) -(2+0j) - = 0j -(2+0j) -= => 0j -(2+0j) * = (4+0j) -(2+0j) *= => (4+0j) -(2+0j) / = (1+0j) -(2+0j) /= => (1+0j) -(2+0j) ** = (4+0j) -(2+0j) **= => (4+0j) -(2+0j) % = 0j -(2+0j) %= => 0j -[1] + 2 ... exceptions.TypeError -[1] += 2 ... exceptions.TypeError -[1] - 2 ... exceptions.TypeError -[1] -= 2 ... exceptions.TypeError -[1] * 2 = [1, 1] -[1] *= 2 => [1, 1] -[1] / 2 ... exceptions.TypeError -[1] /= 2 ... exceptions.TypeError -[1] ** 2 ... exceptions.TypeError -[1] **= 2 ... exceptions.TypeError -[1] % 2 ... exceptions.TypeError -[1] %= 2 ... exceptions.TypeError -[1] + 4.0 ... exceptions.TypeError -[1] += 4.0 ... exceptions.TypeError -[1] - 4.0 ... exceptions.TypeError -[1] -= 4.0 ... exceptions.TypeError -[1] * 4.0 ... exceptions.TypeError -[1] *= 4.0 ... exceptions.TypeError -[1] / 4.0 ... exceptions.TypeError -[1] /= 4.0 ... exceptions.TypeError -[1] ** 4.0 ... exceptions.TypeError -[1] **= 4.0 ... exceptions.TypeError -[1] % 4.0 ... exceptions.TypeError -[1] %= 4.0 ... exceptions.TypeError -[1] + 2 ... exceptions.TypeError -[1] += 2 ... exceptions.TypeError -[1] - 2 ... exceptions.TypeError -[1] -= 2 ... exceptions.TypeError -[1] * 2 = [1, 1] -[1] *= 2 => [1, 1] -[1] / 2 ... exceptions.TypeError -[1] /= 2 ... exceptions.TypeError -[1] ** 2 ... exceptions.TypeError -[1] **= 2 ... exceptions.TypeError -[1] % 2 ... exceptions.TypeError -[1] %= 2 ... exceptions.TypeError -[1] + (2+0j) ... exceptions.TypeError -[1] += (2+0j) ... exceptions.TypeError -[1] - (2+0j) ... exceptions.TypeError -[1] -= (2+0j) ... exceptions.TypeError -[1] * (2+0j) ... exceptions.TypeError -[1] *= (2+0j) ... exceptions.TypeError -[1] / (2+0j) ... exceptions.TypeError -[1] /= (2+0j) ... exceptions.TypeError -[1] ** (2+0j) ... exceptions.TypeError -[1] **= (2+0j) ... exceptions.TypeError -[1] % (2+0j) ... exceptions.TypeError -[1] %= (2+0j) ... exceptions.TypeError -[1] + [1] = [1, 1] -[1] += [1] => [1, 1] -[1] - [1] ... exceptions.TypeError -[1] -= [1] ... exceptions.TypeError -[1] * [1] ... exceptions.TypeError -[1] *= [1] ... exceptions.TypeError -[1] / [1] ... exceptions.TypeError -[1] /= [1] ... exceptions.TypeError -[1] ** [1] ... exceptions.TypeError -[1] **= [1] ... exceptions.TypeError -[1] % [1] ... exceptions.TypeError -[1] %= [1] ... exceptions.TypeError -[1] + (2,) ... exceptions.TypeError -[1] += (2,) => [1, 2] -[1] - (2,) ... exceptions.TypeError -[1] -= (2,) ... exceptions.TypeError -[1] * (2,) ... exceptions.TypeError -[1] *= (2,) ... exceptions.TypeError -[1] / (2,) ... exceptions.TypeError -[1] /= (2,) ... exceptions.TypeError -[1] ** (2,) ... exceptions.TypeError -[1] **= (2,) ... exceptions.TypeError -[1] % (2,) ... exceptions.TypeError -[1] %= (2,) ... exceptions.TypeError -[1] + None ... exceptions.TypeError -[1] += None ... exceptions.TypeError -[1] - None ... exceptions.TypeError -[1] -= None ... exceptions.TypeError -[1] * None ... exceptions.TypeError -[1] *= None ... exceptions.TypeError -[1] / None ... exceptions.TypeError -[1] /= None ... exceptions.TypeError -[1] ** None ... exceptions.TypeError -[1] **= None ... exceptions.TypeError -[1] % None ... exceptions.TypeError -[1] %= None ... exceptions.TypeError -[1] + ... exceptions.TypeError -[1] += ... exceptions.TypeError -[1] - ... exceptions.TypeError -[1] -= ... exceptions.TypeError -[1] * = [1] -[1] *= => [1] -[1] / ... exceptions.TypeError -[1] /= ... exceptions.TypeError -[1] ** ... exceptions.TypeError -[1] **= ... exceptions.TypeError -[1] % ... exceptions.TypeError -[1] %= ... exceptions.TypeError -[1] + ... exceptions.TypeError -[1] += ... exceptions.TypeError -[1] - ... exceptions.TypeError -[1] -= ... exceptions.TypeError -[1] * = [1, 1] -[1] *= => [1, 1] -[1] / ... exceptions.TypeError -[1] /= ... exceptions.TypeError -[1] ** ... exceptions.TypeError -[1] **= ... exceptions.TypeError -[1] % ... exceptions.TypeError -[1] %= ... exceptions.TypeError -(2,) + 2 ... exceptions.TypeError -(2,) += 2 ... exceptions.TypeError -(2,) - 2 ... exceptions.TypeError -(2,) -= 2 ... exceptions.TypeError -(2,) * 2 = (2, 2) -(2,) *= 2 => (2, 2) -(2,) / 2 ... exceptions.TypeError -(2,) /= 2 ... exceptions.TypeError -(2,) ** 2 ... exceptions.TypeError -(2,) **= 2 ... exceptions.TypeError -(2,) % 2 ... exceptions.TypeError -(2,) %= 2 ... exceptions.TypeError -(2,) + 4.0 ... exceptions.TypeError -(2,) += 4.0 ... exceptions.TypeError -(2,) - 4.0 ... exceptions.TypeError -(2,) -= 4.0 ... exceptions.TypeError -(2,) * 4.0 ... exceptions.TypeError -(2,) *= 4.0 ... exceptions.TypeError -(2,) / 4.0 ... exceptions.TypeError -(2,) /= 4.0 ... exceptions.TypeError -(2,) ** 4.0 ... exceptions.TypeError -(2,) **= 4.0 ... exceptions.TypeError -(2,) % 4.0 ... exceptions.TypeError -(2,) %= 4.0 ... exceptions.TypeError -(2,) + 2 ... exceptions.TypeError -(2,) += 2 ... exceptions.TypeError -(2,) - 2 ... exceptions.TypeError -(2,) -= 2 ... exceptions.TypeError -(2,) * 2 = (2, 2) -(2,) *= 2 => (2, 2) -(2,) / 2 ... exceptions.TypeError -(2,) /= 2 ... exceptions.TypeError -(2,) ** 2 ... exceptions.TypeError -(2,) **= 2 ... exceptions.TypeError -(2,) % 2 ... exceptions.TypeError -(2,) %= 2 ... exceptions.TypeError -(2,) + (2+0j) ... exceptions.TypeError -(2,) += (2+0j) ... exceptions.TypeError -(2,) - (2+0j) ... exceptions.TypeError -(2,) -= (2+0j) ... exceptions.TypeError -(2,) * (2+0j) ... exceptions.TypeError -(2,) *= (2+0j) ... exceptions.TypeError -(2,) / (2+0j) ... exceptions.TypeError -(2,) /= (2+0j) ... exceptions.TypeError -(2,) ** (2+0j) ... exceptions.TypeError -(2,) **= (2+0j) ... exceptions.TypeError -(2,) % (2+0j) ... exceptions.TypeError -(2,) %= (2+0j) ... exceptions.TypeError -(2,) + [1] ... exceptions.TypeError -(2,) += [1] ... exceptions.TypeError -(2,) - [1] ... exceptions.TypeError -(2,) -= [1] ... exceptions.TypeError -(2,) * [1] ... exceptions.TypeError -(2,) *= [1] ... exceptions.TypeError -(2,) / [1] ... exceptions.TypeError -(2,) /= [1] ... exceptions.TypeError -(2,) ** [1] ... exceptions.TypeError -(2,) **= [1] ... exceptions.TypeError -(2,) % [1] ... exceptions.TypeError -(2,) %= [1] ... exceptions.TypeError -(2,) + (2,) = (2, 2) -(2,) += (2,) => (2, 2) -(2,) - (2,) ... exceptions.TypeError -(2,) -= (2,) ... exceptions.TypeError -(2,) * (2,) ... exceptions.TypeError -(2,) *= (2,) ... exceptions.TypeError -(2,) / (2,) ... exceptions.TypeError -(2,) /= (2,) ... exceptions.TypeError -(2,) ** (2,) ... exceptions.TypeError -(2,) **= (2,) ... exceptions.TypeError -(2,) % (2,) ... exceptions.TypeError -(2,) %= (2,) ... exceptions.TypeError -(2,) + None ... exceptions.TypeError -(2,) += None ... exceptions.TypeError -(2,) - None ... exceptions.TypeError -(2,) -= None ... exceptions.TypeError -(2,) * None ... exceptions.TypeError -(2,) *= None ... exceptions.TypeError -(2,) / None ... exceptions.TypeError -(2,) /= None ... exceptions.TypeError -(2,) ** None ... exceptions.TypeError -(2,) **= None ... exceptions.TypeError -(2,) % None ... exceptions.TypeError -(2,) %= None ... exceptions.TypeError -(2,) + ... exceptions.TypeError -(2,) += ... exceptions.TypeError -(2,) - ... exceptions.TypeError -(2,) -= ... exceptions.TypeError -(2,) * = (2,) -(2,) *= => (2,) -(2,) / ... exceptions.TypeError -(2,) /= ... exceptions.TypeError -(2,) ** ... exceptions.TypeError -(2,) **= ... exceptions.TypeError -(2,) % ... exceptions.TypeError -(2,) %= ... exceptions.TypeError -(2,) + ... exceptions.TypeError -(2,) += ... exceptions.TypeError -(2,) - ... exceptions.TypeError -(2,) -= ... exceptions.TypeError -(2,) * = (2, 2) -(2,) *= => (2, 2) -(2,) / ... exceptions.TypeError -(2,) /= ... exceptions.TypeError -(2,) ** ... exceptions.TypeError -(2,) **= ... exceptions.TypeError -(2,) % ... exceptions.TypeError -(2,) %= ... exceptions.TypeError -None + 2 ... exceptions.TypeError -None += 2 ... exceptions.TypeError -None - 2 ... exceptions.TypeError -None -= 2 ... exceptions.TypeError -None * 2 ... exceptions.TypeError -None *= 2 ... exceptions.TypeError -None / 2 ... exceptions.TypeError -None /= 2 ... exceptions.TypeError -None ** 2 ... exceptions.TypeError -None **= 2 ... exceptions.TypeError -None % 2 ... exceptions.TypeError -None %= 2 ... exceptions.TypeError -None + 4.0 ... exceptions.TypeError -None += 4.0 ... exceptions.TypeError -None - 4.0 ... exceptions.TypeError -None -= 4.0 ... exceptions.TypeError -None * 4.0 ... exceptions.TypeError -None *= 4.0 ... exceptions.TypeError -None / 4.0 ... exceptions.TypeError -None /= 4.0 ... exceptions.TypeError -None ** 4.0 ... exceptions.TypeError -None **= 4.0 ... exceptions.TypeError -None % 4.0 ... exceptions.TypeError -None %= 4.0 ... exceptions.TypeError -None + 2 ... exceptions.TypeError -None += 2 ... exceptions.TypeError -None - 2 ... exceptions.TypeError -None -= 2 ... exceptions.TypeError -None * 2 ... exceptions.TypeError -None *= 2 ... exceptions.TypeError -None / 2 ... exceptions.TypeError -None /= 2 ... exceptions.TypeError -None ** 2 ... exceptions.TypeError -None **= 2 ... exceptions.TypeError -None % 2 ... exceptions.TypeError -None %= 2 ... exceptions.TypeError -None + (2+0j) ... exceptions.TypeError -None += (2+0j) ... exceptions.TypeError -None - (2+0j) ... exceptions.TypeError -None -= (2+0j) ... exceptions.TypeError -None * (2+0j) ... exceptions.TypeError -None *= (2+0j) ... exceptions.TypeError -None / (2+0j) ... exceptions.TypeError -None /= (2+0j) ... exceptions.TypeError -None ** (2+0j) ... exceptions.TypeError -None **= (2+0j) ... exceptions.TypeError -None % (2+0j) ... exceptions.TypeError -None %= (2+0j) ... exceptions.TypeError -None + [1] ... exceptions.TypeError -None += [1] ... exceptions.TypeError -None - [1] ... exceptions.TypeError -None -= [1] ... exceptions.TypeError -None * [1] ... exceptions.TypeError -None *= [1] ... exceptions.TypeError -None / [1] ... exceptions.TypeError -None /= [1] ... exceptions.TypeError -None ** [1] ... exceptions.TypeError -None **= [1] ... exceptions.TypeError -None % [1] ... exceptions.TypeError -None %= [1] ... exceptions.TypeError -None + (2,) ... exceptions.TypeError -None += (2,) ... exceptions.TypeError -None - (2,) ... exceptions.TypeError -None -= (2,) ... exceptions.TypeError -None * (2,) ... exceptions.TypeError -None *= (2,) ... exceptions.TypeError -None / (2,) ... exceptions.TypeError -None /= (2,) ... exceptions.TypeError -None ** (2,) ... exceptions.TypeError -None **= (2,) ... exceptions.TypeError -None % (2,) ... exceptions.TypeError -None %= (2,) ... exceptions.TypeError -None + None ... exceptions.TypeError -None += None ... exceptions.TypeError -None - None ... exceptions.TypeError -None -= None ... exceptions.TypeError -None * None ... exceptions.TypeError -None *= None ... exceptions.TypeError -None / None ... exceptions.TypeError -None /= None ... exceptions.TypeError -None ** None ... exceptions.TypeError -None **= None ... exceptions.TypeError -None % None ... exceptions.TypeError -None %= None ... exceptions.TypeError -None + ... exceptions.TypeError -None += ... exceptions.TypeError -None - ... exceptions.TypeError -None -= ... exceptions.TypeError -None * ... exceptions.TypeError -None *= ... exceptions.TypeError -None / ... exceptions.TypeError -None /= ... exceptions.TypeError -None ** ... exceptions.TypeError -None **= ... exceptions.TypeError -None % ... exceptions.TypeError -None %= ... exceptions.TypeError -None + ... exceptions.TypeError -None += ... exceptions.TypeError -None - ... exceptions.TypeError -None -= ... exceptions.TypeError -None * ... exceptions.TypeError -None *= ... exceptions.TypeError -None / ... exceptions.TypeError -None /= ... exceptions.TypeError -None ** ... exceptions.TypeError -None **= ... exceptions.TypeError -None % ... exceptions.TypeError -None %= ... exceptions.TypeError - + 2 = 3 - += 2 => 3 - - 2 = -1 - -= 2 => -1 - * 2 = 2 - *= 2 => 2 - / 2 = 0 - /= 2 => 0 - ** 2 = 1 - **= 2 => 1 - % 2 = 1 - %= 2 => 1 - + 4.0 = 5.0 - += 4.0 => 5.0 - - 4.0 = -3.0 - -= 4.0 => -3.0 - * 4.0 = 4.0 - *= 4.0 => 4.0 - / 4.0 = 0.25 - /= 4.0 => 0.25 - ** 4.0 = 1.0 - **= 4.0 => 1.0 - % 4.0 = 1.0 - %= 4.0 => 1.0 - + 2 = 3 - += 2 => 3 - - 2 = -1 - -= 2 => -1 - * 2 = 2 - *= 2 => 2 - / 2 = 0 - /= 2 => 0 - ** 2 = 1 - **= 2 => 1 - % 2 = 1 - %= 2 => 1 - + (2+0j) = (3+0j) - += (2+0j) => (3+0j) - - (2+0j) = (-1+0j) - -= (2+0j) => (-1+0j) - * (2+0j) ... exceptions.KeyboardInterrupt - *= (2+0j) => (2+0j) - / (2+0j) = (0.5+0j) - /= (2+0j) => (0.5+0j) - ** (2+0j) = (1+0j) - **= (2+0j) => (1+0j) - % (2+0j) = (1+0j) - %= (2+0j) => (1+0j) - + [1] ... exceptions.TypeError - += [1] ... exceptions.TypeError - - [1] ... exceptions.TypeError - -= [1] ... exceptions.TypeError - * [1] = [1] - *= [1] => [1] - / [1] ... exceptions.TypeError - /= [1] ... exceptions.TypeError - ** [1] ... exceptions.TypeError - **= [1] ... exceptions.TypeError - % [1] ... exceptions.TypeError - %= [1] ... exceptions.TypeError - + (2,) ... exceptions.TypeError - += (2,) ... exceptions.TypeError - - (2,) ... exceptions.TypeError - -= (2,) ... exceptions.TypeError - * (2,) = (2,) - *= (2,) => (2,) - / (2,) ... exceptions.TypeError - /= (2,) ... exceptions.TypeError - ** (2,) ... exceptions.TypeError - **= (2,) ... exceptions.TypeError - % (2,) ... exceptions.TypeError - %= (2,) ... exceptions.TypeError - + None ... exceptions.TypeError - += None ... exceptions.TypeError - - None ... exceptions.TypeError - -= None ... exceptions.TypeError - * None ... exceptions.TypeError - *= None ... exceptions.TypeError - / None ... exceptions.TypeError - /= None ... exceptions.TypeError - ** None ... exceptions.TypeError - **= None ... exceptions.TypeError - % None ... exceptions.TypeError - %= None ... exceptions.TypeError - + = 2 - += => 2 - - = 0 - -= => 0 - * = 1 - *= => 1 - / = 1 - /= => 1 - ** = 1 - **= => 1 - % = 0 - %= => 0 - + = 3 - += => 3 - - = -1 - -= => -1 - * = 2 - *= => 2 - / = 0 - /= => 0 - ** = 1 - **= => 1 - % = 1 - %= => 1 - + 2 = 4 - += 2 => 4 - - 2 = 0 - -= 2 => 0 - * 2 = 4 - *= 2 => 4 - / 2 = 1 - /= 2 => 1 - ** 2 = 4 - **= 2 => 4 - % 2 = 0 - %= 2 => 0 - + 4.0 = 6.0 - += 4.0 => 6.0 - - 4.0 = -2.0 - -= 4.0 => -2.0 - * 4.0 = 8.0 - *= 4.0 => 8.0 - / 4.0 = 0.5 - /= 4.0 => 0.5 - ** 4.0 = 16.0 - **= 4.0 => 16.0 - % 4.0 = 2.0 - %= 4.0 => 2.0 - + 2 = 4 - += 2 => 4 - - 2 = 0 - -= 2 => 0 - * 2 = 4 - *= 2 => 4 - / 2 = 1 - /= 2 => 1 - ** 2 = 4 - **= 2 => 4 - % 2 = 0 - %= 2 => 0 - + (2+0j) = (4+0j) - += (2+0j) => (4+0j) - - (2+0j) = 0j - -= (2+0j) => 0j - * (2+0j) = (4+0j) - *= (2+0j) => (4+0j) - / (2+0j) = (1+0j) - /= (2+0j) => (1+0j) - ** (2+0j) = (4+0j) - **= (2+0j) => (4+0j) - % (2+0j) = 0j - %= (2+0j) => 0j - + [1] ... exceptions.TypeError - += [1] ... exceptions.TypeError - - [1] ... exceptions.TypeError - -= [1] ... exceptions.TypeError - * [1] = [1, 1] - *= [1] => [1, 1] - / [1] ... exceptions.TypeError - /= [1] ... exceptions.TypeError - ** [1] ... exceptions.TypeError - **= [1] ... exceptions.TypeError - % [1] ... exceptions.TypeError - %= [1] ... exceptions.TypeError - + (2,) ... exceptions.TypeError - += (2,) ... exceptions.TypeError - - (2,) ... exceptions.TypeError - -= (2,) ... exceptions.TypeError - * (2,) = (2, 2) - *= (2,) => (2, 2) - / (2,) ... exceptions.TypeError - /= (2,) ... exceptions.TypeError - ** (2,) ... exceptions.TypeError - **= (2,) ... exceptions.TypeError - % (2,) ... exceptions.TypeError - %= (2,) ... exceptions.TypeError - + None ... exceptions.TypeError - += None ... exceptions.TypeError - - None ... exceptions.TypeError - -= None ... exceptions.TypeError - * None ... exceptions.TypeError - *= None ... exceptions.TypeError - / None ... exceptions.TypeError - /= None ... exceptions.TypeError - ** None ... exceptions.TypeError - **= None ... exceptions.TypeError - % None ... exceptions.TypeError - %= None ... exceptions.TypeError - + = 3 - += => 3 - - = 1 - -= => 1 - * = 2 - *= => 2 - / = 2 - /= => 2 - ** = 2 - **= => 2 - % = 0 - %= => 0 - + = 4 - += => 4 - - = 0 - -= => 0 - * = 4 - *= => 4 - / = 1 - /= => 1 - ** = 4 - **= => 4 - % = 0 - %= => 0 -divmod(2, 2) = (1, 0) -divmod(2, 4.0) = (0.0, 2.0) -divmod(2, 2) = (1L, 0L) -divmod(2, (2+0j)) = ((1+0j), 0j) -divmod(2, [1]) ... exceptions.TypeError -divmod(2, (2,)) ... exceptions.TypeError -divmod(2, None) ... exceptions.TypeError -divmod(2, ) ... exceptions.TypeError -divmod(2, ) = (1, 0) -divmod(4.0, 2) = (2.0, 0.0) -divmod(4.0, 4.0) = (1.0, 0.0) -divmod(4.0, 2) = (2.0, 0.0) -divmod(4.0, (2+0j)) = ((2+0j), 0j) -divmod(4.0, [1]) ... exceptions.TypeError -divmod(4.0, (2,)) ... exceptions.TypeError -divmod(4.0, None) ... exceptions.TypeError -divmod(4.0, ) ... exceptions.TypeError -divmod(4.0, ) = (2.0, 0.0) -divmod(2, 2) = (1L, 0L) -divmod(2, 4.0) = (0.0, 2.0) -divmod(2, 2) = (1L, 0L) -divmod(2, (2+0j)) = ((1+0j), 0j) -divmod(2, [1]) ... exceptions.TypeError -divmod(2, (2,)) ... exceptions.TypeError -divmod(2, None) ... exceptions.TypeError -divmod(2, ) ... exceptions.TypeError -divmod(2, ) = (1L, 0L) -divmod((2+0j), 2) = ((1+0j), 0j) -divmod((2+0j), 4.0) = (0j, (2+0j)) -divmod((2+0j), 2) = ((1+0j), 0j) -divmod((2+0j), (2+0j)) = ((1+0j), 0j) -divmod((2+0j), [1]) ... exceptions.TypeError -divmod((2+0j), (2,)) ... exceptions.TypeError -divmod((2+0j), None) ... exceptions.TypeError -divmod((2+0j), ) ... exceptions.TypeError -divmod((2+0j), ) = ((1+0j), 0j) -divmod([1], 2) ... exceptions.TypeError -divmod([1], 4.0) ... exceptions.TypeError -divmod([1], 2) ... exceptions.TypeError -divmod([1], (2+0j)) ... exceptions.TypeError -divmod([1], [1]) ... exceptions.TypeError -divmod([1], (2,)) ... exceptions.TypeError -divmod([1], None) ... exceptions.TypeError -divmod([1], ) ... exceptions.TypeError -divmod([1], ) ... exceptions.TypeError -divmod((2,), 2) ... exceptions.TypeError -divmod((2,), 4.0) ... exceptions.TypeError -divmod((2,), 2) ... exceptions.TypeError -divmod((2,), (2+0j)) ... exceptions.TypeError -divmod((2,), [1]) ... exceptions.TypeError -divmod((2,), (2,)) ... exceptions.TypeError -divmod((2,), None) ... exceptions.TypeError -divmod((2,), ) ... exceptions.TypeError -divmod((2,), ) ... exceptions.TypeError -divmod(None, 2) ... exceptions.TypeError -divmod(None, 4.0) ... exceptions.TypeError -divmod(None, 2) ... exceptions.TypeError -divmod(None, (2+0j)) ... exceptions.TypeError -divmod(None, [1]) ... exceptions.TypeError -divmod(None, (2,)) ... exceptions.TypeError -divmod(None, None) ... exceptions.TypeError -divmod(None, ) ... exceptions.TypeError -divmod(None, ) ... exceptions.TypeError -divmod(, 2) ... exceptions.TypeError -divmod(, 4.0) ... exceptions.TypeError -divmod(, 2) ... exceptions.TypeError -divmod(, (2+0j)) ... exceptions.TypeError -divmod(, [1]) ... exceptions.TypeError -divmod(, (2,)) ... exceptions.TypeError -divmod(, None) ... exceptions.TypeError -divmod(, ) ... exceptions.TypeError -divmod(, ) ... exceptions.TypeError -divmod(, 2) = (1, 0) -divmod(, 4.0) = (0.0, 2.0) -divmod(, 2) = (1L, 0L) -divmod(, (2+0j)) = ((1+0j), 0j) -divmod(, [1]) ... exceptions.TypeError -divmod(, (2,)) ... exceptions.TypeError -divmod(, None) ... exceptions.TypeError -divmod(, ) ... exceptions.TypeError -divmod(, ) = (1, 0) +(2+0j) /= 2 => \ No newline at end of file Modified: pypy/testresult/arigo at tismerysoft.de/test_enumerate.txt ============================================================================== --- pypy/testresult/arigo at tismerysoft.de/test_enumerate.txt (original) +++ pypy/testresult/arigo at tismerysoft.de/test_enumerate.txt Sun May 1 21:16:18 2005 @@ -6,8 +6,8 @@ cpu model: AMD Athlon(tm) XP 3000+ cpu mhz: 2166.513 oldstyle: no -pypy-revision: 11698 -startdate: Sun May 1 18:03:12 2005 +pypy-revision: 11706 +startdate: Sun May 1 21:19:49 2005 timeout: 529.0 seconds ============================================================ @@ -50,9 +50,9 @@ test_noniterable (__main__.TestBig) ... ok ---------------------------------------------------------------------- -Ran 32 tests in 13.974s +Ran 32 tests in 13.906s OK ========================== closed ========================== -execution time: 30.3484811783 seconds +execution time: 30.2638449669 seconds exit status: 0 Modified: pypy/testresult/arigo at tismerysoft.de/test_eof.txt ============================================================================== --- pypy/testresult/arigo at tismerysoft.de/test_eof.txt (original) +++ pypy/testresult/arigo at tismerysoft.de/test_eof.txt Sun May 1 21:16:18 2005 @@ -1,14 +1,14 @@ testreport-version: 1.0 -command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 576 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python-2.3.4/test/test_eof.py +command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 529 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/2.3.4/test/test_eof.py run by: arigo at tismerysoft.de sys.platform: linux2 sys.version_info: (2, 3, 5, 'final', 0) cpu model: AMD Athlon(tm) XP 3000+ cpu mhz: 2166.513 oldstyle: no -pypy-revision: 11638 -startdate: Sat Apr 30 02:58:53 2005 -timeout: 576.0 seconds +pypy-revision: 11706 +startdate: Sun May 1 21:20:20 2005 +timeout: 529.0 seconds ============================================================ faking @@ -17,13 +17,13 @@ faking faking Traceback (application-level): - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_eof.py", line 32 in ? + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_eof.py", line 32 in ? test_main() - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_eof.py", line 29 in test_main + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_eof.py", line 29 in test_main test_support.run_unittest(EOFTestCase) - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_support.py", line 262 in run_unittest + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_support.py", line 262 in run_unittest run_suite(suite, testclass) - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_support.py", line 246 in run_suite + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_support.py", line 246 in run_suite raise TestFailed(msg) TestFailed: errors occurred in __main__.EOFTestCase test_EOFC (__main__.EOFTestCase) ... FAIL @@ -33,9 +33,9 @@ FAIL: test_EOFC (__main__.EOFTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_eof.py", line 15, in test_EOFC + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_eof.py", line 15, in test_EOFC "EOL while scanning single-quoted string (line 1)") - File "/home/arigo/pypysrc/lib-python-2.3.4/unittest.py", line 302, in failUnlessEqual + File "/home/arigo/pypysrc/lib-python/2.3.4/unittest.py", line 302, in failUnlessEqual raise self.failureException, \ AssertionError: 'EOL while scanning single-quoted string (, line 1)' != 'EOL while scanning single-quoted string (line 1)' @@ -43,16 +43,16 @@ FAIL: test_EOFS (__main__.EOFTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_eof.py", line 24, in test_EOFS + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_eof.py", line 24, in test_EOFS "EOF while scanning triple-quoted string (line 1)") - File "/home/arigo/pypysrc/lib-python-2.3.4/unittest.py", line 302, in failUnlessEqual + File "/home/arigo/pypysrc/lib-python/2.3.4/unittest.py", line 302, in failUnlessEqual raise self.failureException, \ AssertionError: 'EOF while scanning triple-quoted string (, line 1)' != 'EOF while scanning triple-quoted string (line 1)' ---------------------------------------------------------------------- -Ran 2 tests in 3.048s +Ran 2 tests in 3.094s FAILED (failures=2) ========================== closed ========================== -execution time: 10.722853899 seconds +execution time: 11.4479870796 seconds exit status: 1 Modified: pypy/testresult/arigo at tismerysoft.de/test_exceptions.out ============================================================================== --- pypy/testresult/arigo at tismerysoft.de/test_exceptions.out (original) +++ pypy/testresult/arigo at tismerysoft.de/test_exceptions.out Sun May 1 21:16:18 2005 @@ -1 +1,24 @@ test_exceptions +5. Built-in exceptions +spam + +spam + +errno=None args=('spam',) strerror=None filename=None + +spam + +spam + +'spam' + +spam + +(not testable in a script) +spam + +(not safe to test) +spam + +spam + Modified: pypy/testresult/arigo at tismerysoft.de/test_exceptions.txt ============================================================================== --- pypy/testresult/arigo at tismerysoft.de/test_exceptions.txt (original) +++ pypy/testresult/arigo at tismerysoft.de/test_exceptions.txt Sun May 1 21:16:18 2005 @@ -1,25 +1,31 @@ testreport-version: 1.0 -command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 575 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/pypy/lib/test2/test_exceptions.py +command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 529 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/2.3.4/test/test_exceptions.py run by: arigo at tismerysoft.de sys.platform: linux2 sys.version_info: (2, 3, 5, 'final', 0) cpu model: AMD Athlon(tm) XP 3000+ cpu mhz: 2166.513 oldstyle: no -pypy-revision: 11638 -startdate: Sat Apr 30 02:59:26 2005 -timeout: 576.0 seconds +pypy-revision: 11706 +startdate: Sun May 1 21:20:32 2005 +timeout: 529.0 seconds OUTPUT TEST -see output in: /home/arigo/pypysrc/lib-python-2.3.4/test/result/arigo at tismerysoft.de/test_exceptions.out +see output in: /home/arigo/pypysrc/testresult/arigo at tismerysoft.de/test_exceptions.out ============================================================ faking faking +faking +faking +faking +faking +faking +==========================timeout========================== Traceback (application-level): - File "/home/arigo/pypysrc/pypy/lib/test2/test_exceptions.py", line 1 in ? -import autopath -ImportError: autopath + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_exceptions.py", line 95 in ? + while 1: x = x+x +KeyboardInterrupt FAILED: test output differs ========================== closed ========================== -execution time: 0.902293920517 seconds +execution time: 529.776621103 seconds exit status: 1 Modified: pypy/testresult/arigo at tismerysoft.de/test_extcall.txt ============================================================================== --- pypy/testresult/arigo at tismerysoft.de/test_extcall.txt (original) +++ pypy/testresult/arigo at tismerysoft.de/test_extcall.txt Sun May 1 21:16:18 2005 @@ -1,17 +1,17 @@ testreport-version: 1.0 -command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 576 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python-2.3.4/test/test_extcall.py +command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 529 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/2.3.4/test/test_extcall.py run by: arigo at tismerysoft.de sys.platform: linux2 sys.version_info: (2, 3, 5, 'final', 0) cpu model: AMD Athlon(tm) XP 3000+ cpu mhz: 2166.513 oldstyle: no -pypy-revision: 11638 -startdate: Sat Apr 30 02:59:27 2005 -timeout: 576.0 seconds +pypy-revision: 11706 +startdate: Sun May 1 21:29:22 2005 +timeout: 529.0 seconds OUTPUT TEST -see output in: /home/arigo/pypysrc/lib-python-2.3.4/test/result/arigo at tismerysoft.de/test_extcall.out +see output in: /home/arigo/pypysrc/testresult/arigo at tismerysoft.de/test_extcall.out ============================================================ faking faking @@ -20,5 +20,5 @@ faking FAILED: test output differs ========================== closed ========================== -execution time: 103.609025955 seconds +execution time: 104.529972076 seconds exit status: 0 Modified: pypy/testresult/arigo at tismerysoft.de/test_file.txt ============================================================================== --- pypy/testresult/arigo at tismerysoft.de/test_file.txt (original) +++ pypy/testresult/arigo at tismerysoft.de/test_file.txt Sun May 1 21:16:18 2005 @@ -1,13 +1,13 @@ testreport-version: 1.0 -command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 575 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/pypy/lib/test2/test_file.py +command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 576 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/2.3.4/test/test_file.py run by: arigo at tismerysoft.de sys.platform: linux2 sys.version_info: (2, 3, 5, 'final', 0) cpu model: AMD Athlon(tm) XP 3000+ cpu mhz: 2166.513 oldstyle: no -pypy-revision: 11638 -startdate: Sat Apr 30 03:01:13 2005 +pypy-revision: 11706 +startdate: Sun May 1 21:31:08 2005 timeout: 576.0 seconds ============================================================ @@ -16,10 +16,43 @@ faking faking faking -Traceback (application-level): - File "/home/arigo/pypysrc/pypy/lib/test2/test_file.py", line 2 in ? -import autopath -ImportError: autopath +faking +Traceback (most recent call last): + File "/home/arigo/pypysrc/pypy/interpreter/py.py", line 78, in main_ + main.run_file(args[0], space) + File "/home/arigo/svn/pypy/dist/pypy/interpreter/main.py", line 59, in run_file + File "/home/arigo/svn/pypy/dist/pypy/interpreter/main.py", line 50, in run_string + File "/home/arigo/svn/pypy/dist/pypy/interpreter/main.py", line 39, in _run_eval_string + File "/home/arigo/pypysrc/pypy/interpreter/eval.py", line 24, in exec_code + return frame.run() + File "/home/arigo/pypysrc/pypy/interpreter/eval.py", line 70, in resume + result = self.eval(executioncontext) + File "/home/arigo/pypysrc/pypy/interpreter/pyframe.py", line 97, in eval + self.dispatch() + File "/home/arigo/pypysrc/pypy/interpreter/pyopcode.py", line 54, in dispatch + fn(self, oparg) + File "/home/arigo/pypysrc/pypy/interpreter/pyopcode.py", line 639, in CALL_FUNCTION + w_result = f.space.call_args(w_function, args) + File "/home/arigo/pypysrc/pypy/objspace/descroperation.py", line 99, in call_args + return space.get_and_call_args(w_descr, w_obj, args) + File "/home/arigo/pypysrc/pypy/objspace/descroperation.py", line 80, in get_and_call_args + return descr.call_args(args.prepend(w_obj)) + File "/home/arigo/pypysrc/pypy/interpreter/function.py", line 40, in call_args + return frame.run() + File "/home/arigo/pypysrc/pypy/interpreter/gateway.py", line 249, in run + w_result = self._run() + File "", line 3, in _run_UWS_Method_Arguments + File "/home/arigo/pypysrc/pypy/interpreter/function.py", line 180, in descr_method_call + return self.call_args(__args__) + File "/home/arigo/pypysrc/pypy/interpreter/function.py", line 163, in call_args + return self.space.call_args(self.w_function, args) + File "/home/arigo/pypysrc/pypy/objspace/descroperation.py", line 92, in call_args + return w_obj.call_args(args) + File "/home/arigo/pypysrc/pypy/interpreter/function.py", line 39, in call_args + frame.setfastscope(scope_w) + File "/home/arigo/pypysrc/pypy/objspace/std/fake.py", line 133, in setfastscope + raise UnwrapError('calling %s: %s' % (self.code.cpy_callable, e)) +pypy.objspace.std.model.UnwrapError: calling : cannot unwrap > ========================== closed ========================== -execution time: 3.13140892982 seconds +execution time: 5.33077383041 seconds exit status: 1 Modified: pypy/testresult/arigo at tismerysoft.de/test_filecmp.txt ============================================================================== --- pypy/testresult/arigo at tismerysoft.de/test_filecmp.txt (original) +++ pypy/testresult/arigo at tismerysoft.de/test_filecmp.txt Sun May 1 21:16:18 2005 @@ -1,14 +1,14 @@ testreport-version: 1.0 -command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 575 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/2.3.4/test/test_filecmp.py +command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 529 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/2.3.4/test/test_filecmp.py run by: arigo at tismerysoft.de sys.platform: linux2 sys.version_info: (2, 3, 5, 'final', 0) cpu model: AMD Athlon(tm) XP 3000+ cpu mhz: 2166.513 oldstyle: no -pypy-revision: 11698 -startdate: Sun May 1 18:04:04 2005 -timeout: 576.0 seconds +pypy-revision: 11706 +startdate: Sun May 1 21:31:14 2005 +timeout: 529.0 seconds ============================================================ faking @@ -22,9 +22,9 @@ test_dircmp (__main__.DirCompareTestCase) ... ok ---------------------------------------------------------------------- -Ran 4 tests in 3.920s +Ran 4 tests in 3.940s OK ========================== closed ========================== -execution time: 13.5399870872 seconds +execution time: 13.5542631149 seconds exit status: 0 Modified: pypy/testresult/arigo at tismerysoft.de/test_fileinput.txt ============================================================================== --- pypy/testresult/arigo at tismerysoft.de/test_fileinput.txt (original) +++ pypy/testresult/arigo at tismerysoft.de/test_fileinput.txt Sun May 1 21:16:18 2005 @@ -1,13 +1,13 @@ testreport-version: 1.0 -command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 576 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/2.3.4/test/test_fileinput.py +command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 575 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/2.3.4/test/test_fileinput.py run by: arigo at tismerysoft.de sys.platform: linux2 sys.version_info: (2, 3, 5, 'final', 0) cpu model: AMD Athlon(tm) XP 3000+ cpu mhz: 2166.513 oldstyle: no -pypy-revision: 11698 -startdate: Sun May 1 18:04:18 2005 +pypy-revision: 11706 +startdate: Sun May 1 21:31:28 2005 timeout: 576.0 seconds ============================================================ @@ -35,5 +35,5 @@ 13. 0-byte files 14. Files that don't end with newline ========================== closed ========================== -execution time: 25.6576089859 seconds +execution time: 25.7077879906 seconds exit status: 0 Modified: pypy/testresult/arigo at tismerysoft.de/test_fnmatch.txt ============================================================================== --- pypy/testresult/arigo at tismerysoft.de/test_fnmatch.txt (original) +++ pypy/testresult/arigo at tismerysoft.de/test_fnmatch.txt Sun May 1 21:16:18 2005 @@ -1,14 +1,14 @@ testreport-version: 1.0 -command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 529 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/2.3.4/test/test_fnmatch.py +command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 576 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/2.3.4/test/test_fnmatch.py run by: arigo at tismerysoft.de sys.platform: linux2 sys.version_info: (2, 3, 5, 'final', 0) cpu model: AMD Athlon(tm) XP 3000+ cpu mhz: 2166.513 oldstyle: no -pypy-revision: 11698 -startdate: Sun May 1 18:04:44 2005 -timeout: 529.0 seconds +pypy-revision: 11706 +startdate: Sun May 1 21:31:53 2005 +timeout: 576.0 seconds ============================================================ faking @@ -23,9 +23,9 @@ test_fnmatch (__main__.FnmatchTestCase) ... ok ---------------------------------------------------------------------- -Ran 1 test in 9.624s +Ran 1 test in 9.576s OK ========================== closed ========================== -execution time: 17.7913730145 seconds +execution time: 17.7435419559 seconds exit status: 0 Modified: pypy/testresult/arigo at tismerysoft.de/test_format.txt ============================================================================== --- pypy/testresult/arigo at tismerysoft.de/test_format.txt (original) +++ pypy/testresult/arigo at tismerysoft.de/test_format.txt Sun May 1 21:16:18 2005 @@ -1,14 +1,14 @@ testreport-version: 1.0 -command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 575 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python-2.3.4/test/test_format.py +command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 529 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/2.3.4/test/test_format.py run by: arigo at tismerysoft.de sys.platform: linux2 sys.version_info: (2, 3, 5, 'final', 0) cpu model: AMD Athlon(tm) XP 3000+ cpu mhz: 2166.513 oldstyle: no -pypy-revision: 11638 -startdate: Sat Apr 30 03:02:17 2005 -timeout: 576.0 seconds +pypy-revision: 11706 +startdate: Sun May 1 21:32:11 2005 +timeout: 529.0 seconds ============================================================ faking @@ -229,7 +229,7 @@ '%#X' % 1L =? '0X1' ... yes u'%#X' % 1L =? '0X1' ... yes '%Traceback (application-level): - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_format.py", line 236 in ? + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_format.py", line 236 in ? "%*d"%(sys.maxint, -127) OverflowError: repeated string is too long: 1 2147483643 #o' % 1 =? '01' ... yes @@ -278,5 +278,5 @@ u'no format' % '1' works? ... yes u'no format' % u'1' works? ... yes ========================== closed ========================== -execution time: 142.686130047 seconds +execution time: 143.257925987 seconds exit status: 1 Modified: pypy/testresult/arigo at tismerysoft.de/test_fpformat.txt ============================================================================== --- pypy/testresult/arigo at tismerysoft.de/test_fpformat.txt (original) +++ pypy/testresult/arigo at tismerysoft.de/test_fpformat.txt Sun May 1 21:16:18 2005 @@ -6,8 +6,8 @@ cpu model: AMD Athlon(tm) XP 3000+ cpu mhz: 2166.513 oldstyle: no -pypy-revision: 11698 -startdate: Sun May 1 18:05:02 2005 +pypy-revision: 11706 +startdate: Sun May 1 21:34:35 2005 timeout: 529.0 seconds ============================================================ @@ -25,9 +25,9 @@ test_reasonable_values (__main__.FpformatTest) ... ok ---------------------------------------------------------------------- -Ran 3 tests in 181.977s +Ran 3 tests in 181.921s OK ========================== closed ========================== -execution time: 193.126558065 seconds +execution time: 193.066423893 seconds exit status: 0 Modified: pypy/testresult/arigo at tismerysoft.de/test_funcattrs.txt ============================================================================== --- pypy/testresult/arigo at tismerysoft.de/test_funcattrs.txt (original) +++ pypy/testresult/arigo at tismerysoft.de/test_funcattrs.txt Sun May 1 21:16:18 2005 @@ -1,14 +1,14 @@ testreport-version: 1.0 -command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 529 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/modified-2.3.4/test/test_funcattrs.py +command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 484 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/modified-2.3.4/test/test_funcattrs.py run by: arigo at tismerysoft.de sys.platform: linux2 sys.version_info: (2, 3, 5, 'final', 0) cpu model: AMD Athlon(tm) XP 3000+ cpu mhz: 2166.513 oldstyle: no -pypy-revision: 11698 -startdate: Sun May 1 18:08:15 2005 -timeout: 529.0 seconds +pypy-revision: 11706 +startdate: Sun May 1 21:37:49 2005 +timeout: 484.0 seconds ============================================================ faking @@ -17,5 +17,5 @@ faking faking ========================== closed ========================== -execution time: 6.38545703888 seconds +execution time: 6.39410591125 seconds exit status: 0 Modified: pypy/testresult/arigo at tismerysoft.de/test_future.txt ============================================================================== --- pypy/testresult/arigo at tismerysoft.de/test_future.txt (original) +++ pypy/testresult/arigo at tismerysoft.de/test_future.txt Sun May 1 21:16:18 2005 @@ -6,8 +6,8 @@ cpu model: AMD Athlon(tm) XP 3000+ cpu mhz: 2166.513 oldstyle: no -pypy-revision: 11698 -startdate: Sun May 1 18:08:22 2005 +pypy-revision: 11706 +startdate: Sun May 1 21:37:55 2005 timeout: 529.0 seconds OUTPUT TEST @@ -24,5 +24,5 @@ faking OK ========================== closed ========================== -execution time: 8.66765093803 seconds +execution time: 8.70876193047 seconds exit status: 0 Modified: pypy/testresult/arigo at tismerysoft.de/test_future1.txt ============================================================================== --- pypy/testresult/arigo at tismerysoft.de/test_future1.txt (original) +++ pypy/testresult/arigo at tismerysoft.de/test_future1.txt Sun May 1 21:16:18 2005 @@ -6,8 +6,8 @@ cpu model: AMD Athlon(tm) XP 3000+ cpu mhz: 2166.513 oldstyle: no -pypy-revision: 11698 -startdate: Sun May 1 18:08:31 2005 +pypy-revision: 11706 +startdate: Sun May 1 21:38:04 2005 timeout: 529.0 seconds ============================================================ @@ -16,5 +16,5 @@ faking 6 ========================== closed ========================== -execution time: 0.966984033585 seconds +execution time: 0.966811180115 seconds exit status: 0 Modified: pypy/testresult/arigo at tismerysoft.de/test_future2.txt ============================================================================== --- pypy/testresult/arigo at tismerysoft.de/test_future2.txt (original) +++ pypy/testresult/arigo at tismerysoft.de/test_future2.txt Sun May 1 21:16:18 2005 @@ -1,13 +1,13 @@ testreport-version: 1.0 -command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 575 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/2.3.4/test/test_future2.py +command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 576 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/2.3.4/test/test_future2.py run by: arigo at tismerysoft.de sys.platform: linux2 sys.version_info: (2, 3, 5, 'final', 0) cpu model: AMD Athlon(tm) XP 3000+ cpu mhz: 2166.513 oldstyle: no -pypy-revision: 11698 -startdate: Sun May 1 18:08:32 2005 +pypy-revision: 11706 +startdate: Sun May 1 21:38:06 2005 timeout: 576.0 seconds ============================================================ @@ -16,5 +16,5 @@ faking 6 ========================== closed ========================== -execution time: 1.71648097038 seconds +execution time: 1.7136900425 seconds exit status: 0 Modified: pypy/testresult/arigo at tismerysoft.de/test_future3.txt ============================================================================== --- pypy/testresult/arigo at tismerysoft.de/test_future3.txt (original) +++ pypy/testresult/arigo at tismerysoft.de/test_future3.txt Sun May 1 21:16:18 2005 @@ -1,13 +1,13 @@ testreport-version: 1.0 -command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 528 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/2.3.4/test/test_future3.py +command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 529 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/2.3.4/test/test_future3.py run by: arigo at tismerysoft.de sys.platform: linux2 sys.version_info: (2, 3, 5, 'final', 0) cpu model: AMD Athlon(tm) XP 3000+ cpu mhz: 2166.513 oldstyle: no -pypy-revision: 11698 -startdate: Sun May 1 18:08:34 2005 +pypy-revision: 11706 +startdate: Sun May 1 21:38:08 2005 timeout: 529.0 seconds ============================================================ @@ -21,9 +21,9 @@ test_true_div_as_default (__main__.TestFuture) ... ok ---------------------------------------------------------------------- -Ran 3 tests in 1.096s +Ran 3 tests in 1.098s OK ========================== closed ========================== -execution time: 8.29209589958 seconds +execution time: 8.31226682663 seconds exit status: 0 Modified: pypy/testresult/arigo at tismerysoft.de/test_generators.txt ============================================================================== --- pypy/testresult/arigo at tismerysoft.de/test_generators.txt (original) +++ pypy/testresult/arigo at tismerysoft.de/test_generators.txt Sun May 1 21:16:18 2005 @@ -1,13 +1,13 @@ testreport-version: 1.0 -command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 529 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python-2.3.4/test/test_generators.py +command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 528 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/2.3.4/test/test_generators.py run by: arigo at tismerysoft.de sys.platform: linux2 sys.version_info: (2, 3, 5, 'final', 0) cpu model: AMD Athlon(tm) XP 3000+ cpu mhz: 2166.513 oldstyle: no -pypy-revision: 11638 -startdate: Sat Apr 30 03:08:30 2005 +pypy-revision: 11706 +startdate: Sun May 1 21:38:16 2005 timeout: 529.0 seconds ============================================================ @@ -21,15 +21,10 @@ faking faking ***************************************************************** -Failure in example: type(g) -from line #78 of test.test_generators.__test__.email -Expected: -Got: -***************************************************************** Failure in example: type(i) from line #81 of test.test_generators.__test__.email Expected: -Got: +Got: ***************************************************************** Failure in example: print i.next.__doc__ from line #85 of test.test_generators.__test__.email @@ -39,7 +34,7 @@ Failure in example: type(i.gi_frame) from line #97 of test.test_generators.__test__.email Expected: -Got: +Got: ***************************************************************** Failure in example: i.gi_running = 42 from line #99 of test.test_generators.__test__.email @@ -50,7 +45,7 @@ from line #146 of test.test_generators.__test__.email Exception raised: Traceback (most recent call last): - File "/home/arigo/pypysrc/lib-python-2.3.4/doctest.py", line 442, in _run_examples_inner + File "/home/arigo/pypysrc/lib-python/2.3.4/doctest.py", line 442, in _run_examples_inner compileflags, 1) in globs File "", line 1, in ? AttributeError: 'module' object has no attribute 'WichmannHill' @@ -71,7 +66,7 @@ from line #147 of test.test_generators.__test__.email Exception raised: Traceback (most recent call last): - File "/home/arigo/pypysrc/lib-python-2.3.4/doctest.py", line 442, in _run_examples_inner + File "/home/arigo/pypysrc/lib-python/2.3.4/doctest.py", line 442, in _run_examples_inner compileflags, 1) in globs File "", line 6, in ? NameError: global name 'gen' is not defined @@ -99,57 +94,47 @@ Failure in example: type(f()) from line #87 of test.test_generators.__test__.syntax Expected: -Got: +Got: ***************************************************************** Failure in example: type(f()) from line #93 of test.test_generators.__test__.syntax Expected: -Got: +Got: ***************************************************************** Failure in example: type(f()) from line #117 of test.test_generators.__test__.syntax Expected: -Got: -***************************************************************** -Failure in example: type(f()) -from line #125 of test.test_generators.__test__.syntax -Expected: -Got: +Got: ***************************************************************** Failure in example: type(f()) -from line #135 of test.test_generators.__test__.syntax -Expected: -Got: -***************************************************************** -Failure in example: type(f()) -from line #14Traceback (application-level): - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_generators.py", line 1412 in ? - test_main(1) - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_generators.py", line 1408 in test_main - test_support.run_doctest(test_generators, verbose) - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_support.py", line 290 in run_doctest - raise TestFailed("%d of %d doctests failed" % (f, t)) -TestFailed: 24 of 152 doctests failed -3 of test.test_generators.__test__.syntax +from line #143 of test.test_generators.__test__.syntax Expected: -Got: +Got: ***************************************************************** Failure in example: import weakref from line #2 of test.test_generators.__test__.weakref Exception raised: Traceback (most recent call last): - File "/home/arigo/pypysrc/lib-python-2.3.4/doctest.py", line 442, in _run_examples_inner + File "/home/arigo/pypysrc/lib-python/2.3.4/doctest.py", line 442, in _run_examples_inner compileflags, 1) in globs File "", line 1, in ? - File "/home/arigo/pypysrc/lib-python-2.3.4/weakref.py", line 14, in ? + File "/home/arigo/pypysrc/lib-python/2.3.4/weakref.py", line 14, in ? from _weakref import \ ImportError: _weakref -***************************************************************** +************************Traceback (application-level): + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_generators.py", line 1412 in ? + test_main(1) + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_generators.py", line 1408 in test_main + test_support.run_doctest(test_generators, verbose) + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_support.py", line 290 in run_doctest + raise TestFailed("%d of %d doctests failed" % (f, t)) +TestFailed: 21 of 152 doctests failed +***************************************** Failure in example: wr = weakref.ref(gen) from line #6 of test.test_generators.__test__.weakref Exception raised: Traceback (most recent call last): - File "/home/arigo/pypysrc/lib-python-2.3.4/doctest.py", line 442, in _run_examples_inner + File "/home/arigo/pypysrc/lib-python/2.3.4/doctest.py", line 442, in _run_examples_inner compileflags, 1) in globs File "", line 1, in ? NameError: global name 'weakref' is not defined @@ -158,7 +143,7 @@ from line #7 of test.test_generators.__test__.weakref Exception raised: Traceback (most recent call last): - File "/home/arigo/pypysrc/lib-python-2.3.4/doctest.py", line 442, in _run_examples_inner + File "/home/arigo/pypysrc/lib-python/2.3.4/doctest.py", line 442, in _run_examples_inner compileflags, 1) in globs File "", line 1, in ? NameError: global name 'wr' is not defined @@ -167,7 +152,7 @@ from line #9 of test.test_generators.__test__.weakref Exception raised: Traceback (most recent call last): - File "/home/arigo/pypysrc/lib-python-2.3.4/doctest.py", line 442, in _run_examples_inner + File "/home/arigo/pypysrc/lib-python/2.3.4/doctest.py", line 442, in _run_examples_inner compileflags, 1) in globs File "", line 1, in ? NameError: global name 'weakref' is not defined @@ -176,7 +161,7 @@ from line #14 of test.test_generators.__test__.weakref Exception raised: Traceback (most recent call last): - File "/home/arigo/pypysrc/lib-python-2.3.4/doctest.py", line 442, in _run_examples_inner + File "/home/arigo/pypysrc/lib-python/2.3.4/doctest.py", line 442, in _run_examples_inner compileflags, 1) in globs File "", line 1, in ? NameError: global name 'weakref' is not defined @@ -185,7 +170,7 @@ from line #15 of test.test_generators.__test__.weakref Exception raised: Traceback (most recent call last): - File "/home/arigo/pypysrc/lib-python-2.3.4/doctest.py", line 442, in _run_examples_inner + File "/home/arigo/pypysrc/lib-python/2.3.4/doctest.py", line 442, in _run_examples_inner compileflags, 1) in globs File "", line 1, in ? NameError: global name 'wr' is not defined @@ -194,7 +179,7 @@ from line #17 of test.test_generators.__test__.weakref Exception raised: Traceback (most recent call last): - File "/home/arigo/pypysrc/lib-python-2.3.4/doctest.py", line 442, in _run_examples_inner + File "/home/arigo/pypysrc/lib-python/2.3.4/doctest.py", line 442, in _run_examples_inner compileflags, 1) in globs File "", line 1, in ? NameError: global name 'weakref' is not defined @@ -203,17 +188,17 @@ from line #18 of test.test_generators.__test__.weakref Exception raised: Traceback (most recent call last): - File "/home/arigo/pypysrc/lib-python-2.3.4/doctest.py", line 442, in _run_examples_inner + File "/home/arigo/pypysrc/lib-python/2.3.4/doctest.py", line 442, in _run_examples_inner compileflags, 1) in globs File "", line 1, in ? NameError: global name 'p' is not defined ***************************************************************** 4 items had failures: - 7 of 31 in test.test_generators.__test__.email + 6 of 31 in test.test_generators.__test__.email 1 of 20 in test.test_generators.__test__.pep - 8 of 29 in test.test_generators.__test__.syntax + 6 of 29 in test.test_generators.__test__.syntax 8 of 10 in test.test_generators.__test__.weakref -***Test Failed*** 24 failures. +***Test Failed*** 21 failures. ========================== closed ========================== -execution time: 198.367778063 seconds +execution time: 198.468904018 seconds exit status: 1 Modified: pypy/testresult/arigo at tismerysoft.de/test_getopt.txt ============================================================================== --- pypy/testresult/arigo at tismerysoft.de/test_getopt.txt (original) +++ pypy/testresult/arigo at tismerysoft.de/test_getopt.txt Sun May 1 21:16:18 2005 @@ -1,14 +1,14 @@ testreport-version: 1.0 -command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 576 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/2.3.4/test/test_getopt.py +command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 528 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/2.3.4/test/test_getopt.py run by: arigo at tismerysoft.de sys.platform: linux2 sys.version_info: (2, 3, 5, 'final', 0) cpu model: AMD Athlon(tm) XP 3000+ cpu mhz: 2166.513 oldstyle: no -pypy-revision: 11698 -startdate: Sun May 1 18:08:42 2005 -timeout: 576.0 seconds +pypy-revision: 11706 +startdate: Sun May 1 21:41:35 2005 +timeout: 529.0 seconds ============================================================ faking @@ -29,5 +29,5 @@ doctest (__main__) ... 12 tests with zero failures Module getopt: tests completed successfully. ========================== closed ========================== -execution time: 79.1877429485 seconds +execution time: 79.3728148937 seconds exit status: 0 Modified: pypy/testresult/arigo at tismerysoft.de/test_glob.txt ============================================================================== --- pypy/testresult/arigo at tismerysoft.de/test_glob.txt (original) +++ pypy/testresult/arigo at tismerysoft.de/test_glob.txt Sun May 1 21:16:18 2005 @@ -1,14 +1,14 @@ testreport-version: 1.0 -command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 529 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/2.3.4/test/test_glob.py +command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 576 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/2.3.4/test/test_glob.py run by: arigo at tismerysoft.de sys.platform: linux2 sys.version_info: (2, 3, 5, 'final', 0) cpu model: AMD Athlon(tm) XP 3000+ cpu mhz: 2166.513 oldstyle: no -pypy-revision: 11698 -startdate: Sun May 1 18:10:02 2005 -timeout: 529.0 seconds +pypy-revision: 11706 +startdate: Sun May 1 21:42:55 2005 +timeout: 576.0 seconds ============================================================ faking @@ -26,9 +26,9 @@ test_glob_one_directory (__main__.GlobTests) ... ok ---------------------------------------------------------------------- -Ran 4 tests in 12.892s +Ran 4 tests in 12.929s OK ========================== closed ========================== -execution time: 23.0287899971 seconds +execution time: 23.1007108688 seconds exit status: 0 Modified: pypy/testresult/arigo at tismerysoft.de/test_global.txt ============================================================================== --- pypy/testresult/arigo at tismerysoft.de/test_global.txt (original) +++ pypy/testresult/arigo at tismerysoft.de/test_global.txt Sun May 1 21:16:18 2005 @@ -1,17 +1,17 @@ testreport-version: 1.0 -command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 575 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python-2.3.4/test/test_global.py +command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 576 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/2.3.4/test/test_global.py run by: arigo at tismerysoft.de sys.platform: linux2 sys.version_info: (2, 3, 5, 'final', 0) cpu model: AMD Athlon(tm) XP 3000+ cpu mhz: 2166.513 oldstyle: no -pypy-revision: 11638 -startdate: Sat Apr 30 03:16:12 2005 +pypy-revision: 11706 +startdate: Sun May 1 21:43:18 2005 timeout: 576.0 seconds OUTPUT TEST -see output in: /home/arigo/pypysrc/lib-python-2.3.4/test/result/arigo at tismerysoft.de/test_global.out +see output in: /home/arigo/pypysrc/testresult/arigo at tismerysoft.de/test_global.out ============================================================ faking faking @@ -26,5 +26,5 @@ :2: SyntaxWarning: name 'x' is assigned to before global declaration FAILED: test output differs ========================== closed ========================== -execution time: 6.51072001457 seconds +execution time: 7.18410110474 seconds exit status: 0 Modified: pypy/testresult/arigo at tismerysoft.de/test_grammar.txt ============================================================================== --- pypy/testresult/arigo at tismerysoft.de/test_grammar.txt (original) +++ pypy/testresult/arigo at tismerysoft.de/test_grammar.txt Sun May 1 21:16:18 2005 @@ -1,37 +1,37 @@ testreport-version: 1.0 -command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 576 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python-2.3.4/test/test_grammar.py +command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 529 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/2.3.4/test/test_grammar.py run by: arigo at tismerysoft.de sys.platform: linux2 sys.version_info: (2, 3, 5, 'final', 0) cpu model: AMD Athlon(tm) XP 3000+ cpu mhz: 2166.513 oldstyle: no -pypy-revision: 11638 -startdate: Sat Apr 30 03:16:19 2005 -timeout: 576.0 seconds +pypy-revision: 11706 +startdate: Sun May 1 21:43:26 2005 +timeout: 529.0 seconds OUTPUT TEST -see output in: /home/arigo/pypysrc/lib-python-2.3.4/test/result/arigo at tismerysoft.de/test_grammar.out +see output in: /home/arigo/pypysrc/testresult/arigo at tismerysoft.de/test_grammar.out ============================================================ faking faking -/home/arigo/pypysrc/lib-python-2.3.4/test/test_grammar.py:42: FutureWarning: hex/oct constants > sys.maxint will return positive values in Python 2.4 and up +/home/arigo/pypysrc/lib-python/2.3.4/test/test_grammar.py:42: FutureWarning: hex/oct constants > sys.maxint will return positive values in Python 2.4 and up if -2147483647-1 != 020000000000: raise TestFailed, 'max negative int' -/home/arigo/pypysrc/lib-python-2.3.4/test/test_grammar.py:44: FutureWarning: hex/oct constants > sys.maxint will return positive values in Python 2.4 and up +/home/arigo/pypysrc/lib-python/2.3.4/test/test_grammar.py:44: FutureWarning: hex/oct constants > sys.maxint will return positive values in Python 2.4 and up if 037777777777 != -1: raise TestFailed, 'oct -1' -/home/arigo/pypysrc/lib-python-2.3.4/test/test_grammar.py:45: FutureWarning: hex/oct constants > sys.maxint will return positive values in Python 2.4 and up +/home/arigo/pypysrc/lib-python/2.3.4/test/test_grammar.py:45: FutureWarning: hex/oct constants > sys.maxint will return positive values in Python 2.4 and up if 0xffffffff != -1: raise TestFailed, 'hex -1' faking faking faking Traceback (application-level): - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_grammar.py", line 453 in ? + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_grammar.py", line 453 in ? f() - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_grammar.py", line 446 in f + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_grammar.py", line 446 in f exec r"""if 1: File "", line 2 in ? TypeError: exec: arg 1 must be a string, file, or code object FAILED: test output differs ========================== closed ========================== -execution time: 5.84815621376 seconds +execution time: 6.49249720573 seconds exit status: 1 Modified: pypy/testresult/arigo at tismerysoft.de/test_hash.txt ============================================================================== --- pypy/testresult/arigo at tismerysoft.de/test_hash.txt (original) +++ pypy/testresult/arigo at tismerysoft.de/test_hash.txt Sun May 1 21:16:18 2005 @@ -6,8 +6,8 @@ cpu model: AMD Athlon(tm) XP 3000+ cpu mhz: 2166.513 oldstyle: no -pypy-revision: 11698 -startdate: Sun May 1 18:10:25 2005 +pypy-revision: 11706 +startdate: Sun May 1 21:43:33 2005 timeout: 576.0 seconds ============================================================ @@ -21,9 +21,9 @@ test_numeric_literals (__main__.HashEqualityTestCase) ... ok ---------------------------------------------------------------------- -Ran 3 tests in 1.560s +Ran 3 tests in 1.561s OK ========================== closed ========================== -execution time: 8.81754994392 seconds +execution time: 8.80544900894 seconds exit status: 0 Modified: pypy/testresult/arigo at tismerysoft.de/test_heapq.txt ============================================================================== --- pypy/testresult/arigo at tismerysoft.de/test_heapq.txt (original) +++ pypy/testresult/arigo at tismerysoft.de/test_heapq.txt Sun May 1 21:16:18 2005 @@ -1,14 +1,14 @@ testreport-version: 1.0 -command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 529 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/2.3.4/test/test_heapq.py +command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 576 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/2.3.4/test/test_heapq.py run by: arigo at tismerysoft.de sys.platform: linux2 sys.version_info: (2, 3, 5, 'final', 0) cpu model: AMD Athlon(tm) XP 3000+ cpu mhz: 2166.513 oldstyle: no -pypy-revision: 11698 -startdate: Sun May 1 18:10:34 2005 -timeout: 529.0 seconds +pypy-revision: 11706 +startdate: Sun May 1 21:43:42 2005 +timeout: 576.0 seconds ============================================================ faking @@ -16,15 +16,7 @@ faking faking faking -==========================timeout========================== -Traceback (application-level): - File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_heapq.py", line 92 in ? - test_main() - File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_heapq.py", line 85 in test_main - sorted = [heappop(heap) for i in range(size)] - File "/home/arigo/pypysrc/lib-python/2.3.4/heapq.py", line 138 in heappop - lastelt = heap.pop() # raises appropriate IndexError if heap is empty -KeyboardInterrupt +All OK ========================== closed ========================== -execution time: 529.64696908 seconds -exit status: 1 +execution time: 572.266061068 seconds +exit status: 0 Modified: pypy/testresult/arigo at tismerysoft.de/test_hexoct.txt ============================================================================== --- pypy/testresult/arigo at tismerysoft.de/test_hexoct.txt (original) +++ pypy/testresult/arigo at tismerysoft.de/test_hexoct.txt Sun May 1 21:16:18 2005 @@ -6,8 +6,8 @@ cpu model: AMD Athlon(tm) XP 3000+ cpu mhz: 2166.513 oldstyle: no -pypy-revision: 11698 -startdate: Sun May 1 18:19:25 2005 +pypy-revision: 11706 +startdate: Sun May 1 21:53:15 2005 timeout: 576.0 seconds ============================================================ @@ -36,9 +36,9 @@ test_oct_unsigned (__main__.TextHexOct) ... ok ---------------------------------------------------------------------- -Ran 4 tests in 1.462s +Ran 4 tests in 1.458s OK ========================== closed ========================== -execution time: 11.0904760361 seconds +execution time: 11.026925087 seconds exit status: 0 Modified: pypy/testresult/arigo at tismerysoft.de/test_hmac.txt ============================================================================== --- pypy/testresult/arigo at tismerysoft.de/test_hmac.txt (original) +++ pypy/testresult/arigo at tismerysoft.de/test_hmac.txt Sun May 1 21:16:18 2005 @@ -1,14 +1,14 @@ testreport-version: 1.0 -command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 576 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/2.3.4/test/test_hmac.py +command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 529 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/2.3.4/test/test_hmac.py run by: arigo at tismerysoft.de sys.platform: linux2 sys.version_info: (2, 3, 5, 'final', 0) cpu model: AMD Athlon(tm) XP 3000+ cpu mhz: 2166.513 oldstyle: no -pypy-revision: 11698 -startdate: Sun May 1 18:19:36 2005 -timeout: 576.0 seconds +pypy-revision: 11706 +startdate: Sun May 1 21:53:26 2005 +timeout: 529.0 seconds ============================================================ faking @@ -58,9 +58,9 @@ AssertionError: '000000000000000000000000E71DFA9D' != '9294727A3638BB1C13F48EF8158BFC9D' ---------------------------------------------------------------------- -Ran 10 tests in 150.805s +Ran 10 tests in 150.556s FAILED (failures=1) ========================== closed ========================== -execution time: 163.192332983 seconds +execution time: 162.953148842 seconds exit status: 1 Modified: pypy/testresult/arigo at tismerysoft.de/test_htmllib.txt ============================================================================== --- pypy/testresult/arigo at tismerysoft.de/test_htmllib.txt (original) +++ pypy/testresult/arigo at tismerysoft.de/test_htmllib.txt Sun May 1 21:16:18 2005 @@ -6,8 +6,8 @@ cpu model: AMD Athlon(tm) XP 3000+ cpu mhz: 2166.513 oldstyle: no -pypy-revision: 11698 -startdate: Sun May 1 18:22:20 2005 +pypy-revision: 11706 +startdate: Sun May 1 21:56:10 2005 timeout: 529.0 seconds ============================================================ @@ -24,9 +24,9 @@ test_decl_collection (__main__.HTMLParserTestCase) ... ok ---------------------------------------------------------------------- -Ran 2 tests in 1.825s +Ran 2 tests in 1.816s OK ========================== closed ========================== -execution time: 57.0868420601 seconds +execution time: 57.1486661434 seconds exit status: 0 Modified: pypy/testresult/arigo at tismerysoft.de/test_htmlparser.txt ============================================================================== --- pypy/testresult/arigo at tismerysoft.de/test_htmlparser.txt (original) +++ pypy/testresult/arigo at tismerysoft.de/test_htmlparser.txt Sun May 1 21:16:18 2005 @@ -1,13 +1,13 @@ testreport-version: 1.0 -command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 484 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/2.3.4/test/test_htmlparser.py +command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 483 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/2.3.4/test/test_htmlparser.py run by: arigo at tismerysoft.de sys.platform: linux2 sys.version_info: (2, 3, 5, 'final', 0) cpu model: AMD Athlon(tm) XP 3000+ cpu mhz: 2166.513 oldstyle: no -pypy-revision: 11698 -startdate: Sun May 1 18:23:17 2005 +pypy-revision: 11706 +startdate: Sun May 1 21:57:07 2005 timeout: 484.0 seconds ============================================================ @@ -41,9 +41,9 @@ test_unclosed_entityref (__main__.HTMLParserTestCase) ... ok ---------------------------------------------------------------------- -Ran 19 tests in 245.337s +Ran 19 tests in 245.555s OK ========================== closed ========================== -execution time: 290.914998055 seconds +execution time: 291.141642094 seconds exit status: 0 Modified: pypy/testresult/arigo at tismerysoft.de/test_httplib.txt ============================================================================== --- pypy/testresult/arigo at tismerysoft.de/test_httplib.txt (original) +++ pypy/testresult/arigo at tismerysoft.de/test_httplib.txt Sun May 1 21:16:18 2005 @@ -1,14 +1,14 @@ testreport-version: 1.0 -command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 576 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/2.3.4/test/test_httplib.py +command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 528 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/2.3.4/test/test_httplib.py run by: arigo at tismerysoft.de sys.platform: linux2 sys.version_info: (2, 3, 5, 'final', 0) cpu model: AMD Athlon(tm) XP 3000+ cpu mhz: 2166.513 oldstyle: no -pypy-revision: 11698 -startdate: Sun May 1 18:28:08 2005 -timeout: 576.0 seconds +pypy-revision: 11706 +startdate: Sun May 1 22:01:59 2005 +timeout: 529.0 seconds OUTPUT TEST see output in: /home/arigo/pypysrc/testresult/arigo at tismerysoft.de/test_httplib.out @@ -23,5 +23,5 @@ faking OK ========================== closed ========================== -execution time: 14.4920809269 seconds +execution time: 14.492661953 seconds exit status: 0 Modified: pypy/testresult/arigo at tismerysoft.de/test_imaplib.txt ============================================================================== --- pypy/testresult/arigo at tismerysoft.de/test_imaplib.txt (original) +++ pypy/testresult/arigo at tismerysoft.de/test_imaplib.txt Sun May 1 21:16:18 2005 @@ -6,8 +6,8 @@ cpu model: AMD Athlon(tm) XP 3000+ cpu mhz: 2166.513 oldstyle: no -pypy-revision: 11698 -startdate: Sun May 1 18:28:23 2005 +pypy-revision: 11706 +startdate: Sun May 1 22:02:13 2005 timeout: 576.0 seconds ============================================================ @@ -23,5 +23,5 @@ faking faking ========================== closed ========================== -execution time: 31.0537481308 seconds +execution time: 31.0508768559 seconds exit status: 0 Modified: pypy/testresult/arigo at tismerysoft.de/test_imp.txt ============================================================================== --- pypy/testresult/arigo at tismerysoft.de/test_imp.txt (original) +++ pypy/testresult/arigo at tismerysoft.de/test_imp.txt Sun May 1 21:16:18 2005 @@ -1,13 +1,13 @@ testreport-version: 1.0 -command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 575 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python-2.3.4/test/test_imp.py +command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 576 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/2.3.4/test/test_imp.py run by: arigo at tismerysoft.de sys.platform: linux2 sys.version_info: (2, 3, 5, 'final', 0) cpu model: AMD Athlon(tm) XP 3000+ cpu mhz: 2166.513 oldstyle: no -pypy-revision: 11638 -startdate: Sat Apr 30 03:31:49 2005 +pypy-revision: 11706 +startdate: Sun May 1 22:02:45 2005 timeout: 576.0 seconds ============================================================ @@ -17,13 +17,13 @@ faking faking Traceback (application-level): - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_imp.py", line 39 in ? + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_imp.py", line 39 in ? test_main() - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_imp.py", line 36 in test_main + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_imp.py", line 36 in test_main testLock() - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_imp.py", line 13 in testLock + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_imp.py", line 13 in testLock lock_held_at_start = imp.lock_held() AttributeError: 'module' object has no attribute 'lock_held' ========================== closed ========================== -execution time: 4.45112705231 seconds +execution time: 5.10903406143 seconds exit status: 1 Modified: pypy/testresult/arigo at tismerysoft.de/test_import.txt ============================================================================== --- pypy/testresult/arigo at tismerysoft.de/test_import.txt (original) +++ pypy/testresult/arigo at tismerysoft.de/test_import.txt Sun May 1 21:16:18 2005 @@ -1,14 +1,14 @@ testreport-version: 1.0 -command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 529 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python-2.3.4/test/test_import.py +command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 483 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/2.3.4/test/test_import.py run by: arigo at tismerysoft.de sys.platform: linux2 sys.version_info: (2, 3, 5, 'final', 0) cpu model: AMD Athlon(tm) XP 3000+ cpu mhz: 2166.513 oldstyle: no -pypy-revision: 11638 -startdate: Sat Apr 30 03:31:55 2005 -timeout: 529.0 seconds +pypy-revision: 11706 +startdate: Sun May 1 22:02:51 2005 +timeout: 484.0 seconds ============================================================ faking @@ -17,11 +17,11 @@ faking faking Traceback (application-level): - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_import.py", line 67 in ? + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_import.py", line 67 in ? test_with_extension(os.extsep + "py") - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_import.py", line 53 in test_with_extension + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_import.py", line 53 in test_with_extension raise ValueError("import from .pyc/.pyo failed: %s" % err) ValueError: import from .pyc/.pyo failed: No module named @test ========================== closed ========================== -execution time: 6.17749500275 seconds +execution time: 6.89175486565 seconds exit status: 1 Modified: pypy/testresult/arigo at tismerysoft.de/test_importhooks.txt ============================================================================== --- pypy/testresult/arigo at tismerysoft.de/test_importhooks.txt (original) +++ pypy/testresult/arigo at tismerysoft.de/test_importhooks.txt Sun May 1 21:16:18 2005 @@ -1,14 +1,14 @@ testreport-version: 1.0 -command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 528 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python-2.3.4/test/test_importhooks.py +command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 484 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/2.3.4/test/test_importhooks.py run by: arigo at tismerysoft.de sys.platform: linux2 sys.version_info: (2, 3, 5, 'final', 0) cpu model: AMD Athlon(tm) XP 3000+ cpu mhz: 2166.513 oldstyle: no -pypy-revision: 11638 -startdate: Sat Apr 30 03:32:02 2005 -timeout: 529.0 seconds +pypy-revision: 11706 +startdate: Sun May 1 22:02:58 2005 +timeout: 484.0 seconds ============================================================ faking @@ -17,13 +17,13 @@ faking faking Traceback (application-level): - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_importhooks.py", line 206 in ? + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_importhooks.py", line 206 in ? test_main() - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_importhooks.py", line 203 in test_main + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_importhooks.py", line 203 in test_main test_support.run_unittest(ImportHooksTestCase) - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_support.py", line 262 in run_unittest + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_support.py", line 262 in run_unittest run_suite(suite, testclass) - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_support.py", line 246 in run_suite + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_support.py", line 246 in run_suite raise TestFailed(msg) TestFailed: errors occurred in __main__.ImportHooksTestCase testBlocker (__main__.ImportHooksTestCase) ... ERROR @@ -35,7 +35,7 @@ ERROR: testBlocker (__main__.ImportHooksTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_importhooks.py", line 129, in setUp + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_importhooks.py", line 129, in setUp self.meta_path = sys.meta_path[:] AttributeError: 'module' object has no attribute 'meta_path' @@ -43,7 +43,7 @@ ERROR: testImpWrapper (__main__.ImportHooksTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_importhooks.py", line 129, in setUp + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_importhooks.py", line 129, in setUp self.meta_path = sys.meta_path[:] AttributeError: 'module' object has no attribute 'meta_path' @@ -51,7 +51,7 @@ ERROR: testMetaPath (__main__.ImportHooksTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_importhooks.py", line 129, in setUp + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_importhooks.py", line 129, in setUp self.meta_path = sys.meta_path[:] AttributeError: 'module' object has no attribute 'meta_path' @@ -59,14 +59,14 @@ ERROR: testPathHook (__main__.ImportHooksTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_importhooks.py", line 129, in setUp + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_importhooks.py", line 129, in setUp self.meta_path = sys.meta_path[:] AttributeError: 'module' object has no attribute 'meta_path' ---------------------------------------------------------------------- -Ran 4 tests in 3.453s +Ran 4 tests in 3.457s FAILED (errors=4) ========================== closed ========================== -execution time: 12.9672100544 seconds +execution time: 13.660337925 seconds exit status: 1 Modified: pypy/testresult/arigo at tismerysoft.de/test_inspect.txt ============================================================================== --- pypy/testresult/arigo at tismerysoft.de/test_inspect.txt (original) +++ pypy/testresult/arigo at tismerysoft.de/test_inspect.txt Sun May 1 21:16:18 2005 @@ -1,14 +1,14 @@ testreport-version: 1.0 -command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 575 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python-2.3.4/test/test_inspect.py +command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 528 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/2.3.4/test/test_inspect.py run by: arigo at tismerysoft.de sys.platform: linux2 sys.version_info: (2, 3, 5, 'final', 0) cpu model: AMD Athlon(tm) XP 3000+ cpu mhz: 2166.513 oldstyle: no -pypy-revision: 11638 -startdate: Sat Apr 30 03:32:15 2005 -timeout: 576.0 seconds +pypy-revision: 11706 +startdate: Sun May 1 22:03:13 2005 +timeout: 529.0 seconds ============================================================ faking @@ -19,9 +19,9 @@ faking faking Traceback (application-level): - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_inspect.py", line 80 in ? + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_inspect.py", line 80 in ? mod = imp.load_source('testmod', TESTFN) AttributeError: 'module' object has no attribute 'load_source' ========================== closed ========================== -execution time: 69.7071559429 seconds +execution time: 70.459676981 seconds exit status: 1 Modified: pypy/testresult/arigo at tismerysoft.de/test_isinstance.txt ============================================================================== --- pypy/testresult/arigo at tismerysoft.de/test_isinstance.txt (original) +++ pypy/testresult/arigo at tismerysoft.de/test_isinstance.txt Sun May 1 21:16:18 2005 @@ -1,14 +1,14 @@ testreport-version: 1.0 -command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 529 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/2.3.4/test/test_isinstance.py +command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 483 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/2.3.4/test/test_isinstance.py run by: arigo at tismerysoft.de sys.platform: linux2 sys.version_info: (2, 3, 5, 'final', 0) cpu model: AMD Athlon(tm) XP 3000+ cpu mhz: 2166.513 oldstyle: no -pypy-revision: 11698 -startdate: Sun May 1 18:28:54 2005 -timeout: 529.0 seconds +pypy-revision: 11706 +startdate: Sun May 1 22:04:24 2005 +timeout: 484.0 seconds ============================================================ faking @@ -33,9 +33,9 @@ test_subclass_tuple (__main__.TestIsInstanceIsSubclass) ... ok ---------------------------------------------------------------------- -Ran 15 tests in 16.789s +Ran 15 tests in 16.785s OK ========================== closed ========================== -execution time: 27.1083488464 seconds +execution time: 27.0917232037 seconds exit status: 0 Modified: pypy/testresult/arigo at tismerysoft.de/test_iter.txt ============================================================================== --- pypy/testresult/arigo at tismerysoft.de/test_iter.txt (original) +++ pypy/testresult/arigo at tismerysoft.de/test_iter.txt Sun May 1 21:16:18 2005 @@ -1,13 +1,13 @@ testreport-version: 1.0 -command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 529 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python-2.3.4/test/test_iter.py +command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 529 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/2.3.4/test/test_iter.py run by: arigo at tismerysoft.de sys.platform: linux2 sys.version_info: (2, 3, 5, 'final', 0) cpu model: AMD Athlon(tm) XP 3000+ cpu mhz: 2166.513 oldstyle: no -pypy-revision: 11638 -startdate: Sat Apr 30 03:33:57 2005 +pypy-revision: 11706 +startdate: Sun May 1 22:04:51 2005 timeout: 529.0 seconds ============================================================ @@ -226,5 +226,5 @@ raise UnwrapError('calling %s: %s' % (self.code.cpy_callable, e)) pypy.objspace.std.model.UnwrapError: calling : cannot unwrap > ========================== closed ========================== -execution time: 69.8705880642 seconds +execution time: 70.7540009022 seconds exit status: 1 Modified: pypy/testresult/arigo at tismerysoft.de/test_itertools.txt ============================================================================== --- pypy/testresult/arigo at tismerysoft.de/test_itertools.txt (original) +++ pypy/testresult/arigo at tismerysoft.de/test_itertools.txt Sun May 1 21:16:18 2005 @@ -1,13 +1,13 @@ testreport-version: 1.0 -command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 483 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/modified-2.3.4/test/test_itertools.py +command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 484 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/modified-2.3.4/test/test_itertools.py run by: arigo at tismerysoft.de sys.platform: linux2 sys.version_info: (2, 3, 5, 'final', 0) cpu model: AMD Athlon(tm) XP 3000+ cpu mhz: 2166.513 oldstyle: no -pypy-revision: 11698 -startdate: Sun May 1 18:29:22 2005 +pypy-revision: 11706 +startdate: Sun May 1 22:06:03 2005 timeout: 484.0 seconds ============================================================ @@ -55,10 +55,10 @@ test_sf_950057 (__main__.RegressionTests) ... ok ---------------------------------------------------------------------- -Ran 33 tests in 224.502s +Ran 33 tests in 224.279s OK doctest (__main__) ... 35 tests with zero failures ========================== closed ========================== -execution time: 345.948727131 seconds +execution time: 345.793305159 seconds exit status: 0 Modified: pypy/testresult/arigo at tismerysoft.de/test_long.txt ============================================================================== --- pypy/testresult/arigo at tismerysoft.de/test_long.txt (original) +++ pypy/testresult/arigo at tismerysoft.de/test_long.txt Sun May 1 21:16:18 2005 @@ -1,13 +1,13 @@ testreport-version: 1.0 -command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 576 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/2.3.4/test/test_long.py +command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 575 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/2.3.4/test/test_long.py run by: arigo at tismerysoft.de sys.platform: linux2 sys.version_info: (2, 3, 5, 'final', 0) cpu model: AMD Athlon(tm) XP 3000+ cpu mhz: 2166.513 oldstyle: no -pypy-revision: 11698 -startdate: Sun May 1 18:35:19 2005 +pypy-revision: 11706 +startdate: Sun May 1 22:11:49 2005 timeout: 576.0 seconds ============================================================ @@ -24,10 +24,10 @@ y = getran(leny) or 1L File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_long.py", line 59 in getran r = int(random() * (SHIFT * 2)) - File "/home/arigo/pypysrc/pypy/lib/random.py", line 190 in random - y = (172 * y) % 30307 + File "/home/arigo/pypysrc/pypy/lib/random.py", line 191 in random + z = (170 * z) % 30323 KeyboardInterrupt long / * % divmod ========================== closed ========================== -execution time: 576.157457829 seconds +execution time: 576.155021906 seconds exit status: 1 Modified: pypy/testresult/arigo at tismerysoft.de/test_long_future.txt ============================================================================== --- pypy/testresult/arigo at tismerysoft.de/test_long_future.txt (original) +++ pypy/testresult/arigo at tismerysoft.de/test_long_future.txt Sun May 1 21:16:18 2005 @@ -1,14 +1,14 @@ testreport-version: 1.0 -command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 529 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python-2.3.4/test/test_long_future.py +command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 483 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/2.3.4/test/test_long_future.py run by: arigo at tismerysoft.de sys.platform: linux2 sys.version_info: (2, 3, 5, 'final', 0) cpu model: AMD Athlon(tm) XP 3000+ cpu mhz: 2166.513 oldstyle: no -pypy-revision: 11638 -startdate: Sat Apr 30 03:50:20 2005 -timeout: 529.0 seconds +pypy-revision: 11706 +startdate: Sun May 1 22:21:26 2005 +timeout: 484.0 seconds ============================================================ faking @@ -17,14 +17,14 @@ faking faking Traceback (application-level): - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_long_future.py", line 55 in ? + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_long_future.py", line 55 in ? test_true_division() - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_long_future.py", line 19 in test_true_division + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_long_future.py", line 19 in test_true_division verify(1 / mhuge == 0.0) - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_support.py", line 180 in verify + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_support.py", line 180 in verify raise TestFailed(reason) TestFailed: test failed long true division ========================== closed ========================== -execution time: 4.64307904243 seconds +execution time: 5.31956982613 seconds exit status: 1 Modified: pypy/testresult/arigo at tismerysoft.de/test_longexp.txt ============================================================================== --- pypy/testresult/arigo at tismerysoft.de/test_longexp.txt (original) +++ pypy/testresult/arigo at tismerysoft.de/test_longexp.txt Sun May 1 21:16:18 2005 @@ -1,14 +1,14 @@ testreport-version: 1.0 -command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 529 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/2.3.4/test/test_longexp.py +command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 484 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/2.3.4/test/test_longexp.py run by: arigo at tismerysoft.de sys.platform: linux2 sys.version_info: (2, 3, 5, 'final', 0) cpu model: AMD Athlon(tm) XP 3000+ cpu mhz: 2166.513 oldstyle: no -pypy-revision: 11698 -startdate: Sun May 1 18:44:56 2005 -timeout: 529.0 seconds +pypy-revision: 11706 +startdate: Sun May 1 22:21:32 2005 +timeout: 484.0 seconds OUTPUT TEST see output in: /home/arigo/pypysrc/testresult/arigo at tismerysoft.de/test_longexp.out @@ -18,5 +18,5 @@ faking OK ========================== closed ========================== -execution time: 2.87135004997 seconds +execution time: 2.98251390457 seconds exit status: 0 Modified: pypy/testresult/arigo at tismerysoft.de/test_marshal.txt ============================================================================== --- pypy/testresult/arigo at tismerysoft.de/test_marshal.txt (original) +++ pypy/testresult/arigo at tismerysoft.de/test_marshal.txt Sun May 1 21:16:18 2005 @@ -6,8 +6,8 @@ cpu model: AMD Athlon(tm) XP 3000+ cpu mhz: 2166.513 oldstyle: no -pypy-revision: 11698 -startdate: Sun May 1 18:45:21 2005 +pypy-revision: 11706 +startdate: Sun May 1 22:21:35 2005 timeout: 529.0 seconds ============================================================ @@ -17,5 +17,5 @@ faking faking ========================== closed ========================== -execution time: 180.209256887 seconds +execution time: 179.961137056 seconds exit status: 0 Modified: pypy/testresult/arigo at tismerysoft.de/test_math.txt ============================================================================== --- pypy/testresult/arigo at tismerysoft.de/test_math.txt (original) +++ pypy/testresult/arigo at tismerysoft.de/test_math.txt Sun May 1 21:16:18 2005 @@ -1,17 +1,17 @@ testreport-version: 1.0 -command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 575 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python-2.3.4/test/test_math.py +command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 529 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/2.3.4/test/test_math.py run by: arigo at tismerysoft.de sys.platform: linux2 sys.version_info: (2, 3, 5, 'final', 0) cpu model: AMD Athlon(tm) XP 3000+ cpu mhz: 2166.513 oldstyle: no -pypy-revision: 11638 -startdate: Sat Apr 30 03:54:00 2005 -timeout: 576.0 seconds +pypy-revision: 11706 +startdate: Sun May 1 22:24:35 2005 +timeout: 529.0 seconds OUTPUT TEST -see output in: /home/arigo/pypysrc/lib-python-2.3.4/test/result/arigo at tismerysoft.de/test_math.out +see output in: /home/arigo/pypysrc/testresult/arigo at tismerysoft.de/test_math.out ============================================================ faking faking @@ -20,5 +20,5 @@ faking FAILED: test output differs ========================== closed ========================== -execution time: 5.35891485214 seconds +execution time: 6.06613993645 seconds exit status: 0 Modified: pypy/testresult/arigo at tismerysoft.de/test_mimetools.txt ============================================================================== --- pypy/testresult/arigo at tismerysoft.de/test_mimetools.txt (original) +++ pypy/testresult/arigo at tismerysoft.de/test_mimetools.txt Sun May 1 21:16:18 2005 @@ -1,14 +1,14 @@ testreport-version: 1.0 -command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 529 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/2.3.4/test/test_mimetools.py +command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 484 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/2.3.4/test/test_mimetools.py run by: arigo at tismerysoft.de sys.platform: linux2 sys.version_info: (2, 3, 5, 'final', 0) cpu model: AMD Athlon(tm) XP 3000+ cpu mhz: 2166.513 oldstyle: no -pypy-revision: 11698 -startdate: Sun May 1 18:57:12 2005 -timeout: 529.0 seconds +pypy-revision: 11706 +startdate: Sun May 1 22:24:42 2005 +timeout: 484.0 seconds ============================================================ faking @@ -19,14 +19,23 @@ faking faking faking -test_boundary (__main__.MimeToolsTest) ... ok -test_decodeencode (__main__.MimeToolsTest) ... ok -test_message (__main__.MimeToolsTest) ... ok - ----------------------------------------------------------------------- -Ran 3 tests in 55.111s - -OK -========================== closed ========================== -execution time: 63.847055912 seconds -exit status: 0 +faking +Traceback (application-level): + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_mimetools.py", line 50 in ? + test_main() + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_mimetools.py", line 47 in test_main + test_support.run_unittest(MimeToolsTest) + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_support.py", line 262 in run_unittest + run_suite(suite, testclass) + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_support.py", line 234 in run_suite + result = runner.run(suite) + File "/home/arigo/pypysrc/lib-python/2.3.4/unittest.py", line 658 in run + test(result) + File "/home/arigo/pypysrc/lib-python/2.3.4/unittest.py", line 389 in __call__ + test(result) + File "/home/arigo/pypysrc/lib-python/2.3.4/unittest.py", line 389 in __call__ + test(result) +TypeError: instance exception may not have a separate value +test_boundary (__main__.MimeToolsTest) ... ========================== closed ========================== +execution time: 69.9934079647 seconds +exit status: 1 Modified: pypy/testresult/arigo at tismerysoft.de/test_mimetypes.txt ============================================================================== --- pypy/testresult/arigo at tismerysoft.de/test_mimetypes.txt (original) +++ pypy/testresult/arigo at tismerysoft.de/test_mimetypes.txt Sun May 1 21:16:18 2005 @@ -1,14 +1,14 @@ testreport-version: 1.0 -command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 575 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/2.3.4/test/test_mimetypes.py +command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 484 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/2.3.4/test/test_mimetypes.py run by: arigo at tismerysoft.de sys.platform: linux2 sys.version_info: (2, 3, 5, 'final', 0) cpu model: AMD Athlon(tm) XP 3000+ cpu mhz: 2166.513 oldstyle: no -pypy-revision: 11698 -startdate: Sun May 1 18:58:16 2005 -timeout: 576.0 seconds +pypy-revision: 11706 +startdate: Sun May 1 22:25:53 2005 +timeout: 484.0 seconds ============================================================ faking @@ -30,9 +30,9 @@ test_non_standard_types (__main__.MimeTypesTestCase) ... ok ---------------------------------------------------------------------- -Ran 5 tests in 12.408s +Ran 5 tests in 12.440s OK ========================== closed ========================== -execution time: 26.0540258884 seconds +execution time: 26.1214680672 seconds exit status: 0 Modified: pypy/testresult/arigo at tismerysoft.de/test_module.txt ============================================================================== --- pypy/testresult/arigo at tismerysoft.de/test_module.txt (original) +++ pypy/testresult/arigo at tismerysoft.de/test_module.txt Sun May 1 21:16:18 2005 @@ -1,13 +1,13 @@ testreport-version: 1.0 -command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 576 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python-2.3.4/test/test_module.py +command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 575 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/2.3.4/test/test_module.py run by: arigo at tismerysoft.de sys.platform: linux2 sys.version_info: (2, 3, 5, 'final', 0) cpu model: AMD Athlon(tm) XP 3000+ cpu mhz: 2166.513 oldstyle: no -pypy-revision: 11638 -startdate: Sat Apr 30 04:06:24 2005 +pypy-revision: 11706 +startdate: Sun May 1 22:26:26 2005 timeout: 576.0 seconds ============================================================ @@ -17,11 +17,11 @@ faking faking Traceback (application-level): - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_module.py", line 10 in ? + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_module.py", line 10 in ? verify(foo.__dict__ is None) - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_support.py", line 180 in verify + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_support.py", line 180 in verify raise TestFailed(reason) TestFailed: test failed ========================== closed ========================== -execution time: 4.56893086433 seconds +execution time: 5.10058617592 seconds exit status: 1 Modified: pypy/testresult/arigo at tismerysoft.de/test_multifile.txt ============================================================================== --- pypy/testresult/arigo at tismerysoft.de/test_multifile.txt (original) +++ pypy/testresult/arigo at tismerysoft.de/test_multifile.txt Sun May 1 21:16:18 2005 @@ -1,14 +1,14 @@ testreport-version: 1.0 -command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 528 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/2.3.4/test/test_multifile.py +command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 483 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/2.3.4/test/test_multifile.py run by: arigo at tismerysoft.de sys.platform: linux2 sys.version_info: (2, 3, 5, 'final', 0) cpu model: AMD Athlon(tm) XP 3000+ cpu mhz: 2166.513 oldstyle: no -pypy-revision: 11698 -startdate: Sun May 1 18:58:50 2005 -timeout: 529.0 seconds +pypy-revision: 11706 +startdate: Sun May 1 22:26:32 2005 +timeout: 484.0 seconds ============================================================ faking @@ -17,5 +17,5 @@ faking faking ========================== closed ========================== -execution time: 7.4973731041 seconds +execution time: 7.51445913315 seconds exit status: 0 Added: pypy/testresult/arigo at tismerysoft.de/test_mutants.txt ============================================================================== --- (empty file) +++ pypy/testresult/arigo at tismerysoft.de/test_mutants.txt Sun May 1 21:16:18 2005 @@ -0,0 +1,30 @@ +testreport-version: 1.0 +command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 529 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/2.3.4/test/test_mutants.py +run by: arigo at tismerysoft.de +sys.platform: linux2 +sys.version_info: (2, 3, 5, 'final', 0) +cpu model: AMD Athlon(tm) XP 3000+ +cpu mhz: 2166.513 +oldstyle: no +pypy-revision: 11706 +startdate: Sun May 1 22:26:40 2005 +timeout: 529.0 seconds + +============================================================ +faking +faking +faking +faking +faking +trying w/ lengths 7 7 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ==========================timeout========================== +Traceback (application-level): + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_mutants.py", line 154 in ? +test(100) + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_mutants.py", line 151 in test + test_one(random.randrange(1, 100)) + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_mutants.py", line 136 in test_one + print ".", +KeyboardInterrupt +. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .========================== closed ========================== +execution time: 529.646408081 seconds +exit status: 1 Modified: pypy/testresult/arigo at tismerysoft.de/test_netrc.txt ============================================================================== --- pypy/testresult/arigo at tismerysoft.de/test_netrc.txt (original) +++ pypy/testresult/arigo at tismerysoft.de/test_netrc.txt Sun May 1 21:16:18 2005 @@ -1,14 +1,14 @@ testreport-version: 1.0 -command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 576 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/2.3.4/test/test_netrc.py +command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 529 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/2.3.4/test/test_netrc.py run by: arigo at tismerysoft.de sys.platform: linux2 sys.version_info: (2, 3, 5, 'final', 0) cpu model: AMD Athlon(tm) XP 3000+ cpu mhz: 2166.513 oldstyle: no -pypy-revision: 11698 -startdate: Sun May 1 18:58:57 2005 -timeout: 576.0 seconds +pypy-revision: 11706 +startdate: Sun May 1 22:35:30 2005 +timeout: 529.0 seconds ============================================================ faking @@ -19,9 +19,9 @@ test_case_1 (__main__.NetrcTestCase) ... ok ---------------------------------------------------------------------- -Ran 1 test in 2.293s +Ran 1 test in 2.315s OK ========================== closed ========================== -execution time: 9.68357801437 seconds +execution time: 9.70665407181 seconds exit status: 0 Modified: pypy/testresult/arigo at tismerysoft.de/test_new.out ============================================================================== --- pypy/testresult/arigo at tismerysoft.de/test_new.out (original) +++ pypy/testresult/arigo at tismerysoft.de/test_new.out Sun May 1 21:16:18 2005 @@ -1,6 +1,6 @@ test_new new.module() - + new.classobj() - + new.instance() Modified: pypy/testresult/arigo at tismerysoft.de/test_new.txt ============================================================================== --- pypy/testresult/arigo at tismerysoft.de/test_new.txt (original) +++ pypy/testresult/arigo at tismerysoft.de/test_new.txt Sun May 1 21:16:18 2005 @@ -1,17 +1,17 @@ testreport-version: 1.0 -command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 675 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python-2.3.4/test/test_new.py +command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 575 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/2.3.4/test/test_new.py run by: arigo at tismerysoft.de sys.platform: linux2 sys.version_info: (2, 3, 5, 'final', 0) cpu model: AMD Athlon(tm) XP 3000+ cpu mhz: 2166.513 oldstyle: no -pypy-revision: 11638 -startdate: Sat Apr 30 04:06:51 2005 -timeout: 676.0 seconds +pypy-revision: 11706 +startdate: Sun May 1 22:35:40 2005 +timeout: 576.0 seconds OUTPUT TEST -see output in: /home/arigo/pypysrc/lib-python-2.3.4/test/result/arigo at tismerysoft.de/test_new.out +see output in: /home/arigo/pypysrc/testresult/arigo at tismerysoft.de/test_new.out ============================================================ faking faking @@ -19,10 +19,10 @@ faking faking Traceback (application-level): - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_new.py", line 25 in ? + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_new.py", line 25 in ? c = new.instance(C, {'yolks': 3}) TypeError: instance() first arg must be class FAILED: test output differs ========================== closed ========================== -execution time: 5.06018781662 seconds +execution time: 5.31962203979 seconds exit status: 1 Modified: pypy/testresult/arigo at tismerysoft.de/test_opcodes.txt ============================================================================== --- pypy/testresult/arigo at tismerysoft.de/test_opcodes.txt (original) +++ pypy/testresult/arigo at tismerysoft.de/test_opcodes.txt Sun May 1 21:16:18 2005 @@ -1,14 +1,14 @@ testreport-version: 1.0 -command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 575 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/2.3.4/test/test_opcodes.py +command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 483 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/2.3.4/test/test_opcodes.py run by: arigo at tismerysoft.de sys.platform: linux2 sys.version_info: (2, 3, 5, 'final', 0) cpu model: AMD Athlon(tm) XP 3000+ cpu mhz: 2166.513 oldstyle: no -pypy-revision: 11698 -startdate: Sun May 1 18:59:17 2005 -timeout: 576.0 seconds +pypy-revision: 11706 +startdate: Sun May 1 22:35:46 2005 +timeout: 484.0 seconds OUTPUT TEST see output in: /home/arigo/pypysrc/testresult/arigo at tismerysoft.de/test_opcodes.out @@ -20,5 +20,5 @@ faking OK ========================== closed ========================== -execution time: 5.50823187828 seconds +execution time: 5.49903011322 seconds exit status: 0 Modified: pypy/testresult/arigo at tismerysoft.de/test_operations.txt ============================================================================== --- pypy/testresult/arigo at tismerysoft.de/test_operations.txt (original) +++ pypy/testresult/arigo at tismerysoft.de/test_operations.txt Sun May 1 21:16:18 2005 @@ -1,28 +1,28 @@ testreport-version: 1.0 -command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 576 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python-2.3.4/test/test_operations.py +command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 575 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/2.3.4/test/test_operations.py run by: arigo at tismerysoft.de sys.platform: linux2 sys.version_info: (2, 3, 5, 'final', 0) cpu model: AMD Athlon(tm) XP 3000+ cpu mhz: 2166.513 oldstyle: no -pypy-revision: 11638 -startdate: Sat Apr 30 04:07:28 2005 +pypy-revision: 11706 +startdate: Sun May 1 22:35:52 2005 timeout: 576.0 seconds OUTPUT TEST -see output in: /home/arigo/pypysrc/lib-python-2.3.4/test/result/arigo at tismerysoft.de/test_operations.out +see output in: /home/arigo/pypysrc/testresult/arigo at tismerysoft.de/test_operations.out ============================================================ faking faking faking Traceback (application-level): - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_operations.py", line 36 in ? + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_operations.py", line 36 in ? d[x2] = 2 - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_operations.py", line 29 in __cmp__ + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_operations.py", line 29 in __cmp__ raise RuntimeError, "gotcha" RuntimeError: gotcha FAILED: test output differs ========================== closed ========================== -execution time: 1.03525209427 seconds +execution time: 1.0965321064 seconds exit status: 1 Modified: pypy/testresult/arigo at tismerysoft.de/test_operator.txt ============================================================================== --- pypy/testresult/arigo at tismerysoft.de/test_operator.txt (original) +++ pypy/testresult/arigo at tismerysoft.de/test_operator.txt Sun May 1 21:16:18 2005 @@ -1,14 +1,14 @@ testreport-version: 1.0 -command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 575 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/2.3.4/test/test_operator.py +command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 483 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/2.3.4/test/test_operator.py run by: arigo at tismerysoft.de sys.platform: linux2 sys.version_info: (2, 3, 5, 'final', 0) cpu model: AMD Athlon(tm) XP 3000+ cpu mhz: 2166.513 oldstyle: no -pypy-revision: 11698 -startdate: Sun May 1 18:59:23 2005 -timeout: 576.0 seconds +pypy-revision: 11706 +startdate: Sun May 1 22:35:54 2005 +timeout: 484.0 seconds ============================================================ faking @@ -59,9 +59,9 @@ test_truth (__main__.OperatorTestCase) ... ok ---------------------------------------------------------------------- -Ran 41 tests in 13.978s +Ran 41 tests in 14.047s OK ========================== closed ========================== -execution time: 22.1879010201 seconds +execution time: 22.2475681305 seconds exit status: 0 Modified: pypy/testresult/arigo at tismerysoft.de/test_optparse.txt ============================================================================== --- pypy/testresult/arigo at tismerysoft.de/test_optparse.txt (original) +++ pypy/testresult/arigo at tismerysoft.de/test_optparse.txt Sun May 1 21:16:18 2005 @@ -1,14 +1,14 @@ testreport-version: 1.0 -command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 441 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/pypy/lib/test2/test_optparse.py +command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 575 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/modified-2.3.4/test/test_optparse.py run by: arigo at tismerysoft.de sys.platform: linux2 sys.version_info: (2, 3, 5, 'final', 0) cpu model: AMD Athlon(tm) XP 3000+ cpu mhz: 2166.513 oldstyle: no -pypy-revision: 11638 -startdate: Sat Apr 30 04:07:53 2005 -timeout: 441.0 seconds +pypy-revision: 11706 +startdate: Sun May 1 22:36:16 2005 +timeout: 576.0 seconds ============================================================ faking @@ -19,19 +19,19 @@ faking faking Traceback (application-level): - File "/home/arigo/pypysrc/pypy/lib/test2/test_optparse.py", line 1220 in ? + File "/home/arigo/pypysrc/lib-python/modified-2.3.4/test/test_optparse.py", line 1220 in ? unittest.main() - File "/home/arigo/pypysrc/lib-python-2.3.4/unittest.py", line 720 in __init__ + File "/home/arigo/pypysrc/lib-python/2.3.4/unittest.py", line 720 in __init__ self.parseArgs(argv) - File "/home/arigo/pypysrc/lib-python-2.3.4/unittest.py", line 741 in parseArgs + File "/home/arigo/pypysrc/lib-python/2.3.4/unittest.py", line 741 in parseArgs self.test = self.testLoader.loadTestsFromModule(self.module) - File "/home/arigo/pypysrc/lib-python-2.3.4/unittest.py", line 465 in loadTestsFromModule + File "/home/arigo/pypysrc/lib-python/2.3.4/unittest.py", line 465 in loadTestsFromModule tests.append(self.loadTestsFromTestCase(obj)) - File "/home/arigo/pypysrc/lib-python-2.3.4/unittest.py", line 456 in loadTestsFromTestCase + File "/home/arigo/pypysrc/lib-python/2.3.4/unittest.py", line 456 in loadTestsFromTestCase self.getTestCaseNames(testCaseClass))) - File "/home/arigo/pypysrc/lib-python-2.3.4/unittest.py", line 532 in getTestCaseNames + File "/home/arigo/pypysrc/lib-python/2.3.4/unittest.py", line 532 in getTestCaseNames testFnNames.sort(self.sortTestMethodsUsing) TypeError: cmp() takes exactly 2 arguments (3 given) ========================== closed ========================== -execution time: 18.5548818111 seconds +execution time: 18.9979510307 seconds exit status: 1 Modified: pypy/testresult/arigo at tismerysoft.de/test_os.txt ============================================================================== --- pypy/testresult/arigo at tismerysoft.de/test_os.txt (original) +++ pypy/testresult/arigo at tismerysoft.de/test_os.txt Sun May 1 21:16:18 2005 @@ -1,14 +1,14 @@ testreport-version: 1.0 -command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 529 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/2.3.4/test/test_os.py +command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 483 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/2.3.4/test/test_os.py run by: arigo at tismerysoft.de sys.platform: linux2 sys.version_info: (2, 3, 5, 'final', 0) cpu model: AMD Athlon(tm) XP 3000+ cpu mhz: 2166.513 oldstyle: no -pypy-revision: 11698 -startdate: Sun May 1 18:59:45 2005 -timeout: 529.0 seconds +pypy-revision: 11706 +startdate: Sun May 1 22:36:36 2005 +timeout: 484.0 seconds ============================================================ faking @@ -32,9 +32,9 @@ test_traversal (__main__.WalkTests) ... ok ---------------------------------------------------------------------- -Ran 8 tests in 6.814s +Ran 8 tests in 6.846s OK ========================== closed ========================== -execution time: 22.1262660027 seconds +execution time: 22.1245141029 seconds exit status: 0 Modified: pypy/testresult/arigo at tismerysoft.de/test_pickle.txt ============================================================================== --- pypy/testresult/arigo at tismerysoft.de/test_pickle.txt (original) +++ pypy/testresult/arigo at tismerysoft.de/test_pickle.txt Sun May 1 21:16:18 2005 @@ -1,14 +1,14 @@ testreport-version: 1.0 -command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 576 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python-2.3.4/test/test_pickle.py +command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 529 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/2.3.4/test/test_pickle.py run by: arigo at tismerysoft.de sys.platform: linux2 sys.version_info: (2, 3, 5, 'final', 0) cpu model: AMD Athlon(tm) XP 3000+ cpu mhz: 2166.513 oldstyle: no -pypy-revision: 11638 -startdate: Sat Apr 30 04:09:31 2005 -timeout: 576.0 seconds +pypy-revision: 11706 +startdate: Sun May 1 22:36:59 2005 +timeout: 529.0 seconds ============================================================ faking @@ -20,35 +20,293 @@ faking faking faking -==========================timeout========================== -Traceback (application-level): - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_pickle.py", line 73 in ? - test_main() - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_pickle.py", line 68 in test_main - PersPicklerTests - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_support.py", line 262 in run_unittest - run_suite(suite, testclass) - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_support.py", line 234 in run_suite - result = runner.run(suite) - File "/home/arigo/pypysrc/lib-python-2.3.4/unittest.py", line 658 in run - test(result) - File "/home/arigo/pypysrc/lib-python-2.3.4/unittest.py", line 389 in __call__ - test(result) - File "/home/arigo/pypysrc/lib-python-2.3.4/unittest.py", line 389 in __call__ - test(result) - File "/home/arigo/pypysrc/lib-python-2.3.4/unittest.py", line 229 in __call__ - testMethod() - File "/home/arigo/pypysrc/lib-python-2.3.4/test/pickletester.py", line 777 in test_dict_chunking - y = self.loads(s) - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_pickle.py", line 19 in loads - return pickle.loads(buf) - File "/home/arigo/pypysrc/lib-python-2.3.4/pickle.py", line 1394 in loads - return Unpickler(file).load() - File "/home/arigo/pypysrc/lib-python-2.3.4/pickle.py", line 871 in load - key = read(1) - File "/home/arigo/pypysrc/lib-python-2.3.4/StringIO.py", line 110 in read - newpos = min(self.pos+n, self.len) -KeyboardInterrupt -test_dict_chunking (__main__.PickleTests) ... ========================== closed ========================== -execution time: 576.576999903 seconds +faking +test_dump_closed_file (__main__.PickleTests) ... ok +test_garyp (__main__.PickleTests) ... ok +test_getinitargs (__main__.PickleTests) ... ok +test_global_ext1 (__main__.PickleTests) ... ok +test_global_ext2 (__main__.PickleTests) ... ok +test_global_ext4 (__main__.PickleTests) ... ok +test_highest_protocol (__main__.PickleTests) ... ok +test_insecure_strings (__main__.PickleTests) ... ok +test_ints (__main__.PickleTests) ... ok +test_load_closed_file (__main__.PickleTests) ... ok +test_load_from_canned_string (__main__.PickleTests) ... ok +test_long1 (__main__.PickleTests) ... ok +test_long4 (__main__.PickleTests) ... ok +test_maxint64 (__main__.PickleTests) ... Traceback (most recent call last): + File "/home/arigo/pypysrc/pypy/interpreter/py.py", line 78, in main_ + main.run_file(args[0], space) + File "/home/arigo/svn/pypy/dist/pypy/interpreter/main.py", line 59, in run_file + File "/home/arigo/svn/pypy/dist/pypy/interpreter/main.py", line 50, in run_string + File "/home/arigo/svn/pypy/dist/pypy/interpreter/main.py", line 39, in _run_eval_string + File "/home/arigo/pypysrc/pypy/interpreter/eval.py", line 24, in exec_code + return frame.run() + File "/home/arigo/pypysrc/pypy/interpreter/eval.py", line 70, in resume + result = self.eval(executioncontext) + File "/home/arigo/pypysrc/pypy/interpreter/pyframe.py", line 97, in eval + self.dispatch() + File "/home/arigo/pypysrc/pypy/interpreter/pyopcode.py", line 54, in dispatch + fn(self, oparg) + File "/home/arigo/pypysrc/pypy/interpreter/pyopcode.py", line 639, in CALL_FUNCTION + w_result = f.space.call_args(w_function, args) + File "/home/arigo/pypysrc/pypy/objspace/descroperation.py", line 92, in call_args + return w_obj.call_args(args) + File "/home/arigo/pypysrc/pypy/interpreter/function.py", line 40, in call_args + return frame.run() + File "/home/arigo/pypysrc/pypy/interpreter/eval.py", line 70, in resume + result = self.eval(executioncontext) + File "/home/arigo/pypysrc/pypy/interpreter/pyframe.py", line 97, in eval + self.dispatch() + File "/home/arigo/pypysrc/pypy/interpreter/pyopcode.py", line 54, in dispatch + fn(self, oparg) + File "/home/arigo/pypysrc/pypy/interpreter/pyopcode.py", line 639, in CALL_FUNCTION + w_result = f.space.call_args(w_function, args) + File "/home/arigo/pypysrc/pypy/objspace/descroperation.py", line 92, in call_args + return w_obj.call_args(args) + File "/home/arigo/pypysrc/pypy/interpreter/function.py", line 40, in call_args + return frame.run() + File "/home/arigo/pypysrc/pypy/interpreter/eval.py", line 70, in resume + result = self.eval(executioncontext) + File "/home/arigo/pypysrc/pypy/interpreter/pyframe.py", line 97, in eval + self.dispatch() + File "/home/arigo/pypysrc/pypy/interpreter/pyopcode.py", line 54, in dispatch + fn(self, oparg) + File "/home/arigo/pypysrc/pypy/interpreter/pyopcode.py", line 639, in CALL_FUNCTION + w_result = f.space.call_args(w_function, args) + File "/home/arigo/pypysrc/pypy/objspace/descroperation.py", line 92, in call_args + return w_obj.call_args(args) + File "/home/arigo/pypysrc/pypy/interpreter/function.py", line 40, in call_args + return frame.run() + File "/home/arigo/pypysrc/pypy/interpreter/eval.py", line 70, in resume + result = self.eval(executioncontext) + File "/home/arigo/pypysrc/pypy/interpreter/pyframe.py", line 97, in eval + self.dispatch() + File "/home/arigo/pypysrc/pypy/interpreter/pyopcode.py", line 54, in dispatch + fn(self, oparg) + File "/home/arigo/pypysrc/pypy/interpreter/pyopcode.py", line 639, in CALL_FUNCTION + w_result = f.space.call_args(w_function, args) + File "/home/arigo/pypysrc/pypy/objspace/descroperation.py", line 99, in call_args + return space.get_and_call_args(w_descr, w_obj, args) + File "/home/arigo/pypysrc/pypy/objspace/descroperation.py", line 80, in get_and_call_args + return descr.call_args(args.prepend(w_obj)) + File "/home/arigo/pypysrc/pypy/interpreter/function.py", line 40, in call_args + return frame.run() + File "/home/arigo/pypysrc/pypy/interpreter/gateway.py", line 249, in run + w_result = self._run() + File "", line 3, in _run_UWS_Method_Arguments + File "/home/arigo/pypysrc/pypy/interpreter/function.py", line 180, in descr_method_call + return self.call_args(__args__) + File "/home/arigo/pypysrc/pypy/interpreter/function.py", line 163, in call_args + return self.space.call_args(self.w_function, args) + File "/home/arigo/pypysrc/pypy/objspace/descroperation.py", line 92, in call_args + return w_obj.call_args(args) + File "/home/arigo/pypysrc/pypy/interpreter/function.py", line 40, in call_args + return frame.run() + File "/home/arigo/pypysrc/pypy/interpreter/eval.py", line 70, in resume + result = self.eval(executioncontext) + File "/home/arigo/pypysrc/pypy/interpreter/pyframe.py", line 97, in eval + self.dispatch() + File "/home/arigo/pypysrc/pypy/interpreter/pyopcode.py", line 54, in dispatch + fn(self, oparg) + File "/home/arigo/pypysrc/pypy/interpreter/pyopcode.py", line 639, in CALL_FUNCTION + w_result = f.space.call_args(w_function, args) + File "/home/arigo/pypysrc/pypy/objspace/descroperation.py", line 99, in call_args + return space.get_and_call_args(w_descr, w_obj, args) + File "/home/arigo/pypysrc/pypy/objspace/descroperation.py", line 80, in get_and_call_args + return descr.call_args(args.prepend(w_obj)) + File "/home/arigo/pypysrc/pypy/interpreter/function.py", line 40, in call_args + return frame.run() + File "/home/arigo/pypysrc/pypy/interpreter/eval.py", line 70, in resume + result = self.eval(executioncontext) + File "/home/arigo/pypysrc/pypy/interpreter/pyframe.py", line 97, in eval + self.dispatch() + File "/home/arigo/pypysrc/pypy/interpreter/pyopcode.py", line 54, in dispatch + fn(self, oparg) + File "/home/arigo/pypysrc/pypy/interpreter/pyopcode.py", line 639, in CALL_FUNCTION + w_result = f.space.call_args(w_function, args) + File "/home/arigo/pypysrc/pypy/objspace/descroperation.py", line 99, in call_args + return space.get_and_call_args(w_descr, w_obj, args) + File "/home/arigo/pypysrc/pypy/objspace/descroperation.py", line 80, in get_and_call_args + return descr.call_args(args.prepend(w_obj)) + File "/home/arigo/pypysrc/pypy/interpreter/function.py", line 40, in call_args + return frame.run() + File "/home/arigo/pypysrc/pypy/interpreter/eval.py", line 70, in resume + result = self.eval(executioncontext) + File "/home/arigo/pypysrc/pypy/interpreter/pyframe.py", line 97, in eval + self.dispatch() + File "/home/arigo/pypysrc/pypy/interpreter/pyopcode.py", line 54, in dispatch + fn(self, oparg) + File "/home/arigo/pypysrc/pypy/interpreter/pyopcode.py", line 639, in CALL_FUNCTION + w_result = f.space.call_args(w_function, args) + File "/home/arigo/pypysrc/pypy/objspace/descroperation.py", line 99, in call_args + return space.get_and_call_args(w_descr, w_obj, args) + File "/home/arigo/pypysrc/pypy/objspace/descroperation.py", line 80, in get_and_call_args + return descr.call_args(args.prepend(w_obj)) + File "/home/arigo/pypysrc/pypy/interpreter/function.py", line 40, in call_args + return frame.run() + File "/home/arigo/pypysrc/pypy/interpreter/eval.py", line 70, in resume + result = self.eval(executioncontext) + File "/home/arigo/pypysrc/pypy/interpreter/pyframe.py", line 97, in eval + self.dispatch() + File "/home/arigo/pypysrc/pypy/interpreter/pyopcode.py", line 54, in dispatch + fn(self, oparg) + File "/home/arigo/pypysrc/pypy/interpreter/pyopcode.py", line 639, in CALL_FUNCTION + w_result = f.space.call_args(w_function, args) + File "/home/arigo/pypysrc/pypy/objspace/descroperation.py", line 99, in call_args + return space.get_and_call_args(w_descr, w_obj, args) + File "/home/arigo/pypysrc/pypy/objspace/descroperation.py", line 80, in get_and_call_args + return descr.call_args(args.prepend(w_obj)) + File "/home/arigo/pypysrc/pypy/interpreter/function.py", line 40, in call_args + return frame.run() + File "/home/arigo/pypysrc/pypy/interpreter/gateway.py", line 249, in run + w_result = self._run() + File "", line 3, in _run_UWS_Method_Arguments + File "/home/arigo/pypysrc/pypy/interpreter/function.py", line 180, in descr_method_call + return self.call_args(__args__) + File "/home/arigo/pypysrc/pypy/interpreter/function.py", line 163, in call_args + return self.space.call_args(self.w_function, args) + File "/home/arigo/pypysrc/pypy/objspace/descroperation.py", line 92, in call_args + return w_obj.call_args(args) + File "/home/arigo/pypysrc/pypy/interpreter/function.py", line 40, in call_args + return frame.run() + File "/home/arigo/pypysrc/pypy/interpreter/eval.py", line 70, in resume + result = self.eval(executioncontext) + File "/home/arigo/pypysrc/pypy/interpreter/pyframe.py", line 97, in eval + self.dispatch() + File "/home/arigo/pypysrc/pypy/interpreter/pyopcode.py", line 54, in dispatch + fn(self, oparg) + File "/home/arigo/pypysrc/pypy/interpreter/pyopcode.py", line 639, in CALL_FUNCTION + w_result = f.space.call_args(w_function, args) + File "/home/arigo/pypysrc/pypy/objspace/descroperation.py", line 99, in call_args + return space.get_and_call_args(w_descr, w_obj, args) + File "/home/arigo/pypysrc/pypy/objspace/descroperation.py", line 80, in get_and_call_args + return descr.call_args(args.prepend(w_obj)) + File "/home/arigo/pypysrc/pypy/interpreter/function.py", line 40, in call_args + return frame.run() + File "/home/arigo/pypysrc/pypy/interpreter/gateway.py", line 249, in run + w_result = self._run() + File "", line 3, in _run_UWS_Method_Arguments + File "/home/arigo/pypysrc/pypy/interpreter/function.py", line 180, in descr_method_call + return self.call_args(__args__) + File "/home/arigo/pypysrc/pypy/interpreter/function.py", line 163, in call_args + return self.space.call_args(self.w_function, args) + File "/home/arigo/pypysrc/pypy/objspace/descroperation.py", line 92, in call_args + return w_obj.call_args(args) + File "/home/arigo/pypysrc/pypy/interpreter/function.py", line 40, in call_args + return frame.run() + File "/home/arigo/pypysrc/pypy/interpreter/eval.py", line 70, in resume + result = self.eval(executioncontext) + File "/home/arigo/pypysrc/pypy/interpreter/pyframe.py", line 97, in eval + self.dispatch() + File "/home/arigo/pypysrc/pypy/interpreter/pyopcode.py", line 54, in dispatch + fn(self, oparg) + File "/home/arigo/pypysrc/pypy/interpreter/pyopcode.py", line 653, in CALL_FUNCTION_VAR_KW + f.CALL_FUNCTION(oparg, w_varargs, w_varkw) + File "/home/arigo/pypysrc/pypy/interpreter/pyopcode.py", line 639, in CALL_FUNCTION + w_result = f.space.call_args(w_function, args) + File "/home/arigo/pypysrc/pypy/objspace/descroperation.py", line 99, in call_args + return space.get_and_call_args(w_descr, w_obj, args) + File "/home/arigo/pypysrc/pypy/objspace/descroperation.py", line 80, in get_and_call_args + return descr.call_args(args.prepend(w_obj)) + File "/home/arigo/pypysrc/pypy/interpreter/function.py", line 40, in call_args + return frame.run() + File "/home/arigo/pypysrc/pypy/interpreter/gateway.py", line 249, in run + w_result = self._run() + File "", line 3, in _run_UWS_Method_Arguments + File "/home/arigo/pypysrc/pypy/interpreter/function.py", line 180, in descr_method_call + return self.call_args(__args__) + File "/home/arigo/pypysrc/pypy/interpreter/function.py", line 163, in call_args + return self.space.call_args(self.w_function, args) + File "/home/arigo/pypysrc/pypy/objspace/descroperation.py", line 92, in call_args + return w_obj.call_args(args) + File "/home/arigo/pypysrc/pypy/interpreter/function.py", line 40, in call_args + return frame.run() + File "/home/arigo/pypysrc/pypy/interpreter/eval.py", line 70, in resume + result = self.eval(executioncontext) + File "/home/arigo/pypysrc/pypy/interpreter/pyframe.py", line 97, in eval + self.dispatch() + File "/home/arigo/pypysrc/pypy/interpreter/pyopcode.py", line 54, in dispatch + fn(self, oparg) + File "/home/arigo/pypysrc/pypy/interpreter/pyopcode.py", line 639, in CALL_FUNCTION + w_result = f.space.call_args(w_function, args) + File "/home/arigo/pypysrc/pypy/objspace/descroperation.py", line 92, in call_args + return w_obj.call_args(args) + File "/home/arigo/pypysrc/pypy/interpreter/function.py", line 40, in call_args + return frame.run() + File "/home/arigo/pypysrc/pypy/interpreter/eval.py", line 70, in resume + result = self.eval(executioncontext) + File "/home/arigo/pypysrc/pypy/interpreter/pyframe.py", line 97, in eval + self.dispatch() + File "/home/arigo/pypysrc/pypy/interpreter/pyopcode.py", line 54, in dispatch + fn(self, oparg) + File "/home/arigo/pypysrc/pypy/interpreter/pyopcode.py", line 639, in CALL_FUNCTION + w_result = f.space.call_args(w_function, args) + File "/home/arigo/pypysrc/pypy/objspace/descroperation.py", line 99, in call_args + return space.get_and_call_args(w_descr, w_obj, args) + File "/home/arigo/pypysrc/pypy/objspace/descroperation.py", line 80, in get_and_call_args + return descr.call_args(args.prepend(w_obj)) + File "/home/arigo/pypysrc/pypy/interpreter/function.py", line 40, in call_args + return frame.run() + File "/home/arigo/pypysrc/pypy/interpreter/gateway.py", line 249, in run + w_result = self._run() + File "", line 3, in _run_UWS_Method_Arguments + File "/home/arigo/pypysrc/pypy/interpreter/function.py", line 180, in descr_method_call + return self.call_args(__args__) + File "/home/arigo/pypysrc/pypy/interpreter/function.py", line 163, in call_args + return self.space.call_args(self.w_function, args) + File "/home/arigo/pypysrc/pypy/objspace/descroperation.py", line 92, in call_args + return w_obj.call_args(args) + File "/home/arigo/pypysrc/pypy/interpreter/function.py", line 40, in call_args + return frame.run() + File "/home/arigo/pypysrc/pypy/interpreter/eval.py", line 70, in resume + result = self.eval(executioncontext) + File "/home/arigo/pypysrc/pypy/interpreter/pyframe.py", line 97, in eval + self.dispatch() + File "/home/arigo/pypysrc/pypy/interpreter/pyopcode.py", line 54, in dispatch + fn(self, oparg) + File "/home/arigo/pypysrc/pypy/interpreter/pyopcode.py", line 639, in CALL_FUNCTION + w_result = f.space.call_args(w_function, args) + File "/home/arigo/pypysrc/pypy/objspace/descroperation.py", line 92, in call_args + return w_obj.call_args(args) + File "/home/arigo/pypysrc/pypy/interpreter/function.py", line 40, in call_args + return frame.run() + File "/home/arigo/pypysrc/pypy/interpreter/eval.py", line 70, in resume + result = self.eval(executioncontext) + File "/home/arigo/pypysrc/pypy/interpreter/pyframe.py", line 97, in eval + self.dispatch() + File "/home/arigo/pypysrc/pypy/interpreter/pyopcode.py", line 54, in dispatch + fn(self, oparg) + File "/home/arigo/pypysrc/pypy/interpreter/pyopcode.py", line 639, in CALL_FUNCTION + w_result = f.space.call_args(w_function, args) + File "/home/arigo/pypysrc/pypy/objspace/descroperation.py", line 99, in call_args + return space.get_and_call_args(w_descr, w_obj, args) + File "/home/arigo/pypysrc/pypy/objspace/descroperation.py", line 80, in get_and_call_args + return descr.call_args(args.prepend(w_obj)) + File "/home/arigo/pypysrc/pypy/interpreter/function.py", line 40, in call_args + return frame.run() + File "/home/arigo/pypysrc/pypy/interpreter/gateway.py", line 249, in run + w_result = self._run() + File "", line 3, in _run_UWS_ObjSpace_W_Root_Arguments + File "", line 4, in _mm_call_typeS0_perform_call + File "", line 2, in _mm_call_typeS0 + File "/home/arigo/pypysrc/pypy/objspace/std/typeobject.py", line 240, in call__Type + w_newobject = space.call_args(w_newfunc, __args__.prepend(w_type)) + File "/home/arigo/pypysrc/pypy/objspace/descroperation.py", line 92, in call_args + return w_obj.call_args(args) + File "/home/arigo/pypysrc/pypy/interpreter/function.py", line 40, in call_args + return frame.run() + File "/home/arigo/pypysrc/pypy/interpreter/gateway.py", line 249, in run + w_result = self._run() + File "", line 3, in _run_UWS_ObjSpace_W_Root_W_Root_W_Root + File "/home/arigo/pypysrc/pypy/objspace/std/inttype.py", line 21, in descr__new__ + w_longval = string_to_w_long(space, None, base=0, parser=e.parser) + File "/home/arigo/pypysrc/pypy/objspace/std/strutil.py", line 129, in string_to_w_long + digit = p.next_digit() + File "/home/arigo/pypysrc/pypy/objspace/std/strutil.py", line 83, in next_digit + self.error() + File "/home/arigo/pypysrc/pypy/objspace/std/strutil.py", line 33, in error + raise ParseStringError, 'invalid literal for %s(): %s' % (self.fname, self.literal) +pypy.objspace.std.strutil.ParseStringError========================== closed ========================== +execution time: 194.484822035 seconds exit status: 1 Modified: pypy/testresult/arigo at tismerysoft.de/test_pickletools.txt ============================================================================== --- pypy/testresult/arigo at tismerysoft.de/test_pickletools.txt (original) +++ pypy/testresult/arigo at tismerysoft.de/test_pickletools.txt Sun May 1 21:16:18 2005 @@ -1,14 +1,14 @@ testreport-version: 1.0 -command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 576 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python-2.3.4/test/test_pickletools.py +command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 529 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/2.3.4/test/test_pickletools.py run by: arigo at tismerysoft.de sys.platform: linux2 sys.version_info: (2, 3, 5, 'final', 0) cpu model: AMD Athlon(tm) XP 3000+ cpu mhz: 2166.513 oldstyle: no -pypy-revision: 11638 -startdate: Sat Apr 30 04:19:09 2005 -timeout: 576.0 seconds +pypy-revision: 11706 +startdate: Sun May 1 22:40:14 2005 +timeout: 529.0 seconds ============================================================ faking @@ -405,16 +405,16 @@ from line #58 of pickletools.__test__.disassembler_test Exception raised: Traceback (most recent call last): - File "/home/arigo/pypysrc/lib-python-2.3.4/doctest.py", line 442, in _run_examples_inner + File "/home/arigo/pypysrc/lib-python/2.3.4/doctest.py", line 442, in _run_examples_inner compileflags, 1) in globs File "", line 1, in ? - File "/home/arigo/pypysrc/lib-python-2.3.4/pickle.py", line 1386, in dumps + File "/home/arigo/pypysrc/lib-python/2.3.4/pickle.py", line 1386, in dumps Pickler(file, protocol, bin).dump(obj) - File "/home/arigo/pypysrc/lib-python-2.3.4/pickle.py", line 231, in dump + File "/home/arigo/pypysrc/lib-python/2.3.4/pickle.py", line 231, in dump self.save(obj) - File "/home/arigo/pypysrc/lib-python-2.3.4/pickle.py", line 313, in save + File "/home/arigo/pypysrc/lib-python/2.3.4/pickle.py", line 313, in save rv = reduce(self.proto) - File "/home/arigo/pypysrc/lib-python-2.3.4/copy_reg.py", line 69, in _reduce_ex + File "/home/arigo/pypysrc/lib-python/2.3.4/copy_reg.py", line 69, in _reduce_ex raise TypeError, "can't pickle %s objects" % base.__name__ TypeError: can't pickle method objects Trying: x = [pickle.PicklingError()] * 2 @@ -605,9 +605,9 @@ Expecting: 0: ] EMPTY_LIST 1: q BINPUT Traceback (application-level): - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_pickletools.py", line 3 in ? + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_pickletools.py", line 3 in ? test_support.run_doctest(pickletools) - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_support.py", line 290 in run_doctest + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_support.py", line 290 in run_doctest raise TestFailed("%d of %d doctests failed" % (f, t)) TestFailed: 5 of 94 doctests failed 0 @@ -715,5 +715,5 @@ 89 passed and 5 failed. ***Test Failed*** 5 failures. ========================== closed ========================== -execution time: 432.653767824 seconds +execution time: 193.671303034 seconds exit status: 1 Modified: pypy/testresult/arigo at tismerysoft.de/test_pkg.out ============================================================================== --- pypy/testresult/arigo at tismerysoft.de/test_pkg.out (original) +++ pypy/testresult/arigo at tismerysoft.de/test_pkg.out Sun May 1 21:16:18 2005 @@ -1,18 +1,18 @@ test_pkg running test t1 -mkdir /tmp/tmpFdfxEh/t1 -write /tmp/tmpFdfxEh/t1/__init__.py -sys.path = ['/tmp/tmpFdfxEh', '', '/home/arigo/pypysrc/pypy/lib', '/home/arigo/pypysrc/lib-python-2.3.4', '/usr/lib/python23.zip', '/usr/lib/python2.3', '/usr/lib/python2.3/plat-linux2', '/usr/lib/python2.3/lib-tk', '/usr/lib/python2.3/lib-dynload', '/usr/local/lib/python2.3/site-packages', '/usr/lib/python2.3/site-packages'] -rmdir /tmp/tmpFdfxEh/t1 -rmdir /tmp/tmpFdfxEh +mkdir /tmp/tmpz8qNZE/t1 +write /tmp/tmpz8qNZE/t1/__init__.py +sys.path = ['/tmp/tmpz8qNZE', '', '/home/arigo/pypysrc/pypy/lib', '/home/arigo/pypysrc/lib-python/modified-2.3.4', '/home/arigo/pypysrc/lib-python/2.3.4', '/usr/lib/python23.zip', '/usr/lib/python2.3', '/usr/lib/python2.3/plat-linux2', '/usr/lib/python2.3/lib-tk', '/usr/lib/python2.3/lib-dynload', '/usr/local/lib/python2.3/site-packages', '/usr/lib/python2.3/site-packages'] +rmdir /tmp/tmpz8qNZE/t1 +rmdir /tmp/tmpz8qNZE running test t2 -mkdir /tmp/tmpRTuO7A/t2 -write /tmp/tmpRTuO7A/t2/__init__.py -mkdir /tmp/tmpRTuO7A/t2/sub -write /tmp/tmpRTuO7A/t2/sub/__init__.py -mkdir /tmp/tmpRTuO7A/t2/sub/subsub -write /tmp/tmpRTuO7A/t2/sub/subsub/__init__.py -sys.path = ['/tmp/tmpRTuO7A', '', '/home/arigo/pypysrc/pypy/lib', '/home/arigo/pypysrc/lib-python-2.3.4', '/usr/lib/python23.zip', '/usr/lib/python2.3', '/usr/lib/python2.3/plat-linux2', '/usr/lib/python2.3/lib-tk', '/usr/lib/python2.3/lib-dynload', '/usr/local/lib/python2.3/site-packages', '/usr/lib/python2.3/site-packages'] +mkdir /tmp/tmpo8IVEO/t2 +write /tmp/tmpo8IVEO/t2/__init__.py +mkdir /tmp/tmpo8IVEO/t2/sub +write /tmp/tmpo8IVEO/t2/sub/__init__.py +mkdir /tmp/tmpo8IVEO/t2/sub/subsub +write /tmp/tmpo8IVEO/t2/sub/subsub/__init__.py +sys.path = ['/tmp/tmpo8IVEO', '', '/home/arigo/pypysrc/pypy/lib', '/home/arigo/pypysrc/lib-python/modified-2.3.4', '/home/arigo/pypysrc/lib-python/2.3.4', '/usr/lib/python23.zip', '/usr/lib/python2.3', '/usr/lib/python2.3/plat-linux2', '/usr/lib/python2.3/lib-tk', '/usr/lib/python2.3/lib-dynload', '/usr/local/lib/python2.3/site-packages', '/usr/lib/python2.3/site-packages'] t2 loading doc for t2 t2.sub.subsub loading @@ -23,56 +23,56 @@ ['spam', 'sub', 'subsub', 't2'] t2 t2.sub t2.sub.subsub ['spam', 'sub', 'subsub', 't2'] -rmdir /tmp/tmpRTuO7A/t2/sub/subsub -rmdir /tmp/tmpRTuO7A/t2/sub -rmdir /tmp/tmpRTuO7A/t2 -rmdir /tmp/tmpRTuO7A +rmdir /tmp/tmpo8IVEO/t2/sub/subsub +rmdir /tmp/tmpo8IVEO/t2/sub +rmdir /tmp/tmpo8IVEO/t2 +rmdir /tmp/tmpo8IVEO running test t3 -mkdir /tmp/tmpnyE7z8/t3 -write /tmp/tmpnyE7z8/t3/__init__.py -mkdir /tmp/tmpnyE7z8/t3/sub -write /tmp/tmpnyE7z8/t3/sub/__init__.py -mkdir /tmp/tmpnyE7z8/t3/sub/subsub -write /tmp/tmpnyE7z8/t3/sub/subsub/__init__.py -sys.path = ['/tmp/tmpnyE7z8', '', '/home/arigo/pypysrc/pypy/lib', '/home/arigo/pypysrc/lib-python-2.3.4', '/usr/lib/python23.zip', '/usr/lib/python2.3', '/usr/lib/python2.3/plat-linux2', '/usr/lib/python2.3/lib-tk', '/usr/lib/python2.3/lib-dynload', '/usr/local/lib/python2.3/site-packages', '/usr/lib/python2.3/site-packages'] +mkdir /tmp/tmp1TxdlD/t3 +write /tmp/tmp1TxdlD/t3/__init__.py +mkdir /tmp/tmp1TxdlD/t3/sub +write /tmp/tmp1TxdlD/t3/sub/__init__.py +mkdir /tmp/tmp1TxdlD/t3/sub/subsub +write /tmp/tmp1TxdlD/t3/sub/subsub/__init__.py +sys.path = ['/tmp/tmp1TxdlD', '', '/home/arigo/pypysrc/pypy/lib', '/home/arigo/pypysrc/lib-python/modified-2.3.4', '/home/arigo/pypysrc/lib-python/2.3.4', '/usr/lib/python23.zip', '/usr/lib/python2.3', '/usr/lib/python2.3/plat-linux2', '/usr/lib/python2.3/lib-tk', '/usr/lib/python2.3/lib-dynload', '/usr/local/lib/python2.3/site-packages', '/usr/lib/python2.3/site-packages'] t3 loading t3.sub.subsub loading t3 t3.sub t3.sub.subsub t3 loading Traceback (most recent call last): - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_pkg.py", line 66, in runtest + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_pkg.py", line 66, in runtest execfile(fname, globals(), {}) - File "/tmp/tmp9jjoPv", line 5, in ? + File "/tmp/tmp5f1RBf", line 5, in ? reload(t3.sub) AttributeError: 'module' object has no attribute 'sub' -rmdir /tmp/tmpnyE7z8/t3/sub/subsub -rmdir /tmp/tmpnyE7z8/t3/sub -rmdir /tmp/tmpnyE7z8/t3 -rmdir /tmp/tmpnyE7z8 +rmdir /tmp/tmp1TxdlD/t3/sub/subsub +rmdir /tmp/tmp1TxdlD/t3/sub +rmdir /tmp/tmp1TxdlD/t3 +rmdir /tmp/tmp1TxdlD running test t4 -write /tmp/tmpgBvVYj/t4.py -mkdir /tmp/tmpgBvVYj/t4 -write /tmp/tmpgBvVYj/t4/__init__.py -write /tmp/tmpgBvVYj/t4/sub.py -mkdir /tmp/tmpgBvVYj/t4/sub -write /tmp/tmpgBvVYj/t4/sub/__init__.py -write /tmp/tmpgBvVYj/t4/sub/subsub.py -mkdir /tmp/tmpgBvVYj/t4/sub/subsub -write /tmp/tmpgBvVYj/t4/sub/subsub/__init__.py -sys.path = ['/tmp/tmpgBvVYj', '', '/home/arigo/pypysrc/pypy/lib', '/home/arigo/pypysrc/lib-python-2.3.4', '/usr/lib/python23.zip', '/usr/lib/python2.3', '/usr/lib/python2.3/plat-linux2', '/usr/lib/python2.3/lib-tk', '/usr/lib/python2.3/lib-dynload', '/usr/local/lib/python2.3/site-packages', '/usr/lib/python2.3/site-packages'] +write /tmp/tmpcjiagJ/t4.py +mkdir /tmp/tmpcjiagJ/t4 +write /tmp/tmpcjiagJ/t4/__init__.py +write /tmp/tmpcjiagJ/t4/sub.py +mkdir /tmp/tmpcjiagJ/t4/sub +write /tmp/tmpcjiagJ/t4/sub/__init__.py +write /tmp/tmpcjiagJ/t4/sub/subsub.py +mkdir /tmp/tmpcjiagJ/t4/sub/subsub +write /tmp/tmpcjiagJ/t4/sub/subsub/__init__.py +sys.path = ['/tmp/tmpcjiagJ', '', '/home/arigo/pypysrc/pypy/lib', '/home/arigo/pypysrc/lib-python/modified-2.3.4', '/home/arigo/pypysrc/lib-python/2.3.4', '/usr/lib/python23.zip', '/usr/lib/python2.3', '/usr/lib/python2.3/plat-linux2', '/usr/lib/python2.3/lib-tk', '/usr/lib/python2.3/lib-dynload', '/usr/local/lib/python2.3/site-packages', '/usr/lib/python2.3/site-packages'] t4 loading t4.sub.subsub loading t4.sub.subsub.spam = 1 -rmdir /tmp/tmpgBvVYj/t4/sub/subsub -rmdir /tmp/tmpgBvVYj/t4/sub -rmdir /tmp/tmpgBvVYj/t4 -rmdir /tmp/tmpgBvVYj +rmdir /tmp/tmpcjiagJ/t4/sub/subsub +rmdir /tmp/tmpcjiagJ/t4/sub +rmdir /tmp/tmpcjiagJ/t4 +rmdir /tmp/tmpcjiagJ running test t5 -mkdir /tmp/tmp-80LSz/t5 -write /tmp/tmp-80LSz/t5/__init__.py -write /tmp/tmp-80LSz/t5/string.py -write /tmp/tmp-80LSz/t5/foo.py -sys.path = ['/tmp/tmp-80LSz', '', '/home/arigo/pypysrc/pypy/lib', '/home/arigo/pypysrc/lib-python-2.3.4', '/usr/lib/python23.zip', '/usr/lib/python2.3', '/usr/lib/python2.3/plat-linux2', '/usr/lib/python2.3/lib-tk', '/usr/lib/python2.3/lib-dynload', '/usr/local/lib/python2.3/site-packages', '/usr/lib/python2.3/site-packages'] +mkdir /tmp/tmp7bnIHQ/t5 +write /tmp/tmp7bnIHQ/t5/__init__.py +write /tmp/tmp7bnIHQ/t5/string.py +write /tmp/tmp7bnIHQ/t5/foo.py +sys.path = ['/tmp/tmp7bnIHQ', '', '/home/arigo/pypysrc/pypy/lib', '/home/arigo/pypysrc/lib-python/modified-2.3.4', '/home/arigo/pypysrc/lib-python/2.3.4', '/usr/lib/python23.zip', '/usr/lib/python2.3', '/usr/lib/python2.3/plat-linux2', '/usr/lib/python2.3/lib-tk', '/usr/lib/python2.3/lib-dynload', '/usr/local/lib/python2.3/site-packages', '/usr/lib/python2.3/site-packages'] t5.foo loading t5.string loading 1 @@ -80,42 +80,42 @@ ['__file__', '__name__', '__path__', 'foo', 'string', 't5'] ['__file__', '__name__', 'string'] ['__file__', '__name__', 'spam'] -rmdir /tmp/tmp-80LSz/t5 -rmdir /tmp/tmp-80LSz +rmdir /tmp/tmp7bnIHQ/t5 +rmdir /tmp/tmp7bnIHQ running test t6 -mkdir /tmp/tmpsE24Je/t6 -write /tmp/tmpsE24Je/t6/__init__.py -write /tmp/tmpsE24Je/t6/spam.py -write /tmp/tmpsE24Je/t6/ham.py -write /tmp/tmpsE24Je/t6/eggs.py -sys.path = ['/tmp/tmpsE24Je', '', '/home/arigo/pypysrc/pypy/lib', '/home/arigo/pypysrc/lib-python-2.3.4', '/usr/lib/python23.zip', '/usr/lib/python2.3', '/usr/lib/python2.3/plat-linux2', '/usr/lib/python2.3/lib-tk', '/usr/lib/python2.3/lib-dynload', '/usr/local/lib/python2.3/site-packages', '/usr/lib/python2.3/site-packages'] +mkdir /tmp/tmp_BK-il/t6 +write /tmp/tmp_BK-il/t6/__init__.py +write /tmp/tmp_BK-il/t6/spam.py +write /tmp/tmp_BK-il/t6/ham.py +write /tmp/tmp_BK-il/t6/eggs.py +sys.path = ['/tmp/tmp_BK-il', '', '/home/arigo/pypysrc/pypy/lib', '/home/arigo/pypysrc/lib-python/modified-2.3.4', '/home/arigo/pypysrc/lib-python/2.3.4', '/usr/lib/python23.zip', '/usr/lib/python2.3', '/usr/lib/python2.3/plat-linux2', '/usr/lib/python2.3/lib-tk', '/usr/lib/python2.3/lib-dynload', '/usr/local/lib/python2.3/site-packages', '/usr/lib/python2.3/site-packages'] ['__all__', '__file__', '__name__', '__path__'] Traceback (most recent call last): - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_pkg.py", line 66, in runtest + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_pkg.py", line 66, in runtest execfile(fname, globals(), {}) - File "/tmp/tmpNMvaHF", line 4, in ? + File "/tmp/tmpEyX2HK", line 4, in ? from t6 import * AttributeError: 'module' object has no attribute 'spam' -rmdir /tmp/tmpsE24Je/t6 -rmdir /tmp/tmpsE24Je +rmdir /tmp/tmp_BK-il/t6 +rmdir /tmp/tmp_BK-il running test t7 -write /tmp/tmpO3gwGP/t7.py -mkdir /tmp/tmpO3gwGP/t7 -write /tmp/tmpO3gwGP/t7/__init__.py -write /tmp/tmpO3gwGP/t7/sub.py -mkdir /tmp/tmpO3gwGP/t7/sub -write /tmp/tmpO3gwGP/t7/sub/__init__.py -write /tmp/tmpO3gwGP/t7/sub/subsub.py -mkdir /tmp/tmpO3gwGP/t7/sub/subsub -write /tmp/tmpO3gwGP/t7/sub/subsub/__init__.py -sys.path = ['/tmp/tmpO3gwGP', '', '/home/arigo/pypysrc/pypy/lib', '/home/arigo/pypysrc/lib-python-2.3.4', '/usr/lib/python23.zip', '/usr/lib/python2.3', '/usr/lib/python2.3/plat-linux2', '/usr/lib/python2.3/lib-tk', '/usr/lib/python2.3/lib-dynload', '/usr/local/lib/python2.3/site-packages', '/usr/lib/python2.3/site-packages'] +write /tmp/tmprKp_gw/t7.py +mkdir /tmp/tmprKp_gw/t7 +write /tmp/tmprKp_gw/t7/__init__.py +write /tmp/tmprKp_gw/t7/sub.py +mkdir /tmp/tmprKp_gw/t7/sub +write /tmp/tmprKp_gw/t7/sub/__init__.py +write /tmp/tmprKp_gw/t7/sub/subsub.py +mkdir /tmp/tmprKp_gw/t7/sub/subsub +write /tmp/tmprKp_gw/t7/sub/subsub/__init__.py +sys.path = ['/tmp/tmprKp_gw', '', '/home/arigo/pypysrc/pypy/lib', '/home/arigo/pypysrc/lib-python/modified-2.3.4', '/home/arigo/pypysrc/lib-python/2.3.4', '/usr/lib/python23.zip', '/usr/lib/python2.3', '/usr/lib/python2.3/plat-linux2', '/usr/lib/python2.3/lib-tk', '/usr/lib/python2.3/lib-dynload', '/usr/local/lib/python2.3/site-packages', '/usr/lib/python2.3/site-packages'] t7 loading ['__file__', '__name__', '__path__'] ['__file__', '__name__', '__path__'] t7.sub.subsub loading ['__file__', '__name__', '__path__', 'spam'] t7.sub.subsub.spam = 1 -rmdir /tmp/tmpO3gwGP/t7/sub/subsub -rmdir /tmp/tmpO3gwGP/t7/sub -rmdir /tmp/tmpO3gwGP/t7 -rmdir /tmp/tmpO3gwGP +rmdir /tmp/tmprKp_gw/t7/sub/subsub +rmdir /tmp/tmprKp_gw/t7/sub +rmdir /tmp/tmprKp_gw/t7 +rmdir /tmp/tmprKp_gw Modified: pypy/testresult/arigo at tismerysoft.de/test_pkg.txt ============================================================================== --- pypy/testresult/arigo at tismerysoft.de/test_pkg.txt (original) +++ pypy/testresult/arigo at tismerysoft.de/test_pkg.txt Sun May 1 21:16:18 2005 @@ -1,17 +1,17 @@ testreport-version: 1.0 -command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 576 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python-2.3.4/test/test_pkg.py +command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 483 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/2.3.4/test/test_pkg.py run by: arigo at tismerysoft.de sys.platform: linux2 sys.version_info: (2, 3, 5, 'final', 0) cpu model: AMD Athlon(tm) XP 3000+ cpu mhz: 2166.513 oldstyle: no -pypy-revision: 11638 -startdate: Sat Apr 30 04:26:22 2005 -timeout: 576.0 seconds +pypy-revision: 11706 +startdate: Sun May 1 22:43:28 2005 +timeout: 484.0 seconds OUTPUT TEST -see output in: /home/arigo/pypysrc/lib-python-2.3.4/test/result/arigo at tismerysoft.de/test_pkg.out +see output in: /home/arigo/pypysrc/testresult/arigo at tismerysoft.de/test_pkg.out ============================================================ faking faking @@ -20,5 +20,5 @@ faking FAILED: test output differs ========================== closed ========================== -execution time: 44.2915828228 seconds +execution time: 19.8641049862 seconds exit status: 0 Modified: pypy/testresult/arigo at tismerysoft.de/test_pkgimport.txt ============================================================================== --- pypy/testresult/arigo at tismerysoft.de/test_pkgimport.txt (original) +++ pypy/testresult/arigo at tismerysoft.de/test_pkgimport.txt Sun May 1 21:16:18 2005 @@ -1,14 +1,14 @@ testreport-version: 1.0 -command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 529 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/2.3.4/test/test_pkgimport.py +command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 484 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/2.3.4/test/test_pkgimport.py run by: arigo at tismerysoft.de sys.platform: linux2 sys.version_info: (2, 3, 5, 'final', 0) cpu model: AMD Athlon(tm) XP 3000+ cpu mhz: 2166.513 oldstyle: no -pypy-revision: 11698 -startdate: Sun May 1 19:00:49 2005 -timeout: 529.0 seconds +pypy-revision: 11706 +startdate: Sun May 1 22:43:49 2005 +timeout: 484.0 seconds ============================================================ faking @@ -45,9 +45,9 @@ AssertionError ---------------------------------------------------------------------- -Ran 1 test in 1.981s +Ran 1 test in 1.980s FAILED (failures=1) ========================== closed ========================== -execution time: 10.2511100769 seconds +execution time: 10.2786741257 seconds exit status: 1 Modified: pypy/testresult/arigo at tismerysoft.de/test_pow.txt ============================================================================== --- pypy/testresult/arigo at tismerysoft.de/test_pow.txt (original) +++ pypy/testresult/arigo at tismerysoft.de/test_pow.txt Sun May 1 21:16:18 2005 @@ -1,14 +1,14 @@ testreport-version: 1.0 -command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 575 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/2.3.4/test/test_pow.py +command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 483 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/2.3.4/test/test_pow.py run by: arigo at tismerysoft.de sys.platform: linux2 sys.version_info: (2, 3, 5, 'final', 0) cpu model: AMD Athlon(tm) XP 3000+ cpu mhz: 2166.513 oldstyle: no -pypy-revision: 11698 -startdate: Sun May 1 19:02:42 2005 -timeout: 576.0 seconds +pypy-revision: 11706 +startdate: Sun May 1 22:44:00 2005 +timeout: 484.0 seconds ============================================================ faking @@ -36,8 +36,8 @@ testMethod() File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_pow.py", line 63 in test_powlong self.powtest(long) - File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_pow.py", line 56 in powtest - pow(type(i),j)% type(k) + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_pow.py", line 49 in powtest + for k in range(kl, kh+1): KeyboardInterrupt test_bug643260 (__main__.PowTest) ... ok test_bug705231 (__main__.PowTest) ... ok @@ -45,5 +45,5 @@ test_powfloat (__main__.PowTest) ... ok test_powint (__main__.PowTest) ... ok test_powlong (__main__.PowTest) ... ========================== closed ========================== -execution time: 576.187040806 seconds +execution time: 483.233322144 seconds exit status: 1 Modified: pypy/testresult/arigo at tismerysoft.de/test_pprint.txt ============================================================================== --- pypy/testresult/arigo at tismerysoft.de/test_pprint.txt (original) +++ pypy/testresult/arigo at tismerysoft.de/test_pprint.txt Sun May 1 21:16:18 2005 @@ -1,14 +1,14 @@ testreport-version: 1.0 -command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 529 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/2.3.4/test/test_pprint.py +command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 484 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/2.3.4/test/test_pprint.py run by: arigo at tismerysoft.de sys.platform: linux2 sys.version_info: (2, 3, 5, 'final', 0) cpu model: AMD Athlon(tm) XP 3000+ cpu mhz: 2166.513 oldstyle: no -pypy-revision: 11698 -startdate: Sun May 1 19:12:19 2005 -timeout: 529.0 seconds +pypy-revision: 11706 +startdate: Sun May 1 22:52:04 2005 +timeout: 484.0 seconds ============================================================ faking @@ -24,9 +24,9 @@ test_unreadable (__main__.QueryTestCase) ... ok ---------------------------------------------------------------------- -Ran 6 tests in 96.551s +Ran 6 tests in 96.679s OK ========================== closed ========================== -execution time: 104.119084835 seconds +execution time: 104.24987793 seconds exit status: 0 Modified: pypy/testresult/arigo at tismerysoft.de/test_profile.txt ============================================================================== --- pypy/testresult/arigo at tismerysoft.de/test_profile.txt (original) +++ pypy/testresult/arigo at tismerysoft.de/test_profile.txt Sun May 1 21:16:18 2005 @@ -1,14 +1,14 @@ testreport-version: 1.0 -command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 529 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/2.3.4/test/test_profile.py +command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 483 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/2.3.4/test/test_profile.py run by: arigo at tismerysoft.de sys.platform: linux2 sys.version_info: (2, 3, 5, 'final', 0) cpu model: AMD Athlon(tm) XP 3000+ cpu mhz: 2166.513 oldstyle: no -pypy-revision: 11698 -startdate: Sun May 1 19:14:03 2005 -timeout: 529.0 seconds +pypy-revision: 11706 +startdate: Sun May 1 22:53:48 2005 +timeout: 484.0 seconds OUTPUT TEST see output in: /home/arigo/pypysrc/testresult/arigo at tismerysoft.de/test_profile.out @@ -22,5 +22,5 @@ faking FAILED: test output differs ========================== closed ========================== -execution time: 26.6172568798 seconds +execution time: 26.6098470688 seconds exit status: 0 Modified: pypy/testresult/arigo at tismerysoft.de/test_profilehooks.txt ============================================================================== --- pypy/testresult/arigo at tismerysoft.de/test_profilehooks.txt (original) +++ pypy/testresult/arigo at tismerysoft.de/test_profilehooks.txt Sun May 1 21:16:18 2005 @@ -6,8 +6,8 @@ cpu model: AMD Athlon(tm) XP 3000+ cpu mhz: 2166.513 oldstyle: no -pypy-revision: 11698 -startdate: Sun May 1 19:14:31 2005 +pypy-revision: 11706 +startdate: Sun May 1 22:54:16 2005 timeout: 529.0 seconds ============================================================ @@ -35,9 +35,9 @@ test_simple (__main__.ProfileSimulatorTestCase) ... ok ---------------------------------------------------------------------- -Ran 17 tests in 8.822s +Ran 17 tests in 8.894s OK ========================== closed ========================== -execution time: 19.3743259907 seconds +execution time: 19.3750610352 seconds exit status: 0 Modified: pypy/testresult/arigo at tismerysoft.de/test_pyclbr.txt ============================================================================== --- pypy/testresult/arigo at tismerysoft.de/test_pyclbr.txt (original) +++ pypy/testresult/arigo at tismerysoft.de/test_pyclbr.txt Sun May 1 21:16:18 2005 @@ -1,14 +1,14 @@ testreport-version: 1.0 -command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 576 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python-2.3.4/test/test_pyclbr.py +command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 484 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/2.3.4/test/test_pyclbr.py run by: arigo at tismerysoft.de sys.platform: linux2 sys.version_info: (2, 3, 5, 'final', 0) cpu model: AMD Athlon(tm) XP 3000+ cpu mhz: 2166.513 oldstyle: no -pypy-revision: 11638 -startdate: Sat Apr 30 04:46:30 2005 -timeout: 576.0 seconds +pypy-revision: 11706 +startdate: Sun May 1 22:54:35 2005 +timeout: 484.0 seconds ============================================================ faking @@ -21,56 +21,32 @@ faking faking ==========================timeout========================== -l1=['object'] -l2=[] -ignore=() -class= Traceback (application-level): - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_pyclbr.py", line 162 in ? + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_pyclbr.py", line 162 in ? test_main() - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_pyclbr.py", line 158 in test_main + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_pyclbr.py", line 158 in test_main run_unittest(PyclbrTest) - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_support.py", line 262 in run_unittest + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_support.py", line 262 in run_unittest run_suite(suite, testclass) - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_support.py", line 246 in run_suite - raise TestFailed(msg) -TestFailed: errors occurred in __main__.PyclbrTest -test_easy (__main__.PyclbrTest) ... FAIL -test_others (__main__.PyclbrTest) ... ??? _verify -FAIL - -====================================================================== -FAIL: test_easy (__main__.PyclbrTest) ----------------------------------------------------------------------- -Traceback (most recent call last): - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_pyclbr.py", line 131, in test_easy - self.checkModule('pyclbr') - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_pyclbr.py", line 91, in checkModule - self.assertListEq(real_bases, pyclbr_bases, ignore) - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_pyclbr.py", line 30, in assertListEq - self.fail("%r missing" % missing.pop()) - File "/home/arigo/pypysrc/lib-python-2.3.4/unittest.py", line 270, in fail - raise self.failureException, msg -AssertionError: 'object' missing - -====================================================================== -FAIL: test_others (__main__.PyclbrTest) ----------------------------------------------------------------------- -Traceback (most recent call last): - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_pyclbr.py", line 140, in test_others - cm('random', ignore=('Random',)) # from _random import Random as CoreGenerator - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_pyclbr.py", line 80, in checkModule - self.assertHasattr(module, name, ignore) - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_pyclbr.py", line 37, in assertHasattr - 'expected hasattr(%r, %r)' % (obj, attr)) - File "/home/arigo/pypysrc/lib-python-2.3.4/unittest.py", line 278, in failUnless - if not expr: raise self.failureException, msg -AssertionError: expected hasattr(, '_verify') - ----------------------------------------------------------------------- -Ran 2 tests in 650.405s - -FAILED (failures=2) -========================== closed ========================== -execution time: 722.458581924 seconds + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_support.py", line 234 in run_suite + result = runner.run(suite) + File "/home/arigo/pypysrc/lib-python/2.3.4/unittest.py", line 658 in run + test(result) + File "/home/arigo/pypysrc/lib-python/2.3.4/unittest.py", line 389 in __call__ + test(result) + File "/home/arigo/pypysrc/lib-python/2.3.4/unittest.py", line 389 in __call__ + test(result) + File "/home/arigo/pypysrc/lib-python/2.3.4/unittest.py", line 229 in __call__ + testMethod() + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_pyclbr.py", line 131 in test_easy + self.checkModule('pyclbr') + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_pyclbr.py", line 64 in checkModule + dict = pyclbr.readmodule_ex(moduleName) + File "/home/arigo/pypysrc/lib-python/2.3.4/pyclbr.py", line 106 in readmodule_ex + return _readmodule(module, path) + File "/home/arigo/pypysrc/lib-python/2.3.4/pyclbr.py", line 159 in _readmodule + if tokentype == DEDENT: +KeyboardInterrupt +test_easy (__main__.PyclbrTest) ... ========================== closed ========================== +execution time: 485.020820141 seconds exit status: 1 Modified: pypy/testresult/arigo at tismerysoft.de/test_repr.txt ============================================================================== --- pypy/testresult/arigo at tismerysoft.de/test_repr.txt (original) +++ pypy/testresult/arigo at tismerysoft.de/test_repr.txt Sun May 1 21:16:18 2005 @@ -1,14 +1,14 @@ testreport-version: 1.0 -command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 576 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python-2.3.4/test/test_repr.py +command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 483 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/2.3.4/test/test_repr.py run by: arigo at tismerysoft.de sys.platform: linux2 sys.version_info: (2, 3, 5, 'final', 0) cpu model: AMD Athlon(tm) XP 3000+ cpu mhz: 2166.513 oldstyle: no -pypy-revision: 11638 -startdate: Sat Apr 30 05:04:48 2005 -timeout: 576.0 seconds +pypy-revision: 11706 +startdate: Sun May 1 23:02:41 2005 +timeout: 484.0 seconds ============================================================ faking @@ -18,13 +18,13 @@ faking faking Traceback (application-level): - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_repr.py", line 289 in ? + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_repr.py", line 289 in ? test_main() - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_repr.py", line 283 in test_main + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_repr.py", line 283 in test_main run_unittest(ReprTests) - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_support.py", line 262 in run_unittest + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_support.py", line 262 in run_unittest run_suite(suite, testclass) - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_support.py", line 246 in run_suite + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_support.py", line 246 in run_suite raise TestFailed(msg) TestFailed: errors occurred in __main__.ReprTests test_buffer (__main__.ReprTests) ... FAIL @@ -44,9 +44,9 @@ FAIL: test_buffer (__main__.ReprTests) ---------------------------------------------------------------------- Traceback (most recent call last): - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_repr.py", line 150, in test_buffer + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_repr.py", line 150, in test_buffer self.failUnless(repr(x).startswith('') - File "/home/arigo/pypysrc/lib-python-2.3.4/unittest.py", line 302, in failUnlessEqual + File "/home/arigo/pypysrc/lib-python/2.3.4/unittest.py", line 302, in failUnlessEqual raise self.failureException, \ -AssertionError: '' != '' +AssertionError: '' != '' ====================================================================== FAIL: test_descriptors (__main__.ReprTests) ---------------------------------------------------------------------- Traceback (most recent call last): - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_repr.py", line 159, in test_descriptors + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_repr.py", line 159, in test_descriptors eq(repr(dict.items), "") - File "/home/arigo/pypysrc/lib-python-2.3.4/unittest.py", line 302, in failUnlessEqual + File "/home/arigo/pypysrc/lib-python/2.3.4/unittest.py", line 302, in failUnlessEqual raise self.failureException, \ -AssertionError: '' != "" +AssertionError: '' != "" ====================================================================== FAIL: test_instance (__main__.ReprTests) ---------------------------------------------------------------------- Traceback (most recent call last): - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_repr.py", line 84, in test_instance + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_repr.py", line 84, in test_instance eq(r(i1), repr(i1)) - File "/home/arigo/pypysrc/lib-python-2.3.4/unittest.py", line 302, in failUnlessEqual + File "/home/arigo/pypysrc/lib-python/2.3.4/unittest.py", line 302, in failUnlessEqual raise self.failureException, \ AssertionError: "ClassWit...Repr('a')" != "ClassWithLongRepr('a')" @@ -84,9 +84,9 @@ FAIL: test_lambda (__main__.ReprTests) ---------------------------------------------------------------------- Traceback (most recent call last): - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_repr.py", line 110, in test_lambda + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_repr.py", line 110, in test_lambda self.failUnless(repr(lambda x: x).startswith( - File "/home/arigo/pypysrc/lib-python-2.3.4/unittest.py", line 278, in failUnless + File "/home/arigo/pypysrc/lib-python/2.3.4/unittest.py", line 278, in failUnless if not expr: raise self.failureException, msg AssertionError @@ -94,16 +94,16 @@ FAIL: test_xrange (__main__.ReprTests) ---------------------------------------------------------------------- Traceback (most recent call last): - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_repr.py", line 125, in test_xrange + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_repr.py", line 125, in test_xrange eq(repr(xrange(1)), 'xrange(1)') - File "/home/arigo/pypysrc/lib-python-2.3.4/unittest.py", line 302, in failUnlessEqual + File "/home/arigo/pypysrc/lib-python/2.3.4/unittest.py", line 302, in failUnlessEqual raise self.failureException, \ -AssertionError: '' != 'xrange(1)' +AssertionError: '' != 'xrange(1)' ---------------------------------------------------------------------- -Ran 12 tests in 18.145s +Ran 12 tests in 18.130s FAILED (failures=6) ========================== closed ========================== -execution time: 28.0595591068 seconds +execution time: 28.7360889912 seconds exit status: 1 Modified: pypy/testresult/arigo at tismerysoft.de/test_rfc822.txt ============================================================================== --- pypy/testresult/arigo at tismerysoft.de/test_rfc822.txt (original) +++ pypy/testresult/arigo at tismerysoft.de/test_rfc822.txt Sun May 1 21:16:18 2005 @@ -1,13 +1,13 @@ testreport-version: 1.0 -command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 483 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/2.3.4/test/test_rfc822.py +command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 484 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/2.3.4/test/test_rfc822.py run by: arigo at tismerysoft.de sys.platform: linux2 sys.version_info: (2, 3, 5, 'final', 0) cpu model: AMD Athlon(tm) XP 3000+ cpu mhz: 2166.513 oldstyle: no -pypy-revision: 11698 -startdate: Sun May 1 19:15:03 2005 +pypy-revision: 11706 +startdate: Sun May 1 23:03:10 2005 timeout: 484.0 seconds ============================================================ @@ -30,9 +30,9 @@ test_twisted (__main__.MessageTestCase) ... ok ---------------------------------------------------------------------- -Ran 12 tests in 24.339s +Ran 12 tests in 24.263s OK ========================== closed ========================== -execution time: 32.0260329247 seconds +execution time: 31.9332590103 seconds exit status: 0 Modified: pypy/testresult/arigo at tismerysoft.de/test_richcmp.txt ============================================================================== --- pypy/testresult/arigo at tismerysoft.de/test_richcmp.txt (original) +++ pypy/testresult/arigo at tismerysoft.de/test_richcmp.txt Sun May 1 21:16:18 2005 @@ -1,14 +1,14 @@ testreport-version: 1.0 -command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 576 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py +command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 529 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py run by: arigo at tismerysoft.de sys.platform: linux2 sys.version_info: (2, 3, 5, 'final', 0) cpu model: AMD Athlon(tm) XP 3000+ cpu mhz: 2166.513 oldstyle: no -pypy-revision: 11638 -startdate: Sat Apr 30 05:05:54 2005 -timeout: 576.0 seconds +pypy-revision: 11706 +startdate: Sun May 1 23:03:43 2005 +timeout: 529.0 seconds ============================================================ faking @@ -32,396 +32,396 @@ ERROR: test_recursion2 (__main__.MiscTest) ---------------------------------------------------------------------- Traceback (most recent call last): - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py", line 273, in test_recursion2 + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py", line 273, in test_recursion2 self.assert_(Weird() == Weird()) - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py", line 265, in __eq__ + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py", line 265, in __eq__ return self != other - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py", line 267, in __ne__ + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py", line 267, in __ne__ return self == other - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py", line 265, in __eq__ + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py", line 265, in __eq__ return self != other - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py", line 267, in __ne__ + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py", line 267, in __ne__ return self == other - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py", line 265, in __eq__ + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py", line 265, in __eq__ return self != other - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py", line 267, in __ne__ + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py", line 267, in __ne__ return self == other - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py", line 265, in __eq__ + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py", line 265, in __eq__ return self != other - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py", line 267, in __ne__ + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py", line 267, in __ne__ return self == other - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py", line 265, in __eq__ + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py", line 265, in __eq__ return self != other - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py", line 267, in __ne__ + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py", line 267, in __ne__ return self == other - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py", line 265, in __eq__ + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py", line 265, in __eq__ return self != other - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py", line 267, in __ne__ + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py", line 267, in __ne__ return self == other - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py", line 265, in __eq__ + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py", line 265, in __eq__ return self != other - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py", line 267, in __ne__ + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py", line 267, in __ne__ return self == other - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py", line 265, in __eq__ + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py", line 265, in __eq__ return self != other - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py", line 267, in __ne__ + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py", line 267, in __ne__ return self == other - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py", line 265, in __eq__ + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py", line 265, in __eq__ return self != other - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py", line 267, in __ne__ + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py", line 267, in __ne__ return self == other - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py", line 265, in __eq__ + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py", line 265, in __eq__ return self != other - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py", line 267, in __ne__ + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py", line 267, in __ne__ return self == other - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py", line 265, in __eq__ + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py", line 265, in __eq__ return self != other - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py", line 267, in __ne__ + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py", line 267, in __ne__ return self == other - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py", line 265, in __eq__ + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py", line 265, in __eq__ return self != other - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py", line 267, in __ne__ + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py", line 267, in __ne__ return self == other - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py", line 265, in __eq__ + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py", line 265, in __eq__ return self != other - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py", line 267, in __ne__ + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py", line 267, in __ne__ return self == other - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py", line 265, in __eq__ + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py", line 265, in __eq__ return self != other - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py", line 267, in __ne__ + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py", line 267, in __ne__ return self == other - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py", line 265, in __eq__ + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py", line 265, in __eq__ return self != other - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py", line 267, in __ne__ + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py", line 267, in __ne__ return self == other - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py", line 265, in __eq__ + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py", line 265, in __eq__ return self != other - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py", line 267, in __ne__ + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py", line 267, in __ne__ return self == other - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py", line 265, in __eq__ + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py", line 265, in __eq__ return self != other - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py", line 267, in __ne__ + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py", line 267, in __ne__ return self == other - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py", line 265, in __eq__ + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py", line 265, in __eq__ return self != other - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py", line 267, in __ne__ + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py", line 267, in __ne__ return self == other - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py", line 265, in __eq__ + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py", line 265, in __eq__ return self != other - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py", line 267, in __ne__ + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py", line 267, in __ne__ return self == other - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py", line 265, in __eq__ + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py", line 265, in __eq__ return self != other - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py", line 267, in __ne__ + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py", line 267, in __ne__ return self == other - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py", line 265, in __eq__ + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py", line 265, in __eq__ return self != other - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py", line 267, in __ne__ + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py", line 267, in __ne__ return self == other - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py", line 265, in __eq__ + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py", line 265, in __eq__ return self != other - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py", line 267, in __ne__ + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py", line 267, in __ne__ return self == other - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py", line 265, in __eq__ + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py", line 265, in __eq__ return self != other - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py", line 267, in __ne__ + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py", line 267, in __ne__ return self == other - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py", line 265, in __eq__ + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py", line 265, in __eq__ return self != other - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py", line 267, in __ne__ + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py", line 267, in __ne__ return self == other - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py", line 265, in __eq__ + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py", line 265, in __eq__ return self != other - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py", line 267, in __ne__ + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py", line 267, in __ne__ return self == other - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py", line 265, in __eq__ + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py", line 265, in __eq__ return self != other - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py", line 267, in __ne__ + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py", line 267, in __ne__ return self == other - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py", line 265, in __eq__ + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py", line 265, in __eq__ return self != other - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py", line 267, in __ne__ + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py", line 267, in __ne__ return self == other - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py", line 265, in __eq__ + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py", line 265, in __eq__ return self != other - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py", line 267, in __ne__ + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py", line 267, in __ne__ return self == other - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py", line 265, in __eq__ + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py", line 265, in __eq__ return self != other - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py", line 267, in __ne__ + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py", line 267, in __ne__ return self == other - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py", line 265, in __eq__ + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py", line 265, in __eq__ return self != other - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py", line 267, in __ne__ + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py", line 267, in __ne__ return self == other - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py", line 265, in __eq__ + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py", line 265, in __eq__ return self != other - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py", line 267, in __ne__ + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py", line 267, in __ne__ return self == other - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py", line 265, in __eq__ + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py", line 265, in __eq__ return self != other - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py", line 267, in __ne__ + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py", line 267, in __ne__ return self == other - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py", line 265, in __eq__ + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py", line 265, in __eq__ return self != other - File "/home/arigo/pypysrc/lib-python-2.3Traceback (application-level): - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py", line 358 in ? + File "/home/arigo/pypysrc/lib-python/2.3Traceback (application-level): + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py", line 358 in ? test_main() - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py", line 355 in test_main + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py", line 355 in test_main test_support.run_unittest(VectorTest, NumberTest, MiscTest, DictTest, ListTest) - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_support.py", line 262 in run_unittest + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_support.py", line 262 in run_unittest run_suite(suite, testclass) - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_support.py", line 247 in run_suite + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_support.py", line 247 in run_suite raise TestFailed(err) TestFailed: Traceback (most recent call last): - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py", line 273, in test_recursion2 + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py", line 273, in test_recursion2 self.assert_(Weird() == Weird()) - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py", line 265, in __eq__ + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py", line 265, in __eq__ return self != other - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py", line 267, in __ne__ + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py", line 267, in __ne__ return self == other - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py", line 265, in __eq__ + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py", line 265, in __eq__ return self != other - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py", line 267, in __ne__ + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py", line 267, in __ne__ return self == other - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py", line 265, in __eq__ + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py", line 265, in __eq__ return self != other - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py", line 267, in __ne__ + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py", line 267, in __ne__ return self == other - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py", line 265, in __eq__ + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py", line 265, in __eq__ return self != other - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py", line 267, in __ne__ + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py", line 267, in __ne__ return self == other - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py", line 265, in __eq__ + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py", line 265, in __eq__ return self != other - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py", line 267, in __ne__ + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py", line 267, in __ne__ return self == other - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py", line 265, in __eq__ + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py", line 265, in __eq__ return self != other - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py", line 267, in __ne__ + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py", line 267, in __ne__ return self == other - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py", line 265, in __eq__ + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py", line 265, in __eq__ return self != other - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py", line 267, in __ne__ + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py", line 267, in __ne__ return self == other - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py", line 265, in __eq__ + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py", line 265, in __eq__ return self != other - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py", line 267, in __ne__ + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py", line 267, in __ne__ return self == other - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py", line 265, in __eq__ + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py", line 265, in __eq__ return self != other - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py", line 267, in __ne__ + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py", line 267, in __ne__ return self == other - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py", line 265, in __eq__ + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py", line 265, in __eq__ return self != other - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py", line 267, in __ne__ + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py", line 267, in __ne__ return self == other - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py", line 265, in __eq__ + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py", line 265, in __eq__ return self != other - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py", line 267, in __ne__ + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py", line 267, in __ne__ return self == other - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py", line 265, in __eq__ + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py", line 265, in __eq__ return self != other - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py", line 267, in __ne__ + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py", line 267, in __ne__ return self == other - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py", line 265, in __eq__ + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py", line 265, in __eq__ return self != other - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py", line 267, in __ne__ + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py", line 267, in __ne__ return self == other - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py", line 265, in __eq__ + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py", line 265, in __eq__ return self != other - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py", line 267, in __ne__ + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py", line 267, in __ne__ return self == other - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py", line 265, in __eq__ + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py", line 265, in __eq__ return self != other - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py", line 267, in __ne__ + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py", line 267, in __ne__ return self == other - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py", line 265, in __eq__ + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py", line 265, in __eq__ return self != other - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py", line 267, in __ne__ + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py", line 267, in __ne__ return self == other - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py", line 265, in __eq__ + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py", line 265, in __eq__ return self != other - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py", line 267, in __ne__ + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py", line 267, in __ne__ return self == other - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py", line 265, in __eq__ + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py", line 265, in __eq__ return self != other - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py", line 267, in __ne__ + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py", line 267, in __ne__ return self == other - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py", line 265, in __eq__ + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py", line 265, in __eq__ return self != other - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py", line 267, in __ne__ + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py", line 267, in __ne__ return self == other - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py", line 265, in __eq__ + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py", line 265, in __eq__ return self != other - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py", line 267, in __ne__ + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py", line 267, in __ne__ return self == other - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py", line 265, in __eq__ + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py", line 265, in __eq__ return self != other - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py", line 267, in __ne__ + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py", line 267, in __ne__ return self == other - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py", line 265, in __eq__ + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py", line 265, in __eq__ return self != other - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py", line 267, in __ne__ + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py", line 267, in __ne__ return self == other - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py", line 265, in __eq__ + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py", line 265, in __eq__ return self != other - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py", line 267, in __ne__ + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py", line 267, in __ne__ return self == other - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py", line 265, in __eq__ + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py", line 265, in __eq__ return self != other - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py", line 267, in __ne__ + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py", line 267, in __ne__ return self == other - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py", line 265, in __eq__ + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py", line 265, in __eq__ return self != other - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py", line 267, in __ne__ + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py", line 267, in __ne__ return self == other - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py", line 265, in __eq__ + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py", line 265, in __eq__ return self != other - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py", line 267, in __ne__ + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py", line 267, in __ne__ return self == other - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py", line 265, in __eq__ + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py", line 265, in __eq__ return self != other - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py", line 267, in __ne__ + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py", line 267, in __ne__ return self == other - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py", line 265, in __eq__ + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py", line 265, in __eq__ return self != other - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py", line 267, in __ne__ + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py", line 267, in __ne__ return self == other - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py", line 265, in __eq__ + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py", line 265, in __eq__ return self != other - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py", line 267, in __ne__ + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py", line 267, in __ne__ return self == other - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py", line 265, in __eq__ + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py", line 265, in __eq__ return self != other - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py", line 267, in __ne__ + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py", line 267, in __ne__ return self == other - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py", line 265, in __eq__ + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py", line 265, in __eq__ return self != other - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py", line 267, in __ne__ + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py", line 267, in __ne__ return self == other - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py", line 265, in __eq__ + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py", line 265, in __eq__ return self != other - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py", line 267, in __ne__ + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py", line 267, in __ne__ return self == other - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py", line 265, in __eq__ + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py", line 265, in __eq__ return self != other - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py", line 267, in __ne__ + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py", line 267, in __ne__ return self == other - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py", line 265, in __eq__ + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py", line 265, in __eq__ return self != other - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py", line 267, in __ne__ + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py", line 267, in __ne__ return self == other - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py", line 265, in __eq__ + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py", line 265, in __eq__ return self != other - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py", line 267, in __ne__ + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py", line 267, in __ne__ return self == other - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py", line 265, in __eq__ + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py", line 265, in __eq__ return self != other - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py", line 267, in __ne__ + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py", line 267, in __ne__ return self == other - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py", line 265, in __eq__ + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py", line 265, in __eq__ return self != other - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py", line 267, in __ne__ + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py", line 267, in __ne__ return self == other - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py", line 265, in __eq__ + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py", line 265, in __eq__ return self != other - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py", line 267, in __ne__ + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py", line 267, in __ne__ return self == other - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py", line 265, in __eq__ + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py", line 265, in __eq__ return self != other - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py", line 267, in __ne__ + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py", line 267, in __ne__ return self == other - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py", line 265, in __eq__ + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py", line 265, in __eq__ return self != other - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py", line 267, in __ne__ + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py", line 267, in __ne__ return self == other - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py", line 265, in __eq__ + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py", line 265, in __eq__ return self != other - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py", line 267, in __ne__ + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py", line 267, in __ne__ return self == other - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py", line 265, in __eq__ + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py", line 265, in __eq__ return self != other - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py", line 267, in __ne__ + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py", line 267, in __ne__ return self == other - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py", line 265, in __eq__ + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py", line 265, in __eq__ return self != other - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py", line 267, in __ne__ + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py", line 267, in __ne__ return self == other - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py", line 265, in __eq__ + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py", line 265, in __eq__ return self != other - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py", line 267, in __ne__ + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py", line 267, in __ne__ return self == other - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py", line 265, in __eq__ + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py", line 265, in __eq__ return self != other - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py", line 267, in __ne__ + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py", line 267, in __ne__ return self == other - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py", line 265, in __eq__ + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py", line 265, in __eq__ return self != other - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py", line 267, in __ne__ + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py", line 267, in __ne__ return self == other RuntimeError: maximum recursion depth exceeded .4/test/test_richcmp.py", line 267, in __ne__ return self == other - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py", line 265, in __eq__ + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py", line 265, in __eq__ return self != other - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py", line 267, in __ne__ + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py", line 267, in __ne__ return self == other - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py", line 265, in __eq__ + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py", line 265, in __eq__ return self != other - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py", line 267, in __ne__ + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py", line 267, in __ne__ return self == other - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py", line 265, in __eq__ + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py", line 265, in __eq__ return self != other - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py", line 267, in __ne__ + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py", line 267, in __ne__ return self == other - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py", line 265, in __eq__ + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py", line 265, in __eq__ return self != other - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py", line 267, in __ne__ + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py", line 267, in __ne__ return self == other - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py", line 265, in __eq__ + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py", line 265, in __eq__ return self != other - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py", line 267, in __ne__ + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py", line 267, in __ne__ return self == other - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py", line 265, in __eq__ + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py", line 265, in __eq__ return self != other - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py", line 267, in __ne__ + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py", line 267, in __ne__ return self == other - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py", line 265, in __eq__ + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py", line 265, in __eq__ return self != other - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py", line 267, in __ne__ + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py", line 267, in __ne__ return self == other - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py", line 265, in __eq__ + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py", line 265, in __eq__ return self != other - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py", line 267, in __ne__ + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py", line 267, in __ne__ return self == other - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py", line 265, in __eq__ + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py", line 265, in __eq__ return self != other - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py", line 267, in __ne__ + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py", line 267, in __ne__ return self == other - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py", line 265, in __eq__ + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py", line 265, in __eq__ return self != other - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py", line 267, in __ne__ + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py", line 267, in __ne__ return self == other - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py", line 265, in __eq__ + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py", line 265, in __eq__ return self != other - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py", line 267, in __ne__ + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py", line 267, in __ne__ return self == other - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py", line 265, in __eq__ + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py", line 265, in __eq__ return self != other - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py", line 267, in __ne__ + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py", line 267, in __ne__ return self == other - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py", line 265, in __eq__ + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py", line 265, in __eq__ return self != other - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_richcmp.py", line 267, in __ne__ + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_richcmp.py", line 267, in __ne__ return self == other RuntimeError: maximum recursion depth exceeded ---------------------------------------------------------------------- -Ran 11 tests in 82.892s +Ran 11 tests in 82.115s FAILED (errors=1) ========================== closed ========================== -execution time: 95.9531719685 seconds +execution time: 95.8329789639 seconds exit status: 1 Modified: pypy/testresult/arigo at tismerysoft.de/test_robotparser.txt ============================================================================== --- pypy/testresult/arigo at tismerysoft.de/test_robotparser.txt (original) +++ pypy/testresult/arigo at tismerysoft.de/test_robotparser.txt Sun May 1 21:16:18 2005 @@ -1,14 +1,14 @@ testreport-version: 1.0 -command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 576 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/2.3.4/test/test_robotparser.py +command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 483 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/2.3.4/test/test_robotparser.py run by: arigo at tismerysoft.de sys.platform: linux2 sys.version_info: (2, 3, 5, 'final', 0) cpu model: AMD Athlon(tm) XP 3000+ cpu mhz: 2166.513 oldstyle: no -pypy-revision: 11698 -startdate: Sun May 1 19:15:35 2005 -timeout: 576.0 seconds +pypy-revision: 11706 +startdate: Sun May 1 23:05:19 2005 +timeout: 484.0 seconds ============================================================ faking @@ -55,9 +55,9 @@ RobotTest(7, good, /foo.html) ... ok ---------------------------------------------------------------------- -Ran 34 tests in 13.222s +Ran 34 tests in 13.214s OK ========================== closed ========================== -execution time: 36.1382939816 seconds +execution time: 36.1162729263 seconds exit status: 0 From arigo at codespeak.net Sun May 1 22:15:40 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Sun, 1 May 2005 22:15:40 +0200 (CEST) Subject: [pypy-svn] r11727 - pypy/dist/pypy/objspace/std Message-ID: <20050501201540.800E327C23@code1.codespeak.net> Author: arigo Date: Sun May 1 22:15:40 2005 New Revision: 11727 Modified: pypy/dist/pypy/objspace/std/longobject.py Log: truediv__Long_Long fixed. Modified: pypy/dist/pypy/objspace/std/longobject.py ============================================================================== --- pypy/dist/pypy/objspace/std/longobject.py (original) +++ pypy/dist/pypy/objspace/std/longobject.py Sun May 1 22:15:40 2005 @@ -1,4 +1,4 @@ -import sys +import sys, operator from pypy.objspace.std.objspace import * from pypy.objspace.std.intobject import W_IntObject from pypy.objspace.std.floatobject import W_FloatObject @@ -256,7 +256,7 @@ if not y: raise OperationError(space.w_ZeroDivisionError, space.wrap("long division")) - z = x / y + z = operator.truediv(x, y) return space.newfloat(float(z)) def floordiv__Long_Long(space, w_long1, w_long2): #YYYYYY From arigo at codespeak.net Sun May 1 22:16:12 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Sun, 1 May 2005 22:16:12 +0200 (CEST) Subject: [pypy-svn] r11728 - pypy/testresult/arigo@tismerysoft.de Message-ID: <20050501201612.CAC6527C23@code1.codespeak.net> Author: arigo Date: Sun May 1 22:16:12 2005 New Revision: 11728 Modified: pypy/testresult/arigo at tismerysoft.de/test_StringIO.txt pypy/testresult/arigo at tismerysoft.de/test_scope.txt pypy/testresult/arigo at tismerysoft.de/test_sets.txt pypy/testresult/arigo at tismerysoft.de/test_sgmllib.txt pypy/testresult/arigo at tismerysoft.de/test_shelve.txt pypy/testresult/arigo at tismerysoft.de/test_shlex.txt pypy/testresult/arigo at tismerysoft.de/test_shutil.txt pypy/testresult/arigo at tismerysoft.de/test_slice.txt pypy/testresult/arigo at tismerysoft.de/test_softspace.txt pypy/testresult/arigo at tismerysoft.de/test_sort.txt pypy/testresult/arigo at tismerysoft.de/test_str.txt pypy/testresult/arigo at tismerysoft.de/test_string.txt pypy/testresult/arigo at tismerysoft.de/test_syntax.txt pypy/testresult/arigo at tismerysoft.de/test_sys.txt pypy/testresult/arigo at tismerysoft.de/test_tarfile.txt pypy/testresult/arigo at tismerysoft.de/test_tempfile.txt pypy/testresult/arigo at tismerysoft.de/test_textwrap.txt pypy/testresult/arigo at tismerysoft.de/test_time.txt pypy/testresult/arigo at tismerysoft.de/test_tokenize.txt pypy/testresult/arigo at tismerysoft.de/test_trace.txt pypy/testresult/arigo at tismerysoft.de/test_traceback.txt pypy/testresult/arigo at tismerysoft.de/test_types.txt pypy/testresult/arigo at tismerysoft.de/test_unary.txt pypy/testresult/arigo at tismerysoft.de/test_univnewlines.txt pypy/testresult/arigo at tismerysoft.de/test_unpack.txt pypy/testresult/arigo at tismerysoft.de/test_urllib.txt pypy/testresult/arigo at tismerysoft.de/test_urllib2.txt pypy/testresult/arigo at tismerysoft.de/test_urlparse.txt pypy/testresult/arigo at tismerysoft.de/test_userdict.txt pypy/testresult/arigo at tismerysoft.de/test_userlist.txt pypy/testresult/arigo at tismerysoft.de/test_userstring.txt pypy/testresult/arigo at tismerysoft.de/test_warnings.txt pypy/testresult/arigo at tismerysoft.de/test_whichdb.txt Log: Final bunch of test results. Modified: pypy/testresult/arigo at tismerysoft.de/test_StringIO.txt ============================================================================== --- pypy/testresult/arigo at tismerysoft.de/test_StringIO.txt (original) +++ pypy/testresult/arigo at tismerysoft.de/test_StringIO.txt Sun May 1 22:16:12 2005 @@ -1,14 +1,14 @@ testreport-version: 1.0 -command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 576 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/2.3.4/test/test_StringIO.py +command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 529 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/2.3.4/test/test_StringIO.py run by: arigo at tismerysoft.de sys.platform: linux2 sys.version_info: (2, 3, 5, 'final', 0) cpu model: AMD Athlon(tm) XP 3000+ cpu mhz: 2166.513 oldstyle: no -pypy-revision: 11698 -startdate: Sun May 1 19:30:20 2005 -timeout: 576.0 seconds +pypy-revision: 11706 +startdate: Sun May 1 23:38:13 2005 +timeout: 529.0 seconds ============================================================ faking @@ -44,9 +44,9 @@ test_writes (__main__.TestBuffercStringIO) ... ok ---------------------------------------------------------------------- -Ran 26 tests in 13.305s +Ran 26 tests in 13.297s OK ========================== closed ========================== -execution time: 29.9017369747 seconds +execution time: 29.9187068939 seconds exit status: 0 Modified: pypy/testresult/arigo at tismerysoft.de/test_scope.txt ============================================================================== --- pypy/testresult/arigo at tismerysoft.de/test_scope.txt (original) +++ pypy/testresult/arigo at tismerysoft.de/test_scope.txt Sun May 1 22:16:12 2005 @@ -1,14 +1,14 @@ testreport-version: 1.0 -command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 529 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/2.3.4/test/test_scope.py +command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 575 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/2.3.4/test/test_scope.py run by: arigo at tismerysoft.de sys.platform: linux2 sys.version_info: (2, 3, 5, 'final', 0) cpu model: AMD Athlon(tm) XP 3000+ cpu mhz: 2166.513 oldstyle: no -pypy-revision: 11698 -startdate: Sun May 1 19:16:12 2005 -timeout: 529.0 seconds +pypy-revision: 11706 +startdate: Sun May 1 23:05:56 2005 +timeout: 576.0 seconds OUTPUT TEST see output in: /home/arigo/pypysrc/testresult/arigo at tismerysoft.de/test_scope.out @@ -29,5 +29,5 @@ :11: SyntaxWarning: import * only allowed at module level OK ========================== closed ========================== -execution time: 9.27384519577 seconds +execution time: 9.27191710472 seconds exit status: 0 Modified: pypy/testresult/arigo at tismerysoft.de/test_sets.txt ============================================================================== --- pypy/testresult/arigo at tismerysoft.de/test_sets.txt (original) +++ pypy/testresult/arigo at tismerysoft.de/test_sets.txt Sun May 1 22:16:12 2005 @@ -1,14 +1,14 @@ testreport-version: 1.0 -command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 576 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/2.3.4/test/test_sets.py +command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 483 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/2.3.4/test/test_sets.py run by: arigo at tismerysoft.de sys.platform: linux2 sys.version_info: (2, 3, 5, 'final', 0) cpu model: AMD Athlon(tm) XP 3000+ cpu mhz: 2166.513 oldstyle: no -pypy-revision: 11698 -startdate: Sun May 1 19:16:21 2005 -timeout: 576.0 seconds +pypy-revision: 11706 +startdate: Sun May 1 23:06:05 2005 +timeout: 484.0 seconds ============================================================ faking @@ -248,10 +248,10 @@ test_summations (__main__.TestIdentities) ... ok ---------------------------------------------------------------------- -Ran 225 tests in 106.999s +Ran 225 tests in 107.094s OK doctest (test.test_sets) ... 14 tests with zero failures ========================== closed ========================== -execution time: 392.94887495 seconds +execution time: 393.163537025 seconds exit status: 0 Modified: pypy/testresult/arigo at tismerysoft.de/test_sgmllib.txt ============================================================================== --- pypy/testresult/arigo at tismerysoft.de/test_sgmllib.txt (original) +++ pypy/testresult/arigo at tismerysoft.de/test_sgmllib.txt Sun May 1 22:16:12 2005 @@ -1,13 +1,13 @@ testreport-version: 1.0 -command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 575 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/2.3.4/test/test_sgmllib.py +command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 576 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/2.3.4/test/test_sgmllib.py run by: arigo at tismerysoft.de sys.platform: linux2 sys.version_info: (2, 3, 5, 'final', 0) cpu model: AMD Athlon(tm) XP 3000+ cpu mhz: 2166.513 oldstyle: no -pypy-revision: 11698 -startdate: Sun May 1 19:22:54 2005 +pypy-revision: 11706 +startdate: Sun May 1 23:12:38 2005 timeout: 576.0 seconds ============================================================ @@ -41,9 +41,9 @@ Handling of XHTML-style empty start tags ... ok ---------------------------------------------------------------------- -Ran 19 tests in 39.174s +Ran 19 tests in 39.256s OK ========================== closed ========================== -execution time: 77.9251871109 seconds +execution time: 77.8992431164 seconds exit status: 0 Modified: pypy/testresult/arigo at tismerysoft.de/test_shelve.txt ============================================================================== --- pypy/testresult/arigo at tismerysoft.de/test_shelve.txt (original) +++ pypy/testresult/arigo at tismerysoft.de/test_shelve.txt Sun May 1 22:16:12 2005 @@ -1,14 +1,14 @@ testreport-version: 1.0 -command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 529 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/2.3.4/test/test_shelve.py +command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 575 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/2.3.4/test/test_shelve.py run by: arigo at tismerysoft.de sys.platform: linux2 sys.version_info: (2, 3, 5, 'final', 0) cpu model: AMD Athlon(tm) XP 3000+ cpu mhz: 2166.513 oldstyle: no -pypy-revision: 11698 -startdate: Sun May 1 19:24:31 2005 -timeout: 529.0 seconds +pypy-revision: 11706 +startdate: Sun May 1 23:13:57 2005 +timeout: 576.0 seconds ============================================================ faking @@ -40,9 +40,9 @@ test_proto2_file_shelf (__main__.TestCase) ... ok ---------------------------------------------------------------------- -Ran 17 tests in 156.901s +Ran 17 tests in 156.662s OK ========================== closed ========================== -execution time: 196.069844007 seconds +execution time: 195.581501007 seconds exit status: 0 Modified: pypy/testresult/arigo at tismerysoft.de/test_shlex.txt ============================================================================== --- pypy/testresult/arigo at tismerysoft.de/test_shlex.txt (original) +++ pypy/testresult/arigo at tismerysoft.de/test_shlex.txt Sun May 1 22:16:12 2005 @@ -1,14 +1,14 @@ testreport-version: 1.0 -command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 483 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/2.3.4/test/test_shlex.py +command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 576 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/2.3.4/test/test_shlex.py run by: arigo at tismerysoft.de sys.platform: linux2 sys.version_info: (2, 3, 5, 'final', 0) cpu model: AMD Athlon(tm) XP 3000+ cpu mhz: 2166.513 oldstyle: no -pypy-revision: 11698 -startdate: Sun May 1 19:27:47 2005 -timeout: 484.0 seconds +pypy-revision: 11706 +startdate: Sun May 1 23:17:12 2005 +timeout: 576.0 seconds ============================================================ faking @@ -20,9 +20,9 @@ Test data splitting with posix parser ... ok ---------------------------------------------------------------------- -Ran 2 tests in 93.790s +Ran 2 tests in 93.776s OK ========================== closed ========================== -execution time: 101.146353006 seconds +execution time: 101.142245054 seconds exit status: 0 Modified: pypy/testresult/arigo at tismerysoft.de/test_shutil.txt ============================================================================== --- pypy/testresult/arigo at tismerysoft.de/test_shutil.txt (original) +++ pypy/testresult/arigo at tismerysoft.de/test_shutil.txt Sun May 1 22:16:12 2005 @@ -1,14 +1,14 @@ testreport-version: 1.0 -command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 528 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/2.3.4/test/test_shutil.py +command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 575 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/2.3.4/test/test_shutil.py run by: arigo at tismerysoft.de sys.platform: linux2 sys.version_info: (2, 3, 5, 'final', 0) cpu model: AMD Athlon(tm) XP 3000+ cpu mhz: 2166.513 oldstyle: no -pypy-revision: 11698 -startdate: Sun May 1 19:29:28 2005 -timeout: 529.0 seconds +pypy-revision: 11706 +startdate: Sun May 1 23:18:54 2005 +timeout: 576.0 seconds ============================================================ faking @@ -19,9 +19,9 @@ test_rmtree_errors (__main__.TestShutil) ... ok ---------------------------------------------------------------------- -Ran 1 test in 1.039s +Ran 1 test in 1.029s OK ========================== closed ========================== -execution time: 8.67292904854 seconds +execution time: 8.66806101799 seconds exit status: 0 Modified: pypy/testresult/arigo at tismerysoft.de/test_slice.txt ============================================================================== --- pypy/testresult/arigo at tismerysoft.de/test_slice.txt (original) +++ pypy/testresult/arigo at tismerysoft.de/test_slice.txt Sun May 1 22:16:12 2005 @@ -1,13 +1,13 @@ testreport-version: 1.0 -command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 575 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/2.3.4/test/test_slice.py +command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 576 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/2.3.4/test/test_slice.py run by: arigo at tismerysoft.de sys.platform: linux2 sys.version_info: (2, 3, 5, 'final', 0) cpu model: AMD Athlon(tm) XP 3000+ cpu mhz: 2166.513 oldstyle: no -pypy-revision: 11698 -startdate: Sun May 1 19:29:37 2005 +pypy-revision: 11706 +startdate: Sun May 1 23:19:03 2005 timeout: 576.0 seconds ============================================================ @@ -17,5 +17,5 @@ faking faking ========================== closed ========================== -execution time: 5.25969600677 seconds +execution time: 5.2752430439 seconds exit status: 0 Modified: pypy/testresult/arigo at tismerysoft.de/test_softspace.txt ============================================================================== --- pypy/testresult/arigo at tismerysoft.de/test_softspace.txt (original) +++ pypy/testresult/arigo at tismerysoft.de/test_softspace.txt Sun May 1 22:16:12 2005 @@ -1,14 +1,14 @@ testreport-version: 1.0 -command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 529 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/2.3.4/test/test_softspace.py +command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 575 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/2.3.4/test/test_softspace.py run by: arigo at tismerysoft.de sys.platform: linux2 sys.version_info: (2, 3, 5, 'final', 0) cpu model: AMD Athlon(tm) XP 3000+ cpu mhz: 2166.513 oldstyle: no -pypy-revision: 11698 -startdate: Sun May 1 19:29:43 2005 -timeout: 529.0 seconds +pypy-revision: 11706 +startdate: Sun May 1 23:19:08 2005 +timeout: 576.0 seconds ============================================================ faking @@ -17,5 +17,5 @@ faking faking ========================== closed ========================== -execution time: 5.44178819656 seconds +execution time: 5.43270802498 seconds exit status: 0 Modified: pypy/testresult/arigo at tismerysoft.de/test_sort.txt ============================================================================== --- pypy/testresult/arigo at tismerysoft.de/test_sort.txt (original) +++ pypy/testresult/arigo at tismerysoft.de/test_sort.txt Sun May 1 22:16:12 2005 @@ -1,13 +1,13 @@ testreport-version: 1.0 -command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 576 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python-2.3.4/test/test_sort.py +command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 575 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/2.3.4/test/test_sort.py run by: arigo at tismerysoft.de sys.platform: linux2 sys.version_info: (2, 3, 5, 'final', 0) cpu model: AMD Athlon(tm) XP 3000+ cpu mhz: 2166.513 oldstyle: no -pypy-revision: 11638 -startdate: Sat Apr 30 05:22:39 2005 +pypy-revision: 11706 +startdate: Sun May 1 23:19:14 2005 timeout: 576.0 seconds ============================================================ @@ -123,8 +123,6 @@ Checking against an insane comparison function. If the implementation isn't careful, this may segfault. checking an insane function left some permutation - complaining at Complains(5) Complains(11) - checking exception during sort left some permutation checking stability Testing size 17 checking identity @@ -170,7 +168,7 @@ Checking against an insane comparison function. If the implementation isn't careful, this may segfault. checking an insane function left some permutation - complaining at Complains(23) Complains(25) + complaining at Complains(3) Complains(26) checking exception during sort left some permutation checking stability Testing size 64 @@ -190,6 +188,8 @@ Checking against an insane comparison function. If the implementation isn't careful, this may segfault. checking an insane function left some permutation + complaining at Complains(6) Complains(7) + checking exception during sort left some permutation checking stability Testing size 127 checking identity @@ -208,6 +208,8 @@ Checking against an insane comparison function. If the implementation isn't careful, this may segfault. checking an insane function left some permutation + complaining at Complains(115) Complains(108) + checking exception during sort left some permutation checking stability Testing size 129 checking identity @@ -226,6 +228,8 @@ Checking against an insane comparison function. If the implementation isn't careful, this may segfault. checking an insane function left some permutation + complaining at Complains(205) Complains(244) + checking exception during sort left some permutation checking stability Testing size 256 checking identity @@ -235,8 +239,15 @@ Checking against an insane comparison function. If the implementation isn't careful, this may segfault. checking an insane function left some permutation - complaining at Complains(92) Complains(86) - checking exception during sort left some permutation + complaining at Complains(180) Complains(194) + checking exception during sort left some permutati==========================timeout========================== +Traceback (application-level): + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_sort.py", line 115 in ? + augmented.sort() # forced stable because ties broken by index + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_sort.py", line 67 in __cmp__ + return cmp(self.key, other.key) +KeyboardInterrupt +on checking stability Testing size 257 checking identity @@ -244,16 +255,9 @@ checking random permutation checking reversed via function Checking against an insane comparison function. - If the==========================timeout========================== -Traceback (application-level): - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_sort.py", line 97 in ? - s.sort(lambda a, b: int(random.random() * 3) - 1) - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_sort.py", line 97 in - s.sort(lambda a, b: int(random.random() * 3) - 1) -KeyboardInterrupt - implementation isn't careful, this may segfault. + If the implementation isn't careful, this may segfault. checking an insane function left some permutation - complaining at Complains(120) Complains(110) + complaining at Complains(217) Complains(158) checking exception during sort left some permutation checking stability Testing size 511 @@ -264,7 +268,7 @@ Checking against an insane comparison function. If the implementation isn't careful, this may segfault. checking an insane function left some permutation - complaining at Complains(68) Complains(288) + complaining at Complains(214) Complains(187) checking exception during sort left some permutation checking stability Testing size 512 @@ -275,16 +279,8 @@ Checking against an insane comparison function. If the implementation isn't careful, this may segfault. checking an insane function left some permutation - complaining at Complains(266) Complains(237) + complaining at Complains(507) Complains(307) checking exception during sort left some permutation - checking stability -Testing size 513 - checking identity - checking reversed - checking random permutation - checking reversed via function - Checking against an insane comparison function. - If the implementation isn't careful, this may segfault. ========================== closed ========================== -execution time: 576.153685808 seconds +execution time: 576.35799098 seconds exit status: 1 Modified: pypy/testresult/arigo at tismerysoft.de/test_str.txt ============================================================================== --- pypy/testresult/arigo at tismerysoft.de/test_str.txt (original) +++ pypy/testresult/arigo at tismerysoft.de/test_str.txt Sun May 1 22:16:12 2005 @@ -1,13 +1,13 @@ testreport-version: 1.0 -command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 529 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python-2.3.4/test/test_str.py +command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 529 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/2.3.4/test/test_str.py run by: arigo at tismerysoft.de sys.platform: linux2 sys.version_info: (2, 3, 5, 'final', 0) cpu model: AMD Athlon(tm) XP 3000+ cpu mhz: 2166.513 oldstyle: no -pypy-revision: 11638 -startdate: Sat Apr 30 05:32:16 2005 +pypy-revision: 11706 +startdate: Sun May 1 23:28:51 2005 timeout: 529.0 seconds ============================================================ @@ -18,25 +18,25 @@ faking ==========================timeout========================== Traceback (application-level): - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_str.py", line 25 in ? + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_str.py", line 25 in ? test_main() - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_str.py", line 22 in test_main + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_str.py", line 22 in test_main test_support.run_unittest(StrTest) - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_support.py", line 262 in run_unittest + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_support.py", line 262 in run_unittest run_suite(suite, testclass) - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_support.py", line 234 in run_suite + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_support.py", line 234 in run_suite result = runner.run(suite) - File "/home/arigo/pypysrc/lib-python-2.3.4/unittest.py", line 658 in run + File "/home/arigo/pypysrc/lib-python/2.3.4/unittest.py", line 658 in run test(result) - File "/home/arigo/pypysrc/lib-python-2.3.4/unittest.py", line 389 in __call__ + File "/home/arigo/pypysrc/lib-python/2.3.4/unittest.py", line 389 in __call__ test(result) - File "/home/arigo/pypysrc/lib-python-2.3.4/unittest.py", line 389 in __call__ + File "/home/arigo/pypysrc/lib-python/2.3.4/unittest.py", line 389 in __call__ test(result) - File "/home/arigo/pypysrc/lib-python-2.3.4/unittest.py", line 229 in __call__ + File "/home/arigo/pypysrc/lib-python/2.3.4/unittest.py", line 229 in __call__ testMethod() - File "/home/arigo/pypysrc/lib-python-2.3.4/test/string_tests.py", line 586 in test_floatformatting + File "/home/arigo/pypysrc/lib-python/2.3.4/test/string_tests.py", line 586 in test_floatformatting self.checkcall(format, "__mod__", value) - File "/home/arigo/pypysrc/lib-python-2.3.4/test/string_tests.py", line 81 in checkcall + File "/home/arigo/pypysrc/lib-python/2.3.4/test/string_tests.py", line 81 in checkcall getattr(object, methodname)(*args) KeyboardInterrupt test___contains__ (__main__.StrTest) ... ok @@ -48,5 +48,5 @@ test_expandtabs (__main__.StrTest) ... ok test_find (__main__.StrTest) ... ok test_floatformatting (__main__.StrTest) ... ========================== closed ========================== -execution time: 529.136664152 seconds +execution time: 529.668832064 seconds exit status: 1 Modified: pypy/testresult/arigo at tismerysoft.de/test_string.txt ============================================================================== --- pypy/testresult/arigo at tismerysoft.de/test_string.txt (original) +++ pypy/testresult/arigo at tismerysoft.de/test_string.txt Sun May 1 22:16:12 2005 @@ -1,14 +1,14 @@ testreport-version: 1.0 -command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 575 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/2.3.4/test/test_string.py +command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 529 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/2.3.4/test/test_string.py run by: arigo at tismerysoft.de sys.platform: linux2 sys.version_info: (2, 3, 5, 'final', 0) cpu model: AMD Athlon(tm) XP 3000+ cpu mhz: 2166.513 oldstyle: no -pypy-revision: 11698 -startdate: Sun May 1 19:29:48 2005 -timeout: 576.0 seconds +pypy-revision: 11706 +startdate: Sun May 1 23:37:41 2005 +timeout: 529.0 seconds ============================================================ faking @@ -44,9 +44,9 @@ test_maketrans (__main__.ModuleTest) ... ok ---------------------------------------------------------------------- -Ran 26 tests in 20.846s +Ran 26 tests in 20.745s OK ========================== closed ========================== -execution time: 31.7169730663 seconds +execution time: 31.600331068 seconds exit status: 0 Modified: pypy/testresult/arigo at tismerysoft.de/test_syntax.txt ============================================================================== --- pypy/testresult/arigo at tismerysoft.de/test_syntax.txt (original) +++ pypy/testresult/arigo at tismerysoft.de/test_syntax.txt Sun May 1 22:16:12 2005 @@ -6,8 +6,8 @@ cpu model: AMD Athlon(tm) XP 3000+ cpu mhz: 2166.513 oldstyle: no -pypy-revision: 11698 -startdate: Sun May 1 19:30:58 2005 +pypy-revision: 11706 +startdate: Sun May 1 23:38:43 2005 timeout: 529.0 seconds ============================================================ @@ -25,9 +25,9 @@ test_global_err_then_warn (__main__.SyntaxTestCase) ... ok ---------------------------------------------------------------------- -Ran 3 tests in 3.225s +Ran 3 tests in 3.301s OK ========================== closed ========================== -execution time: 11.4559829235 seconds +execution time: 11.5455601215 seconds exit status: 0 Modified: pypy/testresult/arigo at tismerysoft.de/test_sys.txt ============================================================================== --- pypy/testresult/arigo at tismerysoft.de/test_sys.txt (original) +++ pypy/testresult/arigo at tismerysoft.de/test_sys.txt Sun May 1 22:16:12 2005 @@ -6,8 +6,8 @@ cpu model: AMD Athlon(tm) XP 3000+ cpu mhz: 2166.513 oldstyle: no -pypy-revision: 11698 -startdate: Sun May 1 19:31:09 2005 +pypy-revision: 11706 +startdate: Sun May 1 23:38:55 2005 timeout: 576.0 seconds ============================================================ @@ -32,9 +32,9 @@ test_setcheckinterval (__main__.SysModuleTest) ... ok ---------------------------------------------------------------------- -Ran 14 tests in 5.628s +Ran 14 tests in 5.648s OK ========================== closed ========================== -execution time: 13.1939160824 seconds +execution time: 13.2125930786 seconds exit status: 0 Modified: pypy/testresult/arigo at tismerysoft.de/test_tarfile.txt ============================================================================== --- pypy/testresult/arigo at tismerysoft.de/test_tarfile.txt (original) +++ pypy/testresult/arigo at tismerysoft.de/test_tarfile.txt Sun May 1 22:16:12 2005 @@ -1,13 +1,13 @@ testreport-version: 1.0 -command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 576 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python-2.3.4/test/test_tarfile.py +command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 575 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/2.3.4/test/test_tarfile.py run by: arigo at tismerysoft.de sys.platform: linux2 sys.version_info: (2, 3, 5, 'final', 0) cpu model: AMD Athlon(tm) XP 3000+ cpu mhz: 2166.513 oldstyle: no -pypy-revision: 11638 -startdate: Sat Apr 30 06:03:57 2005 +pypy-revision: 11706 +startdate: Sun May 1 23:39:09 2005 timeout: 576.0 seconds ============================================================ @@ -34,15 +34,15 @@ ERROR: Test member extraction. ---------------------------------------------------------------------- Traceback (most recent call last): - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_tarfile.py", line 51, in setUp + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_tarfile.py", line 51, in setUp self.tar = tarfile.open(tarname(self.comp), mode) - File "/home/arigo/pypysrc/lib-python-2.3.4/tarfile.py", line 875, in open + File "/home/arigo/pypysrc/lib-python/2.3.4/tarfile.py", line 875, in open return func(name, filemode, fileobj) - File "/home/arigo/pypysrc/lib-python-2.3.4/tarfile.py", line 912, in taropen + File "/home/arigo/pypysrc/lib-python/2.3.4/tarfile.py", line 912, in taropen return cls(name, mode, fileobj) - File "/home/arigo/pypysrc/lib-python-2.3.4/tarfile.py", line 810, in __init__ + File "/home/arigo/pypysrc/lib-python/2.3.4/tarfile.py", line 810, in __init__ self.firstmember = self.next() - File "/home/arigo/pypysrc/lib-python-2.3.4/tarfile.py", line 1578, in next + File "/home/arigo/pypysrc/lib-python/2.3.4/tarfile.py", line 1578, in next raise ReadError,"empty, unreadable or compressed file" ReadError: empty, unreadable or compressed file @@ -50,15 +50,15 @@ ERROR: Test readlines() method of _FileObject. ---------------------------------------------------------------------- Traceback (most recent call last): - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_tarfile.py", line 51, in setUp + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_tarfile.py", line 51, in setUp self.tar = tarfile.open(tarname(self.comp), mode) - File "/home/arigo/pypysrc/lib-python-2.3.4/tarfile.py", line 875, in open + File "/home/arigo/pypysrc/lib-python/2.3.4/tarfile.py", line 875, in open return func(name, filemode, fileobj) - File "/home/arigo/pypysrc/lib-python-2.3.4/tarfile.py", line 912, in taropen + File "/home/arigo/pypysrc/lib-python/2.3.4/tarfile.py", line 912, in taropen return cls(name, mode, fileobj) - File "/home/arigo/pypysrc/lib-python-2.3.4/tarfile.py", line 810, in __init__ + File "/home/arigo/pypysrc/lib-python/2.3.4/tarfile.py", line 810, in __init__ self.firstmember = self.next() - File "/home/arigo/pypysrc/lib-python-2.3.4/tarfile.py", line 1578, in next + File "/home/arigo/pypysrc/lib-python/2.3.4/tarfile.py", line 1578, in next raise ReadError,"empty, unreadable or compressed file" ReadError: empty, unreadable or compressed file @@ -66,15 +66,15 @@ ERROR: Test seek() method of _FileObject, incl. random reading. ---------------------------------------------------------------------- Traceback (most recent call last): - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_tarfile.py", line 51, in setUp + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_tarfile.py", line 51, in setUp self.tar = tarfile.open(tarname(self.comp), mode) - File "/home/arigo/pypysrc/lib-python-2.3.4/tarfile.py", line 875, in open + File "/home/arigo/pypysrc/lib-python/2.3.4/tarfile.py", line 875, in open return func(name, filemode, fileobj) - File "/home/arigo/pypysrc/lib-python-2.3.4/tarfile.py", line 912, in taropen + File "/home/arigo/pypysrc/lib-python/2.3.4/tarfile.py", line 912, in taropen return cls(name, mode, fileobj) - File "/home/arigo/pypysrc/lib-python-2.3.4/tarfile.py", line 810, in __init__ + File "/home/arigo/pypysrc/lib-python/2.3.4/tarfile.py", line 810, in __init__ self.firstmember = self.next() - File "/home/arigo/pypysrc/lib-python-2.3.4/tarfile.py", line 1578, in next + File "/home/arigo/pypysrc/lib-python/2.3.4/tarfile.py", line 1578, in next raise ReadError,"empty, unreadable or compressed file" ReadError: empty, unreadable or compressed file @@ -82,15 +82,15 @@ ERROR: Test sparse member extraction. ---------------------------------------------------------------------- Traceback (most recent call last): - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_tarfile.py", line 51, in setUp + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_tarfile.py", line 51, in setUp self.tar = tarfile.open(tarname(self.comp), mode) - File "/home/arigo/pypysrc/lib-python-2.3.4/tarfile.py", line 875, in open + File "/home/arigo/pypysrc/lib-python/2.3.4/tarfile.py", line 875, in open return func(name, filemode, fileobj) - File "/home/arigo/pypysrc/lib-python-2.3.4/tarfile.py", line 912, in taropen + File "/home/arigo/pypysrc/lib-python/2.3.4/tarfile.py", line 912, in taropen return cls(name, mode, fileobj) - File "/home/arigo/pypysrc/lib-python-2.3.4/tarfile.py", line 810, in __init__ + File "/home/arigo/pypysrc/lib-python/2.3.4/tarfile.py", line 810, in __init__ self.firstmember = self.next() - File "/home/arigo/pypysrc/lib-python-2.3.4/tarfile.py", line 1578, in next + File "/home/arigo/pypysrc/lib-python/2.3.4/tarfile.py", line 1578, in next raise ReadError,"empty, unreadable or compressed file" ReadError: empty, unreadable or compressed file @@ -98,13 +98,13 @@ ERROR: Test member extraction, and for StreamError when ---------------------------------------------------------------------- Traceback (most recent call last): - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_tarfile.py", line 51, in setUp + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_tarfile.py", line 51, in setUp self.tar = tarfile.open(tarname(self.comp), mode) - File "/home/arigo/pypysrc/lib-python-2.3.4/tarfile.py", line 886, in open + File "/home/arigo/pypysrc/lib-python/2.3.4/tarfile.py", line 886, in open _Stream(name, filemode, comptype, fileobj, bufsize)) - File "/home/arigo/pypysrc/lib-python-2.3.4/tarfile.py", line 810, in __init__ + File "/home/arigo/pypysrc/lib-python/2.3.4/tarfile.py", line 810, in __init__ self.firstmember = self.next() - File "/home/arigo/pypysrc/lib-python-2.3.4/tarfile.py", line 1578, in next + File "/home/arigo/pypysrc/lib-python/2.3.4/tarfile.py", line 1578, in next raise ReadError,"empty, unreadable or compressed file" ReadError: empty, unreadable or compressed file @@ -112,13 +112,13 @@ ERROR: Test readlines() method of _FileObject. ---------------------------------------------------------------------- Traceback (most recent call last): - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_tarfile.py", line 51, in setUp + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_tarfile.py", line 51, in setUp self.tar = tarfile.open(tarname(self.comp), mode) - File "/home/arigo/pypysrc/lib-python-2.3.4/tarfile.py", line 886, in open + File "/home/arigo/pypysrc/lib-python/2.3.4/tarfile.py", line 886, in open _Stream(name, filemode, comptype, fileobj, bufsize)) - File "/home/arigo/pypysrc/lib-python-2.3.4/tarfile.py", line 810, in __init__ + File "/home/arigo/pypysrc/lib-python/2.3.4/tarfile.py", line 810, in __init__ self.firstmember = self.next() - File "/home/arigo/pypysrc/lib-python-2.3.4/tarfile.py", line 1578, in next + File "/home/arigo/pypysrc/lib-python/2.3.4/tarfile.py", line 1578, in next raise ReadError,"empty, unreadable or compressed file" ReadError: empty, unreadable or compressed file @@ -126,13 +126,13 @@ ERROR: Test seek() method of _FileObject, incl. random reading. ---------------------------------------------------------------------- Traceback (most recent call last): - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_tarfile.py", line 51, in setUp + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_tarfile.py", line 51, in setUp self.tar = tarfile.open(tarname(self.comp), mode) - File "/home/arigo/pypysrc/lib-python-2.3.4/tarfile.py", line 886, in open + File "/home/arigo/pypysrc/lib-python/2.3.4/tarfile.py", line 886, in open _Stream(name, filemode, comptype, fileobj, bufsize)) - File "/home/arigo/pypysrc/lib-python-2.3.4/tarfile.py", line 810, in __init__ + File "/home/arigo/pypysrc/lib-python/2.3.4/tarfile.py", line 810, in __init__ self.firstmember = self.next() - File "/home/arigo/pypysrc/lib-python-2.3.4/tarfile.py", line 1578, in next + File "/home/arigo/pypysrc/lib-python/2.3.4/tarfile.py", line 1578, in next raise ReadError,"empty, unreadable or compressed file" ReadError: empty, unreadable or compressed file @@ -140,13 +140,13 @@ ERROR: Test sparse member extraction. ---------------------------------------------------------------------- Traceback (most recent call last): - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_tarfile.py", line 51, in setUp + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_tarfile.py", line 51, in setUp self.tar = tarfile.open(tarname(self.comp), mode) - File "/home/arigo/pypysrc/lib-python-2.3.4/tarfile.py", line 886, in open + File "/home/arigo/pypysrc/lib-python/2.3.4/tarfile.py", line 886, in open _Stream(name, filemode, comptype, fileobj, bufsize)) - File "/home/arigo/pypysrc/lib-python-2.3.4/tarfile.py", line 810, in __init__ + File "/home/arigo/pypysrc/lib-python/2.3.4/tarfile.py", line 810, in __init__ self.firstmember = self.next() - File "/home/arigo/pypysrc/lib-python-2.3.4/tarfile.py", line 1578, in next + File "/home/arigo/pypysrc/lib-python/2.3.4/tarfile.py", line 1578, in next raise ReadError,"empty, unreadable or compressed file" ReadError: empty, unreadable or compressed file @@ -154,22 +154,22 @@ ERROR: Compare the normal tar and the stream tar. ---------------------------------------------------------------------- Traceback (most recent call last): - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_tarfile.py", line 51, in setUp + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_tarfile.py", line 51, in setUp self.tar = tarfile.open(tarname(self.comp), mode) - File "/home/arigo/pypysrc/lib-python-2.3.4/tarfile.py", line 886, in open + File "/home/arigo/pypysrc/lib-python/2.3.4/tarfile.py", line 886, in open _Stream(name, filemode, comptype, fileobj, bufsize)) - File "/home/arigo/pypysrc/lib-python-2.3.4/tarfile.py", line 810, in __init__ + File "/home/arigo/pypysrc/lib-python/2.3.4/tarfile.py", line 810, in __init__ self.firstmember = self.next() - File "/home/arigo/pypysrc/lib-python-2.3.4/tarfile.py", line 1578, in next + File "/home/arigo/pypysrc/lib-python/2.3.4/tarfile.py", line 1578, in next raise ReadError,"empty, unreadable or compressed file" ReadError: Traceback (application-level): - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_tarfile.py", line 275 in ? + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_tarfile.py", line 275 in ? test_main() - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_tarfile.py", line 263 in test_main + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_tarfile.py", line 263 in test_main test_support.run_unittest(*tests) - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_support.py", line 262 in run_unittest + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_support.py", line 262 in run_unittest run_suite(suite, testclass) - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_support.py", line 246 in run_suite + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_support.py", line 246 in run_suite raise TestFailed(msg) TestFailed: errors occurred; run in verbose mode for details empty, unreadable or compressed file @@ -178,9 +178,9 @@ ERROR: test_nonposix (__main__.WriteTest) ---------------------------------------------------------------------- Traceback (most recent call last): - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_tarfile.py", line 179, in setUp + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_tarfile.py", line 179, in setUp self.src = tarfile.open(tarname(self.comp), 'r') - File "/home/arigo/pypysrc/lib-python-2.3.4/tarfile.py", line 898, in open + File "/home/arigo/pypysrc/lib-python/2.3.4/tarfile.py", line 898, in open raise ReadError, "file could not be opened successfully" ReadError: file could not be opened successfully @@ -188,9 +188,9 @@ ERROR: test_posix (__main__.WriteTest) ---------------------------------------------------------------------- Traceback (most recent call last): - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_tarfile.py", line 179, in setUp + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_tarfile.py", line 179, in setUp self.src = tarfile.open(tarname(self.comp), 'r') - File "/home/arigo/pypysrc/lib-python-2.3.4/tarfile.py", line 898, in open + File "/home/arigo/pypysrc/lib-python/2.3.4/tarfile.py", line 898, in open raise ReadError, "file could not be opened successfully" ReadError: file could not be opened successfully @@ -198,9 +198,9 @@ ERROR: test_nonposix (__main__.WriteStreamTest) ---------------------------------------------------------------------- Traceback (most recent call last): - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_tarfile.py", line 179, in setUp + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_tarfile.py", line 179, in setUp self.src = tarfile.open(tarname(self.comp), 'r') - File "/home/arigo/pypysrc/lib-python-2.3.4/tarfile.py", line 898, in open + File "/home/arigo/pypysrc/lib-python/2.3.4/tarfile.py", line 898, in open raise ReadError, "file could not be opened successfully" ReadError: file could not be opened successfully @@ -208,16 +208,16 @@ ERROR: test_posix (__main__.WriteStreamTest) ---------------------------------------------------------------------- Traceback (most recent call last): - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_tarfile.py", line 179, in setUp + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_tarfile.py", line 179, in setUp self.src = tarfile.open(tarname(self.comp), 'r') - File "/home/arigo/pypysrc/lib-python-2.3.4/tarfile.py", line 898, in open + File "/home/arigo/pypysrc/lib-python/2.3.4/tarfile.py", line 898, in open raise ReadError, "file could not be opened successfully" ReadError: file could not be opened successfully ---------------------------------------------------------------------- -Ran 13 tests in 36.126s +Ran 13 tests in 36.584s FAILED (errors=13) ========================== closed ========================== -execution time: 57.3812599182 seconds +execution time: 58.4398200512 seconds exit status: 1 Modified: pypy/testresult/arigo at tismerysoft.de/test_tempfile.txt ============================================================================== --- pypy/testresult/arigo at tismerysoft.de/test_tempfile.txt (original) +++ pypy/testresult/arigo at tismerysoft.de/test_tempfile.txt Sun May 1 22:16:12 2005 @@ -1,14 +1,14 @@ testreport-version: 1.0 -command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 576 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python-2.3.4/test/test_tempfile.py +command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 675 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/modified-2.3.4/test/test_tempfile.py run by: arigo at tismerysoft.de sys.platform: linux2 sys.version_info: (2, 3, 5, 'final', 0) cpu model: AMD Athlon(tm) XP 3000+ cpu mhz: 2166.513 oldstyle: no -pypy-revision: 11638 -startdate: Sat Apr 30 06:04:55 2005 -timeout: 576.0 seconds +pypy-revision: 11706 +startdate: Sun May 1 23:40:08 2005 +timeout: 676.0 seconds ============================================================ faking @@ -20,122 +20,121 @@ faking faking faking -Exception pypy.objspace.std.model.UnwrapError: in >> ignored -Exception pypy.objspace.std.model.UnwrapError: in >> ignored -Exception pypy.objspace.std.model.UnwrapError: in >> ignored -Exception pypy.objspace.std.model.UnwrapError: in >> ignored -Exception pypy.objspace.std.model.UnwrapError: in >> ignored -Exception pypy.objspace.std.model.UnwrapError: in >> ignored -Exception pypy.objspace.std.model.UnwrapError: in >> ignored -Exception pypy.objspace.std.model.UnwrapError: in >> ignored -Exception pypy.objspace.std.model.UnwrapError: in >> ignored -Exception pypy.objspace.std.model.UnwrapError: in >> ignored -Exception pypy.objspace.std.model.UnwrapError: in >> ignored -Exception pypy.objspace.std.model.UnwrapError: in >> ignored -Exception pypy.objspace.std.model.UnwrapError: in >> ignored -Exception pypy.objspace.std.model.UnwrapError: in >> ignored -Exception pypy.objspace.std.model.UnwrapError: in >> ignored -Exception pypy.objspace.std.model.UnwrapError: in >> ignored -Exception pypy.objspace.std.model.UnwrapError: in >> ignored -Exception pypy.objspace.std.model.UnwrapError: in >> ignored -Exception pypy.objspace.std.model.UnwrapError: in >> ignored -Exception pypy.objspace.std.model.UnwrapError: in >> ignored -Exception pypy.objspace.std.model.UnwrapError: in >> ignored -Exception pypy.objspace.std.model.UnwrapError: in >> ignored -Exception pypy.objspace.std.model.UnwrapError: in >> ignored -Exception pypy.objspace.std.model.UnwrapError: in >> ignored -Exception pypy.objspace.std.model.UnwrapError: in >> ignored -Exception pypy.objspace.std.model.UnwrapError: in >> ignored -Exception pypy.objspace.std.model.UnwrapError: in >> ignored -Exception pypy.objspace.std.model.UnwrapError: in >> ignored -Exception pypy.objspace.std.model.UnwrapError: in >> ignored -Exception pypy.objspace.std.model.UnwrapError: in >> ignored -Exception pypy.objspace.std.model.UnwrapError: in >> ignored -Exception pypy.objspace.std.model.UnwrapError: in >> ignored -Exception pypy.objspace.std.model.UnwrapError: in >> ignored -Exception pypy.objspace.std.model.UnwrapError: in >> ignored -Exception pypy.objspace.std.model.UnwrapError: in >> ignored -Exception pypy.objspace.std.model.UnwrapError: in >> ignored -Exception pypy.objspace.std.model.UnwrapError: in >> ignored -Exception pypy.objspace.std.model.UnwrapError: in >> ignored -Exception pypy.objspace.std.model.UnwrapError: in >> ignored -Exception pypy.objspace.std.model.UnwrapError: in >> ignored -Exception pypy.objspace.std.model.UnwrapError: in >> ignored -Exception pypy.objspace.std.model.UnwrapError: in >> ignored -Exception pypy.objspace.std.model.UnwrapError: in >> ignored -Exception pypy.objspace.std.model.UnwrapError: in >> ignored -Exception pypy.objspace.std.model.UnwrapError: in >> ignored -Exception pypy.objspace.std.model.UnwrapError: in >> ignored -Exception pypy.objspace.std.model.UnwrapError: in >> ignored -Exception pypy.objspace.std.model.UnwrapError: in >> ignored -Exception pypy.objspace.std.model.UnwrapError: in >> ignored -Exception pypy.objspace.std.model.UnwrapError: in >> ignored -Exception pypy.objspace.std.model.UnwrapError: in >> ignored -Exception pypy.objspace.std.model.UnwrapError: in >> ignored -Exception pypy.objspace.std.model.UnwrapError: in >> ignored -Exception pypy.objspace.std.model.UnwrapError: in >> ignored -Exception pypy.objspace.std.model.UnwrapError: in >> ignored -Exception pypy.objspace.std.model.UnwrapError: in >> ignored -Exception pypy.objspace.std.model.UnwrapError: in >> ignored -Exception pypy.objspace.std.model.UnwrapError: in >> ignored -Exception pypy.objspace.std.model.UnwrapError: in >> ignored -Exception pypy.objspace.std.model.UnwrapError: in >> ignored -Exception pypy.objspace.std.model.UnwrapError: in >> ignored -Exception pypy.objspace.std.model.UnwrapError: in >> ignored -Exception pypy.objspace.std.model.UnwrapError: in >> ignored -Exception pypy.objspace.std.model.UnwrapError: in >> ignored -Exception pypy.objspace.std.model.UnwrapError: in >> ignored -Exception pypy.objspace.std.model.UnwrapError: in >> ignored -Exception pypy.objspace.std.model.UnwrapError: in >> ignored -Exception pypy.objspace.std.model.UnwrapError: in >> ignored -Exception pypy.objspace.std.model.UnwrapError: in >> ignored -Exception pypy.objspace.std.model.UnwrapError: in >> ignored -Exception pypy.objspace.std.model.UnwrapError: in >> ignored -Exception pypy.objspace.std.model.UnwrapError: in >> ignored -Exception pypy.objspace.std.model.UnwrapError: in >> ignored -Exception pypy.objspace.std.model.UnwrapError: in >> ignored -Exception pypy.objspace.std.model.UnwrapError: in >> ignored -Exception pypy.objspace.std.model.UnwrapError: in >> ignored -Exception pypy.objspace.std.model.UnwrapError: in >> ignored -Exception pypy.objspace.std.model.UnwrapError: in >> ignored -Exception pypy.objspace.std.model.UnwrapError: in >> ignored -Exception pypy.objspace.std.model.UnwrapError: in >> ignored -Exception pypy.objspace.std.model.UnwrapError: in >> ignored -Exception pypy.objspace.std.model.UnwrapError: in >> ignored -Exception pypy.objspace.std.model.UnwrapError: in >> ignored -Exception pypy.objspace.std.model.UnwrapError: in >> ignored -Exception pypy.objspace.std.model.UnwrapError: in >> ignored -Exception pypy.objspace.std.model.UnwrapError: in >> ignored -Exception pypy.objspace.std.model.UnwrapError: in >> ignored -Exception pypy.objspace.std.model.UnwrapError: in >> ignored -Exception pypy.objspace.std.model.UnwrapError: in >> ignored -Exception pypy.objspace.std.model.UnwrapError: in >> ignored -Exception pypy.objspace.std.model.UnwrapError: in >> ignored -Exception pypy.objspace.std.model.UnwrapError: in >> ignored -Exception pypy.objspace.std.model.UnwrapError: in >> ignored -Exception pypy.objspace.std.model.UnwrapError: in >> ignored -Exception pypy.objspace.std.model.UnwrapError: in >> ignored -Exception pypy.objspace.std.model.UnwrapError: in >> ignored -Exception pypy.objspace.std.model.UnwrapError: in >> ignored -Exception pypy.objspace.std.model.UnwrapError: in >> ignored -Exception pypy.objspace.std.model.UnwrapError: in >> ignored -Exception pypy.objspace.std.model.UnwrapError: in >> ignored -Exception pypy.objspace.std.model.UnwrapError: in >> ignored -Exception pypy.objspace.std.model.UnwrapError: in >> ignored -Exception pypy.objspace.std.model.UnwrapError: in >> ignored -Exception pypy.objspace.std.model.UnwrapError: in >> ignored -Exception pypy.objspace.std.model.UnwrapError: in >> ignored -Exception pypy.objspace.std.model.UnwrapError: in >> ignored -Exception pypy.objspace.std.model.UnwrapError: in >> ignored +Exception pypy.objspace.std.model.UnwrapError: in >> ignored +Exception pypy.objspace.std.model.UnwrapError: in >> ignored +Exception pypy.objspace.std.model.UnwrapError: in >> ignored +Exception pypy.objspace.std.model.UnwrapError: in >> ignored +Exception pypy.objspace.std.model.UnwrapError: in >> ignored +Exception pypy.objspace.std.model.UnwrapError: in >> ignored +Exception pypy.objspace.std.model.UnwrapError: in >> ignored +Exception pypy.objspace.std.model.UnwrapError: in >> ignored +Exception pypy.objspace.std.model.UnwrapError: in >> ignored +Exception pypy.objspace.std.model.UnwrapError: in >> ignored +Exception pypy.objspace.std.model.UnwrapError: in >> ignored +Exception pypy.objspace.std.model.UnwrapError: in >> ignored +Exception pypy.objspace.std.model.UnwrapError: in >> ignored +Exception pypy.objspace.std.model.UnwrapError: in >> ignored +Exception pypy.objspace.std.model.UnwrapError: in >> ignored +Exception pypy.objspace.std.model.UnwrapError: in >> ignored +Exception pypy.objspace.std.model.UnwrapError: in >> ignored +Exception pypy.objspace.std.model.UnwrapError: in >> ignored +Exception pypy.objspace.std.model.UnwrapError: in >> ignored +Exception pypy.objspace.std.model.UnwrapError: in >> ignored +Exception pypy.objspace.std.model.UnwrapError: in >> ignored +Exception pypy.objspace.std.model.UnwrapError: in >> ignored +Exception pypy.objspace.std.model.UnwrapError: in >> ignored +Exception pypy.objspace.std.model.UnwrapError: in >> ignored +Exception pypy.objspace.std.model.UnwrapError: in >> ignored +Exception pypy.objspace.std.model.UnwrapError: in >> ignored +Exception pypy.objspace.std.model.UnwrapError: in >> ignored +Exception pypy.objspace.std.model.UnwrapError: in >> ignored +Exception pypy.objspace.std.model.UnwrapError: in >> ignored +Exception pypy.objspace.std.model.UnwrapError: in >> ignored +Exception pypy.objspace.std.model.UnwrapError: in >> ignored +Exception pypy.objspace.std.model.UnwrapError: in >> ignored +Exception pypy.objspace.std.model.UnwrapError: in >> ignored +Exception pypy.objspace.std.model.UnwrapError: in >> ignored +Exception pypy.objspace.std.model.UnwrapError: in >> ignored +Exception pypy.objspace.std.model.UnwrapError: in >> ignored +Exception pypy.objspace.std.model.UnwrapError: in >> ignored +Exception pypy.objspace.std.model.UnwrapError: in >> ignored +Exception pypy.objspace.std.model.UnwrapError: in >> ignored +Exception pypy.objspace.std.model.UnwrapError: in >> ignored +Exception pypy.objspace.std.model.UnwrapError: in >> ignored +Exception pypy.objspace.std.model.UnwrapError: in >> ignored +Exception pypy.objspace.std.model.UnwrapError: in >> ignored +Exception pypy.objspace.std.model.UnwrapError: in >> ignored +Exception pypy.objspace.std.model.UnwrapError: in >> ignored +Exception pypy.objspace.std.model.UnwrapError: in >> ignored +Exception pypy.objspace.std.model.UnwrapError: in >> ignored +Exception pypy.objspace.std.model.UnwrapError: in >> ignored +Exception pypy.objspace.std.model.UnwrapError: in >> ignored +Exception pypy.objspace.std.model.UnwrapError: in >> ignored +Exception pypy.objspace.std.model.UnwrapError: in >> ignored +Exception pypy.objspace.std.model.UnwrapError: in >> ignored +Exception pypy.objspace.std.model.UnwrapError: in >> ignored +Exception pypy.objspace.std.model.UnwrapError: in >> ignored +Exception pypy.objspace.std.model.UnwrapError: in >> ignored +Exception pypy.objspace.std.model.UnwrapError: in >> ignored +Exception pypy.objspace.std.model.UnwrapError: in >> ignored +Exception pypy.objspace.std.model.UnwrapError: in >> ignored +Exception pypy.objspace.std.model.UnwrapError: in >> ignored +Exception pypy.objspace.std.model.UnwrapError: in >> ignored +Exception pypy.objspace.std.model.UnwrapError: in >> ignored +Exception pypy.objspace.std.model.UnwrapError: in >> ignored +Exception pypy.objspace.std.model.UnwrapError: in >> ignored +Exception pypy.objspace.std.model.UnwrapError: in >> ignored +Exception pypy.objspace.std.model.UnwrapError: in >> ignored +Exception pypy.objspace.std.model.UnwrapError: in >> ignored +Exception pypy.objspace.std.model.UnwrapError: in >> ignored +Exception pypy.objspace.std.model.UnwrapError: in >> ignored +Exception pypy.objspace.std.model.UnwrapError: in >> ignored +Exception pypy.objspace.std.model.UnwrapError: in >> ignored +Exception pypy.objspace.std.model.UnwrapError: in >> ignored +Exception pypy.objspace.std.model.UnwrapError: in >> ignored +Exception pypy.objspace.std.model.UnwrapError: in >> ignored +Exception pypy.objspace.std.model.UnwrapError: in >> ignored +Exception pypy.objspace.std.model.UnwrapError: in >> ignored +Exception pypy.objspace.std.model.UnwrapError: in >> ignored +Exception pypy.objspace.std.model.UnwrapError: in >> ignored +Exception pypy.objspace.std.model.UnwrapError: in >> ignored +Exception pypy.objspace.std.model.UnwrapError: in >> ignored +Exception pypy.objspace.std.model.UnwrapError: in >> ignored +Exception pypy.objspace.std.model.UnwrapError: in >> ignored +Exception pypy.objspace.std.model.UnwrapError: in >> ignored +Exception pypy.objspace.std.model.UnwrapError: in >> ignored +Exception pypy.objspace.std.model.UnwrapError: in >> ignored +Exception pypy.objspace.std.model.UnwrapError: in >> ignored +Exception pypy.objspace.std.model.UnwrapError: in >> ignored +Exception pypy.objspace.std.model.UnwrapError: in >> ignored +Exception pypy.objspace.std.model.UnwrapError: in >> ignored +Exception pypy.objspace.std.model.UnwrapError: in >> ignored +Exception pypy.objspace.std.model.UnwrapError: in >> ignored +Exception pypy.objspace.std.model.UnwrapError: in >> ignored +Exception pypy.objspace.std.model.UnwrapError: in >> ignored +Exception pypy.objspace.std.model.UnwrapError: in >> ignored +Exception pypy.objspace.std.model.UnwrapError: in >> ignored +Exception pypy.objspace.std.model.UnwrapError: in >> ignored +Exception pypy.objspace.std.model.UnwrapError: in >> ignored +Exception pypy.objspace.std.model.UnwrapError: in >> ignored +Exception pypy.objspace.std.model.UnwrapError: in >> ignored +Exception pypy.objspace.std.model.UnwrapError: in >> ignored +Exception pypy.objspace.std.model.UnwrapError: in >> ignored +Exception pypy.objspace.std.model.UnwrapError: in >> ignored +Exception pypy.objspace.std.model.UnwrapError: in >> ignored +Exception pypy.objspace.std.model.UnwrapError: in >> ignored +Exception pypy.objspace.std.model.UnwrapError: in >> ignored +Exception pypy.objspace.std.model.UnwrapError: in >> ignored +Exception pypy.objspace.std.model.UnwrapError: in >> ignored +Exception pypy.objspace.std.model.UnwrapError: in >> ignored faking faking -faking -faking -faking -fd 112 is open in childTraceback (application-level): - File "/home/arigo/pypysrc/lib-python-2.3.4/test/tf_inherit_check.py", line 20 in ? - sys.exit(1) -SystemExit: 1 +Traceback (most recent call last): + File "/home/arigo/pypysrc/pypy/interpreter/py.py", line 78, in main_ + main.run_file(args[0], space) + File "/home/arigo/svn/pypy/dist/pypy/interpreter/main.py", line 58, in run_file +IOError: [Errno 2] No such file or directory: '/home/arigo/pypysrc/lib-python/modified-2.3.4/test/tf_inherit_check.py' +Exception pypy.objspace.std.model.UnwrapError: in >> ignored test_exports (__main__.test_exports) ... ok test_get_six_char_str (__main__.test__RandomNameSequence) ... ok test_many (__main__.test__RandomNameSequence) ... ok @@ -344,7 +343,6 @@ File "/home/arigo/pypysrc/pypy/objspace/std/fake.py", line 133, in setfastscope raise UnwrapError('calling %s: %s' % (self.code.cpy_callable, e)) pypy.objspace.std.model.UnwrapError: calling : cannot unwrap > -Exception pypy.objspace.std.model.UnwrapError: in >> ignored ========================== closed ========================== -execution time: 207.429424047 seconds +execution time: 206.432775021 seconds exit status: 1 Modified: pypy/testresult/arigo at tismerysoft.de/test_textwrap.txt ============================================================================== --- pypy/testresult/arigo at tismerysoft.de/test_textwrap.txt (original) +++ pypy/testresult/arigo at tismerysoft.de/test_textwrap.txt Sun May 1 22:16:12 2005 @@ -6,8 +6,8 @@ cpu model: AMD Athlon(tm) XP 3000+ cpu mhz: 2166.513 oldstyle: no -pypy-revision: 11698 -startdate: Sun May 1 19:31:23 2005 +pypy-revision: 11706 +startdate: Sun May 1 23:43:35 2005 timeout: 529.0 seconds ============================================================ @@ -44,9 +44,9 @@ test_dedent_uneven (__main__.DedentTestCase) ... ok ---------------------------------------------------------------------- -Ran 22 tests in 93.905s +Ran 22 tests in 94.002s OK ========================== closed ========================== -execution time: 114.14102602 seconds +execution time: 114.20721221 seconds exit status: 0 Modified: pypy/testresult/arigo at tismerysoft.de/test_time.txt ============================================================================== --- pypy/testresult/arigo at tismerysoft.de/test_time.txt (original) +++ pypy/testresult/arigo at tismerysoft.de/test_time.txt Sun May 1 22:16:12 2005 @@ -6,8 +6,8 @@ cpu model: AMD Athlon(tm) XP 3000+ cpu mhz: 2166.513 oldstyle: no -pypy-revision: 11698 -startdate: Sun May 1 19:33:17 2005 +pypy-revision: 11706 +startdate: Sun May 1 23:45:30 2005 timeout: 529.0 seconds ============================================================ @@ -27,9 +27,9 @@ test_tzset (__main__.TimeTestCase) ... ok ---------------------------------------------------------------------- -Ran 8 tests in 4.054s +Ran 8 tests in 4.135s OK ========================== closed ========================== -execution time: 11.353618145 seconds +execution time: 11.4406268597 seconds exit status: 0 Modified: pypy/testresult/arigo at tismerysoft.de/test_tokenize.txt ============================================================================== --- pypy/testresult/arigo at tismerysoft.de/test_tokenize.txt (original) +++ pypy/testresult/arigo at tismerysoft.de/test_tokenize.txt Sun May 1 22:16:12 2005 @@ -1,17 +1,17 @@ testreport-version: 1.0 -command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 575 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python-2.3.4/test/test_tokenize.py +command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 529 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/2.3.4/test/test_tokenize.py run by: arigo at tismerysoft.de sys.platform: linux2 sys.version_info: (2, 3, 5, 'final', 0) cpu model: AMD Athlon(tm) XP 3000+ cpu mhz: 2166.513 oldstyle: no -pypy-revision: 11638 -startdate: Sat Apr 30 06:11:03 2005 -timeout: 576.0 seconds +pypy-revision: 11706 +startdate: Sun May 1 23:45:41 2005 +timeout: 529.0 seconds OUTPUT TEST -see output in: /home/arigo/pypysrc/lib-python-2.3.4/test/result/arigo at tismerysoft.de/test_tokenize.out +see output in: /home/arigo/pypysrc/testresult/arigo at tismerysoft.de/test_tokenize.out ============================================================ faking faking @@ -24,5 +24,5 @@ faking FAILED: test output differs ========================== closed ========================== -execution time: 321.591223001 seconds +execution time: 323.111890793 seconds exit status: 0 Modified: pypy/testresult/arigo at tismerysoft.de/test_trace.txt ============================================================================== --- pypy/testresult/arigo at tismerysoft.de/test_trace.txt (original) +++ pypy/testresult/arigo at tismerysoft.de/test_trace.txt Sun May 1 22:16:12 2005 @@ -1,14 +1,14 @@ testreport-version: 1.0 -command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 575 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/2.3.4/test/test_trace.py +command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 529 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/2.3.4/test/test_trace.py run by: arigo at tismerysoft.de sys.platform: linux2 sys.version_info: (2, 3, 5, 'final', 0) cpu model: AMD Athlon(tm) XP 3000+ cpu mhz: 2166.513 oldstyle: no -pypy-revision: 11698 -startdate: Sun May 1 19:33:29 2005 -timeout: 576.0 seconds +pypy-revision: 11706 +startdate: Sun May 1 23:51:05 2005 +timeout: 529.0 seconds ============================================================ faking @@ -54,9 +54,9 @@ test_19_no_jump_without_trace_function (__main__.JumpTestCase) ... ok ---------------------------------------------------------------------- -Ran 33 tests in 19.843s +Ran 33 tests in 19.834s OK ========================== closed ========================== -execution time: 32.4502789974 seconds +execution time: 32.4556820393 seconds exit status: 0 Modified: pypy/testresult/arigo at tismerysoft.de/test_traceback.txt ============================================================================== --- pypy/testresult/arigo at tismerysoft.de/test_traceback.txt (original) +++ pypy/testresult/arigo at tismerysoft.de/test_traceback.txt Sun May 1 22:16:12 2005 @@ -1,13 +1,13 @@ testreport-version: 1.0 -command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 576 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python-2.3.4/test/test_traceback.py +command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 575 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/2.3.4/test/test_traceback.py run by: arigo at tismerysoft.de sys.platform: linux2 sys.version_info: (2, 3, 5, 'final', 0) cpu model: AMD Athlon(tm) XP 3000+ cpu mhz: 2166.513 oldstyle: no -pypy-revision: 11638 -startdate: Sat Apr 30 06:16:58 2005 +pypy-revision: 11706 +startdate: Sun May 1 23:51:38 2005 timeout: 576.0 seconds ============================================================ @@ -17,13 +17,13 @@ faking faking Traceback (application-level): - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_traceback.py", line 49 in ? + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_traceback.py", line 49 in ? test_main() - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_traceback.py", line 45 in test_main + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_traceback.py", line 45 in test_main run_unittest(TracebackCases) - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_support.py", line 262 in run_unittest + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_support.py", line 262 in run_unittest run_suite(suite, testclass) - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_support.py", line 246 in run_suite + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_support.py", line 246 in run_suite raise TestFailed(msg) TestFailed: errors occurred in __main__.TracebackCases test_caret (__main__.TracebackCases) ... FAIL @@ -33,9 +33,9 @@ FAIL: test_caret (__main__.TracebackCases) ---------------------------------------------------------------------- Traceback (most recent call last): - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_traceback.py", line 30, in test_caret + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_traceback.py", line 30, in test_caret self.assert_(len(err) == 4) - File "/home/arigo/pypysrc/lib-python-2.3.4/unittest.py", line 278, in failUnless + File "/home/arigo/pypysrc/lib-python/2.3.4/unittest.py", line 278, in failUnless if not expr: raise self.failureException, msg AssertionError @@ -43,16 +43,16 @@ FAIL: test_nocaret (__main__.TracebackCases) ---------------------------------------------------------------------- Traceback (most recent call last): - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_traceback.py", line 40, in test_nocaret + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_traceback.py", line 40, in test_nocaret self.assert_(len(err) == 3) - File "/home/arigo/pypysrc/lib-python-2.3.4/unittest.py", line 278, in failUnless + File "/home/arigo/pypysrc/lib-python/2.3.4/unittest.py", line 278, in failUnless if not expr: raise self.failureException, msg AssertionError ---------------------------------------------------------------------- -Ran 2 tests in 2.846s +Ran 2 tests in 2.760s FAILED (failures=2) ========================== closed ========================== -execution time: 10.6154210567 seconds +execution time: 11.170871973 seconds exit status: 1 Modified: pypy/testresult/arigo at tismerysoft.de/test_types.txt ============================================================================== --- pypy/testresult/arigo at tismerysoft.de/test_types.txt (original) +++ pypy/testresult/arigo at tismerysoft.de/test_types.txt Sun May 1 22:16:12 2005 @@ -1,14 +1,14 @@ testreport-version: 1.0 -command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 576 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/modified-2.3.4/test/test_types.py +command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 529 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/modified-2.3.4/test/test_types.py run by: arigo at tismerysoft.de sys.platform: linux2 sys.version_info: (2, 3, 5, 'final', 0) cpu model: AMD Athlon(tm) XP 3000+ cpu mhz: 2166.513 oldstyle: no -pypy-revision: 11698 -startdate: Sun May 1 19:34:02 2005 -timeout: 576.0 seconds +pypy-revision: 11706 +startdate: Sun May 1 23:51:50 2005 +timeout: 529.0 seconds OUTPUT TEST see output in: /home/arigo/pypysrc/testresult/arigo at tismerysoft.de/test_types.out @@ -20,5 +20,5 @@ faking OK ========================== closed ========================== -execution time: 288.837944031 seconds +execution time: 288.667569876 seconds exit status: 0 Modified: pypy/testresult/arigo at tismerysoft.de/test_unary.txt ============================================================================== --- pypy/testresult/arigo at tismerysoft.de/test_unary.txt (original) +++ pypy/testresult/arigo at tismerysoft.de/test_unary.txt Sun May 1 22:16:12 2005 @@ -1,14 +1,14 @@ testreport-version: 1.0 -command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 529 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/2.3.4/test/test_unary.py +command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 575 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/2.3.4/test/test_unary.py run by: arigo at tismerysoft.de sys.platform: linux2 sys.version_info: (2, 3, 5, 'final', 0) cpu model: AMD Athlon(tm) XP 3000+ cpu mhz: 2166.513 oldstyle: no -pypy-revision: 11698 -startdate: Sun May 1 19:38:51 2005 -timeout: 529.0 seconds +pypy-revision: 11706 +startdate: Sun May 1 23:56:39 2005 +timeout: 576.0 seconds ============================================================ faking @@ -24,9 +24,9 @@ test_positive (__main__.UnaryOpTestCase) ... ok ---------------------------------------------------------------------- -Ran 6 tests in 2.518s +Ran 6 tests in 2.531s OK ========================== closed ========================== -execution time: 9.98944687843 seconds +execution time: 9.99980092049 seconds exit status: 0 Modified: pypy/testresult/arigo at tismerysoft.de/test_univnewlines.txt ============================================================================== --- pypy/testresult/arigo at tismerysoft.de/test_univnewlines.txt (original) +++ pypy/testresult/arigo at tismerysoft.de/test_univnewlines.txt Sun May 1 22:16:12 2005 @@ -1,13 +1,13 @@ testreport-version: 1.0 -command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 484 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/2.3.4/test/test_univnewlines.py +command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 483 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/2.3.4/test/test_univnewlines.py run by: arigo at tismerysoft.de sys.platform: linux2 sys.version_info: (2, 3, 5, 'final', 0) cpu model: AMD Athlon(tm) XP 3000+ cpu mhz: 2166.513 oldstyle: no -pypy-revision: 11698 -startdate: Sun May 1 19:39:01 2005 +pypy-revision: 11706 +startdate: Sun May 1 23:56:49 2005 timeout: 484.0 seconds ============================================================ @@ -43,9 +43,9 @@ test_seek (__main__.TestMixedNewlines) ... ok ---------------------------------------------------------------------- -Ran 25 tests in 8.763s +Ran 25 tests in 8.752s OK ========================== closed ========================== -execution time: 26.148378849 seconds +execution time: 26.1432080269 seconds exit status: 0 Modified: pypy/testresult/arigo at tismerysoft.de/test_unpack.txt ============================================================================== --- pypy/testresult/arigo at tismerysoft.de/test_unpack.txt (original) +++ pypy/testresult/arigo at tismerysoft.de/test_unpack.txt Sun May 1 22:16:12 2005 @@ -1,13 +1,13 @@ testreport-version: 1.0 -command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 576 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/2.3.4/test/test_unpack.py +command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 575 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/2.3.4/test/test_unpack.py run by: arigo at tismerysoft.de sys.platform: linux2 sys.version_info: (2, 3, 5, 'final', 0) cpu model: AMD Athlon(tm) XP 3000+ cpu mhz: 2166.513 oldstyle: no -pypy-revision: 11698 -startdate: Sun May 1 19:39:27 2005 +pypy-revision: 11706 +startdate: Sun May 1 23:57:15 2005 timeout: 576.0 seconds ============================================================ @@ -30,5 +30,5 @@ unpack sequence too long, wrong error unpack sequence too short, wrong error ========================== closed ========================== -execution time: 5.46823191643 seconds +execution time: 5.46951985359 seconds exit status: 0 Modified: pypy/testresult/arigo at tismerysoft.de/test_urllib.txt ============================================================================== --- pypy/testresult/arigo at tismerysoft.de/test_urllib.txt (original) +++ pypy/testresult/arigo at tismerysoft.de/test_urllib.txt Sun May 1 22:16:12 2005 @@ -1,14 +1,14 @@ testreport-version: 1.0 -command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 575 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/2.3.4/test/test_urllib.py +command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 529 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/2.3.4/test/test_urllib.py run by: arigo at tismerysoft.de sys.platform: linux2 sys.version_info: (2, 3, 5, 'final', 0) cpu model: AMD Athlon(tm) XP 3000+ cpu mhz: 2166.513 oldstyle: no -pypy-revision: 11698 -startdate: Sun May 1 19:39:33 2005 -timeout: 576.0 seconds +pypy-revision: 11706 +startdate: Sun May 1 23:57:21 2005 +timeout: 529.0 seconds ============================================================ faking @@ -52,9 +52,9 @@ test_quoting (__main__.Pathname_Tests) ... ok ---------------------------------------------------------------------- -Ran 26 tests in 167.529s +Ran 26 tests in 169.679s OK ========================== closed ========================== -execution time: 188.486027956 seconds +execution time: 190.647668123 seconds exit status: 0 Modified: pypy/testresult/arigo at tismerysoft.de/test_urllib2.txt ============================================================================== --- pypy/testresult/arigo at tismerysoft.de/test_urllib2.txt (original) +++ pypy/testresult/arigo at tismerysoft.de/test_urllib2.txt Sun May 1 22:16:12 2005 @@ -1,14 +1,14 @@ testreport-version: 1.0 -command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 529 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/2.3.4/test/test_urllib2.py +command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 576 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/2.3.4/test/test_urllib2.py run by: arigo at tismerysoft.de sys.platform: linux2 sys.version_info: (2, 3, 5, 'final', 0) cpu model: AMD Athlon(tm) XP 3000+ cpu mhz: 2166.513 oldstyle: no -pypy-revision: 11698 -startdate: Sun May 1 19:42:42 2005 -timeout: 529.0 seconds +pypy-revision: 11706 +startdate: Mon May 2 00:00:32 2005 +timeout: 576.0 seconds ============================================================ faking @@ -25,5 +25,5 @@ faking faking ========================== closed ========================== -execution time: 121.849426031 seconds +execution time: 126.996062994 seconds exit status: 0 Modified: pypy/testresult/arigo at tismerysoft.de/test_urlparse.txt ============================================================================== --- pypy/testresult/arigo at tismerysoft.de/test_urlparse.txt (original) +++ pypy/testresult/arigo at tismerysoft.de/test_urlparse.txt Sun May 1 22:16:12 2005 @@ -1,14 +1,14 @@ testreport-version: 1.0 -command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 529 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/2.3.4/test/test_urlparse.py +command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 575 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/2.3.4/test/test_urlparse.py run by: arigo at tismerysoft.de sys.platform: linux2 sys.version_info: (2, 3, 5, 'final', 0) cpu model: AMD Athlon(tm) XP 3000+ cpu mhz: 2166.513 oldstyle: no -pypy-revision: 11698 -startdate: Sun May 1 19:44:44 2005 -timeout: 529.0 seconds +pypy-revision: 11706 +startdate: Mon May 2 00:02:39 2005 +timeout: 576.0 seconds ============================================================ faking @@ -23,9 +23,9 @@ test_urldefrag (__main__.UrlParseTestCase) ... ok ---------------------------------------------------------------------- -Ran 5 tests in 11.713s +Ran 5 tests in 11.701s OK ========================== closed ========================== -execution time: 18.9845168591 seconds +execution time: 19.1968648434 seconds exit status: 0 Modified: pypy/testresult/arigo at tismerysoft.de/test_userdict.txt ============================================================================== --- pypy/testresult/arigo at tismerysoft.de/test_userdict.txt (original) +++ pypy/testresult/arigo at tismerysoft.de/test_userdict.txt Sun May 1 22:16:12 2005 @@ -1,14 +1,14 @@ testreport-version: 1.0 -command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 575 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/2.3.4/test/test_userdict.py +command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 529 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/2.3.4/test/test_userdict.py run by: arigo at tismerysoft.de sys.platform: linux2 sys.version_info: (2, 3, 5, 'final', 0) cpu model: AMD Athlon(tm) XP 3000+ cpu mhz: 2166.513 oldstyle: no -pypy-revision: 11698 -startdate: Sun May 1 19:45:03 2005 -timeout: 576.0 seconds +pypy-revision: 11706 +startdate: Mon May 2 00:02:58 2005 +timeout: 529.0 seconds ============================================================ faking @@ -26,9 +26,9 @@ test_write (__main__.UserDictMixinTest) ... ok ---------------------------------------------------------------------- -Ran 8 tests in 11.628s +Ran 8 tests in 11.700s OK ========================== closed ========================== -execution time: 23.808191061 seconds +execution time: 23.9240109921 seconds exit status: 0 Modified: pypy/testresult/arigo at tismerysoft.de/test_userlist.txt ============================================================================== --- pypy/testresult/arigo at tismerysoft.de/test_userlist.txt (original) +++ pypy/testresult/arigo at tismerysoft.de/test_userlist.txt Sun May 1 22:16:12 2005 @@ -1,14 +1,14 @@ testreport-version: 1.0 -command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 529 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/2.3.4/test/test_userlist.py +command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 576 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/2.3.4/test/test_userlist.py run by: arigo at tismerysoft.de sys.platform: linux2 sys.version_info: (2, 3, 5, 'final', 0) cpu model: AMD Athlon(tm) XP 3000+ cpu mhz: 2166.513 oldstyle: no -pypy-revision: 11698 -startdate: Sun May 1 19:45:27 2005 -timeout: 529.0 seconds +pypy-revision: 11706 +startdate: Mon May 2 00:03:23 2005 +timeout: 576.0 seconds ============================================================ faking @@ -43,9 +43,9 @@ test_sort (__main__.UserListTest) ... ok ---------------------------------------------------------------------- -Ran 25 tests in 27.086s +Ran 25 tests in 27.158s OK ========================== closed ========================== -execution time: 34.8530368805 seconds +execution time: 34.9669799805 seconds exit status: 0 Modified: pypy/testresult/arigo at tismerysoft.de/test_userstring.txt ============================================================================== --- pypy/testresult/arigo at tismerysoft.de/test_userstring.txt (original) +++ pypy/testresult/arigo at tismerysoft.de/test_userstring.txt Sun May 1 22:16:12 2005 @@ -1,14 +1,14 @@ testreport-version: 1.0 -command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 576 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python-2.3.4/test/test_userstring.py +command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 528 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/2.3.4/test/test_userstring.py run by: arigo at tismerysoft.de sys.platform: linux2 sys.version_info: (2, 3, 5, 'final', 0) cpu model: AMD Athlon(tm) XP 3000+ cpu mhz: 2166.513 oldstyle: no -pypy-revision: 11638 -startdate: Sat Apr 30 06:58:51 2005 -timeout: 576.0 seconds +pypy-revision: 11706 +startdate: Mon May 2 00:03:58 2005 +timeout: 529.0 seconds ============================================================ faking @@ -18,27 +18,27 @@ faking ==========================timeout========================== Traceback (application-level): - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_userstring.py", line 50 in ? + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_userstring.py", line 50 in ? test_main() - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_userstring.py", line 47 in test_main + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_userstring.py", line 47 in test_main test_support.run_unittest(UserStringTest) - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_support.py", line 262 in run_unittest + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_support.py", line 262 in run_unittest run_suite(suite, testclass) - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_support.py", line 234 in run_suite + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_support.py", line 234 in run_suite result = runner.run(suite) - File "/home/arigo/pypysrc/lib-python-2.3.4/unittest.py", line 658 in run + File "/home/arigo/pypysrc/lib-python/2.3.4/unittest.py", line 658 in run test(result) - File "/home/arigo/pypysrc/lib-python-2.3.4/unittest.py", line 389 in __call__ + File "/home/arigo/pypysrc/lib-python/2.3.4/unittest.py", line 389 in __call__ test(result) - File "/home/arigo/pypysrc/lib-python-2.3.4/unittest.py", line 389 in __call__ + File "/home/arigo/pypysrc/lib-python/2.3.4/unittest.py", line 389 in __call__ test(result) - File "/home/arigo/pypysrc/lib-python-2.3.4/unittest.py", line 229 in __call__ + File "/home/arigo/pypysrc/lib-python/2.3.4/unittest.py", line 229 in __call__ testMethod() - File "/home/arigo/pypysrc/lib-python-2.3.4/test/string_tests.py", line 586 in test_floatformatting + File "/home/arigo/pypysrc/lib-python/2.3.4/test/string_tests.py", line 586 in test_floatformatting self.checkcall(format, "__mod__", value) - File "/home/arigo/pypysrc/lib-python-2.3.4/test/test_userstring.py", line 44 in checkcall + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_userstring.py", line 44 in checkcall getattr(object, methodname)(*args) - File "/home/arigo/pypysrc/lib-python-2.3.4/UserString.py", line 59 in __mod__ + File "/home/arigo/pypysrc/lib-python/2.3.4/UserString.py", line 59 in __mod__ return self.__class__(self.data % args) KeyboardInterrupt test___contains__ (__main__.UserStringTest) ... ok @@ -50,5 +50,5 @@ test_expandtabs (__main__.UserStringTest) ... ok test_find (__main__.UserStringTest) ... ok test_floatformatting (__main__.UserStringTest) ... ========================== closed ========================== -execution time: 576.162163019 seconds +execution time: 528.482573986 seconds exit status: 1 Modified: pypy/testresult/arigo at tismerysoft.de/test_warnings.txt ============================================================================== --- pypy/testresult/arigo at tismerysoft.de/test_warnings.txt (original) +++ pypy/testresult/arigo at tismerysoft.de/test_warnings.txt Sun May 1 22:16:12 2005 @@ -1,14 +1,14 @@ testreport-version: 1.0 -command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 575 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/2.3.4/test/test_warnings.py +command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 529 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/2.3.4/test/test_warnings.py run by: arigo at tismerysoft.de sys.platform: linux2 sys.version_info: (2, 3, 5, 'final', 0) cpu model: AMD Athlon(tm) XP 3000+ cpu mhz: 2166.513 oldstyle: no -pypy-revision: 11698 -startdate: Sun May 1 19:46:02 2005 -timeout: 576.0 seconds +pypy-revision: 11706 +startdate: Mon May 2 00:12:47 2005 +timeout: 529.0 seconds ============================================================ faking @@ -25,9 +25,9 @@ test_warn_specific_category (__main__.TestModule) ... ok ---------------------------------------------------------------------- -Ran 3 tests in 5.629s +Ran 3 tests in 15.612s OK ========================== closed ========================== -execution time: 12.8851997852 seconds +execution time: 34.8281018734 seconds exit status: 0 Modified: pypy/testresult/arigo at tismerysoft.de/test_whichdb.txt ============================================================================== --- pypy/testresult/arigo at tismerysoft.de/test_whichdb.txt (original) +++ pypy/testresult/arigo at tismerysoft.de/test_whichdb.txt Sun May 1 22:16:12 2005 @@ -1,14 +1,14 @@ testreport-version: 1.0 -command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 529 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/2.3.4/test/test_whichdb.py +command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 576 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/2.3.4/test/test_whichdb.py run by: arigo at tismerysoft.de sys.platform: linux2 sys.version_info: (2, 3, 5, 'final', 0) cpu model: AMD Athlon(tm) XP 3000+ cpu mhz: 2166.513 oldstyle: no -pypy-revision: 11698 -startdate: Sun May 1 19:46:15 2005 -timeout: 529.0 seconds +pypy-revision: 11706 +startdate: Mon May 2 00:13:22 2005 +timeout: 576.0 seconds ============================================================ faking @@ -23,9 +23,9 @@ test_whichdb_dumbdbm (__main__.WhichDBTestCase) ... ok ---------------------------------------------------------------------- -Ran 1 test in 3.577s +Ran 1 test in 8.711s OK ========================== closed ========================== -execution time: 15.343859911 seconds +execution time: 37.3342130184 seconds exit status: 0 From arigo at codespeak.net Sun May 1 22:19:57 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Sun, 1 May 2005 22:19:57 +0200 (CEST) Subject: [pypy-svn] r11730 - pypy/dist/pypy/objspace/std Message-ID: <20050501201957.5BCE427C23@code1.codespeak.net> Author: arigo Date: Sun May 1 22:19:57 2005 New Revision: 11730 Modified: pypy/dist/pypy/objspace/std/longobject.py Log: More truediv__Long_Long fixes. Modified: pypy/dist/pypy/objspace/std/longobject.py ============================================================================== --- pypy/dist/pypy/objspace/std/longobject.py (original) +++ pypy/dist/pypy/objspace/std/longobject.py Sun May 1 22:19:57 2005 @@ -256,7 +256,11 @@ if not y: raise OperationError(space.w_ZeroDivisionError, space.wrap("long division")) - z = operator.truediv(x, y) + try: + z = operator.truediv(x, y) + except OverflowError: + raise OperationError(space.w_OverflowError, + space.wrap("long/long too large for a float")) return space.newfloat(float(z)) def floordiv__Long_Long(space, w_long1, w_long2): #YYYYYY From pedronis at codespeak.net Sun May 1 22:22:12 2005 From: pedronis at codespeak.net (pedronis at codespeak.net) Date: Sun, 1 May 2005 22:22:12 +0200 (CEST) Subject: [pypy-svn] r11731 - in pypy/dist/pypy: interpreter objspace/std objspace/std/test Message-ID: <20050501202212.5DC9327C23@code1.codespeak.net> Author: pedronis Date: Sun May 1 22:22:11 2005 New Revision: 11731 Modified: pypy/dist/pypy/interpreter/baseobjspace.py pypy/dist/pypy/interpreter/function.py pypy/dist/pypy/objspace/std/test/test_instmethobject.py pypy/dist/pypy/objspace/std/typeobject.py Log: - added W_Root.getname(space) to uniformely access the name(__name__) of objects - unbound method error message more complete and better approximating CPython's one Modified: pypy/dist/pypy/interpreter/baseobjspace.py ============================================================================== --- pypy/dist/pypy/interpreter/baseobjspace.py (original) +++ pypy/dist/pypy/interpreter/baseobjspace.py Sun May 1 22:22:11 2005 @@ -23,11 +23,19 @@ if not e.match(space, space.w_KeyError): raise return None - def getclass(self, space): return space.gettypeobject(self.typedef) + def getname(self, space, default): + try: + return space.str_w(space.getattr(self, space.wrap('__name__'))) + except OperationError, e: + if e.match(space, space.w_TypeError) or e.match(space, space.w_AttributeError): + return default + raise + + class BaseWrappable(W_Root): """A subclass of BaseWrappable is an internal, interpreter-level class that can nevertheless be exposed at application-level by space.wrap().""" @@ -286,7 +294,6 @@ def abstract_getclass(self, w_obj): return self.getattr(w_obj, self.wrap('__class__')) - def eval(self, expression, w_globals, w_locals): "NOT_RPYTHON: For internal debugging." import types Modified: pypy/dist/pypy/interpreter/function.py ============================================================================== --- pypy/dist/pypy/interpreter/function.py (original) +++ pypy/dist/pypy/interpreter/function.py Sun May 1 22:22:11 2005 @@ -121,6 +121,13 @@ w_res = space.w_None return w_res +def _getclass(space, w_obj): + try: + return space.abstract_getclass(w_obj) + except OperationError, e: + if e.match(space, space.w_AttributeError): + return space.type(w_obj) + raise class Method(Wrappable): """A method is a function bound to a specific instance or class.""" @@ -146,21 +153,33 @@ return "%s method %s" % (pre, self.w_function.name) def call_args(self, args): + space = self.space if self.w_instance is not None: # bound method args = args.prepend(self.w_instance) else: # unbound method w_firstarg = args.firstarg() - if w_firstarg is not None and self.space.is_true( - self.space.abstract_isinstance(w_firstarg, self.w_class)): + if w_firstarg is not None and space.is_true( + space.abstract_isinstance(w_firstarg, self.w_class)): pass # ok else: - msg = ("unbound method must be called with " - "instance as first argument") # XXX fix error msg - raise OperationError(self.space.w_TypeError, - self.space.wrap(msg)) - return self.space.call_args(self.w_function, args) + myname = self.getname(space,"") + clsdescr = self.w_class.getname(space,"") + if clsdescr: + clsdescr+=" " + if w_firstarg is None: + instdescr = "nothing" + else: + instname = _getclass(space, w_firstarg).getname(space,"") + if instname: + instname += " " + instdescr = "%sinstance" %instname + msg = ("unbound method %s() must be called with %s" + "instance as first argument (got %s instead)") % (myname, clsdescr, instdescr) + raise OperationError(space.w_TypeError, + space.wrap(msg)) + return space.call_args(self.w_function, args) def descr_method_get(self, w_obj, w_cls=None): space = self.space Modified: pypy/dist/pypy/objspace/std/test/test_instmethobject.py ============================================================================== --- pypy/dist/pypy/objspace/std/test/test_instmethobject.py (original) +++ pypy/dist/pypy/objspace/std/test/test_instmethobject.py Sun May 1 22:22:11 2005 @@ -17,6 +17,14 @@ raises(TypeError, unboundMethod, 333) raises(TypeError, unboundMethod, [1,2,3], 333) + def test_err_format(self): + class C(object): + def m(self): pass + try: + C.m(1) + except TypeError, e: + assert str(e) == 'unbound method m() must be called with C instance as first argument (got int instance instead)' + def test_getBound(self): def f(l,x): return l[x+1] bound = f.__get__('abcdef') Modified: pypy/dist/pypy/objspace/std/typeobject.py ============================================================================== --- pypy/dist/pypy/objspace/std/typeobject.py (original) +++ pypy/dist/pypy/objspace/std/typeobject.py Sun May 1 22:22:11 2005 @@ -358,7 +358,7 @@ if candidate in orderlists[-1][1:]: # explicit error message for this specific case raise OperationError(space.w_TypeError, - space.wrap("duplicate base class " + _getname(space, candidate))) + space.wrap("duplicate base class " + candidate.getname(space,"?"))) while candidate not in cycle: cycle.append(candidate) nextblockinglist = mro_blockinglist(candidate, orderlists) @@ -366,7 +366,7 @@ del cycle[:cycle.index(candidate)] cycle.append(candidate) cycle.reverse() - names = [_getname(space, cls) for cls in cycle] + names = [cls.getname(space, "?") for cls in cycle] raise OperationError(space.w_TypeError, space.wrap("cycle among base classes: " + ' < '.join(names))) From arigo at codespeak.net Sun May 1 22:22:27 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Sun, 1 May 2005 22:22:27 +0200 (CEST) Subject: [pypy-svn] r11732 - pypy/testresult/arigo@tismerysoft.de Message-ID: <20050501202227.CE7E927C26@code1.codespeak.net> Author: arigo Date: Sun May 1 22:22:27 2005 New Revision: 11732 Modified: pypy/testresult/arigo at tismerysoft.de/test_long_future.txt Log: test_long_future passes. Modified: pypy/testresult/arigo at tismerysoft.de/test_long_future.txt ============================================================================== --- pypy/testresult/arigo at tismerysoft.de/test_long_future.txt (original) +++ pypy/testresult/arigo at tismerysoft.de/test_long_future.txt Sun May 1 22:22:27 2005 @@ -6,8 +6,9 @@ cpu model: AMD Athlon(tm) XP 3000+ cpu mhz: 2166.513 oldstyle: no -pypy-revision: 11706 -startdate: Sun May 1 22:21:26 2005 +uselibfile: no +pypy-revision: 11730 +startdate: Mon May 2 00:28:21 2005 timeout: 484.0 seconds ============================================================ @@ -16,15 +17,7 @@ faking faking faking -Traceback (application-level): - File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_long_future.py", line 55 in ? -test_true_division() - File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_long_future.py", line 19 in test_true_division - verify(1 / mhuge == 0.0) - File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_support.py", line 180 in verify - raise TestFailed(reason) -TestFailed: test failed long true division ========================== closed ========================== -execution time: 5.31956982613 seconds -exit status: 1 +execution time: 19.3217840195 seconds +exit status: 0 From arigo at codespeak.net Sun May 1 22:26:17 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Sun, 1 May 2005 22:26:17 +0200 (CEST) Subject: [pypy-svn] r11733 - pypy/dist/lib-python/modified-2.3.4/test Message-ID: <20050501202617.0FD4527C23@code1.codespeak.net> Author: arigo Date: Sun May 1 22:26:16 2005 New Revision: 11733 Added: pypy/dist/lib-python/modified-2.3.4/test/test_complex.py - copied, changed from r11726, pypy/dist/lib-python/2.3.4/test/test_complex.py Log: A version of test_complex with a much faster test_div() Copied: pypy/dist/lib-python/modified-2.3.4/test/test_complex.py (from r11726, pypy/dist/lib-python/2.3.4/test/test_complex.py) ============================================================================== --- pypy/dist/lib-python/2.3.4/test/test_complex.py (original) +++ pypy/dist/lib-python/modified-2.3.4/test/test_complex.py Sun May 1 22:26:16 2005 @@ -68,7 +68,7 @@ self.assertClose(q, x) def test_div(self): - simple_real = [float(i) for i in xrange(-5, 6)] + simple_real = [-2.0, 0.0, 1.0, 5.0] simple_complex = [complex(x, y) for x in simple_real for y in simple_real] for x in simple_complex: for y in simple_complex: From pedronis at codespeak.net Sun May 1 22:35:25 2005 From: pedronis at codespeak.net (pedronis at codespeak.net) Date: Sun, 1 May 2005 22:35:25 +0200 (CEST) Subject: [pypy-svn] r11734 - pypy/dist/lib-python/modified-2.3.4/test Message-ID: <20050501203525.69C5327C23@code1.codespeak.net> Author: pedronis Date: Sun May 1 22:35:25 2005 New Revision: 11734 Modified: pypy/dist/lib-python/modified-2.3.4/test/test_descrtut.py Log: commenting out a test that track behaviors that changed in more recent vers of Python Modified: pypy/dist/lib-python/modified-2.3.4/test/test_descrtut.py ============================================================================== --- pypy/dist/lib-python/modified-2.3.4/test/test_descrtut.py (original) +++ pypy/dist/lib-python/modified-2.3.4/test/test_descrtut.py Sun May 1 22:35:25 2005 @@ -78,15 +78,16 @@ 3 >>> -However, our __getitem__() method is not used for variable access by the -interpreter: - - >>> exec "print foo" in a - Traceback (most recent call last): - File "", line 1, in ? - File "", line 1, in ? - NameError: name 'foo' is not defined - >>> +# PyPy behaves differenlty, as more recent Python versions +#However, our __getitem__() method is not used for variable access by the +#interpreter: +# +# >>> exec "print foo" in a +# Traceback (most recent call last): +# File "", line 1, in ? +# File "", line 1, in ? +# NameError: name 'foo' is not defined +# >>> Now I'll show that defaultdict instances have dynamic instance variables, just like classic classes: From arigo at codespeak.net Sun May 1 22:40:32 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Sun, 1 May 2005 22:40:32 +0200 (CEST) Subject: [pypy-svn] r11735 - pypy/dist/pypy/lib/test2 Message-ID: <20050501204032.B619A27C23@code1.codespeak.net> Author: arigo Date: Sun May 1 22:40:32 2005 New Revision: 11735 Added: pypy/dist/pypy/lib/test2/test_md5_extra.py - copied, changed from r8358, pypy/trunk/src/pypy/appspace/test/test_md5.py pypy/dist/pypy/lib/test2/test_sha_extra.py - copied, changed from r8358, pypy/trunk/src/pypy/appspace/test/test_sha.py Log: Reintroduced these two lib tests. Copied: pypy/dist/pypy/lib/test2/test_md5_extra.py (from r8358, pypy/trunk/src/pypy/appspace/test/test_md5.py) ============================================================================== --- pypy/trunk/src/pypy/appspace/test/test_md5.py (original) +++ pypy/dist/pypy/lib/test2/test_md5_extra.py Sun May 1 22:40:32 2005 @@ -4,10 +4,9 @@ 160 sec. per MB of data on a 233 MHz Intel Pentium CPU. """ -import autopath -import string, unittest +import support import md5 # CPython's implementation in C. -from pypy.appspace import md5 as pymd5 # The pure Python implementation. +pymd5 = support.libmodule("md5") # The pure Python implementation. # Helpers... @@ -18,7 +17,7 @@ d = map(None, str) d = map(ord, d) d = map(lambda x:"%02x" % x, d) - return string.join(d, " ") + return ' '.join(d) def format(str): @@ -70,7 +69,7 @@ return d1, d2 -class MD5CompareTestCase(unittest.TestCase): +class TestMD5Compare: "Compare pure Python MD5 against Python's std. lib. version." def test1(self): @@ -95,14 +94,13 @@ for i in xrange(len(cases)): res = compareImp(cases[i][0]) - try: - assert res == None - except AssertionError, details: + if res is not None: d1, d2 = res message, expectedResult = cases[i][0], None if len(cases[i]) == 2: expectedResult = cases[i][1] printDiff(message, d1, d2, expectedResult) + assert res is None def test2(self): @@ -133,12 +131,11 @@ for i in xrange(len(cases)): res = compareImp(cases[i][0]) - try: - assert res == None - except AssertionError, details: + if res is not None: d1, d2 = res message = cases[i][0] printDiff(message, d1, d2) + assert res is None def test3(self): @@ -152,12 +149,11 @@ for i in xrange(len(cases)): res = compareImp(cases[i][0]) - try: - assert res == None - except AssertionError, details: + if res is not None: d1, d2 = res message = cases[i][0] printDiff(message, d1, d2) + assert res is None def test4(self): @@ -167,11 +163,10 @@ while i < 2**5: message = i * 'a' res = compareImp(message) - try: - assert res == None - except AssertionError, details: + if res is not None: d1, d2 = res printDiff(message, d1, d2) + assert res is None i = i + 1 @@ -223,19 +218,3 @@ d2 = m2c.hexdigest() assert d1 == d2 - - -def makeSuite(): - suite = unittest.TestSuite() - - suite.addTest(MD5CompareTestCase('test1')) - suite.addTest(MD5CompareTestCase('test2')) - suite.addTest(MD5CompareTestCase('test3')) - suite.addTest(MD5CompareTestCase('test4')) - suite.addTest(MD5CompareTestCase('test5')) - - return suite - - -if __name__ == "__main__": - unittest.TextTestRunner().run(makeSuite()) Copied: pypy/dist/pypy/lib/test2/test_sha_extra.py (from r8358, pypy/trunk/src/pypy/appspace/test/test_sha.py) ============================================================================== --- pypy/trunk/src/pypy/appspace/test/test_sha.py (original) +++ pypy/dist/pypy/lib/test2/test_sha_extra.py Sun May 1 22:40:32 2005 @@ -4,8 +4,8 @@ # Publication 180-1, Secure Hash Standard, 1995 April 17 # http://www.itl.nist.gov/div897/pubs/fip180-1.htm -import autopath -from pypy.appspace import sha +import support +sha = support.libmodule("sha") class TestSHA: def check(self, data, digest): From arigo at codespeak.net Sun May 1 22:51:38 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Sun, 1 May 2005 22:51:38 +0200 (CEST) Subject: [pypy-svn] r11736 - pypy/dist/pypy/lib/test2 Message-ID: <20050501205138.D53BD27C23@code1.codespeak.net> Author: arigo Date: Sun May 1 22:51:38 2005 New Revision: 11736 Added: pypy/dist/pypy/lib/test2/test_file_extra.py - copied, changed from r11732, pypy/dist/pypy/lib/test2/FIXME_test_file_extra.py Removed: pypy/dist/pypy/lib/test2/FIXME_test_file_extra.py Modified: pypy/dist/pypy/lib/test2/FIXME_test_sio.py pypy/dist/pypy/lib/test2/support.py Log: Reintroduced test_file_extra. Fixed support.py. Started to fix test_sio.py, but lots of more work is needed there... Deleted: /pypy/dist/pypy/lib/test2/FIXME_test_file_extra.py ============================================================================== --- /pypy/dist/pypy/lib/test2/FIXME_test_file_extra.py Sun May 1 22:51:38 2005 +++ (empty file) @@ -1,193 +0,0 @@ -import os -import autopath -# from pypy.appspace import _file -from pypy.tool.udir import udir -import py -import unittest - -class TestFile: - def setup_method(self, method): - filename = os.path.join(autopath.this_dir, 'test_file.py') - self.fd = file(filename, 'r') - - def teardown_method(self, method): - self.fd.close() - - def test_case_1(self): - assert self.fd.tell() == 0 - - def test_case_readonly(self): - fn = str(udir.join('temptestfile')) - f=file(fn, 'w') - assert f.name == fn - assert f.mode == 'w' - assert f.closed == False - assert f.encoding == None # Fix when we find out what this is - py.test.raises(TypeError, setattr, f, 'name', 42) - - - def test_from_cpython(self): - - from test.test_support import verify, TESTFN, TestFailed - from UserList import UserList - - # verify expected attributes exist - f = file(TESTFN, 'w') - softspace = f.softspace - f.name # merely shouldn't blow up - f.mode # ditto - f.closed # ditto - - # verify softspace is writable - f.softspace = softspace # merely shouldn't blow up - - # verify the others aren't - for attr in 'name', 'mode', 'closed': - try: - setattr(f, attr, 'oops') - except TypeError: - pass - else: - raise TestFailed('expected TypeError setting file attr %r' % attr) - f.close() - - # verify writelines with instance sequence - l = UserList(['1', '2']) - f = open(TESTFN, 'wb') - f.writelines(l) - f.close() - f = open(TESTFN, 'rb') - buf = f.read() - f.close() - verify(buf == '12') - - # verify writelines with integers - f = open(TESTFN, 'wb') - try: - f.writelines([1, 2, 3]) - except TypeError: - pass - else: - print "writelines accepted sequence of integers" - f.close() - - # verify writelines with integers in UserList - f = open(TESTFN, 'wb') - l = UserList([1,2,3]) - try: - f.writelines(l) - except TypeError: - pass - else: - print "writelines accepted sequence of integers" - f.close() - - # verify writelines with non-string object - class NonString: pass - - f = open(TESTFN, 'wb') - try: - f.writelines([NonString(), NonString()]) - except TypeError: - pass - else: - print "writelines accepted sequence of non-string objects" - f.close() - - # verify that we get a sensible error message for bad mode argument - bad_mode = "qwerty" - try: - open(TESTFN, bad_mode) - except IOError, msg: - pass # We have problems with Exceptions - if msg[0] != 0: - s = str(msg) - if s.find(TESTFN) != -1 or s.find(bad_mode) == -1: - print "bad error message for invalid mode: %s" % s - # if msg[0] == 0, we're probably on Windows where there may be - # no obvious way to discover why open() failed. - else: - print "no error for invalid mode: %s" % bad_mode - - f = open(TESTFN) - if f.name != TESTFN: - raise TestFailed, 'file.name should be "%s"' % TESTFN - - if f.isatty(): - raise TestFailed, 'file.isatty() should be false' - - if f.closed: - raise TestFailed, 'file.closed should be false' - - - f.close() - if not f.closed: - raise TestFailed, 'file.closed should be true' - - # make sure that explicitly setting the buffer size doesn't cause - # misbehaviour especially with repeated close() calls - for s in (-1, 0, 1, 512): - try: - f = open(TESTFN, 'w', s) - f.write(str(s)) - f.close() - f.close() - f = open(TESTFN, 'r', s) - d = int(f.read()) - f.close() - f.close() - except IOError, msg: - raise TestFailed, 'error setting buffer size %d: %s' % (s, str(msg)) - if d != s: - raise TestFailed, 'readback failure using buffer size %d' - - methods = ['fileno', 'flush', 'isatty', 'next', 'read', 'readline', - 'readlines', 'seek', 'tell', 'truncate', 'write', - 'xreadlines', '__iter__'] - - for methodname in methods: - method = getattr(f, methodname) - try: - method() - except ValueError: - pass - else: - raise TestFailed, 'file.%s() on a closed file should raise a ValueError' % methodname - - try: - f.writelines([]) - except ValueError: - pass - else: - raise TestFailed, 'file.writelines([]) on a closed file should raise a ValueError' - - os.unlink(TESTFN) - - def bug801631(): - # SF bug - # "file.truncate fault on windows" - f = file(TESTFN, 'wb') - f.write('12345678901') # 11 bytes - f.close() - - f = file(TESTFN,'rb+') - data = f.read(5) - if data != '12345': - raise TestFailed("Read on file opened for update failed %r" % data) - if f.tell() != 5: - raise TestFailed("File pos after read wrong %d" % f.tell()) - - f.truncate() - if f.tell() != 5: - raise TestFailed("File pos after ftruncate wrong %d" % f.tell()) - - f.close() - size = os.path.getsize(TESTFN) - if size != 5: - raise TestFailed("File size after ftruncate wrong %d" % size) - - try: - bug801631() - finally: - os.unlink(TESTFN) - Modified: pypy/dist/pypy/lib/test2/FIXME_test_sio.py ============================================================================== --- pypy/dist/pypy/lib/test2/FIXME_test_sio.py (original) +++ pypy/dist/pypy/lib/test2/FIXME_test_sio.py Sun May 1 22:51:38 2005 @@ -1,10 +1,14 @@ """Unit tests for sio (new standard I/O).""" +import support import os import time from pypy.tool.udir import udir -class TestSource(object): +sio = support.libmodule("_sio") + + +class TSource(object): def __init__(self, packets): for x in packets: @@ -46,7 +50,7 @@ def close(self): pass -class TestReader(object): +class TReader(object): def __init__(self, packets): for x in packets: @@ -90,7 +94,8 @@ def flush(self): pass -class TestWriter(object): + +class TWriter(object): def __init__(self, data=''): self.buf = data @@ -135,7 +140,7 @@ def flush(self): pass -class TestReaderWriter(TestWriter): +class TReaderWriter(TWriter): def read(self, n=-1): if n < 1: @@ -154,7 +159,7 @@ lines = ["ab\n", "def\n", "xy\n", "pq\n", "uvwx"] def makeStream(self, tell=False, seek=False, bufsize=None): - base = TestSource(self.packets) + base = TSource(self.packets) if not tell: base.tell = None if not seek: @@ -356,7 +361,7 @@ class TestBufferingOutputStream: def test_write(self): - base = TestWriter() + base = TWriter() filter = sio.BufferingOutputStream(base, 4) filter.write("123") assert base.buf == "" @@ -372,7 +377,7 @@ assert base.buf == "123456789ABCDEF0123" def test_write_seek(self): - base = TestWriter() + base = TWriter() filter = sio.BufferingOutputStream(base, 4) filter.write("x"*6) filter.seek(3) @@ -382,7 +387,7 @@ def test_write_seek_beyond_end(self): "Linux behaviour. May be different on other platforms." - base = TestWriter() + base = TWriter() filter = sio.BufferingOutputStream(base, 4) filter.seek(3) filter.write("y"*2) @@ -391,7 +396,7 @@ def test_truncate(self): "Linux behaviour. May be different on other platforms." - base = TestWriter() + base = TWriter() filter = sio.BufferingOutputStream(base, 4) filter.write('x') filter.truncate(4) @@ -401,7 +406,7 @@ def test_truncate2(self): "Linux behaviour. May be different on other platforms." - base = TestWriter() + base = TWriter() filter = sio.BufferingOutputStream(base, 4) filter.write('12345678') filter.truncate(4) @@ -412,7 +417,7 @@ class TestLineBufferingOutputStreamTests: def test_write(self): - base = TestWriter() + base = TWriter() filter = sio.LineBufferingOutputStream(base) filter.bufsize = 4 # More handy for testing than the default filter.write("123") @@ -429,7 +434,7 @@ assert base.buf == "123456789ABCDEF\n0123" def xtest_write_seek(self): - base = TestWriter() + base = TWriter() filter = sio.BufferingOutputStream(base, 4) filter.write("x"*6) filter.seek(3) @@ -440,7 +445,7 @@ class TestBufferingInputOutputStreamTests: def test_write(self): - base = TestReaderWriter() + base = TReaderWriter() filter = sio.BufferingInputOutputStream(base, 4) filter.write("123456789") assert base.buf == "12345678" @@ -457,7 +462,7 @@ def test_write_seek_beyond_end(self): "Linux behaviour. May be different on other platforms." - base = TestReaderWriter() + base = TReaderWriter() filter = sio.BufferingInputOutputStream(base, 4) filter.seek(3) filter.write("y"*2) @@ -469,7 +474,7 @@ def test_filter(self): packets = ["abc\ndef\rghi\r\nxyz\r", "123\r", "\n456"] expected = ["abc\ndef\nghi\nxyz\n", "123\n", "456"] - crlf = sio.CRLFFilter(TestSource(packets)) + crlf = sio.CRLFFilter(TSource(packets)) blocks = [] while 1: block = crlf.read(100) @@ -562,13 +567,13 @@ ] def test_read(self): - base = TestReader(self.packets) + base = TReader(self.packets) filter = sio.TextInputFilter(base) for data, pos in self.expected: assert filter.read(100) == data def test_read_tell(self): - base = TestReader(self.packets) + base = TReader(self.packets) filter = sio.TextInputFilter(base) for data, pos in self.expected_with_tell: assert filter.read(100) == data @@ -576,7 +581,7 @@ assert filter.tell() == pos # Repeat the tell() ! def test_seek(self): - base = TestReader(self.packets) + base = TReader(self.packets) filter = sio.TextInputFilter(base) sofar = "" pairs = [] @@ -605,7 +610,7 @@ def test_newlines_attribute(self): for packets, expected in self.expected_newlines: - base = TestReader(packets) + base = TReader(packets) filter = sio.TextInputFilter(base) for e in expected: filter.read(100) @@ -614,7 +619,7 @@ class TestTextOutputFilter: def test_write_nl(self): - base = TestWriter() + base = TWriter() filter = sio.TextOutputFilter(base, linesep="\n") filter.write("abc") filter.write("def\npqr\nuvw") @@ -622,7 +627,7 @@ assert base.buf == "abcdef\npqr\nuvw\n123\n" def test_write_cr(self): - base = TestWriter() + base = TWriter() filter = sio.TextOutputFilter(base, linesep="\r") filter.write("abc") filter.write("def\npqr\nuvw") @@ -630,7 +635,7 @@ assert base.buf == "abcdef\rpqr\ruvw\r123\r" def test_write_crnl(self): - base = TestWriter() + base = TWriter() filter = sio.TextOutputFilter(base, linesep="\r\n") filter.write("abc") filter.write("def\npqr\nuvw") @@ -638,7 +643,7 @@ assert base.buf == "abcdef\r\npqr\r\nuvw\r\n123\r\n" def test_write_tell_nl(self): - base = TestWriter() + base = TWriter() filter = sio.TextOutputFilter(base, linesep="\n") filter.write("xxx") assert filter.tell() == 3 @@ -646,7 +651,7 @@ assert filter.tell() == 8 def test_write_tell_cr(self): - base = TestWriter() + base = TWriter() filter = sio.TextOutputFilter(base, linesep="\r") filter.write("xxx") assert filter.tell() == 3 @@ -654,7 +659,7 @@ assert filter.tell() == 8 def test_write_tell_crnl(self): - base = TestWriter() + base = TWriter() filter = sio.TextOutputFilter(base, linesep="\r\n") filter.write("xxx") assert filter.tell() == 3 @@ -662,7 +667,7 @@ assert filter.tell() == 10 def test_write_seek(self): - base = TestWriter() + base = TWriter() filter = sio.TextOutputFilter(base, linesep="\n") filter.write("x"*100) filter.seek(50) @@ -674,7 +679,7 @@ def test_read(self): chars = u"abc\xff\u1234\u4321\x80xyz" data = chars.encode("utf8") - base = TestReader([data]) + base = TReader([data]) filter = sio.DecodingInputFilter(base) bufs = [] for n in range(1, 11): @@ -692,7 +697,7 @@ chars = u"abc\xff\u1234\u4321\x80xyz" data = chars.encode("utf8") for n in range(1, 11): - base = TestWriter() + base = TWriter() filter = sio.EncodingOutputFilter(base) pos = 0 while 1: Modified: pypy/dist/pypy/lib/test2/support.py ============================================================================== --- pypy/dist/pypy/lib/test2/support.py (original) +++ pypy/dist/pypy/lib/test2/support.py Sun May 1 22:51:38 2005 @@ -13,9 +13,9 @@ # after the standard library! sys.path[:] = [p for p in sys.path if os.path.normpath(os.path.abspath(p)) != lib_dir] - sys.path.append(lib_dir) cleanup_path() +sys.path.append(lib_dir) def libmodule(modname): @@ -25,9 +25,14 @@ # forces the real CPython module to be imported first, to avoid strange # interactions later cleanup_path() - cpython_mod = __import__(modname) - if hasattr(cpython_mod, '__file__'): - assert os.path.dirname(cpython_mod.__file__) != lib_dir + try: + cpython_mod = __import__(modname) + if hasattr(cpython_mod, '__file__'): + assert os.path.dirname(cpython_mod.__file__) != lib_dir + except ImportError: + pass + cleanup_path() + sys.path.append(lib_dir) filename = os.path.join(lib_dir, modname + '.py') mod = new.module(modname) mod.__file__ = filename Copied: pypy/dist/pypy/lib/test2/test_file_extra.py (from r11732, pypy/dist/pypy/lib/test2/FIXME_test_file_extra.py) ============================================================================== --- pypy/dist/pypy/lib/test2/FIXME_test_file_extra.py (original) +++ pypy/dist/pypy/lib/test2/test_file_extra.py Sun May 1 22:51:38 2005 @@ -1,14 +1,12 @@ import os -import autopath -# from pypy.appspace import _file +import support +_file = support.libmodule("_file") from pypy.tool.udir import udir import py -import unittest class TestFile: def setup_method(self, method): - filename = os.path.join(autopath.this_dir, 'test_file.py') - self.fd = file(filename, 'r') + self.fd = _file.file(__file__, 'r') def teardown_method(self, method): self.fd.close() @@ -18,176 +16,14 @@ def test_case_readonly(self): fn = str(udir.join('temptestfile')) - f=file(fn, 'w') + f=_file.file(fn, 'w') assert f.name == fn assert f.mode == 'w' assert f.closed == False assert f.encoding == None # Fix when we find out what this is - py.test.raises(TypeError, setattr, f, 'name', 42) + py.test.raises((TypeError, AttributeError), setattr, f, 'name', 42) - - def test_from_cpython(self): - - from test.test_support import verify, TESTFN, TestFailed - from UserList import UserList - - # verify expected attributes exist - f = file(TESTFN, 'w') - softspace = f.softspace - f.name # merely shouldn't blow up - f.mode # ditto - f.closed # ditto - - # verify softspace is writable - f.softspace = softspace # merely shouldn't blow up - - # verify the others aren't - for attr in 'name', 'mode', 'closed': - try: - setattr(f, attr, 'oops') - except TypeError: - pass - else: - raise TestFailed('expected TypeError setting file attr %r' % attr) - f.close() - - # verify writelines with instance sequence - l = UserList(['1', '2']) - f = open(TESTFN, 'wb') - f.writelines(l) - f.close() - f = open(TESTFN, 'rb') - buf = f.read() - f.close() - verify(buf == '12') - - # verify writelines with integers - f = open(TESTFN, 'wb') - try: - f.writelines([1, 2, 3]) - except TypeError: - pass - else: - print "writelines accepted sequence of integers" - f.close() - - # verify writelines with integers in UserList - f = open(TESTFN, 'wb') - l = UserList([1,2,3]) - try: - f.writelines(l) - except TypeError: - pass - else: - print "writelines accepted sequence of integers" - f.close() - - # verify writelines with non-string object - class NonString: pass - - f = open(TESTFN, 'wb') - try: - f.writelines([NonString(), NonString()]) - except TypeError: - pass - else: - print "writelines accepted sequence of non-string objects" - f.close() - - # verify that we get a sensible error message for bad mode argument - bad_mode = "qwerty" - try: - open(TESTFN, bad_mode) - except IOError, msg: - pass # We have problems with Exceptions - if msg[0] != 0: - s = str(msg) - if s.find(TESTFN) != -1 or s.find(bad_mode) == -1: - print "bad error message for invalid mode: %s" % s - # if msg[0] == 0, we're probably on Windows where there may be - # no obvious way to discover why open() failed. - else: - print "no error for invalid mode: %s" % bad_mode - - f = open(TESTFN) - if f.name != TESTFN: - raise TestFailed, 'file.name should be "%s"' % TESTFN - - if f.isatty(): - raise TestFailed, 'file.isatty() should be false' - - if f.closed: - raise TestFailed, 'file.closed should be false' - - - f.close() - if not f.closed: - raise TestFailed, 'file.closed should be true' - - # make sure that explicitly setting the buffer size doesn't cause - # misbehaviour especially with repeated close() calls - for s in (-1, 0, 1, 512): - try: - f = open(TESTFN, 'w', s) - f.write(str(s)) - f.close() - f.close() - f = open(TESTFN, 'r', s) - d = int(f.read()) - f.close() - f.close() - except IOError, msg: - raise TestFailed, 'error setting buffer size %d: %s' % (s, str(msg)) - if d != s: - raise TestFailed, 'readback failure using buffer size %d' - - methods = ['fileno', 'flush', 'isatty', 'next', 'read', 'readline', - 'readlines', 'seek', 'tell', 'truncate', 'write', - 'xreadlines', '__iter__'] - - for methodname in methods: - method = getattr(f, methodname) - try: - method() - except ValueError: - pass - else: - raise TestFailed, 'file.%s() on a closed file should raise a ValueError' % methodname - - try: - f.writelines([]) - except ValueError: - pass - else: - raise TestFailed, 'file.writelines([]) on a closed file should raise a ValueError' - - os.unlink(TESTFN) - - def bug801631(): - # SF bug - # "file.truncate fault on windows" - f = file(TESTFN, 'wb') - f.write('12345678901') # 11 bytes - f.close() - - f = file(TESTFN,'rb+') - data = f.read(5) - if data != '12345': - raise TestFailed("Read on file opened for update failed %r" % data) - if f.tell() != 5: - raise TestFailed("File pos after read wrong %d" % f.tell()) - - f.truncate() - if f.tell() != 5: - raise TestFailed("File pos after ftruncate wrong %d" % f.tell()) - - f.close() - size = os.path.getsize(TESTFN) - if size != 5: - raise TestFailed("File size after ftruncate wrong %d" % size) - - try: - bug801631() - finally: - os.unlink(TESTFN) - + def test_plain_read(self): + data1 = self.fd.read() + data2 = open(__file__, 'r').read() + assert data1 == data2 From pedronis at codespeak.net Sun May 1 22:55:54 2005 From: pedronis at codespeak.net (pedronis at codespeak.net) Date: Sun, 1 May 2005 22:55:54 +0200 (CEST) Subject: [pypy-svn] r11737 - pypy/testresult/pedronis@ratthing-b246 Message-ID: <20050501205554.0026A27C1F@code1.codespeak.net> Author: pedronis Date: Sun May 1 22:55:54 2005 New Revision: 11737 Added: pypy/testresult/pedronis at ratthing-b246/test_descrtut.txt Log: passes Added: pypy/testresult/pedronis at ratthing-b246/test_descrtut.txt ============================================================================== --- (empty file) +++ pypy/testresult/pedronis at ratthing-b246/test_descrtut.txt Sun May 1 22:55:54 2005 @@ -0,0 +1,27 @@ +testreport-version: 1.0 +command: /usr/bin/python /u/pedronis/PyPy/dist/pypy/tool/alarm.py 441 /u/pedronis/PyPy/dist/pypy/interpreter/py.py --oldstyle /u/pedronis/PyPy/dist/lib-python/modified-2.3.4/test/test_descrtut.py +run by: pedronis at ratthing-b246 +sys.platform: linux2 +sys.version_info: (2, 3, 5, 'final', 0) +cpu model: AMD Athlon(tm) 64 Processor 3800+ +cpu mhz: 2403.737 +oldstyle: yes +uselibfile: no +pypy-revision: 11735 +startdate: Sun May 1 22:46:48 2005 +timeout: 441.0 seconds + +============================================================ +faking +faking +faking +faking +faking +faking +faking +faking +faking +doctest (test.test_descrtut) ... 98 tests with zero failures +========================== closed ========================== +execution time: 333.363782167 seconds +exit status: 0 From arigo at codespeak.net Sun May 1 23:03:48 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Sun, 1 May 2005 23:03:48 +0200 (CEST) Subject: [pypy-svn] r11738 - pypy/dist/lib-python/modified-2.3.4/test Message-ID: <20050501210348.11B9B27C23@code1.codespeak.net> Author: arigo Date: Sun May 1 23:03:47 2005 New Revision: 11738 Modified: pypy/dist/lib-python/modified-2.3.4/test/test_complex.py Log: Yet another reduction of number of tests to allow test_complex not to time out. Modified: pypy/dist/lib-python/modified-2.3.4/test/test_complex.py ============================================================================== --- pypy/dist/lib-python/modified-2.3.4/test/test_complex.py (original) +++ pypy/dist/lib-python/modified-2.3.4/test/test_complex.py Sun May 1 23:03:47 2005 @@ -68,7 +68,7 @@ self.assertClose(q, x) def test_div(self): - simple_real = [-2.0, 0.0, 1.0, 5.0] + simple_real = [-2.0, 0.0, 1.0] simple_complex = [complex(x, y) for x in simple_real for y in simple_real] for x in simple_complex: for y in simple_complex: From arigo at codespeak.net Sun May 1 23:03:59 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Sun, 1 May 2005 23:03:59 +0200 (CEST) Subject: [pypy-svn] r11739 - pypy/testresult/arigo@tismerysoft.de Message-ID: <20050501210359.2578927C26@code1.codespeak.net> Author: arigo Date: Sun May 1 23:03:58 2005 New Revision: 11739 Modified: pypy/testresult/arigo at tismerysoft.de/test_complex.txt Log: test_complex completes, with one failure. Modified: pypy/testresult/arigo at tismerysoft.de/test_complex.txt ============================================================================== --- pypy/testresult/arigo at tismerysoft.de/test_complex.txt (original) +++ pypy/testresult/arigo at tismerysoft.de/test_complex.txt Sun May 1 23:03:58 2005 @@ -1,13 +1,14 @@ testreport-version: 1.0 -command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 575 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/2.3.4/test/test_complex.py +command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 575 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/modified-2.3.4/test/test_complex.py run by: arigo at tismerysoft.de sys.platform: linux2 sys.version_info: (2, 3, 5, 'final', 0) cpu model: AMD Athlon(tm) XP 3000+ cpu mhz: 2166.513 oldstyle: no -pypy-revision: 11706 -startdate: Sun May 1 20:33:32 2005 +uselibfile: no +pypy-revision: 11733 +startdate: Mon May 2 01:01:11 2005 timeout: 576.0 seconds ============================================================ @@ -20,38 +21,53 @@ faking faking faking -==========================timeout========================== Traceback (application-level): - File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_complex.py", line 316 in ? + File "/home/arigo/pypysrc/lib-python/modified-2.3.4/test/test_complex.py", line 316 in ? test_main() - File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_complex.py", line 313 in test_main + File "/home/arigo/pypysrc/lib-python/modified-2.3.4/test/test_complex.py", line 313 in test_main test_support.run_unittest(ComplexTest) File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_support.py", line 262 in run_unittest run_suite(suite, testclass) - File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_support.py", line 234 in run_suite - result = runner.run(suite) - File "/home/arigo/pypysrc/lib-python/2.3.4/unittest.py", line 658 in run - test(result) - File "/home/arigo/pypysrc/lib-python/2.3.4/unittest.py", line 389 in __call__ - test(result) - File "/home/arigo/pypysrc/lib-python/2.3.4/unittest.py", line 389 in __call__ - test(result) - File "/home/arigo/pypysrc/lib-python/2.3.4/unittest.py", line 229 in __call__ - testMethod() - File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_complex.py", line 75 in test_div - self.check_div(x, y) - File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_complex.py", line 57 in check_div - self.assertClose(q, y) - File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_complex.py", line 47 in assertClose - self.assertCloseAbs(x.imag, y.imag, eps) - File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_complex.py", line 42 in assertCloseAbs - self.assert_(abs((x-y)/y) < eps) -KeyboardInterrupt + File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_support.py", line 247 in run_suite + raise TestFailed(err) +TestFailed: Traceback (most recent call last): + File "/home/arigo/pypysrc/lib-python/modified-2.3.4/test/test_complex.py", line 254, in test_constructor + self.assertRaises(ValueError, complex, unicode("1"*500)) + File "/home/arigo/pypysrc/lib-python/2.3.4/unittest.py", line 295, in failUnlessRaises + raise self.failureException, excName +AssertionError: ValueError + test_abs (__main__.ComplexTest) ... ok test_boolcontext (__main__.ComplexTest) ... ok test_coerce (__main__.ComplexTest) ... ok test_conjugate (__main__.ComplexTest) ... ok test_constructor (__main__.ComplexTest) ... FAIL -test_div (__main__.ComplexTest) ... ========================== closed ========================== -execution time: 575.737567902 seconds +test_div (__main__.ComplexTest) ... ok +test_divmod (__main__.ComplexTest) ... ok +test_file (__main__.ComplexTest) ... ok +test_floordiv (__main__.ComplexTest) ... ok +test_hash (__main__.ComplexTest) ... ok +test_mod (__main__.ComplexTest) ... ok +test_neg (__main__.ComplexTest) ... ok +test_pow (__main__.ComplexTest) ... ok +test_repr (__main__.ComplexTest) ... ok +test_richcompare (__main__.ComplexTest) ... ok +test_truediv (__main__.ComplexTest) ... ok + +====================================================================== +FAIL: test_constructor (__main__.ComplexTest) +---------------------------------------------------------------------- +Traceback (most recent call last): + File "/home/arigo/pypysrc/lib-python/modified-2.3.4/test/test_complex.py", line 254, in test_constructor + self.assertRaises(ValueError, complex, unicode("1"*500)) + File "/home/arigo/pypysrc/lib-python/2.3.4/unittest.py", line 295, in failUnlessRaises + raise self.failureException, excName +AssertionError: ValueError + +---------------------------------------------------------------------- +Ran 16 tests in 347.074s + +FAILED (failures=1) +========================== closed ========================== +execution time: 361.224521875 seconds exit status: 1 From pedronis at codespeak.net Sun May 1 23:35:39 2005 From: pedronis at codespeak.net (pedronis at codespeak.net) Date: Sun, 1 May 2005 23:35:39 +0200 (CEST) Subject: [pypy-svn] r11741 - pypy/dist/pypy/objspace/std Message-ID: <20050501213539.F2B5D27C23@code1.codespeak.net> Author: pedronis Date: Sun May 1 23:35:39 2005 New Revision: 11741 Modified: pypy/dist/pypy/objspace/std/typeobject.py Log: don't capture module __name__ as __module__ when constructin builtin types Modified: pypy/dist/pypy/objspace/std/typeobject.py ============================================================================== --- pypy/dist/pypy/objspace/std/typeobject.py (original) +++ pypy/dist/pypy/objspace/std/typeobject.py Sun May 1 23:35:39 2005 @@ -22,22 +22,6 @@ w_self.nslots = 0 w_self.w_bestbase = None - # initialize __module__ in the dict - if '__module__' not in dict_w: - try: - caller = space.getexecutioncontext().framestack.top() - except IndexError: - w_globals = w_locals = space.newdict([]) - else: - w_globals = caller.w_globals - w_str_name = space.wrap('__name__') - try: - w_name = space.getitem(w_globals, w_str_name) - except OperationError: - pass - else: - dict_w['__module__'] = w_name - if overridetypedef is not None: w_self.instancetypedef = overridetypedef w_self.hasdict = overridetypedef.hasdict @@ -46,6 +30,21 @@ w_self.w_bestbase = space.gettypeobject(overridetypedef.base) else: w_self.__flags__ = _HEAPTYPE + # initialize __module__ in the dict + if '__module__' not in dict_w: + try: + caller = space.getexecutioncontext().framestack.top() + except IndexError: + w_globals = w_locals = space.newdict([]) + else: + w_globals = caller.w_globals + w_str_name = space.wrap('__name__') + try: + w_name = space.getitem(w_globals, w_str_name) + except OperationError: + pass + else: + dict_w['__module__'] = w_name # find the most specific typedef instancetypedef = object_typedef for w_base in bases_w: From arigo at codespeak.net Sun May 1 23:51:51 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Sun, 1 May 2005 23:51:51 +0200 (CEST) Subject: [pypy-svn] r11742 - in pypy/dist/pypy/objspace/std: . test Message-ID: <20050501215151.3D58327C26@code1.codespeak.net> Author: arigo Date: Sun May 1 23:51:51 2005 New Revision: 11742 Modified: pypy/dist/pypy/objspace/std/longobject.py pypy/dist/pypy/objspace/std/test/test_longobject.py Log: Argh. A bug in rshift__Long_Long that was difficult to find. Modified: pypy/dist/pypy/objspace/std/longobject.py ============================================================================== --- pypy/dist/pypy/objspace/std/longobject.py (original) +++ pypy/dist/pypy/objspace/std/longobject.py Sun May 1 23:51:51 2005 @@ -15,6 +15,9 @@ SIGN_MASK = r_uint(1) << SIGN_BIT NONSIGN_MASK = ~SIGN_MASK +# XXX some operations below return one of their input arguments +# without checking that it's really of type long (and not a subclass). + class W_LongObject(W_Object): """This is a reimplementation of longs using a list of r_uints.""" #All functions that still rely on the underlying Python's longs are marked @@ -448,7 +451,7 @@ accum = r_uint(0) i = newsize - 1 j = oldsize - 1 - while j >= 0: + while i >= 0: digit = w_long1.digits[j] w_result.digits[i] = (accum | (digit >> remshift)) accum = (digit & LOWER_MASK) << leftshift Modified: pypy/dist/pypy/objspace/std/test/test_longobject.py ============================================================================== --- pypy/dist/pypy/objspace/std/test/test_longobject.py (original) +++ pypy/dist/pypy/objspace/std/test/test_longobject.py Sun May 1 23:51:51 2005 @@ -187,7 +187,7 @@ self.space.raises_w(self.space.w_OverflowError, lobj.rshift__Long_Long, self.space, f1, big) - for y in [0L, 1L, 2304L, 11233L, 3 ** 9]: + for y in [0L, 1L, 32L, 2304L, 11233L, 3 ** 9]: f2 = lobj.W_LongObject(self.space, *lobj.args_from_long(y)) res1 = lobj.lshift__Long_Long(self.space, f1, f2).longval() res2 = lobj.rshift__Long_Long(self.space, f1, f2).longval() From pedronis at codespeak.net Mon May 2 00:00:34 2005 From: pedronis at codespeak.net (pedronis at codespeak.net) Date: Mon, 2 May 2005 00:00:34 +0200 (CEST) Subject: [pypy-svn] r11743 - pypy/testresult/pedronis@ratthing-b246 Message-ID: <20050501220034.717B127C26@code1.codespeak.net> Author: pedronis Date: Mon May 2 00:00:34 2005 New Revision: 11743 Added: pypy/testresult/pedronis at ratthing-b246/test_generators.txt Log: some improvements on test_generators outcome Added: pypy/testresult/pedronis at ratthing-b246/test_generators.txt ============================================================================== --- (empty file) +++ pypy/testresult/pedronis at ratthing-b246/test_generators.txt Mon May 2 00:00:34 2005 @@ -0,0 +1,175 @@ +testreport-version: 1.0 +command: /usr/bin/python /u/pedronis/PyPy/dist/pypy/tool/alarm.py 441 /u/pedronis/PyPy/dist/pypy/interpreter/py.py /u/pedronis/PyPy/dist/lib-python/2.3.4/test/test_generators.py +run by: pedronis at ratthing-b246 +sys.platform: linux2 +sys.version_info: (2, 3, 5, 'final', 0) +cpu model: AMD Athlon(tm) 64 Processor 3800+ +cpu mhz: 2403.737 +oldstyle: no +uselibfile: no +pypy-revision: 11742 +startdate: Sun May 1 23:55:40 2005 +timeout: 441.0 seconds + +============================================================ +faking +faking +faking +faking +faking +faking +faking +faking +faking +***************************************************************** +Failure in example: print i.next.__doc__ +from line #85 of test.test_generators.__test__.email +Expected: x.next() -> the next value, or raise StopIteration +Got: None +***************************************************************** +Failure in example: i.gi_running = 42 +from line #99 of test.test_generators.__test__.email +Expected: TypeError: readonly attribute +Got: TypeError: read-only attribute +***************************************************************** +Failure in example: gen = random.WichmannHill(42) +from line #146 of test.test_generators.__test__.email +Exception raised: +Traceback (most recent call last): + File "/u/pedronis/PyPy/dist/lib-python/2.3.4/doctest.py", line 442, in _run_examples_inner + compileflags, 1) in globs + File "", line 1, in ? +AttributeError: 'module' object has no attribute 'WichmannHill' +***************************************************************** +Failure in example: +while 1: + for s in sets: + print "%s->%s" % (s, s.find()), + print + if len(roots) > 1: + s1 = gen.choice(roots) + roots.remove(s1) + s2 = gen.choice(roots) + s1.union(s2) + print "merged", s1, "into", s2 + else: + break +from line #147 of test.test_generators.__test__.email +Exception raised: +Traceback (most recent call last): + File "/u/pedronis/PyPy/dist/lib-python/2.3.4/doctest.py", line 442, in _run_examples_inner + compileflags, 1) in globs + File "", line 6, in ? +NameError: global name 'gen' is not defined +***************************************************************** +Failure in example: k.next() +from line #52 of test.test_generators.__test__.pep +Expected: ZeroDivisionError: integer division or modulo by zero +Got: ZeroDivisionError: integer division by zero +***************************************************************** +Failure in example: +def f(): + yield +from line #73 of test.test_generators.__test__.syntax +Expected: SyntaxError: invalid syntax +Got: SyntaxError: invalid syntax (, line 2) +***************************************************************** +Failure in example: +def f(): + if 0: + yield +from line #78 of test.test_generators.__test__.syntax +Expected: SyntaxError: invalid syntax +Got: SyntaxError: invalid syntax (, line 3) +***************************************************************** +Failure in example: import weakref +from line #2 of test.test_generators.__test__.weakref +Exception raised: +Traceback (most recent call last): + File "/u/pedronis/PyPy/dist/lib-python/2.3.4/doctest.py", line 442, in _run_examples_inner + compileflags, 1) in globs + File "", line 1, in ? + File "/u/pedronis/PyPy/dist/lib-python/2.3.4/weakref.py", line 14, in ? + from _weakref import \ +ImportError: _weakref +***************************************************************** +Failure in example: wr = weakref.ref(gen) +from line #6 of test.test_generators.__test__.weakref +Exception raised: +Traceback (most recent call last): + File "/u/pedronis/PyPy/dist/lib-python/2.3.4/doctest.py", line 442, in _run_examples_inner + compileflags, 1) in globs + File "", line 1, in ? +NameError: global name 'weakref' is not defined +***************************************************************** +Failure in example: wr() is gen +from line #7 of test.test_generators.__test__.weakref +Exception raised: +Traceback (most recent call last): + File "/u/pedronis/PyPy/dist/lib-python/2.3.4/doctest.py", line 442, in _run_examples_inner + compileflags, 1) in globs + File "", line 1, in ? +NameError: global name 'wr' is not defined +***************************************************************** +Failure in example: p = weakref.proxy(gen) +from line #9 of test.test_generators.__test__.weakref +Exception raised: +Traceback (most recent call last): + File "/u/pedronis/PyPy/dist/lib-python/2.3.4/doctest.py", line 442, in _run_examples_inner + compileflags, 1) in globs + File "", line 1, in ? +NameError: global name 'weakref' is not defined +********************************Traceback (application-level): + File "/u/pedronis/PyPy/dist/lib-python/2.3.4/test/test_generators.py", line 1412 in ? + test_main(1) + File "/u/pedronis/PyPy/dist/lib-python/2.3.4/test/test_generators.py", line 1408 in test_main + test_support.run_doctest(test_generators, verbose) + File "/u/pedronis/PyPy/dist/lib-python/2.3.4/test/test_support.py", line 290 in run_doctest + raise TestFailed("%d of %d doctests failed" % (f, t)) +TestFailed: 15 of 152 doctests failed +********************************* +Failure in example: wr = weakref.ref(gi) +from line #14 of test.test_generators.__test__.weakref +Exception raised: +Traceback (most recent call last): + File "/u/pedronis/PyPy/dist/lib-python/2.3.4/doctest.py", line 442, in _run_examples_inner + compileflags, 1) in globs + File "", line 1, in ? +NameError: global name 'weakref' is not defined +***************************************************************** +Failure in example: wr() is gi +from line #15 of test.test_generators.__test__.weakref +Exception raised: +Traceback (most recent call last): + File "/u/pedronis/PyPy/dist/lib-python/2.3.4/doctest.py", line 442, in _run_examples_inner + compileflags, 1) in globs + File "", line 1, in ? +NameError: global name 'wr' is not defined +***************************************************************** +Failure in example: p = weakref.proxy(gi) +from line #17 of test.test_generators.__test__.weakref +Exception raised: +Traceback (most recent call last): + File "/u/pedronis/PyPy/dist/lib-python/2.3.4/doctest.py", line 442, in _run_examples_inner + compileflags, 1) in globs + File "", line 1, in ? +NameError: global name 'weakref' is not defined +***************************************************************** +Failure in example: list(p) +from line #18 of test.test_generators.__test__.weakref +Exception raised: +Traceback (most recent call last): + File "/u/pedronis/PyPy/dist/lib-python/2.3.4/doctest.py", line 442, in _run_examples_inner + compileflags, 1) in globs + File "", line 1, in ? +NameError: global name 'p' is not defined +***************************************************************** +4 items had failures: + 4 of 31 in test.test_generators.__test__.email + 1 of 20 in test.test_generators.__test__.pep + 2 of 29 in test.test_generators.__test__.syntax + 8 of 10 in test.test_generators.__test__.weakref +***Test Failed*** 15 failures. +========================== closed ========================== +execution time: 145.775120974 seconds +exit status: 1 From arigo at codespeak.net Mon May 2 00:17:45 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Mon, 2 May 2005 00:17:45 +0200 (CEST) Subject: [pypy-svn] r11744 - in pypy/dist/pypy: interpreter interpreter/test translator Message-ID: <20050501221745.BB97727C0F@code1.codespeak.net> Author: arigo Date: Mon May 2 00:17:45 2005 New Revision: 11744 Modified: pypy/dist/pypy/interpreter/pyopcode.py pypy/dist/pypy/interpreter/test/test_exec.py pypy/dist/pypy/translator/geninterplevel.py Log: A hopefully complete 'exec' statement. Modified: pypy/dist/pypy/interpreter/pyopcode.py ============================================================================== --- pypy/dist/pypy/interpreter/pyopcode.py (original) +++ pypy/dist/pypy/interpreter/pyopcode.py Mon May 2 00:17:45 2005 @@ -347,8 +347,10 @@ w_globals = f.valuestack.pop() w_prog = f.valuestack.pop() w_compile_flags = f.space.wrap(f.get_compile_flags()) - w_resulttuple = prepare_exec(f.space, f.space.wrap(f), w_prog, w_globals, w_locals, - w_compile_flags, f.space.wrap(f.builtin)) + w_resulttuple = prepare_exec(f.space, f.space.wrap(f), w_prog, + w_globals, w_locals, + w_compile_flags, f.space.wrap(f.builtin), + f.space.gettypeobject(PyCode.typedef)) w_prog, w_globals, w_locals = f.space.unpacktuple(w_resulttuple, 3) plain = f.space.is_true(f.space.is_(w_locals, f.w_locals)) @@ -821,10 +823,9 @@ continue into_locals[name] = getattr(module, name) - def prepare_exec(f, prog, globals, locals, compile_flags, builtin): + def prepare_exec(f, prog, globals, locals, compile_flags, builtin, codetype): """Manipulate parameters to exec statement to (codeobject, dict, dict). """ - # XXX INCOMPLETE if (globals is None and locals is None and isinstance(prog, tuple) and (len(prog) == 2 or len(prog) == 3)): @@ -838,27 +839,32 @@ locals = f.f_locals if locals is None: locals = globals + if not isinstance(globals, dict): - raise TypeError("exec: arg 2 must be a dictionary or None") - elif not globals.has_key('__builtins__'): + if not (hasattr(globals, '__getitem__') and + hasattr(globals, 'keys')): + raise TypeError("exec: arg 2 must be a dictionary or None") + if '__builtins__' not in globals: globals['__builtins__'] = builtin if not isinstance(locals, dict): - raise TypeError("exec: arg 3 must be a dictionary or None") - # XXX - HACK to check for code object - co = compile('1','','eval') - if isinstance(prog, type(co)): - return (prog, globals, locals) - if not isinstance(prog, str): - ## if not (isinstance(prog, types.StringTypes) or - ## isinstance(prog, types.FileType)): - raise TypeError("exec: arg 1 must be a string, file, " - "or code object") - ## if isinstance(prog, types.FileType): - ## co = compile(prog.read(),prog.name,'exec',comple_flags,1) - ## return (co,globals,locals) - else: # prog is a string - co = compile(prog,'','exec', compile_flags, 1) - return (co, globals, locals) + if not (hasattr(locals, '__getitem__') and + hasattr(locals, 'keys')): + raise TypeError("exec: arg 3 must be a dictionary or None") + + if not isinstance(prog, codetype): + filename = '' + if not isinstance(prog, str): + if isinstance(prog, basestring): + prog = str(prog) + elif isinstance(prog, file): + filename = prog.name + prog = prog.read() + else: + raise TypeError("exec: arg 1 must be a string, file, " + "or code object") + prog = compile(prog, filename, 'exec', compile_flags, 1) + return (prog, globals, locals) + ''', filename=__file__) sys_stdout = app.interphook('sys_stdout') Modified: pypy/dist/pypy/interpreter/test/test_exec.py ============================================================================== --- pypy/dist/pypy/interpreter/test/test_exec.py (original) +++ pypy/dist/pypy/interpreter/test/test_exec.py Mon May 2 00:17:45 2005 @@ -4,6 +4,17 @@ """ import autopath + +def test_file(space): + space.appexec([space.wrap(__file__)], ''' + (filename): + fo = open(filename, 'r') + g = {} + exec fo in g + assert 'test_file' in g + ''') + + class AppTestExecStmt: def test_string(self): @@ -38,15 +49,7 @@ l = {} exec co in g, l assert l['a'] == 3 - -## # Commented out as PyPy give errors using open() -## # ["Not availible in restricted mode"] -## def test_file(self): -## fo = open("test_exec.py", 'r') -## g = {} -## exec fo in g -## self.failUnless(g.has_key('TestExecStmt')) - + def test_implicit(self): a = 4 exec "a = 3" Modified: pypy/dist/pypy/translator/geninterplevel.py ============================================================================== --- pypy/dist/pypy/translator/geninterplevel.py (original) +++ pypy/dist/pypy/translator/geninterplevel.py Mon May 2 00:17:45 2005 @@ -689,6 +689,7 @@ type: 'space.w_type', complex:'space.wrap(types.ComplexType)', unicode:'space.w_unicode', + basestring: (eval_helper, 'basestring', 'basestring'), file: (eval_helper, 'file', 'file'), type(None): (eval_helper, 'NoneType', 'type(None)'), CodeType: (eval_helper, 'code', 'type((lambda:42).func_code)'), From arigo at codespeak.net Mon May 2 00:18:06 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Mon, 2 May 2005 00:18:06 +0200 (CEST) Subject: [pypy-svn] r11745 - pypy/testresult/arigo@tismerysoft.de Message-ID: <20050501221806.4B71927C26@code1.codespeak.net> Author: arigo Date: Mon May 2 00:18:06 2005 New Revision: 11745 Modified: pypy/testresult/arigo at tismerysoft.de/test_hmac.txt Log: Passing test. Good. Modified: pypy/testresult/arigo at tismerysoft.de/test_hmac.txt ============================================================================== --- pypy/testresult/arigo at tismerysoft.de/test_hmac.txt (original) +++ pypy/testresult/arigo at tismerysoft.de/test_hmac.txt Mon May 2 00:18:06 2005 @@ -1,14 +1,15 @@ testreport-version: 1.0 -command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 529 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/2.3.4/test/test_hmac.py +command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 575 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/2.3.4/test/test_hmac.py run by: arigo at tismerysoft.de sys.platform: linux2 sys.version_info: (2, 3, 5, 'final', 0) cpu model: AMD Athlon(tm) XP 3000+ cpu mhz: 2166.513 oldstyle: no -pypy-revision: 11706 -startdate: Sun May 1 21:53:26 2005 -timeout: 529.0 seconds +uselibfile: no +pypy-revision: 11742 +startdate: Mon May 2 02:00:04 2005 +timeout: 576.0 seconds ============================================================ faking @@ -16,25 +17,7 @@ faking faking faking -Traceback (application-level): - File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_hmac.py", line 167 in ? - test_main() - File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_hmac.py", line 163 in test_main - CopyTestCase - File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_support.py", line 262 in run_unittest - run_suite(suite, testclass) - File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_support.py", line 247 in run_suite - raise TestFailed(err) -TestFailed: Traceback (most recent call last): - File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_hmac.py", line 17, in test_md5_vectors - "9294727A3638BB1C13F48EF8158BFC9D") - File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_hmac.py", line 13, in md5test - self.assertEqual(h.hexdigest().upper(), digest.upper()) - File "/home/arigo/pypysrc/lib-python/2.3.4/unittest.py", line 302, in failUnlessEqual - raise self.failureException, \ -AssertionError: '000000000000000000000000E71DFA9D' != '9294727A3638BB1C13F48EF8158BFC9D' - -test_md5_vectors (__main__.TestVectorsTestCase) ... FAIL +test_md5_vectors (__main__.TestVectorsTestCase) ... ok test_sha_vectors (__main__.TestVectorsTestCase) ... ok test_normal (__main__.ConstructorTestCase) ... ok test_withmodule (__main__.ConstructorTestCase) ... ok @@ -45,22 +28,10 @@ test_equality (__main__.CopyTestCase) ... ok test_realcopy (__main__.CopyTestCase) ... ok -====================================================================== -FAIL: test_md5_vectors (__main__.TestVectorsTestCase) ----------------------------------------------------------------------- -Traceback (most recent call last): - File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_hmac.py", line 17, in test_md5_vectors - "9294727A3638BB1C13F48EF8158BFC9D") - File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_hmac.py", line 13, in md5test - self.assertEqual(h.hexdigest().upper(), digest.upper()) - File "/home/arigo/pypysrc/lib-python/2.3.4/unittest.py", line 302, in failUnlessEqual - raise self.failureException, \ -AssertionError: '000000000000000000000000E71DFA9D' != '9294727A3638BB1C13F48EF8158BFC9D' - ---------------------------------------------------------------------- -Ran 10 tests in 150.556s +Ran 10 tests in 217.200s -FAILED (failures=1) +OK ========================== closed ========================== -execution time: 162.953148842 seconds -exit status: 1 +execution time: 231.112616062 seconds +exit status: 0 From arigo at codespeak.net Mon May 2 00:25:42 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Mon, 2 May 2005 00:25:42 +0200 (CEST) Subject: [pypy-svn] r11746 - pypy/dist/pypy/interpreter/test Message-ID: <20050501222542.4FF7A27C26@code1.codespeak.net> Author: arigo Date: Mon May 2 00:25:41 2005 New Revision: 11746 Modified: pypy/dist/pypy/interpreter/test/test_exec.py Log: Bad idea to try to 'exec' ourselves at app-level. Modified: pypy/dist/pypy/interpreter/test/test_exec.py ============================================================================== --- pypy/dist/pypy/interpreter/test/test_exec.py (original) +++ pypy/dist/pypy/interpreter/test/test_exec.py Mon May 2 00:25:41 2005 @@ -3,15 +3,19 @@ New for PyPy - Could be incorporated into CPython regression tests. """ import autopath +from pypy.tool.udir import udir def test_file(space): - space.appexec([space.wrap(__file__)], ''' + fn = udir.join('test_exec_file') + fn.write('abc=1\ncba=2\n') + space.appexec([space.wrap(str(fn))], ''' (filename): fo = open(filename, 'r') g = {} exec fo in g - assert 'test_file' in g + assert 'abc' in g + assert 'cba' in g ''') From arigo at codespeak.net Mon May 2 00:43:34 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Mon, 2 May 2005 00:43:34 +0200 (CEST) Subject: [pypy-svn] r11747 - pypy/dist/pypy/interpreter Message-ID: <20050501224334.8E5B427C26@code1.codespeak.net> Author: arigo Date: Mon May 2 00:43:34 2005 New Revision: 11747 Modified: pypy/dist/pypy/interpreter/pyopcode.py Log: Very obscure. This change is needed to prevent one failure in the flow graph tests in the presence of geninterplevel.py. Modified: pypy/dist/pypy/interpreter/pyopcode.py ============================================================================== --- pypy/dist/pypy/interpreter/pyopcode.py (original) +++ pypy/dist/pypy/interpreter/pyopcode.py Mon May 2 00:43:34 2005 @@ -787,7 +787,15 @@ except AttributeError: pass return softspace +''', filename=__file__) +sys_stdout = app.interphook('sys_stdout') +print_expr = app.interphook('print_expr') +print_item_to = app.interphook('print_item_to') +print_newline_to= app.interphook('print_newline_to') +file_softspace = app.interphook('file_softspace') + +app = gateway.applevel(r''' def find_metaclass(bases, namespace, globals, builtin): if '__metaclass__' in namespace: return namespace['__metaclass__'] @@ -804,7 +812,11 @@ return builtin.__metaclass__ except AttributeError: return type +''', filename=__file__) +find_metaclass = app.interphook('find_metaclass') + +app = gateway.applevel(r''' def import_all_from(module, into_locals): try: all = module.__all__ @@ -822,7 +834,11 @@ if skip_leading_underscores and name[0]=='_': continue into_locals[name] = getattr(module, name) +''', filename=__file__) +import_all_from = app.interphook('import_all_from') + +app = gateway.applevel(r''' def prepare_exec(f, prog, globals, locals, compile_flags, builtin, codetype): """Manipulate parameters to exec statement to (codeobject, dict, dict). """ @@ -864,14 +880,6 @@ "or code object") prog = compile(prog, filename, 'exec', compile_flags, 1) return (prog, globals, locals) - ''', filename=__file__) -sys_stdout = app.interphook('sys_stdout') -print_expr = app.interphook('print_expr') -print_item_to = app.interphook('print_item_to') -print_newline_to= app.interphook('print_newline_to') -file_softspace = app.interphook('file_softspace') -find_metaclass = app.interphook('find_metaclass') -import_all_from = app.interphook('import_all_from') prepare_exec = app.interphook('prepare_exec') From arigo at codespeak.net Mon May 2 00:44:29 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Mon, 2 May 2005 00:44:29 +0200 (CEST) Subject: [pypy-svn] r11748 - pypy/testresult/arigo@tismerysoft.de Message-ID: <20050501224429.A25CF27C26@code1.codespeak.net> Author: arigo Date: Mon May 2 00:44:29 2005 New Revision: 11748 Modified: pypy/testresult/arigo at tismerysoft.de/test_grammar.out pypy/testresult/arigo at tismerysoft.de/test_grammar.txt Log: Good. Yet another passing test. Modified: pypy/testresult/arigo at tismerysoft.de/test_grammar.out ============================================================================== --- pypy/testresult/arigo at tismerysoft.de/test_grammar.out (original) +++ pypy/testresult/arigo at tismerysoft.de/test_grammar.out Mon May 2 00:44:29 2005 @@ -38,3 +38,29 @@ import_stmt global_stmt exec_stmt +assert_stmt +if_stmt +while_stmt +for_stmt +try_stmt +suite +test +comparison +binary mask ops +shift ops +additive ops +multiplicative ops +unary ops +selectors + +atoms +classdef +['Apple', 'Banana', 'Coco nut'] +[3, 6, 9, 12, 15] +[3, 4, 5] +[(1, 'Apple'), (1, 'Banana'), (1, 'Coconut'), (2, 'Apple'), (2, 'Banana'), (2, 'Coconut'), (3, 'Apple'), (3, 'Banana'), (3, 'Coconut'), (4, 'Apple'), (4, 'Banana'), (4, 'Coconut'), (5, 'Apple'), (5, 'Banana'), (5, 'Coconut')] +[(1, 'Banana'), (1, 'Coconut'), (2, 'Banana'), (2, 'Coconut'), (3, 'Banana'), (3, 'Coconut'), (4, 'Banana'), (4, 'Coconut'), (5, 'Banana'), (5, 'Coconut')] +[[1], [1, 1], [1, 2, 4], [1, 3, 9, 27], [1, 4, 16, 64, 256]] +[False, False, False] +[[1, 2], [3, 4], [5, 6]] +[('Boeing', 'Airliner'), ('Boeing', 'Engine'), ('Ford', 'Engine'), ('Macdonalds', 'Cheeseburger')] Modified: pypy/testresult/arigo at tismerysoft.de/test_grammar.txt ============================================================================== --- pypy/testresult/arigo at tismerysoft.de/test_grammar.txt (original) +++ pypy/testresult/arigo at tismerysoft.de/test_grammar.txt Mon May 2 00:44:29 2005 @@ -1,14 +1,15 @@ testreport-version: 1.0 -command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 529 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/2.3.4/test/test_grammar.py +command: /usr/bin/python /home/arigo/pypysrc/pypy/tool/alarm.py 9604 /home/arigo/pypysrc/pypy/interpreter/py.py /home/arigo/pypysrc/lib-python/2.3.4/test/test_grammar.py run by: arigo at tismerysoft.de sys.platform: linux2 sys.version_info: (2, 3, 5, 'final', 0) cpu model: AMD Athlon(tm) XP 3000+ cpu mhz: 2166.513 oldstyle: no -pypy-revision: 11706 -startdate: Sun May 1 21:43:26 2005 -timeout: 529.0 seconds +uselibfile: no +pypy-revision: 11747 +startdate: Mon May 2 02:50:44 2005 +timeout: 9604.0 seconds OUTPUT TEST see output in: /home/arigo/pypysrc/testresult/arigo at tismerysoft.de/test_grammar.out @@ -24,14 +25,9 @@ faking faking faking -Traceback (application-level): - File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_grammar.py", line 453 in ? -f() - File "/home/arigo/pypysrc/lib-python/2.3.4/test/test_grammar.py", line 446 in f - exec r"""if 1: - File "", line 2 in ? -TypeError: exec: arg 1 must be a string, file, or code object -FAILED: test output differs +faking +faking +OK ========================== closed ========================== -execution time: 6.49249720573 seconds -exit status: 1 +execution time: 12.5095300674 seconds +exit status: 0 From tismer at codespeak.net Mon May 2 01:39:47 2005 From: tismer at codespeak.net (tismer at codespeak.net) Date: Mon, 2 May 2005 01:39:47 +0200 (CEST) Subject: [pypy-svn] r11749 - pypy/dist/pypy/objspace/std Message-ID: <20050501233947.B080F27C26@code1.codespeak.net> Author: tismer Date: Mon May 2 01:39:47 2005 New Revision: 11749 Modified: pypy/dist/pypy/objspace/std/longtype.py Log: found two bugs vial flowspace Modified: pypy/dist/pypy/objspace/std/longtype.py ============================================================================== --- pypy/dist/pypy/objspace/std/longtype.py (original) +++ pypy/dist/pypy/objspace/std/longtype.py Mon May 2 01:39:47 2005 @@ -3,6 +3,7 @@ from pypy.interpreter.error import OperationError from pypy.objspace.std.inttype import int_typedef from pypy.interpreter.gateway import NoneNotWrapped +from pypy.tool.rarithmetic import r_uint def descr__new__(space, w_longtype, w_value=0, w_base=NoneNotWrapped): from pypy.objspace.std.longobject import W_LongObject, args_from_long @@ -22,9 +23,9 @@ # 'long(x)' should return whatever x.__long__() returned if space.is_true(space.is_(w_longtype, space.w_long)): return w_obj - if space.is_true(space.isinstance(w_obj, w_long)): + if space.is_true(space.isinstance(w_obj, space.w_long)): w_value = w_obj - elif space.is_true(space.isinstance(w_obj, w_int)): + elif space.is_true(space.isinstance(w_obj, space.w_int)): intval = space.int_w(w_obj) # xxx this logic needs to be put in 1 place if intval < 0: From tismer at codespeak.net Mon May 2 01:40:42 2005 From: tismer at codespeak.net (tismer at codespeak.net) Date: Mon, 2 May 2005 01:40:42 +0200 (CEST) Subject: [pypy-svn] r11750 - pypy/dist/goal Message-ID: <20050501234042.3144F27C26@code1.codespeak.net> Author: tismer Date: Mon May 2 01:40:41 2005 New Revision: 11750 Modified: pypy/dist/goal/translate_pypy.py Log: fixed typo Modified: pypy/dist/goal/translate_pypy.py ============================================================================== --- pypy/dist/goal/translate_pypy.py (original) +++ pypy/dist/goal/translate_pypy.py Mon May 2 01:40:41 2005 @@ -120,7 +120,7 @@ if not quiet: print "=" * 70 percent = int(num and (100.0*someobjnum / num) or 0) - print "somobjectness: %2d percent" % (percent) + print "someobjectness: %2d percent" % (percent) print "(%d out of %d functions get or return SomeObjects" % ( someobjnum, num) print "=" * 70 From tismer at codespeak.net Mon May 2 01:42:29 2005 From: tismer at codespeak.net (tismer at codespeak.net) Date: Mon, 2 May 2005 01:42:29 +0200 (CEST) Subject: [pypy-svn] r11751 - in pypy/dist: goal pypy/translator/genc Message-ID: <20050501234229.7574427C1F@code1.codespeak.net> Author: tismer Date: Mon May 2 01:42:29 2005 New Revision: 11751 Modified: pypy/dist/goal/targetpypy1.py pypy/dist/pypy/translator/genc/ctyper.py pypy/dist/pypy/translator/genc/g_support.h pypy/dist/pypy/translator/genc/int_include.h Log: added exception macros to g_support.h added new specializations to ctyper.py implemented them in int_include.h added operations to targetpypy1.py will continue with this Modified: pypy/dist/goal/targetpypy1.py ============================================================================== --- pypy/dist/goal/targetpypy1.py (original) +++ pypy/dist/goal/targetpypy1.py Mon May 2 01:42:29 2005 @@ -6,13 +6,16 @@ # __________ Entry point __________ def entry_point(): - w_a = W_IntObject(space, -6) - w_b = W_IntObject(space, -7) - return mmentrypoint(space, w_a, w_b) + w_a = W_IntObject(space, -7) + w_b = W_IntObject(space, -6) + ret_mul = mmentrypoints["mul"](space, w_a, w_b) + ret_add = mmentrypoints["add"](space, w_a, w_b) + ret_sub = mmentrypoints["sub"](space, w_a, w_b) + return ret_mul, ret_add, ret_sub # _____ Define and setup target _____ def target(): - global space, mmentrypoint + global space, mmentrypoints # disable translation of the whole of classobjinterp.py StdObjSpace.setup_old_style_classes = lambda self: None space = StdObjSpace() @@ -20,14 +23,15 @@ buildcache2.buildcache(space) # ------------------------------------------------------------ - name = 'mul' - mm = space.MM.mul - exprargs, expr, miniglobals, fallback = ( - mm.install_not_sliced(space.model.typeorder, baked_perform_call=False)) - func = stdtypedef.make_perform_trampoline('__mm_'+name, - exprargs, expr, miniglobals, - mm) - mmentrypoint = func + mmentrypoints = {} + for name in "mul add sub".split(): + mm = getattr(space.MM, name) + exprargs, expr, miniglobals, fallback = ( + mm.install_not_sliced(space.model.typeorder, baked_perform_call=False)) + func = stdtypedef.make_perform_trampoline('__mm_'+name, + exprargs, expr, miniglobals, + mm) + mmentrypoints[name] = func # ------------------------------------------------------------ # further call the entry_point once to trigger building remaining @@ -39,7 +43,8 @@ # _____ Run translated _____ def run(c_entry_point): - w_result = c_entry_point() - print w_result - print w_result.intval - assert w_result.intval == 42 + res_w = c_entry_point() + res = tuple([each.intval for each in res_w]) + print res + assert res == (-7 * -6, -7 + -6, -7 - -6) + \ No newline at end of file Modified: pypy/dist/pypy/translator/genc/ctyper.py ============================================================================== --- pypy/dist/pypy/translator/genc/ctyper.py (original) +++ pypy/dist/pypy/translator/genc/ctyper.py Mon May 2 01:42:29 2005 @@ -35,12 +35,20 @@ typematches = [TNone, TInt], specializationtable = [ - ## op specialized op arg types concrete return type - ('add', 'int_add', TInt, TInt, TInt), - ('inplace_add', 'int_add', TInt, TInt, TInt), - ('sub', 'int_sub', TInt, TInt, TInt), - ('inplace_sub', 'int_sub', TInt, TInt, TInt), - ('is_true', 'int_is_true', TInt, TInt), + ## op specialized op arg types concrete return type + ('add', 'int_add', TInt, TInt, TInt), + ('inplace_add', 'int_add', TInt, TInt, TInt), + ('add_ovf', 'int_add_ovf', TInt, TInt, TInt), + ('inplace_add_ovf', 'int_add_ovf', TInt, TInt, TInt), + ('sub', 'int_sub', TInt, TInt, TInt), + ('inplace_sub', 'int_sub', TInt, TInt, TInt), + ('sub_ovf', 'int_sub_ovf', TInt, TInt, TInt), + ('inplace_sub_ovf', 'int_sub_ovf', TInt, TInt, TInt), + ('mul', 'int_mul', TInt, TInt, TInt), + ('inplace_mul', 'int_mul', TInt, TInt, TInt), + ('mul_ovf', 'int_mul_ovf', TInt, TInt, TInt), + ('inplace_mul_ovf', 'int_mul_ovf', TInt, TInt, TInt), + ('is_true', 'int_is_true', TInt, TInt), ], ) Modified: pypy/dist/pypy/translator/genc/g_support.h ============================================================================== --- pypy/dist/pypy/translator/genc/g_support.h (original) +++ pypy/dist/pypy/translator/genc/g_support.h Mon May 2 01:42:29 2005 @@ -11,6 +11,13 @@ #define MOVE(x, y) y = x; +#define FAIL_EXCEPTION(err, exc, msg) \ + { \ + PyErr_SetString(exc, msg); \ + FAIL(err) \ + } +#define FAIL_OVF(err, msg) FAIL_EXCEPTION(err, PyExc_OverflowError, msg) +#define FAIL_ZER(err, msg) FAIL_EXCEPTION(err, PyExc_ZeroDivisionError, msg) /* we need a subclass of 'builtin_function_or_method' which can be used as methods: builtin function objects that can be bound on instances */ Modified: pypy/dist/pypy/translator/genc/int_include.h ============================================================================== --- pypy/dist/pypy/translator/genc/int_include.h (original) +++ pypy/dist/pypy/translator/genc/int_include.h Mon May 2 01:42:29 2005 @@ -6,9 +6,79 @@ #define OP_INCREF_int(x) /* nothing */ #define OP_DECREF_int(x) /* nothing */ #define CONV_TO_OBJ_int PyInt_FromLong -#define CONV_FROM_OBJ_int PyInt_AsLong +#define CONV_FROM_OBJ_int PyInt_AS_LONG #define OP_INT_IS_TRUE(x,r,err) r = (x != 0); #define OP_INT_ADD(x,y,r,err) r = x + y; + +#define OP_INT_ADD_OVF(x,y,r,err) \ + r = x + y; \ + if ((r^x) >= 0 || (r^y) >= 0); \ + else FAIL_OVF(err, "integer addition") + #define OP_INT_SUB(x,y,r,err) r = x - y; + +#define OP_INT_SUB_OVF(x,y,r,err) \ + r = x - y; \ + if ((r^x) >= 0 || (r^~y) >= 0); \ + else FAIL_OVF(err, "integer subtraction") + +#define OP_INT_MUL(x,y,r,err) r = x * y; + +#ifndef HAVE_LONG_LONG + +#define OP_INT_MUL_OVF(x,y,r,err) \ + if (op_int_mul_ovf(x,y,&r)); \ + else FAIL_OVF(err, "integer multiplication") + +#else + +#define OP_INT_MUL_OVF(x,y,r,err) \ + { \ + PY_LONG_LONG lr = (PY_LONG_LONG)x * (PY_LONG_LONG)y; \ + r = (long)lr; \ + if ((PY_LONG_LONG)r == lr); \ + else FAIL_OVF(err, "integer multiplication") \ + } +#endif + +/* #define OP_ gnargll the division stuff is coming */ + +/* _________________ certain implementations __________________ */ + +#ifndef HAVE_LONG_LONG +/* adjusted from intobject.c, Python 2.3.3 */ +int +op_int_mul_ovf(long a, long b, long *longprod) +{ + double doubled_longprod; /* (double)longprod */ + double doubleprod; /* (double)a * (double)b */ + + *longprod = a * b; + doubleprod = (double)a * (double)b; + doubled_longprod = (double)*longprod; + + /* Fast path for normal case: small multiplicands, and no info + is lost in either method. */ + if (doubled_longprod == doubleprod) + return 1; + + /* Somebody somewhere lost info. Close enough, or way off? Note + that a != 0 and b != 0 (else doubled_longprod == doubleprod == 0). + The difference either is or isn't significant compared to the + true value (of which doubleprod is a good approximation). + */ + { + const double diff = doubled_longprod - doubleprod; + const double absdiff = diff >= 0.0 ? diff : -diff; + const double absprod = doubleprod >= 0.0 ? doubleprod : + -doubleprod; + /* absdiff/absprod <= 1/32 iff + 32 * absdiff <= absprod -- 5 good bits is "close enough" */ + if (32.0 * absdiff <= absprod) + return 1; + return 0; + } +} +#endif /* HAVE_LONG_LONG */ From hpk at codespeak.net Mon May 2 02:04:12 2005 From: hpk at codespeak.net (hpk at codespeak.net) Date: Mon, 2 May 2005 02:04:12 +0200 (CEST) Subject: [pypy-svn] r11752 - pypy/dist/pypy/documentation/revreport Message-ID: <20050502000412.62E7A27C26@code1.codespeak.net> Author: hpk Date: Mon May 2 02:04:12 2005 New Revision: 11752 Modified: pypy/dist/pypy/documentation/revreport/delta.py Log: use new location of callcapture() helper Modified: pypy/dist/pypy/documentation/revreport/delta.py ============================================================================== --- pypy/dist/pypy/documentation/revreport/delta.py (original) +++ pypy/dist/pypy/documentation/revreport/delta.py Mon May 2 02:04:12 2005 @@ -576,9 +576,17 @@ rep.navig = navig for modname in modnames: - - mod1 = expl1.get_module(modname) - mod2 = expl2.get_module(modname) + try: + mod1 = expl1.get_module(modname) + mod2 = expl2.get_module(modname) + except: + print "traceback while getting modules" + print "modname", modname + print "expl1", expl1 + print "expl2", expl2 + import traceback + traceback.print_exc() + continue mod_rep = mod_delta(modname, expl1, mod1, expl2, mod2) From hpk at codespeak.net Mon May 2 02:06:22 2005 From: hpk at codespeak.net (hpk at codespeak.net) Date: Mon, 2 May 2005 02:06:22 +0200 (CEST) Subject: [pypy-svn] r11754 - in pypy/dist: lib-python pypy/tool Message-ID: <20050502000622.A3C2D27C26@code1.codespeak.net> Author: hpk Date: Mon May 2 02:06:22 2005 New Revision: 11754 Added: pypy/dist/lib-python/result.py Modified: pypy/dist/lib-python/conftest.py pypy/dist/pypy/tool/alarm.py Log: first part of larger report update Modified: pypy/dist/lib-python/conftest.py ============================================================================== --- pypy/dist/lib-python/conftest.py (original) +++ pypy/dist/lib-python/conftest.py Mon May 2 02:06:22 2005 @@ -1,3 +1,9 @@ +""" + +test configuration(s) for running CPython's regression +test suite on top of PyPy + +""" import py import sys import pypy @@ -6,12 +12,21 @@ from pypy.tool import pytestsupport from pypy.interpreter.module import Module as PyPyModule from pypy.interpreter.main import run_string, run_file +from py.__.misc.simplecapture import callcapture # the following adds command line options as a side effect! from pypy.conftest import gettestobjspace, option as pypy_option from test.regrtest import reportdiff from test import pystone +pypydir = py.path.local(pypy.__file__).dirpath() +libpythondir = pypydir.dirpath('lib-python') +testdir = libpythondir.join('2.3.4', 'test') +modtestdir = libpythondir.join('modified-2.3.4', 'test') + +from result import Result + + # # Interfacing/Integrating with py.test's collection process # @@ -33,7 +48,7 @@ Option('-T', '--timeout', action="store", type="string", default="100mp", dest="timeout", help="fail a test module after the given timeout. " - "specify in seconds or 'XXXmp' aka Mega-Pystones") + "specify in seconds or 'NUMmp' aka Mega-Pystones") ) def gettimeout(): @@ -46,11 +61,6 @@ return seconds return float(timeout) -pypydir = py.path.local(pypy.__file__).dirpath() -libpythondir = pypydir.dirpath('lib-python') -testdir = libpythondir.join('2.3.4', 'test') -modtestdir = libpythondir.join('modified-2.3.4', 'test') - def callex(space, func, *args, **kwargs): try: return func(*args, **kwargs) @@ -275,10 +285,19 @@ self.basename = basename self.enabled = enabled self.dumbtest = dumbtest + if pypy_option.oldstyle: + oldstyle = True self.oldstyle = oldstyle self.core = core self.uselibfile = uselibfile + def getoptions(self): + l = [] + for name in 'oldstyle', 'core', 'uselibfile': + if getattr(self, name): + l.append(name) + return l + def ismodified(self): return modtestdir.join(self.basename).check() @@ -732,25 +751,34 @@ def join(self, name): return ReallyRunFileExternal(name, parent=self) + +def ensuretestresultdir(): + testresultdir = pypydir.dirpath('testresult') + if not testresultdir.check(dir=1): + py.test.skip("""'testresult' directory not found. + To run tests in reporting mode (without -E), you first have to + check it out as follows: + svn co http://codespeak.net/svn/pypy/testresult %s""" % ( + testresultdir, )) + return testresultdir + + +# +# testmethod: +# invoking in a seprate process: py.py TESTFILE +# +import os +import time +import socket +import getpass + class ReallyRunFileExternal(py.test.Item): - def run(self): - """ invoke a subprocess running the test file via PyPy. - record its output into the 'result/user at host' subdirectory. - (we might want to create subdirectories for - each user, because we will probably all produce - such result runs and they will not be the same - i am afraid. - """ - import os - import time - import socket - import getpass - regrtest = self.parent.regrtest + + def getinvocation(self, regrtest): fspath = regrtest.getfspath() python = sys.executable - pypy_dir = py.path.local(pypy.__file__).dirpath() - pypy_script = pypy_dir.join('interpreter', 'py.py') - alarm_script = pypy_dir.join('tool', 'alarm.py') + pypy_script = pypydir.join('interpreter', 'py.py') + alarm_script = pypydir.join('tool', 'alarm.py') pypy_options = [] if regrtest.oldstyle or pypy_option.oldstyle: pypy_options.append('--oldstyle') @@ -760,100 +788,78 @@ TIMEOUT = gettimeout() cmd = "%s %s %d %s %s %s" %(python, alarm_script, TIMEOUT, pypy_script, sopt, fspath) - try: - username = getpass.getuser() - except: - username = 'unknown' - userhost = '%s@%s' % (username, socket.gethostname()) - - testresultdir = pypydir.dirpath('testresult') - if not testresultdir.check(dir=1): - py.test.skip("""'testresult' directory not found. - To run tests in reporting mode (without -E), you first have to - check it out as follows: - svn co http://codespeak.net/svn/pypy/testresult %s""" % ( - testresultdir, )) - resultdir = testresultdir.join(userhost) - resultdir.ensure(dir=1) - resultfilename = resultdir.join(fspath.new(ext='.txt').basename) - resultfile = resultfilename.open('w') - if regrtest.getoutputpath(): - outputfilename = resultfilename.new(ext='.out') - outputfile = outputfilename.open('w') - print >> outputfile, self.fspath.purebasename - outputfile.close() - else: - outputfilename = None + return cmd - print >> resultfile, "testreport-version: 1.0" - print >> resultfile, "command:", cmd - print >> resultfile, "run by: %s" % userhost - print >> resultfile, "sys.platform:", sys.platform - print >> resultfile, "sys.version_info:", sys.version_info - info = try_getcpuinfo() - if info is not None: - print >>resultfile, "cpu model:", info['model name'] - print >>resultfile, "cpu mhz:", info['cpu mhz'] - - print >> resultfile, "oldstyle:", regrtest.oldstyle and 'yes' or 'no' - print >> resultfile, "uselibfile:", regrtest.uselibfile and 'yes' or 'no' - print >> resultfile, 'pypy-revision:', getrev(pypydir) - print >> resultfile, "startdate:", time.ctime() - print >> resultfile, "timeout: %s seconds" %(TIMEOUT,) - - print >> resultfile - if outputfilename: - print >> resultfile, "OUTPUT TEST" - print >> resultfile, "see output in:", str(outputfilename) - print >> resultfile, '='*60 - print "executing", cmd - starttime = time.time() - resultfile.close() - - if outputfilename: - status = os.system("%s >>%s 2>>%s" %(cmd, outputfilename, - resultfilename) ) - else: - status = os.system("%s >>%s 2>&1" %(cmd, resultfilename) ) + def run(self): + """ invoke a subprocess running the test file via PyPy. + record its output into the 'result/user at host' subdirectory. + (we might want to create subdirectories for + each user, because we will probably all produce + such result runs and they will not be the same + i am afraid. + """ + regrtest = self.parent.regrtest + testresultdir = ensuretestresultdir() + result = self.getresult(regrtest) + resultdir = testresultdir.join(result['userhost']) + assert resultdir.check(dir=1) + + # XXX on timeout failures only write if prev test did not timeout + fn = resultdir.join(regrtest.basename).new(ext='.txt') + fn.write(result.repr_mimemessage().as_string(unixfrom=False)) + if result['exit status']: + time.sleep(0.5) # time for a Ctrl-C to reach us :-) + py.test.fail(result['outcome']) + + def getstatusouterr(self, cmd): + tempdir = py.test.ensuretemp('regrtest') + stdout = tempdir.join(self.fspath.basename) + '.out' + stderr = tempdir.join(self.fspath.basename) + '.err' + + status = os.system("%s >>%s 2>>%s" %(cmd, stdout, stderr)) if os.WIFEXITED(status): status = os.WEXITSTATUS(status) else: status = 'abnormal termination 0x%x' % status + return status, stdout.read(), stderr.read() - failure = None - resultfile = resultfilename.open('a') - if outputfilename: - expectedfilename = regrtest.getoutputpath() - expected = expectedfilename.read(mode='r') - result = outputfilename.read(mode='r') - if result != expected: - reportdiff(expected, result) - failure = "output check failed: %s" % (fspath.basename,) - print >> resultfile, 'FAILED: test output differs' - else: - print >> resultfile, 'OK' - print >> resultfile, '='*26, 'closed', '='*26 - print >> resultfile, 'execution time:', time.time() - starttime, 'seconds' - print >> resultfile, 'exit status:', status - resultfile.close() - if status != 0: - failure = "exitstatus is %d" %(status,) - #print output - if failure: - time.sleep(0.5) # time for a Ctrl-C to reach us :-) - py.test.fail(failure) - - -# -# -# -def try_getcpuinfo(): - if sys.platform.startswith('linux'): - cpuinfopath = py.path.local('/proc/cpuinfo') - d = {} - for line in cpuinfopath.readlines(): - if line.strip(): - name, value = line.split(':', 1) - name = name.strip().lower() - d[name] = value.strip() - return d + def getresult(self, regrtest): + cmd = self.getinvocation(regrtest) + result = Result() + fspath = regrtest.getfspath() + result['fspath'] = str(fspath) + result['options'] = regrtest.getoptions() + result['pypy-revision'] = getrev(pypydir) + result['timeout'] = gettimeout() + result['startdate'] = time.ctime() + starttime = time.time() + + # really run the test in a sub process + exit_status, test_stdout, test_stderr = self.getstatusouterr(cmd) + + timedout = test_stderr.rfind(26*"=" + "timedout" + 26*"=") != -1 + if not timedout: + timedout = test_stderr.rfind("KeyboardInterrupt") != -1 + result['execution-time'] = time.time() - starttime + result.addnamedtext('stdout', test_stdout) + result.addnamedtext('stderr', test_stderr) + + outcome = 'OK' + expectedpath = regrtest.getoutputpath() + if not exit_status: + if expectedpath is not None: + expected = expectedpath.read(mode='r') + test_stdout = "%s\n%s" % (self.fspath.purebasename, test_stdout) + if test_stdout != expected: + exit_status = 2 + res, out, err = callcapture(reportdiff, expected, test_stdout) + outcome = 'ERROUT' + result.addnamedtext('reportdiff', out) + elif timedout: + outcome = "T/O" + else: + outcome = "ERR" + + result['exit status'] = exit_status + result['outcome'] = outcome + return result Added: pypy/dist/lib-python/result.py ============================================================================== --- (empty file) +++ pypy/dist/lib-python/result.py Mon May 2 02:06:22 2005 @@ -0,0 +1,122 @@ +import sys +import py + +class Result(object): + def __init__(self, init=True): + self._headers = {} + self._blocks = {} + self._blocknames = [] + if init: + stdinit(self) + + def __setitem__(self, name, value): + self._headers[name.lower()] = value + + def __getitem__(self, name): + return self._headers[name.lower()] + + def get(self, name, default): + return self._headers.get(name, default) + + def __delitem__(self, name): + del self._headers[name.lower()] + + def items(self): + return self._headers.items() + + def addnamedtext(self, name, text): + assert isinstance(text, str) + assert isinstance(name, str) + self._blocknames.append(name) + self._blocks[name] = text + + def getnamedtext(self, name): + return self._blocks[name] + + def repr_mimemessage(self): + from email.MIMEMultipart import MIMEMultipart + from email.MIMEText import MIMEText + + outer = MIMEMultipart() + items = self._headers.items() + items.sort() + reprs = {} + for name, value in items: + outer[name] = str(value) + if not isinstance(value, str): + typename = type(value).__name__ + assert typename in vars(py.std.__builtin__) + reprs[name] = typename + + outer['_reprs'] = repr(reprs) + + for name in self._blocknames: + text = self._blocks[name] + m = MIMEText(text) + m.add_header('Content-Disposition', 'attachment', filename=name) + outer.attach(m) + return outer + + def isok(self): + return self['outcome'].lower() == 'ok' + def iserr(self): + return self['outcome'].lower()[:3] == 'err' + def istimeout(self): + return self['outcome'].lower() == 't/o' + +class ResultFromMime(Result): + def __init__(self, path): + super(ResultFromMime, self).__init__(init=False) + f = open(str(path), 'r') + from email import message_from_file + msg = message_from_file(f) + # XXX security wise evil (keep in mind once we accept reporsts + # from anonymous + #print msg['_reprs'] + self._reprs = eval(msg['_reprs']) + del msg['_reprs'] + for name, value in msg.items(): + if name in self._reprs: + value = eval(value) # XXX security + self._headers[name] = value + self.fspath = py.path.local(self['fspath']) + self.path = path + + payload = msg.get_payload() + if payload: + for submsg in payload: + assert submsg.get_main_type() == 'text' + fn = submsg.get_filename() + assert fn + self.addnamedtext(fn, submsg.get_payload()) + +def stdinit(result): + import getpass + import socket + try: + username = getpass.getuser() + except: + username = 'unknown' + userhost = '%s@%s' % (username, socket.gethostname()) + result['testreport-version'] = "1.1" + result['userhost'] = userhost + result['platform'] = sys.platform + result['python-version-info'] = sys.version_info + info = try_getcpuinfo() + if info is not None: + result['cpu model'] = info['model name'] + result['cpu mhz'] = info['cpu mhz'] +# +# +# +def try_getcpuinfo(): + if sys.platform.startswith('linux'): + cpuinfopath = py.path.local('/proc/cpuinfo') + if cpuinfopath.check(file=1): + d = {} + for line in cpuinfopath.readlines(): + if line.strip(): + name, value = line.split(':', 1) + name = name.strip().lower() + d[name] = value.strip() + return d Modified: pypy/dist/pypy/tool/alarm.py ============================================================================== --- pypy/dist/pypy/tool/alarm.py (original) +++ pypy/dist/pypy/tool/alarm.py Mon May 2 02:06:22 2005 @@ -15,7 +15,7 @@ while now() < timeout and not finished: sleep(1.65123) if not finished: - stderr.write("="*26 + "timeout" + "="*26 + "\n") + stderr.write("="*26 + "timedout" + "="*26 + "\n") while not finished: # send KeyboardInterrupt repeatedly until the main # thread dies. Then quit (in case we are on a system From hpk at codespeak.net Mon May 2 02:07:06 2005 From: hpk at codespeak.net (hpk at codespeak.net) Date: Mon, 2 May 2005 02:07:06 +0200 (CEST) Subject: [pypy-svn] r11755 - in pypy/testresult: . hpk@code1.codespeak.net Message-ID: <20050502000706.D290927C26@code1.codespeak.net> Author: hpk Date: Mon May 2 02:07:05 2005 New Revision: 11755 Added: pypy/testresult/hpk at code1.codespeak.net/test___all__.txt pypy/testresult/hpk at code1.codespeak.net/test_atexit.txt pypy/testresult/hpk at code1.codespeak.net/test_bufio.txt pypy/testresult/hpk at code1.codespeak.net/test_cfgparser.txt pypy/testresult/hpk at code1.codespeak.net/test_class.txt pypy/testresult/hpk at code1.codespeak.net/test_coercion.txt pypy/testresult/hpk at code1.codespeak.net/test_complex.txt pypy/testresult/hpk at code1.codespeak.net/test_cookie.txt pypy/testresult/hpk at code1.codespeak.net/test_cpickle.txt pypy/testresult/hpk at code1.codespeak.net/test_descr.txt pypy/testresult/hpk at code1.codespeak.net/test_descrtut.txt pypy/testresult/hpk at code1.codespeak.net/test_eof.txt pypy/testresult/hpk at code1.codespeak.net/test_exceptions.txt pypy/testresult/hpk at code1.codespeak.net/test_extcall.txt pypy/testresult/hpk at code1.codespeak.net/test_file.txt pypy/testresult/hpk at code1.codespeak.net/test_format.txt Removed: pypy/testresult/index.cgi pypy/testresult/quickreport.py Modified: pypy/testresult/ (props changed) pypy/testresult/genreportdata.py pypy/testresult/hpk at code1.codespeak.net/test___future__.txt pypy/testresult/hpk at code1.codespeak.net/test_anydbm.txt pypy/testresult/hpk at code1.codespeak.net/test_augassign.txt pypy/testresult/hpk at code1.codespeak.net/test_base64.txt pypy/testresult/hpk at code1.codespeak.net/test_binop.txt pypy/testresult/hpk at code1.codespeak.net/test_bisect.txt pypy/testresult/hpk at code1.codespeak.net/test_bool.txt pypy/testresult/hpk at code1.codespeak.net/test_builtin.txt pypy/testresult/hpk at code1.codespeak.net/test_calendar.txt pypy/testresult/hpk at code1.codespeak.net/test_call.txt pypy/testresult/hpk at code1.codespeak.net/test_cgi.txt pypy/testresult/hpk at code1.codespeak.net/test_cmath.txt pypy/testresult/hpk at code1.codespeak.net/test_codeop.txt pypy/testresult/hpk at code1.codespeak.net/test_compare.txt pypy/testresult/hpk at code1.codespeak.net/test_compile.txt pypy/testresult/hpk at code1.codespeak.net/test_contains.txt pypy/testresult/hpk at code1.codespeak.net/test_copy.txt pypy/testresult/hpk at code1.codespeak.net/test_copy_reg.txt pypy/testresult/hpk at code1.codespeak.net/test_datetime.txt pypy/testresult/hpk at code1.codespeak.net/test_difflib.txt pypy/testresult/hpk at code1.codespeak.net/test_dircache.txt pypy/testresult/hpk at code1.codespeak.net/test_doctest.txt pypy/testresult/hpk at code1.codespeak.net/test_doctest2.txt pypy/testresult/hpk at code1.codespeak.net/test_dumbdbm.txt pypy/testresult/hpk at code1.codespeak.net/test_dummy_thread.txt pypy/testresult/hpk at code1.codespeak.net/test_dummy_threading.txt pypy/testresult/hpk at code1.codespeak.net/test_enumerate.txt pypy/testresult/hpk at code1.codespeak.net/test_filecmp.txt pypy/testresult/hpk at code1.codespeak.net/test_fileinput.txt pypy/testresult/hpk at code1.codespeak.net/test_fnmatch.txt pypy/testresult/hpk at code1.codespeak.net/test_fpformat.txt pypy/testresult/hpk at code1.codespeak.net/test_funcattrs.txt pypy/testresult/hpk at code1.codespeak.net/test_future.txt pypy/testresult/hpk at code1.codespeak.net/test_future1.txt pypy/testresult/hpk at code1.codespeak.net/test_future2.txt pypy/testresult/hpk at code1.codespeak.net/test_future3.txt pypy/testresult/htmlreport.py Log: reworked html views completely Modified: pypy/testresult/genreportdata.py ============================================================================== --- pypy/testresult/genreportdata.py (original) +++ pypy/testresult/genreportdata.py Mon May 2 02:07:05 2005 @@ -5,13 +5,16 @@ if __name__ == '__main__': assert mydir.basename.endswith('result'), mydir mywc = py.path.svnwc(mydir) + print "updating", mywc mywc.update() + ppath = htmlreport.getpicklepath() rep = htmlreport.HtmlReport() - print "parsing", mydir + print "traversing", mydir rep.parse_all(mydir) - for res in rep.results: - res.ensurebody() - print "dumping", mydir + + print "dumping to", ppath ppath.dump(rep) + + rep.makeindex(mydir.join('index.html')) Added: pypy/testresult/hpk at code1.codespeak.net/test___all__.txt ============================================================================== --- (empty file) +++ pypy/testresult/hpk at code1.codespeak.net/test___all__.txt Mon May 2 02:07:05 2005 @@ -0,0 +1,85 @@ +Content-Type: multipart/mixed; boundary="===============3608182309632927640==" +MIME-Version: 1.0 +cpu mhz: 1603.694 +cpu model: AMD Opteron(tm) Processor 242 +execution-time: 72.865696907 +exit status: 1 +fspath: /home/hpk/pypy-dist/lib-python/2.3.4/test/test___all__.py +options: ['core'] +outcome: ERR +platform: linux2 +pypy-revision: 11740 +python-version-info: (2, 3, 5, 'final', 0) +startdate: Mon May 2 00:10:01 2005 +testreport-version: 1.1 +timeout: 900.0 +userhost: hpk at code1.codespeak.net +_reprs: {'execution-time': 'float', 'python-version-info': 'tuple', + 'options': 'list', 'timeout': 'float', 'pypy-revision': 'int', + 'exit status': 'int'} + +--===============3608182309632927640== +Content-Type: text/plain; charset="us-ascii" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Content-Disposition: attachment; filename="stdout" + +test_all (__main__.AllTest) ... ERROR + +====================================================================== +ERROR: test_all (__main__.AllTest) +---------------------------------------------------------------------- +Traceback (most recent call last): + File "/home/hpk/pypy-dist/lib-python/2.3.4/test/test___all__.py", line 77, in test_all + self.check_all("codecs") + File "/home/hpk/pypy-dist/lib-python/2.3.4/test/test___all__.py", line 21, in check_all + exec "import %s" % modname in names + File "", line 1, in ? + File "/home/hpk/pypy-dist/lib-python/modified-2.3.4/codecs.py", line 23, in ? + raise SystemError,\ +SystemError: Failed to load the builtin codecs: pypy + +---------------------------------------------------------------------- +Ran 1 test in 58.163s + +FAILED (errors=1) + +--===============3608182309632927640== +Content-Type: text/plain; charset="us-ascii" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Content-Disposition: attachment; filename="stderr" + +faking +faking +faking +faking +faking +faking +faking +faking +faking +faking +faking +faking +Traceback (application-level): + File "/home/hpk/pypy-dist/lib-python/2.3.4/test/test___all__.py", line 205 in ? + test_main() + File "/home/hpk/pypy-dist/lib-python/2.3.4/test/test___all__.py", line 202 in test_main + test_support.run_unittest(AllTest) + File "/home/hpk/pypy-dist/lib-python/2.3.4/test/test_support.py", line 262 in run_unittest + run_suite(suite, testclass) + File "/home/hpk/pypy-dist/lib-python/2.3.4/test/test_support.py", line 247 in run_suite + raise TestFailed(err) +TestFailed: Traceback (most recent call last): + File "/home/hpk/pypy-dist/lib-python/2.3.4/test/test___all__.py", line 77, in test_all + self.check_all("codecs") + File "/home/hpk/pypy-dist/lib-python/2.3.4/test/test___all__.py", line 21, in check_all + exec "import %s" % modname in names + File "", line 1, in ? + File "/home/hpk/pypy-dist/lib-python/modified-2.3.4/codecs.py", line 23, in ? + raise SystemError,\ +SystemError: Failed to load the builtin codecs: pypy + + +--===============3608182309632927640==-- \ No newline at end of file Modified: pypy/testresult/hpk at code1.codespeak.net/test___future__.txt ============================================================================== --- pypy/testresult/hpk at code1.codespeak.net/test___future__.txt (original) +++ pypy/testresult/hpk at code1.codespeak.net/test___future__.txt Mon May 2 02:07:05 2005 @@ -1,24 +1,43 @@ -testreport-version: 1.0 -command: /usr/bin/python /tmp/pypy-autotest-13/pypy-dist/pypy/tool/alarm.py 15359 /tmp/pypy-autotest-13/pypy-dist/pypy/interpreter/py.py /tmp/pypy-autotest-13/pypy-dist/lib-python-2.3.4/test/test___future__.py -run by: hpk at code1.codespeak.net -sys.platform: linux2 -sys.version_info: (2, 3, 5, 'final', 0) -cpu model: AMD Opteron(tm) Processor 242 +Content-Type: multipart/mixed; boundary="===============5273446146913316989==" +MIME-Version: 1.0 cpu mhz: 1603.694 -oldstyle: no -pypy-revision: 11680 -startdate: Sun May 1 04:01:58 2005 -timeout: 15360.0 seconds +cpu model: AMD Opteron(tm) Processor 242 +execution-time: 7.64621281624 +exit status: 0 +fspath: /home/hpk/pypy-dist/lib-python/2.3.4/test/test___future__.py +options: ['core'] +outcome: OK +platform: linux2 +pypy-revision: 11740 +python-version-info: (2, 3, 5, 'final', 0) +startdate: Mon May 2 00:11:15 2005 +testreport-version: 1.1 +timeout: 900.0 +userhost: hpk at code1.codespeak.net +_reprs: {'execution-time': 'float', 'python-version-info': 'tuple', + 'options': 'list', 'timeout': 'float', 'pypy-revision': 'int', + 'exit status': 'int'} + +--===============5273446146913316989== +Content-Type: text/plain; charset="us-ascii" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Content-Disposition: attachment; filename="stdout" + +Checking __future__ nested_scopes value _Feature((2, 1, 0, 'beta', 1), (2, 2, 0, 'alpha', 0), 16) +Checking __future__ generators value _Feature((2, 2, 0, 'alpha', 1), (2, 3, 0, 'final', 0), 4096) +Checking __future__ division value _Feature((2, 2, 0, 'alpha', 2), (3, 0, 0, 'alpha', 0), 8192) + +--===============5273446146913316989== +Content-Type: text/plain; charset="us-ascii" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Content-Disposition: attachment; filename="stderr" -============================================================ faking faking faking faking faking -Checking __future__ nested_scopes value _Feature((2, 1, 0, 'beta', 1), (2, 2, 0, 'alpha', 0), 16) -Checking __future__ generators value _Feature((2, 2, 0, 'alpha', 1), (2, 3, 0, 'final', 0), 4096) -Checking __future__ division value _Feature((2, 2, 0, 'alpha', 2), (3, 0, 0, 'alpha', 0), 8192) -========================== closed ========================== -execution time: 17.0171048641 seconds -exit status: 0 + +--===============5273446146913316989==-- \ No newline at end of file Modified: pypy/testresult/hpk at code1.codespeak.net/test_anydbm.txt ============================================================================== --- pypy/testresult/hpk at code1.codespeak.net/test_anydbm.txt (original) +++ pypy/testresult/hpk at code1.codespeak.net/test_anydbm.txt Mon May 2 02:07:05 2005 @@ -1,16 +1,45 @@ -testreport-version: 1.0 -command: /usr/bin/python /tmp/pypy-autotest-13/pypy-dist/pypy/tool/alarm.py 13500 /tmp/pypy-autotest-13/pypy-dist/pypy/interpreter/py.py /tmp/pypy-autotest-13/pypy-dist/lib-python-2.3.4/test/test_anydbm.py -run by: hpk at code1.codespeak.net -sys.platform: linux2 -sys.version_info: (2, 3, 5, 'final', 0) -cpu model: AMD Opteron(tm) Processor 242 +Content-Type: multipart/mixed; boundary="===============6453150535472194176==" +MIME-Version: 1.0 cpu mhz: 1603.694 -oldstyle: no -pypy-revision: 11680 -startdate: Sun May 1 04:02:15 2005 -timeout: 13500.0 seconds +cpu model: AMD Opteron(tm) Processor 242 +execution-time: 30.5085959435 +exit status: 0 +fspath: /home/hpk/pypy-dist/lib-python/2.3.4/test/test_anydbm.py +options: ['core'] +outcome: OK +platform: linux2 +pypy-revision: 11740 +python-version-info: (2, 3, 5, 'final', 0) +startdate: Mon May 2 00:11:23 2005 +testreport-version: 1.1 +timeout: 961.0 +userhost: hpk at code1.codespeak.net +_reprs: {'execution-time': 'float', 'python-version-info': 'tuple', + 'options': 'list', 'timeout': 'float', 'pypy-revision': 'int', + 'exit status': 'int'} + +--===============6453150535472194176== +Content-Type: text/plain; charset="us-ascii" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Content-Disposition: attachment; filename="stdout" + +test_anydbm_creation (__main__.AnyDBMTestCase) ... ok +test_anydbm_keys (__main__.AnyDBMTestCase) ... ok +test_anydbm_modification (__main__.AnyDBMTestCase) ... ok +test_anydbm_read (__main__.AnyDBMTestCase) ... ok + +---------------------------------------------------------------------- +Ran 4 tests in 19.092s + +OK + +--===============6453150535472194176== +Content-Type: text/plain; charset="us-ascii" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Content-Disposition: attachment; filename="stderr" -============================================================ faking faking faking @@ -20,15 +49,5 @@ faking faking faking -test_anydbm_creation (__main__.AnyDBMTestCase) ... ok -test_anydbm_keys (__main__.AnyDBMTestCase) ... ok -test_anydbm_modification (__main__.AnyDBMTestCase) ... ok -test_anydbm_read (__main__.AnyDBMTestCase) ... ok - ----------------------------------------------------------------------- -Ran 4 tests in 27.044s -OK -========================== closed ========================== -execution time: 38.8403289318 seconds -exit status: 0 +--===============6453150535472194176==-- \ No newline at end of file Added: pypy/testresult/hpk at code1.codespeak.net/test_atexit.txt ============================================================================== --- (empty file) +++ pypy/testresult/hpk at code1.codespeak.net/test_atexit.txt Mon May 2 02:07:05 2005 @@ -0,0 +1,49 @@ +Content-Type: multipart/mixed; boundary="===============2569991817476333161==" +MIME-Version: 1.0 +cpu mhz: 1603.694 +cpu model: AMD Opteron(tm) Processor 242 +execution-time: 7.64905691147 +exit status: 1 +fspath: /home/hpk/pypy-dist/lib-python/2.3.4/test/test_atexit.py +options: ['core'] +outcome: ERR +platform: linux2 +pypy-revision: 11740 +python-version-info: (2, 3, 5, 'final', 0) +startdate: Mon May 2 00:11:54 2005 +testreport-version: 1.1 +timeout: 961.0 +userhost: hpk at code1.codespeak.net +_reprs: {'execution-time': 'float', 'python-version-info': 'tuple', + 'options': 'list', 'timeout': 'float', 'pypy-revision': 'int', + 'exit status': 'int'} + +--===============2569991817476333161== +Content-Type: text/plain; charset="us-ascii" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Content-Disposition: attachment; filename="stdout" + + +--===============2569991817476333161== +Content-Type: text/plain; charset="us-ascii" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Content-Disposition: attachment; filename="stderr" + +faking +faking +faking +faking +faking +faking +faking +faking +Traceback (application-level): + File "/home/hpk/pypy-dist/lib-python/2.3.4/test/test_atexit.py", line 37 in ? +""") + File "/home/hpk/pypy-dist/lib-python/2.3.4/test/test_support.py", line 194 in vereq + raise TestFailed, "%r == %r" % (a, b) +TestFailed: '' == "handler2 (7,) {'kw': 'abc'}\nhandler2 () {}\nhandler1\n" + +--===============2569991817476333161==-- \ No newline at end of file Modified: pypy/testresult/hpk at code1.codespeak.net/test_augassign.txt ============================================================================== --- pypy/testresult/hpk at code1.codespeak.net/test_augassign.txt (original) +++ pypy/testresult/hpk at code1.codespeak.net/test_augassign.txt Mon May 2 02:07:05 2005 @@ -1,22 +1,88 @@ -testreport-version: 1.0 -command: /usr/bin/python /tmp/pypy-autotest-13/pypy-dist/pypy/tool/alarm.py 13500 /tmp/pypy-autotest-13/pypy-dist/pypy/interpreter/py.py /tmp/pypy-autotest-13/pypy-dist/lib-python-2.3.4/test/test_augassign.py -run by: hpk at code1.codespeak.net -sys.platform: linux2 -sys.version_info: (2, 3, 5, 'final', 0) -cpu model: AMD Opteron(tm) Processor 242 +Content-Type: multipart/mixed; boundary="===============1951216324799441126==" +MIME-Version: 1.0 cpu mhz: 1603.694 -oldstyle: no -pypy-revision: 11680 -startdate: Sun May 1 04:02:54 2005 -timeout: 13500.0 seconds +cpu model: AMD Opteron(tm) Processor 242 +execution-time: 2.34780812263 +exit status: 0 +fspath: /home/hpk/pypy-dist/lib-python/2.3.4/test/test_augassign.py +options: ['core'] +outcome: OK +platform: linux2 +pypy-revision: 11740 +python-version-info: (2, 3, 5, 'final', 0) +startdate: Mon May 2 00:12:03 2005 +testreport-version: 1.1 +timeout: 900.0 +userhost: hpk at code1.codespeak.net +_reprs: {'execution-time': 'float', 'python-version-info': 'tuple', + 'options': 'list', 'timeout': 'float', 'pypy-revision': 'int', + 'exit status': 'int'} + +--===============1951216324799441126== +Content-Type: text/plain; charset="us-ascii" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Content-Disposition: attachment; filename="stdout" + +6 +[6] +6 +[1, 2, 3, 4, 1, 2, 3, 4] +[1, 2, 1, 2, 3] +True +True +True +11 +True +12 +True +True +13 +__add__ called +__radd__ called +__iadd__ called +__sub__ called +__rsub__ called +__isub__ called +__mul__ called +__rmul__ called +__imul__ called +__div__ called +__rdiv__ called +__idiv__ called +__floordiv__ called +__rfloordiv__ called +__ifloordiv__ called +__mod__ called +__rmod__ called +__imod__ called +__pow__ called +__rpow__ called +__ipow__ called +__or__ called +__ror__ called +__ior__ called +__and__ called +__rand__ called +__iand__ called +__xor__ called +__rxor__ called +__ixor__ called +__rshift__ called +__rrshift__ called +__irshift__ called +__lshift__ called +__rlshift__ called +__ilshift__ called + +--===============1951216324799441126== +Content-Type: text/plain; charset="us-ascii" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Content-Disposition: attachment; filename="stderr" -OUTPUT TEST -see output in: /tmp/pypy-autotest-13/pypy-dist/lib-python-2.3.4/test/result/hpk at code1.codespeak.net/test_augassign.out -============================================================ faking faking faking -OK -========================== closed ========================== -execution time: 2.59092092514 seconds -exit status: 0 + +--===============1951216324799441126==-- \ No newline at end of file Modified: pypy/testresult/hpk at code1.codespeak.net/test_base64.txt ============================================================================== --- pypy/testresult/hpk at code1.codespeak.net/test_base64.txt (original) +++ pypy/testresult/hpk at code1.codespeak.net/test_base64.txt Mon May 2 02:07:05 2005 @@ -1,28 +1,47 @@ -testreport-version: 1.0 -command: /usr/bin/python /tmp/pypy-autotest-16/pypy-dist/pypy/tool/alarm.py 15359 /tmp/pypy-autotest-16/pypy-dist/pypy/interpreter/py.py /tmp/pypy-autotest-16/pypy-dist/lib-python/2.3.4/test/test_base64.py -run by: hpk at code1.codespeak.net -sys.platform: linux2 -sys.version_info: (2, 3, 5, 'final', 0) -cpu model: AMD Opteron(tm) Processor 242 +Content-Type: multipart/mixed; boundary="===============3293880887368150043==" +MIME-Version: 1.0 cpu mhz: 1603.694 -oldstyle: no -pypy-revision: 11699 -startdate: Sun May 1 15:47:37 2005 -timeout: 15360.0 seconds +cpu model: AMD Opteron(tm) Processor 242 +execution-time: 9.83619999886 +exit status: 0 +fspath: /home/hpk/pypy-dist/lib-python/2.3.4/test/test_base64.py +options: [] +outcome: OK +platform: linux2 +pypy-revision: 11740 +python-version-info: (2, 3, 5, 'final', 0) +startdate: Sun May 1 23:53:24 2005 +testreport-version: 1.1 +timeout: 900.0 +userhost: hpk at code1.codespeak.net +_reprs: {'execution-time': 'float', 'python-version-info': 'tuple', + 'options': 'list', 'timeout': 'float', 'pypy-revision': 'int', + 'exit status': 'int'} + +--===============3293880887368150043== +Content-Type: text/plain; charset="us-ascii" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Content-Disposition: attachment; filename="stdout" -============================================================ -faking -faking -faking -faking -faking test_decodestring (__main__.Base64TestCase) ... ok test_encodestring (__main__.Base64TestCase) ... ok ---------------------------------------------------------------------- -Ran 2 tests in 5.292s +Ran 2 tests in 1.528s OK -========================== closed ========================== -execution time: 19.9723978043 seconds -exit status: 0 + +--===============3293880887368150043== +Content-Type: text/plain; charset="us-ascii" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Content-Disposition: attachment; filename="stderr" + +faking +faking +faking +faking +faking + +--===============3293880887368150043==-- \ No newline at end of file Modified: pypy/testresult/hpk at code1.codespeak.net/test_binop.txt ============================================================================== --- pypy/testresult/hpk at code1.codespeak.net/test_binop.txt (original) +++ pypy/testresult/hpk at code1.codespeak.net/test_binop.txt Mon May 2 02:07:05 2005 @@ -1,21 +1,29 @@ -testreport-version: 1.0 -command: /usr/bin/python /tmp/pypy-autotest-13/pypy-dist/pypy/tool/alarm.py 13499 /tmp/pypy-autotest-13/pypy-dist/pypy/interpreter/py.py /tmp/pypy-autotest-13/pypy-dist/lib-python-2.3.4/test/test_binop.py -run by: hpk at code1.codespeak.net -sys.platform: linux2 -sys.version_info: (2, 3, 5, 'final', 0) -cpu model: AMD Opteron(tm) Processor 242 +Content-Type: multipart/mixed; boundary="===============3686708374716990142==" +MIME-Version: 1.0 cpu mhz: 1603.694 -oldstyle: no -pypy-revision: 11680 -startdate: Sun May 1 04:03:07 2005 -timeout: 13500.0 seconds +cpu model: AMD Opteron(tm) Processor 242 +execution-time: 32.9482388496 +exit status: 0 +fspath: /home/hpk/pypy-dist/lib-python/2.3.4/test/test_binop.py +options: ['core'] +outcome: OK +platform: linux2 +pypy-revision: 11740 +python-version-info: (2, 3, 5, 'final', 0) +startdate: Mon May 2 00:12:06 2005 +testreport-version: 1.1 +timeout: 900.0 +userhost: hpk at code1.codespeak.net +_reprs: {'execution-time': 'float', 'python-version-info': 'tuple', + 'options': 'list', 'timeout': 'float', 'pypy-revision': 'int', + 'exit status': 'int'} + +--===============3686708374716990142== +Content-Type: text/plain; charset="us-ascii" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Content-Disposition: attachment; filename="stdout" -============================================================ -faking -faking -faking -faking -faking test_add (__main__.RatTestCase) ... ok test_constructor (__main__.RatTestCase) ... ok test_div (__main__.RatTestCase) ... ok @@ -27,9 +35,20 @@ test_sub (__main__.RatTestCase) ... ok ---------------------------------------------------------------------- -Ran 9 tests in 24.301s +Ran 9 tests in 24.297s OK -========================== closed ========================== -execution time: 31.9348540306 seconds -exit status: 0 + +--===============3686708374716990142== +Content-Type: text/plain; charset="us-ascii" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Content-Disposition: attachment; filename="stderr" + +faking +faking +faking +faking +faking + +--===============3686708374716990142==-- \ No newline at end of file Modified: pypy/testresult/hpk at code1.codespeak.net/test_bisect.txt ============================================================================== --- pypy/testresult/hpk at code1.codespeak.net/test_bisect.txt (original) +++ pypy/testresult/hpk at code1.codespeak.net/test_bisect.txt Mon May 2 02:07:05 2005 @@ -1,25 +1,29 @@ -testreport-version: 1.0 -command: /usr/bin/python /tmp/pypy-autotest-13/pypy-dist/pypy/tool/alarm.py 13499 /tmp/pypy-autotest-13/pypy-dist/pypy/interpreter/py.py /tmp/pypy-autotest-13/pypy-dist/lib-python-2.3.4/test/test_bisect.py -run by: hpk at code1.codespeak.net -sys.platform: linux2 -sys.version_info: (2, 3, 5, 'final', 0) -cpu model: AMD Opteron(tm) Processor 242 +Content-Type: multipart/mixed; boundary="===============0818956537019231984==" +MIME-Version: 1.0 cpu mhz: 1603.694 -oldstyle: no -pypy-revision: 11680 -startdate: Sun May 1 04:03:40 2005 -timeout: 13500.0 seconds +cpu model: AMD Opteron(tm) Processor 242 +execution-time: 201.411876917 +exit status: 0 +fspath: /home/hpk/pypy-dist/lib-python/2.3.4/test/test_bisect.py +options: ['core'] +outcome: OK +platform: linux2 +pypy-revision: 11740 +python-version-info: (2, 3, 5, 'final', 0) +startdate: Mon May 2 00:12:40 2005 +testreport-version: 1.1 +timeout: 961.0 +userhost: hpk at code1.codespeak.net +_reprs: {'execution-time': 'float', 'python-version-info': 'tuple', + 'options': 'list', 'timeout': 'float', 'pypy-revision': 'int', + 'exit status': 'int'} + +--===============0818956537019231984== +Content-Type: text/plain; charset="us-ascii" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Content-Disposition: attachment; filename="stdout" -============================================================ -faking -faking -faking -faking -faking -faking -faking -faking -faking test_backcompatibility (__main__.TestBisect) ... ok test_optionalSlicing (__main__.TestBisect) ... ok test_precomputed (__main__.TestBisect) ... ok @@ -28,10 +32,25 @@ test_vsListSort (__main__.TestInsort) ... ok ---------------------------------------------------------------------- -Ran 6 tests in 105.927s +Ran 6 tests in 102.871s OK doctest (test.test_bisect) ... 14 tests with zero failures -========================== closed ========================== -execution time: 204.441030025 seconds -exit status: 0 + +--===============0818956537019231984== +Content-Type: text/plain; charset="us-ascii" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Content-Disposition: attachment; filename="stderr" + +faking +faking +faking +faking +faking +faking +faking +faking +faking + +--===============0818956537019231984==-- \ No newline at end of file Modified: pypy/testresult/hpk at code1.codespeak.net/test_bool.txt ============================================================================== --- pypy/testresult/hpk at code1.codespeak.net/test_bool.txt (original) +++ pypy/testresult/hpk at code1.codespeak.net/test_bool.txt Mon May 2 02:07:05 2005 @@ -1,25 +1,29 @@ -testreport-version: 1.0 -command: /usr/bin/python /tmp/pypy-autotest-13/pypy-dist/pypy/tool/alarm.py 13499 /tmp/pypy-autotest-13/pypy-dist/pypy/interpreter/py.py /tmp/pypy-autotest-13/pypy-dist/lib-python-2.3.4/test/test_bool.py -run by: hpk at code1.codespeak.net -sys.platform: linux2 -sys.version_info: (2, 3, 5, 'final', 0) -cpu model: AMD Opteron(tm) Processor 242 +Content-Type: multipart/mixed; boundary="===============2045616176943440595==" +MIME-Version: 1.0 cpu mhz: 1603.694 -oldstyle: no -pypy-revision: 11680 -startdate: Sun May 1 04:07:04 2005 -timeout: 13500.0 seconds +cpu model: AMD Opteron(tm) Processor 242 +execution-time: 29.4575610161 +exit status: 0 +fspath: /home/hpk/pypy-dist/lib-python/2.3.4/test/test_bool.py +options: ['core'] +outcome: OK +platform: linux2 +pypy-revision: 11740 +python-version-info: (2, 3, 5, 'final', 0) +startdate: Mon May 2 00:16:02 2005 +testreport-version: 1.1 +timeout: 900.0 +userhost: hpk at code1.codespeak.net +_reprs: {'execution-time': 'float', 'python-version-info': 'tuple', + 'options': 'list', 'timeout': 'float', 'pypy-revision': 'int', + 'exit status': 'int'} + +--===============2045616176943440595== +Content-Type: text/plain; charset="us-ascii" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Content-Disposition: attachment; filename="stdout" -============================================================ -faking -faking -faking -faking -faking -faking -faking -faking -faking test_boolean (__main__.BoolTest) ... ok test_callable (__main__.BoolTest) ... ok test_convert (__main__.BoolTest) ... ok @@ -44,9 +48,24 @@ test_subclass (__main__.BoolTest) ... ok ---------------------------------------------------------------------- -Ran 22 tests in 21.274s +Ran 22 tests in 20.818s OK -========================== closed ========================== -execution time: 29.1442580223 seconds -exit status: 0 + +--===============2045616176943440595== +Content-Type: text/plain; charset="us-ascii" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Content-Disposition: attachment; filename="stderr" + +faking +faking +faking +faking +faking +faking +faking +faking +faking + +--===============2045616176943440595==-- \ No newline at end of file Added: pypy/testresult/hpk at code1.codespeak.net/test_bufio.txt ============================================================================== --- (empty file) +++ pypy/testresult/hpk at code1.codespeak.net/test_bufio.txt Mon May 2 02:07:05 2005 @@ -0,0 +1,40 @@ +Content-Type: multipart/mixed; boundary="===============2083746970277668913==" +MIME-Version: 1.0 +cpu mhz: 1603.694 +cpu model: AMD Opteron(tm) Processor 242 +execution-time: 842.297069788 +exit status: 0 +fspath: /home/hpk/pypy-dist/lib-python/2.3.4/test/test_bufio.py +options: ['core'] +outcome: OK +platform: linux2 +pypy-revision: 11740 +python-version-info: (2, 3, 5, 'final', 0) +startdate: Mon May 2 00:16:32 2005 +testreport-version: 1.1 +timeout: 900.0 +userhost: hpk at code1.codespeak.net +_reprs: {'execution-time': 'float', 'python-version-info': 'tuple', + 'options': 'list', 'timeout': 'float', 'pypy-revision': 'int', + 'exit status': 'int'} + +--===============2083746970277668913== +Content-Type: text/plain; charset="us-ascii" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Content-Disposition: attachment; filename="stdout" + + +--===============2083746970277668913== +Content-Type: text/plain; charset="us-ascii" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Content-Disposition: attachment; filename="stderr" + +faking +faking +faking +faking +faking + +--===============2083746970277668913==-- \ No newline at end of file Modified: pypy/testresult/hpk at code1.codespeak.net/test_builtin.txt ============================================================================== --- pypy/testresult/hpk at code1.codespeak.net/test_builtin.txt (original) +++ pypy/testresult/hpk at code1.codespeak.net/test_builtin.txt Mon May 2 02:07:05 2005 @@ -1,27 +1,29 @@ -testreport-version: 1.0 -command: /usr/bin/python /tmp/pypy-autotest-13/pypy-dist/pypy/tool/alarm.py 13500 /tmp/pypy-autotest-13/pypy-dist/pypy/interpreter/py.py /tmp/pypy-autotest-13/pypy-dist/lib-python-2.3.4/test/test_builtin.py -run by: hpk at code1.codespeak.net -sys.platform: linux2 -sys.version_info: (2, 3, 5, 'final', 0) -cpu model: AMD Opteron(tm) Processor 242 +Content-Type: multipart/mixed; boundary="===============0451512302806056798==" +MIME-Version: 1.0 cpu mhz: 1603.694 -oldstyle: no -pypy-revision: 11680 -startdate: Sun May 1 04:07:34 2005 -timeout: 13500.0 seconds +cpu model: AMD Opteron(tm) Processor 242 +execution-time: 265.911864996 +exit status: 0 +fspath: /home/hpk/pypy-dist/lib-python/2.3.4/test/test_builtin.py +options: ['core'] +outcome: OK +platform: linux2 +pypy-revision: 11740 +python-version-info: (2, 3, 5, 'final', 0) +startdate: Mon May 2 00:30:35 2005 +testreport-version: 1.1 +timeout: 841.0 +userhost: hpk at code1.codespeak.net +_reprs: {'execution-time': 'float', 'python-version-info': 'tuple', + 'options': 'list', 'timeout': 'float', 'pypy-revision': 'int', + 'exit status': 'int'} + +--===============0451512302806056798== +Content-Type: text/plain; charset="us-ascii" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Content-Disposition: attachment; filename="stdout" -============================================================ -faking -faking -faking -faking -faking -faking -faking -/tmp/pypy-autotest-13/pypy-dist/pypy/objspace/std/intobject.py:442: FutureWarning: %u/%o/%x/%X of negative int will return a signed string in Python 2.4 and up - ret = "0x%lx" % x -/tmp/pypy-autotest-13/pypy-dist/pypy/objspace/std/intobject.py:430: FutureWarning: %u/%o/%x/%X of negative int will return a signed string in Python 2.4 and up - ret = "0%lo" % x test_abs (__main__.BuiltinTest) ... ok test_apply (__main__.BuiltinTest) ... ok test_callable (__main__.BuiltinTest) ... ok @@ -74,9 +76,26 @@ test_zip (__main__.BuiltinTest) ... ok ---------------------------------------------------------------------- -Ran 50 tests in 247.233s +Ran 50 tests in 248.906s OK -========================== closed ========================== -execution time: 262.343266964 seconds -exit status: 0 + +--===============0451512302806056798== +Content-Type: text/plain; charset="us-ascii" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Content-Disposition: attachment; filename="stderr" + +faking +faking +faking +faking +faking +faking +faking +/home/hpk/pypy-dist/pypy/objspace/std/intobject.py:442: FutureWarning: %u/%o/%x/%X of negative int will return a signed string in Python 2.4 and up + ret = "0x%lx" % x +/home/hpk/pypy-dist/pypy/objspace/std/intobject.py:430: FutureWarning: %u/%o/%x/%X of negative int will return a signed string in Python 2.4 and up + ret = "0%lo" % x + +--===============0451512302806056798==-- \ No newline at end of file Modified: pypy/testresult/hpk at code1.codespeak.net/test_calendar.txt ============================================================================== --- pypy/testresult/hpk at code1.codespeak.net/test_calendar.txt (original) +++ pypy/testresult/hpk at code1.codespeak.net/test_calendar.txt Mon May 2 02:07:05 2005 @@ -1,22 +1,29 @@ -testreport-version: 1.0 -command: /usr/bin/python /tmp/pypy-autotest-13/pypy-dist/pypy/tool/alarm.py 12615 /tmp/pypy-autotest-13/pypy-dist/pypy/interpreter/py.py /tmp/pypy-autotest-13/pypy-dist/lib-python-2.3.4/test/test_calendar.py -run by: hpk at code1.codespeak.net -sys.platform: linux2 -sys.version_info: (2, 3, 5, 'final', 0) -cpu model: AMD Opteron(tm) Processor 242 +Content-Type: multipart/mixed; boundary="===============5058098551307329897==" +MIME-Version: 1.0 cpu mhz: 1603.694 -oldstyle: no -pypy-revision: 11680 -startdate: Sun May 1 04:11:56 2005 -timeout: 12615.0 seconds +cpu model: AMD Opteron(tm) Processor 242 +execution-time: 53.8434078693 +exit status: 0 +fspath: /home/hpk/pypy-dist/lib-python/2.3.4/test/test_calendar.py +options: ['core'] +outcome: OK +platform: linux2 +pypy-revision: 11740 +python-version-info: (2, 3, 5, 'final', 0) +startdate: Mon May 2 00:35:01 2005 +testreport-version: 1.1 +timeout: 841.0 +userhost: hpk at code1.codespeak.net +_reprs: {'execution-time': 'float', 'python-version-info': 'tuple', + 'options': 'list', 'timeout': 'float', 'pypy-revision': 'int', + 'exit status': 'int'} + +--===============5058098551307329897== +Content-Type: text/plain; charset="us-ascii" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Content-Disposition: attachment; filename="stdout" -============================================================ -faking -faking -faking -faking -faking -faking test_days (__main__.CalendarTestCase) ... ok test_enumerateweekdays (__main__.CalendarTestCase) ... ok test_isleap (__main__.CalendarTestCase) ... ok @@ -24,9 +31,21 @@ test_setfirstweekday (__main__.CalendarTestCase) ... ok ---------------------------------------------------------------------- -Ran 5 tests in 43.544s +Ran 5 tests in 42.986s OK -========================== closed ========================== -execution time: 53.5435669422 seconds -exit status: 0 + +--===============5058098551307329897== +Content-Type: text/plain; charset="us-ascii" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Content-Disposition: attachment; filename="stderr" + +faking +faking +faking +faking +faking +faking + +--===============5058098551307329897==-- \ No newline at end of file Modified: pypy/testresult/hpk at code1.codespeak.net/test_call.txt ============================================================================== --- pypy/testresult/hpk at code1.codespeak.net/test_call.txt (original) +++ pypy/testresult/hpk at code1.codespeak.net/test_call.txt Mon May 2 02:07:05 2005 @@ -1,21 +1,29 @@ -testreport-version: 1.0 -command: /usr/bin/python /tmp/pypy-autotest-13/pypy-dist/pypy/tool/alarm.py 14415 /tmp/pypy-autotest-13/pypy-dist/pypy/interpreter/py.py /tmp/pypy-autotest-13/pypy-dist/lib-python-2.3.4/test/test_call.py -run by: hpk at code1.codespeak.net -sys.platform: linux2 -sys.version_info: (2, 3, 5, 'final', 0) -cpu model: AMD Opteron(tm) Processor 242 +Content-Type: multipart/mixed; boundary="===============7229174295672245610==" +MIME-Version: 1.0 cpu mhz: 1603.694 -oldstyle: no -pypy-revision: 11680 -startdate: Sun May 1 04:12:50 2005 -timeout: 14415.0 seconds +cpu model: AMD Opteron(tm) Processor 242 +execution-time: 18.2403590679 +exit status: 0 +fspath: /home/hpk/pypy-dist/lib-python/2.3.4/test/test_call.py +options: ['core'] +outcome: OK +platform: linux2 +pypy-revision: 11740 +python-version-info: (2, 3, 5, 'final', 0) +startdate: Mon May 2 00:35:56 2005 +testreport-version: 1.1 +timeout: 961.0 +userhost: hpk at code1.codespeak.net +_reprs: {'execution-time': 'float', 'python-version-info': 'tuple', + 'options': 'list', 'timeout': 'float', 'pypy-revision': 'int', + 'exit status': 'int'} + +--===============7229174295672245610== +Content-Type: text/plain; charset="us-ascii" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Content-Disposition: attachment; filename="stdout" -============================================================ -faking -faking -faking -faking -faking test_oldargs0_0 (__main__.CFunctionCalls) ... ok test_oldargs0_0_ext (__main__.CFunctionCalls) ... ok test_oldargs0_0_kw (__main__.CFunctionCalls) ... ok @@ -45,9 +53,20 @@ test_varargs2_kw (__main__.CFunctionCalls) ... ok ---------------------------------------------------------------------- -Ran 27 tests in 9.645s +Ran 27 tests in 9.342s OK -========================== closed ========================== -execution time: 17.6842250824 seconds -exit status: 0 + +--===============7229174295672245610== +Content-Type: text/plain; charset="us-ascii" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Content-Disposition: attachment; filename="stderr" + +faking +faking +faking +faking +faking + +--===============7229174295672245610==-- \ No newline at end of file Added: pypy/testresult/hpk at code1.codespeak.net/test_cfgparser.txt ============================================================================== --- (empty file) +++ pypy/testresult/hpk at code1.codespeak.net/test_cfgparser.txt Mon May 2 02:07:05 2005 @@ -0,0 +1,312 @@ +Content-Type: multipart/mixed; boundary="===============1710013655550184444==" +MIME-Version: 1.0 +cpu mhz: 1603.694 +cpu model: AMD Opteron(tm) Processor 242 +execution-time: 63.3964099884 +exit status: 1 +fspath: /home/hpk/pypy-dist/lib-python/2.3.4/test/test_cfgparser.py +options: ['core'] +outcome: ERR +platform: linux2 +pypy-revision: 11740 +python-version-info: (2, 3, 5, 'final', 0) +startdate: Mon May 2 00:36:15 2005 +testreport-version: 1.1 +timeout: 961.0 +userhost: hpk at code1.codespeak.net +_reprs: {'execution-time': 'float', 'python-version-info': 'tuple', + 'options': 'list', 'timeout': 'float', 'pypy-revision': 'int', + 'exit status': 'int'} + +--===============1710013655550184444== +Content-Type: text/plain; charset="us-ascii" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Content-Disposition: attachment; filename="stdout" + +test_basic (__main__.ConfigParserTestCase) ... ok +test_boolean (__main__.ConfigParserTestCase) ... ok +test_case_sensitivity (__main__.ConfigParserTestCase) ... ok +test_interpolation (__main__.ConfigParserTestCase) ... ok +test_interpolation_missing_value (__main__.ConfigParserTestCase) ... ok +test_items (__main__.ConfigParserTestCase) ... ok +test_parse_errors (__main__.ConfigParserTestCase) ... ok +test_query_errors (__main__.ConfigParserTestCase) ... ok +test_weird_errors (__main__.ConfigParserTestCase) ... ok +test_write (__main__.ConfigParserTestCase) ... ok +test_basic (__main__.RawConfigParserTestCase) ... ok +test_boolean (__main__.RawConfigParserTestCase) ... ok +test_case_sensitivity (__main__.RawConfigParserTestCase) ... ok +test_interpolation (__main__.RawConfigParserTestCase) ... ok +test_items (__main__.RawConfigParserTestCase) ... ok +test_parse_errors (__main__.RawConfigParserTestCase) ... ok +test_query_errors (__main__.RawConfigParserTestCase) ... ok +test_weird_errors (__main__.RawConfigParserTestCase) ... ok +test_write (__main__.RawConfigParserTestCase) ... ok +test_basic (__main__.SafeConfigParserTestCase) ... ok +test_boolean (__main__.SafeConfigParserTestCase) ... ok +test_case_sensitivity (__main__.SafeConfigParserTestCase) ... ok +test_interpolation (__main__.SafeConfigParserTestCase) ... +--===============1710013655550184444== +Content-Type: text/plain; charset="us-ascii" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Content-Disposition: attachment; filename="stderr" + +faking +faking +faking +faking +faking +faking +faking +faking +faking +Traceback (most recent call last): + File "/home/hpk/pypy-dist/pypy/interpreter/py.py", line 80, in main_ + main.run_file(args[0], space) + File "/home/hpk/pypy-dist/pypy/interpreter/main.py", line 59, in run_file + run_string(istring, filename, space) + File "/home/hpk/pypy-dist/pypy/interpreter/main.py", line 50, in run_string + _run_eval_string(source, filename, space, False) + File "/home/hpk/pypy-dist/pypy/interpreter/main.py", line 39, in _run_eval_string + retval = pycode.exec_code(space, w_globals, w_globals) + File "/home/hpk/pypy-dist/pypy/interpreter/eval.py", line 24, in exec_code + return frame.run() + File "/home/hpk/pypy-dist/pypy/interpreter/eval.py", line 70, in resume + result = self.eval(executioncontext) + File "/home/hpk/pypy-dist/pypy/interpreter/pyframe.py", line 97, in eval + self.dispatch() + File "/home/hpk/pypy-dist/pypy/interpreter/pyopcode.py", line 54, in dispatch + fn(self, oparg) + File "/home/hpk/pypy-dist/pypy/interpreter/pyopcode.py", line 639, in CALL_FUNCTION + w_result = f.space.call_args(w_function, args) + File "/home/hpk/pypy-dist/pypy/objspace/descroperation.py", line 92, in call_args + return w_obj.call_args(args) + File "/home/hpk/pypy-dist/pypy/interpreter/function.py", line 40, in call_args + return frame.run() + File "/home/hpk/pypy-dist/pypy/interpreter/eval.py", line 70, in resume + result = self.eval(executioncontext) + File "/home/hpk/pypy-dist/pypy/interpreter/pyframe.py", line 97, in eval + self.dispatch() + File "/home/hpk/pypy-dist/pypy/interpreter/pyopcode.py", line 54, in dispatch + fn(self, oparg) + File "/home/hpk/pypy-dist/pypy/interpreter/pyopcode.py", line 639, in CALL_FUNCTION + w_result = f.space.call_args(w_function, args) + File "/home/hpk/pypy-dist/pypy/objspace/descroperation.py", line 92, in call_args + return w_obj.call_args(args) + File "/home/hpk/pypy-dist/pypy/interpreter/function.py", line 40, in call_args + return frame.run() + File "/home/hpk/pypy-dist/pypy/interpreter/eval.py", line 70, in resume + result = self.eval(executioncontext) + File "/home/hpk/pypy-dist/pypy/interpreter/pyframe.py", line 97, in eval + self.dispatch() + File "/home/hpk/pypy-dist/pypy/interpreter/pyopcode.py", line 54, in dispatch + fn(self, oparg) + File "/home/hpk/pypy-dist/pypy/interpreter/pyopcode.py", line 639, in CALL_FUNCTION + w_result = f.space.call_args(w_function, args) + File "/home/hpk/pypy-dist/pypy/objspace/descroperation.py", line 92, in call_args + return w_obj.call_args(args) + File "/home/hpk/pypy-dist/pypy/interpreter/function.py", line 40, in call_args + return frame.run() + File "/home/hpk/pypy-dist/pypy/interpreter/eval.py", line 70, in resume + result = self.eval(executioncontext) + File "/home/hpk/pypy-dist/pypy/interpreter/pyframe.py", line 97, in eval + self.dispatch() + File "/home/hpk/pypy-dist/pypy/interpreter/pyopcode.py", line 54, in dispatch + fn(self, oparg) + File "/home/hpk/pypy-dist/pypy/interpreter/pyopcode.py", line 639, in CALL_FUNCTION + w_result = f.space.call_args(w_function, args) + File "/home/hpk/pypy-dist/pypy/objspace/descroperation.py", line 99, in call_args + return space.get_and_call_args(w_descr, w_obj, args) + File "/home/hpk/pypy-dist/pypy/objspace/descroperation.py", line 80, in get_and_call_args + return descr.call_args(args.prepend(w_obj)) + File "/home/hpk/pypy-dist/pypy/interpreter/function.py", line 40, in call_args + return frame.run() + File "/home/hpk/pypy-dist/pypy/interpreter/gateway.py", line 249, in run + w_result = self._run() + File "", line 3, in _run_UWS_Method_Arguments + File "/home/hpk/pypy-dist/pypy/interpreter/function.py", line 199, in descr_method_call + return self.call_args(__args__) + File "/home/hpk/pypy-dist/pypy/interpreter/function.py", line 182, in call_args + return space.call_args(self.w_function, args) + File "/home/hpk/pypy-dist/pypy/objspace/descroperation.py", line 92, in call_args + return w_obj.call_args(args) + File "/home/hpk/pypy-dist/pypy/interpreter/function.py", line 40, in call_args + return frame.run() + File "/home/hpk/pypy-dist/pypy/interpreter/eval.py", line 70, in resume + result = self.eval(executioncontext) + File "/home/hpk/pypy-dist/pypy/interpreter/pyframe.py", line 97, in eval + self.dispatch() + File "/home/hpk/pypy-dist/pypy/interpreter/pyopcode.py", line 54, in dispatch + fn(self, oparg) + File "/home/hpk/pypy-dist/pypy/interpreter/pyopcode.py", line 639, in CALL_FUNCTION + w_result = f.space.call_args(w_function, args) + File "/home/hpk/pypy-dist/pypy/objspace/descroperation.py", line 99, in call_args + return space.get_and_call_args(w_descr, w_obj, args) + File "/home/hpk/pypy-dist/pypy/objspace/descroperation.py", line 80, in get_and_call_args + return descr.call_args(args.prepend(w_obj)) + File "/home/hpk/pypy-dist/pypy/interpreter/function.py", line 40, in call_args + return frame.run() + File "/home/hpk/pypy-dist/pypy/interpreter/eval.py", line 70, in resume + result = self.eval(executioncontext) + File "/home/hpk/pypy-dist/pypy/interpreter/pyframe.py", line 97, in eval + self.dispatch() + File "/home/hpk/pypy-dist/pypy/interpreter/pyopcode.py", line 54, in dispatch + fn(self, oparg) + File "/home/hpk/pypy-dist/pypy/interpreter/pyopcode.py", line 639, in CALL_FUNCTION + w_result = f.space.call_args(w_function, args) + File "/home/hpk/pypy-dist/pypy/objspace/descroperation.py", line 99, in call_args + return space.get_and_call_args(w_descr, w_obj, args) + File "/home/hpk/pypy-dist/pypy/objspace/descroperation.py", line 80, in get_and_call_args + return descr.call_args(args.prepend(w_obj)) + File "/home/hpk/pypy-dist/pypy/interpreter/function.py", line 40, in call_args + return frame.run() + File "/home/hpk/pypy-dist/pypy/interpreter/eval.py", line 70, in resume + result = self.eval(executioncontext) + File "/home/hpk/pypy-dist/pypy/interpreter/pyframe.py", line 97, in eval + self.dispatch() + File "/home/hpk/pypy-dist/pypy/interpreter/pyopcode.py", line 54, in dispatch + fn(self, oparg) + File "/home/hpk/pypy-dist/pypy/interpreter/pyopcode.py", line 639, in CALL_FUNCTION + w_result = f.space.call_args(w_function, args) + File "/home/hpk/pypy-dist/pypy/objspace/descroperation.py", line 99, in call_args + return space.get_and_call_args(w_descr, w_obj, args) + File "/home/hpk/pypy-dist/pypy/objspace/descroperation.py", line 80, in get_and_call_args + return descr.call_args(args.prepend(w_obj)) + File "/home/hpk/pypy-dist/pypy/interpreter/function.py", line 40, in call_args + return frame.run() + File "/home/hpk/pypy-dist/pypy/interpreter/eval.py", line 70, in resume + result = self.eval(executioncontext) + File "/home/hpk/pypy-dist/pypy/interpreter/pyframe.py", line 97, in eval + self.dispatch() + File "/home/hpk/pypy-dist/pypy/interpreter/pyopcode.py", line 54, in dispatch + fn(self, oparg) + File "/home/hpk/pypy-dist/pypy/interpreter/pyopcode.py", line 639, in CALL_FUNCTION + w_result = f.space.call_args(w_function, args) + File "/home/hpk/pypy-dist/pypy/objspace/descroperation.py", line 99, in call_args + return space.get_and_call_args(w_descr, w_obj, args) + File "/home/hpk/pypy-dist/pypy/objspace/descroperation.py", line 80, in get_and_call_args + return descr.call_args(args.prepend(w_obj)) + File "/home/hpk/pypy-dist/pypy/interpreter/function.py", line 40, in call_args + return frame.run() + File "/home/hpk/pypy-dist/pypy/interpreter/gateway.py", line 249, in run + w_result = self._run() + File "", line 3, in _run_UWS_Method_Arguments + File "/home/hpk/pypy-dist/pypy/interpreter/function.py", line 199, in descr_method_call + return self.call_args(__args__) + File "/home/hpk/pypy-dist/pypy/interpreter/function.py", line 182, in call_args + return space.call_args(self.w_function, args) + File "/home/hpk/pypy-dist/pypy/objspace/descroperation.py", line 92, in call_args + return w_obj.call_args(args) + File "/home/hpk/pypy-dist/pypy/interpreter/function.py", line 40, in call_args + return frame.run() + File "/home/hpk/pypy-dist/pypy/interpreter/eval.py", line 70, in resume + result = self.eval(executioncontext) + File "/home/hpk/pypy-dist/pypy/interpreter/pyframe.py", line 97, in eval + self.dispatch() + File "/home/hpk/pypy-dist/pypy/interpreter/pyopcode.py", line 54, in dispatch + fn(self, oparg) + File "/home/hpk/pypy-dist/pypy/interpreter/pyopcode.py", line 639, in CALL_FUNCTION + w_result = f.space.call_args(w_function, args) + File "/home/hpk/pypy-dist/pypy/objspace/descroperation.py", line 99, in call_args + return space.get_and_call_args(w_descr, w_obj, args) + File "/home/hpk/pypy-dist/pypy/objspace/descroperation.py", line 80, in get_and_call_args + return descr.call_args(args.prepend(w_obj)) + File "/home/hpk/pypy-dist/pypy/interpreter/function.py", line 40, in call_args + return frame.run() + File "/home/hpk/pypy-dist/pypy/interpreter/gateway.py", line 249, in run + w_result = self._run() + File "", line 3, in _run_UWS_Method_Arguments + File "/home/hpk/pypy-dist/pypy/interpreter/function.py", line 199, in descr_method_call + return self.call_args(__args__) + File "/home/hpk/pypy-dist/pypy/interpreter/function.py", line 182, in call_args + return space.call_args(self.w_function, args) + File "/home/hpk/pypy-dist/pypy/objspace/descroperation.py", line 92, in call_args + return w_obj.call_args(args) + File "/home/hpk/pypy-dist/pypy/interpreter/function.py", line 40, in call_args + return frame.run() + File "/home/hpk/pypy-dist/pypy/interpreter/eval.py", line 70, in resume + result = self.eval(executioncontext) + File "/home/hpk/pypy-dist/pypy/interpreter/pyframe.py", line 97, in eval + self.dispatch() + File "/home/hpk/pypy-dist/pypy/interpreter/pyopcode.py", line 54, in dispatch + fn(self, oparg) + File "/home/hpk/pypy-dist/pypy/interpreter/pyopcode.py", line 639, in CALL_FUNCTION + w_result = f.space.call_args(w_function, args) + File "/home/hpk/pypy-dist/pypy/objspace/descroperation.py", line 99, in call_args + return space.get_and_call_args(w_descr, w_obj, args) + File "/home/hpk/pypy-dist/pypy/objspace/descroperation.py", line 80, in get_and_call_args + return descr.call_args(args.prepend(w_obj)) + File "/home/hpk/pypy-dist/pypy/interpreter/function.py", line 40, in call_args + return frame.run() + File "/home/hpk/pypy-dist/pypy/interpreter/gateway.py", line 249, in run + w_result = self._run() + File "", line 3, in _run_UWS_Method_Arguments + File "/home/hpk/pypy-dist/pypy/interpreter/function.py", line 199, in descr_method_call + return self.call_args(__args__) + File "/home/hpk/pypy-dist/pypy/interpreter/function.py", line 182, in call_args + return space.call_args(self.w_function, args) + File "/home/hpk/pypy-dist/pypy/objspace/descroperation.py", line 92, in call_args + return w_obj.call_args(args) + File "/home/hpk/pypy-dist/pypy/interpreter/function.py", line 40, in call_args + return frame.run() + File "/home/hpk/pypy-dist/pypy/interpreter/eval.py", line 70, in resume + result = self.eval(executioncontext) + File "/home/hpk/pypy-dist/pypy/interpreter/pyframe.py", line 97, in eval + self.dispatch() + File "/home/hpk/pypy-dist/pypy/interpreter/pyopcode.py", line 54, in dispatch + fn(self, oparg) + File "/home/hpk/pypy-dist/pypy/interpreter/pyopcode.py", line 639, in CALL_FUNCTION + w_result = f.space.call_args(w_function, args) + File "/home/hpk/pypy-dist/pypy/objspace/descroperation.py", line 99, in call_args + return space.get_and_call_args(w_descr, w_obj, args) + File "/home/hpk/pypy-dist/pypy/objspace/descroperation.py", line 80, in get_and_call_args + return descr.call_args(args.prepend(w_obj)) + File "/home/hpk/pypy-dist/pypy/interpreter/function.py", line 40, in call_args + return frame.run() + File "/home/hpk/pypy-dist/pypy/interpreter/gateway.py", line 249, in run + w_result = self._run() + File "", line 3, in _run_UWS_Method_Arguments + File "/home/hpk/pypy-dist/pypy/interpreter/function.py", line 199, in descr_method_call + return self.call_args(__args__) + File "/home/hpk/pypy-dist/pypy/interpreter/function.py", line 182, in call_args + return space.call_args(self.w_function, args) + File "/home/hpk/pypy-dist/pypy/objspace/descroperation.py", line 92, in call_args + return w_obj.call_args(args) + File "/home/hpk/pypy-dist/pypy/interpreter/function.py", line 40, in call_args + return frame.run() + File "/home/hpk/pypy-dist/pypy/interpreter/eval.py", line 70, in resume + result = self.eval(executioncontext) + File "/home/hpk/pypy-dist/pypy/interpreter/pyframe.py", line 97, in eval + self.dispatch() + File "/home/hpk/pypy-dist/pypy/interpreter/pyopcode.py", line 54, in dispatch + fn(self, oparg) + File "/home/hpk/pypy-dist/pypy/interpreter/pyopcode.py", line 499, in LOAD_ATTR + w_value = f.space.getattr(w_obj, w_attributename) + File "/home/hpk/pypy-dist/pypy/objspace/descroperation.py", line 126, in getattr + return space.get_and_call_function(w_descr, w_obj, w_name) + File "/home/hpk/pypy-dist/pypy/objspace/descroperation.py", line 87, in get_and_call_function + return space.get_and_call_args(w_descr, w_obj, args) + File "/home/hpk/pypy-dist/pypy/objspace/descroperation.py", line 80, in get_and_call_args + return descr.call_args(args.prepend(w_obj)) + File "/home/hpk/pypy-dist/pypy/interpreter/function.py", line 40, in call_args + return frame.run() + File "/home/hpk/pypy-dist/pypy/interpreter/gateway.py", line 249, in run + w_result = self._run() + File "", line 3, in _run_UWS_ObjSpace_W_Root_W_Root + File "/home/hpk/pypy-dist/pypy/objspace/descroperation.py", line 28, in descr__getattribute__ + return space.get(w_descr, w_obj) + File "/home/hpk/pypy-dist/pypy/objspace/descroperation.py", line 107, in get + return space.get_and_call_function(w_get, w_descr, w_obj, w_type) + File "/home/hpk/pypy-dist/pypy/objspace/descroperation.py", line 87, in get_and_call_function + return space.get_and_call_args(w_descr, w_obj, args) + File "/home/hpk/pypy-dist/pypy/objspace/descroperation.py", line 80, in get_and_call_args + return descr.call_args(args.prepend(w_obj)) + File "/home/hpk/pypy-dist/pypy/interpreter/function.py", line 39, in call_args + frame.setfastscope(scope_w) + File "/home/hpk/pypy-dist/pypy/objspace/std/fake.py", line 135, in setfastscope + raise UnwrapError('calling %s: %s' % (self.code.cpy_callable, e)) +pypy.objspace.std.model.UnwrapError: calling : cannot unwrap > + +--===============1710013655550184444==-- \ No newline at end of file Modified: pypy/testresult/hpk at code1.codespeak.net/test_cgi.txt ============================================================================== --- pypy/testresult/hpk at code1.codespeak.net/test_cgi.txt (original) +++ pypy/testresult/hpk at code1.codespeak.net/test_cgi.txt Mon May 2 02:07:05 2005 @@ -1,18 +1,64 @@ -testreport-version: 1.0 -command: /usr/bin/python /tmp/pypy-autotest-13/pypy-dist/pypy/tool/alarm.py 13499 /tmp/pypy-autotest-13/pypy-dist/pypy/interpreter/py.py /tmp/pypy-autotest-13/pypy-dist/lib-python-2.3.4/test/test_cgi.py -run by: hpk at code1.codespeak.net -sys.platform: linux2 -sys.version_info: (2, 3, 5, 'final', 0) -cpu model: AMD Opteron(tm) Processor 242 +Content-Type: multipart/mixed; boundary="===============6264442802913131232==" +MIME-Version: 1.0 cpu mhz: 1603.694 -oldstyle: no -pypy-revision: 11680 -startdate: Sun May 1 04:13:08 2005 -timeout: 13500.0 seconds +cpu model: AMD Opteron(tm) Processor 242 +execution-time: 46.223664999 +exit status: 0 +fspath: /home/hpk/pypy-dist/lib-python/2.3.4/test/test_cgi.py +options: ['core'] +outcome: OK +platform: linux2 +pypy-revision: 11740 +python-version-info: (2, 3, 5, 'final', 0) +startdate: Mon May 2 00:37:19 2005 +testreport-version: 1.1 +timeout: 900.0 +userhost: hpk at code1.codespeak.net +_reprs: {'execution-time': 'float', 'python-version-info': 'tuple', + 'options': 'list', 'timeout': 'float', 'pypy-revision': 'int', + 'exit status': 'int'} + +--===============6264442802913131232== +Content-Type: text/plain; charset="us-ascii" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Content-Disposition: attachment; filename="stdout" + +'' +'&' +'&&' +';' +';&;' +'=' +'=&=' +'=;=' +'=a' +'&=a' +'=a&' +'=&a' +'b=a' +'b+=a' +'a=b=a' +'a=+b=a' +'&b=a' +'b&=a' +'a=a+b&b=b+c' +'a=a+b&a=b+a' +'x=1&y=2.0&z=2-3.%2b0' +'x=1;y=2.0&z=2-3.%2b0' +'x=1;y=2.0;z=2-3.%2b0' +'Hbc5161168c542333633315dee1182227:key_store_seqid=400006&cuyer=r&view=bustomer&order_id=0bb2e248638833d48cb7fed300000f1b&expire=964546263&lobale=en-US&kid=130003.300038&ss=env' +'group_id=5470&set=custom&_assigned_to=31392&_status=1&_category=100&SUBMIT=Browse' +Testing log +Testing initlog 1 +Testing log 2 + +--===============6264442802913131232== +Content-Type: text/plain; charset="us-ascii" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Content-Disposition: attachment; filename="stderr" -OUTPUT TEST -see output in: /tmp/pypy-autotest-13/pypy-dist/lib-python-2.3.4/test/result/hpk at code1.codespeak.net/test_cgi.out -============================================================ faking faking faking @@ -21,7 +67,5 @@ faking faking faking -OK -========================== closed ========================== -execution time: 45.5601921082 seconds -exit status: 0 + +--===============6264442802913131232==-- \ No newline at end of file Added: pypy/testresult/hpk at code1.codespeak.net/test_class.txt ============================================================================== --- (empty file) +++ pypy/testresult/hpk at code1.codespeak.net/test_class.txt Mon May 2 02:07:05 2005 @@ -0,0 +1,154 @@ +Content-Type: multipart/mixed; boundary="===============5965058655176433704==" +MIME-Version: 1.0 +cpu mhz: 1603.694 +cpu model: AMD Opteron(tm) Processor 242 +execution-time: 77.8759458065 +exit status: 2 +fspath: /home/hpk/pypy-dist/lib-python/modified-2.3.4/test/test_class.py +options: ['oldstyle', 'core'] +outcome: ERROUT +platform: linux2 +pypy-revision: 11740 +python-version-info: (2, 3, 5, 'final', 0) +startdate: Mon May 2 00:38:06 2005 +testreport-version: 1.1 +timeout: 900.0 +userhost: hpk at code1.codespeak.net +_reprs: {'execution-time': 'float', 'python-version-info': 'tuple', + 'options': 'list', 'timeout': 'float', 'pypy-revision': 'int', + 'exit status': 'int'} + +--===============5965058655176433704== +Content-Type: text/plain; charset="us-ascii" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Content-Disposition: attachment; filename="stdout" + +__init__: () +__coerce__: (1,) +__add__: (1,) +__coerce__: (1,) +__radd__: (1,) +__coerce__: (1,) +__sub__: (1,) +__coerce__: (1,) +__rsub__: (1,) +__coerce__: (1,) +__mul__: (1,) +__coerce__: (1,) +__rmul__: (1,) +__coerce__: (1,) +__div__: (1,) +__coerce__: (1,) +__rdiv__: (1,) +__coerce__: (1,) +__mod__: (1,) +__coerce__: (1,) +__rmod__: (1,) +__coerce__: (1,) +__divmod__: (1,) +__coerce__: (1,) +__rdivmod__: (1,) +__coerce__: (1,) +__pow__: (1,) +__coerce__: (1,) +__rpow__: (1,) +__coerce__: (1,) +__rshift__: (1,) +__coerce__: (1,) +__rrshift__: (1,) +__coerce__: (1,) +__lshift__: (1,) +__coerce__: (1,) +__rlshift__: (1,) +__coerce__: (1,) +__and__: (1,) +__coerce__: (1,) +__rand__: (1,) +__coerce__: (1,) +__or__: (1,) +__coerce__: (1,) +__ror__: (1,) +__coerce__: (1,) +__xor__: (1,) +__coerce__: (1,) +__rxor__: (1,) +__contains__: (1,) +__getitem__: (1,) +__setitem__: (1, 1) +__delitem__: (1,) +__getslice__: (0, 42) +__setslice__: (0, 42, 'The Answer') +__delslice__: (0, 42) +__getitem__: (slice(2, 1024, 10),) +__setitem__: (slice(2, 1024, 10), 'A lot') +__delitem__: (slice(2, 1024, 10),) +__getitem__: ((slice(None, 42, None), Ellipsis, slice(None, 24, None), 24, 100),) +__setitem__: ((slice(None, 42, None), Ellipsis, slice(None, 24, None), 24, 100), 'Strange') +__delitem__: ((slice(None, 42, None), Ellipsis, slice(None, 24, None), 24, 100),) +__getitem__: (slice(0, 42, None),) +__setitem__: (slice(0, 42, None), 'The Answer') +__delitem__: (slice(0, 42, None),) +__neg__: () +__pos__: () +__abs__: () +__int__: () +__long__: () +__float__: () +__oct__: () +__hex__: () +__hash__: () +__repr__: () +__str__: () +__coerce__: (1,) +__cmp__: (1,) +__coerce__: (1,) +__cmp__: (1,) +__coerce__: (1,) +__cmp__: (1,) +__coerce__: (1,) +__cmp__: (1,) +__coerce__: (1,) +__cmp__: (1,) +__coerce__: (1,) +__cmp__: (1,) +__coerce__: (1,) +__cmp__: (1,) +__coerce__: (1,) +__cmp__: (1,) +__coerce__: (1,) +__cmp__: (1,) +__coerce__: (1,) +__cmp__: (1,) +__getattr__: ('spam',) +__setattr__: ('eggs', 'spam, spam, spam and ham') +__delattr__: ('cardinal',) +attribute error for A().a got masked: booh + +--===============5965058655176433704== +Content-Type: text/plain; charset="us-ascii" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Content-Disposition: attachment; filename="stderr" + +faking +faking +faking +faking +faking +faking + +--===============5965058655176433704== +Content-Type: text/plain; charset="us-ascii" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Content-Disposition: attachment; filename="reportdiff" + +********************************************************************** +*** line 98 of expected output missing: +- __del__: () +*** line 101 of actual output doesn't appear in expected output after line 101: ++ attribute error for A().a got masked: booh +********************************************************************** + +--===============5965058655176433704==-- \ No newline at end of file Modified: pypy/testresult/hpk at code1.codespeak.net/test_cmath.txt ============================================================================== --- pypy/testresult/hpk at code1.codespeak.net/test_cmath.txt (original) +++ pypy/testresult/hpk at code1.codespeak.net/test_cmath.txt Mon May 2 02:07:05 2005 @@ -1,21 +1,29 @@ -testreport-version: 1.0 -command: /usr/bin/python /tmp/pypy-autotest-13/pypy-dist/pypy/tool/alarm.py 12615 /tmp/pypy-autotest-13/pypy-dist/pypy/interpreter/py.py /tmp/pypy-autotest-13/pypy-dist/lib-python-2.3.4/test/test_cmath.py -run by: hpk at code1.codespeak.net -sys.platform: linux2 -sys.version_info: (2, 3, 5, 'final', 0) -cpu model: AMD Opteron(tm) Processor 242 +Content-Type: multipart/mixed; boundary="===============5669588818727408309==" +MIME-Version: 1.0 cpu mhz: 1603.694 -oldstyle: no -pypy-revision: 11680 -startdate: Sun May 1 04:14:03 2005 -timeout: 12615.0 seconds +cpu model: AMD Opteron(tm) Processor 242 +execution-time: 24.2312669754 +exit status: 0 +fspath: /home/hpk/pypy-dist/lib-python/2.3.4/test/test_cmath.py +options: ['core'] +outcome: OK +platform: linux2 +pypy-revision: 11740 +python-version-info: (2, 3, 5, 'final', 0) +startdate: Mon May 2 00:39:25 2005 +testreport-version: 1.1 +timeout: 961.0 +userhost: hpk at code1.codespeak.net +_reprs: {'execution-time': 'float', 'python-version-info': 'tuple', + 'options': 'list', 'timeout': 'float', 'pypy-revision': 'int', + 'exit status': 'int'} + +--===============5669588818727408309== +Content-Type: text/plain; charset="us-ascii" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Content-Disposition: attachment; filename="stdout" -============================================================ -faking -faking -faking -faking -faking Calling sinh(1.000000) = 1.175201 Calling asin(1.000000) = 1.570796 Calling asinh(1.000000) = 0.881373 @@ -34,6 +42,17 @@ Calling tan(1.000000) = 1.557407 PI = 3.14159265358 E = 2.71828182845 -========================== closed ========================== -execution time: 23.549849987 seconds -exit status: 0 + +--===============5669588818727408309== +Content-Type: text/plain; charset="us-ascii" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Content-Disposition: attachment; filename="stderr" + +faking +faking +faking +faking +faking + +--===============5669588818727408309==-- \ No newline at end of file Modified: pypy/testresult/hpk at code1.codespeak.net/test_codeop.txt ============================================================================== --- pypy/testresult/hpk at code1.codespeak.net/test_codeop.txt (original) +++ pypy/testresult/hpk at code1.codespeak.net/test_codeop.txt Mon May 2 02:07:05 2005 @@ -1,30 +1,49 @@ -testreport-version: 1.0 -command: /usr/bin/python /tmp/pypy-autotest-13/pypy-dist/pypy/tool/alarm.py 14415 /tmp/pypy-autotest-13/pypy-dist/pypy/interpreter/py.py /tmp/pypy-autotest-13/pypy-dist/lib-python-2.3.4/test/test_codeop.py -run by: hpk at code1.codespeak.net -sys.platform: linux2 -sys.version_info: (2, 3, 5, 'final', 0) -cpu model: AMD Opteron(tm) Processor 242 +Content-Type: multipart/mixed; boundary="===============1392169737164051710==" +MIME-Version: 1.0 cpu mhz: 1603.694 -oldstyle: no -pypy-revision: 11680 -startdate: Sun May 1 04:14:27 2005 -timeout: 14415.0 seconds +cpu model: AMD Opteron(tm) Processor 242 +execution-time: 13.2186632156 +exit status: 0 +fspath: /home/hpk/pypy-dist/lib-python/2.3.4/test/test_codeop.py +options: ['core'] +outcome: OK +platform: linux2 +pypy-revision: 11740 +python-version-info: (2, 3, 5, 'final', 0) +startdate: Mon May 2 00:39:50 2005 +testreport-version: 1.1 +timeout: 900.0 +userhost: hpk at code1.codespeak.net +_reprs: {'execution-time': 'float', 'python-version-info': 'tuple', + 'options': 'list', 'timeout': 'float', 'pypy-revision': 'int', + 'exit status': 'int'} + +--===============1392169737164051710== +Content-Type: text/plain; charset="us-ascii" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Content-Disposition: attachment; filename="stdout" -============================================================ -faking -faking -faking -faking -faking test_filename (__main__.CodeopTests) ... ok test_incomplete (__main__.CodeopTests) ... ok test_invalid (__main__.CodeopTests) ... ok test_valid (__main__.CodeopTests) ... ok ---------------------------------------------------------------------- -Ran 4 tests in 4.616s +Ran 4 tests in 4.623s OK -========================== closed ========================== -execution time: 12.1025059223 seconds -exit status: 0 + +--===============1392169737164051710== +Content-Type: text/plain; charset="us-ascii" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Content-Disposition: attachment; filename="stderr" + +faking +faking +faking +faking +faking + +--===============1392169737164051710==-- \ No newline at end of file Added: pypy/testresult/hpk at code1.codespeak.net/test_coercion.txt ============================================================================== --- (empty file) +++ pypy/testresult/hpk at code1.codespeak.net/test_coercion.txt Mon May 2 02:07:05 2005 @@ -0,0 +1,1020 @@ +Content-Type: multipart/mixed; boundary="===============1485143794627465665==" +MIME-Version: 1.0 +cpu mhz: 1603.694 +cpu model: AMD Opteron(tm) Processor 242 +execution-time: 900.60542798 +exit status: 1 +fspath: /home/hpk/pypy-dist/lib-python/modified-2.3.4/test/test_coercion.py +options: ['oldstyle', 'core'] +outcome: T/O +platform: linux2 +pypy-revision: 11740 +python-version-info: (2, 3, 5, 'final', 0) +startdate: Mon May 2 00:40:04 2005 +testreport-version: 1.1 +timeout: 841.0 +userhost: hpk at code1.codespeak.net +_reprs: {'execution-time': 'float', 'python-version-info': 'tuple', + 'options': 'list', 'timeout': 'float', 'pypy-revision': 'int', + 'exit status': 'int'} + +--===============1485143794627465665== +Content-Type: text/plain; charset="us-ascii" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Content-Disposition: attachment; filename="stdout" + +2 + 2 = 4 +2 += 2 => 4 +2 - 2 = 0 +2 -= 2 => 0 +2 * 2 = 4 +2 *= 2 => 4 +2 / 2 = 1 +2 /= 2 => 1 +2 ** 2 = 4 +2 **= 2 => 4 +2 % 2 = 0 +2 %= 2 => 0 +2 + 4.0 = 6.0 +2 += 4.0 => 6.0 +2 - 4.0 = -2.0 +2 -= 4.0 => -2.0 +2 * 4.0 = 8.0 +2 *= 4.0 => 8.0 +2 / 4.0 = 0.5 +2 /= 4.0 => 0.5 +2 ** 4.0 = 16.0 +2 **= 4.0 => 16.0 +2 % 4.0 = 2.0 +2 %= 4.0 => 2.0 +2 + 2 = 4 +2 += 2 => 4 +2 - 2 = 0 +2 -= 2 => 0 +2 * 2 = 4 +2 *= 2 => 4 +2 / 2 = 1 +2 /= 2 => 1 +2 ** 2 = 4 +2 **= 2 => 4 +2 % 2 = 0 +2 %= 2 => 0 +2 + (2+0j) = (4+0j) +2 += (2+0j) => (4+0j) +2 - (2+0j) = 0j +2 -= (2+0j) => 0j +2 * (2+0j) = (4+0j) +2 *= (2+0j) => (4+0j) +2 / (2+0j) = (1+0j) +2 /= (2+0j) => (1+0j) +2 ** (2+0j) = (4+0j) +2 **= (2+0j) => (4+0j) +2 % (2+0j) = 0j +2 %= (2+0j) => 0j +2 + [1] ... exceptions.TypeError +2 += [1] ... exceptions.TypeError +2 - [1] ... exceptions.TypeError +2 -= [1] ... exceptions.TypeError +2 * [1] = [1, 1] +2 *= [1] => [1, 1] +2 / [1] ... exceptions.TypeError +2 /= [1] ... exceptions.TypeError +2 ** [1] ... exceptions.TypeError +2 **= [1] ... exceptions.TypeError +2 % [1] ... exceptions.TypeError +2 %= [1] ... exceptions.TypeError +2 + (2,) ... exceptions.TypeError +2 += (2,) ... exceptions.TypeError +2 - (2,) ... exceptions.TypeError +2 -= (2,) ... exceptions.TypeError +2 * (2,) = (2, 2) +2 *= (2,) => (2, 2) +2 / (2,) ... exceptions.TypeError +2 /= (2,) ... exceptions.TypeError +2 ** (2,) ... exceptions.TypeError +2 **= (2,) ... exceptions.TypeError +2 % (2,) ... exceptions.TypeError +2 %= (2,) ... exceptions.TypeError +2 + None ... exceptions.TypeError +2 += None ... exceptions.TypeError +2 - None ... exceptions.TypeError +2 -= None ... exceptions.TypeError +2 * None ... exceptions.TypeError +2 *= None ... exceptions.TypeError +2 / None ... exceptions.TypeError +2 /= None ... exceptions.TypeError +2 ** None ... exceptions.TypeError +2 **= None ... exceptions.TypeError +2 % None ... exceptions.TypeError +2 %= None ... exceptions.TypeError +2 + = 3 +2 += => 3 +2 - = 1 +2 -= => 1 +2 * = 2 +2 *= => 2 +2 / = 2 +2 /= => 2 +2 ** = 2 +2 **= => 2 +2 % = 0 +2 %= => 0 +2 + = 4 +2 += => 4 +2 - = 0 +2 -= => 0 +2 * = 4 +2 *= => 4 +2 / = 1 +2 /= => 1 +2 ** = 4 +2 **= => 4 +2 % = 0 +2 %= => 0 +4.0 + 2 = 6.0 +4.0 += 2 => 6.0 +4.0 - 2 = 2.0 +4.0 -= 2 => 2.0 +4.0 * 2 = 8.0 +4.0 *= 2 => 8.0 +4.0 / 2 = 2.0 +4.0 /= 2 => 2.0 +4.0 ** 2 = 16.0 +4.0 **= 2 => 16.0 +4.0 % 2 = 0.0 +4.0 %= 2 => 0.0 +4.0 + 4.0 = 8.0 +4.0 += 4.0 => 8.0 +4.0 - 4.0 = 0.0 +4.0 -= 4.0 => 0.0 +4.0 * 4.0 = 16.0 +4.0 *= 4.0 => 16.0 +4.0 / 4.0 = 1.0 +4.0 /= 4.0 => 1.0 +4.0 ** 4.0 = 256.0 +4.0 **= 4.0 => 256.0 +4.0 % 4.0 = 0.0 +4.0 %= 4.0 => 0.0 +4.0 + 2 = 6.0 +4.0 += 2 => 6.0 +4.0 - 2 = 2.0 +4.0 -= 2 => 2.0 +4.0 * 2 = 8.0 +4.0 *= 2 => 8.0 +4.0 / 2 = 2.0 +4.0 /= 2 => 2.0 +4.0 ** 2 = 16.0 +4.0 **= 2 => 16.0 +4.0 % 2 = 0.0 +4.0 %= 2 => 0.0 +4.0 + (2+0j) = (6+0j) +4.0 += (2+0j) => (6+0j) +4.0 - (2+0j) = (2+0j) +4.0 -= (2+0j) => (2+0j) +4.0 * (2+0j) = (8+0j) +4.0 *= (2+0j) => (8+0j) +4.0 / (2+0j) = (2+0j) +4.0 /= (2+0j) => (2+0j) +4.0 ** (2+0j) = (16+0j) +4.0 **= (2+0j) => (16+0j) +4.0 % (2+0j) = 0j +4.0 %= (2+0j) => 0j +4.0 + [1] ... exceptions.TypeError +4.0 += [1] ... exceptions.TypeError +4.0 - [1] ... exceptions.TypeError +4.0 -= [1] ... exceptions.TypeError +4.0 * [1] ... exceptions.TypeError +4.0 *= [1] ... exceptions.TypeError +4.0 / [1] ... exceptions.TypeError +4.0 /= [1] ... exceptions.TypeError +4.0 ** [1] ... exceptions.TypeError +4.0 **= [1] ... exceptions.TypeError +4.0 % [1] ... exceptions.TypeError +4.0 %= [1] ... exceptions.TypeError +4.0 + (2,) ... exceptions.TypeError +4.0 += (2,) ... exceptions.TypeError +4.0 - (2,) ... exceptions.TypeError +4.0 -= (2,) ... exceptions.TypeError +4.0 * (2,) ... exceptions.TypeError +4.0 *= (2,) ... exceptions.TypeError +4.0 / (2,) ... exceptions.TypeError +4.0 /= (2,) ... exceptions.TypeError +4.0 ** (2,) ... exceptions.TypeError +4.0 **= (2,) ... exceptions.TypeError +4.0 % (2,) ... exceptions.TypeError +4.0 %= (2,) ... exceptions.TypeError +4.0 + None ... exceptions.TypeError +4.0 += None ... exceptions.TypeError +4.0 - None ... exceptions.TypeError +4.0 -= None ... exceptions.TypeError +4.0 * None ... exceptions.TypeError +4.0 *= None ... exceptions.TypeError +4.0 / None ... exceptions.TypeError +4.0 /= None ... exceptions.TypeError +4.0 ** None ... exceptions.TypeError +4.0 **= None ... exceptions.TypeError +4.0 % None ... exceptions.TypeError +4.0 %= None ... exceptions.TypeError +4.0 + = 5.0 +4.0 += => 5.0 +4.0 - = 3.0 +4.0 -= => 3.0 +4.0 * = 4.0 +4.0 *= => 4.0 +4.0 / = 4.0 +4.0 /= => 4.0 +4.0 ** = 4.0 +4.0 **= => 4.0 +4.0 % = 0.0 +4.0 %= => 0.0 +4.0 + = 6.0 +4.0 += => 6.0 +4.0 - = 2.0 +4.0 -= => 2.0 +4.0 * = 8.0 +4.0 *= => 8.0 +4.0 / = 2.0 +4.0 /= => 2.0 +4.0 ** = 16.0 +4.0 **= => 16.0 +4.0 % = 0.0 +4.0 %= => 0.0 +2 + 2 = 4 +2 += 2 => 4 +2 - 2 = 0 +2 -= 2 => 0 +2 * 2 = 4 +2 *= 2 => 4 +2 / 2 = 1 +2 /= 2 => 1 +2 ** 2 = 4 +2 **= 2 => 4 +2 % 2 = 0 +2 %= 2 => 0 +2 + 4.0 = 6.0 +2 += 4.0 => 6.0 +2 - 4.0 = -2.0 +2 -= 4.0 => -2.0 +2 * 4.0 = 8.0 +2 *= 4.0 => 8.0 +2 / 4.0 = 0.5 +2 /= 4.0 => 0.5 +2 ** 4.0 = 16.0 +2 **= 4.0 => 16.0 +2 % 4.0 = 2.0 +2 %= 4.0 => 2.0 +2 + 2 = 4 +2 += 2 => 4 +2 - 2 = 0 +2 -= 2 => 0 +2 * 2 = 4 +2 *= 2 => 4 +2 / 2 = 1 +2 /= 2 => 1 +2 ** 2 = 4 +2 **= 2 => 4 +2 % 2 = 0 +2 %= 2 => 0 +2 + (2+0j) = (4+0j) +2 += (2+0j) => (4+0j) +2 - (2+0j) = 0j +2 -= (2+0j) => 0j +2 * (2+0j) = (4+0j) +2 *= (2+0j) => (4+0j) +2 / (2+0j) = (1+0j) +2 /= (2+0j) => (1+0j) +2 ** (2+0j) = (4+0j) +2 **= (2+0j) => (4+0j) +2 % (2+0j) = 0j +2 %= (2+0j) => 0j +2 + [1] ... exceptions.TypeError +2 += [1] ... exceptions.TypeError +2 - [1] ... exceptions.TypeError +2 -= [1] ... exceptions.TypeError +2 * [1] = [1, 1] +2 *= [1] => [1, 1] +2 / [1] ... exceptions.TypeError +2 /= [1] ... exceptions.TypeError +2 ** [1] ... exceptions.TypeError +2 **= [1] ... exceptions.TypeError +2 % [1] ... exceptions.TypeError +2 %= [1] ... exceptions.TypeError +2 + (2,) ... exceptions.TypeError +2 += (2,) ... exceptions.TypeError +2 - (2,) ... exceptions.TypeError +2 -= (2,) ... exceptions.TypeError +2 * (2,) = (2, 2) +2 *= (2,) => (2, 2) +2 / (2,) ... exceptions.TypeError +2 /= (2,) ... exceptions.TypeError +2 ** (2,) ... exceptions.TypeError +2 **= (2,) ... exceptions.TypeError +2 % (2,) ... exceptions.TypeError +2 %= (2,) ... exceptions.TypeError +2 + None ... exceptions.TypeError +2 += None ... exceptions.TypeError +2 - None ... exceptions.TypeError +2 -= None ... exceptions.TypeError +2 * None ... exceptions.TypeError +2 *= None ... exceptions.TypeError +2 / None ... exceptions.TypeError +2 /= None ... exceptions.TypeError +2 ** None ... exceptions.TypeError +2 **= None ... exceptions.TypeError +2 % None ... exceptions.TypeError +2 %= None ... exceptions.TypeError +2 + = 3 +2 += => 3 +2 - = 1 +2 -= => 1 +2 * = 2 +2 *= => 2 +2 / = 2 +2 /= => 2 +2 ** = 2 +2 **= => 2 +2 % = 0 +2 %= => 0 +2 + = 4 +2 += => 4 +2 - = 0 +2 -= => 0 +2 * = 4 +2 *= => 4 +2 / = 1 +2 /= => 1 +2 ** = 4 +2 **= => 4 +2 % = 0 +2 %= => 0 +(2+0j) + 2 = (4+0j) +(2+0j) += 2 => (4+0j) +(2+0j) - 2 = 0j +(2+0j) -= 2 => 0j +(2+0j) * 2 = (4+0j) +(2+0j) *= 2 => (4+0j) +(2+0j) / 2 = (1+0j) +(2+0j) /= 2 => (1+0j) +(2+0j) ** 2 = (4+0j) +(2+0j) **= 2 => (4+0j) +(2+0j) % 2 = 0j +(2+0j) %= 2 => 0j +(2+0j) + 4.0 = (6+0j) +(2+0j) += 4.0 => (6+0j) +(2+0j) - 4.0 = (-2+0j) +(2+0j) -= 4.0 => (-2+0j) +(2+0j) * 4.0 = (8+0j) +(2+0j) *= 4.0 => (8+0j) +(2+0j) / 4.0 = (0.5+0j) +(2+0j) /= 4.0 => (0.5+0j) +(2+0j) ** 4.0 = (16+0j) +(2+0j) **= 4.0 => (16+0j) +(2+0j) % 4.0 = (2+0j) +(2+0j) %= 4.0 => (2+0j) +(2+0j) + 2 = (4+0j) +(2+0j) += 2 => (4+0j) +(2+0j) - 2 = 0j +(2+0j) -= 2 => 0j +(2+0j) * 2 = (4+0j) +(2+0j) *= 2 => (4+0j) +(2+0j) / 2 = (1+0j) +(2+0j) /= 2 => (1+0j) +(2+0j) ** 2 = (4+0j) +(2+0j) **= 2 => (4+0j) +(2+0j) % 2 = 0j +(2+0j) %= 2 => 0j +(2+0j) + (2+0j) = (4+0j) +(2+0j) += (2+0j) => (4+0j) +(2+0j) - (2+0j) = 0j +(2+0j) -= (2+0j) => 0j +(2+0j) * (2+0j) = (4+0j) +(2+0j) *= (2+0j) => (4+0j) +(2+0j) / (2+0j) = (1+0j) +(2+0j) /= (2+0j) => (1+0j) +(2+0j) ** (2+0j) = (4+0j) +(2+0j) **= (2+0j) => (4+0j) +(2+0j) % (2+0j) = 0j +(2+0j) %= (2+0j) => 0j +(2+0j) + [1] ... exceptions.TypeError +(2+0j) += [1] ... exceptions.TypeError +(2+0j) - [1] ... exceptions.TypeError +(2+0j) -= [1] ... exceptions.TypeError +(2+0j) * [1] ... exceptions.TypeError +(2+0j) *= [1] ... exceptions.TypeError +(2+0j) / [1] ... exceptions.TypeError +(2+0j) /= [1] ... exceptions.TypeError +(2+0j) ** [1] ... exceptions.TypeError +(2+0j) **= [1] ... exceptions.TypeError +(2+0j) % [1] ... exceptions.TypeError +(2+0j) %= [1] ... exceptions.TypeError +(2+0j) + (2,) ... exceptions.TypeError +(2+0j) += (2,) ... exceptions.TypeError +(2+0j) - (2,) ... exceptions.TypeError +(2+0j) -= (2,) ... exceptions.TypeError +(2+0j) * (2,) ... exceptions.TypeError +(2+0j) *= (2,) ... exceptions.TypeError +(2+0j) / (2,) ... exceptions.TypeError +(2+0j) /= (2,) ... exceptions.TypeError +(2+0j) ** (2,) ... exceptions.TypeError +(2+0j) **= (2,) ... exceptions.TypeError +(2+0j) % (2,) ... exceptions.TypeError +(2+0j) %= (2,) ... exceptions.TypeError +(2+0j) + None ... exceptions.TypeError +(2+0j) += None ... exceptions.TypeError +(2+0j) - None ... exceptions.TypeError +(2+0j) -= None ... exceptions.TypeError +(2+0j) * None ... exceptions.TypeError +(2+0j) *= None ... exceptions.TypeError +(2+0j) / None ... exceptions.TypeError +(2+0j) /= None ... exceptions.TypeError +(2+0j) ** None ... exceptions.TypeError +(2+0j) **= None ... exceptions.TypeError +(2+0j) % None ... exceptions.TypeError +(2+0j) %= None ... exceptions.TypeError +(2+0j) + = (3+0j) +(2+0j) += => (3+0j) +(2+0j) - = (1+0j) +(2+0j) -= => (1+0j) +(2+0j) * = (2+0j) +(2+0j) *= => (2+0j) +(2+0j) / = (2+0j) +(2+0j) /= => (2+0j) +(2+0j) ** = (2+0j) +(2+0j) **= => (2+0j) +(2+0j) % = 0j +(2+0j) %= => 0j +(2+0j) + = (4+0j) +(2+0j) += => (4+0j) +(2+0j) - = 0j +(2+0j) -= => 0j +(2+0j) * = (4+0j) +(2+0j) *= => (4+0j) +(2+0j) / = (1+0j) +(2+0j) /= => (1+0j) +(2+0j) ** = (4+0j) +(2+0j) **= => (4+0j) +(2+0j) % = 0j +(2+0j) %= => 0j +[1] + 2 ... exceptions.TypeError +[1] += 2 ... exceptions.TypeError +[1] - 2 ... exceptions.TypeError +[1] -= 2 ... exceptions.TypeError +[1] * 2 = [1, 1] +[1] *= 2 => [1, 1] +[1] / 2 ... exceptions.TypeError +[1] /= 2 ... exceptions.TypeError +[1] ** 2 ... exceptions.TypeError +[1] **= 2 ... exceptions.TypeError +[1] % 2 ... exceptions.TypeError +[1] %= 2 ... exceptions.TypeError +[1] + 4.0 ... exceptions.TypeError +[1] += 4.0 ... exceptions.TypeError +[1] - 4.0 ... exceptions.TypeError +[1] -= 4.0 ... exceptions.TypeError +[1] * 4.0 ... exceptions.TypeError +[1] *= 4.0 ... exceptions.TypeError +[1] / 4.0 ... exceptions.TypeError +[1] /= 4.0 ... exceptions.TypeError +[1] ** 4.0 ... exceptions.TypeError +[1] **= 4.0 ... exceptions.TypeError +[1] % 4.0 ... exceptions.TypeError +[1] %= 4.0 ... exceptions.TypeError +[1] + 2 ... exceptions.TypeError +[1] += 2 ... exceptions.TypeError +[1] - 2 ... exceptions.TypeError +[1] -= 2 ... exceptions.TypeError +[1] * 2 = [1, 1] +[1] *= 2 => [1, 1] +[1] / 2 ... exceptions.TypeError +[1] /= 2 ... exceptions.TypeError +[1] ** 2 ... exceptions.TypeError +[1] **= 2 ... exceptions.TypeError +[1] % 2 ... exceptions.TypeError +[1] %= 2 ... exceptions.TypeError +[1] + (2+0j) ... exceptions.TypeError +[1] += (2+0j) ... exceptions.TypeError +[1] - (2+0j) ... exceptions.TypeError +[1] -= (2+0j) ... exceptions.TypeError +[1] * (2+0j) ... exceptions.TypeError +[1] *= (2+0j) ... exceptions.TypeError +[1] / (2+0j) ... exceptions.TypeError +[1] /= (2+0j) ... exceptions.TypeError +[1] ** (2+0j) ... exceptions.TypeError +[1] **= (2+0j) ... exceptions.TypeError +[1] % (2+0j) ... exceptions.TypeError +[1] %= (2+0j) ... exceptions.TypeError +[1] + [1] = [1, 1] +[1] += [1] => [1, 1] +[1] - [1] ... exceptions.TypeError +[1] -= [1] ... exceptions.TypeError +[1] * [1] ... exceptions.TypeError +[1] *= [1] ... exceptions.TypeError +[1] / [1] ... exceptions.TypeError +[1] /= [1] ... exceptions.TypeError +[1] ** [1] ... exceptions.TypeError +[1] **= [1] ... exceptions.TypeError +[1] % [1] ... exceptions.TypeError +[1] %= [1] ... exceptions.TypeError +[1] + (2,) ... exceptions.TypeError +[1] += (2,) => [1, 2] +[1] - (2,) ... exceptions.TypeError +[1] -= (2,) ... exceptions.TypeError +[1] * (2,) ... exceptions.TypeError +[1] *= (2,) ... exceptions.TypeError +[1] / (2,) ... exceptions.TypeError +[1] /= (2,) ... exceptions.TypeError +[1] ** (2,) ... exceptions.TypeError +[1] **= (2,) ... exceptions.TypeError +[1] % (2,) ... exceptions.TypeError +[1] %= (2,) ... exceptions.TypeError +[1] + None ... exceptions.TypeError +[1] += None ... exceptions.TypeError +[1] - None ... exceptions.TypeError +[1] -= None ... exceptions.TypeError +[1] * None ... exceptions.TypeError +[1] *= None ... exceptions.TypeError +[1] / None ... exceptions.TypeError +[1] /= None ... exceptions.TypeError +[1] ** None ... exceptions.TypeError +[1] **= None ... exceptions.TypeError +[1] % None ... exceptions.TypeError +[1] %= None ... exceptions.TypeError +[1] + ... exceptions.TypeError +[1] += ... exceptions.TypeError +[1] - ... exceptions.TypeError +[1] -= ... exceptions.TypeError +[1] * = [1] +[1] *= => [1] +[1] / ... exceptions.TypeError +[1] /= ... exceptions.TypeError +[1] ** ... exceptions.TypeError +[1] **= ... exceptions.TypeError +[1] % ... exceptions.TypeError +[1] %= ... exceptions.TypeError +[1] + ... exceptions.TypeError +[1] += ... exceptions.TypeError +[1] - ... exceptions.TypeError +[1] -= ... exceptions.TypeError +[1] * = [1, 1] +[1] *= => [1, 1] +[1] / ... exceptions.TypeError +[1] /= ... exceptions.TypeError +[1] ** ... exceptions.TypeError +[1] **= ... exceptions.TypeError +[1] % ... exceptions.TypeError +[1] %= ... exceptions.TypeError +(2,) + 2 ... exceptions.TypeError +(2,) += 2 ... exceptions.TypeError +(2,) - 2 ... exceptions.TypeError +(2,) -= 2 ... exceptions.TypeError +(2,) * 2 = (2, 2) +(2,) *= 2 => (2, 2) +(2,) / 2 ... exceptions.TypeError +(2,) /= 2 ... exceptions.TypeError +(2,) ** 2 ... exceptions.TypeError +(2,) **= 2 ... exceptions.TypeError +(2,) % 2 ... exceptions.TypeError +(2,) %= 2 ... exceptions.TypeError +(2,) + 4.0 ... exceptions.TypeError +(2,) += 4.0 ... exceptions.TypeError +(2,) - 4.0 ... exceptions.TypeError +(2,) -= 4.0 ... exceptions.TypeError +(2,) * 4.0 ... exceptions.TypeError +(2,) *= 4.0 ... exceptions.TypeError +(2,) / 4.0 ... exceptions.TypeError +(2,) /= 4.0 ... exceptions.TypeError +(2,) ** 4.0 ... exceptions.TypeError +(2,) **= 4.0 ... exceptions.TypeError +(2,) % 4.0 ... exceptions.TypeError +(2,) %= 4.0 ... exceptions.TypeError +(2,) + 2 ... exceptions.TypeError +(2,) += 2 ... exceptions.TypeError +(2,) - 2 ... exceptions.TypeError +(2,) -= 2 ... exceptions.TypeError +(2,) * 2 = (2, 2) +(2,) *= 2 => (2, 2) +(2,) / 2 ... exceptions.TypeError +(2,) /= 2 ... exceptions.TypeError +(2,) ** 2 ... exceptions.TypeError +(2,) **= 2 ... exceptions.TypeError +(2,) % 2 ... exceptions.TypeError +(2,) %= 2 ... exceptions.TypeError +(2,) + (2+0j) ... exceptions.TypeError +(2,) += (2+0j) ... exceptions.TypeError +(2,) - (2+0j) ... exceptions.TypeError +(2,) -= (2+0j) ... exceptions.TypeError +(2,) * (2+0j) ... exceptions.TypeError +(2,) *= (2+0j) ... exceptions.TypeError +(2,) / (2+0j) ... exceptions.TypeError +(2,) /= (2+0j) ... exceptions.TypeError +(2,) ** (2+0j) ... exceptions.TypeError +(2,) **= (2+0j) ... exceptions.TypeError +(2,) % (2+0j) ... exceptions.TypeError +(2,) %= (2+0j) ... exceptions.TypeError +(2,) + [1] ... exceptions.TypeError +(2,) += [1] ... exceptions.TypeError +(2,) - [1] ... exceptions.TypeError +(2,) -= [1] ... exceptions.TypeError +(2,) * [1] ... exceptions.TypeError +(2,) *= [1] ... exceptions.TypeError +(2,) / [1] ... exceptions.TypeError +(2,) /= [1] ... exceptions.TypeError +(2,) ** [1] ... exceptions.TypeError +(2,) **= [1] ... exceptions.TypeError +(2,) % [1] ... exceptions.TypeError +(2,) %= [1] ... exceptions.TypeError +(2,) + (2,) = (2, 2) +(2,) += (2,) => (2, 2) +(2,) - (2,) ... exceptions.TypeError +(2,) -= (2,) ... exceptions.TypeError +(2,) * (2,) ... exceptions.TypeError +(2,) *= (2,) ... exceptions.TypeError +(2,) / (2,) ... exceptions.TypeError +(2,) /= (2,) ... exceptions.TypeError +(2,) ** (2,) ... exceptions.TypeError +(2,) **= (2,) ... exceptions.TypeError +(2,) % (2,) ... exceptions.TypeError +(2,) %= (2,) ... exceptions.TypeError +(2,) + None ... exceptions.TypeError +(2,) += None ... exceptions.TypeError +(2,) - None ... exceptions.TypeError +(2,) -= None ... exceptions.TypeError +(2,) * None ... exceptions.TypeError +(2,) *= None ... exceptions.TypeError +(2,) / None ... exceptions.TypeError +(2,) /= None ... exceptions.TypeError +(2,) ** None ... exceptions.TypeError +(2,) **= None ... exceptions.TypeError +(2,) % None ... exceptions.TypeError +(2,) %= None ... exceptions.TypeError +(2,) + ... exceptions.TypeError +(2,) += ... exceptions.TypeError +(2,) - ... exceptions.TypeError +(2,) -= ... exceptions.TypeError +(2,) * = (2,) +(2,) *= => (2,) +(2,) / ... exceptions.TypeError +(2,) /= ... exceptions.TypeError +(2,) ** ... exceptions.TypeError +(2,) **= ... exceptions.TypeError +(2,) % ... exceptions.TypeError +(2,) %= ... exceptions.TypeError +(2,) + ... exceptions.TypeError +(2,) += ... exceptions.TypeError +(2,) - ... exceptions.TypeError +(2,) -= ... exceptions.TypeError +(2,) * = (2, 2) +(2,) *= => (2, 2) +(2,) / ... exceptions.TypeError +(2,) /= ... exceptions.TypeError +(2,) ** ... exceptions.TypeError +(2,) **= ... exceptions.TypeError +(2,) % ... exceptions.TypeError +(2,) %= ... exceptions.TypeError +None + 2 ... exceptions.TypeError +None += 2 ... exceptions.TypeError +None - 2 ... exceptions.TypeError +None -= 2 ... exceptions.TypeError +None * 2 ... exceptions.TypeError +None *= 2 ... exceptions.TypeError +None / 2 ... exceptions.TypeError +None /= 2 ... exceptions.TypeError +None ** 2 ... exceptions.TypeError +None **= 2 ... exceptions.TypeError +None % 2 ... exceptions.TypeError +None %= 2 ... exceptions.TypeError +None + 4.0 ... exceptions.TypeError +None += 4.0 ... exceptions.TypeError +None - 4.0 ... exceptions.TypeError +None -= 4.0 ... exceptions.TypeError +None * 4.0 ... exceptions.TypeError +None *= 4.0 ... exceptions.TypeError +None / 4.0 ... exceptions.TypeError +None /= 4.0 ... exceptions.TypeError +None ** 4.0 ... exceptions.TypeError +None **= 4.0 ... exceptions.TypeError +None % 4.0 ... exceptions.TypeError +None %= 4.0 ... exceptions.TypeError +None + 2 ... exceptions.TypeError +None += 2 ... exceptions.TypeError +None - 2 ... exceptions.TypeError +None -= 2 ... exceptions.TypeError +None * 2 ... exceptions.TypeError +None *= 2 ... exceptions.TypeError +None / 2 ... exceptions.TypeError +None /= 2 ... exceptions.TypeError +None ** 2 ... exceptions.TypeError +None **= 2 ... exceptions.TypeError +None % 2 ... exceptions.TypeError +None %= 2 ... exceptions.TypeError +None + (2+0j) ... exceptions.TypeError +None += (2+0j) ... exceptions.TypeError +None - (2+0j) ... exceptions.TypeError +None -= (2+0j) ... exceptions.TypeError +None * (2+0j) ... exceptions.TypeError +None *= (2+0j) ... exceptions.TypeError +None / (2+0j) ... exceptions.TypeError +None /= (2+0j) ... exceptions.TypeError +None ** (2+0j) ... exceptions.TypeError +None **= (2+0j) ... exceptions.TypeError +None % (2+0j) ... exceptions.TypeError +None %= (2+0j) ... exceptions.TypeError +None + [1] ... exceptions.TypeError +None += [1] ... exceptions.TypeError +None - [1] ... exceptions.TypeError +None -= [1] ... exceptions.TypeError +None * [1] ... exceptions.TypeError +None *= [1] ... exceptions.TypeError +None / [1] ... exceptions.TypeError +None /= [1] ... exceptions.TypeError +None ** [1] ... exceptions.TypeError +None **= [1] ... exceptions.TypeError +None % [1] ... exceptions.TypeError +None %= [1] ... exceptions.TypeError +None + (2,) ... exceptions.TypeError +None += (2,) ... exceptions.TypeError +None - (2,) ... exceptions.TypeError +None -= (2,) ... exceptions.TypeError +None * (2,) ... exceptions.TypeError +None *= (2,) ... exceptions.TypeError +None / (2,) ... exceptions.TypeError +None /= (2,) ... exceptions.TypeError +None ** (2,) ... exceptions.TypeError +None **= (2,) ... exceptions.TypeError +None % (2,) ... exceptions.TypeError +None %= (2,) ... exceptions.TypeError +None + None ... exceptions.TypeError +None += None ... exceptions.TypeError +None - None ... exceptions.TypeError +None -= None ... exceptions.TypeError +None * None ... exceptions.TypeError +None *= None ... exceptions.TypeError +None / None ... exceptions.TypeError +None /= None ... exceptions.TypeError +None ** None ... exceptions.TypeError +None **= None ... exceptions.TypeError +None % None ... exceptions.TypeError +None %= None ... exceptions.TypeError +None + ... exceptions.TypeError +None += ... exceptions.TypeError +None - ... exceptions.TypeError +None -= ... exceptions.TypeError +None * ... exceptions.TypeError +None *= ... exceptions.TypeError +None / ... exceptions.TypeError +None /= ... exceptions.TypeError +None ** ... exceptions.TypeError +None **= ... exceptions.TypeError +None % ... exceptions.TypeError +None %= ... exceptions.TypeError +None + ... exceptions.TypeError +None += ... exceptions.TypeError +None - ... exceptions.TypeError +None -= ... exceptions.TypeError +None * ... exceptions.TypeError +None *= ... exceptions.TypeError +None / ... exceptions.TypeError +None /= ... exceptions.TypeError +None ** ... exceptions.TypeError +None **= ... exceptions.TypeError +None % ... exceptions.TypeError +None %= ... exceptions.TypeError + + 2 = 3 + += 2 => 3 + - 2 = -1 + -= 2 => -1 + * 2 = 2 + *= 2 => 2 + / 2 = 0 + /= 2 => 0 + ** 2 = 1 + **= 2 => 1 + % 2 = 1 + %= 2 => 1 + + 4.0 = 5.0 + += 4.0 => 5.0 + - 4.0 = -3.0 + -= 4.0 => -3.0 + * 4.0 = 4.0 + *= 4.0 => 4.0 + / 4.0 = 0.25 + /= 4.0 => 0.25 + ** 4.0 = 1.0 + **= 4.0 => 1.0 + % 4.0 = 1.0 + %= 4.0 => 1.0 + + 2 = 3 + += 2 => 3 + - 2 = -1 + -= 2 => -1 + * 2 = 2 + *= 2 => 2 + / 2 = 0 + /= 2 => 0 + ** 2 = 1 + **= 2 => 1 + % 2 = 1 + %= 2 => 1 + + (2+0j) = (3+0j) + += (2+0j) => (3+0j) + - (2+0j) = (-1+0j) + -= (2+0j) => (-1+0j) + * (2+0j) = (2+0j) + *= (2+0j) => (2+0j) + / (2+0j) = (0.5+0j) + /= (2+0j) => (0.5+0j) + ** (2+0j) = (1+0j) + **= (2+0j) => (1+0j) + % (2+0j) = (1+0j) + %= (2+0j) => (1+0j) + + [1] ... exceptions.TypeError + += [1] ... exceptions.TypeError + - [1] ... exceptions.TypeError + -= [1] ... exceptions.TypeError + * [1] = [1] + *= [1] => [1] + / [1] ... exceptions.TypeError + /= [1] ... exceptions.TypeError + ** [1] ... exceptions.TypeError + **= [1] ... exceptions.TypeError + % [1] ... exceptions.TypeError + %= [1] ... exceptions.TypeError + + (2,) ... exceptions.TypeError + += (2,) ... exceptions.TypeError + - (2,) ... exceptions.TypeError + -= (2,) ... exceptions.TypeError + * (2,) = (2,) + *= (2,) => (2,) + / (2,) ... exceptions.TypeError + /= (2,) ... exceptions.TypeError + ** (2,) ... exceptions.TypeError + **= (2,) ... exceptions.TypeError + % (2,) ... exceptions.TypeError + %= (2,) ... exceptions.TypeError + + None ... exceptions.TypeError + += None ... exceptions.TypeError + - None ... exceptions.TypeError + -= None ... exceptions.TypeError + * None ... exceptions.TypeError + *= None ... exceptions.TypeError + / None ... exceptions.TypeError + /= None ... exceptions.TypeError + ** None ... exceptions.TypeError + **= None ... exceptions.TypeError + % None ... exceptions.TypeError + %= None ... exceptions.TypeError + + = 2 + += => 2 + - = 0 + -= => 0 + * = 1 + *= => 1 + / = 1 + /= => 1 + ** = 1 + **= => 1 + % = 0 + %= => 0 + + = 3 + += => 3 + - = -1 + -= => -1 + * = 2 + *= => 2 + / = 0 + /= => 0 + ** = 1 + **= => 1 + % = 1 + %= => 1 + + 2 = 4 + += 2 => 4 + - 2 = 0 + -= 2 => 0 + * 2 = 4 + *= 2 => 4 + / 2 = 1 + /= 2 => 1 + ** 2 = 4 + **= 2 => 4 + % 2 = 0 + %= 2 => 0 + + 4.0 = 6.0 + += 4.0 => 6.0 + - 4.0 = -2.0 + -= 4.0 => -2.0 + * 4.0 = 8.0 + *= 4.0 => 8.0 + / 4.0 = 0.5 + /= 4.0 => 0.5 + ** 4.0 = 16.0 + **= 4.0 => 16.0 + % 4.0 = 2.0 + %= 4.0 => 2.0 + + 2 = 4 + += 2 => 4 + - 2 = 0 + -= 2 => 0 + * 2 = 4 + *= 2 => 4 + / 2 = 1 + /= 2 => 1 + ** 2 = 4 + **= 2 => 4 + % 2 = 0 + %= 2 => 0 + + (2+0j) = (4+0j) + += (2+0j) => (4+0j) + - (2+0j) = 0j + -= (2+0j) => 0j + * (2+0j) = (4+0j) + *= (2+0j) => (4+0j) + / (2+0j) = (1+0j) + /= (2+0j) => (1+0j) + ** (2+0j) = (4+0j) + **= (2+0j) => (4+0j) + % (2+0j) = 0j + %= (2+0j) => 0j + + [1] ... exceptions.TypeError + += [1] ... exceptions.TypeError + - [1] ... exceptions.TypeError + -= [1] ... exceptions.TypeError + * [1] = [1, 1] + *= [1] => [1, 1] + / [1] ... exceptions.TypeError + /= [1] ... exceptions.TypeError + ** [1] ... exceptions.TypeError + **= [1] ... exceptions.TypeError + % [1] ... exceptions.TypeError + %= [1] ... exceptions.TypeError + + (2,) ... exceptions.TypeError + += (2,) ... exceptions.TypeError + - (2,) ... exceptions.TypeError + -= (2,) ... exceptions.TypeError + * (2,) = (2, 2) + *= (2,) => (2, 2) + / (2,) ... exceptions.TypeError + /= (2,) ... exceptions.TypeError + ** (2,) ... exceptions.TypeError + **= (2,) ... exceptions.TypeError + % (2,) ... exceptions.TypeError + %= (2,) ... exceptions.TypeError + + None ... exceptions.TypeError + += None ... exceptions.TypeError + - None ... exceptions.TypeError + -= None ... exceptions.TypeError + * None ... exceptions.TypeError + *= None ... exceptions.TypeError + / None ... exceptions.TypeError + /= None ... exceptions.TypeError + ** None ... exceptions.TypeError + **= None ... exceptions.TypeError + % None ... exceptions.TypeError + %= None ... exceptions.TypeError + + = 3 + += => 3 + - = 1 + -= => 1 + * = 2 + *= => 2 + / = 2 + /= => 2 + ** = 2 + **= => 2 + % = 0 + %= => 0 + + = 4 + += => 4 + +--===============1485143794627465665== +Content-Type: text/plain; charset="us-ascii" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Content-Disposition: attachment; filename="stderr" + +faking +faking +faking +faking +faking +faking +faking +faking +faking +/home/hpk/pypy-dist/lib-python/modified-2.3.4/test/test_coercion.py:0: DeprecationWarning: complex divmod(), // and % are deprecated +/home/hpk/pypy-dist/lib-python/modified-2.3.4/test/test_coercion.py:1: DeprecationWarning: complex divmod(), // and % are deprecated + import copy +/home/hpk/pypy-dist/lib-python/modified-2.3.4/test/test_coercion.py:63: DeprecationWarning: complex divmod(), // and % are deprecated + return other % self.arg +/home/hpk/pypy-dist/lib-python/modified-2.3.4/test/test_coercion.py:60: DeprecationWarning: complex divmod(), // and % are deprecated + return self.arg % other +==========================timedout========================== +Traceback (application-level): + File "/home/hpk/pypy-dist/lib-python/modified-2.3.4/test/test_coercion.py", line 117 in ? +do_infix_binops() + File "/home/hpk/pypy-dist/lib-python/modified-2.3.4/test/test_coercion.py", line 79 in do_infix_binops + print '%s %s %s' % (a, op, b), +KeyboardInterrupt + +--===============1485143794627465665==-- \ No newline at end of file Modified: pypy/testresult/hpk at code1.codespeak.net/test_compare.txt ============================================================================== --- pypy/testresult/hpk at code1.codespeak.net/test_compare.txt (original) +++ pypy/testresult/hpk at code1.codespeak.net/test_compare.txt Mon May 2 02:07:05 2005 @@ -1,22 +1,138 @@ -testreport-version: 1.0 -command: /usr/bin/python /tmp/pypy-autotest-13/pypy-dist/pypy/tool/alarm.py 12615 /tmp/pypy-autotest-13/pypy-dist/pypy/interpreter/py.py --oldstyle /tmp/pypy-autotest-13/pypy-dist/lib-python-2.3.4/test/test_compare.py -run by: hpk at code1.codespeak.net -sys.platform: linux2 -sys.version_info: (2, 3, 5, 'final', 0) -cpu model: AMD Opteron(tm) Processor 242 +Content-Type: multipart/mixed; boundary="===============4390223936752718693==" +MIME-Version: 1.0 cpu mhz: 1603.694 -oldstyle: yes -pypy-revision: 11680 -startdate: Sun May 1 04:14:57 2005 -timeout: 12615.0 seconds +cpu model: AMD Opteron(tm) Processor 242 +execution-time: 124.393460989 +exit status: 0 +fspath: /home/hpk/pypy-dist/lib-python/2.3.4/test/test_compare.py +options: ['oldstyle', 'core'] +outcome: OK +platform: linux2 +pypy-revision: 11740 +python-version-info: (2, 3, 5, 'final', 0) +startdate: Mon May 2 00:55:05 2005 +testreport-version: 1.1 +timeout: 900.0 +userhost: hpk at code1.codespeak.net +_reprs: {'execution-time': 'float', 'python-version-info': 'tuple', + 'options': 'list', 'timeout': 'float', 'pypy-revision': 'int', + 'exit status': 'int'} + +--===============4390223936752718693== +Content-Type: text/plain; charset="us-ascii" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Content-Disposition: attachment; filename="stdout" + +2 == 2 +2 == 2.0 +2 == 2 +2 == (2+0j) +2 != [1] +2 != (3,) +2 != None +2 != +2 == +2 == +2.0 == 2 +2.0 == 2.0 +2.0 == 2 +2.0 == (2+0j) +2.0 != [1] +2.0 != (3,) +2.0 != None +2.0 != +2.0 == +2.0 == +2 == 2 +2 == 2.0 +2 == 2 +2 == (2+0j) +2 != [1] +2 != (3,) +2 != None +2 != +2 == +2 == +(2+0j) == 2 +(2+0j) == 2.0 +(2+0j) == 2 +(2+0j) == (2+0j) +(2+0j) != [1] +(2+0j) != (3,) +(2+0j) != None +(2+0j) != +(2+0j) == +(2+0j) == +[1] != 2 +[1] != 2.0 +[1] != 2 +[1] != (2+0j) +[1] == [1] +[1] != (3,) +[1] != None +[1] != +[1] != +[1] != +(3,) != 2 +(3,) != 2.0 +(3,) != 2 +(3,) != (2+0j) +(3,) != [1] +(3,) == (3,) +(3,) != None +(3,) != +(3,) != +(3,) != +None != 2 +None != 2.0 +None != 2 +None != (2+0j) +None != [1] +None != (3,) +None == None +None != +None != +None != + != 2 + != 2.0 + != 2 + != (2+0j) + != [1] + != (3,) + != None + == + != + != + == 2 + == 2.0 + == 2 + == (2+0j) + != [1] + != (3,) + != None + != + == + == + == 2 + == 2.0 + == 2 + == (2+0j) + != [1] + != (3,) + != None + != + == + == + +--===============4390223936752718693== +Content-Type: text/plain; charset="us-ascii" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Content-Disposition: attachment; filename="stderr" -OUTPUT TEST -see output in: /tmp/pypy-autotest-13/pypy-dist/lib-python-2.3.4/test/result/hpk at code1.codespeak.net/test_compare.out -============================================================ faking faking faking -OK -========================== closed ========================== -execution time: 128.160462141 seconds -exit status: 0 + +--===============4390223936752718693==-- \ No newline at end of file Modified: pypy/testresult/hpk at code1.codespeak.net/test_compile.txt ============================================================================== --- pypy/testresult/hpk at code1.codespeak.net/test_compile.txt (original) +++ pypy/testresult/hpk at code1.codespeak.net/test_compile.txt Mon May 2 02:07:05 2005 @@ -1,25 +1,29 @@ -testreport-version: 1.0 -command: /usr/bin/python /tmp/pypy-autotest-13/pypy-dist/pypy/tool/alarm.py 13499 /tmp/pypy-autotest-13/pypy-dist/pypy/interpreter/py.py /tmp/pypy-autotest-13/pypy-dist/lib-python-2.3.4/test/test_compile.py -run by: hpk at code1.codespeak.net -sys.platform: linux2 -sys.version_info: (2, 3, 5, 'final', 0) -cpu model: AMD Opteron(tm) Processor 242 +Content-Type: multipart/mixed; boundary="===============7378836787762646619==" +MIME-Version: 1.0 cpu mhz: 1603.694 -oldstyle: no -pypy-revision: 11680 -startdate: Sun May 1 04:17:05 2005 -timeout: 13500.0 seconds +cpu model: AMD Opteron(tm) Processor 242 +execution-time: 17.1772141457 +exit status: 0 +fspath: /home/hpk/pypy-dist/lib-python/2.3.4/test/test_compile.py +options: ['core'] +outcome: OK +platform: linux2 +pypy-revision: 11740 +python-version-info: (2, 3, 5, 'final', 0) +startdate: Mon May 2 00:57:10 2005 +testreport-version: 1.1 +timeout: 900.0 +userhost: hpk at code1.codespeak.net +_reprs: {'execution-time': 'float', 'python-version-info': 'tuple', + 'options': 'list', 'timeout': 'float', 'pypy-revision': 'int', + 'exit status': 'int'} + +--===============7378836787762646619== +Content-Type: text/plain; charset="us-ascii" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Content-Disposition: attachment; filename="stdout" -============================================================ -faking -faking -faking -faking -faking -faking -faking -:0: FutureWarning: hex/oct constants > sys.maxint will return positive values in Python 2.4 and up -:0: FutureWarning: hex/oct constants > sys.maxint will return positive values in Python 2.4 and up test_argument_handling (__main__.TestSpecifics) ... ok test_argument_order (__main__.TestSpecifics) ... ok test_complex_args (__main__.TestSpecifics) ... ok @@ -33,9 +37,24 @@ test_unary_minus (__main__.TestSpecifics) ... ok ---------------------------------------------------------------------- -Ran 11 tests in 8.342s +Ran 11 tests in 8.232s OK -========================== closed ========================== -execution time: 16.24909091 seconds -exit status: 0 + +--===============7378836787762646619== +Content-Type: text/plain; charset="us-ascii" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Content-Disposition: attachment; filename="stderr" + +faking +faking +faking +faking +faking +faking +faking +:0: FutureWarning: hex/oct constants > sys.maxint will return positive values in Python 2.4 and up +:0: FutureWarning: hex/oct constants > sys.maxint will return positive values in Python 2.4 and up + +--===============7378836787762646619==-- \ No newline at end of file Added: pypy/testresult/hpk at code1.codespeak.net/test_complex.txt ============================================================================== --- (empty file) +++ pypy/testresult/hpk at code1.codespeak.net/test_complex.txt Mon May 2 02:07:05 2005 @@ -0,0 +1,91 @@ +Content-Type: multipart/mixed; boundary="===============0305805559612487810==" +MIME-Version: 1.0 +cpu mhz: 1603.694 +cpu model: AMD Opteron(tm) Processor 242 +execution-time: 394.345926046 +exit status: 1 +fspath: /home/hpk/pypy-dist/lib-python/modified-2.3.4/test/test_complex.py +options: ['core'] +outcome: ERR +platform: linux2 +pypy-revision: 11740 +python-version-info: (2, 3, 5, 'final', 0) +startdate: Mon May 2 00:57:28 2005 +testreport-version: 1.1 +timeout: 900.0 +userhost: hpk at code1.codespeak.net +_reprs: {'execution-time': 'float', 'python-version-info': 'tuple', + 'options': 'list', 'timeout': 'float', 'pypy-revision': 'int', + 'exit status': 'int'} + +--===============0305805559612487810== +Content-Type: text/plain; charset="us-ascii" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Content-Disposition: attachment; filename="stdout" + +test_abs (__main__.ComplexTest) ... ok +test_boolcontext (__main__.ComplexTest) ... ok +test_coerce (__main__.ComplexTest) ... ok +test_conjugate (__main__.ComplexTest) ... ok +test_constructor (__main__.ComplexTest) ... FAIL +test_div (__main__.ComplexTest) ... ok +test_divmod (__main__.ComplexTest) ... ok +test_file (__main__.ComplexTest) ... ok +test_floordiv (__main__.ComplexTest) ... ok +test_hash (__main__.ComplexTest) ... ok +test_mod (__main__.ComplexTest) ... ok +test_neg (__main__.ComplexTest) ... ok +test_pow (__main__.ComplexTest) ... ok +test_repr (__main__.ComplexTest) ... ok +test_richcompare (__main__.ComplexTest) ... ok +test_truediv (__main__.ComplexTest) ... ok + +====================================================================== +FAIL: test_constructor (__main__.ComplexTest) +---------------------------------------------------------------------- +Traceback (most recent call last): + File "/home/hpk/pypy-dist/lib-python/modified-2.3.4/test/test_complex.py", line 254, in test_constructor + self.assertRaises(ValueError, complex, unicode("1"*500)) + File "/home/hpk/pypy-dist/lib-python/2.3.4/unittest.py", line 295, in failUnlessRaises + raise self.failureException, excName +AssertionError: ValueError + +---------------------------------------------------------------------- +Ran 16 tests in 378.837s + +FAILED (failures=1) + +--===============0305805559612487810== +Content-Type: text/plain; charset="us-ascii" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Content-Disposition: attachment; filename="stderr" + +faking +faking +faking +faking +faking +faking +faking +faking +faking +Traceback (application-level): + File "/home/hpk/pypy-dist/lib-python/modified-2.3.4/test/test_complex.py", line 316 in ? + test_main() + File "/home/hpk/pypy-dist/lib-python/modified-2.3.4/test/test_complex.py", line 313 in test_main + test_support.run_unittest(ComplexTest) + File "/home/hpk/pypy-dist/lib-python/2.3.4/test/test_support.py", line 262 in run_unittest + run_suite(suite, testclass) + File "/home/hpk/pypy-dist/lib-python/2.3.4/test/test_support.py", line 247 in run_suite + raise TestFailed(err) +TestFailed: Traceback (most recent call last): + File "/home/hpk/pypy-dist/lib-python/modified-2.3.4/test/test_complex.py", line 254, in test_constructor + self.assertRaises(ValueError, complex, unicode("1"*500)) + File "/home/hpk/pypy-dist/lib-python/2.3.4/unittest.py", line 295, in failUnlessRaises + raise self.failureException, excName +AssertionError: ValueError + + +--===============0305805559612487810==-- \ No newline at end of file Modified: pypy/testresult/hpk at code1.codespeak.net/test_contains.txt ============================================================================== --- pypy/testresult/hpk at code1.codespeak.net/test_contains.txt (original) +++ pypy/testresult/hpk at code1.codespeak.net/test_contains.txt Mon May 2 02:07:05 2005 @@ -1,21 +1,40 @@ -testreport-version: 1.0 -command: /usr/bin/python /tmp/pypy-autotest-13/pypy-dist/pypy/tool/alarm.py 13499 /tmp/pypy-autotest-13/pypy-dist/pypy/interpreter/py.py /tmp/pypy-autotest-13/pypy-dist/lib-python-2.3.4/test/test_contains.py -run by: hpk at code1.codespeak.net -sys.platform: linux2 -sys.version_info: (2, 3, 5, 'final', 0) -cpu model: AMD Opteron(tm) Processor 242 +Content-Type: multipart/mixed; boundary="===============2123046395303823617==" +MIME-Version: 1.0 cpu mhz: 1603.694 -oldstyle: no -pypy-revision: 11680 -startdate: Sun May 1 04:17:22 2005 -timeout: 13500.0 seconds +cpu model: AMD Opteron(tm) Processor 242 +execution-time: 10.4479849339 +exit status: 0 +fspath: /home/hpk/pypy-dist/lib-python/2.3.4/test/test_contains.py +options: ['core'] +outcome: OK +platform: linux2 +pypy-revision: 11740 +python-version-info: (2, 3, 5, 'final', 0) +startdate: Mon May 2 01:04:04 2005 +testreport-version: 1.1 +timeout: 961.0 +userhost: hpk at code1.codespeak.net +_reprs: {'execution-time': 'float', 'python-version-info': 'tuple', + 'options': 'list', 'timeout': 'float', 'pypy-revision': 'int', + 'exit status': 'int'} + +--===============2123046395303823617== +Content-Type: text/plain; charset="us-ascii" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Content-Disposition: attachment; filename="stdout" + + +--===============2123046395303823617== +Content-Type: text/plain; charset="us-ascii" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Content-Disposition: attachment; filename="stderr" -============================================================ faking faking faking faking faking -========================== closed ========================== -execution time: 9.51487112045 seconds -exit status: 0 + +--===============2123046395303823617==-- \ No newline at end of file Added: pypy/testresult/hpk at code1.codespeak.net/test_cookie.txt ============================================================================== --- (empty file) +++ pypy/testresult/hpk at code1.codespeak.net/test_cookie.txt Mon May 2 02:07:05 2005 @@ -0,0 +1,372 @@ +Content-Type: multipart/mixed; boundary="===============8855377545592532127==" +MIME-Version: 1.0 +cpu mhz: 1603.694 +cpu model: AMD Opteron(tm) Processor 242 +execution-time: 158.16744709 +exit status: 1 +fspath: /home/hpk/pypy-dist/lib-python/2.3.4/test/test_cookie.py +options: ['core'] +outcome: ERR +platform: linux2 +pypy-revision: 11740 +python-version-info: (2, 3, 5, 'final', 0) +startdate: Mon May 2 01:04:15 2005 +testreport-version: 1.1 +timeout: 961.0 +userhost: hpk at code1.codespeak.net +_reprs: {'execution-time': 'float', 'python-version-info': 'tuple', + 'options': 'list', 'timeout': 'float', 'pypy-revision': 'int', + 'exit status': 'int'} + +--===============8855377545592532127== +Content-Type: text/plain; charset="us-ascii" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Content-Disposition: attachment; filename="stdout" + + +Set-Cookie: chips=ahoy; +Set-Cookie: vienna=finger; + chips 'ahoy' 'ahoy' +Set-Cookie: chips=ahoy; + vienna 'finger' 'finger' +Set-Cookie: vienna=finger; + +Set-Cookie: keebler="E=mc2; L=\"Loves\"; fudge=\012;"; + keebler 'E=mc2; L="Loves"; fudge=\n;' 'E=mc2; L="Loves"; fudge=\n;' +Set-Cookie: keebler="E=mc2; L=\"Loves\"; fudge=\012;"; + +Set-Cookie: keebler=E=mc2; + keebler 'E=mc2' 'E=mc2' +Set-Cookie: keebler=E=mc2; +Set-Cookie: Customer="WILE_E_COYOTE"; Path=/acme; + + + + + + +If anything blows up after this line, it's from Cookie's doctest. +Running Cookie.__doc__ +Trying: import Cookie +Expecting: nothing +ok +Trying: C = Cookie.SimpleCookie() +Expecting: nothing +ok +Trying: C = Cookie.SerialCookie() +Expecting: nothing +ok +Trying: C = Cookie.SmartCookie() +Expecting: nothing +ok +Trying: C = Cookie.SmartCookie() +Expecting: nothing +ok +Trying: C["fig"] = "newton" +Expecting: nothing +ok +Trying: C["sugar"] = "wafer" +Expecting: nothing +ok +Trying: print C +Expecting: +Set-Cookie: fig=newton; +Set-Cookie: sugar=wafer; +ok +Trying: C = Cookie.SmartCookie() +Expecting: nothing +ok +Trying: C["rocky"] = "road" +Expecting: nothing +ok +Trying: C["rocky"]["path"] = "/cookie" +Expecting: nothing +ok +Trying: print C.output(header="Cookie:") +Expecting: Cookie: rocky=road; Path=/cookie; +ok +Trying: print C.output(attrs=[], header="Cookie:") +Expecting: Cookie: rocky=road; +ok +Trying: C = Cookie.SmartCookie() +Expecting: nothing +ok +Trying: C.load("chips=ahoy; vienna=finger") +Expecting: nothing +ok +Trying: print C +Expecting: +Set-Cookie: chips=ahoy; +Set-Cookie: vienna=finger; +ok +Trying: C = Cookie.SmartCookie() +Expecting: nothing +ok +Trying: C.load('keebler="E=everybody; L=\\"Loves\\"; fudge=\\012;";') +Expecting: nothing +ok +Trying: print C +Expecting: Set-Cookie: keebler="E=everybody; L=\"Loves\"; fudge=\012;"; +ok +Trying: C = Cookie.SmartCookie() +Expecting: nothing +ok +Trying: C["oreo"] = "doublestuff" +Expecting: nothing +ok +Trying: C["oreo"]["path"] = "/" +Expecting: nothing +ok +Trying: print C +Expecting: Set-Cookie: oreo=doublestuff; Path=/; +ok +Trying: C = Cookie.SmartCookie() +Expecting: nothing +ok +Trying: C["twix"] = "none for you" +Expecting: nothing +ok +Trying: C["twix"].value +Expecting: 'none for you' +ok +Trying: C = Cookie.SimpleCookie() +Expecting: nothing +ok +Trying: C["number"] = 7 +Expecting: nothing +ok +Trying: C["string"] = "seven" +Expecting: nothing +ok +Trying: C["number"].value +Expecting: '7' +ok +Trying: C["string"].value +Expecting: 'seven' +ok +Trying: print C +Expecting: +Set-Cookie: number=7; +Set-Cookie: string=seven; +ok +Trying: C = Cookie.SerialCookie() +Expecting: nothing +ok +Trying: C["number"] = 7 +Expecting: nothing +ok +Trying: C["string"] = "seven" +Expecting: nothing +ok +Trying: C["number"].value +Expecting: 7 +ok +Trying: C["string"].value +Expecting: 'seven' +ok +Trying: print C +Expecting: +Set-Cookie: number="I7\012."; +Set-Cookie: string="S'seven'\012p1\012."; +***************************************************************** +Failure in example: print C +from line #126 of Cookie +Expected: +Set-Cookie: number="I7\012."; +Set-Cookie: string="S'seven'\012p1\012."; +Got: +Set-Cookie: number="I7\012."; +Set-Cookie: string="S'seven'\012p0\012."; +Trying: C = Cookie.SmartCookie() +Expecting: nothing +ok +Trying: C["number"] = 7 +Expecting: nothing +ok +Trying: C["string"] = "seven" +Expecting: nothing +ok +Trying: C["number"].value +Expecting: 7 +ok +Trying: C["string"].value +Expecting: 'seven' +ok +Trying: print C +Expecting: +Set-Cookie: number="I7\012."; +Set-Cookie: string=seven; +ok +Trying: C = Cookie.Cookie() +Expecting: nothing +ok +Trying: print C.__class__.__name__ +Expecting: SmartCookie +ok +1 of 46 examples failed in Cookie.__doc__ +Running Cookie.BaseCookie.__doc__ +0 of 0 examples failed in Cookie.BaseCookie.__doc__ +Running Cookie.BaseCookie._BaseCookie__ParseString.__doc__ +0 of 0 examples failed in Cookie.BaseCookie._BaseCookie__ParseString.__doc__ +Running Cookie.BaseCookie._BaseCookie__set.__doc__ +0 of 0 examples failed in Cookie.BaseCookie._BaseCookie__set.__doc__ +Running Cookie.BaseCookie.__init__.__doc__ +0 of 0 examples failed in Cookie.BaseCookie.__init__.__doc__ +Running Cookie.BaseCookie.__repr__.__doc__ +0 of 0 examples failed in Cookie.BaseCookie.__repr__.__doc__ +Running Cookie.BaseCookie.__setitem__.__doc__ +0 of 0 examples failed in Cookie.BaseCookie.__setitem__.__doc__ +Running Cookie.BaseCookie.__str__.__doc__ +0 of 0 examples failed in Cookie.BaseCookie.__str__.__doc__ +Running Cookie.BaseCookie.js_output.__doc__ +0 of 0 examples failed in Cookie.BaseCookie.js_output.__doc__ +Running Cookie.BaseCookie.load.__doc__ +0 of 0 examples failed in Cookie.BaseCookie.load.__doc__ +Running Cookie.BaseCookie.output.__doc__ +0 of 0 examples failed in Cookie.BaseCookie.output.__doc__ +Running Cookie.BaseCookie.value_decode.__doc__ +0 of 0 examples failed in Cookie.BaseCookie.value_decode.__doc__ +Running Cookie.BaseCookie.value_encode.__doc__ +0 of 0 examples failed in Cookie.BaseCookie.value_encode.__doc__ +Running Cookie.Cookie.__doc__ +0 of 0 examples failed in Cookie.Cookie.__doc__ +Running Cookie.Cookie.__init__.__doc__ +0 of 0 examples failed in Cookie.Cookie.__init__.__doc__ +Running Cookie.Cookie.value_decode.__doc__ +0 of 0 examples failed in Cookie.Cookie.value_decode.__doc__ +Running Cookie.Cookie.value_encode.__doc__ +0 of 0 examples failed in Cookie.Cookie.value_encode.__doc__ +Running Cookie.CookieError.__doc__ +0 of 0 examples failed in Cookie.CookieError.__doc__ +Running Cookie.Morsel.__doc__ +0 of 0 examples failed in Cookie.Morsel.__doc__ +Running Cookie.Morsel.OutputString.__doc__ +0 of 0 examples failed in Cookie.Morsel.OutputString.__doc__ +Running Cookie.Morsel.__init__.__doc__ +0 of 0 examples failed in Cookie.Morsel.__init__.__doc__ +Running Cookie.Morsel.__repr__.__doc__ +0 of 0 examples failed in Cookie.Morsel.__repr__.__doc__ +Running Cookie.Morsel.__setitem__.__doc__ +0 of 0 examples failed in Cookie.Morsel.__setitem__.__doc__ +Running Cookie.Morsel.__str__.__doc__ +0 of 0 examples failed in Cookie.Morsel.__str__.__doc__ +Running Cookie.Morsel.isReservedKey.__doc__ +0 of 0 examples failed in Cookie.Morsel.isReservedKey.__doc__ +Running Cookie.Morsel.js_output.__doc__ +0 of 0 examples failed in Cookie.Morsel.js_output.__doc__ +Running Cookie.Morsel.output.__doc__ +0 of 0 examples failed in Cookie.Morsel.output.__doc__ +Running Cookie.Morsel.set.__doc__ +0 of 0 examples failed in Cookie.Morsel.set.__doc__ +Running Cookie.SerialCookie.__doc__ +0 of 0 examples failed in Cookie.SerialCookie.__doc__ +Running Cookie.SerialCookie.__init__.__doc__ +0 of 0 examples failed in Cookie.SerialCookie.__init__.__doc__ +Running Cookie.SerialCookie.value_decode.__doc__ +0 of 0 examples failed in Cookie.SerialCookie.value_decode.__doc__ +Running Cookie.SerialCookie.value_encode.__doc__ +0 of 0 examples failed in Cookie.SerialCookie.value_encode.__doc__ +Running Cookie.SimpleCookie.__doc__ +0 of 0 examples failed in Cookie.SimpleCookie.__doc__ +Running Cookie.SimpleCookie.value_decode.__doc__ +0 of 0 examples failed in Cookie.SimpleCookie.value_decode.__doc__ +Running Cookie.SimpleCookie.value_encode.__doc__ +0 of 0 examples failed in Cookie.SimpleCookie.value_encode.__doc__ +Running Cookie.SmartCookie.__doc__ +0 of 0 examples failed in Cookie.SmartCookie.__doc__ +Running Cookie.SmartCookie.__init__.__doc__ +0 of 0 examples failed in Cookie.SmartCookie.__init__.__doc__ +Running Cookie.SmartCookie.value_decode.__doc__ +0 of 0 examples failed in Cookie.SmartCookie.value_decode.__doc__ +Running Cookie.SmartCookie.value_encode.__doc__ +0 of 0 examples failed in Cookie.SmartCookie.value_encode.__doc__ +Running Cookie._getdate.__doc__ +0 of 0 examples failed in Cookie._getdate.__doc__ +Running Cookie._quote.__doc__ +0 of 0 examples failed in Cookie._quote.__doc__ +Running Cookie._test.__doc__ +0 of 0 examples failed in Cookie._test.__doc__ +Running Cookie._unquote.__doc__ +0 of 0 examples failed in Cookie._unquote.__doc__ +42 items had no tests: + Cookie.BaseCookie + Cookie.BaseCookie._BaseCookie__ParseString + Cookie.BaseCookie._BaseCookie__set + Cookie.BaseCookie.__init__ + Cookie.BaseCookie.__repr__ + Cookie.BaseCookie.__setitem__ + Cookie.BaseCookie.__str__ + Cookie.BaseCookie.js_output + Cookie.BaseCookie.load + Cookie.BaseCookie.output + Cookie.BaseCookie.value_decode + Cookie.BaseCookie.value_encode + Cookie.Cookie + Cookie.Cookie.__init__ + Cookie.Cookie.value_decode + Cookie.Cookie.value_encode + Cookie.CookieError + Cookie.Morsel + Cookie.Morsel.OutputString + Cookie.Morsel.__init__ + Cookie.Morsel.__repr__ + Cookie.Morsel.__setitem__ + Cookie.Morsel.__str__ + Cookie.Morsel.isReservedKey + Cookie.Morsel.js_output + Cookie.Morsel.output + Cookie.Morsel.set + Cookie.SerialCookie + Cookie.SerialCookie.__init__ + Cookie.SerialCookie.value_decode + Cookie.SerialCookie.value_encode + Cookie.SimpleCookie + Cookie.SimpleCookie.value_decode + Cookie.SimpleCookie.value_encode + Cookie.SmartCookie + Cookie.SmartCookie.__init__ + Cookie.SmartCookie.value_decode + Cookie.SmartCookie.value_encode + Cookie._getdate + Cookie._quote + Cookie._test + Cookie._unquote +***************************************************************** +1 items had failures: + 1 of 46 in Cookie +46 tests in 43 items. +45 passed and 1 failed. +***Test Failed*** 1 failures. + +--===============8855377545592532127== +Content-Type: text/plain; charset="us-ascii" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Content-Disposition: attachment; filename="stderr" + +faking +faking +faking +faking +faking +faking +faking +faking +faking +Traceback (application-level): + File "/home/hpk/pypy-dist/lib-python/2.3.4/test/test_cookie.py", line 52 in ? +run_doctest(Cookie) + File "/home/hpk/pypy-dist/lib-python/2.3.4/test/test_support.py", line 290 in run_doctest + raise TestFailed("%d of %d doctests failed" % (f, t)) +TestFailed: 1 of 46 doctests failed + +--===============8855377545592532127==-- \ No newline at end of file Modified: pypy/testresult/hpk at code1.codespeak.net/test_copy.txt ============================================================================== --- pypy/testresult/hpk at code1.codespeak.net/test_copy.txt (original) +++ pypy/testresult/hpk at code1.codespeak.net/test_copy.txt Mon May 2 02:07:05 2005 @@ -1,21 +1,29 @@ -testreport-version: 1.0 -command: /usr/bin/python /tmp/pypy-autotest-13/pypy-dist/pypy/tool/alarm.py 13499 /tmp/pypy-autotest-13/pypy-dist/pypy/interpreter/py.py /tmp/pypy-autotest-13/pypy-dist/lib-python-2.3.4/test/test_copy.py -run by: hpk at code1.codespeak.net -sys.platform: linux2 -sys.version_info: (2, 3, 5, 'final', 0) -cpu model: AMD Opteron(tm) Processor 242 +Content-Type: multipart/mixed; boundary="===============0817316440374971092==" +MIME-Version: 1.0 cpu mhz: 1603.694 -oldstyle: no -pypy-revision: 11680 -startdate: Sun May 1 04:17:32 2005 -timeout: 13500.0 seconds +cpu model: AMD Opteron(tm) Processor 242 +execution-time: 38.8435969353 +exit status: 0 +fspath: /home/hpk/pypy-dist/lib-python/2.3.4/test/test_copy.py +options: ['core'] +outcome: OK +platform: linux2 +pypy-revision: 11740 +python-version-info: (2, 3, 5, 'final', 0) +startdate: Mon May 2 01:06:54 2005 +testreport-version: 1.1 +timeout: 900.0 +userhost: hpk at code1.codespeak.net +_reprs: {'execution-time': 'float', 'python-version-info': 'tuple', + 'options': 'list', 'timeout': 'float', 'pypy-revision': 'int', + 'exit status': 'int'} + +--===============0817316440374971092== +Content-Type: text/plain; charset="us-ascii" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Content-Disposition: attachment; filename="stdout" -============================================================ -faking -faking -faking -faking -faking test_copy_atomic (__main__.TestCopy) ... ok test_copy_basic (__main__.TestCopy) ... ok test_copy_cant (__main__.TestCopy) ... ok @@ -72,9 +80,20 @@ test_reduce_5tuple (__main__.TestCopy) ... ok ---------------------------------------------------------------------- -Ran 54 tests in 28.648s +Ran 54 tests in 28.788s OK -========================== closed ========================== -execution time: 37.4892439842 seconds -exit status: 0 + +--===============0817316440374971092== +Content-Type: text/plain; charset="us-ascii" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Content-Disposition: attachment; filename="stderr" + +faking +faking +faking +faking +faking + +--===============0817316440374971092==-- \ No newline at end of file Modified: pypy/testresult/hpk at code1.codespeak.net/test_copy_reg.txt ============================================================================== --- pypy/testresult/hpk at code1.codespeak.net/test_copy_reg.txt (original) +++ pypy/testresult/hpk at code1.codespeak.net/test_copy_reg.txt Mon May 2 02:07:05 2005 @@ -1,16 +1,46 @@ -testreport-version: 1.0 -command: /usr/bin/python /tmp/pypy-autotest-13/pypy-dist/pypy/tool/alarm.py 13499 /tmp/pypy-autotest-13/pypy-dist/pypy/interpreter/py.py /tmp/pypy-autotest-13/pypy-dist/lib-python-2.3.4/test/test_copy_reg.py -run by: hpk at code1.codespeak.net -sys.platform: linux2 -sys.version_info: (2, 3, 5, 'final', 0) -cpu model: AMD Opteron(tm) Processor 242 +Content-Type: multipart/mixed; boundary="===============0843311663596837869==" +MIME-Version: 1.0 cpu mhz: 1603.694 -oldstyle: no -pypy-revision: 11680 -startdate: Sun May 1 04:18:10 2005 -timeout: 13500.0 seconds +cpu model: AMD Opteron(tm) Processor 242 +execution-time: 28.2244009972 +exit status: 0 +fspath: /home/hpk/pypy-dist/lib-python/2.3.4/test/test_copy_reg.py +options: ['core'] +outcome: OK +platform: linux2 +pypy-revision: 11740 +python-version-info: (2, 3, 5, 'final', 0) +startdate: Mon May 2 01:07:34 2005 +testreport-version: 1.1 +timeout: 961.0 +userhost: hpk at code1.codespeak.net +_reprs: {'execution-time': 'float', 'python-version-info': 'tuple', + 'options': 'list', 'timeout': 'float', 'pypy-revision': 'int', + 'exit status': 'int'} + +--===============0843311663596837869== +Content-Type: text/plain; charset="us-ascii" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Content-Disposition: attachment; filename="stdout" + +test_bool (__main__.CopyRegTestCase) ... ok +test_class (__main__.CopyRegTestCase) ... ok +test_extension_registry (__main__.CopyRegTestCase) ... ok +test_noncallable_constructor (__main__.CopyRegTestCase) ... ok +test_noncallable_reduce (__main__.CopyRegTestCase) ... ok + +---------------------------------------------------------------------- +Ran 5 tests in 4.494s + +OK + +--===============0843311663596837869== +Content-Type: text/plain; charset="us-ascii" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Content-Disposition: attachment; filename="stderr" -============================================================ faking faking faking @@ -20,16 +50,5 @@ faking faking faking -test_bool (__main__.CopyRegTestCase) ... ok -test_class (__main__.CopyRegTestCase) ... ok -test_extension_registry (__main__.CopyRegTestCase) ... ok -test_noncallable_constructor (__main__.CopyRegTestCase) ... ok -test_noncallable_reduce (__main__.CopyRegTestCase) ... ok - ----------------------------------------------------------------------- -Ran 5 tests in 4.382s -OK -========================== closed ========================== -execution time: 26.4836170673 seconds -exit status: 0 +--===============0843311663596837869==-- \ No newline at end of file Added: pypy/testresult/hpk at code1.codespeak.net/test_cpickle.txt ============================================================================== --- (empty file) +++ pypy/testresult/hpk at code1.codespeak.net/test_cpickle.txt Mon May 2 02:07:05 2005 @@ -0,0 +1,48 @@ +Content-Type: multipart/mixed; boundary="===============9125714760833643939==" +MIME-Version: 1.0 +cpu mhz: 1603.694 +cpu model: AMD Opteron(tm) Processor 242 +execution-time: 10.5902080536 +exit status: 1 +fspath: /home/hpk/pypy-dist/lib-python/2.3.4/test/test_cpickle.py +options: ['core'] +outcome: ERR +platform: linux2 +pypy-revision: 11740 +python-version-info: (2, 3, 5, 'final', 0) +startdate: Mon May 2 01:08:02 2005 +testreport-version: 1.1 +timeout: 961.0 +userhost: hpk at code1.codespeak.net +_reprs: {'execution-time': 'float', 'python-version-info': 'tuple', + 'options': 'list', 'timeout': 'float', 'pypy-revision': 'int', + 'exit status': 'int'} + +--===============9125714760833643939== +Content-Type: text/plain; charset="us-ascii" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Content-Disposition: attachment; filename="stdout" + + +--===============9125714760833643939== +Content-Type: text/plain; charset="us-ascii" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Content-Disposition: attachment; filename="stderr" + +faking +faking +faking +faking +faking +faking +faking +faking +faking +Traceback (application-level): + File "/home/hpk/pypy-dist/lib-python/2.3.4/test/test_cpickle.py", line 4 in ? +from pickletester import AbstractPickleTests, AbstractPickleModuleTests +ImportError: pickletester + +--===============9125714760833643939==-- \ No newline at end of file Modified: pypy/testresult/hpk at code1.codespeak.net/test_datetime.txt ============================================================================== --- pypy/testresult/hpk at code1.codespeak.net/test_datetime.txt (original) +++ pypy/testresult/hpk at code1.codespeak.net/test_datetime.txt Mon May 2 02:07:05 2005 @@ -1,27 +1,29 @@ -testreport-version: 1.0 -command: /usr/bin/python /tmp/pypy-autotest-13/pypy-dist/pypy/tool/alarm.py 13499 /tmp/pypy-autotest-13/pypy-dist/pypy/interpreter/py.py /tmp/pypy-autotest-13/pypy-dist/lib-python-2.3.4/test/test_datetime.py -run by: hpk at code1.codespeak.net -sys.platform: linux2 -sys.version_info: (2, 3, 5, 'final', 0) -cpu model: AMD Opteron(tm) Processor 242 +Content-Type: multipart/mixed; boundary="===============6857137084721802396==" +MIME-Version: 1.0 cpu mhz: 1603.694 -oldstyle: no -pypy-revision: 11680 -startdate: Sun May 1 04:18:36 2005 -timeout: 13500.0 seconds +cpu model: AMD Opteron(tm) Processor 242 +execution-time: 840.960706949 +exit status: 1 +fspath: /home/hpk/pypy-dist/lib-python/2.3.4/test/test_datetime.py +options: ['core'] +outcome: T/O +platform: linux2 +pypy-revision: 11740 +python-version-info: (2, 3, 5, 'final', 0) +startdate: Mon May 2 01:08:14 2005 +testreport-version: 1.1 +timeout: 900.0 +userhost: hpk at code1.codespeak.net +_reprs: {'execution-time': 'float', 'python-version-info': 'tuple', + 'options': 'list', 'timeout': 'float', 'pypy-revision': 'int', + 'exit status': 'int'} + +--===============6857137084721802396== +Content-Type: text/plain; charset="us-ascii" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Content-Disposition: attachment; filename="stdout" -============================================================ -faking -faking -faking -faking -faking -faking -faking -faking -faking -faking -faking test_constants (__main__.TestModule) ... ok test_non_abstractness (__main__.TestTZInfo) ... ok test_normal (__main__.TestTZInfo) ... ok @@ -91,146 +93,46 @@ test_harmful_mixed_comparison (__main__.TestDateTime) ... ok test_harmless_mixed_comparison (__main__.TestDateTime) ... ok test_hash_equality (__main__.TestDateTime) ... ok -test_iso_long_years (__main__.TestDateTime) ... ok -test_isocalendar (__main__.TestDateTime) ... ok -test_isoformat (__main__.TestDateTime) ... ok -test_mixed_compare (__main__.TestDateTime) ... ok -test_more_compare (__main__.TestDateTime) ... ok -test_more_ctime (__main__.TestDateTime) ... ok -test_more_pickling (__main__.TestDateTime) ... ok -test_more_strftime (__main__.TestDateTime) ... ok -test_more_timetuple (__main__.TestDateTime) ... ok -test_ordinal_conversions (__main__.TestDateTime) ... ok -test_overflow (__main__.TestDateTime) ... ok -test_pickling (__main__.TestDateTime) ... ok -test_replace (__main__.TestDateTime) ... ok -test_resolution_info (__main__.TestDateTime) ... ok -test_roundtrip (__main__.TestDateTime) ... ok -test_srftime_out_of_range (__main__.TestDateTime) ... ok -test_strftime (__main__.TestDateTime) ... ok -test_subclass_date (__main__.TestDateTime) ... ok -test_subclass_datetime (__main__.TestDateTime) ... ok -test_timetuple (__main__.TestDateTime) ... ok -test_today (__main__.TestDateTime) ... ok -test_tz_independent_comparing (__main__.TestDateTime) ... ok -test_utcfromtimestamp (__main__.TestDateTime) ... ok -test_utcnow (__main__.TestDateTime) ... ok -test_weekday (__main__.TestDateTime) ... ok -test_bad_constructor_arguments (__main__.TestTime) ... ok -test_basic_attributes (__main__.TestTime) ... ok -test_basic_attributes_nonzero (__main__.TestTime) ... ok -test_bool (__main__.TestTime) ... ok -test_comparing (__main__.TestTime) ... ok -test_harmful_mixed_comparison (__main__.TestTime) ... ok -test_harmless_mixed_comparison (__main__.TestTime) ... ok -test_hash_equality (__main__.TestTime) ... ok -test_isoformat (__main__.TestTime) ... ok -test_pickling (__main__.TestTime) ... ok -test_replace (__main__.TestTime) ... ok -test_repr (__main__.TestTime) ... ok -test_resolution_info (__main__.TestTime) ... ok -test_roundtrip (__main__.TestTime) ... ok -test_str (__main__.TestTime) ... ok -test_strftime (__main__.TestTime) ... ok -test_subclass_time (__main__.TestTime) ... ok -test_argument_passing (__main__.TestTimeTZ) ... ok -test_aware_compare (__main__.TestTimeTZ) ... ok -test_bad_constructor_arguments (__main__.TestTimeTZ) ... ok -test_bad_tzinfo_classes (__main__.TestTimeTZ) ... ok -test_basic_attributes (__main__.TestTimeTZ) ... ok -test_basic_attributes_nonzero (__main__.TestTimeTZ) ... ok -test_bool (__main__.TestTimeTZ) ... ok -test_comparing (__main__.TestTimeTZ) ... ok -test_empty (__main__.TestTimeTZ) ... ok -test_harmful_mixed_comparison (__main__.TestTimeTZ) ... ok -test_harmless_mixed_comparison (__main__.TestTimeTZ) ... ok -test_hash_edge_cases (__main__.TestTimeTZ) ... ok -test_hash_equality (__main__.TestTimeTZ) ... ok -test_isoformat (__main__.TestTimeTZ) ... ok -test_mixed_compare (__main__.TestTimeTZ) ... ok -test_more_bool (__main__.TestTimeTZ) ... ok -test_pickling (__main__.TestTimeTZ) ... ok -test_replace (__main__.TestTimeTZ) ... ok -test_repr (__main__.TestTimeTZ) ... ok -test_resolution_info (__main__.TestTimeTZ) ... ok -test_roundtrip (__main__.TestTimeTZ) ... ok -test_str (__main__.TestTimeTZ) ... ok -test_strftime (__main__.TestTimeTZ) ... ok -test_subclass_time (__main__.TestTimeTZ) ... ok -test_subclass_timetz (__main__.TestTimeTZ) ... ok -test_tzinfo_classes (__main__.TestTimeTZ) ... ok -test_utc_offset_out_of_bounds (__main__.TestTimeTZ) ... ok -test_zones (__main__.TestTimeTZ) ... ok -test_argument_passing (__main__.TestDateTimeTZ) ... ok -test_astimezone (__main__.TestDateTimeTZ) ... ok -test_aware_compare (__main__.TestDateTimeTZ) ... ok -test_aware_subtract (__main__.TestDateTimeTZ) ... ok -test_bad_constructor_arguments (__main__.TestDateTimeTZ) ... ok -test_bad_tzinfo_classes (__main__.TestDateTimeTZ) ... ok -test_basic_attributes (__main__.TestDateTimeTZ) ... ok -test_basic_attributes_nonzero (__main__.TestDateTimeTZ) ... ok -test_bool (__main__.TestDateTimeTZ) ... ok -test_combine (__main__.TestDateTimeTZ) ... ok -test_compare (__main__.TestDateTimeTZ) ... ok -test_computations (__main__.TestDateTimeTZ) ... ok -test_ctime (__main__.TestDateTimeTZ) ... ok -test_even_more_compare (__main__.TestDateTimeTZ) ... ok -test_extract (__main__.TestDateTimeTZ) ... ok -test_extreme_hashes (__main__.TestDateTimeTZ) ... ok -test_extreme_ordinals (__main__.TestDateTimeTZ) ... ok -test_extreme_timedelta (__main__.TestDateTimeTZ) ... ok -test_fromtimestamp (__main__.TestDateTimeTZ) ... ok -test_harmful_mixed_comparison (__main__.TestDateTimeTZ) ... ok -test_harmless_mixed_comparison (__main__.TestDateTimeTZ) ... ok -test_hash_equality (__main__.TestDateTimeTZ) ... ok -test_iso_long_years (__main__.TestDateTimeTZ) ... ok -test_isocalendar (__main__.TestDateTimeTZ) ... ok -test_isoformat (__main__.TestDateTimeTZ) ... ok -test_mixed_compare (__main__.TestDateTimeTZ) ... ok -test_more_astimezone (__main__.TestDateTimeTZ) ... ok -test_more_compare (__main__.TestDateTimeTZ) ... ok -test_more_ctime (__main__.TestDateTimeTZ) ... ok -test_more_pickling (__main__.TestDateTimeTZ) ... ok -test_more_strftime (__main__.TestDateTimeTZ) ... ok -test_more_timetuple (__main__.TestDateTimeTZ) ... ok -test_ordinal_conversions (__main__.TestDateTimeTZ) ... ok -test_overflow (__main__.TestDateTimeTZ) ... ok -test_pickling (__main__.TestDateTimeTZ) ... ok -test_replace (__main__.TestDateTimeTZ) ... ok -test_resolution_info (__main__.TestDateTimeTZ) ... ok -test_roundtrip (__main__.TestDateTimeTZ) ... ok -test_srftime_out_of_range (__main__.TestDateTimeTZ) ... ok -test_strftime (__main__.TestDateTimeTZ) ... ok -test_subclass_date (__main__.TestDateTimeTZ) ... ok -test_subclass_datetime (__main__.TestDateTimeTZ) ... ok -test_subclass_datetimetz (__main__.TestDateTimeTZ) ... ok -test_timetuple (__main__.TestDateTimeTZ) ... ok -test_today (__main__.TestDateTimeTZ) ... ok -test_trivial (__main__.TestDateTimeTZ) ... ok -test_tz_aware_arithmetic (__main__.TestDateTimeTZ) ... ok -test_tz_independent_comparing (__main__.TestDateTimeTZ) ... ok -test_tzinfo_classes (__main__.TestDateTimeTZ) ... ok -test_tzinfo_fromtimestamp (__main__.TestDateTimeTZ) ... ok -test_tzinfo_isoformat (__main__.TestDateTimeTZ) ... ok -test_tzinfo_now (__main__.TestDateTimeTZ) ... ok -test_tzinfo_timetuple (__main__.TestDateTimeTZ) ... ok -test_tzinfo_utcfromtimestamp (__main__.TestDateTimeTZ) ... ok -test_tzinfo_utcnow (__main__.TestDateTimeTZ) ... ok -test_utc_offset_out_of_bounds (__main__.TestDateTimeTZ) ... ok -test_utcfromtimestamp (__main__.TestDateTimeTZ) ... ok -test_utcnow (__main__.TestDateTimeTZ) ... ok -test_utctimetuple (__main__.TestDateTimeTZ) ... ok -test_weekday (__main__.TestDateTimeTZ) ... ok -test_zones (__main__.TestDateTimeTZ) ... ok -test_bogus_dst (__main__.TestTimezoneConversions) ... ok -test_easy (__main__.TestTimezoneConversions) ... ok -test_fromutc (__main__.TestTimezoneConversions) ... ok -test_tricky (__main__.TestTimezoneConversions) ... ok +test_iso_long_years (__main__.TestDateTime) ... +--===============6857137084721802396== +Content-Type: text/plain; charset="us-ascii" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Content-Disposition: attachment; filename="stderr" ----------------------------------------------------------------------- -Ran 204 tests in 6078.306s +faking +faking +faking +faking +faking +faking +faking +faking +faking +faking +faking +==========================timedout========================== +Traceback (application-level): + File "/home/hpk/pypy-dist/lib-python/2.3.4/test/test_datetime.py", line 3113 in ? + test_main() + File "/home/hpk/pypy-dist/lib-python/2.3.4/test/test_datetime.py", line 3096 in test_main + test_support.run_suite(thesuite) + File "/home/hpk/pypy-dist/lib-python/2.3.4/test/test_support.py", line 234 in run_suite + result = runner.run(suite) + File "/home/hpk/pypy-dist/lib-python/2.3.4/unittest.py", line 658 in run + test(result) + File "/home/hpk/pypy-dist/lib-python/2.3.4/unittest.py", line 389 in __call__ + test(result) + File "/home/hpk/pypy-dist/lib-python/2.3.4/unittest.py", line 389 in __call__ + test(result) + File "/home/hpk/pypy-dist/lib-python/2.3.4/unittest.py", line 229 in __call__ + testMethod() + File "/home/hpk/pypy-dist/lib-python/2.3.4/test/test_datetime.py", line 817 in test_iso_long_years + d1 = self.theclass(1600+i, 12, 31) + File "/home/hpk/pypy-dist/pypy/lib/datetime.py", line 1373 in __new__ + _check_tzinfo_arg(tzinfo) + File "/home/hpk/pypy-dist/pypy/lib/datetime.py", line 288 in _check_tzinfo_arg + if tz is not None and not isinstance(tz, tzinfo): +KeyboardInterrupt -OK -========================== closed ========================== -execution time: 6128.61391592 seconds -exit status: 0 +--===============6857137084721802396==-- \ No newline at end of file Added: pypy/testresult/hpk at code1.codespeak.net/test_descr.txt ============================================================================== --- (empty file) +++ pypy/testresult/hpk at code1.codespeak.net/test_descr.txt Mon May 2 02:07:05 2005 @@ -0,0 +1,53 @@ +Content-Type: multipart/mixed; boundary="===============4114596057268237062==" +MIME-Version: 1.0 +cpu mhz: 1603.694 +cpu model: AMD Opteron(tm) Processor 242 +execution-time: 14.3860909939 +exit status: 1 +fspath: /home/hpk/pypy-dist/lib-python/2.3.4/test/test_descr.py +options: ['core'] +outcome: ERR +platform: linux2 +pypy-revision: 11740 +python-version-info: (2, 3, 5, 'final', 0) +startdate: Mon May 2 01:22:16 2005 +testreport-version: 1.1 +timeout: 900.0 +userhost: hpk at code1.codespeak.net +_reprs: {'execution-time': 'float', 'python-version-info': 'tuple', + 'options': 'list', 'timeout': 'float', 'pypy-revision': 'int', + 'exit status': 'int'} + +--===============4114596057268237062== +Content-Type: text/plain; charset="us-ascii" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Content-Disposition: attachment; filename="stdout" + +Testing weakref segfault... + +--===============4114596057268237062== +Content-Type: text/plain; charset="us-ascii" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Content-Disposition: attachment; filename="stderr" + +faking +faking +faking +faking +faking +faking +faking +Traceback (application-level): + File "/home/hpk/pypy-dist/lib-python/2.3.4/test/test_descr.py", line 4050 in ? + test_main() + File "/home/hpk/pypy-dist/lib-python/2.3.4/test/test_descr.py", line 3956 in test_main + weakref_segfault() # Must be first, somehow + File "/home/hpk/pypy-dist/lib-python/2.3.4/test/test_descr.py", line 3924 in weakref_segfault + import weakref + File "/home/hpk/pypy-dist/lib-python/2.3.4/weakref.py", line 14 in ? +from _weakref import \ +ImportError: _weakref + +--===============4114596057268237062==-- \ No newline at end of file Added: pypy/testresult/hpk at code1.codespeak.net/test_descrtut.txt ============================================================================== --- (empty file) +++ pypy/testresult/hpk at code1.codespeak.net/test_descrtut.txt Mon May 2 02:07:05 2005 @@ -0,0 +1,45 @@ +Content-Type: multipart/mixed; boundary="===============2617437723938004455==" +MIME-Version: 1.0 +cpu mhz: 1603.694 +cpu model: AMD Opteron(tm) Processor 242 +execution-time: 515.012633085 +exit status: 0 +fspath: /home/hpk/pypy-dist/lib-python/modified-2.3.4/test/test_descrtut.py +options: ['oldstyle', 'core'] +outcome: OK +platform: linux2 +pypy-revision: 11740 +python-version-info: (2, 3, 5, 'final', 0) +startdate: Mon May 2 01:22:32 2005 +testreport-version: 1.1 +timeout: 900.0 +userhost: hpk at code1.codespeak.net +_reprs: {'execution-time': 'float', 'python-version-info': 'tuple', + 'options': 'list', 'timeout': 'float', 'pypy-revision': 'int', + 'exit status': 'int'} + +--===============2617437723938004455== +Content-Type: text/plain; charset="us-ascii" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Content-Disposition: attachment; filename="stdout" + +doctest (test.test_descrtut) ... 98 tests with zero failures + +--===============2617437723938004455== +Content-Type: text/plain; charset="us-ascii" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Content-Disposition: attachment; filename="stderr" + +faking +faking +faking +faking +faking +faking +faking +faking +faking + +--===============2617437723938004455==-- \ No newline at end of file Modified: pypy/testresult/hpk at code1.codespeak.net/test_difflib.txt ============================================================================== --- pypy/testresult/hpk at code1.codespeak.net/test_difflib.txt (original) +++ pypy/testresult/hpk at code1.codespeak.net/test_difflib.txt Mon May 2 02:07:05 2005 @@ -1,25 +1,29 @@ -testreport-version: 1.0 -command: /usr/bin/python /tmp/pypy-autotest-13/pypy-dist/pypy/tool/alarm.py 12615 /tmp/pypy-autotest-13/pypy-dist/pypy/interpreter/py.py /tmp/pypy-autotest-13/pypy-dist/lib-python-2.3.4/test/test_difflib.py -run by: hpk at code1.codespeak.net -sys.platform: linux2 -sys.version_info: (2, 3, 5, 'final', 0) -cpu model: AMD Opteron(tm) Processor 242 +Content-Type: multipart/mixed; boundary="===============8424126821223750527==" +MIME-Version: 1.0 cpu mhz: 1603.694 -oldstyle: no -pypy-revision: 11680 -startdate: Sun May 1 06:00:45 2005 -timeout: 12615.0 seconds +cpu model: AMD Opteron(tm) Processor 242 +execution-time: 160.395385027 +exit status: 0 +fspath: /home/hpk/pypy-dist/lib-python/2.3.4/test/test_difflib.py +options: ['core'] +outcome: OK +platform: linux2 +pypy-revision: 11740 +python-version-info: (2, 3, 5, 'final', 0) +startdate: Mon May 2 01:31:07 2005 +testreport-version: 1.1 +timeout: 900.0 +userhost: hpk at code1.codespeak.net +_reprs: {'execution-time': 'float', 'python-version-info': 'tuple', + 'options': 'list', 'timeout': 'float', 'pypy-revision': 'int', + 'exit status': 'int'} + +--===============8424126821223750527== +Content-Type: text/plain; charset="us-ascii" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Content-Disposition: attachment; filename="stdout" -============================================================ -faking -faking -faking -faking -faking -faking -faking -faking -faking test_ratio_for_null_seqn (__main__.TestSFbugs) ... ok doctest of difflib.Differ ... ok doctest of difflib.Differ._fancy_replace ... ok @@ -44,9 +48,24 @@ doctest of difflib.unified_diff ... ok ---------------------------------------------------------------------- -Ran 22 tests in 74.307s +Ran 22 tests in 74.003s OK -========================== closed ========================== -execution time: 159.110135078 seconds -exit status: 0 + +--===============8424126821223750527== +Content-Type: text/plain; charset="us-ascii" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Content-Disposition: attachment; filename="stderr" + +faking +faking +faking +faking +faking +faking +faking +faking +faking + +--===============8424126821223750527==-- \ No newline at end of file Modified: pypy/testresult/hpk at code1.codespeak.net/test_dircache.txt ============================================================================== --- pypy/testresult/hpk at code1.codespeak.net/test_dircache.txt (original) +++ pypy/testresult/hpk at code1.codespeak.net/test_dircache.txt Mon May 2 02:07:05 2005 @@ -1,28 +1,47 @@ -testreport-version: 1.0 -command: /usr/bin/python /tmp/pypy-autotest-13/pypy-dist/pypy/tool/alarm.py 13499 /tmp/pypy-autotest-13/pypy-dist/pypy/interpreter/py.py /tmp/pypy-autotest-13/pypy-dist/lib-python-2.3.4/test/test_dircache.py -run by: hpk at code1.codespeak.net -sys.platform: linux2 -sys.version_info: (2, 3, 5, 'final', 0) -cpu model: AMD Opteron(tm) Processor 242 +Content-Type: multipart/mixed; boundary="===============0363522981746676031==" +MIME-Version: 1.0 cpu mhz: 1603.694 -oldstyle: no -pypy-revision: 11680 -startdate: Sun May 1 06:03:25 2005 -timeout: 13500.0 seconds +cpu model: AMD Opteron(tm) Processor 242 +execution-time: 10.5831279755 +exit status: 0 +fspath: /home/hpk/pypy-dist/lib-python/2.3.4/test/test_dircache.py +options: ['core'] +outcome: OK +platform: linux2 +pypy-revision: 11740 +python-version-info: (2, 3, 5, 'final', 0) +startdate: Mon May 2 01:33:48 2005 +testreport-version: 1.1 +timeout: 961.0 +userhost: hpk at code1.codespeak.net +_reprs: {'execution-time': 'float', 'python-version-info': 'tuple', + 'options': 'list', 'timeout': 'float', 'pypy-revision': 'int', + 'exit status': 'int'} + +--===============0363522981746676031== +Content-Type: text/plain; charset="us-ascii" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Content-Disposition: attachment; filename="stdout" -============================================================ -faking -faking -faking -faking -faking test_annotate (__main__.DircacheTests) ... ok test_listdir (__main__.DircacheTests) ... ok ---------------------------------------------------------------------- -Ran 2 tests in 2.140s +Ran 2 tests in 2.146s OK -========================== closed ========================== -execution time: 9.32487916946 seconds -exit status: 0 + +--===============0363522981746676031== +Content-Type: text/plain; charset="us-ascii" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Content-Disposition: attachment; filename="stderr" + +faking +faking +faking +faking +faking + +--===============0363522981746676031==-- \ No newline at end of file Modified: pypy/testresult/hpk at code1.codespeak.net/test_doctest.txt ============================================================================== --- pypy/testresult/hpk at code1.codespeak.net/test_doctest.txt (original) +++ pypy/testresult/hpk at code1.codespeak.net/test_doctest.txt Mon May 2 02:07:05 2005 @@ -1,25 +1,29 @@ -testreport-version: 1.0 -command: /usr/bin/python /tmp/pypy-autotest-13/pypy-dist/pypy/tool/alarm.py 11760 /tmp/pypy-autotest-13/pypy-dist/pypy/interpreter/py.py /tmp/pypy-autotest-13/pypy-dist/lib-python-2.3.4/test/test_doctest.py -run by: hpk at code1.codespeak.net -sys.platform: linux2 -sys.version_info: (2, 3, 5, 'final', 0) -cpu model: AMD Opteron(tm) Processor 242 +Content-Type: multipart/mixed; boundary="===============1114252885650816184==" +MIME-Version: 1.0 cpu mhz: 1603.694 -oldstyle: no -pypy-revision: 11680 -startdate: Sun May 1 06:03:54 2005 -timeout: 11760.0 seconds +cpu model: AMD Opteron(tm) Processor 242 +execution-time: 132.446833134 +exit status: 0 +fspath: /home/hpk/pypy-dist/lib-python/2.3.4/test/test_doctest.py +options: ['core'] +outcome: OK +platform: linux2 +pypy-revision: 11740 +python-version-info: (2, 3, 5, 'final', 0) +startdate: Mon May 2 01:33:59 2005 +testreport-version: 1.1 +timeout: 900.0 +userhost: hpk at code1.codespeak.net +_reprs: {'execution-time': 'float', 'python-version-info': 'tuple', + 'options': 'list', 'timeout': 'float', 'pypy-revision': 'int', + 'exit status': 'int'} + +--===============1114252885650816184== +Content-Type: text/plain; charset="us-ascii" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Content-Disposition: attachment; filename="stdout" -============================================================ -faking -faking -faking -faking -faking -faking -faking -faking -faking Running doctest.__doc__ Trying: [1, 2, 3].remove(42) Expecting: @@ -475,6 +479,21 @@ 71 passed and 0 failed. Test passed. doctest (doctest) ... 71 tests with zero failures -========================== closed ========================== -execution time: 130.20766902 seconds -exit status: 0 + +--===============1114252885650816184== +Content-Type: text/plain; charset="us-ascii" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Content-Disposition: attachment; filename="stderr" + +faking +faking +faking +faking +faking +faking +faking +faking +faking + +--===============1114252885650816184==-- \ No newline at end of file Modified: pypy/testresult/hpk at code1.codespeak.net/test_doctest2.txt ============================================================================== --- pypy/testresult/hpk at code1.codespeak.net/test_doctest2.txt (original) +++ pypy/testresult/hpk at code1.codespeak.net/test_doctest2.txt Mon May 2 02:07:05 2005 @@ -1,25 +1,29 @@ -testreport-version: 1.0 -command: /usr/bin/python /tmp/pypy-autotest-13/pypy-dist/pypy/tool/alarm.py 13500 /tmp/pypy-autotest-13/pypy-dist/pypy/interpreter/py.py /tmp/pypy-autotest-13/pypy-dist/lib-python-2.3.4/test/test_doctest2.py -run by: hpk at code1.codespeak.net -sys.platform: linux2 -sys.version_info: (2, 3, 5, 'final', 0) -cpu model: AMD Opteron(tm) Processor 242 +Content-Type: multipart/mixed; boundary="===============7890450275465421876==" +MIME-Version: 1.0 cpu mhz: 1603.694 -oldstyle: no -pypy-revision: 11680 -startdate: Sun May 1 06:06:05 2005 -timeout: 13500.0 seconds +cpu model: AMD Opteron(tm) Processor 242 +execution-time: 92.3654580116 +exit status: 0 +fspath: /home/hpk/pypy-dist/lib-python/2.3.4/test/test_doctest2.py +options: ['core'] +outcome: OK +platform: linux2 +pypy-revision: 11740 +python-version-info: (2, 3, 5, 'final', 0) +startdate: Mon May 2 01:36:13 2005 +testreport-version: 1.1 +timeout: 961.0 +userhost: hpk at code1.codespeak.net +_reprs: {'execution-time': 'float', 'python-version-info': 'tuple', + 'options': 'list', 'timeout': 'float', 'pypy-revision': 'int', + 'exit status': 'int'} + +--===============7890450275465421876== +Content-Type: text/plain; charset="us-ascii" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Content-Disposition: attachment; filename="stdout" -============================================================ -faking -faking -faking -faking -faking -faking -faking -faking -faking Running test.test_doctest2.__doc__ Trying: print 'yup' # 1 Expecting: yup @@ -119,6 +123,21 @@ 19 passed and 0 failed. Test passed. doctest (test.test_doctest2) ... 19 tests with zero failures -========================== closed ========================== -execution time: 91.6306838989 seconds -exit status: 0 + +--===============7890450275465421876== +Content-Type: text/plain; charset="us-ascii" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Content-Disposition: attachment; filename="stderr" + +faking +faking +faking +faking +faking +faking +faking +faking +faking + +--===============7890450275465421876==-- \ No newline at end of file Modified: pypy/testresult/hpk at code1.codespeak.net/test_dumbdbm.txt ============================================================================== --- pypy/testresult/hpk at code1.codespeak.net/test_dumbdbm.txt (original) +++ pypy/testresult/hpk at code1.codespeak.net/test_dumbdbm.txt Mon May 2 02:07:05 2005 @@ -1,21 +1,29 @@ -testreport-version: 1.0 -command: /usr/bin/python /tmp/pypy-autotest-13/pypy-dist/pypy/tool/alarm.py 13499 /tmp/pypy-autotest-13/pypy-dist/pypy/interpreter/py.py /tmp/pypy-autotest-13/pypy-dist/lib-python-2.3.4/test/test_dumbdbm.py -run by: hpk at code1.codespeak.net -sys.platform: linux2 -sys.version_info: (2, 3, 5, 'final', 0) -cpu model: AMD Opteron(tm) Processor 242 +Content-Type: multipart/mixed; boundary="===============5816551474478010972==" +MIME-Version: 1.0 cpu mhz: 1603.694 -oldstyle: no -pypy-revision: 11680 -startdate: Sun May 1 06:07:37 2005 -timeout: 13500.0 seconds +cpu model: AMD Opteron(tm) Processor 242 +execution-time: 244.574339867 +exit status: 0 +fspath: /home/hpk/pypy-dist/lib-python/2.3.4/test/test_dumbdbm.py +options: ['core'] +outcome: OK +platform: linux2 +pypy-revision: 11740 +python-version-info: (2, 3, 5, 'final', 0) +startdate: Mon May 2 01:37:46 2005 +testreport-version: 1.1 +timeout: 900.0 +userhost: hpk at code1.codespeak.net +_reprs: {'execution-time': 'float', 'python-version-info': 'tuple', + 'options': 'list', 'timeout': 'float', 'pypy-revision': 'int', + 'exit status': 'int'} + +--===============5816551474478010972== +Content-Type: text/plain; charset="us-ascii" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Content-Disposition: attachment; filename="stdout" -============================================================ -faking -faking -faking -faking -faking test_close_twice (__main__.DumbDBMTestCase) ... ok test_dumbdbm_creation (__main__.DumbDBMTestCase) ... ok test_dumbdbm_keys (__main__.DumbDBMTestCase) ... ok @@ -25,9 +33,20 @@ test_write_write_read (__main__.DumbDBMTestCase) ... ok ---------------------------------------------------------------------- -Ran 7 tests in 209.210s +Ran 7 tests in 236.013s OK -========================== closed ========================== -execution time: 216.679497957 seconds -exit status: 0 + +--===============5816551474478010972== +Content-Type: text/plain; charset="us-ascii" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Content-Disposition: attachment; filename="stderr" + +faking +faking +faking +faking +faking + +--===============5816551474478010972==-- \ No newline at end of file Modified: pypy/testresult/hpk at code1.codespeak.net/test_dummy_thread.txt ============================================================================== --- pypy/testresult/hpk at code1.codespeak.net/test_dummy_thread.txt (original) +++ pypy/testresult/hpk at code1.codespeak.net/test_dummy_thread.txt Mon May 2 02:07:05 2005 @@ -1,23 +1,31 @@ -testreport-version: 1.0 -command: /usr/bin/python /tmp/pypy-autotest-13/pypy-dist/pypy/tool/alarm.py 13500 /tmp/pypy-autotest-13/pypy-dist/pypy/interpreter/py.py /tmp/pypy-autotest-13/pypy-dist/lib-python-2.3.4/test/test_dummy_thread.py -run by: hpk at code1.codespeak.net -sys.platform: linux2 -sys.version_info: (2, 3, 5, 'final', 0) -cpu model: AMD Opteron(tm) Processor 242 +Content-Type: multipart/mixed; boundary="===============2384455408891780252==" +MIME-Version: 1.0 cpu mhz: 1603.694 -oldstyle: no -pypy-revision: 11680 -startdate: Sun May 1 06:11:14 2005 -timeout: 13500.0 seconds +cpu model: AMD Opteron(tm) Processor 242 +execution-time: 24.9750230312 +exit status: 0 +fspath: /home/hpk/pypy-dist/lib-python/2.3.4/test/test_dummy_thread.py +options: ['core'] +outcome: OK +platform: linux2 +pypy-revision: 11740 +python-version-info: (2, 3, 5, 'final', 0) +startdate: Mon May 2 01:41:51 2005 +testreport-version: 1.1 +timeout: 961.0 +userhost: hpk at code1.codespeak.net +_reprs: {'execution-time': 'float', 'python-version-info': 'tuple', + 'options': 'list', 'timeout': 'float', 'pypy-revision': 'int', + 'exit status': 'int'} + +--===============2384455408891780252== +Content-Type: text/plain; charset="us-ascii" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Content-Disposition: attachment; filename="stdout" -============================================================ -faking -faking -faking -faking -faking -*** Using as _thread module *** +*** Using as _thread module *** test_cond_acquire_fail (__main__.LockTests) ... ok test_cond_acquire_success (__main__.LockTests) ... ok test_improper_release (__main__.LockTests) ... ok @@ -41,9 +49,20 @@ ok ---------------------------------------------------------------------- -Ran 15 tests in 6.654s +Ran 15 tests in 6.826s OK -========================== closed ========================== -execution time: 17.8472099304 seconds -exit status: 0 + +--===============2384455408891780252== +Content-Type: text/plain; charset="us-ascii" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Content-Disposition: attachment; filename="stderr" + +faking +faking +faking +faking +faking + +--===============2384455408891780252==-- \ No newline at end of file Modified: pypy/testresult/hpk at code1.codespeak.net/test_dummy_threading.txt ============================================================================== --- pypy/testresult/hpk at code1.codespeak.net/test_dummy_threading.txt (original) +++ pypy/testresult/hpk at code1.codespeak.net/test_dummy_threading.txt Mon May 2 02:07:05 2005 @@ -1,21 +1,29 @@ -testreport-version: 1.0 -command: /usr/bin/python /tmp/pypy-autotest-13/pypy-dist/pypy/tool/alarm.py 13499 /tmp/pypy-autotest-13/pypy-dist/pypy/interpreter/py.py /tmp/pypy-autotest-13/pypy-dist/lib-python-2.3.4/test/test_dummy_threading.py -run by: hpk at code1.codespeak.net -sys.platform: linux2 -sys.version_info: (2, 3, 5, 'final', 0) -cpu model: AMD Opteron(tm) Processor 242 +Content-Type: multipart/mixed; boundary="===============0542761181908430962==" +MIME-Version: 1.0 cpu mhz: 1603.694 -oldstyle: no -pypy-revision: 11680 -startdate: Sun May 1 06:11:32 2005 -timeout: 13500.0 seconds +cpu model: AMD Opteron(tm) Processor 242 +execution-time: 18.9056818485 +exit status: 0 +fspath: /home/hpk/pypy-dist/lib-python/2.3.4/test/test_dummy_threading.py +options: ['core'] +outcome: OK +platform: linux2 +pypy-revision: 11740 +python-version-info: (2, 3, 5, 'final', 0) +startdate: Mon May 2 01:42:16 2005 +testreport-version: 1.1 +timeout: 841.0 +userhost: hpk at code1.codespeak.net +_reprs: {'execution-time': 'float', 'python-version-info': 'tuple', + 'options': 'list', 'timeout': 'float', 'pypy-revision': 'int', + 'exit status': 'int'} + +--===============0542761181908430962== +Content-Type: text/plain; charset="us-ascii" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Content-Disposition: attachment; filename="stdout" -============================================================ -faking -faking -faking -faking -faking task will run for 0 sec 1 tasks are running task done @@ -58,6 +66,17 @@ is finished. 0 tasks are running waiting for all tasks to complete all tasks done -========================== closed ========================== -execution time: 14.905369997 seconds -exit status: 0 + +--===============0542761181908430962== +Content-Type: text/plain; charset="us-ascii" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Content-Disposition: attachment; filename="stderr" + +faking +faking +faking +faking +faking + +--===============0542761181908430962==-- \ No newline at end of file Modified: pypy/testresult/hpk at code1.codespeak.net/test_enumerate.txt ============================================================================== --- pypy/testresult/hpk at code1.codespeak.net/test_enumerate.txt (original) +++ pypy/testresult/hpk at code1.codespeak.net/test_enumerate.txt Mon May 2 02:07:05 2005 @@ -1,21 +1,29 @@ -testreport-version: 1.0 -command: /usr/bin/python /tmp/pypy-autotest-13/pypy-dist/pypy/tool/alarm.py 13499 /tmp/pypy-autotest-13/pypy-dist/pypy/interpreter/py.py /tmp/pypy-autotest-13/pypy-dist/pypy/lib/test2/test_enumerate.py -run by: hpk at code1.codespeak.net -sys.platform: linux2 -sys.version_info: (2, 3, 5, 'final', 0) -cpu model: AMD Opteron(tm) Processor 242 +Content-Type: multipart/mixed; boundary="===============6951698893488305020==" +MIME-Version: 1.0 cpu mhz: 1603.694 -oldstyle: no -pypy-revision: 11680 -startdate: Sun May 1 06:11:47 2005 -timeout: 13500.0 seconds +cpu model: AMD Opteron(tm) Processor 242 +execution-time: 48.7223269939 +exit status: 0 +fspath: /home/hpk/pypy-dist/lib-python/modified-2.3.4/test/test_enumerate.py +options: ['core'] +outcome: OK +platform: linux2 +pypy-revision: 11740 +python-version-info: (2, 3, 5, 'final', 0) +startdate: Mon May 2 01:42:36 2005 +testreport-version: 1.1 +timeout: 900.0 +userhost: hpk at code1.codespeak.net +_reprs: {'execution-time': 'float', 'python-version-info': 'tuple', + 'options': 'list', 'timeout': 'float', 'pypy-revision': 'int', + 'exit status': 'int'} + +--===============6951698893488305020== +Content-Type: text/plain; charset="us-ascii" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Content-Disposition: attachment; filename="stdout" -============================================================ -faking -faking -faking -faking -faking test_argumentcheck (__main__.EnumerateTestCase) ... ok test_basicfunction (__main__.EnumerateTestCase) ... ok test_exception_propagation (__main__.EnumerateTestCase) ... ok @@ -50,9 +58,20 @@ test_noniterable (__main__.TestBig) ... ok ---------------------------------------------------------------------- -Ran 32 tests in 15.337s +Ran 32 tests in 15.259s OK -========================== closed ========================== -execution time: 32.6361069679 seconds -exit status: 0 + +--===============6951698893488305020== +Content-Type: text/plain; charset="us-ascii" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Content-Disposition: attachment; filename="stderr" + +faking +faking +faking +faking +faking + +--===============6951698893488305020==-- \ No newline at end of file Added: pypy/testresult/hpk at code1.codespeak.net/test_eof.txt ============================================================================== --- (empty file) +++ pypy/testresult/hpk at code1.codespeak.net/test_eof.txt Mon May 2 02:07:05 2005 @@ -0,0 +1,77 @@ +Content-Type: multipart/mixed; boundary="===============8735672265159867016==" +MIME-Version: 1.0 +cpu mhz: 1603.694 +cpu model: AMD Opteron(tm) Processor 242 +execution-time: 12.8019227982 +exit status: 1 +fspath: /home/hpk/pypy-dist/lib-python/2.3.4/test/test_eof.py +options: ['core'] +outcome: ERR +platform: linux2 +pypy-revision: 11740 +python-version-info: (2, 3, 5, 'final', 0) +startdate: Mon May 2 01:43:26 2005 +testreport-version: 1.1 +timeout: 900.0 +userhost: hpk at code1.codespeak.net +_reprs: {'execution-time': 'float', 'python-version-info': 'tuple', + 'options': 'list', 'timeout': 'float', 'pypy-revision': 'int', + 'exit status': 'int'} + +--===============8735672265159867016== +Content-Type: text/plain; charset="us-ascii" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Content-Disposition: attachment; filename="stdout" + +test_EOFC (__main__.EOFTestCase) ... FAIL +test_EOFS (__main__.EOFTestCase) ... FAIL + +====================================================================== +FAIL: test_EOFC (__main__.EOFTestCase) +---------------------------------------------------------------------- +Traceback (most recent call last): + File "/home/hpk/pypy-dist/lib-python/2.3.4/test/test_eof.py", line 15, in test_EOFC + "EOL while scanning single-quoted string (line 1)") + File "/home/hpk/pypy-dist/lib-python/2.3.4/unittest.py", line 302, in failUnlessEqual + raise self.failureException, \ +AssertionError: 'EOL while scanning single-quoted string (, line 1)' != 'EOL while scanning single-quoted string (line 1)' + +====================================================================== +FAIL: test_EOFS (__main__.EOFTestCase) +---------------------------------------------------------------------- +Traceback (most recent call last): + File "/home/hpk/pypy-dist/lib-python/2.3.4/test/test_eof.py", line 24, in test_EOFS + "EOF while scanning triple-quoted string (line 1)") + File "/home/hpk/pypy-dist/lib-python/2.3.4/unittest.py", line 302, in failUnlessEqual + raise self.failureException, \ +AssertionError: 'EOF while scanning triple-quoted string (, line 1)' != 'EOF while scanning triple-quoted string (line 1)' + +---------------------------------------------------------------------- +Ran 2 tests in 3.321s + +FAILED (failures=2) + +--===============8735672265159867016== +Content-Type: text/plain; charset="us-ascii" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Content-Disposition: attachment; filename="stderr" + +faking +faking +faking +faking +faking +Traceback (application-level): + File "/home/hpk/pypy-dist/lib-python/2.3.4/test/test_eof.py", line 32 in ? + test_main() + File "/home/hpk/pypy-dist/lib-python/2.3.4/test/test_eof.py", line 29 in test_main + test_support.run_unittest(EOFTestCase) + File "/home/hpk/pypy-dist/lib-python/2.3.4/test/test_support.py", line 262 in run_unittest + run_suite(suite, testclass) + File "/home/hpk/pypy-dist/lib-python/2.3.4/test/test_support.py", line 246 in run_suite + raise TestFailed(msg) +TestFailed: errors occurred in __main__.EOFTestCase + +--===============8735672265159867016==-- \ No newline at end of file Added: pypy/testresult/hpk at code1.codespeak.net/test_exceptions.txt ============================================================================== --- (empty file) +++ pypy/testresult/hpk at code1.codespeak.net/test_exceptions.txt Mon May 2 02:07:05 2005 @@ -0,0 +1,70 @@ +Content-Type: multipart/mixed; boundary="===============2052670225221871720==" +MIME-Version: 1.0 +cpu mhz: 1603.694 +cpu model: AMD Opteron(tm) Processor 242 +execution-time: 901.500221968 +exit status: 1 +fspath: /home/hpk/pypy-dist/lib-python/2.3.4/test/test_exceptions.py +options: ['core'] +outcome: T/O +platform: linux2 +pypy-revision: 11740 +python-version-info: (2, 3, 5, 'final', 0) +startdate: Mon May 2 01:43:40 2005 +testreport-version: 1.1 +timeout: 900.0 +userhost: hpk at code1.codespeak.net +_reprs: {'execution-time': 'float', 'python-version-info': 'tuple', + 'options': 'list', 'timeout': 'float', 'pypy-revision': 'int', + 'exit status': 'int'} + +--===============2052670225221871720== +Content-Type: text/plain; charset="us-ascii" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Content-Disposition: attachment; filename="stdout" + +5. Built-in exceptions +spam + +spam + +errno=None args=('spam',) strerror=None filename=None + +spam + +spam + +'spam' + +spam + +(not testable in a script) +spam + +(not safe to test) +spam + +spam + + +--===============2052670225221871720== +Content-Type: text/plain; charset="us-ascii" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Content-Disposition: attachment; filename="stderr" + +faking +faking +faking +faking +faking +faking +faking +==========================timedout========================== +Traceback (application-level): + File "/home/hpk/pypy-dist/lib-python/2.3.4/test/test_exceptions.py", line 95 in ? + while 1: x = x+x +KeyboardInterrupt + +--===============2052670225221871720==-- \ No newline at end of file Added: pypy/testresult/hpk at code1.codespeak.net/test_extcall.txt ============================================================================== --- (empty file) +++ pypy/testresult/hpk at code1.codespeak.net/test_extcall.txt Mon May 2 02:07:05 2005 @@ -0,0 +1,277 @@ +Content-Type: multipart/mixed; boundary="===============2327927256296363653==" +MIME-Version: 1.0 +cpu mhz: 1603.694 +cpu model: AMD Opteron(tm) Processor 242 +execution-time: 117.628324986 +exit status: 2 +fspath: /home/hpk/pypy-dist/lib-python/2.3.4/test/test_extcall.py +options: ['core'] +outcome: ERROUT +platform: linux2 +pypy-revision: 11740 +python-version-info: (2, 3, 5, 'final', 0) +startdate: Mon May 2 01:58:42 2005 +testreport-version: 1.1 +timeout: 900.0 +userhost: hpk at code1.codespeak.net +_reprs: {'execution-time': 'float', 'python-version-info': 'tuple', + 'options': 'list', 'timeout': 'float', 'pypy-revision': 'int', + 'exit status': 'int'} + +--===============2327927256296363653== +Content-Type: text/plain; charset="us-ascii" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Content-Disposition: attachment; filename="stdout" + +() {} +(1,) {} +(1, 2) {} +(1, 2, 3) {} +(1, 2, 3, 4, 5) {} +(1, 2, 3, 4, 5) {} +(1, 2, 3, 4, 5) {} +(1, 2, 3) {'a': 4, 'b': 5} +(1, 2, 3, 4, 5) {'a': 6, 'b': 7} +(1, 2, 3, 6, 7) {'a': 8, 'b': 9, 'x': 4, 'y': 5} +TypeError: g() takes at least 1 argument (0 given) +TypeError: g() takes at least 1 argument (0 given) +TypeError: g() takes at least 1 argument (0 given) +1 () {} +1 (2,) {} +1 (2, 3) {} +1 (2, 3, 4, 5) {} +0 (1, 2) {} +0 (1, 2, 3) {} +1 () {'a': 1, 'b': 2, 'c': 3, 'd': 4} +{'a': 1, 'b': 2, 'c': 3} +{'a': 1, 'b': 2, 'c': 3} +g() got multiple values for keyword argument 'x' +got multiple values for keyword argument 'a' +keywords must be strings +h() got an unexpected keyword argument 'e' +object is not iter()-able +object is not iter()-able +object None is not callable +the keywords must be a dictionary +the keywords must be a dictionary +object None is not callable +got multiple values for keyword argument 'b' +3 512 True +3 +3 +za () {} -> za() takes exactly 1 argument (0 given) +za () {'a': 'aa'} -> ok za aa B D E V a +za () {'d': 'dd'} -> za() got an unexpected keyword argument 'd' +za () {'a': 'aa', 'd': 'dd'} -> za() got an unexpected keyword argument 'd' +za () {'a': 'aa', 'b': 'bb', 'd': 'dd', 'e': 'ee'} -> za() got 3 unexpected keyword arguments +za (1, 2) {} -> za() takes exactly 1 argument (2 given) +za (1, 2) {'a': 'aa'} -> za() got multiple values for keyword argument 'a' +za (1, 2) {'d': 'dd'} -> za() takes exactly 1 argument (3 given) +za (1, 2) {'a': 'aa', 'd': 'dd'} -> za() got multiple values for keyword argument 'a' +za (1, 2) {'a': 'aa', 'b': 'bb', 'd': 'dd', 'e': 'ee'} -> za() got multiple values for keyword argument 'a' +za (1, 2, 3, 4, 5) {} -> za() takes exactly 1 argument (5 given) +za (1, 2, 3, 4, 5) {'a': 'aa'} -> za() got multiple values for keyword argument 'a' +za (1, 2, 3, 4, 5) {'d': 'dd'} -> za() takes exactly 1 argument (6 given) +za (1, 2, 3, 4, 5) {'a': 'aa', 'd': 'dd'} -> za() got multiple values for keyword argument 'a' +za (1, 2, 3, 4, 5) {'a': 'aa', 'b': 'bb', 'd': 'dd', 'e': 'ee'} -> za() got multiple values for keyword argument 'a' +zade () {} -> zade() takes at least 1 argument (0 given) +zade () {'a': 'aa'} -> ok zade aa B d e V a +zade () {'d': 'dd'} -> zade() takes at least 1 non-keyword argument (0 given) +zade () {'a': 'aa', 'd': 'dd'} -> ok zade aa B dd e V d +zade () {'a': 'aa', 'b': 'bb', 'd': 'dd', 'e': 'ee'} -> zade() got an unexpected keyword argument 'b' +zade (1, 2) {} -> ok zade 1 B 2 e V e +zade (1, 2) {'a': 'aa'} -> zade() got multiple values for keyword argument 'a' +zade (1, 2) {'d': 'dd'} -> zade() got multiple values for keyword argument 'd' +zade (1, 2) {'a': 'aa', 'd': 'dd'} -> zade() got multiple values for keyword argument 'a' +zade (1, 2) {'a': 'aa', 'b': 'bb', 'd': 'dd', 'e': 'ee'} -> zade() got multiple values for keyword argument 'a' +zade (1, 2, 3, 4, 5) {} -> zade() takes at most 3 arguments (5 given) +zade (1, 2, 3, 4, 5) {'a': 'aa'} -> zade() got multiple values for keyword argument 'a' +zade (1, 2, 3, 4, 5) {'d': 'dd'} -> zade() got multiple values for keyword argument 'd' +zade (1, 2, 3, 4, 5) {'a': 'aa', 'd': 'dd'} -> zade() got multiple values for keyword argument 'a' +zade (1, 2, 3, 4, 5) {'a': 'aa', 'b': 'bb', 'd': 'dd', 'e': 'ee'} -> zade() got multiple values for keyword argument 'a' +zabk () {} -> zabk() takes exactly 2 non-keyword arguments (0 given) +zabk () {'a': 'aa'} -> zabk() takes exactly 2 non-keyword arguments (0 given) +zabk () {'d': 'dd'} -> zabk() takes exactly 2 non-keyword arguments (0 given) +zabk () {'a': 'aa', 'd': 'dd'} -> zabk() takes exactly 2 non-keyword arguments (0 given) +zabk () {'a': 'aa', 'b': 'bb', 'd': 'dd', 'e': 'ee'} -> ok zabk aa bb D E V {'d': 'dd', 'e': 'ee'} +zabk (1, 2) {} -> ok zabk 1 2 D E V {} +zabk (1, 2) {'a': 'aa'} -> zabk() got multiple values for keyword argument 'a' +zabk (1, 2) {'d': 'dd'} -> ok zabk 1 2 D E V {'d': 'dd'} +zabk (1, 2) {'a': 'aa', 'd': 'dd'} -> zabk() got multiple values for keyword argument 'a' +zabk (1, 2) {'a': 'aa', 'b': 'bb', 'd': 'dd', 'e': 'ee'} -> zabk() got multiple values for keyword argument 'a' +zabk (1, 2, 3, 4, 5) {} -> zabk() takes exactly 2 non-keyword arguments (5 given) +zabk (1, 2, 3, 4, 5) {'a': 'aa'} -> zabk() got multiple values for keyword argument 'a' +zabk (1, 2, 3, 4, 5) {'d': 'dd'} -> zabk() takes exactly 2 non-keyword arguments (5 given) +zabk (1, 2, 3, 4, 5) {'a': 'aa', 'd': 'dd'} -> zabk() got multiple values for keyword argument 'a' +zabk (1, 2, 3, 4, 5) {'a': 'aa', 'b': 'bb', 'd': 'dd', 'e': 'ee'} -> zabk() got multiple values for keyword argument 'a' +zabdv () {} -> zabdv() takes at least 2 arguments (0 given) +zabdv () {'a': 'aa'} -> zabdv() takes at least 2 non-keyword arguments (0 given) +zabdv () {'d': 'dd'} -> zabdv() takes at least 2 non-keyword arguments (0 given) +zabdv () {'a': 'aa', 'd': 'dd'} -> zabdv() takes at least 2 non-keyword arguments (0 given) +zabdv () {'a': 'aa', 'b': 'bb', 'd': 'dd', 'e': 'ee'} -> zabdv() got an unexpected keyword argument 'e' +zabdv (1, 2) {} -> ok zabdv 1 2 d E () e +zabdv (1, 2) {'a': 'aa'} -> zabdv() got multiple values for keyword argument 'a' +zabdv (1, 2) {'d': 'dd'} -> ok zabdv 1 2 dd E () d +zabdv (1, 2) {'a': 'aa', 'd': 'dd'} -> zabdv() got multiple values for keyword argument 'a' +zabdv (1, 2) {'a': 'aa', 'b': 'bb', 'd': 'dd', 'e': 'ee'} -> zabdv() got multiple values for keyword argument 'a' +zabdv (1, 2, 3, 4, 5) {} -> ok zabdv 1 2 3 E (4, 5) e +zabdv (1, 2, 3, 4, 5) {'a': 'aa'} -> zabdv() got multiple values for keyword argument 'a' +zabdv (1, 2, 3, 4, 5) {'d': 'dd'} -> zabdv() got multiple values for keyword argument 'd' +zabdv (1, 2, 3, 4, 5) {'a': 'aa', 'd': 'dd'} -> zabdv() got multiple values for keyword argument 'a' +zabdv (1, 2, 3, 4, 5) {'a': 'aa', 'b': 'bb', 'd': 'dd', 'e': 'ee'} -> zabdv() got multiple values for keyword argument 'a' +zabdevk () {} -> zabdevk() takes at least 2 arguments (0 given) +zabdevk () {'a': 'aa'} -> zabdevk() takes at least 2 non-keyword arguments (0 given) +zabdevk () {'d': 'dd'} -> zabdevk() takes at least 2 non-keyword arguments (0 given) +zabdevk () {'a': 'aa', 'd': 'dd'} -> zabdevk() takes at least 2 non-keyword arguments (0 given) +zabdevk () {'a': 'aa', 'b': 'bb', 'd': 'dd', 'e': 'ee'} -> ok zabdevk aa bb dd ee () {} +zabdevk (1, 2) {} -> ok zabdevk 1 2 d e () {} +zabdevk (1, 2) {'a': 'aa'} -> zabdevk() got multiple values for keyword argument 'a' +zabdevk (1, 2) {'d': 'dd'} -> ok zabdevk 1 2 dd e () {} +zabdevk (1, 2) {'a': 'aa', 'd': 'dd'} -> zabdevk() got multiple values for keyword argument 'a' +zabdevk (1, 2) {'a': 'aa', 'b': 'bb', 'd': 'dd', 'e': 'ee'} -> zabdevk() got multiple values for keyword argument 'a' +zabdevk (1, 2, 3, 4, 5) {} -> ok zabdevk 1 2 3 4 (5,) {} +zabdevk (1, 2, 3, 4, 5) {'a': 'aa'} -> zabdevk() got multiple values for keyword argument 'a' +zabdevk (1, 2, 3, 4, 5) {'d': 'dd'} -> zabdevk() got multiple values for keyword argument 'd' +zabdevk (1, 2, 3, 4, 5) {'a': 'aa', 'd': 'dd'} -> zabdevk() got multiple values for keyword argument 'a' +zabdevk (1, 2, 3, 4, 5) {'a': 'aa', 'b': 'bb', 'd': 'dd', 'e': 'ee'} -> zabdevk() got multiple values for keyword argument 'a' + +--===============2327927256296363653== +Content-Type: text/plain; charset="us-ascii" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Content-Disposition: attachment; filename="stderr" + +faking +faking +faking +faking +faking + +--===============2327927256296363653== +Content-Type: text/plain; charset="us-ascii" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Content-Disposition: attachment; filename="reportdiff" + +********************************************************************** +*** mismatch between lines 25-26 of expected output and lines 25-26 of actual output: +- g() got multiple values for keyword argument 'b' +? ---- ^ ++ got multiple values for keyword argument 'a' +? ^ +- f() keywords must be strings +? ---- ++ keywords must be strings +*** mismatch between lines 28-34 of expected output and lines 28-34 of actual output: +- h() argument after * must be a sequence +- dir() argument after * must be a sequence +- NoneType object argument after * must be a sequence +- h() argument after ** must be a dictionary +- dir() argument after ** must be a dictionary +- NoneType object argument after ** must be a dictionary ++ object is not iter()-able ++ object is not iter()-able ++ object None is not callable ++ the keywords must be a dictionary ++ the keywords must be a dictionary ++ object None is not callable +- dir() got multiple values for keyword argument 'b' +? ------ ++ got multiple values for keyword argument 'b' +*** mismatch between line 42 of expected output and line 42 of actual output: +- za () {'a': 'aa', 'b': 'bb', 'd': 'dd', 'e': 'ee'} -> za() got an unexpected keyword argument 'b' +? ^^ ^^^^ ++ za () {'a': 'aa', 'b': 'bb', 'd': 'dd', 'e': 'ee'} -> za() got 3 unexpected keyword arguments +? ^ ^ +*** mismatch between lines 44-47 of expected output and lines 44-47 of actual output: +- za (1, 2) {'a': 'aa'} -> za() takes exactly 1 non-keyword argument (2 given) ++ za (1, 2) {'a': 'aa'} -> za() got multiple values for keyword argument 'a' +- za (1, 2) {'d': 'dd'} -> za() takes exactly 1 non-keyword argument (2 given) +? ------------ ^ ++ za (1, 2) {'d': 'dd'} -> za() takes exactly 1 argument (3 given) +? ^ +- za (1, 2) {'a': 'aa', 'd': 'dd'} -> za() takes exactly 1 non-keyword argument (2 given) ++ za (1, 2) {'a': 'aa', 'd': 'dd'} -> za() got multiple values for keyword argument 'a' +- za (1, 2) {'a': 'aa', 'b': 'bb', 'd': 'dd', 'e': 'ee'} -> za() takes exactly 1 non-keyword argument (2 given) +? ^ ^^^^^^^^^^^ ^^ ^^^^^^^^^ ++ za (1, 2) {'a': 'aa', 'b': 'bb', 'd': 'dd', 'e': 'ee'} -> za() got multiple values for keyword argument 'a' +? ++ +++++++++++ ^^ ^ ^^ ^^^ +*** mismatch between lines 49-52 of expected output and lines 49-52 of actual output: +- za (1, 2, 3, 4, 5) {'a': 'aa'} -> za() takes exactly 1 non-keyword argument (5 given) ++ za (1, 2, 3, 4, 5) {'a': 'aa'} -> za() got multiple values for keyword argument 'a' +- za (1, 2, 3, 4, 5) {'d': 'dd'} -> za() takes exactly 1 non-keyword argument (5 given) +? ------------ ^ ++ za (1, 2, 3, 4, 5) {'d': 'dd'} -> za() takes exactly 1 argument (6 given) +? ^ +- za (1, 2, 3, 4, 5) {'a': 'aa', 'd': 'dd'} -> za() takes exactly 1 non-keyword argument (5 given) +? ^ ^^^^^^^^^^^ ^^ ^^^^^^^^^ ++ za (1, 2, 3, 4, 5) {'a': 'aa', 'd': 'dd'} -> za() got multiple values for keyword argument 'a' +? ++ +++++++++++ ^^ ^ ^^ ^^^ +- za (1, 2, 3, 4, 5) {'a': 'aa', 'b': 'bb', 'd': 'dd', 'e': 'ee'} -> za() takes exactly 1 non-keyword argument (5 given) +? ^ ^^^^^^^^^^^ ^^ ^^^^^^^^^ ++ za (1, 2, 3, 4, 5) {'a': 'aa', 'b': 'bb', 'd': 'dd', 'e': 'ee'} -> za() got multiple values for keyword argument 'a' +? ++ +++++++++++ ^^ ^ ^^ ^^^ +*** mismatch between lines 64-69 of expected output and lines 64-69 of actual output: +- zade (1, 2, 3, 4, 5) {'a': 'aa'} -> zade() takes at most 3 non-keyword arguments (5 given) +- zade (1, 2, 3, 4, 5) {'d': 'dd'} -> zade() takes at most 3 non-keyword arguments (5 given) ++ zade (1, 2, 3, 4, 5) {'a': 'aa'} -> zade() got multiple values for keyword argument 'a' ++ zade (1, 2, 3, 4, 5) {'d': 'dd'} -> zade() got multiple values for keyword argument 'd' +- zade (1, 2, 3, 4, 5) {'a': 'aa', 'd': 'dd'} -> zade() takes at most 3 non-keyword arguments (5 given) +? ^ ^^^^ ^^^^^^^^^ ^^^^^^^^^^^ ++ zade (1, 2, 3, 4, 5) {'a': 'aa', 'd': 'dd'} -> zade() got multiple values for keyword argument 'a' +? ++ +++++++++++ ^^ ^ ^^ ^^^^ +- zade (1, 2, 3, 4, 5) {'a': 'aa', 'b': 'bb', 'd': 'dd', 'e': 'ee'} -> zade() takes at most 3 non-keyword arguments (5 given) +? ^ ^^^^ ^^^^^^^^^ ^^^^^^^^^^^ ++ zade (1, 2, 3, 4, 5) {'a': 'aa', 'b': 'bb', 'd': 'dd', 'e': 'ee'} -> zade() got multiple values for keyword argument 'a' +? ++ +++++++++++ ^^ ^ ^^ ^^^^ +- zabk () {} -> zabk() takes exactly 2 arguments (0 given) ++ zabk () {} -> zabk() takes exactly 2 non-keyword arguments (0 given) +? ++++++++++++ +- zabk () {'a': 'aa'} -> zabk() takes exactly 2 non-keyword arguments (1 given) +? ^ ++ zabk () {'a': 'aa'} -> zabk() takes exactly 2 non-keyword arguments (0 given) +? ^ +*** mismatch between line 71 of expected output and line 71 of actual output: +- zabk () {'a': 'aa', 'd': 'dd'} -> zabk() takes exactly 2 non-keyword arguments (1 given) +? ^ ++ zabk () {'a': 'aa', 'd': 'dd'} -> zabk() takes exactly 2 non-keyword arguments (0 given) +? ^ +*** mismatch between lines 78-79 of expected output and lines 78-79 of actual output: +- zabk (1, 2, 3, 4, 5) {} -> zabk() takes exactly 2 arguments (5 given) +- zabk (1, 2, 3, 4, 5) {'a': 'aa'} -> zabk() takes exactly 2 non-keyword arguments (5 given) +? --------- ++ zabk (1, 2, 3, 4, 5) {} -> zabk() takes exactly 2 non-keyword arguments (5 given) ++ zabk (1, 2, 3, 4, 5) {'a': 'aa'} -> zabk() got multiple values for keyword argument 'a' +*** mismatch between lines 81-82 of expected output and lines 81-82 of actual output: +- zabk (1, 2, 3, 4, 5) {'a': 'aa', 'd': 'dd'} -> zabk() takes exactly 2 non-keyword arguments (5 given) +? ^ ^^^^^^^^^^^ ^^ ^^^^^^^^^^^ ++ zabk (1, 2, 3, 4, 5) {'a': 'aa', 'd': 'dd'} -> zabk() got multiple values for keyword argument 'a' +? ++ +++++++++++ ^^ ^ ^^ ^^^^ +- zabk (1, 2, 3, 4, 5) {'a': 'aa', 'b': 'bb', 'd': 'dd', 'e': 'ee'} -> zabk() takes exactly 2 non-keyword arguments (5 given) +? ^ ^^^^^^^^^^^ ^^ ^^^^^^^^^^^ ++ zabk (1, 2, 3, 4, 5) {'a': 'aa', 'b': 'bb', 'd': 'dd', 'e': 'ee'} -> zabk() got multiple values for keyword argument 'a' +? ++ +++++++++++ ^^ ^ ^^ ^^^^ +*** mismatch between line 84 of expected output and line 84 of actual output: +- zabdv () {'a': 'aa'} -> zabdv() takes at least 2 non-keyword arguments (1 given) +? ^ ++ zabdv () {'a': 'aa'} -> zabdv() takes at least 2 non-keyword arguments (0 given) +? ^ +*** mismatch between line 86 of expected output and line 86 of actual output: +- zabdv () {'a': 'aa', 'd': 'dd'} -> zabdv() takes at least 2 non-keyword arguments (1 given) +? ^ ++ zabdv () {'a': 'aa', 'd': 'dd'} -> zabdv() takes at least 2 non-keyword arguments (0 given) +? ^ +*** mismatch between line 99 of expected output and line 99 of actual output: +- zabdevk () {'a': 'aa'} -> zabdevk() takes at least 2 non-keyword arguments (1 given) +? ^ ++ zabdevk () {'a': 'aa'} -> zabdevk() takes at least 2 non-keyword arguments (0 given) +? ^ +*** mismatch between line 101 of expected output and line 101 of actual output: +- zabdevk () {'a': 'aa', 'd': 'dd'} -> zabdevk() takes at least 2 non-keyword arguments (1 given) +? ^ ++ zabdevk () {'a': 'aa', 'd': 'dd'} -> zabdevk() takes at least 2 non-keyword arguments (0 given) +? ^ +********************************************************************** + +--===============2327927256296363653==-- \ No newline at end of file Added: pypy/testresult/hpk at code1.codespeak.net/test_file.txt ============================================================================== --- (empty file) +++ pypy/testresult/hpk at code1.codespeak.net/test_file.txt Mon May 2 02:07:05 2005 @@ -0,0 +1,80 @@ +Content-Type: multipart/mixed; boundary="===============4553446121159375105==" +MIME-Version: 1.0 +cpu mhz: 1603.694 +cpu model: AMD Opteron(tm) Processor 242 +execution-time: 6.13943910599 +exit status: 1 +fspath: /home/hpk/pypy-dist/lib-python/2.3.4/test/test_file.py +options: ['core'] +outcome: ERR +platform: linux2 +pypy-revision: 11740 +python-version-info: (2, 3, 5, 'final', 0) +startdate: Mon May 2 02:00:41 2005 +testreport-version: 1.1 +timeout: 961.0 +userhost: hpk at code1.codespeak.net +_reprs: {'execution-time': 'float', 'python-version-info': 'tuple', + 'options': 'list', 'timeout': 'float', 'pypy-revision': 'int', + 'exit status': 'int'} + +--===============4553446121159375105== +Content-Type: text/plain; charset="us-ascii" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Content-Disposition: attachment; filename="stdout" + + +--===============4553446121159375105== +Content-Type: text/plain; charset="us-ascii" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Content-Disposition: attachment; filename="stderr" + +faking +faking +faking +faking +faking +faking +Traceback (most recent call last): + File "/home/hpk/pypy-dist/pypy/interpreter/py.py", line 80, in main_ + main.run_file(args[0], space) + File "/home/hpk/pypy-dist/pypy/interpreter/main.py", line 59, in run_file + run_string(istring, filename, space) + File "/home/hpk/pypy-dist/pypy/interpreter/main.py", line 50, in run_string + _run_eval_string(source, filename, space, False) + File "/home/hpk/pypy-dist/pypy/interpreter/main.py", line 39, in _run_eval_string + retval = pycode.exec_code(space, w_globals, w_globals) + File "/home/hpk/pypy-dist/pypy/interpreter/eval.py", line 24, in exec_code + return frame.run() + File "/home/hpk/pypy-dist/pypy/interpreter/eval.py", line 70, in resume + result = self.eval(executioncontext) + File "/home/hpk/pypy-dist/pypy/interpreter/pyframe.py", line 97, in eval + self.dispatch() + File "/home/hpk/pypy-dist/pypy/interpreter/pyopcode.py", line 54, in dispatch + fn(self, oparg) + File "/home/hpk/pypy-dist/pypy/interpreter/pyopcode.py", line 639, in CALL_FUNCTION + w_result = f.space.call_args(w_function, args) + File "/home/hpk/pypy-dist/pypy/objspace/descroperation.py", line 99, in call_args + return space.get_and_call_args(w_descr, w_obj, args) + File "/home/hpk/pypy-dist/pypy/objspace/descroperation.py", line 80, in get_and_call_args + return descr.call_args(args.prepend(w_obj)) + File "/home/hpk/pypy-dist/pypy/interpreter/function.py", line 40, in call_args + return frame.run() + File "/home/hpk/pypy-dist/pypy/interpreter/gateway.py", line 249, in run + w_result = self._run() + File "", line 3, in _run_UWS_Method_Arguments + File "/home/hpk/pypy-dist/pypy/interpreter/function.py", line 199, in descr_method_call + return self.call_args(__args__) + File "/home/hpk/pypy-dist/pypy/interpreter/function.py", line 182, in call_args + return space.call_args(self.w_function, args) + File "/home/hpk/pypy-dist/pypy/objspace/descroperation.py", line 92, in call_args + return w_obj.call_args(args) + File "/home/hpk/pypy-dist/pypy/interpreter/function.py", line 39, in call_args + frame.setfastscope(scope_w) + File "/home/hpk/pypy-dist/pypy/objspace/std/fake.py", line 135, in setfastscope + raise UnwrapError('calling %s: %s' % (self.code.cpy_callable, e)) +pypy.objspace.std.model.UnwrapError: calling : cannot unwrap > + +--===============4553446121159375105==-- \ No newline at end of file Modified: pypy/testresult/hpk at code1.codespeak.net/test_filecmp.txt ============================================================================== --- pypy/testresult/hpk at code1.codespeak.net/test_filecmp.txt (original) +++ pypy/testresult/hpk at code1.codespeak.net/test_filecmp.txt Mon May 2 02:07:05 2005 @@ -1,31 +1,29 @@ -testreport-version: 1.0 -command: /usr/bin/python /tmp/pypy-autotest-13/pypy-dist/pypy/tool/alarm.py 13499 /tmp/pypy-autotest-13/pypy-dist/pypy/interpreter/py.py /tmp/pypy-autotest-13/pypy-dist/lib-python-2.3.4/test/test_filecmp.py -run by: hpk at code1.codespeak.net -sys.platform: linux2 -sys.version_info: (2, 3, 5, 'final', 0) -cpu model: AMD Opteron(tm) Processor 242 +Content-Type: multipart/mixed; boundary="===============0117157617940922625==" +MIME-Version: 1.0 cpu mhz: 1603.694 -oldstyle: no -pypy-revision: 11680 -startdate: Sun May 1 06:12:43 2005 -timeout: 13500.0 seconds +cpu model: AMD Opteron(tm) Processor 242 +execution-time: 15.9651880264 +exit status: 1 +fspath: /home/hpk/pypy-dist/lib-python/2.3.4/test/test_filecmp.py +options: ['core'] +outcome: ERR +platform: linux2 +pypy-revision: 11740 +python-version-info: (2, 3, 5, 'final', 0) +startdate: Mon May 2 02:00:49 2005 +testreport-version: 1.1 +timeout: 900.0 +userhost: hpk at code1.codespeak.net +_reprs: {'execution-time': 'float', 'python-version-info': 'tuple', + 'options': 'list', 'timeout': 'float', 'pypy-revision': 'int', + 'exit status': 'int'} + +--===============0117157617940922625== +Content-Type: text/plain; charset="us-ascii" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Content-Disposition: attachment; filename="stdout" -============================================================ -faking -faking -faking -faking -faking -Traceback (application-level): - File "/tmp/pypy-autotest-13/pypy-dist/lib-python-2.3.4/test/test_filecmp.py", line 133 in ? - test_main() - File "/tmp/pypy-autotest-13/pypy-dist/lib-python-2.3.4/test/test_filecmp.py", line 130 in test_main - test_support.run_unittest(FileCompareTestCase, DirCompareTestCase) - File "/tmp/pypy-autotest-13/pypy-dist/lib-python-2.3.4/test/test_support.py", line 262 in run_unittest - run_suite(suite, testclass) - File "/tmp/pypy-autotest-13/pypy-dist/lib-python-2.3.4/test/test_support.py", line 246 in run_suite - raise TestFailed(msg) -TestFailed: errors occurred; run in verbose mode for details test_different (__main__.FileCompareTestCase) ... ok test_matching (__main__.FileCompareTestCase) ... ok test_cmpfiles (__main__.DirCompareTestCase) ... ERROR @@ -35,7 +33,7 @@ ERROR: test_cmpfiles (__main__.DirCompareTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): - File "/tmp/pypy-autotest-13/pypy-dist/lib-python-2.3.4/test/test_filecmp.py", line 52, in setUp + File "/home/hpk/pypy-dist/lib-python/2.3.4/test/test_filecmp.py", line 52, in setUp os.mkdir(dir) OSError: errno=17 args=(17, 'File exists') strerror=File exists filename=/tmp/dir @@ -43,14 +41,35 @@ ERROR: test_dircmp (__main__.DirCompareTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): - File "/tmp/pypy-autotest-13/pypy-dist/lib-python-2.3.4/test/test_filecmp.py", line 52, in setUp + File "/home/hpk/pypy-dist/lib-python/2.3.4/test/test_filecmp.py", line 52, in setUp os.mkdir(dir) OSError: errno=17 args=(17, 'File exists') strerror=File exists filename=/tmp/dir ---------------------------------------------------------------------- -Ran 4 tests in 3.487s +Ran 4 tests in 3.534s FAILED (errors=2) -========================== closed ========================== -execution time: 14.4943499565 seconds -exit status: 1 + +--===============0117157617940922625== +Content-Type: text/plain; charset="us-ascii" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Content-Disposition: attachment; filename="stderr" + +faking +faking +faking +faking +faking +Traceback (application-level): + File "/home/hpk/pypy-dist/lib-python/2.3.4/test/test_filecmp.py", line 133 in ? + test_main() + File "/home/hpk/pypy-dist/lib-python/2.3.4/test/test_filecmp.py", line 130 in test_main + test_support.run_unittest(FileCompareTestCase, DirCompareTestCase) + File "/home/hpk/pypy-dist/lib-python/2.3.4/test/test_support.py", line 262 in run_unittest + run_suite(suite, testclass) + File "/home/hpk/pypy-dist/lib-python/2.3.4/test/test_support.py", line 246 in run_suite + raise TestFailed(msg) +TestFailed: errors occurred; run in verbose mode for details + +--===============0117157617940922625==-- \ No newline at end of file Modified: pypy/testresult/hpk at code1.codespeak.net/test_fileinput.txt ============================================================================== --- pypy/testresult/hpk at code1.codespeak.net/test_fileinput.txt (original) +++ pypy/testresult/hpk at code1.codespeak.net/test_fileinput.txt Mon May 2 02:07:05 2005 @@ -1,25 +1,29 @@ -testreport-version: 1.0 -command: /usr/bin/python /tmp/pypy-autotest-13/pypy-dist/pypy/tool/alarm.py 12614 /tmp/pypy-autotest-13/pypy-dist/pypy/interpreter/py.py /tmp/pypy-autotest-13/pypy-dist/lib-python-2.3.4/test/test_fileinput.py -run by: hpk at code1.codespeak.net -sys.platform: linux2 -sys.version_info: (2, 3, 5, 'final', 0) -cpu model: AMD Opteron(tm) Processor 242 +Content-Type: multipart/mixed; boundary="===============3168006767836677111==" +MIME-Version: 1.0 cpu mhz: 1603.694 -oldstyle: no -pypy-revision: 11680 -startdate: Sun May 1 06:12:59 2005 -timeout: 12615.0 seconds +cpu model: AMD Opteron(tm) Processor 242 +execution-time: 28.7920320034 +exit status: 0 +fspath: /home/hpk/pypy-dist/lib-python/2.3.4/test/test_fileinput.py +options: ['core'] +outcome: OK +platform: linux2 +pypy-revision: 11740 +python-version-info: (2, 3, 5, 'final', 0) +startdate: Mon May 2 02:01:06 2005 +testreport-version: 1.1 +timeout: 900.0 +userhost: hpk at code1.codespeak.net +_reprs: {'execution-time': 'float', 'python-version-info': 'tuple', + 'options': 'list', 'timeout': 'float', 'pypy-revision': 'int', + 'exit status': 'int'} + +--===============3168006767836677111== +Content-Type: text/plain; charset="us-ascii" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Content-Disposition: attachment; filename="stdout" -============================================================ -faking -faking -faking -faking -faking -faking -faking -faking -faking 1. Simple iteration (bs=0) 2. Status variables (bs=0) 3. Nextfile (bs=0) @@ -34,6 +38,21 @@ 12. Inplace (bs=30) 13. 0-byte files 14. Files that don't end with newline -========================== closed ========================== -execution time: 27.4883930683 seconds -exit status: 0 + +--===============3168006767836677111== +Content-Type: text/plain; charset="us-ascii" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Content-Disposition: attachment; filename="stderr" + +faking +faking +faking +faking +faking +faking +faking +faking +faking + +--===============3168006767836677111==-- \ No newline at end of file Modified: pypy/testresult/hpk at code1.codespeak.net/test_fnmatch.txt ============================================================================== --- pypy/testresult/hpk at code1.codespeak.net/test_fnmatch.txt (original) +++ pypy/testresult/hpk at code1.codespeak.net/test_fnmatch.txt Mon May 2 02:07:05 2005 @@ -1,16 +1,42 @@ -testreport-version: 1.0 -command: /usr/bin/python /tmp/pypy-autotest-13/pypy-dist/pypy/tool/alarm.py 12615 /tmp/pypy-autotest-13/pypy-dist/pypy/interpreter/py.py /tmp/pypy-autotest-13/pypy-dist/lib-python-2.3.4/test/test_fnmatch.py -run by: hpk at code1.codespeak.net -sys.platform: linux2 -sys.version_info: (2, 3, 5, 'final', 0) -cpu model: AMD Opteron(tm) Processor 242 +Content-Type: multipart/mixed; boundary="===============0358508310790296468==" +MIME-Version: 1.0 cpu mhz: 1603.694 -oldstyle: no -pypy-revision: 11680 -startdate: Sun May 1 06:13:26 2005 -timeout: 12615.0 seconds +cpu model: AMD Opteron(tm) Processor 242 +execution-time: 19.9919638634 +exit status: 0 +fspath: /home/hpk/pypy-dist/lib-python/2.3.4/test/test_fnmatch.py +options: ['core'] +outcome: OK +platform: linux2 +pypy-revision: 11740 +python-version-info: (2, 3, 5, 'final', 0) +startdate: Mon May 2 02:01:35 2005 +testreport-version: 1.1 +timeout: 841.0 +userhost: hpk at code1.codespeak.net +_reprs: {'execution-time': 'float', 'python-version-info': 'tuple', + 'options': 'list', 'timeout': 'float', 'pypy-revision': 'int', + 'exit status': 'int'} + +--===============0358508310790296468== +Content-Type: text/plain; charset="us-ascii" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Content-Disposition: attachment; filename="stdout" + +test_fnmatch (__main__.FnmatchTestCase) ... ok + +---------------------------------------------------------------------- +Ran 1 test in 10.572s + +OK + +--===============0358508310790296468== +Content-Type: text/plain; charset="us-ascii" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Content-Disposition: attachment; filename="stderr" -============================================================ faking faking faking @@ -20,12 +46,5 @@ faking faking faking -test_fnmatch (__main__.FnmatchTestCase) ... ok ----------------------------------------------------------------------- -Ran 1 test in 10.564s - -OK -========================== closed ========================== -execution time: 18.7648670673 seconds -exit status: 0 +--===============0358508310790296468==-- \ No newline at end of file Added: pypy/testresult/hpk at code1.codespeak.net/test_format.txt ============================================================================== --- (empty file) +++ pypy/testresult/hpk at code1.codespeak.net/test_format.txt Mon May 2 02:07:05 2005 @@ -0,0 +1,177 @@ +Content-Type: multipart/mixed; boundary="===============5397547652616958920==" +MIME-Version: 1.0 +cpu mhz: 1603.694 +cpu model: AMD Opteron(tm) Processor 242 +execution-time: 7.35410714149 +exit status: 1 +fspath: /home/hpk/pypy-dist/lib-python/2.3.4/test/test_format.py +options: ['core'] +outcome: ERR +platform: linux2 +pypy-revision: 11740 +python-version-info: (2, 3, 5, 'final', 0) +startdate: Mon May 2 02:01:56 2005 +testreport-version: 1.1 +timeout: 900.0 +userhost: hpk at code1.codespeak.net +_reprs: {'execution-time': 'float', 'python-version-info': 'tuple', + 'options': 'list', 'timeout': 'float', 'pypy-revision': 'int', + 'exit status': 'int'} + +--===============5397547652616958920== +Content-Type: text/plain; charset="us-ascii" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Content-Disposition: attachment; filename="stdout" + +'%.1d' % (1,) =? '1' ... yes +u'%.1d' % (1,) =? '1' ... yes +'%.*d' % (9223372036854775807, 1) works? ... + +--===============5397547652616958920== +Content-Type: text/plain; charset="us-ascii" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Content-Disposition: attachment; filename="stderr" + +faking +faking +faking +faking +faking +Traceback (most recent call last): + File "/home/hpk/pypy-dist/pypy/interpreter/py.py", line 80, in main_ + main.run_file(args[0], space) + File "/home/hpk/pypy-dist/pypy/interpreter/main.py", line 59, in run_file + run_string(istring, filename, space) + File "/home/hpk/pypy-dist/pypy/interpreter/main.py", line 50, in run_string + _run_eval_string(source, filename, space, False) + File "/home/hpk/pypy-dist/pypy/interpreter/main.py", line 39, in _run_eval_string + retval = pycode.exec_code(space, w_globals, w_globals) + File "/home/hpk/pypy-dist/pypy/interpreter/eval.py", line 24, in exec_code + return frame.run() + File "/home/hpk/pypy-dist/pypy/interpreter/eval.py", line 70, in resume + result = self.eval(executioncontext) + File "/home/hpk/pypy-dist/pypy/interpreter/pyframe.py", line 97, in eval + self.dispatch() + File "/home/hpk/pypy-dist/pypy/interpreter/pyopcode.py", line 54, in dispatch + fn(self, oparg) + File "/home/hpk/pypy-dist/pypy/interpreter/pyopcode.py", line 639, in CALL_FUNCTION + w_result = f.space.call_args(w_function, args) + File "/home/hpk/pypy-dist/pypy/objspace/descroperation.py", line 92, in call_args + return w_obj.call_args(args) + File "/home/hpk/pypy-dist/pypy/interpreter/function.py", line 40, in call_args + return frame.run() + File "/home/hpk/pypy-dist/pypy/interpreter/eval.py", line 70, in resume + result = self.eval(executioncontext) + File "/home/hpk/pypy-dist/pypy/interpreter/pyframe.py", line 97, in eval + self.dispatch() + File "/home/hpk/pypy-dist/pypy/interpreter/pyopcode.py", line 54, in dispatch + fn(self, oparg) + File "/home/hpk/pypy-dist/pypy/interpreter/pyopcode.py", line 644, in CALL_FUNCTION_VAR + f.CALL_FUNCTION(oparg, w_varargs) + File "/home/hpk/pypy-dist/pypy/interpreter/pyopcode.py", line 639, in CALL_FUNCTION + w_result = f.space.call_args(w_function, args) + File "/home/hpk/pypy-dist/pypy/objspace/descroperation.py", line 92, in call_args + return w_obj.call_args(args) + File "/home/hpk/pypy-dist/pypy/interpreter/function.py", line 40, in call_args + return frame.run() + File "/home/hpk/pypy-dist/pypy/interpreter/eval.py", line 70, in resume + result = self.eval(executioncontext) + File "/home/hpk/pypy-dist/pypy/interpreter/pyframe.py", line 97, in eval + self.dispatch() + File "/home/hpk/pypy-dist/pypy/interpreter/pyopcode.py", line 57, in dispatch + fn(self) + File "/home/hpk/pypy-dist/pypy/interpreter/pyopcode.py", line 31, in opimpl + w_result = operation(w_1, w_2) + File "/home/hpk/pypy-dist/pypy/objspace/descroperation.py", line 464, in binop_impl + w_res = _invoke_binop(space, w_left_impl, w_obj1, w_obj2) + File "/home/hpk/pypy-dist/pypy/objspace/descroperation.py", line 394, in _invoke_binop + w_res = space.get_and_call_function(w_impl, w_obj1, w_obj2) + File "/home/hpk/pypy-dist/pypy/objspace/descroperation.py", line 87, in get_and_call_function + return space.get_and_call_args(w_descr, w_obj, args) + File "/home/hpk/pypy-dist/pypy/objspace/descroperation.py", line 80, in get_and_call_args + return descr.call_args(args.prepend(w_obj)) + File "/home/hpk/pypy-dist/pypy/interpreter/function.py", line 40, in call_args + return frame.run() + File "/home/hpk/pypy-dist/pypy/interpreter/gateway.py", line 249, in run + w_result = self._run() + File "", line 3, in _run_UWS_ObjSpace_W_Root_W_Root + File "", line 4, in _mm_mod_strS0_perform_call + File "", line 2, in _mm_mod_strS0 + File "", line 2, in _mm_mod_strS0__W_StringObject + File "/home/hpk/pypy-dist/pypy/interpreter/gateway.py", line 556, in appcaller + return space.call_args(w_func, args) + File "/home/hpk/pypy-dist/pypy/objspace/descroperation.py", line 92, in call_args + return w_obj.call_args(args) + File "/home/hpk/pypy-dist/pypy/interpreter/function.py", line 40, in call_args + return frame.run() + File "/home/hpk/pypy-dist/pypy/interpreter/gateway.py", line 249, in run + w_result = self._run() + File "", line 3, in _run_UWS_ObjSpace_Arguments + File "/home/hpk/pypy-dist/pypy/_cache/stringobject_25eb9354a499143245ff8fe3ff7d064d.py", line 3880, in mod__String_ANY + return fastf_mod__String_ANY(space, w_format, w_values) + File "/home/hpk/pypy-dist/pypy/_cache/stringobject_25eb9354a499143245ff8fe3ff7d064d.py", line 3900, in mod__String_ANY + w_3 = space.call_function(gfunc_format, w_1, w_2, space.w_None) + File "/home/hpk/pypy-dist/pypy/interpreter/baseobjspace.py", line 242, in call_function + return self.call_args(w_func, args) + File "/home/hpk/pypy-dist/pypy/objspace/descroperation.py", line 92, in call_args + return w_obj.call_args(args) + File "/home/hpk/pypy-dist/pypy/interpreter/function.py", line 40, in call_args + return frame.run() + File "/home/hpk/pypy-dist/pypy/interpreter/gateway.py", line 249, in run + w_result = self._run() + File "", line 3, in _run_UWS_ObjSpace_Arguments + File "/home/hpk/pypy-dist/pypy/_cache/stringobject_25eb9354a499143245ff8fe3ff7d064d.py", line 3411, in format + return fastf_format(space, w_fmt, w_values, w_valuedict) + File "/home/hpk/pypy-dist/pypy/_cache/stringobject_25eb9354a499143245ff8fe3ff7d064d.py", line 3561, in format + w_44 = space.call_function(w_42, ) + File "/home/hpk/pypy-dist/pypy/interpreter/baseobjspace.py", line 242, in call_function + return self.call_args(w_func, args) + File "/home/hpk/pypy-dist/pypy/objspace/descroperation.py", line 99, in call_args + return space.get_and_call_args(w_descr, w_obj, args) + File "/home/hpk/pypy-dist/pypy/objspace/descroperation.py", line 80, in get_and_call_args + return descr.call_args(args.prepend(w_obj)) + File "/home/hpk/pypy-dist/pypy/interpreter/function.py", line 40, in call_args + return frame.run() + File "/home/hpk/pypy-dist/pypy/interpreter/gateway.py", line 249, in run + w_result = self._run() + File "", line 3, in _run_UWS_Method_Arguments + File "/home/hpk/pypy-dist/pypy/interpreter/function.py", line 199, in descr_method_call + return self.call_args(__args__) + File "/home/hpk/pypy-dist/pypy/interpreter/function.py", line 182, in call_args + return space.call_args(self.w_function, args) + File "/home/hpk/pypy-dist/pypy/objspace/descroperation.py", line 92, in call_args + return w_obj.call_args(args) + File "/home/hpk/pypy-dist/pypy/interpreter/function.py", line 40, in call_args + return frame.run() + File "/home/hpk/pypy-dist/pypy/interpreter/gateway.py", line 249, in run + w_result = self._run() + File "", line 3, in _run_UWS_ObjSpace_Arguments + File "/home/hpk/pypy-dist/pypy/_cache/stringobject_25eb9354a499143245ff8fe3ff7d064d.py", line 2933, in format + return fastf_IntFormatter_format(space, w_self) + File "/home/hpk/pypy-dist/pypy/_cache/stringobject_25eb9354a499143245ff8fe3ff7d064d.py", line 2989, in format + w_19 = space.mul(gs_0, w_18) + File "/home/hpk/pypy-dist/pypy/objspace/descroperation.py", line 464, in binop_impl + w_res = _invoke_binop(space, w_left_impl, w_obj1, w_obj2) + File "/home/hpk/pypy-dist/pypy/objspace/descroperation.py", line 394, in _invoke_binop + w_res = space.get_and_call_function(w_impl, w_obj1, w_obj2) + File "/home/hpk/pypy-dist/pypy/objspace/descroperation.py", line 87, in get_and_call_function + return space.get_and_call_args(w_descr, w_obj, args) + File "/home/hpk/pypy-dist/pypy/objspace/descroperation.py", line 80, in get_and_call_args + return descr.call_args(args.prepend(w_obj)) + File "/home/hpk/pypy-dist/pypy/interpreter/function.py", line 40, in call_args + return frame.run() + File "/home/hpk/pypy-dist/pypy/interpreter/gateway.py", line 249, in run + w_result = self._run() + File "", line 3, in _run_UWS_ObjSpace_W_Root_W_Root + File "", line 4, in _mm_mul_strS0_perform_call + File "", line 2, in _mm_mul_strS0 + File "", line 2, in _mm_mul_strS0__W_StringObject + File "/home/hpk/pypy-dist/pypy/objspace/std/stringobject.py", line 943, in mul__String_ANY + return mul_string_times(space, w_str, w_times) + File "/home/hpk/pypy-dist/pypy/objspace/std/stringobject.py", line 930, in mul_string_times + buffer = [' '] * (mul*input_len) +ValueError: sequence repeat count too large + +--===============5397547652616958920==-- \ No newline at end of file Modified: pypy/testresult/hpk at code1.codespeak.net/test_fpformat.txt ============================================================================== --- pypy/testresult/hpk at code1.codespeak.net/test_fpformat.txt (original) +++ pypy/testresult/hpk at code1.codespeak.net/test_fpformat.txt Mon May 2 02:07:05 2005 @@ -1,16 +1,44 @@ -testreport-version: 1.0 -command: /usr/bin/python /tmp/pypy-autotest-13/pypy-dist/pypy/tool/alarm.py 13500 /tmp/pypy-autotest-13/pypy-dist/pypy/interpreter/py.py /tmp/pypy-autotest-13/pypy-dist/lib-python-2.3.4/test/test_fpformat.py -run by: hpk at code1.codespeak.net -sys.platform: linux2 -sys.version_info: (2, 3, 5, 'final', 0) -cpu model: AMD Opteron(tm) Processor 242 +Content-Type: multipart/mixed; boundary="===============3009159954939926615==" +MIME-Version: 1.0 cpu mhz: 1603.694 -oldstyle: no -pypy-revision: 11680 -startdate: Sun May 1 06:13:46 2005 -timeout: 13500.0 seconds +cpu model: AMD Opteron(tm) Processor 242 +execution-time: 214.447520971 +exit status: 0 +fspath: /home/hpk/pypy-dist/lib-python/2.3.4/test/test_fpformat.py +options: ['core'] +outcome: OK +platform: linux2 +pypy-revision: 11740 +python-version-info: (2, 3, 5, 'final', 0) +startdate: Mon May 2 02:02:04 2005 +testreport-version: 1.1 +timeout: 841.0 +userhost: hpk at code1.codespeak.net +_reprs: {'execution-time': 'float', 'python-version-info': 'tuple', + 'options': 'list', 'timeout': 'float', 'pypy-revision': 'int', + 'exit status': 'int'} + +--===============3009159954939926615== +Content-Type: text/plain; charset="us-ascii" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Content-Disposition: attachment; filename="stdout" + +test_basic_cases (__main__.FpformatTest) ... ok +test_failing_values (__main__.FpformatTest) ... ok +test_reasonable_values (__main__.FpformatTest) ... ok + +---------------------------------------------------------------------- +Ran 3 tests in 201.820s + +OK + +--===============3009159954939926615== +Content-Type: text/plain; charset="us-ascii" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Content-Disposition: attachment; filename="stderr" -============================================================ faking faking faking @@ -20,14 +48,5 @@ faking faking faking -test_basic_cases (__main__.FpformatTest) ... ok -test_failing_values (__main__.FpformatTest) ... ok -test_reasonable_values (__main__.FpformatTest) ... ok - ----------------------------------------------------------------------- -Ran 3 tests in 198.114s -OK -========================== closed ========================== -execution time: 209.628983974 seconds -exit status: 0 +--===============3009159954939926615==-- \ No newline at end of file Modified: pypy/testresult/hpk at code1.codespeak.net/test_funcattrs.txt ============================================================================== --- pypy/testresult/hpk at code1.codespeak.net/test_funcattrs.txt (original) +++ pypy/testresult/hpk at code1.codespeak.net/test_funcattrs.txt Mon May 2 02:07:05 2005 @@ -1,21 +1,40 @@ -testreport-version: 1.0 -command: /usr/bin/python /tmp/pypy-autotest-13/pypy-dist/pypy/tool/alarm.py 13499 /tmp/pypy-autotest-13/pypy-dist/pypy/interpreter/py.py /tmp/pypy-autotest-13/pypy-dist/pypy/lib/test2/test_funcattrs.py -run by: hpk at code1.codespeak.net -sys.platform: linux2 -sys.version_info: (2, 3, 5, 'final', 0) -cpu model: AMD Opteron(tm) Processor 242 +Content-Type: multipart/mixed; boundary="===============7466336036706822855==" +MIME-Version: 1.0 cpu mhz: 1603.694 -oldstyle: no -pypy-revision: 11680 -startdate: Sun May 1 06:17:16 2005 -timeout: 13500.0 seconds +cpu model: AMD Opteron(tm) Processor 242 +execution-time: 7.88857102394 +exit status: 0 +fspath: /home/hpk/pypy-dist/lib-python/modified-2.3.4/test/test_funcattrs.py +options: ['core'] +outcome: OK +platform: linux2 +pypy-revision: 11740 +python-version-info: (2, 3, 5, 'final', 0) +startdate: Mon May 2 02:05:39 2005 +testreport-version: 1.1 +timeout: 841.0 +userhost: hpk at code1.codespeak.net +_reprs: {'execution-time': 'float', 'python-version-info': 'tuple', + 'options': 'list', 'timeout': 'float', 'pypy-revision': 'int', + 'exit status': 'int'} + +--===============7466336036706822855== +Content-Type: text/plain; charset="us-ascii" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Content-Disposition: attachment; filename="stdout" + + +--===============7466336036706822855== +Content-Type: text/plain; charset="us-ascii" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Content-Disposition: attachment; filename="stderr" -============================================================ faking faking faking faking faking -========================== closed ========================== -execution time: 6.25531983376 seconds -exit status: 0 + +--===============7466336036706822855==-- \ No newline at end of file Modified: pypy/testresult/hpk at code1.codespeak.net/test_future.txt ============================================================================== --- pypy/testresult/hpk at code1.codespeak.net/test_future.txt (original) +++ pypy/testresult/hpk at code1.codespeak.net/test_future.txt Mon May 2 02:07:05 2005 @@ -1,18 +1,43 @@ -testreport-version: 1.0 -command: /usr/bin/python /tmp/pypy-autotest-13/pypy-dist/pypy/tool/alarm.py 12615 /tmp/pypy-autotest-13/pypy-dist/pypy/interpreter/py.py /tmp/pypy-autotest-13/pypy-dist/lib-python-2.3.4/test/test_future.py -run by: hpk at code1.codespeak.net -sys.platform: linux2 -sys.version_info: (2, 3, 5, 'final', 0) -cpu model: AMD Opteron(tm) Processor 242 +Content-Type: multipart/mixed; boundary="===============4166020226285430572==" +MIME-Version: 1.0 cpu mhz: 1603.694 -oldstyle: no -pypy-revision: 11680 -startdate: Sun May 1 06:17:22 2005 -timeout: 12615.0 seconds +cpu model: AMD Opteron(tm) Processor 242 +execution-time: 10.1442010403 +exit status: 0 +fspath: /home/hpk/pypy-dist/lib-python/2.3.4/test/test_future.py +options: ['core'] +outcome: OK +platform: linux2 +pypy-revision: 11740 +python-version-info: (2, 3, 5, 'final', 0) +startdate: Mon May 2 02:05:48 2005 +testreport-version: 1.1 +timeout: 900.0 +userhost: hpk at code1.codespeak.net +_reprs: {'execution-time': 'float', 'python-version-info': 'tuple', + 'options': 'list', 'timeout': 'float', 'pypy-revision': 'int', + 'exit status': 'int'} + +--===============4166020226285430572== +Content-Type: text/plain; charset="us-ascii" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Content-Disposition: attachment; filename="stdout" + +6 +6 +SyntaxError badsyntax_future3 3 +SyntaxError badsyntax_future4 3 +SyntaxError badsyntax_future5 4 +SyntaxError badsyntax_future6 3 +SyntaxError badsyntax_future7 3 + +--===============4166020226285430572== +Content-Type: text/plain; charset="us-ascii" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Content-Disposition: attachment; filename="stderr" -OUTPUT TEST -see output in: /tmp/pypy-autotest-13/pypy-dist/lib-python-2.3.4/test/result/hpk at code1.codespeak.net/test_future.out -============================================================ faking faking faking @@ -22,7 +47,5 @@ faking faking faking -OK -========================== closed ========================== -execution time: 8.64759993553 seconds -exit status: 0 + +--===============4166020226285430572==-- \ No newline at end of file Modified: pypy/testresult/hpk at code1.codespeak.net/test_future1.txt ============================================================================== --- pypy/testresult/hpk at code1.codespeak.net/test_future1.txt (original) +++ pypy/testresult/hpk at code1.codespeak.net/test_future1.txt Mon May 2 02:07:05 2005 @@ -1,20 +1,39 @@ -testreport-version: 1.0 -command: /usr/bin/python /tmp/pypy-autotest-13/pypy-dist/pypy/tool/alarm.py 13500 /tmp/pypy-autotest-13/pypy-dist/pypy/interpreter/py.py /tmp/pypy-autotest-13/pypy-dist/lib-python-2.3.4/test/test_future1.py -run by: hpk at code1.codespeak.net -sys.platform: linux2 -sys.version_info: (2, 3, 5, 'final', 0) -cpu model: AMD Opteron(tm) Processor 242 +Content-Type: multipart/mixed; boundary="===============6867012076597281344==" +MIME-Version: 1.0 cpu mhz: 1603.694 -oldstyle: no -pypy-revision: 11680 -startdate: Sun May 1 06:17:31 2005 -timeout: 13500.0 seconds +cpu model: AMD Opteron(tm) Processor 242 +execution-time: 1.05612301826 +exit status: 0 +fspath: /home/hpk/pypy-dist/lib-python/2.3.4/test/test_future1.py +options: ['core'] +outcome: OK +platform: linux2 +pypy-revision: 11740 +python-version-info: (2, 3, 5, 'final', 0) +startdate: Mon May 2 02:05:58 2005 +testreport-version: 1.1 +timeout: 784.0 +userhost: hpk at code1.codespeak.net +_reprs: {'execution-time': 'float', 'python-version-info': 'tuple', + 'options': 'list', 'timeout': 'float', 'pypy-revision': 'int', + 'exit status': 'int'} + +--===============6867012076597281344== +Content-Type: text/plain; charset="us-ascii" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Content-Disposition: attachment; filename="stdout" + +6 + +--===============6867012076597281344== +Content-Type: text/plain; charset="us-ascii" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Content-Disposition: attachment; filename="stderr" -============================================================ faking faking faking -6 -========================== closed ========================== -execution time: 1.04015302658 seconds -exit status: 0 + +--===============6867012076597281344==-- \ No newline at end of file Modified: pypy/testresult/hpk at code1.codespeak.net/test_future2.txt ============================================================================== --- pypy/testresult/hpk at code1.codespeak.net/test_future2.txt (original) +++ pypy/testresult/hpk at code1.codespeak.net/test_future2.txt Mon May 2 02:07:05 2005 @@ -1,20 +1,39 @@ -testreport-version: 1.0 -command: /usr/bin/python /tmp/pypy-autotest-13/pypy-dist/pypy/tool/alarm.py 13499 /tmp/pypy-autotest-13/pypy-dist/pypy/interpreter/py.py /tmp/pypy-autotest-13/pypy-dist/lib-python-2.3.4/test/test_future2.py -run by: hpk at code1.codespeak.net -sys.platform: linux2 -sys.version_info: (2, 3, 5, 'final', 0) -cpu model: AMD Opteron(tm) Processor 242 +Content-Type: multipart/mixed; boundary="===============5283043095802778497==" +MIME-Version: 1.0 cpu mhz: 1603.694 -oldstyle: no -pypy-revision: 11680 -startdate: Sun May 1 06:17:32 2005 -timeout: 13500.0 seconds +cpu model: AMD Opteron(tm) Processor 242 +execution-time: 1.88751912117 +exit status: 0 +fspath: /home/hpk/pypy-dist/lib-python/2.3.4/test/test_future2.py +options: ['core'] +outcome: OK +platform: linux2 +pypy-revision: 11740 +python-version-info: (2, 3, 5, 'final', 0) +startdate: Mon May 2 02:06:00 2005 +testreport-version: 1.1 +timeout: 900.0 +userhost: hpk at code1.codespeak.net +_reprs: {'execution-time': 'float', 'python-version-info': 'tuple', + 'options': 'list', 'timeout': 'float', 'pypy-revision': 'int', + 'exit status': 'int'} + +--===============5283043095802778497== +Content-Type: text/plain; charset="us-ascii" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Content-Disposition: attachment; filename="stdout" + +6 + +--===============5283043095802778497== +Content-Type: text/plain; charset="us-ascii" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Content-Disposition: attachment; filename="stderr" -============================================================ faking faking faking -6 -========================== closed ========================== -execution time: 1.86731410027 seconds -exit status: 0 + +--===============5283043095802778497==-- \ No newline at end of file Modified: pypy/testresult/hpk at code1.codespeak.net/test_future3.txt ============================================================================== --- pypy/testresult/hpk at code1.codespeak.net/test_future3.txt (original) +++ pypy/testresult/hpk at code1.codespeak.net/test_future3.txt Mon May 2 02:07:05 2005 @@ -1,21 +1,29 @@ -testreport-version: 1.0 -command: /usr/bin/python /tmp/pypy-autotest-13/pypy-dist/pypy/tool/alarm.py 12615 /tmp/pypy-autotest-13/pypy-dist/pypy/interpreter/py.py /tmp/pypy-autotest-13/pypy-dist/lib-python-2.3.4/test/test_future3.py -run by: hpk at code1.codespeak.net -sys.platform: linux2 -sys.version_info: (2, 3, 5, 'final', 0) -cpu model: AMD Opteron(tm) Processor 242 +Content-Type: multipart/mixed; boundary="===============2003253127130217213==" +MIME-Version: 1.0 cpu mhz: 1603.694 -oldstyle: no -pypy-revision: 11680 -startdate: Sun May 1 06:17:35 2005 -timeout: 12615.0 seconds +cpu model: AMD Opteron(tm) Processor 242 +execution-time: 9.28078317642 +exit status: 0 +fspath: /home/hpk/pypy-dist/lib-python/2.3.4/test/test_future3.py +options: ['core'] +outcome: OK +platform: linux2 +pypy-revision: 11740 +python-version-info: (2, 3, 5, 'final', 0) +startdate: Mon May 2 02:06:03 2005 +testreport-version: 1.1 +timeout: 900.0 +userhost: hpk at code1.codespeak.net +_reprs: {'execution-time': 'float', 'python-version-info': 'tuple', + 'options': 'list', 'timeout': 'float', 'pypy-revision': 'int', + 'exit status': 'int'} + +--===============2003253127130217213== +Content-Type: text/plain; charset="us-ascii" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Content-Disposition: attachment; filename="stdout" -============================================================ -faking -faking -faking -faking -faking test_floor_div_operator (__main__.TestFuture) ... ok test_nested_scopes (__main__.TestFuture) ... ok test_true_div_as_default (__main__.TestFuture) ... ok @@ -24,6 +32,17 @@ Ran 3 tests in 1.186s OK -========================== closed ========================== -execution time: 8.2985470295 seconds -exit status: 0 + +--===============2003253127130217213== +Content-Type: text/plain; charset="us-ascii" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Content-Disposition: attachment; filename="stderr" + +faking +faking +faking +faking +faking + +--===============2003253127130217213==-- \ No newline at end of file Modified: pypy/testresult/htmlreport.py ============================================================================== --- pypy/testresult/htmlreport.py (original) +++ pypy/testresult/htmlreport.py Mon May 2 02:07:05 2005 @@ -1,149 +1,24 @@ #! /usr/bin/env python """ -A quick reporting tool, showing the exit status and last line of each test. +the html test reporter -In the first column, quickreport attempts to categorize the test result: - - Ok passed. - ERR failed. - (blank) ImportError, one of the known-missing modules listed below. - ? parse error, maybe the test is currently running. - T/O time out. - -When called with arguments, quickreport prints the name of the tests that -match them. The first argument is the category (ok, err, t/o) and the -optional following arguments are searched for in the last column of the -table. """ - import sys, os, re import py -html = py.xml.html -mydir = py.path.local() +# +# various interesting path objects +# +testresultdir = py.magic.autopath().dirpath() +assert testresultdir.basename.endswith('result') +pypydistdir = testresultdir.dirpath() +pypydir = pypydistdir.join('pypy') +assert pypydir.check(dir=1) +libpythondir = pypydistdir.join('lib-python') +resultmodule = libpythondir.join('result.py').pyimport() -r_end = re.compile(r"""(.+)\s*========================== closed ========================== -execution time: (.+) seconds -exit status: (.+) -$""") - -r_endout = re.compile(r"""(.+)\s*FAILED: test output differs -========================== closed ========================== -execution time: (.+) seconds -exit status: (.+) -$""") - -r_timedout = re.compile(r"""==========================timeout========================== -""") - -r_importerror = re.compile(r"ImportError: (.+)") - -# Linux list below. May need to add a few ones for Windows... -IGNORE_MODULES = """ - array datetime md5 regex _testcapi - audioop dbm mmap resource time - binascii dl mpz rgbimg timing - _bsddb fcntl nis rotor _tkinter - bz2 gdbm operator select unicodedata - cmath grp ossaudiodev sha _weakref - cPickle _hotshot parser _socket xreadlines - crypt imageop pcre _ssl zlib - cStringIO itertools pwd strop _winreg - _csv linuxaudiodev pyexpat struct winsound - _curses_panel _locale _random syslog aetools - _curses math readline termios sunaudiodev - - bsddb185 - - thread - signal - _symtable - -""".split() # _symtable as it is is an impl detail of CPython compiler - -IGNORE_MODULES.extend("aepack macfs macostools plistlib".split()) # Mac ext stuff -IGNORE_MODULES.extend("al cd cl gl imgfile".split()) # old SGI IRIX extensions - -IGNORE_MODULES.append("no XML parsers available") -IGNORE_MODULES.append("test locale en_US not supported") -IGNORE_MODULES.append("test_support must be imported from the test package") - -class Result: - def __getattr__(self, name): - if 'pts' in self.__dict__: - raise AttributeError, None - self.pts = '?' - self.name = '?' - self.exit_status = '?' - self.execution_time = '?' - self.timedout = False - self.finalline = '' - self.ensurebody() - return getattr(self, name) - - def parse_header(self, fn): - f = fn.open(mode='r') - header = py.std.rfc822.Message(f) - for name, value in header.items(): - name = name.replace(' ', '_').replace('-', '_').replace('.', '_') - try: - value = int(value) - except ValueError: - pass - setattr(self, name, value) - if not hasattr(self, 'testreport_version'): - self.testreport_version = '1.0' - assert self.testreport_version == '1.0' - self.resultpath = fn - self.name = fn.purebasename - self._body = header.fp.read() - - def ensurebody(self): - if not hasattr(self, '_body'): - return True - data = self.body = self._body - del self._body - self.timedout = bool(r_timedout.search(data)) - match = r_end.search(data) - assert match, self.resultpath - self.execution_time = float(match.group(2)) - self.exit_status = int(match.group(3)) - - if (self.exit_status == 0 and - not match.group(1).lower().startswith('fail')): - self.pts = 'Ok' - elif not self.timedout: - self.finalline = match.group(1) - output_test = False - if self.finalline == "FAILED: test output differs": - output_test = True - match = r_endout.search(data) - assert match - self.finalline = match.group(1) - self.pts = 'ERR' - match1 = r_importerror.match(self.finalline) - if match1: - module = match1.group(1) - if module in IGNORE_MODULES: - self.pts = '' # doesn't count in our total - elif self.finalline.startswith('TestSkipped: '): - self.pts = '' - elif self.finalline == 'skipping curses': - self.pts = '' - if output_test: - self.finalline+=" [OUTPUT TEST]" - else: - self.finalline = 'TIME OUT' - self.pts = 'T/O' - - def __str__(self): - return '%-3s %-17s %3s %5s %s' % ( - self.pts, - self.name, - self.exit_status, - str(self.execution_time)[:5], - self.finalline) +html = py.xml.html class HtmlReport(object): def __init__(self): @@ -159,11 +34,23 @@ self.parse_one(x) def parse_one(self, resultpath): - result = Result() - result.parse_header(resultpath) - self.results.append(result) - self.name2result.setdefault(result.name, []).append(result) - return result + try: + res = resultmodule.ResultFromMime(resultpath) + ver = res['testreport-version'] + if ver != "1.1": + raise TypeError + except TypeError: + return + else: + print "sucess", resultpath + self.results.append(res) + name = res.fspath.purebasename + self.name2result.setdefault(name, []).append(res) + return res + + # + # rendering + # def get_latest_results(self, checkerfunc=None): names = self.name2result.keys() @@ -174,8 +61,9 @@ maxrev = 0 maxresult = None for res in resultlist: - if res.pypy_revision > maxrev: - maxrev = res.pypy_revision + resrev = res['pypy-revision'] + if resrev > maxrev: + maxrev = resrev maxresult = res assert maxresult if not checkerfunc or checkerfunc(maxresult): @@ -185,47 +73,151 @@ def render_latest_table(self, results): table = html.table( [html.th(x, align='left') - for x in ("status", "revision", "user", "platform", - "elapsed", "oldstyle", - "filename", "finalline")] + for x in ("status", "filename", "revision", + "user", "platform", "elapsed", + "options", + )], ) for result in results: table.append(self.render_result_row(result)) return table def render_result_row(self, result): - l = [] - l.append(html.a(result.resultpath.purebasename, - href=self.href_resultpath(result.resultpath))) - outpath = result.resultpath.new(ext='.out') - if outpath.check(): - l.append(html.a("[OUT]", - href=self.href_resultpath(outpath))) - - dp = result.resultpath.dirpath() - #if dp.basename == result.run_by: - # user = html.a(dp.basename[:15], href=self.href_resultpath(dp)) - #else: - user = dp.basename[:15] - + #l = [] + #l.append(html.a(result.purebasenameresultpath.purebasename, + # href=self.href_resultpath(result.resultpath))) + #outpath = result.resultpath.new(ext='.out') + #if outpath.check(): + # l.append(html.a("[OUT]", + # href=self.href_resultpath(outpath))) + dp = py.path.local(result['fspath']) + + options = " ".join([x for x in result.get('options', []) if x!= 'core']) + if not options: + options=" " return html.tr( - html.td(result.pts), - html.td(result.pypy_revision), - html.td(user), - html.td(result.sys_platform), - html.td("%.2fs" % result.execution_time), - html.td(getattr(result, 'oldstyle', '??')), - html.td(l), - html.td(result.finalline) + html.td(result['outcome'], + style = "background-color: %s" % (getresultcolor(result),)), + html.td(self.render_test_references(result)), + html.td(result['pypy-revision']), + html.td(result['userhost'][:15]), + html.td(result['platform']), + html.td("%.2fs" % result['execution-time']), + html.td(options), ) - - def setresulturl(self, url): - self.url = url - def href_resultpath(self, path): - rel = path.relto(mydir) - return "%s/%s" % (self.url, rel,) + def getrelpath(self, p): + return p.relto(self.indexpath.dirpath()) + + def render_test_references(self, result): + dest = self.make_single_test_result(result) + return html.div(html.a(result.path.purebasename, + href=self.getrelpath(dest)), + style="background-color: transparent") + + def make_single_test_result(self, result): + cache = self.indexpath.dirpath('.cache') + cache.ensure(dir=1) + dest = cache.join(result.path.basename).new(ext='.html') + doc = ViewResult(result) + doc.writetopath(dest) + return dest + + def getcorelists(self): + def iscore(result): + return 'core' in result.get('options', []) + coretests = [] + noncoretests = [] + for x in self.get_latest_results() : + if iscore(x): + coretests.append(x) + else: + noncoretests.append(x) + return coretests, noncoretests + + # generate html files + # + def makeindex(self, indexpath): + self.indexpath = indexpath + doc = Document(title='pypy test results') + body = doc.body + coretests, noncoretests = self.getcorelists() + body.append(html.h2("PyPy - latest compliance test results - " + "core tests")) + + ok = len([x for x in coretests if x.isok()]) + err = len([x for x in coretests if x.iserr()]) + to = len([x for x in coretests if x.istimeout()]) + sum = ok + err + to + sum100 = sum / 100.0 + body.append(html.div( "%.2f%% passed, %.2f%% timeout, %.2f%% ERROR" % ( + ok/sum100, to/sum100, err/sum100), + style="font-weight: bold")) + body.append(self.render_latest_table(coretests)) + + body.append( + html.h2("PyPy - latest compliance test results - non-core tests")) + body.append(self.render_latest_table(noncoretests)) + doc.writetopath(indexpath) + +class Document(object): + def __init__(self, title=None): + self.body = html.body() + self.head = html.head() + self.doc = html.html(self.head, self.body) + if title is not None: + self.head.append( + html.meta(name="title", content=title)) + self.head.append( + html.link(rel="Stylesheet", type="text/css", href="/pypy/default.css")) + + def writetopath(self, p): + assert p.ext == '.html' + self.head.append( + html.meta(name="Content-Type", content="text/html;charset=UTF-8") + ) + s = self.doc.unicode().encode('utf-8') + p.write(s) + +def getresultcolor(result): + if result.isok(): + color = "#00ee00" + elif result.iserr(): + color = "#ee0000" + elif result.istimeout: + color = "#0000ee" + else: + color = "#444444" + return color + +class ViewResult(Document): + def __init__(self, result): + title = "%s testresult" % (result.path.purebasename,) + super(ViewResult, self).__init__(title=title) + color = getresultcolor(result) + self.body.append(html.h2(title, + style="background-color: %s" % color)) + self.body.append(self.render_meta_info(result)) + for name in ('reportdiff', 'stdout', 'stderr'): + try: + text = result.getnamedtext(name) + except KeyError: + continue + text = py.xml.escape(text) + self.body.append(html.h3(name)) + self.body.append(html.pre(text)) + + def render_meta_info(self, result): + t = html.table() + items = result.items() + items.sort() + for name, value in items: + if name.lower() == name: + t.append(html.tr( + html.td(name), html.td(value))) + return t + class TestOfHtmlReportClass: def setup_class(cls): cls.testresultdir = py.path.local() @@ -236,16 +228,15 @@ # test pickling of report tempdir = py.test.ensuretemp('reportpickle') picklepath = tempdir.join('report.pickle') - picklepath.dumpobj(self.rep) - x = picklepath.loadobj() + picklepath.dump(self.rep) + x = picklepath.load() assert len(x.results) == len(self.rep.results) def test_render_latest(self): - t = self.rep.render_latest_table() + t = self.rep.render_latest_table(self.rep.results) assert unicode(t) mydir = py.magic.autopath().dirpath() def getpicklepath(): return mydir.join('.htmlreport.pickle') - Deleted: /pypy/testresult/index.cgi ============================================================================== --- /pypy/testresult/index.cgi Mon May 2 02:07:05 2005 +++ (empty file) @@ -1,74 +0,0 @@ -#!/usr/bin/python - -import cgitb -cgitb.enable() -import htmlreport - -# XXX HACK - -import sys -sys.path.insert(0, '/projects/pypy/dist') # always updated via '~/.svntrigger' - -# XXX -baseurl = "http://codespeak.net/~hpk/pypy-testresult" - -if __name__ == '__main__': - import py - html = py.xml.html - pypytestresultdir = py.magic.autopath().dirpath() - - head = html.head() - body = html.body() - doc = html.html(head, body) - - testlist = html.ul() - body.append(testlist) - - ppath = htmlreport.getpicklepath() - rep = ppath.load() - rep.setresulturl(baseurl) - - # XXX refactor: - import pypy - conftest = (py.path.local(pypy.__file__).dirpath() - .dirpath('lib-python', 'conftest.py') - .getpymodule()) - name2core = {} - for regrtest in conftest.testmap: - if regrtest.core: - i = regrtest.basename.find('.') - name = regrtest.basename[:i] - name2core[name] = True - def iscore(result): - return result.name in name2core - - coretests = [] - noncoretests = [] - for x in rep.get_latest_results() : - if iscore(x): - coretests.append(x) - else: - noncoretests.append(x) - - assert coretests - assert noncoretests - ok = len([x for x in coretests if x.pts.lower() == 'ok']) - err = len([x for x in coretests if x.pts.lower() == 'err']) - to = len([x for x in coretests if x.pts.lower() == 't/o']) - doc.append(html.h2("PyPy - latest compliance test results - " - "core tests")) - sum = ok + err + to - sum100 = sum / 100.0 - doc.append(html.div( "%.2f%% passed, %.2f%% timeout, %.2f%% ERROR" % ( - ok/sum100, to/sum100, err/sum100), - style="font-weight: bold")) - doc.append(rep.render_latest_table(coretests)) - - doc.append( - html.h2("PyPy - latest compliance test results - non-core tests")) - doc.append(rep.render_latest_table(noncoretests)) - - result = doc.unicode().encode('UTF-8') - print "Content-Type: text/html; charset=UTF8" - print - print result Deleted: /pypy/testresult/quickreport.py ============================================================================== --- /pypy/testresult/quickreport.py Mon May 2 02:07:05 2005 +++ (empty file) @@ -1,175 +0,0 @@ -#! /usr/bin/env python - -""" -A quick reporting tool, showing the exit status and last line of each test. - -In the first column, quickreport attempts to categorize the test result: - - Ok passed. - ERR failed. - (blank) ImportError, one of the known-missing modules listed below. - ? parse error, maybe the test is currently running. - T/O time out. - -When called with arguments, quickreport prints the name of the tests that -match them. The first argument is the category (ok, err, t/o) and the -optional following arguments are searched for in the last column of the -table. -""" - -import sys, os -try: - __file__ -except NameError: - __file__ = sys.argv[0] -dir = os.path.abspath(__file__) -dir = os.path.dirname(dir) # result/ -dir = os.path.dirname(dir) # test/ -dir = os.path.dirname(dir) # lib-python-2.3.4/ -dir = os.path.dirname(dir) # dist/ -sys.path.insert(0, dir) -import py, re - -mydir = py.path.local() - -r_end = re.compile(r"""(.+)\s*========================== closed ========================== -execution time: (.+) seconds -exit status: (.+) -$""") - -r_endout = re.compile(r"""(.+)\s*FAILED: test output differs -========================== closed ========================== -execution time: (.+) seconds -exit status: (.+) -$""") - -r_timeout = re.compile(r"""==========================timeout========================== -""") - -r_importerror = re.compile(r"ImportError: (.+)") - -# Linux list below. May need to add a few ones for Windows... -IGNORE_MODULES = """ - array datetime md5 regex _testcapi - audioop dbm mmap resource time - binascii dl mpz rgbimg timing - _bsddb fcntl nis rotor _tkinter - bz2 gdbm operator select unicodedata - cmath grp ossaudiodev sha _weakref - cPickle _hotshot parser _socket xreadlines - crypt imageop pcre _ssl zlib - cStringIO itertools pwd strop _winreg - _csv linuxaudiodev pyexpat struct winsound - _curses_panel _locale _random syslog aetools - _curses math readline termios sunaudiodev - - bsddb185 - - thread - signal - _symtable - -""".split() # _symtable as it is is an impl detail of CPython compiler - -IGNORE_MODULES.extend("aepack macfs macostools plistlib".split()) # Mac ext stuff -IGNORE_MODULES.extend("al cd cl gl imgfile".split()) # old SGI IRIX extensions - -IGNORE_MODULES.append("no XML parsers available") -IGNORE_MODULES.append("test locale en_US not supported") -IGNORE_MODULES.append("test_support must be imported from the test package") - -class Result: - pts = '?' - name = '?' - exit_status = '?' - execution_time = '?' - timeout = False - finalline = '' - - def read(self, fn): - self.name = fn.purebasename - data = fn.read(mode='r') - self.timeout = bool(r_timeout.search(data)) - match = r_end.search(data) - assert match - self.execution_time = float(match.group(2)) - self.exit_status = match.group(3) - if (self.exit_status == '0' and - not match.group(1).lower().startswith('fail')): - self.pts = 'Ok' - elif not self.timeout: - self.finalline = match.group(1) - output_test = False - if self.finalline == "FAILED: test output differs": - output_test = True - match = r_endout.search(data) - assert match - self.finalline = match.group(1) - self.pts = 'ERR' - match1 = r_importerror.match(self.finalline) - if match1: - module = match1.group(1) - if module in IGNORE_MODULES: - self.pts = '' # doesn't count in our total - elif self.finalline.startswith('TestSkipped: '): - self.pts = '' - elif self.finalline == 'skipping curses': - self.pts = '' - if output_test: - self.finalline+=" [OUTPUT TEST]" - else: - self.finalline = 'TIME OUT' - self.pts = 'T/O' - - def __str__(self): - return '%-3s %-17s %3s %5s %s' % ( - self.pts, - self.name, - self.exit_status, - str(self.execution_time)[:5], - self.finalline) - - -def allresults(): - files = mydir.listdir("*.txt") - files.sort(lambda x,y: cmp(str(x).lower(), str(y).lower())) - for fn in files: - result = Result() - try: - result.read(fn) - except AssertionError: - pass - yield result - - -def report_table(): - header = Result() - header.pts = 'res' - header.name = 'name' - header.exit_status = 'err' - header.execution_time = 'time' - header.finalline = ' last output line' - print - print header - print - count = 0 - for result in allresults(): - print result - count += 1 - print - if count == 0: - print >> sys.stderr, """No result found. Try to run it as: - cd user at host; python ../quickreport.py - """ - -if __name__ == '__main__': - if len(sys.argv) <= 1: - report_table() - else: - match_pts = sys.argv[1].upper() - match_finalline = '\s+'.join([re.escape(s) for s in sys.argv[2:]]) - r_match_finalline = re.compile(match_finalline) - for result in allresults(): - if result.pts.upper() == match_pts: - if r_match_finalline.search(result.finalline): - print result.name From hpk at codespeak.net Mon May 2 02:14:27 2005 From: hpk at codespeak.net (hpk at codespeak.net) Date: Mon, 2 May 2005 02:14:27 +0200 (CEST) Subject: [pypy-svn] r11756 - pypy/testresult/hpk@code1.codespeak.net Message-ID: <20050502001427.0A6B827C1F@code1.codespeak.net> Author: hpk Date: Mon May 2 02:14:26 2005 New Revision: 11756 Added: pypy/testresult/hpk at code1.codespeak.net/test_generators.txt pypy/testresult/hpk at code1.codespeak.net/test_global.txt pypy/testresult/hpk at code1.codespeak.net/test_grammar.txt Modified: pypy/testresult/hpk at code1.codespeak.net/test_getopt.txt pypy/testresult/hpk at code1.codespeak.net/test_glob.txt pypy/testresult/hpk at code1.codespeak.net/test_hash.txt Log: more test results Added: pypy/testresult/hpk at code1.codespeak.net/test_generators.txt ============================================================================== --- (empty file) +++ pypy/testresult/hpk at code1.codespeak.net/test_generators.txt Mon May 2 02:14:26 2005 @@ -0,0 +1,193 @@ +Content-Type: multipart/mixed; boundary="===============7980231702083571109==" +MIME-Version: 1.0 +cpu mhz: 1603.694 +cpu model: AMD Opteron(tm) Processor 242 +execution-time: 244.039711952 +exit status: 1 +fspath: /home/hpk/pypy-dist/lib-python/2.3.4/test/test_generators.py +options: ['core'] +outcome: ERR +platform: linux2 +pypy-revision: 11740 +python-version-info: (2, 3, 5, 'final', 0) +startdate: Mon May 2 02:06:13 2005 +testreport-version: 1.1 +timeout: 900.0 +userhost: hpk at code1.codespeak.net +_reprs: {'execution-time': 'float', 'python-version-info': 'tuple', + 'options': 'list', 'timeout': 'float', 'pypy-revision': 'int', + 'exit status': 'int'} + +--===============7980231702083571109== +Content-Type: text/plain; charset="us-ascii" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Content-Disposition: attachment; filename="stdout" + +***************************************************************** +Failure in example: print i.next.__doc__ +from line #85 of test.test_generators.__test__.email +Expected: x.next() -> the next value, or raise StopIteration +Got: None +***************************************************************** +Failure in example: i.gi_running = 42 +from line #99 of test.test_generators.__test__.email +Expected: TypeError: readonly attribute +Got: TypeError: read-only attribute +***************************************************************** +Failure in example: gen = random.WichmannHill(42) +from line #146 of test.test_generators.__test__.email +Exception raised: +Traceback (most recent call last): + File "/home/hpk/pypy-dist/lib-python/2.3.4/doctest.py", line 442, in _run_examples_inner + compileflags, 1) in globs + File "", line 1, in ? +AttributeError: 'module' object has no attribute 'WichmannHill' +***************************************************************** +Failure in example: +while 1: + for s in sets: + print "%s->%s" % (s, s.find()), + print + if len(roots) > 1: + s1 = gen.choice(roots) + roots.remove(s1) + s2 = gen.choice(roots) + s1.union(s2) + print "merged", s1, "into", s2 + else: + break +from line #147 of test.test_generators.__test__.email +Exception raised: +Traceback (most recent call last): + File "/home/hpk/pypy-dist/lib-python/2.3.4/doctest.py", line 442, in _run_examples_inner + compileflags, 1) in globs + File "", line 6, in ? +NameError: global name 'gen' is not defined +***************************************************************** +Failure in example: k.next() +from line #52 of test.test_generators.__test__.pep +Expected: ZeroDivisionError: integer division or modulo by zero +Got: ZeroDivisionError: integer division by zero +***************************************************************** +Failure in example: +def f(): + yield +from line #73 of test.test_generators.__test__.syntax +Expected: SyntaxError: invalid syntax +Got: SyntaxError: invalid syntax (, line 2) +***************************************************************** +Failure in example: +def f(): + if 0: + yield +from line #78 of test.test_generators.__test__.syntax +Expected: SyntaxError: invalid syntax +Got: SyntaxError: invalid syntax (, line 3) +***************************************************************** +Failure in example: import weakref +from line #2 of test.test_generators.__test__.weakref +Exception raised: +Traceback (most recent call last): + File "/home/hpk/pypy-dist/lib-python/2.3.4/doctest.py", line 442, in _run_examples_inner + compileflags, 1) in globs + File "", line 1, in ? + File "/home/hpk/pypy-dist/lib-python/2.3.4/weakref.py", line 14, in ? + from _weakref import \ +ImportError: _weakref +***************************************************************** +Failure in example: wr = weakref.ref(gen) +from line #6 of test.test_generators.__test__.weakref +Exception raised: +Traceback (most recent call last): + File "/home/hpk/pypy-dist/lib-python/2.3.4/doctest.py", line 442, in _run_examples_inner + compileflags, 1) in globs + File "", line 1, in ? +NameError: global name 'weakref' is not defined +***************************************************************** +Failure in example: wr() is gen +from line #7 of test.test_generators.__test__.weakref +Exception raised: +Traceback (most recent call last): + File "/home/hpk/pypy-dist/lib-python/2.3.4/doctest.py", line 442, in _run_examples_inner + compileflags, 1) in globs + File "", line 1, in ? +NameError: global name 'wr' is not defined +***************************************************************** +Failure in example: p = weakref.proxy(gen) +from line #9 of test.test_generators.__test__.weakref +Exception raised: +Traceback (most recent call last): + File "/home/hpk/pypy-dist/lib-python/2.3.4/doctest.py", line 442, in _run_examples_inner + compileflags, 1) in globs + File "", line 1, in ? +NameError: global name 'weakref' is not defined +***************************************************************** +Failure in example: wr = weakref.ref(gi) +from line #14 of test.test_generators.__test__.weakref +Exception raised: +Traceback (most recent call last): + File "/home/hpk/pypy-dist/lib-python/2.3.4/doctest.py", line 442, in _run_examples_inner + compileflags, 1) in globs + File "", line 1, in ? +NameError: global name 'weakref' is not defined +***************************************************************** +Failure in example: wr() is gi +from line #15 of test.test_generators.__test__.weakref +Exception raised: +Traceback (most recent call last): + File "/home/hpk/pypy-dist/lib-python/2.3.4/doctest.py", line 442, in _run_examples_inner + compileflags, 1) in globs + File "", line 1, in ? +NameError: global name 'wr' is not defined +***************************************************************** +Failure in example: p = weakref.proxy(gi) +from line #17 of test.test_generators.__test__.weakref +Exception raised: +Traceback (most recent call last): + File "/home/hpk/pypy-dist/lib-python/2.3.4/doctest.py", line 442, in _run_examples_inner + compileflags, 1) in globs + File "", line 1, in ? +NameError: global name 'weakref' is not defined +***************************************************************** +Failure in example: list(p) +from line #18 of test.test_generators.__test__.weakref +Exception raised: +Traceback (most recent call last): + File "/home/hpk/pypy-dist/lib-python/2.3.4/doctest.py", line 442, in _run_examples_inner + compileflags, 1) in globs + File "", line 1, in ? +NameError: global name 'p' is not defined +***************************************************************** +4 items had failures: + 4 of 31 in test.test_generators.__test__.email + 1 of 20 in test.test_generators.__test__.pep + 2 of 29 in test.test_generators.__test__.syntax + 8 of 10 in test.test_generators.__test__.weakref +***Test Failed*** 15 failures. + +--===============7980231702083571109== +Content-Type: text/plain; charset="us-ascii" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Content-Disposition: attachment; filename="stderr" + +faking +faking +faking +faking +faking +faking +faking +faking +faking +Traceback (application-level): + File "/home/hpk/pypy-dist/lib-python/2.3.4/test/test_generators.py", line 1412 in ? + test_main(1) + File "/home/hpk/pypy-dist/lib-python/2.3.4/test/test_generators.py", line 1408 in test_main + test_support.run_doctest(test_generators, verbose) + File "/home/hpk/pypy-dist/lib-python/2.3.4/test/test_support.py", line 290 in run_doctest + raise TestFailed("%d of %d doctests failed" % (f, t)) +TestFailed: 15 of 152 doctests failed + +--===============7980231702083571109==-- \ No newline at end of file Modified: pypy/testresult/hpk at code1.codespeak.net/test_getopt.txt ============================================================================== --- pypy/testresult/hpk at code1.codespeak.net/test_getopt.txt (original) +++ pypy/testresult/hpk at code1.codespeak.net/test_getopt.txt Mon May 2 02:14:26 2005 @@ -1,16 +1,44 @@ -testreport-version: 1.0 -command: /usr/bin/python /tmp/pypy-autotest-13/pypy-dist/pypy/tool/alarm.py 13500 /tmp/pypy-autotest-13/pypy-dist/pypy/interpreter/py.py /tmp/pypy-autotest-13/pypy-dist/lib-python-2.3.4/test/test_getopt.py -run by: hpk at code1.codespeak.net -sys.platform: linux2 -sys.version_info: (2, 3, 5, 'final', 0) -cpu model: AMD Opteron(tm) Processor 242 +Content-Type: multipart/mixed; boundary="===============4361236636524145855==" +MIME-Version: 1.0 cpu mhz: 1603.694 -oldstyle: no -pypy-revision: 11680 -startdate: Sun May 1 06:17:43 2005 -timeout: 13500.0 seconds +cpu model: AMD Opteron(tm) Processor 242 +execution-time: 88.9181101322 +exit status: 0 +fspath: /home/hpk/pypy-dist/lib-python/2.3.4/test/test_getopt.py +options: ['core'] +outcome: OK +platform: linux2 +pypy-revision: 11740 +python-version-info: (2, 3, 5, 'final', 0) +startdate: Mon May 2 02:10:18 2005 +testreport-version: 1.1 +timeout: 841.0 +userhost: hpk at code1.codespeak.net +_reprs: {'execution-time': 'float', 'python-version-info': 'tuple', + 'options': 'list', 'timeout': 'float', 'pypy-revision': 'int', + 'exit status': 'int'} + +--===============4361236636524145855== +Content-Type: text/plain; charset="us-ascii" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Content-Disposition: attachment; filename="stdout" + +Running tests on getopt.short_has_arg +Running tests on getopt.long_has_args +Running tests on getopt.do_shorts +Running tests on getopt.do_longs +Running tests on getopt.getopt +Running tests on getopt.gnu_getopt +doctest (__main__) ... 12 tests with zero failures +Module getopt: tests completed successfully. + +--===============4361236636524145855== +Content-Type: text/plain; charset="us-ascii" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Content-Disposition: attachment; filename="stderr" -============================================================ faking faking faking @@ -20,14 +48,5 @@ faking faking faking -Running tests on getopt.short_has_arg -Running tests on getopt.long_has_args -Running tests on getopt.do_shorts -Running tests on getopt.do_longs -Running tests on getopt.getopt -Running tests on getopt.gnu_getopt -doctest (__main__) ... 12 tests with zero failures -Module getopt: tests completed successfully. -========================== closed ========================== -execution time: 87.2648501396 seconds -exit status: 0 + +--===============4361236636524145855==-- \ No newline at end of file Modified: pypy/testresult/hpk at code1.codespeak.net/test_glob.txt ============================================================================== --- pypy/testresult/hpk at code1.codespeak.net/test_glob.txt (original) +++ pypy/testresult/hpk at code1.codespeak.net/test_glob.txt Mon May 2 02:14:26 2005 @@ -1,16 +1,45 @@ -testreport-version: 1.0 -command: /usr/bin/python /tmp/pypy-autotest-13/pypy-dist/pypy/tool/alarm.py 11759 /tmp/pypy-autotest-13/pypy-dist/pypy/interpreter/py.py /tmp/pypy-autotest-13/pypy-dist/lib-python-2.3.4/test/test_glob.py -run by: hpk at code1.codespeak.net -sys.platform: linux2 -sys.version_info: (2, 3, 5, 'final', 0) -cpu model: AMD Opteron(tm) Processor 242 +Content-Type: multipart/mixed; boundary="===============1448722861457019459==" +MIME-Version: 1.0 cpu mhz: 1603.694 -oldstyle: no -pypy-revision: 11680 -startdate: Sun May 1 06:19:11 2005 -timeout: 11760.0 seconds +cpu model: AMD Opteron(tm) Processor 242 +execution-time: 26.3018949032 +exit status: 0 +fspath: /home/hpk/pypy-dist/lib-python/2.3.4/test/test_glob.py +options: ['core'] +outcome: OK +platform: linux2 +pypy-revision: 11740 +python-version-info: (2, 3, 5, 'final', 0) +startdate: Mon May 2 02:11:47 2005 +testreport-version: 1.1 +timeout: 961.0 +userhost: hpk at code1.codespeak.net +_reprs: {'execution-time': 'float', 'python-version-info': 'tuple', + 'options': 'list', 'timeout': 'float', 'pypy-revision': 'int', + 'exit status': 'int'} + +--===============1448722861457019459== +Content-Type: text/plain; charset="us-ascii" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Content-Disposition: attachment; filename="stdout" + +test_glob_directory_names (__main__.GlobTests) ... ok +test_glob_literal (__main__.GlobTests) ... ok +test_glob_nested_directory (__main__.GlobTests) ... ok +test_glob_one_directory (__main__.GlobTests) ... ok + +---------------------------------------------------------------------- +Ran 4 tests in 14.501s + +OK + +--===============1448722861457019459== +Content-Type: text/plain; charset="us-ascii" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Content-Disposition: attachment; filename="stderr" -============================================================ faking faking faking @@ -20,15 +49,5 @@ faking faking faking -test_glob_directory_names (__main__.GlobTests) ... ok -test_glob_literal (__main__.GlobTests) ... ok -test_glob_nested_directory (__main__.GlobTests) ... ok -test_glob_one_directory (__main__.GlobTests) ... ok - ----------------------------------------------------------------------- -Ran 4 tests in 14.264s -OK -========================== closed ========================== -execution time: 24.6971290112 seconds -exit status: 0 +--===============1448722861457019459==-- \ No newline at end of file Added: pypy/testresult/hpk at code1.codespeak.net/test_global.txt ============================================================================== --- (empty file) +++ pypy/testresult/hpk at code1.codespeak.net/test_global.txt Mon May 2 02:14:26 2005 @@ -0,0 +1,96 @@ +Content-Type: multipart/mixed; boundary="===============8527208029460999044==" +MIME-Version: 1.0 +cpu mhz: 1603.694 +cpu model: AMD Opteron(tm) Processor 242 +execution-time: 8.35421800613 +exit status: 2 +fspath: /home/hpk/pypy-dist/lib-python/2.3.4/test/test_global.py +options: ['core'] +outcome: ERROUT +platform: linux2 +pypy-revision: 11740 +python-version-info: (2, 3, 5, 'final', 0) +startdate: Mon May 2 02:12:14 2005 +testreport-version: 1.1 +timeout: 961.0 +userhost: hpk at code1.codespeak.net +_reprs: {'execution-time': 'float', 'python-version-info': 'tuple', + 'options': 'list', 'timeout': 'float', 'pypy-revision': 'int', + 'exit status': 'int'} + +--===============8527208029460999044== +Content-Type: text/plain; charset="us-ascii" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Content-Disposition: attachment; filename="stdout" + +should have raised SyntaxError: +def wrong1(): + a = 1 + b = 2 + global a + global b + +should have raised SyntaxError: +def wrong2(): + print x + global x + +should have raised SyntaxError: +def wrong3(): + print x + x = 2 + global x + +as expected, no SyntaxError + +--===============8527208029460999044== +Content-Type: text/plain; charset="us-ascii" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Content-Disposition: attachment; filename="stderr" + +faking +faking +faking +faking +faking +faking +faking +:2: SyntaxWarning: name 'a' is assigned to before global declaration +:2: SyntaxWarning: name 'b' is assigned to before global declaration +:2: SyntaxWarning: name 'x' is used prior to global declaration +:2: SyntaxWarning: name 'x' is assigned to before global declaration + +--===============8527208029460999044== +Content-Type: text/plain; charset="us-ascii" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Content-Disposition: attachment; filename="reportdiff" + +********************************************************************** +*** mismatch between lines 2-4 of expected output and lines 2-19 of actual output: +- got SyntaxError as expected +- got SyntaxError as expected +- got SyntaxError as expected ++ should have raised SyntaxError: ++ def wrong1(): ++ a = 1 ++ b = 2 ++ global a ++ global b ++ ++ should have raised SyntaxError: ++ def wrong2(): ++ print x ++ global x ++ ++ should have raised SyntaxError: ++ def wrong3(): ++ print x ++ x = 2 ++ global x ++ +********************************************************************** + +--===============8527208029460999044==-- \ No newline at end of file Added: pypy/testresult/hpk at code1.codespeak.net/test_grammar.txt ============================================================================== --- (empty file) +++ pypy/testresult/hpk at code1.codespeak.net/test_grammar.txt Mon May 2 02:14:26 2005 @@ -0,0 +1,110 @@ +Content-Type: multipart/mixed; boundary="===============0980434005190315954==" +MIME-Version: 1.0 +cpu mhz: 1603.694 +cpu model: AMD Opteron(tm) Processor 242 +execution-time: 13.283249855 +exit status: 0 +fspath: /home/hpk/pypy-dist/lib-python/2.3.4/test/test_grammar.py +options: ['core'] +outcome: OK +platform: linux2 +pypy-revision: 11740 +python-version-info: (2, 3, 5, 'final', 0) +startdate: Mon May 2 02:12:24 2005 +testreport-version: 1.1 +timeout: 900.0 +userhost: hpk at code1.codespeak.net +_reprs: {'execution-time': 'float', 'python-version-info': 'tuple', + 'options': 'list', 'timeout': 'float', 'pypy-revision': 'int', + 'exit status': 'int'} + +--===============0980434005190315954== +Content-Type: text/plain; charset="us-ascii" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Content-Disposition: attachment; filename="stdout" + +1. Parser +1.1 Tokens +1.1.1 Backslashes +1.1.2 Numeric literals +1.1.2.1 Plain integers +1.1.2.2 Long integers +1.1.2.3 Floating point +1.1.3 String literals +1.2 Grammar +single_input +file_input +expr_input +eval_input +funcdef +lambdef +simple_stmt +expr_stmt +print_stmt +1 2 3 +1 2 3 +1 1 1 +extended print_stmt +1 2 3 +1 2 3 +1 1 1 +hello world +del_stmt +pass_stmt +flow_stmt +break_stmt +continue_stmt +continue + try/except ok +continue + try/finally ok +testing continue and break in try/except in loop +return_stmt +raise_stmt +import_stmt +global_stmt +exec_stmt +assert_stmt +if_stmt +while_stmt +for_stmt +try_stmt +suite +test +comparison +binary mask ops +shift ops +additive ops +multiplicative ops +unary ops +selectors + +atoms +classdef +['Apple', 'Banana', 'Coco nut'] +[3, 6, 9, 12, 15] +[3, 4, 5] +[(1, 'Apple'), (1, 'Banana'), (1, 'Coconut'), (2, 'Apple'), (2, 'Banana'), (2, 'Coconut'), (3, 'Apple'), (3, 'Banana'), (3, 'Coconut'), (4, 'Apple'), (4, 'Banana'), (4, 'Coconut'), (5, 'Apple'), (5, 'Banana'), (5, 'Coconut')] +[(1, 'Banana'), (1, 'Coconut'), (2, 'Banana'), (2, 'Coconut'), (3, 'Banana'), (3, 'Coconut'), (4, 'Banana'), (4, 'Coconut'), (5, 'Banana'), (5, 'Coconut')] +[[1], [1, 1], [1, 2, 4], [1, 3, 9, 27], [1, 4, 16, 64, 256]] +[False, False, False] +[[1, 2], [3, 4], [5, 6]] +[('Boeing', 'Airliner'), ('Boeing', 'Engine'), ('Ford', 'Engine'), ('Macdonalds', 'Cheeseburger')] + +--===============0980434005190315954== +Content-Type: text/plain; charset="us-ascii" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Content-Disposition: attachment; filename="stderr" + +faking +faking +faking +faking +faking +:0: FutureWarning: hex/oct constants > sys.maxint will return positive values in Python 2.4 and up +:0: FutureWarning: hex/oct constants > sys.maxint will return positive values in Python 2.4 and up +:0: FutureWarning: hex/oct constants > sys.maxint will return positive values in Python 2.4 and up +faking +faking + +--===============0980434005190315954==-- \ No newline at end of file Modified: pypy/testresult/hpk at code1.codespeak.net/test_hash.txt ============================================================================== --- pypy/testresult/hpk at code1.codespeak.net/test_hash.txt (original) +++ pypy/testresult/hpk at code1.codespeak.net/test_hash.txt Mon May 2 02:14:26 2005 @@ -1,29 +1,48 @@ -testreport-version: 1.0 -command: /usr/bin/python /tmp/pypy-autotest-13/pypy-dist/pypy/tool/alarm.py 13500 /tmp/pypy-autotest-13/pypy-dist/pypy/interpreter/py.py /tmp/pypy-autotest-13/pypy-dist/lib-python-2.3.4/test/test_hash.py -run by: hpk at code1.codespeak.net -sys.platform: linux2 -sys.version_info: (2, 3, 5, 'final', 0) -cpu model: AMD Opteron(tm) Processor 242 +Content-Type: multipart/mixed; boundary="===============7907517768040769131==" +MIME-Version: 1.0 cpu mhz: 1603.694 -oldstyle: no -pypy-revision: 11680 -startdate: Sun May 1 06:19:36 2005 -timeout: 13500.0 seconds +cpu model: AMD Opteron(tm) Processor 242 +execution-time: 10.1873660088 +exit status: 0 +fspath: /home/hpk/pypy-dist/lib-python/2.3.4/test/test_hash.py +options: ['core'] +outcome: OK +platform: linux2 +pypy-revision: 11740 +python-version-info: (2, 3, 5, 'final', 0) +startdate: Mon May 2 02:12:38 2005 +testreport-version: 1.1 +timeout: 961.0 +userhost: hpk at code1.codespeak.net +_reprs: {'execution-time': 'float', 'python-version-info': 'tuple', + 'options': 'list', 'timeout': 'float', 'pypy-revision': 'int', + 'exit status': 'int'} + +--===============7907517768040769131== +Content-Type: text/plain; charset="us-ascii" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Content-Disposition: attachment; filename="stdout" -============================================================ -faking -faking -faking -faking -faking test_coerced_floats (__main__.HashEqualityTestCase) ... ok test_coerced_integers (__main__.HashEqualityTestCase) ... ok test_numeric_literals (__main__.HashEqualityTestCase) ... ok ---------------------------------------------------------------------- -Ran 3 tests in 1.692s +Ran 3 tests in 1.725s OK -========================== closed ========================== -execution time: 8.89893293381 seconds -exit status: 0 + +--===============7907517768040769131== +Content-Type: text/plain; charset="us-ascii" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Content-Disposition: attachment; filename="stderr" + +faking +faking +faking +faking +faking + +--===============7907517768040769131==-- \ No newline at end of file From hpk at codespeak.net Mon May 2 02:50:58 2005 From: hpk at codespeak.net (hpk at codespeak.net) Date: Mon, 2 May 2005 02:50:58 +0200 (CEST) Subject: [pypy-svn] r11763 - pypy/dist/lib-python Message-ID: <20050502005058.2051F27C1F@code1.codespeak.net> Author: hpk Date: Mon May 2 02:50:57 2005 New Revision: 11763 Modified: pypy/dist/lib-python/conftest.py Log: avoid overwriting non-timeout failures with timeout failures Modified: pypy/dist/lib-python/conftest.py ============================================================================== --- pypy/dist/lib-python/conftest.py (original) +++ pypy/dist/lib-python/conftest.py Mon May 2 02:50:57 2005 @@ -24,7 +24,8 @@ testdir = libpythondir.join('2.3.4', 'test') modtestdir = libpythondir.join('modified-2.3.4', 'test') -from result import Result +result = libpythondir.join('result.py').pyimport('result') +from result import Result, ResultFromMime # @@ -806,6 +807,17 @@ # XXX on timeout failures only write if prev test did not timeout fn = resultdir.join(regrtest.basename).new(ext='.txt') + if result.istimeout(): + if fn.check(file=1): + try: + oldresult = ResultFromMime(fn) + except TypeError: + pass + else: + if not oldresult.istimeout(): + py.test.skip("timed out, not overwriting " + "more interesting non-timeout outcome") + fn.write(result.repr_mimemessage().as_string(unixfrom=False)) if result['exit status']: time.sleep(0.5) # time for a Ctrl-C to reach us :-) From hpk at codespeak.net Mon May 2 03:34:15 2005 From: hpk at codespeak.net (hpk at codespeak.net) Date: Mon, 2 May 2005 03:34:15 +0200 (CEST) Subject: [pypy-svn] r11772 - pypy/dist/lib-python Message-ID: <20050502013415.5871F27C23@code1.codespeak.net> Author: hpk Date: Mon May 2 03:34:15 2005 New Revision: 11772 Modified: pypy/dist/lib-python/conftest.py Log: uselibfile for test_file Modified: pypy/dist/lib-python/conftest.py ============================================================================== --- pypy/dist/lib-python/conftest.py (original) +++ pypy/dist/lib-python/conftest.py Mon May 2 03:34:15 2005 @@ -435,7 +435,7 @@ RegrTest('test_exceptions.py', enabled=False, core=True), RegrTest('test_extcall.py', enabled=False, core=True), RegrTest('test_fcntl.py', enabled=False, dumbtest=1), - RegrTest('test_file.py', enabled=False, dumbtest=1, core=True), + RegrTest('test_file.py', enabled=False, dumbtest=1, core=True, uselibfile=True), RegrTest('test_filecmp.py', enabled=True, core=True), RegrTest('test_fileinput.py', enabled=True, dumbtest=1, core=True), RegrTest('test_fnmatch.py', enabled=True, core=True), @@ -805,7 +805,6 @@ resultdir = testresultdir.join(result['userhost']) assert resultdir.check(dir=1) - # XXX on timeout failures only write if prev test did not timeout fn = resultdir.join(regrtest.basename).new(ext='.txt') if result.istimeout(): if fn.check(file=1): From hpk at codespeak.net Mon May 2 12:39:51 2005 From: hpk at codespeak.net (hpk at codespeak.net) Date: Mon, 2 May 2005 12:39:51 +0200 (CEST) Subject: [pypy-svn] r11775 - pypy/dist/lib-python Message-ID: <20050502103951.1D10C27B5F@code1.codespeak.net> Author: hpk Date: Mon May 2 12:39:50 2005 New Revision: 11775 Modified: pypy/dist/lib-python/conftest.py Log: - for fine grained output tests switch test_support.verbose off, i don't see an easy way of doing the same for coarse-grained short of copying the whole test_support to modified and globally switching it off - added a '-N' noncore option which selects non-core tests Modified: pypy/dist/lib-python/conftest.py ============================================================================== --- pypy/dist/lib-python/conftest.py (original) +++ pypy/dist/lib-python/conftest.py Mon May 2 12:39:50 2005 @@ -43,6 +43,9 @@ Option('-A', '--all', action="store_true", default=False, dest="withall", help="include all tests (instead of just core tests)."), + Option('-N', '--noncore', action="store_true", + default=False, dest="noncore", + help="include only non-core tests"), Option('-E', '--extracttests', action="store_true", default=False, dest="extracttests", help="try to extract single tests and run them via py.test/PyPy"), @@ -314,7 +317,19 @@ if p.check(file=1): return p + def _prepare(self, space): + # output tests sometimes depend on not running in + # verbose mode + if not hasattr(self, '_prepared'): + if self.getoutputpath(): + space.appexec([], """(): + from test import test_support + test_support.verbose = False + """) + self._prepared = True + def run_file(self, space): + self._prepare(space) fspath = self.getfspath() assert fspath.check() if self.oldstyle or pypy_option.oldstyle: @@ -714,8 +729,12 @@ return cache.get(name, None) def run(self): - return [x.basename for x in self.testmap - if x.core or pypy_option.withall] + l = [] + for x in self.testmap: + print x.core + if ((not not x.core) ^ (pypy_option.noncore)) or pypy_option.withall: + l.append(x.basename) + return l def join(self, name): regrtest = self.get(name) From arigo at codespeak.net Mon May 2 15:52:14 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Mon, 2 May 2005 15:52:14 +0200 (CEST) Subject: [pypy-svn] r11781 - pypy/dist/lib-python/modified-2.3.4/test Message-ID: <20050502135214.85F6627B84@code1.codespeak.net> Author: arigo Date: Mon May 2 15:52:14 2005 New Revision: 11781 Added: pypy/dist/lib-python/modified-2.3.4/test/test_file.py - copied, changed from r11778, pypy/dist/lib-python/2.3.4/test/test_file.py Log: Fixed test_file.py. Copied: pypy/dist/lib-python/modified-2.3.4/test/test_file.py (from r11778, pypy/dist/lib-python/2.3.4/test/test_file.py) ============================================================================== --- pypy/dist/lib-python/2.3.4/test/test_file.py (original) +++ pypy/dist/lib-python/modified-2.3.4/test/test_file.py Mon May 2 15:52:14 2005 @@ -19,7 +19,7 @@ for attr in 'name', 'mode', 'closed': try: setattr(f, attr, 'oops') - except TypeError: + except (TypeError, AttributeError): pass else: raise TestFailed('expected TypeError setting file attr %r' % attr) @@ -126,26 +126,21 @@ if d != s: raise TestFailed, 'readback failure using buffer size %d' -methods = ['fileno', 'flush', 'isatty', 'next', 'read', 'readinto', - 'readline', 'readlines', 'seek', 'tell', 'truncate', 'write', - 'xreadlines', '__iter__'] +a = array('c', 'x'*10) +methods = {'fileno': (), 'flush': (), 'isatty': (), 'next': (), + 'read': (), 'readinto': (a,), 'readline': (), 'readlines': (), + 'seek': (0,), 'tell': (), 'truncate': (), 'write': ('',), + 'writelines': ([],), 'xreadlines': (), '__iter__': () } if sys.platform.startswith('atheos'): - methods.remove('truncate') + del methods['truncate'] -for methodname in methods: +for methodname, args in methods.items(): method = getattr(f, methodname) try: - method() + method(*args) except ValueError: pass else: raise TestFailed, 'file.%s() on a closed file should raise a ValueError' % methodname -try: - f.writelines([]) -except ValueError: - pass -else: - raise TestFailed, 'file.writelines([]) on a closed file should raise a ValueError' - os.unlink(TESTFN) From hpk at codespeak.net Mon May 2 16:42:36 2005 From: hpk at codespeak.net (hpk at codespeak.net) Date: Mon, 2 May 2005 16:42:36 +0200 (CEST) Subject: [pypy-svn] r11785 - pypy/dist/lib-python Message-ID: <20050502144236.C75BE27B6E@code1.codespeak.net> Author: hpk Date: Mon May 2 16:42:36 2005 New Revision: 11785 Modified: pypy/dist/lib-python/conftest.py pypy/dist/lib-python/result.py Log: get rid of print and introduce a helper method for error lines Modified: pypy/dist/lib-python/conftest.py ============================================================================== --- pypy/dist/lib-python/conftest.py (original) +++ pypy/dist/lib-python/conftest.py Mon May 2 16:42:36 2005 @@ -731,7 +731,6 @@ def run(self): l = [] for x in self.testmap: - print x.core if ((not not x.core) ^ (pypy_option.noncore)) or pypy_option.withall: l.append(x.basename) return l Modified: pypy/dist/lib-python/result.py ============================================================================== --- pypy/dist/lib-python/result.py (original) +++ pypy/dist/lib-python/result.py Mon May 2 16:42:36 2005 @@ -33,6 +33,13 @@ def getnamedtext(self, name): return self._blocks[name] + def repr_short_error(self): + if not self.isok(): + text = self.getnamedtext('stderr') + lines = text.strip().split('\n') + if lines: + return lines[-1] + def repr_mimemessage(self): from email.MIMEMultipart import MIMEMultipart from email.MIMEText import MIMEText From pedronis at codespeak.net Mon May 2 16:47:35 2005 From: pedronis at codespeak.net (pedronis at codespeak.net) Date: Mon, 2 May 2005 16:47:35 +0200 (CEST) Subject: [pypy-svn] r11787 - pypy/dist/pypy/interpreter Message-ID: <20050502144735.C593227B7B@code1.codespeak.net> Author: pedronis Date: Mon May 2 16:47:35 2005 New Revision: 11787 Modified: pypy/dist/pypy/interpreter/module.py pypy/dist/pypy/interpreter/typedef.py Log: changes to pass test_module Modified: pypy/dist/pypy/interpreter/module.py ============================================================================== --- pypy/dist/pypy/interpreter/module.py (original) +++ pypy/dist/pypy/interpreter/module.py Mon May 2 16:47:35 2005 @@ -12,9 +12,11 @@ self.space = space if w_dict is None: w_dict = space.newdict([]) + elif space.is_w(w_dict, space.w_None): + w_dict = None self.w_dict = w_dict self.w_name = w_name - if w_name is not None: + if w_name is not None and w_dict is not None: space.setitem(w_dict, space.wrap('__name__'), w_name) def getdict(self): @@ -22,7 +24,7 @@ def descr_module__new__(space, w_subtype, __args__): module = space.allocate_instance(Module, w_subtype) - Module.__init__(module, space, space.wrap('?')) + Module.__init__(module, space, space.wrap('?'), space.w_None) return space.wrap(module) def descr_module__init__(self, w_name, w_doc=None): @@ -31,5 +33,7 @@ if w_doc is None: w_doc = space.w_None w_dict = self.getdict() + if w_dict is None: + w_dict = self.w_dict = space.newdict([]) space.setitem(w_dict, space.wrap('__name__'), w_name) space.setitem(w_dict, space.wrap('__doc__'), w_doc) Modified: pypy/dist/pypy/interpreter/typedef.py ============================================================================== --- pypy/dist/pypy/interpreter/typedef.py (original) +++ pypy/dist/pypy/interpreter/typedef.py Mon May 2 16:47:35 2005 @@ -280,6 +280,12 @@ assert w_dict is not None, repr(obj) return w_dict +def descr_get_dict_may_be_None(space, obj): + w_dict = obj.getdict() + if w_dict is None: + return space.w_None + return w_dict + def descr_set_dict(space, obj, w_dict): obj.setdict(w_dict) @@ -359,7 +365,8 @@ __new__ = interp2app(Module.descr_module__new__.im_func, unwrap_spec=[ObjSpace, W_Root, Arguments]), __init__ = interp2app(Module.descr_module__init__), - __dict__ = GetSetProperty(descr_get_dict, cls=Module), # module dictionaries are readonly attributes + __dict__ = GetSetProperty(descr_get_dict_may_be_None, cls=Module), # module dictionaries are readonly attributes + __doc__ = 'module(name[, doc])\n\nCreate a module object.\nThe name must be a string; the optional doc argument can have any type.' ) getset_func_doc = GetSetProperty(Function.fget_func_doc, From hpk at codespeak.net Mon May 2 17:22:30 2005 From: hpk at codespeak.net (hpk at codespeak.net) Date: Mon, 2 May 2005 17:22:30 +0200 (CEST) Subject: [pypy-svn] r11788 - in pypy/dist: lib-python pypy pypy/interpreter pypy/tool pypy/tool/pytest pypy/tool/test Message-ID: <20050502152230.0475527B6E@code1.codespeak.net> Author: hpk Date: Mon May 2 17:22:30 2005 New Revision: 11788 Added: pypy/dist/pypy/tool/pytest/ (props changed) pypy/dist/pypy/tool/pytest/__init__.py - copied unchanged from r11784, pypy/dist/pypy/tool/__init__.py pypy/dist/pypy/tool/pytest/appsupport.py - copied unchanged from r11784, pypy/dist/pypy/tool/pytestsupport.py pypy/dist/pypy/tool/pytest/autopath.py - copied unchanged from r11784, pypy/dist/pypy/tool/autopath.py pypy/dist/pypy/tool/pytest/confpath.py pypy/dist/pypy/tool/pytest/genreportdata.py (contents, props changed) - copied, changed from r11783, pypy/testresult/genreportdata.py pypy/dist/pypy/tool/pytest/htmlreport.py (contents, props changed) - copied, changed from r11786, pypy/testresult/htmlreport.py pypy/dist/pypy/tool/pytest/result.py (props changed) - copied unchanged from r11785, pypy/dist/lib-python/result.py Removed: pypy/dist/lib-python/result.py pypy/dist/pypy/tool/pytestsupport.py Modified: pypy/dist/lib-python/conftest.py pypy/dist/pypy/conftest.py pypy/dist/pypy/interpreter/baseobjspace.py pypy/dist/pypy/tool/alarm.py (props changed) pypy/dist/pypy/tool/compile.py (props changed) pypy/dist/pypy/tool/pypyrev.py (props changed) pypy/dist/pypy/tool/test/test_pytestsupport.py pypy/dist/pypy/tool/tls.py (props changed) Log: refactor all test-help code including html generation into pypy/tool/pytest Modified: pypy/dist/lib-python/conftest.py ============================================================================== --- pypy/dist/lib-python/conftest.py (original) +++ pypy/dist/lib-python/conftest.py Mon May 2 17:22:30 2005 @@ -19,14 +19,9 @@ from test.regrtest import reportdiff from test import pystone -pypydir = py.path.local(pypy.__file__).dirpath() -libpythondir = pypydir.dirpath('lib-python') -testdir = libpythondir.join('2.3.4', 'test') -modtestdir = libpythondir.join('modified-2.3.4', 'test') - -result = libpythondir.join('result.py').pyimport('result') -from result import Result, ResultFromMime - +from pypy.tool.pytest.confpath import pypydir, libpythondir, \ + regrtestdir, modregrtestdir, testresultdir +from pypy.tool.pytest.result import Result, ResultFromMime # # Interfacing/Integrating with py.test's collection process @@ -303,17 +298,17 @@ return l def ismodified(self): - return modtestdir.join(self.basename).check() + return modregrtestdir.join(self.basename).check() def getfspath(self): - fn = modtestdir.join(self.basename) + fn = modregrtestdir.join(self.basename) if fn.check(): return fn - fn = testdir.join(self.basename) + fn = regrtestdir.join(self.basename) return fn def getoutputpath(self): - p = testdir.join('output', self.basename).new(ext='') + p = regrtestdir.join('output', self.basename).new(ext='') if p.check(file=1): return p @@ -772,7 +767,6 @@ def ensuretestresultdir(): - testresultdir = pypydir.dirpath('testresult') if not testresultdir.check(dir=1): py.test.skip("""'testresult' directory not found. To run tests in reporting mode (without -E), you first have to Deleted: /pypy/dist/lib-python/result.py ============================================================================== --- /pypy/dist/lib-python/result.py Mon May 2 17:22:30 2005 +++ (empty file) @@ -1,129 +0,0 @@ -import sys -import py - -class Result(object): - def __init__(self, init=True): - self._headers = {} - self._blocks = {} - self._blocknames = [] - if init: - stdinit(self) - - def __setitem__(self, name, value): - self._headers[name.lower()] = value - - def __getitem__(self, name): - return self._headers[name.lower()] - - def get(self, name, default): - return self._headers.get(name, default) - - def __delitem__(self, name): - del self._headers[name.lower()] - - def items(self): - return self._headers.items() - - def addnamedtext(self, name, text): - assert isinstance(text, str) - assert isinstance(name, str) - self._blocknames.append(name) - self._blocks[name] = text - - def getnamedtext(self, name): - return self._blocks[name] - - def repr_short_error(self): - if not self.isok(): - text = self.getnamedtext('stderr') - lines = text.strip().split('\n') - if lines: - return lines[-1] - - def repr_mimemessage(self): - from email.MIMEMultipart import MIMEMultipart - from email.MIMEText import MIMEText - - outer = MIMEMultipart() - items = self._headers.items() - items.sort() - reprs = {} - for name, value in items: - outer[name] = str(value) - if not isinstance(value, str): - typename = type(value).__name__ - assert typename in vars(py.std.__builtin__) - reprs[name] = typename - - outer['_reprs'] = repr(reprs) - - for name in self._blocknames: - text = self._blocks[name] - m = MIMEText(text) - m.add_header('Content-Disposition', 'attachment', filename=name) - outer.attach(m) - return outer - - def isok(self): - return self['outcome'].lower() == 'ok' - def iserr(self): - return self['outcome'].lower()[:3] == 'err' - def istimeout(self): - return self['outcome'].lower() == 't/o' - -class ResultFromMime(Result): - def __init__(self, path): - super(ResultFromMime, self).__init__(init=False) - f = open(str(path), 'r') - from email import message_from_file - msg = message_from_file(f) - # XXX security wise evil (keep in mind once we accept reporsts - # from anonymous - #print msg['_reprs'] - self._reprs = eval(msg['_reprs']) - del msg['_reprs'] - for name, value in msg.items(): - if name in self._reprs: - value = eval(value) # XXX security - self._headers[name] = value - self.fspath = py.path.local(self['fspath']) - self.path = path - - payload = msg.get_payload() - if payload: - for submsg in payload: - assert submsg.get_main_type() == 'text' - fn = submsg.get_filename() - assert fn - self.addnamedtext(fn, submsg.get_payload()) - -def stdinit(result): - import getpass - import socket - try: - username = getpass.getuser() - except: - username = 'unknown' - userhost = '%s@%s' % (username, socket.gethostname()) - result['testreport-version'] = "1.1" - result['userhost'] = userhost - result['platform'] = sys.platform - result['python-version-info'] = sys.version_info - info = try_getcpuinfo() - if info is not None: - result['cpu model'] = info['model name'] - result['cpu mhz'] = info['cpu mhz'] -# -# -# -def try_getcpuinfo(): - if sys.platform.startswith('linux'): - cpuinfopath = py.path.local('/proc/cpuinfo') - if cpuinfopath.check(file=1): - d = {} - for line in cpuinfopath.readlines(): - if line.strip(): - name, value = line.split(':', 1) - name = name.strip().lower() - d[name] = value.strip() - return d Modified: pypy/dist/pypy/conftest.py ============================================================================== --- pypy/dist/pypy/conftest.py (original) +++ pypy/dist/pypy/conftest.py Mon May 2 17:22:30 2005 @@ -1,7 +1,7 @@ import py from pypy.interpreter.gateway import app2interp_temp from pypy.interpreter.error import OperationError -from pypy.tool import pytestsupport +from pypy.tool.pytest import appsupport from inspect import isclass rootdir = py.magic.autopath().dirpath() @@ -70,13 +70,13 @@ ''') if name != 'flow': # not sensible for flow objspace case space.setitem(space.builtin.w_dict, space.wrap('AssertionError'), - pytestsupport.build_pytest_assertion(space)) + appsupport.build_pytest_assertion(space)) space.setitem(space.builtin.w_dict, space.wrap('raises'), - space.wrap(pytestsupport.app_raises)) + space.wrap(appsupport.app_raises)) space.setitem(space.builtin.w_dict, space.wrap('skip'), - space.wrap(pytestsupport.app_skip)) - space.raises_w = pytestsupport.raises_w.__get__(space) - space.eq_w = pytestsupport.eq_w.__get__(space) + space.wrap(appsupport.app_skip)) + space.raises_w = appsupport.raises_w.__get__(space) + space.eq_w = appsupport.eq_w.__get__(space) return space # @@ -133,9 +133,9 @@ except OperationError, e: if e.match(space, space.w_KeyboardInterrupt): raise KeyboardInterrupt - appexcinfo = pytestsupport.AppExceptionInfo(space, e) + appexcinfo = appsupport.AppExceptionInfo(space, e) if appexcinfo.traceback: - raise self.Failed(excinfo=pytestsupport.AppExceptionInfo(space, e)) + raise self.Failed(excinfo=appsupport.AppExceptionInfo(space, e)) raise class IntTestFunction(PyPyTestFunction): Modified: pypy/dist/pypy/interpreter/baseobjspace.py ============================================================================== --- pypy/dist/pypy/interpreter/baseobjspace.py (original) +++ pypy/dist/pypy/interpreter/baseobjspace.py Mon May 2 17:22:30 2005 @@ -337,7 +337,7 @@ """ NOT_RPYTHON """ # XXX will change once we have our own compiler from pypy.interpreter.pycode import PyCode - from pypy.tool.pytestsupport import py # aehem + from pypy.tool.getpy import py # aehem source = source.lstrip() assert source.startswith('('), "incorrect header in:\n%s" % (source,) source = py.code.Source("def anonymous%s\n" % source) Added: pypy/dist/pypy/tool/pytest/confpath.py ============================================================================== --- (empty file) +++ pypy/dist/pypy/tool/pytest/confpath.py Mon May 2 17:22:30 2005 @@ -0,0 +1,11 @@ +import autopath +import py +import pypy + +pypydir = py.path.local(pypy.__file__).dirpath() +distdir = pypydir.dirpath() +testresultdir = distdir.join('testresult') +assert pypydir.check(dir=1) +libpythondir = distdir.join('lib-python') +regrtestdir = libpythondir.join('2.3.4', 'test') +modregrtestdir = libpythondir.join('modified-2.3.4', 'test') Copied: pypy/dist/pypy/tool/pytest/genreportdata.py (from r11783, pypy/testresult/genreportdata.py) ============================================================================== --- pypy/testresult/genreportdata.py (original) +++ pypy/dist/pypy/tool/pytest/genreportdata.py Mon May 2 17:22:30 2005 @@ -1,21 +1,21 @@ +import autopath import py mydir = py.magic.autopath().dirpath().realpath() -import htmlreport +from pypy.tool.pytest import htmlreport +from pypy.tool.pytest import confpath if __name__ == '__main__': - assert mydir.basename.endswith('result'), mydir - mywc = py.path.svnwc(mydir) + testresultdir = confpath.testresultdir + assert testresultdir.check(dir=1) - print "updating", mywc - mywc.update() + resultwc = py.path.svnwc(testresultdir) + + print "updating", resultwc + resultwc.update() - ppath = htmlreport.getpicklepath() - rep = htmlreport.HtmlReport() print "traversing", mydir - rep.parse_all(mydir) + rep = htmlreport.HtmlReport() + rep.parse_all(testresultdir) - #print "dumping to", ppath - #ppath.dump(rep) - print "making html files" - rep.makeindex(mydir.join('index.html')) + rep.makeindex(testresultdir.join('index.html')) Copied: pypy/dist/pypy/tool/pytest/htmlreport.py (from r11786, pypy/testresult/htmlreport.py) ============================================================================== --- pypy/testresult/htmlreport.py (original) +++ pypy/dist/pypy/tool/pytest/htmlreport.py Mon May 2 17:22:30 2005 @@ -6,17 +6,11 @@ """ import sys, os, re import py +from pypy.tool.pytest import result # # various interesting path objects # -testresultdir = py.magic.autopath().dirpath().realpath() -assert testresultdir.basename.endswith('result') -pypydistdir = testresultdir.dirpath() -pypydir = pypydistdir.join('pypy') -assert pypydir.check(dir=1) -libpythondir = pypydistdir.join('lib-python') -resultmodule = libpythondir.join('result.py').pyimport() html = py.xml.html @@ -35,7 +29,7 @@ def parse_one(self, resultpath): try: - res = resultmodule.ResultFromMime(resultpath) + res = result.ResultFromMime(resultpath) ver = res['testreport-version'] if ver != "1.1": raise TypeError @@ -226,7 +220,8 @@ class TestOfHtmlReportClass: def setup_class(cls): - cls.testresultdir = py.path.local() + py.test.skip('needs move to own test file') + cls.testresultdir = confpath.testresultdir cls.rep = rep = HtmlReport() rep.parse_all(cls.testresultdir) Deleted: /pypy/dist/pypy/tool/pytestsupport.py ============================================================================== --- /pypy/dist/pypy/tool/pytestsupport.py Mon May 2 17:22:30 2005 +++ (empty file) @@ -1,199 +0,0 @@ -from __future__ import generators -import autopath -import py -from py.__.magic import exprinfo -from pypy.interpreter import gateway -from pypy.interpreter.error import OperationError - -# ____________________________________________________________ - -class AppFrame(py.code.Frame): - - def __init__(self, pyframe): - self.code = py.code.Code(pyframe.code) - self.lineno = pyframe.get_last_lineno() - 1 - self.space = pyframe.space - self.w_globals = pyframe.w_globals - self.w_locals = pyframe.getdictscope() - self.f_locals = self.w_locals # for py.test's recursion detection - - def eval(self, code, **vars): - space = self.space - for key, w_value in vars.items(): - space.setitem(self.w_locals, space.wrap(key), w_value) - return space.eval(code, self.w_globals, self.w_locals) - - def exec_(self, code, **vars): - space = self.space - for key, w_value in vars.items(): - space.setitem(self.w_locals, space.wrap(key), w_value) - space.exec_(code, self.w_globals, self.w_locals) - - def repr(self, w_value): - return self.space.unwrap(self.space.repr(w_value)) - - def is_true(self, w_value): - return self.space.is_true(w_value) - -class AppExceptionInfo(py.code.ExceptionInfo): - """An ExceptionInfo object representing an app-level exception.""" - - def __init__(self, space, operr): - self.space = space - self.operr = operr - self.traceback = AppTraceback(self.operr.application_traceback) - - def exconly(self, tryshort=True): - return '(application-level) ' + self.operr.errorstr(self.space) - - def errisinstance(self, exc): - clsname = exc.__name__ - try: - w_exc = getattr(self.space, 'w_' + clsname) - except KeyboardInterrupt: - raise - except: - pass - else: - return self.operr.match(self.space, w_exc) - return False - - def __str__(self): - return '(application-level) ' + self.operr.errorstr(self.space) - -class AppTracebackEntry(py.code.Traceback.Entry): - exprinfo = None - - def __init__(self, tb): - self.frame = AppFrame(tb.frame) - self.lineno = tb.lineno - 1 - - def reinterpret(self): - # XXX we need to solve a general problem: how to prevent - # reinterpretation from generating a different exception? - # This problem includes the fact that exprinfo will generate - # its own long message that looks like - # OperationError: << [: W_StringObj... - # which is much less nice than the one produced by str(self). - # XXX this reinterpret() is only here to prevent reinterpretation. - return self.exprinfo - -class AppTraceback(py.code.Traceback): - Entry = AppTracebackEntry - - def __init__(self, apptb): - l = [] - while apptb is not None: - l.append(self.Entry(apptb)) - apptb = apptb.next - list.__init__(self, l) - -# ____________________________________________________________ - -def build_pytest_assertion(space): - def my_init(space, w_self, __args__): - "Our new AssertionError.__init__()." - w_parent_init = space.getattr(w_BuiltinAssertionError, - space.wrap('__init__')) - space.call_args(w_parent_init, __args__.prepend(w_self)) - framestack = space.getexecutioncontext().framestack - frame = framestack.top(0) -## # Argh! we may see app-level helpers in the frame stack! -## # that's very probably very bad... -## if frame.code.co_name == 'normalize_exception': -## frame = framestack.top(1) - - # if the assertion provided a message, don't do magic - args_w, kwargs_w = __args__.unpack() - if args_w: - w_msg = args_w[0] - else: - runner = AppFrame(frame) - try: - source = runner.statement - source = str(source).strip() - except py.error.ENOENT: - source = None - from pypy import conftest - if source and not conftest.option.nomagic: - msg = exprinfo.interpret(source, runner, should_fail=True) - space.setattr(w_self, space.wrap('args'), - space.newtuple([space.wrap(msg)])) - w_msg = space.wrap(msg) - else: - w_msg = space.w_None - space.setattr(w_self, space.wrap('msg'), w_msg) - - # build a new AssertionError class to replace the original one. - w_BuiltinAssertionError = space.getitem(space.builtin.w_dict, - space.wrap('AssertionError')) - w_metaclass = space.type(w_BuiltinAssertionError) - w_init = space.wrap(gateway.interp2app_temp(my_init, - unwrap_spec=[gateway.ObjSpace, - gateway.W_Root, - gateway.Arguments])) - w_dict = space.newdict([]) - space.setitem(w_dict, space.wrap('__init__'), w_init) - return space.call_function(w_metaclass, - space.wrap('AssertionError'), - space.newtuple([w_BuiltinAssertionError]), - w_dict) - -def pypyraises(space, w_ExpectedException, w_expr, __args__): - """A built-in function providing the equivalent of py.test.raises().""" - args_w, kwds_w = __args__.unpack() - if space.is_true(space.isinstance(w_expr, space.w_str)): - if args_w: - raise OperationError(space.w_TypeError, - space.wrap("raises() takes no argument " - "after a string expression")) - expr = space.unwrap(w_expr) - source = py.code.Source(expr) - frame = space.getexecutioncontext().framestack.top() - w_locals = frame.getdictscope() - w_locals = space.call_method(w_locals, 'copy') - for key, w_value in kwds_w.items(): - space.setitem(w_locals, space.wrap(key), w_value) - try: - space.exec_(str(source), frame.w_globals, w_locals) - except OperationError, e: - if e.match(space, w_ExpectedException): - return space.sys.call('exc_info') - raise - else: - try: - space.call_args(w_expr, __args__) - except OperationError, e: - if e.match(space, w_ExpectedException): - return space.sys.call('exc_info') - raise - raise OperationError(space.w_AssertionError, - space.wrap("DID NOT RAISE")) - -app_raises = gateway.interp2app_temp(pypyraises, - unwrap_spec=[gateway.ObjSpace, - gateway.W_Root, - gateway.W_Root, - gateway.Arguments]) - -def pypyskip(space, w_message): - """skip a test at app-level. """ - msg = space.unwrap(w_message) - py.test.skip(msg) - -app_skip = gateway.interp2app_temp(pypyskip) - -def raises_w(space, w_ExpectedException, *args, **kwds): - try: - excinfo = py.test.raises(OperationError, *args, **kwds) - type, value, tb = excinfo._excinfo - if not value.match(space, w_ExpectedException): - raise type, value, tb - return excinfo - except py.test.Item.ExceptionFailure, e: - e.tbindex = getattr(e, 'tbindex', -1) - 1 - raise - -def eq_w(space, w_obj1, w_obj2): - """ return interp-level boolean of eq(w_obj1, w_obj2). """ - return space.is_true(space.eq(w_obj1, w_obj2)) Modified: pypy/dist/pypy/tool/test/test_pytestsupport.py ============================================================================== --- pypy/dist/pypy/tool/test/test_pytestsupport.py (original) +++ pypy/dist/pypy/tool/test/test_pytestsupport.py Mon May 2 17:22:30 2005 @@ -5,7 +5,7 @@ from pypy.interpreter.argument import Arguments from pypy.interpreter.pycode import PyCode from pypy.interpreter.pyframe import PyFrame -from pypy.tool.pytestsupport import AppFrame, build_pytest_assertion, AppExceptionInfo +from pypy.tool.pytest.appsupport import AppFrame, build_pytest_assertion, AppExceptionInfo def somefunc(x): From hpk at codespeak.net Mon May 2 17:34:21 2005 From: hpk at codespeak.net (hpk at codespeak.net) Date: Mon, 2 May 2005 17:34:21 +0200 (CEST) Subject: [pypy-svn] r11790 - pypy/dist/lib-python Message-ID: <20050502153421.A3E8227B6E@code1.codespeak.net> Author: hpk Date: Mon May 2 17:34:21 2005 New Revision: 11790 Modified: pypy/dist/lib-python/conftest.py Log: fixed conftest Modified: pypy/dist/lib-python/conftest.py ============================================================================== --- pypy/dist/lib-python/conftest.py (original) +++ pypy/dist/lib-python/conftest.py Mon May 2 17:34:21 2005 @@ -9,7 +9,6 @@ import pypy from pypy.interpreter.gateway import ApplevelClass from pypy.interpreter.error import OperationError -from pypy.tool import pytestsupport from pypy.interpreter.module import Module as PyPyModule from pypy.interpreter.main import run_string, run_file from py.__.misc.simplecapture import callcapture @@ -19,6 +18,7 @@ from test.regrtest import reportdiff from test import pystone +from pypy.tool.pytest import appsupport from pypy.tool.pytest.confpath import pypydir, libpythondir, \ regrtestdir, modregrtestdir, testresultdir from pypy.tool.pytest.result import Result, ResultFromMime @@ -67,7 +67,7 @@ ilevelinfo = py.code.ExceptionInfo() if e.match(space, space.w_KeyboardInterrupt): raise KeyboardInterrupt - appexcinfo=pytestsupport.AppExceptionInfo(space, e) + appexcinfo = appsupport.AppExceptionInfo(space, e) if appexcinfo.traceback: print "appexcinfo.traceback:" py.std.pprint.pprint(appexcinfo.traceback) From hpk at codespeak.net Mon May 2 18:10:57 2005 From: hpk at codespeak.net (hpk at codespeak.net) Date: Mon, 2 May 2005 18:10:57 +0200 (CEST) Subject: [pypy-svn] r11795 - in pypy/dist: lib-python pypy/tool/pytest Message-ID: <20050502161057.C4F0B27B8A@code1.codespeak.net> Author: hpk Date: Mon May 2 18:10:57 2005 New Revision: 11795 Added: pypy/dist/pypy/tool/pytest/regrverbose.py Modified: pypy/dist/lib-python/conftest.py Log: run non-verbose for output tests Modified: pypy/dist/lib-python/conftest.py ============================================================================== --- pypy/dist/lib-python/conftest.py (original) +++ pypy/dist/lib-python/conftest.py Mon May 2 18:10:57 2005 @@ -792,6 +792,7 @@ python = sys.executable pypy_script = pypydir.join('interpreter', 'py.py') alarm_script = pypydir.join('tool', 'alarm.py') + regr_script = pypydir.join('tool', 'pytest', 'regrverbose.py') pypy_options = [] if regrtest.oldstyle or pypy_option.oldstyle: pypy_options.append('--oldstyle') @@ -799,8 +800,13 @@ pypy_options.append('--file') sopt = " ".join(pypy_options) + if regrtest.getoutputpath(): + wrap = str(regr_script) + else: + wrap = "" TIMEOUT = gettimeout() - cmd = "%s %s %d %s %s %s" %(python, alarm_script, TIMEOUT, pypy_script, sopt, fspath) + cmd = "%s %s %d %s %s %s %s" %(python, alarm_script, TIMEOUT, + pypy_script, wrap, sopt, fspath) return cmd def run(self): Added: pypy/dist/pypy/tool/pytest/regrverbose.py ============================================================================== --- (empty file) +++ pypy/dist/pypy/tool/pytest/regrverbose.py Mon May 2 18:10:57 2005 @@ -0,0 +1,4 @@ +import sys +from test import test_support +test_support.verbose = False +execfile(sys.argv[1]) From pedronis at codespeak.net Mon May 2 19:32:41 2005 From: pedronis at codespeak.net (pedronis at codespeak.net) Date: Mon, 2 May 2005 19:32:41 +0200 (CEST) Subject: [pypy-svn] r11800 - pypy/dist/pypy/objspace Message-ID: <20050502173241.5765F27B85@code1.codespeak.net> Author: pedronis Date: Mon May 2 19:32:41 2005 New Revision: 11800 Modified: pypy/dist/pypy/objspace/descroperation.py Log: changes to pass test_richcmp Modified: pypy/dist/pypy/objspace/descroperation.py ============================================================================== --- pypy/dist/pypy/objspace/descroperation.py (original) +++ pypy/dist/pypy/objspace/descroperation.py Mon May 2 19:32:41 2005 @@ -307,7 +307,8 @@ try: # Try to do some magic to compare cyclic constructs. if (_compare_nesting > space._NESTING_LIMIT and - (space.lookup(w_v, '__getitem__') is not None) and + # dont't be subtle the corresponding condition in CPython is always true for heaptypes + # (space.lookup(w_v, '__getitem__') is not None) and not (space.is_w(w_vt, space.w_str) or space.is_w(w_vt, space.w_tuple))): try: @@ -490,7 +491,8 @@ try: # Try to do some magic to compare cyclic constructs. if (_compare_nesting > space._NESTING_LIMIT and - (space.lookup(w_obj1, '__getitem__') is not None) and + # dont't be subtle the corresponding condition in CPython is always true for heaptypes + # (space.lookup(w_obj1, '__getitem__') is not None) and not (space.is_w(w_typ1, space.w_str) or space.is_w(w_typ1, space.w_tuple))): i1 = space.int_w(space.id(w_obj1)) From arigo at codespeak.net Mon May 2 19:32:51 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Mon, 2 May 2005 19:32:51 +0200 (CEST) Subject: [pypy-svn] r11801 - pypy/dist/lib-python/modified-2.3.4/test Message-ID: <20050502173251.63D9B27B8D@code1.codespeak.net> Author: arigo Date: Mon May 2 19:32:51 2005 New Revision: 11801 Added: pypy/dist/lib-python/modified-2.3.4/test/test_operations.py - copied, changed from r11792, pypy/dist/lib-python/2.3.4/test/test_operations.py Log: Dict operations swallow some exceptions in CPython. There is a test checking that. Argh. Fixed the test to mean "either swallow or not, but doesn't crash". Copied: pypy/dist/lib-python/modified-2.3.4/test/test_operations.py (from r11792, pypy/dist/lib-python/2.3.4/test/test_operations.py) ============================================================================== --- pypy/dist/lib-python/2.3.4/test/test_operations.py (original) +++ pypy/dist/lib-python/modified-2.3.4/test/test_operations.py Mon May 2 19:32:51 2005 @@ -32,8 +32,14 @@ d = {} x1 = BadDictKey() x2 = BadDictKey() -d[x1] = 1 -d[x2] = 2 +try: + d[x1] = 1 +except RuntimeError: + pass # N.B. CPython swallows the exception entierely +try: + d[x2] = 2 +except RuntimeError: + pass print "No exception passed through." # Dict resizing bug, found by Jack Jansen in 2.2 CVS development. From pedronis at codespeak.net Mon May 2 19:55:01 2005 From: pedronis at codespeak.net (pedronis at codespeak.net) Date: Mon, 2 May 2005 19:55:01 +0200 (CEST) Subject: [pypy-svn] r11807 - pypy/dist/lib-python Message-ID: <20050502175501.51E5E27B85@code1.codespeak.net> Author: pedronis Date: Mon May 2 19:55:01 2005 New Revision: 11807 Modified: pypy/dist/lib-python/conftest.py Log: test_new needs to be run with oldstyle classes Modified: pypy/dist/lib-python/conftest.py ============================================================================== --- pypy/dist/lib-python/conftest.py (original) +++ pypy/dist/lib-python/conftest.py Mon May 2 19:55:01 2005 @@ -529,7 +529,7 @@ RegrTest('test_multifile.py', enabled=True, core=True), RegrTest('test_mutants.py', enabled=False, dumbtest=1, core="possibly"), RegrTest('test_netrc.py', enabled=True, core=True), - RegrTest('test_new.py', enabled=False, core=True), + RegrTest('test_new.py', enabled=False, core=True, oldstyle=True), RegrTest('test_nis.py', enabled=False), RegrTest('test_normalization.py', enabled=False), RegrTest('test_ntpath.py', enabled=True, dumbtest=1), From hpk at codespeak.net Mon May 2 21:12:25 2005 From: hpk at codespeak.net (hpk at codespeak.net) Date: Mon, 2 May 2005 21:12:25 +0200 (CEST) Subject: [pypy-svn] r11814 - pypy/dist/pypy/documentation Message-ID: <20050502191225.D4F7227B84@code1.codespeak.net> Author: hpk Date: Mon May 2 21:12:25 2005 New Revision: 11814 Modified: pypy/dist/pypy/documentation/getting_started.txt pypy/dist/pypy/documentation/misc.txt Log: advertise pypy-dist instead of dist-pypy because it's more completion-friendly with respect to having branches etc.pp. Modified: pypy/dist/pypy/documentation/getting_started.txt ============================================================================== --- pypy/dist/pypy/documentation/getting_started.txt (original) +++ pypy/dist/pypy/documentation/getting_started.txt Mon May 2 21:12:25 2005 @@ -15,11 +15,11 @@ There is no public release yet, but you can easily do:: - svn co http://codespeak.net/svn/pypy/dist dist-pypy + svn co http://codespeak.net/svn/pypy/dist pypy-dist and after checkout you can get a PyPy interpreter via:: - python dist-pypy/pypy/interpreter/py.py + python pypy-dist/pypy/interpreter/py.py have fun :-) @@ -46,7 +46,7 @@ For running all PyPy tests you can issue:: - cd dist-pypy/pypy/ + cd pypy-dist/pypy/ python test_all.py test_all.py really is another name for `py.test`_ which is a testing @@ -91,15 +91,15 @@ 2. Change to the directory where you wish to install the source tree, and use subversion to download the source:: - svn co http://codespeak.net/svn/pypy/dist dist-pypy + svn co http://codespeak.net/svn/pypy/dist pypy-dist - This will create a directory named ``dist-pypy``, and will get - you the PyPy source in ``dist-pypy/pypy`` and documentation - files in ``dist-pypy/pypy/documentation``. + This will create a directory named ``pypy-dist``, and will get + you the PyPy source in ``pypy-dist/pypy`` and documentation + files in ``pypy-dist/pypy/documentation``. 3. To start interpreting Python with PyPy, use Python 2.3 or greater:: - cd dist-pypy/pypy/interpreter + cd pypy-dist/pypy/interpreter python py.py After a few seconds, you should be at the PyPy prompt, which is @@ -121,7 +121,7 @@ 5. To list the PyPy interpreter command line options, type:: - cd dist-pypy/pypy/interpreter + cd pypy-dist/pypy/interpreter python py.py --help As an example of using PyPy from the command line, you could type:: @@ -141,13 +141,13 @@ a couple of different categories of tests which you can run. To run all the unit tests:: - cd dist-pypy/pypy + cd pypy-dist/pypy python test_all.py Alternatively, you may run subtests by going to the correct subdirectory and running them individually:: - cd dist-pypy/pypy + cd pypy-dist/pypy python test_all.py module/test/test_builtin.py ``test_all.py`` is actually just a synonym for `py.test`_ which is @@ -159,7 +159,7 @@ Finally, there are standard regression tests which you can run like this:: - cd dist-pypy/lib-python-2.3.4/test + cd pypy-dist/lib-python-2.3.4/test python ../../pypy/test_all.py or if you have `installed py.test`_ then you simply say:: @@ -182,7 +182,7 @@ 3. Type:: - cd dist-pypy/pypy/translator + cd pypy-dist/pypy/translator python -i translator.py Test snippets of translatable code are provided in the file @@ -219,29 +219,29 @@ PyPy is made from parts that are relatively independent from each other. You should start looking at the part that attracts you most: -* `dist-pypy/pypy/interpreter`_ contains the basic interpreter: bytecode dispatcher +* `pypy-dist/pypy/interpreter`_ contains the basic interpreter: bytecode dispatcher in pyopcode.py_, frame and code objects in eval.py_ and pyframe.py_, function objects and argument passing in function.py_ and argument.py_, the object space interface definition in baseobjspace.py_, modules in module.py_ and lazymodule.py_. Core types supporting the interpreter are defined in typedef.py_. -* `dist-pypy/pypy/objspace/std`_ contains the `Standard object space`_. The main file +* `pypy-dist/pypy/objspace/std`_ contains the `Standard object space`_. The main file is objspace.py_. For each type, the files ``xxxtype.py`` and ``xxxobject.py`` contain respectively the definition of the type and its (default) implementation. -* `dist-pypy/pypy/objspace`_ contains a few other object spaces: the thunk_ +* `pypy-dist/pypy/objspace`_ contains a few other object spaces: the thunk_ one, the trace_ one, the flow_ one. The latter is a relatively short piece of code that builds the control flow graphs when the interpreter runs in it. -* `dist-pypy/pypy/translator`_ contains the code analysis and generation stuff. +* `pypy-dist/pypy/translator`_ contains the code analysis and generation stuff. Start reading from translator.py_, from which it should be easy to follow the pieces of code involved in the various translation phases. -* `dist-pypy/pypy/annotation`_ contains the data model for the type annotation that +* `pypy-dist/pypy/annotation`_ contains the data model for the type annotation that can be inferred about a graph. The graph "walker" that uses this is in - `dist-pypy/pypy/translator/annrpython.py`_. + `pypy-dist/pypy/translator/annrpython.py`_. To learn more @@ -299,7 +299,7 @@ .. _Dot Graphviz: http://www.research.att.com/sw/tools/graphviz/ .. _Pygame: http://www.pygame.org/ -.. _dist-pypy/pypy/interpreter: http://codespeak.net/svn/pypy/dist/pypy/interpreter/ +.. _pypy-dist/pypy/interpreter: http://codespeak.net/svn/pypy/dist/pypy/interpreter/ .. _pyopcode.py: http://codespeak.net/svn/pypy/dist/pypy/interpreter/pyopcode.py .. _eval.py: http://codespeak.net/svn/pypy/dist/pypy/interpreter/eval.py .. _pyframe.py: http://codespeak.net/svn/pypy/dist/pypy/interpreter/pyframe.py @@ -309,17 +309,17 @@ .. _module.py: http://codespeak.net/svn/pypy/dist/pypy/interpreter/module.py .. _lazymodule.py: http://codespeak.net/svn/pypy/dist/pypy/interpreter/lazymodule.py .. _typedef.py: http://codespeak.net/svn/pypy/dist/pypy/interpreter/typedef.py -.. _dist-pypy/pypy/objspace/std: http://codespeak.net/svn/pypy/dist/pypy/objspace/std/ +.. _pypy-dist/pypy/objspace/std: http://codespeak.net/svn/pypy/dist/pypy/objspace/std/ .. _Standard object space: http://codespeak.net/pypy/index.cgi?doc/stdobjspace.html .. _objspace.py: http://codespeak.net/svn/pypy/dist/pypy/objspace/std/objspace.py -.. _dist-pypy/pypy/objspace: http://codespeak.net/svn/pypy/dist/pypy/objspace/ +.. _pypy-dist/pypy/objspace: http://codespeak.net/svn/pypy/dist/pypy/objspace/ .. _thunk: http://codespeak.net/svn/pypy/dist/pypy/objspace/thunk.py .. _trace: http://codespeak.net/svn/pypy/dist/pypy/objspace/trace.py .. _flow: http://codespeak.net/svn/pypy/dist/pypy/objspace/flow/ -.. _dist-pypy/pypy/translator: http://codespeak.net/svn/pypy/dist/pypy/translator/ +.. _pypy-dist/pypy/translator: http://codespeak.net/svn/pypy/dist/pypy/translator/ .. _translator.py: http://codespeak.net/svn/pypy/dist/pypy/translator/translator.py -.. _dist-pypy/pypy/annotation: http://codespeak.net/svn/pypy/dist/pypy/annotation/ -.. _dist-pypy/pypy/translator/annrpython.py: http://codespeak.net/svn/pypy/dist/pypy/translator/annrpython.py +.. _pypy-dist/pypy/annotation: http://codespeak.net/svn/pypy/dist/pypy/annotation/ +.. _pypy-dist/pypy/translator/annrpython.py: http://codespeak.net/svn/pypy/dist/pypy/translator/annrpython.py .. _mailing lists: http://codespeak.net/pypy/index.cgi?lists .. _documentation: http://codespeak.net/pypy/index.cgi?doc .. _wiki: http://codespeak.net/moin/pypy/moin.cgi/FrontPage?action=show Modified: pypy/dist/pypy/documentation/misc.txt ============================================================================== --- pypy/dist/pypy/documentation/misc.txt (original) +++ pypy/dist/pypy/documentation/misc.txt Mon May 2 21:12:25 2005 @@ -95,7 +95,7 @@ The idea is that developers can use a simple url:: - svn co https://codespeak.net/svn/pypy/dist dist-pypy + svn co https://codespeak.net/svn/pypy/dist pypy-dist in order to get everything neccessary for sourcecode, documentation and test development. Obviously, if you care about the EU-funding From arigo at codespeak.net Mon May 2 21:19:57 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Mon, 2 May 2005 21:19:57 +0200 (CEST) Subject: [pypy-svn] r11815 - pypy/dist/pypy/lib Message-ID: <20050502191957.8B3EE27B84@code1.codespeak.net> Author: arigo Date: Mon May 2 21:19:57 2005 New Revision: 11815 Modified: pypy/dist/pypy/lib/random.py Log: Python 2.3 provides the name random.WichmannHill as an alias for the 2.2 version of random.Random. (But we only have the 2.2 version of random.Random for now, which is a different kind of problem.) Modified: pypy/dist/pypy/lib/random.py ============================================================================== --- pypy/dist/pypy/lib/random.py (original) +++ pypy/dist/pypy/lib/random.py Mon May 2 21:19:57 2005 @@ -81,7 +81,7 @@ "randrange","shuffle","normalvariate","lognormvariate", "cunifvariate","expovariate","vonmisesvariate","gammavariate", "stdgamma","gauss","betavariate","paretovariate","weibullvariate", - "getstate","setstate","jumpahead","whseed"] + "getstate","setstate","jumpahead","whseed","WichmannHill"] def _verify(name, computed, expected): if abs(computed - expected) > 1e-7: @@ -775,5 +775,7 @@ jumpahead = _inst.jumpahead whseed = _inst.whseed +WichmannHill = Random # for compatibility with >= 2.3 + if __name__ == '__main__': _test() From arigo at codespeak.net Mon May 2 21:28:29 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Mon, 2 May 2005 21:28:29 +0200 (CEST) Subject: [pypy-svn] r11816 - in pypy/dist: lib-python/modified-2.3.4/test pypy/objspace/std Message-ID: <20050502192829.AC37927B84@code1.codespeak.net> Author: arigo Date: Mon May 2 21:28:29 2005 New Revision: 11816 Added: pypy/dist/lib-python/modified-2.3.4/test/test_format.py - copied, changed from r11778, pypy/dist/lib-python/2.3.4/test/test_format.py Modified: pypy/dist/pypy/objspace/std/stringobject.py Log: test_format expects MemoryError but we get a (justifiable) OverflowError instead. Fixed this and added a missing ovfcheck() in stringobject.py. Copied: pypy/dist/lib-python/modified-2.3.4/test/test_format.py (from r11778, pypy/dist/lib-python/2.3.4/test/test_format.py) ============================================================================== --- pypy/dist/lib-python/2.3.4/test/test_format.py (original) +++ pypy/dist/lib-python/modified-2.3.4/test/test_format.py Mon May 2 21:28:29 2005 @@ -234,8 +234,9 @@ # crashes 2.2.1 and earlier: try: "%*d"%(sys.maxint, -127) - except MemoryError: - pass + except (MemoryError, OverflowError): + pass # CPython raises MemoryError, but both CPython and PyPy raise + # OverflowError for string concatenation else: raise TestFailed, '"%*d"%(sys.maxint, -127) should fail' # (different things go wrong on a 64 bit box...) Modified: pypy/dist/pypy/objspace/std/stringobject.py ============================================================================== --- pypy/dist/pypy/objspace/std/stringobject.py (original) +++ pypy/dist/pypy/objspace/std/stringobject.py Mon May 2 21:28:29 2005 @@ -76,7 +76,7 @@ from pypy.objspace.std.objspace import * from pypy.interpreter import gateway -from pypy.tool.rarithmetic import intmask +from pypy.tool.rarithmetic import intmask, ovfcheck from pypy.objspace.std.intobject import W_IntObject from pypy.objspace.std.sliceobject import W_SliceObject from pypy.objspace.std import slicetype @@ -927,7 +927,7 @@ return space.wrap("") input_len = len(input) try: - buffer = [' '] * (mul*input_len) + buffer = [' '] * ovfcheck(mul*input_len) except (MemoryError,OverflowError): raise OperationError( space.w_OverflowError, space.wrap("repeated string is too long: %d %d" % (input_len,mul) )) From ale at codespeak.net Mon May 2 21:32:31 2005 From: ale at codespeak.net (ale at codespeak.net) Date: Mon, 2 May 2005 21:32:31 +0200 (CEST) Subject: [pypy-svn] r11817 - in pypy/dist/pypy/lib: . test2 Message-ID: <20050502193231.42F4527B84@code1.codespeak.net> Author: ale Date: Mon May 2 21:32:31 2005 New Revision: 11817 Added: pypy/dist/pypy/lib/test2/test_codeccallbacks.py Modified: pypy/dist/pypy/lib/_codecs.py pypy/dist/pypy/lib/unicodecodec.py Log: Just an intermediate checkin (in the old library layout) There is still a lot of test failing. I have had to change test_codeccallbacks.py to use codecs.encode/decode instead of u''.encode/decode I havent looked at translate yet. Next thing will be utf-16 codecs. what (mostly) works is : utf-7 codec ascii codec latin-1 codec utf-8 codec charmap codec error handlers: ('strict', 'replace', 'ignore', 'backslashreplace', 'xmlcharreplace') Modified: pypy/dist/pypy/lib/_codecs.py ============================================================================== --- pypy/dist/pypy/lib/_codecs.py (original) +++ pypy/dist/pypy/lib/_codecs.py Mon May 2 21:32:31 2005 @@ -39,7 +39,6 @@ #/* --- Registry ----------------------------------------------------------- */ codec_search_path = [] codec_search_cache = {} -codec_error_registry = {} def codec_register( search_function ): """register(search_function) @@ -64,37 +63,13 @@ if not result: for search in codec_search_path: result=search(encoding) - if result : break + if result : + codec_search_cache[encoding] = result + break return result lookup = codec_lookup -def lookup_error(errors): - """lookup_error(errors) -> handler - - Return the error handler for the specified error handling name - or raise a LookupError, if no handler exists under this name. - """ - try: - err_handler = codec_error_registry[errors] - except KeyError: - raise LookupError("unknown error handler name %s"%errors) - return err_handler - -def register_error(errors, handler): - """register_error(errors, handler) - - Register the specified error handler under the name - errors. handler must be a callable object, that - will be called with an exception instance containing - information about the location of the encoding/decoding - error and must return a (replacement, new position) tuple. - """ - if callable(handler): - codec_error_registry[errors] = handler - else: - raise TypeError("handler must be callable") - def encode(v, encoding='defaultencoding',errors='strict'): """encode(obj, [encoding[,errors]]) -> object @@ -126,10 +101,11 @@ res = decoder(obj,errors) return res[0] -def latin_1_encode(inst,obj,errors='strict'): +def latin_1_encode( obj,errors='strict'): """None """ res = PyUnicode_EncodeLatin1(obj,len(obj),errors) + #print res return res, len(res) # XXX MBCS codec might involve ctypes ? def mbcs_decode(): @@ -137,56 +113,56 @@ """ pass -def readbuffer_encode(inst,obj,errors='strict'): +def readbuffer_encode( obj,errors='strict'): """None """ res = str(obj) return res,len(res) -def escape_encode(inst,obj,errors='strict'): +def escape_encode( obj,errors='strict'): """None """ s = repr(obj) v = s[1:-1] return v,len(v) # XXX -def utf_8_decode(inst,data,errors='strict'): +def utf_8_decode( data,errors='strict'): """None """ pass # XXX -def raw_unicode_escape_decode(inst,data,errors='strict'): +def raw_unicode_escape_decode( data,errors='strict'): """None """ pass -def utf_7_decode(inst,data,errors='strict'): +def utf_7_decode( data,errors='strict'): """None """ unistr = PyUnicode_DecodeUTF7(data,errors='strict') return unistr,len(unistr) # XXX -def unicode_escape_encode(inst,obj,errors='strict'): +def unicode_escape_encode( obj,errors='strict'): """None """ pass # XXX -def latin_1_decode(inst,data,errors='strict'): +def latin_1_decode( data,errors='strict'): """None """ pass # XXX -def utf_16_decode(inst,data,errors='strict'): +def utf_16_decode( data,errors='strict'): """None """ pass # XXX -def unicode_escape_decode(inst,data,errors='strict'): +def unicode_escape_decode( data,errors='strict'): """None """ pass -def ascii_decode(inst,data,errors='strict'): +def ascii_decode( data,errors='strict'): """None """ res = PyUnicode_DecodeASCII(data,len(data),errors) @@ -198,7 +174,7 @@ res = PyUnicode_EncodeCharmap(obj,len(obj),mapping,errors) return res,len(res) -def unicode_internal_encode(inst,obj,errors='strict'): +def unicode_internal_encode( obj,errors='strict'): """None """ if type(obj) == unicode: @@ -206,7 +182,7 @@ else: return PyUnicode_FromUnicode(obj,size),size # XXX -def utf_16_ex_decode(inst,data,errors='strict'): +def utf_16_ex_decode( data,errors='strict'): """None """ pass @@ -216,18 +192,18 @@ """ return data,len(data) -def charbuffer_encode(inst,obj,errors='strict'): +def charbuffer_encode( obj,errors='strict'): """None """ res = str(obj) return res,len(res) # XXX -def charmap_decode(inst,data,errors='strict'): +def charmap_decode( data,errors='strict'): """None """ pass -def utf_7_encode(inst,obj,errors='strict'): +def utf_7_encode( obj,errors='strict'): """None """ obj = PyUnicode_FromObject(obj) @@ -238,7 +214,7 @@ errors), PyUnicode_GET_SIZE(obj)) -def mbcs_encode(inst,obj,errors='strict'): +def mbcs_encode( obj,errors='strict'): """None """ return (PyUnicode_EncodeMBCS( @@ -248,43 +224,46 @@ PyUnicode_GET_SIZE(obj)); -def ascii_encode(inst,obj,errors='strict'): +def ascii_encode( obj,errors='strict'): """None """ - return (PyUnicode_EncodeASCII( - PyUnicode_AS_UNICODE(obj), - PyUnicode_GET_SIZE(obj), - errors), - PyUnicode_GET_SIZE(obj)) + res = PyUnicode_EncodeASCII(obj,len(obj),errors) + return res,len(res) +##(PyUnicode_EncodeASCII( +## PyUnicode_AS_UNICODE(obj), +## PyUnicode_GET_SIZE(obj), +## errors), +## PyUnicode_GET_SIZE(obj)) -def utf_16_encode(inst,obj,errors='strict'): +def utf_16_encode( obj,errors='strict'): """None """ u = PyUnicode_EncodeUTF16(obj,len(obj),errors) return u,len(u) -def raw_unicode_escape_encode(inst,obj,errors='strict'): +def raw_unicode_escape_encode( obj,errors='strict'): """None """ res = PyUnicode_EncodeRawUnicodeEscape(obj,len(obj)) return res,len(res) -# XXX -def utf_8_encode(inst,obj,errors='strict'): + +def utf_8_encode( obj,errors='strict'): """None """ - pass + res = PyUnicode_EncodeUTF8(obj,len(obj),errors) + return res,len(res) # XXX -def utf_16_le_encode(inst,obj,errors='strict'): +def utf_16_le_encode( obj,errors='strict'): """None """ pass # XXX -def utf_16_be_encode(inst,obj,errors='strict'): +def utf_16_be_encode( obj,errors='strict'): """None """ pass -def unicode_internal_decode(inst,unistr,errors='strict'): +def unicode_internal_decode( unistr,errors='strict'): """None """ if type(unistr) == unicode: @@ -292,12 +271,12 @@ else: return unicode(unistr),len(unistr) # XXX -def utf_16_le_decode(inst,data,errors='strict'): +def utf_16_le_decode( data,errors='strict'): """None """ pass # XXX -def utf_16_be_decode(inst,data,errors='strict'): +def utf_16_be_decode( data,errors='strict'): """None """ pass @@ -309,27 +288,33 @@ raise TypeError("codec must pass exception instance") def ignore_errors(exc): - if type(exc) in [UnicodeEncodeError,UnicodeDecodeError,UnicodeTranslateError]: + if isinstance(exc,(UnicodeEncodeError,UnicodeDecodeError,UnicodeTranslateError)): return u'',exc.end else: - raise TypeError("don't know how to handle %.400s in error callback"%type(exc)) -# XXX + raise TypeError("don't know how to handle %.400s in error callback"%exc) + def replace_errors(exc): - if isinstance(exc,Exception): - raise exc + if isinstance(exc,(UnicodeDecodeError,UnicodeEncodeError)): + return u'?'*(exc.end-exc.start),exc.end else: - raise TypeError("codec must pass exception instance") -# XXX + raise TypeError("don't know how to handle %.400s in error callback"%exc) + def xmlcharrefreplace_errors(exc): - if isinstance(exc,Exception): - raise exc + if isinstance(exc,UnicodeEncodeError): + res = [u'&#'] + for ch in exc.object[exc.start:exc.end]: + res.append(str(ord(ch))) + res.append(';') + return u''.join(res),exc.end else: - raise TypeError("codec must pass exception instance") + raise TypeError("don't know how to handle %.400s in error callback"%type(exc)) def backslashreplace_errors(exc): if isinstance(exc,UnicodeEncodeError): - p=['\\'] + p=[] + #print exc.start,exc.end for c in exc.object[exc.start:exc.end]: + p.append('\\') oc = ord(c) if (oc >= 0x00010000): p.append('U') Added: pypy/dist/pypy/lib/test2/test_codeccallbacks.py ============================================================================== --- (empty file) +++ pypy/dist/pypy/lib/test2/test_codeccallbacks.py Mon May 2 21:32:31 2005 @@ -0,0 +1,715 @@ +import autopath +import test.test_support, unittest +import sys, htmlentitydefs, unicodedata +from pypy.lib import codecs + +class PosReturn: + # this can be used for configurable callbacks + + def __init__(self): + self.pos = 0 + + def handle(self, exc): + oldpos = self.pos + realpos = oldpos + if realpos<0: + realpos = len(exc.object) + realpos + # if we don't advance this time, terminate on the next call + # otherwise we'd get an endless loop + if realpos <= exc.start: + self.pos = len(exc.object) + return (u"", oldpos) + +class CodecCallbackTest(unittest.TestCase): + + def test_xmlcharrefreplace(self): + # replace unencodable characters which numeric character entities. + # For ascii, latin-1 and charmaps this is completely implemented + # in C and should be reasonably fast. + s = u"\u30b9\u30d1\u30e2 \xe4nd eggs" + self.assertEqual( + s.encode("ascii", "xmlcharrefreplace"), + "スパモ änd eggs" + ) + self.assertEqual( + s.encode("latin-1", "xmlcharrefreplace"), + "スパモ \xe4nd eggs" + ) + + def test_xmlcharnamereplace(self): + # This time use a named character entity for unencodable + # characters, if one is available. + + def xmlcharnamereplace(exc): + if not isinstance(exc, UnicodeEncodeError): + raise TypeError("don't know how to handle %r" % exc) + l = [] + for c in exc.object[exc.start:exc.end]: + try: + l.append(u"&%s;" % htmlentitydefs.codepoint2name[ord(c)]) + except KeyError: + l.append(u"&#%d;" % ord(c)) + return (u"".join(l), exc.end) + + codecs.register_error( + "test.xmlcharnamereplace", xmlcharnamereplace) + + sin = u"\xab\u211c\xbb = \u2329\u1234\u20ac\u232a" + sout = "«ℜ» = ⟨ሴ€⟩" + self.assertEqual(codecs.encode(sin,"ascii", "test.xmlcharnamereplace"), sout) + sout = "\xabℜ\xbb = ⟨ሴ€⟩" + self.assertEqual(codecs.encode(sin,"latin-1", "test.xmlcharnamereplace"), sout) + sout = "\xabℜ\xbb = ⟨ሴ\xa4⟩" + self.assertEqual(codecs.encode(sin,"iso-8859-15", "test.xmlcharnamereplace"), sout) + + def test_uninamereplace(self): + # We're using the names from the unicode database this time, + # and we're doing "syntax highlighting" here, i.e. we include + # the replaced text in ANSI escape sequences. For this it is + # useful that the error handler is not called for every single + # unencodable character, but for a complete sequence of + # unencodable characters, otherwise we would output many + # unneccessary escape sequences. + + def uninamereplace(exc): + if not isinstance(exc, UnicodeEncodeError): + raise TypeError("don't know how to handle %r" % exc) + l = [] + for c in exc.object[exc.start:exc.end]: + l.append(unicodedata.name(c, u"0x%x" % ord(c))) + return (u"\033[1m%s\033[0m" % u", ".join(l), exc.end) + + codecs.register_error( + "test.uninamereplace", uninamereplace) + + sin = u"\xac\u1234\u20ac\u8000" + sout = "\033[1mNOT SIGN, ETHIOPIC SYLLABLE SEE, EURO SIGN, CJK UNIFIED IDEOGRAPH-8000\033[0m" + self.assertEqual(codecs.encode(sin,"ascii", "test.uninamereplace"), sout) + + sout = "\xac\033[1mETHIOPIC SYLLABLE SEE, EURO SIGN, CJK UNIFIED IDEOGRAPH-8000\033[0m" + tout = codecs.encode(sin,"latin-1", "test.uninamereplace") + self.assertEqual(tout, sout) + sout = "\xac\033[1mETHIOPIC SYLLABLE SEE\033[0m\xa4\033[1mCJK UNIFIED IDEOGRAPH-8000\033[0m" + self.assertEqual(codecs.encode(sin,"iso-8859-15", "test.uninamereplace"), sout) + + def test_backslashescape(self): + # Does the same as the "unicode-escape" encoding, but with different + # base encodings. + sin = u"a\xac\u1234\u20ac\u8000" + if sys.maxunicode > 0xffff: + sin += unichr(sys.maxunicode) + sout = "a\\xac\\u1234\\u20ac\\u8000" + if sys.maxunicode > 0xffff: + sout += "\\U%08x" % sys.maxunicode + self.assertEqual(codecs.encode(sin,"ascii", "backslashreplace"), sout) + + sout = "a\xac\\u1234\\u20ac\\u8000" + if sys.maxunicode > 0xffff: + sout += "\\U%08x" % sys.maxunicode + self.assertEqual(codecs.encode(sin,"latin-1", "backslashreplace"), sout) + + sout = "a\xac\\u1234\xa4\\u8000" + if sys.maxunicode > 0xffff: + sout += "\\U%08x" % sys.maxunicode + self.assertEqual(codecs.encode(sin,"iso-8859-15", "backslashreplace"), sout) + + def test_relaxedutf8(self): + # This is the test for a decoding callback handler, + # that relaxes the UTF-8 minimal encoding restriction. + # A null byte that is encoded as "\xc0\x80" will be + # decoded as a null byte. All other illegal sequences + # will be handled strictly. + def relaxedutf8(exc): + if not isinstance(exc, UnicodeDecodeError): + raise TypeError("don't know how to handle %r" % exc) + if exc.object[exc.start:exc.end].startswith("\xc0\x80"): + return (u"\x00", exc.start+2) # retry after two bytes + else: + raise exc + + codecs.register_error( + "test.relaxedutf8", relaxedutf8) + + sin = "a\x00b\xc0\x80c\xc3\xbc\xc0\x80\xc0\x80" + sout = u"a\x00b\x00c\xfc\x00\x00" + self.assertEqual(codecs.decode(sin,"utf-8", "test.relaxedutf8"), sout) + sin = "\xc0\x80\xc0\x81" + self.assertRaises(UnicodeError, codecs.decode,sin, "utf-8", "test.relaxedutf8") + + def test_charmapencode(self): + # For charmap encodings the replacement string will be + # mapped through the encoding again. This means, that + # to be able to use e.g. the "replace" handler, the + # charmap has to have a mapping for "?". + charmap = dict([ (ord(c), 2*c.upper()) for c in "abcdefgh"]) + sin = u"abc" + sout = "AABBCC" + self.assertEquals(codecs.charmap_encode(sin, "strict", charmap)[0], sout) + + sin = u"abcA" + self.assertRaises(UnicodeError, codecs.charmap_encode, sin, "strict", charmap) + + charmap[ord("?")] = "XYZ" + sin = u"abcDEF" + sout = "AABBCCXYZXYZXYZ" + self.assertEquals(codecs.charmap_encode(sin, "replace", charmap)[0], sout) + + charmap[ord("?")] = u"XYZ" + self.assertRaises(TypeError, codecs.charmap_encode, sin, "replace", charmap) + + charmap[ord("?")] = u"XYZ" + self.assertRaises(TypeError, codecs.charmap_encode, sin, "replace", charmap) + + def test_callbacks(self): + def handler1(exc): + if not isinstance(exc, UnicodeEncodeError) \ + and not isinstance(exc, UnicodeDecodeError): + raise TypeError("don't know how to handle %r" % exc) + l = [u"<%d>" % ord(exc.object[pos]) for pos in xrange(exc.start, exc.end)] + return (u"[%s]" % u"".join(l), exc.end) + + codecs.register_error("test.handler1", handler1) + + def handler2(exc): + if not isinstance(exc, UnicodeDecodeError): + raise TypeError("don't know how to handle %r" % exc) + l = [u"<%d>" % ord(exc.object[pos]) for pos in xrange(exc.start, exc.end)] + return (u"[%s]" % u"".join(l), exc.end+1) # skip one character + + codecs.register_error("test.handler2", handler2) + + s = "\x00\x81\x7f\x80\xff" + + self.assertEqual( + codecs.decode(s,"ascii", "test.handler1"), + u"\x00[<129>]\x7f[<128>][<255>]" + ) + self.assertEqual( + codecs.decode(s,"ascii", "test.handler2"), + u"\x00[<129>][<128>]" + ) + + self.assertEqual( + codecs.decode("\\u3042\u3xxx","unicode-escape", "test.handler1"), + u"\u3042[<92><117><51><120>]xx" + ) + + self.assertEqual( + codecs.decode("\\u3042\u3xx","unicode-escape", "test.handler1"), + u"\u3042[<92><117><51><120><120>]" + ) + + self.assertEqual( + codecs.charmap_decode("abc", "test.handler1", {ord("a"): u"z"})[0], + u"z[<98>][<99>]" + ) + + self.assertEqual( + codecs.encode(u"g\xfc\xdfrk","ascii", "test.handler1"), + u"g[<252><223>]rk" + ) + + self.assertEqual( + codecs.encode(u"g\xfc\xdf","ascii", "test.handler1"), + u"g[<252><223>]" + ) + + def test_longstrings(self): + # test long strings to check for memory overflow problems + errors = [ "strict", "ignore", "replace", "xmlcharrefreplace", "backslashreplace"] + # register the handlers under different names, + # to prevent the codec from recognizing the name + for err in errors: + codecs.register_error("test." + err, codecs.lookup_error(err)) + l = 1000 + errors += [ "test." + err for err in errors ] + for uni in [ s*l for s in (u"x", u"\u3042", u"a\xe4") ]: + for enc in ("ascii", "latin-1", "iso-8859-1", "iso-8859-15", "utf-8", "utf-7", "utf-16"): + for err in errors: + try: + codecs.encode(uni,enc, err) + except UnicodeError: + pass + + def check_exceptionobjectargs(self, exctype, args, msg): + # Test UnicodeError subclasses: construction, attribute assignment and __str__ conversion + # check with one missing argument + self.assertRaises(TypeError, exctype, *args[:-1]) + # check with one argument too much + self.assertRaises(TypeError, exctype, *(args + ["too much"])) + # check with one argument of the wrong type + wrongargs = [ "spam", u"eggs", 42, 1.0, None ] + for i in xrange(len(args)): + for wrongarg in wrongargs: + if type(wrongarg) is type(args[i]): + continue + # build argument array + callargs = [] + for j in xrange(len(args)): + if i==j: + callargs.append(wrongarg) + else: + callargs.append(args[i]) + self.assertRaises(TypeError, exctype, *callargs) + + # check with the correct number and type of arguments + exc = exctype(*args) + self.assertEquals(str(exc), msg) + + def test_unicodeencodeerror(self): + self.check_exceptionobjectargs( + UnicodeEncodeError, + ["ascii", u"g\xfcrk", 1, 2, "ouch"], + "'ascii' codec can't encode character u'\\xfc' in position 1: ouch" + ) + self.check_exceptionobjectargs( + UnicodeEncodeError, + ["ascii", u"g\xfcrk", 1, 4, "ouch"], + "'ascii' codec can't encode characters in position 1-3: ouch" + ) + self.check_exceptionobjectargs( + UnicodeEncodeError, + ["ascii", u"\xfcx", 0, 1, "ouch"], + "'ascii' codec can't encode character u'\\xfc' in position 0: ouch" + ) + self.check_exceptionobjectargs( + UnicodeEncodeError, + ["ascii", u"\u0100x", 0, 1, "ouch"], + "'ascii' codec can't encode character u'\\u0100' in position 0: ouch" + ) + self.check_exceptionobjectargs( + UnicodeEncodeError, + ["ascii", u"\uffffx", 0, 1, "ouch"], + "'ascii' codec can't encode character u'\\uffff' in position 0: ouch" + ) + if sys.maxunicode > 0xffff: + self.check_exceptionobjectargs( + UnicodeEncodeError, + ["ascii", u"\U00010000x", 0, 1, "ouch"], + "'ascii' codec can't encode character u'\\U00010000' in position 0: ouch" + ) + + def test_unicodedecodeerror(self): + self.check_exceptionobjectargs( + UnicodeDecodeError, + ["ascii", "g\xfcrk", 1, 2, "ouch"], + "'ascii' codec can't decode byte 0xfc in position 1: ouch" + ) + self.check_exceptionobjectargs( + UnicodeDecodeError, + ["ascii", "g\xfcrk", 1, 3, "ouch"], + "'ascii' codec can't decode bytes in position 1-2: ouch" + ) + + def test_unicodetranslateerror(self): + self.check_exceptionobjectargs( + UnicodeTranslateError, + [u"g\xfcrk", 1, 2, "ouch"], + "can't translate character u'\\xfc' in position 1: ouch" + ) + self.check_exceptionobjectargs( + UnicodeTranslateError, + [u"g\u0100rk", 1, 2, "ouch"], + "can't translate character u'\\u0100' in position 1: ouch" + ) + self.check_exceptionobjectargs( + UnicodeTranslateError, + [u"g\uffffrk", 1, 2, "ouch"], + "can't translate character u'\\uffff' in position 1: ouch" + ) + if sys.maxunicode > 0xffff: + self.check_exceptionobjectargs( + UnicodeTranslateError, + [u"g\U00010000rk", 1, 2, "ouch"], + "can't translate character u'\\U00010000' in position 1: ouch" + ) + self.check_exceptionobjectargs( + UnicodeTranslateError, + [u"g\xfcrk", 1, 3, "ouch"], + "can't translate characters in position 1-2: ouch" + ) + + def test_badandgoodstrictexceptions(self): + # "strict" complains about a non-exception passed in + self.assertRaises( + TypeError, + codecs.strict_errors, + 42 + ) + # "strict" complains about the wrong exception type + self.assertRaises( + Exception, + codecs.strict_errors, + Exception("ouch") + ) + + # If the correct exception is passed in, "strict" raises it + self.assertRaises( + UnicodeEncodeError, + codecs.strict_errors, + UnicodeEncodeError("ascii", u"\u3042", 0, 1, "ouch") + ) + + def test_badandgoodignoreexceptions(self): + # "ignore" complains about a non-exception passed in + self.assertRaises( + TypeError, + codecs.ignore_errors, + 42 + ) + # "ignore" complains about the wrong exception type + self.assertRaises( + TypeError, + codecs.ignore_errors, + UnicodeError("ouch") + ) + # If the correct exception is passed in, "ignore" returns an empty replacement + self.assertEquals( + codecs.ignore_errors(UnicodeEncodeError("ascii", u"\u3042", 0, 1, "ouch")), + (u"", 1) + ) + self.assertEquals( + codecs.ignore_errors(UnicodeDecodeError("ascii", "\xff", 0, 1, "ouch")), + (u"", 1) + ) + self.assertEquals( + codecs.ignore_errors(UnicodeTranslateError(u"\u3042", 0, 1, "ouch")), + (u"", 1) + ) + + def test_badandgoodreplaceexceptions(self): + # "replace" complains about a non-exception passed in + self.assertRaises( + TypeError, + codecs.replace_errors, + 42 + ) + # "replace" complains about the wrong exception type + self.assertRaises( + TypeError, + codecs.replace_errors, + UnicodeError("ouch") + ) + # With the correct exception, "ignore" returns an empty replacement + self.assertEquals( + codecs.replace_errors(UnicodeEncodeError("ascii", u"\u3042", 0, 1, "ouch")), + (u"?", 1) + ) + self.assertEquals( + codecs.replace_errors(UnicodeDecodeError("ascii", "\xff", 0, 1, "ouch")), + (u"\ufffd", 1) + ) + self.assertEquals( + codecs.replace_errors(UnicodeTranslateError(u"\u3042", 0, 1, "ouch")), + (u"\ufffd", 1) + ) + + def test_badandgoodxmlcharrefreplaceexceptions(self): + # "xmlcharrefreplace" complains about a non-exception passed in + self.assertRaises( + TypeError, + codecs.xmlcharrefreplace_errors, + 42 + ) + # "xmlcharrefreplace" complains about the wrong exception types + self.assertRaises( + TypeError, + codecs.xmlcharrefreplace_errors, + UnicodeError("ouch") + ) + # "xmlcharrefreplace" can only be used for encoding + self.assertRaises( + TypeError, + codecs.xmlcharrefreplace_errors, + UnicodeDecodeError("ascii", "\xff", 0, 1, "ouch") + ) + self.assertRaises( + TypeError, + codecs.xmlcharrefreplace_errors, + UnicodeTranslateError(u"\u3042", 0, 1, "ouch") + ) + # Use the correct exception + self.assertEquals( + codecs.xmlcharrefreplace_errors(UnicodeEncodeError("ascii", u"\u3042", 0, 1, "ouch")), + (u"&#%d;" % 0x3042, 1) + ) + + def test_badandgoodbackslashreplaceexceptions(self): + # "backslashreplace" complains about a non-exception passed in + self.assertRaises( + TypeError, + codecs.backslashreplace_errors, + 42 + ) + # "backslashreplace" complains about the wrong exception types + self.assertRaises( + TypeError, + codecs.backslashreplace_errors, + UnicodeError("ouch") + ) + # "backslashreplace" can only be used for encoding + self.assertRaises( + TypeError, + codecs.backslashreplace_errors, + UnicodeDecodeError("ascii", "\xff", 0, 1, "ouch") + ) + self.assertRaises( + TypeError, + codecs.backslashreplace_errors, + UnicodeTranslateError(u"\u3042", 0, 1, "ouch") + ) + # Use the correct exception + self.assertEquals( + codecs.backslashreplace_errors(UnicodeEncodeError("ascii", u"\u3042", 0, 1, "ouch")), + (u"\\u3042", 1) + ) + self.assertEquals( + codecs.backslashreplace_errors(UnicodeEncodeError("ascii", u"\x00", 0, 1, "ouch")), + (u"\\x00", 1) + ) + self.assertEquals( + codecs.backslashreplace_errors(UnicodeEncodeError("ascii", u"\xff", 0, 1, "ouch")), + (u"\\xff", 1) + ) + self.assertEquals( + codecs.backslashreplace_errors(UnicodeEncodeError("ascii", u"\u0100", 0, 1, "ouch")), + (u"\\u0100", 1) + ) + self.assertEquals( + codecs.backslashreplace_errors(UnicodeEncodeError("ascii", u"\uffff", 0, 1, "ouch")), + (u"\\uffff", 1) + ) + if sys.maxunicode>0xffff: + self.assertEquals( + codecs.backslashreplace_errors(UnicodeEncodeError("ascii", u"\U00010000", 0, 1, "ouch")), + (u"\\U00010000", 1) + ) + self.assertEquals( + codecs.backslashreplace_errors(UnicodeEncodeError("ascii", u"\U0010ffff", 0, 1, "ouch")), + (u"\\U0010ffff", 1) + ) + + def test_badhandlerresults(self): + results = ( 42, u"foo", (1,2,3), (u"foo", 1, 3), (u"foo", None), (u"foo",), ("foo", 1, 3), ("foo", None), ("foo",) ) + encs = ("ascii", "latin-1", "iso-8859-1", "iso-8859-15") + + for res in results: + codecs.register_error("test.badhandler", lambda: res) + for enc in encs: + self.assertRaises( + TypeError, + codecs.encode, + u"\u3042", + enc, + "test.badhandler" + ) + for (enc, bytes) in ( + ("ascii", "\xff"), + ("utf-8", "\xff"), + ("utf-7", "+x-") + ): + self.assertRaises( + TypeError, + codecs.decode, + bytes, + enc, + "test.badhandler" + ) + + def test_lookup(self): + self.assertEquals(codecs.strict_errors, codecs.lookup_error("strict")) + self.assertEquals(codecs.ignore_errors, codecs.lookup_error("ignore")) + self.assertEquals(codecs.strict_errors, codecs.lookup_error("strict")) + self.assertEquals( + codecs.xmlcharrefreplace_errors, + codecs.lookup_error("xmlcharrefreplace") + ) + self.assertEquals( + codecs.backslashreplace_errors, + codecs.lookup_error("backslashreplace") + ) + + def test_unencodablereplacement(self): + def unencrepl(exc): + if isinstance(exc, UnicodeEncodeError): + return (u"\u4242", exc.end) + else: + raise TypeError("don't know how to handle %r" % exc) + codecs.register_error("test.unencreplhandler", unencrepl) + for enc in ("ascii", "iso-8859-1", "iso-8859-15"): + self.assertRaises( + UnicodeEncodeError, + codecs.encode, + u"\u4242", + enc, + "test.unencreplhandler" + ) + + def test_badregistercall(self): + # enhance coverage of: + # Modules/_codecsmodule.c::register_error() + # Python/codecs.c::PyCodec_RegisterError() + self.assertRaises(TypeError, codecs.register_error, 42) + self.assertRaises(TypeError, codecs.register_error, "test.dummy", 42) + + def test_unknownhandler(self): + # enhance coverage of: + # Modules/_codecsmodule.c::lookup_error() + self.assertRaises(LookupError, codecs.lookup_error, "test.unknown") + +## def test_xmlcharrefvalues(self): +## # enhance coverage of: +## # Python/codecs.c::PyCodec_XMLCharRefReplaceErrors() +## # and inline implementations +## v = (1, 5, 10, 50, 100, 500, 1000, 5000, 10000, 50000) +## if sys.maxunicode>=100000: +## v += (100000, 500000, 1000000) +## s = u"".join([unichr(x) for x in v]) +## codecs.register_error("test.xmlcharrefreplace", codecs.xmlcharrefreplace_errors) +## for enc in ("ascii", "iso-8859-15"): +## for err in ("xmlcharrefreplace", "test.xmlcharrefreplace"): +## codecs.encode(s,enc, err) + + def test_decodehelper(self): + # enhance coverage of: + # Objects/unicodeobject.c::unicode_decode_call_errorhandler() + # and callers + self.assertRaises(LookupError, codecs.decode,"\xff", "ascii", "test.unknown") + + def baddecodereturn1(exc): + return 42 + codecs.register_error("test.baddecodereturn1", baddecodereturn1) + self.assertRaises(TypeError, codecs.decode, "\xff", "ascii", "test.baddecodereturn1") + self.assertRaises(TypeError, codecs.decode, "\\", "unicode-escape", "test.baddecodereturn1") + self.assertRaises(TypeError, codecs.decode, "\\x0", "unicode-escape", "test.baddecodereturn1") + self.assertRaises(TypeError, codecs.decode, "\\x0y", "unicode-escape", "test.baddecodereturn1") + self.assertRaises(TypeError, codecs.decode, "\\Uffffeeee", "unicode-escape", "test.baddecodereturn1") + self.assertRaises(TypeError, codecs.decode, "\\uyyyy", "raw-unicode-escape", "test.baddecodereturn1") + + def baddecodereturn2(exc): + return (u"?", None) + codecs.register_error("test.baddecodereturn2", baddecodereturn2) + self.assertRaises(TypeError, codecs.decode, "\xff", "ascii", "test.baddecodereturn2") + + handler = PosReturn() + codecs.register_error("test.posreturn", handler.handle) + + # Valid negative position + handler.pos = -1 + self.assertEquals(codecs.decode( "\xff0","ascii", "test.posreturn"), u"0") + + # Valid negative position + handler.pos = -2 + self.assertEquals(codecs.decode("\xff0","ascii", "test.posreturn"), u"") + + # Negative position out of bounds + handler.pos = -3 + self.assertRaises(IndexError, codecs.decode,"\xff0", "ascii", "test.posreturn") + + # Valid positive position + handler.pos = 1 + self.assertEquals(codecs.decode("\xff0","ascii", "test.posreturn"), u"0") + + # Largest valid positive position (one beyond end of input + handler.pos = 2 + self.assertEquals(codecs.decode("\xff0","ascii", "test.posreturn"), u"") + + # Invalid positive position + handler.pos = 3 + self.assertRaises(IndexError, codecs.decode,"\xff0", "ascii", "test.posreturn") + + # Restart at the "0" + handler.pos = 6 + self.assertEquals(codecs.decode("\\uyyyy0","raw-unicode-escape", "test.posreturn"), u"0") + + class D(dict): + def __getitem__(self, key): + raise ValueError + self.assertRaises(UnicodeError, codecs.charmap_decode, "\xff", "strict", {0xff: None}) + self.assertRaises(ValueError, codecs.charmap_decode, "\xff", "strict", D()) + self.assertRaises(TypeError, codecs.charmap_decode, "\xff", "strict", {0xff: sys.maxunicode+1}) + + def test_encodehelper(self): + # enhance coverage of: + # Objects/unicodeobject.c::unicode_encode_call_errorhandler() + # and callers + + self.assertRaises(LookupError, codecs.decode,u"\xff", "ascii", "test.unknown") + + def badencodereturn1(exc): + return 42 + codecs.register_error("test.badencodereturn1", badencodereturn1) + self.assertRaises(TypeError, codecs.decode, u"\xff", "ascii", "test.badencodereturn1") + + def badencodereturn2(exc): + return (u"?", None) + codecs.register_error("test.badencodereturn2", badencodereturn2) + self.assertRaises(TypeError, codecs.decode,u"\xff", "ascii", "test.badencodereturn2") + + handler = PosReturn() + codecs.register_error("test.posreturn", handler.handle) + + # Valid negative position + handler.pos = -1 + self.assertEquals(u"\xff0".encode("ascii", "test.posreturn"), "0") + + # Valid negative position + handler.pos = -2 + self.assertEquals(u"\xff0".encode("ascii", "test.posreturn"), "") + + # Negative position out of bounds + handler.pos = -3 + self.assertRaises(IndexError, u"\xff0".encode, "ascii", "test.posreturn") + + # Valid positive position + handler.pos = 1 + self.assertEquals(u"\xff0".encode("ascii", "test.posreturn"), "0") + + # Largest valid positive position (one beyond end of input + handler.pos = 2 + self.assertEquals(u"\xff0".encode("ascii", "test.posreturn"), "") + + # Invalid positive position + handler.pos = 3 + self.assertRaises(IndexError, u"\xff0".encode, "ascii", "test.posreturn") + + handler.pos = 0 + + class D(dict): + def __getitem__(self, key): + raise ValueError + for err in ("strict", "replace", "xmlcharrefreplace", "backslashreplace", "test.posreturn"): + self.assertRaises(UnicodeError, codecs.charmap_encode, u"\xff", err, {0xff: None}) + self.assertRaises(ValueError, codecs.charmap_encode, u"\xff", err, D()) + self.assertRaises(TypeError, codecs.charmap_encode, u"\xff", err, {0xff: 300}) + + def test_translatehelper(self): + # enhance coverage of: + # Objects/unicodeobject.c::unicode_encode_call_errorhandler() + # and callers + # (Unfortunately the errors argument is not directly accessible + # from Python, so we can't test that much) + class D(dict): + def __getitem__(self, key): + raise ValueError + self.assertRaises(ValueError, u"\xff".translate, D()) + self.assertRaises(TypeError, u"\xff".translate, {0xff: sys.maxunicode+1}) + self.assertRaises(TypeError, u"\xff".translate, {0xff: ()}) + + def test_bug828737(self): + charmap = { + ord("&"): u"&", + ord("<"): u"<", + ord(">"): u">", + ord('"'): u""", + } + + for n in (1, 10, 100, 1000): + text = u'abcghi'*n + text.translate(charmap) + +def test_main(): + test.test_support.run_unittest(CodecCallbackTest) + +if __name__ == "__main__": + test_main() Modified: pypy/dist/pypy/lib/unicodecodec.py ============================================================================== --- pypy/dist/pypy/lib/unicodecodec.py (original) +++ pypy/dist/pypy/lib/unicodecodec.py Mon May 2 21:32:31 2005 @@ -17,6 +17,34 @@ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 1, 1, ] unicode_latin1=[] + +codec_error_registry = {} +def lookup_error(errors): + """lookup_error(errors) -> handler + + Return the error handler for the specified error handling name + or raise a LookupError, if no handler exists under this name. + """ + try: + err_handler = codec_error_registry[errors] + except KeyError: + raise LookupError("unknown error handler name %s"%errors) + return err_handler + +def register_error(errors, handler): + """register_error(errors, handler) + + Register the specified error handler under the name + errors. handler must be a callable object, that + will be called with an exception instance containing + information about the location of the encoding/decoding + error and must return a (replacement, new position) tuple. + """ + if callable(handler): + codec_error_registry[errors] = handler + else: + raise TypeError("handler must be callable") + for i in range(256): unicode_latin1.append(None) @@ -305,7 +333,7 @@ def PyUnicode_EncodeASCII(p,size,errors): - return unicode_encode_ucs1(p, size, errors, 128) + return u''.join(unicode_encode_ucs1(p, size, errors, 128)) def PyUnicode_AsASCIIString(unistr): @@ -560,12 +588,53 @@ #### if (0 == WideCharToMultiByte(CP_ACP, 0, p, size, s, mbcssize, NULL, NULL)): #### raise UnicodeEncodeError, "Windows cannot decode the string %s" %p ## return s +def unicode_decode_call_errorhandler(errors, errorHandler, encoding, + reason, input, insize, startinpos, endinpos, exceptionObject): + + if not errorHandler: + errorHandler = lookup_error(errors) + + if not exceptionObject: + exceptionObject = UnicodeDecodeError(encoding, input, insize, startinpos, endinpos, reason) + else: + exceptionObject.start = startinpos + exceptionObject.ens = endinpos + exceptionObject.resason = reason + + res,newpos = errorHandler(exceptionObject) + if (newpos<0): + newpos = insize+newpos; + if newpos<0 or newpos>insize: + raise IndexError( "position %d from error handler out of bounds", newpos) + return res,newpos + def PyUnicode_DecodeUTF8(s, size, errors): - return PyUnicode_DecodeUTF8Stateful(s, size, errors, NULL); + return PyUnicode_DecodeUTF8Stateful(s, size, errors, None); + +## /* Map UTF-8 encoded prefix byte to sequence length. zero means +## illegal prefix. see RFC 2279 for details */ +utf8_code_length = [ + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 0, 0 +] def PyUnicode_DecodeUTF8Stateful(s,size,errors,consumed): - pass + ##{ ## const char *starts = s; ## int n; @@ -584,80 +653,53 @@ ## unicode = _PyUnicode_New(size); ## if (!unicode) ## return NULL; -## if (size == 0) { -## if (consumed) -## *consumed = 0; -## return (PyObject *)unicode; -## } -## -## /* Unpack UTF-8 encoded data */ -## p = unicode->str; -## e = s + size; -## -## while (s < e) { -## Py_UCS4 ch = (unsigned char)*s; -## -## if (ch < 0x80) { -## *p++ = (Py_UNICODE)ch; -## s++; -## continue; -## } -## -## n = utf8_code_length[ch]; -## -## if (s + n > e) { -## if (consumed) -## break; -## else { -## errmsg = "unexpected end of data"; -## startinpos = s-starts; -## endinpos = size; -## goto utf8Error; -## } -## } -## -## switch (n) { -## -## case 0: -## errmsg = "unexpected code byte"; -## startinpos = s-starts; -## endinpos = startinpos+1; -## goto utf8Error; -## -## case 1: -## errmsg = "internal error"; -## startinpos = s-starts; -## endinpos = startinpos+1; -## goto utf8Error; -## -## case 2: -## if ((s[1] & 0xc0) != 0x80) { -## errmsg = "invalid data"; -## startinpos = s-starts; -## endinpos = startinpos+2; -## goto utf8Error; -## } -## ch = ((s[0] & 0x1f) << 6) + (s[1] & 0x3f); -## if (ch < 0x80) { -## startinpos = s-starts; -## endinpos = startinpos+2; -## errmsg = "illegal encoding"; -## goto utf8Error; -## } -## else -## *p++ = (Py_UNICODE)ch; -## break; -## -## case 3: -## if ((s[1] & 0xc0) != 0x80 || -## (s[2] & 0xc0) != 0x80) { -## errmsg = "invalid data"; -## startinpos = s-starts; -## endinpos = startinpos+3; -## goto utf8Error; -## } -## ch = ((s[0] & 0x0f) << 12) + ((s[1] & 0x3f) << 6) + (s[2] & 0x3f); -## if (ch < 0x0800) { + if (size == 0): + if (consumed): + consumed = 0; + return u'' + + res = [] + for ch in s: + if ord(ch) < 0x80: + res.append(ch) + continue + + n = utf8_code_length[ord(ch)] + startinpos = s.index(ch) + if (startinpos + n > size): + if (consumed): + break + else: + errmsg = "unexpected end of data" + endinpos = size + p,outpos = unicode_decode_call_errorhandler( + errors, None, + "utf8", errmsg, + starts, size, startinpos, endinpos, s) + if n == 0: + errmsg = "unexpected code byte" + endinpos = startinpos+1 + elif n == 1: + errmsg = "internal error" + endinpos = startinpos+1 + elif n == 2: + if ((s[1] & 0xc0) != 0x80): + errmsg = "invalid data" + endinpos = startinpos+2 + c = ((ord(s[0]) & 0x1f) << 6) + (ord(s[1]) & 0x3f) + if c<0x80: + errmsg = "illegal encoding" + endinpos = startinpos+2 + + else: + res.append(c) + break + elif n == 3: + if ((s[1] & 0xc0) != 0x80 or + (s[2] & 0xc0) != 0x80): + errmsg = "invalid data" + endinpos = startinpos+3 + c = ((s[0] & 0x0f) << 12) + ((s[1] & 0x3f) << 6) + (s[2] & 0x3f) ## /* Note: UTF-8 encodings of surrogates are considered ## legal UTF-8 sequences; ## @@ -665,6 +707,18 @@ ## to recombine the surrogates into a single code ## unit. ## */ + if c < 0x8000: + errmsg = "illegal encoding" + endinpos = startinpos+3 + else: + res.append(c) +## p,outpos = unicode_decode_call_errorhandler( +## errors, None, +## "utf8", errmsg, +## starts, size, startinpos, endinpos, s) + +## ch = ((s[0] & 0x0f) << 12) + ((s[1] & 0x3f) << 6) + (s[2] & 0x3f); +## if (ch < 0x0800) { ## errmsg = "illegal encoding"; ## startinpos = s-starts; ## endinpos = startinpos+3; @@ -757,7 +811,7 @@ def PyUnicode_EncodeUTF8(s,size,errors): - assert(s != NULL) + assert(s != None) assert(size >= 0) p = [] i = 0 @@ -828,11 +882,11 @@ ## Py_XDECREF(v); ## return NULL; ##} -from pypy.lib._codecs import lookup_error -def unicode_encode_ucs1(p,size,errors,limit): - if limit==256: +def unicode_encode_ucs1(p,size,errors,limit): + + if limit == 256: reason = "ordinal not in range(256)" encoding = "latin-1" else: @@ -842,31 +896,32 @@ if (size == 0): return '' res = [] - for ch in p: + pos=0 + while pos < len(p): + #for ch in p: + ch = p[pos] if ord(ch) < limit: res.append(ch) + pos += 1 else: - #/* startpos for collecting unencodable chars */ collstart = p.index(ch) - collend = p.index(ch) - #/* find all unecodable characters */ - for c in p[collstart:]: - if ord(c) >= limit: - collend +=1 - else: - break + collend = p.index(ch)+1 + while collend < len(p) and ord(p[collend]) >= limit: + collend += 1 + #uncollectable = [c for c in p if ord(c) >= limit] handler = lookup_error(errors) - x = handler(UnicodeEncodeError(encoding,p,collstart,collend,reason)) - res.append(x) - - return ''.join(res) - -def PyUnicode_EncodeLatin1(p,size,errors): + exc = UnicodeEncodeError(encoding,p,collstart,collend,reason) + x = handler(exc) + res.append(x[0]) + pos = x[1] - return unicode_encode_ucs1(p, size, errors, 256); + return res #u''.join(res) +def PyUnicode_EncodeLatin1(p,size,errors): + res=unicode_encode_ucs1(p, size, errors, 256) + return u''.join(res) def PyUnicode_EncodeRawUnicodeEscape(s,size): if (size == 0): @@ -908,17 +963,19 @@ return '' inpos = 0 res = [] - print type(mapping),type(p) while (inpos")) - else: + x = handler(UnicodeEncodeError("charmap",p,inpos,inpos+1, + "character maps to ")) + res.append(mapping[ord(x[0])]) + #else: #/* done with this character => adjust input position */ - inpos+=1 + inpos+=1 return ''.join(res) From ale at codespeak.net Mon May 2 22:08:27 2005 From: ale at codespeak.net (ale at codespeak.net) Date: Mon, 2 May 2005 22:08:27 +0200 (CEST) Subject: [pypy-svn] r11820 - pypy/dist/lib-python/modified-2.3.4/encodings Message-ID: <20050502200827.E063027B84@code1.codespeak.net> Author: ale Date: Mon May 2 22:08:27 2005 New Revision: 11820 Added: pypy/dist/lib-python/modified-2.3.4/encodings/ - copied from r11508, pypy/dist/lib-python-2.3.4/encodings/ Modified: pypy/dist/lib-python/modified-2.3.4/encodings/ascii.py pypy/dist/lib-python/modified-2.3.4/encodings/charmap.py pypy/dist/lib-python/modified-2.3.4/encodings/latin_1.py pypy/dist/lib-python/modified-2.3.4/encodings/mbcs.py pypy/dist/lib-python/modified-2.3.4/encodings/raw_unicode_escape.py pypy/dist/lib-python/modified-2.3.4/encodings/unicode_escape.py pypy/dist/lib-python/modified-2.3.4/encodings/unicode_internal.py pypy/dist/lib-python/modified-2.3.4/encodings/utf_16.py pypy/dist/lib-python/modified-2.3.4/encodings/utf_16_be.py pypy/dist/lib-python/modified-2.3.4/encodings/utf_16_le.py pypy/dist/lib-python/modified-2.3.4/encodings/utf_7.py pypy/dist/lib-python/modified-2.3.4/encodings/utf_8.py Log: I needed to change a number of files (all the files that used the cfunctions in _codecsmodule.c). I have used the staticmethod built-in to makethe python functions behave like their c counterparts. I am not totally sure this is the Right Thing to do Modified: pypy/dist/lib-python/modified-2.3.4/encodings/ascii.py ============================================================================== --- pypy/dist/lib-python-2.3.4/encodings/ascii.py (original) +++ pypy/dist/lib-python/modified-2.3.4/encodings/ascii.py Mon May 2 22:08:27 2005 @@ -14,8 +14,8 @@ # Note: Binding these as C functions will result in the class not # converting them to methods. This is intended. - encode = codecs.ascii_encode - decode = codecs.ascii_decode + encode = staticmethod(codecs.ascii_encode) + decode = staticmethod(codecs.ascii_decode) class StreamWriter(Codec,codecs.StreamWriter): pass Modified: pypy/dist/lib-python/modified-2.3.4/encodings/charmap.py ============================================================================== --- pypy/dist/lib-python-2.3.4/encodings/charmap.py (original) +++ pypy/dist/lib-python/modified-2.3.4/encodings/charmap.py Mon May 2 22:08:27 2005 @@ -18,8 +18,8 @@ # Note: Binding these as C functions will result in the class not # converting them to methods. This is intended. - encode = codecs.charmap_encode - decode = codecs.charmap_decode + encode = staticmethod(codecs.charmap_encode) + decode = staticmethod(codecs.charmap_decode) class StreamWriter(Codec,codecs.StreamWriter): Modified: pypy/dist/lib-python/modified-2.3.4/encodings/latin_1.py ============================================================================== --- pypy/dist/lib-python-2.3.4/encodings/latin_1.py (original) +++ pypy/dist/lib-python/modified-2.3.4/encodings/latin_1.py Mon May 2 22:08:27 2005 @@ -14,8 +14,8 @@ # Note: Binding these as C functions will result in the class not # converting them to methods. This is intended. - encode = codecs.latin_1_encode - decode = codecs.latin_1_decode + encode = staticmethod(codecs.latin_1_encode) + decode = staticmethod(codecs.latin_1_decode) class StreamWriter(Codec,codecs.StreamWriter): pass Modified: pypy/dist/lib-python/modified-2.3.4/encodings/mbcs.py ============================================================================== --- pypy/dist/lib-python-2.3.4/encodings/mbcs.py (original) +++ pypy/dist/lib-python/modified-2.3.4/encodings/mbcs.py Mon May 2 22:08:27 2005 @@ -15,8 +15,8 @@ # Note: Binding these as C functions will result in the class not # converting them to methods. This is intended. - encode = codecs.mbcs_encode - decode = codecs.mbcs_decode + encode = staticmethod(codecs.mbcs_encode) + decode = staticmethod(codecs.mbcs_decode) class StreamWriter(Codec,codecs.StreamWriter): pass Modified: pypy/dist/lib-python/modified-2.3.4/encodings/raw_unicode_escape.py ============================================================================== --- pypy/dist/lib-python-2.3.4/encodings/raw_unicode_escape.py (original) +++ pypy/dist/lib-python/modified-2.3.4/encodings/raw_unicode_escape.py Mon May 2 22:08:27 2005 @@ -14,8 +14,8 @@ # Note: Binding these as C functions will result in the class not # converting them to methods. This is intended. - encode = codecs.raw_unicode_escape_encode - decode = codecs.raw_unicode_escape_decode + encode = staticmethod(codecs.raw_unicode_escape_encode) + decode = staticmethod(codecs.raw_unicode_escape_decode) class StreamWriter(Codec,codecs.StreamWriter): pass Modified: pypy/dist/lib-python/modified-2.3.4/encodings/unicode_escape.py ============================================================================== --- pypy/dist/lib-python-2.3.4/encodings/unicode_escape.py (original) +++ pypy/dist/lib-python/modified-2.3.4/encodings/unicode_escape.py Mon May 2 22:08:27 2005 @@ -14,8 +14,8 @@ # Note: Binding these as C functions will result in the class not # converting them to methods. This is intended. - encode = codecs.unicode_escape_encode - decode = codecs.unicode_escape_decode + encode = staticmethod(codecs.unicode_escape_encode) + decode = staticmethod(codecs.unicode_escape_decode) class StreamWriter(Codec,codecs.StreamWriter): pass Modified: pypy/dist/lib-python/modified-2.3.4/encodings/unicode_internal.py ============================================================================== --- pypy/dist/lib-python-2.3.4/encodings/unicode_internal.py (original) +++ pypy/dist/lib-python/modified-2.3.4/encodings/unicode_internal.py Mon May 2 22:08:27 2005 @@ -14,8 +14,8 @@ # Note: Binding these as C functions will result in the class not # converting them to methods. This is intended. - encode = codecs.unicode_internal_encode - decode = codecs.unicode_internal_decode + encode = staticmethod(codecs.unicode_internal_encode) + decode = staticmethod(codecs.unicode_internal_decode) class StreamWriter(Codec,codecs.StreamWriter): pass Modified: pypy/dist/lib-python/modified-2.3.4/encodings/utf_16.py ============================================================================== --- pypy/dist/lib-python-2.3.4/encodings/utf_16.py (original) +++ pypy/dist/lib-python/modified-2.3.4/encodings/utf_16.py Mon May 2 22:08:27 2005 @@ -14,8 +14,8 @@ # Note: Binding these as C functions will result in the class not # converting them to methods. This is intended. - encode = codecs.utf_16_encode - decode = codecs.utf_16_decode + encode = staticmethod(codecs.utf_16_encode) + decode = staticmethod(codecs.utf_16_decode) class StreamWriter(Codec,codecs.StreamWriter): def __init__(self, stream, errors='strict'): Modified: pypy/dist/lib-python/modified-2.3.4/encodings/utf_16_be.py ============================================================================== --- pypy/dist/lib-python-2.3.4/encodings/utf_16_be.py (original) +++ pypy/dist/lib-python/modified-2.3.4/encodings/utf_16_be.py Mon May 2 22:08:27 2005 @@ -14,8 +14,8 @@ # Note: Binding these as C functions will result in the class not # converting them to methods. This is intended. - encode = codecs.utf_16_be_encode - decode = codecs.utf_16_be_decode + encode = staticmethod(codecs.utf_16_be_encode) + decode = staticmethod(codecs.utf_16_be_decode) class StreamWriter(Codec,codecs.StreamWriter): pass Modified: pypy/dist/lib-python/modified-2.3.4/encodings/utf_16_le.py ============================================================================== --- pypy/dist/lib-python-2.3.4/encodings/utf_16_le.py (original) +++ pypy/dist/lib-python/modified-2.3.4/encodings/utf_16_le.py Mon May 2 22:08:27 2005 @@ -14,8 +14,8 @@ # Note: Binding these as C functions will result in the class not # converting them to methods. This is intended. - encode = codecs.utf_16_le_encode - decode = codecs.utf_16_le_decode + encode = staticmethod(codecs.utf_16_le_encode) + decode = staticmethod(codecs.utf_16_le_decode) class StreamWriter(Codec,codecs.StreamWriter): pass Modified: pypy/dist/lib-python/modified-2.3.4/encodings/utf_7.py ============================================================================== --- pypy/dist/lib-python-2.3.4/encodings/utf_7.py (original) +++ pypy/dist/lib-python/modified-2.3.4/encodings/utf_7.py Mon May 2 22:08:27 2005 @@ -10,8 +10,8 @@ # Note: Binding these as C functions will result in the class not # converting them to methods. This is intended. - encode = codecs.utf_7_encode - decode = codecs.utf_7_decode + encode = staticmethod(codecs.utf_7_encode) + decode = staticmethod(codecs.utf_7_decode) class StreamWriter(Codec,codecs.StreamWriter): pass Modified: pypy/dist/lib-python/modified-2.3.4/encodings/utf_8.py ============================================================================== --- pypy/dist/lib-python-2.3.4/encodings/utf_8.py (original) +++ pypy/dist/lib-python/modified-2.3.4/encodings/utf_8.py Mon May 2 22:08:27 2005 @@ -14,8 +14,8 @@ # Note: Binding these as C functions will result in the class not # converting them to methods. This is intended. - encode = codecs.utf_8_encode - decode = codecs.utf_8_decode + encode = staticmethod(codecs.utf_8_encode) + decode = staticmethod(codecs.utf_8_decode) class StreamWriter(Codec,codecs.StreamWriter): pass From hpk at codespeak.net Mon May 2 22:23:23 2005 From: hpk at codespeak.net (hpk at codespeak.net) Date: Mon, 2 May 2005 22:23:23 +0200 (CEST) Subject: [pypy-svn] r11821 - pypy/dist/pypy/documentation Message-ID: <20050502202323.26C6D27B84@code1.codespeak.net> Author: hpk Date: Mon May 2 22:23:22 2005 New Revision: 11821 Modified: pypy/dist/pypy/documentation/coding-style.txt Log: - added a section on our use of the standard python library - refactored naming conventions slightly - i think we should rename coding-style.txt to coding-guide.txt because we should with time add more information about the mechanics, e.g. modules, descriptors ... Modified: pypy/dist/pypy/documentation/coding-style.txt ============================================================================== --- pypy/dist/pypy/documentation/coding-style.txt (original) +++ pypy/dist/pypy/documentation/coding-style.txt Mon May 2 22:23:22 2005 @@ -297,30 +297,66 @@ handling enabled, so we might catch cases where we failed to adhere to our implicit assertions. -Naming and development conventions -================================== +Naming and directory layout +=========================== -Naming ------- +Modifying/Hacking PyPy's standard library +-------------------------------------------- -- directories/modules/namespaces are always **lowercase** +PyPy reuses the Python implementations of CPython's standard +library, currently from version 2.3.4. Sometimes +we need to modify modules and - more often - +regression tests because they rely on implementation +details of CPython. Therefore we have a strict scheme on +how to deal with these issues. Here is the order +in which PyPy looks up Python modules: + +*pypy/lib/* + + Used ONLY for complete pure Python reimplementation of modules. + The test2 subdirectory contains regular tests for these. + These tests run on top of CPython, i.e. at PyPy interpreter + level and are meant to *quickly* check that the reimplementations + are correct, independently of PyPy. + +*lib-python/modified-2.3.4/* + + The files and tests that we have modified from the CPython library. + +*lib-python/2.3.4/* + + The unmodified CPython library. **Never checkin anything here**. + +If you e.g. need to change a standard module or package then +you would issue:: -- classes are **CamelCase** + svn cp lib-python/2.3.4/standardmodule.py lib-python/modified-2.3.4 + +and subsequently edit and commit ``lib-python/modified-2.3.4/somemodule.py``. + +Directory and File Naming +------------------------- + +- directories/modules/namespaces are always **lowercase** - never use plural names in directory and file names -- ``__init__.py`` is always empty except for ``pypy/objspace/*`` - and ``pypy/module/*``. +- ``__init__.py`` is usually empty except for + ``pypy/objspace/*`` and ``pypy/module/*/__init__.py``. -- functions/methods are lowercase and ``'_'-separated`` (if - you need to separate at all) +- don't use more than 4 directory nesting levels -- not more than 4 directory nesting levels +- keep filenames concise and completion-friendly. -- it's appreciated if you manage to name files in a directory - so that tab-completion on the shell level is as easy as possible. -- objectspace classes are always spelled "ObjSpace". e.g. +Naming of python objects +------------------------ + +- class names are **CamelCase** + +- functions/methods are lowercase and ``_`` separated + +- objectspace classes are spelled ``XyzObjSpace``. e.g. - StdObjSpace - FlowObjSpace @@ -330,11 +366,10 @@ includes w_self. Don't use ``w_`` in application level python only code. - Committing ---------- -- it's nice to write good log messages because several people +- write good log messages because several people are reading the diffs. - if you add (text/py) files to the repository then please run @@ -389,7 +424,7 @@ is often sufficient to write "normal" application-level Python code that doesn't need to be aware of any particular coding style or restrictions. If we have a choice we often -use application level tests which usually look like this: +use application level tests which usually look like this:: def app_test_something(): # application level test code From hpk at codespeak.net Mon May 2 23:02:26 2005 From: hpk at codespeak.net (hpk at codespeak.net) Date: Mon, 2 May 2005 23:02:26 +0200 (CEST) Subject: [pypy-svn] r11825 - pypy/dist/pypy/documentation Message-ID: <20050502210226.242B827B84@code1.codespeak.net> Author: hpk Date: Mon May 2 23:02:25 2005 New Revision: 11825 Modified: pypy/dist/pypy/documentation/architecture.txt pypy/dist/pypy/documentation/coding-style.txt pypy/dist/pypy/documentation/objspace.txt pypy/dist/pypy/documentation/theory.txt Log: - a few minor fixes and more inter-linking Modified: pypy/dist/pypy/documentation/architecture.txt ============================================================================== --- pypy/dist/pypy/documentation/architecture.txt (original) +++ pypy/dist/pypy/documentation/architecture.txt Mon May 2 23:02:25 2005 @@ -43,9 +43,9 @@ ------------------------------------- The various parts of PyPy have always been under more or less heavy -refactoring during our five one-week sprints in 2003. However, the -higher level architecture remains rather simple and unchanged. There -are two independent basic subsystems: +refactoring since its inception. However, the higher level architecture +remains rather simple and unchanged. There are two independent basic +subsystems: - the *standard interpreter* which implements the Python language and is composed out of two components: @@ -99,6 +99,8 @@ python function, which, in turn, delegates operations on application-level objects to an object space. +.. _`objectspace`: + The Object Space ================ @@ -302,7 +304,7 @@ The Flow Object Space then, with the help of our plain interpreter, works through those initialized "RPython" code objects. The result of -this *abstract interpretation* is a flow graph: yet another +this `abstract interpretation`_ is a flow graph: yet another representation of a python program, but one which is suitable for applying translation and type inference techniques. The nodes of the graph are basic blocks consisting of Object Space operations, flowing @@ -329,6 +331,8 @@ also accepts plain non-typed python code, we can test translation even though type annotation is not complete. +.. _`abstract interpretation`: theory.html#abstract-interpretation + Trace Object Space ================== Modified: pypy/dist/pypy/documentation/coding-style.txt ============================================================================== --- pypy/dist/pypy/documentation/coding-style.txt (original) +++ pypy/dist/pypy/documentation/coding-style.txt Mon May 2 23:02:25 2005 @@ -392,12 +392,14 @@ - **Application Level tests**. They run at application level which means that they look like straight python code but they are interpreted by PyPy. -Both types of tests need an objectspace they can run with (the interpreter +Both types of tests need an `objectspace`_ they can run with (the interpreter dispatches operations on objects to an objectspace). If you run a test you can usually give the '-o' switch to select an object space. E.g. '-o thunk' -will select the thunk object space. The default is the "Standard Object Space" +will select the thunk object space. The default is the `Standard Object Space`_ which aims to implement unmodified Python semantics. +.. _`standard object space`: objspace.html#standard-object-space +.. _`objectspace`: architecture.html#objectspace .. _`py.test`: http://codespeak.net/py/current/doc/test.html Interpreter level tests Modified: pypy/dist/pypy/documentation/objspace.txt ============================================================================== --- pypy/dist/pypy/documentation/objspace.txt (original) +++ pypy/dist/pypy/documentation/objspace.txt Mon May 2 23:02:25 2005 @@ -247,6 +247,8 @@ List of names of exception classes. +.. _`standard object space`: + The Standard Object Space ========================= Modified: pypy/dist/pypy/documentation/theory.txt ============================================================================== --- pypy/dist/pypy/documentation/theory.txt (original) +++ pypy/dist/pypy/documentation/theory.txt Mon May 2 23:02:25 2005 @@ -5,6 +5,8 @@ .. contents:: .. sectnum:: +.. _`abstract interpretation`: + Abstract Interpretation ======================= From hpk at codespeak.net Mon May 2 23:46:34 2005 From: hpk at codespeak.net (hpk at codespeak.net) Date: Mon, 2 May 2005 23:46:34 +0200 (CEST) Subject: [pypy-svn] r11827 - pypy/dist/lib-python Message-ID: <20050502214634.75B3F27B84@code1.codespeak.net> Author: hpk Date: Mon May 2 23:46:34 2005 New Revision: 11827 Modified: pypy/dist/lib-python/conftest.py Log: argl, fixed getrev() code, more and more unknown revision numbers where showing up ... Modified: pypy/dist/lib-python/conftest.py ============================================================================== --- pypy/dist/lib-python/conftest.py (original) +++ pypy/dist/lib-python/conftest.py Mon May 2 23:46:34 2005 @@ -743,7 +743,7 @@ def getrev(path): try: - return py.path.svnwc(testdir).info().rev + return py.path.svnwc(pypydir).info().rev except: return 'unknown' # on windows people not always have 'svn' in their path From hpk at codespeak.net Tue May 3 11:03:12 2005 From: hpk at codespeak.net (hpk at codespeak.net) Date: Tue, 3 May 2005 11:03:12 +0200 (CEST) Subject: [pypy-svn] r11831 - pypy/dist/lib-python Message-ID: <20050503090312.AF57127B72@code1.codespeak.net> Author: hpk Date: Tue May 3 11:03:12 2005 New Revision: 11831 Modified: pypy/dist/lib-python/conftest.py Log: be more precise about exceptions when getrev()ing Modified: pypy/dist/lib-python/conftest.py ============================================================================== --- pypy/dist/lib-python/conftest.py (original) +++ pypy/dist/lib-python/conftest.py Tue May 3 11:03:12 2005 @@ -744,7 +744,7 @@ def getrev(path): try: return py.path.svnwc(pypydir).info().rev - except: + except py.process.cmdexec.Error: return 'unknown' # on windows people not always have 'svn' in their path class RunFileExternal(py.test.collect.Module): From hpk at codespeak.net Tue May 3 11:11:47 2005 From: hpk at codespeak.net (hpk at codespeak.net) Date: Tue, 3 May 2005 11:11:47 +0200 (CEST) Subject: [pypy-svn] r11832 - pypy/dist/pypy/tool/pytest Message-ID: <20050503091147.CC31A27B72@code1.codespeak.net> Author: hpk Date: Tue May 3 11:11:47 2005 New Revision: 11832 Modified: pypy/dist/pypy/tool/pytest/htmlreport.py Log: fix handling of unknown revisions Modified: pypy/dist/pypy/tool/pytest/htmlreport.py ============================================================================== --- pypy/dist/pypy/tool/pytest/htmlreport.py (original) +++ pypy/dist/pypy/tool/pytest/htmlreport.py Tue May 3 11:11:47 2005 @@ -56,9 +56,10 @@ maxresult = None for res in resultlist: resrev = res['pypy-revision'] - if resrev > maxrev: - maxrev = resrev - maxresult = res + if resrev != 'unknown': + if resrev > maxrev: + maxrev = resrev + maxresult = res assert maxresult if not checkerfunc or checkerfunc(maxresult): l.append(maxresult) From hpk at codespeak.net Tue May 3 11:17:35 2005 From: hpk at codespeak.net (hpk at codespeak.net) Date: Tue, 3 May 2005 11:17:35 +0200 (CEST) Subject: [pypy-svn] r11833 - pypy/dist/pypy/tool/pytest Message-ID: <20050503091735.1603127B72@code1.codespeak.net> Author: hpk Date: Tue May 3 11:17:34 2005 New Revision: 11833 Modified: pypy/dist/pypy/tool/pytest/htmlreport.py Log: try harder to get a meaningful revision number: skip timeouted results if we have non-timeouted ones Modified: pypy/dist/pypy/tool/pytest/htmlreport.py ============================================================================== --- pypy/dist/pypy/tool/pytest/htmlreport.py (original) +++ pypy/dist/pypy/tool/pytest/htmlreport.py Tue May 3 11:17:34 2005 @@ -56,11 +56,19 @@ maxresult = None for res in resultlist: resrev = res['pypy-revision'] - if resrev != 'unknown': + if resrev != 'unknown' and not res.istimeout(): if resrev > maxrev: maxrev = resrev maxresult = res - assert maxresult + if not maxresult: + for res in resultlist: + resrev = res['pypy-revision'] + if resrev != 'unknown': + if resrev > maxrev: + maxrev = resrev + maxresult = res + assert maxresult + if not checkerfunc or checkerfunc(maxresult): l.append(maxresult) return l From pedronis at codespeak.net Tue May 3 13:31:19 2005 From: pedronis at codespeak.net (pedronis at codespeak.net) Date: Tue, 3 May 2005 13:31:19 +0200 (CEST) Subject: [pypy-svn] r11843 - pypy/dist/pypy/interpreter Message-ID: <20050503113119.1EEEC27B6D@code1.codespeak.net> Author: pedronis Date: Tue May 3 13:31:18 2005 New Revision: 11843 Modified: pypy/dist/pypy/interpreter/function.py pypy/dist/pypy/interpreter/gateway.py pypy/dist/pypy/interpreter/typedef.py Log: changes to pass test_new: implementd function.__new__ Modified: pypy/dist/pypy/interpreter/function.py ============================================================================== --- pypy/dist/pypy/interpreter/function.py (original) +++ pypy/dist/pypy/interpreter/function.py Tue May 3 13:31:18 2005 @@ -10,6 +10,7 @@ from pypy.interpreter.baseobjspace import Wrappable from pypy.interpreter.argument import Arguments from pypy.interpreter.eval import Code +from pypy.interpreter.gateway import NoneNotWrapped class Function(Wrappable): """A function is a code object captured with some environment: @@ -50,6 +51,43 @@ # unwrapping is done through unwrap_specs in typedef.py + def descr_method__new__(space, w_subtype, w_code, w_globals, w_name=None, w_argdefs=None, w_closure=NoneNotWrapped): + code = space.interpclass_w(w_code) + if code is None or not isinstance(code, Code): + raise OperationError(space.w_TypeError, space.wrap("expected code")) + if not space.is_true(space.isinstance(w_globals, space.w_dict)): + raise OperationError(space.w_TypeError, space.wrap("expected dict")) + if not space.is_w(w_name, space.w_None): + name = space.str_w(w_name) + else: + name = None + if not space.is_w(w_argdefs, space.w_None): + defs_w = space.unpackiterable(w_argdefs) + else: + defs_w = [] + if w_closure is None: + closure = None + elif not space.is_w(space.type(w_closure), space.w_tuple): + raise OperationError(space.w_TypeError, space.wrap("invalid closure")) + else: + from pypy.interpreter.pycode import PyCode + from pypy.interpreter.nestedscope import Cell + closure_w = space.unpackiterable(w_closure) + n = len(closure_w) + if not isinstance(code, PyCode) or len(code.co_freevars) == 0: + raise OperationError(space.w_ValueError, space.wrap("no closure needed")) + elif len(code.co_freevars) != n: + raise OperationError(space.w_ValueError, space.wrap("closure is wrong size")) + closure = [] + for w_cell in closure_w: + cell = space.interpclass_w(w_cell) + if not isinstance(cell, Cell): + raise OperationError(space.w_TypeError, space.wrap("non-cell in closure")) + closure.append(cell) + func = space.allocate_instance(Function, w_subtype) + func.__init__(space, code, w_globals, defs_w, closure, name) + return space.wrap(func) + def descr_function_get(self, w_obj, w_cls=None): space = self.space wrap = space.wrap Modified: pypy/dist/pypy/interpreter/gateway.py ============================================================================== --- pypy/dist/pypy/interpreter/gateway.py (original) +++ pypy/dist/pypy/interpreter/gateway.py Tue May 3 13:31:18 2005 @@ -9,6 +9,8 @@ import types, sys, md5, os +NoneNotWrapped = object() + from pypy.tool import hack from pypy.interpreter.error import OperationError from pypy.interpreter import eval @@ -22,8 +24,6 @@ # internal non-translatable parts: from pypy.tool.getpy import py # XXX from interpreter/ we get py.py -NoneNotWrapped = object() - class Signature: "NOT_RPYTHON" def __init__(self, func=None, argnames=None, varargname=None, Modified: pypy/dist/pypy/interpreter/typedef.py ============================================================================== --- pypy/dist/pypy/interpreter/typedef.py (original) +++ pypy/dist/pypy/interpreter/typedef.py Tue May 3 13:31:18 2005 @@ -391,6 +391,7 @@ getset_func_dict = GetSetProperty(descr_get_dict, descr_set_dict, cls=Function) Function.typedef = TypeDef("function", + __new__ = interp2app(Function.descr_method__new__.im_func), __call__ = interp2app(Function.descr_function_call, unwrap_spec=['self', Arguments]), __get__ = interp2app(Function.descr_function_get), From hpk at codespeak.net Tue May 3 14:09:03 2005 From: hpk at codespeak.net (hpk at codespeak.net) Date: Tue, 3 May 2005 14:09:03 +0200 (CEST) Subject: [pypy-svn] r11847 - in pypy/dist/pypy/tool/pytest: . test Message-ID: <20050503120903.CC74F27B7B@code1.codespeak.net> Author: hpk Date: Tue May 3 14:09:03 2005 New Revision: 11847 Added: pypy/dist/pypy/tool/pytest/overview.py pypy/dist/pypy/tool/pytest/test/ (props changed) pypy/dist/pypy/tool/pytest/test/__init__.py - copied unchanged from r11839, pypy/dist/pypy/tool/pytest/__init__.py pypy/dist/pypy/tool/pytest/test/test_overview.py Modified: pypy/dist/pypy/tool/pytest/genreportdata.py pypy/dist/pypy/tool/pytest/htmlreport.py pypy/dist/pypy/tool/pytest/result.py Log: separate result parsing from reporting some more Modified: pypy/dist/pypy/tool/pytest/genreportdata.py ============================================================================== --- pypy/dist/pypy/tool/pytest/genreportdata.py (original) +++ pypy/dist/pypy/tool/pytest/genreportdata.py Tue May 3 14:09:03 2005 @@ -15,7 +15,7 @@ print "traversing", mydir rep = htmlreport.HtmlReport() - rep.parse_all(testresultdir) + rep.parselatest() print "making html files" rep.makeindex(testresultdir.join('index.html')) Modified: pypy/dist/pypy/tool/pytest/htmlreport.py ============================================================================== --- pypy/dist/pypy/tool/pytest/htmlreport.py (original) +++ pypy/dist/pypy/tool/pytest/htmlreport.py Tue May 3 14:09:03 2005 @@ -7,6 +7,7 @@ import sys, os, re import py from pypy.tool.pytest import result +from pypy.tool.pytest.overview import ResultCache # # various interesting path objects @@ -16,63 +17,14 @@ class HtmlReport(object): def __init__(self): - self.results = [] - self.name2result = {} - - def parse_all(self, testresultdir): - def filefilter(p): - return p.check(fnmatch='test_*.txt', file=1) - def rec(p): - return p.check(dotfile=0) - for x in testresultdir.visit(filefilter, rec): - self.parse_one(x) - - def parse_one(self, resultpath): - try: - res = result.ResultFromMime(resultpath) - ver = res['testreport-version'] - if ver != "1.1": - raise TypeError - except TypeError: - return - #else: - # print "sucess", resultpath - self.results.append(res) - name = res.fspath.purebasename - self.name2result.setdefault(name, []).append(res) - return res + self.resultcache = ResultCache() + def parselatest(self): + self.resultcache.parselatest() # # rendering # - def get_latest_results(self, checkerfunc=None): - names = self.name2result.keys() - names.sort(lambda x,y: cmp(x.lower(), y.lower())) - l = [] - for name in names: - resultlist = self.name2result[name] - maxrev = 0 - maxresult = None - for res in resultlist: - resrev = res['pypy-revision'] - if resrev != 'unknown' and not res.istimeout(): - if resrev > maxrev: - maxrev = resrev - maxresult = res - if not maxresult: - for res in resultlist: - resrev = res['pypy-revision'] - if resrev != 'unknown': - if resrev > maxrev: - maxrev = resrev - maxresult = res - assert maxresult - - if not checkerfunc or checkerfunc(maxresult): - l.append(maxresult) - return l - def render_latest_table(self, results): table = html.table( [html.th(x, align='left') @@ -137,11 +89,14 @@ return 'core' in result.get('options', []) coretests = [] noncoretests = [] - for x in self.get_latest_results() : - if iscore(x): - coretests.append(x) + for name in self.resultcache.getnames(): + result = self.resultcache.getlatest(name, error=1, ok=1) + if not result: + result = self.resultcache.getlatest(name) + if iscore(result): + coretests.append(result) else: - noncoretests.append(x) + noncoretests.append(result) return coretests, noncoretests # generate html files @@ -155,7 +110,7 @@ "core tests")) ok = len([x for x in coretests if x.isok()]) - err = len([x for x in coretests if x.iserr()]) + err = len([x for x in coretests if x.iserror()]) to = len([x for x in coretests if x.istimeout()]) sum = ok + err + to sum100 = sum / 100.0 @@ -191,7 +146,7 @@ def getresultcolor(result): if result.isok(): color = "#00ee00" - elif result.iserr(): + elif result.iserror(): color = "#ee0000" elif result.istimeout: color = "#0000ee" Added: pypy/dist/pypy/tool/pytest/overview.py ============================================================================== --- (empty file) +++ pypy/dist/pypy/tool/pytest/overview.py Tue May 3 14:09:03 2005 @@ -0,0 +1,50 @@ +from pypy.tool.pytest.confpath import testresultdir +from pypy.tool.pytest import result + + +class ResultCache: + def __init__(self): + self.name2result = {} + + def parselatest(self): + def filefilter(p): + return p.check(fnmatch='test_*.txt', file=1) + def rec(p): + return p.check(dotfile=0) + for x in testresultdir.visit(filefilter, rec): + self.parse_one(x) + + def parse_one(self, resultpath): + try: + res = result.ResultFromMime(resultpath) + ver = res['testreport-version'] + if ver != "1.1": + raise TypeError + except TypeError: + return + name = res.fspath.purebasename + self.name2result.setdefault(name, []).append(res) + return res + + def getnames(self): + return self.name2result.keys() + + def getlatest(self, name, timeout=0, error=0, ok=0): + l = [] + resultlist = self.name2result[name] + maxrev = 0 + maxresult = None + for res in resultlist: + resrev = res['pypy-revision'] + if resrev == 'unknown': + continue + if resrev <= maxrev: + continue + if timeout or error or ok: + if not (timeout and res.istimeout() or + error and res.iserror() or + ok and res.isok()): + continue + maxrev = resrev + maxresult = res + return maxresult Modified: pypy/dist/pypy/tool/pytest/result.py ============================================================================== --- pypy/dist/pypy/tool/pytest/result.py (original) +++ pypy/dist/pypy/tool/pytest/result.py Tue May 3 14:09:03 2005 @@ -66,7 +66,7 @@ def isok(self): return self['outcome'].lower() == 'ok' - def iserr(self): + def iserror(self): return self['outcome'].lower()[:3] == 'err' def istimeout(self): return self['outcome'].lower() == 't/o' @@ -96,6 +96,11 @@ fn = submsg.get_filename() assert fn self.addnamedtext(fn, submsg.get_payload()) + def __repr__(self): + return '<%s (%s) %r rev=%s>' %(self.__class__.__name__, + self['outcome'], + self.fspath.purebasename, + self['pypy-revision']) def stdinit(result): import getpass Added: pypy/dist/pypy/tool/pytest/test/test_overview.py ============================================================================== --- (empty file) +++ pypy/dist/pypy/tool/pytest/test/test_overview.py Tue May 3 14:09:03 2005 @@ -0,0 +1,20 @@ + +import py +from pypy.tool.pytest.overview import ResultCache + +class TestResultCache: + def setup_class(cls): + cls.rc = ResultCache() + cls.rc.parselatest() + + def test_getlatest_all(self): + for type in 'error', 'timeout', 'ok': + for name in self.rc.getnames(): + result = self.rc.getlatest(name, **{type:1}) + if result: + meth = getattr(result, 'is'+type) + assert meth() + + def test_getlatest_datetime(self): + result = self.rc.getlatest('test_datetime', ok=1) + assert result From pedronis at codespeak.net Tue May 3 14:20:43 2005 From: pedronis at codespeak.net (pedronis at codespeak.net) Date: Tue, 3 May 2005 14:20:43 +0200 (CEST) Subject: [pypy-svn] r11850 - pypy/dist/pypy/tool/pytest Message-ID: <20050503122043.1F84F27B82@code1.codespeak.net> Author: pedronis Date: Tue May 3 14:20:42 2005 New Revision: 11850 Modified: pypy/dist/pypy/tool/pytest/regrverbose.py Log: some tests (e.g. test_pkg) when run as __main__ consider they args! Modified: pypy/dist/pypy/tool/pytest/regrverbose.py ============================================================================== --- pypy/dist/pypy/tool/pytest/regrverbose.py (original) +++ pypy/dist/pypy/tool/pytest/regrverbose.py Tue May 3 14:20:42 2005 @@ -1,4 +1,5 @@ import sys from test import test_support -test_support.verbose = False -execfile(sys.argv[1]) +test_support.verbose = False +sys.argv[:] = sys.argv[1:] +execfile(sys.argv[0]) From cfbolz at codespeak.net Tue May 3 14:32:40 2005 From: cfbolz at codespeak.net (cfbolz at codespeak.net) Date: Tue, 3 May 2005 14:32:40 +0200 (CEST) Subject: [pypy-svn] r11852 - pypy/dist/pypy/module/builtin Message-ID: <20050503123240.BFC5B27B82@code1.codespeak.net> Author: cfbolz Date: Tue May 3 14:32:40 2005 New Revision: 11852 Modified: pypy/dist/pypy/module/builtin/app_complex.py Log: Somewhat hackish (and probably not platform independent) attempt to make test_complex pass. Modified: pypy/dist/pypy/module/builtin/app_complex.py ============================================================================== --- pypy/dist/pypy/module/builtin/app_complex.py (original) +++ pypy/dist/pypy/module/builtin/app_complex.py Tue May 3 14:32:40 2005 @@ -47,12 +47,8 @@ re = co.real im = co.imag else: - try: - re = float(real) - except ValueError: - raise ValueError, "complex() argument must be a string or a number" + re = float(real) im = 0.0 - if isinstance(imag, (str, unicode)): msg = "complex() second arg can't be a string" raise TypeError, msg @@ -60,11 +56,7 @@ re -= imag.imag im += imag.real elif imag is not None: - try: - im += float(imag) - except ValueError: - raise ValueError, "complex() argument must be a string or a number" - + im += float(imag) real_slot.__set__(self, re) imag_slot.__set__(self, im) @@ -89,9 +81,15 @@ y = y[:-1] if len(y) <= 1: y += "1" - return 0, float(y) + f = float(y) + if abs(f) == float("inf"): + raise ValueError, "float() out of range: %s" % y + return 0, f if y == "": - return float(x), 0 + f = float(x) + if abs(f) == float("inf"): + raise ValueError, "float() out of range: %s" % x + return f, 0 if y[-1] != "j": raise ValueError, "complex() arg is a malformed string" assert y[-1] == "j" @@ -99,10 +97,17 @@ if y == "": if x in "+-": x += "1.0" - return 0, float(x) + f = float(x) + if abs(f) == float("inf"): + raise ValueError, "float() out of range: %s" % x + return 0, f if y in "+-": y += "1.0" - return float(x), float(y) + x = float(x) + y = float(y) + if abs(x) == float("inf") or abs(y) == float("inf"): + raise ValueError, "float() out of range: %s" % y + return x, y def __description(self, precision): if self.real != 0.: From arigo at codespeak.net Tue May 3 14:47:12 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Tue, 3 May 2005 14:47:12 +0200 (CEST) Subject: [pypy-svn] r11854 - pypy/dist/pypy/interpreter Message-ID: <20050503124712.5BD9C27B3D@code1.codespeak.net> Author: arigo Date: Tue May 3 14:47:12 2005 New Revision: 11854 Modified: pypy/dist/pypy/interpreter/argument.py Log: Tweaking the wrong-number-of-arguments error messages. Modified: pypy/dist/pypy/interpreter/argument.py ============================================================================== --- pypy/dist/pypy/interpreter/argument.py (original) +++ pypy/dist/pypy/interpreter/argument.py Tue May 3 14:47:12 2005 @@ -61,7 +61,7 @@ # maybe we could allow general mappings? if not space.is_true(space.isinstance(w_starstararg, space.w_dict)): raise OperationError(space.w_TypeError, - space.wrap("the keywords must be " + space.wrap("argument after ** must be " "a dictionary")) d = self.kwds_w.copy() # don't change the original yet, # in case something goes wrong @@ -181,7 +181,7 @@ raise ArgErrMultipleValues(name) remainingkwds_w = kwds_w.copy() - not_enough = False + missing = 0 if input_argcount < co_argcount: # not enough args, fill in kwargs or defaults if exists def_first = co_argcount - len(defaults_w) @@ -195,8 +195,8 @@ else: # error: not enough arguments. Don't signal it immediately # because it might be related to a problem with */** or - # keyword arguments, will be checked for below. - not_enough = True + # keyword arguments, which will be checked for below. + missing += 1 # collect extra positional arguments into the *vararg if varargname is not None: @@ -205,7 +205,7 @@ else: # shortcut for the non-unpack() case above scope_w.append(self.w_stararg) elif len(args_w) > co_argcount: - raise ArgErrCount(signature, defaults_w, True) + raise ArgErrCount(signature, defaults_w, 0) # collect extra keyword arguments into the **kwarg if kwargname is not None: @@ -216,8 +216,8 @@ elif remainingkwds_w: raise ArgErrUnknownKwds(remainingkwds_w) - if not_enough: - raise ArgErrCount(signature, defaults_w, False) + if missing: + raise ArgErrCount(signature, defaults_w, missing) return scope_w ### Argument <-> list of w_objects together with "shape" information @@ -267,20 +267,23 @@ class ArgErrCount(ArgErr): - def __init__(self, signature, defaults_w, too_many): - self.signature = signature - self.defaults_w = defaults_w - self.too_many = too_many + def __init__(self, signature, defaults_w, missing_args): + self.signature = signature + self.defaults_w = defaults_w + self.missing_args = missing_args def getmsg(self, args, fnname): argnames, varargname, kwargname = self.signature args_w, kwds_w = args.unpack() - nargs = len(args_w) if kwargname is not None or (kwds_w and self.defaults_w): msg2 = "non-keyword " + if self.missing_args: + nargs = len(argnames) - self.missing_args + else: + nargs = len(args_w) else: msg2 = "" - nargs += len(kwds_w) + nargs = len(args_w) + len(kwds_w) n = len(argnames) if n == 0: msg = "%s() takes no %sargument (%d given)" % ( @@ -291,7 +294,7 @@ defcount = len(self.defaults_w) if defcount == 0 and varargname is None: msg1 = "exactly" - elif self.too_many: + elif not self.missing_args: msg1 = "at most" else: msg1 = "at least" From arigo at codespeak.net Tue May 3 15:03:25 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Tue, 3 May 2005 15:03:25 +0200 (CEST) Subject: [pypy-svn] r11856 - pypy/dist/pypy/lib Message-ID: <20050503130325.2907D27B42@code1.codespeak.net> Author: arigo Date: Tue May 3 15:03:24 2005 New Revision: 11856 Modified: pypy/dist/pypy/lib/cPickle.py Log: Some temporary dark magic to produce pickled dumps that are closer to the ones produced by cPickle in CPython. Modified: pypy/dist/pypy/lib/cPickle.py ============================================================================== --- pypy/dist/pypy/lib/cPickle.py (original) +++ pypy/dist/pypy/lib/cPickle.py Tue May 3 15:03:24 2005 @@ -16,3 +16,23 @@ class BadPickleGet(UnpicklingError): pass + +# ____________________________________________________________ +# XXX some temporary dark magic to produce pickled dumps that are +# closer to the ones produced by cPickle in CPython + +from pickle import StringIO + +PythonPickler = Pickler +class Pickler(PythonPickler): + def memoize(self, obj): + self.memo[None] = None # cPickle starts counting at one + return PythonPickler.memoize(self, obj) + +def dump(obj, file, protocol=None, bin=None): + Pickler(file, protocol, bin).dump(obj) + +def dumps(obj, protocol=None, bin=None): + file = StringIO() + Pickler(file, protocol, bin).dump(obj) + return file.getvalue() From hpk at codespeak.net Tue May 3 15:06:39 2005 From: hpk at codespeak.net (hpk at codespeak.net) Date: Tue, 3 May 2005 15:06:39 +0200 (CEST) Subject: [pypy-svn] r11857 - pypy/dist/lib-python Message-ID: <20050503130639.0AD1727B42@code1.codespeak.net> Author: hpk Date: Tue May 3 15:06:38 2005 New Revision: 11857 Modified: pypy/dist/lib-python/conftest.py Log: get rid of superflous options now that there is proper keyword support Modified: pypy/dist/lib-python/conftest.py ============================================================================== --- pypy/dist/lib-python/conftest.py (original) +++ pypy/dist/lib-python/conftest.py Tue May 3 15:06:38 2005 @@ -35,12 +35,6 @@ Option = py.test.Config.Option option = py.test.Config.addoptions("compliance testing options", - Option('-A', '--all', action="store_true", - default=False, dest="withall", - help="include all tests (instead of just core tests)."), - Option('-N', '--noncore', action="store_true", - default=False, dest="noncore", - help="include only non-core tests"), Option('-E', '--extracttests', action="store_true", default=False, dest="extracttests", help="try to extract single tests and run them via py.test/PyPy"), @@ -715,8 +709,6 @@ type. XXX If you find errors in the classification please correct them! """ - testmap = testmap - def get(self, name, cache={}): if not cache: for x in testmap: @@ -724,11 +716,7 @@ return cache.get(name, None) def run(self): - l = [] - for x in self.testmap: - if ((not not x.core) ^ (pypy_option.noncore)) or pypy_option.withall: - l.append(x.basename) - return l + return [x.basename for x in testmap] def join(self, name): regrtest = self.get(name) @@ -786,6 +774,19 @@ import getpass class ReallyRunFileExternal(py.test.Item): + _resultcache = None + def haskeyword(self, keyword): + if keyword == 'core': + return self.parent.regrtest.core + if keyword not in ('error', 'ok', 'timeout'): + return super(ReallyRunFileExternal, self).haskeyword(keyword) + if self._resultcache is None: + from pypy.tool.pytest.overview import ResultCache + self.__class__._resultcache = rc = ResultCache() + rc.parselatest() + result = self._resultcache.getlatest(self.fspath.purebasename, + **{keyword:True}) + return result is not None def getinvocation(self, regrtest): fspath = regrtest.getfspath() From pedronis at codespeak.net Tue May 3 15:17:42 2005 From: pedronis at codespeak.net (pedronis at codespeak.net) Date: Tue, 3 May 2005 15:17:42 +0200 (CEST) Subject: [pypy-svn] r11860 - in pypy/dist/pypy: lib module/builtin Message-ID: <20050503131742.ACEFF27B5B@code1.codespeak.net> Author: pedronis Date: Tue May 3 15:17:42 2005 New Revision: 11860 Modified: pypy/dist/pypy/lib/imp.py pypy/dist/pypy/module/builtin/importing.py Log: fixes to pass test_pkg; load_module should overwrite the prev mod.__dict__ contents; import star logic should possibly use __all__ as fromlist for a package Modified: pypy/dist/pypy/lib/imp.py ============================================================================== --- pypy/dist/pypy/lib/imp.py (original) +++ pypy/dist/pypy/lib/imp.py Tue May 3 15:17:42 2005 @@ -51,7 +51,6 @@ co = compile(source, filename, 'exec') if module is None: sys.modules[name] = module = new_module(name) - module.__dict__.clear() module.__name__ = name module.__doc__ = None module.__file__ = filename @@ -62,7 +61,6 @@ initfilename = os.path.join(filename, '__init__.py') if module is None: sys.modules[name] = module = new_module(name) - module.__dict__.clear() module.__name__ = name module.__doc__ = None module.__file__ = initfilename Modified: pypy/dist/pypy/module/builtin/importing.py ============================================================================== --- pypy/dist/pypy/module/builtin/importing.py (original) +++ pypy/dist/pypy/module/builtin/importing.py Tue May 3 15:17:42 2005 @@ -21,6 +21,7 @@ w_mod = space.wrap(Module(space, w_modulename)) space.sys.setmodule(w_mod) space.setattr(w_mod, w('__file__'), w(f)) + space.setattr(w_mod, w('__doc__'), space.w_None) if pkgdir is not None: space.setattr(w_mod, w('__path__'), space.newlist([w(pkgdir)])) w_dict = space.getattr(w_mod, w('__dict__')) @@ -137,9 +138,15 @@ if w_fromlist is not None and space.is_true(w_fromlist): if w_path is not None: - for w_name in space.unpackiterable(w_fromlist): - load_part(space, w_path, prefix, space.str_w(w_name), w_mod, - tentative=1) + fromlist_w = space.unpackiterable(w_fromlist) + if len(fromlist_w) == 1 and space.eq_w(fromlist_w[0],w('*')): + w_all = try_getattr(space, w_mod, w('__all__')) + if w_all is not None: + fromlist_w = space.unpackiterable(w_all) + for w_name in fromlist_w: + if try_getattr(space, w_mod, w_name) is None: + load_part(space, w_path, prefix, space.str_w(w_name), w_mod, + tentative=1) return w_mod else: return first From arigo at codespeak.net Tue May 3 15:18:22 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Tue, 3 May 2005 15:18:22 +0200 (CEST) Subject: [pypy-svn] r11862 - pypy/dist/pypy/interpreter Message-ID: <20050503131822.7CD0227B5C@code1.codespeak.net> Author: arigo Date: Tue May 3 15:18:22 2005 New Revision: 11862 Modified: pypy/dist/pypy/interpreter/argument.py Log: More tweaks of the argument parsing error messages. Modified: pypy/dist/pypy/interpreter/argument.py ============================================================================== --- pypy/dist/pypy/interpreter/argument.py (original) +++ pypy/dist/pypy/interpreter/argument.py Tue May 3 15:18:22 2005 @@ -278,7 +278,8 @@ if kwargname is not None or (kwds_w and self.defaults_w): msg2 = "non-keyword " if self.missing_args: - nargs = len(argnames) - self.missing_args + required_args = len(argnames) - len(self.defaults_w) + nargs = required_args - self.missing_args else: nargs = len(args_w) else: From pedronis at codespeak.net Tue May 3 15:48:06 2005 From: pedronis at codespeak.net (pedronis at codespeak.net) Date: Tue, 3 May 2005 15:48:06 +0200 (CEST) Subject: [pypy-svn] r11866 - pypy/dist/pypy/module/builtin Message-ID: <20050503134806.6815927B5F@code1.codespeak.net> Author: pedronis Date: Tue May 3 15:48:06 2005 New Revision: 11866 Modified: pypy/dist/pypy/module/builtin/importing.py Log: changes to pass test_pkgimport: in 2.3 SyntaxErrors (and only those) results in no module being put in sys.modules Modified: pypy/dist/pypy/module/builtin/importing.py ============================================================================== --- pypy/dist/pypy/module/builtin/importing.py (original) +++ pypy/dist/pypy/module/builtin/importing.py Tue May 3 15:48:06 2005 @@ -25,10 +25,22 @@ if pkgdir is not None: space.setattr(w_mod, w('__path__'), space.newlist([w(pkgdir)])) w_dict = space.getattr(w_mod, w('__dict__')) - space.builtin.call('execfile', w(f), w_dict, w_dict) + e = None + try: + space.builtin.call('execfile', w(f), w_dict, w_dict) + except OperationError, e: + if e.match(space, space.w_SyntaxError): + w_mods = space.sys.get('modules') + try: + space.delitem(w_mods, w_modulename) + except OperationError, e: + if not e.match(space, space.w_KeyError): + raise w_mod = check_sys_modules(space, w_modulename) if w_mod is not None and w_parent is not None: space.setattr(w_parent, w_name, w_mod) + if e: + raise e return w_mod else: return None From hpk at codespeak.net Tue May 3 16:43:26 2005 From: hpk at codespeak.net (hpk at codespeak.net) Date: Tue, 3 May 2005 16:43:26 +0200 (CEST) Subject: [pypy-svn] r11869 - pypy/dist/lib-python Message-ID: <20050503144326.0CCE927B5F@code1.codespeak.net> Author: hpk Date: Tue May 3 16:43:25 2005 New Revision: 11869 Modified: pypy/dist/lib-python/conftest.py Log: use a more permanent tempdirectory and clean it up after use Modified: pypy/dist/lib-python/conftest.py ============================================================================== --- pypy/dist/lib-python/conftest.py (original) +++ pypy/dist/lib-python/conftest.py Tue May 3 16:43:25 2005 @@ -842,16 +842,19 @@ py.test.fail(result['outcome']) def getstatusouterr(self, cmd): - tempdir = py.test.ensuretemp('regrtest') - stdout = tempdir.join(self.fspath.basename) + '.out' - stderr = tempdir.join(self.fspath.basename) + '.err' - - status = os.system("%s >>%s 2>>%s" %(cmd, stdout, stderr)) - if os.WIFEXITED(status): - status = os.WEXITSTATUS(status) - else: - status = 'abnormal termination 0x%x' % status - return status, stdout.read(), stderr.read() + tempdir = py.path.local.mkdtemp() + try: + stdout = tempdir.join(self.fspath.basename) + '.out' + stderr = tempdir.join(self.fspath.basename) + '.err' + + status = os.system("%s >>%s 2>>%s" %(cmd, stdout, stderr)) + if os.WIFEXITED(status): + status = os.WEXITSTATUS(status) + else: + status = 'abnormal termination 0x%x' % status + return status, stdout.read(), stderr.read() + finally: + tempdir.remove() def getresult(self, regrtest): cmd = self.getinvocation(regrtest) From hpk at codespeak.net Tue May 3 16:51:27 2005 From: hpk at codespeak.net (hpk at codespeak.net) Date: Tue, 3 May 2005 16:51:27 +0200 (CEST) Subject: [pypy-svn] r11870 - pypy/dist/lib-python/modified-2.3.4/test Message-ID: <20050503145127.20BF827B5F@code1.codespeak.net> Author: hpk Date: Tue May 3 16:51:26 2005 New Revision: 11870 Added: pypy/dist/lib-python/modified-2.3.4/test/test_cpickle.py - copied, changed from r11868, pypy/dist/lib-python/2.3.4/test/test_cpickle.py Log: move test_cpickle.py to modified so that it can pick up the correct "pickletester.py" module which is also in modified. Also changed the import to be an absolute import because currently 'py.py' does not handle sys.path correctly. Copied: pypy/dist/lib-python/modified-2.3.4/test/test_cpickle.py (from r11868, pypy/dist/lib-python/2.3.4/test/test_cpickle.py) ============================================================================== --- pypy/dist/lib-python/2.3.4/test/test_cpickle.py (original) +++ pypy/dist/lib-python/modified-2.3.4/test/test_cpickle.py Tue May 3 16:51:26 2005 @@ -1,7 +1,7 @@ import cPickle import unittest from cStringIO import StringIO -from pickletester import AbstractPickleTests, AbstractPickleModuleTests +from test.pickletester import AbstractPickleTests, AbstractPickleModuleTests from test import test_support class cPickleTests(AbstractPickleTests, AbstractPickleModuleTests): From hpk at codespeak.net Tue May 3 17:12:03 2005 From: hpk at codespeak.net (hpk at codespeak.net) Date: Tue, 3 May 2005 17:12:03 +0200 (CEST) Subject: [pypy-svn] r11874 - pypy/dist/lib-python Message-ID: <20050503151203.3032B27B60@code1.codespeak.net> Author: hpk Date: Tue May 3 17:12:02 2005 New Revision: 11874 Modified: pypy/dist/lib-python/conftest.py Log: added some analysis about why test_global.py test_optparse.py are failing. Modified: pypy/dist/lib-python/conftest.py ============================================================================== --- pypy/dist/lib-python/conftest.py (original) +++ pypy/dist/lib-python/conftest.py Tue May 3 17:12:02 2005 @@ -468,6 +468,10 @@ RegrTest('test_gl.py', enabled=False, dumbtest=1), RegrTest('test_glob.py', enabled=True, core=True), RegrTest('test_global.py', enabled=False, core=True), + # this fails because it relies on the warnings module + # turning a warning into an exception, but PyPy's + # interplevel doesn't call into the app-level warnings + # module RegrTest('test_grammar.py', enabled=False, core=True), RegrTest('test_grp.py', enabled=False), #rev 10840: ImportError: grp @@ -532,6 +536,10 @@ RegrTest('test_operations.py', enabled=False, core=True), RegrTest('test_operator.py', enabled=True, core=True), RegrTest('test_optparse.py', enabled=False, core="maybe"), + # this test fails because it expects that PyPy's builtin + # functions act as if they are staticmethods that can be put + # on classes and don't get bound etc.pp. + RegrTest('test_os.py', enabled=True, core=True), RegrTest('test_ossaudiodev.py', enabled=False), RegrTest('test_parser.py', enabled=False), From pedronis at codespeak.net Tue May 3 17:17:05 2005 From: pedronis at codespeak.net (pedronis at codespeak.net) Date: Tue, 3 May 2005 17:17:05 +0200 (CEST) Subject: [pypy-svn] r11875 - pypy/dist/pypy/interpreter/test Message-ID: <20050503151705.5781027B60@code1.codespeak.net> Author: pedronis Date: Tue May 3 17:17:05 2005 New Revision: 11875 Modified: pypy/dist/pypy/interpreter/test/test_py.py Log: test (for now failing) that traceback exceptions are normalized Modified: pypy/dist/pypy/interpreter/test/test_py.py ============================================================================== --- pypy/dist/pypy/interpreter/test/test_py.py (original) +++ pypy/dist/pypy/interpreter/test/test_py.py Tue May 3 17:17:05 2005 @@ -64,3 +64,28 @@ (sys.executable, pypath, tmpfilepath) ) assert output.splitlines()[-1] == str([tmpfilepath,'hello']) + +TB_NORMALIZATION_CHK= """ +class K(object): + def __repr__(self): + return "" + def __str__(self): + return "-not normalized-" + +{}[K()] +""" + +def test_tb_normalization(): + tmpfilepath = str(udir.join("test_py_script.py")) + tmpfile = file( tmpfilepath, "w" ) + tmpfile.write(TB_NORMALIZATION_CHK) + tmpfile.close() + + e = None + try: + output = py.process.cmdexec( '''"%s" "%s" "%s" ''' % + (sys.executable, pypath, tmpfilepath) ) + except py.process.cmdexec.Error, e: + pass + assert e," expected failure" + assert e.err.splitlines()[-1] == 'KeyError: ' From arigo at codespeak.net Tue May 3 17:31:48 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Tue, 3 May 2005 17:31:48 +0200 (CEST) Subject: [pypy-svn] r11876 - in pypy/dist/pypy: interpreter module/sys2 Message-ID: <20050503153148.2A74327B60@code1.codespeak.net> Author: arigo Date: Tue May 3 17:31:47 2005 New Revision: 11876 Modified: pypy/dist/pypy/interpreter/interactive.py pypy/dist/pypy/interpreter/main.py pypy/dist/pypy/interpreter/py.py pypy/dist/pypy/module/sys2/__init__.py pypy/dist/pypy/module/sys2/app.py Log: Cleaned up a bit py.py / main.py / interactive.py, implementing a more complete exception behavior: normalization, calling sys.excepthook(), ... Modified: pypy/dist/pypy/interpreter/interactive.py ============================================================================== --- pypy/dist/pypy/interpreter/interactive.py (original) +++ pypy/dist/pypy/interpreter/interactive.py Tue May 3 17:31:47 2005 @@ -159,52 +159,11 @@ def runcode(self, code): # 'code' is a CPython code object - from pypy.interpreter.pycode import PyCode - pycode = PyCode(self.space)._from_code(code) - try: - self.settrace() - pycode.exec_code(self.space, self.w_globals, self.w_globals) - self.checktrace() - - except error.OperationError, operationerr: - space = self.space - try: - if operationerr.match(space, space.w_SystemExit): - w_exitcode = space.getattr(operationerr.w_value, - space.wrap('code')) - if space.is_w(w_exitcode, space.w_None): - exitcode = 0 - else: - try: - exitcode = space.int_w(w_exitcode) - except error.OperationError: - # not an integer: print it to stderr - msg = space.str_w(space.str(w_exitcode)) - print >> sys.stderr, msg - exitcode = 1 - raise SystemExit(exitcode) - space.setitem(space.sys.w_dict, space.wrap('last_type'), - operationerr.w_type) - space.setitem(space.sys.w_dict, space.wrap('last_value'), - operationerr.w_value) - space.setitem(space.sys.w_dict, space.wrap('last_traceback'), - space.wrap(operationerr.application_traceback)) - except error.OperationError, operationerr: - pass # let the code below print any error we get above - if self.verbose: - operationerr.print_detailed_traceback(space) - else: - operationerr.print_application_traceback(space) - # for debugging convenience we also insert the exception into - # the interpreter-level sys.last_xxx - sys.last_type, sys.last_value, sys.last_traceback = sys.exc_info() - else: - try: - if sys.stdout.softspace: - print - except AttributeError: - # Don't crash if user defined stdout doesn't have softspace - pass + self.settrace() + main.run_toplevel_program(self.space, code, + w_globals=self.w_globals, + verbose=self.verbose) + self.checktrace() def runsource(self, source, ignored_filename="", symbol="single"): hacked_filename = '' + source Modified: pypy/dist/pypy/interpreter/main.py ============================================================================== --- pypy/dist/pypy/interpreter/main.py (original) +++ pypy/dist/pypy/interpreter/main.py Tue May 3 17:31:47 2005 @@ -1,7 +1,8 @@ import autopath -from pypy.interpreter import executioncontext, module +from pypy.interpreter import executioncontext, module, eval from pypy.interpreter.error import OperationError -import sys +from pypy.interpreter.pycode import PyCode +import sys, types def ensure__main__(space): w_main = space.wrap('__main__') @@ -15,6 +16,18 @@ space.setitem(w_modules, w_main, mainmodule) return mainmodule +def compilecode(space, source, filename, cmd='exec'): + if isinstance(source, types.CodeType): + pycode = PyCode(space)._from_code(source) + else: + w = space.wrap + w_code = space.builtin.call('compile', + w(source), w(filename), w(cmd), w(0), w(0)) + pycode = space.interpclass_w(w_code) + assert isinstance(pycode, eval.Code) + return pycode + + def _run_eval_string(source, filename, space, eval): if eval: cmd = 'eval' @@ -27,15 +40,14 @@ space = StdObjSpace() w = space.wrap - w_code = space.builtin.call('compile', - w(source), w(filename), w(cmd), w(0), w(0)) + + pycode = compilecode(space, source, filename, cmd) mainmodule = ensure__main__(space) w_globals = mainmodule.w_dict space.setitem(w_globals, w('__builtins__'), space.builtin) - pycode = space.interpclass_w(w_code) retval = pycode.exec_code(space, w_globals, w_globals) if eval: return retval @@ -57,3 +69,96 @@ print "Running %r with %r" % (filename, space) istring = open(filename).read() run_string(istring, filename, space) + +# ____________________________________________________________ + +def run_toplevel_program(space, source, filename='', + w_globals=None, verbose=False): + """Run the given source code in the given globals (or __main__ by default). + Intended use is to run the main program or one interactive statement. + It handles details like forwarding exceptions to sys.excepthook(), + catching SystemExit, printing a newline after sys.stdout if needed, etc. + """ + try: + # build a valid w_globals + if w_globals is None: + w_globals = ensure__main__(space).w_dict + w1 = space.wrap('__builtins__') + if not space.is_true(space.contains(w_globals, w1)): + space.setitem(w_globals, w1, space.builtin) + + # compile and execute the code + pycode = compilecode(space, source, filename) + pycode.exec_code(space, w_globals, w_globals) + + # we arrive here if no exception is raised. stdout cosmetics... + try: + w_stdout = space.sys.get('stdout') + w_softspace = space.getattr(w_stdout, space.wrap('softspace')) + except OperationError, e: + if not e.match(space, space.w_AttributeError): + raise + # Don't crash if user defined stdout doesn't have softspace + else: + if space.is_true(w_softspace): + space.call_method(w_stdout, 'write', space.wrap('\n')) + + except OperationError, operationerr: + operationerr.normalize_exception(space) + w_type = operationerr.w_type + w_value = operationerr.w_value + w_traceback = space.wrap(operationerr.application_traceback) + + # for debugging convenience we also insert the exception into + # the interpreter-level sys.last_xxx + operationerr.record_interpreter_traceback() + sys.last_type, sys.last_value, sys.last_traceback = sys.exc_info() + + try: + # exit if we catch a w_SystemExit + if operationerr.match(space, space.w_SystemExit): + w_exitcode = space.getattr(operationerr.w_value, + space.wrap('code')) + if space.is_w(w_exitcode, space.w_None): + exitcode = 0 + else: + try: + exitcode = space.int_w(w_exitcode) + except OperationError: + # not an integer: print it to stderr + msg = space.str_w(space.str(w_exitcode)) + print >> sys.stderr, msg + exitcode = 1 + raise SystemExit(exitcode) + + # set the sys.last_xxx attributes + space.setitem(space.sys.w_dict, space.wrap('last_type'), w_type) + space.setitem(space.sys.w_dict, space.wrap('last_value'), w_value) + space.setitem(space.sys.w_dict, space.wrap('last_traceback'), + w_traceback) + + # call sys.excepthook if present + w_hook = space.sys.getdictvalue(space, 'excepthook') + if w_hook is not None: + # hack: skip it if it wasn't modified by the user, + # to do instead the faster verbose/nonverbose thing below + w_original = space.sys.getdictvalue(space, '__excepthook__') + if w_original is None or not space.is_w(w_hook, w_original): + space.call_function(w_hook, w_type, w_value, w_traceback) + return 1 # done + + except OperationError, err2: + # XXX should we go through sys.get('stderr') ? + print >> sys.stderr, 'Error calling sys.excepthook:' + err2.print_application_traceback(space) + print >> sys.stderr + print >> sys.stderr, 'Original exception was:' + + # we only get here if sys.excepthook didn't do its job + if verbose: + operationerr.print_detailed_traceback(space) + else: + operationerr.print_application_traceback(space) + return 1 + + return 0 # success Modified: pypy/dist/pypy/interpreter/py.py ============================================================================== --- pypy/dist/pypy/interpreter/py.py (original) +++ pypy/dist/pypy/interpreter/py.py Tue May 3 17:31:47 2005 @@ -52,65 +52,117 @@ def main_(argv=None): starttime = time.time() - from pypy.tool import tb_server args = option.process_options(get_main_options(), Options, argv[1:]) - space = None - exit_status = 1 # until proven otherwise - # XXX should review what CPython's policy is for - # the exit status code - try: - space = option.objspace() - space._starttime = starttime - assert 'pypy.tool.udir' not in sys.modules, ( - "running py.py should not import pypy.tool.udir, which is\n" - "only for testing or translating purposes.") - go_interactive = Options.interactive - if Options.verbose: - error.RECORD_INTERPLEVEL_TRACEBACK = True - banner = '' - space.setitem(space.sys.w_dict,space.wrap('executable'),space.wrap(argv[0])) - if Options.command: - args = ['-c'] + Options.command[1:] - for arg in args: - space.call_method(space.sys.get('argv'), 'append', space.wrap(arg)) - try: - if Options.command: - main.run_string(Options.command[0], '', space) - elif args: - main.run_file(args[0], space) - else: - space.call_method(space.sys.get('argv'), 'append', space.wrap('')) - go_interactive = 1 - banner = None - exit_status = 0 - except error.OperationError, operationerr: - if Options.verbose: - operationerr.print_detailed_traceback(space) - else: - operationerr.print_application_traceback(space) - if go_interactive: - con = interactive.PyPyConsole(space, verbose=Options.verbose, completer=Options.completer) - if banner == '': - banner = '%s / %s'%(con.__class__.__name__, - repr(space)) - con.interact(banner) - except: - exc_type, value, tb = sys.exc_info() - sys.last_type = exc_type - sys.last_value = value - sys.last_traceback = tb - if issubclass(exc_type, SystemExit): - pass # don't print tracebacks for SystemExit - elif isinstance(value, error.OperationError): - value.print_detailed_traceback(space=space) - else: - sys.excepthook(exc_type, value, tb) - tb_server.wait_until_interrupt() - exit_status = 1 - - tb_server.stop() + if Options.verbose: + error.RECORD_INTERPLEVEL_TRACEBACK = True + + # create the object space + space = option.objspace() + space._starttime = starttime + assert 'pypy.tool.udir' not in sys.modules, ( + "running py.py should not import pypy.tool.udir, which is\n" + "only for testing or translating purposes.") + space.setitem(space.sys.w_dict,space.wrap('executable'),space.wrap(argv[0])) + + # store the command-line arguments into sys.argv + go_interactive = Options.interactive + banner = '' + exit_status = 0 + if Options.command: + args = ['-c'] + Options.command[1:] + for arg in args: + space.call_method(space.sys.get('argv'), 'append', space.wrap(arg)) + + # compile the program given as command-line argument + if Options.command: + filename = '' + fullsource = Options.command[0] + elif args: + filename = args[0] + fullsource = open(filename).read() + else: + filename = fullsource = None + space.call_method(space.sys.get('argv'), 'append', space.wrap('')) + go_interactive = 1 + banner = None + + # run it + if fullsource is not None: + exit_status = main.run_toplevel_program(space, fullsource, filename, + verbose=Options.verbose) + + # start the interactive console + if go_interactive: + con = interactive.PyPyConsole(space, verbose=Options.verbose, + completer=Options.completer) + if banner == '': + banner = '%s / %s'%(con.__class__.__name__, + repr(space)) + con.interact(banner) + exit_status = 0 return exit_status +##def main_(argv=None): +## starttime = time.time() +## from pypy.tool import tb_server +## args = option.process_options(get_main_options(), Options, argv[1:]) +## space = None +## exit_status = 1 # until proven otherwise +## # XXX should review what CPython's policy is for +## # the exit status code +## try: +## space = option.objspace() +## space._starttime = starttime +## assert 'pypy.tool.udir' not in sys.modules, ( +## "running py.py should not import pypy.tool.udir, which is\n" +## "only for testing or translating purposes.") +## go_interactive = Options.interactive +## if Options.verbose: +## error.RECORD_INTERPLEVEL_TRACEBACK = True +## banner = '' +## space.setitem(space.sys.w_dict,space.wrap('executable'),space.wrap(argv[0])) +## if Options.command: +## args = ['-c'] + Options.command[1:] +## for arg in args: +## space.call_method(space.sys.get('argv'), 'append', space.wrap(arg)) +## try: +## if Options.command: +## main.run_string(Options.command[0], '', space) +## elif args: +## main.run_file(args[0], space) +## else: +## space.call_method(space.sys.get('argv'), 'append', space.wrap('')) +## go_interactive = 1 +## banner = None +## exit_status = 0 +## except error.OperationError, operationerr: +## if Options.verbose: +## operationerr.print_detailed_traceback(space) +## else: +## operationerr.print_application_traceback(space) +## if go_interactive: +## con = interactive.PyPyConsole(space, verbose=Options.verbose, completer=Options.completer) +## if banner == '': +## banner = '%s / %s'%(con.__class__.__name__, +## repr(space)) +## con.interact(banner) +## except: +## exc_type, value, tb = sys.exc_info() +## sys.last_type = exc_type +## sys.last_value = value +## sys.last_traceback = tb +## if issubclass(exc_type, SystemExit): +## pass # don't print tracebacks for SystemExit +## elif isinstance(value, error.OperationError): +## value.print_detailed_traceback(space=space) +## else: +## sys.excepthook(exc_type, value, tb) +## tb_server.wait_until_interrupt() +## exit_status = 1 + +## tb_server.stop() +## return exit_status + if __name__ == '__main__': try: import readline Modified: pypy/dist/pypy/module/sys2/__init__.py ============================================================================== --- pypy/dist/pypy/module/sys2/__init__.py (original) +++ pypy/dist/pypy/module/sys2/__init__.py Tue May 3 17:31:47 2005 @@ -64,7 +64,7 @@ #'displayhook' : 'app.displayhook', #'__displayhook__' : 'app.__displayhook__', 'excepthook' : 'app.excepthook', - '__excepthook__' : 'app.__excepthook__', + '__excepthook__' : 'app.excepthook', 'exit' : 'app.exit', 'getfilesystemencoding' : 'app.getfilesystemencoding', 'callstats' : 'app.callstats', Modified: pypy/dist/pypy/module/sys2/app.py ============================================================================== --- pypy/dist/pypy/module/sys2/app.py (original) +++ pypy/dist/pypy/module/sys2/app.py Tue May 3 17:31:47 2005 @@ -7,13 +7,10 @@ import sys -# XXX not called by the core yet def excepthook(exctype, value, traceback): from traceback import print_exception print_exception(exctype, value, traceback) -__excepthook__ = excepthook # this is exactly like in CPython - def exit(exitcode=0): # note that we cannot use SystemExit(exitcode) here. # The comma version leads to an extra de-tupelizing From pedronis at codespeak.net Tue May 3 17:38:57 2005 From: pedronis at codespeak.net (pedronis at codespeak.net) Date: Tue, 3 May 2005 17:38:57 +0200 (CEST) Subject: [pypy-svn] r11877 - in pypy/dist/pypy: interpreter module/builtin Message-ID: <20050503153857.6014227B61@code1.codespeak.net> Author: pedronis Date: Tue May 3 17:38:57 2005 New Revision: 11877 Modified: pypy/dist/pypy/interpreter/pyopcode.py pypy/dist/pypy/module/builtin/compiling.py Log: subtle changes to 1) attach all the data to our SyntaxErrors 2) have .filename=None as in CPython for the eval and exec cases, more than one test depend on this so I went for tweaking PyPy instead of the tests Modified: pypy/dist/pypy/interpreter/pyopcode.py ============================================================================== --- pypy/dist/pypy/interpreter/pyopcode.py (original) +++ pypy/dist/pypy/interpreter/pyopcode.py Tue May 3 17:38:57 2005 @@ -878,7 +878,14 @@ else: raise TypeError("exec: arg 1 must be a string, file, " "or code object") - prog = compile(prog, filename, 'exec', compile_flags, 1) + try: + prog = compile(prog, filename, 'exec', compile_flags, 1) + except SyntaxError, e: # exec SyntaxErrors have filename==None + msg, loc = e.args + loc1 = (None,) + loc[1:] + e.args = msg, loc1 + e.filename = None + raise e return (prog, globals, locals) ''', filename=__file__) Modified: pypy/dist/pypy/module/builtin/compiling.py ============================================================================== --- pypy/dist/pypy/module/builtin/compiling.py (original) +++ pypy/dist/pypy/module/builtin/compiling.py Tue May 3 17:38:57 2005 @@ -33,7 +33,7 @@ # but here we only propagate the 'usual' ones, until we figure # out how to do it generically. except SyntaxError,e: - raise OperationError(space.w_SyntaxError,space.wrap(str(e))) + raise OperationError(space.w_SyntaxError,space.wrap(e.args)) except ValueError,e: raise OperationError(space.w_ValueError,space.wrap(str(e))) except TypeError,e: @@ -48,10 +48,21 @@ if (space.is_true(space.isinstance(w_code, space.w_str)) or space.is_true(space.isinstance(w_code, space.w_unicode))): - w_code = compile(space, - space.call_method(w_code, 'lstrip', - space.wrap(' \t')), - "", "eval") + try: + w_code = compile(space, + space.call_method(w_code, 'lstrip', + space.wrap(' \t')), + "", "eval") + except OperationError, e: + if e.match(space, space.w_SyntaxError): + e_value_w = space.unpacktuple(e.w_value) + e_loc_w = space.unpacktuple(e_value_w[1]) + e.w_value = space.newtuple([e_value_w[0], + space.newtuple([space.w_None]+ + e_loc_w[1:])]) + raise e + else: + raise codeobj = space.interpclass_w(w_code) if not isinstance(codeobj, PyCode): From hpk at codespeak.net Tue May 3 17:43:05 2005 From: hpk at codespeak.net (hpk at codespeak.net) Date: Tue, 3 May 2005 17:43:05 +0200 (CEST) Subject: [pypy-svn] r11879 - pypy/dist/lib-python Message-ID: <20050503154305.E85F027B6D@code1.codespeak.net> Author: hpk Date: Tue May 3 17:43:05 2005 New Revision: 11879 Modified: pypy/dist/lib-python/conftest.py Log: present more useful interactive information for the coarse grained run Modified: pypy/dist/lib-python/conftest.py ============================================================================== --- pypy/dist/lib-python/conftest.py (original) +++ pypy/dist/lib-python/conftest.py Tue May 3 17:43:05 2005 @@ -847,7 +847,8 @@ fn.write(result.repr_mimemessage().as_string(unixfrom=False)) if result['exit status']: time.sleep(0.5) # time for a Ctrl-C to reach us :-) - py.test.fail(result['outcome']) + print >>sys.stderr, result.getnamedtext('stderr') + py.test.fail("running test failed, see stderr output below") def getstatusouterr(self, cmd): tempdir = py.path.local.mkdtemp() From tismer at codespeak.net Tue May 3 19:16:38 2005 From: tismer at codespeak.net (tismer at codespeak.net) Date: Tue, 3 May 2005 19:16:38 +0200 (CEST) Subject: [pypy-svn] r11881 - in pypy/dist/pypy/translator/genc: . test Message-ID: <20050503171638.38F0527B72@code1.codespeak.net> Author: tismer Date: Tue May 3 19:16:37 2005 New Revision: 11881 Modified: pypy/dist/pypy/translator/genc/ctyper.py pypy/dist/pypy/translator/genc/g_support.h pypy/dist/pypy/translator/genc/int_include.h pypy/dist/pypy/translator/genc/test/test_typed.py Log: added a couple of new functions and macros, checking just for review. Modified: pypy/dist/pypy/translator/genc/ctyper.py ============================================================================== --- pypy/dist/pypy/translator/genc/ctyper.py (original) +++ pypy/dist/pypy/translator/genc/ctyper.py Tue May 3 19:16:37 2005 @@ -25,6 +25,52 @@ self.TInt = TInt = t.getconcretetype(CIntType) self.TNone = TNone = t.getconcretetype(CNoneType) self.TPyObject = TPyObject = t.getconcretetype(CPyObjectType) + + specializationtable = [ + ## op specialized op arg types concrete return type + ('is_true', 'int_is_true', TInt, TInt), + ] + ii_i = (TInt, TInt, TInt) + for op in "eq ne le gt lt ge cmp".split(): + specializationtable.extend([ + ('%s' % op, 'int_%s' % op) + ii_i, + ]) + for op in "add sub mul".split(): + specializationtable.extend([ + ('%s' % op, 'int_%s' % op) + ii_i, + ('inplace_%s' % op, 'int_%s' % op) + ii_i, + ('%s_ovf' % op, 'int_%s_ovf' % op) + ii_i, + ('inplace_%s_ovf' % op, 'int_%s_ovf' % op) + ii_i, + ]) + for op in "rshift".split(): + specializationtable.extend([ + ('%s' % op, 'int_%s' % op) + ii_i, + ('inplace_%s' % op, 'int_%s' % op) + ii_i, + ('%s_val' % op, 'int_%s_val' % op) + ii_i, + ('inplace_%s_val' % op, 'int_%s_val' % op) + ii_i, + ]) + for op in "lshift".split(): + specializationtable.extend([ + ('%s' % op, 'int_%s' % op) + ii_i, + ('inplace_%s' % op, 'int_%s' % op) + ii_i, + ('%s_ovf' % op, 'int_%s_ovf' % op) + ii_i, + ('inplace_%s_ovf' % op, 'int_%s_ovf' % op) + ii_i, + ('%s_val' % op, 'int_%s_val' % op) + ii_i, + ('inplace_%s_val' % op, 'int_%s_val' % op) + ii_i, + ('%s_ovf_val' % op, 'int_%s_ovf_val' % op) + ii_i, + ('inplace_%s_ovf_val' % op, 'int_%s_ovf_val' % op) + ii_i, + ]) + for op in "floordiv mod".split(): + specializationtable.extend([ + ('%s' % op, 'int_%s' % op) + ii_i, + ('inplace_%s' % op, 'int_%s' % op) + ii_i, + ('%s_ovf' % op, 'int_%s_ovf' % op) + ii_i, + ('inplace_%s_ovf' % op, 'int_%s_ovf' % op) + ii_i, + ('%s_zer' % op, 'int_%s_zer' % op) + ii_i, + ('inplace_%s_zer' % op, 'int_%s_zer' % op) + ii_i, + ('%s_ovf_zer' % op, 'int_%s_ovf_zer' % op) + ii_i, + ('inplace_%s_ovf_zer' % op, 'int_%s_ovf_zer' % op) + ii_i, + ]) # initialization Specializer.__init__( @@ -34,22 +80,7 @@ # in more-specific-first, more-general-last order typematches = [TNone, TInt], - specializationtable = [ - ## op specialized op arg types concrete return type - ('add', 'int_add', TInt, TInt, TInt), - ('inplace_add', 'int_add', TInt, TInt, TInt), - ('add_ovf', 'int_add_ovf', TInt, TInt, TInt), - ('inplace_add_ovf', 'int_add_ovf', TInt, TInt, TInt), - ('sub', 'int_sub', TInt, TInt, TInt), - ('inplace_sub', 'int_sub', TInt, TInt, TInt), - ('sub_ovf', 'int_sub_ovf', TInt, TInt, TInt), - ('inplace_sub_ovf', 'int_sub_ovf', TInt, TInt, TInt), - ('mul', 'int_mul', TInt, TInt, TInt), - ('inplace_mul', 'int_mul', TInt, TInt, TInt), - ('mul_ovf', 'int_mul_ovf', TInt, TInt, TInt), - ('inplace_mul_ovf', 'int_mul_ovf', TInt, TInt, TInt), - ('is_true', 'int_is_true', TInt, TInt), - ], + specializationtable = specializationtable, ) def annotation2concretetype(self, s_value): Modified: pypy/dist/pypy/translator/genc/g_support.h ============================================================================== --- pypy/dist/pypy/translator/genc/g_support.h (original) +++ pypy/dist/pypy/translator/genc/g_support.h Tue May 3 19:16:37 2005 @@ -17,6 +17,7 @@ FAIL(err) \ } #define FAIL_OVF(err, msg) FAIL_EXCEPTION(err, PyExc_OverflowError, msg) +#define FAIL_VAL(err, msg) FAIL_EXCEPTION(err, PyExc_ValueError, msg) #define FAIL_ZER(err, msg) FAIL_EXCEPTION(err, PyExc_ZeroDivisionError, msg) /* we need a subclass of 'builtin_function_or_method' which can be used Modified: pypy/dist/pypy/translator/genc/int_include.h ============================================================================== --- pypy/dist/pypy/translator/genc/int_include.h (original) +++ pypy/dist/pypy/translator/genc/int_include.h Tue May 3 19:16:37 2005 @@ -8,23 +8,33 @@ #define CONV_TO_OBJ_int PyInt_FromLong #define CONV_FROM_OBJ_int PyInt_AS_LONG -#define OP_INT_IS_TRUE(x,r,err) r = (x != 0); +#define OP_INT_IS_TRUE(x,r,err) r = ((long)(x) != 0); +#define OP_INT_EQ(x,y,r,err) r = ((long)(x) == (long)(y)); +#define OP_INT_LE(x,y,r,err) r = ((long)(x) <= (long)(y)); +#define OP_INT_GT(x,y,r,err) r = ((long)(x) > (long)(y)); +#define OP_INT_LT(x,y,r,err) r = ((long)(x) < (long)(y)); +#define OP_INT_GE(x,y,r,err) r = ((long)(x) >= (long)(y)); -#define OP_INT_ADD(x,y,r,err) r = x + y; +#define OP_INT_CMP(x,y,r,err) \ + r = (((long)(x) > (long)(y)) - ((long)(x) < (long)(y))) + +/* addition, subtraction */ + +#define OP_INT_ADD(x,y,r,err) r = (long)(x) + (long)(y); #define OP_INT_ADD_OVF(x,y,r,err) \ - r = x + y; \ - if ((r^x) >= 0 || (r^y) >= 0); \ + OP_INT_ADD(x,y,r,err) \ + if ((r^(x)) >= 0 || (r^(y)) >= 0); \ else FAIL_OVF(err, "integer addition") -#define OP_INT_SUB(x,y,r,err) r = x - y; +#define OP_INT_SUB(x,y,r,err) r = (long)(x) - (long)(y); #define OP_INT_SUB_OVF(x,y,r,err) \ - r = x - y; \ - if ((r^x) >= 0 || (r^~y) >= 0); \ + OP_INT_SUB(x,y,r,err) \ + if ((r^(long)(x)) >= 0 || (r^~(long)(y)) >= 0); \ else FAIL_OVF(err, "integer subtraction") -#define OP_INT_MUL(x,y,r,err) r = x * y; +#define OP_INT_MUL(x,y,r,err) r = (long)(x) * (long)(y); #ifndef HAVE_LONG_LONG @@ -36,14 +46,76 @@ #define OP_INT_MUL_OVF(x,y,r,err) \ { \ - PY_LONG_LONG lr = (PY_LONG_LONG)x * (PY_LONG_LONG)y; \ + PY_LONG_LONG lr = (PY_LONG_LONG)(x) * (PY_LONG_LONG)(y); \ r = (long)lr; \ if ((PY_LONG_LONG)r == lr); \ else FAIL_OVF(err, "integer multiplication") \ } #endif -/* #define OP_ gnargll the division stuff is coming */ +/* shifting */ + +#define OP_INT_RSHIFT(x,y,r,err) \ + if ((long)(y) < LONG_BIT) \ + r = Py_ARITHMETIC_RIGHT_SHIFT(long, (long)(x), (long)(y)); \ + else r = (long)(x) < 0 ? -1 : 0; + +#define OP_INT_RSHIFT_VAL(x,y,r,err) \ + if ((long)(y) >= 0) { OP_INT_RSHIFT(x,y,r,err) } \ + else FAIL_VAL(err, "negative shift count") + +#define OP_INT_LSHIFT(x,y,r,err) \ + if ((long)(y) < LONG_BIT) \ + r = (long)(x) << (long)(y); \ + else r = 0; + +#define OP_INT_LSHIFT_VAL(x,y,r,err) \ + if ((long)(y) >= 0) { OP_INT_LSHIFT(x,y,r,err) } \ + else FAIL_VAL(err, "negative shift count") + +#define OP_INT_LSHIFT_OVF(x,y,r,err) \ + OP_INT_LSHIFT(x,y,r,err) \ + if ((long)(x) != Py_ARITHMETIC_RIGHT_SHIFT(long, r, (long)(y))) \ + FAIL_OVF(err, "x<= 0) { OP_INT_LSHIFT_OVF(x,y,r,err) } \ + else FAIL_VAL(err, "negative shift count") + + +/* floor division */ + +#define OP_INT_FLOORDIV(x,y,r,err) r = op_divmod_adj(x, y, NULL); + +#define OP_INT_FLOORDIV_OVF(x,y,r,err) \ + if ((long)(y) == -1 && (long)(x) < 0 && (long)(x) == -(long)(x)) \ + FAIL_OVF(err, "integer division") \ + OP_INT_FLOORDIV(x,y,r,err) + +#define OP_INT_FLOORDIV_ZER(x,y,r,err) \ + if ((long)(y)) { OP_INT_FLOORDIV(x,y,r,err) } \ + else FAIL_ZER(err, "integer division") + +#define OP_INT_FLOORDIV_OVF_ZER(x,y,r,err) \ + if ((long)(y)) { OP_INT_FLOORDIV_OVF(x,y,r,err) } \ + else FAIL_ZER(err, "integer division") + +/* modulus */ + +#define OP_INT_MOD(x,y,r,err) op_divmod_adj(x, y, &r); + +#define OP_INT_MOD_OVF(x,y,r,err) \ + if ((long)(y) == -1 && (long)(x) < 0 && (long)x == -(long)(x)) \ + FAIL_OVF(err, "integer modulo") \ + OP_INT_MOD(x,y,r,err); + +#define OP_INT_MOD_ZER(x,y,r,err) \ + if ((long)(y)) { OP_INT_MOD(x,y,r,err) } \ + else FAIL_ZER(err, "integer modulo") + +#define OP_INT_MOD_OVF_ZER(x,y,r,err) \ + if ((long)(y)) { OP_INT_MOD_OVF(x,y,r,err) } \ + else FAIL_ZER(err, "integer modulo") /* _________________ certain implementations __________________ */ @@ -82,3 +154,24 @@ } } #endif /* HAVE_LONG_LONG */ + +/* XXX we might probe the compiler whether it does what we want */ + +long op_divmod_adj(long x, long y, long *p_rem) +{ + long xdivy = x / y; + long xmody = x - xdivy * y; + /* If the signs of x and y differ, and the remainder is non-0, + * C89 doesn't define whether xdivy is now the floor or the + * ceiling of the infinitely precise quotient. We want the floor, + * and we have it iff the remainder's sign matches y's. + */ + if (xmody && ((y ^ xmody) < 0) /* i.e. and signs differ */) { + xmody += y; + --xdivy; + assert(xmody && ((y ^ xmody) >= 0)); + } + if (p_rem) + *p_rem = xmody; + return xdivy; +} \ No newline at end of file Modified: pypy/dist/pypy/translator/genc/test/test_typed.py ============================================================================== --- pypy/dist/pypy/translator/genc/test/test_typed.py (original) +++ pypy/dist/pypy/translator/genc/test/test_typed.py Tue May 3 19:16:37 2005 @@ -8,7 +8,7 @@ from pypy.translator.genc.test.test_annotated import TestAnnotatedTestCase as _TestAnnotatedTestCase -class TestTypedTestCase(_TestAnnotatedTestCase): +class TestTypedTestCase:##!!(_TestAnnotatedTestCase): def getcompiled(self, func): t = Translator(func, simplifying=True) @@ -19,12 +19,36 @@ if isinstance(spec, tuple): spec = spec[0] # use the first type only for the tests argstypelist.append(spec) + t.view()##!! a = t.annotate(argstypelist) + t.view()##!! a.simplify() + t.view()##!! GenCSpecializer(a).specialize() + t.view()##!! t.checkgraphs() return skip_missing_compiler(t.ccompile) - def test_int_overflow(self): - fn = self.getcompiled(snippet.simple_func) - raises(OverflowError, fn, sys.maxint+1) + def xxx_testint_overflow(self): + fn = self.getcompiled(snippet.add_func) + raises(OverflowError, fn, sys.maxint) + + def xxx_testint_div_ovf_zer(self): + fn = self.getcompiled(snippet.div_func) + raises(OverflowError, fn, -1) + raises(ZeroDivisionError, fn, 0) + + def testint_mod_ovf_zer(self): + fn = self.getcompiled(snippet.mod_func) + raises(OverflowError, fn, -1) + raises(ZeroDivisionError, fn, 0) + + def xxx_testint_rshift_val(self): + fn = self.getcompiled(snippet.rshift_func) + raises(ValueError, fn, -1) + + def testint_lshift_ovf_val(self): + fn = self.getcompiled(snippet.lshift_func) + raises(ValueError, fn, -1) + raises(OverflowError, fn, 1) + \ No newline at end of file From arigo at codespeak.net Tue May 3 19:36:35 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Tue, 3 May 2005 19:36:35 +0200 (CEST) Subject: [pypy-svn] r11882 - pypy/dist/pypy/interpreter Message-ID: <20050503173635.2959C27B72@code1.codespeak.net> Author: arigo Date: Tue May 3 19:36:34 2005 New Revision: 11882 Modified: pypy/dist/pypy/interpreter/interactive.py pypy/dist/pypy/interpreter/main.py pypy/dist/pypy/interpreter/py.py Log: Yet some more clean-ups, to allow sys.exitfunc to be introduced. Modified: pypy/dist/pypy/interpreter/interactive.py ============================================================================== --- pypy/dist/pypy/interpreter/interactive.py (original) +++ pypy/dist/pypy/interpreter/interactive.py Tue May 3 19:36:34 2005 @@ -159,11 +159,13 @@ def runcode(self, code): # 'code' is a CPython code object - self.settrace() - main.run_toplevel_program(self.space, code, - w_globals=self.w_globals, - verbose=self.verbose) - self.checktrace() + from pypy.interpreter.pycode import PyCode + pycode = PyCode(self.space)._from_code(code) + def doit(): + self.settrace() + pycode.exec_code(self.space, self.w_globals, self.w_globals) + self.checktrace() + main.run_toplevel(self.space, doit, verbose=self.verbose) def runsource(self, source, ignored_filename="", symbol="single"): hacked_filename = '' + source Modified: pypy/dist/pypy/interpreter/main.py ============================================================================== --- pypy/dist/pypy/interpreter/main.py (original) +++ pypy/dist/pypy/interpreter/main.py Tue May 3 19:36:34 2005 @@ -17,13 +17,10 @@ return mainmodule def compilecode(space, source, filename, cmd='exec'): - if isinstance(source, types.CodeType): - pycode = PyCode(space)._from_code(source) - else: - w = space.wrap - w_code = space.builtin.call('compile', - w(source), w(filename), w(cmd), w(0), w(0)) - pycode = space.interpclass_w(w_code) + w = space.wrap + w_code = space.builtin.call('compile', + w(source), w(filename), w(cmd), w(0), w(0)) + pycode = space.interpclass_w(w_code) assert isinstance(pycode, eval.Code) return pycode @@ -72,24 +69,16 @@ # ____________________________________________________________ -def run_toplevel_program(space, source, filename='', - w_globals=None, verbose=False): - """Run the given source code in the given globals (or __main__ by default). +def run_toplevel(space, f, verbose=False): + """Calls f() and handle all OperationErrors. Intended use is to run the main program or one interactive statement. - It handles details like forwarding exceptions to sys.excepthook(), - catching SystemExit, printing a newline after sys.stdout if needed, etc. + run_protected() handles details like forwarding exceptions to + sys.excepthook(), catching SystemExit, printing a newline after + sys.stdout if needed, etc. """ try: - # build a valid w_globals - if w_globals is None: - w_globals = ensure__main__(space).w_dict - w1 = space.wrap('__builtins__') - if not space.is_true(space.contains(w_globals, w1)): - space.setitem(w_globals, w1, space.builtin) - - # compile and execute the code - pycode = compilecode(space, source, filename) - pycode.exec_code(space, w_globals, w_globals) + # run it + f() # we arrive here if no exception is raised. stdout cosmetics... try: @@ -145,7 +134,7 @@ w_original = space.sys.getdictvalue(space, '__excepthook__') if w_original is None or not space.is_w(w_hook, w_original): space.call_function(w_hook, w_type, w_value, w_traceback) - return 1 # done + return False # done except OperationError, err2: # XXX should we go through sys.get('stderr') ? @@ -159,6 +148,6 @@ operationerr.print_detailed_traceback(space) else: operationerr.print_application_traceback(space) - return 1 + return False - return 0 # success + return True # success Modified: pypy/dist/pypy/interpreter/py.py ============================================================================== --- pypy/dist/pypy/interpreter/py.py (original) +++ pypy/dist/pypy/interpreter/py.py Tue May 3 19:36:34 2005 @@ -73,33 +73,42 @@ for arg in args: space.call_method(space.sys.get('argv'), 'append', space.wrap(arg)) - # compile the program given as command-line argument + # load the source of the program given as command-line argument if Options.command: - filename = '' - fullsource = Options.command[0] + def doit(): + main.run_string(Options.command[0], space=space) elif args: - filename = args[0] - fullsource = open(filename).read() + def doit(): + main.run_file(args[0], space=space) else: - filename = fullsource = None + def doit(): + pass space.call_method(space.sys.get('argv'), 'append', space.wrap('')) go_interactive = 1 banner = None - # run it - if fullsource is not None: - exit_status = main.run_toplevel_program(space, fullsource, filename, - verbose=Options.verbose) - - # start the interactive console - if go_interactive: - con = interactive.PyPyConsole(space, verbose=Options.verbose, - completer=Options.completer) - if banner == '': - banner = '%s / %s'%(con.__class__.__name__, - repr(space)) - con.interact(banner) - exit_status = 0 + try: + # compile and run it + if not main.run_toplevel(space, doit, verbose=Options.verbose): + exit_status = 1 + + # start the interactive console + if go_interactive: + con = interactive.PyPyConsole(space, verbose=Options.verbose, + completer=Options.completer) + if banner == '': + banner = '%s / %s'%(con.__class__.__name__, + repr(space)) + con.interact(banner) + exit_status = 0 + finally: + # call the sys.exitfunc() + w_exitfunc = space.sys.getdictvalue(space, 'exitfunc') + if w_exitfunc is not None: + def doit(): + space.call_function(w_exitfunc) + main.run_toplevel(space, doit, verbose=Options.verbose) + return exit_status ##def main_(argv=None): From arigo at codespeak.net Tue May 3 20:38:15 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Tue, 3 May 2005 20:38:15 +0200 (CEST) Subject: [pypy-svn] r11884 - in pypy/dist/pypy: interpreter objspace Message-ID: <20050503183815.CB8F927B61@code1.codespeak.net> Author: arigo Date: Tue May 3 20:38:15 2005 New Revision: 11884 Modified: pypy/dist/pypy/interpreter/function.py pypy/dist/pypy/interpreter/lazymodule.py pypy/dist/pypy/interpreter/typedef.py pypy/dist/pypy/objspace/descroperation.py Log: Added a type 'builtin_function', as discussed on: http://codespeak.net/pipermail/pypy-dev/2005q2/002018.html Modified: pypy/dist/pypy/interpreter/function.py ============================================================================== --- pypy/dist/pypy/interpreter/function.py (original) +++ pypy/dist/pypy/interpreter/function.py Tue May 3 20:38:15 2005 @@ -263,3 +263,22 @@ def descr_staticmethod_get(self, w_obj, w_cls=None): return self.w_function + +class BuiltinFunction(Function): + + def __init__(self, func): + assert isinstance(func, Function) + Function.__init__(self, func.space, func.code, func.w_func_globals, + func.defs_w, func.closure, func.name) + self.w_doc = func.w_doc + self.w_func_dict = func.w_func_dict + self.w_module = func.w_module + + def descr_method__new__(space, w_subtype, w_func): + func = space.interpclass_w(w_func) + if func is None or not isinstance(func, Function): + raise OperationError(space.w_TypeError, + space.wrap("expected a function object")) + bltin = space.allocate_instance(BuiltinFunction, w_subtype) + bltin.__init__(func) + return space.wrap(bltin) Modified: pypy/dist/pypy/interpreter/lazymodule.py ============================================================================== --- pypy/dist/pypy/interpreter/lazymodule.py (original) +++ pypy/dist/pypy/interpreter/lazymodule.py Tue May 3 20:38:15 2005 @@ -1,4 +1,5 @@ -from pypy.interpreter.module import Module +from pypy.interpreter.module import Module +from pypy.interpreter.function import Function, BuiltinFunction from pypy.tool.cache import Cache from pypy.interpreter import gateway from pypy.interpreter.error import OperationError @@ -42,6 +43,11 @@ #print "trying to load", name w_value = loader(space) #print "loaded", w_value + # obscure + func = space.interpclass_w(w_value) + if type(func) is Function: + func = BuiltinFunction(func) + w_value = space.wrap(func) space.setitem(self.w_dict, space.wrap(name), w_value) return w_value Modified: pypy/dist/pypy/interpreter/typedef.py ============================================================================== --- pypy/dist/pypy/interpreter/typedef.py (original) +++ pypy/dist/pypy/interpreter/typedef.py Tue May 3 20:38:15 2005 @@ -270,6 +270,7 @@ from pypy.interpreter.pyframe import PyFrame, ControlFlowException from pypy.interpreter.module import Module from pypy.interpreter.function import Function, Method, StaticMethod +from pypy.interpreter.function import BuiltinFunction from pypy.interpreter.pytraceback import PyTraceback from pypy.interpreter.generator import GeneratorIterator from pypy.interpreter.nestedscope import Cell @@ -428,6 +429,15 @@ # XXX getattribute etc.pp ) +def always_none(self, obj): + return None +BuiltinFunction.typedef = TypeDef("builtin_function",**Function.typedef.rawdict) +BuiltinFunction.typedef.rawdict.update({ + '__new__': interp2app(BuiltinFunction.descr_method__new__.im_func), + '__self__': GetSetProperty(always_none, cls=BuiltinFunction) + }) +del BuiltinFunction.typedef.rawdict['__get__'] + PyTraceback.typedef = TypeDef("traceback", tb_frame = interp_attrproperty('frame', cls=PyTraceback), tb_lasti = interp_attrproperty('lasti', cls=PyTraceback), Modified: pypy/dist/pypy/objspace/descroperation.py ============================================================================== --- pypy/dist/pypy/objspace/descroperation.py (original) +++ pypy/dist/pypy/objspace/descroperation.py Tue May 3 20:38:15 2005 @@ -76,7 +76,7 @@ def get_and_call_args(space, w_descr, w_obj, args): descr = space.interpclass_w(w_descr) # a special case for performance and to avoid infinite recursion - if isinstance(descr, Function): + if type(descr) is Function: return descr.call_args(args.prepend(w_obj)) else: w_impl = space.get(w_descr, w_obj) @@ -88,7 +88,7 @@ def call_args(space, w_obj, args): # a special case for performance - if type(w_obj) is Function: + if isinstance(w_obj, Function): return w_obj.call_args(args) w_descr = space.lookup(w_obj, '__call__') if w_descr is None: From arigo at codespeak.net Tue May 3 20:49:16 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Tue, 3 May 2005 20:49:16 +0200 (CEST) Subject: [pypy-svn] r11885 - in pypy/dist/pypy: interpreter objspace/std Message-ID: <20050503184916.240BE27B61@code1.codespeak.net> Author: arigo Date: Tue May 3 20:49:15 2005 New Revision: 11885 Modified: pypy/dist/pypy/interpreter/baseobjspace.py pypy/dist/pypy/interpreter/function.py pypy/dist/pypy/interpreter/typedef.py pypy/dist/pypy/objspace/std/objecttype.py Log: __repr__ for functions and built-in functions. Modified: pypy/dist/pypy/interpreter/baseobjspace.py ============================================================================== --- pypy/dist/pypy/interpreter/baseobjspace.py (original) +++ pypy/dist/pypy/interpreter/baseobjspace.py Tue May 3 20:49:15 2005 @@ -3,6 +3,7 @@ from pypy.interpreter.miscutils import getthreadlocals from pypy.interpreter.argument import Arguments from pypy.tool.cache import Cache +from pypy.tool.rarithmetic import r_uint __all__ = ['ObjSpace', 'OperationError', 'Wrappable', 'BaseWrappable', 'W_Root'] @@ -34,7 +35,11 @@ if e.match(space, space.w_TypeError) or e.match(space, space.w_AttributeError): return default raise - + + def getrepr(self, space, info): + id = space.int_w(space.id(self)) # xxx ids could be long + id = r_uint(id) # XXX what about sizeof(void*) > sizeof(long) !! + return space.wrap("<%s at 0x%x>" % (info, id)) class BaseWrappable(W_Root): """A subclass of BaseWrappable is an internal, interpreter-level class Modified: pypy/dist/pypy/interpreter/function.py ============================================================================== --- pypy/dist/pypy/interpreter/function.py (original) +++ pypy/dist/pypy/interpreter/function.py Tue May 3 20:49:15 2005 @@ -104,6 +104,9 @@ def descr_function_call(self, __args__): return self.call_args(__args__) + def descr_function_repr(self): + return self.getrepr(self.space, 'function %s' % (self.name,)) + def fget_func_defaults(space, self): values_w = self.defs_w if not values_w: @@ -282,3 +285,6 @@ bltin = space.allocate_instance(BuiltinFunction, w_subtype) bltin.__init__(func) return space.wrap(bltin) + + def descr_function_repr(self): + return self.space.wrap('' % (self.name,)) Modified: pypy/dist/pypy/interpreter/typedef.py ============================================================================== --- pypy/dist/pypy/interpreter/typedef.py (original) +++ pypy/dist/pypy/interpreter/typedef.py Tue May 3 20:49:15 2005 @@ -396,6 +396,7 @@ __call__ = interp2app(Function.descr_function_call, unwrap_spec=['self', Arguments]), __get__ = interp2app(Function.descr_function_get), + __repr__ = interp2app(Function.descr_function_repr), func_code = getset_func_code, func_doc = getset_func_doc, func_name = interp_attrproperty('name', cls=Function), @@ -434,7 +435,8 @@ BuiltinFunction.typedef = TypeDef("builtin_function",**Function.typedef.rawdict) BuiltinFunction.typedef.rawdict.update({ '__new__': interp2app(BuiltinFunction.descr_method__new__.im_func), - '__self__': GetSetProperty(always_none, cls=BuiltinFunction) + '__self__': GetSetProperty(always_none, cls=BuiltinFunction), + '__repr__': interp2app(BuiltinFunction.descr_function_repr), }) del BuiltinFunction.typedef.rawdict['__get__'] Modified: pypy/dist/pypy/objspace/std/objecttype.py ============================================================================== --- pypy/dist/pypy/objspace/std/objecttype.py (original) +++ pypy/dist/pypy/objspace/std/objecttype.py Tue May 3 20:49:15 2005 @@ -3,15 +3,12 @@ from pypy.objspace.std.stdtypedef import * from pypy.objspace.std.register_all import register_all from pypy.objspace.std.objspace import StdObjSpace -from pypy.tool.rarithmetic import r_uint def descr__repr__(space, w_obj): w = space.wrap classname = space.str_w(space.getattr(space.type(w_obj), w("__name__"))) - id = space.int_w(space.id(w_obj))# xxx ids could be long - id = r_uint(id) # XXX what about sizeof(void*) > sizeof(long) !! - return w("<%s object at 0x%x>" % (classname, id)) + return w_obj.getrepr(space, '%s object' % (classname,)) def descr__str__(space, w_obj): return space.repr(w_obj) From arigo at codespeak.net Tue May 3 21:04:21 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Tue, 3 May 2005 21:04:21 +0200 (CEST) Subject: [pypy-svn] r11886 - pypy/dist/pypy/interpreter Message-ID: <20050503190421.17EC327B60@code1.codespeak.net> Author: arigo Date: Tue May 3 21:04:20 2005 New Revision: 11886 Modified: pypy/dist/pypy/interpreter/lazymodule.py Log: Fix. Obscure. Modified: pypy/dist/pypy/interpreter/lazymodule.py ============================================================================== --- pypy/dist/pypy/interpreter/lazymodule.py (original) +++ pypy/dist/pypy/interpreter/lazymodule.py Tue May 3 21:04:20 2005 @@ -14,7 +14,7 @@ """ NOT_RPYTHON """ Module.__init__(self, space, w_name) self.lazy = True - self.__class__.buildloaders() + self.__class__.buildloaders() def get(self, name): space = self.space @@ -46,8 +46,12 @@ # obscure func = space.interpclass_w(w_value) if type(func) is Function: - func = BuiltinFunction(func) - w_value = space.wrap(func) + try: + bltin = func._builtinversion_ + except AttributeError: + bltin = BuiltinFunction(func) + func._builtinversion_ = bltin + w_value = space.wrap(bltin) space.setitem(self.w_dict, space.wrap(name), w_value) return w_value From arigo at codespeak.net Tue May 3 21:10:41 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Tue, 3 May 2005 21:10:41 +0200 (CEST) Subject: [pypy-svn] r11888 - pypy/dist/lib-python/modified-2.3.4 Message-ID: <20050503191041.F168C27B60@code1.codespeak.net> Author: arigo Date: Tue May 3 21:10:41 2005 New Revision: 11888 Removed: pypy/dist/lib-python/modified-2.3.4/types.py Log: Temporary, will we reintroduced based on a fresh 2.3.4/types.py. Deleted: /pypy/dist/lib-python/modified-2.3.4/types.py ============================================================================== --- /pypy/dist/lib-python/modified-2.3.4/types.py Tue May 3 21:10:41 2005 +++ (empty file) @@ -1,120 +0,0 @@ -"""Appspace types module. - -!! This file has been copied practicaly verbatim from the CPython source. -!! See http://www.python.org/2.3.2/license.html for licensing info. - -Define names for all type symbols known in the standard interpreter. - -Types that are part of optional modules (e.g. array) are not listed. -""" -from __future__ import generators - -import sys - -# Iterators in Python aren't a matter of type but of protocol. A large -# and changing number of builtin types implement *some* flavor of -# iterator. Don't check the type! Use hasattr to check for both -# "__iter__" and "next" attributes instead. - -NoneType = type(None) -TypeType = type -ObjectType = object - -IntType = int -try: - LongType = long -except NameError: - pass -FloatType = float -try: - BooleanType = bool -except NameError: - pass -try: - ComplexType = complex -except NameError: - pass - -StringType = str -try: - UnicodeType = unicode - StringTypes = (StringType, UnicodeType) -except NameError: - StringTypes = (StringType,) - -try: - BufferType = buffer -except NameError: - pass - -TupleType = tuple -ListType = list -DictType = DictionaryType = dict - -def _f(): pass -FunctionType = type(_f) -LambdaType = type(lambda: None) # Same as FunctionType -try: - CodeType = type(_f.func_code) -except RuntimeError: - # Execution in restricted environment - pass - -def g(): - yield 1 -try: - GeneratorType = type(g()) -except: - # Refusing generators - pass -del g - -# checking whether we can make copy_reg happy -class _C: - def _m(self): pass - -ClassType = _classobj # from builtins -try: - UnboundMethodType = type(_C._m) # Same as MethodType -except AttributeError: - pass -_x = _C() -InstanceType = _instance # from builtins -MethodType = type(_x._m) - -BuiltinFunctionType = type(len) -BuiltinMethodType = type([].append) # Same as BuiltinFunctionType - -ModuleType = type(sys) -try: - FileType = file -except NameError: - pass -try: - XRangeType = type(xrange(0)) -except NameError: - pass - -try: - raise TypeError -except TypeError: - try: - tb = sys.exc_info()[2] - TracebackType = type(tb) - FrameType = type(tb.tb_frame) - except AttributeError: - # In the restricted environment, exc_info returns (None, None, - # None) Then, tb.tb_frame gives an attribute error - pass - tb = None; del tb - -SliceType = type(slice(0)) -EllipsisType = type(Ellipsis) - -DictProxyType = type(TypeType.__dict__) -try: - NotImplementedType = type(NotImplemented) -except NameError: - pass - -del sys, _f, _C, _x#, generators # Not for export From arigo at codespeak.net Tue May 3 21:12:07 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Tue, 3 May 2005 21:12:07 +0200 (CEST) Subject: [pypy-svn] r11889 - pypy/dist/lib-python/modified-2.3.4 Message-ID: <20050503191207.53AE627B62@code1.codespeak.net> Author: arigo Date: Tue May 3 21:12:06 2005 New Revision: 11889 Added: pypy/dist/lib-python/modified-2.3.4/types.py - copied, changed from r11887, pypy/dist/lib-python/2.3.4/types.py Log: Copied from 2.3.4, changed only ClassType and InstanceType. Copied: pypy/dist/lib-python/modified-2.3.4/types.py (from r11887, pypy/dist/lib-python/2.3.4/types.py) ============================================================================== --- pypy/dist/lib-python/2.3.4/types.py (original) +++ pypy/dist/lib-python/modified-2.3.4/types.py Tue May 3 21:12:06 2005 @@ -55,10 +55,10 @@ class _C: def _m(self): pass -ClassType = type(_C) +ClassType = _classobj # PyPy-specific, from __builtin__ UnboundMethodType = type(_C._m) # Same as MethodType _x = _C() -InstanceType = type(_x) +InstanceType = _instance # PyPy-specific, from __builtin__ MethodType = type(_x._m) BuiltinFunctionType = type(len) From tismer at codespeak.net Tue May 3 21:29:37 2005 From: tismer at codespeak.net (tismer at codespeak.net) Date: Tue, 3 May 2005 21:29:37 +0200 (CEST) Subject: [pypy-svn] r11891 - pypy/dist/lib-python/modified-2.3.4/test Message-ID: <20050503192937.01E5927B6E@code1.codespeak.net> Author: tismer Date: Tue May 3 21:29:37 2005 New Revision: 11891 Modified: pypy/dist/lib-python/modified-2.3.4/test/test_codeccallbacks.py (contents, props changed) Log: fixeol Modified: pypy/dist/lib-python/modified-2.3.4/test/test_codeccallbacks.py ============================================================================== --- pypy/dist/lib-python/modified-2.3.4/test/test_codeccallbacks.py (original) +++ pypy/dist/lib-python/modified-2.3.4/test/test_codeccallbacks.py Tue May 3 21:29:37 2005 @@ -1,712 +1,712 @@ -import test.test_support, unittest -import sys, codecs, htmlentitydefs, unicodedata - -class PosReturn: - # this can be used for configurable callbacks - - def __init__(self): - self.pos = 0 - - def handle(self, exc): - oldpos = self.pos - realpos = oldpos - if realpos<0: - realpos = len(exc.object) + realpos - # if we don't advance this time, terminate on the next call - # otherwise we'd get an endless loop - if realpos <= exc.start: - self.pos = len(exc.object) - return (u"", oldpos) - -class CodecCallbackTest(unittest.TestCase): - - def test_xmlcharrefreplace(self): - # replace unencodable characters which numeric character entities. - # For ascii, latin-1 and charmaps this is completely implemented - # in C and should be reasonably fast. - s = u"\u30b9\u30d1\u30e2 \xe4nd eggs" - self.assertEqual( - s.encode("ascii", "xmlcharrefreplace"), - "スパモ änd eggs" - ) - self.assertEqual( - s.encode("latin-1", "xmlcharrefreplace"), - "スパモ \xe4nd eggs" - ) - - def test_xmlcharnamereplace(self): - # This time use a named character entity for unencodable - # characters, if one is available. - - def xmlcharnamereplace(exc): - if not isinstance(exc, UnicodeEncodeError): - raise TypeError("don't know how to handle %r" % exc) - l = [] - for c in exc.object[exc.start:exc.end]: - try: - l.append(u"&%s;" % htmlentitydefs.codepoint2name[ord(c)]) - except KeyError: - l.append(u"&#%d;" % ord(c)) - return (u"".join(l), exc.end) - - codecs.register_error( - "test.xmlcharnamereplace", xmlcharnamereplace) - - sin = u"\xab\u211c\xbb = \u2329\u1234\u20ac\u232a" - sout = "«ℜ» = ⟨ሴ€⟩" - self.assertEqual(codecs.encode(sin,"ascii", "test.xmlcharnamereplace"), sout) - sout = "\xabℜ\xbb = ⟨ሴ€⟩" - self.assertEqual(codecs.encode(sin,"latin-1", "test.xmlcharnamereplace"), sout) - sout = "\xabℜ\xbb = ⟨ሴ\xa4⟩" - self.assertEqual(codecs.encode(sin,"iso-8859-15", "test.xmlcharnamereplace"), sout) - - def test_uninamereplace(self): - # We're using the names from the unicode database this time, - # and we're doing "syntax highlighting" here, i.e. we include - # the replaced text in ANSI escape sequences. For this it is - # useful that the error handler is not called for every single - # unencodable character, but for a complete sequence of - # unencodable characters, otherwise we would output many - # unneccessary escape sequences. - - def uninamereplace(exc): - if not isinstance(exc, UnicodeEncodeError): - raise TypeError("don't know how to handle %r" % exc) - l = [] - for c in exc.object[exc.start:exc.end]: - l.append(unicodedata.name(c, u"0x%x" % ord(c))) - return (u"\033[1m%s\033[0m" % u", ".join(l), exc.end) - - codecs.register_error( - "test.uninamereplace", uninamereplace) - - sin = u"\xac\u1234\u20ac\u8000" - sout = "\033[1mNOT SIGN, ETHIOPIC SYLLABLE SEE, EURO SIGN, CJK UNIFIED IDEOGRAPH-8000\033[0m" - self.assertEqual(codecs.encode(sin,"ascii", "test.uninamereplace"), sout) - - sout = "\xac\033[1mETHIOPIC SYLLABLE SEE, EURO SIGN, CJK UNIFIED IDEOGRAPH-8000\033[0m" - self.assertEqual(codecs.encode(sin,"latin-1", "test.uninamereplace"), sout) - - sout = "\xac\033[1mETHIOPIC SYLLABLE SEE\033[0m\xa4\033[1mCJK UNIFIED IDEOGRAPH-8000\033[0m" - self.assertEqual(codecs.encode(sin,"iso-8859-15", "test.uninamereplace"), sout) - - def test_backslashescape(self): - # Does the same as the "unicode-escape" encoding, but with different - # base encodings. - sin = u"a\xac\u1234\u20ac\u8000" - if sys.maxunicode > 0xffff: - sin += unichr(sys.maxunicode) - sout = "a\\xac\\u1234\\u20ac\\u8000" - if sys.maxunicode > 0xffff: - sout += "\\U%08x" % sys.maxunicode - self.assertEqual(codecs.encode(sin,"ascii", "backslashreplace"), sout) - - sout = "a\xac\\u1234\\u20ac\\u8000" - if sys.maxunicode > 0xffff: - sout += "\\U%08x" % sys.maxunicode - self.assertEqual(codecs.encode(sin,"latin-1", "backslashreplace"), sout) - - sout = "a\xac\\u1234\xa4\\u8000" - if sys.maxunicode > 0xffff: - sout += "\\U%08x" % sys.maxunicode - self.assertEqual(codecs.encode(sin,"iso-8859-15", "backslashreplace"), sout) - - def test_relaxedutf8(self): - # This is the test for a decoding callback handler, - # that relaxes the UTF-8 minimal encoding restriction. - # A null byte that is encoded as "\xc0\x80" will be - # decoded as a null byte. All other illegal sequences - # will be handled strictly. - def relaxedutf8(exc): - if not isinstance(exc, UnicodeDecodeError): - raise TypeError("don't know how to handle %r" % exc) - if exc.object[exc.start:exc.end].startswith("\xc0\x80"): - return (u"\x00", exc.start+2) # retry after two bytes - else: - raise exc - - codecs.register_error( - "test.relaxedutf8", relaxedutf8) - - sin = "a\x00b\xc0\x80c\xc3\xbc\xc0\x80\xc0\x80" - sout = u"a\x00b\x00c\xfc\x00\x00" - self.assertEqual(codecs.decode(sin,"utf-8", "test.relaxedutf8"), sout) - sin = "\xc0\x80\xc0\x81" - self.assertRaises(UnicodeError, codecs.decode,sin, "utf-8", "test.relaxedutf8") - - def test_charmapencode(self): - # For charmap encodings the replacement string will be - # mapped through the encoding again. This means, that - # to be able to use e.g. the "replace" handler, the - # charmap has to have a mapping for "?". - charmap = dict([ (ord(c), 2*c.upper()) for c in "abcdefgh"]) - sin = u"abc" - sout = "AABBCC" - self.assertEquals(codecs.charmap_encode(sin, "strict", charmap)[0], sout) - - sin = u"abcA" - self.assertRaises(UnicodeError, codecs.charmap_encode, sin, "strict", charmap) - - charmap[ord("?")] = "XYZ" - sin = u"abcDEF" - sout = "AABBCCXYZXYZXYZ" - self.assertEquals(codecs.charmap_encode(sin, "replace", charmap)[0], sout) - - charmap[ord("?")] = u"XYZ" - self.assertRaises(TypeError, codecs.charmap_encode, sin, "replace", charmap) - - charmap[ord("?")] = u"XYZ" - self.assertRaises(TypeError, codecs.charmap_encode, sin, "replace", charmap) - - def test_callbacks(self): - def handler1(exc): - if not isinstance(exc, UnicodeEncodeError) \ - and not isinstance(exc, UnicodeDecodeError): - raise TypeError("don't know how to handle %r" % exc) - l = [u"<%d>" % ord(exc.object[pos]) for pos in xrange(exc.start, exc.end)] - return (u"[%s]" % u"".join(l), exc.end) - - codecs.register_error("test.handler1", handler1) - - def handler2(exc): - if not isinstance(exc, UnicodeDecodeError): - raise TypeError("don't know how to handle %r" % exc) - l = [u"<%d>" % ord(exc.object[pos]) for pos in xrange(exc.start, exc.end)] - return (u"[%s]" % u"".join(l), exc.end+1) # skip one character - - codecs.register_error("test.handler2", handler2) - - s = "\x00\x81\x7f\x80\xff" - - self.assertEqual( - codecs.decode(s,"ascii", "test.handler1"), - u"\x00[<129>]\x7f[<128>][<255>]" - ) - self.assertEqual( - codecs.decode(s,"ascii", "test.handler2"), - u"\x00[<129>][<128>]" - ) - - self.assertEqual( - codecs.decode("\\u3042\u3xxx","unicode-escape", "test.handler1"), - u"\u3042[<92><117><51><120>]xx" - ) - - self.assertEqual( - codecs.decode("\\u3042\u3xx","unicode-escape", "test.handler1"), - u"\u3042[<92><117><51><120><120>]" - ) - - self.assertEqual( - codecs.charmap_decode("abc", "test.handler1", {ord("a"): u"z"})[0], - u"z[<98>][<99>]" - ) - - self.assertEqual( - codecs.encode(u"g\xfc\xdfrk","ascii", "test.handler1"), - u"g[<252><223>]rk" - ) - - self.assertEqual( - codecs.encode(u"g\xfc\xdf","ascii", "test.handler1"), - u"g[<252><223>]" - ) - - def test_longstrings(self): - # test long strings to check for memory overflow problems - errors = [ "strict", "ignore", "replace", "xmlcharrefreplace", "backslashreplace"] - # register the handlers under different names, - # to prevent the codec from recognizing the name - for err in errors: - codecs.register_error("test." + err, codecs.lookup_error(err)) - l = 1000 - errors += [ "test." + err for err in errors ] - for uni in [ s*l for s in (u"x", u"\u3042", u"a\xe4") ]: - for enc in ("ascii", "latin-1", "iso-8859-1", "iso-8859-15", "utf-8", "utf-7", "utf-16"): - for err in errors: - try: - codecs.encode(uni,enc, err) - except UnicodeError: - pass - - def check_exceptionobjectargs(self, exctype, args, msg): - # Test UnicodeError subclasses: construction, attribute assignment and __str__ conversion - # check with one missing argument - self.assertRaises(TypeError, exctype, *args[:-1]) - # check with one argument too much - self.assertRaises(TypeError, exctype, *(args + ["too much"])) - # check with one argument of the wrong type - wrongargs = [ "spam", u"eggs", 42, 1.0, None ] - for i in xrange(len(args)): - for wrongarg in wrongargs: - if type(wrongarg) is type(args[i]): - continue - # build argument array - callargs = [] - for j in xrange(len(args)): - if i==j: - callargs.append(wrongarg) - else: - callargs.append(args[i]) - self.assertRaises(TypeError, exctype, *callargs) - - # check with the correct number and type of arguments - exc = exctype(*args) - self.assertEquals(str(exc), msg) - - def test_unicodeencodeerror(self): - self.check_exceptionobjectargs( - UnicodeEncodeError, - ["ascii", u"g\xfcrk", 1, 2, "ouch"], - "'ascii' codec can't encode character u'\\xfc' in position 1: ouch" - ) - self.check_exceptionobjectargs( - UnicodeEncodeError, - ["ascii", u"g\xfcrk", 1, 4, "ouch"], - "'ascii' codec can't encode characters in position 1-3: ouch" - ) - self.check_exceptionobjectargs( - UnicodeEncodeError, - ["ascii", u"\xfcx", 0, 1, "ouch"], - "'ascii' codec can't encode character u'\\xfc' in position 0: ouch" - ) - self.check_exceptionobjectargs( - UnicodeEncodeError, - ["ascii", u"\u0100x", 0, 1, "ouch"], - "'ascii' codec can't encode character u'\\u0100' in position 0: ouch" - ) - self.check_exceptionobjectargs( - UnicodeEncodeError, - ["ascii", u"\uffffx", 0, 1, "ouch"], - "'ascii' codec can't encode character u'\\uffff' in position 0: ouch" - ) - if sys.maxunicode > 0xffff: - self.check_exceptionobjectargs( - UnicodeEncodeError, - ["ascii", u"\U00010000x", 0, 1, "ouch"], - "'ascii' codec can't encode character u'\\U00010000' in position 0: ouch" - ) - - def test_unicodedecodeerror(self): - self.check_exceptionobjectargs( - UnicodeDecodeError, - ["ascii", "g\xfcrk", 1, 2, "ouch"], - "'ascii' codec can't decode byte 0xfc in position 1: ouch" - ) - self.check_exceptionobjectargs( - UnicodeDecodeError, - ["ascii", "g\xfcrk", 1, 3, "ouch"], - "'ascii' codec can't decode bytes in position 1-2: ouch" - ) - - def test_unicodetranslateerror(self): - self.check_exceptionobjectargs( - UnicodeTranslateError, - [u"g\xfcrk", 1, 2, "ouch"], - "can't translate character u'\\xfc' in position 1: ouch" - ) - self.check_exceptionobjectargs( - UnicodeTranslateError, - [u"g\u0100rk", 1, 2, "ouch"], - "can't translate character u'\\u0100' in position 1: ouch" - ) - self.check_exceptionobjectargs( - UnicodeTranslateError, - [u"g\uffffrk", 1, 2, "ouch"], - "can't translate character u'\\uffff' in position 1: ouch" - ) - if sys.maxunicode > 0xffff: - self.check_exceptionobjectargs( - UnicodeTranslateError, - [u"g\U00010000rk", 1, 2, "ouch"], - "can't translate character u'\\U00010000' in position 1: ouch" - ) - self.check_exceptionobjectargs( - UnicodeTranslateError, - [u"g\xfcrk", 1, 3, "ouch"], - "can't translate characters in position 1-2: ouch" - ) - - def test_badandgoodstrictexceptions(self): - # "strict" complains about a non-exception passed in - self.assertRaises( - TypeError, - codecs.strict_errors, - 42 - ) - # "strict" complains about the wrong exception type - self.assertRaises( - Exception, - codecs.strict_errors, - Exception("ouch") - ) - - # If the correct exception is passed in, "strict" raises it - self.assertRaises( - UnicodeEncodeError, - codecs.strict_errors, - UnicodeEncodeError("ascii", u"\u3042", 0, 1, "ouch") - ) - - def test_badandgoodignoreexceptions(self): - # "ignore" complains about a non-exception passed in - self.assertRaises( - TypeError, - codecs.ignore_errors, - 42 - ) - # "ignore" complains about the wrong exception type - self.assertRaises( - TypeError, - codecs.ignore_errors, - UnicodeError("ouch") - ) - # If the correct exception is passed in, "ignore" returns an empty replacement - self.assertEquals( - codecs.ignore_errors(UnicodeEncodeError("ascii", u"\u3042", 0, 1, "ouch")), - (u"", 1) - ) - self.assertEquals( - codecs.ignore_errors(UnicodeDecodeError("ascii", "\xff", 0, 1, "ouch")), - (u"", 1) - ) - self.assertEquals( - codecs.ignore_errors(UnicodeTranslateError(u"\u3042", 0, 1, "ouch")), - (u"", 1) - ) - - def test_badandgoodreplaceexceptions(self): - # "replace" complains about a non-exception passed in - self.assertRaises( - TypeError, - codecs.replace_errors, - 42 - ) - # "replace" complains about the wrong exception type - self.assertRaises( - TypeError, - codecs.replace_errors, - UnicodeError("ouch") - ) - # With the correct exception, "ignore" returns an empty replacement - self.assertEquals( - codecs.replace_errors(UnicodeEncodeError("ascii", u"\u3042", 0, 1, "ouch")), - (u"?", 1) - ) - self.assertEquals( - codecs.replace_errors(UnicodeDecodeError("ascii", "\xff", 0, 1, "ouch")), - (u"\ufffd", 1) - ) - self.assertEquals( - codecs.replace_errors(UnicodeTranslateError(u"\u3042", 0, 1, "ouch")), - (u"\ufffd", 1) - ) - - def test_badandgoodxmlcharrefreplaceexceptions(self): - # "xmlcharrefreplace" complains about a non-exception passed in - self.assertRaises( - TypeError, - codecs.xmlcharrefreplace_errors, - 42 - ) - # "xmlcharrefreplace" complains about the wrong exception types - self.assertRaises( - TypeError, - codecs.xmlcharrefreplace_errors, - UnicodeError("ouch") - ) - # "xmlcharrefreplace" can only be used for encoding - self.assertRaises( - TypeError, - codecs.xmlcharrefreplace_errors, - UnicodeDecodeError("ascii", "\xff", 0, 1, "ouch") - ) - self.assertRaises( - TypeError, - codecs.xmlcharrefreplace_errors, - UnicodeTranslateError(u"\u3042", 0, 1, "ouch") - ) - # Use the correct exception - self.assertEquals( - codecs.xmlcharrefreplace_errors(UnicodeEncodeError("ascii", u"\u3042", 0, 1, "ouch")), - (u"&#%d;" % 0x3042, 1) - ) - - def test_badandgoodbackslashreplaceexceptions(self): - # "backslashreplace" complains about a non-exception passed in - self.assertRaises( - TypeError, - codecs.backslashreplace_errors, - 42 - ) - # "backslashreplace" complains about the wrong exception types - self.assertRaises( - TypeError, - codecs.backslashreplace_errors, - UnicodeError("ouch") - ) - # "backslashreplace" can only be used for encoding - self.assertRaises( - TypeError, - codecs.backslashreplace_errors, - UnicodeDecodeError("ascii", "\xff", 0, 1, "ouch") - ) - self.assertRaises( - TypeError, - codecs.backslashreplace_errors, - UnicodeTranslateError(u"\u3042", 0, 1, "ouch") - ) - # Use the correct exception - self.assertEquals( - codecs.backslashreplace_errors(UnicodeEncodeError("ascii", u"\u3042", 0, 1, "ouch")), - (u"\\u3042", 1) - ) - self.assertEquals( - codecs.backslashreplace_errors(UnicodeEncodeError("ascii", u"\x00", 0, 1, "ouch")), - (u"\\x00", 1) - ) - self.assertEquals( - codecs.backslashreplace_errors(UnicodeEncodeError("ascii", u"\xff", 0, 1, "ouch")), - (u"\\xff", 1) - ) - self.assertEquals( - codecs.backslashreplace_errors(UnicodeEncodeError("ascii", u"\u0100", 0, 1, "ouch")), - (u"\\u0100", 1) - ) - self.assertEquals( - codecs.backslashreplace_errors(UnicodeEncodeError("ascii", u"\uffff", 0, 1, "ouch")), - (u"\\uffff", 1) - ) - if sys.maxunicode>0xffff: - self.assertEquals( - codecs.backslashreplace_errors(UnicodeEncodeError("ascii", u"\U00010000", 0, 1, "ouch")), - (u"\\U00010000", 1) - ) - self.assertEquals( - codecs.backslashreplace_errors(UnicodeEncodeError("ascii", u"\U0010ffff", 0, 1, "ouch")), - (u"\\U0010ffff", 1) - ) - - def test_badhandlerresults(self): - results = ( 42, u"foo", (1,2,3), (u"foo", 1, 3), (u"foo", None), (u"foo",), ("foo", 1, 3), ("foo", None), ("foo",) ) - encs = ("ascii", "latin-1", "iso-8859-1", "iso-8859-15") - - for res in results: - codecs.register_error("test.badhandler", lambda: res) - for enc in encs: - self.assertRaises( - TypeError, - codecs.encode, - u"\u3042", - enc, - "test.badhandler" - ) - for (enc, bytes) in ( - ("ascii", "\xff"), - ("utf-8", "\xff"), - ("utf-7", "+x-") - ): - self.assertRaises( - TypeError, - codecs.decode, - bytes, - enc, - "test.badhandler" - ) - - def test_lookup(self): - self.assertEquals(codecs.strict_errors, codecs.lookup_error("strict")) - self.assertEquals(codecs.ignore_errors, codecs.lookup_error("ignore")) - self.assertEquals(codecs.strict_errors, codecs.lookup_error("strict")) - self.assertEquals( - codecs.xmlcharrefreplace_errors, - codecs.lookup_error("xmlcharrefreplace") - ) - self.assertEquals( - codecs.backslashreplace_errors, - codecs.lookup_error("backslashreplace") - ) - - def test_unencodablereplacement(self): - def unencrepl(exc): - if isinstance(exc, UnicodeEncodeError): - return (u"\u4242", exc.end) - else: - raise TypeError("don't know how to handle %r" % exc) - codecs.register_error("test.unencreplhandler", unencrepl) - for enc in ("ascii", "iso-8859-1", "iso-8859-15"): - self.assertRaises( - UnicodeEncodeError, - codecs.encode, - u"\u4242", - enc, - "test.unencreplhandler" - ) - - def test_badregistercall(self): - # enhance coverage of: - # Modules/_codecsmodule.c::register_error() - # Python/codecs.c::PyCodec_RegisterError() - self.assertRaises(TypeError, codecs.register_error, 42) - self.assertRaises(TypeError, codecs.register_error, "test.dummy", 42) - - def test_unknownhandler(self): - # enhance coverage of: - # Modules/_codecsmodule.c::lookup_error() - self.assertRaises(LookupError, codecs.lookup_error, "test.unknown") - - def test_xmlcharrefvalues(self): - # enhance coverage of: - # Python/codecs.c::PyCodec_XMLCharRefReplaceErrors() - # and inline implementations - v = (1, 5, 10, 50, 100, 500, 1000, 5000, 10000, 50000) - if sys.maxunicode>=100000: - v += (100000, 500000, 1000000) - s = u"".join([unichr(x) for x in v]) - codecs.register_error("test.xmlcharrefreplace", codecs.xmlcharrefreplace_errors) - for enc in ("ascii", "iso-8859-15"): - for err in ("xmlcharrefreplace", "test.xmlcharrefreplace"): - codecs.encode(s,enc, err) - - def test_decodehelper(self): - # enhance coverage of: - # Objects/unicodeobject.c::unicode_decode_call_errorhandler() - # and callers - self.assertRaises(LookupError, codecs.decode,"\xff", "ascii", "test.unknown") - - def baddecodereturn1(exc): - return 42 - codecs.register_error("test.baddecodereturn1", baddecodereturn1) - self.assertRaises(TypeError, codecs.decode, "\xff", "ascii", "test.baddecodereturn1") - self.assertRaises(TypeError, codecs.decode, "\\", "unicode-escape", "test.baddecodereturn1") - self.assertRaises(TypeError, codecs.decode, "\\x0", "unicode-escape", "test.baddecodereturn1") - self.assertRaises(TypeError, codecs.decode, "\\x0y", "unicode-escape", "test.baddecodereturn1") - self.assertRaises(TypeError, codecs.decode, "\\Uffffeeee", "unicode-escape", "test.baddecodereturn1") - self.assertRaises(TypeError, codecs.decode, "\\uyyyy", "raw-unicode-escape", "test.baddecodereturn1") - - def baddecodereturn2(exc): - return (u"?", None) - codecs.register_error("test.baddecodereturn2", baddecodereturn2) - self.assertRaises(TypeError, codecs.decode, "\xff", "ascii", "test.baddecodereturn2") - - handler = PosReturn() - codecs.register_error("test.posreturn", handler.handle) - - # Valid negative position - handler.pos = -1 - self.assertEquals(codecs.decode( "\xff0","ascii", "test.posreturn"), u"0") - - # Valid negative position - handler.pos = -2 - self.assertEquals(codecs.decode("\xff0","ascii", "test.posreturn"), u"") - - # Negative position out of bounds - handler.pos = -3 - self.assertRaises(IndexError, codecs.decode,"\xff0", "ascii", "test.posreturn") - - # Valid positive position - handler.pos = 1 - self.assertEquals(codecs.decode("\xff0","ascii", "test.posreturn"), u"0") - - # Largest valid positive position (one beyond end of input - handler.pos = 2 - self.assertEquals(codecs.decode("\xff0","ascii", "test.posreturn"), u"") - - # Invalid positive position - handler.pos = 3 - self.assertRaises(IndexError, codecs.decode,"\xff0", "ascii", "test.posreturn") - - # Restart at the "0" - handler.pos = 6 - self.assertEquals(codecs.decode("\\uyyyy0","raw-unicode-escape", "test.posreturn"), u"0") - - class D(dict): - def __getitem__(self, key): - raise ValueError - self.assertRaises(UnicodeError, codecs.charmap_decode, "\xff", "strict", {0xff: None}) - self.assertRaises(ValueError, codecs.charmap_decode, "\xff", "strict", D()) - self.assertRaises(TypeError, codecs.charmap_decode, "\xff", "strict", {0xff: sys.maxunicode+1}) - - def test_encodehelper(self): - # enhance coverage of: - # Objects/unicodeobject.c::unicode_encode_call_errorhandler() - # and callers - self.assertRaises(LookupError, codecs.decode,u"\xff", "ascii", "test.unknown") - - def badencodereturn1(exc): - return 42 - codecs.register_error("test.badencodereturn1", badencodereturn1) - self.assertRaises(TypeError, codecs.decode, u"\xff", "ascii", "test.badencodereturn1") - - def badencodereturn2(exc): - return (u"?", None) - codecs.register_error("test.badencodereturn2", badencodereturn2) - self.assertRaises(TypeError, codecs.decode,u"\xff", "ascii", "test.badencodereturn2") - - handler = PosReturn() - codecs.register_error("test.posreturn", handler.handle) - - # Valid negative position - handler.pos = -1 - self.assertEquals(u"\xff0".encode("ascii", "test.posreturn"), "0") - - # Valid negative position - handler.pos = -2 - self.assertEquals(u"\xff0".encode("ascii", "test.posreturn"), "") - - # Negative position out of bounds - handler.pos = -3 - self.assertRaises(IndexError, u"\xff0".encode, "ascii", "test.posreturn") - - # Valid positive position - handler.pos = 1 - self.assertEquals(u"\xff0".encode("ascii", "test.posreturn"), "0") - - # Largest valid positive position (one beyond end of input - handler.pos = 2 - self.assertEquals(u"\xff0".encode("ascii", "test.posreturn"), "") - - # Invalid positive position - handler.pos = 3 - self.assertRaises(IndexError, u"\xff0".encode, "ascii", "test.posreturn") - - handler.pos = 0 - - class D(dict): - def __getitem__(self, key): - raise ValueError - for err in ("strict", "replace", "xmlcharrefreplace", "backslashreplace", "test.posreturn"): - self.assertRaises(UnicodeError, codecs.charmap_encode, u"\xff", err, {0xff: None}) - self.assertRaises(ValueError, codecs.charmap_encode, u"\xff", err, D()) - self.assertRaises(TypeError, codecs.charmap_encode, u"\xff", err, {0xff: 300}) - - def test_translatehelper(self): - # enhance coverage of: - # Objects/unicodeobject.c::unicode_encode_call_errorhandler() - # and callers - # (Unfortunately the errors argument is not directly accessible - # from Python, so we can't test that much) - class D(dict): - def __getitem__(self, key): - raise ValueError - self.assertRaises(ValueError, u"\xff".translate, D()) - self.assertRaises(TypeError, u"\xff".translate, {0xff: sys.maxunicode+1}) - self.assertRaises(TypeError, u"\xff".translate, {0xff: ()}) - - def test_bug828737(self): - charmap = { - ord("&"): u"&", - ord("<"): u"<", - ord(">"): u">", - ord('"'): u""", - } - - for n in (1, 10, 100, 1000): - text = u'abcghi'*n - text.translate(charmap) - -def test_main(): - test.test_support.run_unittest(CodecCallbackTest) - -if __name__ == "__main__": - test_main() +import test.test_support, unittest +import sys, codecs, htmlentitydefs, unicodedata + +class PosReturn: + # this can be used for configurable callbacks + + def __init__(self): + self.pos = 0 + + def handle(self, exc): + oldpos = self.pos + realpos = oldpos + if realpos<0: + realpos = len(exc.object) + realpos + # if we don't advance this time, terminate on the next call + # otherwise we'd get an endless loop + if realpos <= exc.start: + self.pos = len(exc.object) + return (u"", oldpos) + +class CodecCallbackTest(unittest.TestCase): + + def test_xmlcharrefreplace(self): + # replace unencodable characters which numeric character entities. + # For ascii, latin-1 and charmaps this is completely implemented + # in C and should be reasonably fast. + s = u"\u30b9\u30d1\u30e2 \xe4nd eggs" + self.assertEqual( + s.encode("ascii", "xmlcharrefreplace"), + "スパモ änd eggs" + ) + self.assertEqual( + s.encode("latin-1", "xmlcharrefreplace"), + "スパモ \xe4nd eggs" + ) + + def test_xmlcharnamereplace(self): + # This time use a named character entity for unencodable + # characters, if one is available. + + def xmlcharnamereplace(exc): + if not isinstance(exc, UnicodeEncodeError): + raise TypeError("don't know how to handle %r" % exc) + l = [] + for c in exc.object[exc.start:exc.end]: + try: + l.append(u"&%s;" % htmlentitydefs.codepoint2name[ord(c)]) + except KeyError: + l.append(u"&#%d;" % ord(c)) + return (u"".join(l), exc.end) + + codecs.register_error( + "test.xmlcharnamereplace", xmlcharnamereplace) + + sin = u"\xab\u211c\xbb = \u2329\u1234\u20ac\u232a" + sout = "«ℜ» = ⟨ሴ€⟩" + self.assertEqual(codecs.encode(sin,"ascii", "test.xmlcharnamereplace"), sout) + sout = "\xabℜ\xbb = ⟨ሴ€⟩" + self.assertEqual(codecs.encode(sin,"latin-1", "test.xmlcharnamereplace"), sout) + sout = "\xabℜ\xbb = ⟨ሴ\xa4⟩" + self.assertEqual(codecs.encode(sin,"iso-8859-15", "test.xmlcharnamereplace"), sout) + + def test_uninamereplace(self): + # We're using the names from the unicode database this time, + # and we're doing "syntax highlighting" here, i.e. we include + # the replaced text in ANSI escape sequences. For this it is + # useful that the error handler is not called for every single + # unencodable character, but for a complete sequence of + # unencodable characters, otherwise we would output many + # unneccessary escape sequences. + + def uninamereplace(exc): + if not isinstance(exc, UnicodeEncodeError): + raise TypeError("don't know how to handle %r" % exc) + l = [] + for c in exc.object[exc.start:exc.end]: + l.append(unicodedata.name(c, u"0x%x" % ord(c))) + return (u"\033[1m%s\033[0m" % u", ".join(l), exc.end) + + codecs.register_error( + "test.uninamereplace", uninamereplace) + + sin = u"\xac\u1234\u20ac\u8000" + sout = "\033[1mNOT SIGN, ETHIOPIC SYLLABLE SEE, EURO SIGN, CJK UNIFIED IDEOGRAPH-8000\033[0m" + self.assertEqual(codecs.encode(sin,"ascii", "test.uninamereplace"), sout) + + sout = "\xac\033[1mETHIOPIC SYLLABLE SEE, EURO SIGN, CJK UNIFIED IDEOGRAPH-8000\033[0m" + self.assertEqual(codecs.encode(sin,"latin-1", "test.uninamereplace"), sout) + + sout = "\xac\033[1mETHIOPIC SYLLABLE SEE\033[0m\xa4\033[1mCJK UNIFIED IDEOGRAPH-8000\033[0m" + self.assertEqual(codecs.encode(sin,"iso-8859-15", "test.uninamereplace"), sout) + + def test_backslashescape(self): + # Does the same as the "unicode-escape" encoding, but with different + # base encodings. + sin = u"a\xac\u1234\u20ac\u8000" + if sys.maxunicode > 0xffff: + sin += unichr(sys.maxunicode) + sout = "a\\xac\\u1234\\u20ac\\u8000" + if sys.maxunicode > 0xffff: + sout += "\\U%08x" % sys.maxunicode + self.assertEqual(codecs.encode(sin,"ascii", "backslashreplace"), sout) + + sout = "a\xac\\u1234\\u20ac\\u8000" + if sys.maxunicode > 0xffff: + sout += "\\U%08x" % sys.maxunicode + self.assertEqual(codecs.encode(sin,"latin-1", "backslashreplace"), sout) + + sout = "a\xac\\u1234\xa4\\u8000" + if sys.maxunicode > 0xffff: + sout += "\\U%08x" % sys.maxunicode + self.assertEqual(codecs.encode(sin,"iso-8859-15", "backslashreplace"), sout) + + def test_relaxedutf8(self): + # This is the test for a decoding callback handler, + # that relaxes the UTF-8 minimal encoding restriction. + # A null byte that is encoded as "\xc0\x80" will be + # decoded as a null byte. All other illegal sequences + # will be handled strictly. + def relaxedutf8(exc): + if not isinstance(exc, UnicodeDecodeError): + raise TypeError("don't know how to handle %r" % exc) + if exc.object[exc.start:exc.end].startswith("\xc0\x80"): + return (u"\x00", exc.start+2) # retry after two bytes + else: + raise exc + + codecs.register_error( + "test.relaxedutf8", relaxedutf8) + + sin = "a\x00b\xc0\x80c\xc3\xbc\xc0\x80\xc0\x80" + sout = u"a\x00b\x00c\xfc\x00\x00" + self.assertEqual(codecs.decode(sin,"utf-8", "test.relaxedutf8"), sout) + sin = "\xc0\x80\xc0\x81" + self.assertRaises(UnicodeError, codecs.decode,sin, "utf-8", "test.relaxedutf8") + + def test_charmapencode(self): + # For charmap encodings the replacement string will be + # mapped through the encoding again. This means, that + # to be able to use e.g. the "replace" handler, the + # charmap has to have a mapping for "?". + charmap = dict([ (ord(c), 2*c.upper()) for c in "abcdefgh"]) + sin = u"abc" + sout = "AABBCC" + self.assertEquals(codecs.charmap_encode(sin, "strict", charmap)[0], sout) + + sin = u"abcA" + self.assertRaises(UnicodeError, codecs.charmap_encode, sin, "strict", charmap) + + charmap[ord("?")] = "XYZ" + sin = u"abcDEF" + sout = "AABBCCXYZXYZXYZ" + self.assertEquals(codecs.charmap_encode(sin, "replace", charmap)[0], sout) + + charmap[ord("?")] = u"XYZ" + self.assertRaises(TypeError, codecs.charmap_encode, sin, "replace", charmap) + + charmap[ord("?")] = u"XYZ" + self.assertRaises(TypeError, codecs.charmap_encode, sin, "replace", charmap) + + def test_callbacks(self): + def handler1(exc): + if not isinstance(exc, UnicodeEncodeError) \ + and not isinstance(exc, UnicodeDecodeError): + raise TypeError("don't know how to handle %r" % exc) + l = [u"<%d>" % ord(exc.object[pos]) for pos in xrange(exc.start, exc.end)] + return (u"[%s]" % u"".join(l), exc.end) + + codecs.register_error("test.handler1", handler1) + + def handler2(exc): + if not isinstance(exc, UnicodeDecodeError): + raise TypeError("don't know how to handle %r" % exc) + l = [u"<%d>" % ord(exc.object[pos]) for pos in xrange(exc.start, exc.end)] + return (u"[%s]" % u"".join(l), exc.end+1) # skip one character + + codecs.register_error("test.handler2", handler2) + + s = "\x00\x81\x7f\x80\xff" + + self.assertEqual( + codecs.decode(s,"ascii", "test.handler1"), + u"\x00[<129>]\x7f[<128>][<255>]" + ) + self.assertEqual( + codecs.decode(s,"ascii", "test.handler2"), + u"\x00[<129>][<128>]" + ) + + self.assertEqual( + codecs.decode("\\u3042\u3xxx","unicode-escape", "test.handler1"), + u"\u3042[<92><117><51><120>]xx" + ) + + self.assertEqual( + codecs.decode("\\u3042\u3xx","unicode-escape", "test.handler1"), + u"\u3042[<92><117><51><120><120>]" + ) + + self.assertEqual( + codecs.charmap_decode("abc", "test.handler1", {ord("a"): u"z"})[0], + u"z[<98>][<99>]" + ) + + self.assertEqual( + codecs.encode(u"g\xfc\xdfrk","ascii", "test.handler1"), + u"g[<252><223>]rk" + ) + + self.assertEqual( + codecs.encode(u"g\xfc\xdf","ascii", "test.handler1"), + u"g[<252><223>]" + ) + + def test_longstrings(self): + # test long strings to check for memory overflow problems + errors = [ "strict", "ignore", "replace", "xmlcharrefreplace", "backslashreplace"] + # register the handlers under different names, + # to prevent the codec from recognizing the name + for err in errors: + codecs.register_error("test." + err, codecs.lookup_error(err)) + l = 1000 + errors += [ "test." + err for err in errors ] + for uni in [ s*l for s in (u"x", u"\u3042", u"a\xe4") ]: + for enc in ("ascii", "latin-1", "iso-8859-1", "iso-8859-15", "utf-8", "utf-7", "utf-16"): + for err in errors: + try: + codecs.encode(uni,enc, err) + except UnicodeError: + pass + + def check_exceptionobjectargs(self, exctype, args, msg): + # Test UnicodeError subclasses: construction, attribute assignment and __str__ conversion + # check with one missing argument + self.assertRaises(TypeError, exctype, *args[:-1]) + # check with one argument too much + self.assertRaises(TypeError, exctype, *(args + ["too much"])) + # check with one argument of the wrong type + wrongargs = [ "spam", u"eggs", 42, 1.0, None ] + for i in xrange(len(args)): + for wrongarg in wrongargs: + if type(wrongarg) is type(args[i]): + continue + # build argument array + callargs = [] + for j in xrange(len(args)): + if i==j: + callargs.append(wrongarg) + else: + callargs.append(args[i]) + self.assertRaises(TypeError, exctype, *callargs) + + # check with the correct number and type of arguments + exc = exctype(*args) + self.assertEquals(str(exc), msg) + + def test_unicodeencodeerror(self): + self.check_exceptionobjectargs( + UnicodeEncodeError, + ["ascii", u"g\xfcrk", 1, 2, "ouch"], + "'ascii' codec can't encode character u'\\xfc' in position 1: ouch" + ) + self.check_exceptionobjectargs( + UnicodeEncodeError, + ["ascii", u"g\xfcrk", 1, 4, "ouch"], + "'ascii' codec can't encode characters in position 1-3: ouch" + ) + self.check_exceptionobjectargs( + UnicodeEncodeError, + ["ascii", u"\xfcx", 0, 1, "ouch"], + "'ascii' codec can't encode character u'\\xfc' in position 0: ouch" + ) + self.check_exceptionobjectargs( + UnicodeEncodeError, + ["ascii", u"\u0100x", 0, 1, "ouch"], + "'ascii' codec can't encode character u'\\u0100' in position 0: ouch" + ) + self.check_exceptionobjectargs( + UnicodeEncodeError, + ["ascii", u"\uffffx", 0, 1, "ouch"], + "'ascii' codec can't encode character u'\\uffff' in position 0: ouch" + ) + if sys.maxunicode > 0xffff: + self.check_exceptionobjectargs( + UnicodeEncodeError, + ["ascii", u"\U00010000x", 0, 1, "ouch"], + "'ascii' codec can't encode character u'\\U00010000' in position 0: ouch" + ) + + def test_unicodedecodeerror(self): + self.check_exceptionobjectargs( + UnicodeDecodeError, + ["ascii", "g\xfcrk", 1, 2, "ouch"], + "'ascii' codec can't decode byte 0xfc in position 1: ouch" + ) + self.check_exceptionobjectargs( + UnicodeDecodeError, + ["ascii", "g\xfcrk", 1, 3, "ouch"], + "'ascii' codec can't decode bytes in position 1-2: ouch" + ) + + def test_unicodetranslateerror(self): + self.check_exceptionobjectargs( + UnicodeTranslateError, + [u"g\xfcrk", 1, 2, "ouch"], + "can't translate character u'\\xfc' in position 1: ouch" + ) + self.check_exceptionobjectargs( + UnicodeTranslateError, + [u"g\u0100rk", 1, 2, "ouch"], + "can't translate character u'\\u0100' in position 1: ouch" + ) + self.check_exceptionobjectargs( + UnicodeTranslateError, + [u"g\uffffrk", 1, 2, "ouch"], + "can't translate character u'\\uffff' in position 1: ouch" + ) + if sys.maxunicode > 0xffff: + self.check_exceptionobjectargs( + UnicodeTranslateError, + [u"g\U00010000rk", 1, 2, "ouch"], + "can't translate character u'\\U00010000' in position 1: ouch" + ) + self.check_exceptionobjectargs( + UnicodeTranslateError, + [u"g\xfcrk", 1, 3, "ouch"], + "can't translate characters in position 1-2: ouch" + ) + + def test_badandgoodstrictexceptions(self): + # "strict" complains about a non-exception passed in + self.assertRaises( + TypeError, + codecs.strict_errors, + 42 + ) + # "strict" complains about the wrong exception type + self.assertRaises( + Exception, + codecs.strict_errors, + Exception("ouch") + ) + + # If the correct exception is passed in, "strict" raises it + self.assertRaises( + UnicodeEncodeError, + codecs.strict_errors, + UnicodeEncodeError("ascii", u"\u3042", 0, 1, "ouch") + ) + + def test_badandgoodignoreexceptions(self): + # "ignore" complains about a non-exception passed in + self.assertRaises( + TypeError, + codecs.ignore_errors, + 42 + ) + # "ignore" complains about the wrong exception type + self.assertRaises( + TypeError, + codecs.ignore_errors, + UnicodeError("ouch") + ) + # If the correct exception is passed in, "ignore" returns an empty replacement + self.assertEquals( + codecs.ignore_errors(UnicodeEncodeError("ascii", u"\u3042", 0, 1, "ouch")), + (u"", 1) + ) + self.assertEquals( + codecs.ignore_errors(UnicodeDecodeError("ascii", "\xff", 0, 1, "ouch")), + (u"", 1) + ) + self.assertEquals( + codecs.ignore_errors(UnicodeTranslateError(u"\u3042", 0, 1, "ouch")), + (u"", 1) + ) + + def test_badandgoodreplaceexceptions(self): + # "replace" complains about a non-exception passed in + self.assertRaises( + TypeError, + codecs.replace_errors, + 42 + ) + # "replace" complains about the wrong exception type + self.assertRaises( + TypeError, + codecs.replace_errors, + UnicodeError("ouch") + ) + # With the correct exception, "ignore" returns an empty replacement + self.assertEquals( + codecs.replace_errors(UnicodeEncodeError("ascii", u"\u3042", 0, 1, "ouch")), + (u"?", 1) + ) + self.assertEquals( + codecs.replace_errors(UnicodeDecodeError("ascii", "\xff", 0, 1, "ouch")), + (u"\ufffd", 1) + ) + self.assertEquals( + codecs.replace_errors(UnicodeTranslateError(u"\u3042", 0, 1, "ouch")), + (u"\ufffd", 1) + ) + + def test_badandgoodxmlcharrefreplaceexceptions(self): + # "xmlcharrefreplace" complains about a non-exception passed in + self.assertRaises( + TypeError, + codecs.xmlcharrefreplace_errors, + 42 + ) + # "xmlcharrefreplace" complains about the wrong exception types + self.assertRaises( + TypeError, + codecs.xmlcharrefreplace_errors, + UnicodeError("ouch") + ) + # "xmlcharrefreplace" can only be used for encoding + self.assertRaises( + TypeError, + codecs.xmlcharrefreplace_errors, + UnicodeDecodeError("ascii", "\xff", 0, 1, "ouch") + ) + self.assertRaises( + TypeError, + codecs.xmlcharrefreplace_errors, + UnicodeTranslateError(u"\u3042", 0, 1, "ouch") + ) + # Use the correct exception + self.assertEquals( + codecs.xmlcharrefreplace_errors(UnicodeEncodeError("ascii", u"\u3042", 0, 1, "ouch")), + (u"&#%d;" % 0x3042, 1) + ) + + def test_badandgoodbackslashreplaceexceptions(self): + # "backslashreplace" complains about a non-exception passed in + self.assertRaises( + TypeError, + codecs.backslashreplace_errors, + 42 + ) + # "backslashreplace" complains about the wrong exception types + self.assertRaises( + TypeError, + codecs.backslashreplace_errors, + UnicodeError("ouch") + ) + # "backslashreplace" can only be used for encoding + self.assertRaises( + TypeError, + codecs.backslashreplace_errors, + UnicodeDecodeError("ascii", "\xff", 0, 1, "ouch") + ) + self.assertRaises( + TypeError, + codecs.backslashreplace_errors, + UnicodeTranslateError(u"\u3042", 0, 1, "ouch") + ) + # Use the correct exception + self.assertEquals( + codecs.backslashreplace_errors(UnicodeEncodeError("ascii", u"\u3042", 0, 1, "ouch")), + (u"\\u3042", 1) + ) + self.assertEquals( + codecs.backslashreplace_errors(UnicodeEncodeError("ascii", u"\x00", 0, 1, "ouch")), + (u"\\x00", 1) + ) + self.assertEquals( + codecs.backslashreplace_errors(UnicodeEncodeError("ascii", u"\xff", 0, 1, "ouch")), + (u"\\xff", 1) + ) + self.assertEquals( + codecs.backslashreplace_errors(UnicodeEncodeError("ascii", u"\u0100", 0, 1, "ouch")), + (u"\\u0100", 1) + ) + self.assertEquals( + codecs.backslashreplace_errors(UnicodeEncodeError("ascii", u"\uffff", 0, 1, "ouch")), + (u"\\uffff", 1) + ) + if sys.maxunicode>0xffff: + self.assertEquals( + codecs.backslashreplace_errors(UnicodeEncodeError("ascii", u"\U00010000", 0, 1, "ouch")), + (u"\\U00010000", 1) + ) + self.assertEquals( + codecs.backslashreplace_errors(UnicodeEncodeError("ascii", u"\U0010ffff", 0, 1, "ouch")), + (u"\\U0010ffff", 1) + ) + + def test_badhandlerresults(self): + results = ( 42, u"foo", (1,2,3), (u"foo", 1, 3), (u"foo", None), (u"foo",), ("foo", 1, 3), ("foo", None), ("foo",) ) + encs = ("ascii", "latin-1", "iso-8859-1", "iso-8859-15") + + for res in results: + codecs.register_error("test.badhandler", lambda: res) + for enc in encs: + self.assertRaises( + TypeError, + codecs.encode, + u"\u3042", + enc, + "test.badhandler" + ) + for (enc, bytes) in ( + ("ascii", "\xff"), + ("utf-8", "\xff"), + ("utf-7", "+x-") + ): + self.assertRaises( + TypeError, + codecs.decode, + bytes, + enc, + "test.badhandler" + ) + + def test_lookup(self): + self.assertEquals(codecs.strict_errors, codecs.lookup_error("strict")) + self.assertEquals(codecs.ignore_errors, codecs.lookup_error("ignore")) + self.assertEquals(codecs.strict_errors, codecs.lookup_error("strict")) + self.assertEquals( + codecs.xmlcharrefreplace_errors, + codecs.lookup_error("xmlcharrefreplace") + ) + self.assertEquals( + codecs.backslashreplace_errors, + codecs.lookup_error("backslashreplace") + ) + + def test_unencodablereplacement(self): + def unencrepl(exc): + if isinstance(exc, UnicodeEncodeError): + return (u"\u4242", exc.end) + else: + raise TypeError("don't know how to handle %r" % exc) + codecs.register_error("test.unencreplhandler", unencrepl) + for enc in ("ascii", "iso-8859-1", "iso-8859-15"): + self.assertRaises( + UnicodeEncodeError, + codecs.encode, + u"\u4242", + enc, + "test.unencreplhandler" + ) + + def test_badregistercall(self): + # enhance coverage of: + # Modules/_codecsmodule.c::register_error() + # Python/codecs.c::PyCodec_RegisterError() + self.assertRaises(TypeError, codecs.register_error, 42) + self.assertRaises(TypeError, codecs.register_error, "test.dummy", 42) + + def test_unknownhandler(self): + # enhance coverage of: + # Modules/_codecsmodule.c::lookup_error() + self.assertRaises(LookupError, codecs.lookup_error, "test.unknown") + + def test_xmlcharrefvalues(self): + # enhance coverage of: + # Python/codecs.c::PyCodec_XMLCharRefReplaceErrors() + # and inline implementations + v = (1, 5, 10, 50, 100, 500, 1000, 5000, 10000, 50000) + if sys.maxunicode>=100000: + v += (100000, 500000, 1000000) + s = u"".join([unichr(x) for x in v]) + codecs.register_error("test.xmlcharrefreplace", codecs.xmlcharrefreplace_errors) + for enc in ("ascii", "iso-8859-15"): + for err in ("xmlcharrefreplace", "test.xmlcharrefreplace"): + codecs.encode(s,enc, err) + + def test_decodehelper(self): + # enhance coverage of: + # Objects/unicodeobject.c::unicode_decode_call_errorhandler() + # and callers + self.assertRaises(LookupError, codecs.decode,"\xff", "ascii", "test.unknown") + + def baddecodereturn1(exc): + return 42 + codecs.register_error("test.baddecodereturn1", baddecodereturn1) + self.assertRaises(TypeError, codecs.decode, "\xff", "ascii", "test.baddecodereturn1") + self.assertRaises(TypeError, codecs.decode, "\\", "unicode-escape", "test.baddecodereturn1") + self.assertRaises(TypeError, codecs.decode, "\\x0", "unicode-escape", "test.baddecodereturn1") + self.assertRaises(TypeError, codecs.decode, "\\x0y", "unicode-escape", "test.baddecodereturn1") + self.assertRaises(TypeError, codecs.decode, "\\Uffffeeee", "unicode-escape", "test.baddecodereturn1") + self.assertRaises(TypeError, codecs.decode, "\\uyyyy", "raw-unicode-escape", "test.baddecodereturn1") + + def baddecodereturn2(exc): + return (u"?", None) + codecs.register_error("test.baddecodereturn2", baddecodereturn2) + self.assertRaises(TypeError, codecs.decode, "\xff", "ascii", "test.baddecodereturn2") + + handler = PosReturn() + codecs.register_error("test.posreturn", handler.handle) + + # Valid negative position + handler.pos = -1 + self.assertEquals(codecs.decode( "\xff0","ascii", "test.posreturn"), u"0") + + # Valid negative position + handler.pos = -2 + self.assertEquals(codecs.decode("\xff0","ascii", "test.posreturn"), u"") + + # Negative position out of bounds + handler.pos = -3 + self.assertRaises(IndexError, codecs.decode,"\xff0", "ascii", "test.posreturn") + + # Valid positive position + handler.pos = 1 + self.assertEquals(codecs.decode("\xff0","ascii", "test.posreturn"), u"0") + + # Largest valid positive position (one beyond end of input + handler.pos = 2 + self.assertEquals(codecs.decode("\xff0","ascii", "test.posreturn"), u"") + + # Invalid positive position + handler.pos = 3 + self.assertRaises(IndexError, codecs.decode,"\xff0", "ascii", "test.posreturn") + + # Restart at the "0" + handler.pos = 6 + self.assertEquals(codecs.decode("\\uyyyy0","raw-unicode-escape", "test.posreturn"), u"0") + + class D(dict): + def __getitem__(self, key): + raise ValueError + self.assertRaises(UnicodeError, codecs.charmap_decode, "\xff", "strict", {0xff: None}) + self.assertRaises(ValueError, codecs.charmap_decode, "\xff", "strict", D()) + self.assertRaises(TypeError, codecs.charmap_decode, "\xff", "strict", {0xff: sys.maxunicode+1}) + + def test_encodehelper(self): + # enhance coverage of: + # Objects/unicodeobject.c::unicode_encode_call_errorhandler() + # and callers + self.assertRaises(LookupError, codecs.decode,u"\xff", "ascii", "test.unknown") + + def badencodereturn1(exc): + return 42 + codecs.register_error("test.badencodereturn1", badencodereturn1) + self.assertRaises(TypeError, codecs.decode, u"\xff", "ascii", "test.badencodereturn1") + + def badencodereturn2(exc): + return (u"?", None) + codecs.register_error("test.badencodereturn2", badencodereturn2) + self.assertRaises(TypeError, codecs.decode,u"\xff", "ascii", "test.badencodereturn2") + + handler = PosReturn() + codecs.register_error("test.posreturn", handler.handle) + + # Valid negative position + handler.pos = -1 + self.assertEquals(u"\xff0".encode("ascii", "test.posreturn"), "0") + + # Valid negative position + handler.pos = -2 + self.assertEquals(u"\xff0".encode("ascii", "test.posreturn"), "") + + # Negative position out of bounds + handler.pos = -3 + self.assertRaises(IndexError, u"\xff0".encode, "ascii", "test.posreturn") + + # Valid positive position + handler.pos = 1 + self.assertEquals(u"\xff0".encode("ascii", "test.posreturn"), "0") + + # Largest valid positive position (one beyond end of input + handler.pos = 2 + self.assertEquals(u"\xff0".encode("ascii", "test.posreturn"), "") + + # Invalid positive position + handler.pos = 3 + self.assertRaises(IndexError, u"\xff0".encode, "ascii", "test.posreturn") + + handler.pos = 0 + + class D(dict): + def __getitem__(self, key): + raise ValueError + for err in ("strict", "replace", "xmlcharrefreplace", "backslashreplace", "test.posreturn"): + self.assertRaises(UnicodeError, codecs.charmap_encode, u"\xff", err, {0xff: None}) + self.assertRaises(ValueError, codecs.charmap_encode, u"\xff", err, D()) + self.assertRaises(TypeError, codecs.charmap_encode, u"\xff", err, {0xff: 300}) + + def test_translatehelper(self): + # enhance coverage of: + # Objects/unicodeobject.c::unicode_encode_call_errorhandler() + # and callers + # (Unfortunately the errors argument is not directly accessible + # from Python, so we can't test that much) + class D(dict): + def __getitem__(self, key): + raise ValueError + self.assertRaises(ValueError, u"\xff".translate, D()) + self.assertRaises(TypeError, u"\xff".translate, {0xff: sys.maxunicode+1}) + self.assertRaises(TypeError, u"\xff".translate, {0xff: ()}) + + def test_bug828737(self): + charmap = { + ord("&"): u"&", + ord("<"): u"<", + ord(">"): u">", + ord('"'): u""", + } + + for n in (1, 10, 100, 1000): + text = u'abcghi'*n + text.translate(charmap) + +def test_main(): + test.test_support.run_unittest(CodecCallbackTest) + +if __name__ == "__main__": + test_main() From arigo at codespeak.net Tue May 3 21:42:37 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Tue, 3 May 2005 21:42:37 +0200 (CEST) Subject: [pypy-svn] r11892 - pypy/dist/pypy/objspace/std Message-ID: <20050503194237.9165B27B64@code1.codespeak.net> Author: arigo Date: Tue May 3 21:42:37 2005 New Revision: 11892 Modified: pypy/dist/pypy/objspace/std/fake.py Log: Obscure, did you say? Modified: pypy/dist/pypy/objspace/std/fake.py ============================================================================== --- pypy/dist/pypy/objspace/std/fake.py (original) +++ pypy/dist/pypy/objspace/std/fake.py Tue May 3 21:42:37 2005 @@ -1,7 +1,7 @@ from pypy.interpreter.error import OperationError, debug_print from pypy.interpreter import baseobjspace from pypy.interpreter import eval -from pypy.interpreter.function import Function +from pypy.interpreter.function import Function, BuiltinFunction from pypy.objspace.std.stdtypedef import * from pypy.objspace.std.objspace import W_Object, StdObjSpace from pypy.objspace.std.model import UnwrapError @@ -148,7 +148,13 @@ def fake_builtin_callable(space, val): return Function(space, CPythonFakeCode(val)) -_fake_type_cache.content[type(len)] = fake_builtin_callable +def fake_builtin_function(space, fn): + func = fake_builtin_callable(space, fn) + if fn.__self__ is None: + func = BuiltinFunction(func) + return func + +_fake_type_cache.content[type(len)] = fake_builtin_function _fake_type_cache.content[type(list.append)] = fake_builtin_callable _fake_type_cache.content[type(type(None).__repr__)] = fake_builtin_callable From arigo at codespeak.net Tue May 3 21:45:11 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Tue, 3 May 2005 21:45:11 +0200 (CEST) Subject: [pypy-svn] r11893 - pypy/dist/lib-python/modified-2.3.4/test Message-ID: <20050503194511.E585B27B6E@code1.codespeak.net> Author: arigo Date: Tue May 3 21:45:11 2005 New Revision: 11893 Removed: pypy/dist/lib-python/modified-2.3.4/test/test_tempfile.py Log: Resolved this problem. Deleted: /pypy/dist/lib-python/modified-2.3.4/test/test_tempfile.py ============================================================================== --- /pypy/dist/lib-python/modified-2.3.4/test/test_tempfile.py Tue May 3 21:45:11 2005 +++ (empty file) @@ -1,665 +0,0 @@ -# -# XXX THIS FAILS BECAUSE IT SETS OS.UNLINK AS A CLASS ATTRIBUTE -# GRUMBLE GRUMBLE GRUMBLE. SEE ALSO THE SAME IN TEMPFILE.PY ITSELF. -# - -# tempfile.py unit tests. - -import tempfile -import os -import sys -import re -import errno -import warnings - -import unittest -from test import test_support - -warnings.filterwarnings("ignore", - category=RuntimeWarning, - message="mktemp", module=__name__) - -if hasattr(os, 'stat'): - import stat - has_stat = 1 -else: - has_stat = 0 - -has_textmode = (tempfile._text_openflags != tempfile._bin_openflags) -has_spawnl = hasattr(os, 'spawnl') - -# TEST_FILES may need to be tweaked for systems depending on the maximum -# number of files that can be opened at one time (see ulimit -n) -if sys.platform == 'mac': - TEST_FILES = 32 -else: - TEST_FILES = 100 - -# This is organized as one test for each chunk of code in tempfile.py, -# in order of their appearance in the file. Testing which requires -# threads is not done here. - -# Common functionality. -class TC(unittest.TestCase): - - str_check = re.compile(r"[a-zA-Z0-9_-]{6}$") - - def failOnException(self, what, ei=None): - if ei is None: - ei = sys.exc_info() - self.fail("%s raised %s: %s" % (what, ei[0], ei[1])) - - def nameCheck(self, name, dir, pre, suf): - (ndir, nbase) = os.path.split(name) - npre = nbase[:len(pre)] - nsuf = nbase[len(nbase)-len(suf):] - - self.assertEqual(ndir, dir, - "file '%s' not in directory '%s'" % (name, dir)) - self.assertEqual(npre, pre, - "file '%s' does not begin with '%s'" % (nbase, pre)) - self.assertEqual(nsuf, suf, - "file '%s' does not end with '%s'" % (nbase, suf)) - - nbase = nbase[len(pre):len(nbase)-len(suf)] - self.assert_(self.str_check.match(nbase), - "random string '%s' does not match /^[a-zA-Z0-9_-]{6}$/" - % nbase) - -test_classes = [] - -class test_exports(TC): - def test_exports(self): - # There are no surprising symbols in the tempfile module - dict = tempfile.__dict__ - - expected = { - "NamedTemporaryFile" : 1, - "TemporaryFile" : 1, - "mkstemp" : 1, - "mkdtemp" : 1, - "mktemp" : 1, - "TMP_MAX" : 1, - "gettempprefix" : 1, - "gettempdir" : 1, - "tempdir" : 1, - "template" : 1 - } - - unexp = [] - for key in dict: - if key[0] != '_' and key not in expected: - unexp.append(key) - self.failUnless(len(unexp) == 0, - "unexpected keys: %s" % unexp) - -test_classes.append(test_exports) - - -class test__RandomNameSequence(TC): - """Test the internal iterator object _RandomNameSequence.""" - - def setUp(self): - self.r = tempfile._RandomNameSequence() - - def test_get_six_char_str(self): - # _RandomNameSequence returns a six-character string - s = self.r.next() - self.nameCheck(s, '', '', '') - - def test_many(self): - # _RandomNameSequence returns no duplicate strings (stochastic) - - dict = {} - r = self.r - for i in xrange(TEST_FILES): - s = r.next() - self.nameCheck(s, '', '', '') - self.failIf(s in dict) - dict[s] = 1 - - def test_supports_iter(self): - # _RandomNameSequence supports the iterator protocol - - i = 0 - r = self.r - try: - for s in r: - i += 1 - if i == 20: - break - except: - failOnException("iteration") - -test_classes.append(test__RandomNameSequence) - - -class test__candidate_tempdir_list(TC): - """Test the internal function _candidate_tempdir_list.""" - - def test_nonempty_list(self): - # _candidate_tempdir_list returns a nonempty list of strings - - cand = tempfile._candidate_tempdir_list() - - self.failIf(len(cand) == 0) - for c in cand: - self.assert_(isinstance(c, basestring), - "%s is not a string" % c) - - def test_wanted_dirs(self): - # _candidate_tempdir_list contains the expected directories - - # Make sure the interesting environment variables are all set. - added = [] - try: - for envname in 'TMPDIR', 'TEMP', 'TMP': - dirname = os.getenv(envname) - if not dirname: - os.environ[envname] = os.path.abspath(envname) - added.append(envname) - - cand = tempfile._candidate_tempdir_list() - - for envname in 'TMPDIR', 'TEMP', 'TMP': - dirname = os.getenv(envname) - if not dirname: raise ValueError - self.assert_(dirname in cand) - - try: - dirname = os.getcwd() - except (AttributeError, os.error): - dirname = os.curdir - - self.assert_(dirname in cand) - - # Not practical to try to verify the presence of OS-specific - # paths in this list. - finally: - for p in added: - del os.environ[p] - -test_classes.append(test__candidate_tempdir_list) - - -# We test _get_default_tempdir by testing gettempdir. - - -class test__get_candidate_names(TC): - """Test the internal function _get_candidate_names.""" - - def test_retval(self): - # _get_candidate_names returns a _RandomNameSequence object - obj = tempfile._get_candidate_names() - self.assert_(isinstance(obj, tempfile._RandomNameSequence)) - - def test_same_thing(self): - # _get_candidate_names always returns the same object - a = tempfile._get_candidate_names() - b = tempfile._get_candidate_names() - - self.assert_(a is b) - -test_classes.append(test__get_candidate_names) - - -class test__mkstemp_inner(TC): - """Test the internal function _mkstemp_inner.""" - - class mkstemped: - _bflags = tempfile._bin_openflags - _tflags = tempfile._text_openflags - _close = os.close - _unlink = os.unlink - - def __init__(self, dir, pre, suf, bin): - if bin: flags = self._bflags - else: flags = self._tflags - - (self.fd, self.name) = tempfile._mkstemp_inner(dir, pre, suf, flags) - - def write(self, str): - os.write(self.fd, str) - - def __del__(self): - self._close(self.fd) - self._unlink(self.name) - - def do_create(self, dir=None, pre="", suf="", bin=1): - if dir is None: - dir = tempfile.gettempdir() - try: - file = self.mkstemped(dir, pre, suf, bin) - except: - self.failOnException("_mkstemp_inner") - - self.nameCheck(file.name, dir, pre, suf) - return file - - def test_basic(self): - # _mkstemp_inner can create files - self.do_create().write("blat") - self.do_create(pre="a").write("blat") - self.do_create(suf="b").write("blat") - self.do_create(pre="a", suf="b").write("blat") - self.do_create(pre="aa", suf=".txt").write("blat") - - def test_basic_many(self): - # _mkstemp_inner can create many files (stochastic) - extant = range(TEST_FILES) - for i in extant: - extant[i] = self.do_create(pre="aa") - - def test_choose_directory(self): - # _mkstemp_inner can create files in a user-selected directory - dir = tempfile.mkdtemp() - try: - self.do_create(dir=dir).write("blat") - finally: - os.rmdir(dir) - - def test_file_mode(self): - # _mkstemp_inner creates files with the proper mode - if not has_stat: - return # ugh, can't use TestSkipped. - - file = self.do_create() - mode = stat.S_IMODE(os.stat(file.name).st_mode) - expected = 0600 - if sys.platform in ('win32', 'os2emx', 'mac'): - # There's no distinction among 'user', 'group' and 'world'; - # replicate the 'user' bits. - user = expected >> 6 - expected = user * (1 + 8 + 64) - self.assertEqual(mode, expected) - - def test_noinherit(self): - # _mkstemp_inner file handles are not inherited by child processes - if not has_spawnl: - return # ugh, can't use TestSkipped. - - if test_support.verbose: - v="v" - else: - v="q" - - file = self.do_create() - fd = "%d" % file.fd - - try: - me = __file__ - except NameError: - me = sys.argv[0] - - # We have to exec something, so that FD_CLOEXEC will take - # effect. The core of this test is therefore in - # tf_inherit_check.py, which see. - tester = os.path.join(os.path.dirname(os.path.abspath(me)), - "tf_inherit_check.py") - - # On Windows a spawn* /path/ with embedded spaces shouldn't be quoted, - # but an arg with embedded spaces should be decorated with double - # quotes on each end - if sys.platform in ('win32'): - decorated = '"%s"' % sys.executable - tester = '"%s"' % tester - else: - decorated = sys.executable - - retval = os.spawnl(os.P_WAIT, sys.executable, decorated, tester, v, fd) - self.failIf(retval < 0, - "child process caught fatal signal %d" % -retval) - self.failIf(retval > 0, "child process reports failure") - - def test_textmode(self): - # _mkstemp_inner can create files in text mode - if not has_textmode: - return # ugh, can't use TestSkipped. - - self.do_create(bin=0).write("blat\n") - # XXX should test that the file really is a text file - -test_classes.append(test__mkstemp_inner) - - -class test_gettempprefix(TC): - """Test gettempprefix().""" - - def test_sane_template(self): - # gettempprefix returns a nonempty prefix string - p = tempfile.gettempprefix() - - self.assert_(isinstance(p, basestring)) - self.assert_(len(p) > 0) - - def test_usable_template(self): - # gettempprefix returns a usable prefix string - - # Create a temp directory, avoiding use of the prefix. - # Then attempt to create a file whose name is - # prefix + 'xxxxxx.xxx' in that directory. - p = tempfile.gettempprefix() + "xxxxxx.xxx" - d = tempfile.mkdtemp(prefix="") - try: - p = os.path.join(d, p) - try: - fd = os.open(p, os.O_RDWR | os.O_CREAT) - except: - self.failOnException("os.open") - os.close(fd) - os.unlink(p) - finally: - os.rmdir(d) - -test_classes.append(test_gettempprefix) - - -class test_gettempdir(TC): - """Test gettempdir().""" - - def test_directory_exists(self): - # gettempdir returns a directory which exists - - dir = tempfile.gettempdir() - self.assert_(os.path.isabs(dir) or dir == os.curdir, - "%s is not an absolute path" % dir) - self.assert_(os.path.isdir(dir), - "%s is not a directory" % dir) - - def test_directory_writable(self): - # gettempdir returns a directory writable by the user - - # sneaky: just instantiate a NamedTemporaryFile, which - # defaults to writing into the directory returned by - # gettempdir. - try: - file = tempfile.NamedTemporaryFile() - file.write("blat") - file.close() - except: - self.failOnException("create file in %s" % tempfile.gettempdir()) - - def test_same_thing(self): - # gettempdir always returns the same object - a = tempfile.gettempdir() - b = tempfile.gettempdir() - - self.assert_(a is b) - -test_classes.append(test_gettempdir) - - -class test_mkstemp(TC): - """Test mkstemp().""" - - def do_create(self, dir=None, pre="", suf="", ): - if dir is None: - dir = tempfile.gettempdir() - try: - (fd, name) = tempfile.mkstemp(dir=dir, prefix=pre, suffix=suf) - except: - self.failOnException("mkstemp") - - try: - self.nameCheck(name, dir, pre, suf) - finally: - os.close(fd) - os.unlink(name) - - def test_basic(self): - # mkstemp can create files - self.do_create() - self.do_create(pre="a") - self.do_create(suf="b") - self.do_create(pre="a", suf="b") - self.do_create(pre="aa", suf=".txt") - - def test_choose_directory(self): - # mkstemp can create directories in a user-selected directory - dir = tempfile.mkdtemp() - try: - self.do_create(dir=dir) - finally: - os.rmdir(dir) - -test_classes.append(test_mkstemp) - - -class test_mkdtemp(TC): - """Test mkdtemp().""" - - def do_create(self, dir=None, pre="", suf=""): - if dir is None: - dir = tempfile.gettempdir() - try: - name = tempfile.mkdtemp(dir=dir, prefix=pre, suffix=suf) - except: - self.failOnException("mkdtemp") - - try: - self.nameCheck(name, dir, pre, suf) - return name - except: - os.rmdir(name) - raise - - def test_basic(self): - # mkdtemp can create directories - os.rmdir(self.do_create()) - os.rmdir(self.do_create(pre="a")) - os.rmdir(self.do_create(suf="b")) - os.rmdir(self.do_create(pre="a", suf="b")) - os.rmdir(self.do_create(pre="aa", suf=".txt")) - - def test_basic_many(self): - # mkdtemp can create many directories (stochastic) - extant = range(TEST_FILES) - try: - for i in extant: - extant[i] = self.do_create(pre="aa") - finally: - for i in extant: - if(isinstance(i, basestring)): - os.rmdir(i) - - def test_choose_directory(self): - # mkdtemp can create directories in a user-selected directory - dir = tempfile.mkdtemp() - try: - os.rmdir(self.do_create(dir=dir)) - finally: - os.rmdir(dir) - - def test_mode(self): - # mkdtemp creates directories with the proper mode - if not has_stat: - return # ugh, can't use TestSkipped. - - dir = self.do_create() - try: - mode = stat.S_IMODE(os.stat(dir).st_mode) - mode &= 0777 # Mask off sticky bits inherited from /tmp - expected = 0700 - if sys.platform in ('win32', 'os2emx', 'mac'): - # There's no distinction among 'user', 'group' and 'world'; - # replicate the 'user' bits. - user = expected >> 6 - expected = user * (1 + 8 + 64) - self.assertEqual(mode, expected) - finally: - os.rmdir(dir) - -test_classes.append(test_mkdtemp) - - -class test_mktemp(TC): - """Test mktemp().""" - - # For safety, all use of mktemp must occur in a private directory. - # We must also suppress the RuntimeWarning it generates. - def setUp(self): - self.dir = tempfile.mkdtemp() - - def tearDown(self): - if self.dir: - os.rmdir(self.dir) - self.dir = None - - class mktemped: - _unlink = os.unlink - _bflags = tempfile._bin_openflags - - def __init__(self, dir, pre, suf): - self.name = tempfile.mktemp(dir=dir, prefix=pre, suffix=suf) - # Create the file. This will raise an exception if it's - # mysteriously appeared in the meanwhile. - os.close(os.open(self.name, self._bflags, 0600)) - - def __del__(self): - self._unlink(self.name) - - def do_create(self, pre="", suf=""): - try: - file = self.mktemped(self.dir, pre, suf) - except: - self.failOnException("mktemp") - - self.nameCheck(file.name, self.dir, pre, suf) - return file - - def test_basic(self): - # mktemp can choose usable file names - self.do_create() - self.do_create(pre="a") - self.do_create(suf="b") - self.do_create(pre="a", suf="b") - self.do_create(pre="aa", suf=".txt") - - def test_many(self): - # mktemp can choose many usable file names (stochastic) - extant = range(TEST_FILES) - for i in extant: - extant[i] = self.do_create(pre="aa") - -## def test_warning(self): -## # mktemp issues a warning when used -## warnings.filterwarnings("error", -## category=RuntimeWarning, -## message="mktemp") -## self.assertRaises(RuntimeWarning, -## tempfile.mktemp, dir=self.dir) - -test_classes.append(test_mktemp) - - -# We test _TemporaryFileWrapper by testing NamedTemporaryFile. - - -class test_NamedTemporaryFile(TC): - """Test NamedTemporaryFile().""" - - def do_create(self, dir=None, pre="", suf=""): - if dir is None: - dir = tempfile.gettempdir() - try: - file = tempfile.NamedTemporaryFile(dir=dir, prefix=pre, suffix=suf) - except: - self.failOnException("NamedTemporaryFile") - - self.nameCheck(file.name, dir, pre, suf) - return file - - - def test_basic(self): - # NamedTemporaryFile can create files - self.do_create() - self.do_create(pre="a") - self.do_create(suf="b") - self.do_create(pre="a", suf="b") - self.do_create(pre="aa", suf=".txt") - - def test_creates_named(self): - # NamedTemporaryFile creates files with names - f = tempfile.NamedTemporaryFile() - self.failUnless(os.path.exists(f.name), - "NamedTemporaryFile %s does not exist" % f.name) - - def test_del_on_close(self): - # A NamedTemporaryFile is deleted when closed - dir = tempfile.mkdtemp() - try: - f = tempfile.NamedTemporaryFile(dir=dir) - f.write('blat') - f.close() - self.failIf(os.path.exists(f.name), - "NamedTemporaryFile %s exists after close" % f.name) - finally: - os.rmdir(dir) - - def test_multiple_close(self): - # A NamedTemporaryFile can be closed many times without error - - f = tempfile.NamedTemporaryFile() - f.write('abc\n') - f.close() - try: - f.close() - f.close() - except: - self.failOnException("close") - - # How to test the mode and bufsize parameters? - -test_classes.append(test_NamedTemporaryFile) - - -class test_TemporaryFile(TC): - """Test TemporaryFile().""" - - def test_basic(self): - # TemporaryFile can create files - # No point in testing the name params - the file has no name. - try: - tempfile.TemporaryFile() - except: - self.failOnException("TemporaryFile") - - def test_has_no_name(self): - # TemporaryFile creates files with no names (on this system) - dir = tempfile.mkdtemp() - f = tempfile.TemporaryFile(dir=dir) - f.write('blat') - - # Sneaky: because this file has no name, it should not prevent - # us from removing the directory it was created in. - try: - os.rmdir(dir) - except: - ei = sys.exc_info() - # cleanup - f.close() - os.rmdir(dir) - self.failOnException("rmdir", ei) - - def test_multiple_close(self): - # A TemporaryFile can be closed many times without error - f = tempfile.TemporaryFile() - f.write('abc\n') - f.close() - try: - f.close() - f.close() - except: - self.failOnException("close") - - # How to test the mode and bufsize parameters? - - -if tempfile.NamedTemporaryFile is not tempfile.TemporaryFile: - test_classes.append(test_TemporaryFile) - -def test_main(): - test_support.run_unittest(*test_classes) - -if __name__ == "__main__": - test_main() From arigo at codespeak.net Tue May 3 21:56:14 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Tue, 3 May 2005 21:56:14 +0200 (CEST) Subject: [pypy-svn] r11895 - pypy/dist/lib-python/modified-2.3.4/test Message-ID: <20050503195614.8BA7F27B82@code1.codespeak.net> Author: arigo Date: Tue May 3 21:56:14 2005 New Revision: 11895 Modified: pypy/dist/lib-python/modified-2.3.4/test/test_class.py Log: Using "is not" to compare two strings? Bad idea. Modified: pypy/dist/lib-python/modified-2.3.4/test/test_class.py ============================================================================== --- pypy/dist/lib-python/modified-2.3.4/test/test_class.py (original) +++ pypy/dist/lib-python/modified-2.3.4/test/test_class.py Tue May 3 21:56:14 2005 @@ -353,7 +353,7 @@ try: A().a # Raised AttributeError: A instance has no attribute 'a' except AttributeError, x: - if str(x) is not "booh": + if str(x) != "booh": print "attribute error for A().a got masked:", str(x) class E: From arigo at codespeak.net Tue May 3 22:07:11 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Tue, 3 May 2005 22:07:11 +0200 (CEST) Subject: [pypy-svn] r11897 - pypy/dist/pypy/lib Message-ID: <20050503200711.5A64527B82@code1.codespeak.net> Author: arigo Date: Tue May 3 22:07:11 2005 New Revision: 11897 Modified: pypy/dist/pypy/lib/_classobj.py Log: __del__() support for old-style classes. Modified: pypy/dist/pypy/lib/_classobj.py ============================================================================== --- pypy/dist/pypy/lib/_classobj.py (original) +++ pypy/dist/pypy/lib/_classobj.py Tue May 3 22:07:11 2005 @@ -275,6 +275,11 @@ obj_setattr(inst, '__dict__', dic) return inst + def __del__(self): + func = instance_getattr1(self, '__del__', exc=False) + if func is not None: + func() + def __setattr__(self, name, value): if name == '__dict__': if not isinstance(value, dict): From pedronis at codespeak.net Tue May 3 22:10:12 2005 From: pedronis at codespeak.net (pedronis at codespeak.net) Date: Tue, 3 May 2005 22:10:12 +0200 (CEST) Subject: [pypy-svn] r11898 - pypy/dist/pypy/module Message-ID: <20050503201012.338D627B82@code1.codespeak.net> Author: pedronis Date: Tue May 3 22:10:11 2005 New Revision: 11898 Modified: pypy/dist/pypy/module/classobjinterp.py Log: regenerated Modified: pypy/dist/pypy/module/classobjinterp.py ============================================================================== --- pypy/dist/pypy/module/classobjinterp.py (original) +++ pypy/dist/pypy/module/classobjinterp.py Tue May 3 22:10:11 2005 @@ -1937,9 +1937,50 @@ ##SECTION## ## filename 'lib/_classobj.py' -## function '__setattr__' +## function '__del__' ## firstlineno 278 ##SECTION## + def __del__(space, __args__): + funcname = "__del__" + signature = ['self'], None, None + defaults_w = [] + w_self, = __args__.parse(funcname, signature, defaults_w) + return fastf_instance___del__(space, w_self) + + f_instance___del__ = __del__ + + def __del__(space, w_self): + goto = 1 # startblock + while True: + + if goto == 1: + _args = gateway.Arguments.fromshape(space, (2, ('exc',), False, False), [w_self, gs___del__, space.w_False]) + w_0 = space.call_args(gfunc_instance_getattr1, _args) + w_1 = space.is_(w_0, space.w_None) + v0 = space.is_true(w_1) + if v0 == True: + w_2 = space.w_None + goto = 3 + else: + assert v0 == False + w_3 = w_0 + goto = 2 + + if goto == 2: + w_4 = space.call_function(w_3, ) + w_2 = space.w_None + goto = 3 + + if goto == 3: + return w_2 + + fastf_instance___del__ = __del__ + +##SECTION## +## filename 'lib/_classobj.py' +## function '__setattr__' +## firstlineno 283 +##SECTION## # global declarations # global object gs___dict___must_be_set_to_a_dictio # global object gs___class___must_be_set_to_a_class @@ -2093,7 +2134,7 @@ ##SECTION## ## filename 'lib/_classobj.py' ## function '__delattr__' -## firstlineno 294 +## firstlineno 299 ##SECTION## # global declarations # global object g2tuple_2 @@ -2198,7 +2239,7 @@ ##SECTION## ## filename 'lib/_classobj.py' ## function '__repr__' -## firstlineno 310 +## firstlineno 315 ##SECTION## # global declaration # global object gs___s__s_instance_at_0x_x_ @@ -2277,7 +2318,7 @@ ##SECTION## ## filename 'lib/_classobj.py' ## function '__str__' -## firstlineno 319 +## firstlineno 324 ##SECTION## def __str__(space, __args__): funcname = "__str__" @@ -2348,7 +2389,7 @@ ##SECTION## ## filename 'lib/_classobj.py' ## function '__hash__' -## firstlineno 326 +## firstlineno 331 ##SECTION## # global declarations # global object gs_unhashable_instance @@ -2493,7 +2534,7 @@ ##SECTION## ## filename 'lib/_classobj.py' ## function '__len__' -## firstlineno 340 +## firstlineno 345 ##SECTION## # global declarations # global object gs___len_____should_return____0 @@ -2595,7 +2636,7 @@ ##SECTION## ## filename 'lib/_classobj.py' ## function '__getitem__' -## firstlineno 349 +## firstlineno 354 ##SECTION## def __getitem__(space, __args__): funcname = "__getitem__" @@ -2624,7 +2665,7 @@ ##SECTION## ## filename 'lib/_classobj.py' ## function '__setitem__' -## firstlineno 352 +## firstlineno 357 ##SECTION## def __setitem__(space, __args__): funcname = "__setitem__" @@ -2653,7 +2694,7 @@ ##SECTION## ## filename 'lib/_classobj.py' ## function '__delitem__' -## firstlineno 355 +## firstlineno 360 ##SECTION## def __delitem__(space, __args__): funcname = "__delitem__" @@ -2682,7 +2723,7 @@ ##SECTION## ## filename 'lib/_classobj.py' ## function '__getslice__' -## firstlineno 358 +## firstlineno 363 ##SECTION## def __getslice__(space, __args__): funcname = "__getslice__" @@ -2727,7 +2768,7 @@ ##SECTION## ## filename 'lib/_classobj.py' ## function '__setslice__' -## firstlineno 365 +## firstlineno 370 ##SECTION## def __setslice__(space, __args__): funcname = "__setslice__" @@ -2772,7 +2813,7 @@ ##SECTION## ## filename 'lib/_classobj.py' ## function '__delslice__' -## firstlineno 372 +## firstlineno 377 ##SECTION## def __delslice__(space, __args__): funcname = "__delslice__" @@ -2817,7 +2858,7 @@ ##SECTION## ## filename 'lib/_classobj.py' ## function '__contains__' -## firstlineno 379 +## firstlineno 384 ##SECTION## def __contains__(space, __args__): funcname = "__contains__" @@ -2886,7 +2927,7 @@ ##SECTION## ## filename 'lib/_classobj.py' ## function '__abs__' -## firstlineno 394 +## firstlineno 399 ##SECTION## def __abs__(space, __args__): funcname = "__abs__" @@ -2915,7 +2956,7 @@ ##SECTION## ## filename 'lib/_classobj.py' ## function '__float__' -## firstlineno 394 +## firstlineno 399 ##SECTION## def __float__(space, __args__): funcname = "__float__" @@ -2944,7 +2985,7 @@ ##SECTION## ## filename 'lib/_classobj.py' ## function '__hex__' -## firstlineno 394 +## firstlineno 399 ##SECTION## def __hex__(space, __args__): funcname = "__hex__" @@ -2973,7 +3014,7 @@ ##SECTION## ## filename 'lib/_classobj.py' ## function '__int__' -## firstlineno 394 +## firstlineno 399 ##SECTION## def __int__(space, __args__): funcname = "__int__" @@ -3002,7 +3043,7 @@ ##SECTION## ## filename 'lib/_classobj.py' ## function '__invert__' -## firstlineno 394 +## firstlineno 399 ##SECTION## def __invert__(space, __args__): funcname = "__invert__" @@ -3031,7 +3072,7 @@ ##SECTION## ## filename 'lib/_classobj.py' ## function '__long__' -## firstlineno 394 +## firstlineno 399 ##SECTION## def __long__(space, __args__): funcname = "__long__" @@ -3060,7 +3101,7 @@ ##SECTION## ## filename 'lib/_classobj.py' ## function '__neg__' -## firstlineno 394 +## firstlineno 399 ##SECTION## def __neg__(space, __args__): funcname = "__neg__" @@ -3089,7 +3130,7 @@ ##SECTION## ## filename 'lib/_classobj.py' ## function '__oct__' -## firstlineno 394 +## firstlineno 399 ##SECTION## def __oct__(space, __args__): funcname = "__oct__" @@ -3118,7 +3159,7 @@ ##SECTION## ## filename 'lib/_classobj.py' ## function '__pos__' -## firstlineno 394 +## firstlineno 399 ##SECTION## def __pos__(space, __args__): funcname = "__pos__" @@ -3147,7 +3188,7 @@ ##SECTION## ## filename 'lib/_classobj.py' ## function '__coerce__' -## firstlineno 400 +## firstlineno 405 ##SECTION## def __coerce__(space, __args__): funcname = "__coerce__" @@ -3186,7 +3227,7 @@ ##SECTION## ## filename 'lib/_classobj.py' ## function '__add__' -## firstlineno 417 +## firstlineno 422 ##SECTION## def __add__(space, __args__): funcname = "__add__" @@ -3261,7 +3302,7 @@ ##SECTION## ## filename 'lib/_classobj.py' ## function '__and__' -## firstlineno 417 +## firstlineno 422 ##SECTION## def __and__(space, __args__): funcname = "__and__" @@ -3336,7 +3377,7 @@ ##SECTION## ## filename 'lib/_classobj.py' ## function '__div__' -## firstlineno 417 +## firstlineno 422 ##SECTION## def __div__(space, __args__): funcname = "__div__" @@ -3411,7 +3452,7 @@ ##SECTION## ## filename 'lib/_classobj.py' ## function '__divmod__' -## firstlineno 417 +## firstlineno 422 ##SECTION## def __divmod__(space, __args__): funcname = "__divmod__" @@ -3486,7 +3527,7 @@ ##SECTION## ## filename 'lib/_classobj.py' ## function '__floordiv__' -## firstlineno 417 +## firstlineno 422 ##SECTION## def __floordiv__(space, __args__): funcname = "__floordiv__" @@ -3561,7 +3602,7 @@ ##SECTION## ## filename 'lib/_classobj.py' ## function '__lshift__' -## firstlineno 417 +## firstlineno 422 ##SECTION## def __lshift__(space, __args__): funcname = "__lshift__" @@ -3636,7 +3677,7 @@ ##SECTION## ## filename 'lib/_classobj.py' ## function '__mod__' -## firstlineno 417 +## firstlineno 422 ##SECTION## def __mod__(space, __args__): funcname = "__mod__" @@ -3711,7 +3752,7 @@ ##SECTION## ## filename 'lib/_classobj.py' ## function '__mul__' -## firstlineno 417 +## firstlineno 422 ##SECTION## def __mul__(space, __args__): funcname = "__mul__" @@ -3786,7 +3827,7 @@ ##SECTION## ## filename 'lib/_classobj.py' ## function '__or__' -## firstlineno 417 +## firstlineno 422 ##SECTION## def __or__(space, __args__): funcname = "__or__" @@ -3861,7 +3902,7 @@ ##SECTION## ## filename 'lib/_classobj.py' ## function '__rshift__' -## firstlineno 417 +## firstlineno 422 ##SECTION## def __rshift__(space, __args__): funcname = "__rshift__" @@ -3936,7 +3977,7 @@ ##SECTION## ## filename 'lib/_classobj.py' ## function '__sub__' -## firstlineno 417 +## firstlineno 422 ##SECTION## def __sub__(space, __args__): funcname = "__sub__" @@ -4011,7 +4052,7 @@ ##SECTION## ## filename 'lib/_classobj.py' ## function '__truediv__' -## firstlineno 417 +## firstlineno 422 ##SECTION## def __truediv__(space, __args__): funcname = "__truediv__" @@ -4086,7 +4127,7 @@ ##SECTION## ## filename 'lib/_classobj.py' ## function '__xor__' -## firstlineno 417 +## firstlineno 422 ##SECTION## # global declaration # global object gfunc__coerce @@ -4164,7 +4205,7 @@ ##SECTION## ## filename 'lib/_classobj.py' ## function '__radd__' -## firstlineno 427 +## firstlineno 432 ##SECTION## def __radd__(space, __args__): funcname = "__radd__" @@ -4239,7 +4280,7 @@ ##SECTION## ## filename 'lib/_classobj.py' ## function '__rand__' -## firstlineno 427 +## firstlineno 432 ##SECTION## def __rand__(space, __args__): funcname = "__rand__" @@ -4314,7 +4355,7 @@ ##SECTION## ## filename 'lib/_classobj.py' ## function '__rdiv__' -## firstlineno 427 +## firstlineno 432 ##SECTION## def __rdiv__(space, __args__): funcname = "__rdiv__" @@ -4389,7 +4430,7 @@ ##SECTION## ## filename 'lib/_classobj.py' ## function '__rdivmod__' -## firstlineno 427 +## firstlineno 432 ##SECTION## def __rdivmod__(space, __args__): funcname = "__rdivmod__" @@ -4464,7 +4505,7 @@ ##SECTION## ## filename 'lib/_classobj.py' ## function '__rfloordiv__' -## firstlineno 427 +## firstlineno 432 ##SECTION## def __rfloordiv__(space, __args__): funcname = "__rfloordiv__" @@ -4539,7 +4580,7 @@ ##SECTION## ## filename 'lib/_classobj.py' ## function '__rlshift__' -## firstlineno 427 +## firstlineno 432 ##SECTION## def __rlshift__(space, __args__): funcname = "__rlshift__" @@ -4614,7 +4655,7 @@ ##SECTION## ## filename 'lib/_classobj.py' ## function '__rmod__' -## firstlineno 427 +## firstlineno 432 ##SECTION## def __rmod__(space, __args__): funcname = "__rmod__" @@ -4689,7 +4730,7 @@ ##SECTION## ## filename 'lib/_classobj.py' ## function '__rmul__' -## firstlineno 427 +## firstlineno 432 ##SECTION## def __rmul__(space, __args__): funcname = "__rmul__" @@ -4764,7 +4805,7 @@ ##SECTION## ## filename 'lib/_classobj.py' ## function '__ror__' -## firstlineno 427 +## firstlineno 432 ##SECTION## def __ror__(space, __args__): funcname = "__ror__" @@ -4839,7 +4880,7 @@ ##SECTION## ## filename 'lib/_classobj.py' ## function '__rrshift__' -## firstlineno 427 +## firstlineno 432 ##SECTION## def __rrshift__(space, __args__): funcname = "__rrshift__" @@ -4914,7 +4955,7 @@ ##SECTION## ## filename 'lib/_classobj.py' ## function '__rsub__' -## firstlineno 427 +## firstlineno 432 ##SECTION## def __rsub__(space, __args__): funcname = "__rsub__" @@ -4989,7 +5030,7 @@ ##SECTION## ## filename 'lib/_classobj.py' ## function '__rtruediv__' -## firstlineno 427 +## firstlineno 432 ##SECTION## def __rtruediv__(space, __args__): funcname = "__rtruediv__" @@ -5064,7 +5105,7 @@ ##SECTION## ## filename 'lib/_classobj.py' ## function '__rxor__' -## firstlineno 427 +## firstlineno 432 ##SECTION## def __rxor__(space, __args__): funcname = "__rxor__" @@ -5139,7 +5180,7 @@ ##SECTION## ## filename 'lib/_classobj.py' ## function '__iadd__' -## firstlineno 445 +## firstlineno 450 ##SECTION## def __iadd__(space, __args__): funcname = "__iadd__" @@ -5178,7 +5219,7 @@ ##SECTION## ## filename 'lib/_classobj.py' ## function '__iand__' -## firstlineno 445 +## firstlineno 450 ##SECTION## def __iand__(space, __args__): funcname = "__iand__" @@ -5217,7 +5258,7 @@ ##SECTION## ## filename 'lib/_classobj.py' ## function '__idiv__' -## firstlineno 445 +## firstlineno 450 ##SECTION## def __idiv__(space, __args__): funcname = "__idiv__" @@ -5256,7 +5297,7 @@ ##SECTION## ## filename 'lib/_classobj.py' ## function '__ifloordiv__' -## firstlineno 445 +## firstlineno 450 ##SECTION## def __ifloordiv__(space, __args__): funcname = "__ifloordiv__" @@ -5295,7 +5336,7 @@ ##SECTION## ## filename 'lib/_classobj.py' ## function '__ilshift__' -## firstlineno 445 +## firstlineno 450 ##SECTION## def __ilshift__(space, __args__): funcname = "__ilshift__" @@ -5334,7 +5375,7 @@ ##SECTION## ## filename 'lib/_classobj.py' ## function '__imod__' -## firstlineno 445 +## firstlineno 450 ##SECTION## def __imod__(space, __args__): funcname = "__imod__" @@ -5373,7 +5414,7 @@ ##SECTION## ## filename 'lib/_classobj.py' ## function '__imul__' -## firstlineno 445 +## firstlineno 450 ##SECTION## def __imul__(space, __args__): funcname = "__imul__" @@ -5412,7 +5453,7 @@ ##SECTION## ## filename 'lib/_classobj.py' ## function '__ior__' -## firstlineno 445 +## firstlineno 450 ##SECTION## def __ior__(space, __args__): funcname = "__ior__" @@ -5451,7 +5492,7 @@ ##SECTION## ## filename 'lib/_classobj.py' ## function '__ipow__' -## firstlineno 445 +## firstlineno 450 ##SECTION## def __ipow__(space, __args__): funcname = "__ipow__" @@ -5490,7 +5531,7 @@ ##SECTION## ## filename 'lib/_classobj.py' ## function '__irshift__' -## firstlineno 445 +## firstlineno 450 ##SECTION## def __irshift__(space, __args__): funcname = "__irshift__" @@ -5529,7 +5570,7 @@ ##SECTION## ## filename 'lib/_classobj.py' ## function '__isub__' -## firstlineno 445 +## firstlineno 450 ##SECTION## def __isub__(space, __args__): funcname = "__isub__" @@ -5568,7 +5609,7 @@ ##SECTION## ## filename 'lib/_classobj.py' ## function '__itruediv__' -## firstlineno 445 +## firstlineno 450 ##SECTION## def __itruediv__(space, __args__): funcname = "__itruediv__" @@ -5607,7 +5648,7 @@ ##SECTION## ## filename 'lib/_classobj.py' ## function '__ixor__' -## firstlineno 445 +## firstlineno 450 ##SECTION## def __ixor__(space, __args__): funcname = "__ixor__" @@ -5646,7 +5687,7 @@ ##SECTION## ## filename 'lib/_classobj.py' ## function '__pow__' -## firstlineno 454 +## firstlineno 459 ##SECTION## def __pow__(space, __args__): funcname = "__pow__" @@ -5749,7 +5790,7 @@ ##SECTION## ## filename 'lib/_classobj.py' ## function '__rpow__' -## firstlineno 472 +## firstlineno 477 ##SECTION## def __rpow__(space, __args__): funcname = "__rpow__" @@ -5852,7 +5893,7 @@ ##SECTION## ## filename 'lib/_classobj.py' ## function '__nonzero__' -## firstlineno 490 +## firstlineno 495 ##SECTION## # global declarations # global object gs___nonzero_____should_return____0 @@ -5980,7 +6021,7 @@ ##SECTION## ## filename 'lib/_classobj.py' ## function '__call__' -## firstlineno 505 +## firstlineno 510 ##SECTION## # global declaration # global object gs__s_instance_has_no___call___meth @@ -6063,7 +6104,7 @@ ##SECTION## ## filename 'lib/_classobj.py' ## function '__eq__' -## firstlineno 516 +## firstlineno 521 ##SECTION## def __eq__(space, __args__): funcname = "__eq__" @@ -6135,7 +6176,7 @@ ##SECTION## ## filename 'lib/_classobj.py' ## function '__ge__' -## firstlineno 516 +## firstlineno 521 ##SECTION## def __ge__(space, __args__): funcname = "__ge__" @@ -6207,7 +6248,7 @@ ##SECTION## ## filename 'lib/_classobj.py' ## function '__gt__' -## firstlineno 516 +## firstlineno 521 ##SECTION## def __gt__(space, __args__): funcname = "__gt__" @@ -6279,7 +6320,7 @@ ##SECTION## ## filename 'lib/_classobj.py' ## function '__le__' -## firstlineno 516 +## firstlineno 521 ##SECTION## def __le__(space, __args__): funcname = "__le__" @@ -6351,7 +6392,7 @@ ##SECTION## ## filename 'lib/_classobj.py' ## function '__lt__' -## firstlineno 516 +## firstlineno 521 ##SECTION## def __lt__(space, __args__): funcname = "__lt__" @@ -6423,7 +6464,7 @@ ##SECTION## ## filename 'lib/_classobj.py' ## function '__ne__' -## firstlineno 516 +## firstlineno 521 ##SECTION## def __ne__(space, __args__): funcname = "__ne__" @@ -6495,7 +6536,7 @@ ##SECTION## ## filename 'lib/_classobj.py' ## function '__iter__' -## firstlineno 525 +## firstlineno 530 ##SECTION## # global declarations # global object gs___iter___returned_non_iterator_o @@ -6606,7 +6647,7 @@ ##SECTION## ## filename 'lib/_classobj.py' ## function 'next' -## firstlineno 540 +## firstlineno 545 ##SECTION## # global declaration # global object gs_instance_has_no_next___method @@ -6656,7 +6697,7 @@ ##SECTION## ## filename 'lib/_classobj.py' ## function '__cmp__' -## firstlineno 546 +## firstlineno 551 ##SECTION## # global declarations # global object gi_minus_1 @@ -6849,7 +6890,7 @@ ##SECTION## ## filename 'lib/_classobj.py' ## function 'purify' -## firstlineno 584 +## firstlineno 589 ##SECTION## # global declarations # global object g3tuple @@ -6915,6 +6956,8 @@ # global object gfunc_instance___coerce__ # global object gs___contains__ # global object gfunc_instance___contains__ +# global object gs___del__ +# global object gfunc_instance___del__ # global object gs___delattr__ # global object gfunc_instance___delattr__ # global object gs___delitem__ @@ -7115,6 +7158,9 @@ gs___contains__ = space.wrap('__contains__') gfunc_instance___contains__ = space.wrap(gateway.interp2app(f_instance___contains__, unwrap_spec=[gateway.ObjSpace, gateway.Arguments])) space.setattr(gcls_instance, gs___contains__, gfunc_instance___contains__) + gs___del__ = space.wrap('__del__') + gfunc_instance___del__ = space.wrap(gateway.interp2app(f_instance___del__, unwrap_spec=[gateway.ObjSpace, gateway.Arguments])) + space.setattr(gcls_instance, gs___del__, gfunc_instance___del__) gs___delattr__ = space.wrap('__delattr__') gfunc_instance___delattr__ = space.wrap(gateway.interp2app(f_instance___delattr__, unwrap_spec=[gateway.ObjSpace, gateway.Arguments])) space.setattr(gcls_instance, gs___delattr__, gfunc_instance___delattr__) From arigo at codespeak.net Tue May 3 22:38:47 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Tue, 3 May 2005 22:38:47 +0200 (CEST) Subject: [pypy-svn] r11903 - pypy/dist/pypy/objspace/std Message-ID: <20050503203847.1729527B85@code1.codespeak.net> Author: arigo Date: Tue May 3 22:38:46 2005 New Revision: 11903 Modified: pypy/dist/pypy/objspace/std/fake.py Log: Veeeery obscure hacks to fake SRE_Pattern and SRE_Match's methods. Used in ConfigParser.py: class SafeConfigParser: match = re.compile(r"...").match Modified: pypy/dist/pypy/objspace/std/fake.py ============================================================================== --- pypy/dist/pypy/objspace/std/fake.py (original) +++ pypy/dist/pypy/objspace/std/fake.py Tue May 3 22:38:46 2005 @@ -59,13 +59,13 @@ import __builtin__ p = re.compile("foo") for meth_name in p.__methods__: - kw[meth_name] = __builtin__.eval("lambda p,*args,**kwds: p.%s(*args,**kwds)" % meth_name) + kw[meth_name] = EvenMoreObscureWrapping(__builtin__.eval("lambda p,*args,**kwds: p.%s(*args,**kwds)" % meth_name)) elif cpy_type.__name__ == 'SRE_Match': import re import __builtin__ m = re.compile("foo").match('foo') for meth_name in m.__methods__: - kw[meth_name] = __builtin__.eval("lambda m,*args,**kwds: m.%s(*args,**kwds)" % meth_name) + kw[meth_name] = EvenMoreObscureWrapping(__builtin__.eval("lambda m,*args,**kwds: m.%s(*args,**kwds)" % meth_name)) else: for s, v in cpy_type.__dict__.items(): if not (cpy_type is unicode and s in ['__add__', '__contains__']): @@ -145,6 +145,12 @@ wrap_exception(self.space) return self.space.wrap(result) +class EvenMoreObscureWrapping(baseobjspace.BaseWrappable): + def __init__(self, val): + self.val = val + def __spacebind__(self, space): + return fake_builtin_callable(space, self.val) + def fake_builtin_callable(space, val): return Function(space, CPythonFakeCode(val)) From arigo at codespeak.net Tue May 3 22:51:01 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Tue, 3 May 2005 22:51:01 +0200 (CEST) Subject: [pypy-svn] r11905 - in pypy/dist/pypy/objspace: std test Message-ID: <20050503205101.EE50527B82@code1.codespeak.net> Author: arigo Date: Tue May 3 22:51:01 2005 New Revision: 11905 Modified: pypy/dist/pypy/objspace/std/objspace.py pypy/dist/pypy/objspace/test/test_descroperation.py Log: Oups. __getslice__()'s maximum index is not sys.maxint, but the maximum value that fits in a C int. Grumble. Modified: pypy/dist/pypy/objspace/std/objspace.py ============================================================================== --- pypy/dist/pypy/objspace/std/objspace.py (original) +++ pypy/dist/pypy/objspace/std/objspace.py Tue May 3 22:51:01 2005 @@ -366,6 +366,14 @@ pow.extras['defaults'] = (None,) +# what is the maximum value slices can get on CPython? +# we need to stick to that value, because fake.py etc. +class Temp: + def __getslice__(self, i, j): + return j +slice_max = Temp()[:] +del Temp + def old_slice_range(space, w_obj, w_start, w_stop): """Only for backward compatibility for __getslice__()&co methods.""" @@ -377,7 +385,7 @@ # behavior when w_obj doesn't implement __len__(), so we just # ignore this case. if space.is_w(w_stop, space.w_None): - w_stop = space.wrap(sys.maxint) + w_stop = space.wrap(slice_max) elif space.is_true(space.lt(w_stop, space.wrap(0))): w_stop = space.add(w_stop, space.len(w_obj)) return w_start, w_stop Modified: pypy/dist/pypy/objspace/test/test_descroperation.py ============================================================================== --- pypy/dist/pypy/objspace/test/test_descroperation.py (original) +++ pypy/dist/pypy/objspace/test/test_descroperation.py Tue May 3 22:51:01 2005 @@ -28,10 +28,12 @@ sq = Sq() assert sq[1:3] == (1,3) - import sys - assert sq[1:] == (1, sys.maxint) + slice_min, slice_max = sq[:] + assert slice_min == 0 + assert slice_max >= 2**31-1 + assert sq[1:] == (1, slice_max) assert sq[:3] == (0, 3) - assert sq[:] == (0, sys.maxint) + assert sq[:] == (0, slice_max) # negative indices assert sq[-1:3] == (99, 3) assert sq[1:-3] == (1, 97) @@ -54,13 +56,14 @@ sq[12:] = 'world' sq[:-1] = 'spam' sq[:] = 'egg' + slice_max = ops[-1][1] + assert slice_max >= 2**31-1 - import sys assert ops == [ (95, 3, 'hello'), - (12, sys.maxint, 'world'), + (12, slice_max, 'world'), (0, 99, 'spam'), - (0, sys.maxint, 'egg'), + (0, slice_max, 'egg'), ] def test_delslice(self): @@ -78,13 +81,14 @@ del sq[-12:] del sq[:1] del sq[:] + slice_max = ops[-1][1] + assert slice_max >= 2**31-1 - import sys assert ops == [ (5, 97), - (88, sys.maxint), + (88, slice_max), (0, 1), - (0, sys.maxint), + (0, slice_max), ] def test_ipow(self): From hpk at codespeak.net Wed May 4 00:29:39 2005 From: hpk at codespeak.net (hpk at codespeak.net) Date: Wed, 4 May 2005 00:29:39 +0200 (CEST) Subject: [pypy-svn] r11907 - pypy/dist/pypy/module/builtin Message-ID: <20050503222939.6CC0427B76@code1.codespeak.net> Author: hpk Date: Wed May 4 00:29:39 2005 New Revision: 11907 Modified: pypy/dist/pypy/module/builtin/compiling.py Log: make test_global.py work which depends on compile() interacting nicely with the warnings module. on 'compile()' we intercept interp-level SyntaxWarnings and send them to applevel, reraising SyntaxWarnings as SyntaxError just as CPython does. Modified: pypy/dist/pypy/module/builtin/compiling.py ============================================================================== --- pypy/dist/pypy/module/builtin/compiling.py (original) +++ pypy/dist/pypy/module/builtin/compiling.py Wed May 4 00:29:39 2005 @@ -7,6 +7,44 @@ from pypy.interpreter.error import OperationError from pypy.interpreter.gateway import NoneNotWrapped import __builtin__ as cpy_builtin +import warnings + +def setup_warn_explicit(space): + """ NOT_RPYTHON + + this is a hack until we have our own parsing/compiling + in place: we bridge certain warnings to the applevel + warnings module to let it decide what to do with + a syntax warning ... + """ + def warn_explicit(message, category, filename, lineno, + module=None, registry=None): + if hasattr(category, '__bases__') and \ + issubclass(category, SyntaxWarning): + assert isinstance(message, str) + w_mod = space.sys.getmodule('warnings') + if w_mod is not None: + w_dict = w_mod.getdict() + w_reg = space.call_method(w_dict, 'setdefault', + space.wrap("__warningregistry__"), + space.newdict([])) + try: + space.call_method(w_mod, 'warn_explicit', + space.wrap(message), + space.w_SyntaxWarning, + space.wrap(filename), + space.wrap(lineno), + space.w_None, + space.w_None) + except OperationError, e: + if e.match(space, space.w_SyntaxWarning): + raise OperationError( + space.w_SyntaxError, + space.wrap(message)) + raise + old_warn_explicit = warnings.warn_explicit + warnings.warn_explicit = warn_explicit + return old_warn_explicit def compile(space, w_str_, filename, startstr, supplied_flags=0, dont_inherit=0): @@ -28,7 +66,12 @@ if isinstance(caller, pyframe.PyFrame): supplied_flags |= caller.get_compile_flags() try: - c = cpy_builtin.compile(str_, filename, startstr, supplied_flags, 1) + old = setup_warn_explicit(space) + try: + c = cpy_builtin.compile(str_, filename, startstr, supplied_flags, 1) + finally: + warnings.warn_explicit = old + # It would be nice to propagate all exceptions to app level, # but here we only propagate the 'usual' ones, until we figure # out how to do it generically. From hpk at codespeak.net Wed May 4 01:05:50 2005 From: hpk at codespeak.net (hpk at codespeak.net) Date: Wed, 4 May 2005 01:05:50 +0200 (CEST) Subject: [pypy-svn] r11909 - pypy/dist/pypy/module/builtin Message-ID: <20050503230550.86F3027B64@code1.codespeak.net> Author: hpk Date: Wed May 4 01:05:50 2005 New Revision: 11909 Modified: pypy/dist/pypy/module/builtin/__init__.py Log: fix docstring Modified: pypy/dist/pypy/module/builtin/__init__.py ============================================================================== --- pypy/dist/pypy/module/builtin/__init__.py (original) +++ pypy/dist/pypy/module/builtin/__init__.py Wed May 4 01:05:50 2005 @@ -3,10 +3,7 @@ from pypy.interpreter.lazymodule import LazyModule class Module(LazyModule): - """Built-in functions, exceptions, and other objects. - -Noteworthy: None is the `nil' object; Ellipsis represents `...' in slices. -""" + """Built-in functions, exceptions, and other objects.""" appleveldefs = { 'quit' : 'app_help.exit', From hpk at codespeak.net Wed May 4 01:11:49 2005 From: hpk at codespeak.net (hpk at codespeak.net) Date: Wed, 4 May 2005 01:11:49 +0200 (CEST) Subject: [pypy-svn] r11910 - pypy/dist/lib-python/modified-2.3.4/test Message-ID: <20050503231149.5B3FC27B64@code1.codespeak.net> Author: hpk Date: Wed May 4 01:11:49 2005 New Revision: 11910 Added: pypy/dist/lib-python/modified-2.3.4/test/test_exceptions.py - copied, changed from r11906, pypy/dist/lib-python/2.3.4/test/test_exceptions.py Log: move test_exceptions.py to modified it doesn't make much sense to try to hack an interp-level overflow warning to turn into an applevel one because that doesn't work on Python2.4 anymore, anyway. With this checkin the last timeouting-test is going. Copied: pypy/dist/lib-python/modified-2.3.4/test/test_exceptions.py (from r11906, pypy/dist/lib-python/2.3.4/test/test_exceptions.py) ============================================================================== --- pypy/dist/lib-python/2.3.4/test/test_exceptions.py (original) +++ pypy/dist/lib-python/modified-2.3.4/test/test_exceptions.py Wed May 4 01:11:49 2005 @@ -89,11 +89,17 @@ # ints are big enough. But ints no longer do that by default. This # test will have to go away someday. For now, we can convert the # transitional OverflowWarning into an error. -warnings.filterwarnings("error", "", OverflowWarning, __name__) -x = 1 -try: - while 1: x = x+x -except OverflowError: pass + +# XXX we are heading for python2.4 so it doesn't make much +# sense to try to hack the following +# OverflowWarning->OverflowError conversion to work +# for PyPy as it doesn't work on Python2.4 anymore, anyway +# +#warnings.filterwarnings("error", "", OverflowWarning, __name__) +#x = 1 +#try: +# while 1: x = x+x +#except OverflowError: pass r(RuntimeError) print '(not used any more?)' From pedronis at codespeak.net Wed May 4 01:47:45 2005 From: pedronis at codespeak.net (pedronis at codespeak.net) Date: Wed, 4 May 2005 01:47:45 +0200 (CEST) Subject: [pypy-svn] r11912 - in pypy/dist/pypy/module: builtin test Message-ID: <20050503234745.5166227B64@code1.codespeak.net> Author: pedronis Date: Wed May 4 01:47:45 2005 New Revision: 11912 Modified: pypy/dist/pypy/module/builtin/app_complex.py pypy/dist/pypy/module/test/test_complexobject.py Log: fix complex_subclass(complex).__class__ is complex_subclass Modified: pypy/dist/pypy/module/builtin/app_complex.py ============================================================================== --- pypy/dist/pypy/module/builtin/app_complex.py (original) +++ pypy/dist/pypy/module/builtin/app_complex.py Wed May 4 01:47:45 2005 @@ -17,7 +17,7 @@ # provide __new__to prevent the default which has no parameters def __new__(typ, real=0.0, imag=None): - if real.__class__ == complex and imag is None: + if real.__class__ == complex and imag is None and typ is complex: return real ret = object.__new__(typ) ret._init(real, imag) Modified: pypy/dist/pypy/module/test/test_complexobject.py ============================================================================== --- pypy/dist/pypy/module/test/test_complexobject.py (original) +++ pypy/dist/pypy/module/test/test_complexobject.py Wed May 4 01:47:45 2005 @@ -265,3 +265,12 @@ ours = pycomplex(10, pycomplex(100,1000)) cpy = complex(10, complex(100,1000)) self.assertAEqual(ours, cpy) + + def test_subclassing(self): + class cx(pycomplex): + pass + _1_j = pycomplex(0,1) + assert pycomplex(_1_j) is _1_j + assert type(cx(_1_j)) is cx + assert cx(_1_j) == _1_j + From pedronis at codespeak.net Wed May 4 02:22:18 2005 From: pedronis at codespeak.net (pedronis at codespeak.net) Date: Wed, 4 May 2005 02:22:18 +0200 (CEST) Subject: [pypy-svn] r11913 - in pypy/dist/pypy/objspace/std: . test Message-ID: <20050504002218.9246C27B64@code1.codespeak.net> Author: pedronis Date: Wed May 4 02:22:18 2005 New Revision: 11913 Modified: pypy/dist/pypy/objspace/std/inttype.py pypy/dist/pypy/objspace/std/test/test_intobject.py Log: fix for int(large&junk) Modified: pypy/dist/pypy/objspace/std/inttype.py ============================================================================== --- pypy/dist/pypy/objspace/std/inttype.py (original) +++ pypy/dist/pypy/objspace/std/inttype.py Wed May 4 02:22:18 2005 @@ -3,6 +3,14 @@ from pypy.interpreter.error import OperationError from pypy.interpreter.gateway import NoneNotWrapped +def retry_to_w_long(space, parser, base=0): + parser.rewind() + try: + return string_to_w_long(space, None, base=base, parser=parser) + except ParseStringError, e: + raise OperationError(space.w_ValueError, + space.wrap(e.msg)) + def descr__new__(space, w_inttype, w_value=0, w_base=NoneNotWrapped): from pypy.objspace.std.intobject import W_IntObject w_longval = None @@ -17,8 +25,7 @@ raise OperationError(space.w_ValueError, space.wrap(e.msg)) except ParseStringOverflowError, e: - e.parser.rewind() - w_longval = string_to_w_long(space, None, base=0, parser=e.parser) + w_longval = retry_to_w_long(space, e.parser) else: # otherwise, use the __int__() method w_obj = space.int(w_value) @@ -54,8 +61,7 @@ raise OperationError(space.w_ValueError, space.wrap(e.msg)) except ParseStringOverflowError, e: - e.parser.rewind() - w_longval = string_to_w_long(space, None, base, parser=e.parser) + w_longval = retry_to_w_long(space, e.parser, base) if w_longval is not None: if not space.is_true(space.is_(w_inttype, space.w_int)): Modified: pypy/dist/pypy/objspace/std/test/test_intobject.py ============================================================================== --- pypy/dist/pypy/objspace/std/test/test_intobject.py (original) +++ pypy/dist/pypy/objspace/std/test/test_intobject.py Wed May 4 02:22:18 2005 @@ -330,7 +330,9 @@ def test_int_w_long_arg(self): assert int(10000000000) == 10000000000L - assert int("10000000000") == 10000000000L + assert int("10000000000") == 10000000000l + raises(ValueError, int, "10000000000JUNK") + raises(ValueError, int, "10000000000JUNK", 10) def test_int_subclass_ctr(self): import sys From hpk at codespeak.net Wed May 4 02:40:06 2005 From: hpk at codespeak.net (hpk at codespeak.net) Date: Wed, 4 May 2005 02:40:06 +0200 (CEST) Subject: [pypy-svn] r11914 - pypy/dist/pypy/interpreter Message-ID: <20050504004006.A3C0827B64@code1.codespeak.net> Author: hpk Date: Wed May 4 02:40:06 2005 New Revision: 11914 Modified: pypy/dist/pypy/interpreter/error.py Log: make applevel tracebacks look more like CPython's Modified: pypy/dist/pypy/interpreter/error.py ============================================================================== --- pypy/dist/pypy/interpreter/error.py (original) +++ pypy/dist/pypy/interpreter/error.py Wed May 4 02:40:06 2005 @@ -101,6 +101,7 @@ if l: if l.endswith('\n'): l = l[:-1] + l = " " + l.lstrip() print >> file, l tb = tb.next From ale at codespeak.net Wed May 4 09:44:20 2005 From: ale at codespeak.net (ale at codespeak.net) Date: Wed, 4 May 2005 09:44:20 +0200 (CEST) Subject: [pypy-svn] r11918 - in pypy/dist/pypy/lib: . test2 Message-ID: <20050504074420.AC40727B6E@code1.codespeak.net> Author: ale Date: Wed May 4 09:44:20 2005 New Revision: 11918 Modified: pypy/dist/pypy/lib/_codecs.py pypy/dist/pypy/lib/test2/test_codeccallbacks.py pypy/dist/pypy/lib/unicodecodec.py Log: Some more test are passing Added unicode_escape_codec Modified: pypy/dist/pypy/lib/_codecs.py ============================================================================== --- pypy/dist/pypy/lib/_codecs.py (original) +++ pypy/dist/pypy/lib/_codecs.py Wed May 4 09:44:20 2005 @@ -99,6 +99,8 @@ decoder = lookup(encoding)[1] if decoder: res = decoder(obj,errors) + else: + raise LookupError("No such encoding") return res[0] def latin_1_encode( obj,errors='strict'): @@ -125,11 +127,12 @@ s = repr(obj) v = s[1:-1] return v,len(v) -# XXX -def utf_8_decode( data,errors='strict'): + +def utf_8_decode( data,errors='strict',final=None): """None """ - pass + res = PyUnicode_DecodeUTF8Stateful(data, size, errors, final) + return res,len(res) # XXX def raw_unicode_escape_decode( data,errors='strict'): """None @@ -156,11 +159,13 @@ """None """ pass -# XXX + def unicode_escape_decode( data,errors='strict'): """None """ - pass + unistr = PyUnicode_DecodeUnicodeEscape(data,len(data),errors) + return unistr,len(unistr) + def ascii_decode( data,errors='strict'): """None @@ -197,22 +202,19 @@ """ res = str(obj) return res,len(res) -# XXX -def charmap_decode( data,errors='strict'): + +def charmap_decode( data,errors='strict',mapping=None): """None """ - pass + res = PyUnicode_DecodeCharmap(data, len(data), mapping, errors) + return res,len(res) + def utf_7_encode( obj,errors='strict'): """None """ - obj = PyUnicode_FromObject(obj) - return (PyUnicode_EncodeUTF7(PyUnicode_AS_UNICODE(obj), - PyUnicode_GET_SIZE(obj), - 0, - 0, - errors), - PyUnicode_GET_SIZE(obj)) + res = PyUnicode_EncodeUTF7(obj,len(obj),0,0,errors) + return res,len(res) def mbcs_encode( obj,errors='strict'): """None @@ -301,11 +303,11 @@ def xmlcharrefreplace_errors(exc): if isinstance(exc,UnicodeEncodeError): - res = [u'&#'] + res = ['&#'] for ch in exc.object[exc.start:exc.end]: res.append(str(ord(ch))) res.append(';') - return u''.join(res),exc.end + return ''.join(res),exc.end else: raise TypeError("don't know how to handle %.400s in error callback"%type(exc)) Modified: pypy/dist/pypy/lib/test2/test_codeccallbacks.py ============================================================================== --- pypy/dist/pypy/lib/test2/test_codeccallbacks.py (original) +++ pypy/dist/pypy/lib/test2/test_codeccallbacks.py Wed May 4 09:44:20 2005 @@ -1,7 +1,14 @@ import autopath import test.test_support, unittest import sys, htmlentitydefs, unicodedata +sys.path.insert(1,r'd:\projects\pypy_co\pypy\lib') from pypy.lib import codecs +sys.modules['codecs'] = codecs +from pypy.lib import encodings +reload(encodings) +reload(codecs) +assert codecs == encodings.codecs +sys.modules['encodings'] = encodings class PosReturn: # this can be used for configurable callbacks @@ -256,78 +263,78 @@ exc = exctype(*args) self.assertEquals(str(exc), msg) - def test_unicodeencodeerror(self): - self.check_exceptionobjectargs( - UnicodeEncodeError, - ["ascii", u"g\xfcrk", 1, 2, "ouch"], - "'ascii' codec can't encode character u'\\xfc' in position 1: ouch" - ) - self.check_exceptionobjectargs( - UnicodeEncodeError, - ["ascii", u"g\xfcrk", 1, 4, "ouch"], - "'ascii' codec can't encode characters in position 1-3: ouch" - ) - self.check_exceptionobjectargs( - UnicodeEncodeError, - ["ascii", u"\xfcx", 0, 1, "ouch"], - "'ascii' codec can't encode character u'\\xfc' in position 0: ouch" - ) - self.check_exceptionobjectargs( - UnicodeEncodeError, - ["ascii", u"\u0100x", 0, 1, "ouch"], - "'ascii' codec can't encode character u'\\u0100' in position 0: ouch" - ) - self.check_exceptionobjectargs( - UnicodeEncodeError, - ["ascii", u"\uffffx", 0, 1, "ouch"], - "'ascii' codec can't encode character u'\\uffff' in position 0: ouch" - ) - if sys.maxunicode > 0xffff: - self.check_exceptionobjectargs( - UnicodeEncodeError, - ["ascii", u"\U00010000x", 0, 1, "ouch"], - "'ascii' codec can't encode character u'\\U00010000' in position 0: ouch" - ) - - def test_unicodedecodeerror(self): - self.check_exceptionobjectargs( - UnicodeDecodeError, - ["ascii", "g\xfcrk", 1, 2, "ouch"], - "'ascii' codec can't decode byte 0xfc in position 1: ouch" - ) - self.check_exceptionobjectargs( - UnicodeDecodeError, - ["ascii", "g\xfcrk", 1, 3, "ouch"], - "'ascii' codec can't decode bytes in position 1-2: ouch" - ) - - def test_unicodetranslateerror(self): - self.check_exceptionobjectargs( - UnicodeTranslateError, - [u"g\xfcrk", 1, 2, "ouch"], - "can't translate character u'\\xfc' in position 1: ouch" - ) - self.check_exceptionobjectargs( - UnicodeTranslateError, - [u"g\u0100rk", 1, 2, "ouch"], - "can't translate character u'\\u0100' in position 1: ouch" - ) - self.check_exceptionobjectargs( - UnicodeTranslateError, - [u"g\uffffrk", 1, 2, "ouch"], - "can't translate character u'\\uffff' in position 1: ouch" - ) - if sys.maxunicode > 0xffff: - self.check_exceptionobjectargs( - UnicodeTranslateError, - [u"g\U00010000rk", 1, 2, "ouch"], - "can't translate character u'\\U00010000' in position 1: ouch" - ) - self.check_exceptionobjectargs( - UnicodeTranslateError, - [u"g\xfcrk", 1, 3, "ouch"], - "can't translate characters in position 1-2: ouch" - ) +## def test_unicodeencodeerror(self): +## self.check_exceptionobjectargs( +## UnicodeEncodeError, +## ["ascii", u"g\xfcrk", 1, 2, "ouch"], +## "'ascii' codec can't encode character u'\\xfc' in position 1: ouch" +## ) +## self.check_exceptionobjectargs( +## UnicodeEncodeError, +## ["ascii", u"g\xfcrk", 1, 4, "ouch"], +## "'ascii' codec can't encode characters in position 1-3: ouch" +## ) +## self.check_exceptionobjectargs( +## UnicodeEncodeError, +## ["ascii", u"\xfcx", 0, 1, "ouch"], +## "'ascii' codec can't encode character u'\\xfc' in position 0: ouch" +## ) +## self.check_exceptionobjectargs( +## UnicodeEncodeError, +## ["ascii", u"\u0100x", 0, 1, "ouch"], +## "'ascii' codec can't encode character u'\\u0100' in position 0: ouch" +## ) +## self.check_exceptionobjectargs( +## UnicodeEncodeError, +## ["ascii", u"\uffffx", 0, 1, "ouch"], +## "'ascii' codec can't encode character u'\\uffff' in position 0: ouch" +## ) +## if sys.maxunicode > 0xffff: +## self.check_exceptionobjectargs( +## UnicodeEncodeError, +## ["ascii", u"\U00010000x", 0, 1, "ouch"], +## "'ascii' codec can't encode character u'\\U00010000' in position 0: ouch" +## ) +## +## def test_unicodedecodeerror(self): +## self.check_exceptionobjectargs( +## UnicodeDecodeError, +## ["ascii", "g\xfcrk", 1, 2, "ouch"], +## "'ascii' codec can't decode byte 0xfc in position 1: ouch" +## ) +## self.check_exceptionobjectargs( +## UnicodeDecodeError, +## ["ascii", "g\xfcrk", 1, 3, "ouch"], +## "'ascii' codec can't decode bytes in position 1-2: ouch" +## ) +## +## def test_unicodetranslateerror(self): +## self.check_exceptionobjectargs( +## UnicodeTranslateError, +## [u"g\xfcrk", 1, 2, "ouch"], +## "can't translate character u'\\xfc' in position 1: ouch" +## ) +## self.check_exceptionobjectargs( +## UnicodeTranslateError, +## [u"g\u0100rk", 1, 2, "ouch"], +## "can't translate character u'\\u0100' in position 1: ouch" +## ) +## self.check_exceptionobjectargs( +## UnicodeTranslateError, +## [u"g\uffffrk", 1, 2, "ouch"], +## "can't translate character u'\\uffff' in position 1: ouch" +## ) +## if sys.maxunicode > 0xffff: +## self.check_exceptionobjectargs( +## UnicodeTranslateError, +## [u"g\U00010000rk", 1, 2, "ouch"], +## "can't translate character u'\\U00010000' in position 1: ouch" +## ) +## self.check_exceptionobjectargs( +## UnicodeTranslateError, +## [u"g\xfcrk", 1, 3, "ouch"], +## "can't translate characters in position 1-2: ouch" +## ) def test_badandgoodstrictexceptions(self): # "strict" complains about a non-exception passed in @@ -557,18 +564,18 @@ # Modules/_codecsmodule.c::lookup_error() self.assertRaises(LookupError, codecs.lookup_error, "test.unknown") -## def test_xmlcharrefvalues(self): -## # enhance coverage of: -## # Python/codecs.c::PyCodec_XMLCharRefReplaceErrors() -## # and inline implementations -## v = (1, 5, 10, 50, 100, 500, 1000, 5000, 10000, 50000) -## if sys.maxunicode>=100000: -## v += (100000, 500000, 1000000) -## s = u"".join([unichr(x) for x in v]) -## codecs.register_error("test.xmlcharrefreplace", codecs.xmlcharrefreplace_errors) -## for enc in ("ascii", "iso-8859-15"): -## for err in ("xmlcharrefreplace", "test.xmlcharrefreplace"): -## codecs.encode(s,enc, err) + def test_xmlcharrefvalues(self): + # enhance coverage of: + # Python/codecs.c::PyCodec_XMLCharRefReplaceErrors() + # and inline implementations + v = (1, 5, 10, 50, 100, 500, 1000, 5000, 10000, 50000) + if sys.maxunicode>=100000: + v += (100000, 500000, 1000000) + s = u"".join([unichr(x) for x in v]) + codecs.register_error("test.xmlcharrefreplace", codecs.xmlcharrefreplace_errors) + for enc in ("ascii", "iso-8859-15"): + for err in ("xmlcharrefreplace", "test.xmlcharrefreplace"): + codecs.encode(s,enc, err) def test_decodehelper(self): # enhance coverage of: Modified: pypy/dist/pypy/lib/unicodecodec.py ============================================================================== --- pypy/dist/pypy/lib/unicodecodec.py (original) +++ pypy/dist/pypy/lib/unicodecodec.py Wed May 4 09:44:20 2005 @@ -1,4 +1,4 @@ - +import sys ## indicate whether a UTF-7 character is special i.e. cannot be directly ## encoded: ## 0 - not special @@ -86,7 +86,7 @@ def ENCODE(out, ch, bits) : while (bits >= 6): - out.append( B64(ch >> (bits-6))) + out += B64(ord(ch) >> (bits-6)) bits -= 6; return ''.join(out),ch,bits @@ -104,7 +104,7 @@ surrogate = 1 raise UnicodeDecodeError,"code pairs are not supported" else: - out.append( outCh ) + out += outCh return ''.join(out),ch,bits,surrogate def PyUnicode_DecodeUTF7(s, size, errors): @@ -145,14 +145,14 @@ raise UnicodeDecodeError, "non-zero padding bits in shift sequence" if (ch == '-') : if ((i < size) and (s[i] == '-')) : - p.append( '-') + p += '-' inShift = 1 elif SPECIAL(ch,0,0) : raise UnicodeDecodeError,"unexpected special character" else: - p.append( ch ) + p += ch else: charsleft = (charsleft << 6) | UB64(ch) bitsleft += 6 @@ -163,7 +163,7 @@ i+=1 if (i 0 else: - out.append(ch) + out += ch else: if (not SPECIAL(ch, encodeSetO, encodeWhiteSpace)): - out.append(B64(charsleft << (6-bitsleft))) + out += B64(charsleft << (6-bitsleft)) charsleft = 0 bitsleft = 0 ## /* Characters not in the BASE64 set implicitly unshift the sequence ## so no '-' is required, except if the character is itself a '-' */ if (B64CHAR(ch) or ch == '-'): - out.append('-') + out += '-' inShift = 0 - out.append(ch) + out += ch else: bitsleft += 16 - charsleft = (charsleft << 16) | ch + charsleft = (charsleft << 16) | ord(ch) out, charsleft, bitsleft = ENCODE(out, charsleft, bitsleft) ## /* If the next character is special then we dont' need to terminate @@ -231,18 +232,18 @@ if (SPECIAL(ch2, encodeSetO, encodeWhiteSpace)): pass elif (B64CHAR(ch2) or ch2 == '-'): - out.append( '-') + out += '-' inShift = 0 else: inShift = 0 else: - out.append( '-') + out += '-' inShift = 0 i+=1 if (bitsleft): - out.append(B64(charsleft << (6-bitsleft) )) - out.append( '-') + out += B64(charsleft << (6-bitsleft) ) + out += '-' return ''.join(out) @@ -324,12 +325,19 @@ if (size == 0): return unicode('') p = [] - for c in s: + pos = 0 + while pos < len(s): + c = s[pos] if ord(c) < 128: - p.append(c) + p += c + pos += 1 else: - UnicodeDecodeError("ordinal not in range(128)",s.index(c)) - return ''.join(p) + handler = lookup_error(errors) + x = handler(UnicodeDecodeError("ascii",s,pos, + pos+1,"ordinal not in range(128)")) + p += x[0] + pos = x[1] + return ''.join(p) #(encoding,p,collstart,collend,reason) def PyUnicode_EncodeASCII(p,size,errors): @@ -661,7 +669,7 @@ res = [] for ch in s: if ord(ch) < 0x80: - res.append(ch) + res += ch continue n = utf8_code_length[ord(ch)] @@ -692,7 +700,7 @@ endinpos = startinpos+2 else: - res.append(c) + res += c break elif n == 3: if ((s[1] & 0xc0) != 0x80 or @@ -711,7 +719,7 @@ errmsg = "illegal encoding" endinpos = startinpos+3 else: - res.append(c) + res += c ## p,outpos = unicode_decode_call_errorhandler( ## errors, None, ## "utf8", errmsg, @@ -820,11 +828,11 @@ i+=1 if (ord(ch) < 0x80): ## /* Encode ASCII */ - p.append(ch) + p += ch elif (ord(ch) < 0x0800) : ## /* Encode Latin-1 */ - p.append(chr((0xc0 | (ch >> 6)))) - p.append(chr((0x80 | (ch & 0x3f)))) + p += chr((0xc0 | (ch >> 6))) + p += chr((0x80 | (ch & 0x3f))) else: ## /* Encode UCS2 Unicode ordinals */ if (ord(ch) < 0x10000): @@ -833,15 +841,15 @@ ch2 = s[i] ## /* Check for low surrogate and combine the two to ## form a UCS4 value */ - if (0xDC00 <= ch2 and ch2 <= 0xDFFF) : - ch = ((ch - 0xD800) << 10 | (ch2 - 0xDC00)) + 0x10000 + if (0xDC00 <= ord(ch2) and ord(ch2) <= 0xDFFF) : + ch3 = ((ord(ch) - 0xD800) << 10 | (ord(ch2) - 0xDC00)) + 0x10000 i+=1 - p.extend(encodeUCS4(ch)) + p.extend(encodeUCS4(ch3)) continue ## /* Fall through: handles isolated high surrogates */ - p.append (chr((0xe0 | (ch >> 12)))) - p.append (chr((0x80 | ((ch >> 6) & 0x3f)))) - p.append (chr((0x80 | (ch & 0x3f)))) + p.append (chr((0xe0 | (ord(ch) >> 12)))) + p.append (chr((0x80 | ((ord(ch) >> 6) & 0x3f)))) + p.append (chr((0x80 | (ord(ch) & 0x3f)))) continue return ''.join(p) @@ -901,7 +909,7 @@ #for ch in p: ch = p[pos] if ord(ch) < limit: - res.append(ch) + res += chr(ord(ch)) pos += 1 else: #/* startpos for collecting unencodable chars */ @@ -914,14 +922,211 @@ handler = lookup_error(errors) exc = UnicodeEncodeError(encoding,p,collstart,collend,reason) x = handler(exc) - res.append(x[0]) + res += str(x[0]) pos = x[1] - return res #u''.join(res) def PyUnicode_EncodeLatin1(p,size,errors): res=unicode_encode_ucs1(p, size, errors, 256) - return u''.join(res) + return ''.join(res) + +hexdigits = [hex(i)[-1] for i in range(16)]+[hex(i)[-1].upper() for i in range(10,16)] +def hexescape(s,pos,digits,message,errors): + chr = 0 + p = [] + if (pos+digits>len(s)): + handler = lookup_error(errors) + x = handler(UnicodeDecodeError("unicodeescape",s,pos-2, + len(s),"end of string in escape sequence")) + p += x[0] + pos = x[1] + else: + try: + #print s[pos:pos+digits],errors + chr = int(s[pos:pos+digits],16) + except ValueError: + endinpos = pos + while s[endinpos] in hexdigits: endinpos +=1 + handler = lookup_error(errors) + x = handler(UnicodeDecodeError("unicodeescape",s,pos-2, + endinpos+1,message)) + p += x[0] + pos = x[1] + # /* when we get here, chr is a 32-bit unicode character */ + else: + if chr < sys.maxunicode: + p += [unichr(chr)] + pos += digits + #else + elif (chr <= 0x10ffff): + chr -= 0x10000L + p += unichr(0xD800 + (chr >> 10)) + p += unichr(0xDC00 + (chr & 0x03FF)) + pos += digits + #endif + else: + handler = lookup_error(errors) + x = handler(UnicodeDecodeError("unicodeescape",s,pos, + pos+digits,"illegal Unicode character")) + p += x[0] + pos = x[1] + res = ''.join(p) + return res,pos + +def PyUnicode_DecodeUnicodeEscape(s, size, errors): +## +## const char *starts = s; +## int startinpos; +## int endinpos; +## int outpos; +## int i; +## PyUnicodeObject *v; +## Py_UNICODE *p; +## const char *end; +## char* message; +## Py_UCS4 chr = 0xffffffff; /* in case 'getcode' messes up */ +## PyObject *errorHandler = NULL; +## PyObject *exc = NULL; + +## /* Escaped strings will always be longer than the resulting +## Unicode string, so we start with size here and then reduce the +## length after conversion to the true value. +## (but if the error callback returns a long replacement string +## we'll have to allocate more space) */ + + if (size == 0): + return u'' + + p = [] + pos = 0 + while (pos < size): +## unsigned char c; +## Py_UNICODE x; +## int digits; + +## /* Non-escape characters are interpreted as Unicode ordinals */ + if (s[pos] != '\\') : + p += s[pos] + pos += 1 + continue + +## /* \ - Escapes */ + pos +=1 + ch = s[pos] + +## /* \x escapes */ + #if ch == '\n': break; + if ch == '\\': p += '\\' + if ch == '\'': p += '\'' + if ch == '\"': p += '\"' + if ch == 'b': p += '\b' + if ch == 'f': p += '\014' #/* FF */ + if ch == 't': p += '\t' + if ch == 'n': p += '\n' + if ch == 'r': p += '\r' + if ch == 'v': p += '\013' #break; /* VT */ + if ch == 'a': p += '\007' # break; /* BEL, not classic C */ + +## /* \OOO (octal) escapes */ + if ch in [ '0','1', '2', '3','4', '5', '6','7']: + x = ord(ch) - ord('0') + ch = s[pos+1] + if ('0' <= ch and ch <= '7'): + x = (x<<3) + ord(ch) - ord('0') + ch = s[pos+2] + if ('0' <= ch and ch <= '7'): + x = (x<<3) + ord(ch) - ord('0') + pos += 3 + + p += unichr(x) +## /* hex escapes */ +## /* \xXX */ + if ch == 'x': + digits = 2; + message = "truncated \\xXX escape"; + x = hexescape(s,pos+1,digits,message,errors) + p += x[0] + pos = x[1] + + # /* \uXXXX */ + if ch == 'u': + digits = 4; + message = "truncated \\uXXXX escape"; + x = hexescape(s,pos+1,digits,message,errors) + p += x[0] + pos = x[1] + + # /* \UXXXXXXXX */ + if ch == 'U': + digits = 8; + message = "truncated \\UXXXXXXXX escape"; + x = hexescape(s,pos+1,digits,message,errors) + p += x[0] + pos = x[1] + + +## /* \N{name} */ +## if ch == 'N': +## message = "malformed \\N character escape"; +## if (ucnhash_CAPI == NULL) { +## /* load the unicode data module */ +## PyObject *m, *v; +## m = PyImport_ImportModule("unicodedata"); +## if (m == NULL) +## goto ucnhashError; +## v = PyObject_GetAttrString(m, "ucnhash_CAPI"); +## Py_DECREF(m); +## if (v == NULL) +## goto ucnhashError; +## ucnhash_CAPI = PyCObject_AsVoidPtr(v); +## Py_DECREF(v); +## if (ucnhash_CAPI == NULL) +## goto ucnhashError; +## } +## if (*s == '{') { +## const char *start = s+1; +## /* look for the closing brace */ +## while (*s != '}' && s < end) +## s++; +## if (s > start && s < end && *s == '}') { +## /* found a name. look it up in the unicode database */ +## message = "unknown Unicode character name"; +## s++; +## if (ucnhash_CAPI->getcode(start, s-start-1, &chr)) +## goto store; +## } +## } +## endinpos = s-starts; +## outpos = p-PyUnicode_AS_UNICODE(v); +## if (unicode_decode_call_errorhandler( +## errors, &errorHandler, +## "unicodeescape", message, +## starts, size, &startinpos, &endinpos, &exc, &s, +## (PyObject **)&v, &outpos, &p)) +## goto onError; +## break; + if (pos > size): + message = "\\ at end of string" +## endinpos = s-starts; +## outpos = p-PyUnicode_AS_UNICODE(v); + handler = lookup_error(errors) + x = handler(UnicodeDecodeError("unicodeescape",s,pos, + pos+digits,message)) + p += x[0] + pos = x[1] +## if (unicode_decode_call_errorhandler( +## errors, &errorHandler, +## "unicodeescape", message, +## starts, size, &startinpos, &endinpos, &exc, &s, +## (PyObject **)&v, &outpos, &p)) +## goto onError; + + else: + p += '\\' + p += s[pos] + + return ''.join(p) + def PyUnicode_EncodeRawUnicodeEscape(s,size): if (size == 0): @@ -931,24 +1136,28 @@ for ch in s: # /* Map 32-bit characters to '\Uxxxxxxxx' */ if (ord(ch) >= 0x10000): - p.append('\\') - p.append('U') - p.append(hex(ord(ch))) + p += '\\' + p += 'U' + p += hex(ord(ch)) elif (ord(ch) >= 256) : # /* Map 16-bit characters to '\uxxxx' */ - p.append('\\') - p.append('u') - p.append(hex(ord(ch))) + p += '\\' + p += 'u' + p += hex(ord(ch)) # /* Copy everything else as-is */ else: - p.append(ch) + p += ch - p.append('\0') + p += '\0' return ''.join(p) -def charmapencode_output(c,mapping,outobj,outpos): +def charmapencode_output(c,mapping): rep = mapping[c] + if isinstance(rep,(int,long)): + return str(rep) + else: + return rep def PyUnicode_EncodeCharmap(p,size,mapping='latin-1',errors='strict'): @@ -967,22 +1176,54 @@ #/* try to encode it */ try: x = mapping[ord(p[inpos])] - res.append(unicode(x)) + res += unicode(x) except KeyError: handler = lookup_error(errors) x = handler(UnicodeEncodeError("charmap",p,inpos,inpos+1, - "character maps to ")) - res.append(mapping[ord(x[0])]) + "character maps to ")) + #print x[0],type(x[0]) + res += [charmapencode_output(ord(y),mapping) for y in x[0]] + #print res #else: #/* done with this character => adjust input position */ inpos+=1 - - + #print res return ''.join(res) +def PyUnicode_DecodeCharmap(s, size, mapping, errors): -encodings = { "utf-8" : PyUnicode_DecodeUTF8, - "latin-1" : PyUnicode_DecodeLatin1, - "mbcs" : PyUnicode_DecodeMBCS, - "ascii" : PyUnicode_DecodeASCII, - } +## /* Default to Latin-1 */ + if (mapping == None): + return PyUnicode_DecodeLatin1(s, size, errors) + + if (size == 0): + return u'' + p = [] + inpos = 0 + while (inpos< len(s)): + + #/* Get mapping (char ordinal -> integer, Unicode char or None) */ + ch = s[inpos] + try: + x = mapping[ord(ch)] + if isinstance(x,int): + p += unichr(x) + elif isinstance(x,unicode): + p += x + elif not x: + raise KeyError + else: + raise TypeError + except KeyError: + handler = lookup_error(errors) + x = handler(UnicodeDecodeError("charmap",s,inpos,inpos+1, + "character maps to ")) + p += x[0]#[mapping[ord(y)] for y in x[0]] + except TypeError: + handler = lookup_error(errors) + x = handler(UnicodeDecodeError("charmap",s,inpos,inpos+1, + "character mapping must return integer, None or unicode")) + p += x[0]#[mapping[ord(y)] for y in x[0]] + inpos +=1 + #print p + return u''.join(p) \ No newline at end of file From hpk at codespeak.net Wed May 4 10:53:41 2005 From: hpk at codespeak.net (hpk at codespeak.net) Date: Wed, 4 May 2005 10:53:41 +0200 (CEST) Subject: [pypy-svn] r11919 - pypy/dist/lib-python/modified-2.3.4/test Message-ID: <20050504085341.0E0C227B6E@code1.codespeak.net> Author: hpk Date: Wed May 4 10:53:40 2005 New Revision: 11919 Modified: pypy/dist/lib-python/modified-2.3.4/test/test_exceptions.py Log: don't run tests again _testcapi which test internal CPython-C level APIs. Modified: pypy/dist/lib-python/modified-2.3.4/test/test_exceptions.py ============================================================================== --- pypy/dist/lib-python/modified-2.3.4/test/test_exceptions.py (original) +++ pypy/dist/lib-python/modified-2.3.4/test/test_exceptions.py Wed May 4 10:53:40 2005 @@ -209,7 +209,7 @@ else: print "Expected exception" -if not sys.platform.startswith('java'): +if 0 and not sys.platform.startswith('java'): # switched off hard for PyPy test_capi1() test_capi2() From hpk at codespeak.net Wed May 4 11:07:23 2005 From: hpk at codespeak.net (hpk at codespeak.net) Date: Wed, 4 May 2005 11:07:23 +0200 (CEST) Subject: [pypy-svn] r11921 - pypy/dist/pypy/tool/pytest Message-ID: <20050504090723.B1F3027B76@code1.codespeak.net> Author: hpk Date: Wed May 4 11:07:23 2005 New Revision: 11921 Modified: pypy/dist/pypy/tool/pytest/result.py Log: indicate that the test failed output comparison Modified: pypy/dist/pypy/tool/pytest/result.py ============================================================================== --- pypy/dist/pypy/tool/pytest/result.py (original) +++ pypy/dist/pypy/tool/pytest/result.py Wed May 4 11:07:23 2005 @@ -35,10 +35,13 @@ def repr_short_error(self): if not self.isok(): - text = self.getnamedtext('stderr') - lines = text.strip().split('\n') - if lines: - return lines[-1] + if 'reportdiff' in self._blocks: + return "output comaprison failed, see reportdiff" + else: + text = self.getnamedtext('stderr') + lines = text.strip().split('\n') + if lines: + return lines[-1] def repr_mimemessage(self): from email.MIMEMultipart import MIMEMultipart From arigo at codespeak.net Wed May 4 13:28:38 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Wed, 4 May 2005 13:28:38 +0200 (CEST) Subject: [pypy-svn] r11929 - pypy/dist/goal Message-ID: <20050504112838.820EC27B56@code1.codespeak.net> Author: arigo Date: Wed May 4 13:28:38 2005 New Revision: 11929 Added: pypy/dist/goal/app_example.py (contents, props changed) pypy/dist/goal/app_main.py (contents, props changed) pypy/dist/goal/targetpypymain.py - copied, changed from r11921, pypy/dist/goal/targetpypy.py Log: Trying to annotate PyPy starting from a py.py equivalent (written at app-level for simplicity). Crashes so far, will investigate... Added: pypy/dist/goal/app_example.py ============================================================================== --- (empty file) +++ pypy/dist/goal/app_example.py Wed May 4 13:28:38 2005 @@ -0,0 +1,3 @@ +print '--- beginning of app_example.py ---' +print 6*7 +print '--- end of app_example.py ---' Added: pypy/dist/goal/app_main.py ============================================================================== --- (empty file) +++ pypy/dist/goal/app_main.py Wed May 4 13:28:38 2005 @@ -0,0 +1,24 @@ +# App-level version of py.py. +# XXX very incomplete! Blindly runs the file named as first argument. +# No option checking, no interactive console, no fancy hooks. + +def entry_point(argv): + import sys + sys.executable = argv[0] + sys.argv = argv[1:] + + mainmodule = type(sys)('__main__') + sys.modules['__main__'] = mainmodule + + try: + execfile(sys.argv[0], mainmodule.__dict__) + except: + sys.excepthook(*sys.exc_info()) + return 1 + else: + return 0 + +if __name__ == '__main__': + # debugging only + import sys + sys.exit(entry_point(sys.argv)) Copied: pypy/dist/goal/targetpypymain.py (from r11921, pypy/dist/goal/targetpypy.py) ============================================================================== --- pypy/dist/goal/targetpypy.py (original) +++ pypy/dist/goal/targetpypymain.py Wed May 4 13:28:38 2005 @@ -1,32 +1,40 @@ -import buildcache2 -from pypy.objspace.std.objspace import StdObjSpace, W_Object -from pypy.objspace.std.intobject import W_IntObject +import os, sys +from pypy.objspace.std.objspace import StdObjSpace +from pypy.annotation.model import * +from pypy.annotation.listdef import ListDef + +# WARNING: this requires the annotator. +# There is no easy way to build all caches manually, +# but the annotator can do it for us for free. + +this_dir = os.path.dirname(sys.argv[0]) # __________ Entry point __________ -def entry_point(): - w_a = W_IntObject(space, -6) - w_b = W_IntObject(space, -7) - return space.mul(w_a, w_b) +def entry_point(argv): + w_argv = space.newlist([space.wrap(s) for s in argv]) + w_exitcode = space.call(w_entry_point, w_argv) + return space.int_w(w_exitcode) # _____ Define and setup target ___ def target(): - global space + global space, w_entry_point # disable translation of the whole of classobjinterp.py StdObjSpace.setup_old_style_classes = lambda self: None space = StdObjSpace() - # call cache filling code - buildcache2.buildcache(space) - # further call the entry_point once to trigger building remaining - # caches (as far as analyzing the entry_point is concerned) - entry_point() - return entry_point, [] + # manually imports app_main.py + filename = os.path.join(this_dir, 'app_main.py') + w_dict = space.newdict([]) + space.exec_(open(filename).read(), w_dict, w_dict) + w_entry_point = space.getitem(w_dict, space.wrap('entry_point')) + + s_list_of_strings = SomeList(ListDef(None, SomeString())) + return entry_point, [s_list_of_strings] # _____ Run translated _____ def run(c_entry_point): - w_result = c_entry_point() - print w_result - print w_result.intval - assert w_result.intval == 42 + argv = [os.path.join(this_dir, 'app_example.py')] + exitcode = c_entry_point(argv) + assert exitcode == 0 From arigo at codespeak.net Wed May 4 13:28:49 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Wed, 4 May 2005 13:28:49 +0200 (CEST) Subject: [pypy-svn] r11930 - pypy/dist/pypy/objspace/std Message-ID: <20050504112849.4295027B5C@code1.codespeak.net> Author: arigo Date: Wed May 4 13:28:49 2005 New Revision: 11930 Modified: pypy/dist/pypy/objspace/std/typeobject.py Log: Nicer cache management. Modified: pypy/dist/pypy/objspace/std/typeobject.py ============================================================================== --- pypy/dist/pypy/objspace/std/typeobject.py (original) +++ pypy/dist/pypy/objspace/std/typeobject.py Wed May 4 13:28:49 2005 @@ -190,12 +190,18 @@ w_self.name, w_subtype.name, w_subtype.name))) return w_subtype - def getdict(w_self): - # XXX should return a - if w_self.lazyloaders: + def _freeze_(w_self): + "NOT_RPYTHON. Forces the lazy attributes to be computed." + if 'lazyloaders' in w_self.__dict__: for attr in w_self.lazyloaders.keys(): w_self.getdictvalue(w_self.space, attr) del w_self.lazyloaders + return False + + def getdict(w_self): + # XXX should return a + if w_self.lazyloaders: + w_self._freeze_() # force un-lazification space = w_self.space dictspec = [] for key, w_value in w_self.dict_w.items(): @@ -286,7 +292,7 @@ def delattr__Type_ANY(space, w_type, w_name): if w_type.lazyloaders: - w_type.getdict() # force un-lazification + w_type._freeze_() # force un-lazification name = space.str_w(w_name) w_descr = space.lookup(w_type, name) if w_descr is not None: From arigo at codespeak.net Wed May 4 14:53:49 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Wed, 4 May 2005 14:53:49 +0200 (CEST) Subject: [pypy-svn] r11933 - in pypy/dist/pypy: annotation tool tool/test Message-ID: <20050504125349.917C827B56@code1.codespeak.net> Author: arigo Date: Wed May 4 14:53:49 2005 New Revision: 11933 Modified: pypy/dist/pypy/annotation/bookkeeper.py pypy/dist/pypy/tool/cache.py pypy/dist/pypy/tool/test/test_cache.py Log: Trying a _specialize_="memo" function attribute for the annotator... Modified: pypy/dist/pypy/annotation/bookkeeper.py ============================================================================== --- pypy/dist/pypy/annotation/bookkeeper.py (original) +++ pypy/dist/pypy/annotation/bookkeeper.py Wed May 4 14:53:49 2005 @@ -2,6 +2,7 @@ The Bookkeeper class. """ +from __future__ import generators from types import FunctionType, ClassType, MethodType from types import BuiltinMethodType from pypy.tool.ansi_print import ansi_print @@ -319,6 +320,16 @@ elif specialize == "location": # fully specialize: create one version per call position func = self.specialize_by_key(func, self.position_key) + elif specialize == "memo": + # call the function now, and collect possible results + arglist_s, kwds_s = args.unpack() + assert not kwds_s, ("no ** args in call to function " + "marked specialize='concrete'") + possible_results = [] + for arglist in possible_arguments(arglist_s): + result = func(*arglist) + possible_results.append(self.immutablevalue(result)) + return unionof(*possible_results) else: raise Exception, "unsupported specialization type '%s'"%(specialize,) @@ -412,7 +423,7 @@ raise Exception, "specializing %r?? why??"%thing self.cachespecializations[key] = thing return thing - + def getbookkeeper(): """Get the current Bookkeeper. @@ -440,3 +451,24 @@ name = x.__class__.__name__ l.append(name) return "__".join(l) + +def possible_arguments(args): + # enumerate all tuples (x1,..xn) of concrete values that are contained + # in a tuple args=(s1,..sn) of SomeXxx. Requires that each s be either + # a constant or SomePBC. + if not args: + yield () + return + s = args[0] + if s.is_constant(): + possible_values = [s.const] + elif isinstance(s, SomePBC): + for value in s.prebuiltinstances.values(): + assert value is True, ("concrete call with a method bound " + "on a non-constant instance") + possible_values = s.prebuiltinstances.keys() + else: + raise AssertionError, "concrete call with a non-constant arg %r" % (s,) + for tuple_tail in possible_arguments(args[1:]): + for value in possible_values: + yield (value,) + tuple_tail Modified: pypy/dist/pypy/tool/cache.py ============================================================================== --- pypy/dist/pypy/tool/cache.py (original) +++ pypy/dist/pypy/tool/cache.py Wed May 4 14:53:49 2005 @@ -1,41 +1,38 @@ +""" +Caches that can freeze when the annotator needs it. +""" + +# +# _freeze_() protocol: +# user-defined classes can define a method _freeze_(), which +# is called when a prebuilt instance is found. If the method +# returns True, the instance is considered immutable and becomes +# a SomePBC(). Otherwise it's just SomeInstance(). The method +# should force away any laziness that remains in the instance. +# +# Cache class: +# a cache meant to map a finite number of keys to values. +# It is normally extended lazily, until it contains all possible +# keys. The _specialize_ attribute of the getorbuild() method +# forces the annotator to decode the argument's annotations, +# which must be constants or SomePBCs, actually call the +# method with all possible combinations, and gather the results. +# The idea is to completely fill the cache at annotation-time, +# using the information collected by the annotator itself about +# what the keys can actually be. +# -# hacks += 1 -class Cache: - frozen = True +class Cache: def __init__(self): self.content = {} - self.frozen = False - - def __hash__(self): - if not self.frozen: - #raise TypeError, "cannot get hash of un-frozen cache" - self.freeze() - return id(self) - - def clear(self): - if self.frozen: - raise TypeError, "cannot clear frozen cache" - self.content.clear() def getorbuild(self, key, builder, stuff): try: return self.content[key] except KeyError: - assert not self.frozen, "cannot build %r, cache already frozen" % key result = builder(key, stuff) #assert key not in self.content, "things messed up" self.content[key] = result return result - # note to annotator: we want loadfromcache() to be - # specialized for the different cache types - getorbuild._specialize_ = "location" - - def freeze(self): - try: - del self.frozen - except AttributeError: - pass - return True - - _freeze_ = freeze + getorbuild._specialize_ = "memo" Modified: pypy/dist/pypy/tool/test/test_cache.py ============================================================================== --- pypy/dist/pypy/tool/test/test_cache.py (original) +++ pypy/dist/pypy/tool/test/test_cache.py Wed May 4 14:53:49 2005 @@ -6,15 +6,6 @@ cache = Cache() assert cache.getorbuild(1, lambda k,s: 42, None) == 42 assert cache.getorbuild(1, lambda k,s: self.fail(), None) == 42 - # XXX cannot test that any longer: - # XXX hash(cache) now freezes the cache "just-in-time". - # XXX --disabled-- self.assertRaises(TypeError, hash, cache) - cache.clear() - assert cache.getorbuild(1, lambda k,s: 44, None) == 44 - assert cache.getorbuild(1, lambda k,s: self.fail(), None) == 44 - cache.freeze() - hash(cache) - assert cache.getorbuild(1, lambda k,s: self.fail(), None) == 44 - raises(TypeError, cache.clear) - raises(AssertionError, cache.getorbuild, - 2, lambda k,s: self.fail(), 4) + assert cache.getorbuild(2, lambda k,s: 24, None) == 24 + assert cache.getorbuild(1, lambda k,s: self.fail(), None) == 42 + assert cache.getorbuild(2, lambda k,s: self.fail(), None) == 24 From pedronis at codespeak.net Wed May 4 15:01:08 2005 From: pedronis at codespeak.net (pedronis at codespeak.net) Date: Wed, 4 May 2005 15:01:08 +0200 (CEST) Subject: [pypy-svn] r11934 - pypy/dist/lib-python/modified-2.3.4/test Message-ID: <20050504130108.564E427B57@code1.codespeak.net> Author: pedronis Date: Wed May 4 15:01:08 2005 New Revision: 11934 Modified: pypy/dist/lib-python/modified-2.3.4/test/test_exceptions.py Log: improvent change, we still need a better IOError.__str__ it seems to pass the test Modified: pypy/dist/lib-python/modified-2.3.4/test/test_exceptions.py ============================================================================== --- pypy/dist/lib-python/modified-2.3.4/test/test_exceptions.py (original) +++ pypy/dist/lib-python/modified-2.3.4/test/test_exceptions.py Wed May 4 15:01:08 2005 @@ -29,7 +29,7 @@ def r(thing): test_raise_catch(thing) - if isinstance(thing, ClassType): + if isinstance(thing, (type, ClassType)): print thing.__name__ else: print thing From ludal at codespeak.net Wed May 4 15:05:19 2005 From: ludal at codespeak.net (ludal at codespeak.net) Date: Wed, 4 May 2005 15:05:19 +0200 (CEST) Subject: [pypy-svn] r11936 - pypy/dist/pypy/module/recparser Message-ID: <20050504130519.B914927B5D@code1.codespeak.net> Author: ludal Date: Wed May 4 15:05:19 2005 New Revision: 11936 Modified: pypy/dist/pypy/module/recparser/pythonparse.py Log: * fix the test failures with encoding declaration on codespeak (modified python grammar) Modified: pypy/dist/pypy/module/recparser/pythonparse.py ============================================================================== --- pypy/dist/pypy/module/recparser/pythonparse.py (original) +++ pypy/dist/pypy/module/recparser/pythonparse.py Wed May 4 15:05:19 2005 @@ -4,6 +4,7 @@ from ebnfparse import parse_grammar import sys import pythonutil +import symbol def parse_python_source( textsrc, gram, goal ): """Parse a python source according to goal""" @@ -43,7 +44,8 @@ root_node = builder.stack[-1] nested_tuples = root_node.totuple() if hasattr(builder, '_source_encoding'): - return (323, nested_tuples, builder._source_encoding) + # XXX: maybe the parser could fix that instead ? + return ( symbol.encoding_decl, nested_tuples, builder._source_encoding) else: return nested_tuples return None # XXX raise an exception instead From arigo at codespeak.net Wed May 4 15:51:41 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Wed, 4 May 2005 15:51:41 +0200 (CEST) Subject: [pypy-svn] r11939 - pypy/dist/pypy/objspace/std Message-ID: <20050504135141.26A5327B5B@code1.codespeak.net> Author: arigo Date: Wed May 4 15:51:40 2005 New Revision: 11939 Modified: pypy/dist/pypy/objspace/std/model.py Log: This typedef=None isn't needed and confuses the annotator. Modified: pypy/dist/pypy/objspace/std/model.py ============================================================================== --- pypy/dist/pypy/objspace/std/model.py (original) +++ pypy/dist/pypy/objspace/std/model.py Wed May 4 15:51:40 2005 @@ -103,7 +103,6 @@ class W_Object(W_Root, object): "Parent base class for wrapped objects." - typedef = None def __init__(w_self, space): w_self.space = space # XXX not sure this is ever used any more From arigo at codespeak.net Wed May 4 16:52:42 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Wed, 4 May 2005 16:52:42 +0200 (CEST) Subject: [pypy-svn] r11941 - in pypy/dist/pypy: interpreter tool Message-ID: <20050504145242.5372A27B5B@code1.codespeak.net> Author: arigo Date: Wed May 4 16:52:42 2005 New Revision: 11941 Modified: pypy/dist/pypy/interpreter/typedef.py pypy/dist/pypy/tool/cache.py Log: _freeze_() method for TypeDef and Cache classes. Modified: pypy/dist/pypy/interpreter/typedef.py ============================================================================== --- pypy/dist/pypy/interpreter/typedef.py (original) +++ pypy/dist/pypy/interpreter/typedef.py Wed May 4 16:52:42 2005 @@ -20,6 +20,9 @@ self.rawdict = rawdict self.acceptable_as_base_class = True + def _freeze_(self): + # hint for the annotator: track individual constant instances of TypeDef + return True unique_interplevel_subclass_cache = Cache() def get_unique_interplevel_subclass(cls, hasdict, wants_slots): Modified: pypy/dist/pypy/tool/cache.py ============================================================================== --- pypy/dist/pypy/tool/cache.py (original) +++ pypy/dist/pypy/tool/cache.py Wed May 4 16:52:42 2005 @@ -36,3 +36,9 @@ self.content[key] = result return result getorbuild._specialize_ = "memo" + + def _freeze_(self): + # needs to be SomePBC, but otherwise we can't really freeze the + # cache because more getorbuild() calls might be discovered later + # during annotation. + return True From arigo at codespeak.net Wed May 4 17:18:43 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Wed, 4 May 2005 17:18:43 +0200 (CEST) Subject: [pypy-svn] r11943 - pypy/extradoc/talk Message-ID: <20050504151843.2CFDF27B5B@code1.codespeak.net> Author: arigo Date: Wed May 4 17:18:42 2005 New Revision: 11943 Added: pypy/extradoc/talk/pypy-talk-ep2005.txt (contents, props changed) Log: EuroPython 2005 talk abstract. Added: pypy/extradoc/talk/pypy-talk-ep2005.txt ============================================================================== --- (empty file) +++ pypy/extradoc/talk/pypy-talk-ep2005.txt Wed May 4 17:18:42 2005 @@ -0,0 +1,40 @@ + + + +PyPy as a compiler +------------------ + +A status report on PyPy, the Python interpreter implemented in Python. + +1) introduction to the PyPy release (planned one month before EuroPython); +2) current work on the compilation infrastructure for PyPy; +3) (if time permits) a short tutorial on how to compile your own Python programs. + +The main part of the talk will be the second one, as it is where we are putting the most efforts at the moment: "how to turn an interpreter into a compiler". +We will dig into: + +- what kind of programs we can statically compile; +- the frontend infrastructure (control flow graph production, type inference); +- the C back-end, and the role of the "typer" component bridging the gap between high-level type annotations and the C data model; +- the LLVM back-end (targetting a virtual machine with a different model and different trade-offs than plain C); +- how this relates to our rather different long-term goal of making a really fast PyPy interpreter. + +------------------------------------------- + +The PyPy project (http://codespeak.net/pypy) aims at producing a simple runtime system for the Python language, expressing the basic abstractions within the Python language itself. Simplicity and Flexibilty are the foremost goals. + +To reach our goal, we are currently working on a Python source analysis and compilation toolchain -- based on PyPy as well -- and a minimal low-level core that doesn't need CPython any more. The presentation will focus on these tools, which are able to perform automatic static type inference of "static enough" Python programs and then compile them to various lower-level languages (currently, we have experimental back-ends for C, LLVM, Python, Lisp, Pyrex and Java). This analysis works on fully standard Python sources (bytecodes, actually), and the distinguishing feature of the techniques we use -- "abstract interpretation" -- is to allow type inference to be performed for any language for which we have an interpreter. Moreover, it doesn't require explicit type annotations added by the user. + +To some extent, and although it is not our primary long-term goal, the tools we have developped could be used generally to check or improve the performance of any program. We will see in particular which "staticness" restrictions must be met for these tools to work, and look under the hood: + +* how we build control flow graphs; + +* how we perform type inference, and what "type inference" precisely means in this context; + +* type inference is not the end of the story: good code must be generated from the source and the inferred types. + +The presentation will focus on the latter point, explaining the two major code generators we have at the moment: the C and LLVM back-ends. + +The techniques relate to Psyco's, the just-in-time specializer for CPython. We will compare them, and also contrast the "internal" notion of type used as an implementation detail (as in PyPy and Psyco) with the other typical approach of explicit user-specified types. This point of view puts our current efforts in the more general context of our long-term goals, which are about dynamic optimizations rather than static compilation. + +Our approach is motivated by the desire of flexibility: it allows issues that normally require early design decisions to be postponed, and addressed later in possibly more than one way, without rewriting everything. Typical example: adding Stackless-style continuations in CPython required a whole-scale rewrite, but has only a "local" impact on PyPy. We will plead for a framework based on interpreters as a way to gain the most flexibility from programming languages -- and the best performances too, for very-high-level languages! From ac at codespeak.net Wed May 4 18:04:52 2005 From: ac at codespeak.net (ac at codespeak.net) Date: Wed, 4 May 2005 18:04:52 +0200 (CEST) Subject: [pypy-svn] r11944 - pypy/branch/non-fake-unicode/pypy/module/unicodedata Message-ID: <20050504160452.5368627B5F@code1.codespeak.net> Author: ac Date: Wed May 4 18:04:52 2005 New Revision: 11944 Modified: pypy/branch/non-fake-unicode/pypy/module/unicodedata/functions.py pypy/branch/non-fake-unicode/pypy/module/unicodedata/generate_unicodedb.py Log: Improve the unicodedatabase. Modified: pypy/branch/non-fake-unicode/pypy/module/unicodedata/functions.py ============================================================================== --- pypy/branch/non-fake-unicode/pypy/module/unicodedata/functions.py (original) +++ pypy/branch/non-fake-unicode/pypy/module/unicodedata/functions.py Wed May 4 18:04:52 2005 @@ -15,7 +15,7 @@ def lookup(space, w_name): name = space.str_w(w_name) try: - code = unicodedb.charcodeByName[name] + code = unicodedb.lookup(name) except KeyError: msg = space.mod(space.wrap("undefined character name '%s'"), w_name) raise OperationError(space.w_KeyError, msg) @@ -25,7 +25,7 @@ def name(space, w_unichr, w_default=NoneNotWrapped): code = unichr_to_code_w(space, w_unichr) try: - name = unicodedb.charnameByCode[code] + name = unicodedb.name(code) except KeyError: if w_default is not None: return w_default @@ -36,7 +36,7 @@ def decimal(space, w_unichr, default=NoneNotWrapped): code = unichr_to_code_w(space, w_unichr) try: - return space.wrap(unicodedb.decimalValue[code]) + return space.wrap(unicodedb.decimal(code)) except KeyError: pass if w_default is not None: @@ -46,7 +46,7 @@ def digit(space, w_unichr, w_default=NoneNotWrapped): code = unichr_to_code_w(space, w_unichr) try: - return space.wrap(unicodedb.digitValue[code]) + return space.wrap(unicodedb.digit(code)) except KeyError: pass if w_default is not None: @@ -56,7 +56,7 @@ def numeric(space, w_unichr, w_default=NoneNotWrapped): code = unichr_to_code_w(space, w_unichr) try: - return space.wrap(unicodedb.numericValue[code]) + return space.wrap(unicodedb.numeric(code)) except KeyError: pass if w_default is not None: @@ -66,24 +66,24 @@ def category(space, w_unichr): code = unichr_to_code_w(space, w_unichr) - return space.wrap(unicodedb.category.get(code, 'Cn')) + return space.wrap(unicodedb.category(code)) def bidirectional(space, w_unichr): code = unichr_to_code_w(space, w_unichr) - return space.wrap(unicodedb.bidirectional.get(code, '')) + return space.wrap(unicodedb.bidirectional(code)) def combining(space, w_unichr): code = unichr_to_code_w(space, w_unichr) - return space.wrap(unicodedb.combining(code, 0) + return space.wrap(unicodedb.combining(code)) def mirrored(space, w_unichr): code = unichr_to_code_w(space, w_unichr) - return space.wrap(unicodedb.mirrored(code, 0)) - + return space.wrap(unicodedb.mirrored(code)) def decomposition(space, w_unichr): code = unichr_to_code_w(space, w_unichr) - return space.wrap('') + raise OperationError(space.w_NotImplementedError, + space.wrap('Decomposition is not implemented')) def normalize(space, w_form, w_unistr): form = space.str_w(w_form) Modified: pypy/branch/non-fake-unicode/pypy/module/unicodedata/generate_unicodedb.py ============================================================================== --- pypy/branch/non-fake-unicode/pypy/module/unicodedata/generate_unicodedb.py (original) +++ pypy/branch/non-fake-unicode/pypy/module/unicodedata/generate_unicodedb.py Wed May 4 18:04:52 2005 @@ -1,132 +1,223 @@ #!/usr/bin/env python - import sys -import __future__ -def printDict(outfile, name, dictionary): - keys = dictionary.keys() - keys.sort() - print >> outfile, name, '= {' - for key in keys: - print >>outfile, ' %r : %r,' % (key, dictionary[key]) - print >>outfile, '}' +class Unicodechar(object): + __slots__ = '''code name category combining bidirectional + decomposition decomposition_tag decimal digit numeric + mirrored upper lower title'''.split() + def __init__(self, data): + if not data[1] or data[1][0] == '<' and data[1][-1] == '>': + self.name = None + else: + self.name = data[1] + self.category = data[2] + self.combining = 0 + if data[3]: + self.combining = int(data[3]) + self.bidirectional = data[4] + self.decomposition = None + self.decomposition_tag = None + if data[5]: + if data[5][0] == '<': + tag, value = data[5].split(None, 1) + else: + tag = '' + value = data[5] + self.decomposition_tag = tag[1:-1] + self.decomposition = [int(v, 16) for v in value.split()] + + self.decimal = None + if data[6]: + self.decimal = int(data[6]) + self.digit = None + if data[7]: + self.digit = int(data[7]) + self.numeric = None + if data[8]: + try: + numerator, denomenator = data[8].split('/') + self.numeric = float(numerator) / float(denomenator) + except ValueError: + self.numeric = float(data[8]) + self.mirrored = (data[9] == 'Y') + if data[12]: + self.upper = int(data[12], 16) + self.lower = None + if data[13]: + self.lower = int(data[13], 16) + self.title = None + if data[14]: + self.title = int(data[14], 16) + + def isspace(self): + return (self.category == 'Zs' or + self.bidirectional in ('WS', 'B' or 'S')) -def generate_unicodedb(unidata_version, infile, outfile): - decimal = {} - digit = {} - number = {} - uppercase = {} - lowercase = {} - titlecase = {} - category = {} - name = {} - combining = {} - bidir = {} - mirrored = {} - - decomp = {} - - table = {} +def read_unicodedata(infile): + rangeFirst = {} + rangeLast = {} + table = [Unicodechar(['0000', None, 'Cn'] + [''] * 12)] * (sys.maxunicode + 1) for line in infile: line = line.split('#', 1)[0].strip() if not line: continue data = [ v.strip() for v in line.split(';') ] - code = data[0] = int(data[0], 16) - table[code] = data + if data[1].endswith(', First>'): + code = int(data[0], 16) + name = data[1][1:-len(', First>')] + rangeFirst[name] = (code, data) + continue + if data[1].endswith(', Last>'): + code = int(data[0], 16) + rangeLast[name] = code + continue + code = int(data[0], 16) + u = Unicodechar(data) + table[code] = u + + # Expand ranges + for name, (start, data) in rangeFirst.iteritems(): + end = rangeLast[name] + unichar = Unicodechar(['0000', None] + data[2:]) + for code in range(start, end + 1): + table[code] = unichar - # Expand named ranges - field = None - for i in range(0, 0x110000): - s = table.get(i) - if s: - if s[1][-8:] == ", First>": - field = s[:] - field[1] = s[1][:-8] - s[1] = s[1][:-8] + '-%4X'%s[0] - elif s[1][-7:] == ", Last>": - s[1] = s[1][:-7] + '-%4X'%s[0] - field = None - elif field: - s = field[:] - s[0] = i - s[1] = s[1] + '-%4X'%s[0] - table[i] = s - - for (code, _name, cat, _combine, _bidir, _decomp, - _decimal, _digit, _number, _mirrored, unicode1_name, comment, - _uppercase, _lowercase, _titlecase) in table.itervalues(): - if cat != 'Cn': - category[code] = cat - - name[code] = _name - if _combine: - combine = int(_combine) - if combine != 0: - combining[code] = combine - - if _decimal: - decimal[code] = int(_decimal) - if _digit: - d = digit[code] = int(_digit) - if _number: - number[code] = float(eval(compile(_number, '-', 'eval', __future__.CO_FUTURE_DIVISION, 1))) - - if _uppercase: - uppercase[code] = int(_uppercase, 16) - if _lowercase: - lowercase[code] = int(_lowercase, 16) - if _titlecase: - titlecase[code] = int(_titlecase, 16) + return table - if _mirrored == 'Y': - mirrored[code] = 1 +def writeDict(outfile, name, dictionary): + print >> outfile, '%s = {' % name + keys = dictionary.keys() + keys.sort() + for key in keys: + print >> outfile, '%r: %r,'%(key, dictionary[key]) + print >> outfile, '}' + print >> outfile - if _bidir: - bidir[code] = _bidir +def writeCategory(outfile, table, name, categoryNames): + print >> outfile, '_%s_names = %r' % (name, categoryNames) + print >> outfile, '_%s = "".join([' % name + for i in range(0, len(table), 64): + result = [] + for char in table[i:i + 64]: + result.append(chr(categoryNames.index(getattr(char, name)) + 0x20)) + print >> outfile, ' %r,' % ''.join(result) + print >> outfile, '])' + print >> outfile, ''' +def %s(code): + return _%s_names[ord(_%s[code]) & 0x1f] + +'''%(name, name, name) + +def writeUnicodedata(version, table, outfile): + # Version + print >> outfile, 'version = %r' % version + print >> outfile + # Character names + print >> outfile, '_charnames = {' + for code in range(len(table)): + if table[code].name: + print >> outfile, '%r: %r,'%(code, table[code].name) + print >> outfile, '''} + +_code_by_name = dict(zip(_charnames.itervalues(), _charnames.iterkeys())) - #if _decomp: - # raise Exception +def lookup(name): + return _code_by_name[name] - codeByName = {} - duplicateNames = {} - for k, v in name.iteritems(): - if duplicateNames.has_key(k): - continue - if codeByName.has_key(k): - duplicateNames[k] = 1 - del codeByName[k] - continue - codeByName[k] = v +def name(code): + return _charnames[code] +''' + # Categories + categories = {} + bidirs = {} + for char in table: + categories[char.category] = 1 + bidirs[char.bidirectional] = 1 + category_names = categories.keys() + category_names.sort() + if len(category_names) > 32: + raise RuntimeError('Too many general categories defined.') + bidirectional_names = bidirs.keys() + bidirectional_names.sort() + if len(bidirectional_names) > 32: + raise RuntimeError('Too many bidirectional categories defined.') + + writeCategory(outfile, table, 'category', category_names) + writeCategory(outfile, table, 'bidirectional', bidirectional_names) + print >> outfile, ''' +def isspace(code): + return category(code) == "Zs" or bidirectional(code) in ("WS", "B", "S") +def islower(code): + return category(code) == "Ll" +def isupper(code): + return category(code) == "Lu" +def istitle(code): + return category(code) == "Lt" +def isalpha(code): + return category(code) in ("Lm", "Lt", "Lu", "Ll", "Lo") +def islinebreak(code): + return category(code) == "Zl" or bidirectional(code) == "B" +''' + + # Numeric characters + decimal = {} + digit = {} + numeric = {} + for code in range(len(table)): + if table[code].decimal is not None: + decimal[code] = table[code].decimal + if table[code].digit is not None: + digit[code] = table[code].digit + if table[code].numeric is not None: + numeric[code] = table[code].numeric + + writeDict(outfile, '_decimal', decimal) + writeDict(outfile, '_digit', digit) + writeDict(outfile, '_numeric', numeric) + print >> outfile, ''' +def decimal(code): + return _decimal[code] + +def isdecimal(code): + return _decimal.has_key(code) + +def digit(code): + return _digit[code] + +def isdigit(code): + return _digit.has_key(code) - print >> outfile, 'version = %r'%unidata_version - print >> outfile - printDict(outfile, 'charnameByCode', name) - print >> outfile - printDict(outfile,'charcodeByName', codeByName) - print >> outfile - printDict(outfile, 'decimalValue', decimal) - print >> outfile - printDict(outfile, 'digitValue', digit) - print >> outfile - printDict(outfile, 'numericValue', number) - print >> outfile - printDict(outfile, 'category', category) - print >> outfile - printDict(outfile, 'bidirectional', bidir) - print >> outfile - printDict(outfile, 'combining', combining) - print >> outfile - printDict(outfile, 'mirrored', mirrored) - print >> outfile - printDict(outfile, 'decomposition', decomp) - print >> outfile - printDict(outfile, 'uppercase', uppercase) - print >> outfile - printDict(outfile, 'lowercase', lowercase) - print >> outfile - printDict(outfile, 'titlecase', titlecase) - print >> outfile +def numeric(code): + return _numeric[code] + +def isnumeric(code): + return _numeric.has_key(code) + +''' + # Combining + combining = {} + for code in range(len(table)): + if table[code].combining: + combining[code] = table[code].combining + writeDict(outfile, '_combining', combining) + print >> outfile, ''' +def combining(code): + return _combining.get(code, 0) + +''' + # Mirrored + mirrored = dict([(code, 1) for char in table + if char.mirrored]) + mirrored = {} + for code in range(len(table)): + if table[code].mirrored: + mirrored[code] = 1 + writeDict(outfile, '_mirrored', mirrored) + print >> outfile, ''' +def mirrored(code): + return _mirrored.get(code, 0) + +''' if __name__ == '__main__': import getopt, re @@ -153,10 +244,10 @@ if unidata_version is None: raise ValueError('No version specified') - + + table = read_unicodedata(infile) print >> outfile, '# UNICODE CHARACTER DATABASE' - print >> outfile, '# This ficle was genrated with the command:' - print >> outfile, '# ', ' '.join(sys.argv) + print >> outfile, '# This file was genrated with the command:' + print >> outfile, '# ', ' '.join(sys.argv) print >> outfile - - generate_unicodedb(unidata_version, infile, outfile) + writeUnicodedata(unidata_version, table, outfile) From tismer at codespeak.net Wed May 4 23:21:34 2005 From: tismer at codespeak.net (tismer at codespeak.net) Date: Wed, 4 May 2005 23:21:34 +0200 (CEST) Subject: [pypy-svn] r11947 - pypy/dist/pypy/objspace/std Message-ID: <20050504212134.109B327B60@code1.codespeak.net> Author: tismer Date: Wed May 4 23:21:33 2005 New Revision: 11947 Modified: pypy/dist/pypy/objspace/std/intobject.py pypy/dist/pypy/objspace/std/longobject.py Log: tiny cleanups like un-overflow-checking an operation. synchronized the way long and ints decide about floordiv Modified: pypy/dist/pypy/objspace/std/intobject.py ============================================================================== --- pypy/dist/pypy/objspace/std/intobject.py (original) +++ pypy/dist/pypy/objspace/std/intobject.py Wed May 4 23:21:33 2005 @@ -178,13 +178,12 @@ y = w_int2.intval try: z = ovfcheck(x // y) - t = ovfcheck(x % y) except ZeroDivisionError: raise OperationError(space.w_ZeroDivisionError, space.wrap("integer division by zero")) except OverflowError: return space.div(space.newfloat(float(x)), w_int2) - if t != 0: # gives a float + if x % y != 0: # gives a float return space.div(space.newfloat(float(x)), w_int2) return W_IntObject(space, z) Modified: pypy/dist/pypy/objspace/std/longobject.py ============================================================================== --- pypy/dist/pypy/objspace/std/longobject.py (original) +++ pypy/dist/pypy/objspace/std/longobject.py Wed May 4 23:21:33 2005 @@ -275,7 +275,13 @@ z = x // y return W_LongObject(space, *args_from_long(z)) -div__Long_Long = floordiv__Long_Long #YYYYYY +old_style_div = 1 / 2 == 1 // 2 +def div__Long_Long(space, w_long1, w_long2): #YYYYYY + # Select the proper div + if old_style_div: + return floordiv__Long_Long(space, w_long1, w_long2) + else: + return truediv__Long_Long(space, w_long1, w_long2) def mod__Long_Long(space, w_long1, w_long2): #YYYYYY From hpk at codespeak.net Thu May 5 00:05:22 2005 From: hpk at codespeak.net (hpk at codespeak.net) Date: Thu, 5 May 2005 00:05:22 +0200 (CEST) Subject: [pypy-svn] r11948 - in pypy/dist/pypy/lib: . test2 Message-ID: <20050504220522.9128827B6E@code1.codespeak.net> Author: hpk Date: Thu May 5 00:05:22 2005 New Revision: 11948 Added: pypy/dist/pypy/lib/__init__.py Removed: pypy/dist/pypy/lib/test2/support.py Modified: pypy/dist/pypy/lib/test2/FIXME_test_sio.py pypy/dist/pypy/lib/test2/test_binascii_extra.py pypy/dist/pypy/lib/test2/test_codeccallbacks.py pypy/dist/pypy/lib/test2/test_file_extra.py pypy/dist/pypy/lib/test2/test_imp_extra.py pypy/dist/pypy/lib/test2/test_md5_extra.py pypy/dist/pypy/lib/test2/test_sha_extra.py pypy/dist/pypy/lib/test2/test_struct_extra.py Log: make pypy.lib plainly importable at cpython level in order to allow easier testing in pypy/lib/test2 Added: pypy/dist/pypy/lib/__init__.py ============================================================================== --- (empty file) +++ pypy/dist/pypy/lib/__init__.py Thu May 5 00:05:22 2005 @@ -0,0 +1 @@ +# Modified: pypy/dist/pypy/lib/test2/FIXME_test_sio.py ============================================================================== --- pypy/dist/pypy/lib/test2/FIXME_test_sio.py (original) +++ pypy/dist/pypy/lib/test2/FIXME_test_sio.py Thu May 5 00:05:22 2005 @@ -5,7 +5,7 @@ import time from pypy.tool.udir import udir -sio = support.libmodule("_sio") +from pypy.lib import _sio as sio class TSource(object): Deleted: /pypy/dist/pypy/lib/test2/support.py ============================================================================== --- /pypy/dist/pypy/lib/test2/support.py Thu May 5 00:05:22 2005 +++ (empty file) @@ -1,40 +0,0 @@ -import sys, os, new - -this_dir = os.path.normpath(os.path.dirname(os.path.abspath(__file__))) -lib_dir = os.path.dirname(this_dir) -pypy_dir = os.path.dirname(lib_dir) -dist_dir = os.path.dirname(pypy_dir) - -if dist_dir not in sys.path: - sys.path.insert(0, dist_dir) - -def cleanup_path(): - # the 'pypy/lib' directory should always be last in CPython's sys.path, - # after the standard library! - sys.path[:] = [p for p in sys.path - if os.path.normpath(os.path.abspath(p)) != lib_dir] - -cleanup_path() -sys.path.append(lib_dir) - - -def libmodule(modname): - """Get a module from the pypy/lib directory, without going through the - import machinery. - """ - # forces the real CPython module to be imported first, to avoid strange - # interactions later - cleanup_path() - try: - cpython_mod = __import__(modname) - if hasattr(cpython_mod, '__file__'): - assert os.path.dirname(cpython_mod.__file__) != lib_dir - except ImportError: - pass - cleanup_path() - sys.path.append(lib_dir) - filename = os.path.join(lib_dir, modname + '.py') - mod = new.module(modname) - mod.__file__ = filename - execfile(filename, mod.__dict__) - return mod Modified: pypy/dist/pypy/lib/test2/test_binascii_extra.py ============================================================================== --- pypy/dist/pypy/lib/test2/test_binascii_extra.py (original) +++ pypy/dist/pypy/lib/test2/test_binascii_extra.py Thu May 5 00:05:22 2005 @@ -1,6 +1,5 @@ -import support -binascii = support.libmodule('binascii') +from pypy.lib import binascii def test_uu(): assert binascii.b2a_uu('1234567') == "',3(S-#4V-P \n" Modified: pypy/dist/pypy/lib/test2/test_codeccallbacks.py ============================================================================== --- pypy/dist/pypy/lib/test2/test_codeccallbacks.py (original) +++ pypy/dist/pypy/lib/test2/test_codeccallbacks.py Thu May 5 00:05:22 2005 @@ -1,3 +1,5 @@ +import py +py.test.skip("this test module doesn't belong here") import autopath import test.test_support, unittest import sys, htmlentitydefs, unicodedata Modified: pypy/dist/pypy/lib/test2/test_file_extra.py ============================================================================== --- pypy/dist/pypy/lib/test2/test_file_extra.py (original) +++ pypy/dist/pypy/lib/test2/test_file_extra.py Thu May 5 00:05:22 2005 @@ -1,6 +1,5 @@ import os -import support -_file = support.libmodule("_file") +from pypy.lib import _file from pypy.tool.udir import udir import py Modified: pypy/dist/pypy/lib/test2/test_imp_extra.py ============================================================================== --- pypy/dist/pypy/lib/test2/test_imp_extra.py (original) +++ pypy/dist/pypy/lib/test2/test_imp_extra.py Thu May 5 00:05:22 2005 @@ -1,9 +1,7 @@ -import support -imp = support.libmodule('imp') +from pypy.lib import imp import os - def test_find_module(): file, pathname, description = imp.find_module('StringIO') assert file is not None Modified: pypy/dist/pypy/lib/test2/test_md5_extra.py ============================================================================== --- pypy/dist/pypy/lib/test2/test_md5_extra.py (original) +++ pypy/dist/pypy/lib/test2/test_md5_extra.py Thu May 5 00:05:22 2005 @@ -4,9 +4,8 @@ 160 sec. per MB of data on a 233 MHz Intel Pentium CPU. """ -import support import md5 # CPython's implementation in C. -pymd5 = support.libmodule("md5") # The pure Python implementation. +from pypy.lib import md5 as pymd5 # Helpers... Modified: pypy/dist/pypy/lib/test2/test_sha_extra.py ============================================================================== --- pypy/dist/pypy/lib/test2/test_sha_extra.py (original) +++ pypy/dist/pypy/lib/test2/test_sha_extra.py Thu May 5 00:05:22 2005 @@ -4,8 +4,7 @@ # Publication 180-1, Secure Hash Standard, 1995 April 17 # http://www.itl.nist.gov/div897/pubs/fip180-1.htm -import support -sha = support.libmodule("sha") +from pypy.lib import sha class TestSHA: def check(self, data, digest): Modified: pypy/dist/pypy/lib/test2/test_struct_extra.py ============================================================================== --- pypy/dist/pypy/lib/test2/test_struct_extra.py (original) +++ pypy/dist/pypy/lib/test2/test_struct_extra.py Thu May 5 00:05:22 2005 @@ -1,6 +1,4 @@ -import support -struct = support.libmodule('struct') - +from pypy.lib import struct def test_simple(): morezeros = '\x00' * (struct.calcsize('l')-4) From arigo at codespeak.net Thu May 5 00:07:31 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Thu, 5 May 2005 00:07:31 +0200 (CEST) Subject: [pypy-svn] r11949 - in pypy/dist/pypy: interpreter module/sys2 objspace/flow objspace/std tool tool/test Message-ID: <20050504220731.A8E0C27B6E@code1.codespeak.net> Author: arigo Date: Thu May 5 00:07:31 2005 New Revision: 11949 Modified: pypy/dist/pypy/interpreter/baseobjspace.py pypy/dist/pypy/interpreter/gateway.py pypy/dist/pypy/interpreter/lazymodule.py pypy/dist/pypy/interpreter/typedef.py pypy/dist/pypy/module/sys2/state.py pypy/dist/pypy/objspace/flow/objspace.py pypy/dist/pypy/objspace/std/fake.py pypy/dist/pypy/objspace/std/objspace.py pypy/dist/pypy/objspace/std/stdtypedef.py pypy/dist/pypy/tool/cache.py pypy/dist/pypy/tool/test/test_cache.py Log: Changed the annotator-related behavior of Cache. It doesn't really make sense to forcibly freeze caches. What we really want is that the annotator figures out all the keys that can be used with a given cache (as SomePBCs), and build the corresponding values and add them to the cache. This change required a bit of refactoring in all places using the Cache class. (Some of these places didn't actually need to use the now-a-bit-obscure Cache machinery, and were changed into plain dict manipulations.) Modified: pypy/dist/pypy/interpreter/baseobjspace.py ============================================================================== --- pypy/dist/pypy/interpreter/baseobjspace.py (original) +++ pypy/dist/pypy/interpreter/baseobjspace.py Thu May 5 00:07:31 2005 @@ -51,6 +51,31 @@ """Same as BaseWrappable, just new-style instead.""" +class InternalSpaceCache(Cache): + """A generic cache for an object space. Arbitrary information can + be attached to the space by defining a function or class 'f' which + can be called as 'f(space)'. Its result is stored in this + ObjSpaceCache. + """ + def __init__(self, space): + Cache.__init__(self) + self.space = space + def _build(self, callable): + return callable(self.space) + +class SpaceCache(Cache): + """A base class for all our concrete caches.""" + def __init__(self, space): + Cache.__init__(self) + self.space = space + def _build(self, key): + val = self.space.enter_cache_building_mode() + try: + return self.build(key) + finally: + self.space.leave_cache_building_mode(val) + + class ObjSpace(object): """Base class for the interpreter-level implementations of object spaces. http://codespeak.net/moin/pypy/moin.cgi/ObjectSpace""" @@ -59,8 +84,7 @@ def __init__(self): "NOT_RPYTHON: Basic initialization of objects." - self._gatewaycache = Cache() - self._codecache = Cache() + self.fromcache = InternalSpaceCache(self).getorbuild # set recursion limit # sets all the internal descriptors self.initialize() @@ -112,10 +136,10 @@ """NOT_RPYTHON: Abstract method that should put some minimal content into the w_builtins.""" - def loadfromcache(self, key, builder, cache): - return cache.getorbuild(key, builder, self) - loadfromcache._specialize_ = "location" - + def enter_cache_building_mode(self): + "hook for the flow object space" + def leave_cache_building_mode(self, val): + "hook for the flow object space" def get_ec_state_dict(self): "Return the 'state dict' from the active execution context." @@ -334,21 +358,23 @@ return result ''' """ - w_func = self.loadfromcache(source, buildappexecfunc, self._codecache) + w_func = self.fromcache(AppExecCache).getorbuild(source) args = Arguments(self, posargs_w) return self.call_args(w_func, args) -def buildappexecfunc(source, space): - """ NOT_RPYTHON """ - # XXX will change once we have our own compiler - from pypy.interpreter.pycode import PyCode - from pypy.tool.getpy import py # aehem - source = source.lstrip() - assert source.startswith('('), "incorrect header in:\n%s" % (source,) - source = py.code.Source("def anonymous%s\n" % source) - w_glob = space.newdict([]) - space.exec_(source.compile(), w_glob, w_glob) - return space.getitem(w_glob, space.wrap('anonymous')) +class AppExecCache(SpaceCache): + def build(cache, source): + """ NOT_RPYTHON """ + space = cache.space + # XXX will change once we have our own compiler + from pypy.interpreter.pycode import PyCode + from pypy.tool.getpy import py # aehem + source = source.lstrip() + assert source.startswith('('), "incorrect header in:\n%s" % (source,) + source = py.code.Source("def anonymous%s\n" % source) + w_glob = space.newdict([]) + space.exec_(source.compile(), w_glob, w_glob) + return space.getitem(w_glob, space.wrap('anonymous')) ## Table describing the regular part of the interface of object spaces, ## namely all methods which only take w_ arguments and return a w_ result Modified: pypy/dist/pypy/interpreter/gateway.py ============================================================================== --- pypy/dist/pypy/interpreter/gateway.py (original) +++ pypy/dist/pypy/interpreter/gateway.py Thu May 5 00:07:31 2005 @@ -15,9 +15,9 @@ from pypy.interpreter.error import OperationError from pypy.interpreter import eval from pypy.interpreter.function import Function, Method -from pypy.interpreter.baseobjspace import W_Root, ObjSpace, BaseWrappable, Wrappable +from pypy.interpreter.baseobjspace import W_Root, ObjSpace, BaseWrappable +from pypy.interpreter.baseobjspace import Wrappable, SpaceCache from pypy.interpreter.argument import Arguments -from pypy.tool.cache import Cache from pypy.tool.compile import compile2 from pypy.tool.sourcetools import NiceCompile @@ -457,12 +457,10 @@ return self.get_function(space) def get_function(self, space): - return space.loadfromcache(self, - interp2app.build_function, - self.getcache(space)) + return self.getcache(space).getorbuild(self) def getcache(self, space): - return space._gatewaycache + return space.fromcache(GatewayCache) def get_method(self, obj): # to bind this as a method out of an instance, we build a @@ -479,17 +477,15 @@ w_obj, space.type(w_obj)) - def build_function(self, space): +class GatewayCache(SpaceCache): + def build(cache, gateway): "NOT_RPYTHON" - cache = self.getcache(space) - try: - return cache.content[self] - except KeyError: - defs = self._getdefaults(space) # needs to be implemented by subclass - code = self._code - fn = Function(space, code, None, defs, forcename = self.name) - cache.content[self] = fn - return fn + space = cache.space + defs = gateway._getdefaults(space) # needs to be implemented by subclass + code = gateway._code + fn = Function(space, code, None, defs, forcename = gateway.name) + return fn + # # the next gateways are to be used only for @@ -498,7 +494,7 @@ class interp2app_temp(interp2app): "NOT_RPYTHON" def getcache(self, space): - return self.__dict__.setdefault(space, Cache()) + return self.__dict__.setdefault(space, GatewayCache(space)) # and now for something completely different ... @@ -521,8 +517,7 @@ self.code = NiceCompile(filename)(source) def getwdict(self, space): - return space.loadfromcache(self, self.__class__._builddict, - space._gatewaycache) + return space.fromcache(ApplevelCache).getorbuild(self) def buildmodule(self, space, name='applevel'): from pypy.interpreter.module import Module @@ -564,6 +559,10 @@ def _freeze_(self): return True # hint for the annotator: applevel instances are constants +class ApplevelCache(SpaceCache): + def build(cache, app): + return app._builddict(cache.space) + class ApplevelInterpClass(ApplevelClass): """ similar to applevel, but using translation to interp-level. This version maintains a cache folder with single files. Modified: pypy/dist/pypy/interpreter/lazymodule.py ============================================================================== --- pypy/dist/pypy/interpreter/lazymodule.py (original) +++ pypy/dist/pypy/interpreter/lazymodule.py Thu May 5 00:07:31 2005 @@ -1,6 +1,5 @@ from pypy.interpreter.module import Module from pypy.interpreter.function import Function, BuiltinFunction -from pypy.tool.cache import Cache from pypy.interpreter import gateway from pypy.interpreter.error import OperationError @@ -106,7 +105,7 @@ return value return ifileloader -applevelcache = Cache() +applevelcache = {} def getappfileloader(pkgroot, spec): """ NOT_RPYTHON """ # hum, it's a bit more involved, because we usually @@ -114,15 +113,16 @@ modname, attrname = spec.split('.') impbase = pkgroot + '.' + modname mod = __import__(impbase, None, None, ['attrname']) - app = applevelcache.getorbuild(mod, buildapplevelfrommodule, None) + try: + app = applevelcache[mod] + except KeyError: + source = inspect.getsource(mod) + fn = mod.__file__ + if fn.endswith('.pyc') or fn.endswith('.pyo'): + fn = fn[:-1] + app = gateway.applevel(source, filename=fn) + applevelcache[mod] = app + def afileloader(space): return app.wget(space, attrname) return afileloader - -def buildapplevelfrommodule(mod, _): - """ NOT_RPYTHON """ - source = inspect.getsource(mod) - fn = mod.__file__ - if fn.endswith('.pyc'): - fn = fn[:-1] - return gateway.applevel(source, filename=fn) Modified: pypy/dist/pypy/interpreter/typedef.py ============================================================================== --- pypy/dist/pypy/interpreter/typedef.py (original) +++ pypy/dist/pypy/interpreter/typedef.py Thu May 5 00:07:31 2005 @@ -24,11 +24,18 @@ # hint for the annotator: track individual constant instances of TypeDef return True -unique_interplevel_subclass_cache = Cache() +subclass_cache = {} def get_unique_interplevel_subclass(cls, hasdict, wants_slots): - return unique_interplevel_subclass_cache.getorbuild((cls, hasdict, wants_slots), _buildusercls, None) + key = (cls, hasdict, wants_slots) + try: + return subclass_cache[key] + except KeyError: + subcls = _buildusercls(cls, hasdict, wants_slots) + subclass_cache[key] = subcls + return subcls +get_unique_interplevel_subclass._specialize_ = "memo" -def _buildusercls((cls, hasdict, wants_slots), ignored): +def _buildusercls(cls, hasdict, wants_slots): "NOT_RPYTHON: initialization-time only" typedef = cls.typedef name = ['User'] Modified: pypy/dist/pypy/module/sys2/state.py ============================================================================== --- pypy/dist/pypy/module/sys2/state.py (original) +++ pypy/dist/pypy/module/sys2/state.py Thu May 5 00:07:31 2005 @@ -3,7 +3,6 @@ """ #from pypy.interpreter.module import Module from pypy.interpreter.error import OperationError -from pypy.tool.cache import Cache import sys, os @@ -41,7 +40,7 @@ builtin_module_names.sort() class State: - def __init__(self, space, stuff=None): + def __init__(self, space): self.space = space self.w_builtin_module_names = space.newtuple( [space.wrap(fn) for fn in builtin_module_names]) @@ -71,9 +70,8 @@ ] + [space.wrap(p) for p in sys.path if p!= srcdir]) -statecache = Cache() def get(space): - return space.loadfromcache(space, State, statecache) + return space.fromcache(State) def pypy_getudir(space): """NOT_RPYTHON""" Modified: pypy/dist/pypy/objspace/flow/objspace.py ============================================================================== --- pypy/dist/pypy/objspace/flow/objspace.py (original) +++ pypy/dist/pypy/objspace/flow/objspace.py Thu May 5 00:07:31 2005 @@ -63,20 +63,18 @@ #self.make_builtins() #self.make_sys() - def loadfromcache(self, key, builder, cache): + def enter_cache_building_mode(self): # when populating the caches, the flow space switches to # "concrete mode". In this mode, only Constants are allowed # and no SpaceOperation is recorded. - def my_builder(key, stuff): - previous_recorder = self.executioncontext.recorder - self.executioncontext.recorder = flowcontext.ConcreteNoOp() - self.concrete_mode += 1 - try: - return builder(key, stuff) - finally: - self.executioncontext.recorder = previous_recorder - self.concrete_mode -= 1 - return super(FlowObjSpace, self).loadfromcache(key, my_builder, cache) + previous_recorder = self.executioncontext.recorder + self.executioncontext.recorder = flowcontext.ConcreteNoOp() + self.concrete_mode += 1 + return previous_recorder + + def leave_cache_building_mode(self, previous_recorder): + self.executioncontext.recorder = previous_recorder + self.concrete_mode -= 1 def newdict(self, items_w): if self.concrete_mode: Modified: pypy/dist/pypy/objspace/std/fake.py ============================================================================== --- pypy/dist/pypy/objspace/std/fake.py (original) +++ pypy/dist/pypy/objspace/std/fake.py Thu May 5 00:07:31 2005 @@ -5,7 +5,6 @@ from pypy.objspace.std.stdtypedef import * from pypy.objspace.std.objspace import W_Object, StdObjSpace from pypy.objspace.std.model import UnwrapError -from pypy.tool.cache import Cache # this file automatically generates non-reimplementations of CPython # types that we do not yet implement in the standard object space @@ -22,7 +21,7 @@ import sys -_fake_type_cache = Cache() +_fake_type_cache = {} # real-to-wrapped exceptions def wrap_exception(space): @@ -47,9 +46,14 @@ def fake_type(cpy_type): assert type(cpy_type) is type - return _fake_type_cache.getorbuild(cpy_type, really_build_fake_type, None) + try: + return _fake_type_cache[cpy_type] + except KeyError: + faked_type = really_build_fake_type(cpy_type) + _fake_type_cache[cpy_type] = faked_type + return faked_type -def really_build_fake_type(cpy_type, ignored): +def really_build_fake_type(cpy_type): "NOT_RPYTHON (not remotely so!)." debug_print('faking %r'%(cpy_type,)) kw = {} @@ -160,9 +164,9 @@ func = BuiltinFunction(func) return func -_fake_type_cache.content[type(len)] = fake_builtin_function -_fake_type_cache.content[type(list.append)] = fake_builtin_callable -_fake_type_cache.content[type(type(None).__repr__)] = fake_builtin_callable +_fake_type_cache[type(len)] = fake_builtin_function +_fake_type_cache[type(list.append)] = fake_builtin_callable +_fake_type_cache[type(type(None).__repr__)] = fake_builtin_callable from pypy.interpreter.baseobjspace import Wrappable @@ -212,5 +216,5 @@ __delete__ = interp2app(descr_descriptor_del), ) -_fake_type_cache.content[type(file.softspace)] = W_FakeDescriptor -_fake_type_cache.content[type(type.__dict__['__dict__'])] = W_FakeDescriptor +_fake_type_cache[type(file.softspace)] = W_FakeDescriptor +_fake_type_cache[type(type.__dict__['__dict__'])] = W_FakeDescriptor Modified: pypy/dist/pypy/objspace/std/objspace.py ============================================================================== --- pypy/dist/pypy/objspace/std/objspace.py (original) +++ pypy/dist/pypy/objspace/std/objspace.py Thu May 5 00:07:31 2005 @@ -168,9 +168,7 @@ def gettypeobject(self, typedef): # types_w maps each StdTypeDef instance to its # unique-for-this-space W_TypeObject instance - return self.loadfromcache(typedef, - stdtypedef.buildtypeobject, - self._typecache) + return self.fromcache(stdtypedef.TypeCache).getorbuild(typedef) def wrap(self, x): "Wraps the Python value 'x' into one of the wrapper classes." Modified: pypy/dist/pypy/objspace/std/stdtypedef.py ============================================================================== --- pypy/dist/pypy/objspace/std/stdtypedef.py (original) +++ pypy/dist/pypy/objspace/std/stdtypedef.py Thu May 5 00:07:31 2005 @@ -1,6 +1,7 @@ from pypy.interpreter import eval, function, gateway from pypy.interpreter.error import OperationError from pypy.interpreter.typedef import TypeDef, GetSetProperty, Member +from pypy.interpreter.baseobjspace import SpaceCache from pypy.objspace.std.model import MultiMethod, FailedToImplement from pypy.tool.compile import compile2 @@ -51,43 +52,45 @@ # the descriptors to put into the W_TypeObjects. # -def buildtypeobject(typedef, space): - "NOT_RPYTHON: initialization-time only." - # build a W_TypeObject from this StdTypeDef - from pypy.objspace.std.typeobject import W_TypeObject - from pypy.objspace.std.objecttype import object_typedef - - w = space.wrap - rawdict = typedef.rawdict - lazyloaders = {} - - if isinstance(typedef, StdTypeDef): - # get all the sliced multimethods - multimethods = slicemultimethods(space, typedef) - for name, loader in multimethods.items(): - if name in rawdict: - # the name specified in the rawdict has priority - continue - assert name not in lazyloaders, ( - 'name clash: %s in %s.lazyloaders' % (name, typedef.name)) - lazyloaders[name] = loader - - # compute the bases - if typedef is object_typedef: - bases_w = [] - else: - base = typedef.base or object_typedef - bases_w = [space.gettypeobject(base)] - - # wrap everything - dict_w = {} - for descrname, descrvalue in rawdict.items(): - dict_w[descrname] = w(descrvalue) - - w_type = W_TypeObject(space, typedef.name, bases_w, dict_w, - overridetypedef=typedef) - w_type.lazyloaders = lazyloaders - return w_type +class TypeCache(SpaceCache): + def build(cache, typedef): + "NOT_RPYTHON: initialization-time only." + # build a W_TypeObject from this StdTypeDef + from pypy.objspace.std.typeobject import W_TypeObject + from pypy.objspace.std.objecttype import object_typedef + + space = cache.space + w = space.wrap + rawdict = typedef.rawdict + lazyloaders = {} + + if isinstance(typedef, StdTypeDef): + # get all the sliced multimethods + multimethods = slicemultimethods(space, typedef) + for name, loader in multimethods.items(): + if name in rawdict: + # the name specified in the rawdict has priority + continue + assert name not in lazyloaders, ( + 'name clash: %s in %s.lazyloaders' % (name, typedef.name)) + lazyloaders[name] = loader + + # compute the bases + if typedef is object_typedef: + bases_w = [] + else: + base = typedef.base or object_typedef + bases_w = [space.gettypeobject(base)] + + # wrap everything + dict_w = {} + for descrname, descrvalue in rawdict.items(): + dict_w[descrname] = w(descrvalue) + + w_type = W_TypeObject(space, typedef.name, bases_w, dict_w, + overridetypedef=typedef) + w_type.lazyloaders = lazyloaders + return w_type def hack_out_multimethods(ns): "NOT_RPYTHON: initialization-time only." Modified: pypy/dist/pypy/tool/cache.py ============================================================================== --- pypy/dist/pypy/tool/cache.py (original) +++ pypy/dist/pypy/tool/cache.py Thu May 5 00:07:31 2005 @@ -21,18 +21,20 @@ # using the information collected by the annotator itself about # what the keys can actually be. # +# Cache must be subclassed, and a _build() method provided. +# Be sure to call the parent __init__() if you override it. +# -class Cache: +class Cache(object): def __init__(self): self.content = {} - def getorbuild(self, key, builder, stuff): + def getorbuild(self, key): try: return self.content[key] except KeyError: - result = builder(key, stuff) - #assert key not in self.content, "things messed up" + result = self._build(key) self.content[key] = result return result getorbuild._specialize_ = "memo" Modified: pypy/dist/pypy/tool/test/test_cache.py ============================================================================== --- pypy/dist/pypy/tool/test/test_cache.py (original) +++ pypy/dist/pypy/tool/test/test_cache.py Thu May 5 00:07:31 2005 @@ -1,11 +1,22 @@ import autopath from pypy.tool.cache import Cache +class MyCache(Cache): + counter = 0 + def _build(self, key): + self.counter += 1 + return key*7 + class TestCache: def test_getorbuild(self): - cache = Cache() - assert cache.getorbuild(1, lambda k,s: 42, None) == 42 - assert cache.getorbuild(1, lambda k,s: self.fail(), None) == 42 - assert cache.getorbuild(2, lambda k,s: 24, None) == 24 - assert cache.getorbuild(1, lambda k,s: self.fail(), None) == 42 - assert cache.getorbuild(2, lambda k,s: self.fail(), None) == 24 + cache = MyCache() + assert cache.getorbuild(1) == 7 + assert cache.counter == 1 + assert cache.getorbuild(1) == 7 + assert cache.counter == 1 + assert cache.getorbuild(3) == 21 + assert cache.counter == 2 + assert cache.getorbuild(1) == 7 + assert cache.counter == 2 + assert cache.getorbuild(3) == 21 + assert cache.counter == 2 From arigo at codespeak.net Thu May 5 02:09:06 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Thu, 5 May 2005 02:09:06 +0200 (CEST) Subject: [pypy-svn] r11953 - pypy/dist/pypy/annotation Message-ID: <20050505000906.19AA627B60@code1.codespeak.net> Author: arigo Date: Thu May 5 02:09:05 2005 New Revision: 11953 Modified: pypy/dist/pypy/annotation/classdef.py pypy/dist/pypy/annotation/unaryop.py Log: Annotation fun: sometimes, new methods can show up on classes, added e.g. by W_TypeObject._freeze_() -- the multimethod implementations. Check that in the ClassDef... This is really a special case for PyPy's pattern of adding a bunch of new methods at a time. It would break things if we added e.g. a method that overrides another existing method. Modified: pypy/dist/pypy/annotation/classdef.py ============================================================================== --- pypy/dist/pypy/annotation/classdef.py (original) +++ pypy/dist/pypy/annotation/classdef.py Thu May 5 02:09:05 2005 @@ -178,6 +178,8 @@ self._generalize_attr(attr, s_value) def about_attribute(self, name): + """This is the interface for the code generators to ask about + the annotation given to a attribute.""" for cdef in self.getmro(): if name in cdef.attrs: s_result = cdef.attrs[name].s_value @@ -187,7 +189,7 @@ return None return None - def matching(self, pbc, name=None): + def matching(self, pbc, name): d = {} uplookup = None upfunc = None @@ -210,13 +212,38 @@ if uplookup is not None: d[upfunc] = uplookup elif meth: - if name is None: - name = '???' - self.bookkeeper.warning("demoting method %s to base class %s" % (name,self)) + if not self.check_missing_attribute_update(name): + self.bookkeeper.warning("demoting method %s to base class %s" % (name,self)) if d: return SomePBC(d) else: return SomeImpossibleValue() + def check_missing_attribute_update(self, name): + # haaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaack + # sometimes, new methods can show up on classes, added + # e.g. by W_TypeObject._freeze_() -- the multimethod + # implementations. Check that here... + found = False + parents = list(self.getmro()) + parents.reverse() + for base in parents: + if base.check_attr_here(name): + found = True + return found + + def check_attr_here(self, name): + if name in self.cls.__dict__: + # oups! new attribute showed up + value = self.cls.__dict__[name] + self.add_source_for_attribute(name, value, self) + # maybe it also showed up in some subclass? + for subdef in self.getallsubdefs(): + if subdef is not self: + subdef.check_attr_here(name) + return True + else: + return False + def isclassdef(x): return isinstance(x, ClassDef) Modified: pypy/dist/pypy/annotation/unaryop.py ============================================================================== --- pypy/dist/pypy/annotation/unaryop.py (original) +++ pypy/dist/pypy/annotation/unaryop.py Thu May 5 02:09:05 2005 @@ -291,6 +291,8 @@ # XXX do it more nicely if isinstance(s_result, SomePBC): s_result = ins.classdef.matching(s_result, attr) + elif isinstance(s_result, SomeImpossibleValue): + ins.classdef.check_missing_attribute_update(attr) return s_result return SomeObject() From arigo at codespeak.net Thu May 5 02:13:49 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Thu, 5 May 2005 02:13:49 +0200 (CEST) Subject: [pypy-svn] r11954 - pypy/dist/pypy/annotation Message-ID: <20050505001349.2ABE427B60@code1.codespeak.net> Author: arigo Date: Thu May 5 02:13:48 2005 New Revision: 11954 Modified: pypy/dist/pypy/annotation/classdef.py Log: Oups, typo. Modified: pypy/dist/pypy/annotation/classdef.py ============================================================================== --- pypy/dist/pypy/annotation/classdef.py (original) +++ pypy/dist/pypy/annotation/classdef.py Thu May 5 02:13:48 2005 @@ -235,8 +235,7 @@ def check_attr_here(self, name): if name in self.cls.__dict__: # oups! new attribute showed up - value = self.cls.__dict__[name] - self.add_source_for_attribute(name, value, self) + self.add_source_for_attribute(name, self.cls, self) # maybe it also showed up in some subclass? for subdef in self.getallsubdefs(): if subdef is not self: From arigo at codespeak.net Thu May 5 02:39:46 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Thu, 5 May 2005 02:39:46 +0200 (CEST) Subject: [pypy-svn] r11955 - pypy/dist/pypy/annotation Message-ID: <20050505003946.D731027B60@code1.codespeak.net> Author: arigo Date: Thu May 5 02:39:46 2005 New Revision: 11955 Modified: pypy/dist/pypy/annotation/bookkeeper.py Log: provide SomeBool's possible_values. Modified: pypy/dist/pypy/annotation/bookkeeper.py ============================================================================== --- pypy/dist/pypy/annotation/bookkeeper.py (original) +++ pypy/dist/pypy/annotation/bookkeeper.py Thu May 5 02:39:46 2005 @@ -467,6 +467,8 @@ assert value is True, ("concrete call with a method bound " "on a non-constant instance") possible_values = s.prebuiltinstances.keys() + elif isinstance(s, SomeBool): + possible_values = [False, True] else: raise AssertionError, "concrete call with a non-constant arg %r" % (s,) for tuple_tail in possible_arguments(args[1:]): From arigo at codespeak.net Thu May 5 02:58:38 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Thu, 5 May 2005 02:58:38 +0200 (CEST) Subject: [pypy-svn] r11956 - in pypy/dist/pypy: interpreter objspace/std Message-ID: <20050505005838.3CA1727B60@code1.codespeak.net> Author: arigo Date: Thu May 5 02:58:38 2005 New Revision: 11956 Modified: pypy/dist/pypy/interpreter/pyopcode.py pypy/dist/pypy/objspace/std/typeobject.py Log: - fix a name clash between W_Root.getname() and PyInterpFrame.getname() - remove unused function _getname() Modified: pypy/dist/pypy/interpreter/pyopcode.py ============================================================================== --- pypy/dist/pypy/interpreter/pyopcode.py (original) +++ pypy/dist/pypy/interpreter/pyopcode.py Thu May 5 02:58:38 2005 @@ -74,7 +74,7 @@ def getconstant_w(self, index): return self.code.co_consts_w[index] - def getname(self, index): + def getname_u(self, index): return self.code.co_names[index] def getname_w(self, index): @@ -460,7 +460,7 @@ if not e.match(f.space, f.space.w_KeyError): raise # we got a KeyError, now look in the built-ins - varname = f.getname(nameindex) + varname = f.getname_u(nameindex) w_value = f.builtin.getdictvalue(f.space, varname) if w_value is None: message = "global name '%s' is not defined" % varname Modified: pypy/dist/pypy/objspace/std/typeobject.py ============================================================================== --- pypy/dist/pypy/objspace/std/typeobject.py (original) +++ pypy/dist/pypy/objspace/std/typeobject.py Thu May 5 02:58:38 2005 @@ -354,9 +354,6 @@ return lst return GOODCANDIDATE # good candidate -def _getname(space, w_cls): - return space.str_w(space.getattr(w_cls, space.wrap('__name__'))) - def mro_error(space, orderlists): cycle = [] candidate = orderlists[-1][0] From arigo at codespeak.net Thu May 5 11:54:42 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Thu, 5 May 2005 11:54:42 +0200 (CEST) Subject: [pypy-svn] r11960 - pypy/dist/pypy/lib Message-ID: <20050505095442.2AB6927B5C@code1.codespeak.net> Author: arigo Date: Thu May 5 11:54:41 2005 New Revision: 11960 Modified: pypy/dist/pypy/lib/__init__.py Log: This __init__.py shows up in PyPy's app-level standard library. Let's try to prevent that confusion... Modified: pypy/dist/pypy/lib/__init__.py ============================================================================== --- pypy/dist/pypy/lib/__init__.py (original) +++ pypy/dist/pypy/lib/__init__.py Thu May 5 11:54:41 2005 @@ -1 +1,4 @@ -# +# This __init__.py shows up in PyPy's app-level standard library. +# Let's try to prevent that confusion... +if __name__ != 'pypy.lib': + raise ImportError, '__init__' From hpk at codespeak.net Thu May 5 13:16:56 2005 From: hpk at codespeak.net (hpk at codespeak.net) Date: Thu, 5 May 2005 13:16:56 +0200 (CEST) Subject: [pypy-svn] r11961 - pypy/dist/lib-python Message-ID: <20050505111656.BB6EB27B5D@code1.codespeak.net> Author: hpk Date: Thu May 5 13:16:56 2005 New Revision: 11961 Modified: pypy/dist/lib-python/conftest.py Log: be more helpful by creating a user at host directory if it doesn't exist. Modified: pypy/dist/lib-python/conftest.py ============================================================================== --- pypy/dist/lib-python/conftest.py (original) +++ pypy/dist/lib-python/conftest.py Thu May 5 13:16:56 2005 @@ -830,7 +830,7 @@ testresultdir = ensuretestresultdir() result = self.getresult(regrtest) resultdir = testresultdir.join(result['userhost']) - assert resultdir.check(dir=1) + assert resultdir.ensure(dir=1) fn = resultdir.join(regrtest.basename).new(ext='.txt') if result.istimeout(): From hpk at codespeak.net Thu May 5 13:48:47 2005 From: hpk at codespeak.net (hpk at codespeak.net) Date: Thu, 5 May 2005 13:48:47 +0200 (CEST) Subject: [pypy-svn] r11963 - pypy/dist/lib-python Message-ID: <20050505114847.77CE927B5D@code1.codespeak.net> Author: hpk Date: Thu May 5 13:48:47 2005 New Revision: 11963 Modified: pypy/dist/lib-python/conftest.py Log: fix oldstyle and uselibfile handling. The commandline options '--oldstyle' and '--file' were not really having the expected effect. They have now. thanks Seo for pointing the problem out! Modified: pypy/dist/lib-python/conftest.py ============================================================================== --- pypy/dist/lib-python/conftest.py (original) +++ pypy/dist/lib-python/conftest.py Thu May 5 13:48:47 2005 @@ -278,11 +278,22 @@ self.basename = basename self.enabled = enabled self.dumbtest = dumbtest - if pypy_option.oldstyle: - oldstyle = True - self.oldstyle = oldstyle + # we have to determine oldstyle and uselibfile values + # lazily because at RegrTest() call time the command + # line options haven't been parsed! + self._oldstyle = oldstyle + self._uselibfile = uselibfile self.core = core - self.uselibfile = uselibfile + + def oldstyle(self): + return self._oldstyle or pypy_option.oldstyle + oldstyle = property(oldstyle) + + def uselibfile(self): + return self._uselibfile or pypy_option.uselibfile + uselibfile = property(uselibfile) + + def getoptions(self): l = [] @@ -321,9 +332,9 @@ self._prepare(space) fspath = self.getfspath() assert fspath.check() - if self.oldstyle or pypy_option.oldstyle: + if self.oldstyle: space.enable_old_style_classes_as_default_metaclass() - if self.uselibfile or pypy_option.uselibfile: + if self.uselibfile: w_original_faked_file = space.appexec([], '''(): from _file import file prev = __builtins__.file @@ -333,9 +344,8 @@ try: callex(space, run_file, str(fspath), space) finally: - if not pypy_option.oldstyle: - space.enable_new_style_classes_as_default_metaclass() - if self.uselibfile and not pypy_option.uselibfile: + space.enable_new_style_classes_as_default_metaclass() + if self.uselibfile: space.appexec([w_original_faked_file], '''(prev): __builtins__.file = __builtins__.open = prev ''') @@ -803,9 +813,9 @@ alarm_script = pypydir.join('tool', 'alarm.py') regr_script = pypydir.join('tool', 'pytest', 'regrverbose.py') pypy_options = [] - if regrtest.oldstyle or pypy_option.oldstyle: + if regrtest.oldstyle: pypy_options.append('--oldstyle') - if regrtest.uselibfile or pypy_option.uselibfile: + if regrtest.uselibfile: pypy_options.append('--file') sopt = " ".join(pypy_options) From arigo at codespeak.net Thu May 5 16:15:36 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Thu, 5 May 2005 16:15:36 +0200 (CEST) Subject: [pypy-svn] r11965 - in pypy/dist/pypy/interpreter: . test Message-ID: <20050505141536.954A427B5D@code1.codespeak.net> Author: arigo Date: Thu May 5 16:15:36 2005 New Revision: 11965 Added: pypy/dist/pypy/interpreter/compiler.py - copied, changed from r11959, pypy/dist/pypy/module/builtin/compiling.py pypy/dist/pypy/interpreter/test/test_compiler.py (contents, props changed) Modified: pypy/dist/pypy/interpreter/executioncontext.py Log: Base framework for multiple bytecode compilers, with one concrete but faked CPythonCompiler using the underlying compile(). Copied: pypy/dist/pypy/interpreter/compiler.py (from r11959, pypy/dist/pypy/module/builtin/compiling.py) ============================================================================== --- pypy/dist/pypy/module/builtin/compiling.py (original) +++ pypy/dist/pypy/interpreter/compiler.py Thu May 5 16:15:36 2005 @@ -1,27 +1,128 @@ """ -Implementation of the interpreter-level compile/eval builtins. +General classes for bytecode compilers. +Compiler instances are stored into 'space.getexecutioncontext().compiler'. """ +from codeop import PyCF_DONT_IMPLY_DEDENT +from pypy.interpreter.error import OperationError -from pypy.interpreter.pycode import PyCode -from pypy.interpreter.baseobjspace import W_Root, ObjSpace -from pypy.interpreter.error import OperationError -from pypy.interpreter.gateway import NoneNotWrapped -import __builtin__ as cpy_builtin -import warnings - -def setup_warn_explicit(space): - """ NOT_RPYTHON - - this is a hack until we have our own parsing/compiling - in place: we bridge certain warnings to the applevel - warnings module to let it decide what to do with - a syntax warning ... - """ - def warn_explicit(message, category, filename, lineno, - module=None, registry=None): + +class Compiler: + """Abstract base class for a bytecode compiler.""" + + # The idea is to grow more methods here over the time, + # e.g. to handle .pyc files in various ways if we have multiple compilers. + + def __init__(self, space): + self.space = space + + def compile(self, source, filename, mode, flags): + """Compile and return an pypy.interpreter.eval.Code instance.""" + raise NotImplementedError + + def getcodeflags(self, code): + """Return the __future__ compiler flags that were used to compile + the given code object.""" + return 0 + + def compile_command(self, source, filename, mode, flags): + """Same as compile(), but tries to compile a possibly partial + interactive input. If more input is needed, it returns None. + """ + # Hackish default implementation based on the stdlib 'codeop' module. + # See comments over there. + space = self.space + flags |= PyCF_DONT_IMPLY_DEDENT + # Check for source consisting of only blank lines and comments + if mode != "eval": + in_comment = False + for c in source: + if c in ' \t\f\v': # spaces + pass + elif c == '#': + in_comment = True + elif c in '\n\r': + in_comment = False + elif not in_comment: + break # non-whitespace, non-comment character + else: + source = "pass" # Replace it with a 'pass' statement + + try: + code = self.compile(source, filename, mode, flags) + return code # success + except OperationError, err: + if not err.match(space, space.w_SyntaxError): + raise + + try: + self.compile(source + "\n", filename, mode, flags) + return None # expect more + except OperationError, err1: + if not err1.match(space, space.w_SyntaxError): + raise + + try: + self.compile(source + "\n\n", filename, mode, flags) + raise # uh? no error with \n\n. re-raise the previous error + except OperationError, err2: + if not err2.match(space, space.w_SyntaxError): + raise + + if space.eq_w(err1.w_value, err2.w_value): + raise # twice the same error, re-raise + + return None # two different errors, expect more + + +# ____________________________________________________________ +# faked compiler + +import __future__ +feature_compiler_flags = 0 +for fname in __future__.all_feature_names: + feature = getattr(__future__, fname) + feature_compiler_flags |= feature.compiler_flag + del feature, fname + + +class CPythonCompiler(Compiler): + """Faked implementation of a compiler, using the underlying compile().""" + + def compile(self, source, filename, mode, flags): + space = self.space + try: + # hack to make the flow space happy: 'warnings' should not look + # like a Constant + warnings = __import__('warnings') + old_warn_explicit = warnings.warn_explicit + warnings.warn_explicit = self._warn_explicit + try: + c = compile(source, filename, mode, flags, True) + finally: + warnings.warn_explicit = old_warn_explicit + # It would be nice to propagate all exceptions to app level, + # but here we only propagate the 'usual' ones, until we figure + # out how to do it generically. + except SyntaxError,e: + raise OperationError(space.w_SyntaxError,space.wrap(e.args)) + except ValueError,e: + raise OperationError(space.w_ValueError,space.wrap(str(e))) + except TypeError,e: + raise OperationError(space.w_TypeError,space.wrap(str(e))) + from pypy.interpreter.pycode import PyCode + return space.wrap(PyCode(space)._from_code(c)) + + def getcodeflags(self, code): + from pypy.interpreter.pycode import PyCode + assert isinstance(code, PyCode) + return code.co_flags & feature_compiler_flags + + def _warn_explicit(self, message, category, filename, lineno, + module=None, registry=None): if hasattr(category, '__bases__') and \ issubclass(category, SyntaxWarning): - assert isinstance(message, str) + assert isinstance(message, str) + space = self.space w_mod = space.sys.getmodule('warnings') if w_mod is not None: w_dict = w_mod.getdict() @@ -42,97 +143,12 @@ space.w_SyntaxError, space.wrap(message)) raise - old_warn_explicit = warnings.warn_explicit - warnings.warn_explicit = warn_explicit - return old_warn_explicit - -def compile(space, w_str_, filename, startstr, - supplied_flags=0, dont_inherit=0): - if space.is_true(space.isinstance(w_str_, space.w_unicode)): - str_ = space.unwrap(w_str_) # xxx generic unwrap - else: - str_ = space.str_w(w_str_) - #print (str_, filename, startstr, supplied_flags, dont_inherit) - # XXX we additionally allow GENERATORS because compiling some builtins - # requires it. doesn't feel quite right to do that here. - supplied_flags |= 4096 - if not dont_inherit: - try: - caller = space.getexecutioncontext().framestack.top() - except IndexError: - caller = None - else: - from pypy.interpreter import pyframe - if isinstance(caller, pyframe.PyFrame): - supplied_flags |= caller.get_compile_flags() - try: - old = setup_warn_explicit(space) - try: - c = cpy_builtin.compile(str_, filename, startstr, supplied_flags, 1) - finally: - warnings.warn_explicit = old - - # It would be nice to propagate all exceptions to app level, - # but here we only propagate the 'usual' ones, until we figure - # out how to do it generically. - except SyntaxError,e: - raise OperationError(space.w_SyntaxError,space.wrap(e.args)) - except ValueError,e: - raise OperationError(space.w_ValueError,space.wrap(str(e))) - except TypeError,e: - raise OperationError(space.w_TypeError,space.wrap(str(e))) - return space.wrap(PyCode(space)._from_code(c)) -# -compile.unwrap_spec = [ObjSpace,W_Root,str,str,int,int] - - -def eval(space, w_code, w_globals=NoneNotWrapped, w_locals=NoneNotWrapped): - w = space.wrap - - if (space.is_true(space.isinstance(w_code, space.w_str)) or - space.is_true(space.isinstance(w_code, space.w_unicode))): - try: - w_code = compile(space, - space.call_method(w_code, 'lstrip', - space.wrap(' \t')), - "", "eval") - except OperationError, e: - if e.match(space, space.w_SyntaxError): - e_value_w = space.unpacktuple(e.w_value) - e_loc_w = space.unpacktuple(e_value_w[1]) - e.w_value = space.newtuple([e_value_w[0], - space.newtuple([space.w_None]+ - e_loc_w[1:])]) - raise e - else: - raise - - codeobj = space.interpclass_w(w_code) - if not isinstance(codeobj, PyCode): - raise OperationError(space.w_TypeError, - w('eval() arg 1 must be a string or code object')) - - try: - caller = space.getexecutioncontext().framestack.top() - except IndexError: - caller = None - - if w_globals is None: - if caller is None: - w_globals = w_locals = space.newdict([]) - else: - w_globals = caller.w_globals - w_locals = caller.getdictscope() - elif w_locals is None: - w_locals = w_globals - - try: - space.getitem(w_globals, space.wrap('__builtins__')) - except OperationError, e: - if not e.match(space, space.w_KeyError): - raise - if caller is not None: - w_builtin = space.builtin.pick_builtin(caller.w_globals) - space.setitem(w_globals, space.wrap('__builtins__'), w_builtin) - return codeobj.exec_code(space, w_globals, w_locals) + def setup_warn_explicit(self, warnings, prev=None): + """ + this is a hack until we have our own parsing/compiling + in place: we bridge certain warnings to the applevel + warnings module to let it decide what to do with + a syntax warning ... + """ + return old_warn_explicit Modified: pypy/dist/pypy/interpreter/executioncontext.py ============================================================================== --- pypy/dist/pypy/interpreter/executioncontext.py (original) +++ pypy/dist/pypy/interpreter/executioncontext.py Thu May 5 16:15:36 2005 @@ -1,11 +1,12 @@ import sys from pypy.interpreter.miscutils import getthreadlocals, Stack from pypy.interpreter.error import OperationError +from pypy.interpreter.compiler import CPythonCompiler class ExecutionContext: """An ExecutionContext holds the state of an execution thread in the Python interpreter.""" - + def __init__(self, space): self.space = space self.framestack = Stack() @@ -13,6 +14,7 @@ self.w_tracefunc = None self.w_profilefunc = None self.is_tracing = 0 + self.compiler = CPythonCompiler(space) def enter(self, frame): if self.framestack.depth() > self.space.sys.recursionlimit: Added: pypy/dist/pypy/interpreter/test/test_compiler.py ============================================================================== --- (empty file) +++ pypy/dist/pypy/interpreter/test/test_compiler.py Thu May 5 16:15:36 2005 @@ -0,0 +1,53 @@ +import __future__ +import autopath +import py +from pypy.interpreter.compiler import CPythonCompiler, Compiler +from pypy.interpreter.pycode import PyCode + + +class TestCompiler: + def setup_method(self, method): + self.compiler = CPythonCompiler(self.space) + + def test_compile(self): + code = self.compiler.compile('6*7', '', 'eval', 0) + assert isinstance(code, PyCode) + assert code.co_filename == '' + space = self.space + w_res = code.exec_code(space, space.newdict([]), space.newdict([])) + assert space.int_w(w_res) == 42 + + def test_compile_command(self): + c0 = self.compiler.compile_command('\t # hello\n ', '?', 'exec', 0) + c1 = self.compiler.compile_command('print 6*7', '?', 'exec', 0) + c2 = self.compiler.compile_command('if 1:\n x\n', '?', 'exec', 0) + assert c0 is not None + assert c1 is not None + assert c2 is not None + c3 = self.compiler.compile_command('if 1:\n x', '?', 'exec', 0) + c4 = self.compiler.compile_command('x = (', '?', 'exec', 0) + c5 = self.compiler.compile_command('x = (\n', '?', 'exec', 0) + c6 = self.compiler.compile_command('x = (\n\n', '?', 'exec', 0) + assert c3 is None + assert c4 is None + assert c5 is None + assert c6 is None + space = self.space + space.raises_w(space.w_SyntaxError, self.compiler.compile_command, + 'if 1:\n x x', '?', 'exec', 0) + + def test_getcodeflags(self): + code = self.compiler.compile('from __future__ import division\n', + '', 'exec', 0) + flags = self.compiler.getcodeflags(code) + assert flags & __future__.division.compiler_flag + # check that we don't get more flags than the compiler can accept back + code2 = self.compiler.compile('print 6*7', '', 'exec', flags) + # check that the flag remains in force + flags2 = self.compiler.getcodeflags(code2) + assert flags == flags2 + + +class TestECCompiler(TestCompiler): + def setup_method(self, method): + self.compiler = self.space.getexecutioncontext().compiler From arigo at codespeak.net Thu May 5 16:56:45 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Thu, 5 May 2005 16:56:45 +0200 (CEST) Subject: [pypy-svn] r11967 - in pypy/dist/pypy: interpreter module/builtin Message-ID: <20050505145645.1423D27B76@code1.codespeak.net> Author: arigo Date: Thu May 5 16:56:44 2005 New Revision: 11967 Modified: pypy/dist/pypy/interpreter/compiler.py pypy/dist/pypy/interpreter/interactive.py pypy/dist/pypy/interpreter/pyframe.py pypy/dist/pypy/interpreter/pyopcode.py pypy/dist/pypy/module/builtin/compiling.py Log: Plugged the compiler.py module into our built-in compile(), and into the interactive command-line interpreter. Modified: pypy/dist/pypy/interpreter/compiler.py ============================================================================== --- pypy/dist/pypy/interpreter/compiler.py (original) +++ pypy/dist/pypy/interpreter/compiler.py Thu May 5 16:56:44 2005 @@ -78,17 +78,16 @@ # faked compiler import __future__ -feature_compiler_flags = 0 +compiler_flags = 0 for fname in __future__.all_feature_names: - feature = getattr(__future__, fname) - feature_compiler_flags |= feature.compiler_flag - del feature, fname + compiler_flags |= getattr(__future__, fname).compiler_flag class CPythonCompiler(Compiler): """Faked implementation of a compiler, using the underlying compile().""" def compile(self, source, filename, mode, flags): + flags |= __future__.generators.compiler_flag # always on (2.2 compat) space = self.space try: # hack to make the flow space happy: 'warnings' should not look @@ -114,8 +113,10 @@ def getcodeflags(self, code): from pypy.interpreter.pycode import PyCode - assert isinstance(code, PyCode) - return code.co_flags & feature_compiler_flags + if isinstance(code, PyCode): + return code.co_flags & compiler_flags + else: + return 0 def _warn_explicit(self, message, category, filename, lineno, module=None, registry=None): Modified: pypy/dist/pypy/interpreter/interactive.py ============================================================================== --- pypy/dist/pypy/interpreter/interactive.py (original) +++ pypy/dist/pypy/interpreter/interactive.py Thu May 5 16:56:44 2005 @@ -92,6 +92,7 @@ self.verbose = verbose space = self.space self.ec = space.createexecutioncontext() + self.console_compiler_flags = 0 mainmodule = main.ensure__main__(space) self.w_globals = mainmodule.w_dict @@ -158,26 +159,32 @@ raise def runcode(self, code): - # 'code' is a CPython code object - from pypy.interpreter.pycode import PyCode - pycode = PyCode(self.space)._from_code(code) + raise NotImplementedError + + def runsource(self, source, ignored_filename="", symbol="single"): + hacked_filename = '' + source + compiler = self.space.getexecutioncontext().compiler + def doit(): + # compile the provided input + code = compiler.compile_command(source, hacked_filename, symbol, + self.console_compiler_flags) + if code is None: + raise IncompleteInput + self.console_compiler_flags |= compiler.getcodeflags(code) + + # execute it self.settrace() - pycode.exec_code(self.space, self.w_globals, self.w_globals) + code.exec_code(self.space, self.w_globals, self.w_globals) self.checktrace() - main.run_toplevel(self.space, doit, verbose=self.verbose) - def runsource(self, source, ignored_filename="", symbol="single"): - hacked_filename = '' + source + # run doit() in an exception-catching box try: - code = self.compile(source, hacked_filename, symbol) - except (OverflowError, SyntaxError, ValueError): - self.showsyntaxerror(self.filename) - return 0 - if code is None: + main.run_toplevel(self.space, doit, verbose=self.verbose) + except IncompleteInput: return 1 - self.runcode(code) - return 0 + else: + return 0 def settrace(self): if self.tracelevel: @@ -216,6 +223,10 @@ self.tracelevel = tracelevel + +class IncompleteInput(Exception): + pass + if __name__ == '__main__': try: import readline Modified: pypy/dist/pypy/interpreter/pyframe.py ============================================================================== --- pypy/dist/pypy/interpreter/pyframe.py (original) +++ pypy/dist/pypy/interpreter/pyframe.py Thu May 5 16:56:44 2005 @@ -14,11 +14,6 @@ g[op] = opcode.opmap[op] HAVE_ARGUMENT = opcode.HAVE_ARGUMENT -import __future__ -compiler_flags = 0 -for fname in __future__.all_feature_names: - compiler_flags |= getattr(__future__, fname).compiler_flag - def cpython_tb(): """NOT_RPYTHON""" @@ -76,9 +71,6 @@ def getclosure(self): return None - def get_compile_flags(self): - return self.code.co_flags & compiler_flags - def eval(self, executioncontext): "Interpreter main loop!" try: Modified: pypy/dist/pypy/interpreter/pyopcode.py ============================================================================== --- pypy/dist/pypy/interpreter/pyopcode.py (original) +++ pypy/dist/pypy/interpreter/pyopcode.py Thu May 5 16:56:44 2005 @@ -346,7 +346,8 @@ w_locals = f.valuestack.pop() w_globals = f.valuestack.pop() w_prog = f.valuestack.pop() - w_compile_flags = f.space.wrap(f.get_compile_flags()) + flags = f.space.getexecutioncontext().compiler.getcodeflags(f.code) + w_compile_flags = f.space.wrap(flags) w_resulttuple = prepare_exec(f.space, f.space.wrap(f), w_prog, w_globals, w_locals, w_compile_flags, f.space.wrap(f.builtin), Modified: pypy/dist/pypy/module/builtin/compiling.py ============================================================================== --- pypy/dist/pypy/module/builtin/compiling.py (original) +++ pypy/dist/pypy/module/builtin/compiling.py Thu May 5 16:56:44 2005 @@ -6,82 +6,24 @@ from pypy.interpreter.baseobjspace import W_Root, ObjSpace from pypy.interpreter.error import OperationError from pypy.interpreter.gateway import NoneNotWrapped -import __builtin__ as cpy_builtin -import warnings -def setup_warn_explicit(space): - """ NOT_RPYTHON - - this is a hack until we have our own parsing/compiling - in place: we bridge certain warnings to the applevel - warnings module to let it decide what to do with - a syntax warning ... - """ - def warn_explicit(message, category, filename, lineno, - module=None, registry=None): - if hasattr(category, '__bases__') and \ - issubclass(category, SyntaxWarning): - assert isinstance(message, str) - w_mod = space.sys.getmodule('warnings') - if w_mod is not None: - w_dict = w_mod.getdict() - w_reg = space.call_method(w_dict, 'setdefault', - space.wrap("__warningregistry__"), - space.newdict([])) - try: - space.call_method(w_mod, 'warn_explicit', - space.wrap(message), - space.w_SyntaxWarning, - space.wrap(filename), - space.wrap(lineno), - space.w_None, - space.w_None) - except OperationError, e: - if e.match(space, space.w_SyntaxWarning): - raise OperationError( - space.w_SyntaxError, - space.wrap(message)) - raise - old_warn_explicit = warnings.warn_explicit - warnings.warn_explicit = warn_explicit - return old_warn_explicit - -def compile(space, w_str_, filename, startstr, - supplied_flags=0, dont_inherit=0): - if space.is_true(space.isinstance(w_str_, space.w_unicode)): - str_ = space.unwrap(w_str_) # xxx generic unwrap +def compile(space, w_source, filename, mode, flags=0, dont_inherit=0): + if space.is_true(space.isinstance(w_source, space.w_unicode)): + str_ = space.unwrap(w_source) # xxx generic unwrap else: - str_ = space.str_w(w_str_) - #print (str_, filename, startstr, supplied_flags, dont_inherit) - # XXX we additionally allow GENERATORS because compiling some builtins - # requires it. doesn't feel quite right to do that here. - supplied_flags |= 4096 + str_ = space.str_w(w_source) + + ec = space.getexecutioncontext() if not dont_inherit: try: - caller = space.getexecutioncontext().framestack.top() + caller = ec.framestack.top() except IndexError: - caller = None + pass else: - from pypy.interpreter import pyframe - if isinstance(caller, pyframe.PyFrame): - supplied_flags |= caller.get_compile_flags() - try: - old = setup_warn_explicit(space) - try: - c = cpy_builtin.compile(str_, filename, startstr, supplied_flags, 1) - finally: - warnings.warn_explicit = old - - # It would be nice to propagate all exceptions to app level, - # but here we only propagate the 'usual' ones, until we figure - # out how to do it generically. - except SyntaxError,e: - raise OperationError(space.w_SyntaxError,space.wrap(e.args)) - except ValueError,e: - raise OperationError(space.w_ValueError,space.wrap(str(e))) - except TypeError,e: - raise OperationError(space.w_TypeError,space.wrap(str(e))) - return space.wrap(PyCode(space)._from_code(c)) + flags |= ec.compiler.getcodeflags(caller.code) + + code = ec.compiler.compile(str_, filename, mode, flags) + return space.wrap(code) # compile.unwrap_spec = [ObjSpace,W_Root,str,str,int,int] From arigo at codespeak.net Thu May 5 17:32:57 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Thu, 5 May 2005 17:32:57 +0200 (CEST) Subject: [pypy-svn] r11968 - in pypy/dist: goal pypy/translator Message-ID: <20050505153257.9E5DB27B5D@code1.codespeak.net> Author: arigo Date: Thu May 5 17:32:57 2005 New Revision: 11968 Modified: pypy/dist/goal/translate_pypy.py pypy/dist/pypy/translator/annrpython.py Log: Display a Top Ten of the most often reflow blocks after translate_pypy.py. Modified: pypy/dist/goal/translate_pypy.py ============================================================================== --- pypy/dist/goal/translate_pypy.py (original) +++ pypy/dist/goal/translate_pypy.py Thu May 5 17:32:57 2005 @@ -34,8 +34,7 @@ from pypy.tool.cache import Cache from pypy.annotation.model import SomeObject from pypy.tool.udir import udir - - +from pypy.tool.ansi_print import ansi_print # XXX this tries to make compiling faster @@ -56,7 +55,10 @@ if listen_port: run_async_server() if not options['-no-a']: - a = t.annotate(inputtypes, overrides=pypy_overrides) + try: + a = t.annotate(inputtypes, overrides=pypy_overrides) + finally: + worstblocks_topten(t.annotator) if not options['-no-s']: a.simplify() if not options['-no-t']: @@ -156,6 +158,22 @@ graphserver.run_server(homepage, port=listen_port, background=True) options['-text'] = True +def worstblocks_topten(ann, n=10): + import heapq + h = [(-count, block) for block, count in ann.reflowcounter.iteritems()] + heapq.heapify(h) + print + ansi_print(',----------------------- Top %d Most Reflown Blocks -----------------------.' % n, 36) + for i in range(n): + if not h: + break + count, block = heapq.heappop(h) + count = -count + ansi_print(' #%3d: reflown %d times |' % (i+1, count), 36) + about(block) + ansi_print("`----------------------------------------------------------------------------'", 36) + print + if __name__ == '__main__': Modified: pypy/dist/pypy/translator/annrpython.py ============================================================================== --- pypy/dist/pypy/translator/annrpython.py (original) +++ pypy/dist/pypy/translator/annrpython.py Thu May 5 17:32:57 2005 @@ -37,6 +37,7 @@ self.binding_cause_history = {} # map Variables to lists of positions # history of binding_caused_by, kept in sync with # bindingshistory + self.reflowcounter = {} self.return_bindings = {} # map return Variables to functions # user-supplied annotation logic for functions we don't want to flow into self.overrides = overrides @@ -293,6 +294,9 @@ # input variables). #print '* processblock', block, cells + if annmodel.DEBUG: + self.reflowcounter.setdefault(block, 0) + self.reflowcounter[block] += 1 self.annotated[block] = fn or True try: self.flowin(fn, block) From arigo at codespeak.net Thu May 5 17:42:34 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Thu, 5 May 2005 17:42:34 +0200 (CEST) Subject: [pypy-svn] r11969 - pypy/dist/pypy/interpreter Message-ID: <20050505154234.66C7327B64@code1.codespeak.net> Author: arigo Date: Thu May 5 17:42:34 2005 New Revision: 11969 Modified: pypy/dist/pypy/interpreter/compiler.py Log: Another try at a hack to make the flow space happy. Modified: pypy/dist/pypy/interpreter/compiler.py ============================================================================== --- pypy/dist/pypy/interpreter/compiler.py (original) +++ pypy/dist/pypy/interpreter/compiler.py Thu May 5 17:42:34 2005 @@ -77,6 +77,7 @@ # ____________________________________________________________ # faked compiler +import warnings import __future__ compiler_flags = 0 for fname in __future__.all_feature_names: @@ -90,15 +91,11 @@ flags |= __future__.generators.compiler_flag # always on (2.2 compat) space = self.space try: - # hack to make the flow space happy: 'warnings' should not look - # like a Constant - warnings = __import__('warnings') - old_warn_explicit = warnings.warn_explicit - warnings.warn_explicit = self._warn_explicit + old = self.setup_warn_explicit(warnings) try: c = compile(source, filename, mode, flags, True) finally: - warnings.warn_explicit = old_warn_explicit + self.restore_warn_explicit(warnings, old) # It would be nice to propagate all exceptions to app level, # but here we only propagate the 'usual' ones, until we figure # out how to do it generically. @@ -145,11 +142,18 @@ space.wrap(message)) raise - def setup_warn_explicit(self, warnings, prev=None): + def setup_warn_explicit(self, warnings): """ this is a hack until we have our own parsing/compiling in place: we bridge certain warnings to the applevel warnings module to let it decide what to do with a syntax warning ... """ + # there is a hack to make the flow space happy: + # 'warnings' should not look like a Constant + old_warn_explicit = warnings.warn_explicit + warnings.warn_explicit = self._warn_explicit return old_warn_explicit + + def restore_warn_explicit(self, warnings, old_warn_explicit): + warnings.warn_explicit = old_warn_explicit From arigo at codespeak.net Thu May 5 18:13:03 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Thu, 5 May 2005 18:13:03 +0200 (CEST) Subject: [pypy-svn] r11970 - pypy/dist/goal Message-ID: <20050505161303.7172127B82@code1.codespeak.net> Author: arigo Date: Thu May 5 18:13:03 2005 New Revision: 11970 Modified: pypy/dist/goal/translate_pypy.py Log: A dumb list.sort() is much faster than heapq on 2.3. Modified: pypy/dist/goal/translate_pypy.py ============================================================================== --- pypy/dist/goal/translate_pypy.py (original) +++ pypy/dist/goal/translate_pypy.py Thu May 5 18:13:03 2005 @@ -159,16 +159,14 @@ options['-text'] = True def worstblocks_topten(ann, n=10): - import heapq - h = [(-count, block) for block, count in ann.reflowcounter.iteritems()] - heapq.heapify(h) + h = [(count, block) for block, count in ann.reflowcounter.iteritems()] + h.sort() print ansi_print(',----------------------- Top %d Most Reflown Blocks -----------------------.' % n, 36) for i in range(n): if not h: break - count, block = heapq.heappop(h) - count = -count + count, block = h.pop() ansi_print(' #%3d: reflown %d times |' % (i+1, count), 36) about(block) ansi_print("`----------------------------------------------------------------------------'", 36) From pedronis at codespeak.net Thu May 5 19:09:15 2005 From: pedronis at codespeak.net (pedronis at codespeak.net) Date: Thu, 5 May 2005 19:09:15 +0200 (CEST) Subject: [pypy-svn] r11972 - pypy/dist/pypy/interpreter Message-ID: <20050505170915.B39CC27B82@code1.codespeak.net> Author: pedronis Date: Thu May 5 19:09:15 2005 New Revision: 11972 Modified: pypy/dist/pypy/interpreter/lazymodule.py Log: attach __module__ to builtin functions from lazymodules, allows them to be pickled Modified: pypy/dist/pypy/interpreter/lazymodule.py ============================================================================== --- pypy/dist/pypy/interpreter/lazymodule.py (original) +++ pypy/dist/pypy/interpreter/lazymodule.py Thu May 5 19:09:15 2005 @@ -49,6 +49,7 @@ bltin = func._builtinversion_ except AttributeError: bltin = BuiltinFunction(func) + bltin.w_module = self.w_name func._builtinversion_ = bltin w_value = space.wrap(bltin) space.setitem(self.w_dict, space.wrap(name), w_value) From arigo at codespeak.net Thu May 5 19:09:37 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Thu, 5 May 2005 19:09:37 +0200 (CEST) Subject: [pypy-svn] r11973 - pypy/dist/pypy/annotation Message-ID: <20050505170937.35EAD27B84@code1.codespeak.net> Author: arigo Date: Thu May 5 19:09:36 2005 New Revision: 11973 Modified: pypy/dist/pypy/annotation/classdef.py Log: annotator's optimization. Modified: pypy/dist/pypy/annotation/classdef.py ============================================================================== --- pypy/dist/pypy/annotation/classdef.py (original) +++ pypy/dist/pypy/annotation/classdef.py Thu May 5 19:09:36 2005 @@ -91,8 +91,15 @@ def add_source_for_attribute(self, attr, source, clsdef=None): attrdef = self.find_attribute(attr) attrdef.sources[source] = clsdef - for position in attrdef.read_locations: - self.bookkeeper.annotator.reflowfromposition(position) + if attrdef.read_locations: + # we should reflow from all the reader's position, + # but as an optimization we try to see if the attribute + # has really been generalized + s_prev_value = attrdef.s_value + s_next_value = attrdef.getvalue() + if s_prev_value != s_next_value: + for position in attrdef.read_locations: + self.bookkeeper.annotator.reflowfromposition(position) def locate_attribute(self, attr): for cdef in self.getmro(): From pedronis at codespeak.net Thu May 5 19:11:50 2005 From: pedronis at codespeak.net (pedronis at codespeak.net) Date: Thu, 5 May 2005 19:11:50 +0200 (CEST) Subject: [pypy-svn] r11974 - pypy/dist/pypy/interpreter Message-ID: <20050505171150.CB88927B8A@code1.codespeak.net> Author: pedronis Date: Thu May 5 19:11:50 2005 New Revision: 11974 Modified: pypy/dist/pypy/interpreter/function.py Log: use Function.__init__ directly so that the annotator is not confused by __init__ from subclasses Modified: pypy/dist/pypy/interpreter/function.py ============================================================================== --- pypy/dist/pypy/interpreter/function.py (original) +++ pypy/dist/pypy/interpreter/function.py Thu May 5 19:11:50 2005 @@ -85,7 +85,7 @@ raise OperationError(space.w_TypeError, space.wrap("non-cell in closure")) closure.append(cell) func = space.allocate_instance(Function, w_subtype) - func.__init__(space, code, w_globals, defs_w, closure, name) + Function.__init__(space, code, w_globals, defs_w, closure, name) return space.wrap(func) def descr_function_get(self, w_obj, w_cls=None): From pedronis at codespeak.net Thu May 5 19:14:36 2005 From: pedronis at codespeak.net (pedronis at codespeak.net) Date: Thu, 5 May 2005 19:14:36 +0200 (CEST) Subject: [pypy-svn] r11975 - pypy/dist/pypy/translator Message-ID: <20050505171436.3C83C27B90@code1.codespeak.net> Author: pedronis Date: Thu May 5 19:14:36 2005 New Revision: 11975 Modified: pypy/dist/pypy/translator/ann_override.py Log: annotation override for the code invoke host CPython compile, this should be special cased when translating Modified: pypy/dist/pypy/translator/ann_override.py ============================================================================== --- pypy/dist/pypy/translator/ann_override.py (original) +++ pypy/dist/pypy/translator/ann_override.py Thu May 5 19:14:36 2005 @@ -7,6 +7,8 @@ from pypy.objspace.std import fake from pypy.module.sys2 import state as sys_state import pypy.interpreter.typedef as itypedef +import pypy.interpreter.pycode as pycode +import pypy.interpreter.compiler as icompiler from pypy.objspace.std.objspace import StdObjSpace def ignore(*args): @@ -32,6 +34,10 @@ clsdef = getbookkeeper().getclassdef(itypedef.W_Root) return annmodel.SomeInstance(clsdef) +def cpy_compile(self, source, filename, mode, flags): + clsdef = getbookkeeper().getclassdef(pycode.PyCode) + return annmodel.SomeInstance(clsdef) + pypy_overrides = {} def install(tgt, override): @@ -46,3 +52,4 @@ install(fake.fake_object, fake_object) install(itypedef.instantiate, instantiate) install(StdObjSpace.wrap_exception_cls, wrap_exception_cls) +install(icompiler.CPythonCompiler.compile, cpy_compile) From arigo at codespeak.net Thu May 5 19:14:59 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Thu, 5 May 2005 19:14:59 +0200 (CEST) Subject: [pypy-svn] r11976 - pypy/dist/pypy/annotation Message-ID: <20050505171459.2BDF927B96@code1.codespeak.net> Author: arigo Date: Thu May 5 19:14:59 2005 New Revision: 11976 Modified: pypy/dist/pypy/annotation/bookkeeper.py Log: infnite recursion fix. Modified: pypy/dist/pypy/annotation/bookkeeper.py ============================================================================== --- pypy/dist/pypy/annotation/bookkeeper.py (original) +++ pypy/dist/pypy/annotation/bookkeeper.py Thu May 5 19:14:59 2005 @@ -173,9 +173,9 @@ if x not in self.seen_mutable: # avoid circular reflowing, # see for example test_circular_mutable_getattr + self.seen_mutable[x] = True for attr in x.__dict__: clsdef.add_source_for_attribute(attr, x) # can trigger reflowing - self.seen_mutable[x] = True return SomeInstance(clsdef) elif x is None: return self.getpbc(None) From arigo at codespeak.net Thu May 5 20:16:12 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Thu, 5 May 2005 20:16:12 +0200 (CEST) Subject: [pypy-svn] r11977 - pypy/dist/pypy/interpreter Message-ID: <20050505181612.EAF7727B99@code1.codespeak.net> Author: arigo Date: Thu May 5 20:16:12 2005 New Revision: 11977 Modified: pypy/dist/pypy/interpreter/function.py Log: Typo! Modified: pypy/dist/pypy/interpreter/function.py ============================================================================== --- pypy/dist/pypy/interpreter/function.py (original) +++ pypy/dist/pypy/interpreter/function.py Thu May 5 20:16:12 2005 @@ -85,7 +85,7 @@ raise OperationError(space.w_TypeError, space.wrap("non-cell in closure")) closure.append(cell) func = space.allocate_instance(Function, w_subtype) - Function.__init__(space, code, w_globals, defs_w, closure, name) + Function.__init__(func, space, code, w_globals, defs_w, closure, name) return space.wrap(func) def descr_function_get(self, w_obj, w_cls=None): From arigo at codespeak.net Thu May 5 21:42:27 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Thu, 5 May 2005 21:42:27 +0200 (CEST) Subject: [pypy-svn] r11979 - in pypy/dist/pypy/interpreter: . test Message-ID: <20050505194227.1519F27B9A@code1.codespeak.net> Author: arigo Date: Thu May 5 21:42:26 2005 New Revision: 11979 Modified: pypy/dist/pypy/interpreter/gateway.py pypy/dist/pypy/interpreter/test/test_appinterp.py Log: Cleaned up a very little bit the whole lot of stuff around Applevel{Interp}Class in gateway.py. Now there is only one ApplevelClass, which contains only sane stuff, plus a flag "should I use geninterp". When the instance gets build, the flag is used to dispatch to one or the other version. Modified: pypy/dist/pypy/interpreter/gateway.py ============================================================================== --- pypy/dist/pypy/interpreter/gateway.py (original) +++ pypy/dist/pypy/interpreter/gateway.py Thu May 5 21:42:26 2005 @@ -507,15 +507,19 @@ name at app-level.""" hidden_applevel = True - NOT_RPYTHON_ATTRIBUTES = ['code'] + use_geninterp = True # change this to disable geninterp globally + + def __init__(self, source, filename = None, modname = '__builtin__', do_imports=False): + self.filename = filename + self.source = source + self.modname = modname + self.do_imports = do_imports + # look at the first three lines for a NOT_RPYTHON tag + first = source.split("\n", 3)[:3] + for line in first: + if "NOT_RPYTHON" in line: + self.use_geninterp = False - def __init__(self, source, filename=None, *args, **kwds): - "NOT_RPYTHON" - if filename is None: - self.code = py.code.Source(source).compile() - else: - self.code = NiceCompile(filename)(source) - def getwdict(self, space): return space.fromcache(ApplevelCache).getorbuild(self) @@ -523,20 +527,6 @@ from pypy.interpreter.module import Module return Module(space, space.wrap(name), self.getwdict(space)) - def _builddict(self, space): - "NOT_RPYTHON" - code = self._buildcode(space, self.code) - w_glob = space.newdict([]) - space.setitem(w_glob, space.wrap('__name__'), space.wrap('__builtin__')) - space.exec_(code, w_glob, w_glob) - return w_glob - - def _buildcode(cls, space, code): - "NOT_RPYTHON" - from pypy.interpreter.pycode import PyCode - return PyCode(space)._from_code(code, hidden_applevel=cls.hidden_applevel) - _buildcode = classmethod(_buildcode) - def wget(self, space, name): w_globals = self.getwdict(space) return space.getitem(w_globals, space.wrap(name)) @@ -559,32 +549,52 @@ def _freeze_(self): return True # hint for the annotator: applevel instances are constants + class ApplevelCache(SpaceCache): - def build(cache, app): - return app._builddict(cache.space) + """The cache mapping each applevel instance to its lazily built w_dict""" -class ApplevelInterpClass(ApplevelClass): - """ similar to applevel, but using translation to interp-level. - This version maintains a cache folder with single files. - """ - NOT_RPYTHON_ATTRIBUTES = ['cache_path', 'known_source'] + def build(self, app): + "NOT_RPYTHON. Called indirectly by Applevel.getwdict()." + if app.use_geninterp: + return PyPyCacheDir.build_applevelinterp_dict(app, self.space) + else: + return build_applevel_dict(app, self.space) - def __init__(self, source, filename = None, modname = '__builtin__', do_imports=False): - "NOT_RPYTHON" - self.filename = filename - self.source = source - self.modname = modname - self.do_imports = do_imports - def _builddict(self, space): - "NOT_RPYTHON" - if not self._setup_done: - self._setup() +# __________ pure applevel version __________ + +def build_applevel_dict(self, space): + "NOT_RPYTHON" + if self.filename is None: + code = py.code.Source(self.source).compile() + else: + code = NiceCompile(self.filename)(self.source) + + from pypy.interpreter.pycode import PyCode + pycode = PyCode(space)._from_code(code, hidden_applevel=self.hidden_applevel) + w_glob = space.newdict([]) + space.setitem(w_glob, space.wrap('__name__'), space.wrap('__builtin__')) + space.exec_(pycode, w_glob, w_glob) + return w_glob + +# __________ geninterplevel version __________ + +class PyPyCacheDir: + # similar to applevel, but using translation to interp-level. + # This version maintains a cache folder with single files. + + def build_applevelinterp_dict(cls, self, space): + "NOT_RPYTHON" + # N.B. 'self' is the ApplevelInterp; this is a class method, + # just so that we have a convenient place to store the global state. + if not cls._setup_done: + cls._setup() + from pypy.translator.geninterplevel import translate_as_module - scramble = md5.new(self.seed) + scramble = md5.new(cls.seed) scramble.update(self.source) key = scramble.hexdigest() - initfunc = self.known_source.get(key) + initfunc = cls.known_source.get(key) if not initfunc: # try to get it from file name = key @@ -599,12 +609,12 @@ # print x pass else: - initfunc = self.known_source[key] + initfunc = cls.known_source[key] if not initfunc: # build it and put it into a file initfunc, newsrc = translate_as_module( self.source, self.filename, self.modname, self.do_imports) - fname = self.cache_path.join(name+".py").strpath + fname = cls.cache_path.join(name+".py").strpath f = file(fname, "w") print >> f, """\ # self-destruct on double-click: @@ -623,9 +633,10 @@ print >> f, "known_source[%r] = %s" % (key, initfunc.__name__) w_glob = initfunc(space) return w_glob + build_applevelinterp_dict = classmethod(build_applevelinterp_dict) _setup_done = False - + def _setup(cls): """NOT_RPYTHON""" from pypy.tool.getpy import py @@ -685,18 +696,7 @@ cls._setup_done = True _setup = classmethod(_setup) -def applevel(source, filename = None, - modname = '__builtin__', do_imports=False): - # look at the first three lines - first = source.split("\n", 3)[:3] - klass = ApplevelInterpClass - for line in first: - if "NOT_RPYTHON" in line: - klass = ApplevelClass - return klass(source, filename, modname, do_imports) - -# uncomment this to check against applevel without translation -##ApplevelInterpClass = ApplevelClass +# ____________________________________________________________ def appdef(source, applevel=ApplevelClass): """ NOT_RPYTHON: build an app-level helper function, like for example: @@ -715,18 +715,22 @@ source = source[p:] return applevel("def %s%s\n" % (funcname, source)).interphook(funcname) +applevel = ApplevelClass # backward compatibility app2interp = appdef # backward compatibility class applevel_temp(ApplevelClass): hidden_applevel = False - def getwdict(self, space): - return self._builddict(space) # no cache + def getwdict(self, space): # no cache + return build_applevel_dict(self, space) -class applevelinterp_temp(ApplevelInterpClass): - hidden_applevel = False - def getwdict(self, space): - return self._builddict(space) # no cache +if ApplevelClass.use_geninterp: + class applevelinterp_temp(ApplevelClass): + hidden_applevel = False + def getwdict(self, space): # no cache + return PyPyCacheDir.build_applevelinterp_dict(self, space) +else: + applevelinterp_temp = applevel_temp # app2interp_temp is used for testing mainly def app2interp_temp(func, applevel_temp=applevel_temp): Modified: pypy/dist/pypy/interpreter/test/test_appinterp.py ============================================================================== --- pypy/dist/pypy/interpreter/test/test_appinterp.py (original) +++ pypy/dist/pypy/interpreter/test/test_appinterp.py Thu May 5 21:42:26 2005 @@ -1,6 +1,6 @@ import py -from pypy.interpreter.gateway import appdef, ApplevelClass, ApplevelInterpClass +from pypy.interpreter.gateway import appdef, ApplevelClass def test_execwith_novars(space): val = space.appexec([], """ @@ -70,27 +70,29 @@ w_result = app(space) assert space.eq_w(w_result, space.wrap(42)) -def test_applevel_functions(space, applevel=ApplevelClass): - app = applevel(''' +def test_applevel_functions(space, use_geninterp=False): + app = ApplevelClass(''' def f(x, y): return x-y def g(x, y): return f(y, x) ''') + app.use_geninterp &= use_geninterp g = app.interphook('g') w_res = g(space, space.wrap(10), space.wrap(1)) assert space.eq_w(w_res, space.wrap(-9)) def test_applevelinterp_functions(space): - test_applevel_functions(space, applevel=ApplevelInterpClass) + test_applevel_functions(space, use_geninterp=True) -def test_applevel_class(space, applevel=ApplevelClass): - app = applevel(''' +def test_applevel_class(space, use_geninterp=False): + app = ApplevelClass(''' class C: clsattr = 42 def __init__(self, x=13): self.attr = x ''') + app.use_geninterp &= use_geninterp C = app.interphook('C') c = C(space, space.wrap(17)) w_attr = space.getattr(c, space.wrap('clsattr')) @@ -99,7 +101,7 @@ assert space.eq_w(w_clsattr, space.wrap(17)) def test_applevelinterp_class(space): - test_applevel_class(space, applevel=ApplevelInterpClass) + test_applevel_class(space, use_geninterp=True) def app_test_something_at_app_level(): x = 2 From arigo at codespeak.net Thu May 5 21:43:03 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Thu, 5 May 2005 21:43:03 +0200 (CEST) Subject: [pypy-svn] r11980 - in pypy/dist/pypy: annotation translator Message-ID: <20050505194303.7936A27BA2@code1.codespeak.net> Author: arigo Date: Thu May 5 21:43:03 2005 New Revision: 11980 Modified: pypy/dist/pypy/annotation/classdef.py pypy/dist/pypy/translator/translator.py Log: Cosmetics. Modified: pypy/dist/pypy/annotation/classdef.py ============================================================================== --- pypy/dist/pypy/annotation/classdef.py (original) +++ pypy/dist/pypy/annotation/classdef.py Thu May 5 21:43:03 2005 @@ -11,6 +11,11 @@ # readonly-ness # SomeThing-ness # more potential sources (pbcs or classes) of information + # NB. the laziness of 'sources' was required for two reasons: + # * some strange attributes exist on classes but are never touched, + # immutablevalue() wouldn't be happy with them + # * there is an infinite recursion between immutablevalue() and + # add_source_for_attribute() for cyclic constant structures. def __init__(self, name, bookkeeper): self.name = name Modified: pypy/dist/pypy/translator/translator.py ============================================================================== --- pypy/dist/pypy/translator/translator.py (original) +++ pypy/dist/pypy/translator/translator.py Thu May 5 21:43:03 2005 @@ -29,7 +29,7 @@ Try dir(test) for list of current snippets. """ -import autopath, os +import autopath, os, sys from pypy.objspace.flow.model import * from pypy.annotation.model import * @@ -78,7 +78,8 @@ print 'getflowgraph (%s:%d) %s' % ( func.func_globals.get('__name__', '?'), func.func_code.co_firstlineno, - func.__name__) + func.__name__), + sys.stdout.flush() assert not self.frozen space = FlowObjSpace() space.builtins_can_raise_exceptions = self.builtins_can_raise_exceptions @@ -86,6 +87,8 @@ graph = space.build_flow(func) if self.simplifying: simplify_graph(graph) + if self.verbose: + print 'done' self.flowgraphs[func] = graph self.functions.append(func) try: From arigo at codespeak.net Thu May 5 21:45:24 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Thu, 5 May 2005 21:45:24 +0200 (CEST) Subject: [pypy-svn] r11981 - pypy/dist/goal Message-ID: <20050505194524.02D6527BA7@code1.codespeak.net> Author: arigo Date: Thu May 5 21:45:24 2005 New Revision: 11981 Modified: pypy/dist/goal/targetpypymain.py Log: disable geninterp for now -- we have faaar toooo much interp-level code for the poor translator already. Modified: pypy/dist/goal/targetpypymain.py ============================================================================== --- pypy/dist/goal/targetpypymain.py (original) +++ pypy/dist/goal/targetpypymain.py Thu May 5 21:45:24 2005 @@ -2,6 +2,7 @@ from pypy.objspace.std.objspace import StdObjSpace from pypy.annotation.model import * from pypy.annotation.listdef import ListDef +from pypy.interpreter import gateway # WARNING: this requires the annotator. # There is no easy way to build all caches manually, @@ -22,6 +23,10 @@ global space, w_entry_point # disable translation of the whole of classobjinterp.py StdObjSpace.setup_old_style_classes = lambda self: None + # disable geninterp for now -- we have faaar toooo much interp-level code + # for the poor translator already + gateway.ApplevelClass.use_geninterp = False + space = StdObjSpace() # manually imports app_main.py From arigo at codespeak.net Thu May 5 22:12:43 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Thu, 5 May 2005 22:12:43 +0200 (CEST) Subject: [pypy-svn] r11983 - pypy/dist/lib-python/modified-2.3.4 Message-ID: <20050505201243.AFFF527BAE@code1.codespeak.net> Author: arigo Date: Thu May 5 22:12:43 2005 New Revision: 11983 Added: pypy/dist/lib-python/modified-2.3.4/DISABLED-codecs.py - copied unchanged from r11976, pypy/dist/lib-python/modified-2.3.4/codecs.py Removed: pypy/dist/lib-python/modified-2.3.4/codecs.py Log: Moved lib-python/modified-2.3.4/codecs.py out of the way. It imports pypy at app-level! This deeply confuses translate_pypy (and me too)... Deleted: /pypy/dist/lib-python/modified-2.3.4/codecs.py ============================================================================== --- /pypy/dist/lib-python/modified-2.3.4/codecs.py Thu May 5 22:12:43 2005 +++ (empty file) @@ -1,750 +0,0 @@ -""" codecs -- Python Codec Registry, API and helpers. - - -Written by Marc-Andre Lemburg (mal at lemburg.com). - -(c) Copyright CNRI, All Rights Reserved. NO WARRANTY. - -"""#" - -import __builtin__, sys - -### Registry and builtin stateless codec functions - -try: - import sys - if sys.path[0] != r'd:\projects\pypy_co': - sys.path.insert(0,r'd:\projects\pypy_co') - from pypy.lib import _codecs - reload(_codecs) - del _codecs - from pypy.lib._codecs import * -except ImportError, why: - raise SystemError,\ - 'Failed to load the builtin codecs: %s' % why - -__all__ = ["register", "lookup", "open", "EncodedFile", "BOM", "BOM_BE", - "BOM_LE", "BOM32_BE", "BOM32_LE", "BOM64_BE", "BOM64_LE", - "BOM_UTF8", "BOM_UTF16", "BOM_UTF16_LE", "BOM_UTF16_BE", - "BOM_UTF32", "BOM_UTF32_LE", "BOM_UTF32_BE", - "strict_errors", "ignore_errors", "replace_errors", - "xmlcharrefreplace_errors", - "register_error", "lookup_error"] - -### Constants - -# -# Byte Order Mark (BOM = ZERO WIDTH NO-BREAK SPACE = U+FEFF) -# and its possible byte string values -# for UTF8/UTF16/UTF32 output and little/big endian machines -# - -# UTF-8 -BOM_UTF8 = '\xef\xbb\xbf' - -# UTF-16, little endian -BOM_LE = BOM_UTF16_LE = '\xff\xfe' - -# UTF-16, big endian -BOM_BE = BOM_UTF16_BE = '\xfe\xff' - -# UTF-32, little endian -BOM_UTF32_LE = '\xff\xfe\x00\x00' - -# UTF-32, big endian -BOM_UTF32_BE = '\x00\x00\xfe\xff' - -if sys.byteorder == 'little': - - # UTF-16, native endianness - BOM = BOM_UTF16 = BOM_UTF16_LE - - # UTF-32, native endianness - BOM_UTF32 = BOM_UTF32_LE - -else: - - # UTF-16, native endianness - BOM = BOM_UTF16 = BOM_UTF16_BE - - # UTF-32, native endianness - BOM_UTF32 = BOM_UTF32_BE - -# Old broken names (don't use in new code) -BOM32_LE = BOM_UTF16_LE -BOM32_BE = BOM_UTF16_BE -BOM64_LE = BOM_UTF32_LE -BOM64_BE = BOM_UTF32_BE - - -### Codec base classes (defining the API) - -class Codec: - - """ Defines the interface for stateless encoders/decoders. - - The .encode()/.decode() methods may use different error - handling schemes by providing the errors argument. These - string values are predefined: - - 'strict' - raise a ValueError error (or a subclass) - 'ignore' - ignore the character and continue with the next - 'replace' - replace with a suitable replacement character; - Python will use the official U+FFFD REPLACEMENT - CHARACTER for the builtin Unicode codecs on - decoding and '?' on encoding. - 'xmlcharrefreplace' - Replace with the appropriate XML - character reference (only for encoding). - 'backslashreplace' - Replace with backslashed escape sequences - (only for encoding). - - The set of allowed values can be extended via register_error. - - """ - def encode(self, input, errors='strict'): - - """ Encodes the object input and returns a tuple (output - object, length consumed). - - errors defines the error handling to apply. It defaults to - 'strict' handling. - - The method may not store state in the Codec instance. Use - StreamCodec for codecs which have to keep state in order to - make encoding/decoding efficient. - - The encoder must be able to handle zero length input and - return an empty object of the output object type in this - situation. - - """ - raise NotImplementedError - - def decode(self, input, errors='strict'): - - """ Decodes the object input and returns a tuple (output - object, length consumed). - - input must be an object which provides the bf_getreadbuf - buffer slot. Python strings, buffer objects and memory - mapped files are examples of objects providing this slot. - - errors defines the error handling to apply. It defaults to - 'strict' handling. - - The method may not store state in the Codec instance. Use - StreamCodec for codecs which have to keep state in order to - make encoding/decoding efficient. - - The decoder must be able to handle zero length input and - return an empty object of the output object type in this - situation. - - """ - raise NotImplementedError - -# -# The StreamWriter and StreamReader class provide generic working -# interfaces which can be used to implement new encoding submodules -# very easily. See encodings/utf_8.py for an example on how this is -# done. -# - -class StreamWriter(Codec): - - def __init__(self, stream, errors='strict'): - - """ Creates a StreamWriter instance. - - stream must be a file-like object open for writing - (binary) data. - - The StreamWriter may use different error handling - schemes by providing the errors keyword argument. These - parameters are predefined: - - 'strict' - raise a ValueError (or a subclass) - 'ignore' - ignore the character and continue with the next - 'replace'- replace with a suitable replacement character - 'xmlcharrefreplace' - Replace with the appropriate XML - character reference. - 'backslashreplace' - Replace with backslashed escape - sequences (only for encoding). - - The set of allowed parameter values can be extended via - register_error. - """ - self.stream = stream - self.errors = errors - - def write(self, object): - - """ Writes the object's contents encoded to self.stream. - """ - data, consumed = self.encode(object, self.errors) - print type(data) - self.stream.write(data) - - def writelines(self, list): - - """ Writes the concatenated list of strings to the stream - using .write(). - """ - self.write(''.join(list)) - - def reset(self): - - """ Flushes and resets the codec buffers used for keeping state. - - Calling this method should ensure that the data on the - output is put into a clean state, that allows appending - of new fresh data without having to rescan the whole - stream to recover state. - - """ - pass - - def __getattr__(self, name, - getattr=getattr): - - """ Inherit all other methods from the underlying stream. - """ - return getattr(self.stream, name) - -### - -class StreamReader(Codec): - - def __init__(self, stream, errors='strict'): - - """ Creates a StreamReader instance. - - stream must be a file-like object open for reading - (binary) data. - - The StreamReader may use different error handling - schemes by providing the errors keyword argument. These - parameters are predefined: - - 'strict' - raise a ValueError (or a subclass) - 'ignore' - ignore the character and continue with the next - 'replace'- replace with a suitable replacement character; - - The set of allowed parameter values can be extended via - register_error. - """ - self.stream = stream - self.errors = errors - self.bytebuffer = "" - self.charbuffer = u"" - self.atcr = False - - def decode(self, input, errors='strict'): - raise NotImplementedError - - def read(self, size=-1, chars=-1): - - """ Decodes data from the stream self.stream and returns the - resulting object. - - chars indicates the number of characters to read from the - stream. read() will never return more than chars - characters, but it might return less, if there are not enough - characters available. - - size indicates the approximate maximum number of bytes to - read from the stream for decoding purposes. The decoder - can modify this setting as appropriate. The default value - -1 indicates to read and decode as much as possible. size - is intended to prevent having to decode huge files in one - step. - - The method should use a greedy read strategy meaning that - it should read as much data as is allowed within the - definition of the encoding and the given size, e.g. if - optional encoding endings or state markers are available - on the stream, these should be read too. - """ - # read until we get the required number of characters (if available) - while True: - # can the request can be satisfied from the character buffer? - if chars < 0: - if self.charbuffer: - break - else: - if len(self.charbuffer) >= chars: - break - # we need more data - if size < 0: - newdata = self.stream.read() - else: - newdata = self.stream.read(size) - # decode bytes (those remaining from the last call included) - data = self.bytebuffer + newdata - newchars, decodedbytes = self.decode(data, self.errors) - # keep undecoded bytes until the next call - self.bytebuffer = data[decodedbytes:] - # put new characters in the character buffer - self.charbuffer += newchars - # there was no data available - if not newdata: - break - if chars < 0: - # Return everything we've got - result = self.charbuffer - self.charbuffer = u"" - else: - # Return the first chars characters - result = self.charbuffer[:chars] - self.charbuffer = self.charbuffer[chars:] - return result - - def readline(self, size=None, keepends=True): - - """ Read one line from the input stream and return the - decoded data. - - size, if given, is passed as size argument to the - read() method. - - """ - readsize = size or 72 - line = u"" - # If size is given, we call read() only once - while True: - data = self.read(readsize) - if self.atcr and data.startswith(u"\n"): - data = data[1:] - if data: - self.atcr = data.endswith(u"\r") - line += data - lines = line.splitlines(True) - if lines: - line0withend = lines[0] - line0withoutend = lines[0].splitlines(False)[0] - if line0withend != line0withoutend: # We really have a line end - # Put the rest back together and keep it until the next call - self.charbuffer = u"".join(lines[1:]) + self.charbuffer - if keepends: - line = line0withend - else: - line = line0withoutend - break - # we didn't get anything or this was our only try - elif not data or size is not None: - if line and not keepends: - line = line.splitlines(False)[0] - break - if readsize<8000: - readsize *= 2 - return line - - def readlines(self, sizehint=None, keepends=True): - - """ Read all lines available on the input stream - and return them as list of lines. - - Line breaks are implemented using the codec's decoder - method and are included in the list entries. - - sizehint, if given, is ignored since there is no efficient - way to finding the true end-of-line. - - """ - data = self.read() - return data.splitlines(keepends) - - def reset(self): - - """ Resets the codec buffers used for keeping state. - - Note that no stream repositioning should take place. - This method is primarily intended to be able to recover - from decoding errors. - - """ - pass - - def next(self): - - """ Return the next decoded line from the input stream.""" - line = self.readline() - if line: - return line - raise StopIteration - - def __iter__(self): - return self - - def __getattr__(self, name, - getattr=getattr): - - """ Inherit all other methods from the underlying stream. - """ - return getattr(self.stream, name) - -### - -class StreamReaderWriter: - - """ StreamReaderWriter instances allow wrapping streams which - work in both read and write modes. - - The design is such that one can use the factory functions - returned by the codec.lookup() function to construct the - instance. - - """ - # Optional attributes set by the file wrappers below - encoding = 'unknown' - - def __init__(self, stream, Reader, Writer, errors='strict'): - - """ Creates a StreamReaderWriter instance. - - stream must be a Stream-like object. - - Reader, Writer must be factory functions or classes - providing the StreamReader, StreamWriter interface resp. - - Error handling is done in the same way as defined for the - StreamWriter/Readers. - - """ - self.stream = stream - self.reader = Reader(stream, errors) - self.writer = Writer(stream, errors) - self.errors = errors - - def read(self, size=-1): - - return self.reader.read(size) - - def readline(self, size=None): - - return self.reader.readline(size) - - def readlines(self, sizehint=None): - - return self.reader.readlines(sizehint) - - def next(self): - - """ Return the next decoded line from the input stream.""" - return self.reader.next() - - def __iter__(self): - return self - - def write(self, data): - - return self.writer.write(data) - - def writelines(self, list): - - return self.writer.writelines(list) - - def reset(self): - - self.reader.reset() - self.writer.reset() - - def __getattr__(self, name, - getattr=getattr): - - """ Inherit all other methods from the underlying stream. - """ - return getattr(self.stream, name) - -### - -class StreamRecoder: - - """ StreamRecoder instances provide a frontend - backend - view of encoding data. - - They use the complete set of APIs returned by the - codecs.lookup() function to implement their task. - - Data written to the stream is first decoded into an - intermediate format (which is dependent on the given codec - combination) and then written to the stream using an instance - of the provided Writer class. - - In the other direction, data is read from the stream using a - Reader instance and then return encoded data to the caller. - - """ - # Optional attributes set by the file wrappers below - data_encoding = 'unknown' - file_encoding = 'unknown' - - def __init__(self, stream, encode, decode, Reader, Writer, - errors='strict'): - - """ Creates a StreamRecoder instance which implements a two-way - conversion: encode and decode work on the frontend (the - input to .read() and output of .write()) while - Reader and Writer work on the backend (reading and - writing to the stream). - - You can use these objects to do transparent direct - recodings from e.g. latin-1 to utf-8 and back. - - stream must be a file-like object. - - encode, decode must adhere to the Codec interface, Reader, - Writer must be factory functions or classes providing the - StreamReader, StreamWriter interface resp. - - encode and decode are needed for the frontend translation, - Reader and Writer for the backend translation. Unicode is - used as intermediate encoding. - - Error handling is done in the same way as defined for the - StreamWriter/Readers. - - """ - self.stream = stream - self.encode = encode - self.decode = decode - self.reader = Reader(stream, errors) - self.writer = Writer(stream, errors) - self.errors = errors - - def read(self, size=-1): - - data = self.reader.read(size) - data, bytesencoded = self.encode(data, self.errors) - return data - - def readline(self, size=None): - - if size is None: - data = self.reader.readline() - else: - data = self.reader.readline(size) - data, bytesencoded = self.encode(data, self.errors) - return data - - def readlines(self, sizehint=None): - - data = self.reader.read() - data, bytesencoded = self.encode(data, self.errors) - return data.splitlines(1) - - def next(self): - - """ Return the next decoded line from the input stream.""" - return self.reader.next() - - def __iter__(self): - return self - - def write(self, data): - - data, bytesdecoded = self.decode(data, self.errors) - return self.writer.write(data) - - def writelines(self, list): - - data = ''.join(list) - data, bytesdecoded = self.decode(data, self.errors) - return self.writer.write(data) - - def reset(self): - - self.reader.reset() - self.writer.reset() - - def __getattr__(self, name, - getattr=getattr): - - """ Inherit all other methods from the underlying stream. - """ - return getattr(self.stream, name) - -### Shortcuts - -def open(filename, mode='rb', encoding=None, errors='strict', buffering=1): - - """ Open an encoded file using the given mode and return - a wrapped version providing transparent encoding/decoding. - - Note: The wrapped version will only accept the object format - defined by the codecs, i.e. Unicode objects for most builtin - codecs. Output is also codec dependent and will usually by - Unicode as well. - - Files are always opened in binary mode, even if no binary mode - was specified. This is done to avoid data loss due to encodings - using 8-bit values. The default file mode is 'rb' meaning to - open the file in binary read mode. - - encoding specifies the encoding which is to be used for the - file. - - errors may be given to define the error handling. It defaults - to 'strict' which causes ValueErrors to be raised in case an - encoding error occurs. - - buffering has the same meaning as for the builtin open() API. - It defaults to line buffered. - - The returned wrapped file object provides an extra attribute - .encoding which allows querying the used encoding. This - attribute is only available if an encoding was specified as - parameter. - - """ - if encoding is not None and \ - 'b' not in mode: - # Force opening of the file in binary mode - mode = mode + 'b' - file = __builtin__.open(filename, mode, buffering) - if encoding is None: - return file - (e, d, sr, sw) = lookup(encoding) - srw = StreamReaderWriter(file, sr, sw, errors) - # Add attributes to simplify introspection - srw.encoding = encoding - return srw - -def EncodedFile(file, data_encoding, file_encoding=None, errors='strict'): - - """ Return a wrapped version of file which provides transparent - encoding translation. - - Strings written to the wrapped file are interpreted according - to the given data_encoding and then written to the original - file as string using file_encoding. The intermediate encoding - will usually be Unicode but depends on the specified codecs. - - Strings are read from the file using file_encoding and then - passed back to the caller as string using data_encoding. - - If file_encoding is not given, it defaults to data_encoding. - - errors may be given to define the error handling. It defaults - to 'strict' which causes ValueErrors to be raised in case an - encoding error occurs. - - The returned wrapped file object provides two extra attributes - .data_encoding and .file_encoding which reflect the given - parameters of the same name. The attributes can be used for - introspection by Python programs. - - """ - if file_encoding is None: - file_encoding = data_encoding - encode, decode = lookup(data_encoding)[:2] - Reader, Writer = lookup(file_encoding)[2:] - sr = StreamRecoder(file, - encode, decode, Reader, Writer, - errors) - # Add attributes to simplify introspection - sr.data_encoding = data_encoding - sr.file_encoding = file_encoding - return sr - -### Helpers for codec lookup - -def getencoder(encoding): - - """ Lookup up the codec for the given encoding and return - its encoder function. - - Raises a LookupError in case the encoding cannot be found. - - """ - return lookup(encoding)[0] - -def getdecoder(encoding): - - """ Lookup up the codec for the given encoding and return - its decoder function. - - Raises a LookupError in case the encoding cannot be found. - - """ - return lookup(encoding)[1] - -def getreader(encoding): - - """ Lookup up the codec for the given encoding and return - its StreamReader class or factory function. - - Raises a LookupError in case the encoding cannot be found. - - """ - return lookup(encoding)[2] - -def getwriter(encoding): - - """ Lookup up the codec for the given encoding and return - its StreamWriter class or factory function. - - Raises a LookupError in case the encoding cannot be found. - - """ - return lookup(encoding)[3] - -### Helpers for charmap-based codecs - -def make_identity_dict(rng): - - """ make_identity_dict(rng) -> dict - - Return a dictionary where elements of the rng sequence are - mapped to themselves. - - """ - res = {} - for i in rng: - res[i]=i - return res - -def make_encoding_map(decoding_map): - - """ Creates an encoding map from a decoding map. - - If a target mapping in the decoding map occurs multiple - times, then that target is mapped to None (undefined mapping), - causing an exception when encountered by the charmap codec - during translation. - - One example where this happens is cp875.py which decodes - multiple character to \u001a. - - """ - m = {} - for k,v in decoding_map.items(): - if not v in m: - m[v] = k - else: - m[v] = None - return m - -### error handlers - -strict_errors = lookup_error("strict") -ignore_errors = lookup_error("ignore") -replace_errors = lookup_error("replace") -xmlcharrefreplace_errors = lookup_error("xmlcharrefreplace") -backslashreplace_errors = lookup_error("backslashreplace") - -# Tell modulefinder that using codecs probably needs the encodings -# package -_false = 1 -if _false: - import encodings - -### Tests - -if __name__ == '__main__': - - # Make stdout translate Latin-1 output into UTF-8 output - sys.stdout = EncodedFile(sys.stdout, 'latin-1', 'utf-8') - - # Have stdin translate Latin-1 input into UTF-8 input - sys.stdin = EncodedFile(sys.stdin, 'utf-8', 'latin-1') From arigo at codespeak.net Thu May 5 23:12:51 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Thu, 5 May 2005 23:12:51 +0200 (CEST) Subject: [pypy-svn] r11986 - pypy/dist/pypy/objspace/flow Message-ID: <20050505211251.CF25B27BBA@code1.codespeak.net> Author: arigo Date: Thu May 5 23:12:51 2005 New Revision: 11986 Modified: pypy/dist/pypy/objspace/flow/flowcontext.py Log: Hard-to-find problem with the flow objspace creating too large graphs in some cases. Modified: pypy/dist/pypy/objspace/flow/flowcontext.py ============================================================================== --- pypy/dist/pypy/objspace/flow/flowcontext.py (original) +++ pypy/dist/pypy/objspace/flow/flowcontext.py Thu May 5 23:12:51 2005 @@ -324,7 +324,7 @@ currentblock.closeblock(Link(outputargs, newblock)) # phew if not finished: - if block is not None and block.exits: + if block is not None: # to simplify the graph, we patch the old block to point # directly at the new block which is its generalization block.dead = True @@ -332,6 +332,7 @@ block.exitswitch = None outputargs = block.framestate.getoutputargs(newstate) block.recloseblock(Link(outputargs, newblock)) + candidates.remove(block) candidates.insert(0, newblock) self.pendingblocks.append(newblock) From arigo at codespeak.net Thu May 5 23:18:32 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Thu, 5 May 2005 23:18:32 +0200 (CEST) Subject: [pypy-svn] r11987 - pypy/dist/pypy/objspace/flow/test Message-ID: <20050505211832.E0C1A27BBD@code1.codespeak.net> Author: arigo Date: Thu May 5 23:18:32 2005 New Revision: 11987 Modified: pypy/dist/pypy/objspace/flow/test/test_objspace.py Log: A test against the flow space producing too large graphs. Modified: pypy/dist/pypy/objspace/flow/test/test_objspace.py ============================================================================== --- pypy/dist/pypy/objspace/flow/test/test_objspace.py (original) +++ pypy/dist/pypy/objspace/flow/test/test_objspace.py Thu May 5 23:18:32 2005 @@ -1,5 +1,6 @@ import autopath from pypy.objspace.flow.model import Constant, Block, Link, Variable, traverse +from pypy.objspace.flow.model import flatten from pypy.interpreter.argument import Arguments from pypy.translator.simplify import simplify_graph @@ -425,6 +426,55 @@ traverse(visitor, x) #__________________________________________________________ + def highly_branching_example(a,b,c,d,e,f,g,h,i,j): + if a: + x1 = 1 + else: + x1 = 2 + if b: + x2 = 1 + else: + x2 = 2 + if c: + x3 = 1 + else: + x3 = 2 + if d: + x4 = 1 + else: + x4 = 2 + if e: + x5 = 1 + else: + x5 = 2 + if f: + x6 = 1 + else: + x6 = 2 + if g: + x7 = 1 + else: + x7 = 2 + if h: + x8 = 1 + else: + x8 = 2 + if i: + x9 = 1 + else: + x9 = 2 + if j: + x10 = 1 + else: + x10 = 2 + return (x1, x2, x3, x4, x5, x6, x7, x8, x9, x10) + + def test_highly_branching_example(self): + x = self.codetest(self.highly_branching_example) + self.show(x) + assert len(flatten(x)) < 60 # roughly 20 blocks + 30 links + + #__________________________________________________________ def test_unfrozen_user_class1(self): class C: def __nonzero__(self): From arigo at codespeak.net Thu May 5 23:52:10 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Thu, 5 May 2005 23:52:10 +0200 (CEST) Subject: [pypy-svn] r11989 - in pypy/dist/pypy: objspace/flow translator Message-ID: <20050505215210.1248027BBF@code1.codespeak.net> Author: arigo Date: Thu May 5 23:52:09 2005 New Revision: 11989 Modified: pypy/dist/pypy/objspace/flow/framestate.py pypy/dist/pypy/objspace/flow/model.py pypy/dist/pypy/translator/annrpython.py pypy/dist/pypy/translator/gencl.py pypy/dist/pypy/translator/genpyrex.py Log: Make sure that undefined local variables can never propagate in flow graphs. Modified: pypy/dist/pypy/objspace/flow/framestate.py ============================================================================== --- pypy/dist/pypy/objspace/flow/framestate.py (original) +++ pypy/dist/pypy/objspace/flow/framestate.py Thu May 5 23:52:09 2005 @@ -8,13 +8,8 @@ def __init__(self, state): if isinstance(state, PyFrame): - data = [] - for w in state.getfastscope(): - if w is None: - data.append(Constant(undefined_value)) - else: - data.append(w) - data.extend(state.valuestack.items) + # getfastscope() can return real None, for undefined locals + data = state.getfastscope() + state.valuestack.items if state.last_exception is None: data.append(Constant(None)) data.append(Constant(None)) @@ -35,7 +30,7 @@ state.__class__.__name__) self.next_instr = self.nonmergeable[1] for w1 in self.mergeable: - assert isinstance(w1, (Variable, Constant)), ( + assert isinstance(w1, (Variable, Constant)) or w1 is None, ( '%r found in frame state' % w1) def restoreframe(self, frame): @@ -43,13 +38,7 @@ fastlocals = len(frame.fastlocals_w) data = self.mergeable[:] recursively_unflatten(frame.space, data) - fastscope = [] - for w in data[:fastlocals]: - if isinstance(w, Constant) and w.value is undefined_value: - fastscope.append(None) - else: - fastscope.append(w) - frame.setfastscope(fastscope) + frame.setfastscope(data[:fastlocals]) # Nones == undefined locals frame.valuestack.items[:] = data[fastlocals:-2] if data[-2] == Constant(None): assert data[-1] == Constant(None) @@ -121,6 +110,9 @@ def union(w1, w2): "Union of two variables or constants." + if w1 is None or w2 is None: + return None # if w1 or w2 is an undefined local, we "kill" the value + # coming from the other path and return an undefined local if isinstance(w1, Variable) or isinstance(w2, Variable): return Variable() # new fresh Variable if isinstance(w1, Constant) and isinstance(w2, Constant): Modified: pypy/dist/pypy/objspace/flow/model.py ============================================================================== --- pypy/dist/pypy/objspace/flow/model.py (original) +++ pypy/dist/pypy/objspace/flow/model.py Thu May 5 23:52:09 2005 @@ -218,7 +218,6 @@ return self.name last_exception = Atom('last_exception') last_exc_value = Atom('last_exc_value') -undefined_value= Atom('*undefined*') # if Block().exitswitch == Constant(last_exception), it means that we are # interested in catching the exception that the *last operation* of the # block could raise. The exitcases of the links are None for no exception Modified: pypy/dist/pypy/translator/annrpython.py ============================================================================== --- pypy/dist/pypy/translator/annrpython.py (original) +++ pypy/dist/pypy/translator/annrpython.py Thu May 5 23:52:09 2005 @@ -5,7 +5,7 @@ from pypy.annotation import model as annmodel from pypy.annotation.model import pair from pypy.annotation.bookkeeper import Bookkeeper -from pypy.objspace.flow.model import Variable, Constant, undefined_value +from pypy.objspace.flow.model import Variable, Constant from pypy.objspace.flow.model import SpaceOperation, FunctionGraph from pypy.objspace.flow.model import last_exception, last_exc_value @@ -172,8 +172,8 @@ else: raise elif isinstance(arg, Constant): - if arg.value is undefined_value: # undefined local variables - return annmodel.SomeImpossibleValue() + #if arg.value is undefined_value: # undefined local variables + # return annmodel.SomeImpossibleValue() assert not arg.value is last_exception and not arg.value is last_exc_value return self.bookkeeper.immutablevalue(arg.value) else: Modified: pypy/dist/pypy/translator/gencl.py ============================================================================== --- pypy/dist/pypy/translator/gencl.py (original) +++ pypy/dist/pypy/translator/gencl.py Thu May 5 23:52:09 2005 @@ -306,7 +306,7 @@ target = link.target.inputargs print "(psetq", # parallel assignment for s, t in zip(source, target): - if s != t and s != Constant(undefined_value): + if s != t: # and s != Constant(undefined_value): print self.str(t), self.str(s), print ")" self.emit_jump(link.target) Modified: pypy/dist/pypy/translator/genpyrex.py ============================================================================== --- pypy/dist/pypy/translator/genpyrex.py (original) +++ pypy/dist/pypy/translator/genpyrex.py Thu May 5 23:52:09 2005 @@ -4,7 +4,7 @@ """ from pypy.interpreter.baseobjspace import ObjSpace from pypy.interpreter.argument import Arguments -from pypy.objspace.flow.model import Variable, Constant, undefined_value +from pypy.objspace.flow.model import Variable, Constant from pypy.objspace.flow.model import mkentrymap, last_exception from pypy.translator.annrpython import RPythonAnnotator from pypy.annotation.model import SomePBC @@ -407,7 +407,7 @@ # get rid of identity-assignments and assignments of undefined_value sargs, targs = [], [] for s,t in zip(sourceargs, targetargs): - if s != t and s != Constant(undefined_value): + if s != t: # and s != Constant(undefined_value): sargs.append(s) targs.append(t) if sargs: From pedronis at codespeak.net Fri May 6 00:08:17 2005 From: pedronis at codespeak.net (pedronis at codespeak.net) Date: Fri, 6 May 2005 00:08:17 +0200 (CEST) Subject: [pypy-svn] r11990 - pypy/dist/pypy/objspace/std Message-ID: <20050505220817.3BFED27BCB@code1.codespeak.net> Author: pedronis Date: Fri May 6 00:08:17 2005 New Revision: 11990 Modified: pypy/dist/pypy/objspace/std/inttype.py Log: make value defined on all paths Modified: pypy/dist/pypy/objspace/std/inttype.py ============================================================================== --- pypy/dist/pypy/objspace/std/inttype.py (original) +++ pypy/dist/pypy/objspace/std/inttype.py Fri May 6 00:08:17 2005 @@ -14,6 +14,7 @@ def descr__new__(space, w_inttype, w_value=0, w_base=NoneNotWrapped): from pypy.objspace.std.intobject import W_IntObject w_longval = None + value = 0 if w_base is None: # check for easy cases if isinstance(w_value, W_IntObject): From arigo at codespeak.net Fri May 6 00:09:46 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Fri, 6 May 2005 00:09:46 +0200 (CEST) Subject: [pypy-svn] r11991 - pypy/dist/pypy/lib Message-ID: <20050505220946.C504827BCC@code1.codespeak.net> Author: arigo Date: Fri May 6 00:09:46 2005 New Revision: 11991 Modified: pypy/dist/pypy/lib/_formatting.py Log: Fix for the new rule of not using possibly undefined locals. Modified: pypy/dist/pypy/lib/_formatting.py ============================================================================== --- pypy/dist/pypy/lib/_formatting.py (original) +++ pypy/dist/pypy/lib/_formatting.py Fri May 6 00:09:46 2005 @@ -64,6 +64,7 @@ """return (char, flags, width, prec, value) partially consumes fmtiter & valueiter""" c = fmtiter.next() + value = None gotvalue = False if c == '(': n = '' From pedronis at codespeak.net Fri May 6 00:14:05 2005 From: pedronis at codespeak.net (pedronis at codespeak.net) Date: Fri, 6 May 2005 00:14:05 +0200 (CEST) Subject: [pypy-svn] r11993 - pypy/dist/pypy/objspace/std Message-ID: <20050505221405.3381F27BD1@code1.codespeak.net> Author: pedronis Date: Fri May 6 00:14:04 2005 New Revision: 11993 Modified: pypy/dist/pypy/objspace/std/fake.py Log: val definedness Modified: pypy/dist/pypy/objspace/std/fake.py ============================================================================== --- pypy/dist/pypy/objspace/std/fake.py (original) +++ pypy/dist/pypy/objspace/std/fake.py Fri May 6 00:14:04 2005 @@ -187,6 +187,7 @@ else: name = space.unwrap(w_descriptor).name obj = space.unwrap(w_obj) + val = None try: val = getattr(obj, name) # this gives a "not RPython" warning except: From pedronis at codespeak.net Fri May 6 00:30:31 2005 From: pedronis at codespeak.net (pedronis at codespeak.net) Date: Fri, 6 May 2005 00:30:31 +0200 (CEST) Subject: [pypy-svn] r11995 - in pypy/dist/pypy: interpreter module/builtin Message-ID: <20050505223031.3C12C27BD6@code1.codespeak.net> Author: pedronis Date: Fri May 6 00:30:31 2005 New Revision: 11995 Modified: pypy/dist/pypy/interpreter/pyopcode.py pypy/dist/pypy/module/builtin/compiling.py Log: fixes to pass test_compile again Modified: pypy/dist/pypy/interpreter/pyopcode.py ============================================================================== --- pypy/dist/pypy/interpreter/pyopcode.py (original) +++ pypy/dist/pypy/interpreter/pyopcode.py Fri May 6 00:30:31 2005 @@ -882,10 +882,11 @@ try: prog = compile(prog, filename, 'exec', compile_flags, 1) except SyntaxError, e: # exec SyntaxErrors have filename==None - msg, loc = e.args - loc1 = (None,) + loc[1:] - e.args = msg, loc1 - e.filename = None + if len(e.args) == 2: + msg, loc = e.args + loc1 = (None,) + loc[1:] + e.args = msg, loc1 + e.filename = None raise e return (prog, globals, locals) ''', filename=__file__) Modified: pypy/dist/pypy/module/builtin/compiling.py ============================================================================== --- pypy/dist/pypy/module/builtin/compiling.py (original) +++ pypy/dist/pypy/module/builtin/compiling.py Fri May 6 00:30:31 2005 @@ -41,10 +41,11 @@ except OperationError, e: if e.match(space, space.w_SyntaxError): e_value_w = space.unpacktuple(e.w_value) - e_loc_w = space.unpacktuple(e_value_w[1]) - e.w_value = space.newtuple([e_value_w[0], - space.newtuple([space.w_None]+ - e_loc_w[1:])]) + if len(e_value_w) == 2: + e_loc_w = space.unpacktuple(e_value_w[1]) + e.w_value = space.newtuple([e_value_w[0], + space.newtuple([space.w_None]+ + e_loc_w[1:])]) raise e else: raise From pedronis at codespeak.net Fri May 6 00:46:31 2005 From: pedronis at codespeak.net (pedronis at codespeak.net) Date: Fri, 6 May 2005 00:46:31 +0200 (CEST) Subject: [pypy-svn] r11996 - pypy/dist/pypy/objspace/std Message-ID: <20050505224631.DD37227BDA@code1.codespeak.net> Author: pedronis Date: Fri May 6 00:46:31 2005 New Revision: 11996 Modified: pypy/dist/pypy/objspace/std/fake.py Log: more definedness fixes Modified: pypy/dist/pypy/objspace/std/fake.py ============================================================================== --- pypy/dist/pypy/objspace/std/fake.py (original) +++ pypy/dist/pypy/objspace/std/fake.py Fri May 6 00:46:31 2005 @@ -84,6 +84,7 @@ r = cpy_type.__new__(cpy_type, *args) except: wrap_exception(space) + raise w_obj = space.allocate_instance(W_Fake, w_type) w_obj.__init__(space, r) return w_obj @@ -147,6 +148,7 @@ result = apply(fn, self.unwrappedargs, self.unwrappedkwds) except: wrap_exception(self.space) + raise return self.space.wrap(result) class EvenMoreObscureWrapping(baseobjspace.BaseWrappable): @@ -187,11 +189,11 @@ else: name = space.unwrap(w_descriptor).name obj = space.unwrap(w_obj) - val = None try: val = getattr(obj, name) # this gives a "not RPython" warning except: wrap_exception(space) + raise return space.wrap(val) def descr_descriptor_set(space, w_descriptor, w_obj, w_value): From arigo at codespeak.net Fri May 6 00:49:40 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Fri, 6 May 2005 00:49:40 +0200 (CEST) Subject: [pypy-svn] r11997 - pypy/dist/pypy/interpreter Message-ID: <20050505224940.4BF6727BDD@code1.codespeak.net> Author: arigo Date: Fri May 6 00:49:40 2005 New Revision: 11997 Modified: pypy/dist/pypy/interpreter/function.py pypy/dist/pypy/interpreter/typedef.py Log: Fixed method.__get__(). Done by making function.__get__ really generic, as it doesn't really depend on the fact that 'self' is a function. Modified: pypy/dist/pypy/interpreter/function.py ============================================================================== --- pypy/dist/pypy/interpreter/function.py (original) +++ pypy/dist/pypy/interpreter/function.py Fri May 6 00:49:40 2005 @@ -88,19 +88,6 @@ Function.__init__(func, space, code, w_globals, defs_w, closure, name) return space.wrap(func) - def descr_function_get(self, w_obj, w_cls=None): - space = self.space - wrap = space.wrap - asking_for_bound = (w_cls == space.w_None or - not space.is_true(space.is_(w_obj, space.w_None)) or - space.is_true(space.is_(w_cls, space.type(space.w_None)))) - if asking_for_bound: - #if w_cls == space.w_None: - # w_cls = space.type(w_obj) - return wrap(Method(space, wrap(self), w_obj, w_cls)) - else: - return wrap(Method(space, wrap(self), None, w_cls)) - def descr_function_call(self, __args__): return self.call_args(__args__) @@ -162,6 +149,20 @@ w_res = space.w_None return w_res +def descr_function_get(space, w_function, w_obj, w_cls=None): + # this is not defined as a method on Function because it's generally + # useful logic: w_function can be any callable. It is used by Method too. + asking_for_bound = (space.is_w(w_cls, space.w_None) or + not space.is_w(w_obj, space.w_None) or + space.is_w(w_cls, space.type(space.w_None))) + if asking_for_bound: + #if w_cls == space.w_None: + # w_cls = space.type(w_obj) + return space.wrap(Method(space, w_function, w_obj, w_cls)) + else: + return space.wrap(Method(space, w_function, None, w_cls)) + + def _getclass(space, w_obj): try: return space.abstract_getclass(w_obj) @@ -191,7 +192,7 @@ pre = "bound" else: pre = "unbound" - return "%s method %s" % (pre, self.w_function.name) + return "%s method %s" % (pre, self.w_function.getname(self.space, '?')) def call_args(self, args): space = self.space @@ -233,8 +234,9 @@ if (w_cls is not None and not space.is_w(w_cls, space.w_None) and not space.is_true(space.abstract_issubclass(w_cls, self.w_class))): - return space.wrap(self) # subclass test failed - return space.get(self.w_function, w_obj, w_cls) + return space.wrap(self) # subclass test failed + else: + return descr_function_get(space, self.w_function, w_obj, w_cls) def descr_method_call(self, __args__): return self.call_args(__args__) Modified: pypy/dist/pypy/interpreter/typedef.py ============================================================================== --- pypy/dist/pypy/interpreter/typedef.py (original) +++ pypy/dist/pypy/interpreter/typedef.py Fri May 6 00:49:40 2005 @@ -280,7 +280,7 @@ from pypy.interpreter.pyframe import PyFrame, ControlFlowException from pypy.interpreter.module import Module from pypy.interpreter.function import Function, Method, StaticMethod -from pypy.interpreter.function import BuiltinFunction +from pypy.interpreter.function import BuiltinFunction, descr_function_get from pypy.interpreter.pytraceback import PyTraceback from pypy.interpreter.generator import GeneratorIterator from pypy.interpreter.nestedscope import Cell @@ -405,7 +405,7 @@ __new__ = interp2app(Function.descr_method__new__.im_func), __call__ = interp2app(Function.descr_function_call, unwrap_spec=['self', Arguments]), - __get__ = interp2app(Function.descr_function_get), + __get__ = interp2app(descr_function_get), __repr__ = interp2app(Function.descr_function_repr), func_code = getset_func_code, func_doc = getset_func_doc, From pedronis at codespeak.net Fri May 6 01:00:26 2005 From: pedronis at codespeak.net (pedronis at codespeak.net) Date: Fri, 6 May 2005 01:00:26 +0200 (CEST) Subject: [pypy-svn] r11999 - pypy/dist/pypy/objspace/std Message-ID: <20050505230026.C498127BDF@code1.codespeak.net> Author: pedronis Date: Fri May 6 01:00:26 2005 New Revision: 11999 Modified: pypy/dist/pypy/objspace/std/unicodeobject.py Log: definedness fixes Modified: pypy/dist/pypy/objspace/std/unicodeobject.py ============================================================================== --- pypy/dist/pypy/objspace/std/unicodeobject.py (original) +++ pypy/dist/pypy/objspace/std/unicodeobject.py Fri May 6 01:00:26 2005 @@ -88,6 +88,7 @@ s = unicode_to_decimal_w(space, w_uni) except: wrap_exception(space) + raise return space.call_function(space.w_int, space.wrap(s)) # xxx unicode.__long__ should not exist From pedronis at codespeak.net Fri May 6 02:32:10 2005 From: pedronis at codespeak.net (pedronis at codespeak.net) Date: Fri, 6 May 2005 02:32:10 +0200 (CEST) Subject: [pypy-svn] r12001 - in pypy/dist/pypy: interpreter translator/test Message-ID: <20050506003210.69B9927B4F@code1.codespeak.net> Author: pedronis Date: Fri May 6 02:32:10 2005 New Revision: 12001 Modified: pypy/dist/pypy/interpreter/compiler.py pypy/dist/pypy/translator/test/snippet.py Log: - fixes to code to convert host CPython compile syntax errors to PyPy exceptions. - fix snippet so that test_geninterp works again Modified: pypy/dist/pypy/interpreter/compiler.py ============================================================================== --- pypy/dist/pypy/interpreter/compiler.py (original) +++ pypy/dist/pypy/interpreter/compiler.py Fri May 6 02:32:10 2005 @@ -100,7 +100,12 @@ # but here we only propagate the 'usual' ones, until we figure # out how to do it generically. except SyntaxError,e: - raise OperationError(space.w_SyntaxError,space.wrap(e.args)) + w_synerr = space.newtuple([space.wrap(e.msg), + space.newtuple([space.wrap(e.filename), + space.wrap(e.lineno), + space.wrap(e.offset), + space.wrap(e.text)])]) + raise OperationError(space.w_SyntaxError, w_synerr) except ValueError,e: raise OperationError(space.w_ValueError,space.wrap(str(e))) except TypeError,e: Modified: pypy/dist/pypy/translator/test/snippet.py ============================================================================== --- pypy/dist/pypy/translator/test/snippet.py (original) +++ pypy/dist/pypy/translator/test/snippet.py Fri May 6 02:32:10 2005 @@ -172,6 +172,7 @@ def choose_last(): """For loop test""" set = ["foo", "bar", "spam", "egg", "python"] + choice = "" for choice in set: pass return choice From pedronis at codespeak.net Fri May 6 02:53:26 2005 From: pedronis at codespeak.net (pedronis at codespeak.net) Date: Fri, 6 May 2005 02:53:26 +0200 (CEST) Subject: [pypy-svn] r12002 - pypy/dist/pypy/module/builtin Message-ID: <20050506005326.7707927B58@code1.codespeak.net> Author: pedronis Date: Fri May 6 02:53:26 2005 New Revision: 12002 Modified: pypy/dist/pypy/module/builtin/importing.py Log: fix typo that could bite later Modified: pypy/dist/pypy/module/builtin/importing.py ============================================================================== --- pypy/dist/pypy/module/builtin/importing.py (original) +++ pypy/dist/pypy/module/builtin/importing.py Fri May 6 02:53:26 2005 @@ -33,8 +33,8 @@ w_mods = space.sys.get('modules') try: space.delitem(w_mods, w_modulename) - except OperationError, e: - if not e.match(space, space.w_KeyError): + except OperationError, kerr: + if not kerr.match(space, space.w_KeyError): raise w_mod = check_sys_modules(space, w_modulename) if w_mod is not None and w_parent is not None: From pedronis at codespeak.net Fri May 6 02:54:11 2005 From: pedronis at codespeak.net (pedronis at codespeak.net) Date: Fri, 6 May 2005 02:54:11 +0200 (CEST) Subject: [pypy-svn] r12003 - pypy/dist/pypy/interpreter/test Message-ID: <20050506005411.51DCA27B58@code1.codespeak.net> Author: pedronis Date: Fri May 6 02:54:11 2005 New Revision: 12003 Modified: pypy/dist/pypy/interpreter/test/test_function.py Log: fix tests after changes Modified: pypy/dist/pypy/interpreter/test/test_function.py ============================================================================== --- pypy/dist/pypy/interpreter/test/test_function.py (original) +++ pypy/dist/pypy/interpreter/test/test_function.py Fri May 6 02:54:11 2005 @@ -1,7 +1,7 @@ import autopath import unittest -from pypy.interpreter.function import Function, Method +from pypy.interpreter.function import Function, Method, descr_function_get from pypy.interpreter.pycode import PyCode from pypy.interpreter.argument import Arguments @@ -202,20 +202,20 @@ def test_get(self): space = self.space - w_meth = self.fn.descr_function_get(space.wrap(5), space.type(space.wrap(5))) + w_meth = descr_function_get(space, self.fn, space.wrap(5), space.type(space.wrap(5))) meth = space.unwrap(w_meth) assert isinstance(meth, Method) def test_call(self): space = self.space - w_meth = self.fn.descr_function_get(space.wrap(5), space.type(space.wrap(5))) + w_meth = descr_function_get(space, self.fn, space.wrap(5), space.type(space.wrap(5))) meth = space.unwrap(w_meth) w_result = meth.call_args(Arguments(space, [space.wrap(42)])) assert space.unwrap(w_result) == 42 def test_fail_call(self): space = self.space - w_meth = self.fn.descr_function_get(space.wrap(5), space.type(space.wrap(5))) + w_meth = descr_function_get(space, self.fn, space.wrap(5), space.type(space.wrap(5))) meth = space.unwrap(w_meth) args = Arguments(space, [space.wrap("spam"), space.wrap("egg")]) self.space.raises_w(self.space.w_TypeError, meth.call_args, args) @@ -231,7 +231,7 @@ obj2 = space.wrap(42) args = Arguments(space, []) # Check method returned from func.__get__() - w_meth1 = func.descr_function_get(obj1, space.type(obj1)) + w_meth1 = descr_function_get(space, func, obj1, space.type(obj1)) meth1 = space.unwrap(w_meth1) assert isinstance(meth1, Method) assert meth1.call_args(args) == obj1 @@ -242,7 +242,7 @@ assert isinstance(meth2, Method) assert meth2.call_args(args) == obj1 # Check method returned from unbound_method.__get__() - w_meth3 = func.descr_function_get(None, space.type(obj2)) + w_meth3 = descr_function_get(space, func, None, space.type(obj2)) meth3 = space.unwrap(w_meth3) w_meth4 = meth3.descr_method_get(obj2, space.w_None) meth4 = space.unwrap(w_meth4) From tismer at codespeak.net Fri May 6 13:53:38 2005 From: tismer at codespeak.net (tismer at codespeak.net) Date: Fri, 6 May 2005 13:53:38 +0200 (CEST) Subject: [pypy-svn] r12010 - pypy/dist/pypy/translator/genc Message-ID: <20050506115338.6092027B5D@code1.codespeak.net> Author: tismer Date: Fri May 6 13:53:38 2005 New Revision: 12010 Modified: pypy/dist/pypy/translator/genc/int_include.h Log: small fixes Modified: pypy/dist/pypy/translator/genc/int_include.h ============================================================================== --- pypy/dist/pypy/translator/genc/int_include.h (original) +++ pypy/dist/pypy/translator/genc/int_include.h Fri May 6 13:53:38 2005 @@ -8,13 +8,15 @@ #define CONV_TO_OBJ_int PyInt_FromLong #define CONV_FROM_OBJ_int PyInt_AS_LONG -#define OP_INT_IS_TRUE(x,r,err) r = ((long)(x) != 0); #define OP_INT_EQ(x,y,r,err) r = ((long)(x) == (long)(y)); +#define OP_INT_NE(x,y,r,err) r = ((long)(x) != (long)(y)); #define OP_INT_LE(x,y,r,err) r = ((long)(x) <= (long)(y)); #define OP_INT_GT(x,y,r,err) r = ((long)(x) > (long)(y)); #define OP_INT_LT(x,y,r,err) r = ((long)(x) < (long)(y)); #define OP_INT_GE(x,y,r,err) r = ((long)(x) >= (long)(y)); +#define OP_INT_IS_TRUE(x,r,err) OP_INT_NE(x,0,r,err) + #define OP_INT_CMP(x,y,r,err) \ r = (((long)(x) > (long)(y)) - ((long)(x) < (long)(y))) From tismer at codespeak.net Fri May 6 13:58:42 2005 From: tismer at codespeak.net (tismer at codespeak.net) Date: Fri, 6 May 2005 13:58:42 +0200 (CEST) Subject: [pypy-svn] r12011 - pypy/dist/pypy/objspace/std Message-ID: <20050506115842.4C47727B5D@code1.codespeak.net> Author: tismer Date: Fri May 6 13:58:42 2005 New Revision: 12011 Modified: pypy/dist/pypy/objspace/std/floatobject.py pypy/dist/pypy/objspace/std/intobject.py pypy/dist/pypy/objspace/std/longobject.py Log: a few small (but hard to find) changes avoid pulling the whole interpreter in on basic operations. Especially space.is_true should be avoided and space.is_w should work directly. Modified: pypy/dist/pypy/objspace/std/floatobject.py ============================================================================== --- pypy/dist/pypy/objspace/std/floatobject.py (original) +++ pypy/dist/pypy/objspace/std/floatobject.py Fri May 6 13:58:42 2005 @@ -42,7 +42,10 @@ # a derived float object, where it should return # an exact one. def float__Float(space, w_float1): - if space.is_true(space.is_(space.type(w_float1), space.w_float)): + # don't trigger a descr operation. + # XXX let's consider to change space.is_ to plain bool + #if space.is_true(space.is_(space.type(w_float1), space.w_float)): + if space.w_True is space.is_(space.type(w_float1), space.w_float): return w_float1 a = w_float1.floatval return W_FloatObject(space, a) @@ -157,9 +160,14 @@ truediv__Float_Float = div__Float_Float +# avoid space.getitem for a basic operation +##def floordiv__Float_Float(space, w_float1, w_float2): +## w_t = divmod__Float_Float(space, w_float1, w_float2) +## return space.getitem(w_t, space.wrap(0)) + def floordiv__Float_Float(space, w_float1, w_float2): - w_t = divmod__Float_Float(space, w_float1, w_float2) - return space.getitem(w_t, space.wrap(0)) + w_div, w_mod = _divmod_w(space, w_float1, w_float2) + return w_div def mod__Float_Float(space, w_float1, w_float2): x = w_float1.floatval @@ -176,7 +184,7 @@ return W_FloatObject(space, mod) -def divmod__Float_Float(space, w_float1, w_float2): +def _divmod_w(space, w_float1, w_float2): x = w_float1.floatval y = w_float2.floatval if y == 0.0: @@ -203,8 +211,10 @@ except FloatingPointError: raise FailedToImplement(space.w_FloatingPointError, space.wrap("float division")) - return space.newtuple([W_FloatObject(space, floordiv), - W_FloatObject(space, mod)]) + return [W_FloatObject(space, floordiv), W_FloatObject(space, mod)] + +def divmod__Float_Float(space, w_float1, w_float2): + return space.newtuple(_divmod_w(space, w_float1, w_float2)) def pow__Float_Float_ANY(space, w_float1, w_float2, thirdArg): if not space.is_w(thirdArg, space.w_None): Modified: pypy/dist/pypy/objspace/std/intobject.py ============================================================================== --- pypy/dist/pypy/objspace/std/intobject.py (original) +++ pypy/dist/pypy/objspace/std/intobject.py Fri May 6 13:58:42 2005 @@ -174,18 +174,12 @@ return W_IntObject(space, z) def _truediv(space, w_int1, w_int2): - x = w_int1.intval - y = w_int2.intval - try: - z = ovfcheck(x // y) - except ZeroDivisionError: - raise OperationError(space.w_ZeroDivisionError, - space.wrap("integer division by zero")) - except OverflowError: - return space.div(space.newfloat(float(x)), w_int2) - if x % y != 0: # gives a float - return space.div(space.newfloat(float(x)), w_int2) - return W_IntObject(space, z) + # XXX how to do delegation to float elegantly? + # avoiding a general space.div operation which pulls + # the whole interpreter in. + # Instead, we delegate to long for now. + raise FailedToImplement(space.w_TypeError, + space.wrap("integer division")) def mod__Int_Int(space, w_int1, w_int2): x = w_int1.intval @@ -396,7 +390,10 @@ # a derived integer object, where it should return # an exact one. def int__Int(space, w_int1): - if space.is_true(space.is_(space.type(w_int1), space.w_int)): + # don't trigger a descr operation. + # XXX let's consider to change space.is_ to plain bool + #if space.is_true(space.is_(space.type(w_int1), space.w_int)): + if space.w_True is space.is_(space.type(w_int1), space.w_int): return w_int1 a = w_int1.intval return W_IntObject(space, a) Modified: pypy/dist/pypy/objspace/std/longobject.py ============================================================================== --- pypy/dist/pypy/objspace/std/longobject.py (original) +++ pypy/dist/pypy/objspace/std/longobject.py Fri May 6 13:58:42 2005 @@ -103,7 +103,10 @@ # a derived long object, where it should return # an exact one. def long__Long(space, w_long1): - if space.is_true(space.is_(space.type(w_long1), space.w_long)): + # don't trigger a descr operation. + # XXX let's consider to change space.is_ to plain bool + #if space.is_true(space.is_(space.type(w_long1), space.w_long)): + if space.w_True is space.is_(space.type(w_long1), space.w_long): return w_long1 digits = w_long1.digits sign = w_long1.sign From tismer at codespeak.net Fri May 6 14:00:50 2005 From: tismer at codespeak.net (tismer at codespeak.net) Date: Fri, 6 May 2005 14:00:50 +0200 (CEST) Subject: [pypy-svn] r12012 - pypy/dist/goal Message-ID: <20050506120050.EFC2D27B5D@code1.codespeak.net> Author: tismer Date: Fri May 6 14:00:50 2005 New Revision: 12012 Modified: pypy/dist/goal/targetpypy1.py Log: targetpypy1 works with a lot of operators now, while the produced code stays slim. Modified: pypy/dist/goal/targetpypy1.py ============================================================================== --- pypy/dist/goal/targetpypy1.py (original) +++ pypy/dist/goal/targetpypy1.py Fri May 6 14:00:50 2005 @@ -1,30 +1,49 @@ -import buildcache2 from pypy.objspace.std.objspace import StdObjSpace, W_Object from pypy.objspace.std.intobject import W_IntObject from pypy.objspace.std import stdtypedef # __________ Entry point __________ +operations = "mul add sub div mod lshift rshift floordiv truediv ".split() + def entry_point(): w_a = W_IntObject(space, -7) - w_b = W_IntObject(space, -6) - ret_mul = mmentrypoints["mul"](space, w_a, w_b) - ret_add = mmentrypoints["add"](space, w_a, w_b) - ret_sub = mmentrypoints["sub"](space, w_a, w_b) - return ret_mul, ret_add, ret_sub - + w_b = W_IntObject(space, 6) + results_w = [mmentrypoints[op](space, w_a, w_b) for op in operations] + return [space.unwrap(each) for each in resuls_w] + +# flatten the above code, to get a nicer look +def make_flat_code(): + g = globals() + # make globals constants from the operations + code = """def entry_point(): + import sys + w_a = W_IntObject(space, -7) + # -sys.maxint-1 crashes: genc problem with OP_SUB and int constant + # when implementing lshift_Long_Long and rshift__Long_Long + w_b = W_IntObject(space, 6) + results_w = [] + append = results_w.append +""" + for op in operations: + g["op_%s" % op] = mmentrypoints[op] + line = " append(op_%s(space, w_a, w_b))" % op + code += line + '\n' + code += " return [space.unwrap(each) for each in results_w]\n" + print code + exec code in g + # _____ Define and setup target _____ def target(): global space, mmentrypoints # disable translation of the whole of classobjinterp.py StdObjSpace.setup_old_style_classes = lambda self: None space = StdObjSpace() - # call cache filling code - buildcache2.buildcache(space) + # call cache filling code *not* needed here # ------------------------------------------------------------ mmentrypoints = {} - for name in "mul add sub".split(): + for name in operations: mm = getattr(space.MM, name) exprargs, expr, miniglobals, fallback = ( mm.install_not_sliced(space.model.typeorder, baked_perform_call=False)) @@ -36,6 +55,7 @@ # further call the entry_point once to trigger building remaining # caches (as far as analyzing the entry_point is concerned) + make_flat_code() entry_point() return entry_point, [] @@ -43,8 +63,13 @@ # _____ Run translated _____ def run(c_entry_point): - res_w = c_entry_point() - res = tuple([each.intval for each in res_w]) + res = c_entry_point() print res - assert res == (-7 * -6, -7 + -6, -7 - -6) + import operator + assert res == [getattr(operator, name)(-7, 6) for name in operations] + +if __name__ == "__main__": + # just run it without translation + target() + run(entry_point) \ No newline at end of file From tismer at codespeak.net Fri May 6 14:09:13 2005 From: tismer at codespeak.net (tismer at codespeak.net) Date: Fri, 6 May 2005 14:09:13 +0200 (CEST) Subject: [pypy-svn] r12014 - pypy/dist/goal Message-ID: <20050506120913.F024C27B58@code1.codespeak.net> Author: tismer Date: Fri May 6 14:09:13 2005 New Revision: 12014 Added: pypy/dist/goal/targetrpystone.py (contents, props changed) Log: rpystone translates nicely and runs about 3+ times faster than under CPython Added: pypy/dist/goal/targetrpystone.py ============================================================================== --- (empty file) +++ pypy/dist/goal/targetrpystone.py Fri May 6 14:09:13 2005 @@ -0,0 +1,35 @@ +import buildcache2 +from pypy.objspace.std.objspace import StdObjSpace +from pypy.translator.test import rpystone + +# __________ Entry point __________ + +LOOPS = 150000 + +def entry_point(): + rpystone.entrypoint(LOOPS) + +# _____ Define and setup target _____ +def target(): + global space, mmentrypoints + # disable translation of the whole of classobjinterp.py + #StdObjSpace.setup_old_style_classes = lambda self: None + space = StdObjSpace() + # call cache filling code + #buildcache2.buildcache(space) + + # ------------------------------------------------------------ + + return entry_point, [] + +# _____ Run translated _____ + +def run(c_entry_point): + res_w = c_entry_point() + print res_w + +if __name__ == "__main__": + # just run it without translation + target() + run(entry_point) + \ No newline at end of file From tismer at codespeak.net Fri May 6 14:11:47 2005 From: tismer at codespeak.net (tismer at codespeak.net) Date: Fri, 6 May 2005 14:11:47 +0200 (CEST) Subject: [pypy-svn] r12015 - pypy/dist/pypy/translator/genc Message-ID: <20050506121147.556A227B58@code1.codespeak.net> Author: tismer Date: Fri May 6 14:11:47 2005 New Revision: 12015 Modified: pypy/dist/pypy/translator/genc/pyobjtype.py Log: convinced genc to produce a filled space instance. Maybe this should be done differently, but it works. Modified: pypy/dist/pypy/translator/genc/pyobjtype.py ============================================================================== --- pypy/dist/pypy/translator/genc/pyobjtype.py (original) +++ pypy/dist/pypy/translator/genc/pyobjtype.py Fri May 6 14:11:47 2005 @@ -7,6 +7,11 @@ from pypy.tool.rarithmetic import r_int, r_uint +# XXX maybe this can be done more elegantly: +# needed to convince should_translate_attr +# to fill the space instance. +# Should this be registered with the annotator? +from pypy.interpreter.baseobjspace import ObjSpace class CPyObjectType(CType): """The PyObject* C type. @@ -19,7 +24,7 @@ def __init__(self, translator): super(CPyObjectType, self).__init__(translator) - self.namespace= NameManager() + self.namespace = NameManager() # keywords cannot be reused. This is the C99 draft's list. self.namespace.make_reserved_names(''' auto enum restrict unsigned @@ -199,7 +204,7 @@ def should_translate_attr(self, pbc, attr): ann = self.translator.annotator - if ann is None: + if ann is None or isinstance(pbc, ObjSpace): ignore = getattr(pbc.__class__, 'NOT_RPYTHON_ATTRIBUTES', []) if attr in ignore: return False From tismer at codespeak.net Fri May 6 14:12:47 2005 From: tismer at codespeak.net (tismer at codespeak.net) Date: Fri, 6 May 2005 14:12:47 +0200 (CEST) Subject: [pypy-svn] r12016 - pypy/dist/pypy/annotation Message-ID: <20050506121247.3B5BB27B58@code1.codespeak.net> Author: tismer Date: Fri May 6 14:12:46 2005 New Revision: 12016 Modified: pypy/dist/pypy/annotation/builtin.py Log: rpystone support: some time functions Modified: pypy/dist/pypy/annotation/builtin.py ============================================================================== --- pypy/dist/pypy/annotation/builtin.py (original) +++ pypy/dist/pypy/annotation/builtin.py Fri May 6 14:12:46 2005 @@ -3,7 +3,7 @@ """ import types -import sys, math, os +import sys, math, os, time from pypy.tool.ansi_print import ansi_print from pypy.annotation.model import SomeInteger, SomeObject, SomeChar, SomeBool from pypy.annotation.model import SomeList, SomeString, SomeTuple, SomeSlice @@ -192,6 +192,9 @@ def pathpart(*args): return SomeString() +def time_func(): + return SomeFloat() + # collect all functions import __builtin__ BUILTIN_ANALYZERS = {} @@ -224,3 +227,7 @@ BUILTIN_ANALYZERS[os.path.join] = pathpart BUILTIN_ANALYZERS[os.path.exists] = test BUILTIN_ANALYZERS[os.path.isdir] = test + +# time stuff +BUILTIN_ANALYZERS[time.time] = time_func +BUILTIN_ANALYZERS[time.clock] = time_func From tismer at codespeak.net Fri May 6 14:14:29 2005 From: tismer at codespeak.net (tismer at codespeak.net) Date: Fri, 6 May 2005 14:14:29 +0200 (CEST) Subject: [pypy-svn] r12017 - pypy/dist/pypy/objspace/flow Message-ID: <20050506121429.82F6427B58@code1.codespeak.net> Author: tismer Date: Fri May 6 14:14:29 2005 New Revision: 12017 Modified: pypy/dist/pypy/objspace/flow/objspace.py Log: added a couple of exceptions. This is not ready and not really correct right now. We need to create extra _ovf operations. Modified: pypy/dist/pypy/objspace/flow/objspace.py ============================================================================== --- pypy/dist/pypy/objspace/flow/objspace.py (original) +++ pypy/dist/pypy/objspace/flow/objspace.py Fri May 6 14:14:29 2005 @@ -436,7 +436,8 @@ inplace_add inplace_sub inplace_mul inplace_truediv inplace_floordiv inplace_div inplace_mod inplace_pow inplace_lshift""", OverflowError) -_add_exceptions("""pow inplace_pow""", ValueError) +_add_exceptions("""pow inplace_pow lshift inplace_lshift rshift + inplace_rshift""", ValueError) _add_exceptions("""add sub mul truediv floordiv div mod divmod pow inplace_add inplace_sub inplace_mul inplace_truediv inplace_floordiv inplace_div inplace_mod inplace_divmod From tismer at codespeak.net Fri May 6 14:19:03 2005 From: tismer at codespeak.net (tismer at codespeak.net) Date: Fri, 6 May 2005 14:19:03 +0200 (CEST) Subject: [pypy-svn] r12018 - in pypy/dist/pypy: annotation translator translator/genc translator/genc/test translator/test Message-ID: <20050506121903.B690A27B58@code1.codespeak.net> Author: tismer Date: Fri May 6 14:19:03 2005 New Revision: 12018 Modified: pypy/dist/pypy/annotation/binaryop.py pypy/dist/pypy/translator/genc/ctyper.py pypy/dist/pypy/translator/genc/test/test_typed.py pypy/dist/pypy/translator/test/snippet.py pypy/dist/pypy/translator/transform.py Log: temporary check-in of a working version of ovfcheck handling. Please don't look into transform.py, this is completely a hack and will be replaced by the real one, today. I had to merge stuff before I get too big diffs. Modified: pypy/dist/pypy/annotation/binaryop.py ============================================================================== --- pypy/dist/pypy/annotation/binaryop.py (original) +++ pypy/dist/pypy/annotation/binaryop.py Fri May 6 14:19:03 2005 @@ -164,16 +164,17 @@ unsigned=unsigned) - add = mul = or_ = xor = _clone(union, []) - div = floordiv = mod = _clone(union, [ZeroDivisionError]) + or_ = xor = _clone(union, []) + add = mul = _clone(union, [OverflowError]) + div = floordiv = mod = _clone(union, [ZeroDivisionError, OverflowError]) def truediv((int1, int2)): return SomeFloat() - truediv.can_only_throw = [ZeroDivisionError] + truediv.can_only_throw = [ZeroDivisionError, OverflowError] def sub((int1, int2)): return SomeInteger(unsigned = int1.unsigned or int2.unsigned) - sub.can_only_throw = [] + sub.can_only_throw = [OverflowError] def and_((int1, int2)): unsigned = int1.unsigned or int2.unsigned @@ -185,14 +186,15 @@ if int1.unsigned: return SomeInteger(unsigned=True) return SomeInteger() - lshift.can_only_throw = [] + lshift.can_only_throw = [ValueError] rshift = lshift + lshift_ovf = _clone(lshift, [ValueError, OverflowError]) def pow((int1, int2), obj3): if int1.unsigned or int2.unsigned or getattr(obj3, 'unsigned', False): return SomeInteger(unsigned=True) return SomeInteger() - pow.can_only_throw = [ZeroDivisionError] + pow.can_only_throw = [ZeroDivisionError, OverflowError] class __extend__(pairtype(SomeBool, SomeBool)): Modified: pypy/dist/pypy/translator/genc/ctyper.py ============================================================================== --- pypy/dist/pypy/translator/genc/ctyper.py (original) +++ pypy/dist/pypy/translator/genc/ctyper.py Fri May 6 14:19:03 2005 @@ -44,32 +44,22 @@ ]) for op in "rshift".split(): specializationtable.extend([ - ('%s' % op, 'int_%s' % op) + ii_i, - ('inplace_%s' % op, 'int_%s' % op) + ii_i, - ('%s_val' % op, 'int_%s_val' % op) + ii_i, - ('inplace_%s_val' % op, 'int_%s_val' % op) + ii_i, + ('%s' % op, 'int_%s_val' % op) + ii_i, + ('inplace_%s' % op, 'int_%s_val' % op) + ii_i, ]) for op in "lshift".split(): specializationtable.extend([ - ('%s' % op, 'int_%s' % op) + ii_i, - ('inplace_%s' % op, 'int_%s' % op) + ii_i, - ('%s_ovf' % op, 'int_%s_ovf' % op) + ii_i, - ('inplace_%s_ovf' % op, 'int_%s_ovf' % op) + ii_i, - ('%s_val' % op, 'int_%s_val' % op) + ii_i, - ('inplace_%s_val' % op, 'int_%s_val' % op) + ii_i, - ('%s_ovf_val' % op, 'int_%s_ovf_val' % op) + ii_i, - ('inplace_%s_ovf_val' % op, 'int_%s_ovf_val' % op) + ii_i, + ('%s' % op, 'int_%s_val' % op) + ii_i, + ('inplace_%s' % op, 'int_%s_val' % op) + ii_i, + ('%s_ovf' % op, 'int_%s_ovf_val' % op) + ii_i, + ('inplace_%s_ovf' % op, 'int_%s_ovf_val' % op) + ii_i, ]) for op in "floordiv mod".split(): specializationtable.extend([ - ('%s' % op, 'int_%s' % op) + ii_i, - ('inplace_%s' % op, 'int_%s' % op) + ii_i, - ('%s_ovf' % op, 'int_%s_ovf' % op) + ii_i, - ('inplace_%s_ovf' % op, 'int_%s_ovf' % op) + ii_i, - ('%s_zer' % op, 'int_%s_zer' % op) + ii_i, - ('inplace_%s_zer' % op, 'int_%s_zer' % op) + ii_i, - ('%s_ovf_zer' % op, 'int_%s_ovf_zer' % op) + ii_i, - ('inplace_%s_ovf_zer' % op, 'int_%s_ovf_zer' % op) + ii_i, + ('%s' % op, 'int_%s_zer' % op) + ii_i, + ('inplace_%s' % op, 'int_%s_zer' % op) + ii_i, + ('%s_ovf' % op, 'int_%s_ovf_zer' % op) + ii_i, + ('inplace_%s_ovf' % op, 'int_%s_ovf_zer' % op) + ii_i, ]) # initialization Modified: pypy/dist/pypy/translator/genc/test/test_typed.py ============================================================================== --- pypy/dist/pypy/translator/genc/test/test_typed.py (original) +++ pypy/dist/pypy/translator/genc/test/test_typed.py Fri May 6 14:19:03 2005 @@ -8,7 +8,7 @@ from pypy.translator.genc.test.test_annotated import TestAnnotatedTestCase as _TestAnnotatedTestCase -class TestTypedTestCase:##!!(_TestAnnotatedTestCase): +class TestTypedTestCase(_TestAnnotatedTestCase): def getcompiled(self, func): t = Translator(func, simplifying=True) @@ -19,35 +19,31 @@ if isinstance(spec, tuple): spec = spec[0] # use the first type only for the tests argstypelist.append(spec) - t.view()##!! a = t.annotate(argstypelist) - t.view()##!! a.simplify() - t.view()##!! GenCSpecializer(a).specialize() - t.view()##!! t.checkgraphs() return skip_missing_compiler(t.ccompile) - def xxx_testint_overflow(self): + def test_int_overflow(self): fn = self.getcompiled(snippet.add_func) raises(OverflowError, fn, sys.maxint) - def xxx_testint_div_ovf_zer(self): + def test_int_div_ovf_zer(self): fn = self.getcompiled(snippet.div_func) raises(OverflowError, fn, -1) raises(ZeroDivisionError, fn, 0) - def testint_mod_ovf_zer(self): + def test_int_mod_ovf_zer(self): fn = self.getcompiled(snippet.mod_func) raises(OverflowError, fn, -1) raises(ZeroDivisionError, fn, 0) - def xxx_testint_rshift_val(self): + def test_int_rshift_val(self): fn = self.getcompiled(snippet.rshift_func) raises(ValueError, fn, -1) - def testint_lshift_ovf_val(self): + def test_int_lshift_ovf_val(self): fn = self.getcompiled(snippet.lshift_func) raises(ValueError, fn, -1) raises(OverflowError, fn, 1) Modified: pypy/dist/pypy/translator/test/snippet.py ============================================================================== --- pypy/dist/pypy/translator/test/snippet.py (original) +++ pypy/dist/pypy/translator/test/snippet.py Fri May 6 14:19:03 2005 @@ -84,6 +84,46 @@ def simple_func(i=numtype): return i + 1 +from pypy.tool.rarithmetic import ovfcheck, ovfcheck_lshift + +def add_func(i=numtype): + try: + return ovfcheck(i + 1) + except OverflowError: + raise + +from sys import maxint + +def div_func(i=numtype): + try: + return ovfcheck((-maxint-1) // i) + except OverflowError: + raise + except ZeroDivisionError: + raise + +def mod_func(i=numtype): + try: + return ovfcheck((-maxint-1) % i) + except OverflowError: + raise + except ZeroDivisionError: + raise + +def rshift_func(i=numtype): + try: + return (-maxint-1) >> i + except ValueError: + raise + +def lshift_func(i=numtype): + try: + return ovfcheck_lshift((-maxint-1), i) + except OverflowError: + raise + except ValueError: + raise + def while_func(i=numtype): total = 0 while i > 0: Modified: pypy/dist/pypy/translator/transform.py ============================================================================== --- pypy/dist/pypy/translator/transform.py (original) +++ pypy/dist/pypy/translator/transform.py Fri May 6 14:19:03 2005 @@ -96,7 +96,7 @@ return (ops and ops[-1].opname == "simple_call" and ops[-1].args[0] in covf) def is_single(bl): - return is_ovfcheck(bl) and len(bl.operations) > 1 + return is_ovfcheck(bl)## and len(bl.operations) > 1 def is_paired(bl): return bl.exits and is_ovfcheck(bl.exits[0].target) def rename(v): @@ -104,8 +104,15 @@ for block in fully_annotated_blocks(self): renaming = {} if is_single(block): - print 100*"*" - print block.operations[-2] + print 79*"*" + print block.operations + if block.operations[-1].args[0] == covf[-1]: # rewrite it + op = block.operations[-1] + op.opname = "lshift_ovf" # XXX + op.args = op.args[1:] + continue + if len(block.operations) < 2: + continue delop = block.operations.pop() op = block.operations[-1] assert len(delop.args) == 2 @@ -115,9 +122,14 @@ args = [rename(a) for a in exit.args] exits.append(Link(args, exit.target, exit.exitcase)) elif is_paired(block): - print 100*"+" - print block.operations[-1] + print 79*"+" + print block.operations ovfblock = block.exits[0].target + if ovfblock.operations[0].args[0] == covf[-1]: # rewrite it + op = ovfblock.operations[0] + op.opname = "lshift_ovf" # XXX + op.args = op.args[1:] + continue assert len(ovfblock.operations) == 1 op = block.operations[-1] exits = list(block.exits) @@ -128,7 +140,7 @@ assert len(ovfblock.exits) == 2 ovexp = ovfblock.exits[1] # space from block, last_ from ovfblock - args = exits[0].args[:1] + ovexp.args[1:] + args = exits[0].args[:len(ovexp.args)-2] + ovexp.args[-2:] exits.append(Link(args, ovexp.target, ovexp.exitcase)) block.exitswitch = ovfblock.exitswitch else: @@ -138,20 +150,75 @@ if exit.exitcase is Exception: bl = exit.target while len(bl.exits) == 2: - if bl.operations[0].args[-1] == covfExc: + lastoparg = bl.operations[0].args[-1] + del bl.operations[:] + bl.exitswitch = None + if lastoparg == covfExc: exit.exitcase = OverflowError - exit.target = bl.exits[1].target - assert len(exit.target.inputargs) == 1 - del exit.args[1:] # space only + bl.exits = [bl.exits[1]] + bl.exits[0].exitcase = None break else: + bl.exits = [bl.exits[0]] bl = bl.exits[0].target block.exits = [] block.recloseblock(*exits) # finally, mangle the operation name - apps = [op_appendices[exit.exitcase] for exit in block.exits[1:]] - apps.sort() - op.opname = '_'.join([op.opname]+apps) + #apps = [op_appendices[exit.exitcase] for exit in block.exits[1:]] + #apps.sort() + #if apps.count("ovf") == 2: apps.remove("ovf") # XXX HACK + op.opname += '_ovf' # .join([op.opname]+apps) + +def xxx_transform_ovfcheck(self): + """removes ovfcheck and ovfcheck_lshift calls""" + from pypy.tool.rarithmetic import ovfcheck, ovfcheck_lshift + covf = Constant(ovfcheck) + covflshift = Constant(ovfcheck_lshift) + covf_tests = covf, covflshift + + def get_ovfcheck(bl): + ops = bl.operations + if ops: + op = ops[-1] + if (op.opname == "simple_call" and op.args[0] in covf_tests): + return op.args[0] + return None + + def rename(v): + return renaming.get(v, v) + + for block in fully_annotated_blocks(self): + renaming = {} + func = get_ovfcheck(block) + if not func: + continue + if func == covf: + print 30*"*", "ovfcheck" + # it is considered a programming error if ovfcheck is + # called on an operation that cannot raise. + # That means ovfcheck must be the blocks's only operation + assert len(block.operations) == 1, """ovfcheck is called on +an operation that cannot raise an exception""" + # we remove the operation and error exits. + delop = block.operations.pop() + assert len(delop.args) == 2 + renaming[delop.result] = delop.args[1] + exits = [] + # leave the default exit, only + for exit in block.exits[:1]: + args = [rename(a) for a in exit.args] + exits.append(Link(args, exit.target, exit.exitcase)) + block.exits = exits + block.exitswitch = None + else: + print 30*"+", "ovfcheck_lshift" + # the only thing we have to do here is to replace + # the function call by an lshift operator + op = block.operations[-1] + op.opname = "lshift" + op.args = op.args[1:] # drop the function + + # a(*b) # --> # c = newtuple(*b) From arigo at codespeak.net Fri May 6 14:24:46 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Fri, 6 May 2005 14:24:46 +0200 (CEST) Subject: [pypy-svn] r12019 - pypy/dist/pypy/translator/genc/test Message-ID: <20050506122446.E6E4627B58@code1.codespeak.net> Author: arigo Date: Fri May 6 14:24:46 2005 New Revision: 12019 Added: pypy/dist/pypy/translator/genc/test/christian_test_typed.py - copied unchanged from r12018, pypy/dist/pypy/translator/genc/test/test_typed.py Removed: pypy/dist/pypy/translator/genc/test/test_typed.py Log: Moving out of the way, to re-enable the previous tests. Deleted: /pypy/dist/pypy/translator/genc/test/test_typed.py ============================================================================== --- /pypy/dist/pypy/translator/genc/test/test_typed.py Fri May 6 14:24:46 2005 +++ (empty file) @@ -1,50 +0,0 @@ -import autopath -import sys -from pypy.translator.genc.ctyper import GenCSpecializer -from pypy.translator.translator import Translator -from pypy.translator.test import snippet -from pypy.translator.tool.buildpyxmodule import skip_missing_compiler - -from pypy.translator.genc.test.test_annotated import TestAnnotatedTestCase as _TestAnnotatedTestCase - - -class TestTypedTestCase(_TestAnnotatedTestCase): - - def getcompiled(self, func): - t = Translator(func, simplifying=True) - # builds starting-types from func_defs - argstypelist = [] - if func.func_defaults: - for spec in func.func_defaults: - if isinstance(spec, tuple): - spec = spec[0] # use the first type only for the tests - argstypelist.append(spec) - a = t.annotate(argstypelist) - a.simplify() - GenCSpecializer(a).specialize() - t.checkgraphs() - return skip_missing_compiler(t.ccompile) - - def test_int_overflow(self): - fn = self.getcompiled(snippet.add_func) - raises(OverflowError, fn, sys.maxint) - - def test_int_div_ovf_zer(self): - fn = self.getcompiled(snippet.div_func) - raises(OverflowError, fn, -1) - raises(ZeroDivisionError, fn, 0) - - def test_int_mod_ovf_zer(self): - fn = self.getcompiled(snippet.mod_func) - raises(OverflowError, fn, -1) - raises(ZeroDivisionError, fn, 0) - - def test_int_rshift_val(self): - fn = self.getcompiled(snippet.rshift_func) - raises(ValueError, fn, -1) - - def test_int_lshift_ovf_val(self): - fn = self.getcompiled(snippet.lshift_func) - raises(ValueError, fn, -1) - raises(OverflowError, fn, 1) - \ No newline at end of file From arigo at codespeak.net Fri May 6 14:26:23 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Fri, 6 May 2005 14:26:23 +0200 (CEST) Subject: [pypy-svn] r12020 - pypy/dist/pypy/translator/genc/test Message-ID: <20050506122623.4746527B58@code1.codespeak.net> Author: arigo Date: Fri May 6 14:26:22 2005 New Revision: 12020 Added: pypy/dist/pypy/translator/genc/test/test_typed.py - copied unchanged from r12019, pypy/dist/pypy/translator/genc/test/christian_test_typed.py Removed: pypy/dist/pypy/translator/genc/test/christian_test_typed.py Log: Sorry, moved back in place. Didn't notice Christian was actively working on it. Deleted: /pypy/dist/pypy/translator/genc/test/christian_test_typed.py ============================================================================== --- /pypy/dist/pypy/translator/genc/test/christian_test_typed.py Fri May 6 14:26:22 2005 +++ (empty file) @@ -1,50 +0,0 @@ -import autopath -import sys -from pypy.translator.genc.ctyper import GenCSpecializer -from pypy.translator.translator import Translator -from pypy.translator.test import snippet -from pypy.translator.tool.buildpyxmodule import skip_missing_compiler - -from pypy.translator.genc.test.test_annotated import TestAnnotatedTestCase as _TestAnnotatedTestCase - - -class TestTypedTestCase(_TestAnnotatedTestCase): - - def getcompiled(self, func): - t = Translator(func, simplifying=True) - # builds starting-types from func_defs - argstypelist = [] - if func.func_defaults: - for spec in func.func_defaults: - if isinstance(spec, tuple): - spec = spec[0] # use the first type only for the tests - argstypelist.append(spec) - a = t.annotate(argstypelist) - a.simplify() - GenCSpecializer(a).specialize() - t.checkgraphs() - return skip_missing_compiler(t.ccompile) - - def test_int_overflow(self): - fn = self.getcompiled(snippet.add_func) - raises(OverflowError, fn, sys.maxint) - - def test_int_div_ovf_zer(self): - fn = self.getcompiled(snippet.div_func) - raises(OverflowError, fn, -1) - raises(ZeroDivisionError, fn, 0) - - def test_int_mod_ovf_zer(self): - fn = self.getcompiled(snippet.mod_func) - raises(OverflowError, fn, -1) - raises(ZeroDivisionError, fn, 0) - - def test_int_rshift_val(self): - fn = self.getcompiled(snippet.rshift_func) - raises(ValueError, fn, -1) - - def test_int_lshift_ovf_val(self): - fn = self.getcompiled(snippet.lshift_func) - raises(ValueError, fn, -1) - raises(OverflowError, fn, 1) - \ No newline at end of file From arigo at codespeak.net Fri May 6 18:02:47 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Fri, 6 May 2005 18:02:47 +0200 (CEST) Subject: [pypy-svn] r12025 - pypy/dist/pypy/translator Message-ID: <20050506160247.3DF7427B53@code1.codespeak.net> Author: arigo Date: Fri May 6 18:02:47 2005 New Revision: 12025 Modified: pypy/dist/pypy/translator/typer.py Log: Cannot attach a concretetype attribute in-place to an old Constant instance. Who knows who else is using it? Modified: pypy/dist/pypy/translator/typer.py ============================================================================== --- pypy/dist/pypy/translator/typer.py (original) +++ pypy/dist/pypy/translator/typer.py Fri May 6 18:02:47 2005 @@ -34,14 +34,15 @@ self.specialize_block(block) def settype(self, a, concretetype): - """Set the concretetype of a Variable or Constant.""" + """Set the concretetype of a Variable.""" + assert isinstance(a, Variable) if hasattr(a, 'concretetype') and a.concretetype != concretetype: raise TyperError, "inconsitent type for %r: %r != %r" % ( a, a.concretetype, concretetype) a.concretetype = concretetype def setbesttype(self, a): - """Set the best concretetype for a Variable or Constant according to + """Set the best concretetype for a Variable according to the annotations.""" try: return a.concretetype @@ -64,12 +65,9 @@ """Get the operation(s) needed to convert 'v' to the given type.""" ops = [] if isinstance(v, Constant): - try: - # mark the concrete type of the Constant - self.settype(v, concretetype) - except TyperError: - v = Constant(v.value) # need a copy of the Constant - self.settype(v, concretetype) + # we should never modify a Constant in-place + v = Constant(v.value) + v.concretetype = concretetype elif v.concretetype != concretetype: # XXX do we need better conversion paths? From arigo at codespeak.net Fri May 6 19:03:29 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Fri, 6 May 2005 19:03:29 +0200 (CEST) Subject: [pypy-svn] r12028 - pypy/dist/pypy/translator Message-ID: <20050506170329.CFFFF27B4D@code1.codespeak.net> Author: arigo Date: Fri May 6 19:03:29 2005 New Revision: 12028 Modified: pypy/dist/pypy/translator/translator.py Log: Cosmetics. Modified: pypy/dist/pypy/translator/translator.py ============================================================================== --- pypy/dist/pypy/translator/translator.py (original) +++ pypy/dist/pypy/translator/translator.py Fri May 6 19:03:29 2005 @@ -88,7 +88,7 @@ if self.simplifying: simplify_graph(graph) if self.verbose: - print 'done' + print self.flowgraphs[func] = graph self.functions.append(func) try: From pedronis at codespeak.net Fri May 6 19:19:27 2005 From: pedronis at codespeak.net (pedronis at codespeak.net) Date: Fri, 6 May 2005 19:19:27 +0200 (CEST) Subject: [pypy-svn] r12030 - pypy/dist/lib-python/modified-2.3.4/test Message-ID: <20050506171927.AFF3627B60@code1.codespeak.net> Author: pedronis Date: Fri May 6 19:19:27 2005 New Revision: 12030 Added: pypy/dist/lib-python/modified-2.3.4/test/test_descr.py - copied, changed from r12022, pypy/dist/lib-python/2.3.4/test/test_descr.py Log: modified test_descr such that a failure doesn't kill it completely Copied: pypy/dist/lib-python/modified-2.3.4/test/test_descr.py (from r12022, pypy/dist/lib-python/2.3.4/test/test_descr.py) ============================================================================== --- pypy/dist/lib-python/2.3.4/test/test_descr.py (original) +++ pypy/dist/lib-python/modified-2.3.4/test/test_descr.py Fri May 6 19:19:27 2005 @@ -3952,99 +3952,131 @@ except RuntimeError: pass +class NotRun(Exception): + pass + +def placeholder(func,msg): + def plh(): + raise NotRun,"Not run: %s!" % msg + return plh + def test_main(): - weakref_segfault() # Must be first, somehow - do_this_first() - class_docstrings() - lists() - dicts() - dict_constructor() - test_dir() - ints() - longs() - floats() - complexes() - spamlists() - spamdicts() - pydicts() - pylists() - metaclass() - pymods() - multi() - mro_disagreement() - diamond() - ex5() - monotonicity() - consistency_with_epg() - objects() - slots() - slotspecials() - dynamics() - errors() - classmethods() - classmethods_in_c() - staticmethods() - staticmethods_in_c() - classic() - compattr() - newslot() - altmro() - overloading() - methods() - specials() - weakrefs() - properties() - supers() - inherits() - keywords() - restricted() - str_subclass_as_dict_key() - classic_comparisons() - rich_comparisons() - coercions() - descrdoc() - setclass() - setdict() - pickles() - copies() - binopoverride() - subclasspropagation() - buffer_inherit() - str_of_str_subclass() - kwdargs() - delhook() - hashinherit() - strops() - deepcopyrecursive() - modules() - dictproxyiterkeys() - dictproxyitervalues() - dictproxyiteritems() - pickleslots() - funnynew() - imulbug() - docdescriptor() - string_exceptions() - copy_setstate() - slices() - subtype_resurrection() - slottrash() - slotmultipleinheritance() - testrmul() - testipow() - test_mutable_bases() - test_mutable_bases_with_failing_mro() - test_mutable_bases_catch_mro_conflict() - mutable_names() - subclass_right_op() - dict_type_with_metaclass() - meth_class_get() - isinst_isclass() - proxysuper() - carloverre() - filefault() + testfuncs = [ + weakref_segfault, # Must be first, somehow + do_this_first, + class_docstrings, + lists, + dicts, + dict_constructor, + test_dir, + ints, + longs, + floats, + complexes, + spamlists, + spamdicts, + pydicts, + pylists, + metaclass, + pymods, + multi, + mro_disagreement, + diamond, + ex5, + monotonicity, + consistency_with_epg, + objects, + slots, + slotspecials, + dynamics, + errors, + classmethods, + classmethods_in_c, + staticmethods, + staticmethods_in_c, + classic, + compattr, + newslot, + altmro, + overloading, + methods, + specials, + weakrefs, + properties, + supers, + inherits, + keywords, + restricted, + str_subclass_as_dict_key, + classic_comparisons, + rich_comparisons, + coercions, + descrdoc, + setclass, + setdict, + pickles, + copies, + binopoverride, + subclasspropagation, + buffer_inherit, + str_of_str_subclass, + kwdargs, + delhook, + hashinherit, + placeholder(strops,"PyPy starts mem trashing with this one"), + deepcopyrecursive, + modules, + dictproxyiterkeys, + dictproxyitervalues, + dictproxyiteritems, + pickleslots, + funnynew, + imulbug, + docdescriptor, + string_exceptions, + copy_setstate, + slices, + subtype_resurrection, + slottrash, + slotmultipleinheritance, + testrmul, + testipow, + test_mutable_bases, + test_mutable_bases_with_failing_mro, + test_mutable_bases_catch_mro_conflict, + mutable_names, + subclass_right_op, + dict_type_with_metaclass, + meth_class_get, + isinst_isclass, + proxysuper, + carloverre, + filefault,] + + #global verbose + #import test + #test.test_support.verbose = False + #verbose = False + + n = len(testfuncs) + success = 0 + + for testfunc in testfuncs: + try: + print "*"*40 + testfunc() + except Exception, e: + if isinstance(e, KeyboardInterrupt): + raise + print "-->", testfunc.__name__, "FAILURE(%d/%d)" % (success, n), str(e) + else: + success += 1 + print "-->", testfunc.__name__, "OK(%d/%d)" % (success, n) - if verbose: print "All OK" + if n != success: + raise TestFailed, "%d/%d" % (success, n) + else: + if verbose: print "All OK" if __name__ == "__main__": test_main() From pedronis at codespeak.net Fri May 6 19:27:23 2005 From: pedronis at codespeak.net (pedronis at codespeak.net) Date: Fri, 6 May 2005 19:27:23 +0200 (CEST) Subject: [pypy-svn] r12032 - pypy/dist/lib-python Message-ID: <20050506172723.D8FC827B55@code1.codespeak.net> Author: pedronis Date: Fri May 6 19:27:23 2005 New Revision: 12032 Modified: pypy/dist/lib-python/conftest.py Log: test_descr needs oldstyle Modified: pypy/dist/lib-python/conftest.py ============================================================================== --- pypy/dist/lib-python/conftest.py (original) +++ pypy/dist/lib-python/conftest.py Fri May 6 19:27:23 2005 @@ -424,9 +424,8 @@ RegrTest('test_curses.py', enabled=False, dumbtest=1), RegrTest('test_datetime.py', enabled=True, core=True), RegrTest('test_dbm.py', enabled=False, dumbtest=1), - RegrTest('test_descr.py', enabled=False, core=True), + RegrTest('test_descr.py', enabled=False, core=True, oldstyle=True), RegrTest('test_descrtut.py', enabled=False, core=True, oldstyle=True), - #rev 10840: 19 of 96 tests fail RegrTest('test_difflib.py', enabled=True, dumbtest=1, core=True), RegrTest('test_dircache.py', enabled=True, core=True), From arigo at codespeak.net Fri May 6 20:32:06 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Fri, 6 May 2005 20:32:06 +0200 (CEST) Subject: [pypy-svn] r12033 - pypy/dist/pypy/translator/genc Message-ID: <20050506183206.31E1827B52@code1.codespeak.net> Author: arigo Date: Fri May 6 20:32:05 2005 New Revision: 12033 Modified: pypy/dist/pypy/translator/genc/functype.py Log: Quick non-fix for functions taking default arguments. Modified: pypy/dist/pypy/translator/genc/functype.py ============================================================================== --- pypy/dist/pypy/translator/genc/functype.py (original) +++ pypy/dist/pypy/translator/genc/functype.py Fri May 6 20:32:05 2005 @@ -39,5 +39,7 @@ def spec_simple_call(self, typer, op): argtypes = [self] argtypes += self.argtypes + if len(argtypes) != len(op.args): + raise NotImplementedError # XXX default arguments, probably yield typer.typed_op(op, argtypes, self.returntype, newopname='direct_call') From arigo at codespeak.net Sat May 7 00:12:16 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Sat, 7 May 2005 00:12:16 +0200 (CEST) Subject: [pypy-svn] r12035 - in pypy/dist/pypy: interpreter objspace/std Message-ID: <20050506221216.6A04E27B5C@code1.codespeak.net> Author: arigo Date: Sat May 7 00:12:16 2005 New Revision: 12035 Modified: pypy/dist/pypy/interpreter/function.py pypy/dist/pypy/interpreter/pycode.py pypy/dist/pypy/objspace/std/dicttype.py pypy/dist/pypy/objspace/std/fake.py pypy/dist/pypy/objspace/std/floattype.py pypy/dist/pypy/objspace/std/inttype.py pypy/dist/pypy/objspace/std/listtype.py pypy/dist/pypy/objspace/std/longtype.py pypy/dist/pypy/objspace/std/objecttype.py pypy/dist/pypy/objspace/std/slicetype.py pypy/dist/pypy/objspace/std/stringtype.py pypy/dist/pypy/objspace/std/tupletype.py pypy/dist/pypy/objspace/std/typetype.py Log: Replace the calls to xyz.__init__() with known calls to XyzClass.__init__(xyz). Avoids annotator surprizes. Modified: pypy/dist/pypy/interpreter/function.py ============================================================================== --- pypy/dist/pypy/interpreter/function.py (original) +++ pypy/dist/pypy/interpreter/function.py Sat May 7 00:12:16 2005 @@ -181,10 +181,10 @@ self.w_class = w_class # possibly space.w_None def descr_method__new__(space, w_subtype, w_function, w_instance, w_class=None): - method = space.allocate_instance(Method, w_subtype) if space.is_w( w_instance, space.w_None ): w_instance = None - method.__init__(space, w_function, w_instance, w_class) + method = space.allocate_instance(Method, w_subtype) + Method.__init__(method, space, w_function, w_instance, w_class) return space.wrap(method) def __repr__(self): @@ -285,7 +285,7 @@ raise OperationError(space.w_TypeError, space.wrap("expected a function object")) bltin = space.allocate_instance(BuiltinFunction, w_subtype) - bltin.__init__(func) + BuiltinFunction.__init__(bltin, func) return space.wrap(bltin) def descr_function_repr(self): Modified: pypy/dist/pypy/interpreter/pycode.py ============================================================================== --- pypy/dist/pypy/interpreter/pycode.py (original) +++ pypy/dist/pypy/interpreter/pycode.py Sat May 7 00:12:16 2005 @@ -239,7 +239,7 @@ lnotab, w_freevars=NoneNotWrapped, w_cellvars=NoneNotWrapped): code = space.allocate_instance(PyCode, w_subtype) - code.__init__(space) + PyCode.__init__(code, space) code.co_argcount = argcount code.co_nlocals = nlocals code.co_stacksize = stacksize Modified: pypy/dist/pypy/objspace/std/dicttype.py ============================================================================== --- pypy/dist/pypy/objspace/std/dicttype.py (original) +++ pypy/dist/pypy/objspace/std/dicttype.py Sat May 7 00:12:16 2005 @@ -90,7 +90,7 @@ def descr__new__(space, w_dicttype, __args__): from pypy.objspace.std.dictobject import W_DictObject w_obj = space.allocate_instance(W_DictObject, w_dicttype) - w_obj.__init__(space, []) + W_DictObject.__init__(w_obj, space, []) return w_obj # ____________________________________________________________ Modified: pypy/dist/pypy/objspace/std/fake.py ============================================================================== --- pypy/dist/pypy/objspace/std/fake.py (original) +++ pypy/dist/pypy/objspace/std/fake.py Sat May 7 00:12:16 2005 @@ -86,7 +86,7 @@ wrap_exception(space) raise w_obj = space.allocate_instance(W_Fake, w_type) - w_obj.__init__(space, r) + W_Fake.__init__(w_obj, space, r) return w_obj kw['__new__'] = gateway.interp2app(fake__new__, Modified: pypy/dist/pypy/objspace/std/floattype.py ============================================================================== --- pypy/dist/pypy/objspace/std/floattype.py (original) +++ pypy/dist/pypy/objspace/std/floattype.py Sat May 7 00:12:16 2005 @@ -16,7 +16,7 @@ # whatever x.__float__() returned value = space.float_w(w_obj) w_obj = space.allocate_instance(W_FloatObject, w_floattype) - w_obj.__init__(space, value) + W_FloatObject.__init__(w_obj, space, value) return w_obj # ____________________________________________________________ Modified: pypy/dist/pypy/objspace/std/inttype.py ============================================================================== --- pypy/dist/pypy/objspace/std/inttype.py (original) +++ pypy/dist/pypy/objspace/std/inttype.py Sat May 7 00:12:16 2005 @@ -72,7 +72,7 @@ return w_longval else: w_obj = space.allocate_instance(W_IntObject, w_inttype) - w_obj.__init__(space, value) + W_IntObject.__init__(w_obj, space, value) return w_obj # ____________________________________________________________ Modified: pypy/dist/pypy/objspace/std/listtype.py ============================================================================== --- pypy/dist/pypy/objspace/std/listtype.py (original) +++ pypy/dist/pypy/objspace/std/listtype.py Sat May 7 00:12:16 2005 @@ -31,7 +31,7 @@ def descr__new__(space, w_listtype, __args__): from pypy.objspace.std.listobject import W_ListObject w_obj = space.allocate_instance(W_ListObject, w_listtype) - w_obj.__init__(space, []) + W_ListObject.__init__(w_obj, space, []) return w_obj # ____________________________________________________________ Modified: pypy/dist/pypy/objspace/std/longtype.py ============================================================================== --- pypy/dist/pypy/objspace/std/longtype.py (original) +++ pypy/dist/pypy/objspace/std/longtype.py Sat May 7 00:12:16 2005 @@ -58,7 +58,7 @@ space.wrap(e.msg)) w_obj = space.allocate_instance(W_LongObject, w_longtype) - w_obj.__init__(space, w_value.digits, w_value.sign) + W_LongObject.__init__(w_obj, space, w_value.digits, w_value.sign) return w_obj # ____________________________________________________________ Modified: pypy/dist/pypy/objspace/std/objecttype.py ============================================================================== --- pypy/dist/pypy/objspace/std/objecttype.py (original) +++ pypy/dist/pypy/objspace/std/objecttype.py Sat May 7 00:12:16 2005 @@ -31,7 +31,7 @@ space.wrap("default __new__ takes " "no parameters")) w_obj = space.allocate_instance(W_ObjectObject, w_type) - w_obj.__init__(space) + W_ObjectObject.__init__(w_obj, space) return w_obj def descr__hash__(space, w_obj): Modified: pypy/dist/pypy/objspace/std/slicetype.py ============================================================================== --- pypy/dist/pypy/objspace/std/slicetype.py (original) +++ pypy/dist/pypy/objspace/std/slicetype.py Sat May 7 00:12:16 2005 @@ -117,7 +117,7 @@ raise OperationError(space.w_TypeError, space.wrap("slice() takes at least 1 argument")) w_obj = space.allocate_instance(W_SliceObject, w_slicetype) - w_obj.__init__(space, w_start, w_stop, w_step) + W_SliceObject.__init__(w_obj, space, w_start, w_stop, w_step) return w_obj # descr__new__.unwrap_spec = [baseobjspace.ObjSpace, baseobjspace.W_Root, Modified: pypy/dist/pypy/objspace/std/stringtype.py ============================================================================== --- pypy/dist/pypy/objspace/std/stringtype.py (original) +++ pypy/dist/pypy/objspace/std/stringtype.py Sat May 7 00:12:16 2005 @@ -46,7 +46,7 @@ return w_obj # XXX might be reworked when space.str() typechecks value = space.str_w(w_obj) w_obj = space.allocate_instance(W_StringObject, w_stringtype) - w_obj.__init__(space, value) + W_StringObject.__init__(w_obj, space, value) return w_obj # ____________________________________________________________ Modified: pypy/dist/pypy/objspace/std/tupletype.py ============================================================================== --- pypy/dist/pypy/objspace/std/tupletype.py (original) +++ pypy/dist/pypy/objspace/std/tupletype.py Sat May 7 00:12:16 2005 @@ -11,7 +11,7 @@ else: tuple_w = space.unpackiterable(w_items) w_obj = space.allocate_instance(W_TupleObject, w_tupletype) - w_obj.__init__(space, tuple_w) + W_TupleObject.__init__(w_obj, space, tuple_w) return w_obj # ____________________________________________________________ Modified: pypy/dist/pypy/objspace/std/typetype.py ============================================================================== --- pypy/dist/pypy/objspace/std/typetype.py (original) +++ pypy/dist/pypy/objspace/std/typetype.py Sat May 7 00:12:16 2005 @@ -41,7 +41,8 @@ key = space.str_w(w_key) dict_w[key] = space.getitem(w_dict, w_key) w_type = space.allocate_instance(W_TypeObject, w_typetype) - w_type.__init__(space, name, bases_w or [space.w_object], dict_w) + W_TypeObject.__init__(w_type, space, name, bases_w or [space.w_object], + dict_w) return w_type def _precheck_for_new(space, w_type): From pedronis at codespeak.net Sat May 7 00:20:24 2005 From: pedronis at codespeak.net (pedronis at codespeak.net) Date: Sat, 7 May 2005 00:20:24 +0200 (CEST) Subject: [pypy-svn] r12036 - in pypy/dist/pypy: interpreter objspace/std Message-ID: <20050506222024.B159927B5C@code1.codespeak.net> Author: pedronis Date: Sat May 7 00:20:24 2005 New Revision: 12036 Modified: pypy/dist/pypy/interpreter/baseobjspace.py pypy/dist/pypy/objspace/std/floatobject.py pypy/dist/pypy/objspace/std/intobject.py pypy/dist/pypy/objspace/std/longobject.py pypy/dist/pypy/objspace/std/objspace.py Log: Add is_w to the irregular ops so that proxy and trace work after it is short-cut in std objspace. Done that: added a short-cut version of is_w to std objspace. Modified: pypy/dist/pypy/interpreter/baseobjspace.py ============================================================================== --- pypy/dist/pypy/interpreter/baseobjspace.py (original) +++ pypy/dist/pypy/interpreter/baseobjspace.py Sat May 7 00:20:24 2005 @@ -526,6 +526,7 @@ 'interpclass_w', 'unwrap', 'is_true', + 'is_w', 'newtuple', 'newlist', 'newstring', Modified: pypy/dist/pypy/objspace/std/floatobject.py ============================================================================== --- pypy/dist/pypy/objspace/std/floatobject.py (original) +++ pypy/dist/pypy/objspace/std/floatobject.py Sat May 7 00:20:24 2005 @@ -42,10 +42,7 @@ # a derived float object, where it should return # an exact one. def float__Float(space, w_float1): - # don't trigger a descr operation. - # XXX let's consider to change space.is_ to plain bool - #if space.is_true(space.is_(space.type(w_float1), space.w_float)): - if space.w_True is space.is_(space.type(w_float1), space.w_float): + if space.is_w(space.type(w_float1), space.w_float): return w_float1 a = w_float1.floatval return W_FloatObject(space, a) Modified: pypy/dist/pypy/objspace/std/intobject.py ============================================================================== --- pypy/dist/pypy/objspace/std/intobject.py (original) +++ pypy/dist/pypy/objspace/std/intobject.py Sat May 7 00:20:24 2005 @@ -390,10 +390,7 @@ # a derived integer object, where it should return # an exact one. def int__Int(space, w_int1): - # don't trigger a descr operation. - # XXX let's consider to change space.is_ to plain bool - #if space.is_true(space.is_(space.type(w_int1), space.w_int)): - if space.w_True is space.is_(space.type(w_int1), space.w_int): + if space.is_w(space.type(w_int1), space.w_int): return w_int1 a = w_int1.intval return W_IntObject(space, a) Modified: pypy/dist/pypy/objspace/std/longobject.py ============================================================================== --- pypy/dist/pypy/objspace/std/longobject.py (original) +++ pypy/dist/pypy/objspace/std/longobject.py Sat May 7 00:20:24 2005 @@ -103,10 +103,7 @@ # a derived long object, where it should return # an exact one. def long__Long(space, w_long1): - # don't trigger a descr operation. - # XXX let's consider to change space.is_ to plain bool - #if space.is_true(space.is_(space.type(w_long1), space.w_long)): - if space.w_True is space.is_(space.type(w_long1), space.w_long): + if space.is_w(space.type(w_long1), space.w_long): return w_long1 digits = w_long1.digits sign = w_long1.sign Modified: pypy/dist/pypy/objspace/std/objspace.py ============================================================================== --- pypy/dist/pypy/objspace/std/objspace.py (original) +++ pypy/dist/pypy/objspace/std/objspace.py Sat May 7 00:20:24 2005 @@ -309,6 +309,10 @@ return self.w_True return self.w_False + # short-cut + def is_w(self, w_one, w_two): + return w_one is w_two + def is_true(self, w_obj): # XXX don't look! if isinstance(w_obj, W_DictObject): From ale at codespeak.net Sat May 7 00:34:12 2005 From: ale at codespeak.net (ale at codespeak.net) Date: Sat, 7 May 2005 00:34:12 +0200 (CEST) Subject: [pypy-svn] r12037 - pypy/dist/lib-python/modified-2.3.4/test Message-ID: <20050506223412.85B2827B5C@code1.codespeak.net> Author: ale Date: Sat May 7 00:34:12 2005 New Revision: 12037 Modified: pypy/dist/lib-python/modified-2.3.4/test/test_codeccallbacks.py Log: I made some changes in order to get Cpython (and Pypy) using the the pypy version of codecs.py/_codecs.py and encoding package instead of the standard CPython modules Also changed some of the tests in order to test the codecs module and not unicode objects use of the codecs module.( changed u'...'.decode(...) to codecs.decode(u'...',...) Modified: pypy/dist/lib-python/modified-2.3.4/test/test_codeccallbacks.py ============================================================================== --- pypy/dist/lib-python/modified-2.3.4/test/test_codeccallbacks.py (original) +++ pypy/dist/lib-python/modified-2.3.4/test/test_codeccallbacks.py Sat May 7 00:34:12 2005 @@ -1,5 +1,19 @@ + import test.test_support, unittest -import sys, codecs, htmlentitydefs, unicodedata +import sys, htmlentitydefs, unicodedata +sys.path.insert(0,r'd:\projects\pypy_co') +sys.path.insert(0,r'd:\projects\pypy_co\pypy\lib') +sys.path.insert(0,r'd:\projects\pypy_co\lib-python\modified-2.3.4') +sys.path.insert(0,r'd:\projects\pypy_co\lib-python\2.3.4') +from pypy.lib import _codecs +sys.modules['_codecs'] = _codecs +from pypy.lib import encodings +sys.modules['encodings'] = encodings +from pypy.lib import codecs +sys.modules['codecs'] = codecs +reload(encodings) +reload(codecs) +assert codecs == encodings.codecs class PosReturn: # this can be used for configurable callbacks @@ -26,11 +40,11 @@ # in C and should be reasonably fast. s = u"\u30b9\u30d1\u30e2 \xe4nd eggs" self.assertEqual( - s.encode("ascii", "xmlcharrefreplace"), + codecs.encode(s,"ascii", "xmlcharrefreplace"), "スパモ änd eggs" ) self.assertEqual( - s.encode("latin-1", "xmlcharrefreplace"), + codecs.encode(s,"latin-1", "xmlcharrefreplace"), "スパモ \xe4nd eggs" ) @@ -79,14 +93,14 @@ codecs.register_error( "test.uninamereplace", uninamereplace) - + sin = u"\xac\u1234\u20ac\u8000" sout = "\033[1mNOT SIGN, ETHIOPIC SYLLABLE SEE, EURO SIGN, CJK UNIFIED IDEOGRAPH-8000\033[0m" self.assertEqual(codecs.encode(sin,"ascii", "test.uninamereplace"), sout) sout = "\xac\033[1mETHIOPIC SYLLABLE SEE, EURO SIGN, CJK UNIFIED IDEOGRAPH-8000\033[0m" - self.assertEqual(codecs.encode(sin,"latin-1", "test.uninamereplace"), sout) - + tout = codecs.encode(sin,"latin-1", "test.uninamereplace") + self.assertEqual(tout, sout) sout = "\xac\033[1mETHIOPIC SYLLABLE SEE\033[0m\xa4\033[1mCJK UNIFIED IDEOGRAPH-8000\033[0m" self.assertEqual(codecs.encode(sin,"iso-8859-15", "test.uninamereplace"), sout) @@ -163,6 +177,7 @@ if not isinstance(exc, UnicodeEncodeError) \ and not isinstance(exc, UnicodeDecodeError): raise TypeError("don't know how to handle %r" % exc) + l = [u"<%d>" % ord(exc.object[pos]) for pos in xrange(exc.start, exc.end)] return (u"[%s]" % u"".join(l), exc.end) @@ -631,6 +646,7 @@ # enhance coverage of: # Objects/unicodeobject.c::unicode_encode_call_errorhandler() # and callers + self.assertRaises(LookupError, codecs.decode,u"\xff", "ascii", "test.unknown") def badencodereturn1(exc): @@ -648,27 +664,27 @@ # Valid negative position handler.pos = -1 - self.assertEquals(u"\xff0".encode("ascii", "test.posreturn"), "0") + self.assertEquals(codecs.encode(u"\xff0","ascii", "test.posreturn"), "0") # Valid negative position handler.pos = -2 - self.assertEquals(u"\xff0".encode("ascii", "test.posreturn"), "") + self.assertEquals(codecs.encode(u"\xff0","ascii", "test.posreturn"), "") # Negative position out of bounds handler.pos = -3 - self.assertRaises(IndexError, u"\xff0".encode, "ascii", "test.posreturn") + self.assertRaises(IndexError, codecs.encode,u"\xff0", "ascii", "test.posreturn") # Valid positive position handler.pos = 1 - self.assertEquals(u"\xff0".encode("ascii", "test.posreturn"), "0") + self.assertEquals(codecs.encode(u"\xff0","ascii", "test.posreturn"), "0") # Largest valid positive position (one beyond end of input handler.pos = 2 - self.assertEquals(u"\xff0".encode("ascii", "test.posreturn"), "") + self.assertEquals(codecs.encode(u"\xff0","ascii", "test.posreturn"), "") # Invalid positive position handler.pos = 3 - self.assertRaises(IndexError, u"\xff0".encode, "ascii", "test.posreturn") + self.assertRaises(IndexError, codecs.encode,u"\xff0", "ascii", "test.posreturn") handler.pos = 0 From ale at codespeak.net Sat May 7 00:36:31 2005 From: ale at codespeak.net (ale at codespeak.net) Date: Sat, 7 May 2005 00:36:31 +0200 (CEST) Subject: [pypy-svn] r12038 - pypy/dist/lib-python/modified-2.3.4/test Message-ID: <20050506223631.EB55A27B5C@code1.codespeak.net> Author: ale Date: Sat May 7 00:36:31 2005 New Revision: 12038 Added: pypy/dist/lib-python/modified-2.3.4/test/test_codecs.py - copied, changed from r11917, pypy/dist/lib-python/2.3.4/test/test_codecs.py Log: inserted codecs,_codec and encoding into sys.modules Copied: pypy/dist/lib-python/modified-2.3.4/test/test_codecs.py (from r11917, pypy/dist/lib-python/2.3.4/test/test_codecs.py) ============================================================================== --- pypy/dist/lib-python/2.3.4/test/test_codecs.py (original) +++ pypy/dist/lib-python/modified-2.3.4/test/test_codecs.py Sat May 7 00:36:31 2005 @@ -1,5 +1,20 @@ from test import test_support import unittest +import sys +sys.path.insert(0,r'd:\projects\pypy_co') +sys.path.insert(0,r'd:\projects\pypy_co\pypy\lib') +sys.path.insert(0,r'd:\projects\pypy_co\lib-python\modified-2.3.4') +sys.path.insert(0,r'd:\projects\pypy_co\lib-python\2.3.4') +from pypy.lib import _codecs +sys.modules['_codecs'] = _codecs +from pypy.lib import encodings +sys.modules['encodings'] = encodings +from pypy.lib import codecs +sys.modules['codecs'] = codecs +reload(encodings) +reload(codecs) +assert codecs == encodings.codecs + import codecs import StringIO From ale at codespeak.net Sat May 7 00:43:50 2005 From: ale at codespeak.net (ale at codespeak.net) Date: Sat, 7 May 2005 00:43:50 +0200 (CEST) Subject: [pypy-svn] r12039 - pypy/dist/pypy/lib Message-ID: <20050506224350.9FEC527B5C@code1.codespeak.net> Author: ale Date: Sat May 7 00:43:50 2005 New Revision: 12039 Modified: pypy/dist/pypy/lib/_codecs.py Log: Some more test are passing (19 out of 26 tests in test_callbacks.py and 4 out 6 in test_codecs.py) Modified: pypy/dist/pypy/lib/_codecs.py ============================================================================== --- pypy/dist/pypy/lib/_codecs.py (original) +++ pypy/dist/pypy/lib/_codecs.py Sat May 7 00:43:50 2005 @@ -34,7 +34,7 @@ Copyright (c) Corporation for National Research Initiatives. """ -from pypy.lib.unicodecodec import * +from unicodecodec import * #/* --- Registry ----------------------------------------------------------- */ codec_search_path = [] @@ -107,7 +107,6 @@ """None """ res = PyUnicode_EncodeLatin1(obj,len(obj),errors) - #print res return res, len(res) # XXX MBCS codec might involve ctypes ? def mbcs_decode(): @@ -131,30 +130,31 @@ def utf_8_decode( data,errors='strict',final=None): """None """ - res = PyUnicode_DecodeUTF8Stateful(data, size, errors, final) + res = PyUnicode_DecodeUTF8Stateful(data, len(data), errors, final) return res,len(res) -# XXX + def raw_unicode_escape_decode( data,errors='strict'): """None """ - pass + res = PyUnicode_DecodeRawUnicodeEscape(data, len(data), errors) + return res,len(res) def utf_7_decode( data,errors='strict'): """None """ unistr = PyUnicode_DecodeUTF7(data,errors='strict') return unistr,len(unistr) -# XXX +# XXX unicode_escape_encode def unicode_escape_encode( obj,errors='strict'): """None """ pass -# XXX +# XXX latin_1_decode def latin_1_decode( data,errors='strict'): """None """ pass -# XXX +# XXX utf_16_decode def utf_16_decode( data,errors='strict'): """None """ @@ -186,12 +186,12 @@ return obj, len(obj) else: return PyUnicode_FromUnicode(obj,size),size -# XXX +# XXX utf_16_ex_decode def utf_16_ex_decode( data,errors='strict'): """None """ pass -# XXX Check if this is right +# XXX escape_decode Check if this is right def escape_decode(data,errors='strict'): """None """ @@ -254,12 +254,12 @@ """ res = PyUnicode_EncodeUTF8(obj,len(obj),errors) return res,len(res) -# XXX +# XXX utf_16_le_encode def utf_16_le_encode( obj,errors='strict'): """None """ pass -# XXX +# XXX utf_16_be_encode def utf_16_be_encode( obj,errors='strict'): """None """ @@ -272,12 +272,12 @@ return unistr,len(unistr) else: return unicode(unistr),len(unistr) -# XXX +# XXX utf_16_le_decode def utf_16_le_decode( data,errors='strict'): """None """ pass -# XXX +# XXX utf_16_be_decode def utf_16_be_decode( data,errors='strict'): """None """ @@ -295,18 +295,23 @@ else: raise TypeError("don't know how to handle %.400s in error callback"%exc) +Py_UNICODE_REPLACEMENT_CHARACTER = u"\ufffd" + def replace_errors(exc): - if isinstance(exc,(UnicodeDecodeError,UnicodeEncodeError)): + if isinstance(exc,UnicodeEncodeError): return u'?'*(exc.end-exc.start),exc.end + elif isinstance(exc,(UnicodeTranslateError,UnicodeDecodeError)): + return Py_UNICODE_REPLACEMENT_CHARACTER*(exc.end-exc.start),exc.end else: raise TypeError("don't know how to handle %.400s in error callback"%exc) def xmlcharrefreplace_errors(exc): if isinstance(exc,UnicodeEncodeError): - res = ['&#'] + res = [] for ch in exc.object[exc.start:exc.end]: - res.append(str(ord(ch))) - res.append(';') + res += '&#' + res += str(ord(ch)) + res += ';' return ''.join(res),exc.end else: raise TypeError("don't know how to handle %.400s in error callback"%type(exc)) @@ -314,7 +319,6 @@ def backslashreplace_errors(exc): if isinstance(exc,UnicodeEncodeError): p=[] - #print exc.start,exc.end for c in exc.object[exc.start:exc.end]: p.append('\\') oc = ord(c) From ale at codespeak.net Sat May 7 00:52:57 2005 From: ale at codespeak.net (ale at codespeak.net) Date: Sat, 7 May 2005 00:52:57 +0200 (CEST) Subject: [pypy-svn] r12040 - pypy/dist/pypy/lib Message-ID: <20050506225257.8A08D27B5C@code1.codespeak.net> Author: ale Date: Sat May 7 00:52:57 2005 New Revision: 12040 Modified: pypy/dist/pypy/lib/unicodecodec.py Log: Some more test are passing (19 out of 26 tests in test_callbacks.py and 4 out 6 in test_codecs.py) Modified: pypy/dist/pypy/lib/unicodecodec.py ============================================================================== --- pypy/dist/pypy/lib/unicodecodec.py (original) +++ pypy/dist/pypy/lib/unicodecodec.py Sat May 7 00:52:57 2005 @@ -25,6 +25,7 @@ Return the error handler for the specified error handling name or raise a LookupError, if no handler exists under this name. """ + try: err_handler = codec_error_registry[errors] except KeyError: @@ -71,7 +72,7 @@ def B64(n): return ("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[(n) & 0x3f]) def B64CHAR(c): - return (isalnum(c) or (c) == '+' or (c) == '/') + return (c.isalnum() or (c) == '+' or (c) == '/') def UB64(c): if (c) == '+' : return 62 @@ -85,10 +86,14 @@ return ord(c) + 4 def ENCODE(out, ch, bits) : + charvalue = 0 + for c in ch: + charvalue <<= 16 + charvalue += ord(c) while (bits >= 6): - out += B64(ord(ch) >> (bits-6)) + out += B64(charvalue >> (bits-6)) bits -= 6; - return ''.join(out),ch,bits + return out,ch,bits def DECODE(out, ch, bits, surrogate): while (bits >= 16): @@ -188,9 +193,8 @@ inShift = 0 i = 0 bitsleft = 0 - charsleft = 0 + charsleft = '' out = [] - #print len(s),type(s) for ch in s: if (not inShift) : if (ch == '+'): @@ -206,8 +210,8 @@ out += ch else: if (not SPECIAL(ch, encodeSetO, encodeWhiteSpace)): - out += B64(charsleft << (6-bitsleft)) - charsleft = 0 + out += B64(ord(charsleft) << (6-bitsleft)) + charsleft = '' bitsleft = 0 ## /* Characters not in the BASE64 set implicitly unshift the sequence ## so no '-' is required, except if the character is itself a '-' */ @@ -217,7 +221,7 @@ out += ch else: bitsleft += 16 - charsleft = (charsleft << 16) | ord(ch) + charsleft += ch #((ord(charsleft) << 16) | ord(ch)) out, charsleft, bitsleft = ENCODE(out, charsleft, bitsleft) ## /* If the next character is special then we dont' need to terminate @@ -242,7 +246,7 @@ i+=1 if (bitsleft): - out += B64(charsleft << (6-bitsleft) ) + out += [B64(ord(cc) << (6-bitsleft) ) for cc in charsleft] out += '-' return ''.join(out) @@ -335,8 +339,15 @@ handler = lookup_error(errors) x = handler(UnicodeDecodeError("ascii",s,pos, pos+1,"ordinal not in range(128)")) - p += x[0] - pos = x[1] + if isinstance(x[0],unicode): + + p += x[0] + else: + raise TypeError + if isinstance(x[1],(int,long)): + pos = x[1] + else: + raise TypeError return ''.join(p) #(encoding,p,collstart,collend,reason) def PyUnicode_EncodeASCII(p,size,errors): @@ -596,25 +607,18 @@ #### if (0 == WideCharToMultiByte(CP_ACP, 0, p, size, s, mbcssize, NULL, NULL)): #### raise UnicodeEncodeError, "Windows cannot decode the string %s" %p ## return s -def unicode_decode_call_errorhandler(errors, errorHandler, encoding, - reason, input, insize, startinpos, endinpos, exceptionObject): - - if not errorHandler: - errorHandler = lookup_error(errors) - - if not exceptionObject: - exceptionObject = UnicodeDecodeError(encoding, input, insize, startinpos, endinpos, reason) - else: - exceptionObject.start = startinpos - exceptionObject.ens = endinpos - exceptionObject.resason = reason +def unicode_decode_call_errorhandler(errors, encoding, + reason, input, startinpos, endinpos): + errorHandler = lookup_error(errors) + exceptionObject = UnicodeDecodeError(encoding, input, startinpos, endinpos, reason) res,newpos = errorHandler(exceptionObject) - if (newpos<0): - newpos = insize+newpos; - if newpos<0 or newpos>insize: - raise IndexError( "position %d from error handler out of bounds", newpos) - return res,newpos + +## if (newpos<0): +## newpos = len(input)+newpos; +## if newpos<0 or newpos>len(input): +## raise IndexError( "position %d from error handler out of bounds", newpos) + return res,newpos def PyUnicode_DecodeUTF8(s, size, errors): @@ -643,71 +647,86 @@ def PyUnicode_DecodeUTF8Stateful(s,size,errors,consumed): -##{ -## const char *starts = s; -## int n; -## int startinpos; -## int endinpos; -## int outpos; -## const char *e; -## PyUnicodeObject *unicode; -## Py_UNICODE *p; -## const char *errmsg = ""; -## PyObject *errorHandler = NULL; -## PyObject *exc = NULL; -## -## /* Note: size will always be longer than the resulting Unicode -## character count */ -## unicode = _PyUnicode_New(size); -## if (!unicode) -## return NULL; if (size == 0): if (consumed): - consumed = 0; + consumed = 0 return u'' - res = [] - for ch in s: + p = [] + pos = 0 + while pos < size: + ch = s[pos] if ord(ch) < 0x80: - res += ch + p += ch + pos += 1 continue n = utf8_code_length[ord(ch)] - startinpos = s.index(ch) + startinpos = pos if (startinpos + n > size): if (consumed): break else: errmsg = "unexpected end of data" - endinpos = size - p,outpos = unicode_decode_call_errorhandler( - errors, None, - "utf8", errmsg, - starts, size, startinpos, endinpos, s) + endinpos = size + res = unicode_decode_call_errorhandler( + errors, "utf8", errmsg, + s, startinpos, endinpos) + p += res[0] + pos = res[1] if n == 0: errmsg = "unexpected code byte" endinpos = startinpos+1 + res = unicode_decode_call_errorhandler( + errors, "utf8", errmsg, + s, startinpos, endinpos) + p += res[0] + pos = res[1] elif n == 1: errmsg = "internal error" endinpos = startinpos+1 + res = unicode_decode_call_errorhandler( + errors, "utf8", errmsg, + s, startinpos, endinpos) + p += res[0] + pos = res[1] elif n == 2: - if ((s[1] & 0xc0) != 0x80): + if ((ord(s[pos+1]) & 0xc0) != 0x80): errmsg = "invalid data" endinpos = startinpos+2 - c = ((ord(s[0]) & 0x1f) << 6) + (ord(s[1]) & 0x3f) - if c<0x80: - errmsg = "illegal encoding" - endinpos = startinpos+2 - + res = unicode_decode_call_errorhandler( + errors, "utf8", errmsg, + s, startinpos, endinpos) + p += res[0] + pos = res[1] else: - res += c - break + c = ((ord(s[pos]) & 0x1f) << 6) + (ord(s[pos+1]) & 0x3f) + if c<0x80: + errmsg = "illegal encoding" + endinpos = startinpos+2 + res = unicode_decode_call_errorhandler( + errors, "utf8", errmsg, + s, startinpos, endinpos) + p += res[0] + pos = res[1] + else: + p += unichr(c) + pos += n + #break elif n == 3: - if ((s[1] & 0xc0) != 0x80 or - (s[2] & 0xc0) != 0x80): + if ((ord(s[pos+1]) & 0xc0) != 0x80 or + (ord(s[pos+2]) & 0xc0) != 0x80): errmsg = "invalid data" endinpos = startinpos+3 - c = ((s[0] & 0x0f) << 12) + ((s[1] & 0x3f) << 6) + (s[2] & 0x3f) + res = unicode_decode_call_errorhandler( + errors, "utf8", errmsg, + s, startinpos, endinpos) + p += res[0] + pos = res[1] + else: + c = ((ord(s[pos]) & 0x0f) << 12) + \ + ((ord(s[pos+1]) & 0x3f) << 6) +\ + (ord(s[pos+2]) & 0x3f) ## /* Note: UTF-8 encodings of surrogates are considered ## legal UTF-8 sequences; ## @@ -715,107 +734,79 @@ ## to recombine the surrogates into a single code ## unit. ## */ - if c < 0x8000: - errmsg = "illegal encoding" - endinpos = startinpos+3 - else: - res += c -## p,outpos = unicode_decode_call_errorhandler( -## errors, None, -## "utf8", errmsg, -## starts, size, startinpos, endinpos, s) - -## ch = ((s[0] & 0x0f) << 12) + ((s[1] & 0x3f) << 6) + (s[2] & 0x3f); -## if (ch < 0x0800) { -## errmsg = "illegal encoding"; -## startinpos = s-starts; -## endinpos = startinpos+3; -## goto utf8Error; -## } -## else -## *p++ = (Py_UNICODE)ch; -## break; -## + if c < 0x8000: + errmsg = "illegal encoding" + endinpos = startinpos+3 + res = unicode_decode_call_errorhandler( + errors, "utf8", errmsg, + s, startinpos, endinpos) + p += res[0] + pos = res[1] + else: + p += unichr(c) + pos += n + if n == 4: + ## case 4: -## if ((s[1] & 0xc0) != 0x80 || -## (s[2] & 0xc0) != 0x80 || -## (s[3] & 0xc0) != 0x80) { -## errmsg = "invalid data"; -## startinpos = s-starts; -## endinpos = startinpos+4; -## goto utf8Error; -## } -## ch = ((s[0] & 0x7) << 18) + ((s[1] & 0x3f) << 12) + -## ((s[2] & 0x3f) << 6) + (s[3] & 0x3f); -## /* validate and convert to UTF-16 */ -## if ((ch < 0x10000) /* minimum value allowed for 4 -## byte encoding */ -## || (ch > 0x10ffff)) /* maximum value allowed for -## UTF-16 */ -## { -## errmsg = "illegal encoding"; -## startinpos = s-starts; -## endinpos = startinpos+4; -## goto utf8Error; -## } -###ifdef Py_UNICODE_WIDE -## *p++ = (Py_UNICODE)ch; -###else -## /* compute and append the two surrogates: */ -## -## /* translate from 10000..10FFFF to 0..FFFF */ -## ch -= 0x10000; -## -## /* high surrogate = top 10 bits added to D800 */ -## *p++ = (Py_UNICODE)(0xD800 + (ch >> 10)); -## -## /* low surrogate = bottom 10 bits added to DC00 */ -## *p++ = (Py_UNICODE)(0xDC00 + (ch & 0x03FF)); -###endif -## break; -## + if ((ord(s[1]) & 0xc0) != 0x80 or + (ord(s[2]) & 0xc0) != 0x80 or + (ord(s[3]) & 0xc0) != 0x80): + + errmsg = "invalid data" + startinpos = pos + endinpos = startinpos+4 + res = unicode_decode_call_errorhandler( + errors, "utf8", errmsg, + s, startinpos, endinpos) + p += res[0] + pos = res[1] + else: + c = ((ord(s[0]) & 0x7) << 18) + ((ord(s[1]) & 0x3f) << 12) +\ + ((ord(s[2]) & 0x3f) << 6) + (ord(s[3]) & 0x3f) + #/* validate and convert to UTF-16 */ + if ((c < 0x10000) or (c > 0x10ffff)): + #/* minimum value allowed for 4 byte encoding */ + #/* maximum value allowed for UTF-16 */ + + errmsg = "illegal encoding" + startinpos = pos + endinpos = startinpos+4 + res = unicode_decode_call_errorhandler( + errors, "utf8", errmsg, + s, startinpos, endinpos) + p += res[0] + pos = res[1] + else: + #ifdef Py_UNICODE_WIDE + if c> 10)) + #/* low surrogate = bottom 10 bits added to DC00 */ + p += unichr(0xDC00 + (c & 0x03FF)) + pos += n + else: ## default: ## /* Other sizes are only needed for UCS-4 */ -## errmsg = "unsupported Unicode code range"; -## startinpos = s-starts; -## endinpos = startinpos+n; -## goto utf8Error; -## } -## s += n; -## continue; -## -## utf8Error: -## outpos = p-PyUnicode_AS_UNICODE(unicode); -## if (unicode_decode_call_errorhandler( -## errors, &errorHandler, -## "utf8", errmsg, -## starts, size, &startinpos, &endinpos, &exc, &s, -## (PyObject **)&unicode, &outpos, &p)) -## goto onError; -## } -## if (consumed) -## *consumed = s-starts; -## -## /* Adjust length */ -## if (_PyUnicode_Resize(&unicode, p - unicode->str) < 0) -## goto onError; -## -## Py_XDECREF(errorHandler); -## Py_XDECREF(exc); -## return (PyObject *)unicode; -## -##onError: -## Py_XDECREF(errorHandler); -## Py_XDECREF(exc); -## Py_DECREF(unicode); -## return NULL; -##} -## -##/* Allocation strategy: if the string is short, convert into a stack buffer -## and allocate exactly as much space needed at the end. Else allocate the -## maximum possible needed (4 result bytes per Unicode character), and return -## the excess memory at the end. -##*/ + errmsg = "unsupported Unicode code range"; + startinpos = pos + endinpos = startinpos+n + res = unicode_decode_call_errorhandler( + errors, "utf8", errmsg, + s, startinpos, endinpos) + p += res[0] + pos = res[1] + + #continue + + if (consumed): + consumed = pos + return u''.join(p) def PyUnicode_EncodeUTF8(s,size,errors): @@ -831,8 +822,8 @@ p += ch elif (ord(ch) < 0x0800) : ## /* Encode Latin-1 */ - p += chr((0xc0 | (ch >> 6))) - p += chr((0x80 | (ch & 0x3f))) + p += chr((0xc0 | (ord(ch) >> 6))) + p += chr((0x80 | (ord(ch) & 0x3f))) else: ## /* Encode UCS2 Unicode ordinals */ if (ord(ch) < 0x10000): @@ -913,8 +904,8 @@ pos += 1 else: #/* startpos for collecting unencodable chars */ - collstart = p.index(ch) - collend = p.index(ch)+1 + collstart = pos + collend = pos+1 while collend < len(p) and ord(p[collend]) >= limit: collend += 1 @@ -942,7 +933,6 @@ pos = x[1] else: try: - #print s[pos:pos+digits],errors chr = int(s[pos:pos+digits],16) except ValueError: endinpos = pos @@ -950,8 +940,12 @@ handler = lookup_error(errors) x = handler(UnicodeDecodeError("unicodeescape",s,pos-2, endinpos+1,message)) - p += x[0] - pos = x[1] + if (isinstance(x,tuple) and isinstance(x[0],(str,unicode)) and + isinstance(x[1],(int,long))): + p += x[0] + pos = x[1] + else: + raise TypeError # /* when we get here, chr is a 32-bit unicode character */ else: if chr < sys.maxunicode: @@ -974,99 +968,78 @@ return res,pos def PyUnicode_DecodeUnicodeEscape(s, size, errors): -## -## const char *starts = s; -## int startinpos; -## int endinpos; -## int outpos; -## int i; -## PyUnicodeObject *v; -## Py_UNICODE *p; -## const char *end; -## char* message; -## Py_UCS4 chr = 0xffffffff; /* in case 'getcode' messes up */ -## PyObject *errorHandler = NULL; -## PyObject *exc = NULL; -## /* Escaped strings will always be longer than the resulting -## Unicode string, so we start with size here and then reduce the -## length after conversion to the true value. -## (but if the error callback returns a long replacement string -## we'll have to allocate more space) */ - if (size == 0): return u'' p = [] pos = 0 while (pos < size): -## unsigned char c; -## Py_UNICODE x; -## int digits; - ## /* Non-escape characters are interpreted as Unicode ordinals */ if (s[pos] != '\\') : p += s[pos] pos += 1 continue - ## /* \ - Escapes */ - pos +=1 - ch = s[pos] - -## /* \x escapes */ - #if ch == '\n': break; - if ch == '\\': p += '\\' - if ch == '\'': p += '\'' - if ch == '\"': p += '\"' - if ch == 'b': p += '\b' - if ch == 'f': p += '\014' #/* FF */ - if ch == 't': p += '\t' - if ch == 'n': p += '\n' - if ch == 'r': p += '\r' - if ch == 'v': p += '\013' #break; /* VT */ - if ch == 'a': p += '\007' # break; /* BEL, not classic C */ - -## /* \OOO (octal) escapes */ - if ch in [ '0','1', '2', '3','4', '5', '6','7']: - x = ord(ch) - ord('0') - ch = s[pos+1] - if ('0' <= ch and ch <= '7'): - x = (x<<3) + ord(ch) - ord('0') - ch = s[pos+2] + else: + pos +=1 + if pos>=len(s): + break + ch = s[pos] + + ## /* \x escapes */ + #if ch == '\n': break; + if ch == '\\': p += '\\' + elif ch == '\'': p += '\'' + elif ch == '\"': p += '\"' + elif ch == 'b': p += '\b' + elif ch == 'f': p += '\014' #/* FF */ + elif ch == 't': p += '\t' + elif ch == 'n': p += '\n' + elif ch == 'r': p += '\r' + elif ch == 'v': p += '\013' #break; /* VT */ + elif ch == 'a': p += '\007' # break; /* BEL, not classic C */ + + ## /* \OOO (octal) escapes */ + elif ch in [ '0','1', '2', '3','4', '5', '6','7']: + x = ord(ch) - ord('0') + ch = s[pos+1] if ('0' <= ch and ch <= '7'): x = (x<<3) + ord(ch) - ord('0') - pos += 3 - - p += unichr(x) -## /* hex escapes */ -## /* \xXX */ - if ch == 'x': - digits = 2; - message = "truncated \\xXX escape"; - x = hexescape(s,pos+1,digits,message,errors) - p += x[0] - pos = x[1] - - # /* \uXXXX */ - if ch == 'u': - digits = 4; - message = "truncated \\uXXXX escape"; - x = hexescape(s,pos+1,digits,message,errors) - p += x[0] - pos = x[1] - - # /* \UXXXXXXXX */ - if ch == 'U': - digits = 8; - message = "truncated \\UXXXXXXXX escape"; - x = hexescape(s,pos+1,digits,message,errors) - p += x[0] - pos = x[1] - + ch = s[pos+2] + if ('0' <= ch and ch <= '7'): + x = (x<<3) + ord(ch) - ord('0') + pos += 3 + + p += unichr(x) + ## /* hex escapes */ + ## /* \xXX */ + elif ch == 'x': + digits = 2; + message = "truncated \\xXX escape"; + x = hexescape(s,pos+1,digits,message,errors) + p += x[0] + pos = x[1] + + # /* \uXXXX */ + elif ch == 'u': + digits = 4; + message = "truncated \\uXXXX escape"; + x = hexescape(s,pos+1,digits,message,errors) + p += x[0] + pos = x[1] + + # /* \UXXXXXXXX */ + elif ch == 'U': + digits = 8; + message = "truncated \\UXXXXXXXX escape"; + x = hexescape(s,pos+1,digits,message,errors) + p += x[0] + pos = x[1] + ## /* \N{name} */ -## if ch == 'N': +## elif ch == 'N': ## message = "malformed \\N character escape"; ## if (ucnhash_CAPI == NULL) { ## /* load the unicode data module */ @@ -1105,6 +1078,9 @@ ## (PyObject **)&v, &outpos, &p)) ## goto onError; ## break; + else: + p += '\\' + p += s[pos] if (pos > size): message = "\\ at end of string" ## endinpos = s-starts; @@ -1121,10 +1097,7 @@ ## (PyObject **)&v, &outpos, &p)) ## goto onError; - else: - p += '\\' - p += s[pos] - + return ''.join(p) def PyUnicode_EncodeRawUnicodeEscape(s,size): @@ -1153,9 +1126,12 @@ def charmapencode_output(c,mapping): + rep = mapping[c] if isinstance(rep,(int,long)): - return str(rep) + return chr(rep) + elif isinstance(rep,unicode): + raise TypeError else: return rep @@ -1175,19 +1151,20 @@ while (inpos")) - #print x[0],type(x[0]) - res += [charmapencode_output(ord(y),mapping) for y in x[0]] - #print res - #else: + try: + res += [charmapencode_output(ord(y),mapping) for y in x[0]] + except KeyError: + raise UnicodeEncodeError("charmap",p,inpos,inpos+1, + "character maps to ") + #/* done with this character => adjust input position */ inpos+=1 - #print res return ''.join(res) def PyUnicode_DecodeCharmap(s, size, mapping, errors): @@ -1225,5 +1202,4 @@ "character mapping must return integer, None or unicode")) p += x[0]#[mapping[ord(y)] for y in x[0]] inpos +=1 - #print p - return u''.join(p) \ No newline at end of file + return u''.join(p) From arigo at codespeak.net Sat May 7 00:57:12 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Sat, 7 May 2005 00:57:12 +0200 (CEST) Subject: [pypy-svn] r12041 - in pypy/dist/pypy/objspace/std: . test Message-ID: <20050506225712.3621127B5C@code1.codespeak.net> Author: arigo Date: Sat May 7 00:57:12 2005 New Revision: 12041 Modified: pypy/dist/pypy/objspace/std/stringobject.py pypy/dist/pypy/objspace/std/stringtype.py pypy/dist/pypy/objspace/std/test/test_stringobject.py Log: Added missing default arguments in string methods. Also added new Python 2.4 default arguments. Removed the outdated docstring. Modified: pypy/dist/pypy/objspace/std/stringobject.py ============================================================================== --- pypy/dist/pypy/objspace/std/stringobject.py (original) +++ pypy/dist/pypy/objspace/std/stringobject.py Sat May 7 00:57:12 2005 @@ -1,78 +1,4 @@ # -*- Coding: Latin-1 -*- -""" -stringobject.py - -this is here: - to not confuse python-mode - -Synopsis of implemented methods (* marks work in progress) - -Py PyPy - - def _is_generic(w_self, fun): - def mod__String_ANY(space, w_str, w_item):def mod__String_Tuple(space, w_str, w_tuple):def mod_str_tuple(space, w_format, w_args): - def ord__String(space, w_str): - def string_richcompare(space, w_str1, w_str2, op): - def str_w__String(space, w_str): -__add__ def add__String_String(space, w_left, w_right): -__class__ -__contains__ -__delattr__ -__doc__ -__eq__ def eq__String_String(space, w_str1, w_str2): -__ge__ def ge__String_String(space, w_str1, w_str2): -__getattribute__ -__getitem__ def getitem__String_ANY(space, w_str, w_int): def getitem__String_Slice(space, w_str, w_slice): -__getslice__ -__gt__ def gt__String_String(space, w_str1, w_str2): -__hash__ def hash__String(space, w_str): -__init__ -__le__ def le__String_String(space, w_str1, w_str2): -__len__ def len__String(space, w_str): -__lt__ def lt__String_String(space, w_str1, w_str2): -__mul__ -__ne__ def ne__String_String(space, w_str1, w_str2): -__new__ -__reduce__ -__repr__ def repr__String(space, w_str): -__rmul__ -__setattr__ -__str__ def str__String(space, w_str): -capitalize def str_capitalize__String(space, w_self): -center def str_center__String_ANY(space, w_self): -count def str_count__String_String_ANY_ANY(space, w_self): [optional arguments not supported now] -decode !Unicode not supported now -encode !Unicode not supported now -endswith str_endswith__String_String [optional arguments not supported now] -expandtabs str_expandtabs__String_ANY -find OK -index OK -isalnum def str_isalnum__String(space, w_self): def _isalnum(ch): -isalpha def str_isalpha__String(space, w_self): def _isalpha(ch): -isdigit def str_isdigit__String(space, w_self): def _isdigit(ch): -islower def str_islower__String(space, w_self): def _islower(ch): -isspace def str_isspace__String(space, w_self): def _isspace(ch): -istitle def str_istitle(space, w_self): -isupper def str_isupper__String(space, w_self): def _isupper(ch): -join def str_join__String_ANY(space, w_self, w_list): -ljust def str_ljust__String_ANY(space, w_self, w_arg): -lower OK -lstrip def str_lstrip__String_String(space, w_self, w_chars): -replace OK -rfind OK -rindex OK -rjust def str_rjust__String_ANY(space, w_self, w_arg): -rstrip def str_rstrip__String_String(space, w_self, w_chars): -split def str_split__String_None_ANY(space, w_self, w_none, w_maxsplit=-1):def str_split__String_String_ANY(space, w_self, w_by, w_maxsplit=-1): -splitlines def str_splitlines__String_String(space, w_self, w_keepends): -startswith str_startswith__String_String [optional arguments not supported now] -strip def str_strip__String_String(space, w_self, w_chars): -swapcase OK -title def str_title__String(space, w_self): -translate OK -upper def str_upper__String(space, w_self): -zfill OK -""" from pypy.objspace.std.objspace import * from pypy.interpreter import gateway @@ -376,26 +302,35 @@ return space.wrap("") -def str_rjust__String_ANY(space, w_self, w_arg): +def str_rjust__String_ANY_ANY(space, w_self, w_arg, w_fillchar): u_arg = space.int_w(w_arg) u_self = w_self._value + fillchar = space.str_w(w_fillchar) + if len(fillchar) != 1: + raise OperationError(space.w_TypeError, + space.wrap("rjust() argument 2 must be a single character")) + d = u_arg - len(u_self) if d>0: - u_self = d * ' ' + u_self + u_self = d * fillchar + u_self return space.wrap(u_self) -def str_ljust__String_ANY(space, w_self, w_arg): +def str_ljust__String_ANY_ANY(space, w_self, w_arg, w_fillchar): u_self = w_self._value u_arg = space.int_w(w_arg) + fillchar = space.str_w(w_fillchar) + if len(fillchar) != 1: + raise OperationError(space.w_TypeError, + space.wrap("ljust() argument 2 must be a single character")) d = u_arg - len(u_self) if d>0: - u_self += d * ' ' + u_self += d * fillchar return space.wrap(u_self) @@ -601,14 +536,18 @@ return _strip_none(space, w_self, left=1, right=0) -def str_center__String_ANY(space, w_self, w_arg): +def str_center__String_ANY_ANY(space, w_self, w_arg, w_fillchar): u_self = w_self._value u_arg = space.int_w(w_arg) + fillchar = space.str_w(w_fillchar) + if len(fillchar) != 1: + raise OperationError(space.w_TypeError, + space.wrap("center() argument 2 must be a single character")) d = u_arg - len(u_self) if d>0: offset = d//2 - u_centered = offset * ' ' + u_self + (d - offset) * ' ' + u_centered = offset * fillchar + u_self + (d - offset) * fillchar else: u_centered = u_self @@ -636,36 +575,28 @@ return W_IntObject(space, count) -#[optional arguments not supported now] -def str_endswith__String_String(space, w_self, w_end): - u_self = w_self._value - u_end = w_end._value - - found = 0 - if u_end: - endlen = len(u_end) - if endlen <= len(u_self): - found = (u_end == u_self[-endlen:]) - else: - found = 1 - - return space.newbool(found) - +def str_endswith__String_String_ANY_ANY(space, w_self, w_suffix, w_start, w_end): + (u_self, suffix, start, end) = _convert_idx_params(space, w_self, + w_suffix, w_start, w_end) + begin = end - len(suffix) + if begin < start: + return space.w_False + for i in range(len(suffix)): + if u_self[begin+i] != suffix[i]: + return space.w_False + return space.w_True -def str_startswith__String_String_ANY(space, w_self, w_prefix, w_start): - u_self = w_self._value - u_prefix = w_prefix._value - u_start = space.int_w(w_start) - found = 0 - if u_prefix: - plen = len(u_prefix) - if u_start + plen <= len(u_self): - found = (u_prefix == u_self[u_start:u_start+plen]) - else: - found = 1 - - return space.newbool(found) +def str_startswith__String_String_ANY_ANY(space, w_self, w_prefix, w_start, w_end): + (u_self, prefix, start, end) = _convert_idx_params(space, w_self, + w_prefix, w_start, w_end) + stop = start + len(prefix) + if stop > end: + return space.w_False + for i in range(len(prefix)): + if u_self[start+i] != prefix[i]: + return space.w_False + return space.w_True def _tabindent(u_token, u_tabsize): @@ -740,8 +671,6 @@ if len(input) >= width: return w_self - b = width - len(input) - buf = [' '] * width if len(input) > 0 and (input[0] == '+' or input[0] == '-'): buf[0] = input[0] @@ -981,8 +910,6 @@ app = gateway.applevel(r''' - import codecs - def str_translate__String_ANY_ANY(s, table, deletechars=''): """charfilter - unicode handling is not implemented @@ -1017,6 +944,7 @@ return repr def str_decode__String_ANY_ANY(str, encoding=None, errors=None): + import codecs if encoding is None and errors is None: return unicode(str) elif errors is None: Modified: pypy/dist/pypy/objspace/std/stringtype.py ============================================================================== --- pypy/dist/pypy/objspace/std/stringtype.py (original) +++ pypy/dist/pypy/objspace/std/stringtype.py Sat May 7 00:57:12 2005 @@ -12,8 +12,8 @@ str_islower = MultiMethod('islower', 1) str_istitle = MultiMethod('istitle', 1) str_isalnum = MultiMethod('isalnum', 1) -str_ljust = MultiMethod('ljust', 2) -str_rjust = MultiMethod('rjust', 2) +str_ljust = MultiMethod('ljust', 3, defaults=(' ',)) +str_rjust = MultiMethod('rjust', 3, defaults=(' ',)) str_upper = MultiMethod('upper', 1) str_lower = MultiMethod('lower', 1) str_swapcase = MultiMethod('swapcase', 1) @@ -28,12 +28,12 @@ str_strip = MultiMethod('strip', 2, defaults=(None,)) str_rstrip = MultiMethod('rstrip', 2, defaults=(None,)) str_lstrip = MultiMethod('lstrip', 2, defaults=(None,)) -str_center = MultiMethod('center', 2, ) +str_center = MultiMethod('center', 3, defaults=(' ',)) str_count = MultiMethod('count', 4, defaults=(0, maxint)) -str_endswith = MultiMethod('endswith', 2) #[optional arguments not supported now] +str_endswith = MultiMethod('endswith', 4, defaults=(0, maxint)) str_expandtabs = MultiMethod('expandtabs', 2, defaults=(8,)) str_splitlines = MultiMethod('splitlines', 2, defaults=(0,)) -str_startswith = MultiMethod('startswith', 3, defaults=(0,)) +str_startswith = MultiMethod('startswith', 4, defaults=(0, maxint)) str_translate = MultiMethod('translate', 3, defaults=('',)) #unicode mimic not supported now str_decode = MultiMethod('decode', 3, defaults=(None, None)) Modified: pypy/dist/pypy/objspace/std/test/test_stringobject.py ============================================================================== --- pypy/dist/pypy/objspace/std/test/test_stringobject.py (original) +++ pypy/dist/pypy/objspace/std/test/test_stringobject.py Sat May 7 00:57:12 2005 @@ -181,6 +181,8 @@ assert 'abc'.rjust(6) == ' abc' assert 'abc'.rjust(3) == 'abc' assert 'abc'.rjust(2) == 'abc' + assert 'abc'.rjust(5, '*') == '**abc' # Python 2.4 + raises(TypeError, 'abc'.rjust, 5, 'xx') def test_ljust(self): s = "abc" @@ -192,6 +194,8 @@ assert 'abc'.ljust(6) == 'abc ' assert 'abc'.ljust(3) == 'abc' assert 'abc'.ljust(2) == 'abc' + assert 'abc'.ljust(5, '*') == 'abc**' # Python 2.4 + raises(TypeError, 'abc'.ljust, 6, '') def test_replace(self): assert 'one!two!three!'.replace('!', '@', 1) == 'one at two!three!' @@ -253,6 +257,8 @@ assert 'abc'.center(6) == ' abc ' assert 'abc'.center(3) == 'abc' assert 'abc'.center(2) == 'abc' + assert 'abc'.center(5, '*') == '*abc*' # Python 2.4 + raises(TypeError, 'abc'.center, 4, 'cba') def test_count(self): @@ -282,6 +288,8 @@ assert 'ab'.startswith('a', 0) is True assert 'ab'.startswith('a', 1) is False assert 'ab'.startswith('b', 1) is True + assert 'abc'.startswith('bc', 1, 2) is False + assert 'abc'.startswith('c', -1, 4) is True def test_endswith(self): assert 'ab'.endswith('ab') is True @@ -293,6 +301,12 @@ assert ''.endswith('a') is False assert 'x'.endswith('xx') is False assert 'y'.endswith('xx') is False + + def test_endswith_more(self): + assert 'abc'.endswith('ab', 0, 2) is True + assert 'abc'.endswith('bc', 1) is True + assert 'abc'.endswith('bc', 2) is False + assert 'abc'.endswith('b', -3, -1) is True def test_expandtabs(self): assert 'abc\rab\tdef\ng\thi'.expandtabs() == 'abc\rab def\ng hi' From arigo at codespeak.net Sat May 7 01:15:34 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Sat, 7 May 2005 01:15:34 +0200 (CEST) Subject: [pypy-svn] r12043 - in pypy/dist/pypy/objspace/std: . test Message-ID: <20050506231534.42FAD27B5C@code1.codespeak.net> Author: arigo Date: Sat May 7 01:15:34 2005 New Revision: 12043 Modified: pypy/dist/pypy/objspace/std/stringobject.py pypy/dist/pypy/objspace/std/test/test_stringobject.py Log: We tested an incorrect behavior of str.islower() and str.isupper(). Fixed the test, and fixed the implementation. Modified: pypy/dist/pypy/objspace/std/stringobject.py ============================================================================== --- pypy/dist/pypy/objspace/std/stringobject.py (original) +++ pypy/dist/pypy/objspace/std/stringobject.py Sat May 7 01:15:34 2005 @@ -67,7 +67,6 @@ c = v[0] return space.newbool(fun(c)) else: - res = 1 for idx in range(len(v)): if not fun(v[idx]): return space.w_False @@ -100,10 +99,36 @@ return _is_generic(w_self, _isalnum) def str_isupper__String(space, w_self): - return _is_generic(w_self, _isupper) + """Return True if all cased characters in S are uppercase and there is +at least one cased character in S, False otherwise.""" + space = w_self.space + v = w_self._value + if len(v) == 1: + c = v[0] + return space.newbool(_isupper(c)) + cased = False + for idx in range(len(v)): + if _islower(v[idx]): + return space.w_False + elif not cased and _isupper(v[idx]): + cased = True + return space.newbool(cased) def str_islower__String(space, w_self): - return _is_generic(w_self, _islower) + """Return True if all cased characters in S are lowercase and there is +at least one cased character in S, False otherwise.""" + space = w_self.space + v = w_self._value + if len(v) == 1: + c = v[0] + return space.newbool(_islower(c)) + cased = False + for idx in range(len(v)): + if _isupper(v[idx]): + return space.w_False + elif not cased and _islower(v[idx]): + cased = True + return space.newbool(cased) def str_istitle__String(space, w_self): input = w_self._value Modified: pypy/dist/pypy/objspace/std/test/test_stringobject.py ============================================================================== --- pypy/dist/pypy/objspace/std/test/test_stringobject.py (original) +++ pypy/dist/pypy/objspace/std/test/test_stringobject.py Sat May 7 01:15:34 2005 @@ -468,7 +468,7 @@ assert "\t\t\b\b\n".islower() == False assert "b".islower() == True assert "bbb".islower() == True - assert "!bbb".islower() == False + assert "!bbb".islower() == True assert "BBB".islower() == False assert "bbbBBB".islower() == False @@ -478,7 +478,7 @@ assert "\t\t\b\b\n".isupper() == False assert "B".isupper() == True assert "BBB".isupper() == True - assert "!BBB".isupper() == False + assert "!BBB".isupper() == True assert "bbb".isupper() == False assert "BBBbbb".isupper() == False From pedronis at codespeak.net Sat May 7 01:16:33 2005 From: pedronis at codespeak.net (pedronis at codespeak.net) Date: Sat, 7 May 2005 01:16:33 +0200 (CEST) Subject: [pypy-svn] r12044 - in pypy/dist/pypy/objspace/std: . test Message-ID: <20050506231633.DA1F027B5C@code1.codespeak.net> Author: pedronis Date: Sat May 7 01:16:33 2005 New Revision: 12044 Modified: pypy/dist/pypy/objspace/std/test/test_typeobject.py pypy/dist/pypy/objspace/std/typeobject.py Log: fixes about mro state during user-defined mro computations with tests Modified: pypy/dist/pypy/objspace/std/test/test_typeobject.py ============================================================================== --- pypy/dist/pypy/objspace/std/test/test_typeobject.py (original) +++ pypy/dist/pypy/objspace/std/test/test_typeobject.py Sat May 7 01:16:33 2005 @@ -288,3 +288,29 @@ class C(A): pass raises(TypeError, "class D(A, C): pass") + + def test_user_defined_mro_cls_access(self): + d = [] + class T(type): + def mro(cls): + d.append(cls.__dict__) + return type.mro(cls) + class C: + __metaclass__ = T + assert d + assert sorted(d[0].keys()) == ['__dict__','__metaclass__','__module__'] + d = [] + class T(type): + def mro(cls): + try: + cls.x() + except AttributeError: + d.append('miss') + return type.mro(cls) + class C: + def x(cls): + return 1 + x = classmethod(x) + __metaclass__ = T + assert d == ['miss'] + assert C.x() == 1 Modified: pypy/dist/pypy/objspace/std/typeobject.py ============================================================================== --- pypy/dist/pypy/objspace/std/typeobject.py (original) +++ pypy/dist/pypy/objspace/std/typeobject.py Sat May 7 01:16:33 2005 @@ -122,6 +122,7 @@ w_type = space.type(w_self) if not space.is_true(space.is_(w_type, space.w_type)): + w_self.mro_w = [] mro_func = w_type.lookup('mro') mro_func_args = Arguments(space, [w_self]) w_mro = space.call_args(mro_func, mro_func_args) From arigo at codespeak.net Sat May 7 01:24:17 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Sat, 7 May 2005 01:24:17 +0200 (CEST) Subject: [pypy-svn] r12045 - in pypy/dist/pypy/objspace/std: . test Message-ID: <20050506232417.6DA5027B5C@code1.codespeak.net> Author: arigo Date: Sat May 7 01:24:17 2005 New Revision: 12045 Modified: pypy/dist/pypy/objspace/std/stringobject.py pypy/dist/pypy/objspace/std/test/test_stringobject.py Log: str.istitle() fix. Modified: pypy/dist/pypy/objspace/std/stringobject.py ============================================================================== --- pypy/dist/pypy/objspace/std/stringobject.py (original) +++ pypy/dist/pypy/objspace/std/stringobject.py Sat May 7 01:24:17 2005 @@ -131,18 +131,29 @@ return space.newbool(cased) def str_istitle__String(space, w_self): + """Return True if S is a titlecased string and there is at least one +character in S, i.e. uppercase characters may only follow uncased +characters and lowercase characters only cased ones. Return False +otherwise.""" input = w_self._value - prev_letter='!' + cased = False + previous_is_cased = False for pos in range(0, len(input)): ch = input[pos] - if _isalpha(ch): - if (_isalpha(prev_letter) and _isupper(ch)) or \ - (not _isalpha(prev_letter) and _islower(ch)): - return space.w_False - prev_letter = ch + if _isupper(ch): + if previous_is_cased: + return space.w_False + previous_is_cased = True + cased = True + elif _islower(ch): + if not previous_is_cased: + return space.w_False + cased = True + else: + previous_is_cased = False - return space.w_True + return space.newbool(cased) def str_upper__String(space, w_self): self = w_self._value Modified: pypy/dist/pypy/objspace/std/test/test_stringobject.py ============================================================================== --- pypy/dist/pypy/objspace/std/test/test_stringobject.py (original) +++ pypy/dist/pypy/objspace/std/test/test_stringobject.py Sat May 7 01:24:17 2005 @@ -152,6 +152,9 @@ assert "bro!wn fox".title() == "Bro!Wn Fox" def test_istitle(self): + assert "".istitle() == False + assert "!".istitle() == False + assert "!!".istitle() == False assert "brown fox".istitle() == False assert "!brown fox".istitle() == False assert "bROWN fOX".istitle() == False From arigo at codespeak.net Sat May 7 01:34:17 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Sat, 7 May 2005 01:34:17 +0200 (CEST) Subject: [pypy-svn] r12047 - in pypy/dist/pypy/objspace/std: . test Message-ID: <20050506233417.DC23127B5D@code1.codespeak.net> Author: arigo Date: Sat May 7 01:34:17 2005 New Revision: 12047 Modified: pypy/dist/pypy/objspace/std/stringobject.py pypy/dist/pypy/objspace/std/test/test_stringobject.py Log: str.splitlines() fix. Modified: pypy/dist/pypy/objspace/std/stringobject.py ============================================================================== --- pypy/dist/pypy/objspace/std/stringobject.py (original) +++ pypy/dist/pypy/objspace/std/stringobject.py Sat May 7 01:34:17 2005 @@ -679,25 +679,29 @@ def str_splitlines__String_ANY(space, w_self, w_keepends): - u_self = w_self._value + data = w_self._value u_keepends = space.int_w(w_keepends) # truth value, but type checked - selflen = len(u_self) + selflen = len(data) L = [] - pos = 0 - while 1: - oldpos = pos - pos = _find(u_self, '\n', pos, selflen, 1) + 1 - if pos > oldpos: - w_item = space.wrap(u_self[oldpos:pos]) - if not u_keepends: - w_item = _strip(space, w_item, W_StringObject(space,'\n'), left=0, right=1) - L.append(w_item) - else: - if oldpos < selflen: - w_item = space.wrap(u_self[oldpos:]) - L.append(w_item) - break + i = j = 0 + while i < selflen: + # Find a line and append it + while i < selflen and data[i] != '\n' and data[i] != '\r': + i += 1 + # Skip the line break reading CRLF as one line break + eol = i + i += 1 + if i < selflen and data[i-1] == '\r' and data[i] == '\n': + i += 1 + if u_keepends: + eol = i + L.append(W_StringObject(space, data[j:eol])) + j = i + + if j < selflen: + L.append(W_StringObject(space, data[j:])) + return W_ListObject(space, L) def str_zfill__String_ANY(space, w_self, w_width): Modified: pypy/dist/pypy/objspace/std/test/test_stringobject.py ============================================================================== --- pypy/dist/pypy/objspace/std/test/test_stringobject.py (original) +++ pypy/dist/pypy/objspace/std/test/test_stringobject.py Sat May 7 01:34:17 2005 @@ -351,6 +351,9 @@ s="\none\n\two\nthree\n\n" assert s.splitlines() ==['', 'one', '\two', 'three', ''] assert s.splitlines(1) ==['\n', 'one\n', '\two\n', 'three\n', '\n'] + # Split on \r and \r\n too + assert '12\r34\r\n56'.splitlines() == ['12', '34', '56'] + assert '12\r34\r\n56'.splitlines(1) == ['12\r', '34\r\n', '56'] def test_find(self): assert 'abcdefghiabc'.find('abc') == 0 From arigo at codespeak.net Sat May 7 01:46:27 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Sat, 7 May 2005 01:46:27 +0200 (CEST) Subject: [pypy-svn] r12048 - in pypy/dist/pypy/objspace/std: . test Message-ID: <20050506234627.9085227B5C@code1.codespeak.net> Author: arigo Date: Sat May 7 01:46:27 2005 New Revision: 12048 Modified: pypy/dist/pypy/objspace/std/stringobject.py pypy/dist/pypy/objspace/std/test/test_stringobject.py Log: Test for subclasses of strings being not returned by string methods. Modified: pypy/dist/pypy/objspace/std/stringobject.py ============================================================================== --- pypy/dist/pypy/objspace/std/stringobject.py (original) +++ pypy/dist/pypy/objspace/std/stringobject.py Sat May 7 01:46:27 2005 @@ -709,7 +709,8 @@ width = space.int_w(w_width) if len(input) >= width: - return w_self + # cannot return w_self, in case it is a subclass of str + return space.wrap(input) buf = [' '] * width if len(input) > 0 and (input[0] == '+' or input[0] == '-'): Modified: pypy/dist/pypy/objspace/std/test/test_stringobject.py ============================================================================== --- pypy/dist/pypy/objspace/std/test/test_stringobject.py (original) +++ pypy/dist/pypy/objspace/std/test/test_stringobject.py Sat May 7 01:46:27 2005 @@ -560,3 +560,26 @@ def test_getnewargs(self): assert "foo".__getnewargs__() == ("foo",) + + def test_subclass(self): + class S(str): + pass + s = S('abc') + assert type(''.join([s])) is str + assert type(s.join([])) is str + assert type(s.split('x')[0]) is str + assert type(s.ljust(3)) is str + assert type(s.rjust(3)) is str + assert type(S('A').upper()) is str + assert type(S('a').lower()) is str + assert type(S('A').capitalize()) is str + assert type(S('A').title()) is str + assert type(s.replace(s, s)) is str + assert type(s.replace('x', 'y')) is str + assert type(s.replace('x', 'y', 0)) is str + assert type(s.zfill(3)) is str + assert type(s.strip()) is str + assert type(s.rstrip()) is str + assert type(s.lstrip()) is str + assert type(s.center(3)) is str + assert type(s.splitlines()[0]) is str From arigo at codespeak.net Sat May 7 01:54:13 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Sat, 7 May 2005 01:54:13 +0200 (CEST) Subject: [pypy-svn] r12050 - pypy/dist/pypy/objspace/std Message-ID: <20050506235413.D61EC27B5C@code1.codespeak.net> Author: arigo Date: Sat May 7 01:54:13 2005 New Revision: 12050 Modified: pypy/dist/pypy/objspace/std/stringobject.py Log: Ugh. On 64-bit machines: >>> [2] * 1111111111111 Traceback (most recent call last): File "", line 1, in ? ValueError: sequence repeat count too large >>> [2] * 11111111111111111111111111 Traceback (most recent call last): File "", line 1, in ? OverflowError: long int too large to convert to int Modified: pypy/dist/pypy/objspace/std/stringobject.py ============================================================================== --- pypy/dist/pypy/objspace/std/stringobject.py (original) +++ pypy/dist/pypy/objspace/std/stringobject.py Sat May 7 01:54:13 2005 @@ -898,7 +898,9 @@ input_len = len(input) try: buffer = [' '] * ovfcheck(mul*input_len) - except (MemoryError,OverflowError): + except (MemoryError,OverflowError,ValueError): + # ugh. ValueError is what you get on 64-bit machines for + # integers in range(2**31, 2**63). raise OperationError( space.w_OverflowError, space.wrap("repeated string is too long: %d %d" % (input_len,mul) )) pos = 0 From pedronis at codespeak.net Sat May 7 03:21:05 2005 From: pedronis at codespeak.net (pedronis at codespeak.net) Date: Sat, 7 May 2005 03:21:05 +0200 (CEST) Subject: [pypy-svn] r12051 - pypy/dist/pypy/lib Message-ID: <20050507012105.DC90727B60@code1.codespeak.net> Author: pedronis Date: Sat May 7 03:21:04 2005 New Revision: 12051 Modified: pypy/dist/pypy/lib/cPickle.py Log: better emulation of cPickle Modified: pypy/dist/pypy/lib/cPickle.py ============================================================================== --- pypy/dist/pypy/lib/cPickle.py (original) +++ pypy/dist/pypy/lib/cPickle.py Sat May 7 03:21:04 2005 @@ -5,17 +5,8 @@ from pickle import * from pickle import __doc__, __version__, format_version, compatible_formats -class UnpickleableError(PicklingError): - def __init__(self, *args): - self.args=args - - def __str__(self): - a=self.args - a=a and type(a[0]) or '(what)' - return 'Cannot pickle %s objects' % a - -class BadPickleGet(UnpicklingError): - pass +BadPickleGet = KeyError +UnpickleableError = PicklingError # ____________________________________________________________ # XXX some temporary dark magic to produce pickled dumps that are @@ -25,10 +16,21 @@ PythonPickler = Pickler class Pickler(PythonPickler): + def __init__(self, *args): + self.__f = None + if len(args) == 1 and isinstance(args[0], int): + self.__f = StringIO() + PythonPickler.__init__(self, self.__f, args[0]) + else: + PythonPickler.__init__(self, *args) + def memoize(self, obj): self.memo[None] = None # cPickle starts counting at one return PythonPickler.memoize(self, obj) + def getvalue(self): + return self.__f and self.__f.getvalue() + def dump(obj, file, protocol=None, bin=None): Pickler(file, protocol, bin).dump(obj) From hpk at codespeak.net Sun May 8 00:08:34 2005 From: hpk at codespeak.net (hpk at codespeak.net) Date: Sun, 8 May 2005 00:08:34 +0200 (CEST) Subject: [pypy-svn] r12055 - pypy/dist/pypy/module/sys2 Message-ID: <20050507220834.5C2E827B4D@code1.codespeak.net> Author: hpk Date: Sun May 8 00:08:34 2005 New Revision: 12055 Modified: pypy/dist/pypy/module/sys2/state.py Log: steal fnctl from CPython to let test_tempfile pass and remove _codecs and binascii becasue we have our own implementation. Hum, i guess we should be a bit more strict and clever about building the list of modules we steal from CPython to avoid people getting confused not getting their pypy/lib implementation for things ... Modified: pypy/dist/pypy/module/sys2/state.py ============================================================================== --- pypy/dist/pypy/module/sys2/state.py (original) +++ pypy/dist/pypy/module/sys2/state.py Sun May 8 00:08:34 2005 @@ -24,10 +24,10 @@ # The following built-in modules are not written in PyPy, so we # steal them from Python. for fn in ['posix', 'nt', 'os2', 'mac', 'ce', 'riscos', - 'math', '_codecs', 'array', 'select', + 'math', 'array', 'select', '_random', '_sre', 'time', '_socket', 'errno', - 'binascii', 'unicodedata', - 'parser' + 'unicodedata', + 'parser', 'fcntl', #'_codecs', 'binascii' ]: if fn not in builtin_modules: try: From ale at codespeak.net Sun May 8 00:32:06 2005 From: ale at codespeak.net (ale at codespeak.net) Date: Sun, 8 May 2005 00:32:06 +0200 (CEST) Subject: [pypy-svn] r12056 - in pypy/dist: lib-python/modified-2.3.4/test pypy/lib Message-ID: <20050507223206.96B6527B4D@code1.codespeak.net> Author: ale Date: Sun May 8 00:32:06 2005 New Revision: 12056 Modified: pypy/dist/lib-python/modified-2.3.4/test/test_codeccallbacks.py pypy/dist/pypy/lib/_codecs.py pypy/dist/pypy/lib/unicodecodec.py Log: Down to : "Ran 26 tests in 7728.133s FAILED (failures=4, errors=1)" in test/test_codeccallbacks.py and : Ran 6 tests in 90.470s FAILED (failures=1, errors=1) in test/test_codecs.py The remaining failures are due to : - not implemented translate methods and translate exception - UnicodeEncodeError/UnicodeDecodeError exception not checking for proper number of arguments - a forgotten print statement -> unprintable unicode error - Some mixup in my setup (bad sre.MAGICNUMBER) - a missing UTF-16 encode function Modified: pypy/dist/lib-python/modified-2.3.4/test/test_codeccallbacks.py ============================================================================== --- pypy/dist/lib-python/modified-2.3.4/test/test_codeccallbacks.py (original) +++ pypy/dist/lib-python/modified-2.3.4/test/test_codeccallbacks.py Sun May 8 00:32:06 2005 @@ -240,6 +240,7 @@ for enc in ("ascii", "latin-1", "iso-8859-1", "iso-8859-15", "utf-8", "utf-7", "utf-16"): for err in errors: try: + print uni[0],enc,err codecs.encode(uni,enc, err) except UnicodeError: pass @@ -598,19 +599,19 @@ self.assertRaises(TypeError, codecs.decode, "\\x0y", "unicode-escape", "test.baddecodereturn1") self.assertRaises(TypeError, codecs.decode, "\\Uffffeeee", "unicode-escape", "test.baddecodereturn1") self.assertRaises(TypeError, codecs.decode, "\\uyyyy", "raw-unicode-escape", "test.baddecodereturn1") - + def baddecodereturn2(exc): return (u"?", None) codecs.register_error("test.baddecodereturn2", baddecodereturn2) self.assertRaises(TypeError, codecs.decode, "\xff", "ascii", "test.baddecodereturn2") - + handler = PosReturn() codecs.register_error("test.posreturn", handler.handle) # Valid negative position handler.pos = -1 self.assertEquals(codecs.decode( "\xff0","ascii", "test.posreturn"), u"0") - + # Valid negative position handler.pos = -2 self.assertEquals(codecs.decode("\xff0","ascii", "test.posreturn"), u"") Modified: pypy/dist/pypy/lib/_codecs.py ============================================================================== --- pypy/dist/pypy/lib/_codecs.py (original) +++ pypy/dist/pypy/lib/_codecs.py Sun May 8 00:32:06 2005 @@ -312,7 +312,7 @@ res += '&#' res += str(ord(ch)) res += ';' - return ''.join(res),exc.end + return u''.join(res),exc.end else: raise TypeError("don't know how to handle %.400s in error callback"%type(exc)) Modified: pypy/dist/pypy/lib/unicodecodec.py ============================================================================== --- pypy/dist/pypy/lib/unicodecodec.py (original) +++ pypy/dist/pypy/lib/unicodecodec.py Sun May 8 00:32:06 2005 @@ -336,18 +336,11 @@ p += c pos += 1 else: - handler = lookup_error(errors) - x = handler(UnicodeDecodeError("ascii",s,pos, - pos+1,"ordinal not in range(128)")) - if isinstance(x[0],unicode): - - p += x[0] - else: - raise TypeError - if isinstance(x[1],(int,long)): - pos = x[1] - else: - raise TypeError + res = unicode_call_errorhandler( + errors, "ascii", "ordinal not in range(128)", + s, pos, pos+1) + p += res[0] + pos = res[1] return ''.join(p) #(encoding,p,collstart,collend,reason) def PyUnicode_EncodeASCII(p,size,errors): @@ -534,12 +527,11 @@ return [hi,lo] p = [] - import sys bom = sys.byteorder if (byteorder == 0): - import sys + bom = sys.byteorder - p.extend(STORECHAR(0xFEFF,bom)) + p += STORECHAR(0xFEFF,bom) if (size == 0): return "" @@ -557,9 +549,9 @@ ch2 = 0xDC00 | ((ch-0x10000) & 0x3FF) ch = 0xD800 | ((ch-0x10000) >> 10) - p.extend(STORECHAR(ch,bom)) + p += STORECHAR(ch,bom) if (ch2): - p.extend(STORECHAR(ch2,bom)) + p +=STORECHAR(ch2,bom) return ''.join(p) @@ -607,18 +599,24 @@ #### if (0 == WideCharToMultiByte(CP_ACP, 0, p, size, s, mbcssize, NULL, NULL)): #### raise UnicodeEncodeError, "Windows cannot decode the string %s" %p ## return s -def unicode_decode_call_errorhandler(errors, encoding, - reason, input, startinpos, endinpos): - - errorHandler = lookup_error(errors) - exceptionObject = UnicodeDecodeError(encoding, input, startinpos, endinpos, reason) - res,newpos = errorHandler(exceptionObject) +def unicode_call_errorhandler(errors, encoding, + reason, input, startinpos, endinpos,decode=True): -## if (newpos<0): -## newpos = len(input)+newpos; -## if newpos<0 or newpos>len(input): -## raise IndexError( "position %d from error handler out of bounds", newpos) - return res,newpos + errorHandler = lookup_error(errors) + if decode: + exceptionObject = UnicodeDecodeError(encoding, input, startinpos, endinpos, reason) + else: + exceptionObject = UnicodeEncodeError(encoding, input, startinpos, endinpos, reason) + res = errorHandler(exceptionObject) + if isinstance(res,tuple) and isinstance(res[0],unicode) and isinstance(res[1],int): + newpos = res[1] + if (newpos<0): + newpos = len(input)+newpos + if newpos<0 or newpos>len(input): + raise IndexError( "position %d from error handler out of bounds", newpos) + return res[0],newpos + else: + raise TypeError("encoding error handler must return (unicode, int) tuple") def PyUnicode_DecodeUTF8(s, size, errors): @@ -669,7 +667,7 @@ else: errmsg = "unexpected end of data" endinpos = size - res = unicode_decode_call_errorhandler( + res = unicode_call_errorhandler( errors, "utf8", errmsg, s, startinpos, endinpos) p += res[0] @@ -677,7 +675,7 @@ if n == 0: errmsg = "unexpected code byte" endinpos = startinpos+1 - res = unicode_decode_call_errorhandler( + res = unicode_call_errorhandler( errors, "utf8", errmsg, s, startinpos, endinpos) p += res[0] @@ -685,7 +683,7 @@ elif n == 1: errmsg = "internal error" endinpos = startinpos+1 - res = unicode_decode_call_errorhandler( + res = unicode_call_errorhandler( errors, "utf8", errmsg, s, startinpos, endinpos) p += res[0] @@ -694,7 +692,7 @@ if ((ord(s[pos+1]) & 0xc0) != 0x80): errmsg = "invalid data" endinpos = startinpos+2 - res = unicode_decode_call_errorhandler( + res = unicode_call_errorhandler( errors, "utf8", errmsg, s, startinpos, endinpos) p += res[0] @@ -704,7 +702,7 @@ if c<0x80: errmsg = "illegal encoding" endinpos = startinpos+2 - res = unicode_decode_call_errorhandler( + res = unicode_call_errorhandler( errors, "utf8", errmsg, s, startinpos, endinpos) p += res[0] @@ -718,7 +716,7 @@ (ord(s[pos+2]) & 0xc0) != 0x80): errmsg = "invalid data" endinpos = startinpos+3 - res = unicode_decode_call_errorhandler( + res = unicode_call_errorhandler( errors, "utf8", errmsg, s, startinpos, endinpos) p += res[0] @@ -737,7 +735,7 @@ if c < 0x8000: errmsg = "illegal encoding" endinpos = startinpos+3 - res = unicode_decode_call_errorhandler( + res = unicode_call_errorhandler( errors, "utf8", errmsg, s, startinpos, endinpos) p += res[0] @@ -755,7 +753,7 @@ errmsg = "invalid data" startinpos = pos endinpos = startinpos+4 - res = unicode_decode_call_errorhandler( + res = unicode_call_errorhandler( errors, "utf8", errmsg, s, startinpos, endinpos) p += res[0] @@ -771,7 +769,7 @@ errmsg = "illegal encoding" startinpos = pos endinpos = startinpos+4 - res = unicode_decode_call_errorhandler( + res = unicode_call_errorhandler( errors, "utf8", errmsg, s, startinpos, endinpos) p += res[0] @@ -796,7 +794,7 @@ errmsg = "unsupported Unicode code range"; startinpos = pos endinpos = startinpos+n - res = unicode_decode_call_errorhandler( + res = unicode_call_errorhandler( errors, "utf8", errmsg, s, startinpos, endinpos) p += res[0] @@ -908,11 +906,7 @@ collend = pos+1 while collend < len(p) and ord(p[collend]) >= limit: collend += 1 - - #uncollectable = [c for c in p if ord(c) >= limit] - handler = lookup_error(errors) - exc = UnicodeEncodeError(encoding,p,collstart,collend,reason) - x = handler(exc) + x = unicode_call_errorhandler(errors,encoding,reason,p,collstart,collend,False) res += str(x[0]) pos = x[1] return res #u''.join(res) @@ -926,9 +920,8 @@ chr = 0 p = [] if (pos+digits>len(s)): - handler = lookup_error(errors) - x = handler(UnicodeDecodeError("unicodeescape",s,pos-2, - len(s),"end of string in escape sequence")) + message = "end of string in escape sequence" + x = unicode_call_errorhandler(errors,"unicodeescape",message,s,pos-2,len(s)) p += x[0] pos = x[1] else: @@ -936,16 +929,13 @@ chr = int(s[pos:pos+digits],16) except ValueError: endinpos = pos - while s[endinpos] in hexdigits: endinpos +=1 - handler = lookup_error(errors) - x = handler(UnicodeDecodeError("unicodeescape",s,pos-2, - endinpos+1,message)) - if (isinstance(x,tuple) and isinstance(x[0],(str,unicode)) and - isinstance(x[1],(int,long))): - p += x[0] - pos = x[1] - else: - raise TypeError + while s[endinpos] in hexdigits: + endinpos +=1 + #message = "Find den rigtige fejl meddelelse" + x = unicode_call_errorhandler(errors,"unicodeescape",message,s,pos-2, + endinpos+1) + p += x[0] + pos = x[1] # /* when we get here, chr is a 32-bit unicode character */ else: if chr < sys.maxunicode: @@ -959,9 +949,9 @@ pos += digits #endif else: - handler = lookup_error(errors) - x = handler(UnicodeDecodeError("unicodeescape",s,pos, - pos+digits,"illegal Unicode character")) + message = "Find den rigtige fejl meddelelse" + x = unicode_call_errorhandler(errors,"unicodeescape",message,s,pos-2, + pos+1) p += x[0] pos = x[1] res = ''.join(p) @@ -984,7 +974,8 @@ else: pos +=1 if pos>=len(s): - break + errmessage = "\\ at end of string" + unicode_call_errorhandler(errors,"unicodeescape",errmessage,s,pos-1,size) ch = s[pos] ## /* \x escapes */ @@ -1090,7 +1081,7 @@ pos+digits,message)) p += x[0] pos = x[1] -## if (unicode_decode_call_errorhandler( +## if (unicode_call_errorhandler( ## errors, &errorHandler, ## "unicodeescape", message, ## starts, size, &startinpos, &endinpos, &exc, &s, @@ -1128,8 +1119,13 @@ rep = mapping[c] + if not rep: + raise UnicodeError if isinstance(rep,(int,long)): - return chr(rep) + if rep<256: + return chr(rep) + else: + raise TypeError elif isinstance(rep,unicode): raise TypeError else: @@ -1152,11 +1148,10 @@ #/* try to encode it */ try: x = charmapencode_output(ord(p[inpos]),mapping) - res += x + res += [x] except KeyError: - handler = lookup_error(errors) - x = handler(UnicodeEncodeError("charmap",p,inpos,inpos+1, - "character maps to ")) + x = unicode_call_errorhandler(errors,"charmap", + "character maps to ",p,inpos,inpos+1,False) try: res += [charmapencode_output(ord(y),mapping) for y in x[0]] except KeyError: @@ -1184,7 +1179,10 @@ try: x = mapping[ord(ch)] if isinstance(x,int): - p += unichr(x) + if x<65536: + p += unichr(x) + else: + raise TypeError("character mapping must be in range(65536)") elif isinstance(x,unicode): p += x elif not x: @@ -1192,14 +1190,85 @@ else: raise TypeError except KeyError: - handler = lookup_error(errors) - x = handler(UnicodeDecodeError("charmap",s,inpos,inpos+1, - "character maps to ")) - p += x[0]#[mapping[ord(y)] for y in x[0]] - except TypeError: - handler = lookup_error(errors) - x = handler(UnicodeDecodeError("charmap",s,inpos,inpos+1, - "character mapping must return integer, None or unicode")) - p += x[0]#[mapping[ord(y)] for y in x[0]] + x = unicode_call_errorhandler(errors,"charmap", + "character maps to ",s,inpos,inpos+1) + p += x[0] +## except TypeError: +## x = unicode_call_errorhandler(errors,"charmap", +## "character mapping must return integer, None or unicode", +## s,inpos,inpos+1) +## p += x[0] inpos +=1 return u''.join(p) + +def PyUnicode_DecodeRawUnicodeEscape(s, size,errors): + + if (size == 0): + return u'' + pos = 0 + p = [] + while (pos < len(s)): + ch = s[pos] + #/* Non-escape characters are interpreted as Unicode ordinals */ + if (ch != '\\'): + p += ch + + startinpos = pos + +## /* \u-escapes are only interpreted iff the number of leading +## backslashes is odd */ + bs = pos + while pos < size: + if (s[pos] != '\\'): + break; + p += s[pos] + pos += 1 + + if (((pos - bs) & 1) == 0 or + pos >= size or + (s[pos] != 'u' and s[pos] != 'U')) : + pos += 1 + continue + + p.pop(-1) + if s[pos] == 'u': + count = 4 + else: + count = 8 + pos += 1 + + #/* \uXXXX with 4 hex digits, \Uxxxxxxxx with 8 */ + + i = 0 + x = 0 + try: + x = int(s[pos:pos+count],16) + except ValueError: + res = unicode_call_errorhandler( + errors, "rawunicodeescape", "truncated \\uXXXX", + s, size, pos, pos+count) + p += res[0] + pos = res[1] + else: + #ifndef Py_UNICODE_WIDE + if sys.maxunicode > 0xffff: + if (x > 0x10000): + res = unicode_call_errorhandler( + errors, "rawunicodeescape", "\\Uxxxxxxxx out of range", + s, size, pos, pos+1) + pos = i = res[1] + p += res[0] + i += 1 + else: + if (x > 0x10000): + res = unicode_call_errorhandler( + errors, "rawunicodeescape", "\\Uxxxxxxxx out of range", + s, size, pos, pos+1) + pos = i = res[1] + p += res[0] + + #endif + else: + p += unichr(x) + + return u''.join(p) \ No newline at end of file From arigo at codespeak.net Sun May 8 08:06:29 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Sun, 8 May 2005 08:06:29 +0200 (CEST) Subject: [pypy-svn] r12059 - pypy/dist/pypy/module/sys2 Message-ID: <20050508060629.1641027B64@code1.codespeak.net> Author: arigo Date: Sun May 8 08:06:28 2005 New Revision: 12059 Modified: pypy/dist/pypy/module/sys2/state.py Log: Don't let faked modules get in our builtin_modules if we see a Python reimplementation in pypy/lib/. (Quick hack for now.) Modified: pypy/dist/pypy/module/sys2/state.py ============================================================================== --- pypy/dist/pypy/module/sys2/state.py (original) +++ pypy/dist/pypy/module/sys2/state.py Sun May 8 08:06:28 2005 @@ -1,6 +1,7 @@ """ Implementation of interpreter-level 'sys' routines. """ +import pypy #from pypy.interpreter.module import Module from pypy.interpreter.error import OperationError @@ -29,7 +30,9 @@ 'unicodedata', 'parser', 'fcntl', #'_codecs', 'binascii' ]: - if fn not in builtin_modules: + if fn not in builtin_modules and not os.path.exists( + os.path.join(os.path.dirname(pypy.__file__), + 'lib', fn+'.py')): try: builtin_modules[fn] = hack_cpython_module(fn) except ImportError: From arigo at codespeak.net Sun May 8 10:34:21 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Sun, 8 May 2005 10:34:21 +0200 (CEST) Subject: [pypy-svn] r12060 - pypy/dist/pypy/interpreter Message-ID: <20050508083421.1F3A427B96@code1.codespeak.net> Author: arigo Date: Sun May 8 10:34:20 2005 New Revision: 12060 Modified: pypy/dist/pypy/interpreter/lazymodule.py Log: Typecheck the objects built by the interpleveldef of lazy modules. Modified: pypy/dist/pypy/interpreter/lazymodule.py ============================================================================== --- pypy/dist/pypy/interpreter/lazymodule.py (original) +++ pypy/dist/pypy/interpreter/lazymodule.py Sun May 8 10:34:20 2005 @@ -2,6 +2,7 @@ from pypy.interpreter.function import Function, BuiltinFunction from pypy.interpreter import gateway from pypy.interpreter.error import OperationError +from pypy.interpreter.baseobjspace import W_Root import inspect @@ -102,7 +103,9 @@ #print spec, "->", value if hasattr(value, 'func_code'): # semi-evil return space.wrap(gateway.interp2app(value)) - assert value is not None + assert isinstance(value, W_Root), ( + "interpleveldef %s.%s must return a wrapped object " + "(got %r instead)" % (pkgroot, spec, value)) return value return ifileloader From arigo at codespeak.net Sun May 8 10:35:12 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Sun, 8 May 2005 10:35:12 +0200 (CEST) Subject: [pypy-svn] r12061 - pypy/dist/pypy/module/recparser Message-ID: <20050508083512.7F2A127B96@code1.codespeak.net> Author: arigo Date: Sun May 8 10:35:12 2005 New Revision: 12061 Modified: pypy/dist/pypy/module/recparser/pyparser.py Log: Import statements must be made locals and the flag do_imports=False must be added to prevent the imported Python module from being compiled by geninterp. Modified: pypy/dist/pypy/module/recparser/pyparser.py ============================================================================== --- pypy/dist/pypy/module/recparser/pyparser.py (original) +++ pypy/dist/pypy/module/recparser/pyparser.py Sun May 8 10:35:12 2005 @@ -72,21 +72,23 @@ ASTType = STType app = applevel(""" - import compiler def mycompile(tup, filename): + import compiler transformer = compiler.transformer.Transformer() compileAST = transformer.compile_node(tup) compiler.misc.set_filename(filename, compileAST) return compileAST def exprcompile(compileAST): + import compiler gen = compiler.pycodegen.ExpressionCodeGenerator(compileAST) return gen.getCode() def modcompile(compileAST): + import compiler gen = compiler.pycodegen.ModuleCodeGenerator(compileAST) return gen.getCode() -""", filename=__file__) +""", filename=__file__, do_imports=False) mycompile = app.interphook("mycompile") exprcompile = app.interphook("exprcompile") From arigo at codespeak.net Sun May 8 10:46:22 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Sun, 8 May 2005 10:46:22 +0200 (CEST) Subject: [pypy-svn] r12062 - pypy/dist/pypy/interpreter Message-ID: <20050508084622.D0BF427B96@code1.codespeak.net> Author: arigo Date: Sun May 8 10:46:22 2005 New Revision: 12062 Modified: pypy/dist/pypy/interpreter/lazymodule.py Log: Accepts interp-level classes in the interpleveldef of lazy modules. They are turned into the app-level type object corresponding to their typedef attribute. Modified: pypy/dist/pypy/interpreter/lazymodule.py ============================================================================== --- pypy/dist/pypy/interpreter/lazymodule.py (original) +++ pypy/dist/pypy/interpreter/lazymodule.py Sun May 8 10:46:22 2005 @@ -103,6 +103,14 @@ #print spec, "->", value if hasattr(value, 'func_code'): # semi-evil return space.wrap(gateway.interp2app(value)) + + try: + is_type = issubclass(value, W_Root) # pseudo-evil + except TypeError: + is_type = False + if is_type: + return space.gettypeobject(value.typedef) + assert isinstance(value, W_Root), ( "interpleveldef %s.%s must return a wrapped object " "(got %r instead)" % (pkgroot, spec, value)) From hpk at codespeak.net Sun May 8 10:55:54 2005 From: hpk at codespeak.net (hpk at codespeak.net) Date: Sun, 8 May 2005 10:55:54 +0200 (CEST) Subject: [pypy-svn] r12063 - in pypy/dist/pypy/module: builtin test Message-ID: <20050508085554.DAA5627B96@code1.codespeak.net> Author: hpk Date: Sun May 8 10:55:54 2005 New Revision: 12063 Modified: pypy/dist/pypy/module/builtin/app_functional.py pypy/dist/pypy/module/test/test_builtin.py Log: refactor xrange to work and represent itself more like CPython does (to pass compliancy test) Modified: pypy/dist/pypy/module/builtin/app_functional.py ============================================================================== --- pypy/dist/pypy/module/builtin/app_functional.py (original) +++ pypy/dist/pypy/module/builtin/app_functional.py Sun May 8 10:55:54 2005 @@ -252,43 +252,57 @@ # ____________________________________________________________ +def get_len_of_range(lo, hi, step): + n = 0 + if lo < hi: + diff = hi - lo - 1 + n = diff // step + 1 + return n + class xrange(object): def __init__(self, start, stop=None, step=1): if not isinstance(start, (int, long, float)): raise TypeError('an integer is required') start = int(start) if stop is None: - self.start = 0 - self.stop = start + stop = start + start = 0 else: if not isinstance(stop, (int, long, float)): raise TypeError('an integer is required') stop = int(stop) - self.start = start - self.stop = stop if not isinstance(step, (int, long, float)): raise TypeError('an integer is required') step = int(step) if step == 0: raise ValueError, 'xrange() step-argument (arg 3) must not be zero' - self.step = step + if step > 0: + n = get_len_of_range(start, stop, step) + else: + n = get_len_of_range(stop, start, -step) + self.start = start + self.len = n + self.step = step + + def __str__(self): + stop = self.start + self.len * self.step + if self.start == 0 and self.step == 1: + s = "xrange(%d)" % (stop,) + elif self.step == 1: + s = "xrange(%d, %d)" % (self.start, stop) + else: + s = "xrange(%d, %d, %d)" %(self.start, stop, self.step) + return s + __repr__ = __str__ def __len__(self): - if not hasattr(self, '_len'): - slicelength = self.stop - self.start - lengthsign = cmp(slicelength, 0) - stepsign = cmp(self.step, 0) - if stepsign == lengthsign: - self._len = (slicelength - lengthsign) // self.step + 1 - else: - self._len = 0 - return self._len + return self.len def __getitem__(self, index): # xrange does NOT support slicing if not isinstance(index, int): raise TypeError, "sequence index must be integer" - len = self.__len__() + len = self.len if index<0: index += len if 0 <= index < len: @@ -296,16 +310,10 @@ raise IndexError, "xrange object index out of range" def __iter__(self): - start, stop, step = self.start, self.stop, self.step - i = start - if step > 0: - while i < stop: - yield i - i+=step - else: - while i > stop: - yield i - i+=step + i = 0 + while i < self.len: + yield self.start + i * self.step + i += 1 # ____________________________________________________________ Modified: pypy/dist/pypy/module/test/test_builtin.py ============================================================================== --- pypy/dist/pypy/module/test/test_builtin.py (original) +++ pypy/dist/pypy/module/test/test_builtin.py Sun May 8 10:55:54 2005 @@ -146,6 +146,11 @@ raises(ValueError, xrange, 0, 1, 0) + def test_xrange_repr(self): + assert repr(xrange(1)) == 'xrange(1)' + assert repr(xrange(1,2)) == 'xrange(1, 2)' + assert repr(xrange(1,2,3)) == 'xrange(1, 4, 3)' + def test_xrange_up(self): x = xrange(2) iter_x = iter(x) From hpk at codespeak.net Sun May 8 12:34:23 2005 From: hpk at codespeak.net (hpk at codespeak.net) Date: Sun, 8 May 2005 12:34:23 +0200 (CEST) Subject: [pypy-svn] r12066 - in pypy/dist/pypy/interpreter: . test Message-ID: <20050508103423.41AD027B9E@code1.codespeak.net> Author: hpk Date: Sun May 8 12:34:23 2005 New Revision: 12066 Modified: pypy/dist/pypy/interpreter/function.py pypy/dist/pypy/interpreter/test/test_function.py pypy/dist/pypy/interpreter/typedef.py Log: a CPython like __repr__ for methods (new-style). it doesn't return '" + class A(object): + def f(self): + pass + assert repr(A.f) == "" + assert repr(A().f).startswith(" Author: tismer Date: Sun May 8 13:17:49 2005 New Revision: 12067 Modified: pypy/dist/pypy/translator/annrpython.py Log: interpretation of can_only_throw is now very exact. The possible exceptions are checked against the actual ones and get consumed. The algorithm works like this: (pseudo language) candidates = can_only_throw for each exception link in order covered = all candidates which match link if covered not empty add link to exceptions remove covered from candidates Modified: pypy/dist/pypy/translator/annrpython.py ============================================================================== --- pypy/dist/pypy/translator/annrpython.py (original) +++ pypy/dist/pypy/translator/annrpython.py Sun May 8 13:17:49 2005 @@ -417,11 +417,16 @@ can_only_throw = getattr(unop, "can_only_throw", None) else: can_only_throw = None + if can_only_throw is not None: - exits = [link - for link in exits - if link.exitcase is None - or link.exitcase in can_only_throw ] + candidates = can_only_throw + exits = [block.exits[0]] + for link in block.exits[1:]: + case = link.exitcase + covered = [c for c in candidates if issubclass(c, case)] + if covered: + exits.append(link) + candidates = [c for c in candidates if c not in covered] for link in exits: self.links_followed[link] = True From tismer at codespeak.net Sun May 8 20:41:00 2005 From: tismer at codespeak.net (tismer at codespeak.net) Date: Sun, 8 May 2005 20:41:00 +0200 (CEST) Subject: [pypy-svn] r12072 - pypy/dist/pypy/translator Message-ID: <20050508184100.6EC4B27BC2@code1.codespeak.net> Author: tismer Date: Sun May 8 20:41:00 2005 New Revision: 12072 Modified: pypy/dist/pypy/translator/geninterplevel.py Log: safer method for restoring the sys.path Modified: pypy/dist/pypy/translator/geninterplevel.py ============================================================================== --- pypy/dist/pypy/translator/geninterplevel.py (original) +++ pypy/dist/pypy/translator/geninterplevel.py Sun May 8 20:41:00 2005 @@ -1539,9 +1539,10 @@ tmpname = 'nada' out = _file(tmpname, 'w') gen.f = out + hold = sys.path[:] sys.path.insert(0, libdir) gen.gen_source(tmpname, file=_file) - sys.path.remove(libdir) + sys.path[:] = hold out.close() newsrc = _file(tmpname).read() code = py.code.Source(newsrc).compile() From tismer at codespeak.net Sun May 8 20:43:09 2005 From: tismer at codespeak.net (tismer at codespeak.net) Date: Sun, 8 May 2005 20:43:09 +0200 (CEST) Subject: [pypy-svn] r12073 - in pypy/dist/pypy: annotation objspace/flow Message-ID: <20050508184309.27DB427BC2@code1.codespeak.net> Author: tismer Date: Sun May 8 20:43:08 2005 New Revision: 12073 Modified: pypy/dist/pypy/annotation/binaryop.py pypy/dist/pypy/objspace/flow/objspace.py Log: added xxx_ovf binary operators to the relevant tables. Yet to do are the unary ones. Modified: pypy/dist/pypy/annotation/binaryop.py ============================================================================== --- pypy/dist/pypy/annotation/binaryop.py (original) +++ pypy/dist/pypy/annotation/binaryop.py Sun May 8 20:43:08 2005 @@ -30,7 +30,14 @@ 'inplace_and', 'inplace_or', 'inplace_xor', 'lt', 'le', 'eq', 'ne', 'gt', 'ge', 'is_', 'cmp', 'union', 'coerce', - ]) + ] + +[opname+'_ovf' for opname in + """add sub mul truediv + floordiv div mod divmod pow lshift + inplace_add inplace_sub inplace_mul inplace_truediv + inplace_floordiv inplace_div inplace_mod inplace_pow + inplace_lshift""".split() + ]) for opname in BINARY_OPERATIONS: missing_operation(pairtype(SomeObject, SomeObject), opname) @@ -162,19 +169,21 @@ unsigned = int1.unsigned or int2.unsigned return SomeInteger(nonneg = unsigned or (int1.nonneg and int2.nonneg), unsigned=unsigned) - - or_ = xor = _clone(union, []) - add = mul = _clone(union, [OverflowError]) - div = floordiv = mod = _clone(union, [ZeroDivisionError, OverflowError]) + or_ = xor = add = mul = _clone(union, []) + add_ovf = mul_ovf = _clone(union, [OverflowError]) + div = floordiv = mod = _clone(union, [ZeroDivisionError]) + div_ovf= floordiv_ovf = mod_ovf = _clone(union, [ZeroDivisionError, OverflowError]) def truediv((int1, int2)): return SomeFloat() - truediv.can_only_throw = [ZeroDivisionError, OverflowError] + truediv.can_only_throw = [ZeroDivisionError] + truediv_ovf = _clone(truediv, [ZeroDivisionError, OverflowError]) def sub((int1, int2)): return SomeInteger(unsigned = int1.unsigned or int2.unsigned) - sub.can_only_throw = [OverflowError] + sub.can_only_throw = [] + sub_ovf = _clone(sub, [OverflowError]) def and_((int1, int2)): unsigned = int1.unsigned or int2.unsigned @@ -194,7 +203,8 @@ if int1.unsigned or int2.unsigned or getattr(obj3, 'unsigned', False): return SomeInteger(unsigned=True) return SomeInteger() - pow.can_only_throw = [ZeroDivisionError, OverflowError] + pow.can_only_throw = [ZeroDivisionError] + pow_ovf = _clone(pow, [ZeroDivisionError, OverflowError]) class __extend__(pairtype(SomeBool, SomeBool)): Modified: pypy/dist/pypy/objspace/flow/objspace.py ============================================================================== --- pypy/dist/pypy/objspace/flow/objspace.py (original) +++ pypy/dist/pypy/objspace/flow/objspace.py Sun May 8 20:43:08 2005 @@ -418,6 +418,13 @@ lis.append(exc) assert exc in op_appendices +def _add_except_ovf(names): + # duplicate exceptions and add OverflowError + for name in names.split(): + lis = implicit_exceptions.setdefault(name, [])[:] + lis.append(OverflowError) + implicit_exceptions[name+"_ovf"] = lis + for _err in IndexError, KeyError: _add_exceptions("""getitem""", _err) _add_exceptions("""delitem""", _err) @@ -431,18 +438,18 @@ _add_exceptions("""div mod divmod truediv floordiv pow inplace_div inplace_mod inplace_divmod inplace_truediv inplace_floordiv inplace_pow""", ZeroDivisionError) -_add_exceptions("""pos neg abs invert add sub mul truediv - floordiv div mod divmod pow lshift - inplace_add inplace_sub inplace_mul inplace_truediv - inplace_floordiv inplace_div inplace_mod inplace_pow - inplace_lshift""", OverflowError) _add_exceptions("""pow inplace_pow lshift inplace_lshift rshift inplace_rshift""", ValueError) _add_exceptions("""add sub mul truediv floordiv div mod divmod pow inplace_add inplace_sub inplace_mul inplace_truediv inplace_floordiv inplace_div inplace_mod inplace_divmod inplace_pow""", FloatingPointError) -del _add_exceptions +_add_except_ovf("""pos neg abs invert add sub mul truediv + floordiv div mod divmod pow lshift + inplace_add inplace_sub inplace_mul inplace_truediv + inplace_floordiv inplace_div inplace_mod inplace_pow + inplace_lshift""") +del _add_exceptions, _add_except_ovf def extract_cell_content(c): """Get the value contained in a CPython 'cell', as read through From tismer at codespeak.net Sun May 8 21:01:12 2005 From: tismer at codespeak.net (tismer at codespeak.net) Date: Sun, 8 May 2005 21:01:12 +0200 (CEST) Subject: [pypy-svn] r12075 - in pypy/dist/pypy/translator: . test Message-ID: <20050508190112.0DE2E27BBA@code1.codespeak.net> Author: tismer Date: Sun May 8 21:01:11 2005 New Revision: 12075 Modified: pypy/dist/pypy/translator/simplify.py pypy/dist/pypy/translator/test/snippet.py pypy/dist/pypy/translator/transform.py Log: removed the changes to transform.py * transform_ovfcheck is now in simplify.py. It seems to cover all cases and also does plausibility checks for misplaced operations or operations that are checked but cannot overflow. * added simplify_exceptions, which walks all the lengthy exception traces of the interpreter and compacts them into a single exitswitch. * added remove_dead_exceptions, that removes unreachable exception branches. All thoroughly tested with annotation and geninterp. Modified: pypy/dist/pypy/translator/simplify.py ============================================================================== --- pypy/dist/pypy/translator/simplify.py (original) +++ pypy/dist/pypy/translator/simplify.py Sun May 8 21:01:11 2005 @@ -5,7 +5,10 @@ simplify_graph() applies all simplifications defined in this file. """ -from pypy.objspace.flow.model import * +from pypy.objspace.flow.model import SpaceOperation +from pypy.objspace.flow.model import Variable, Constant, Block, Link +from pypy.objspace.flow.model import last_exception +from pypy.objspace.flow.model import checkgraph, traverse, mkentrymap def simplify_graph(graph): """inplace-apply all the existing optimisations to the graph.""" @@ -15,6 +18,9 @@ join_blocks(graph) transform_dead_op_vars(graph) remove_identical_vars(graph) + transform_ovfcheck(graph) + simplify_exceptions(graph) + remove_dead_exceptions(graph) checkgraph(graph) # ____________________________________________________________ @@ -43,6 +49,209 @@ # the while loop above will simplify recursively the new link traverse(visit, graph) +def transform_ovfcheck(graph): + """The special function calls ovfcheck and ovfcheck_lshift need to + be translated into primitive operations. ovfcheck is called directly + after an operation that should be turned into an overflow-checked + version. It is considered a syntax error if the resulting -ovf + is not defined in baseobjspace.py . + ovfcheck_lshift is special because there is no preceding operation. + Instead, it will be replaced by an OP_LSHIFT_OVF operation. + + The exception handling of the original operation is completely + ignored. Only exception handlers for the ovfcheck function call + are taken into account. This gives us the best possible control + over situations where we want exact contol over certain operations. + Example: + + try: + ovfcheck(array1[idx-1] += array2[idx+1]) + except OverflowError: + ... + + assuming two integer arrays, we are only checking the element addition + for overflows, but the indexing is not checked. + """ + # General assumption: + # empty blocks have been eliminated. + # ovfcheck can appear in the same blcok with its operation. + # this is the case if no exception handling was provided. + # Otherwise, we have a block ending in the operation, + # followed by a block with a single ovfcheck call. + from pypy.tool.rarithmetic import ovfcheck, ovfcheck_lshift + from pypy.objspace.flow.objspace import op_appendices + from pypy.objspace.flow.objspace import implicit_exceptions + covf = Constant(ovfcheck) + covfls = Constant(ovfcheck_lshift) + appendix = op_appendices[OverflowError] + renaming = {} + seen_ovfblocks = {} + + # get all blocks + blocks = {} + def visit(block): + if isinstance(block, Block): + blocks[block] = True + traverse(visit, graph) + + def is_ovfcheck(bl): + ops = bl.operations + return (ops and ops[-1].opname == "simple_call" + and ops[-1].args[0] == covf) + def is_ovfshiftcheck(bl): + ops = bl.operations + return (ops and ops[-1].opname == "simple_call" + and ops[-1].args[0] == covfls) + def is_single(bl): + return is_ovfcheck(bl) and len(bl.operations) > 1 + def is_paired(bl): + return bl.exits and is_ovfcheck(bl.exits[0].target) + def rename(v): + return renaming.get(v, v) + def remove_last_op(bl): + delop = bl.operations.pop() + assert delop.opname == "simple_call" + assert len(delop.args) == 2 + renaming[delop.result] = rename(delop.args[1]) + for exit in bl.exits: + exit.args = [rename(a) for a in exit.args] + + def check_syntax(ovfblock, block=None): + """check whether ovfblock is reachable more than once + or if they cheated about the argument""" + if block: + link = block.exits[0] + for lprev, ltarg in zip(link.args, ovfblock.inputargs): + renaming[ltarg] = rename(lprev) + arg = ovfblock.operations[0].args[-1] + res = block.operations[-1].result + opname = block.operations[-1].opname + else: + arg = ovfblock.operations[-1].args[-1] + res = ovfblock.operations[-2].result + opname = ovfblock.operations[-2].opname + if rename(arg) != rename(res) or ovfblock in seen_ovfblocks: + raise SyntaxError("ovfcheck: The checked operation %s is misplaced" + % opname) + exlis = implicit_exceptions.get("%s_%s" % (opname, appendix), []) + if OverflowError not in exlis: + raise SyntaxError("ovfcheck: Operation %s has no overflow variant") + + blocks_to_join = False + for block in blocks: + if is_ovfshiftcheck(block): + # ovfcheck_lshift: + # simply rewrite the operation + op = block.operations[-1] + op.opname = "lshift" # augmented later + op.args = op.args[1:] + elif is_single(block): + # remove the call to ovfcheck and keep the exceptions + check_syntax(block) + remove_last_op(block) + seen_ovfblocks[block] = True + elif is_paired(block): + # remove the block's exception links + link = block.exits[0] + ovfblock = link.target + check_syntax(ovfblock, block) + block.exits = [link] + block.exitswitch = None + # remove the ovfcheck call from the None target + remove_last_op(ovfblock) + seen_ovfblocks[ovfblock] = True + blocks_to_join = True + else: + continue + op = block.operations[-1] + op.opname = "%s_%s" % (op.opname, appendix) + if blocks_to_join: + join_blocks(graph) + +def simplify_exceptions(graph): + """The exception handling caused by non-implicit exceptions + starts with an exitswitch on Exception, followed by a lengthy + chain of is_/issubtype tests. We collapse them all into + the block's single list of exits and also remove unreachable + cases. + """ + clastexc = Constant(last_exception) + renaming = {} + def rename(v): + return renaming.get(v, v) + + def visit(block): + if not (isinstance(block, Block) + and block.exitswitch == clastexc and len(block.exits) == 2 + and block.exits[1].exitcase is Exception): + return + seen = [] + norm, exc = block.exits + query = exc.target + switches = [ (None, norm) ] + # collect the targets + while len(query.exits) == 2: + for lprev, ltarg in zip(exc.args, query.inputargs): + renaming[ltarg] = rename(lprev) + op = query.operations[0] + if not (op.opname in ("is_", "issubtype") and + rename(op.args[0]) == clastexc): + break + case = query.operations[0].args[-1].value + assert issubclass(case, Exception) + lno, lyes = query.exits + if case not in seen: + switches.append( (case, lyes) ) + seen.append(case) + exc = lno + query = exc.target + if Exception not in seen: + switches.append( (Exception, exc) ) + # construct the block's new exits + exits = [] + for case, oldlink in switches: + args = [rename(arg) for arg in oldlink.args] + link = Link(args, oldlink.target, case) + link.prevblock = block + exits.append(link) + block.exits = tuple(exits) + + traverse(visit, graph) + +def remove_dead_exceptions(graph): + """Exceptions can be removed if they are unreachable""" + + clastexc = Constant(last_exception) + + def issubclassofmember(cls, seq): + for member in seq: + if member and issubclass(cls, member): + return True + return False + + def visit(block): + if not (isinstance(block, Block) and block.exitswitch == clastexc): + return + exits = [] + seen = [] + for link in block.exits: + case = link.exitcase + # check whether exceptions are shadowed + if issubclassofmember(case, seen): + continue + # see if the previous case can be merged + while len(exits) > 1: + prev = exits[-1] + if not (issubclass(prev.exitcase, link.exitcase) and + prev.target is link.target and prev.args == link.args): + break + exits.pop() + exits.append(link) + seen.append(case) + block.exits = tuple(exits) + + traverse(visit, graph) + def join_blocks(graph): """Links can be deleted if they are the single exit of a block and the single entry point of the next block. When this happens, we can Modified: pypy/dist/pypy/translator/test/snippet.py ============================================================================== --- pypy/dist/pypy/translator/test/snippet.py (original) +++ pypy/dist/pypy/translator/test/snippet.py Sun May 8 21:01:11 2005 @@ -97,9 +97,7 @@ def div_func(i=numtype): try: return ovfcheck((-maxint-1) // i) - except OverflowError: - raise - except ZeroDivisionError: + except (OverflowError, ZeroDivisionError): raise def mod_func(i=numtype): @@ -116,12 +114,15 @@ except ValueError: raise +class hugelmugel(OverflowError):pass + +def hugo(a, b, c):pass + def lshift_func(i=numtype): try: + hugo(2, 3, 5) return ovfcheck_lshift((-maxint-1), i) - except OverflowError: - raise - except ValueError: + except (hugelmugel, OverflowError, StandardError, ValueError): raise def while_func(i=numtype): Modified: pypy/dist/pypy/translator/transform.py ============================================================================== --- pypy/dist/pypy/translator/transform.py (original) +++ pypy/dist/pypy/translator/transform.py Sun May 8 21:01:11 2005 @@ -71,154 +71,6 @@ op2.result) block.operations[i+1:i+2] = [new_op] -# try: -# z = ovfcheck(x y) -# except OverflowError: -# # and in some cases also -# except ZeroDivisionError: -# --> -# z = (x, y) -# -# v = ovfcheck(z) -# -# --> -# z = _ovf(x, y) -# - -def transform_ovfcheck(self): - """Transforms ovfcheck(x y) to _ofv(x, y).""" - from pypy.tool.rarithmetic import ovfcheck, ovfcheck_lshift - from pypy.objspace.flow.objspace import op_appendices - covf = Constant(ovfcheck), Constant(ovfcheck_lshift) - covfExc = Constant(OverflowError) - def is_ovfcheck(bl): - ops = bl.operations - return (ops and ops[-1].opname == "simple_call" - and ops[-1].args[0] in covf) - def is_single(bl): - return is_ovfcheck(bl)## and len(bl.operations) > 1 - def is_paired(bl): - return bl.exits and is_ovfcheck(bl.exits[0].target) - def rename(v): - return renaming.get(v, v) - for block in fully_annotated_blocks(self): - renaming = {} - if is_single(block): - print 79*"*" - print block.operations - if block.operations[-1].args[0] == covf[-1]: # rewrite it - op = block.operations[-1] - op.opname = "lshift_ovf" # XXX - op.args = op.args[1:] - continue - if len(block.operations) < 2: - continue - delop = block.operations.pop() - op = block.operations[-1] - assert len(delop.args) == 2 - renaming[delop.result] = delop.args[1] - exits = [] - for exit in block.exits: - args = [rename(a) for a in exit.args] - exits.append(Link(args, exit.target, exit.exitcase)) - elif is_paired(block): - print 79*"+" - print block.operations - ovfblock = block.exits[0].target - if ovfblock.operations[0].args[0] == covf[-1]: # rewrite it - op = ovfblock.operations[0] - op.opname = "lshift_ovf" # XXX - op.args = op.args[1:] - continue - assert len(ovfblock.operations) == 1 - op = block.operations[-1] - exits = list(block.exits) - # shortcut the "no exception" path - exits[0].target = ovfblock.exits[0].target - if len(ovfblock.exits) > 1: - # merge the exception link - assert len(ovfblock.exits) == 2 - ovexp = ovfblock.exits[1] - # space from block, last_ from ovfblock - args = exits[0].args[:len(ovexp.args)-2] + ovexp.args[-2:] - exits.append(Link(args, ovexp.target, ovexp.exitcase)) - block.exitswitch = ovfblock.exitswitch - else: - continue - # replace the generic exception handler by the direct case - for exit in exits: - if exit.exitcase is Exception: - bl = exit.target - while len(bl.exits) == 2: - lastoparg = bl.operations[0].args[-1] - del bl.operations[:] - bl.exitswitch = None - if lastoparg == covfExc: - exit.exitcase = OverflowError - bl.exits = [bl.exits[1]] - bl.exits[0].exitcase = None - break - else: - bl.exits = [bl.exits[0]] - bl = bl.exits[0].target - block.exits = [] - block.recloseblock(*exits) - # finally, mangle the operation name - #apps = [op_appendices[exit.exitcase] for exit in block.exits[1:]] - #apps.sort() - #if apps.count("ovf") == 2: apps.remove("ovf") # XXX HACK - op.opname += '_ovf' # .join([op.opname]+apps) - -def xxx_transform_ovfcheck(self): - """removes ovfcheck and ovfcheck_lshift calls""" - from pypy.tool.rarithmetic import ovfcheck, ovfcheck_lshift - covf = Constant(ovfcheck) - covflshift = Constant(ovfcheck_lshift) - covf_tests = covf, covflshift - - def get_ovfcheck(bl): - ops = bl.operations - if ops: - op = ops[-1] - if (op.opname == "simple_call" and op.args[0] in covf_tests): - return op.args[0] - return None - - def rename(v): - return renaming.get(v, v) - - for block in fully_annotated_blocks(self): - renaming = {} - func = get_ovfcheck(block) - if not func: - continue - if func == covf: - print 30*"*", "ovfcheck" - # it is considered a programming error if ovfcheck is - # called on an operation that cannot raise. - # That means ovfcheck must be the blocks's only operation - assert len(block.operations) == 1, """ovfcheck is called on -an operation that cannot raise an exception""" - # we remove the operation and error exits. - delop = block.operations.pop() - assert len(delop.args) == 2 - renaming[delop.result] = delop.args[1] - exits = [] - # leave the default exit, only - for exit in block.exits[:1]: - args = [rename(a) for a in exit.args] - exits.append(Link(args, exit.target, exit.exitcase)) - block.exits = exits - block.exitswitch = None - else: - print 30*"+", "ovfcheck_lshift" - # the only thing we have to do here is to replace - # the function call by an lshift operator - op = block.operations[-1] - op.opname = "lshift" - op.args = op.args[1:] # drop the function - - # a(*b) # --> # c = newtuple(*b) @@ -464,18 +316,7 @@ transform_dead_code(ann) transform_allocate(ann) transform_slice(ann) - from pypy.translator.simplify import join_blocks - # testing the is_single case: - #if ann.translator: - # for graph in ann.translator.flowgraphs.values(): - # join_blocks(graph) - transform_ovfcheck(ann) ##transform_listextend(ann) # do this last, after the previous transformations had a # chance to remove dependency on certain variables transform_dead_op_vars(ann) - if ann.translator: - # see again if we caused trivial blocks - for graph in ann.translator.flowgraphs.values(): - join_blocks(graph) - ann.translator.checkgraphs() From tismer at codespeak.net Sun May 8 21:02:21 2005 From: tismer at codespeak.net (tismer at codespeak.net) Date: Sun, 8 May 2005 21:02:21 +0200 (CEST) Subject: [pypy-svn] r12077 - pypy/dist/pypy/translator Message-ID: <20050508190221.AF26427BBA@code1.codespeak.net> Author: tismer Date: Sun May 8 21:02:21 2005 New Revision: 12077 Modified: pypy/dist/pypy/translator/simplify.py Log: tiny oops Modified: pypy/dist/pypy/translator/simplify.py ============================================================================== --- pypy/dist/pypy/translator/simplify.py (original) +++ pypy/dist/pypy/translator/simplify.py Sun May 8 21:02:21 2005 @@ -135,7 +135,8 @@ % opname) exlis = implicit_exceptions.get("%s_%s" % (opname, appendix), []) if OverflowError not in exlis: - raise SyntaxError("ovfcheck: Operation %s has no overflow variant") + raise SyntaxError("ovfcheck: Operation %s has no overflow variant" + % opname) blocks_to_join = False for block in blocks: From tismer at codespeak.net Sun May 8 21:08:25 2005 From: tismer at codespeak.net (tismer at codespeak.net) Date: Sun, 8 May 2005 21:08:25 +0200 (CEST) Subject: [pypy-svn] r12078 - pypy/dist/pypy/translator Message-ID: <20050508190825.6048B27BBA@code1.codespeak.net> Author: tismer Date: Sun May 8 21:08:25 2005 New Revision: 12078 Modified: pypy/dist/pypy/translator/simplify.py Log: disabled syntax check for now, I get a problem with targetpypymain Modified: pypy/dist/pypy/translator/simplify.py ============================================================================== --- pypy/dist/pypy/translator/simplify.py (original) +++ pypy/dist/pypy/translator/simplify.py Sun May 8 21:08:25 2005 @@ -119,6 +119,7 @@ def check_syntax(ovfblock, block=None): """check whether ovfblock is reachable more than once or if they cheated about the argument""" + return # still a bug if block: link = block.exits[0] for lprev, ltarg in zip(link.args, ovfblock.inputargs): From hpk at codespeak.net Sun May 8 21:46:42 2005 From: hpk at codespeak.net (hpk at codespeak.net) Date: Sun, 8 May 2005 21:46:42 +0200 (CEST) Subject: [pypy-svn] r12079 - in pypy/dist/pypy: lib module tool Message-ID: <20050508194642.8141127BBA@code1.codespeak.net> Author: hpk Date: Sun May 8 21:46:42 2005 New Revision: 12079 Modified: pypy/dist/pypy/lib/_exceptions.py pypy/dist/pypy/module/exceptionsinterp.py pypy/dist/pypy/tool/_enum_exceptions.py Log: ok, found the steps one needs to do for adding a __str__ implementation (to EnvironmentError), for easier redoing here are the steps: python tool/_enum_exceptions.py mv lib/_exceptions.pre.py lib/_exceptions.py python translator/tool/tointerplevel.py --modname exceptions --out module/exceptionsinterp.py lib/_exceptions.py hope i didn't miss anything. It would indeed be nice to have this all more automated/hidden. Modified: pypy/dist/pypy/lib/_exceptions.py ============================================================================== --- pypy/dist/pypy/lib/_exceptions.py (original) +++ pypy/dist/pypy/lib/_exceptions.py Sun May 8 21:46:42 2005 @@ -191,16 +191,15 @@ self.filename = args[2] self.args = (args[0], args[1]) - # auto-generated code, please check carefully! - def __str__(self): - # this is a bad hack, please supply an implementation - res = ' '.join([ - 'errno=' + str(getattr(self, 'errno', None)), - 'args=' + str(getattr(self, 'args', None)), - 'strerror=' + str(getattr(self, 'strerror', None)), - 'filename=' + str(getattr(self, 'filename', None)), - ]) - return res + def __str__(self): + if self.filename is not None: + return "[Errno %s] %s: %s" % (self.errno, + self.strerror, + self.filename) + if self.errno and self.strerror: + return "[Errno %s] %s" % (self.errno, self.strerror) + return StandardError.__str__(self) + class OSError(EnvironmentError): """OS system call failed.""" Modified: pypy/dist/pypy/module/exceptionsinterp.py ============================================================================== --- pypy/dist/pypy/module/exceptionsinterp.py (original) +++ pypy/dist/pypy/module/exceptionsinterp.py Sun May 8 21:46:42 2005 @@ -157,7 +157,7 @@ # global object gs_EOFError # global object gcls_EOFError # global object gs___file__ -# global object gs__u_pedronis_PyPy_dist_pypy_lib__ +# global object gs__home_hpk_pypy_dist_pypy_lib__ex # global object gs_TabError # global object gcls_TabError # global object gs_UnicodeEncodeError @@ -724,14 +724,13 @@ ##SECTION## ## filename 'lib/_exceptions.py' ## function '__str__' -## firstlineno 195 +## firstlineno 194 ##SECTION## # global declarations # global object gs_errno -# global object gs_errno_ # global object gs_strerror -# global object gs_strerror_ -# global object gs_filename_ +# global object gs__Errno__s___s___s +# global object gs__Errno__s___s def __str__(space, __args__): funcname = "__str__" @@ -747,32 +746,74 @@ while True: if goto == 1: - w_0 = space.call_function((space.builtin.get(space.str_w(gs_getattr))), w_self, gs_errno, space.w_None) - w_1 = space.str(w_0) - w_2 = space.add(gs_errno_, w_1) - w_3 = space.call_function((space.builtin.get(space.str_w(gs_getattr))), w_self, gs_args, space.w_None) - w_4 = space.str(w_3) - w_5 = space.add(gs_args_, w_4) - w_6 = space.call_function((space.builtin.get(space.str_w(gs_getattr))), w_self, gs_strerror, space.w_None) - w_7 = space.str(w_6) - w_8 = space.add(gs_strerror_, w_7) - w_9 = space.call_function((space.builtin.get(space.str_w(gs_getattr))), w_self, gs_filename, space.w_None) - w_10 = space.str(w_9) - w_11 = space.add(gs_filename_, w_10) - w_12 = space.newlist([w_2, w_5, w_8, w_11]) - w_13 = space.call_function(gbltinmethod_join, w_12) - w_14 = w_13 - goto = 2 + w_0 = space.getattr(w_self, gs_filename) + w_1 = space.is_(w_0, space.w_None) + v0 = space.is_true(w_1) + if v0 == True: + w_self_1 = w_self + goto = 3 + else: + assert v0 == False + w_self_2 = w_self + goto = 2 if goto == 2: - return w_14 + w_2 = space.getattr(w_self_2, gs_errno) + w_3 = space.getattr(w_self_2, gs_strerror) + w_4 = space.getattr(w_self_2, gs_filename) + w_5 = space.newtuple([w_2, w_3, w_4]) + w_6 = space.mod(gs__Errno__s___s___s, w_5) + w_7 = w_6 + goto = 8 + + if goto == 3: + w_8 = space.getattr(w_self_1, gs_errno) + v1 = space.is_true(w_8) + if v1 == True: + w_self_3 = w_self_1 + goto = 4 + else: + assert v1 == False + w_self_4, w_9 = w_self_1, w_8 + goto = 5 + + if goto == 4: + w_10 = space.getattr(w_self_3, gs_strerror) + w_self_4, w_9 = w_self_3, w_10 + goto = 5 + + if goto == 5: + v2 = space.is_true(w_9) + if v2 == True: + w_self_5 = w_self_4 + goto = 6 + else: + assert v2 == False + w_11 = w_self_4 + goto = 7 + + if goto == 6: + w_12 = space.getattr(w_self_5, gs_errno) + w_13 = space.getattr(w_self_5, gs_strerror) + w_14 = space.newtuple([w_12, w_13]) + w_15 = space.mod(gs__Errno__s___s, w_14) + w_7 = w_15 + goto = 8 + + if goto == 7: + w_16 = fastf_Exception___str__(space, w_11) + w_7 = w_16 + goto = 8 + + if goto == 8: + return w_7 fastf_EnvironmentError___str__ = __str__ ##SECTION## ## filename 'lib/_exceptions.py' ## function '__init__' -## firstlineno 239 +## firstlineno 238 ##SECTION## def __init__(space, __args__): funcname = "__init__" @@ -841,11 +882,11 @@ ##SECTION## ## filename 'lib/_exceptions.py' ## function '__str__' -## firstlineno 250 +## firstlineno 249 ##SECTION## # global declarations -# global object gfunc_basename # global object gs____ +# global object gfunc_basename # global object gs__s___s__line__ld_ # global object gs__s___s_ # global object gs__s__line__ld_ @@ -879,7 +920,7 @@ if goto == 2: w_4 = space.getattr(w_3, gs_msg) w_5 = w_4 - goto = 15 + goto = 13 if goto == 3: w_6 = space.getattr(w_self_1, gs_msg) @@ -910,7 +951,7 @@ else: assert v2 == False w_5 = w_buffer - goto = 15 + goto = 13 if goto == 5: w_14 = space.getattr(w_self_3, gs_filename) @@ -919,99 +960,86 @@ (w_self_4, w_buffer_2, w_have_lineno_2, w_have_filename_2, w_15) = (w_self_3, w_buffer_1, w_have_lineno_1, w_have_filename_1, w_14) - goto = 7 + goto = 6 else: assert v3 == False - (w_self_5, w_buffer_3, w_have_lineno_3, - w_have_filename_3) = (w_self_3, w_buffer_1, w_have_lineno_1, - w_have_filename_1) + (w_self_4, w_buffer_2, w_have_lineno_2, w_have_filename_2, + w_15) = (w_self_3, w_buffer_1, w_have_lineno_1, + w_have_filename_1, gs____) goto = 6 if goto == 6: - w_16 = fastf_basename(space, gs____) - (w_self_6, w_fname, w_buffer_4, w_have_lineno_4, - w_have_filename_4) = (w_self_5, w_16, w_buffer_3, - w_have_lineno_3, w_have_filename_3) - goto = 8 - - if goto == 7: - w_17 = fastf_basename(space, w_15) - (w_self_6, w_fname, w_buffer_4, w_have_lineno_4, - w_have_filename_4) = (w_self_4, w_17, w_buffer_2, - w_have_lineno_2, w_have_filename_2) - goto = 8 - - if goto == 8: - v4 = space.is_true(w_have_filename_4) + w_16 = fastf_basename(space, w_15) + v4 = space.is_true(w_have_filename_2) if v4 == True: - (w_self_7, w_fname_1, w_buffer_5, w_have_lineno_5, - w_have_filename_5, w_18) = (w_self_6, w_fname, w_buffer_4, - w_have_lineno_4, w_have_filename_4, w_have_lineno_4) - goto = 9 + (w_self_5, w_fname, w_buffer_3, w_have_lineno_3, + w_have_filename_3, w_17) = (w_self_4, w_16, w_buffer_2, + w_have_lineno_2, w_have_filename_2, w_have_lineno_2) + goto = 7 else: assert v4 == False - (w_self_7, w_fname_1, w_buffer_5, w_have_lineno_5, - w_have_filename_5, w_18) = (w_self_6, w_fname, w_buffer_4, - w_have_lineno_4, w_have_filename_4, w_have_filename_4) + (w_self_5, w_fname, w_buffer_3, w_have_lineno_3, + w_have_filename_3, w_17) = (w_self_4, w_16, w_buffer_2, + w_have_lineno_2, w_have_filename_2, w_have_filename_2) + goto = 7 + + if goto == 7: + v5 = space.is_true(w_17) + if v5 == True: + w_self_6, w_fname_1 = w_self_5, w_fname + goto = 8 + else: + assert v5 == False + (w_self_7, w_fname_2, w_buffer_4, w_have_lineno_4, + w_18) = (w_self_5, w_fname, w_buffer_3, w_have_lineno_3, + w_have_filename_3) goto = 9 + if goto == 8: + w_19 = space.getattr(w_self_6, gs_msg) + w_20 = space.getattr(w_self_6, gs_lineno) + w_21 = space.newtuple([w_19, w_fname_1, w_20]) + w_22 = space.mod(gs__s___s__line__ld_, w_21) + w_5 = w_22 + goto = 13 + if goto == 9: - v5 = space.is_true(w_18) - if v5 == True: - w_self_8, w_fname_2 = w_self_7, w_fname_1 + v6 = space.is_true(w_18) + if v6 == True: + w_fname_3, w_23 = w_fname_2, w_self_7 goto = 10 else: - assert v5 == False - (w_self_9, w_fname_3, w_buffer_6, w_have_lineno_6, - w_19) = (w_self_7, w_fname_1, w_buffer_5, w_have_lineno_5, - w_have_filename_5) + assert v6 == False + (w_self_8, w_buffer_5, w_24) = (w_self_7, w_buffer_4, + w_have_lineno_4) goto = 11 if goto == 10: - w_20 = space.getattr(w_self_8, gs_msg) - w_21 = space.getattr(w_self_8, gs_lineno) - w_22 = space.newtuple([w_20, w_fname_2, w_21]) - w_23 = space.mod(gs__s___s__line__ld_, w_22) - w_5 = w_23 - goto = 15 + w_25 = space.getattr(w_23, gs_msg) + w_26 = space.newtuple([w_25, w_fname_3]) + w_27 = space.mod(gs__s___s_, w_26) + w_5 = w_27 + goto = 13 if goto == 11: - v6 = space.is_true(w_19) - if v6 == True: - w_fname_4, w_24 = w_fname_3, w_self_9 + v7 = space.is_true(w_24) + if v7 == True: + w_self_9 = w_self_8 goto = 12 else: - assert v6 == False - (w_self_10, w_buffer_7, w_25) = (w_self_9, w_buffer_6, - w_have_lineno_6) + assert v7 == False + w_5 = w_buffer_5 goto = 13 if goto == 12: - w_26 = space.getattr(w_24, gs_msg) - w_27 = space.newtuple([w_26, w_fname_4]) - w_28 = space.mod(gs__s___s_, w_27) - w_5 = w_28 - goto = 15 + w_28 = space.getattr(w_self_9, gs_msg) + w_29 = space.getattr(w_self_9, gs_lineno) + w_30 = space.newtuple([w_28, w_29]) + w_31 = space.mod(gs__s__line__ld_, w_30) + w_5 = w_31 + goto = 13 if goto == 13: - v7 = space.is_true(w_25) - if v7 == True: - w_self_11 = w_self_10 - goto = 14 - else: - assert v7 == False - w_5 = w_buffer_7 - goto = 15 - - if goto == 14: - w_29 = space.getattr(w_self_11, gs_msg) - w_30 = space.getattr(w_self_11, gs_lineno) - w_31 = space.newtuple([w_29, w_30]) - w_32 = space.mod(gs__s__line__ld_, w_31) - w_5 = w_32 - goto = 15 - - if goto == 15: return w_5 fastf_SyntaxError___str__ = __str__ @@ -1019,7 +1047,7 @@ ##SECTION## ## filename 'lib/_exceptions.py' ## function '__init__' -## firstlineno 276 +## firstlineno 275 ##SECTION## # global declaration # global object gs_code @@ -1096,7 +1124,7 @@ ##SECTION## ## filename 'lib/_exceptions.py' ## function '__init__' -## firstlineno 311 +## firstlineno 310 ##SECTION## def __init__(space, __args__): funcname = "__init__" @@ -1146,7 +1174,7 @@ ##SECTION## ## filename 'lib/_exceptions.py' ## function '__str__' -## firstlineno 322 +## firstlineno 321 ##SECTION## def __str__(space, __args__): funcname = "__str__" @@ -1193,7 +1221,7 @@ ##SECTION## ## filename 'lib/_exceptions.py' ## function '__init__' -## firstlineno 371 +## firstlineno 370 ##SECTION## # global declaration # global object gi_5 @@ -1246,7 +1274,7 @@ ##SECTION## ## filename 'lib/_exceptions.py' ## function '__str__' -## firstlineno 382 +## firstlineno 381 ##SECTION## # global declarations # global object gs_encoding @@ -1550,9 +1578,9 @@ space.setitem(g46dict, gs_EOFError, gcls_EOFError) space.setitem(g46dict, gs_StandardError, gcls_StandardError) gs___file__ = space.wrap('__file__') - gs__u_pedronis_PyPy_dist_pypy_lib__ = space.wrap( -"""/u/pedronis/PyPy/dist/pypy/lib/_exceptions.py""") - space.setitem(g46dict, gs___file__, gs__u_pedronis_PyPy_dist_pypy_lib__) + gs__home_hpk_pypy_dist_pypy_lib__ex = space.wrap( +"""/home/hpk/pypy-dist/pypy/lib/_exceptions.py""") + space.setitem(g46dict, gs___file__, gs__home_hpk_pypy_dist_pypy_lib__ex) gs_TabError = space.wrap('TabError') _dic = space.newdict([]) space.setitem(_dic, gs___module__, gs__exceptions) @@ -1764,12 +1792,11 @@ gi_2 = space.wrap(2) gi_3 = space.wrap(3) gs_errno = space.wrap('errno') - gs_errno_ = space.wrap('errno=') gs_strerror = space.wrap('strerror') - gs_strerror_ = space.wrap('strerror=') - gs_filename_ = space.wrap('filename=') - gfunc_basename = space.wrap(gateway.interp2app(f_basename, unwrap_spec=[gateway.ObjSpace, gateway.Arguments])) + gs__Errno__s___s___s = space.wrap('[Errno %s] %s: %s') + gs__Errno__s___s = space.wrap('[Errno %s] %s') gs____ = space.wrap('???') + gfunc_basename = space.wrap(gateway.interp2app(f_basename, unwrap_spec=[gateway.ObjSpace, gateway.Arguments])) gs__s___s__line__ld_ = space.wrap('%s (%s, line %ld)') gs__s___s_ = space.wrap('%s (%s)') gs__s__line__ld_ = space.wrap('%s (line %ld)') Modified: pypy/dist/pypy/tool/_enum_exceptions.py ============================================================================== --- pypy/dist/pypy/tool/_enum_exceptions.py (original) +++ pypy/dist/pypy/tool/_enum_exceptions.py Sun May 8 21:46:42 2005 @@ -4,8 +4,8 @@ # The idea is to use it once to create # a template for a re-birth of exceptions.py +import autopath import types - from pypy.tool.sourcetools import render_docstr def classOfAttribute(klass, attname): @@ -358,9 +358,19 @@ elif have_lineno: buffer = "%s (line %ld)" % (self.msg, self.lineno) return buffer - known__str__[SyntaxError] = __str__ +# EnvironmentError +def __str__(self): + if self.filename is not None: + return "[Errno %s] %s: %s" % (self.errno, + self.strerror, + self.filename) + if self.errno and self.strerror: + return "[Errno %s] %s" % (self.errno, self.strerror) + return StandardError.__str__(self) +known__str__[EnvironmentError] = __str__ + if __name__ == "__main__": import pypy, os prefix = os.path.dirname(pypy.__file__) From tismer at codespeak.net Sun May 8 22:04:01 2005 From: tismer at codespeak.net (tismer at codespeak.net) Date: Sun, 8 May 2005 22:04:01 +0200 (CEST) Subject: [pypy-svn] r12080 - pypy/dist/pypy/translator Message-ID: <20050508200401.D041527BB6@code1.codespeak.net> Author: tismer Date: Sun May 8 22:04:01 2005 New Revision: 12080 Modified: pypy/dist/pypy/translator/simplify.py Log: fixed a special situation where my block matching got arong result, via the syntax error exception. There is still one problem left that shows up in tergetpypymain, when I seem to produce a bad last_exc_val constant over anonexceptionallink. Will try to nail that down. Modified: pypy/dist/pypy/translator/simplify.py ============================================================================== --- pypy/dist/pypy/translator/simplify.py (original) +++ pypy/dist/pypy/translator/simplify.py Sun May 8 22:04:01 2005 @@ -74,7 +74,7 @@ """ # General assumption: # empty blocks have been eliminated. - # ovfcheck can appear in the same blcok with its operation. + # ovfcheck can appear in the same block with its operation. # this is the case if no exception handling was provided. # Otherwise, we have a block ending in the operation, # followed by a block with a single ovfcheck call. @@ -105,7 +105,10 @@ def is_single(bl): return is_ovfcheck(bl) and len(bl.operations) > 1 def is_paired(bl): - return bl.exits and is_ovfcheck(bl.exits[0].target) + if bl.exits: + ovfblock = bl.exits[0].target + return (bl.exits and is_ovfcheck(ovfblock) and + len(ovfblock.operations) == 1) def rename(v): return renaming.get(v, v) def remove_last_op(bl): @@ -119,7 +122,6 @@ def check_syntax(ovfblock, block=None): """check whether ovfblock is reachable more than once or if they cheated about the argument""" - return # still a bug if block: link = block.exits[0] for lprev, ltarg in zip(link.args, ovfblock.inputargs): @@ -132,12 +134,14 @@ res = ovfblock.operations[-2].result opname = ovfblock.operations[-2].opname if rename(arg) != rename(res) or ovfblock in seen_ovfblocks: + import __main__ + __main__.problem = graph raise SyntaxError("ovfcheck: The checked operation %s is misplaced" - % opname) + " - see __main__.problem.view()" % opname) exlis = implicit_exceptions.get("%s_%s" % (opname, appendix), []) if OverflowError not in exlis: raise SyntaxError("ovfcheck: Operation %s has no overflow variant" - % opname) + " - see __main__.problem.view()" % opname) blocks_to_join = False for block in blocks: From hpk at codespeak.net Sun May 8 22:54:21 2005 From: hpk at codespeak.net (hpk at codespeak.net) Date: Sun, 8 May 2005 22:54:21 +0200 (CEST) Subject: [pypy-svn] r12085 - pypy/dist/lib-python/modified-2.3.4/test Message-ID: <20050508205421.55F7627BBA@code1.codespeak.net> Author: hpk Date: Sun May 8 22:54:21 2005 New Revision: 12085 Added: pypy/dist/lib-python/modified-2.3.4/test/test_tempfile.py - copied, changed from r12065, pypy/dist/lib-python/2.3.4/test/test_tempfile.py pypy/dist/lib-python/modified-2.3.4/test/tf_inherit_check.py - copied unchanged from r12065, pypy/dist/lib-python/2.3.4/test/tf_inherit_check.py Log: fixed the last failure in test_tempfile.py which assumed early finalization via __del__ just for a Testcase.tearDown method, so modified that to not be dependent on this GC detail. I also had to copy the unmodified tf_inherit.py because test_tempfile.py uses it for fd's close-on-exec subprocess tests (this is one of the reasons why i think that tests should temporarily create such test files somewhere instead of using files that come along with tests, it's just more self-contained). Copied: pypy/dist/lib-python/modified-2.3.4/test/test_tempfile.py (from r12065, pypy/dist/lib-python/2.3.4/test/test_tempfile.py) ============================================================================== --- pypy/dist/lib-python/2.3.4/test/test_tempfile.py (original) +++ pypy/dist/lib-python/modified-2.3.4/test/test_tempfile.py Sun May 8 22:54:21 2005 @@ -496,8 +496,9 @@ self.dir = tempfile.mkdtemp() def tearDown(self): + import shutil if self.dir: - os.rmdir(self.dir) + shutil.rmtree(self.dir) self.dir = None class mktemped: From pedronis at codespeak.net Sun May 8 23:06:37 2005 From: pedronis at codespeak.net (pedronis at codespeak.net) Date: Sun, 8 May 2005 23:06:37 +0200 (CEST) Subject: [pypy-svn] r12086 - pypy/dist/pypy/lib Message-ID: <20050508210637.7229927BBC@code1.codespeak.net> Author: pedronis Date: Sun May 8 23:06:37 2005 New Revision: 12086 Added: pypy/dist/pypy/lib/inprogress_binascii.py - copied unchanged from r12068, pypy/dist/pypy/lib/binascii.py Removed: pypy/dist/pypy/lib/binascii.py Log: disable it for now, it generates failure that makes hard to see problems with things we are really interested right like object model impl details Deleted: /pypy/dist/pypy/lib/binascii.py ============================================================================== --- /pypy/dist/pypy/lib/binascii.py Sun May 8 23:06:37 2005 +++ (empty file) @@ -1,299 +0,0 @@ -class Error(Exception): - pass - -class Incomplete(Exception): - pass - -def a2b_uu(s): - length = (ord(s[0]) - 0x20) % 64 - a = quadruplets(s[1:].rstrip()) - try: - result = [''.join( - [chr((A - 0x20) << 2 | (((B - 0x20) >> 4) & 0x3)), - chr(((B - 0x20) & 0xF) << 4 | (((C - 0x20) >> 2) & 0xF)), - chr(((C - 0x20) & 0x3) << 6 | ((D - 0x20) & 0x3F)) - ]) for A, B, C, D in a] - except ValueError: - raise Error, 'Illegal char' - result = ''.join(result) - trailingdata = result[length:] - if trailingdata.strip('\x00'): - raise Error, 'Trailing garbage' - result = result[:length] - if len(result) < length: - result += ((length - len(result)) * '\x00') - return result - -def quadruplets(s): - while s: - try: - a, b, c, d = s[0], s[1], s[2], s[3] - except IndexError: - s += ' ' - yield ord(s[0]), ord(s[1]), ord(s[2]), ord(s[3]) - return - s = s[4:] - yield ord(a), ord(b), ord(c), ord(d) - -def b2a_uu(s): - length = len(s) - if length > 45: - raise Error, 'At most 45 bytes at once' - - a = triples(s) - result = [''.join( - [chr(0x20 + (( A >> 2 ) & 0x3F)), - chr(0x20 + (((A << 4) | ((B >> 4) & 0xF)) & 0x3F)), - chr(0x20 + (((B << 2) | ((C >> 6) & 0x3)) & 0x3F)), - chr(0x20 + (( C ) & 0x3F))]) for A, B, C in a] - return chr(ord(' ') + (length & 077)) + ''.join(result) + '\n' - -def triples(s): - while s: - try: - a, b, c = s[0], s[1], s[2] - except IndexError: - s += '\0\0' - yield ord(s[0]), ord(s[1]), ord(s[2]) - return - s = s[3:] - yield ord(a), ord(b), ord(c) - - -table_a2b_base64 = { - 'A': 0, - 'B': 1, - 'C': 2, - 'D': 3, - 'E': 4, - 'F': 5, - 'G': 6, - 'H': 7, - 'I': 8, - 'J': 9, - 'K': 10, - 'L': 11, - 'M': 12, - 'N': 13, - 'O': 14, - 'P': 15, - 'Q': 16, - 'R': 17, - 'S': 18, - 'T': 19, - 'U': 20, - 'V': 21, - 'W': 22, - 'X': 23, - 'Y': 24, - 'Z': 25, - 'a': 26, - 'b': 27, - 'c': 28, - 'd': 29, - 'e': 30, - 'f': 31, - 'g': 32, - 'h': 33, - 'i': 34, - 'j': 35, - 'k': 36, - 'l': 37, - 'm': 38, - 'n': 39, - 'o': 40, - 'p': 41, - 'q': 42, - 'r': 43, - 's': 44, - 't': 45, - 'u': 46, - 'v': 47, - 'w': 48, - 'x': 49, - 'y': 50, - 'z': 51, - '0': 52, - '1': 53, - '2': 54, - '3': 55, - '4': 56, - '5': 57, - '6': 58, - '7': 59, - '8': 60, - '9': 61, - '+': 62, - '/': 63, -} - -def quadruplets_base64(s): - while s: - a, b, c, d = table_a2b_base64[s[0]], table_a2b_base64[s[1]], table_a2b_base64[s[2]], table_a2b_base64[s[3]] - s = s[4:] - yield a, b, c, d - -def a2b_base64(s): - s = s.rstrip() - # clean out all invalid characters, this also strips the final '=' padding - clean_s = [] - for item in s: - if item in table_a2b_base64: - clean_s.append(item) - s = ''.join(clean_s) - # Add '=' padding back into the string - if len(s) % 4: - s = s + ('=' * (4 - len(s) % 4)) - - a = quadruplets_base64(s[:-4]) - result = [ - chr(A << 2 | ((B >> 4) & 0x3)) + - chr((B & 0xF) << 4 | ((C >> 2 ) & 0xF)) + - chr((C & 0x3) << 6 | D ) - for A, B, C, D in a] - - if s: - final = s[-4:] - if final[2] == '=': - A = table_a2b_base64[final[0]] - B = table_a2b_base64[final[1]] - snippet = chr(A << 2 | ((B >> 4) & 0x3)) - elif final[3] == '=': - A = table_a2b_base64[final[0]] - B = table_a2b_base64[final[1]] - C = table_a2b_base64[final[2]] - snippet = chr(A << 2 | ((B >> 4) & 0x3)) + \ - chr((B & 0xF) << 4 | ((C >> 2 ) & 0xF)) - else: - A = table_a2b_base64[final[0]] - B = table_a2b_base64[final[1]] - C = table_a2b_base64[final[2]] - D = table_a2b_base64[final[3]] - snippet = chr(A << 2 | ((B >> 4) & 0x3)) + \ - chr((B & 0xF) << 4 | ((C >> 2 ) & 0xF)) + \ - chr((C & 0x3) << 6 | D ) - result.append(snippet) - - return ''.join(result) - -table_b2a_base64 = \ -"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/" - -def b2a_base64(s): - length = len(s) - final_length = length % 3 - - a = triples(s[ :length - final_length]) - - result = [''.join( - [table_b2a_base64[( A >> 2 ) & 0x3F], - table_b2a_base64[((A << 4) | ((B >> 4) & 0xF)) & 0x3F], - table_b2a_base64[((B << 2) | ((C >> 6) & 0x3)) & 0x3F], - table_b2a_base64[( C ) & 0x3F]]) - for A, B, C in a] - - final = s[length - final_length:] - if final_length == 0: - snippet = '' - elif final_length == 1: - a = ord(final[0]) - snippet = table_b2a_base64[(a >> 2 ) & 0x3F] + \ - table_b2a_base64[(a << 4 ) & 0x3F] + '==' - else: - a = ord(final[0]) - b = ord(final[1]) - snippet = table_b2a_base64[(a >> 2) & 0x3F] + \ - table_b2a_base64[((a << 4) | (b >> 4) & 0xF) & 0x3F] + \ - table_b2a_base64[(b << 2) & 0x3F] + '=' - return ''.join(result) + snippet + '\n' - -def a2b_qp(s): - parts = s.rstrip().split('=') - - # Change the parts in-place - for index, part in enumerate(parts[1:]): - if len(part) > 1 and part[0] in hex_numbers and part[1] in hex_numbers: - parts[index + 1] = chr(strhex_to_int(part[0:2])) + part[2:] - elif index == len(parts) - 2 and len(part) < 2: - parts[index + 1] = '' - else: - parts[index + 1] = '=' + parts[index + 1] - - return ''.join(parts) - -def b2a_qp(s): - """ In this implementation, we are quoting all spaces and tab character. - This is ok by the standard, though it slightly reduces the - readability of the quoted string. The CPython implementation - preserves internal whitespace, which is a different way of - implementing the standard. The reason we are doing things differently - is that it greatly simplifies the code. - - The CPython implementation does not escape CR and LF characters - and does not encode newlines as CRLF sequences. This seems to be - non-standard, and we copy this behaviour. - """ - crlf = s.find('\r\n') - lf = s.find('\n') - linebreak = None - if crlf >= 0 and crlf <= lf: - linebreak = '\r\n' - elif lf > 0: - linebreak = '\n' - - if linebreak: - s = s.replace('\r\n', '\n') - - lines = s.split('\n') - - result = [] - for line in lines: - charlist = [] - count = 0 - for c in line: - if '!' <= c <= '<' or '>' <= c <= '~' or c in '\n\r': - if count >= 75: - charlist.append('=\r\n') - count = 0 - charlist.append(c) - count += 1 - else: - if count >= 72: - charlist.append('=\r\n') - count = 0 - snippet = '=' + two_hex_digits(ord(c)) - count += len(snippet) - charlist.append(snippet) - result.append(''.join(charlist)) - return linebreak.join(result) - -hex_numbers = '0123456789ABCDEF' -def hex(n): - if n == 0: - return '0' - - if n < 0: - n = -n - sign = '-' - else: - sign = '' - arr = [] - for nibble in hexgen(n): - arr = [hex_numbers[nibble]] + arr - return sign + ''.join(arr) - -def two_hex_digits(n): - return hex_numbers[n / 0x10] + hex_numbers[n % 0x10] - -def hexgen(n): - """ Yield a nibble at a time. """ - while n: - remainder = n % 0x10 - n = n / 0x10 - yield remainder - -def strhex_to_int(s): - i = 0 - for c in s: - i = i * 0x10 + hex_numbers.index(c) - return i From hpk at codespeak.net Sun May 8 23:08:08 2005 From: hpk at codespeak.net (hpk at codespeak.net) Date: Sun, 8 May 2005 23:08:08 +0200 (CEST) Subject: [pypy-svn] r12087 - pypy/dist/pypy/lib/test2 Message-ID: <20050508210808.5F39627BBC@code1.codespeak.net> Author: hpk Date: Sun May 8 23:08:07 2005 New Revision: 12087 Added: pypy/dist/pypy/lib/test2/test_exception_extra.py Log: forgot to commit a test last time Added: pypy/dist/pypy/lib/test2/test_exception_extra.py ============================================================================== --- (empty file) +++ pypy/dist/pypy/lib/test2/test_exception_extra.py Sun May 8 23:08:07 2005 @@ -0,0 +1,11 @@ + +from pypy.lib import _exceptions as ex + +def test_environmenterror_repr(): + e = ex.EnvironmentError("hello") + assert str(e) == "hello" + e = ex.EnvironmentError(1, "hello") + assert str(e) == "[Errno 1] hello" + e = ex.EnvironmentError(1, "hello", "world") + assert str(e) == "[Errno 1] hello: world" + From hpk at codespeak.net Sun May 8 23:23:07 2005 From: hpk at codespeak.net (hpk at codespeak.net) Date: Sun, 8 May 2005 23:23:07 +0200 (CEST) Subject: [pypy-svn] r12089 - pypy/dist/lib-python/modified-2.3.4/test Message-ID: <20050508212307.6627A27BCC@code1.codespeak.net> Author: hpk Date: Sun May 8 23:23:07 2005 New Revision: 12089 Modified: pypy/dist/lib-python/modified-2.3.4/test/test_tempfile.py Log: even more care is needed for tearDown() because of random GC interactions (i guess). the test now really passes Modified: pypy/dist/lib-python/modified-2.3.4/test/test_tempfile.py ============================================================================== --- pypy/dist/lib-python/modified-2.3.4/test/test_tempfile.py (original) +++ pypy/dist/lib-python/modified-2.3.4/test/test_tempfile.py Sun May 8 23:23:07 2005 @@ -497,8 +497,8 @@ def tearDown(self): import shutil - if self.dir: - shutil.rmtree(self.dir) + if self.dir: + shutil.rmtree(self.dir, ignore_errors=True) self.dir = None class mktemped: From hpk at codespeak.net Sun May 8 23:51:49 2005 From: hpk at codespeak.net (hpk at codespeak.net) Date: Sun, 8 May 2005 23:51:49 +0200 (CEST) Subject: [pypy-svn] r12092 - pypy/dist/pypy/module/sys2 Message-ID: <20050508215149.341DA27BCF@code1.codespeak.net> Author: hpk Date: Sun May 8 23:51:48 2005 New Revision: 12092 Modified: pypy/dist/pypy/module/sys2/state.py Log: try to lookup codecs and binascii if they are not in pypy/lib. Actually i am tempted to rename lib/_codecs to inprogress_codecs.py as well because enabling it breaks a number of compliance tests currently. Modified: pypy/dist/pypy/module/sys2/state.py ============================================================================== --- pypy/dist/pypy/module/sys2/state.py (original) +++ pypy/dist/pypy/module/sys2/state.py Sun May 8 23:51:48 2005 @@ -28,7 +28,7 @@ 'math', 'array', 'select', '_random', '_sre', 'time', '_socket', 'errno', 'unicodedata', - 'parser', 'fcntl', #'_codecs', 'binascii' + 'parser', 'fcntl', '_codecs', 'binascii' ]: if fn not in builtin_modules and not os.path.exists( os.path.join(os.path.dirname(pypy.__file__), From arigo at codespeak.net Sun May 8 23:55:24 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Sun, 8 May 2005 23:55:24 +0200 (CEST) Subject: [pypy-svn] r12094 - in pypy/dist: lib-python pypy/tool/pytest Message-ID: <20050508215524.5688627BCF@code1.codespeak.net> Author: arigo Date: Sun May 8 23:55:24 2005 New Revision: 12094 Modified: pypy/dist/lib-python/conftest.py pypy/dist/pypy/tool/pytest/htmlreport.py pypy/dist/pypy/tool/pytest/overview.py Log: Use the same logic in conftest.py to select ok/error/timeout tests as in the web page. Put this logic in overview.py. This makes which tests are actually selected predictable (for example there are now a lot of timed-out tests checked in later than the revision selected on the web page, which means that it took me a long time to figure out why -kerror was only selecting three tests from the lot...). Modified: pypy/dist/lib-python/conftest.py ============================================================================== --- pypy/dist/lib-python/conftest.py (original) +++ pypy/dist/lib-python/conftest.py Sun May 8 23:55:24 2005 @@ -801,9 +801,12 @@ from pypy.tool.pytest.overview import ResultCache self.__class__._resultcache = rc = ResultCache() rc.parselatest() - result = self._resultcache.getlatest(self.fspath.purebasename, - **{keyword:True}) - return result is not None + result = self._resultcache.getlatestrelevant(self.fspath.purebasename) + if not result: return False + if keyword == 'timeout': return result.istimeout() + if keyword == 'error': return result.iserror() + if keyword == 'ok': return result.isok() + assert False, "should not be there" def getinvocation(self, regrtest): fspath = regrtest.getfspath() Modified: pypy/dist/pypy/tool/pytest/htmlreport.py ============================================================================== --- pypy/dist/pypy/tool/pytest/htmlreport.py (original) +++ pypy/dist/pypy/tool/pytest/htmlreport.py Sun May 8 23:55:24 2005 @@ -90,9 +90,7 @@ coretests = [] noncoretests = [] for name in self.resultcache.getnames(): - result = self.resultcache.getlatest(name, error=1, ok=1) - if not result: - result = self.resultcache.getlatest(name) + result = self.resultcache.getlatestrelevant(name) if iscore(result): coretests.append(result) else: Modified: pypy/dist/pypy/tool/pytest/overview.py ============================================================================== --- pypy/dist/pypy/tool/pytest/overview.py (original) +++ pypy/dist/pypy/tool/pytest/overview.py Sun May 8 23:55:24 2005 @@ -48,3 +48,7 @@ maxrev = resrev maxresult = res return maxresult + + def getlatestrelevant(self, name): + # get the latest revision that did not time out. + return self.getlatest(name, error=1, ok=1) or self.getlatest(name) From pedronis at codespeak.net Mon May 9 00:29:01 2005 From: pedronis at codespeak.net (pedronis at codespeak.net) Date: Mon, 9 May 2005 00:29:01 +0200 (CEST) Subject: [pypy-svn] r12097 - pypy/dist/pypy/lib Message-ID: <20050508222901.60DD627BD0@code1.codespeak.net> Author: pedronis Date: Mon May 9 00:29:01 2005 New Revision: 12097 Added: pypy/dist/pypy/lib/inprogress__codecs.py - copied unchanged from r12096, pypy/dist/pypy/lib/_codecs.py Removed: pypy/dist/pypy/lib/_codecs.py Log: temporarely disable (for the same reasons as binascii) this until we reach consesus on pypy-dev what to do about incomplete modules and their inprogress testing. Deleted: /pypy/dist/pypy/lib/_codecs.py ============================================================================== --- /pypy/dist/pypy/lib/_codecs.py Mon May 9 00:29:01 2005 +++ (empty file) @@ -1,342 +0,0 @@ -""" - - _codecs -- Provides access to the codec registry and the builtin - codecs. - - This module should never be imported directly. The standard library - module "codecs" wraps this builtin module for use within Python. - - The codec registry is accessible via: - - register(search_function) -> None - - lookup(encoding) -> (encoder, decoder, stream_reader, stream_writer) - - The builtin Unicode codecs use the following interface: - - _encode(Unicode_object[,errors='strict']) -> - (string object, bytes consumed) - - _decode(char_buffer_obj[,errors='strict']) -> - (Unicode object, bytes consumed) - - _encode() interfaces also accept non-Unicode object as - input. The objects are then converted to Unicode using - PyUnicode_FromObject() prior to applying the conversion. - - These s are available: utf_8, unicode_escape, - raw_unicode_escape, unicode_internal, latin_1, ascii (7-bit), - mbcs (on win32). - - -Written by Marc-Andre Lemburg (mal at lemburg.com). - -Copyright (c) Corporation for National Research Initiatives. - -""" -from unicodecodec import * - -#/* --- Registry ----------------------------------------------------------- */ -codec_search_path = [] -codec_search_cache = {} - -def codec_register( search_function ): - """register(search_function) - - Register a codec search function. Search functions are expected to take - one argument, the encoding name in all lower case letters, and return - a tuple of functions (encoder, decoder, stream_reader, stream_writer). - """ - - if callable(search_function): - codec_search_path.append(search_function) - -register = codec_register - -def codec_lookup(encoding): - """lookup(encoding) -> (encoder, decoder, stream_reader, stream_writer) - Looks up a codec tuple in the Python codec registry and returns - a tuple of functions. - """ - - result = codec_search_cache.get(encoding,None) - if not result: - for search in codec_search_path: - result=search(encoding) - if result : - codec_search_cache[encoding] = result - break - return result - -lookup = codec_lookup - -def encode(v, encoding='defaultencoding',errors='strict'): - """encode(obj, [encoding[,errors]]) -> object - - Encodes obj using the codec registered for encoding. encoding defaults - to the default encoding. errors may be given to set a different error - handling scheme. Default is 'strict' meaning that encoding errors raise - a ValueError. Other possible values are 'ignore', 'replace' and - 'xmlcharrefreplace' as well as any other name registered with - codecs.register_error that can handle ValueErrors. - """ - - encoder = lookup(encoding)[0] - if encoder : - res = encoder(v,errors) - return res[0] - -def decode(obj,encoding='defaultencoding',errors='strict'): - """decode(obj, [encoding[,errors]]) -> object - - Decodes obj using the codec registered for encoding. encoding defaults - to the default encoding. errors may be given to set a different error - handling scheme. Default is 'strict' meaning that encoding errors raise - a ValueError. Other possible values are 'ignore' and 'replace' - as well as any other name registerd with codecs.register_error that is - able to handle ValueErrors. - """ - decoder = lookup(encoding)[1] - if decoder: - res = decoder(obj,errors) - else: - raise LookupError("No such encoding") - return res[0] - -def latin_1_encode( obj,errors='strict'): - """None - """ - res = PyUnicode_EncodeLatin1(obj,len(obj),errors) - return res, len(res) -# XXX MBCS codec might involve ctypes ? -def mbcs_decode(): - """None - """ - pass - -def readbuffer_encode( obj,errors='strict'): - """None - """ - res = str(obj) - return res,len(res) - -def escape_encode( obj,errors='strict'): - """None - """ - s = repr(obj) - v = s[1:-1] - return v,len(v) - -def utf_8_decode( data,errors='strict',final=None): - """None - """ - res = PyUnicode_DecodeUTF8Stateful(data, len(data), errors, final) - return res,len(res) - -def raw_unicode_escape_decode( data,errors='strict'): - """None - """ - res = PyUnicode_DecodeRawUnicodeEscape(data, len(data), errors) - return res,len(res) - -def utf_7_decode( data,errors='strict'): - """None - """ - unistr = PyUnicode_DecodeUTF7(data,errors='strict') - return unistr,len(unistr) -# XXX unicode_escape_encode -def unicode_escape_encode( obj,errors='strict'): - """None - """ - pass -# XXX latin_1_decode -def latin_1_decode( data,errors='strict'): - """None - """ - pass -# XXX utf_16_decode -def utf_16_decode( data,errors='strict'): - """None - """ - pass - -def unicode_escape_decode( data,errors='strict'): - """None - """ - unistr = PyUnicode_DecodeUnicodeEscape(data,len(data),errors) - return unistr,len(unistr) - - -def ascii_decode( data,errors='strict'): - """None - """ - res = PyUnicode_DecodeASCII(data,len(data),errors) - return res,len(res) - -def charmap_encode(obj,errors='strict',mapping='latin-1'): - """None - """ - res = PyUnicode_EncodeCharmap(obj,len(obj),mapping,errors) - return res,len(res) - -def unicode_internal_encode( obj,errors='strict'): - """None - """ - if type(obj) == unicode: - return obj, len(obj) - else: - return PyUnicode_FromUnicode(obj,size),size -# XXX utf_16_ex_decode -def utf_16_ex_decode( data,errors='strict'): - """None - """ - pass -# XXX escape_decode Check if this is right -def escape_decode(data,errors='strict'): - """None - """ - return data,len(data) - -def charbuffer_encode( obj,errors='strict'): - """None - """ - res = str(obj) - return res,len(res) - -def charmap_decode( data,errors='strict',mapping=None): - """None - """ - res = PyUnicode_DecodeCharmap(data, len(data), mapping, errors) - return res,len(res) - - -def utf_7_encode( obj,errors='strict'): - """None - """ - res = PyUnicode_EncodeUTF7(obj,len(obj),0,0,errors) - return res,len(res) - -def mbcs_encode( obj,errors='strict'): - """None - """ - return (PyUnicode_EncodeMBCS( - PyUnicode_AS_UNICODE(obj), - PyUnicode_GET_SIZE(obj), - errors), - PyUnicode_GET_SIZE(obj)); - - -def ascii_encode( obj,errors='strict'): - """None - """ - res = PyUnicode_EncodeASCII(obj,len(obj),errors) - return res,len(res) -##(PyUnicode_EncodeASCII( -## PyUnicode_AS_UNICODE(obj), -## PyUnicode_GET_SIZE(obj), -## errors), -## PyUnicode_GET_SIZE(obj)) - -def utf_16_encode( obj,errors='strict'): - """None - """ - u = PyUnicode_EncodeUTF16(obj,len(obj),errors) - return u,len(u) - -def raw_unicode_escape_encode( obj,errors='strict'): - """None - """ - res = PyUnicode_EncodeRawUnicodeEscape(obj,len(obj)) - return res,len(res) - -def utf_8_encode( obj,errors='strict'): - """None - """ - res = PyUnicode_EncodeUTF8(obj,len(obj),errors) - return res,len(res) -# XXX utf_16_le_encode -def utf_16_le_encode( obj,errors='strict'): - """None - """ - pass -# XXX utf_16_be_encode -def utf_16_be_encode( obj,errors='strict'): - """None - """ - pass - -def unicode_internal_decode( unistr,errors='strict'): - """None - """ - if type(unistr) == unicode: - return unistr,len(unistr) - else: - return unicode(unistr),len(unistr) -# XXX utf_16_le_decode -def utf_16_le_decode( data,errors='strict'): - """None - """ - pass -# XXX utf_16_be_decode -def utf_16_be_decode( data,errors='strict'): - """None - """ - pass - -def strict_errors(exc): - if isinstance(exc,Exception): - raise exc - else: - raise TypeError("codec must pass exception instance") - -def ignore_errors(exc): - if isinstance(exc,(UnicodeEncodeError,UnicodeDecodeError,UnicodeTranslateError)): - return u'',exc.end - else: - raise TypeError("don't know how to handle %.400s in error callback"%exc) - -Py_UNICODE_REPLACEMENT_CHARACTER = u"\ufffd" - -def replace_errors(exc): - if isinstance(exc,UnicodeEncodeError): - return u'?'*(exc.end-exc.start),exc.end - elif isinstance(exc,(UnicodeTranslateError,UnicodeDecodeError)): - return Py_UNICODE_REPLACEMENT_CHARACTER*(exc.end-exc.start),exc.end - else: - raise TypeError("don't know how to handle %.400s in error callback"%exc) - -def xmlcharrefreplace_errors(exc): - if isinstance(exc,UnicodeEncodeError): - res = [] - for ch in exc.object[exc.start:exc.end]: - res += '&#' - res += str(ord(ch)) - res += ';' - return u''.join(res),exc.end - else: - raise TypeError("don't know how to handle %.400s in error callback"%type(exc)) - -def backslashreplace_errors(exc): - if isinstance(exc,UnicodeEncodeError): - p=[] - for c in exc.object[exc.start:exc.end]: - p.append('\\') - oc = ord(c) - if (oc >= 0x00010000): - p.append('U') - p.append("%.8x" % ord(c)) - elif (oc >= 0x100): - p.append('u') - p.append("%.4x" % ord(c)) - else: - p.append('x') - p.append("%.2x" % ord(c)) - return u''.join(p),exc.end - else: - raise TypeError("don't know how to handle %.400s in error callback"%type(exc)) - -register_error("strict",strict_errors) -register_error("ignore",ignore_errors) -register_error("replace",replace_errors) -register_error("xmlcharrefreplace",xmlcharrefreplace_errors) -register_error("backslashreplace",backslashreplace_errors) \ No newline at end of file From tismer at codespeak.net Mon May 9 03:40:55 2005 From: tismer at codespeak.net (tismer at codespeak.net) Date: Mon, 9 May 2005 03:40:55 +0200 (CEST) Subject: [pypy-svn] r12101 - pypy/dist/pypy/objspace/flow Message-ID: <20050509014055.BADC427BD6@code1.codespeak.net> Author: tismer Date: Mon May 9 03:40:55 2005 New Revision: 12101 Modified: pypy/dist/pypy/objspace/flow/model.py Log: enable debugging by a single keystroke Modified: pypy/dist/pypy/objspace/flow/model.py ============================================================================== --- pypy/dist/pypy/objspace/flow/model.py (original) +++ pypy/dist/pypy/objspace/flow/model.py Mon May 9 03:40:55 2005 @@ -378,7 +378,7 @@ except AssertionError, e: # hack for debug tools only - #graph.show() <== ENABLE THIS TO SEE THE BROKEN GRAPH + #graph.show() # <== ENABLE THIS TO SEE THE BROKEN GRAPH if this_block[0] and not hasattr(e, '__annotator_block'): setattr(e, '__annotator_block', this_block[0]) raise From hpk at codespeak.net Mon May 9 10:57:49 2005 From: hpk at codespeak.net (hpk at codespeak.net) Date: Mon, 9 May 2005 10:57:49 +0200 (CEST) Subject: [pypy-svn] r12104 - pypy/dist/pypy/documentation Message-ID: <20050509085749.A56ED27BB1@code1.codespeak.net> Author: hpk Date: Mon May 9 10:57:49 2005 New Revision: 12104 Added: pypy/dist/pypy/documentation/coding-guide.txt - copied, changed from r12103, pypy/dist/pypy/documentation/coding-style.txt Removed: pypy/dist/pypy/documentation/coding-style.txt Modified: pypy/dist/pypy/documentation/getting_started.txt pypy/dist/pypy/documentation/index.txt pypy/dist/pypy/documentation/navlist pypy/dist/pypy/documentation/objspace.txt pypy/dist/pypy/documentation/redirections pypy/dist/pypy/documentation/theory.txt pypy/dist/pypy/documentation/translation.txt Log: move coding-style to become coding-guide.txt Copied: pypy/dist/pypy/documentation/coding-guide.txt (from r12103, pypy/dist/pypy/documentation/coding-style.txt) ============================================================================== --- pypy/dist/pypy/documentation/coding-style.txt (original) +++ pypy/dist/pypy/documentation/coding-guide.txt Mon May 9 10:57:49 2005 @@ -1,10 +1,14 @@ ===================================== -PyPy Coding Style +PyPy Coding Guide ===================================== .. contents:: .. sectnum:: +This document describes coding requirements and conventions for +working with the PyPy code base. Please read it carefully and +ask back any questions you might have. + Restricted Python ================== @@ -81,7 +85,7 @@ have any questions about the restrictions below then please feel free to mail us at pypy-dev at codespeak net. -.. _`wrapped object`: objspace.html#wrapping-rules +.. _`wrapped object`: coding-guide.html#wrapping-rules Object restrictions ------------------------- @@ -297,6 +301,109 @@ handling enabled, so we might catch cases where we failed to adhere to our implicit assertions. +.. _`wrapping rules`: + +Wrapping rules +============== + +PyPy is made of Python source code at two levels: there is on the one hand *application-level code* that looks like normal Python code, and that implements some functionalities as one would expect from Python code (e.g. one can give a pure Python implementation of some built-in functions like ``zip()``). There is also *interpreter-level code* for the functionalities that must more directly manipulate interpreter data and objects (e.g. the main loop of the interpreter, and the various object spaces). + +Application-level code doesn't see object spaces explicitely: it runs using an object space to support the objects it manipulates, but this is implicit. There is no need for particular conventions for application-level code. The sequel is only about interpreter-level code. (Ideally, no application-level variable should be called ``space`` or ``w_xxx`` to avoid confusion.) + + +Naming conventions +------------------ + +* ``space``: the object space is only visible at interpreter-level, where it is by convention in a variable called ``space``. + +* ``w_xxx``: any object seen by application-level code is an object explicitely managed by the object space. From the interpreter-level point of view, this is called a *wrapped* object. The ``w_`` prefix is used for any type of application-level object. + +* ``xxx_w``: an interpreter-level container for wrapped objects, for example a list or a dict containing wrapped objects. Not to be confused with a wrapped object that would be a list or a dict: these are normal wrapped objects, so they use the ``w_`` prefix. + + +Operations on ``w_xxx`` +----------------------- + +The core interpreter considers wrapped objects as black boxes. It is not allowed to inspect them directly. The allowed operations are all dependent on the object space: they are called ``space.xxx()``, where ``xxx`` is a standard operation name (``add``, ``getattr``, ``call``, ``eq``...). The list of standard operations is found in the large table near the end of ``pypy.interpreter.baseobjspace``. These operations take wrapped arguments and return a wrapped result (or sometimes just None). + +Also note some helpers: + +* ``space.call_function(w_callable, ...)``: collects the given (already-wrapped) arguments, builds a wrapped tuple for them, and uses ``space.call()`` to perform the call. + +* ``space.call_method(w_object, 'method', ...)``: uses ``space.getattr()`` to get the method object, and then ``space.call_function()`` to invoke it. + + +Building ``w_xxx`` objects +-------------------------- + +From the core interpreter, wrapped objects are usually built as the result of an object space operation. The ways to directly create a wrapped object are: + +* ``space.wrap(x)``: returns a wrapped object containing the value ``x``. Only works if ``x`` is either a simple value (integer, float, string) or an instance of an internal interpreter class (Function, Code, Frame...). + +* ``space.newlist([w_x, w_y, w_z...])``: returns a wrapped list from a list of already-wrapped objects. + +* ``space.newtuple([w_x, w_y, w_z...])``: returns a wrapped tuple from a list of already-wrapped objects. + +* ``space.newdict([])``: returns a new, empty wrapped dictionary. (The argument list can contain tuples ``(w_key, w_value)`` but it seems that such a use is not common.) + +* ``space.newbool(x)``: returns ``space.w_False`` or ``space.w_True`` depending on the truth value of ``x``. + +There are a few less common constructors, described in the comments at the end of ``pypy.interpreter.baseobjspace``. + + +Constant ``w_xxx`` objects +-------------------------- + +The object space holds a number of predefined wrapped objects. The most common ones are ``space.w_None`` and ``space.w_XxxError`` for each exception class ``XxxError`` (e.g. ``space.w_KeyError``, ``space.w_IndexError``, etc.). + + +Inspecting ``w_xxx`` objects +---------------------------- + +The most delicate operation is for the interpreter to inspect a wrapped object, which must be done via the object space. + +* ``space.is_true(w_x)``: checks if the given wrapped object is considered to be ``True`` or ``False``. You must never use the truth-value of ``w_x`` directly; doing so (e.g. writing ``if w_x:``) will give you an error reminding you of the problem. + +* ``w_x == w_y`` or ``w_x is w_y``: DON'T DO THAT. The only half-official exception is to check if ``w_x`` contains a wrapped ``None``: you can write ``w_x == space.w_None``. Follow this rule; the case of ``None`` is easy to fix globally later if we find out that we need to. The rationale for this rule is that there is no reason that two wrappers are related in any way even if they contain what looks like the same object at application-level. To check for equality, use ``space.is_true(space.eq(w_x, w_y))``. To check for identity, use ``space.is_true(space.is_(w_x, w_y))``. + +* ``space.unpackiterable(w_x)``: this helper iterates ``w_x`` (using ``space.iter()`` and ``space.next()``) and collects the resulting wrapped objects in a list. Of course, in cases where iterating directly is better than collecting the elements in a list first, you should use ``space.iter()`` and ``space.next()`` directly. + +* ``space.unwrap(w_x)``: inverse of ``space.wrap()``. Attention! Using ``space.unwrap()`` must be avoided whenever possible, i.e. only use this when you are well aware that you are cheating, in unit tests or bootstrapping code. + +* ``space.interpclass_w(w_x)``: If w_x is a wrapped instance of an interpreter class -- for example Function, Frame, Cell, etc. -- return it unwrapped. Otherwise return None. + +* ``space.int_w(w_x)``: If w_x is an application-level integer or long which can be converted without overflow to an integer, return an interpreter-level integer. Otherwise raise TypeError or OverflowError. + +* ``space.str_w(w_x)``: If w_x is an application-level string, return an interpreter-level string. Otherwise raise TypeError. + +* ``space.float_w(w_x)``: If w_x is an application-level float, integer or long, return interpreter-level float. Otherwise raise TypeError or OverflowError in case of very large longs. + +Remember that you can usually obtain the information you want by invoking operations or methods on the wrapped objects; e.g. ``space.call_method(w_dict, 'iterkeys')`` returns a wrapped iterable that you can decode with ``space.unpackiterable()``. + + +Application-level exceptions +---------------------------- + +Interpreter-level code can use exceptions freely. However, all application-level exceptions are represented as an ``OperationError`` at interpreter-level. In other words, all exceptions that are potentially visible at application-level are internally an ``OperationError``. This is the case of all errors reported by the object space operations (``space.add()`` etc.). + +To raise an application-level exception:: + + raise OperationError(space.w_XxxError, space.wrap("message")) + +To catch a specific application-level exception:: + + try: + ... + except OperationError, e: + if not e.match(space, space.w_XxxError): + raise + ... + +This construct catches all application-level exceptions, so we have to match it against the particular ``w_XxxError`` we are interested in and re-raise other exceptions. The exception instance ``e`` holds two attributes that you can inspect: ``e.w_type`` and ``e.w_value``. Do not use ``e.w_type`` to match an exception, as this will miss exceptions that are instances of subclasses. + +We are thinking about replacing ``OperationError`` with a family of common exception classes (e.g. ``AppKeyError``, ``AppIndexError``...) so that we can more easily catch them. The generic ``AppError`` would stand for all other application-level classes. + + Naming and directory layout =========================== Deleted: /pypy/dist/pypy/documentation/coding-style.txt ============================================================================== --- /pypy/dist/pypy/documentation/coding-style.txt Mon May 9 10:57:49 2005 +++ (empty file) @@ -1,543 +0,0 @@ -===================================== -PyPy Coding Style -===================================== - -.. contents:: -.. sectnum:: - -Restricted Python -================== - -We are writing a Python interpreter in Python, using Python's well known ability -to step behind the algorithmic problems as language. At first glance, one might -think this achieves nothing but a better understanding how the interpreter works. -This alone would make it worth doing, but we have much larger goals. - - -CPython vs. PyPy -------------------- - -Compared to the CPython implementation, Python takes the role of the C -Code. We rewrite the CPython interpreter in Python itself. We could -also aim at writing a more flexible interpreter at C level but but we -want to use Python to give an alternative description of the interpreter. - -The clear advantage is that such a description is shorter and simpler to -read, and many implementation details vanish. The drawback of this approach is -that this interpreter will be unbearably slow as long as it is run on top -of CPython. - -To get to a useful interpreter again, we need to translate our -high-level description of Python to a lower level one. One rather -straight-forward way is to do a whole program analysis of the PyPy -interpreter and create a C source, again. There are many other ways, -but let's stick with this somewhat canonical approach. - -our runtime interpreter is "restricted python" ----------------------------------------------- - -In order to make a C code generator feasible we restrict ourselves to a -subset of the Python language, and we adhere to some rules which make -translation to lower level langauges more obvious. - -Unlike source-to-source translations (like e.g. Starkiller_) we start -translation from live python code objects which constitute our Python -interpreter. When doing its work of interpreting bytecode our Python -implementation must behave in a static way often referenced as -"RPythonic". - -.. _Starkiller: http://www.python.org/pycon/dc2004/papers/1/paper.pdf - -However, when the PyPy interpreter is started as a Python program, it -can use all of the Python language until it reaches interpretation -runtime. That is, during initialisation our program is free to use the -full dynamism of Python, including dynamic code generation. - -An example can be found in the current implementation which is quite -elegant: For the definition of all the opcodes of the Python -interpreter, the module ``dis`` is imported and used to initialize our -bytecode interpreter. (See ``__initclass_`` in `pyopcode.py`_). This -saves us from adding extra modules to PyPy. The import code is run at -startup time, and we are allowed to use the CPython builtin import -function. - -After the startup code is finished, all resulting objects, functions, -code blocks etc. must adhere to certain runtime restrictions which we -describe further below. Here is some background for why this is so: -during translation, a whole program analysis ("type inference") is -performed, which makes use of the restrictions defined in RPython. This -enables the code generator to emit efficient machine level replacements -for pure integer objects, for instance. - -.. _`pyopcode.py`: http://codespeak.net/svn/pypy/dist/pypy/interpreter/pyopcode.py - -RPython Definition, not ------------------------ - -The list and exact details of the "RPython" restrictions are a somewhat -evolving topic. In particular, we have no formal language definition -as we find it more practical to discuss and evolve the set of -restrictions while working on the whole program analysis. If you -have any questions about the restrictions below then please feel -free to mail us at pypy-dev at codespeak net. - -.. _`wrapped object`: objspace.html#wrapping-rules - -Object restrictions -------------------------- - -We are using - -**variables** - - the same variable in the same context can receive values of different types, - at a possible overhead cost. For example, a variable that can contain a - `wrapped object`_ or None is efficiently implemented as a PyObject* pointer that - can be NULL, but a variable that can contain either an integer or a float must - be implemented as a union with a type tag in C. - -**constants** - - all module globals are considered constants. - -**integer, float, string, boolean** - - avoid string methods and complex operations like slicing with a step - -**tuples** - - no variable-length tuples; use them to store or return pairs or n-tuples of - values - -**lists** - - lists are used as an allocated array; list.append() does naive resizing, so as - far as possible use list comprehensions (see below). list.extend() or the += - operator are allowed and efficient. Unless there is really a use case for it, - repetition is limited to initialization purposes: '[single_value] * length'. - -**dicts** - - dicts with string keys only (preferrably the kind of strings that are usually - interned in CPython, i.e. short strings that look like identifiers). The - implementation could safely decide that all dict keys should be interned. - -**control structures** - - all allowed - -**list comprehensions** - - may be used to create allocated, initialized array. the array size must be - computable in advance, which implies that we don't allow an if clause. - -**functions** - -+ statically called functions may use defaults and a variable number of - arguments (which may be passed as a list instead of a tuple, so write code that - does not depend on it being a tuple). - -+ dynamic dispatch enforces use of very simple signatures, equal for all - functions to be called in that context. At the moment, this occurs in the opcode - dispatch, only. - -**builtin functions** - - A few builtin functions will be used, while this set is not defined - completely, yet. Some builtin functions are special forms: - -**range** - - does not create an array. It is only allowed in for loops. The step argument - must be a constant. - -**len** - -+ may be used with basic types that have a length. But len is a special form - that is recognized by the compiler. - -+ If a certain structure is never touched by len, the compiler might save the - length field from the underlying structure. - -``int, float, ord, chr``... are available as simple conversion functions. - -``int, float, str``... have a special meaning as a type inside of isinstance only. - -**classes** - -+ methods and other class attributes do not change after startup -+ inheritance is supported -+ classes are first-class objects too - -**exceptions** - -+ fully supported -+ see below for restrictions on exceptions raised by built-in operations - -**objects** - - wrapped objects are borrowed from the object space. Just like in CPython, code - that needs e.g. a dictionary can use a wrapped dict and the object space - operations on it. - -This layout makes the number of types to take care about quite limited. - - -Integer Types -------------------------- - -While implementing the integer type, we stumbled over the problem, that -integers are quite in flux in CPython right now. Starting on Python 2.2, -integers mutate into longs on overflow. However, shifting to the left truncates -up to 2.3 but extends to longs as well in 2.4. By contrast, we need a way to -perform wrap-around machine-sized arithmetic by default, while still being -able to check for overflow when we need it explicitely. Moreover, we need a -consistent behavior before and after translation. - -We use normal integers for signed arithmetic. It means that before -translation we get longs in case of overflow, and after translation we get a -silent wrap-around. Whenever we need more control, we use the following -helpers: - -**ovfcheck()** - - This special function should only be used with a single arithmetic operation - as its argument, e.g. ``z = ovfcheck(x+y)``. Its intended meaning is to - perform the given operation in overflow-checking mode. - - At run-time, in Python, the ovfcheck() function itself checks the result - and raises OverflowError if it is a ``long``. But the code generators use - ovfcheck() as a hint: they replace the whole ``ovfcheck(x+y)`` expression - with a single overflow-checking addition in C. - -**ovfcheck_lshift()** - - ovfcheck_lshift(x, y) is a workaround for ovfcheck(x< Author: ale Date: Mon May 9 11:47:04 2005 New Revision: 12105 Modified: pypy/dist/lib-python/modified-2.3.4/test/test_codeccallbacks.py Log: absolute path - bad,bad Modified: pypy/dist/lib-python/modified-2.3.4/test/test_codeccallbacks.py ============================================================================== --- pypy/dist/lib-python/modified-2.3.4/test/test_codeccallbacks.py (original) +++ pypy/dist/lib-python/modified-2.3.4/test/test_codeccallbacks.py Mon May 9 11:47:04 2005 @@ -1,20 +1,8 @@ import test.test_support, unittest import sys, htmlentitydefs, unicodedata -sys.path.insert(0,r'd:\projects\pypy_co') -sys.path.insert(0,r'd:\projects\pypy_co\pypy\lib') -sys.path.insert(0,r'd:\projects\pypy_co\lib-python\modified-2.3.4') -sys.path.insert(0,r'd:\projects\pypy_co\lib-python\2.3.4') -from pypy.lib import _codecs -sys.modules['_codecs'] = _codecs -from pypy.lib import encodings -sys.modules['encodings'] = encodings -from pypy.lib import codecs -sys.modules['codecs'] = codecs -reload(encodings) -reload(codecs) -assert codecs == encodings.codecs - +import codecs +print sys.modules['codecs'],sys.modules['_codecs']#,sys.modules['encodings'] class PosReturn: # this can be used for configurable callbacks From pedronis at codespeak.net Mon May 9 14:01:51 2005 From: pedronis at codespeak.net (pedronis at codespeak.net) Date: Mon, 9 May 2005 14:01:51 +0200 (CEST) Subject: [pypy-svn] r12107 - in pypy/dist/pypy/translator: . tool Message-ID: <20050509120151.EA18427BE4@code1.codespeak.net> Author: pedronis Date: Mon May 9 14:01:51 2005 New Revision: 12107 Modified: pypy/dist/pypy/translator/geninterplevel.py pypy/dist/pypy/translator/simplify.py pypy/dist/pypy/translator/tool/tointerplevel.py pypy/dist/pypy/translator/translator.py Log: let pass around a list of wanted passes to simplify mechanism, so that geninterplevel can explicitly avoid transform_ovfcheck which makes little sense for it right now, the _ovf version of operations being not space ops. test_geninterp passes again Modified: pypy/dist/pypy/translator/geninterplevel.py ============================================================================== --- pypy/dist/pypy/translator/geninterplevel.py (original) +++ pypy/dist/pypy/translator/geninterplevel.py Mon May 9 14:01:51 2005 @@ -39,6 +39,13 @@ from pypy.translator.gensupp import ordered_blocks, UniqueList, builtin_base, \ c_string, uniquemodulename, C_IDENTIFIER, NameManager + +# list of simplifcation passes needed by geninterp +from pypy.translator.simplify import transform_ovfcheck, all_passes as needed_passes + +needed_passes.remove(transform_ovfcheck) + + import pypy # __path__ import py.path @@ -1433,7 +1440,7 @@ # extract certain stuff like a general module maker # and put this into tools/compile_exceptions, maybe??? dic, entrypoint = exceptions_helper() - t = Translator(None, verbose=False, simplifying=True, + t = Translator(None, verbose=False, simplifying=needed_passes, builtins_can_raise_exceptions=True, do_imports_immediately=False) gen = GenRpy(t, entrypoint) @@ -1452,7 +1459,7 @@ dic = None if entrypoint.__name__.endswith("_helper"): dic, entrypoint = entrypoint() - t = Translator(entrypoint, verbose=False, simplifying=True, builtins_can_raise_exceptions=True) + t = Translator(entrypoint, verbose=False, simplifying=needed_passes, builtins_can_raise_exceptions=True) gen = GenRpy(t) gen.use_fast_call = True if dic: gen.moddict = dic @@ -1472,7 +1479,7 @@ def test(): entrypoint() - t = Translator(test, verbose=False, simplifying=True, + t = Translator(test, verbose=False, simplifying=needed_passes, builtins_can_raise_exceptions=True, do_imports_immediately=False) gen2 = GenRpy(t) @@ -1526,7 +1533,7 @@ exec code in dic #del dic['__builtins__'] entrypoint = dic - t = Translator(None, verbose=False, simplifying=True, + t = Translator(None, verbose=False, simplifying=needed_passes, builtins_can_raise_exceptions=True, do_imports_immediately=do_imports) hold = sys.path Modified: pypy/dist/pypy/translator/simplify.py ============================================================================== --- pypy/dist/pypy/translator/simplify.py (original) +++ pypy/dist/pypy/translator/simplify.py Mon May 9 14:01:51 2005 @@ -10,19 +10,6 @@ from pypy.objspace.flow.model import last_exception from pypy.objspace.flow.model import checkgraph, traverse, mkentrymap -def simplify_graph(graph): - """inplace-apply all the existing optimisations to the graph.""" - checkgraph(graph) - eliminate_empty_blocks(graph) - remove_assertion_errors(graph) - join_blocks(graph) - transform_dead_op_vars(graph) - remove_identical_vars(graph) - transform_ovfcheck(graph) - simplify_exceptions(graph) - remove_dead_exceptions(graph) - checkgraph(graph) - # ____________________________________________________________ def eliminate_empty_blocks(graph): @@ -479,3 +466,26 @@ for link in block.exits: consider_blocks[link.target] = True break + +# ____ all passes & simplify_graph + +all_passes = [ + eliminate_empty_blocks, + remove_assertion_errors, + join_blocks, + transform_dead_op_vars, + remove_identical_vars, + transform_ovfcheck, + simplify_exceptions, + remove_dead_exceptions, + ] + +def simplify_graph(graph, passes=True): # can take a list of passes to apply, True meaning all + """inplace-apply all the existing optimisations to the graph.""" + if passes is True: + passes = all_passes + checkgraph(graph) + for pass_ in passes: + pass_(graph) + checkgraph(graph) + Modified: pypy/dist/pypy/translator/tool/tointerplevel.py ============================================================================== --- pypy/dist/pypy/translator/tool/tointerplevel.py (original) +++ pypy/dist/pypy/translator/tool/tointerplevel.py Mon May 9 14:01:51 2005 @@ -6,7 +6,7 @@ from pypy.objspace.flow.objspace import FlowObjSpace from pypy.translator.translator import Translator -from pypy.translator.geninterplevel import GenRpy +from pypy.translator.geninterplevel import GenRpy, needed_passes as genrpy_needed_passes # change default FlowObjSpace.builtins_can_raise_exceptions = True @@ -54,7 +54,7 @@ else: entrypoint = tuple(objs) - t = Translator(None, verbose=False, simplifying=True, builtins_can_raise_exceptions=True) + t = Translator(None, verbose=False, simplifying=genrpy_needed_passes, builtins_can_raise_exceptions=True) gen = GenRpy(t, entrypoint, modname, mod.__dict__) output = options.output or modname + "interp.py" Modified: pypy/dist/pypy/translator/translator.py ============================================================================== --- pypy/dist/pypy/translator/translator.py (original) +++ pypy/dist/pypy/translator/translator.py Mon May 9 14:01:51 2005 @@ -86,7 +86,7 @@ space.do_imports_immediately = self.do_imports_immediately graph = space.build_flow(func) if self.simplifying: - simplify_graph(graph) + simplify_graph(graph, self.simplifying) if self.verbose: print self.flowgraphs[func] = graph @@ -130,15 +130,15 @@ from pypy.translator.tool.graphpage import TranslatorPage TranslatorPage(self).display() - def simplify(self, func=None): + def simplify(self, func=None, passes=True): """Simplifies the control flow graph (default: for all functions).""" if func is None: for func in self.flowgraphs.keys(): self.simplify(func) else: graph = self.getflowgraph(func) - simplify_graph(graph) - + simplify_graph(graph, passes) + def annotate(self, input_args_types, func=None, overrides={}): """annotate(self, input_arg_types[, func]) -> Annotator From pedronis at codespeak.net Mon May 9 14:48:12 2005 From: pedronis at codespeak.net (pedronis at codespeak.net) Date: Mon, 9 May 2005 14:48:12 +0200 (CEST) Subject: [pypy-svn] r12108 - pypy/dist/pypy/translator/genc Message-ID: <20050509124812.F148227BE9@code1.codespeak.net> Author: pedronis Date: Mon May 9 14:48:12 2005 New Revision: 12108 Modified: pypy/dist/pypy/translator/genc/pyobjtype.py Log: more "robust" detection of '__builtin__' exceptions. the test framework itself substitute AssertionError so we need to be careful. This logic should probably go to gensupp... Modified: pypy/dist/pypy/translator/genc/pyobjtype.py ============================================================================== --- pypy/dist/pypy/translator/genc/pyobjtype.py (original) +++ pypy/dist/pypy/translator/genc/pyobjtype.py Mon May 9 14:48:12 2005 @@ -283,7 +283,9 @@ metaclass = "type" if issubclass(cls, Exception): - if cls.__module__ == 'exceptions': + # if cls.__module__ == 'exceptions': + # don't rely on this, py.magic redefines AssertionError + if getattr(__builtin__,cls.__name__,None) is cls: name = self.uniquename('gexc_' + cls.__name__) self.initcode_python(name, cls.__name__) return name From ludal at codespeak.net Mon May 9 16:20:42 2005 From: ludal at codespeak.net (ludal at codespeak.net) Date: Mon, 9 May 2005 16:20:42 +0200 (CEST) Subject: [pypy-svn] r12111 - pypy/dist/pypy/module/recparser Message-ID: <20050509142042.0332D27BD8@code1.codespeak.net> Author: ludal Date: Mon May 9 16:20:42 2005 New Revision: 12111 Modified: pypy/dist/pypy/module/recparser/pyparser.py pypy/dist/pypy/module/recparser/syntaxtree.py Log: * generates line numbers in totuple Modified: pypy/dist/pypy/module/recparser/pyparser.py ============================================================================== --- pypy/dist/pypy/module/recparser/pyparser.py (original) +++ pypy/dist/pypy/module/recparser/pyparser.py Mon May 9 16:20:42 2005 @@ -24,23 +24,23 @@ self.space = space self.node = syntaxnode - def totuple (self, line_info = 0): + def totuple (self, line_info = False ): """STType.totuple() Convert the ST object into a tuple representation. """ # lineinfo is ignored for now - return self.node.totuple() + return self.node.totuple( line_info ) - def descr_totuple(self, line_info = 0): + def descr_totuple(self, line_info = False): return self.space.wrap(self.totuple(line_info)) descr_totuple.unwrap_spec=['self', int] - def tolist (self, line_info = 0): + def tolist (self, line_info = False): """STType.tolist() Convert the ST object into a list representation. """ - return self.node.tolist() + return self.node.tolist( line_info ) def isexpr (self): """STType.isexpr() Modified: pypy/dist/pypy/module/recparser/syntaxtree.py ============================================================================== --- pypy/dist/pypy/module/recparser/syntaxtree.py (original) +++ pypy/dist/pypy/module/recparser/syntaxtree.py Mon May 9 16:20:42 2005 @@ -61,7 +61,12 @@ "|=" : token.VBAREQUAL, } - +SYMBOLS = {} +# copies the numerical mapping between symbol name and symbol value +# into SYMBOLS +for k,v in symbol.__dict__.items(): + if type(v)==int: + SYMBOLS[k] = v class SyntaxNode(object): @@ -108,8 +113,9 @@ def expand(self): return [ self ] - def totuple(self): - l = [getattr(symbol, self.name, (0,self.name) )] + def totuple(self, lineno=False ): + symvalue = SYMBOLS.get( self.name, (0,self.name) ) + l = [ symvalue ] l += [node.totuple() for node in self.nodes] return tuple(l) @@ -137,7 +143,7 @@ else: return "<%s!>" % (self.name,) - def totuple(self): + def totuple(self, lineno=False): num = TOKEN_MAP.get(self.name, -1) if num == -1: print "Unknown", self.name, self.value @@ -148,4 +154,7 @@ val = self.name else: val = self.value or '' - return (num, val) + if lineno: + return (num, val, self.lineno) + else: + return (num, val) From pedronis at codespeak.net Mon May 9 17:14:59 2005 From: pedronis at codespeak.net (pedronis at codespeak.net) Date: Mon, 9 May 2005 17:14:59 +0200 (CEST) Subject: [pypy-svn] r12113 - in pypy/dist/pypy: objspace/flow translator translator/genc translator/genc/test Message-ID: <20050509151459.C0DB227BE2@code1.codespeak.net> Author: pedronis Date: Mon May 9 17:14:59 2005 New Revision: 12113 Modified: pypy/dist/pypy/objspace/flow/flowcontext.py pypy/dist/pypy/objspace/flow/model.py pypy/dist/pypy/translator/annrpython.py pypy/dist/pypy/translator/genc/funcdef.py pypy/dist/pypy/translator/genc/test/test_typed.py pypy/dist/pypy/translator/geninterplevel.py pypy/dist/pypy/translator/simplify.py pypy/dist/pypy/translator/typer.py Log: Instead of using special constants as markers for the value and type of exceptions in exception handling let the flow graphs introduce fresh variables and attach them to the link exiting an exception exitcase. Link grow .last_exception and .last_exc_value attributes that can be None or the introduced variables for exception links. This avoids the problem that sometimes the constants could get propagated far beyond the point where it was possible to track them back to their origin making hard to associate them with types. Given that now we use variables their value is propagated through usual flowing and they cannot appear unexpectedly. All code generators have been adaptated and fixed for this change apart genllvm. It was already failing one test related it seems to exception handling btw. Modified: pypy/dist/pypy/objspace/flow/flowcontext.py ============================================================================== --- pypy/dist/pypy/objspace/flow/flowcontext.py (original) +++ pypy/dist/pypy/objspace/flow/flowcontext.py Mon May 9 17:14:59 2005 @@ -107,21 +107,29 @@ def guessbool(self, ec, w_condition, cases=[False,True], replace_last_variable_except_in_first_case = None): block = self.crnt_block - vars = vars2 = block.getvariables() + bvars = vars = vars2 = block.getvariables() links = [] + first = True + attach = {} for case in cases: + if first: + first = False + elif replace_last_variable_except_in_first_case is not None: + assert block.operations[-1].result is bvars[-1] + vars = bvars[:-1] + for name in replace_last_variable_except_in_first_case: + newvar = Variable(name) + attach[name] = newvar + vars.append(newvar) + vars2 = bvars[:-1] + while len(vars2) < len(vars): + vars2.append(Variable()) egg = EggBlock(vars2, block, case) ec.pendingblocks.append(egg) link = Link(vars, egg, case) + link.__dict__.update(attach) links.append(link) - if replace_last_variable_except_in_first_case is not None: - assert block.operations[-1].result is vars[-1] - vars = vars[:-1] - vars.extend(replace_last_variable_except_in_first_case) - vars2 = vars2[:-1] - while len(vars2) < len(vars): - vars2.append(Variable()) - replace_last_variable_except_in_first_case = None + block.exitswitch = w_condition block.closeblock(*links) # forked the graph. Note that False comes before True by default @@ -212,8 +220,8 @@ outcome = self.guessbool(Constant(last_exception), cases = [None] + list(classes), replace_last_variable_except_in_first_case = [ - Constant(last_exception), # exc. class - Constant(last_exc_value)]) # exc. value + 'last_exception', # exc. class + 'last_exc_value']) # exc. value if outcome is None: w_exc_cls, w_exc_value = None, None else: Modified: pypy/dist/pypy/objspace/flow/model.py ============================================================================== --- pypy/dist/pypy/objspace/flow/model.py (original) +++ pypy/dist/pypy/objspace/flow/model.py Mon May 9 17:14:59 2005 @@ -54,6 +54,18 @@ self.exitcase = exitcase # this is a concrete value self.prevblock = None # the block this Link is an exit of + # exception passing vars + self.last_exception = None + self.last_exc_value = None + + def copy(self, rename=lambda x: x): + newargs = [rename(a) for a in self.args] + newlink = Link(newargs, self.target, self.exitcase) + newlink.prevblock = self.prevblock + newlink.last_exception = rename(self.last_exception) + newlink.last_exc_value = rename(self.last_exc_value) + return newlink + def __repr__(self): return "link from %s to %s" % (str(self.prevblock), str(self.target)) @@ -217,7 +229,6 @@ def __repr__(self): return self.name last_exception = Atom('last_exception') -last_exc_value = Atom('last_exc_value') # if Block().exitswitch == Constant(last_exception), it means that we are # interested in catching the exception that the *last operation* of the # block could raise. The exitcases of the links are None for no exception @@ -333,7 +344,7 @@ assert v in vars else: assert v.value != last_exception - assert v.value != last_exc_value + #assert v.value != last_exc_value exc_links = {} if block.exitswitch is None: assert len(block.exits) <= 1 @@ -356,13 +367,13 @@ for v in link.args: assert isinstance(v, (Constant, Variable)) if isinstance(v, Variable): - assert v in vars + assert v in vars or (exc_link and v in (link.last_exception, link.last_exc_value)) if exc_link: assert v != block.operations[-1].result else: if not exc_link: assert v.value != last_exception - assert v.value != last_exc_value + #assert v.value != last_exc_value vars_previous_blocks.update(vars) try: Modified: pypy/dist/pypy/translator/annrpython.py ============================================================================== --- pypy/dist/pypy/translator/annrpython.py (original) +++ pypy/dist/pypy/translator/annrpython.py Mon May 9 17:14:59 2005 @@ -7,7 +7,7 @@ from pypy.annotation.bookkeeper import Bookkeeper from pypy.objspace.flow.model import Variable, Constant from pypy.objspace.flow.model import SpaceOperation, FunctionGraph -from pypy.objspace.flow.model import last_exception, last_exc_value +from pypy.objspace.flow.model import last_exception class AnnotatorError(Exception): pass @@ -174,7 +174,7 @@ elif isinstance(arg, Constant): #if arg.value is undefined_value: # undefined local variables # return annmodel.SomeImpossibleValue() - assert not arg.value is last_exception and not arg.value is last_exc_value + assert not arg.value is last_exception return self.bookkeeper.immutablevalue(arg.value) else: raise TypeError, 'Variable or Constant expected, got %r' % (arg,) @@ -432,6 +432,10 @@ self.links_followed[link] = True import types in_except_block = False + + last_exception_var = link.last_exception # may be None for non-exception link + last_exc_value_var = link.last_exc_value # may be None for non-exception link + if isinstance(link.exitcase, (types.ClassType, type)) \ and issubclass(link.exitcase, Exception): last_exception_object = annmodel.SomeObject() @@ -441,16 +445,19 @@ last_exc_value_object = self.bookkeeper.valueoftype(link.exitcase) last_exc_value_vars = [] in_except_block = True + # not needed! + #self.setbinding(last_exception_var, last_exception_object) + #self.setbinding(last_exc_value_var, last_exc_value_object) cells = [] renaming = {} for a,v in zip(link.args,link.target.inputargs): renaming.setdefault(a, []).append(v) for a,v in zip(link.args,link.target.inputargs): - if a == Constant(last_exception): + if a == last_exception_var: assert in_except_block cells.append(last_exception_object) - elif a == Constant(last_exc_value): + elif a == last_exc_value_var: assert in_except_block cells.append(last_exc_value_object) last_exc_value_vars.append(v) Modified: pypy/dist/pypy/translator/genc/funcdef.py ============================================================================== --- pypy/dist/pypy/translator/genc/funcdef.py (original) +++ pypy/dist/pypy/translator/genc/funcdef.py Mon May 9 17:14:59 2005 @@ -3,7 +3,7 @@ from pypy.objspace.flow.model import Variable, Constant, SpaceOperation from pypy.objspace.flow.model import traverse, uniqueitems, checkgraph from pypy.objspace.flow.model import Block, Link, FunctionGraph -from pypy.objspace.flow.model import last_exception, last_exc_value +from pypy.objspace.flow.model import last_exception from pypy.translator.simplify import simplify_graph from pypy.translator.unsimplify import remove_direct_loops from pypy.translator.genc.inttype import CIntType @@ -490,8 +490,8 @@ yield '\t}' yield '\tPy_XDECREF(exc_tb);' for op in gen_link(link, { - Constant(last_exception): 'exc_cls', - Constant(last_exc_value): 'exc_value'}): + link.last_exception: 'exc_cls', + link.last_exc_value: 'exc_value'}): yield '\t' + op yield '}' err_reachable = True Modified: pypy/dist/pypy/translator/genc/test/test_typed.py ============================================================================== --- pypy/dist/pypy/translator/genc/test/test_typed.py (original) +++ pypy/dist/pypy/translator/genc/test/test_typed.py Mon May 9 17:14:59 2005 @@ -1,5 +1,6 @@ import autopath import sys +import py.test from pypy.translator.genc.ctyper import GenCSpecializer from pypy.translator.translator import Translator from pypy.translator.test import snippet @@ -29,12 +30,14 @@ fn = self.getcompiled(snippet.add_func) raises(OverflowError, fn, sys.maxint) - def test_int_div_ovf_zer(self): + def test_int_div_ovf_zer(self): # + py.test.skip("right now aborting python wiht Floating Point Error!") fn = self.getcompiled(snippet.div_func) raises(OverflowError, fn, -1) raises(ZeroDivisionError, fn, 0) def test_int_mod_ovf_zer(self): + py.test.skip("right now aborting python wiht Floating Point Error!") fn = self.getcompiled(snippet.mod_func) raises(OverflowError, fn, -1) raises(ZeroDivisionError, fn, 0) @@ -47,4 +50,4 @@ fn = self.getcompiled(snippet.lshift_func) raises(ValueError, fn, -1) raises(OverflowError, fn, 1) - \ No newline at end of file + Modified: pypy/dist/pypy/translator/geninterplevel.py ============================================================================== --- pypy/dist/pypy/translator/geninterplevel.py (original) +++ pypy/dist/pypy/translator/geninterplevel.py Mon May 9 17:14:59 2005 @@ -22,7 +22,7 @@ from copy_reg import _HEAPTYPE from pypy.objspace.flow.model import Variable, Constant, SpaceOperation from pypy.objspace.flow.model import FunctionGraph, Block, Link -from pypy.objspace.flow.model import last_exception, last_exc_value +from pypy.objspace.flow.model import last_exception from pypy.objspace.flow.model import traverse, uniqueitems, checkgraph from pypy.interpreter.pycode import CO_VARARGS, CO_VARKEYWORDS from pypy.annotation import model as annmodel @@ -1169,8 +1169,8 @@ self.nameof(link.exitcase)) q = "elif" for op in self.gen_link(link, localscope, blocknum, block, { - Constant(last_exception): 'e.w_type', - Constant(last_exc_value): 'e.w_value'}): + link.last_exception: 'e.w_type', + link.last_exc_value: 'e.w_value'}): yield " %s" % op yield " else:raise # unhandled case, should not happen" else: Modified: pypy/dist/pypy/translator/simplify.py ============================================================================== --- pypy/dist/pypy/translator/simplify.py (original) +++ pypy/dist/pypy/translator/simplify.py Mon May 9 17:14:59 2005 @@ -203,8 +203,8 @@ # construct the block's new exits exits = [] for case, oldlink in switches: - args = [rename(arg) for arg in oldlink.args] - link = Link(args, oldlink.target, case) + link = oldlink.copy(rename) + link.exitcase = case link.prevblock = block exits.append(link) block.exits = tuple(exits) @@ -269,8 +269,8 @@ link.prevblock.operations.append(op) exits = [] for exit in link.target.exits: - args = [rename(a) for a in exit.args] - exits.append(Link(args, exit.target, exit.exitcase)) + newexit = exit.copy(rename) + exits.append(newexit) link.prevblock.exitswitch = rename(link.target.exitswitch) link.prevblock.recloseblock(*exits) # simplify recursively the new links Modified: pypy/dist/pypy/translator/typer.py ============================================================================== --- pypy/dist/pypy/translator/typer.py (original) +++ pypy/dist/pypy/translator/typer.py Mon May 9 17:14:59 2005 @@ -144,6 +144,8 @@ for link in block.exits: for i in range(len(link.args)): a1 = link.args[i] + if a1 in (link.last_exception, link.last_exc_value):# treated specially in gen_link + continue a2 = link.target.inputargs[i] a2type = self.setbesttype(a2) a1, convops = self.convertvar(a1, a2type) From adim at codespeak.net Mon May 9 18:28:29 2005 From: adim at codespeak.net (adim at codespeak.net) Date: Mon, 9 May 2005 18:28:29 +0200 (CEST) Subject: [pypy-svn] r12123 - pypy/dist/pypy/module/recparser Message-ID: <20050509162829.55BB227BDA@code1.codespeak.net> Author: adim Date: Mon May 9 18:28:29 2005 New Revision: 12123 Added: pypy/dist/pypy/module/recparser/compat.py Modified: pypy/dist/pypy/module/recparser/__init__.py pypy/dist/pypy/module/recparser/pyparser.py pypy/dist/pypy/module/recparser/syntaxtree.py Log: - added basic implementation of ast2tuple() - added compat layer for CPython's parser module - fixed missing line number in SyntaxNode.totuple() Modified: pypy/dist/pypy/module/recparser/__init__.py ============================================================================== --- pypy/dist/pypy/module/recparser/__init__.py (original) +++ pypy/dist/pypy/module/recparser/__init__.py Mon May 9 18:28:29 2005 @@ -23,6 +23,7 @@ 'suite' : 'pyparser.suite', 'expr' : 'pyparser.expr', 'STType' : 'pyparser.STType', + 'ast2tuple' : 'pyparser.ast2tuple', # 'ASTType' : 'pyparser.STType', # 'sequence2st' : 'pyparser.sequence2st', #'eval_input' : 'pyparser.eval_input', Added: pypy/dist/pypy/module/recparser/compat.py ============================================================================== --- (empty file) +++ pypy/dist/pypy/module/recparser/compat.py Mon May 9 18:28:29 2005 @@ -0,0 +1,18 @@ +"""Compatibility layer for CPython's parser module""" + +from pythonparse import parse_python_source +from pypy.module.recparser import PYTHON_PARSER +from compiler import transformer, compile as pycompile + +def suite( source ): + builder = parse_python_source( source, PYTHON_PARSER, "file_input" ) + return builder.stack[-1] + +def expr( source ): + builder = parse_python_source( source, PYTHON_PARSER, "eval_input" ) + return builder.stack[-1] + +def ast2tuple(node, line_info=False): + """Quick dummy implementation of parser.ast2tuple(tree) function""" + tuples = node.totuple(line_info) + return tuples Modified: pypy/dist/pypy/module/recparser/pyparser.py ============================================================================== --- pypy/dist/pypy/module/recparser/pyparser.py (original) +++ pypy/dist/pypy/module/recparser/pyparser.py Mon May 9 18:28:29 2005 @@ -111,4 +111,9 @@ expr.unwrap_spec = [ObjSpace, str] +def ast2tuple(space, node, line_info=False): + """Quick dummy implementation of parser.ast2tuple(tree) function""" + tuples = node.totuple(line_info) + return space.wrap(tuples) +ast2tuple.unwrap_spec = [ObjSpace, STType, bool] Modified: pypy/dist/pypy/module/recparser/syntaxtree.py ============================================================================== --- pypy/dist/pypy/module/recparser/syntaxtree.py (original) +++ pypy/dist/pypy/module/recparser/syntaxtree.py Mon May 9 18:28:29 2005 @@ -116,7 +116,7 @@ def totuple(self, lineno=False ): symvalue = SYMBOLS.get( self.name, (0,self.name) ) l = [ symvalue ] - l += [node.totuple() for node in self.nodes] + l += [node.totuple(lineno) for node in self.nodes] return tuple(l) From adim at codespeak.net Mon May 9 18:29:22 2005 From: adim at codespeak.net (adim at codespeak.net) Date: Mon, 9 May 2005 18:29:22 +0200 (CEST) Subject: [pypy-svn] r12124 - pypy/dist/pypy/module/recparser Message-ID: <20050509162922.4CF8C27BDA@code1.codespeak.net> Author: adim Date: Mon May 9 18:29:22 2005 New Revision: 12124 Modified: pypy/dist/pypy/module/recparser/compat.py (props changed) Log: fixeol on compat From pedronis at codespeak.net Mon May 9 20:31:19 2005 From: pedronis at codespeak.net (pedronis at codespeak.net) Date: Mon, 9 May 2005 20:31:19 +0200 (CEST) Subject: [pypy-svn] r12137 - pypy/dist/pypy/translator/llvm Message-ID: <20050509183119.D40BB27BCE@code1.codespeak.net> Author: pedronis Date: Mon May 9 20:31:19 2005 New Revision: 12137 Modified: pypy/dist/pypy/translator/llvm/funcrepr.py pypy/dist/pypy/translator/llvm/genllvm.py pypy/dist/pypy/translator/llvm/representation.py pypy/dist/pypy/translator/llvm/typerepr.py Log: tweak to let the tests unrelated to exceptions pass Modified: pypy/dist/pypy/translator/llvm/funcrepr.py ============================================================================== --- pypy/dist/pypy/translator/llvm/funcrepr.py (original) +++ pypy/dist/pypy/translator/llvm/funcrepr.py Mon May 9 20:31:19 2005 @@ -4,14 +4,13 @@ from types import FunctionType, MethodType from pypy.objspace.flow.model import Variable, Constant, Block, Link -from pypy.objspace.flow.model import last_exception, last_exc_value from pypy.objspace.flow.model import traverse, checkgraph from pypy.annotation import model as annmodel from pypy.annotation.builtin import BUILTIN_ANALYZERS from pypy.translator.llvm import llvmbc from pypy.translator.unsimplify import remove_double_links -from pypy.translator.llvm.representation import debug, LLVMRepr, CompileError +from pypy.translator.llvm.representation import debug, LLVMRepr, CompileError, last_exception, last_exc_value from pypy.translator.llvm.typerepr import TypeRepr, PointerTypeRepr debug = False Modified: pypy/dist/pypy/translator/llvm/genllvm.py ============================================================================== --- pypy/dist/pypy/translator/llvm/genllvm.py (original) +++ pypy/dist/pypy/translator/llvm/genllvm.py Mon May 9 20:31:19 2005 @@ -5,7 +5,7 @@ import autopath import sets, StringIO -from pypy.objspace.flow.model import Constant, last_exception, last_exc_value +from pypy.objspace.flow.model import Constant from pypy.annotation import model as annmodel from pypy.translator import transform from pypy.translator.translator import Translator Modified: pypy/dist/pypy/translator/llvm/representation.py ============================================================================== --- pypy/dist/pypy/translator/llvm/representation.py (original) +++ pypy/dist/pypy/translator/llvm/representation.py Mon May 9 20:31:19 2005 @@ -2,7 +2,10 @@ import sets from pypy.objspace.flow.model import Variable, Constant -from pypy.objspace.flow.model import last_exception, last_exc_value +# xxx tweak just so that unrelated tests can work +from pypy.objspace.flow.model import last_exception # this one is only used for the exitswitch now!!! +last_exc_value = object() + from pypy.annotation import model as annmodel from pypy.translator.llvm.lazyattribute import MetaLazyRepr LLVM_SIMPLE_TYPES = {annmodel.SomeChar: "sbyte", Modified: pypy/dist/pypy/translator/llvm/typerepr.py ============================================================================== --- pypy/dist/pypy/translator/llvm/typerepr.py (original) +++ pypy/dist/pypy/translator/llvm/typerepr.py Mon May 9 20:31:19 2005 @@ -4,7 +4,6 @@ from types import ClassType from pypy.objspace.flow.model import Variable, Constant -from pypy.objspace.flow.model import last_exception, last_exc_value from pypy.annotation import model as annmodel from pypy.annotation.listdef import ListDef From adim at codespeak.net Tue May 10 12:22:35 2005 From: adim at codespeak.net (adim at codespeak.net) Date: Tue, 10 May 2005 12:22:35 +0200 (CEST) Subject: [pypy-svn] r12145 - pypy/dist/pypy/module/recparser Message-ID: <20050510102235.D3A0D27C09@code1.codespeak.net> Author: adim Date: Tue May 10 12:22:35 2005 New Revision: 12145 Modified: pypy/dist/pypy/module/recparser/pythonlexer.py pypy/dist/pypy/module/recparser/pythonparse.py Log: fixed interactive-shell bug (IndexError when dealing with multi-lines input) Modified: pypy/dist/pypy/module/recparser/pythonlexer.py ============================================================================== --- pypy/dist/pypy/module/recparser/pythonlexer.py (original) +++ pypy/dist/pypy/module/recparser/pythonlexer.py Tue May 10 12:22:35 2005 @@ -263,7 +263,11 @@ if not hasattr(self, '_lines'): # split lines only once self._lines = self.input.splitlines() - return 'line %s : %s' % (self.line, self._lines[self.line-1]) + if self.line > len(self._lines): + lineno = len(self._lines) + else: + lineno = self.line + return 'line %s : %s' % (lineno, self._lines[lineno-1]) ## ONLY refactor ideas ########################################### ## def _mynext(self): Modified: pypy/dist/pypy/module/recparser/pythonparse.py ============================================================================== --- pypy/dist/pypy/module/recparser/pythonparse.py (original) +++ pypy/dist/pypy/module/recparser/pythonparse.py Tue May 10 12:22:35 2005 @@ -17,7 +17,6 @@ builder._source_encoding = src.encoding # if not result: - print src.debug() raise SyntaxError("at %s" % src.debug() ) return builder From pedronis at codespeak.net Tue May 10 15:06:42 2005 From: pedronis at codespeak.net (pedronis at codespeak.net) Date: Tue, 10 May 2005 15:06:42 +0200 (CEST) Subject: [pypy-svn] r12150 - pypy/dist/pypy/rpython Message-ID: <20050510130642.4FDC127C06@code1.codespeak.net> Author: pedronis Date: Tue May 10 15:06:42 2005 New Revision: 12150 Added: pypy/dist/pypy/rpython/ (props changed) Log: new dir, rarithemtic and the new ll types stuff will live here From pedronis at codespeak.net Tue May 10 15:09:55 2005 From: pedronis at codespeak.net (pedronis at codespeak.net) Date: Tue, 10 May 2005 15:09:55 +0200 (CEST) Subject: [pypy-svn] r12151 - pypy/dist/pypy/rpython Message-ID: <20050510130955.9B6E527C06@code1.codespeak.net> Author: pedronis Date: Tue May 10 15:09:55 2005 New Revision: 12151 Added: pypy/dist/pypy/rpython/__init__.py (contents, props changed) Log: package __init__ Added: pypy/dist/pypy/rpython/__init__.py ============================================================================== --- (empty file) +++ pypy/dist/pypy/rpython/__init__.py Tue May 10 15:09:55 2005 @@ -0,0 +1 @@ +# From pedronis at codespeak.net Tue May 10 15:36:01 2005 From: pedronis at codespeak.net (pedronis at codespeak.net) Date: Tue, 10 May 2005 15:36:01 +0200 (CEST) Subject: [pypy-svn] r12152 - in pypy/dist/pypy: annotation interpreter objspace/std objspace/std/test rpython rpython/test tool tool/test translator translator/genc translator/test Message-ID: <20050510133601.6381D27BFE@code1.codespeak.net> Author: pedronis Date: Tue May 10 15:36:01 2005 New Revision: 12152 Added: pypy/dist/pypy/rpython/rarithmetic.py - copied unchanged from r12148, pypy/dist/pypy/tool/rarithmetic.py pypy/dist/pypy/rpython/test/ (props changed) pypy/dist/pypy/rpython/test/__init__.py - copied unchanged from r12151, pypy/dist/pypy/rpython/__init__.py pypy/dist/pypy/rpython/test/test_rarithmetic.py - copied, changed from r12148, pypy/dist/pypy/tool/test/test_rarithmetic.py Removed: pypy/dist/pypy/tool/rarithmetic.py pypy/dist/pypy/tool/test/test_rarithmetic.py Modified: pypy/dist/pypy/annotation/bookkeeper.py pypy/dist/pypy/annotation/builtin.py pypy/dist/pypy/annotation/model.py pypy/dist/pypy/interpreter/baseobjspace.py pypy/dist/pypy/objspace/std/dictobject.py pypy/dist/pypy/objspace/std/intobject.py pypy/dist/pypy/objspace/std/listobject.py pypy/dist/pypy/objspace/std/listsort.py pypy/dist/pypy/objspace/std/longobject.py pypy/dist/pypy/objspace/std/longtype.py pypy/dist/pypy/objspace/std/stringobject.py pypy/dist/pypy/objspace/std/strutil.py pypy/dist/pypy/objspace/std/test/test_intobject.py pypy/dist/pypy/objspace/std/test/test_longobject.py pypy/dist/pypy/objspace/std/tupleobject.py pypy/dist/pypy/rpython/ (props changed) pypy/dist/pypy/translator/genc/pyobjtype.py pypy/dist/pypy/translator/geninterplevel.py pypy/dist/pypy/translator/simplify.py pypy/dist/pypy/translator/test/snippet.py pypy/dist/pypy/translator/test/test_annrpython.py Log: moving rarithmetic.py to rpython Modified: pypy/dist/pypy/annotation/bookkeeper.py ============================================================================== --- pypy/dist/pypy/annotation/bookkeeper.py (original) +++ pypy/dist/pypy/annotation/bookkeeper.py Tue May 10 15:36:01 2005 @@ -14,7 +14,7 @@ from pypy.interpreter.pycode import CO_VARARGS from pypy.interpreter.pycode import cpython_code_signature from pypy.interpreter.argument import ArgErr -from pypy.tool.rarithmetic import r_uint +from pypy.rpython.rarithmetic import r_uint from pypy.tool.unionfind import UnionFind import inspect, new Modified: pypy/dist/pypy/annotation/builtin.py ============================================================================== --- pypy/dist/pypy/annotation/builtin.py (original) +++ pypy/dist/pypy/annotation/builtin.py Tue May 10 15:36:01 2005 @@ -10,7 +10,7 @@ from pypy.annotation.model import SomeFloat, unionof from pypy.annotation.bookkeeper import getbookkeeper from pypy.objspace.flow.model import Constant -import pypy.tool.rarithmetic +import pypy.rpython.rarithmetic # convenience only! def immutablevalue(x): @@ -53,7 +53,7 @@ r = SomeBool() if s_type.is_constant(): typ = s_type.const - if typ == pypy.tool.rarithmetic.r_uint: + if typ == pypy.rpython.rarithmetic.r_uint: if s_obj.is_constant(): r.const = isinstance(s_obj.const, typ) else: @@ -203,10 +203,10 @@ original = getattr(__builtin__, name[8:]) BUILTIN_ANALYZERS[original] = value -BUILTIN_ANALYZERS[pypy.tool.rarithmetic.r_uint] = restricted_uint -BUILTIN_ANALYZERS[pypy.tool.rarithmetic.ovfcheck] = rarith_ovfcheck -BUILTIN_ANALYZERS[pypy.tool.rarithmetic.ovfcheck_lshift] = rarith_ovfcheck_lshift -BUILTIN_ANALYZERS[pypy.tool.rarithmetic.intmask] = rarith_intmask +BUILTIN_ANALYZERS[pypy.rpython.rarithmetic.r_uint] = restricted_uint +BUILTIN_ANALYZERS[pypy.rpython.rarithmetic.ovfcheck] = rarith_ovfcheck +BUILTIN_ANALYZERS[pypy.rpython.rarithmetic.ovfcheck_lshift] = rarith_ovfcheck_lshift +BUILTIN_ANALYZERS[pypy.rpython.rarithmetic.intmask] = rarith_intmask BUILTIN_ANALYZERS[Exception.__init__.im_func] = exception_init # this one is needed otherwise when annotating assert in a test we may try to annotate Modified: pypy/dist/pypy/annotation/model.py ============================================================================== --- pypy/dist/pypy/annotation/model.py (original) +++ pypy/dist/pypy/annotation/model.py Tue May 10 15:36:01 2005 @@ -118,7 +118,7 @@ knowntype = int def __init__(self, nonneg=False, unsigned=False): self.nonneg = unsigned or nonneg - self.unsigned = unsigned # pypy.tool.rarithmetic.r_uint + self.unsigned = unsigned # pypy.rpython.rarithmetic.r_uint class SomeBool(SomeInteger): Modified: pypy/dist/pypy/interpreter/baseobjspace.py ============================================================================== --- pypy/dist/pypy/interpreter/baseobjspace.py (original) +++ pypy/dist/pypy/interpreter/baseobjspace.py Tue May 10 15:36:01 2005 @@ -3,7 +3,7 @@ from pypy.interpreter.miscutils import getthreadlocals from pypy.interpreter.argument import Arguments from pypy.tool.cache import Cache -from pypy.tool.rarithmetic import r_uint +from pypy.rpython.rarithmetic import r_uint __all__ = ['ObjSpace', 'OperationError', 'Wrappable', 'BaseWrappable', 'W_Root'] Modified: pypy/dist/pypy/objspace/std/dictobject.py ============================================================================== --- pypy/dist/pypy/objspace/std/dictobject.py (original) +++ pypy/dist/pypy/objspace/std/dictobject.py Tue May 10 15:36:01 2005 @@ -8,7 +8,7 @@ from pypy.objspace.std.objspace import * from pypy.interpreter import gateway -from pypy.tool.rarithmetic import r_uint +from pypy.rpython.rarithmetic import r_uint class Entry: def __init__(self): Modified: pypy/dist/pypy/objspace/std/intobject.py ============================================================================== --- pypy/dist/pypy/objspace/std/intobject.py (original) +++ pypy/dist/pypy/objspace/std/intobject.py Tue May 10 15:36:01 2005 @@ -1,6 +1,6 @@ from pypy.objspace.std.objspace import * from pypy.objspace.std.noneobject import W_NoneObject -from pypy.tool.rarithmetic import ovfcheck, ovfcheck_lshift, LONG_BIT, r_uint +from pypy.rpython.rarithmetic import ovfcheck, ovfcheck_lshift, LONG_BIT, r_uint """ In order to have the same behavior running Modified: pypy/dist/pypy/objspace/std/listobject.py ============================================================================== --- pypy/dist/pypy/objspace/std/listobject.py (original) +++ pypy/dist/pypy/objspace/std/listobject.py Tue May 10 15:36:01 2005 @@ -5,7 +5,7 @@ from pypy.objspace.std import slicetype from pypy.interpreter import gateway, baseobjspace -from pypy.tool.rarithmetic import r_uint +from pypy.rpython.rarithmetic import r_uint from pypy.objspace.std.listsort import TimSort Modified: pypy/dist/pypy/objspace/std/listsort.py ============================================================================== --- pypy/dist/pypy/objspace/std/listsort.py (original) +++ pypy/dist/pypy/objspace/std/listsort.py Tue May 10 15:36:01 2005 @@ -1,4 +1,4 @@ -from pypy.tool.rarithmetic import ovfcheck, ovfcheck_lshift +from pypy.rpython.rarithmetic import ovfcheck, ovfcheck_lshift ## ------------------------------------------------------------------------ Modified: pypy/dist/pypy/objspace/std/longobject.py ============================================================================== --- pypy/dist/pypy/objspace/std/longobject.py (original) +++ pypy/dist/pypy/objspace/std/longobject.py Tue May 10 15:36:01 2005 @@ -3,8 +3,8 @@ from pypy.objspace.std.intobject import W_IntObject from pypy.objspace.std.floatobject import W_FloatObject from pypy.objspace.std.noneobject import W_NoneObject -from pypy.tool.rarithmetic import intmask, r_uint, LONG_MASK -from pypy.tool.rarithmetic import LONG_BIT +from pypy.rpython.rarithmetic import intmask, r_uint, LONG_MASK +from pypy.rpython.rarithmetic import LONG_BIT import math Modified: pypy/dist/pypy/objspace/std/longtype.py ============================================================================== --- pypy/dist/pypy/objspace/std/longtype.py (original) +++ pypy/dist/pypy/objspace/std/longtype.py Tue May 10 15:36:01 2005 @@ -3,7 +3,7 @@ from pypy.interpreter.error import OperationError from pypy.objspace.std.inttype import int_typedef from pypy.interpreter.gateway import NoneNotWrapped -from pypy.tool.rarithmetic import r_uint +from pypy.rpython.rarithmetic import r_uint def descr__new__(space, w_longtype, w_value=0, w_base=NoneNotWrapped): from pypy.objspace.std.longobject import W_LongObject, args_from_long Modified: pypy/dist/pypy/objspace/std/stringobject.py ============================================================================== --- pypy/dist/pypy/objspace/std/stringobject.py (original) +++ pypy/dist/pypy/objspace/std/stringobject.py Tue May 10 15:36:01 2005 @@ -2,7 +2,7 @@ from pypy.objspace.std.objspace import * from pypy.interpreter import gateway -from pypy.tool.rarithmetic import intmask, ovfcheck +from pypy.rpython.rarithmetic import intmask, ovfcheck from pypy.objspace.std.intobject import W_IntObject from pypy.objspace.std.sliceobject import W_SliceObject from pypy.objspace.std import slicetype Modified: pypy/dist/pypy/objspace/std/strutil.py ============================================================================== --- pypy/dist/pypy/objspace/std/strutil.py (original) +++ pypy/dist/pypy/objspace/std/strutil.py Tue May 10 15:36:01 2005 @@ -2,7 +2,7 @@ Pure Python implementation of string utilities. """ -from pypy.tool.rarithmetic import r_uint, ovfcheck +from pypy.rpython.rarithmetic import r_uint, ovfcheck # XXX factor more functions out of stringobject.py. # This module is independent from PyPy. Modified: pypy/dist/pypy/objspace/std/test/test_intobject.py ============================================================================== --- pypy/dist/pypy/objspace/std/test/test_intobject.py (original) +++ pypy/dist/pypy/objspace/std/test/test_intobject.py Tue May 10 15:36:01 2005 @@ -2,7 +2,7 @@ import autopath from pypy.objspace.std import intobject as iobj from pypy.objspace.std.objspace import FailedToImplement -from pypy.tool.rarithmetic import r_uint +from pypy.rpython.rarithmetic import r_uint objspacename = 'std' Modified: pypy/dist/pypy/objspace/std/test/test_longobject.py ============================================================================== --- pypy/dist/pypy/objspace/std/test/test_longobject.py (original) +++ pypy/dist/pypy/objspace/std/test/test_longobject.py Tue May 10 15:36:01 2005 @@ -3,7 +3,7 @@ from random import random, randint from pypy.objspace.std import longobject as lobj from pypy.objspace.std.objspace import FailedToImplement -from pypy.tool.rarithmetic import r_uint +from pypy.rpython.rarithmetic import r_uint objspacename = 'std' Modified: pypy/dist/pypy/objspace/std/tupleobject.py ============================================================================== --- pypy/dist/pypy/objspace/std/tupleobject.py (original) +++ pypy/dist/pypy/objspace/std/tupleobject.py Tue May 10 15:36:01 2005 @@ -1,6 +1,6 @@ from pypy.objspace.std.objspace import * from pypy.objspace.std.intobject import W_IntObject -from pypy.tool.rarithmetic import intmask +from pypy.rpython.rarithmetic import intmask from pypy.objspace.std.sliceobject import W_SliceObject from pypy.objspace.std import slicetype from pypy.interpreter import gateway Copied: pypy/dist/pypy/rpython/test/test_rarithmetic.py (from r12148, pypy/dist/pypy/tool/test/test_rarithmetic.py) ============================================================================== --- pypy/dist/pypy/tool/test/test_rarithmetic.py (original) +++ pypy/dist/pypy/rpython/test/test_rarithmetic.py Tue May 10 15:36:01 2005 @@ -1,6 +1,4 @@ -import unittest -import autopath -from pypy.tool.rarithmetic import * +from pypy.rpython.rarithmetic import * import sys Deleted: /pypy/dist/pypy/tool/rarithmetic.py ============================================================================== --- /pypy/dist/pypy/tool/rarithmetic.py Tue May 10 15:36:01 2005 +++ (empty file) @@ -1,310 +0,0 @@ -""" -This file defines restricted arithmetic: - -classes and operations to express integer arithmetic, -such that before and after translation semantics are -consistent - -r_uint an unsigned integer which has not overflow - checking. It is always positive and always - truncated to the internal machine word size. -intmask mask a possibly long value when running on CPython - back to a signed int value -ovfcheck check on CPython whether the result of a signed - integer operation did overflow -ovfcheck_lshift - << with oveflow checking - catering to 2.3/2.4 differences about << - -These are meant to be erased by translation, r_uint -in the process should mark unsigned values, ovfcheck should -mark where overflow checking is required. - - -""" - -class r_int(int): - """ fake integer implementation in order to make sure that - primitive integer operations do overflow """ - - def __add__(self, other): - x = int(self) - y = int(other) - return r_int(x + y) - __radd__ = __add__ - - def __sub__(self, other): - x = int(self) - y = int(other) - return r_int(x - y) - - def __rsub__(self, other): - y = int(self) - x = int(other) - return r_int(x - y) - - def __mul__(self, other): - x = int(self) - if not isinstance(other, (int, long)): - return x * other - y = int(other) - return r_int(x * y) - __rmul__ = __mul__ - - def __div__(self, other): - x = int(self) - y = int(other) - return r_int(x // y) - - __floordiv__ = __div__ - - def __rdiv__(self, other): - y = int(self) - x = int(other) - return r_int(x // y) - - __rfloordiv__ = __rdiv__ - - def __mod__(self, other): - x = int(self) - y = int(other) - return r_int(x % y) - - def __rmod__(self, other): - y = int(self) - x = int(other) - return r_int(x % y) - - def __divmod__(self, other): - x = int(self) - y = int(other) - res = divmod(x, y) - return (r_int(res[0]), r_int(res[1])) - - def __lshift__(self, n): - # ensure long shift, so we don't depend on - # shift truncation (2.3) vs. long(2.4) - x = long(self) - y = int(n) - return r_int(x << y) - - def __rlshift__(self, n): - y = long(self) - x = int(n) - return r_int(x << y) - - def __rshift__(self, n): - x = int(self) - y = int(n) - return r_int(x >> y) - - def __rrshift__(self, n): - y = int(self) - x = int(n) - return r_int(x >> y) - - def __or__(self, other): - x = int(self) - y = int(other) - return r_int(x | y) - __ror__ = __or__ - - def __and__(self, other): - x = int(self) - y = int(other) - return r_int(x & y) - __rand__ = __and__ - - def __xor__(self, other): - x = int(self) - y = int(other) - return r_int(x ^ y) - __rxor__ = __xor__ - - def __neg__(self): - x = int(self) - return r_int(-x) - - def __pos__(self): - return r_int(self) - - def __invert__(self): - x = int(self) - return r_int(~x) - - def __pow__(self, other, m=None): - x = int(self) - y = int(other) - res = pow(x, y, m) - return r_int(res) - - def __rpow__(self, other, m=None): - y = int(self) - x = int(other) - res = pow(x, y, m) - return r_int(res) - -# set up of machine internals -_bits = 0 -_itest = 1 -_Ltest = 1L -while _itest == _Ltest and type(_itest) is int: - _itest *= 2 - _Ltest *= 2 - _bits += 1 - -LONG_BIT = _bits+1 -LONG_MASK = _Ltest*2-1 -LONG_TEST = _Ltest - -def intmask(n): - if isinstance(n, int): - return n - if isinstance(n, r_uint): - n = long(n) - n &= LONG_MASK - if n >= LONG_TEST: - n -= 2*LONG_TEST - return int(n) - -del _bits, _itest, _Ltest - -def ovfcheck(r): - # to be used as ovfcheck(x y) - # raise OverflowError if the operation did overflow - assert not isinstance(r, r_uint), "unexpected ovf check on unsigned" - if isinstance(r, long): - raise OverflowError, "signed integer expression did overflow" - return r - -def ovfcheck_lshift(a, b): - return ovfcheck(int(long(a) << b)) - -class r_uint(long): - """ fake unsigned integer implementation """ - - _mask = LONG_MASK - - def __new__(klass, val): - return long.__new__(klass, val & klass._mask) - - def __int__(self): - if self < LONG_TEST: - return long.__int__(self) - else: - return intmask(self) - - def __add__(self, other): - x = long(self) - y = long(other) - return r_uint(x + y) - __radd__ = __add__ - - def __sub__(self, other): - x = long(self) - y = long(other) - return r_uint(x - y) - - def __rsub__(self, other): - y = long(self) - x = long(other) - return r_uint(x - y) - - def __mul__(self, other): - x = long(self) - if not isinstance(other, (int, long)): - return x * other - y = long(other) - return r_uint(x * y) - __rmul__ = __mul__ - - def __div__(self, other): - x = long(self) - y = long(other) - return r_uint(x // y) - - __floordiv__ = __div__ - - def __rdiv__(self, other): - y = long(self) - x = long(other) - return r_uint(x // y) - - __rfloordiv__ = __rdiv__ - - def __mod__(self, other): - x = long(self) - y = long(other) - return r_uint(x % y) - - def __rmod__(self, other): - y = long(self) - x = long(other) - return r_uint(x % y) - - def __divmod__(self, other): - x = long(self) - y = long(other) - res = divmod(x, y) - return (r_uint(res[0]), r_uint(res[1])) - - def __lshift__(self, n): - x = long(self) - y = long(n) - return r_uint(x << y) - - def __rlshift__(self, n): - y = long(self) - x = long(n) - return r_uint(x << y) - - def __rshift__(self, n): - x = long(self) - y = long(n) - return r_uint(x >> y) - - def __rrshift__(self, n): - y = long(self) - x = long(n) - return r_uint(x >> y) - - def __or__(self, other): - x = long(self) - y = long(other) - return r_uint(x | y) - __ror__ = __or__ - - def __and__(self, other): - x = long(self) - y = long(other) - return r_uint(x & y) - __rand__ = __and__ - - def __xor__(self, other): - x = long(self) - y = long(other) - return r_uint(x ^ y) - __rxor__ = __xor__ - - def __neg__(self): - x = long(self) - return r_uint(-x) - - def __pos__(self): - return r_uint(self) - - def __invert__(self): - x = long(self) - return r_uint(~x) - - def __pow__(self, other, m=None): - x = long(self) - y = long(other) - res = pow(x, y, m) - return r_uint(res) - - def __rpow__(self, other, m=None): - y = long(self) - x = long(other) - res = pow(x, y, m) - return r_uint(res) Deleted: /pypy/dist/pypy/tool/test/test_rarithmetic.py ============================================================================== --- /pypy/dist/pypy/tool/test/test_rarithmetic.py Tue May 10 15:36:01 2005 +++ (empty file) @@ -1,218 +0,0 @@ -import unittest -import autopath -from pypy.tool.rarithmetic import * -import sys - - -maxint_mask = (sys.maxint*2 + 1) -machbits = 0 -i = 1 -l = 1L -while i == l and type(i) is int: - i *= 2 - l *= 2 - machbits += 1 -#print machbits - - -objspacename = 'std' - -class Test_r_int: - - def setup_method(self,method): - space = self.space - - def test__add__(self): - self.binary_test(lambda x, y: x + y) - def test__sub__(self): - self.binary_test(lambda x, y: x - y) - def test__mul__(self): - self.binary_test(lambda x, y: x * y) - x = 3; y = [2] - assert x*y == r_int(x)*y - assert y*x == y*r_int(x) - def test__div__(self): - self.binary_test(lambda x, y: x // y) - def test__mod__(self): - self.binary_test(lambda x, y: x % y) - def test__divmod__(self): - self.binary_test(divmod) - def test__lshift__(self): - self.binary_test(lambda x, y: x << y, (1, 2, 3)) - def test__rshift__(self): - self.binary_test(lambda x, y: x >> y, (1, 2, 3)) - def test__or__(self): - self.binary_test(lambda x, y: x | y) - def test__and__(self): - self.binary_test(lambda x, y: x & y) - def test__xor__(self): - self.binary_test(lambda x, y: x ^ y) - def test__neg__(self): - self.unary_test(lambda x: -x) - def test__pos__(self): - self.unary_test(lambda x: +x) - def test__invert__(self): - self.unary_test(lambda x: ~x) - def test__pow__(self): - self.binary_test(lambda x, y: x**y, (2, 3)) - self.binary_test(lambda x, y: pow(x, y, 42), (2, 3, 5, 1000)) - - def unary_test(self, f): - for arg in (-10, -1, 0, 3, 12345): - res = f(arg) - cmp = f(r_int(arg)) - assert res == cmp - - def binary_test(self, f, rargs = None): - if not rargs: - rargs = (-10, -1, 3, 55) - for larg in (-10, -1, 0, 3, 1234): - for rarg in rargs: - for types in ((int, r_int), (r_int, int), (r_int, r_int)): - res = f(larg, rarg) - left, right = types - cmp = f(left(larg), right(rarg)) - assert res == cmp - -class Test_r_uint: - - def setup_method(self,method): - space = self.space - - def test__add__(self): - self.binary_test(lambda x, y: x + y) - def test__sub__(self): - self.binary_test(lambda x, y: x - y) - def test__mul__(self): - self.binary_test(lambda x, y: x * y) - x = 3; y = [2] - assert x*y == r_uint(x)*y - assert y*x == y*r_uint(x) - def test__div__(self): - self.binary_test(lambda x, y: x // y) - def test__mod__(self): - self.binary_test(lambda x, y: x % y) - def test__divmod__(self): - self.binary_test(divmod) - def test__lshift__(self): - self.binary_test(lambda x, y: x << y, (1, 2, 3)) - def test__rshift__(self): - self.binary_test(lambda x, y: x >> y, (1, 2, 3)) - def test__or__(self): - self.binary_test(lambda x, y: x | y) - def test__and__(self): - self.binary_test(lambda x, y: x & y) - def test__xor__(self): - self.binary_test(lambda x, y: x ^ y) - def test__neg__(self): - self.unary_test(lambda x: -x) - def test__pos__(self): - self.unary_test(lambda x: +x) - def test__invert__(self): - self.unary_test(lambda x: ~x) - def test__pow__(self): - self.binary_test(lambda x, y: x**y, (2, 3)) - # pow is buggy, dowsn't allow our type - #self.binary_test(lambda x, y: pow(x, y, 42), (2, 3, 5, 1000)) - - def test_back_to_int(self): - assert int(r_uint(-1)) == -1 - assert int(r_uint(1)) == 1 - - def unary_test(self, f): - for arg in (0, 3, 12345): - res = f(arg) & maxint_mask - cmp = f(r_uint(arg)) - assert res == cmp - - def binary_test(self, f, rargs = None): - mask = maxint_mask - if not rargs: - rargs = (1, 3, 55) - for larg in (0, 1, 2, 3, 1234): - for rarg in rargs: - for types in ((int, r_uint), (r_uint, int), (r_uint, r_uint)): - res = f(larg, rarg) - left, right = types - cmp = f(left(larg), right(rarg)) - if type(res) is tuple: - res = res[0] & mask, res[1] & mask - else: - res = res & mask - assert res == cmp - -def test_intmask(): - assert intmask(1) == 1 - assert intmask(sys.maxint) == sys.maxint - minint = -sys.maxint-1 - assert intmask(minint) == minint - assert intmask(2*sys.maxint+1) == -1 - assert intmask(sys.maxint*2) == -2 - assert intmask(sys.maxint*2+2) == 0 - assert intmask(2*(sys.maxint*1+1)) == 0 - assert intmask(1 << (machbits-1)) == 1 << (machbits-1) - assert intmask(sys.maxint+1) == minint - assert intmask(minint-1) == sys.maxint - assert intmask(r_uint(-1)) == -1 - - -def test_ovfcheck(): - one = 1 - x = sys.maxint - minusx = -sys.maxint - n = -sys.maxint-1 - y = sys.maxint-1 - # sanity - raises(AssertionError, ovfcheck, r_uint(0)) - - # not overflowing - try: - ovfcheck(y+one) - except OverflowError: - assert False - else: - pass - try: - ovfcheck(minusx-one) - except OverflowError: - assert False - else: - pass - try: - ovfcheck(x-x) - except OverflowError: - assert False - else: - pass - try: - ovfcheck(n-n) - except OverflowError: - assert False - else: - pass - - # overflowing - try: - ovfcheck(x+one) - except OverflowError: - pass - else: - assert False - try: - ovfcheck(x+x) - except OverflowError: - pass - else: - assert False - try: - ovfcheck(n-one) - except OverflowError: - pass - else: - assert False - try: - ovfcheck(n-y) - except OverflowError: - pass - else: - assert False Modified: pypy/dist/pypy/translator/genc/pyobjtype.py ============================================================================== --- pypy/dist/pypy/translator/genc/pyobjtype.py (original) +++ pypy/dist/pypy/translator/genc/pyobjtype.py Tue May 10 15:36:01 2005 @@ -5,7 +5,7 @@ from pypy.translator.genc.basetype import CType from types import FunctionType, CodeType, InstanceType, ClassType -from pypy.tool.rarithmetic import r_int, r_uint +from pypy.rpython.rarithmetic import r_int, r_uint # XXX maybe this can be done more elegantly: # needed to convince should_translate_attr Modified: pypy/dist/pypy/translator/geninterplevel.py ============================================================================== --- pypy/dist/pypy/translator/geninterplevel.py (original) +++ pypy/dist/pypy/translator/geninterplevel.py Tue May 10 15:36:01 2005 @@ -29,7 +29,7 @@ from types import FunctionType, CodeType, ModuleType from pypy.interpreter.error import OperationError from pypy.interpreter.argument import Arguments -from pypy.tool.rarithmetic import r_int, r_uint +from pypy.rpython.rarithmetic import r_int, r_uint from pypy.translator.translator import Translator from pypy.objspace.flow import FlowObjSpace Modified: pypy/dist/pypy/translator/simplify.py ============================================================================== --- pypy/dist/pypy/translator/simplify.py (original) +++ pypy/dist/pypy/translator/simplify.py Tue May 10 15:36:01 2005 @@ -65,7 +65,7 @@ # this is the case if no exception handling was provided. # Otherwise, we have a block ending in the operation, # followed by a block with a single ovfcheck call. - from pypy.tool.rarithmetic import ovfcheck, ovfcheck_lshift + from pypy.rpython.rarithmetic import ovfcheck, ovfcheck_lshift from pypy.objspace.flow.objspace import op_appendices from pypy.objspace.flow.objspace import implicit_exceptions covf = Constant(ovfcheck) Modified: pypy/dist/pypy/translator/test/snippet.py ============================================================================== --- pypy/dist/pypy/translator/test/snippet.py (original) +++ pypy/dist/pypy/translator/test/snippet.py Tue May 10 15:36:01 2005 @@ -84,7 +84,7 @@ def simple_func(i=numtype): return i + 1 -from pypy.tool.rarithmetic import ovfcheck, ovfcheck_lshift +from pypy.rpython.rarithmetic import ovfcheck, ovfcheck_lshift def add_func(i=numtype): try: Modified: pypy/dist/pypy/translator/test/test_annrpython.py ============================================================================== --- pypy/dist/pypy/translator/test/test_annrpython.py (original) +++ pypy/dist/pypy/translator/test/test_annrpython.py Tue May 10 15:36:01 2005 @@ -8,7 +8,7 @@ from pypy.annotation.listdef import ListDef from pypy.annotation.dictdef import DictDef from pypy.objspace.flow.model import * -from pypy.tool.rarithmetic import r_uint +from pypy.rpython.rarithmetic import r_uint from pypy.translator.test import snippet @@ -801,7 +801,6 @@ py.test.raises(KeyError, "access_sets[object()]") def test_isinstance_usigned(self): - from pypy.tool.rarithmetic import r_uint def f(x): return isinstance(x, r_uint) def g(): From pedronis at codespeak.net Tue May 10 15:41:51 2005 From: pedronis at codespeak.net (pedronis at codespeak.net) Date: Tue, 10 May 2005 15:41:51 +0200 (CEST) Subject: [pypy-svn] r12153 - pypy/dist/pypy/rpython Message-ID: <20050510134151.8F3BD27BFE@code1.codespeak.net> Author: pedronis Date: Tue May 10 15:41:51 2005 New Revision: 12153 Added: pypy/dist/pypy/rpython/lltypes.py - copied unchanged from r12152, user/pedronis/llrpy/ll.py Log: classes to define lltypes and concrete (testing) implementation of semantics From pedronis at codespeak.net Tue May 10 15:44:54 2005 From: pedronis at codespeak.net (pedronis at codespeak.net) Date: Tue, 10 May 2005 15:44:54 +0200 (CEST) Subject: [pypy-svn] r12154 - pypy/dist/pypy/rpython Message-ID: <20050510134454.079E727BFE@code1.codespeak.net> Author: pedronis Date: Tue May 10 15:44:53 2005 New Revision: 12154 Modified: pypy/dist/pypy/rpython/lltypes.py Log: oops, tool.rarithmetic -> rpython.rarithmetic Modified: pypy/dist/pypy/rpython/lltypes.py ============================================================================== --- pypy/dist/pypy/rpython/lltypes.py (original) +++ pypy/dist/pypy/rpython/lltypes.py Tue May 10 15:44:53 2005 @@ -1,6 +1,6 @@ import weakref import py -from pypy.tool.rarithmetic import r_uint +from pypy.rpython.rarithmetic import r_uint class LowLevelType(object): From pedronis at codespeak.net Tue May 10 15:48:16 2005 From: pedronis at codespeak.net (pedronis at codespeak.net) Date: Tue, 10 May 2005 15:48:16 +0200 (CEST) Subject: [pypy-svn] r12155 - in pypy/dist/pypy/rpython: . test Message-ID: <20050510134816.E922E27BFE@code1.codespeak.net> Author: pedronis Date: Tue May 10 15:48:16 2005 New Revision: 12155 Added: pypy/dist/pypy/rpython/test/test_lltypes.py - copied, changed from r12153, pypy/dist/pypy/rpython/lltypes.py Modified: pypy/dist/pypy/rpython/lltypes.py Log: moved lltypes tests to their own file under test Modified: pypy/dist/pypy/rpython/lltypes.py ============================================================================== --- pypy/dist/pypy/rpython/lltypes.py (original) +++ pypy/dist/pypy/rpython/lltypes.py Tue May 10 15:48:16 2005 @@ -370,162 +370,3 @@ raise TypeError, "malloc for Structs and Arrays only" return _ptr(GcPtr(T), o) -# ____________________________________________________________ - -def test_me(): - S0 = Struct("s0", ('a', Signed), ('b', Signed)) - assert S0.a == Signed - assert S0.b == Signed - s0 = malloc(S0) - print s0 - assert typeOf(s0) == GcPtr(S0) - assert s0.a == 0 - assert s0.b == 0 - assert typeOf(s0.a) == Signed - s0.a = 1 - s0.b = s0.a - assert s0.a == 1 - assert s0.b == 1 - # simple array - Ar = Array(('v', Signed)) - x = malloc(Ar,0) - print x - assert len(x) == 0 - x = malloc(Ar,3) - print x - assert typeOf(x) == GcPtr(Ar) - assert typeOf(x[0]) == _TmpPtr(Ar.OF) - assert typeOf(x[0].v) == Signed - assert x[0].v == 0 - x[0].v = 1 - x[1].v = 2 - x[2].v = 3 - assert [x[z].v for z in range(3)] == [1, 2, 3] - # - def define_list(T): - List_typ = Struct("list", - ("items", GcPtr(Array(('item',T))))) - def newlist(): - l = malloc(List_typ) - items = malloc(List_typ.items.TO, 0) - l.items = items - return l - - def append(l, newitem): - length = len(l.items) - newitems = malloc(List_typ.items.TO, length+1) - i = 0 - while i' % (self,) - - def __str__(self): - return self.__class__.__name__ - - def _defl(self): - raise NotImplementedError - - -class ContainerType(LowLevelType): - pass - - -class Struct(ContainerType): - def __init__(self, name, *fields): - self._name = name - self._flds = flds = {} - self._names = names = [] - self._arrayfld = None - for name, typ in fields: - if name.startswith('_'): - raise NameError, ("%s: field name %r should not start with " - "an underscore" % (self._name, name,)) - names.append(name) - if name in flds: - raise TypeError("%s: repeated field name" % self._name) - flds[name] = typ - # look if we have an inlined variable-sized array as the last field - if fields: - for name, typ in fields[:-1]: - if isinstance(typ, Array): - raise TypeError("%s: array field must be last") - name, typ = fields[-1] - if isinstance(typ, Array): - self._arrayfld = name - - def __getattr__(self, name): - try: - return self._flds[name] - except KeyError: - raise AttributeError, 'struct %s has no field %r' % (self._name, - name) - - def _str_fields(self): - return ', '.join(['%s: %s' % (name, self._flds[name]) - for name in self._names]) - - def __str__(self): - return "Struct %s { %s }" % (self._name, self._str_fields()) - - def _defl(self): - return _struct(self) - - -class Array(ContainerType): - def __init__(self, *fields): - self.OF = Struct("", *fields) - if self.OF._arrayfld is not None: - raise TypeError("array cannot contain an inlined array") - - def __str__(self): - return "Array of { %s }" % (self.OF._str_fields(),) - - -class Primitive(LowLevelType): - def __init__(self, name, default): - self._name = name - self._default = default - - def __str__(self): - return self._name - - def _defl(self): - return self._default - - -Signed = Primitive("Signed", 0) -Unsigned = Primitive("Unsigned", r_uint(0)) -Char = Primitive("Char", '\x00') -Bool = Primitive("Bool", False) -Void = Primitive("Void", None) - - -class _PtrType(LowLevelType): - def __init__(self, TO, **flags): - if not isinstance(TO, ContainerType): - raise TypeError, ("can only point to a Struct or an Array, " - "not to %s" % (TO,)) - self.TO = TO - self.flags = flags - - def _str_flags(self): - flags = self.flags.keys() - flags.sort() - result = [] - for flag in flags: - if self.flags[flag] is not True: - flag = '%s=%r' % (flag, self.flags[flag]) - result.append(flag) - return ', '.join(result) - - def __str__(self): - return 'ptr(%s) to %s' % (self._str_flags(), self.TO) - - def _defl(self): - return _ptr(self, None) - -def GcPtr(TO, **flags): - return _PtrType(TO, gc=True, **flags) - -def NonGcPtr(TO, **flags): - return _PtrType(TO, **flags) - - -# ____________________________________________________________ - - -def typeOf(val): - if isinstance(val, bool): - return Bool - if isinstance(val, r_uint): - return Unsigned - if isinstance(val, int): - return Signed - if isinstance(val, str): - assert len(val) == 1 - return Char - if val is None: - return Void # maybe - return val._TYPE - -class InvalidCast(TypeError): - pass - -def cast_flags(PTRTYPE, ptr): - if not isinstance(ptr, _ptr) or not isinstance(PTRTYPE, _PtrType): - raise TypeError, "can only cast pointers to other pointers" - CURTYPE = ptr._TYPE - if CURTYPE.TO != PTRTYPE.TO: - raise TypeError, "cast_flags only between pointers to the same type" - # allowed direct casts (for others, you need several casts): - # * adding one flag - curflags = CURTYPE.flags - newflags = PTRTYPE.flags - if len(curflags) + 1 == len(newflags): - for key in curflags: - if key not in newflags or curflags[key] != newflags[key]: - raise InvalidCast(CURTYPE, PTRTYPE) - # * removing one flag - elif len(curflags) - 1 == len(newflags): - for key in newflags: - if key not in curflags or curflags[key] != newflags[key]: - raise InvalidCast(CURTYPE, PTRTYPE) - # end - else: - raise InvalidCast(CURTYPE, PTRTYPE) - return _ptr(PTRTYPE, ptr._obj) - -def cast_parent(PTRTYPE, ptr): - if not isinstance(ptr, _ptr) or not isinstance(PTRTYPE, _PtrType): - raise TypeError, "can only cast pointers to other pointers" - CURTYPE = ptr._TYPE - if CURTYPE.flags != PTRTYPE.flags: - raise TypeError("cast_parent() cannot change the flags (%s) to (%s)" - % (CURTYPE._str_flags(), PTRTYPE._str_flags())) - # * converting from TO-structure to a parent TO-structure whose first - # field is the original structure - if (not isinstance(CURTYPE.TO, Struct) or - not isinstance(PTRTYPE.TO, Struct)): - raise InvalidCast(CURTYPE, PTRTYPE) - ptr._check() - parent = ptr._obj._wrparent() - PARENTTYPE = ptr._obj._wrparent_type - if getattr(parent, PARENTTYPE._names[0]) is not ptr._obj: - raise InvalidCast(CURTYPE, PTRTYPE) - return _ptr(PTRTYPE, parent) - - -def _TmpPtr(TO): - return _PtrType(TO, _tmp=True) - -def _expose(val, can_have_gc=False): - """XXX A nice docstring here""" - T = typeOf(val) - if isinstance(T, ContainerType): - if can_have_gc and isinstance(T, Struct): - val = _ptr(GcPtr(T), val) - else: - val = _ptr(_TmpPtr(T), val) - return val - - -class _ptr(object): - - def __init__(self, TYPE, pointing_to): - self.__dict__['_TYPE'] = TYPE - self.__dict__['_T'] = TYPE.TO - self.__dict__['_obj'] = pointing_to - - def __eq__(self, other): - if not isinstance(other, _ptr): - raise TypeError("comparing pointer with %r object" % ( - type(other).__name__,)) - if self._TYPE != other._TYPE: - raise TypeError("comparing %r and %r" % (self._TYPE, other._TYPE)) - return self._obj is other._obj - - def __ne__(self, other): - return not (self == other) - - def __nonzero__(self): - return self._obj is not None - - def _check(self): - if self._obj is None: - raise RuntimeError("dereferencing 'NULL' pointer to %r" % (self._T,)) - self._obj._check() - - def __getattr__(self, field_name): # ! can only return basic or ptr ! - if isinstance(self._T, Struct): - if field_name in self._T._flds: - self._check() - o = getattr(self._obj, field_name) - can_have_gc = (field_name == self._T._names[0] and - 'gc' in self._TYPE.flags) - return _expose(o, can_have_gc) - raise AttributeError("%r instance has no field %r" % (self._T, - field_name)) - - def __setattr__(self, field_name, val): - if isinstance(self._T, Struct): - if field_name in self._T._flds: - T1 = self._T._flds[field_name] - T2 = typeOf(val) - if T1 != T2: - raise TypeError("%r instance field %r:\n" - "expects %r\n" - " got %r" % (self._T, field_name, T1, T2)) - self._check() - setattr(self._obj, field_name, val) - return - raise AttributeError("%r instance has no field %r" % (self._T, - field_name)) - - def __getitem__(self, i): # ! can only return basic or ptr ! - if isinstance(self._T, Array): - self._check() - if not (0 <= i < len(self._obj.items)): - raise IndexError("array index out of bounds") - o = self._obj.items[i] - return _expose(o) - raise TypeError("%r instance is not an array" % (self._T,)) - - def __setitem__(self, i, val): # ! not allowed ! - if isinstance(self._T, Array): - raise TypeError("cannot directly assign to array items") - raise TypeError("%r instance is not an array" % (self._T,)) - - def __len__(self): - if isinstance(self._T, Array): - self._check() - return len(self._obj.items) - raise TypeError("%r instance is not an array" % (self._T,)) - - def __repr__(self): - return '<%s>' % (self,) - - def __str__(self): - return '%s to %s' % (self._TYPE.__class__.__name__.lower(), self._obj) - - -class _struct(object): - _wrparent = None - - def __init__(self, TYPE, n=None, parent=None): - self._TYPE = TYPE - if n is not None and TYPE._arrayfld is None: - raise TypeError("%r is not variable-sized" % (TYPE,)) - if n is None and TYPE._arrayfld is not None: - raise TypeError("%r is variable-sized" % (TYPE,)) - for fld, typ in TYPE._flds.items(): - if isinstance(typ, Struct): - value = _struct(typ, parent=self) - elif fld == TYPE._arrayfld: - value = _array(typ, n) - else: - value = typ._defl() - setattr(self, fld, value) - if parent is not None: - self._wrparent_type = typeOf(parent) - self._wrparent = weakref.ref(parent) - - def _check(self): - if self._wrparent is not None: - if self._wrparent() is None: - raise RuntimeError("accessing substructure %r,\n" - "but already garbage collected parent %r" - % (self, self._wrparent_type)) - - def __repr__(self): - return '<%s>' % (self,) - - def _str_fields(self): - fields = [] - for name in self._TYPE._names: - T = self._TYPE._flds[name] - if isinstance(T, Primitive): - reprvalue = repr(getattr(self, name)) - else: - reprvalue = '...' - fields.append('%s=%s' % (name, reprvalue)) - return ', '.join(fields) - - def __str__(self): - return 'struct %s { %s }' % (self._TYPE._name, self._str_fields()) - - -class _array(object): - _wrparent = None - - def __init__(self, TYPE, n, parent=None): - if not isinstance(n, int): - raise TypeError, "array length must be an int" - if n < 0: - raise ValueError, "negative array length" - self._TYPE = TYPE - self.items = [TYPE.OF._defl() for j in range(n)] - if parent is not None: - self._wrparent_type = typeOf(parent) - self._wrparent = weakref.ref(parent) - - def _check(self): - if self._wrparent is not None: - if self._wrparent() is None: - raise RuntimeError("accessing subarray %r,\n" - "but already garbage collected parent %r" - % (self, self._wrparent_type)) - - def __repr__(self): - return '<%s>' % (self,) - - def __str__(self): - return 'array [ %s ]' % (', '.join(['{%s}' % item._str_fields() - for item in self.items]),) - - -def malloc(T, n=None): - if isinstance(T, Struct): - o = _struct(T, n) - elif isinstance(T, Array): - o = _array(T, n) - else: - raise TypeError, "malloc for Structs and Arrays only" - return _ptr(GcPtr(T), o) +from pypy.rpython.lltypes import * +from pypy.rpython.lltypes import _TmpPtr -# ____________________________________________________________ - -def test_me(): +def test_basics(): S0 = Struct("s0", ('a', Signed), ('b', Signed)) assert S0.a == Signed assert S0.b == Signed From pedronis at codespeak.net Tue May 10 16:02:03 2005 From: pedronis at codespeak.net (pedronis at codespeak.net) Date: Tue, 10 May 2005 16:02:03 +0200 (CEST) Subject: [pypy-svn] r12157 - in pypy/dist/pypy/rpython: . test Message-ID: <20050510140203.CD2F727C00@code1.codespeak.net> Author: pedronis Date: Tue May 10 16:02:03 2005 New Revision: 12157 Modified: pypy/dist/pypy/rpython/lltypes.py pypy/dist/pypy/rpython/test/test_lltypes.py Log: added simple tests for best-effort gc detection for parents, fixed bug discovered by them Modified: pypy/dist/pypy/rpython/lltypes.py ============================================================================== --- pypy/dist/pypy/rpython/lltypes.py (original) +++ pypy/dist/pypy/rpython/lltypes.py Tue May 10 16:02:03 2005 @@ -299,7 +299,7 @@ if isinstance(typ, Struct): value = _struct(typ, parent=self) elif fld == TYPE._arrayfld: - value = _array(typ, n) + value = _array(typ, n, parent=self) else: value = typ._defl() setattr(self, fld, value) Modified: pypy/dist/pypy/rpython/test/test_lltypes.py ============================================================================== --- pypy/dist/pypy/rpython/test/test_lltypes.py (original) +++ pypy/dist/pypy/rpython/test/test_lltypes.py Tue May 10 16:02:03 2005 @@ -158,3 +158,18 @@ assert p3 == p1 py.test.raises(TypeError, "cast_parent(GcPtr(S1), p1.sub2)") py.test.raises(TypeError, "cast_parent(_TmpPtr(S1), p1.sub2)") + +def test_best_effort_gced_parent_detection(): + S2 = Struct("s2", ('a', Signed)) + S1 = Struct("s1", ('sub1', S2), ('sub2', S2), ('tail', Array(('e', Signed)))) + p1 = malloc(S1, 1) + p2 = p1.sub2 + assert p2.a == 0 + p3 = p1.tail + p3[0].e = 1 + assert p3[0].e == 1 + del p1 + import gc + gc.collect() + py.test.raises(RuntimeError, "p2.a") + py.test.raises(RuntimeError, "p3[0]") From pedronis at codespeak.net Tue May 10 16:20:26 2005 From: pedronis at codespeak.net (pedronis at codespeak.net) Date: Tue, 10 May 2005 16:20:26 +0200 (CEST) Subject: [pypy-svn] r12158 - in pypy/dist/pypy/rpython: . test Message-ID: <20050510142026.D417227C00@code1.codespeak.net> Author: pedronis Date: Tue May 10 16:20:26 2005 New Revision: 12158 Modified: pypy/dist/pypy/rpython/lltypes.py pypy/dist/pypy/rpython/test/test_lltypes.py Log: recursive checking for parents too, doh check for array el structures with tests Modified: pypy/dist/pypy/rpython/lltypes.py ============================================================================== --- pypy/dist/pypy/rpython/lltypes.py (original) +++ pypy/dist/pypy/rpython/lltypes.py Tue May 10 16:20:26 2005 @@ -20,7 +20,7 @@ def __str__(self): return self.__class__.__name__ - def _defl(self): + def _defl(self, parent=None): raise NotImplementedError @@ -65,8 +65,8 @@ def __str__(self): return "Struct %s { %s }" % (self._name, self._str_fields()) - def _defl(self): - return _struct(self) + def _defl(self, parent=None): + return _struct(self, parent=parent) class Array(ContainerType): @@ -87,7 +87,7 @@ def __str__(self): return self._name - def _defl(self): + def _defl(self, parent=None): return self._default @@ -119,7 +119,7 @@ def __str__(self): return 'ptr(%s) to %s' % (self._str_flags(), self.TO) - def _defl(self): + def _defl(self, parent=None): return _ptr(self, None) def GcPtr(TO, **flags): @@ -309,10 +309,13 @@ def _check(self): if self._wrparent is not None: - if self._wrparent() is None: + parent = self._wrparent() + if parent is None: raise RuntimeError("accessing substructure %r,\n" "but already garbage collected parent %r" % (self, self._wrparent_type)) + else: + parent._check() def __repr__(self): return '<%s>' % (self,) @@ -341,17 +344,20 @@ if n < 0: raise ValueError, "negative array length" self._TYPE = TYPE - self.items = [TYPE.OF._defl() for j in range(n)] + self.items = [TYPE.OF._defl(parent=self) for j in range(n)] if parent is not None: self._wrparent_type = typeOf(parent) self._wrparent = weakref.ref(parent) def _check(self): if self._wrparent is not None: - if self._wrparent() is None: + parent = self._wrparent() + if parent is None: raise RuntimeError("accessing subarray %r,\n" "but already garbage collected parent %r" % (self, self._wrparent_type)) + else: + parent._check() def __repr__(self): return '<%s>' % (self,) Modified: pypy/dist/pypy/rpython/test/test_lltypes.py ============================================================================== --- pypy/dist/pypy/rpython/test/test_lltypes.py (original) +++ pypy/dist/pypy/rpython/test/test_lltypes.py Tue May 10 16:20:26 2005 @@ -173,3 +173,17 @@ gc.collect() py.test.raises(RuntimeError, "p2.a") py.test.raises(RuntimeError, "p3[0]") + +def test_best_effort_gced_parent_for_arrays(): + A1 = Array(('v', Signed)) + p1 = malloc(A1, 10) + p1[5].v=3 + assert p1[0].v == 0 + assert p1[9].v == 0 + assert p1[5].v == 3 + p1_5 = p1[5] + del p1 + import gc + gc.collect() + py.test.raises(RuntimeError, "p1_5.v") + From pedronis at codespeak.net Wed May 11 00:05:15 2005 From: pedronis at codespeak.net (pedronis at codespeak.net) Date: Wed, 11 May 2005 00:05:15 +0200 (CEST) Subject: [pypy-svn] r12169 - in pypy/dist/pypy: annotation rpython rpython/test Message-ID: <20050510220515.A8C2A27C08@code1.codespeak.net> Author: pedronis Date: Wed May 11 00:05:15 2005 New Revision: 12169 Added: pypy/dist/pypy/rpython/test/test_llann.py (contents, props changed) Modified: pypy/dist/pypy/annotation/binaryop.py pypy/dist/pypy/annotation/builtin.py pypy/dist/pypy/annotation/model.py pypy/dist/pypy/annotation/unaryop.py pypy/dist/pypy/rpython/lltypes.py pypy/dist/pypy/rpython/test/test_lltypes.py Log: start of support for annotating low-level types, with some initial tests TODO: casts, getitem, getattr on pointers Modified: pypy/dist/pypy/annotation/binaryop.py ============================================================================== --- pypy/dist/pypy/annotation/binaryop.py (original) +++ pypy/dist/pypy/annotation/binaryop.py Wed May 11 00:05:15 2005 @@ -451,3 +451,23 @@ class __extend__(pairtype(SomePBC, SomeString )): def union((pbc, s)): return pair(s, pbc).union() + +# annotation of low-level types +from pypy.rpython import lltypes +from pypy.annotation.model import SomePtr + +class __extend__(SomePtr, SomePtr): + def union((p1, p2)): + assert p1.ll_ptrtype == p2.ll_prttype,("mixing of incompatible pointer types: %r, %r" % + (p1.ll_prttype, p2.ll_prttype)) + return SomePtr(p1.ll_ptrtype) + +class __extend__(SomePtr, SomeObject): + def union((p1, obj)): + assert False, ("mixing pointer type %r with something else %r" % (p1.ll_ptrtype, obj)) + +class __extend__(SomeObject, SomePtr): + def union((obj, p2)): + return pair(p2, obj).union() + + Modified: pypy/dist/pypy/annotation/builtin.py ============================================================================== --- pypy/dist/pypy/annotation/builtin.py (original) +++ pypy/dist/pypy/annotation/builtin.py Wed May 11 00:05:15 2005 @@ -231,3 +231,21 @@ # time stuff BUILTIN_ANALYZERS[time.time] = time_func BUILTIN_ANALYZERS[time.clock] = time_func + + +# annotation of low-level types +from pypy.annotation.model import SomePtr +from pypy.rpython import lltypes + +def malloc(T, n=None): + assert n is None or n.knowntype == int + assert T.is_constant() + if n is not None: + n = 1 + p = lltypes.malloc(T.const, n) + r = SomePtr(lltypes.typeOf(p)) + print r + return r + +BUILTIN_ANALYZERS[lltypes.malloc] = malloc + Modified: pypy/dist/pypy/annotation/model.py ============================================================================== --- pypy/dist/pypy/annotation/model.py (original) +++ pypy/dist/pypy/annotation/model.py Wed May 11 00:05:15 2005 @@ -267,6 +267,14 @@ """The empty set. Instances are placeholders for objects that will never show up at run-time, e.g. elements of an empty list.""" +#____________________________________________________________ +# annotation of low-level types + +class SomePtr(SomeObject): + def __init__(self, ll_ptrtype): + self.ll_ptrtype = ll_ptrtype + +# ____________________________________________________________ def unionof(*somevalues): "The most precise SomeValue instance that contains all the values." Modified: pypy/dist/pypy/annotation/unaryop.py ============================================================================== --- pypy/dist/pypy/annotation/unaryop.py (original) +++ pypy/dist/pypy/annotation/unaryop.py Wed May 11 00:05:15 2005 @@ -409,3 +409,32 @@ class CallPatternTooComplex(Exception): pass + +# annotation of low-level types +from pypy.rpython import lltypes +from pypy.annotation.model import SomePtr + +ll_to_annotation_map = { + lltypes.Signed: SomeInteger(), + lltypes.Unsigned: SomeInteger(nonneg=True, unsigned=True), + lltypes.Char: SomeChar(), + lltypes.Bool: SomeBool(), +} + +def ll_to_annotation(v): + if v is None: + assert False, "cannot retrieve Void low-level type value" + typ = lltypes.typeOf(v) + s = ll_to_annotation_map.get(typ) + if s is None: + return SomePtr(typ) + else: + return s + +class __extend__(SomePtr): + + def getattr(p, s_attr): + assert s_attr.is_constant(), "getattr on ptr %r with non-constant field-name" % p.ll_ptrtype + v = getattr(p.ll_ptrtype._example(), s_attr.const) + return ll_to_annotation(v) + Modified: pypy/dist/pypy/rpython/lltypes.py ============================================================================== --- pypy/dist/pypy/rpython/lltypes.py (original) +++ pypy/dist/pypy/rpython/lltypes.py Wed May 11 00:05:15 2005 @@ -2,6 +2,13 @@ import py from pypy.rpython.rarithmetic import r_uint +class frozendict(dict): + + def __hash__(self): + items = self.items() + items.sort() + return hash(tuple(items)) + class LowLevelType(object): def __eq__(self, other): @@ -23,6 +30,9 @@ def _defl(self, parent=None): raise NotImplementedError + def _freeze_(self): + return True + class ContainerType(LowLevelType): pass @@ -31,8 +41,8 @@ class Struct(ContainerType): def __init__(self, name, *fields): self._name = name - self._flds = flds = {} - self._names = names = [] + flds = {} + names = [] self._arrayfld = None for name, typ in fields: if name.startswith('_'): @@ -50,6 +60,8 @@ name, typ = fields[-1] if isinstance(typ, Array): self._arrayfld = name + self._flds = frozendict(flds) + self._names = tuple(names) def __getattr__(self, name): try: @@ -68,6 +80,12 @@ def _defl(self, parent=None): return _struct(self, parent=parent) + def _example(self): + if self._arrayfld is None: + n = None + else: + n = 1 + return _struct(self, n) class Array(ContainerType): def __init__(self, *fields): @@ -78,6 +96,9 @@ def __str__(self): return "Array of { %s }" % (self.OF._str_fields(),) + def _example(self): + return _array(self, 1) + class Primitive(LowLevelType): def __init__(self, name, default): @@ -104,7 +125,7 @@ raise TypeError, ("can only point to a Struct or an Array, " "not to %s" % (TO,)) self.TO = TO - self.flags = flags + self.flags = frozendict(flags) def _str_flags(self): flags = self.flags.keys() @@ -122,6 +143,11 @@ def _defl(self, parent=None): return _ptr(self, None) + def _example(self): + o = self.TO._example() + return _ptr(self, o) + + def GcPtr(TO, **flags): return _PtrType(TO, gc=True, **flags) Added: pypy/dist/pypy/rpython/test/test_llann.py ============================================================================== --- (empty file) +++ pypy/dist/pypy/rpython/test/test_llann.py Wed May 11 00:05:15 2005 @@ -0,0 +1,27 @@ +from pypy.rpython.lltypes import * +from pypy.translator import annrpython + + +class TestAnnonateTestCase: + objspacename = 'flow' + + from pypy.translator.annrpython import RPythonAnnotator + + def test_simple(self): + S = Struct("s", ('v', Signed)) + def llf(): + s = malloc(S) + return s.v + a = self.RPythonAnnotator() + s = a.build_types(llf, []) + assert s.knowntype == int + + def test_simple2(self): + S = Struct("s", ('v', Signed)) + S2 = Struct("s2", ('a',S), ('b',S)) + def llf(): + s = malloc(S2) + return s.a.v+s.b.v + a = self.RPythonAnnotator() + s = a.build_types(llf, []) + assert s.knowntype == int Modified: pypy/dist/pypy/rpython/test/test_lltypes.py ============================================================================== --- pypy/dist/pypy/rpython/test/test_lltypes.py (original) +++ pypy/dist/pypy/rpython/test/test_lltypes.py Wed May 11 00:05:15 2005 @@ -187,3 +187,24 @@ gc.collect() py.test.raises(RuntimeError, "p1_5.v") +def test_examples(): + A1 = Array(('v', Signed)) + S = Struct("s", ('v', Signed)) + St = Struct("st", ('v', Signed),('trail', A1)) + + PA1 = GcPtr(A1) + PS = GcPtr(S) + PSt = GcPtr(St) + + ex_pa1 = PA1._example() + ex_ps = PS._example() + ex_pst = PSt._example() + + assert typeOf(ex_pa1) == PA1 + assert typeOf(ex_ps) == PS + assert typeOf(ex_pst) == PSt + + assert ex_pa1[0].v == 0 + assert ex_ps.v == 0 + assert ex_pst.v == 0 + assert ex_pst.trail[0].v == 0 From arigo at codespeak.net Wed May 11 12:43:51 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Wed, 11 May 2005 12:43:51 +0200 (CEST) Subject: [pypy-svn] r12171 - pypy/dist/pypy/translator Message-ID: <20050511104351.66A9B27C14@code1.codespeak.net> Author: arigo Date: Wed May 11 12:43:51 2005 New Revision: 12171 Modified: pypy/dist/pypy/translator/translator.py Log: Freeze the translator when generating C code from annotated graphs. If we don't, confusion ensures. Modified: pypy/dist/pypy/translator/translator.py ============================================================================== --- pypy/dist/pypy/translator/translator.py (original) +++ pypy/dist/pypy/translator/translator.py Wed May 11 12:43:51 2005 @@ -243,6 +243,8 @@ """Returns compiled function, compiled using the C generator. """ from pypy.tool.udir import udir + if self.annotator is not None: + self.frozen = True name = uniquemodulename(self.entrypoint.func_name) cfile = udir.join('%s.c' % name) f = cfile.open('w') From arigo at codespeak.net Wed May 11 12:45:14 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Wed, 11 May 2005 12:45:14 +0200 (CEST) Subject: [pypy-svn] r12172 - in pypy/dist/pypy: documentation documentation/revreport lib lib/test2 module/parser module/parser/test module/recparser module/test/impsubdir/pkg/pkg2 objspace objspace/std/test tool/pytest tool/pytest/test translator/genc translator/llvm translator/llvm/test translator/test Message-ID: <20050511104514.8016527C14@code1.codespeak.net> Author: arigo Date: Wed May 11 12:45:14 2005 New Revision: 12172 Modified: pypy/dist/pypy/documentation/conftest.py (props changed) pypy/dist/pypy/documentation/misc.txt (props changed) pypy/dist/pypy/documentation/revreport/revreport.py (props changed) pypy/dist/pypy/documentation/test_redirections.py (props changed) pypy/dist/pypy/lib/__init__.py (props changed) pypy/dist/pypy/lib/inprogress__codecs.py (props changed) pypy/dist/pypy/lib/inprogress_binascii.py (props changed) pypy/dist/pypy/lib/test2/test_binascii_extra.py (props changed) pypy/dist/pypy/lib/test2/test_exception_extra.py (props changed) pypy/dist/pypy/module/parser/ (props changed) pypy/dist/pypy/module/parser/app_class.py (props changed) pypy/dist/pypy/module/parser/test/ (props changed) pypy/dist/pypy/module/parser/test/__init__.py (props changed) pypy/dist/pypy/module/parser/test/test_parser.py (props changed) pypy/dist/pypy/module/recparser/pyparser.py (props changed) pypy/dist/pypy/module/test/impsubdir/pkg/pkg2/ (props changed) pypy/dist/pypy/objspace/std/test/test_longobject.py (props changed) pypy/dist/pypy/objspace/thunk.py (props changed) pypy/dist/pypy/tool/pytest/confpath.py (props changed) pypy/dist/pypy/tool/pytest/overview.py (props changed) pypy/dist/pypy/tool/pytest/regrverbose.py (props changed) pypy/dist/pypy/tool/pytest/test/test_overview.py (props changed) pypy/dist/pypy/translator/genc/__init__.py (props changed) pypy/dist/pypy/translator/genc/inttype.py (props changed) pypy/dist/pypy/translator/genc/nonetype.py (props changed) pypy/dist/pypy/translator/llvm/lazyattribute.py (props changed) pypy/dist/pypy/translator/llvm/memorylayout.py (props changed) pypy/dist/pypy/translator/llvm/pbcrepr.py (props changed) pypy/dist/pypy/translator/llvm/test/test_class.py (props changed) pypy/dist/pypy/translator/llvm/test/test_lazyattribute.py (props changed) pypy/dist/pypy/translator/llvm/test/test_seq.py (props changed) pypy/dist/pypy/translator/llvm/test/test_snippet.py (props changed) pypy/dist/pypy/translator/test/test_annsimplifyrpython.py (props changed) Log: fixeol. (This hasn't been done at the 'pypy' level for quite some time...) From arigo at codespeak.net Wed May 11 16:03:30 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Wed, 11 May 2005 16:03:30 +0200 (CEST) Subject: [pypy-svn] r12176 - pypy/dist/pypy/translator Message-ID: <20050511140330.C4E7727C19@code1.codespeak.net> Author: arigo Date: Wed May 11 16:03:30 2005 New Revision: 12176 Modified: pypy/dist/pypy/translator/typer.py Log: Wrong condition when checking if we need to build a new SpaceOperation or if we can reuse the existing one: the arguments may differ only in a Constant which has grown a concretetype attribute. Modified: pypy/dist/pypy/translator/typer.py ============================================================================== --- pypy/dist/pypy/translator/typer.py (original) +++ pypy/dist/pypy/translator/typer.py Wed May 11 16:03:30 2005 @@ -132,8 +132,7 @@ self.settype(op.result, restype) # store the possibly modified SpaceOperation - if newopname is not None or args != op.args: - op = SpaceOperation(newopname or op.opname, args, op.result) + op = SpaceOperation(newopname or op.opname, args, op.result) result.append(op) return result From tismer at codespeak.net Wed May 11 16:09:34 2005 From: tismer at codespeak.net (tismer at codespeak.net) Date: Wed, 11 May 2005 16:09:34 +0200 (CEST) Subject: [pypy-svn] r12177 - pypy/dist/pypy/translator Message-ID: <20050511140934.15D9A27C19@code1.codespeak.net> Author: tismer Date: Wed May 11 16:09:33 2005 New Revision: 12177 Modified: pypy/dist/pypy/translator/geninterplevel.py Log: avoid global side-effects: all_passes must be copied before modification Modified: pypy/dist/pypy/translator/geninterplevel.py ============================================================================== --- pypy/dist/pypy/translator/geninterplevel.py (original) +++ pypy/dist/pypy/translator/geninterplevel.py Wed May 11 16:09:33 2005 @@ -43,6 +43,7 @@ # list of simplifcation passes needed by geninterp from pypy.translator.simplify import transform_ovfcheck, all_passes as needed_passes +needed_passes = needed_passes[:] needed_passes.remove(transform_ovfcheck) From tismer at codespeak.net Wed May 11 16:11:10 2005 From: tismer at codespeak.net (tismer at codespeak.net) Date: Wed, 11 May 2005 16:11:10 +0200 (CEST) Subject: [pypy-svn] r12178 - pypy/dist/pypy/rpython Message-ID: <20050511141110.93A3F27C19@code1.codespeak.net> Author: tismer Date: Wed May 11 16:11:10 2005 New Revision: 12178 Modified: pypy/dist/pypy/rpython/rarithmetic.py Log: made a local copy of ovfcheck, to be called by ovfcheck_lshift. Reason: I case that we don't annotate, this function call would become a syntax error in transform_ovfcheck Modified: pypy/dist/pypy/rpython/rarithmetic.py ============================================================================== --- pypy/dist/pypy/rpython/rarithmetic.py (original) +++ pypy/dist/pypy/rpython/rarithmetic.py Wed May 11 16:11:10 2005 @@ -177,8 +177,16 @@ raise OverflowError, "signed integer expression did overflow" return r +def _local_ovfcheck(r): + # a copy of the above, because we cannot call ovfcheck + # in a context where no primitiveoperator is involved. + assert not isinstance(r, r_uint), "unexpected ovf check on unsigned" + if isinstance(r, long): + raise OverflowError, "signed integer expression did overflow" + return r + def ovfcheck_lshift(a, b): - return ovfcheck(int(long(a) << b)) + return _local_ovfcheck(int(long(a) << b)) class r_uint(long): """ fake unsigned integer implementation """ From arigo at codespeak.net Wed May 11 16:14:03 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Wed, 11 May 2005 16:14:03 +0200 (CEST) Subject: [pypy-svn] r12179 - pypy/dist/pypy/rpython/test Message-ID: <20050511141403.A599D27C19@code1.codespeak.net> Author: arigo Date: Wed May 11 16:14:03 2005 New Revision: 12179 Modified: pypy/dist/pypy/rpython/test/test_llann.py Log: Give the test class an appropriate name. Modified: pypy/dist/pypy/rpython/test/test_llann.py ============================================================================== --- pypy/dist/pypy/rpython/test/test_llann.py (original) +++ pypy/dist/pypy/rpython/test/test_llann.py Wed May 11 16:14:03 2005 @@ -1,8 +1,7 @@ from pypy.rpython.lltypes import * -from pypy.translator import annrpython -class TestAnnonateTestCase: +class TestLowLevelAnnonateTestCase: objspacename = 'flow' from pypy.translator.annrpython import RPythonAnnotator From arigo at codespeak.net Wed May 11 16:16:08 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Wed, 11 May 2005 16:16:08 +0200 (CEST) Subject: [pypy-svn] r12180 - in pypy/dist/pypy/translator/genc: . test Message-ID: <20050511141608.B9CCB27C1B@code1.codespeak.net> Author: arigo Date: Wed May 11 16:16:08 2005 New Revision: 12180 Added: pypy/dist/pypy/translator/genc/ll_include.h (contents, props changed) pypy/dist/pypy/translator/genc/lltype.py (contents, props changed) pypy/dist/pypy/translator/genc/test/test_lltyped.py (contents, props changed) Modified: pypy/dist/pypy/translator/genc/ctyper.py pypy/dist/pypy/translator/genc/g_include.h pypy/dist/pypy/translator/genc/genc.py pypy/dist/pypy/translator/genc/inttype.py Log: Hackish draft of support of the LowLevelTypes in GenC. Very partial and without memory management. It is also very much indirect because it plugs in the existing CTyper, which was meant to support a much more indirect, C-template-based approach than actually needed now. Modified: pypy/dist/pypy/translator/genc/ctyper.py ============================================================================== --- pypy/dist/pypy/translator/genc/ctyper.py (original) +++ pypy/dist/pypy/translator/genc/ctyper.py Wed May 11 16:16:08 2005 @@ -6,6 +6,7 @@ from pypy.translator.typer import Specializer from pypy.objspace.flow.model import Constant, Variable, SpaceOperation from pypy.annotation.model import SomeInteger, SomePBC, SomeTuple, SomeList +from pypy.annotation.model import SomePtr from pypy.translator.genc.pyobjtype import CPyObjectType from pypy.translator.genc.inttype import CIntType from pypy.translator.genc.nonetype import CNoneType @@ -14,6 +15,8 @@ from pypy.translator.genc.listtype import CListType from pypy.translator.genc.classtype import CClassPtrType from pypy.translator.genc.instancetype import CInstanceType +from pypy.translator.genc.lltype import CPtrType, CLiteralTypeName +from pypy.rpython import lltypes import types from pypy.interpreter.pycode import CO_VARARGS @@ -110,12 +113,28 @@ # besttype = self.annotator.translator.getconcretetype( # CListType, item_ct) + elif isinstance(s_value, SomePtr): + besttype = self.annotator.translator.getconcretetype( + CPtrType, s_value.ll_ptrtype) + return besttype def specialized_op(self, op, bindings): if op.opname in ('newtuple', 'newlist'): # operations that are controlled by their return type s_binding = self.annotator.binding(op.result, True) + elif op.opname == 'simple_call' and isinstance(op.args[0], Constant): + # XXX move me elsewhere + func = op.args[0].value + if func is lltypes.malloc: + assert len(op.args) == 2 # for now + s_result = self.annotator.binding(op.result) + ct = self.annotator.translator.getconcretetype(CLiteralTypeName) + return [ + self.typed_op(SpaceOperation('malloc', [op.args[1]], + op.result), + [ct], self.annotation2concretetype(s_result)) + ] elif bindings: # operations are by default controlled by their 1st arg s_binding = bindings[0] Modified: pypy/dist/pypy/translator/genc/g_include.h ============================================================================== --- pypy/dist/pypy/translator/genc/g_include.h (original) +++ pypy/dist/pypy/translator/genc/g_include.h Wed May 11 16:16:08 2005 @@ -20,3 +20,4 @@ #include "none_include.h" #include "pyobj_include.h" #include "tuple_include.h" +#include "ll_include.h" Modified: pypy/dist/pypy/translator/genc/genc.py ============================================================================== --- pypy/dist/pypy/translator/genc/genc.py (original) +++ pypy/dist/pypy/translator/genc/genc.py Wed May 11 16:16:08 2005 @@ -125,14 +125,20 @@ # the footer proper: the module init function */ print >> f, self.C_FOOTER % info + def need_typedecl_now(self, ct): + if ct not in self.ctypes_alreadyseen: + self.ctypes_alreadyseen[ct] = True + return ct.init_globals(self) + else: + return [] + def gen_global_declarations(self): # collect more of the latercode between the functions, # and produce the corresponding global declarations insert_first = [] for ct in self.translator.ctlist: if ct not in self.ctypes_alreadyseen: - insert_first += list(ct.init_globals(self)) - self.ctypes_alreadyseen[ct] = True + insert_first += list(self.need_typedecl_now(ct)) self.globaldecl[:0] = insert_first for ct in self.translator.ctlist: self.globaldecl += list(ct.collect_globals(self)) Modified: pypy/dist/pypy/translator/genc/inttype.py ============================================================================== --- pypy/dist/pypy/translator/genc/inttype.py (original) +++ pypy/dist/pypy/translator/genc/inttype.py Wed May 11 16:16:08 2005 @@ -10,3 +10,13 @@ def nameof(self, v, debug=None): return '%d' % (v,) + + +class CUnsignedType(CType): + typename = 'unsigned' + error_return = '-1' + s_annotation = SomeInteger(nonneg=True, unsigned=True) + + def nameof(self, v, debug=None): + assert v >= 0 + return '%d' % (v,) Added: pypy/dist/pypy/translator/genc/ll_include.h ============================================================================== --- (empty file) +++ pypy/dist/pypy/translator/genc/ll_include.h Wed May 11 16:16:08 2005 @@ -0,0 +1,15 @@ + +/************************************************************/ + /*** C header subsection: operations on LowLevelTypes ***/ + + +/* XXX no reference counting */ + +#define OP_MALLOC(typename, r, err) \ + r = PyObject_Malloc(sizeof(typename)); \ + if (r == NULL) { PyErr_NoMemory(); FAIL(err) } \ + memset((void*) r, 0, sizeof(typename)); + +#define OP_GETFIELD(x, fieldname, r, err) r = x->fieldname; +#define OP_SETFIELD(x, fieldname, val, r, err) x->fieldname = val; +#define OP_GETSUBSTRUCT(x, fieldname, r, err) r = &x->fieldname; Added: pypy/dist/pypy/translator/genc/lltype.py ============================================================================== --- (empty file) +++ pypy/dist/pypy/translator/genc/lltype.py Wed May 11 16:16:08 2005 @@ -0,0 +1,150 @@ +from __future__ import generators +from pypy.translator.genc.basetype import CType +from pypy.translator.gensupp import C_IDENTIFIER +from pypy.objspace.flow.model import SpaceOperation, Constant, Variable +from pypy.rpython import lltypes + + +class CLiteral(CType): # HACK! TEMPORARY + def nameof(self, obj, debug=None): + assert isinstance(obj, str) + return obj + +class CLiteralTypeName(CType): # HACK! TEMPORARY + def nameof(self, obj, debug=None): + assert isinstance(obj, lltypes.LowLevelType) + ct = ll2concretetype(self.translator, obj) + return ct.typename + + +class CLLType(CType): + + def __init__(self, translator, lltype): + super(CLLType, self).__init__(translator) + self.lltype = lltype +## self.globaldecl = [] + + def debugname(self): + # a nice textual name for debugging... + return str(self.lltype) + +## def collect_globals(self, genc): +## result = self.globaldecl +## self.globaldecl = [] +## return result + + +class CPtrType(CLLType): + error_return = 'NULL' + Counter = 0 + + def __init__(self, translator, lltype): + super(CPtrType, self).__init__(translator, lltype) + ct = ll2concretetype(translator, lltype.TO) + self.typename = 'ptr%d_%s' % (CPtrType.Counter, + ct.typename.translate(C_IDENTIFIER)) + CPtrType.Counter += 1 + + def init_globals(self, genc): + ct = ll2concretetype(genc.translator, self.lltype.TO) + yield 'typedef %s* %s;' % (ct.typename, self.typename) + yield '#define OP_DECREF_%s(x) /* XXX nothing for now */' % ( + self.typename) + + def spec_getattr(self, typer, op): + v_ptr, v_attrname = op.args + assert isinstance(v_attrname, Constant) + attrname = v_attrname.value + attrtype = self.lltype.TO._flds[attrname] + cliteral = typer.annotator.translator.getconcretetype(CLiteral) + s_result = typer.annotator.binding(op.result) + ctresult = typer.annotation2concretetype(s_result) + if isinstance(attrtype, lltypes.ContainerType): + yield typer.typed_op(op, [self, cliteral], ctresult, + newopname='getsubstruct') + else: + yield typer.typed_op(op, [self, cliteral], ctresult, + newopname='getfield') + + def spec_setattr(self, typer, op): + v_ptr, v_attrname, v_value = op.args + assert isinstance(v_attrname, Constant) + attrname = v_attrname.value + attrtype = self.lltype.TO._flds[attrname] + cliteral = typer.annotator.translator.getconcretetype(CLiteral) + if isinstance(attrtype, lltypes.ContainerType): + raise AssertionError("cannot setattr to a substructure") + ctinput = ll2concretetype(typer.annotator.translator, attrtype) + yield typer.typed_op(op, [self, cliteral, ctinput], typer.TNone, + newopname='setfield') + + +class CStructType(CLLType): + Counter = 0 + + def __init__(self, translator, lltype): + super(CStructType, self).__init__(translator, lltype) + basename = lltype._name.translate(C_IDENTIFIER) + self.typename = 'struct ll_%s%d' % (basename, CStructType.Counter) + CStructType.Counter += 1 + + def init_globals(self, genc): + # make sure that the field types are defined before we use them + lines = ['%s {' % self.typename] + for fieldname in self.lltype._names: + T = self.lltype._flds[fieldname] + ct = ll2concretetype(genc.translator, T) + for line in genc.need_typedecl_now(ct): + yield line + lines.append('\t%s %s;' % (ct.typename, fieldname)) + lines.append('};') + for line in lines: + yield line + + +class CArrayType(CLLType): + Counter = 0 + + def __init__(self, translator, lltype): + super(CArrayType, self).__init__(translator, lltype) + self.typename = 'struct array%d ' % CArrayType.Counter + CArrayType.Counter += 1 + + def init_globals(self, genc): + # define first the struct containing one item of this array + ct = ll2concretetype(genc.translator, self.lltype.OF) + for line in genc.need_typedecl_now(ct): + yield line + # the array struct itself + yield '%s {' % self.typename + yield '\tlong size;' + yield '\t%s items[1]; /* variable-sized */' % ct.typename + yield '};' + + +# ____________________________________________________________ + +from pypy.translator.genc import inttype, nonetype + +primitivetypemap = { + lltypes.Signed: inttype.CIntType, + lltypes.Unsigned: inttype.CUnsignedType, + #lltypes.Char: ... + lltypes.Bool: inttype.CIntType, + lltypes.Void: nonetype.CNoneType, + } + +def get_primitive_type(translator, lltype): + cls = primitivetypemap[lltype] + return translator.getconcretetype(cls) + +ll2concretetypemap = { + lltypes.Struct: CStructType, + lltypes.Array: CArrayType, + lltypes._PtrType: CPtrType, + lltypes.Primitive: get_primitive_type, + } + +def ll2concretetype(translator, lltype): + cls = ll2concretetypemap[lltype.__class__] + return translator.getconcretetype(cls, lltype) Added: pypy/dist/pypy/translator/genc/test/test_lltyped.py ============================================================================== --- (empty file) +++ pypy/dist/pypy/translator/genc/test/test_lltyped.py Wed May 11 16:16:08 2005 @@ -0,0 +1,37 @@ +from pypy.rpython.lltypes import * +from pypy.translator.tool.buildpyxmodule import skip_missing_compiler +from pypy.translator.translator import Translator +from pypy.translator.genc.ctyper import GenCSpecializer + + +class TestLowLevelType: + objspacename = 'flow' + + def getcompiled(self, func, argstypelist=[]): + t = Translator(func, simplifying=True) + # builds starting-types from func_defs + a = t.annotate(argstypelist) + a.simplify() + GenCSpecializer(a).specialize() + t.checkgraphs() + t.view() + return skip_missing_compiler(t.ccompile) + + def test_simple(self): + S = Struct("s", ('v', Signed)) + def llf(): + s = malloc(S) + return s.v + fn = self.getcompiled(llf) + assert fn() == 0 + + def test_simple2(self): + S = Struct("s", ('v', Signed)) + S2 = Struct("s2", ('a',S), ('b',S)) + def llf(): + s = malloc(S2) + s.a.v = 6 + s.b.v = 12 + return s.a.v+s.b.v + fn = self.getcompiled(llf) + assert fn() == 18 From tismer at codespeak.net Wed May 11 16:17:02 2005 From: tismer at codespeak.net (tismer at codespeak.net) Date: Wed, 11 May 2005 16:17:02 +0200 (CEST) Subject: [pypy-svn] r12181 - pypy/dist/pypy/translator Message-ID: <20050511141702.CA7F427C1B@code1.codespeak.net> Author: tismer Date: Wed May 11 16:17:02 2005 New Revision: 12181 Modified: pypy/dist/pypy/translator/simplify.py Log: slightly better error messages Modified: pypy/dist/pypy/translator/simplify.py ============================================================================== --- pypy/dist/pypy/translator/simplify.py (original) +++ pypy/dist/pypy/translator/simplify.py Wed May 11 16:17:02 2005 @@ -121,14 +121,12 @@ res = ovfblock.operations[-2].result opname = ovfblock.operations[-2].opname if rename(arg) != rename(res) or ovfblock in seen_ovfblocks: - import __main__ - __main__.problem = graph - raise SyntaxError("ovfcheck: The checked operation %s is misplaced" - " - see __main__.problem.view()" % opname) + raise SyntaxError("ovfcheck in %s: The checked operation %s" + " is misplaced" % (graph.name, opname)) exlis = implicit_exceptions.get("%s_%s" % (opname, appendix), []) if OverflowError not in exlis: - raise SyntaxError("ovfcheck: Operation %s has no overflow variant" - " - see __main__.problem.view()" % opname) + raise SyntaxError("ovfcheck in %s: Operation %s has no" + " overflow variant" % (graph.name, opname)) blocks_to_join = False for block in blocks: @@ -165,8 +163,7 @@ """The exception handling caused by non-implicit exceptions starts with an exitswitch on Exception, followed by a lengthy chain of is_/issubtype tests. We collapse them all into - the block's single list of exits and also remove unreachable - cases. + the block's single list of exits. """ clastexc = Constant(last_exception) renaming = {} From tismer at codespeak.net Wed May 11 16:38:36 2005 From: tismer at codespeak.net (tismer at codespeak.net) Date: Wed, 11 May 2005 16:38:36 +0200 (CEST) Subject: [pypy-svn] r12189 - in pypy/dist/pypy: rpython/test translator/test Message-ID: <20050511143836.48C4227C19@code1.codespeak.net> Author: tismer Date: Wed May 11 16:38:36 2005 New Revision: 12189 Modified: pypy/dist/pypy/rpython/test/test_llann.py pypy/dist/pypy/translator/test/test_annrpython.py pypy/dist/pypy/translator/test/test_annsimplifyrpython.py Log: make the test class names more appropriate :-) Modified: pypy/dist/pypy/rpython/test/test_llann.py ============================================================================== --- pypy/dist/pypy/rpython/test/test_llann.py (original) +++ pypy/dist/pypy/rpython/test/test_llann.py Wed May 11 16:38:36 2005 @@ -1,7 +1,7 @@ from pypy.rpython.lltypes import * -class TestLowLevelAnnonateTestCase: +class TestLowLevelAnnotateTestCase: objspacename = 'flow' from pypy.translator.annrpython import RPythonAnnotator Modified: pypy/dist/pypy/translator/test/test_annrpython.py ============================================================================== --- pypy/dist/pypy/translator/test/test_annrpython.py (original) +++ pypy/dist/pypy/translator/test/test_annrpython.py Wed May 11 16:38:36 2005 @@ -31,7 +31,7 @@ return annmodel.SomeDict(DictDef(None, s_key, s_value)) -class TestAnnonateTestCase: +class TestAnnotateTestCase: objspacename = 'flow' from pypy.translator.annrpython import RPythonAnnotator Modified: pypy/dist/pypy/translator/test/test_annsimplifyrpython.py ============================================================================== --- pypy/dist/pypy/translator/test/test_annsimplifyrpython.py (original) +++ pypy/dist/pypy/translator/test/test_annsimplifyrpython.py Wed May 11 16:38:36 2005 @@ -1,9 +1,9 @@ import autopath import pypy.translator.test.test_annrpython -parent = pypy.translator.test.test_annrpython.TestAnnonateTestCase +parent = pypy.translator.test.test_annrpython.TestAnnotateTestCase -class TestAnnonateAndSimplifyTestCase(parent): +class TestAnnotateAndSimplifyTestCase(parent): """Same tests as test_annrpython.TestAnnotateTestCase, but automatically running the simplify() method of the annotator after the annotation phase. """ From tismer at codespeak.net Wed May 11 16:48:46 2005 From: tismer at codespeak.net (tismer at codespeak.net) Date: Wed, 11 May 2005 16:48:46 +0200 (CEST) Subject: [pypy-svn] r12191 - pypy/dist/pypy/translator/genc Message-ID: <20050511144846.7597B27C19@code1.codespeak.net> Author: tismer Date: Wed May 11 16:48:46 2005 New Revision: 12191 Modified: pypy/dist/pypy/translator/genc/ctyper.py Log: s_binding was not initialized in all paths Modified: pypy/dist/pypy/translator/genc/ctyper.py ============================================================================== --- pypy/dist/pypy/translator/genc/ctyper.py (original) +++ pypy/dist/pypy/translator/genc/ctyper.py Wed May 11 16:48:46 2005 @@ -124,7 +124,8 @@ # operations that are controlled by their return type s_binding = self.annotator.binding(op.result, True) elif op.opname == 'simple_call' and isinstance(op.args[0], Constant): - # XXX move me elsewhere + # XXX move me elsewhere + s_binding = None func = op.args[0].value if func is lltypes.malloc: assert len(op.args) == 2 # for now From tismer at codespeak.net Wed May 11 18:22:33 2005 From: tismer at codespeak.net (tismer at codespeak.net) Date: Wed, 11 May 2005 18:22:33 +0200 (CEST) Subject: [pypy-svn] r12193 - in pypy/dist/pypy: annotation objspace/flow translator/genc translator/genc/test translator/test Message-ID: <20050511162233.5839B27C19@code1.codespeak.net> Author: tismer Date: Wed May 11 18:22:33 2005 New Revision: 12193 Modified: pypy/dist/pypy/annotation/unaryop.py pypy/dist/pypy/objspace/flow/objspace.py pypy/dist/pypy/translator/genc/ctyper.py pypy/dist/pypy/translator/genc/int_include.h pypy/dist/pypy/translator/genc/test/test_typed.py pypy/dist/pypy/translator/test/snippet.py Log: implemented the unary operations. added a test case. Modified: pypy/dist/pypy/annotation/unaryop.py ============================================================================== --- pypy/dist/pypy/annotation/unaryop.py (original) +++ pypy/dist/pypy/annotation/unaryop.py Wed May 11 18:22:33 2005 @@ -15,6 +15,8 @@ from pypy.annotation.classdef import isclassdef from pypy.annotation import builtin +from pypy.annotation.binaryop import _clone ## XXX where to put this? + # convenience only! def immutablevalue(x): return getbookkeeper().immutablevalue(x) @@ -23,7 +25,8 @@ 'simple_call', 'call_args', 'str', 'repr', 'iter', 'next', 'invert', 'type', 'issubtype', 'pos', 'neg', 'nonzero', 'abs', 'hex', 'oct', - 'ord', 'int', 'float', 'long', 'id']) + 'ord', 'int', 'float', 'long', 'id', + 'neg_ovf', 'abs_ovf']) for opname in UNARY_OPERATIONS: missing_operation(SomeObject, opname) @@ -139,21 +142,32 @@ return SomeInteger(unsigned=True) return SomeInteger() + invert.can_only_throw = [] + def pos(self): return self + pos.can_only_throw = [] int = pos + # these are the only ones which can overflow: + def neg(self): if self.unsigned: return SomeInteger(unsigned=True) return SomeInteger() + neg.can_only_throw = [] + neg_ovf = _clone(neg, [OverflowError]) + def abs(self): if self.unsigned: return self return SomeInteger(nonneg=True) + abs.can_only_throw = [] + abs_ovf = _clone(abs, [OverflowError]) + class __extend__(SomeBool): def is_true(self): Modified: pypy/dist/pypy/objspace/flow/objspace.py ============================================================================== --- pypy/dist/pypy/objspace/flow/objspace.py (original) +++ pypy/dist/pypy/objspace/flow/objspace.py Wed May 11 18:22:33 2005 @@ -444,7 +444,7 @@ inplace_add inplace_sub inplace_mul inplace_truediv inplace_floordiv inplace_div inplace_mod inplace_divmod inplace_pow""", FloatingPointError) -_add_except_ovf("""pos neg abs invert add sub mul truediv +_add_except_ovf("""neg abs invert add sub mul truediv floordiv div mod divmod pow lshift inplace_add inplace_sub inplace_mul inplace_truediv inplace_floordiv inplace_div inplace_mod inplace_pow Modified: pypy/dist/pypy/translator/genc/ctyper.py ============================================================================== --- pypy/dist/pypy/translator/genc/ctyper.py (original) +++ pypy/dist/pypy/translator/genc/ctyper.py Wed May 11 18:22:33 2005 @@ -30,8 +30,14 @@ self.TPyObject = TPyObject = t.getconcretetype(CPyObjectType) specializationtable = [ - ## op specialized op arg types concrete return type - ('is_true', 'int_is_true', TInt, TInt), + ## op specialized op arg types concrete return type + ('is_true', 'int_is_true', TInt, TInt), + ('invert', 'int_invert', TInt, TInt), + ('pos', 'int_pos', TInt, TInt), + ('neg', 'int_neg', TInt, TInt), + ('neg_ovf', 'int_neg_ovf', TInt, TInt), + ('abs', 'int_abs', TInt, TInt), + ('abs_ovf', 'int_abs_ovf', TInt, TInt), ] ii_i = (TInt, TInt, TInt) for op in "eq ne le gt lt ge cmp".split(): Modified: pypy/dist/pypy/translator/genc/int_include.h ============================================================================== --- pypy/dist/pypy/translator/genc/int_include.h (original) +++ pypy/dist/pypy/translator/genc/int_include.h Wed May 11 18:22:33 2005 @@ -2,12 +2,35 @@ /************************************************************/ /*** C header subsection: operations between ints ***/ +/*** unary operations ***/ #define OP_INCREF_int(x) /* nothing */ #define OP_DECREF_int(x) /* nothing */ #define CONV_TO_OBJ_int PyInt_FromLong #define CONV_FROM_OBJ_int PyInt_AS_LONG +#define OP_INT_IS_TRUE(x,r,err) OP_INT_NE(x,0,r,err) + +#define OP_INT_INVERT(x,r,err) r = ~((long)(x)); + +#define OP_INT_POS(x,r,err) r = x; + +#define OP_INT_NEG(x,r,err) r = -((long)x); + +#define OP_INT_NEG_OVF(x,r,err) \ + OP_INT_NEG(x,r,err) \ + if ((long)(x) >= 0 || (long)(x) != -(long)(x)); \ + else FAIL_OVF(err, "integer negate") + +#define OP_INT_ABS(x,r,err) r = (long)(x) >= 0 ? x : -((long)x); + +#define OP_INT_ABS_OVF(x,r,err) \ + OP_INT_ABS(x,r,err) \ + if ((long)(x) >= 0 || (long)(x) != -(long)(x)); \ + else FAIL_OVF(err, "integer absolute") + +/*** binary operations ***/ + #define OP_INT_EQ(x,y,r,err) r = ((long)(x) == (long)(y)); #define OP_INT_NE(x,y,r,err) r = ((long)(x) != (long)(y)); #define OP_INT_LE(x,y,r,err) r = ((long)(x) <= (long)(y)); @@ -15,8 +38,6 @@ #define OP_INT_LT(x,y,r,err) r = ((long)(x) < (long)(y)); #define OP_INT_GE(x,y,r,err) r = ((long)(x) >= (long)(y)); -#define OP_INT_IS_TRUE(x,r,err) OP_INT_NE(x,0,r,err) - #define OP_INT_CMP(x,y,r,err) \ r = (((long)(x) > (long)(y)) - ((long)(x) < (long)(y))) @@ -26,7 +47,7 @@ #define OP_INT_ADD_OVF(x,y,r,err) \ OP_INT_ADD(x,y,r,err) \ - if ((r^(x)) >= 0 || (r^(y)) >= 0); \ + if ((r^((long)x)) >= 0 || (r^((long)y)) >= 0); \ else FAIL_OVF(err, "integer addition") #define OP_INT_SUB(x,y,r,err) r = (long)(x) - (long)(y); Modified: pypy/dist/pypy/translator/genc/test/test_typed.py ============================================================================== --- pypy/dist/pypy/translator/genc/test/test_typed.py (original) +++ pypy/dist/pypy/translator/genc/test/test_typed.py Wed May 11 18:22:33 2005 @@ -50,4 +50,10 @@ fn = self.getcompiled(snippet.lshift_func) raises(ValueError, fn, -1) raises(OverflowError, fn, 1) - + + def test_int_unary_ovf(self): + fn = self.getcompiled(snippet.unary_func) + for i in range(-3,3): + assert fn(i) == (-(i), abs(i-1)) + raises (OverflowError, fn, -sys.maxint-1) + raises (OverflowError, fn, -sys.maxint) Modified: pypy/dist/pypy/translator/test/snippet.py ============================================================================== --- pypy/dist/pypy/translator/test/snippet.py (original) +++ pypy/dist/pypy/translator/test/snippet.py Wed May 11 18:22:33 2005 @@ -125,6 +125,13 @@ except (hugelmugel, OverflowError, StandardError, ValueError): raise +def unary_func(i=numtype): + try: + return ovfcheck(-i), ovfcheck(abs(i-1)) + except: raise + # XXX it would be nice to get it right without an exception + # handler at all, but then we need to do much harder parsing + def while_func(i=numtype): total = 0 while i > 0: From tismer at codespeak.net Wed May 11 18:34:00 2005 From: tismer at codespeak.net (tismer at codespeak.net) Date: Wed, 11 May 2005 18:34:00 +0200 (CEST) Subject: [pypy-svn] r12194 - pypy/dist/pypy/translator/genc Message-ID: <20050511163400.DB6F627C19@code1.codespeak.net> Author: tismer Date: Wed May 11 18:34:00 2005 New Revision: 12194 Modified: pypy/dist/pypy/translator/genc/ctyper.py (contents, props changed) Log: fixeol Modified: pypy/dist/pypy/translator/genc/ctyper.py ============================================================================== --- pypy/dist/pypy/translator/genc/ctyper.py (original) +++ pypy/dist/pypy/translator/genc/ctyper.py Wed May 11 18:34:00 2005 @@ -28,48 +28,48 @@ self.TInt = TInt = t.getconcretetype(CIntType) self.TNone = TNone = t.getconcretetype(CNoneType) self.TPyObject = TPyObject = t.getconcretetype(CPyObjectType) - + specializationtable = [ - ## op specialized op arg types concrete return type - ('is_true', 'int_is_true', TInt, TInt), - ('invert', 'int_invert', TInt, TInt), - ('pos', 'int_pos', TInt, TInt), - ('neg', 'int_neg', TInt, TInt), - ('neg_ovf', 'int_neg_ovf', TInt, TInt), - ('abs', 'int_abs', TInt, TInt), - ('abs_ovf', 'int_abs_ovf', TInt, TInt), - ] - ii_i = (TInt, TInt, TInt) - for op in "eq ne le gt lt ge cmp".split(): - specializationtable.extend([ - ('%s' % op, 'int_%s' % op) + ii_i, - ]) - for op in "add sub mul".split(): - specializationtable.extend([ - ('%s' % op, 'int_%s' % op) + ii_i, - ('inplace_%s' % op, 'int_%s' % op) + ii_i, - ('%s_ovf' % op, 'int_%s_ovf' % op) + ii_i, - ('inplace_%s_ovf' % op, 'int_%s_ovf' % op) + ii_i, - ]) - for op in "rshift".split(): - specializationtable.extend([ - ('%s' % op, 'int_%s_val' % op) + ii_i, - ('inplace_%s' % op, 'int_%s_val' % op) + ii_i, - ]) - for op in "lshift".split(): - specializationtable.extend([ - ('%s' % op, 'int_%s_val' % op) + ii_i, - ('inplace_%s' % op, 'int_%s_val' % op) + ii_i, - ('%s_ovf' % op, 'int_%s_ovf_val' % op) + ii_i, - ('inplace_%s_ovf' % op, 'int_%s_ovf_val' % op) + ii_i, - ]) - for op in "floordiv mod".split(): - specializationtable.extend([ - ('%s' % op, 'int_%s_zer' % op) + ii_i, - ('inplace_%s' % op, 'int_%s_zer' % op) + ii_i, - ('%s_ovf' % op, 'int_%s_ovf_zer' % op) + ii_i, - ('inplace_%s_ovf' % op, 'int_%s_ovf_zer' % op) + ii_i, - ]) + ## op specialized op arg types concrete return type + ('is_true', 'int_is_true', TInt, TInt), + ('invert', 'int_invert', TInt, TInt), + ('pos', 'int_pos', TInt, TInt), + ('neg', 'int_neg', TInt, TInt), + ('neg_ovf', 'int_neg_ovf', TInt, TInt), + ('abs', 'int_abs', TInt, TInt), + ('abs_ovf', 'int_abs_ovf', TInt, TInt), + ] + ii_i = (TInt, TInt, TInt) + for op in "eq ne le gt lt ge cmp".split(): + specializationtable.extend([ + ('%s' % op, 'int_%s' % op) + ii_i, + ]) + for op in "add sub mul".split(): + specializationtable.extend([ + ('%s' % op, 'int_%s' % op) + ii_i, + ('inplace_%s' % op, 'int_%s' % op) + ii_i, + ('%s_ovf' % op, 'int_%s_ovf' % op) + ii_i, + ('inplace_%s_ovf' % op, 'int_%s_ovf' % op) + ii_i, + ]) + for op in "rshift".split(): + specializationtable.extend([ + ('%s' % op, 'int_%s_val' % op) + ii_i, + ('inplace_%s' % op, 'int_%s_val' % op) + ii_i, + ]) + for op in "lshift".split(): + specializationtable.extend([ + ('%s' % op, 'int_%s_val' % op) + ii_i, + ('inplace_%s' % op, 'int_%s_val' % op) + ii_i, + ('%s_ovf' % op, 'int_%s_ovf_val' % op) + ii_i, + ('inplace_%s_ovf' % op, 'int_%s_ovf_val' % op) + ii_i, + ]) + for op in "floordiv mod".split(): + specializationtable.extend([ + ('%s' % op, 'int_%s_zer' % op) + ii_i, + ('inplace_%s' % op, 'int_%s_zer' % op) + ii_i, + ('%s_ovf' % op, 'int_%s_ovf_zer' % op) + ii_i, + ('inplace_%s_ovf' % op, 'int_%s_ovf_zer' % op) + ii_i, + ]) # initialization Specializer.__init__( @@ -79,7 +79,7 @@ # in more-specific-first, more-general-last order typematches = [TNone, TInt], - specializationtable = specializationtable, + specializationtable = specializationtable, ) def annotation2concretetype(self, s_value): @@ -130,7 +130,7 @@ # operations that are controlled by their return type s_binding = self.annotator.binding(op.result, True) elif op.opname == 'simple_call' and isinstance(op.args[0], Constant): - # XXX move me elsewhere + # XXX move me elsewhere s_binding = None func = op.args[0].value if func is lltypes.malloc: From tismer at codespeak.net Wed May 11 19:22:59 2005 From: tismer at codespeak.net (tismer at codespeak.net) Date: Wed, 11 May 2005 19:22:59 +0200 (CEST) Subject: [pypy-svn] r12195 - pypy/dist/pypy/translator Message-ID: <20050511172259.CD0ED27C1C@code1.codespeak.net> Author: tismer Date: Wed May 11 19:22:59 2005 New Revision: 12195 Modified: pypy/dist/pypy/translator/typer.py Log: buglet in typer Modified: pypy/dist/pypy/translator/typer.py ============================================================================== --- pypy/dist/pypy/translator/typer.py (original) +++ pypy/dist/pypy/translator/typer.py Wed May 11 19:22:59 2005 @@ -69,7 +69,7 @@ v = Constant(v.value) v.concretetype = concretetype - elif v.concretetype != concretetype: + elif hasattr(v, 'concretetype') and v.concretetype != concretetype: # XXX do we need better conversion paths? # 1) convert to the generic type From tismer at codespeak.net Wed May 11 19:24:03 2005 From: tismer at codespeak.net (tismer at codespeak.net) Date: Wed, 11 May 2005 19:24:03 +0200 (CEST) Subject: [pypy-svn] r12196 - pypy/dist/pypy/objspace/flow Message-ID: <20050511172403.E5E3A27C1C@code1.codespeak.net> Author: tismer Date: Wed May 11 19:24:03 2005 New Revision: 12196 Modified: pypy/dist/pypy/objspace/flow/model.py Log: introducing __slots__ in Variable, Constant and SpaceOperation saved about 120 MB ofmemory for targetpypymain. Modified: pypy/dist/pypy/objspace/flow/model.py ============================================================================== --- pypy/dist/pypy/objspace/flow/model.py (original) +++ pypy/dist/pypy/objspace/flow/model.py Wed May 11 19:24:03 2005 @@ -5,6 +5,12 @@ # a discussion in Berlin, 4th of october 2003 from __future__ import generators +## the switch to slotted objects reduces annotation of +## targetpypymain from 321 MB down to 205 MB +## including genc, we go from 442 to 325. + +__metaclass__ = type + class FunctionGraph: def __init__(self, name, startblock, return_var=None): self.name = name # function name (possibly mangled already) @@ -47,6 +53,11 @@ SingleGraphPage(self).display() class Link: + ## + ## __slots__ = """args target exitcase prevblock + ## last_exception last_exc_value""".split() + # collision with flowcontext.py which wants to use update + def __init__(self, args, target, exitcase=None): assert len(args) == len(target.inputargs), "output args mismatch" self.args = list(args) # mixed list of var/const @@ -138,12 +149,14 @@ class Variable: + __slots__ = ["renamed", "name", "concretetype"] + counter = 0 instances = {} - renamed = False def __init__(self, name=None): self.name = 'v%d' % Variable.counter + self.renamed = False Variable.instances[self.name] = self Variable.counter += 1 if name is not None: @@ -172,6 +185,8 @@ class Constant: + __slots__ = ["key", "value", "concretetype"] + def __init__(self, value): self.value = value # a concrete value # try to be smart about constant mutable or immutable values @@ -202,6 +217,8 @@ return '(%s)' % (r,) class SpaceOperation: + __slots__ = "opname args result offset".split() + def __init__(self, opname, args, result): self.opname = opname # operation name self.args = list(args) # mixed list of var/const From pedronis at codespeak.net Wed May 11 19:33:47 2005 From: pedronis at codespeak.net (pedronis at codespeak.net) Date: Wed, 11 May 2005 19:33:47 +0200 (CEST) Subject: [pypy-svn] r12197 - in pypy/dist/pypy: annotation annotation/test rpython rpython/test translator/genc translator/genc/test Message-ID: <20050511173347.CE8CB27C1C@code1.codespeak.net> Author: pedronis Date: Wed May 11 19:33:47 2005 New Revision: 12197 Modified: pypy/dist/pypy/annotation/binaryop.py pypy/dist/pypy/annotation/model.py pypy/dist/pypy/annotation/test/test_model.py pypy/dist/pypy/annotation/unaryop.py pypy/dist/pypy/rpython/lltypes.py pypy/dist/pypy/rpython/test/test_llann.py pypy/dist/pypy/translator/genc/ctyper.py pypy/dist/pypy/translator/genc/test/test_lltyped.py Log: some more annotation support for lltypes; tests; removed debug view graph from test_lltyped.py Modified: pypy/dist/pypy/annotation/binaryop.py ============================================================================== --- pypy/dist/pypy/annotation/binaryop.py (original) +++ pypy/dist/pypy/annotation/binaryop.py Wed May 11 19:33:47 2005 @@ -454,19 +454,31 @@ # annotation of low-level types from pypy.rpython import lltypes -from pypy.annotation.model import SomePtr +from pypy.annotation.model import SomePtr, ll_to_annotation -class __extend__(SomePtr, SomePtr): +class __extend__(pairtype(SomePtr, SomePtr)): def union((p1, p2)): - assert p1.ll_ptrtype == p2.ll_prttype,("mixing of incompatible pointer types: %r, %r" % - (p1.ll_prttype, p2.ll_prttype)) + assert p1.ll_ptrtype == p2.ll_ptrtype,("mixing of incompatible pointer types: %r, %r" % + (p1.ll_ptrtype, p2.ll_ptrtype)) return SomePtr(p1.ll_ptrtype) -class __extend__(SomePtr, SomeObject): - def union((p1, obj)): - assert False, ("mixing pointer type %r with something else %r" % (p1.ll_ptrtype, obj)) +class __extend__(pairtype(SomePtr, SomeInteger)): -class __extend__(SomeObject, SomePtr): + def getitem((p, int1)): + v = p.ll_ptrtype._example()[0] + return ll_to_annotation(v) + +class __extend__(pairtype(SomePtr, SomeObject)): + def union((p, obj)): + assert False, ("mixing pointer type %r with something else %r" % (p.ll_ptrtype, obj)) + + def gettitem((p, obj)): + assert False,"ptr %r getitem index not an int: %r" % (p.ll_ptrtype, obj) + + def settitem((p, obj)): + assert False,"ptr setitem is not a valid operation" + +class __extend__(pairtype(SomeObject, SomePtr)): def union((obj, p2)): return pair(p2, obj).union() Modified: pypy/dist/pypy/annotation/model.py ============================================================================== --- pypy/dist/pypy/annotation/model.py (original) +++ pypy/dist/pypy/annotation/model.py Wed May 11 19:33:47 2005 @@ -274,6 +274,37 @@ def __init__(self, ll_ptrtype): self.ll_ptrtype = ll_ptrtype +from pypy.rpython import lltypes + +annotation_to_ll_map = [ + (SomeBool(), lltypes.Bool), + (SomeInteger(), lltypes.Signed), + (SomeInteger(nonneg=True, unsigned=True), lltypes.Unsigned), + (SomeChar(), lltypes.Char), +] + +def annotation_to_lltype(s_val): + if isinstance(s_val, SomePtr): + return s_val.ll_ptrtype + for witness, lltype in annotation_to_ll_map: + if witness.contains(s_val): + return lltype + raise AssertionError("trying find a matching low-level type for unexpected" + "%r" % s_val) + +ll_to_annotation_map = dict([(ll, ann) for ann,ll in annotation_to_ll_map]) + +def ll_to_annotation(v): + if v is None: + assert False, "cannot retrieve Void low-level type value" + typ = lltypes.typeOf(v) + s = ll_to_annotation_map.get(typ) + if s is None: + return SomePtr(typ) + else: + return s + + # ____________________________________________________________ def unionof(*somevalues): Modified: pypy/dist/pypy/annotation/test/test_model.py ============================================================================== --- pypy/dist/pypy/annotation/test/test_model.py (original) +++ pypy/dist/pypy/annotation/test/test_model.py Wed May 11 19:33:47 2005 @@ -1,5 +1,6 @@ import autopath +import py from pypy.annotation.model import * from pypy.annotation.listdef import ListDef, MOST_GENERAL_LISTDEF @@ -101,7 +102,72 @@ assert not s1.contains(s2) assert s1 != s2 +def test_ll_to_annotation(): + s_z = ll_to_annotation(lltypes.Signed._defl()) + s_s = SomeInteger() + s_u = SomeInteger(nonneg=True, unsigned=True) + assert s_z.contains(s_s) + assert not s_z.contains(s_u) + s_uz = ll_to_annotation(lltypes.Unsigned._defl()) + assert s_uz.contains(s_u) + assert ll_to_annotation(lltypes.Bool._defl()).contains(SomeBool()) + assert ll_to_annotation(lltypes.Char._defl()).contains(SomeChar()) + S = lltypes.Struct('s') + A = lltypes.Array() + s_p = ll_to_annotation(lltypes.malloc(S)) + assert isinstance(s_p, SomePtr) and s_p.ll_ptrtype == lltypes.GcPtr(S) + s_p = ll_to_annotation(lltypes.malloc(A, 0)) + assert isinstance(s_p, SomePtr) and s_p.ll_ptrtype == lltypes.GcPtr(A) + +def test_annotation_to_lltype(): + from pypy.rpython.rarithmetic import r_uint + s_i = SomeInteger() + s_pos = SomeInteger(nonneg=True) + s_1 = SomeInteger(nonneg=True); s_1.const = 1 + s_m1 = SomeInteger(nonneg=False); s_m1.const = -1 + s_u = SomeInteger(nonneg=True, unsigned=True); + s_u1 = SomeInteger(nonneg=True, unsigned=True); + s_u1.const = r_uint(1) + assert annotation_to_lltype(s_i) == lltypes.Signed + assert annotation_to_lltype(s_pos) == lltypes.Signed + assert annotation_to_lltype(s_1) == lltypes.Signed + assert annotation_to_lltype(s_m1) == lltypes.Signed + assert annotation_to_lltype(s_u) == lltypes.Unsigned + assert annotation_to_lltype(s_u1) == lltypes.Unsigned + assert annotation_to_lltype(SomeBool()) == lltypes.Bool + assert annotation_to_lltype(SomeChar()) == lltypes.Char + PS = lltypes.GcPtr(lltypes.Struct('s')) + s_p = SomePtr(ll_ptrtype=PS) + assert annotation_to_lltype(s_p) == PS + py.test.raises(AssertionError, "annotation_to_lltype(si0)") + +def test_ll_union(): + PS1 = lltypes.GcPtr(lltypes.Struct('s')) + PS2 = lltypes.GcPtr(lltypes.Struct('s')) + PS3 = lltypes.GcPtr(lltypes.Struct('s3')) + PA1 = lltypes.GcPtr(lltypes.Array()) + PA2 = lltypes.GcPtr(lltypes.Array()) + + assert unionof(SomePtr(PS1),SomePtr(PS1)) == SomePtr(PS1) + assert unionof(SomePtr(PS1),SomePtr(PS2)) == SomePtr(PS2) + assert unionof(SomePtr(PS1),SomePtr(PS2)) == SomePtr(PS1) + + assert unionof(SomePtr(PA1),SomePtr(PA1)) == SomePtr(PA1) + assert unionof(SomePtr(PA1),SomePtr(PA2)) == SomePtr(PA2) + assert unionof(SomePtr(PA1),SomePtr(PA2)) == SomePtr(PA1) + + assert unionof(SomePtr(PS1),SomeImpossibleValue()) == SomePtr(PS1) + assert unionof(SomeImpossibleValue(), SomePtr(PS1)) == SomePtr(PS1) + + py.test.raises(AssertionError, "unionof(SomePtr(PA1), SomePtr(PS1))") + py.test.raises(AssertionError, "unionof(SomePtr(PS1), SomePtr(PS3))") + py.test.raises(AssertionError, "unionof(SomePtr(PS1), SomeInteger())") + py.test.raises(AssertionError, "unionof(SomePtr(PS1), SomeObject())") + py.test.raises(AssertionError, "unionof(SomeInteger(), SomePtr(PS1))") + py.test.raises(AssertionError, "unionof(SomeObject(), SomePtr(PS1))") + if __name__ == '__main__': for name, value in globals().items(): if name.startswith('test_'): value() + Modified: pypy/dist/pypy/annotation/unaryop.py ============================================================================== --- pypy/dist/pypy/annotation/unaryop.py (original) +++ pypy/dist/pypy/annotation/unaryop.py Wed May 11 19:33:47 2005 @@ -426,25 +426,7 @@ # annotation of low-level types from pypy.rpython import lltypes -from pypy.annotation.model import SomePtr - -ll_to_annotation_map = { - lltypes.Signed: SomeInteger(), - lltypes.Unsigned: SomeInteger(nonneg=True, unsigned=True), - lltypes.Char: SomeChar(), - lltypes.Bool: SomeBool(), -} - -def ll_to_annotation(v): - if v is None: - assert False, "cannot retrieve Void low-level type value" - typ = lltypes.typeOf(v) - s = ll_to_annotation_map.get(typ) - if s is None: - return SomePtr(typ) - else: - return s - +from pypy.annotation.model import SomePtr, ll_to_annotation, annotation_to_lltype class __extend__(SomePtr): def getattr(p, s_attr): @@ -452,3 +434,8 @@ v = getattr(p.ll_ptrtype._example(), s_attr.const) return ll_to_annotation(v) + def setattr(p, s_attr, s_value): # just doing checking + assert s_attr.is_constant(), "getattr on ptr %r with non-constant field-name" % p.ll_ptrtype + v_lltype = annotation_to_lltype(s_value) + setattr(p.ll_ptrtype._example(), s_attr.const, + v_lltype._example()) Modified: pypy/dist/pypy/rpython/lltypes.py ============================================================================== --- pypy/dist/pypy/rpython/lltypes.py (original) +++ pypy/dist/pypy/rpython/lltypes.py Wed May 11 19:33:47 2005 @@ -80,7 +80,7 @@ def _defl(self, parent=None): return _struct(self, parent=parent) - def _example(self): + def _container_example(self): if self._arrayfld is None: n = None else: @@ -96,7 +96,7 @@ def __str__(self): return "Array of { %s }" % (self.OF._str_fields(),) - def _example(self): + def _container_example(self): return _array(self, 1) @@ -110,6 +110,8 @@ def _defl(self, parent=None): return self._default + + _example = _defl Signed = Primitive("Signed", 0) @@ -144,7 +146,7 @@ return _ptr(self, None) def _example(self): - o = self.TO._example() + o = self.TO._container_example() return _ptr(self, o) Modified: pypy/dist/pypy/rpython/test/test_llann.py ============================================================================== --- pypy/dist/pypy/rpython/test/test_llann.py (original) +++ pypy/dist/pypy/rpython/test/test_llann.py Wed May 11 19:33:47 2005 @@ -24,3 +24,13 @@ a = self.RPythonAnnotator() s = a.build_types(llf, []) assert s.knowntype == int + + def test_array(self): + A = Array(('v', Signed)) + def llf(): + a = malloc(A, 1) + return a[0].v + a = self.RPythonAnnotator() + s = a.build_types(llf, []) + assert s.knowntype == int + Modified: pypy/dist/pypy/translator/genc/ctyper.py ============================================================================== --- pypy/dist/pypy/translator/genc/ctyper.py (original) +++ pypy/dist/pypy/translator/genc/ctyper.py Wed May 11 19:33:47 2005 @@ -83,6 +83,11 @@ ) def annotation2concretetype(self, s_value): + if isinstance(s_value, SomePtr): # XXX moved here to avoid contains failures + besttype = self.annotator.translator.getconcretetype( + CPtrType, s_value.ll_ptrtype) + return besttype + besttype = Specializer.annotation2concretetype(self, s_value) if besttype == self.defaultconcretetype: @@ -119,9 +124,6 @@ # besttype = self.annotator.translator.getconcretetype( # CListType, item_ct) - elif isinstance(s_value, SomePtr): - besttype = self.annotator.translator.getconcretetype( - CPtrType, s_value.ll_ptrtype) return besttype Modified: pypy/dist/pypy/translator/genc/test/test_lltyped.py ============================================================================== --- pypy/dist/pypy/translator/genc/test/test_lltyped.py (original) +++ pypy/dist/pypy/translator/genc/test/test_lltyped.py Wed May 11 19:33:47 2005 @@ -14,7 +14,7 @@ a.simplify() GenCSpecializer(a).specialize() t.checkgraphs() - t.view() + #t.view() return skip_missing_compiler(t.ccompile) def test_simple(self): From pedronis at codespeak.net Wed May 11 20:13:37 2005 From: pedronis at codespeak.net (pedronis at codespeak.net) Date: Wed, 11 May 2005 20:13:37 +0200 (CEST) Subject: [pypy-svn] r12198 - pypy/dist/pypy/objspace/flow Message-ID: <20050511181337.750BD27C1C@code1.codespeak.net> Author: pedronis Date: Wed May 11 20:13:37 2005 New Revision: 12198 Modified: pypy/dist/pypy/objspace/flow/flowcontext.py pypy/dist/pypy/objspace/flow/model.py Log: changed a bit the interface guessbool <-> Link; we can use __slots__ for Links too Modified: pypy/dist/pypy/objspace/flow/flowcontext.py ============================================================================== --- pypy/dist/pypy/objspace/flow/flowcontext.py (original) +++ pypy/dist/pypy/objspace/flow/flowcontext.py Wed May 11 20:13:37 2005 @@ -127,7 +127,8 @@ egg = EggBlock(vars2, block, case) ec.pendingblocks.append(egg) link = Link(vars, egg, case) - link.__dict__.update(attach) + if attach: + link.extravars(**attach) links.append(link) block.exitswitch = w_condition Modified: pypy/dist/pypy/objspace/flow/model.py ============================================================================== --- pypy/dist/pypy/objspace/flow/model.py (original) +++ pypy/dist/pypy/objspace/flow/model.py Wed May 11 20:13:37 2005 @@ -53,10 +53,8 @@ SingleGraphPage(self).display() class Link: - ## - ## __slots__ = """args target exitcase prevblock - ## last_exception last_exc_value""".split() - # collision with flowcontext.py which wants to use update + + __slots__ = """args target exitcase prevblock last_exception last_exc_value""".split() def __init__(self, args, target, exitcase=None): assert len(args) == len(target.inputargs), "output args mismatch" @@ -69,6 +67,11 @@ self.last_exception = None self.last_exc_value = None + # right now only exception handling needs to introduce new variables on the links + def extravars(self, last_exception=None, last_exc_value=None): + self.last_exception = last_exception + self.last_exc_value = last_exc_value + def copy(self, rename=lambda x: x): newargs = [rename(a) for a in self.args] newlink = Link(newargs, self.target, self.exitcase) From tismer at codespeak.net Wed May 11 20:37:32 2005 From: tismer at codespeak.net (tismer at codespeak.net) Date: Wed, 11 May 2005 20:37:32 +0200 (CEST) Subject: [pypy-svn] r12199 - pypy/dist/pypy/objspace/flow Message-ID: <20050511183732.397B327C1C@code1.codespeak.net> Author: tismer Date: Wed May 11 20:37:31 2005 New Revision: 12199 Modified: pypy/dist/pypy/objspace/flow/model.py Log: added __slots__ to blocks as well. The effect isn't that large, but even 4 MB are a nice gift. Added some statistics info. Modified: pypy/dist/pypy/objspace/flow/model.py ============================================================================== --- pypy/dist/pypy/objspace/flow/model.py (original) +++ pypy/dist/pypy/objspace/flow/model.py Wed May 11 20:37:31 2005 @@ -5,9 +5,17 @@ # a discussion in Berlin, 4th of october 2003 from __future__ import generators -## the switch to slotted objects reduces annotation of -## targetpypymain from 321 MB down to 205 MB -## including genc, we go from 442 to 325. +""" + memory size before and after introduction of __slots__ + using targetpypymain + + slottified annotation ann+genc + ------------------------------------------- + nothing 321 MB 442 MB + Var/Const/SpaceOp 205 MB 325 MB + + Link 189 MB 311 MB + + Block 185 MB 304 MB +""" __metaclass__ = type @@ -54,8 +62,9 @@ class Link: - __slots__ = """args target exitcase prevblock last_exception last_exc_value""".split() - + __slots__ = """args target exitcase prevblock + last_exception last_exc_value""".split() + def __init__(self, args, target, exitcase=None): assert len(args) == len(target.inputargs), "output args mismatch" self.args = list(args) # mixed list of var/const @@ -84,9 +93,11 @@ return "link from %s to %s" % (str(self.prevblock), str(self.target)) class Block: - isstartblock = False + __slots__ = """isstartblock inputargs operations exitswitch + exits exc_handler""".split() def __init__(self, inputargs): + self.isstartblock = False self.inputargs = list(inputargs) # mixed list of variable/const self.operations = [] # list of SpaceOperation(s) self.exitswitch = None # a variable or From tismer at codespeak.net Wed May 11 21:13:05 2005 From: tismer at codespeak.net (tismer at codespeak.net) Date: Wed, 11 May 2005 21:13:05 +0200 (CEST) Subject: [pypy-svn] r12200 - in pypy/dist: goal pypy/translator/test Message-ID: <20050511191305.7FCE127C1C@code1.codespeak.net> Author: tismer Date: Wed May 11 21:13:05 2005 New Revision: 12200 Added: pypy/dist/goal/targetrpystone2.py (contents, props changed) Modified: pypy/dist/goal/targetrpystone.py pypy/dist/pypy/translator/test/rpystone.py Log: did a few changes to enable switching off those rpystone tests which are expensive at the moment. Changed the test to run bot CPython and the compiled version. Added a targetrpystone2.py file which is configured for the fast version. Feel free toplay with the options in rpystone.setslow() With the current settings, the speed gain is about 10-12 Modified: pypy/dist/goal/targetrpystone.py ============================================================================== --- pypy/dist/goal/targetrpystone.py (original) +++ pypy/dist/goal/targetrpystone.py Wed May 11 21:13:05 2005 @@ -6,17 +6,15 @@ LOOPS = 150000 +# rpystone.setslow(False) + def entry_point(): rpystone.entrypoint(LOOPS) # _____ Define and setup target _____ def target(): global space, mmentrypoints - # disable translation of the whole of classobjinterp.py - #StdObjSpace.setup_old_style_classes = lambda self: None space = StdObjSpace() - # call cache filling code - #buildcache2.buildcache(space) # ------------------------------------------------------------ @@ -27,9 +25,12 @@ def run(c_entry_point): res_w = c_entry_point() print res_w + print "CPython:" + rpystone.entrypoint(50000) if __name__ == "__main__": # just run it without translation + LOOPS = 50000 target() run(entry_point) \ No newline at end of file Added: pypy/dist/goal/targetrpystone2.py ============================================================================== --- (empty file) +++ pypy/dist/goal/targetrpystone2.py Wed May 11 21:13:05 2005 @@ -0,0 +1,36 @@ +import buildcache2 +from pypy.objspace.std.objspace import StdObjSpace +from pypy.translator.test import rpystone + +# __________ Entry point __________ + +LOOPS = 1000000 + +rpystone.setslow(False) + +def entry_point(): + rpystone.entrypoint(LOOPS) + +# _____ Define and setup target _____ +def target(): + global space, mmentrypoints + space = StdObjSpace() + + # ------------------------------------------------------------ + + return entry_point, [] + +# _____ Run translated _____ + +def run(c_entry_point): + res_w = c_entry_point() + print res_w + print "CPython:" + rpystone.entrypoint(50000) + +if __name__ == "__main__": + # just run it without translation + LOOPS = 50000 + target() + run(entry_point) + \ No newline at end of file Modified: pypy/dist/pypy/translator/test/rpystone.py ============================================================================== --- pypy/dist/pypy/translator/test/rpystone.py (original) +++ pypy/dist/pypy/translator/test/rpystone.py Wed May 11 21:13:05 2005 @@ -1,5 +1,21 @@ #! /usr/bin/env python +def setslow(X): + global XF1, XF2, XF3, XP1, XP2, XP3, XP4, XP5, XP6, XP7, XP8 + XF1 = True + XF2 = X + XF3 = True + XP1 = X + XP2 = X + XP3 = True + XP4 = X + XP5 = True + XP6 = True + XP7 = True + XP8 = X + +setslow(True) + """ "PYSTONE" Benchmark Program @@ -115,28 +131,28 @@ starttime = clock() for i in range(loops): - Proc5() - Proc4() + if XP5:Proc5() + if XP4:Proc4() IntLoc1 = 2 IntLoc2 = 3 String2Loc = "DHRYSTONE PROGRAM, 2'ND STRING" EnumLoc = Ident2 - g.BoolGlob = not Func2(String1Loc, String2Loc) + if XF2:g.BoolGlob = not Func2(String1Loc, String2Loc) while IntLoc1 < IntLoc2: IntLoc3 = 5 * IntLoc1 - IntLoc2 IntLoc3 = Proc7(IntLoc1, IntLoc2) IntLoc1 = IntLoc1 + 1 - Proc8(g.Array1Glob, g.Array2Glob, IntLoc1, IntLoc3) - g.PtrGlb = Proc1(g.PtrGlb) + if XP8:Proc8(g.Array1Glob, g.Array2Glob, IntLoc1, IntLoc3) + if XP1:g.PtrGlb = Proc1(g.PtrGlb) CharIndex = 'A' while CharIndex <= g.Char2Glob: - if EnumLoc == Func1(CharIndex, 'C'): - EnumLoc = Proc6(Ident1) + if XF1 and EnumLoc == Func1(CharIndex, 'C'): + if XP6:EnumLoc = Proc6(Ident1) CharIndex = chr(ord(CharIndex)+1) IntLoc3 = IntLoc2 * IntLoc1 IntLoc2 = IntLoc3 / IntLoc1 IntLoc2 = 7 * (IntLoc3 - IntLoc2) - IntLoc1 - IntLoc1 = Proc2(IntLoc1) + if XP2:IntLoc1 = Proc2(IntLoc1) benchtime = clock() - starttime - nulltime return benchtime, (loops / benchtime) @@ -146,12 +162,12 @@ PtrParIn.IntComp = 5 NextRecord.IntComp = PtrParIn.IntComp NextRecord.PtrComp = PtrParIn.PtrComp - NextRecord.PtrComp = Proc3(NextRecord.PtrComp) + if XP3:NextRecord.PtrComp = Proc3(NextRecord.PtrComp) if NextRecord.Discr == Ident1: NextRecord.IntComp = 6 - NextRecord.EnumComp = Proc6(PtrParIn.EnumComp) + if XP6:NextRecord.EnumComp = Proc6(PtrParIn.EnumComp) NextRecord.PtrComp = g.PtrGlb.PtrComp - NextRecord.IntComp = Proc7(NextRecord.IntComp, 10) + if XP7:NextRecord.IntComp = Proc7(NextRecord.IntComp, 10) else: PtrParIn = NextRecord.copy() NextRecord.PtrComp = None @@ -176,7 +192,7 @@ PtrParOut = g.PtrGlb.PtrComp else: g.IntGlob = 100 - g.PtrGlb.IntComp = Proc7(10, g.IntGlob) + if XP7:g.PtrGlb.IntComp = Proc7(10, g.IntGlob) return PtrParOut def Proc4(): @@ -195,7 +211,7 @@ def Proc6(EnumParIn): EnumParOut = EnumParIn - if not Func3(EnumParIn): + if XF3 and not Func3(EnumParIn): EnumParOut = Ident4 if EnumParIn == Ident1: EnumParOut = Ident1 @@ -241,7 +257,7 @@ def Func2(StrParI1, StrParI2): IntLoc = 1 while IntLoc <= 1: - if Func1(StrParI1[IntLoc], StrParI2[IntLoc+1]) == Ident1: + if XF1 and Func1(StrParI1[IntLoc], StrParI2[IntLoc+1]) == Ident1: CharLoc = 'A' IntLoc = IntLoc + 1 if CharLoc >= 'W' and CharLoc <= 'Z': From arigo at codespeak.net Wed May 11 21:50:11 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Wed, 11 May 2005 21:50:11 +0200 (CEST) Subject: [pypy-svn] r12201 - pypy/dist/pypy/translator/genc Message-ID: <20050511195011.EF36627C1C@code1.codespeak.net> Author: arigo Date: Wed May 11 21:50:11 2005 New Revision: 12201 Modified: pypy/dist/pypy/translator/genc/ctyper.py Log: Wrong logic that hided simple_call to SomePBCs. Modified: pypy/dist/pypy/translator/genc/ctyper.py ============================================================================== --- pypy/dist/pypy/translator/genc/ctyper.py (original) +++ pypy/dist/pypy/translator/genc/ctyper.py Wed May 11 21:50:11 2005 @@ -128,12 +128,8 @@ return besttype def specialized_op(self, op, bindings): - if op.opname in ('newtuple', 'newlist'): - # operations that are controlled by their return type - s_binding = self.annotator.binding(op.result, True) - elif op.opname == 'simple_call' and isinstance(op.args[0], Constant): + if op.opname == 'simple_call' and isinstance(op.args[0], Constant): # XXX move me elsewhere - s_binding = None func = op.args[0].value if func is lltypes.malloc: assert len(op.args) == 2 # for now @@ -144,6 +140,9 @@ op.result), [ct], self.annotation2concretetype(s_result)) ] + if op.opname in ('newtuple', 'newlist'): + # operations that are controlled by their return type + s_binding = self.annotator.binding(op.result, True) elif bindings: # operations are by default controlled by their 1st arg s_binding = bindings[0] From arigo at codespeak.net Wed May 11 23:22:21 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Wed, 11 May 2005 23:22:21 +0200 (CEST) Subject: [pypy-svn] r12203 - pypy/dist/pypy/documentation Message-ID: <20050511212221.A1F3F27C1A@code1.codespeak.net> Author: arigo Date: Wed May 11 23:22:21 2005 New Revision: 12203 Modified: pypy/dist/pypy/documentation/getting_started.txt Log: pystone.py is no longer in test2/, but in test/. Modified: pypy/dist/pypy/documentation/getting_started.txt ============================================================================== --- pypy/dist/pypy/documentation/getting_started.txt (original) +++ pypy/dist/pypy/documentation/getting_started.txt Wed May 11 23:22:21 2005 @@ -109,7 +109,7 @@ modules will not run yet, and others will run too slowly to be worth waiting for, but a few are fun to run:: - >>>> from test2 import pystone + >>>> from test import pystone >>>> pystone.main(10) Note that this is a slightly modified version of pystone -- the @@ -126,15 +126,12 @@ As an example of using PyPy from the command line, you could type:: - python py.py -c "from test2 import pystone; pystone.main(10)" + python py.py -c "from test import pystone; pystone.main(10)" Alternatively, as with regular Python, you can simply give a script name on the command line:: - python py.py ../lib/test2/pystone.py - - (Note that this will run "forever" -- actually, "just" for many - hours, with the current implementation of PyPy.) + python py.py ../../lib-python/modified-2.3.4/test/pystone.py 10 6. The PyPy project uses test-driven-development. Right now, there are From pedronis at codespeak.net Thu May 12 00:31:46 2005 From: pedronis at codespeak.net (pedronis at codespeak.net) Date: Thu, 12 May 2005 00:31:46 +0200 (CEST) Subject: [pypy-svn] r12204 - in pypy/dist/pypy: annotation rpython rpython/test Message-ID: <20050511223146.C8F7927C18@code1.codespeak.net> Author: pedronis Date: Thu May 12 00:31:46 2005 New Revision: 12204 Modified: pypy/dist/pypy/annotation/builtin.py pypy/dist/pypy/rpython/lltypes.py pypy/dist/pypy/rpython/test/test_llann.py Log: annotation for low-level cast_flags/cast_parent Modified: pypy/dist/pypy/annotation/builtin.py ============================================================================== --- pypy/dist/pypy/annotation/builtin.py (original) +++ pypy/dist/pypy/annotation/builtin.py Thu May 12 00:31:46 2005 @@ -244,8 +244,28 @@ n = 1 p = lltypes.malloc(T.const, n) r = SomePtr(lltypes.typeOf(p)) - print r + #print "MALLOC", r return r +def cast_flags(PtrT, s_p): + #print "CAST", s_p + assert isinstance(s_p, SomePtr), "casting of non-pointer: %r" % s_p + assert PtrT.is_constant() + return SomePtr(ll_ptrtype=lltypes.typeOf(lltypes.cast_flags(PtrT.const, s_p.ll_ptrtype._example()))) + +def cast_parent(PtrT, s_p): + assert isinstance(s_p, SomePtr), "casting of non-pointer: %r" % s_p + assert PtrT.is_constant() + PtrT = PtrT.const + parent_example_p = PtrT._example() + first_p = parent_example_p._first() + if s_p.ll_ptrtype == lltypes.typeOf(first_p): + candidate_p = first_p + else: + candidate_p = s_p.ll_ptrtype._example() + return SomePtr(ll_ptrtype=lltypes.typeOf(lltypes.cast_parent(PtrT, candidate_p))) + BUILTIN_ANALYZERS[lltypes.malloc] = malloc +BUILTIN_ANALYZERS[lltypes.cast_flags] = cast_flags +BUILTIN_ANALYZERS[lltypes.cast_parent] = cast_parent Modified: pypy/dist/pypy/rpython/lltypes.py ============================================================================== --- pypy/dist/pypy/rpython/lltypes.py (original) +++ pypy/dist/pypy/rpython/lltypes.py Thu May 12 00:31:46 2005 @@ -272,6 +272,11 @@ raise AttributeError("%r instance has no field %r" % (self._T, field_name)) + def _first(self): + if isinstance(self._T, Struct) and self._T._names: + return self.__getattr__(self._T._names[0]) + raise AttributeError("%r instance has no first field" % (self._T,)) + def __setattr__(self, field_name, val): if isinstance(self._T, Struct): if field_name in self._T._flds: Modified: pypy/dist/pypy/rpython/test/test_llann.py ============================================================================== --- pypy/dist/pypy/rpython/test/test_llann.py (original) +++ pypy/dist/pypy/rpython/test/test_llann.py Thu May 12 00:31:46 2005 @@ -1,4 +1,5 @@ from pypy.rpython.lltypes import * +from pypy.annotation import model as annmodel class TestLowLevelAnnotateTestCase: @@ -33,4 +34,29 @@ a = self.RPythonAnnotator() s = a.build_types(llf, []) assert s.knowntype == int - + + def test_cast_flags(self): + S1 = Struct("s1", ('a', Signed), ('b', Unsigned)) + NGCPS1 = NonGcPtr(S1) + def llf(): + p1 = malloc(S1) + p2 = cast_flags(NGCPS1, p1) + return p2 + a = self.RPythonAnnotator() + s = a.build_types(llf, []) + assert isinstance(s, annmodel.SomePtr) + assert s.ll_ptrtype == NGCPS1 + + def test_cast_parent(self): + S2 = Struct("s2", ('a', Signed)) + S1 = Struct("s1", ('sub1', S2), ('sub2', S2)) + GCPS1 = GcPtr(S1) + def llf(): + p1 = malloc(S1) + p2 = p1.sub1 + p3 = cast_parent(GCPS1, p2) + return p3 + a = self.RPythonAnnotator() + s = a.build_types(llf, []) + assert isinstance(s, annmodel.SomePtr) + assert s.ll_ptrtype == GCPS1 From arigo at codespeak.net Thu May 12 01:22:17 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Thu, 12 May 2005 01:22:17 +0200 (CEST) Subject: [pypy-svn] r12205 - pypy/dist/pypy/translator/genc Message-ID: <20050511232217.044A927B9F@code1.codespeak.net> Author: arigo Date: Thu May 12 01:22:17 2005 New Revision: 12205 Modified: pypy/dist/pypy/translator/genc/ctyper.py pypy/dist/pypy/translator/genc/ll_include.h pypy/dist/pypy/translator/genc/lltype.py Log: Added reference counting to GenC/LowLevelTypes. Becomes quite obscure. Probably soon time to refactor CTyper around the idea that only LowLevelTypes are needed. Modified: pypy/dist/pypy/translator/genc/ctyper.py ============================================================================== --- pypy/dist/pypy/translator/genc/ctyper.py (original) +++ pypy/dist/pypy/translator/genc/ctyper.py Thu May 12 01:22:17 2005 @@ -132,14 +132,32 @@ # XXX move me elsewhere func = op.args[0].value if func is lltypes.malloc: - assert len(op.args) == 2 # for now s_result = self.annotator.binding(op.result) - ct = self.annotator.translator.getconcretetype(CLiteralTypeName) - return [ - self.typed_op(SpaceOperation('malloc', [op.args[1]], - op.result), - [ct], self.annotation2concretetype(s_result)) - ] + ctliteral = self.annotator.translator.getconcretetype( + CLiteralTypeName) + ct = op.args[1] + if len(op.args) == 2: + return [ + self.typed_op(SpaceOperation('malloc', [ct], op.result), + [ctliteral], self.annotation2concretetype(s_result)) + ] + else: + if isinstance(ct, lltypes.Struct): + assert ct._arrayfld is not None + sizefield = ct._arrayfld + '.size' + varstruct = ct._flds[ct._arrayfld].OF + else: + assert isinstance(ct, lltypes.Array) + sizefield = 'size' + varstruct = ct.OF + + return [ + self.typed_op(SpaceOperation('malloc_varsize', + [ct, varstruct, Constant(sizefield), op.args[2]], + op.result), + [ctliteral, ctliteral, ctliteral, self.TInt], + self.annotation2concretetype(s_result)) + ] if op.opname in ('newtuple', 'newlist'): # operations that are controlled by their return type s_binding = self.annotator.binding(op.result, True) Modified: pypy/dist/pypy/translator/genc/ll_include.h ============================================================================== --- pypy/dist/pypy/translator/genc/ll_include.h (original) +++ pypy/dist/pypy/translator/genc/ll_include.h Thu May 12 01:22:17 2005 @@ -3,12 +3,41 @@ /*** C header subsection: operations on LowLevelTypes ***/ -/* XXX no reference counting */ +#define GCSTRUCT_TO_STRUCT(typename, p) (&(p)->data) + +#define STRUCT_TO_GCSTRUCT(typename, p) \ + ((typename##_gc*) (((char*)(p)) - offsetof(typename##_gc, data))) + +#define REFCNT(typename, p) STRUCT_TO_GCSTRUCT(typename, p)->refcount + +/* ____________________________________________________________ */ + + +#define OP_MALLOC(typename, r, err) { \ + typename##_gc *__block = (typename##_gc*) PyObject_Malloc( \ + sizeof(typename##_gc)); \ + printf("allocated %d bytes at %p\n", sizeof(typename##_gc), __block); \ + if (__block == NULL) { PyErr_NoMemory(); FAIL(err) } \ + __block->refcount = 1; \ + r = GCSTRUCT_TO_STRUCT(typename, __block); \ + memset((void*) r, 0, sizeof(typename)); \ + } + +#define OP_MALLOC_VARSIZE(typename, vartypename, sizefield, nsize, r, err) { \ + size_t memsize = sizeof(typename##_gc) + (nsize-1)*sizeof(vartypename); \ + typename##_gc *__block = (typename##_gc*) PyObject_Malloc(memsize); \ + printf("var-allocated %d bytes at %p\n", memsize, __block); \ + if (__block == NULL) { PyErr_NoMemory(); FAIL(err) } \ + memset((void*) __block, 0, memsize); \ + __block->refcount = 1; \ + r = GCSTRUCT_TO_STRUCT(typename, __block); \ + r->sizefield = nsize; \ + } +#define STRUCTFREE(typename, p) { \ + printf("freeing %p\n", STRUCT_TO_GCSTRUCT(typename, p)); \ + PyObject_Free(STRUCT_TO_GCSTRUCT(typename, p)); \ + } -#define OP_MALLOC(typename, r, err) \ - r = PyObject_Malloc(sizeof(typename)); \ - if (r == NULL) { PyErr_NoMemory(); FAIL(err) } \ - memset((void*) r, 0, sizeof(typename)); #define OP_GETFIELD(x, fieldname, r, err) r = x->fieldname; #define OP_SETFIELD(x, fieldname, val, r, err) x->fieldname = val; Modified: pypy/dist/pypy/translator/genc/lltype.py ============================================================================== --- pypy/dist/pypy/translator/genc/lltype.py (original) +++ pypy/dist/pypy/translator/genc/lltype.py Thu May 12 01:22:17 2005 @@ -22,16 +22,20 @@ def __init__(self, translator, lltype): super(CLLType, self).__init__(translator) self.lltype = lltype -## self.globaldecl = [] + self.globaldecl = [] def debugname(self): # a nice textual name for debugging... return str(self.lltype) -## def collect_globals(self, genc): -## result = self.globaldecl -## self.globaldecl = [] -## return result + def collect_globals(self, genc): + result = self.globaldecl + self.globaldecl = [] + return result + + +def needs_refcount(ct): + return isinstance(ct, CPtrType) and 'gc' in ct.lltype.flags class CPtrType(CLLType): @@ -48,8 +52,14 @@ def init_globals(self, genc): ct = ll2concretetype(genc.translator, self.lltype.TO) yield 'typedef %s* %s;' % (ct.typename, self.typename) - yield '#define OP_DECREF_%s(x) /* XXX nothing for now */' % ( - self.typename) + if 'gc' in self.lltype.flags: + yield '#define OP_INCREF_%s(p) if (p) REFCNT(%s, p)++;' % ( + self.typename, ct.typename) + yield '#define OP_DECREF_%s(p) if (p && !--REFCNT(%s, p)) %s(p);' %( + self.typename, ct.typename, ct.destructorname) + else: + yield '#define OP_INCREF_%s(p) /* no ref */' % self.typename + yield '#define OP_DECREF_%s(p) /* no ref */' % self.typename def spec_getattr(self, typer, op): v_ptr, v_attrname = op.args @@ -65,8 +75,13 @@ else: yield typer.typed_op(op, [self, cliteral], ctresult, newopname='getfield') + if needs_refcount(ctresult): + v = Variable() + yield typer.typed_op(SpaceOperation('incref', [op.result], v), + [ctresult], typer.TNone) def spec_setattr(self, typer, op): + # XXX refcounting v_ptr, v_attrname, v_value = op.args assert isinstance(v_attrname, Constant) attrname = v_attrname.value @@ -86,20 +101,47 @@ super(CStructType, self).__init__(translator, lltype) basename = lltype._name.translate(C_IDENTIFIER) self.typename = 'struct ll_%s%d' % (basename, CStructType.Counter) + self.destructorname = 'lldel_%s%d' % (basename, CStructType.Counter) CStructType.Counter += 1 def init_globals(self, genc): # make sure that the field types are defined before we use them lines = ['%s {' % self.typename] + destructorlines = [] for fieldname in self.lltype._names: T = self.lltype._flds[fieldname] ct = ll2concretetype(genc.translator, T) for line in genc.need_typedecl_now(ct): yield line lines.append('\t%s %s;' % (ct.typename, fieldname)) + if isinstance(ct, (CStructType, CArrayType)): + destructorlines.append('\tsubstruct_%s(&p->%s);' % ( + ct.destructorname, fieldname)) + elif needs_refcount(ct): + destructorlines.append('\tOP_DECREF_%s((p->%s))' % ( + ct.typename, fieldname)) lines.append('};') for line in lines: yield line + # declare the wrapper structure used by gc pointers + yield '%s_gc { int refcount; %s data; };' % ( + self.typename, self.typename) + # declare the destructor function + yield 'static void substruct_%s(%s *p);' % ( + self.destructorname, self.typename) + yield 'static void %s(%s *p);' % (self.destructorname, self.typename) + def gen(): + yield 'static void substruct_%s(%s *p) {' % ( + self.destructorname, self.typename) + for line in destructorlines: + yield line + yield '}' + yield 'static void %s(%s *p) {' % ( + self.destructorname, self.typename) + yield '\tsubstruct_%s(p);' % self.destructorname + yield '\tSTRUCTFREE(%s, p)' % self.typename + yield '}' + self.globaldecl += list(gen()) class CArrayType(CLLType): @@ -107,7 +149,8 @@ def __init__(self, translator, lltype): super(CArrayType, self).__init__(translator, lltype) - self.typename = 'struct array%d ' % CArrayType.Counter + self.typename = 'struct array%d' % CArrayType.Counter + self.destructorname = 'lldelarray%d' % CArrayType.Counter CArrayType.Counter += 1 def init_globals(self, genc): @@ -120,6 +163,26 @@ yield '\tlong size;' yield '\t%s items[1]; /* variable-sized */' % ct.typename yield '};' + # declare the wrapper structure used by gc pointers + yield '%s_gc { int refcount; %s data; };' % ( + self.typename, self.typename) + # declare the destructor function + yield 'static void substruct_%s(%s *p);' % ( + self.destructorname, self.typename) + yield 'static void %s(%s *p);' % (self.destructorname, self.typename) + def gen(): + yield 'static void substruct_%s(%s *p) {' % ( + self.destructorname, self.typename) + yield '\tint i = p->size;' + yield '\twhile (i--) {' + yield '\t\tsubstruct_%s(p->items+i);' % ct.destructorname + yield '\t}' + yield 'static void %s(%s *p) {' % ( + self.destructorname, self.typename) + yield '\tsubstruct_%s(p);' % self.destructorname + yield '\tSTRUCTFREE(%s, p)' % self.typename + yield '}' + self.globaldecl += list(gen()) # ____________________________________________________________ From pedronis at codespeak.net Thu May 12 13:01:13 2005 From: pedronis at codespeak.net (pedronis at codespeak.net) Date: Thu, 12 May 2005 13:01:13 +0200 (CEST) Subject: [pypy-svn] r12209 - pypy/dist/pypy/annotation Message-ID: <20050512110113.CEEF527BE4@code1.codespeak.net> Author: pedronis Date: Thu May 12 13:01:13 2005 New Revision: 12209 Modified: pypy/dist/pypy/annotation/builtin.py Log: XXX for current unicode annotation Modified: pypy/dist/pypy/annotation/builtin.py ============================================================================== --- pypy/dist/pypy/annotation/builtin.py (original) +++ pypy/dist/pypy/annotation/builtin.py Thu May 12 13:01:13 2005 @@ -42,7 +42,7 @@ def builtin_chr(s_int): return SomeChar() -def builtin_unicode(s_obj): +def builtin_unicode(s_obj): # XXX return SomeString() def our_issubclass(cls1, cls2): From pedronis at codespeak.net Thu May 12 13:06:58 2005 From: pedronis at codespeak.net (pedronis at codespeak.net) Date: Thu, 12 May 2005 13:06:58 +0200 (CEST) Subject: [pypy-svn] r12210 - in pypy/dist/pypy: annotation rpython/test Message-ID: <20050512110658.E6D2227BE4@code1.codespeak.net> Author: pedronis Date: Thu May 12 13:06:58 2005 New Revision: 12210 Modified: pypy/dist/pypy/annotation/unaryop.py pypy/dist/pypy/rpython/test/test_llann.py Log: same semantics as concrete impl len for ptrs, test Modified: pypy/dist/pypy/annotation/unaryop.py ============================================================================== --- pypy/dist/pypy/annotation/unaryop.py (original) +++ pypy/dist/pypy/annotation/unaryop.py Thu May 12 13:06:58 2005 @@ -434,6 +434,9 @@ v = getattr(p.ll_ptrtype._example(), s_attr.const) return ll_to_annotation(v) + def len(p): + return ll_to_annotation(len(p.ll_ptrtype._example())) + def setattr(p, s_attr, s_value): # just doing checking assert s_attr.is_constant(), "getattr on ptr %r with non-constant field-name" % p.ll_ptrtype v_lltype = annotation_to_lltype(s_value) Modified: pypy/dist/pypy/rpython/test/test_llann.py ============================================================================== --- pypy/dist/pypy/rpython/test/test_llann.py (original) +++ pypy/dist/pypy/rpython/test/test_llann.py Thu May 12 13:06:58 2005 @@ -60,3 +60,12 @@ s = a.build_types(llf, []) assert isinstance(s, annmodel.SomePtr) assert s.ll_ptrtype == GCPS1 + + def test_array_length(self): + A = Array(('v', Signed)) + def llf(): + a = malloc(A, 1) + return len(a) + a = self.RPythonAnnotator() + s = a.build_types(llf, []) + assert s.knowntype == int From pedronis at codespeak.net Thu May 12 13:15:51 2005 From: pedronis at codespeak.net (pedronis at codespeak.net) Date: Thu, 12 May 2005 13:15:51 +0200 (CEST) Subject: [pypy-svn] r12211 - pypy/dist/pypy/annotation Message-ID: <20050512111551.26C2C27BE4@code1.codespeak.net> Author: pedronis Date: Thu May 12 13:15:50 2005 New Revision: 12211 Modified: pypy/dist/pypy/annotation/bookkeeper.py Log: valueoftype impl for low-level types Modified: pypy/dist/pypy/annotation/bookkeeper.py ============================================================================== --- pypy/dist/pypy/annotation/bookkeeper.py (original) +++ pypy/dist/pypy/annotation/bookkeeper.py Thu May 12 13:15:50 2005 @@ -15,6 +15,7 @@ from pypy.interpreter.pycode import cpython_code_signature from pypy.interpreter.argument import ArgErr from pypy.rpython.rarithmetic import r_uint +from pypy.rpython import lltypes from pypy.tool.unionfind import UnionFind import inspect, new @@ -144,6 +145,8 @@ values_s = [self.immutablevalue(e) for e in x.values()] result = SomeDict(DictDef(self, unionof(*keys_s), unionof(*values_s))) + elif isinstance(x, lltypes.LowLevelType): + result = ll_to_annotation(x._example()) elif ishashable(x) and x in BUILTIN_ANALYZERS: result = SomeBuiltin(BUILTIN_ANALYZERS[x]) elif callable(x) or isinstance(x, staticmethod): # XXX @@ -206,6 +209,8 @@ def valueoftype(self, t): """The most precise SomeValue instance that contains all objects of type t.""" + if isinstance(t, lltypes.LowLevelType): + return ll_to_annotation(t._example()) assert isinstance(t, (type, ClassType)) if t is bool: return SomeBool() @@ -221,7 +226,7 @@ return SomeList(MOST_GENERAL_LISTDEF) elif t is dict: return SomeDict(MOST_GENERAL_DICTDEF) - # can't do dict, tuple + # can't do tuple elif t.__module__ != '__builtin__': classdef = self.getclassdef(t) return SomeInstance(classdef) From pedronis at codespeak.net Thu May 12 13:34:14 2005 From: pedronis at codespeak.net (pedronis at codespeak.net) Date: Thu, 12 May 2005 13:34:14 +0200 (CEST) Subject: [pypy-svn] r12212 - pypy/dist/pypy/annotation Message-ID: <20050512113414.F001027BE4@code1.codespeak.net> Author: pedronis Date: Thu May 12 13:34:14 2005 New Revision: 12212 Modified: pypy/dist/pypy/annotation/binaryop.py pypy/dist/pypy/annotation/bookkeeper.py Log: * oops, last checkin had some non-sense lines in it... * string with len==1 -> SomeChar Modified: pypy/dist/pypy/annotation/binaryop.py ============================================================================== --- pypy/dist/pypy/annotation/binaryop.py (original) +++ pypy/dist/pypy/annotation/binaryop.py Thu May 12 13:34:14 2005 @@ -228,6 +228,10 @@ def add((str1, str2)): return SomeString() +class __extend__(pairtype(SomeChar, SomeChar)): + + def union((chr1, chr2)): + return SomeChar() class __extend__(pairtype(SomeString, SomeObject)): Modified: pypy/dist/pypy/annotation/bookkeeper.py ============================================================================== --- pypy/dist/pypy/annotation/bookkeeper.py (original) +++ pypy/dist/pypy/annotation/bookkeeper.py Thu May 12 13:34:14 2005 @@ -132,7 +132,10 @@ elif tp is r_uint: result = SomeInteger(nonneg = True, unsigned = True) elif issubclass(tp, str): # py.lib uses annotated str subclasses - result = SomeString() + if len(x) == 1: + result = SomeChar() + else: + result = SomeString() elif tp is tuple: result = SomeTuple(items = [self.immutablevalue(e) for e in x]) elif tp is float: @@ -145,8 +148,6 @@ values_s = [self.immutablevalue(e) for e in x.values()] result = SomeDict(DictDef(self, unionof(*keys_s), unionof(*values_s))) - elif isinstance(x, lltypes.LowLevelType): - result = ll_to_annotation(x._example()) elif ishashable(x) and x in BUILTIN_ANALYZERS: result = SomeBuiltin(BUILTIN_ANALYZERS[x]) elif callable(x) or isinstance(x, staticmethod): # XXX From arigo at codespeak.net Thu May 12 13:42:06 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Thu, 12 May 2005 13:42:06 +0200 (CEST) Subject: [pypy-svn] r12213 - in pypy/dist/pypy/rpython: . test Message-ID: <20050512114206.5966427BE7@code1.codespeak.net> Author: arigo Date: Thu May 12 13:42:06 2005 New Revision: 12213 Modified: pypy/dist/pypy/rpython/lltypes.py pypy/dist/pypy/rpython/test/test_lltypes.py Log: Check that we don't try to inline a var-sized struct in another struct. Modified: pypy/dist/pypy/rpython/lltypes.py ============================================================================== --- pypy/dist/pypy/rpython/lltypes.py (original) +++ pypy/dist/pypy/rpython/lltypes.py Thu May 12 13:42:06 2005 @@ -52,6 +52,9 @@ if name in flds: raise TypeError("%s: repeated field name" % self._name) flds[name] = typ + if isinstance(typ, Struct) and typ._arrayfld: + raise TypeError("cannot inline a var-sized struct " + "inside another struct") # look if we have an inlined variable-sized array as the last field if fields: for name, typ in fields[:-1]: Modified: pypy/dist/pypy/rpython/test/test_lltypes.py ============================================================================== --- pypy/dist/pypy/rpython/test/test_lltypes.py (original) +++ pypy/dist/pypy/rpython/test/test_lltypes.py Thu May 12 13:42:06 2005 @@ -105,6 +105,7 @@ assert s1.rest[3].v == 5 py.test.raises(TypeError, "Struct('invalid', ('rest', Array(('v', Signed))), ('a', Signed))") + py.test.raises(TypeError, "Struct('invalid', ('x', S1))") def test_substructure_ptr(): S2 = Struct("s2", ('a', Signed)) From pedronis at codespeak.net Thu May 12 14:44:07 2005 From: pedronis at codespeak.net (pedronis at codespeak.net) Date: Thu, 12 May 2005 14:44:07 +0200 (CEST) Subject: [pypy-svn] r12216 - in pypy/dist/pypy/rpython: . test Message-ID: <20050512124407.CB51027BFB@code1.codespeak.net> Author: pedronis Date: Thu May 12 14:44:07 2005 New Revision: 12216 Modified: pypy/dist/pypy/rpython/lltypes.py pypy/dist/pypy/rpython/test/test_lltypes.py Log: support for expressing functions&function pointers Modified: pypy/dist/pypy/rpython/lltypes.py ============================================================================== --- pypy/dist/pypy/rpython/lltypes.py (original) +++ pypy/dist/pypy/rpython/lltypes.py Thu May 12 14:44:07 2005 @@ -33,9 +33,13 @@ def _freeze_(self): return True + def _inline_is_varsize(self, last): + return False + class ContainerType(LowLevelType): - pass + def _inline_is_varsize(self, last): + raise TypeError, "%r cannot be inlined in structure" % self class Struct(ContainerType): @@ -52,20 +56,23 @@ if name in flds: raise TypeError("%s: repeated field name" % self._name) flds[name] = typ - if isinstance(typ, Struct) and typ._arrayfld: - raise TypeError("cannot inline a var-sized struct " - "inside another struct") + # look if we have an inlined variable-sized array as the last field if fields: for name, typ in fields[:-1]: - if isinstance(typ, Array): - raise TypeError("%s: array field must be last") + typ._inline_is_varsize(False) name, typ = fields[-1] - if isinstance(typ, Array): + if typ._inline_is_varsize(True): self._arrayfld = name self._flds = frozendict(flds) self._names = tuple(names) + def _inline_is_varsize(self, last): + if self._arrayfld: + raise TypeError("cannot inline a var-sized struct " + "inside another struct") + return False + def __getattr__(self, name): try: return self._flds[name] @@ -96,12 +103,36 @@ if self.OF._arrayfld is not None: raise TypeError("array cannot contain an inlined array") + def _inline_is_varsize(self, last): + if not last: + raise TypeError("array field must be last") + return True + def __str__(self): return "Array of { %s }" % (self.OF._str_fields(),) def _container_example(self): return _array(self, 1) +class FuncType(ContainerType): + def __init__(self, args, result): + for arg in args: + if isinstance(arg, ContainerType): + raise TypeError, "function arguments can only be primitives or pointers" + self.ARGS = tuple(args) + if isinstance(result, ContainerType): + raise TypeError, "function result can only be primitive or pointer" + self.RESULT = result + + def __str__(self): + args = ', '.join(map(str, self.ARGS)) + return "Func ( %s ) -> %s" % (args, self.RESULT) + + def _container_example(self): + def ex(*args): + return self.RESULT._example() + return _func(self, _callable=ex) + class Primitive(LowLevelType): def __init__(self, name, default): @@ -127,10 +158,12 @@ class _PtrType(LowLevelType): def __init__(self, TO, **flags): if not isinstance(TO, ContainerType): - raise TypeError, ("can only point to a Struct or an Array, " + raise TypeError, ("can only point to a Struct or an Array or a FuncType, " "not to %s" % (TO,)) self.TO = TO self.flags = frozendict(flags) + if isinstance(TO, FuncType) and 'gc' in self.flags: + raise TypeError, "function pointers are not gc-able" def _str_flags(self): flags = self.flags.keys() @@ -231,6 +264,7 @@ """XXX A nice docstring here""" T = typeOf(val) if isinstance(T, ContainerType): + assert not isinstance(T, FuncType), "functions cannot be substructures" if can_have_gc and isinstance(T, Struct): val = _ptr(GcPtr(T), val) else: @@ -321,6 +355,17 @@ def __str__(self): return '%s to %s' % (self._TYPE.__class__.__name__.lower(), self._obj) + def __call__(self, *args): + if isinstance(self._T, FuncType): + self._check() + if len(args) != len(self._T.ARGS): + raise TypeError,"calling %r with wrong argument number: %r" % (self._T, args) + for a, ARG in zip(args, self._T.ARGS): + if typeOf(a) != ARG: + raise TypeError,"calling %r with wrong argument types: %r" % (self._T, args) + return self._obj._callable(*args) + raise TypeError("%r instance is not a function" % (self._T,)) + class _struct(object): _wrparent = None @@ -402,6 +447,22 @@ return 'array [ %s ]' % (', '.join(['{%s}' % item._str_fields() for item in self.items]),) +class _func(object): + def __init__(self, TYPE, **attrs): + self._TYPE = TYPE + self._name = "?" + self._callable = None + self.__dict__.update(attrs) + + def _check(self): + if self._callable is None: + raise RuntimeError,"calling undefined function" + + def __repr__(self): + return '<%s>' % (self,) + + def __str__(self): + return "func %s" % self._name def malloc(T, n=None): if isinstance(T, Struct): Modified: pypy/dist/pypy/rpython/test/test_lltypes.py ============================================================================== --- pypy/dist/pypy/rpython/test/test_lltypes.py (original) +++ pypy/dist/pypy/rpython/test/test_lltypes.py Thu May 12 14:44:07 2005 @@ -209,3 +209,14 @@ assert ex_ps.v == 0 assert ex_pst.v == 0 assert ex_pst.trail[0].v == 0 + +def test_functions(): + F = FuncType((Signed,), Signed) + py.test.raises(TypeError, "Struct('x', ('x', F))") + + PF = NonGcPtr(F) + pf = PF._example() + assert pf(0) == 0 + py.test.raises(TypeError, pf, 0, 0) + py.test.raises(TypeError, pf, 'a') + From pedronis at codespeak.net Thu May 12 15:41:57 2005 From: pedronis at codespeak.net (pedronis at codespeak.net) Date: Thu, 12 May 2005 15:41:57 +0200 (CEST) Subject: [pypy-svn] r12219 - in pypy/dist/pypy: annotation rpython/test Message-ID: <20050512134157.C368427BFB@code1.codespeak.net> Author: pedronis Date: Thu May 12 15:41:57 2005 New Revision: 12219 Modified: pypy/dist/pypy/annotation/unaryop.py pypy/dist/pypy/rpython/test/test_llann.py Log: annotation for calls to func ptrs Modified: pypy/dist/pypy/annotation/unaryop.py ============================================================================== --- pypy/dist/pypy/annotation/unaryop.py (original) +++ pypy/dist/pypy/annotation/unaryop.py Thu May 12 15:41:57 2005 @@ -442,3 +442,8 @@ v_lltype = annotation_to_lltype(s_value) setattr(p.ll_ptrtype._example(), s_attr.const, v_lltype._example()) + + def simple_call(p, *args_s): + llargs = [annotation_to_lltype(arg_s)._example() for arg_s in args_s] + v = p.ll_ptrtype._example()(*llargs) + return ll_to_annotation(v) Modified: pypy/dist/pypy/rpython/test/test_llann.py ============================================================================== --- pypy/dist/pypy/rpython/test/test_llann.py (original) +++ pypy/dist/pypy/rpython/test/test_llann.py Thu May 12 15:41:57 2005 @@ -69,3 +69,13 @@ a = self.RPythonAnnotator() s = a.build_types(llf, []) assert s.knowntype == int + + def test_funcptr(self): + F = FuncType((Signed,), Signed) + PF = NonGcPtr(F) + def llf(p): + return p(0) + a = self.RPythonAnnotator() + s = a.build_types(llf, [PF]) + assert s.knowntype == int + From arigo at codespeak.net Thu May 12 19:41:41 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Thu, 12 May 2005 19:41:41 +0200 (CEST) Subject: [pypy-svn] r12224 - in pypy/dist/pypy: annotation rpython rpython/test translator translator/genc translator/tool Message-ID: <20050512174141.2839627BE4@code1.codespeak.net> Author: arigo Date: Thu May 12 19:41:40 2005 New Revision: 12224 Added: pypy/dist/pypy/rpython/rlist.py (contents, props changed) pypy/dist/pypy/rpython/test/test_rlist.py (contents, props changed) pypy/dist/pypy/rpython/test/test_typer.py (contents, props changed) pypy/dist/pypy/rpython/typer.py (contents, props changed) Modified: pypy/dist/pypy/annotation/model.py pypy/dist/pypy/rpython/lltypes.py pypy/dist/pypy/translator/genc/basetype.py pypy/dist/pypy/translator/tool/graphpage.py pypy/dist/pypy/translator/typer.py Log: Started to write a Typer for the low-level types. The goal is to get rid of the CTyper, but we can still use the abstract base Typer. - new low-level types: PyObject (as an opaque container, not a pointer) and ForwardReference, used temporarily while building recursive data structures. - started the implementation of the RPython list. - minor changes in translator/ to accomodate our new stuff. Modified: pypy/dist/pypy/annotation/model.py ============================================================================== --- pypy/dist/pypy/annotation/model.py (original) +++ pypy/dist/pypy/annotation/model.py Thu May 12 19:41:40 2005 @@ -283,14 +283,18 @@ (SomeChar(), lltypes.Char), ] -def annotation_to_lltype(s_val): +def annotation_to_lltype(s_val, info=None): if isinstance(s_val, SomePtr): return s_val.ll_ptrtype for witness, lltype in annotation_to_ll_map: if witness.contains(s_val): return lltype - raise AssertionError("trying find a matching low-level type for unexpected" - "%r" % s_val) + if info is None: + info = '' + else: + info = '%s: ' % info + raise ValueError("%sshould return a low-level type,\ngot instead %r" % ( + info, s_val)) ll_to_annotation_map = dict([(ll, ann) for ann,ll in annotation_to_ll_map]) Modified: pypy/dist/pypy/rpython/lltypes.py ============================================================================== --- pypy/dist/pypy/rpython/lltypes.py (original) +++ pypy/dist/pypy/rpython/lltypes.py Thu May 12 19:41:40 2005 @@ -132,7 +132,17 @@ def ex(*args): return self.RESULT._example() return _func(self, _callable=ex) - + +class PyObjectType(ContainerType): + def __str__(self): + return "PyObject" +PyObject = PyObjectType() + +class ForwardReference(ContainerType): + def become(self, realcontainertype): + self.__class__ = realcontainertype.__class__ + self.__dict__ = realcontainertype.__dict__ + class Primitive(LowLevelType): def __init__(self, name, default): Added: pypy/dist/pypy/rpython/rlist.py ============================================================================== --- (empty file) +++ pypy/dist/pypy/rpython/rlist.py Thu May 12 19:41:40 2005 @@ -0,0 +1,68 @@ +import py +from pypy.annotation.model import * +from pypy.rpython.lltypes import * + + +def substitute_newlist(typer, op): + s_result = typer.annotator.binding(op.result) + LIST = getlisttype(typer, s_result) + T = getlistitemtype(typer, s_result) + n = len(op.args) + inputsignature = (T,) * n + try: + newlist = typer.newlistcache[LIST, n] + except KeyError: + # Make an implementation of newlist(x1,..,xn) which allocates + # a list with n elements and initialize them. + + args = ', '.join(['arg%d' % i for i in range(n)]) + lines = [] + lines.append( 'def newlist(%s):' % args) + lines.append( ' l = malloc(List_typ)') + lines.append( ' l.items = malloc(List_typ.items.TO, %d)' % n) + for i in range(n): + lines.append(' l.items[%d].item = arg%d' % (i, i)) + lines.append( ' return l') + lines.append( '') + miniglobal = {'List_typ': LIST.TO, 'malloc': malloc} + exec py.code.Source('\n'.join(lines)).compile() in miniglobal + newlist = typer.newlistcache[LIST, n] = miniglobal['newlist'] + return typer.substitute_op(op, (newlist,) + inputsignature + (LIST,)) + +def getlisttype(typer, s_list): + assert isinstance(s_list, SomeList) + listdef = s_list.listdef + try: + return typer.listtypecache[listdef] + except KeyError: + List_typ = ForwardReference() + result = typer.listtypecache[listdef] = GcPtr(List_typ) + define_list(typer, s_list, List_typ) + return result + +def getlistitemtype(typer, s_list): + return typer.annotation2concretetype(s_list.listdef.listitem.s_value) + + +def define_list(typer, s_list, List_typ): + T = getlistitemtype(typer, s_list) + List_typ.become(Struct("list", + ("items", GcPtr(Array(('item',T)))))) + + def getitem(l, i): + return l.items[i].item + + typer['getitem', s_list, SomeInteger()] = ( + getitem, GcPtr(List_typ), Signed, T) + +## def append(l, newitem): +## length = len(l.items) +## newitems = malloc(List_typ.items.TO, length+1) +## i = 0 +## while i len(op.args): + continue + elif len(pattern) != len(op.args): + continue + for s_match, s_value in zip(pattern, bindings): + if not s_match.contains(s_value): + break + else: + # match! + return self.substitute_op(op, substitution) + # specialization not found + argtypes = [self.defaultconcretetype] * len(op.args) + return self.typed_op(op, argtypes, self.defaultconcretetype) + + def substitute_op(self, op, substitution): + if isinstance(substitution, tuple): + newopname = substitution[0] + argtypes = substitution[1:-1] + resulttype = substitution[-1] + assert len(argtypes) == len(op.args) + # None in the substitution list means "remove this argument" + while None in argtypes: + argtypes = list(argtypes) + i = argtypes.index(None) + del argtypes[i] + args = list(op.args) + del args[i] + op = SpaceOperation(op.opname, args, op.result) + return self.typed_op(op, argtypes, resulttype, + newopname = newopname) + else: + assert callable(substitution), "type error in the registry tables" + return substitution(self, op) + + def typed_op(self, op, argtypes, restype, newopname=None): + if isinstance(newopname, types.FunctionType): + python_function = newopname + newargs = [Constant(python_function)] + op.args + op = SpaceOperation('simple_call', newargs, op.result) + try: + functyp = python_function.TYPE + except AttributeError: + s_returnvalue = self.annotator.build_types(python_function, + argtypes) + inferred_type = annotation_to_lltype(s_returnvalue, + info=python_function) + if inferred_type != restype: + raise TyperError("%r return type mismatch:\n" + "declared %r\n" + "inferred %r" % (python_function, + inferred_type, restype)) + functyp = NonGcPtr(FuncType(argtypes, restype)) + python_function.TYPE = functyp + argtypes = [functyp] + list(argtypes) + newopname = None + return Specializer.typed_op(self, op, argtypes, restype, newopname) + + +def substitute_malloc(typer, op): + s_result = typer.annotator.binding(op.result) + T = annotation_to_lltype(s_result, 'malloc') + if len(op.args) == 2: + substitution = 'malloc', None, Void, T + else: + substitution = 'malloc_varsize', None, Void, Signed, T + return typer.substitute_op(op, substitution) Modified: pypy/dist/pypy/translator/genc/basetype.py ============================================================================== --- pypy/dist/pypy/translator/genc/basetype.py (original) +++ pypy/dist/pypy/translator/genc/basetype.py Thu May 12 19:41:40 2005 @@ -10,6 +10,9 @@ def debugname(self): return self.typename + def __str__(self): + return self.debugname() + def genc(): """A hack to get at the currently running GenC instance.""" from pypy.translator.genc.genc import TLS Modified: pypy/dist/pypy/translator/tool/graphpage.py ============================================================================== --- pypy/dist/pypy/translator/tool/graphpage.py (original) +++ pypy/dist/pypy/translator/tool/graphpage.py Thu May 12 19:41:40 2005 @@ -128,9 +128,8 @@ if isinstance(node, Block): for var in node.getvariables(): if hasattr(var, 'concretetype'): - typename = var.concretetype.debugname() info = self.links.get(var.name, var.name) - info = '(%s) %s' % (typename, info) + info = '(%s) %s' % (var.concretetype, info) self.links[var.name] = info for graph in graphs: traverse(visit, graph) Modified: pypy/dist/pypy/translator/typer.py ============================================================================== --- pypy/dist/pypy/translator/typer.py (original) +++ pypy/dist/pypy/translator/typer.py Thu May 12 19:41:40 2005 @@ -29,9 +29,18 @@ self.specializationdict = d def specialize(self): - for block in self.annotator.annotated: - if block.operations != (): - self.specialize_block(block) + """Main entry point: specialize all annotated blocks of the program.""" + # new blocks can be created as a result of specialize_block(), so + # we need to be careful about the loop here. + already_seen = {} + pending = self.annotator.annotated.keys() + while pending: + for block in pending: + if block.operations != (): + self.specialize_block(block) + already_seen[block] = True + pending = [block for block in self.annotator.annotated + if block not in already_seen] def settype(self, a, concretetype): """Set the concretetype of a Variable.""" From ale at codespeak.net Fri May 13 12:39:48 2005 From: ale at codespeak.net (ale at codespeak.net) Date: Fri, 13 May 2005 12:39:48 +0200 (CEST) Subject: [pypy-svn] r12232 - pypy/dist/pypy/lib Message-ID: <20050513103948.6C15527B95@code1.codespeak.net> Author: ale Date: Fri May 13 12:39:48 2005 New Revision: 12232 Modified: pypy/dist/pypy/lib/inprogress__codecs.py pypy/dist/pypy/lib/unicodecodec.py Log: All functions of the _codecsmodule.c is now exposed by _codecs.py. All the codecs exposed by _codecs.py is now implemented in unicodecodec.py. Unfortunately a lot of the codecs testing is done in test_unicode.py which doesn' work for obvious reasons, so the test coverage is rather poor. Modified: pypy/dist/pypy/lib/inprogress__codecs.py ============================================================================== --- pypy/dist/pypy/lib/inprogress__codecs.py (original) +++ pypy/dist/pypy/lib/inprogress__codecs.py Fri May 13 12:39:48 2005 @@ -34,7 +34,7 @@ Copyright (c) Corporation for National Research Initiatives. """ -from unicodecodec import * +from unicodecodec_ import * #/* --- Registry ----------------------------------------------------------- */ codec_search_path = [] @@ -107,6 +107,7 @@ """None """ res = PyUnicode_EncodeLatin1(obj,len(obj),errors) + res = ''.join(res) return res, len(res) # XXX MBCS codec might involve ctypes ? def mbcs_decode(): @@ -131,53 +132,65 @@ """None """ res = PyUnicode_DecodeUTF8Stateful(data, len(data), errors, final) + res = ''.join(res) return res,len(res) def raw_unicode_escape_decode( data,errors='strict'): """None """ res = PyUnicode_DecodeRawUnicodeEscape(data, len(data), errors) + res = ''.join(res) return res,len(res) def utf_7_decode( data,errors='strict'): """None """ - unistr = PyUnicode_DecodeUTF7(data,errors='strict') - return unistr,len(unistr) -# XXX unicode_escape_encode + res = PyUnicode_DecodeUTF7(data,errors='strict') + res = ''.join(res) + return res,len(res) + def unicode_escape_encode( obj,errors='strict'): """None """ - pass -# XXX latin_1_decode + res = PyUnicode_EncodeUnicodeEscape(data,len(data),errors) + res = ''.join(res) + return res, len(res) + def latin_1_decode( data,errors='strict'): """None """ - pass -# XXX utf_16_decode -def utf_16_decode( data,errors='strict'): + res = PyUnicode_DecodeLatin1(data,len(data),errors) + res = ''.join(res) + return res, len(res) + +def utf_16_decode( data,errors='strict',final=None): """None """ - pass + res = PyUnicode_DecodeUTF16Stateful(data,len(data),errors) + res = ''.join(res) + return res, len(res) def unicode_escape_decode( data,errors='strict'): """None """ - unistr = PyUnicode_DecodeUnicodeEscape(data,len(data),errors) - return unistr,len(unistr) + res = PyUnicode_DecodeUnicodeEscape(data,len(data),errors) + res = ''.join(res) + return res, len(res) def ascii_decode( data,errors='strict'): """None """ res = PyUnicode_DecodeASCII(data,len(data),errors) - return res,len(res) + res = ''.join(res) + return res, len(res) def charmap_encode(obj,errors='strict',mapping='latin-1'): """None """ res = PyUnicode_EncodeCharmap(obj,len(obj),mapping,errors) - return res,len(res) + res = ''.join(res) + return res, len(res) def unicode_internal_encode( obj,errors='strict'): """None @@ -185,12 +198,14 @@ if type(obj) == unicode: return obj, len(obj) else: - return PyUnicode_FromUnicode(obj,size),size -# XXX utf_16_ex_decode + return ''.join(PyUnicode_FromUnicode(obj,size),size) + def utf_16_ex_decode( data,errors='strict'): """None """ - pass + res = PyUnicode_DecodeUTF16Stateful(data,len(data),errors,'native') + res = ''.join(res) + return res, len(res) # XXX escape_decode Check if this is right def escape_decode(data,errors='strict'): """None @@ -201,20 +216,23 @@ """None """ res = str(obj) - return res,len(res) + res = ''.join(res) + return res, len(res) def charmap_decode( data,errors='strict',mapping=None): """None """ res = PyUnicode_DecodeCharmap(data, len(data), mapping, errors) - return res,len(res) + res = ''.join(res) + return res, len(res) def utf_7_encode( obj,errors='strict'): """None """ res = PyUnicode_EncodeUTF7(obj,len(obj),0,0,errors) - return res,len(res) + res = ''.join(res) + return res, len(res) def mbcs_encode( obj,errors='strict'): """None @@ -230,40 +248,43 @@ """None """ res = PyUnicode_EncodeASCII(obj,len(obj),errors) - return res,len(res) -##(PyUnicode_EncodeASCII( -## PyUnicode_AS_UNICODE(obj), -## PyUnicode_GET_SIZE(obj), -## errors), -## PyUnicode_GET_SIZE(obj)) + res = ''.join(res) + return res, len(res) def utf_16_encode( obj,errors='strict'): """None """ - u = PyUnicode_EncodeUTF16(obj,len(obj),errors) - return u,len(u) + res = PyUnicode_EncodeUTF16(obj,len(obj),errors) + res = ''.join(res) + return res, len(res) def raw_unicode_escape_encode( obj,errors='strict'): """None """ res = PyUnicode_EncodeRawUnicodeEscape(obj,len(obj)) - return res,len(res) + res = ''.join(res) + return res, len(res) def utf_8_encode( obj,errors='strict'): """None """ res = PyUnicode_EncodeUTF8(obj,len(obj),errors) - return res,len(res) -# XXX utf_16_le_encode + res = ''.join(res) + return res, len(res) + def utf_16_le_encode( obj,errors='strict'): """None """ - pass -# XXX utf_16_be_encode + res = PyUnicode_EncodeUTF16(obj,len(obj),errors,'little') + res = ''.join(res) + return res, len(res) + def utf_16_be_encode( obj,errors='strict'): """None """ - pass + res = PyUnicode_EncodeUTF16(obj,len(obj),errors,'big') + res = ''.join(res) + return res, len(res) def unicode_internal_decode( unistr,errors='strict'): """None @@ -272,16 +293,20 @@ return unistr,len(unistr) else: return unicode(unistr),len(unistr) -# XXX utf_16_le_decode + def utf_16_le_decode( data,errors='strict'): """None """ - pass -# XXX utf_16_be_decode + res = PyUnicode_DecodeUTF16Stateful(data,len(data),errors,'little') + res = ''.join(res) + return res, len(res) + def utf_16_be_decode( data,errors='strict'): """None """ - pass + res = PyUnicode_DecodeUTF16Stateful(data,len(data),errors,'big') + res = ''.join(res) + return res, len(res) def strict_errors(exc): if isinstance(exc,Exception): Modified: pypy/dist/pypy/lib/unicodecodec.py ============================================================================== --- pypy/dist/pypy/lib/unicodecodec.py (original) +++ pypy/dist/pypy/lib/unicodecodec.py Fri May 13 12:39:48 2005 @@ -1,4 +1,12 @@ import sys +""" Python implementation of CPythons builtin unicode codecs. + + Generally the functions in this module take a list of characters an returns + a list of characters. + + For use in the PyPy project""" + + ## indicate whether a UTF-7 character is special i.e. cannot be directly ## encoded: ## 0 - not special @@ -16,7 +24,7 @@ 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 1, 1, ] -unicode_latin1=[] +unicode_latin1=[None]*256 codec_error_registry = {} def lookup_error(errors): @@ -46,8 +54,6 @@ else: raise TypeError("handler must be callable") -for i in range(256): - unicode_latin1.append(None) def PyUnicode_Check(op): return type(op) == unicode @@ -85,17 +91,19 @@ else: return ord(c) + 4 -def ENCODE(out, ch, bits) : +def ENCODE( ch, bits) : charvalue = 0 + out = [] for c in ch: charvalue <<= 16 charvalue += ord(c) while (bits >= 6): out += B64(charvalue >> (bits-6)) bits -= 6; - return out,ch,bits + return out,bits -def DECODE(out, ch, bits, surrogate): +def DECODE( ch, bits, surrogate): + out = [] while (bits >= 16): outCh = unicode (chr((ord(ch) >> (bits-16)) & 0xffff)) bits -= 16 @@ -110,7 +118,7 @@ raise UnicodeDecodeError,"code pairs are not supported" else: out += outCh - return ''.join(out),ch,bits,surrogate + return out,bits,surrogate def PyUnicode_DecodeUTF7(s, size, errors): @@ -134,7 +142,8 @@ if ((ch == '-') or not B64CHAR(ch)): inShift = 0 i += 1 - p, charsleft, bitsleft, surrogate = DECODE(p, charsleft, bitsleft, surrogate); + out, bitsleft, surrogate = DECODE(charsleft, bitsleft, surrogate) + p += out if (bitsleft >= 6): ## /* The shift sequence has a partial character in it. If ## bitsleft < 6 then we could just classify it as padding @@ -185,7 +194,7 @@ endinpos = size; raise UnicodeDecodeError, "unterminated shift sequence" - return unicode(''.join(p)) + return p def PyUnicode_EncodeUTF7(s, size, encodeSetO, encodeWhiteSpace, errors): @@ -204,7 +213,8 @@ charsleft = ch bitsleft = 16 out += '+' - out, charsleft, bitsleft = ENCODE(out, charsleft, bitsleft) + p, bitsleft = ENCODE( charsleft, bitsleft) + out += p inShift = bitsleft > 0 else: out += ch @@ -249,7 +259,7 @@ out += [B64(ord(cc) << (6-bitsleft) ) for cc in charsleft] out += '-' - return ''.join(out) + return out def PyUnicode_FromOrdinal(ordinal): @@ -289,14 +299,6 @@ ## /* Single character Unicode objects in the Latin-1 range are ## shared when using this constructor */ - if (size == 1 and ord(u) < 256) : - result = unicode_latin1[ord(u)] - if (not result): - result = unicode(u) - unicode_latin1[ord(u)] = result - if (not result): - return None - return result return unicode(u) def PyUnicode_Decode(s,size,encoding,errors): @@ -321,6 +323,80 @@ v = PyUnicode_Decode(s, len(s), encoding, errors) return v +def unicodeescape_string(s, size, quotes): + + + p = [] + if (quotes) : + p += 'u' + if (s.find('\'')!=-1 and s.find('"')==-1): + p += '"' + else: + p += '\'' + pos = 0 + while (pos < size): + ch = s[pos] + #/* Escape quotes */ + if (quotes and (ch == p[1] or ch == '\\')): + p += '\\' + p += ch + continue + +#ifdef Py_UNICODE_WIDE + #/* Map 21-bit characters to '\U00xxxxxx' */ + elif (ord(ch) >= 0x10000): + p += '\\' + p += 'U' + p += '%08x'%ord(ch) + continue +#endif + #/* Map UTF-16 surrogate pairs to Unicode \UXXXXXXXX escapes */ + elif (ord(ch) >= 0xD800 and ord(ch) < 0xDC00): + pos += 1 + ch2 = s[pos] + + if (ord(ch2) >= 0xDC00 and ord(ch2) <= 0xDFFF): + ucs = (((ord(ch) & 0x03FF) << 10) | (ord(ch2) & 0x03FF)) + 0x00010000 + p += '\\' + p += 'U' + p += '%08x'%ucs + continue + + #/* Fall through: isolated surrogates are copied as-is */ + pos -= 1 + + #/* Map 16-bit characters to '\uxxxx' */ + if (ord(ch) >= 256): + p += '\\' + p += 'u' + p += '%04x'%ord(ch) + + #/* Map special whitespace to '\t', \n', '\r' */ + elif (ch == '\t'): + p += '\\' + p += 't' + + elif (ch == '\n'): + p += '\\' + p += 'n' + + elif (ch == '\r'): + p += '\\' + p += 'r' + + #/* Map non-printable US ASCII to '\xhh' */ + elif (ch < ' ' or ch >= 0x7F) : + p += '\\' + p += 'x' + p += '%02x'%ord(ch) + #/* Copy everything else as-is */ + else: + p += ch + + if (quotes): + p += p[1] + return p + def PyUnicode_DecodeASCII(s, size, errors): # /* ASCII is equivalent to the first 128 ordinals in Unicode. */ @@ -336,16 +412,17 @@ p += c pos += 1 else: + res = unicode_call_errorhandler( errors, "ascii", "ordinal not in range(128)", s, pos, pos+1) p += res[0] pos = res[1] - return ''.join(p) #(encoding,p,collstart,collend,reason) + return p def PyUnicode_EncodeASCII(p,size,errors): - return u''.join(unicode_encode_ucs1(p, size, errors, 128)) + return unicode_encode_ucs1(p, size, errors, 128) def PyUnicode_AsASCIIString(unistr): @@ -355,159 +432,119 @@ len(unicode), None) -##def PyUnicode_DecodeUTF16Stateful(s,size,errors,byteorder,consumed): -## -## bo = 0; /* assume native ordering by default */ -## errmsg = ""; -## /* Offsets from q for retrieving byte pairs in the right order. */ -###ifdef BYTEORDER_IS_LITTLE_ENDIAN -## int ihi = 1, ilo = 0; -###else -## int ihi = 0, ilo = 1; -###endif -## PyObject *errorHandler = NULL; -## PyObject *exc = NULL; -## -## /* Note: size will always be longer than the resulting Unicode -## character count */ -## unicode = _PyUnicode_New(size); -## if (!unicode) -## return NULL; -## if (size == 0) -## return (PyObject *)unicode; -## -## /* Unpack UTF-16 encoded data */ -## p = unicode->str; -## q = (unsigned char *)s; -## e = q + size; -## -## if (byteorder) -## bo = *byteorder; -## +def PyUnicode_DecodeUTF16Stateful(s,size,errors,byteorder='native',consumed=None): + + bo = 0 #/* assume native ordering by default */ + errmsg = "" + + if sys.byteorder == 'little': + ihi = 1 + ilo = 0 + else: + ihi = 0 + ilo = 1 + + if (size == 0): + return [u''] + + #/* Unpack UTF-16 encoded data */ + ## /* Check for BOM marks (U+FEFF) in the input and adjust current ## byte order setting accordingly. In native mode, the leading BOM ## mark is skipped, in all other modes, it is copied to the output ## stream as-is (giving a ZWNBSP character). */ -## if (bo == 0) { -## if (size >= 2) { -## const Py_UNICODE bom = (q[ihi] << 8) | q[ilo]; -###ifdef BYTEORDER_IS_LITTLE_ENDIAN -## if (bom == 0xFEFF) { -## q += 2; -## bo = -1; -## } -## else if (bom == 0xFFFE) { -## q += 2; -## bo = 1; -## } -###else -## if (bom == 0xFEFF) { -## q += 2; -## bo = 1; -## } -## else if (bom == 0xFFFE) { -## q += 2; -## bo = -1; -## } -###endif -## } -## } -## -## if (bo == -1) { -## /* force LE */ -## ihi = 1; -## ilo = 0; -## } -## else if (bo == 1) { -## /* force BE */ -## ihi = 0; -## ilo = 1; -## } -## -## while (q < e) { -## Py_UNICODE ch; -## /* remaining bytes at the end? (size should be even) */ -## if (e-q<2) { -## if (consumed) -## break; -## errmsg = "truncated data"; -## startinpos = ((const char *)q)-starts; -## endinpos = ((const char *)e)-starts; -## goto utf16Error; -## /* The remaining input chars are ignored if the callback -## chooses to skip the input */ -## } -## ch = (q[ihi] << 8) | q[ilo]; -## -## q += 2; -## -## if (ch < 0xD800 || ch > 0xDFFF) { -## *p++ = ch; -## continue; -## } -## -## /* UTF-16 code pair: */ -## if (q >= e) { -## errmsg = "unexpected end of data"; -## startinpos = (((const char *)q)-2)-starts; -## endinpos = ((const char *)e)-starts; -## goto utf16Error; -## } -## if (0xD800 <= ch && ch <= 0xDBFF) { -## Py_UNICODE ch2 = (q[ihi] << 8) | q[ilo]; -## q += 2; -## if (0xDC00 <= ch2 && ch2 <= 0xDFFF) { -###ifndef Py_UNICODE_WIDE -## *p++ = ch; -## *p++ = ch2; -###else -## *p++ = (((ch & 0x3FF)<<10) | (ch2 & 0x3FF)) + 0x10000; -###endif -## continue; -## } -## else { -## errmsg = "illegal UTF-16 surrogate"; -## startinpos = (((const char *)q)-4)-starts; -## endinpos = startinpos+2; -## goto utf16Error; -## } -## -## } -## errmsg = "illegal encoding"; -## startinpos = (((const char *)q)-2)-starts; -## endinpos = startinpos+2; -## /* Fall through to report the error */ -## -## utf16Error: -## outpos = p-PyUnicode_AS_UNICODE(unicode); -## if (unicode_decode_call_errorhandler( -## errors, &errorHandler, -## "utf16", errmsg, -## starts, size, &startinpos, &endinpos, &exc, (const char **)&q, -## (PyObject **)&unicode, &outpos, &p)) -## goto onError; -## } -## -## if (byteorder) -## *byteorder = bo; -## -## if (consumed) -## *consumed = (const char *)q-starts; -## -## /* Adjust length */ -## if (_PyUnicode_Resize(&unicode, p - unicode->str) < 0) -## goto onError; -## -## Py_XDECREF(errorHandler); -## Py_XDECREF(exc); -## return (PyObject *)unicode; + q = 0 + if byteorder == 'native': + if (size >= 2): + bom = (ord(s[ihi]) << 8) | ord(s[ilo]) +#ifdef BYTEORDER_IS_LITTLE_ENDIAN + if sys.byteorder == 'little': + if (bom == 0xFEFF): + q += 2 + bo = -1 + elif bom == 0xFFFE: + q += 2 + bo = 1 + else: + if bom == 0xFEFF: + q += 2 + bo = 1 + elif bom == 0xFFFE: + q += 2 + bo = -1 + elif byteorder == 'little': + bo = -1 + else: + bo = 1 + + if (bo == -1): + #/* force LE */ + ihi = 1 + ilo = 0 + + elif (bo == 1): + #/* force BE */ + ihi = 0 + ilo = 1 + + while (q < len(s)): + + #/* remaining bytes at the end? (size should be even) */ + if (len(s)-q<2): + if (consumed): + break + errmsg = "truncated data"; + startinpos = q + endinpos = len(s) + unicode_call_errorhandler() +## /* The remaining input chars are ignored if the callback +## chooses to skip the input */ + + ch = (s[q+ihi] << 8) | s[q+ilo] + q += 2 + + if (ch < 0xD800 or ch > 0xDFFF): + p += unichr(ch) + continue + + #/* UTF-16 code pair: */ + if (q >= e): + errmsg = "unexpected end of data"; + startinpos = q-2 + endinpos = len(s) + unicode_call_errorhandler + + if (0xD800 <= ch and ch <= 0xDBFF): + ch2 = (s[q+ihi] << 8) | s[q+ilo] + q += 2 + if (0xDC00 <= ch2 and ch2 <= 0xDFFF): + #ifndef Py_UNICODE_WIDE + if sys.maxunicode < 65536: + p += unichr(ch) + p += unichr(ch2) + else: + p += unichr((((ch & 0x3FF)<<10) | (ch2 & 0x3FF)) + 0x10000) + #endif + continue + + else: + errmsg = "illegal UTF-16 surrogate"; + startinpos = q-4 + endinpos = startinpos+2 + unicode_call_errorhandler + + errmsg = "illegal encoding"; + startinpos = q-2 + endinpos = startinpos+2 + unicode_call_errorhandler + + +## if (byteorder): +## byteorder = bo ## -##onError: -## Py_DECREF(unicode); -## Py_XDECREF(errorHandler); -## Py_XDECREF(exc); -## return NULL; -##} +## if (consumed): +## consumed = (const char *)q-starts; + return p def PyUnicode_EncodeUTF16(s,size,errors,byteorder='little'): @@ -553,7 +590,7 @@ if (ch2): p +=STORECHAR(ch2,bom) - return ''.join(p) + return p def PyUnicode_DecodeMBCS(s, size, errors): @@ -581,8 +618,8 @@ ## return (PyObject *)v; ##} -##def PyUnicode_EncodeMBCS(p, size, errors): -## +def PyUnicode_EncodeMBCS(p, size, errors): + pass #### /* If there are no characters, bail now! */ ## if (size==0) ## return "" @@ -804,7 +841,7 @@ if (consumed): consumed = pos - return u''.join(p) + return p def PyUnicode_EncodeUTF8(s,size,errors): @@ -836,50 +873,33 @@ p.extend(encodeUCS4(ch3)) continue ## /* Fall through: handles isolated high surrogates */ - p.append (chr((0xe0 | (ord(ch) >> 12)))) - p.append (chr((0x80 | ((ord(ch) >> 6) & 0x3f)))) - p.append (chr((0x80 | (ord(ch) & 0x3f)))) + p += (chr((0xe0 | (ord(ch) >> 12)))) + p += (chr((0x80 | ((ord(ch) >> 6) & 0x3f)))) + p += (chr((0x80 | (ord(ch) & 0x3f)))) continue - return ''.join(p) + return p def encodeUCS4(ch): ## /* Encode UCS4 Unicode ordinals */ p=[] - p.append (chr((0xf0 | (ch >> 18)))) - p.append (chr((0x80 | ((ch >> 12) & 0x3f)))) - p.append (chr((0x80 | ((ch >> 6) & 0x3f)))) - p.append (chr((0x80 | (ch & 0x3f)))) + p += (chr((0xf0 | (ch >> 18)))) + p += (chr((0x80 | ((ch >> 12) & 0x3f)))) + p += (chr((0x80 | ((ch >> 6) & 0x3f)))) + p += (chr((0x80 | (ch & 0x3f)))) return p #/* --- Latin-1 Codec ------------------------------------------------------ */ def PyUnicode_DecodeLatin1(s, size, errors): - pass -##{ -## PyUnicodeObject *v; -## Py_UNICODE *p; -## -## /* Latin-1 is equivalent to the first 256 ordinals in Unicode. */ -## if (size == 1) { -## Py_UNICODE r = *(unsigned char*)s; -## return PyUnicode_FromUnicode(&r, 1); -## } -## -## v = _PyUnicode_New(size); -## if (v == NULL) -## goto onError; -## if (size == 0) -## return (PyObject *)v; -## p = PyUnicode_AS_UNICODE(v); -## while (size-- > 0) -## *p++ = (unsigned char)*s++; -## return (PyObject *)v; -## -## onE rror: -## Py_XDECREF(v); -## return NULL; -##} - + #/* Latin-1 is equivalent to the first 256 ordinals in Unicode. */ + if (size == 1): + return [PyUnicode_FromUnicode(s, 1)] + pos = 0 + p = [] + while (pos < size): + p += s[pos] + pos += 1 + return p def unicode_encode_ucs1(p,size,errors,limit): @@ -897,6 +917,10 @@ while pos < len(p): #for ch in p: ch = p[pos] + try: + ord(ch) + except TypeError: + print "Typeerror",ch,type(ch) if ord(ch) < limit: res += chr(ord(ch)) pos += 1 @@ -909,11 +933,11 @@ x = unicode_call_errorhandler(errors,encoding,reason,p,collstart,collend,False) res += str(x[0]) pos = x[1] - return res #u''.join(res) + return res def PyUnicode_EncodeLatin1(p,size,errors): res=unicode_encode_ucs1(p, size, errors, 256) - return ''.join(res) + return res hexdigits = [hex(i)[-1] for i in range(16)]+[hex(i)[-1].upper() for i in range(10,16)] def hexescape(s,pos,digits,message,errors): @@ -931,30 +955,28 @@ endinpos = pos while s[endinpos] in hexdigits: endinpos +=1 - #message = "Find den rigtige fejl meddelelse" x = unicode_call_errorhandler(errors,"unicodeescape",message,s,pos-2, endinpos+1) p += x[0] pos = x[1] - # /* when we get here, chr is a 32-bit unicode character */ + #/* when we get here, chr is a 32-bit unicode character */ else: if chr < sys.maxunicode: p += [unichr(chr)] pos += digits - #else + elif (chr <= 0x10ffff): chr -= 0x10000L p += unichr(0xD800 + (chr >> 10)) p += unichr(0xDC00 + (chr & 0x03FF)) pos += digits - #endif else: - message = "Find den rigtige fejl meddelelse" + message = "illegal Unicode character" x = unicode_call_errorhandler(errors,"unicodeescape",message,s,pos-2, pos+1) p += x[0] pos = x[1] - res = ''.join(p) + res = p return res,pos def PyUnicode_DecodeUnicodeEscape(s, size, errors): @@ -1027,69 +1049,43 @@ x = hexescape(s,pos+1,digits,message,errors) p += x[0] pos = x[1] - - ## /* \N{name} */ -## elif ch == 'N': -## message = "malformed \\N character escape"; -## if (ucnhash_CAPI == NULL) { -## /* load the unicode data module */ -## PyObject *m, *v; -## m = PyImport_ImportModule("unicodedata"); -## if (m == NULL) -## goto ucnhashError; -## v = PyObject_GetAttrString(m, "ucnhash_CAPI"); -## Py_DECREF(m); -## if (v == NULL) -## goto ucnhashError; -## ucnhash_CAPI = PyCObject_AsVoidPtr(v); -## Py_DECREF(v); -## if (ucnhash_CAPI == NULL) -## goto ucnhashError; -## } -## if (*s == '{') { -## const char *start = s+1; -## /* look for the closing brace */ -## while (*s != '}' && s < end) -## s++; -## if (s > start && s < end && *s == '}') { -## /* found a name. look it up in the unicode database */ -## message = "unknown Unicode character name"; -## s++; -## if (ucnhash_CAPI->getcode(start, s-start-1, &chr)) -## goto store; -## } -## } -## endinpos = s-starts; -## outpos = p-PyUnicode_AS_UNICODE(v); -## if (unicode_decode_call_errorhandler( -## errors, &errorHandler, -## "unicodeescape", message, -## starts, size, &startinpos, &endinpos, &exc, &s, -## (PyObject **)&v, &outpos, &p)) -## goto onError; -## break; + elif ch == 'N': + message = "malformed \\N character escape" + try: + import unicodedata + except ImportError: + message = "\\N escapes not supported (can't load unicodedata module)" + unicode_call_errorhandler(errors,"unicodeescape",message,s,pos-1,size) + if (s[pos] == '{'): + look = pos+1 + #/* look for the closing brace */ + while (s[look] != '}' and look < size): + look += 1 + if (look > pos+1 and look < size and s[look] == '}'): + #/* found a name. look it up in the unicode database */ + message = "unknown Unicode character name" + look += 1 + try: + chr = unicodedata.lookup(s[pos:look]) + except KeyError: + x=unicode_call_errorhandler(errors,"unicodeescape",message,s,pos-1,size) + else: + x = hexescape(s,pos+1,look-pos,message,errors) + p += x[0] + pos = x[1] else: - p += '\\' - p += s[pos] - if (pos > size): - message = "\\ at end of string" -## endinpos = s-starts; -## outpos = p-PyUnicode_AS_UNICODE(v); - handler = lookup_error(errors) - x = handler(UnicodeDecodeError("unicodeescape",s,pos, - pos+digits,message)) - p += x[0] - pos = x[1] -## if (unicode_call_errorhandler( -## errors, &errorHandler, -## "unicodeescape", message, -## starts, size, &startinpos, &endinpos, &exc, &s, -## (PyObject **)&v, &outpos, &p)) -## goto onError; - - - return ''.join(p) + if (pos > size): + message = "\\ at end of string" + handler = lookup_error(errors) + x = handler(UnicodeDecodeError("unicodeescape",s,pos, + pos+digits,message)) + p += x[0] + pos = x[1] + else: + p += '\\' + p += s[pos] + return p def PyUnicode_EncodeRawUnicodeEscape(s,size): @@ -1113,7 +1109,7 @@ p += ch p += '\0' - return ''.join(p) + return p def charmapencode_output(c,mapping): @@ -1160,7 +1156,7 @@ #/* done with this character => adjust input position */ inpos+=1 - return ''.join(res) + return res def PyUnicode_DecodeCharmap(s, size, mapping, errors): @@ -1199,7 +1195,7 @@ ## s,inpos,inpos+1) ## p += x[0] inpos +=1 - return u''.join(p) + return p def PyUnicode_DecodeRawUnicodeEscape(s, size,errors): @@ -1271,4 +1267,4 @@ else: p += unichr(x) - return u''.join(p) \ No newline at end of file + return p \ No newline at end of file From pedronis at codespeak.net Fri May 13 15:50:27 2005 From: pedronis at codespeak.net (pedronis at codespeak.net) Date: Fri, 13 May 2005 15:50:27 +0200 (CEST) Subject: [pypy-svn] r12236 - in pypy/dist/pypy/annotation: . test Message-ID: <20050513135027.8C27C27B9A@code1.codespeak.net> Author: pedronis Date: Fri May 13 15:50:27 2005 New Revision: 12236 Modified: pypy/dist/pypy/annotation/model.py pypy/dist/pypy/annotation/test/test_model.py Log: fix test gone out of sync wrt code Modified: pypy/dist/pypy/annotation/model.py ============================================================================== --- pypy/dist/pypy/annotation/model.py (original) +++ pypy/dist/pypy/annotation/model.py Fri May 13 15:50:27 2005 @@ -300,7 +300,7 @@ def ll_to_annotation(v): if v is None: - assert False, "cannot retrieve Void low-level type value" + raise ValueError, "cannot retrieve Void low-level type value" typ = lltypes.typeOf(v) s = ll_to_annotation_map.get(typ) if s is None: Modified: pypy/dist/pypy/annotation/test/test_model.py ============================================================================== --- pypy/dist/pypy/annotation/test/test_model.py (original) +++ pypy/dist/pypy/annotation/test/test_model.py Fri May 13 15:50:27 2005 @@ -139,7 +139,7 @@ PS = lltypes.GcPtr(lltypes.Struct('s')) s_p = SomePtr(ll_ptrtype=PS) assert annotation_to_lltype(s_p) == PS - py.test.raises(AssertionError, "annotation_to_lltype(si0)") + py.test.raises(ValueError, "annotation_to_lltype(si0)") def test_ll_union(): PS1 = lltypes.GcPtr(lltypes.Struct('s')) From pedronis at codespeak.net Fri May 13 16:52:54 2005 From: pedronis at codespeak.net (pedronis at codespeak.net) Date: Fri, 13 May 2005 16:52:54 +0200 (CEST) Subject: [pypy-svn] r12239 - pypy/dist/pypy/documentation Message-ID: <20050513145254.AF65B27B9A@code1.codespeak.net> Author: pedronis Date: Fri May 13 16:52:54 2005 New Revision: 12239 Modified: pypy/dist/pypy/documentation/translation.txt Log: update the section on lists and dicts to reflect the current state of things Modified: pypy/dist/pypy/documentation/translation.txt ============================================================================== --- pypy/dist/pypy/documentation/translation.txt (original) +++ pypy/dist/pypy/documentation/translation.txt Fri May 13 16:52:54 2005 @@ -231,63 +231,93 @@ Lists and Dictionaries ++++++++++++++++++++++ -``SomeList`` stands for a list of homogenous type (i.e. all the elements -of the list are represented by a single common ``SomeXxx`` annotation). +``SomeList`` stands for a list of homogeneous type (i.e. all the +elements of the list are represented by a single common ``SomeXxx`` +annotation). -``SomeDict`` stands for a homogenous dictionary (i.e. all keys have the -same ``SomeXxx`` annotation, and so have all values). +``SomeDict`` stands for a homogeneous dictionary (i.e. all keys have +the same ``SomeXxx`` annotation, and so have all values). -These types are mutable, which requires special support for the +These types are mutable, which requires special support for the annotator. The problem is that in code like:: lst = [42] update_list(lst) value = lst[0] -the annotation given to ``value`` depends on the order in which the -annotator progresses. As ``lst`` is originally considered as a list of -``SomeInteger(const=42)``, it is possible that ``value`` becomes -``SomeInteger(const=42)`` as well if the analysis of ``update_list()`` -is not completed by the time the third operation is first considered. -To solve this problem, each ``SomeList`` or ``SomeDict`` is linked to a -set of so-called *factories*. Each creation point, i.e. each 'newlist' -or 'newdict' operation, gets its associated factory. The factory -remembers what kind of object it really needs to build. For example, in -code like:: +the annotation given to ``value`` depends on the order in which the +annotator progresses. As ``lst`` is originally considered as a list +of ``SomeInteger(const=42)``, it is possible that ``value`` becomes +``SomeInteger(const=42)`` as well if the analysis of ``update_list()`` +is not completed by the time the third operation is first considered. + + +To solve this problem, each ``SomeList`` or ``SomeDict`` is linked to +so-called *list-definition* or *dict-definition* +(``pypy.annotation.listdef.ListDef``, +``pypy.annotation.dictdef.DictDef``). The list definitions and dict +definitions contain information about the type of list items, dict +keys and values respectively. + +At each creation point, i.e. each 'newlist' or 'newdict', a +``SomeList`` or ``SomeDict`` is created with a fresh definition object +if its the first time we annotate this operation, otherwise the +definition setup (which has been cached) the first time is reused. +While proceeding the annotator also records on the definition objects +all flow graph positions where values are read from the list or dict. + +For example, in code like:: lst = [42] + f(lst[0]) lst.append(43) -the factory associated with the first line originally builds a list -whose items are all constants equal to 42; when the ``append(43)`` call -is then found, the factory is updated to build a more general list of -integers, and the annotator restarts its analysis from the factory -position. Our model is not sensitive to timing: it doesn't know that -the same list object may contain different items at different times. It -only computes how general the items in the list must be to cover all -cases. - -For initially empty lists, as created by ``lst = []``, we build a list -whose items have the annotation ``SomeImpossibleValue``. This is an -annotation that denotes that no Python object at all can possibly appear -here at run-time. It is the least general annotation. The rationale is -that:: +the definition associated with the list at creation time (first line) +represents list whose items are all constants equal to 42; when a +value is read from the list (second line) this position is recorded on +the definition; when the ``append(43)`` call is then found, the item +type information in the definition is generalized (in this case to +general list of integers) and the annotator schedule all the so far +recorded read positions for reflowing, in order to keep the +annotations consistent. + +Our model is not sensitive to timing: it doesn't know that the same +list object may contain different items at different times. It only +computes how general the items in the list must be to cover all cases. + +For initially empty lists, as created by ``lst = []``, we build a list +whose items have the annotation ``SomeImpossibleValue``. This is an +annotation that denotes that no Python object at all can possibly +appear here at run-time. It is the least general annotation. The +rationale is that:: lst = [] oups = lst[0] -will give the variable ``oups`` the annotation ``SomeImpossibleValue``, -which is reasonable given that no concrete Python object can ever be put -in ``oups`` at run-time. In a more usual example:: +will give the variable ``oups`` the annotation +``SomeImpossibleValue``, which is reasonable given that no concrete +Python object can ever be put in ``oups`` at run-time. In a more +usual example:: lst = [] lst.append(42) -the list is first built with ``SomeImpossibleValue`` items, and then the -factory is generalized to produce a list of ``SomeInteger(const=42)``. -With this "impossible object" trick we don't have to do anything special -about empty lists. +the list is first built with ``SomeImpossibleValue`` items, and then +the factory is generalized to produce a list of +``SomeInteger(const=42)``. With this "impossible object" trick we +don't have to do anything special about empty lists. + +When the annotator has to unify different list or dict annotations it +effectively unifies the corresponding definitions, the item types are +generalized as necessary and the union of the read position sets is +used, also things are internally setup in such a way that the involved +definitions now are considered interchangeably the same for the rest of +the process (that means that union for lists and dicts is a not +reversible operation). If the new item type is more general reflowing +from all the read positions is also scheduled. + +XXX THE REST NEEDS REVIEW AND TO BE COMPLETED User-defined Classes and Instances ++++++++++++++++++++++++++++++++++ From tismer at codespeak.net Fri May 13 18:39:33 2005 From: tismer at codespeak.net (tismer at codespeak.net) Date: Fri, 13 May 2005 18:39:33 +0200 (CEST) Subject: [pypy-svn] r12241 - pypy/dist/pypy/objspace/flow Message-ID: <20050513163933.F124627B8A@code1.codespeak.net> Author: tismer Date: Fri May 13 18:39:33 2005 New Revision: 12241 Modified: pypy/dist/pypy/objspace/flow/model.py Log: saved another 25 MB of memory by dropping Variable.instances Modified: pypy/dist/pypy/objspace/flow/model.py ============================================================================== --- pypy/dist/pypy/objspace/flow/model.py (original) +++ pypy/dist/pypy/objspace/flow/model.py Fri May 13 18:39:33 2005 @@ -15,6 +15,9 @@ Var/Const/SpaceOp 205 MB 325 MB + Link 189 MB 311 MB + Block 185 MB 304 MB + + Dropping Variable.instances brought + annotation down to 160 MB. """ __metaclass__ = type @@ -165,17 +168,26 @@ class Variable: __slots__ = ["renamed", "name", "concretetype"] - counter = 0 - instances = {} + countall = 0 + countmax = 0 + countcurr = 0 + instancenames = {} + # change this to a weakvalue dict if you want + # to track all alive instances def __init__(self, name=None): - self.name = 'v%d' % Variable.counter + self.name = 'v%d' % Variable.countall self.renamed = False - Variable.instances[self.name] = self - Variable.counter += 1 + Variable.instancenames[self.name] = True + Variable.countall += 1 + Variable.countcurr += 1 + Variable.countmax = max(Variable.countmax, Variable.countcurr) if name is not None: self.rename(name) + def __del__(self): + Variable.countcurr -= 1 + def __repr__(self): return '%s' % self.name @@ -192,10 +204,10 @@ return if '0' <= name[0] <= '9': name = '_' + name - del Variable.instances[self.name] + del Variable.instancenames[self.name] self.renamed = True self.name = name + '_' + self.name[1:] - Variable.instances[self.name] = self + Variable.instancenames[self.name] = True class Constant: From pedronis at codespeak.net Fri May 13 18:40:20 2005 From: pedronis at codespeak.net (pedronis at codespeak.net) Date: Fri, 13 May 2005 18:40:20 +0200 (CEST) Subject: [pypy-svn] r12242 - pypy/dist/pypy/documentation Message-ID: <20050513164020.A323D27B8A@code1.codespeak.net> Author: pedronis Date: Fri May 13 18:40:20 2005 New Revision: 12242 Modified: pypy/dist/pypy/documentation/translation.txt Log: start of documentation about SomePBC. Missing how method annotation is encoded f:ClassDef Modified: pypy/dist/pypy/documentation/translation.txt ============================================================================== --- pypy/dist/pypy/documentation/translation.txt (original) +++ pypy/dist/pypy/documentation/translation.txt Fri May 13 18:40:20 2005 @@ -316,9 +316,6 @@ reversible operation). If the new item type is more general reflowing from all the read positions is also scheduled. - -XXX THE REST NEEDS REVIEW AND TO BE COMPLETED - User-defined Classes and Instances ++++++++++++++++++++++++++++++++++ @@ -365,10 +362,42 @@ parent class. -Prebuilt Constants -++++++++++++++++++ +Prebuilt Constants and instance methods ++++++++++++++++++++++++++++++++++++++++ -(to be completed) +Constants in the flowgraph are annotated with a corresponding +``SomeXxx`` instance with 'const' attribute set to the their value. + +Constant instances of user-defined classes, callables (which include +functions but also class types themself) and staticmethod are treated +specially. Constant user-defined class instances can declare themself +immutable by having a '_freeze_' method returning true, otherwise they +will be assumed mutable and be annotated with usual ``SomeInstance`` +annotation without 'const' set. + +For user-defined constant instances that declared themself immutable, +staticmethods and other callables ``SomePBC`` is used (PBC = pre-built +constant). Its instances contain a 'prebuiltinstances' dictionary. For +the normal case and single value ``x`` this will be set to ``{x : +True}``. For a single value the 'const' attribute will also be set. + +The union of ``SomePBC`` instances will result in an instance with the +merge of the original dictionaries. So for example a dictionary +pointing to functions, will usually have as its value annotation such +a ``SomePBC`` with a 'prebuiltinstances' dict having all the functions +as keys. + +For a large part of operations when encountering ``SomeXxx`` with +'const' set the annotator will do constant propagation and produce +results with also 'const' set. This also means that based on 'const' +truth values the annotator will not flow into code that is not +reachable given global constant values. A later graph transformation +will remove such dead code. + +XXX None, how methods annotation storage work + + +XXX complete Built-in functions and methods From arigo at codespeak.net Fri May 13 18:59:28 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Fri, 13 May 2005 18:59:28 +0200 (CEST) Subject: [pypy-svn] r12243 - pypy/dist/pypy/translator/genc Message-ID: <20050513165928.EF3B927B8A@code1.codespeak.net> Author: arigo Date: Fri May 13 18:59:28 2005 New Revision: 12243 Modified: pypy/dist/pypy/translator/genc/ll_include.h Log: Commented out debugging prints. Modified: pypy/dist/pypy/translator/genc/ll_include.h ============================================================================== --- pypy/dist/pypy/translator/genc/ll_include.h (original) +++ pypy/dist/pypy/translator/genc/ll_include.h Fri May 13 18:59:28 2005 @@ -16,7 +16,8 @@ #define OP_MALLOC(typename, r, err) { \ typename##_gc *__block = (typename##_gc*) PyObject_Malloc( \ sizeof(typename##_gc)); \ - printf("allocated %d bytes at %p\n", sizeof(typename##_gc), __block); \ + /* printf("allocated %d bytes at %p\n", */ \ + /* sizeof(typename##_gc), __block); */ \ if (__block == NULL) { PyErr_NoMemory(); FAIL(err) } \ __block->refcount = 1; \ r = GCSTRUCT_TO_STRUCT(typename, __block); \ @@ -26,16 +27,16 @@ #define OP_MALLOC_VARSIZE(typename, vartypename, sizefield, nsize, r, err) { \ size_t memsize = sizeof(typename##_gc) + (nsize-1)*sizeof(vartypename); \ typename##_gc *__block = (typename##_gc*) PyObject_Malloc(memsize); \ - printf("var-allocated %d bytes at %p\n", memsize, __block); \ + /* printf("var-allocated %d bytes at %p\n", memsize, __block); */ \ if (__block == NULL) { PyErr_NoMemory(); FAIL(err) } \ memset((void*) __block, 0, memsize); \ __block->refcount = 1; \ r = GCSTRUCT_TO_STRUCT(typename, __block); \ r->sizefield = nsize; \ } -#define STRUCTFREE(typename, p) { \ - printf("freeing %p\n", STRUCT_TO_GCSTRUCT(typename, p)); \ - PyObject_Free(STRUCT_TO_GCSTRUCT(typename, p)); \ +#define STRUCTFREE(typename, p) { \ + /* printf("freeing %p\n", STRUCT_TO_GCSTRUCT(typename, p)); */ \ + PyObject_Free(STRUCT_TO_GCSTRUCT(typename, p)); \ } From arigo at codespeak.net Fri May 13 18:59:47 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Fri, 13 May 2005 18:59:47 +0200 (CEST) Subject: [pypy-svn] r12244 - in pypy/dist/pypy/translator: . genc Message-ID: <20050513165947.F33CE27B8D@code1.codespeak.net> Author: arigo Date: Fri May 13 18:59:47 2005 New Revision: 12244 Modified: pypy/dist/pypy/translator/genc/genc.py pypy/dist/pypy/translator/geninterplevel.py Log: Oups, a quick repair... Modified: pypy/dist/pypy/translator/genc/genc.py ============================================================================== --- pypy/dist/pypy/translator/genc/genc.py (original) +++ pypy/dist/pypy/translator/genc/genc.py Fri May 13 18:59:47 2005 @@ -171,7 +171,6 @@ del self.translator.flowgraphs[funcdef.func] except KeyError: pass - Variable.instances.clear() def loadincludefile(basename): filename = os.path.join(autopath.this_dir, basename) Modified: pypy/dist/pypy/translator/geninterplevel.py ============================================================================== --- pypy/dist/pypy/translator/geninterplevel.py (original) +++ pypy/dist/pypy/translator/geninterplevel.py Fri May 13 18:59:47 2005 @@ -1088,7 +1088,6 @@ if not self.translator.frozen: # this is only to keep the RAM consumption under control del self.translator.flowgraphs[func] - Variable.instances.clear() def rpyfunction_body(self, func, localscope): try: From arigo at codespeak.net Fri May 13 19:31:57 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Fri, 13 May 2005 19:31:57 +0200 (CEST) Subject: [pypy-svn] r12245 - in pypy/dist/pypy/tool: . test Message-ID: <20050513173157.D234E27B8D@code1.codespeak.net> Author: arigo Date: Fri May 13 19:31:57 2005 New Revision: 12245 Added: pypy/dist/pypy/tool/template.py (contents, props changed) pypy/dist/pypy/tool/test/test_template.py (contents, props changed) Log: Experimental templating helper. Added: pypy/dist/pypy/tool/template.py ============================================================================== --- (empty file) +++ pypy/dist/pypy/tool/template.py Fri May 13 19:31:57 2005 @@ -0,0 +1,29 @@ +import autopath +import sys +import py + + +def compile_template(source, resultname): + """Compiles the source code (a py.code.Source or a list/generator of lines) + which should be a definition for a function named 'resultname'. + The caller's global dict and local variable bindings are captured. + """ + if not isinstance(source, py.code.Source): + lines = list(source) + lines.append('') + source = py.code.Source('\n'.join(lines)) + + caller = sys._getframe(1) + locals = caller.f_locals + localnames = locals.keys() + localnames.sort() + values = [locals[key] for key in localnames] + + source = source.putaround( + before = "def container(%s):" % (', '.join(localnames),), + after = "# no unindent\n return %s" % resultname) + + d = {} + exec source.compile() in caller.f_globals, d + container = d['container'] + return container(*values) Added: pypy/dist/pypy/tool/test/test_template.py ============================================================================== --- (empty file) +++ pypy/dist/pypy/tool/test/test_template.py Fri May 13 19:31:57 2005 @@ -0,0 +1,19 @@ +import autopath +from pypy.tool.template import compile_template + + +some_global = 5 + +def test_template(): + init_value = 50 + + def template(n): + args = ['arg%d' % i for i in range(n)] + yield 'def add(%s):' % (', '.join(args),) + yield ' total = init_value + some_global' + for i in range(n): + yield ' total += arg%d' % i + yield ' return total' + + add = compile_template(template(5), 'add') + assert add(10000, 1000, 100, 10, 1) == 11166 From arigo at codespeak.net Fri May 13 19:36:58 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Fri, 13 May 2005 19:36:58 +0200 (CEST) Subject: [pypy-svn] r12246 - pypy/dist/pypy/rpython Message-ID: <20050513173658.B9A5E27B99@code1.codespeak.net> Author: arigo Date: Fri May 13 19:36:58 2005 New Revision: 12246 Modified: pypy/dist/pypy/rpython/rlist.py Log: Looks slightly less obscure with compile_template(). Modified: pypy/dist/pypy/rpython/rlist.py ============================================================================== --- pypy/dist/pypy/rpython/rlist.py (original) +++ pypy/dist/pypy/rpython/rlist.py Fri May 13 19:36:58 2005 @@ -1,6 +1,7 @@ import py from pypy.annotation.model import * from pypy.rpython.lltypes import * +from pypy.tool.template import compile_template def substitute_newlist(typer, op): @@ -14,19 +15,19 @@ except KeyError: # Make an implementation of newlist(x1,..,xn) which allocates # a list with n elements and initialize them. - - args = ', '.join(['arg%d' % i for i in range(n)]) - lines = [] - lines.append( 'def newlist(%s):' % args) - lines.append( ' l = malloc(List_typ)') - lines.append( ' l.items = malloc(List_typ.items.TO, %d)' % n) - for i in range(n): - lines.append(' l.items[%d].item = arg%d' % (i, i)) - lines.append( ' return l') - lines.append( '') - miniglobal = {'List_typ': LIST.TO, 'malloc': malloc} - exec py.code.Source('\n'.join(lines)).compile() in miniglobal - newlist = typer.newlistcache[LIST, n] = miniglobal['newlist'] + List_typ = LIST.TO + + def template(): + args = ', '.join(['arg%d' % i for i in range(n)]) + yield 'def newlist(%s):' % args + yield ' l = malloc(List_typ)' + yield ' l.items = malloc(List_typ.items.TO, %d)' % n + for i in range(n): + yield ' l.items[%d].item = arg%d' % (i, i) + yield ' return l' + + newlist = compile_template(template(), 'newlist') + typer.newlistcache[LIST, n] = newlist return typer.substitute_op(op, (newlist,) + inputsignature + (LIST,)) def getlisttype(typer, s_list): From tismer at codespeak.net Fri May 13 21:17:50 2005 From: tismer at codespeak.net (tismer at codespeak.net) Date: Fri, 13 May 2005 21:17:50 +0200 (CEST) Subject: [pypy-svn] r12247 - pypy/dist/pypy/objspace/flow Message-ID: <20050513191750.8A22D27B95@code1.codespeak.net> Author: tismer Date: Fri May 13 21:17:50 2005 New Revision: 12247 Modified: pypy/dist/pypy/objspace/flow/model.py Log: annotation of targetpypymain is now down to 109 MB, just by getting rid of a huge dict and a Variable attribute. I think this is a fragmentation issue. Modified: pypy/dist/pypy/objspace/flow/model.py ============================================================================== --- pypy/dist/pypy/objspace/flow/model.py (original) +++ pypy/dist/pypy/objspace/flow/model.py Fri May 13 21:17:50 2005 @@ -16,8 +16,13 @@ + Link 189 MB 311 MB + Block 185 MB 304 MB - Dropping Variable.instances brought + Dropping Variable.instances and using + just an instancenames dict brought annotation down to 160 MB. + Computing the Variable.renamed attribute + and dropping Variable.instancenames + got annotation down to 109 MB. + Probably an effect of less fragmentation. """ __metaclass__ = type @@ -166,19 +171,25 @@ class Variable: - __slots__ = ["renamed", "name", "concretetype"] + __slots__ = ["_name", "concretetype"] countall = 0 countmax = 0 countcurr = 0 - instancenames = {} - # change this to a weakvalue dict if you want - # to track all alive instances + def name(self): + name = self._name + if type(name) is int: + name = 'v%d' % name + return name + name = property(name) + + def renamed(self): + return isinstance(self._name, str) + renamed = property(renamed) + def __init__(self, name=None): - self.name = 'v%d' % Variable.countall - self.renamed = False - Variable.instancenames[self.name] = True + self._name = Variable.countall Variable.countall += 1 Variable.countcurr += 1 Variable.countmax = max(Variable.countmax, Variable.countcurr) @@ -204,10 +215,7 @@ return if '0' <= name[0] <= '9': name = '_' + name - del Variable.instancenames[self.name] - self.renamed = True - self.name = name + '_' + self.name[1:] - Variable.instancenames[self.name] = True + self._name = name + '_' + self.name[1:] class Constant: From arigo at codespeak.net Fri May 13 22:22:13 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Fri, 13 May 2005 22:22:13 +0200 (CEST) Subject: [pypy-svn] r12248 - pypy/dist/pypy/documentation Message-ID: <20050513202213.7B37727B92@code1.codespeak.net> Author: arigo Date: Fri May 13 22:22:13 2005 New Revision: 12248 Modified: pypy/dist/pypy/documentation/translation.txt Log: Started documenting the low-level types. Modified: pypy/dist/pypy/documentation/translation.txt ============================================================================== --- pypy/dist/pypy/documentation/translation.txt (original) +++ pypy/dist/pypy/documentation/translation.txt Fri May 13 22:22:13 2005 @@ -29,16 +29,16 @@ 3. Optionally, the Annotator_ performs global type inference on the control flow graphs. Each variable gets annotated with an inferred type. -4. One of the Code Generators (XXX not documented yet) turns the optionally annotated flow graphs and produces a source file in a lower-level language: C_, LLVM_, `Common Lisp`_, Pyrex_, Java_, or `Python again`_ (this is used in PyPy to turn sufficiently RPythonic app-level code into interp-level code). +4. The `RPython typer`_ can use the high-level types inferred by the Annotator to turn the operations in the control flow graphs into low-level operations over low-level types (close to the C types: struct, array, pointer...). -5. This lower-level source file is compiled to produce an executable. +5. One of the Code Generators (XXX not documented yet) turns the optionally annotated/typed flow graphs and produces a source file in a lower-level language: C_, LLVM_, `Common Lisp`_, Pyrex_, Java_, or `Python again`_ (this is used in PyPy to turn sufficiently RPythonic app-level code into interp-level code). + +6. This lower-level source file is compiled to produce an executable. .. _`translator.py`: http://codespeak.net/svn/pypy/dist/pypy/translator/translator.py .. _`play around`: getting_started.html#trying-out-the-translator .. _`Flow Object Space`: objspace.html#the-flow-object-space .. _`control flow graph`: objspace.html#the-flow-model -.. _C: http://codespeak.net/svn/pypy/dist/pypy/translator/genc/ -.. _LLVM: http://codespeak.net/svn/pypy/dist/pypy/translator/llvm/ .. _`Common Lisp`: http://codespeak.net/svn/pypy/dist/pypy/translator/gencl.py .. _Pyrex: http://codespeak.net/svn/pypy/dist/pypy/translator/genpyrex.py .. _Java: http://codespeak.net/svn/pypy/dist/pypy/translator/java/ @@ -414,20 +414,20 @@ -The C Back-End -============== +.. _`RPython typer`: +The RPython Typer +================= -Overview --------- +http://codespeak.net/svn/pypy/dist/pypy/rpython/ -The task of GenC is to convert a flow graph into C code. By itself, GenC does not use the annotations in the graph. It can actually convert unannotated graphs to C. However, to make use of the annotations if they are present, an extra pass is needed: the C typer, whose task is to modify the flow graph according to the annotations, replacing operations with lower-level C-ish equivalents. -The C typer first replaces all Variables that have constant annotations with real Constants in the flow graph. +Overview +-------- -For the time being, we assume that each SomeXxx annotation has a canonical C-level representation. For example, all variables annotated with SomeInteger() will correspond to the C ``int`` type. This allows an attribute ``concretetype`` to be attached to each Variable. Constants also get such an attribute ``concretetype``, but they are computed based on the usage that is made of the particular Constant; for example, a Constant(5) will be a C ``int`` when used in an integer addition but a C ``PyObject*`` when inserted into a CPython list. +The RPython Typer is the bridge between the _Annotator and the low-level code generators. The annotator computes types (or "annotations") that are high-level, in the sense that they describe RPython types like lists or instances of user-defined classes. In general, though, to emit code we need to represent these high-level annotations into the low-level model of the target language; for C, this means structures and pointers and arrays. The Typer both determines the appropriate low-level type for each annotation, and tries to replace *all* operations in the control flow graphs with one or a few low-level operations. Just like low-level types, there is only a fairly restricted set of low-level operations, along the lines of reading or writing from or to a field of a structure. -The C typer considers each operation in turn and, based on its annotations, replaces it by C-level operations if possible. +In theory, this step is optional; some code generators might be able to read directly the high-level types. However, we expect that case to be the exception. "Compiling" high-level types into low-level ones is rather more messy than one would expect. This was the motivation for making this step explicit and isolated in a single place. After Typing, the graphs can only contain very few operations, which makes the job of the code generators much simpler. Example: Integer operations @@ -445,100 +445,150 @@ then obviously we want to type it and replace it with:: - int v1, v2, v3; v3 = int_add(v1, v2) -The typing notation in C syntax means that the Variables (which might actually be Constants) are given the ``concretetype`` corresponding to the C ``int``. +where -- in C notation -- all three variables v1, v2 and v3 are typed ``int``. This is done by attaching an attribute ``concretetype`` to v1, v2 and v3 (which might be instances of Variable or possibly Constant). In our model, this ``concretetype`` is ``pypy.rpython.lltypes.Signed``. Of course, the purpose of replacing the operation called ``int`` with ``int_add`` is that code generators no longer have to worry about what kind of addition (or concatenation maybe?) it means. + + +The process in more details +--------------------------- + +The RPython Typer does the following transformations for each block of all the annotated flow graphs (each block is processed independently, by assuming that the already-computed annotations are globally correct): + +* We first replace all Variables that have constant annotations with real Constants in the flow graph. + +* For the time being, we assume that each SomeXxx annotation has a canonical low-level representation. For example, all variables annotated with SomeInteger() will correspond to the ``Signed`` low-level type. Each input argument of the block are tagged with the canonical low-level representation (this is done by attaching an attribute ``concretetype`` to each Variable). + +* Each operation, with its argument's annotation, is looked up in a table which specifies with which low-level operation(s) it should be substituted. If needed, the arguments are first converted (with extra operations) from their current ``concretetype`` to the required low-level types. For constant arguments, we just attach the ``concretetype`` to the Constant instance; as for Variables, this tells the code generator of which type the constant really is. Finally, the substitution rules specify the ``concretetype`` of the result. It is attached to the result Variable, and will be used further down the block to detect when conversions are needed. + +* When a block has been transformed in this way, all the links are considered; if the concrete types of the Variables that exit do not match the canonical low-level types expected by the target block, conversions are inserted. + +This may look like flowing, similar to what the annotator does, but it is limited to a single block; for global coherency it trusts the more involved fixpoint-based algorithm run by the annotator. -Memory model ------------- +Low-Level Types +--------------- -For more complicated examples we need to choose a memory model. We will assume a simple model: local Variables store primitive values only (integers, pointers), and the heap stores structs. +For now, the RPython Typer uses a standard low-level model which we believe can correspond rather directly to various target languages from C to LLVM to Java. This model is implemented in the first part of `lltypes.py`_. -We support this model using the following new graph operations (the result Variable is omitted when meaningless):: +The second part of `lltypes.py`_ is a runnable implementation of these types, for testing purposes. It allows us to write and test plain Python code using a malloc() function to obtain and manipulate structures and arrays. This is useful for example to implement RPython types like 'list' with its operations and methods. - v2 = malloc() - v2 = malloc(v1) - incref(v3) - decref(v3) +The basic assumption is that Variables (i.e. local variables and function arguments and return value) all contain "simple" values: basically, just integers or pointers. All the "container" data structures (struct and array) are allocated in the heap, and they are always manipulated via pointers. (There is no equivalent to the C notion of local variable of a ``struct`` type.) -v2=malloc() allocates some bytes of heap memory, zero it, and returns a pointer to it. The number of bytes is suitable for the type of v2. For now, there is always a reference counter in a hidden header, initialized to 1. +.. _`lltypes.py`: http://codespeak.net/svn/pypy/dist/pypy/rpython/lltypes.py -incref() and decref() allow each value to be tracked. The decref(v3) operation is used when the content of the value ``v3`` is about to be deleted. GenC inserts an operation decref(v3) whenever the value in a local variable v3 is about to be forgotten (it isn't passed to the next basic block). In addition, incref(v3) is inserted when a local Variable is about to be duplicated (it is passed several times to the next basic block). -The exact operations performed by incref(v3) and decref(v3) depend on the type of v3. For pointer types, they increment and decrement the reference counter of whatever they point to. For integers, they have no effect. +Primitive Types ++++++++++++++++ -When decref() is applied on a pointer and the reference counter drops to zero, the destructor of the appropriate type is called; its action depends on the type, but (as in CPython) what it typically does is call decref() on each member of the structure and then release the occupied memory. +Signed + a signed integer in one machine word (a ``long``, in C) -Note that for now malloc() returns memory initialized to zero. This allows our destructors to cope with partially initialized data structures, should an error occur while they are constructed. +Unsigned + a non-signed integer in one machine word (``unsigned long``) -In C, it is common to see a struct definition whose last member is a variable-sized array. For this case, v2=malloc(v1) allocates an amount of memory which is enough to store the fixed part of the struct plus ``v1`` items in the variable-sized part. +Char + a single character (``char``) +Bool + a boolean value (could be ``char`` as well in C) -CType ------ +Void + a constant. Meant for variables and function arguments that should + disappear from the generated code. -Each C type is represented by an instance of a concrete subclass of CType_. Each instance has the following interface: -* a ``typename`` attribute: the name given to this type in C. +Structure Types ++++++++++++++++ -* nameof(obj): method returning a C expression representing the constant ``obj`` in this C type. +Structure types are built as instances of ``pypy.rpython.lltypes.Struct``:: -* init_globals(): called the first time genc sees this particular CType instance. It generates C code that declares the type. + MyStructType = Struct('somename', ('field1', Type1), ('field2', Type2)...) -* collect_globals(): called from time to time -- more precisely, before each function body is written to the C file. It can generate more C code related to this type, if needed (e.g. declaration of static variables of this type). +This declares a structure (or a Pascal ``record``) containing the specified named fields with the given types. The field names cannot start with an underscope. As noted above, you cannot directly manipulate structure objects, but only pointer to structures living in the heap. +By contrast, the fields themselves can be of primitive, pointer or container type. When a structure contains another structure as a field we say that the latter is "inlined" in the former: the bigger structure contains the smaller one as part of its memory layout. -.. _CType: http://codespeak.net/svn/pypy/dist/pypy/translator/genc/basetype.py +A structure can also contain an inlined array (see below), but only as its last field: in this case it is a "variable-sized" structure, whose memory layout starts with the non-variable fields and ends with a variable number of array items. This number is determined when a structure is allocated in the heap. Variable-sized structures cannot be inlined in other structures. -C-level operations ------------------- +Array Types ++++++++++++ -Here are the new operations that the C typer introduces in flow graphs. Ideally, a completely typed graph should only contain these operations, and no longer any of the original operations. +An array type is built as an instance of ``pypy.rpython.lltypes.Array``:: -Integer arithmetic operations (see complete list in `ctyper.py`_):: + MyArrayType = Array(('field1', Type1), ('field2', Type2)...) - v3 = int_add(v1, v2) # v3 = v1+v2; // int v1, v2, v3 - v3 = int_sub(v1, v2) # v3 = v1-v2; // int v1, v2, v3 - v3 = int_mul(v1, v2) # v3 = v1*v2; // int v1, v2, v3 - v3 = int_is_true(v1) # v3 = v1?1:0; // int v1, v3 - etc. +The items of an array are always structures; the arguments to Array() give the fields of these structures (it can of course be a single field). The allowed field types follow the same rules as for Struct(), but this particular structure cannot be variable-sized. -Function call:: +For now, each array stores its length explicitely in a header. An array can never be resized: it occupies a fixed amount of bytes determined when it is allocated. - v3 = direct_call(v1, v2, ...) # v3 = v1(v2, ...); -Memory management (see `Memory model`_):: +Pointer Types ++++++++++++++ - v2 = malloc() # for T* v2, alloc and zero sizeof(T) bytes of memory - v2 = malloc(v1) # same, but allocates sizeof(T) + v1*sizeof(T_item) - incref(v3) # for T* v3, details depend on T - decref(v3) # for T* v3, details depend on T +As in C, pointers provide the indirection needed to make a reference modifiable or sharable. Pointers can only point to a structure, an array, a function (see below) or a PyObject (see below). Pointers to primitive types, if needed, must be done by pointing to a structure with a single field of the required type. Pointer types are declared using one of:: -Pointer operations:: + GcPtr(T, **flags) + NonGcPtr(T, **flags) - v3 = arrow(v1, 'fieldname') # v3 = v1->fieldname; // if fieldname is a primitive - v3 = substruct(v1, 'fieldname') # v3 = &v1->fieldname; // if fieldname is a struct - v3 = subarray(v1, 'fieldname') # v3 = v1->fieldname; // if fieldname is an array - arrow_set(v1, 'fieldname', v2) # v1->fieldname = v2; - v3 = ptr_add(v1, v2) # v3 = v1+v2; // T* v1, int v2, T* v3 - v3 = ptr_cast(v1) # v3 = (T*) v1; // S* v1, T* v3 +The so-called GC pointers are the ones that hold a reference to the object they point to. Typically, the malloc() operation allocates and returns a GcPtr to a new structure or array. In a refcounting implementation, malloc() would allocate enough space for a reference counter before the actual structure, and initialize it to 1. Actually, GC pointers can only point to a malloc()ed structure or array. Non-GC pointers are used when you know that a pointer doesn't hold a (counted) reference to an object, usually because the object has no reference counter at all: for example, functions don't have one; more importantly, inlined substructures don't have one either. For them, care must be taken to ensure that the bigger structure of which they are part of isn't freed while the NonGcPtr to the substructure is still in use. -For regularity, all pointers should point to struct types. Casting should follow the C99 aliasing rules: in our case, we should only use it when we have got a pointer ``S* v1``, and we discover (by inspecting what v1 points to) that it is actually just the first field of a larger structure of type T. +All pointer types can also have additional flags, whose meaning is unspecified at this level (apart from the flag ``gc=True`` which GcPtrs have and NonGcPtrs miss). Types with different flags are incompatible, but the cast_flags() operation is provided to perform explicit casts. The intention is for example to represent the high-level object "the method append() of this list" as the type ``GcPtr(ListType, method='append')`` -- i.e. a pointer to the list in question with an additional flag specifying that the pointer represents the method append() of that list, as opposed to the list itself. -If you are confused by the three variants of the ``->`` operator, note that only arrow() reads the content of a field. The substruct() operation returns a pointer to a substructure of the parent structure. The subarray() operation does the same for arrays in the parent structure -- which is essentially the same as substruct(), and not as arrow(). Blame C syntax. +Function Types +++++++++++++++ -.. _`ctyper.py`: http://codespeak.net/svn/pypy/dist/pypy/translator/genc/ctyper.py +The declaration:: + MyFuncType = FuncType([Type1, Type2, ...], ResultType) +declares a function type taking arguments of the given types and returning a result of the given type. All these types must be primitives or pointers. The function type itself is considered to be a "container" type: if you wish, a function contains the bytes that make up its executable code. As with structures and arrays, they can only be manipulated through pointers. More precisely, the only thing you can do -- more or less -- with MyFuncType is to embbed it in a NonGcPtr. +The PyObject Type ++++++++++++++++++ + +This is a special type, for compatibility with CPython: it stands for a structure compatible with PyObject. It should be manipulated via GcPtr or NonGcPtr, depending on whether the CPython reference counter should be updated or not. A typed graph can still contain generic space operations (add, getitem, etc.) provided they are applied on objects whose low-level type is a pointer to ``PyObject``. In fact, code generators that support this should consider that the default type of a variable, if none is specified, is ``GcPtr(PyObject)``. In this way, they can generate the correct code for fully-untyped flow graphs. + + +Implementing RPython types +-------------------------- + +As hinted above, the RPython types (e.g. 'list') are implemented in some "restricted-restricted Python" format by manipulating only low-level types, as provided by the "testing" concrete implementation of malloc() and friends. What occurs then is that the same (tested!) very-low-level Python code -- which looks really just like C -- is then transformed into a flow graph and integrated with the rest of the user program. In other words, we replace an operation like ``add`` between two variables annotated as SomeList, with a ``simple_call`` operation invoking this very-low-level list concatenation. + +This list concatenation flow graph is then annotated as usual, with one difference: the annotator has to be taught about malloc() and the way the pointer thus obtained can be manipulated. This generates a flow graph which is hopefully completely annotated with the SomePtr annotation. Introduced just for this case, SomePtr maps directly to a low-level pointer type. This is the only change needed to the Annotator to allow it to perform type inferrence of our very-low-level snippets of code. + +See for example http://codespeak.net/svn/pypy/dist/pypy/rpython/rlist.py. + + + +.. _C: + +The C Back-End +============== + +http://codespeak.net/svn/pypy/dist/pypy/translator/genc/ + + +Overview +-------- + +The task of GenC is to convert a flow graph into C code. By itself, GenC does not use the annotations in the graph. It can actually convert unannotated graphs to C. However, to make use of the annotations if they are present, an extra pass is needed: the `RPython Typer`_, whose task is to modify the flow graph according to the annotations, replacing operations with lower-level C-ish equivalents. + +XXX GenC is currently in the process of being updated to use the RPython Typer. more documentation needed when this is done. + + + +.. _LLVM: + The LLVM Back-End ================= +http://codespeak.net/svn/pypy/dist/pypy/translator/llvm/ + + Overview -------- From ale at codespeak.net Sat May 14 02:19:17 2005 From: ale at codespeak.net (ale at codespeak.net) Date: Sat, 14 May 2005 02:19:17 +0200 (CEST) Subject: [pypy-svn] r12253 - pypy/dist/pypy/tool Message-ID: <20050514001917.7C8ED27B8E@code1.codespeak.net> Author: ale Date: Sat May 14 02:19:17 2005 New Revision: 12253 Modified: pypy/dist/pypy/tool/_enum_exceptions.py Log: added arguments checking. There are checks for correct number of arguments and correct types (for the case I understand an exact nuber of arguments I haven't run any test - it is too late for that. Will do in the morning Modified: pypy/dist/pypy/tool/_enum_exceptions.py ============================================================================== --- pypy/dist/pypy/tool/_enum_exceptions.py (original) +++ pypy/dist/pypy/tool/_enum_exceptions.py Sat May 14 02:19:17 2005 @@ -234,8 +234,17 @@ names[obj] = "%r # default, hopefully" % obj return names[obj] res = [] - for name, obj in assigned: - res.append("self.%s = %s" % (name, nameof(obj))) + for i,(name, obj) in enumerate(assigned): + if isinstance(obj,ProbeObject) or name == 'args': + res.append("self.%s = %s" % (name, nameof(obj))) + else: + res.append("if type(%s) == %s:"%(nameof(obj),repr(type(obj))[7:-2])) + res.append(" self.%s = %s" % (name, nameof(obj))) + res.append("else:") + reason ="argument %i must be %s, not %s"%(i-1,repr(type(obj))[7:-2],'%s') + reason2=''.join(["%type(","%s"%nameof(obj),")"]) + reason = "'"+ reason+"'" +reason2 + res.append(" raise TypeError(%s)"%(reason)) return tuple(res) def tryGenerate__init__(exc, maxprobe=20): @@ -266,6 +275,7 @@ yield " argc = len(args)" for argcounts, ordered_statements in cases: ordered_statements.sort() + trailer = None if len(argcounts) == maxprobe: # all counts, no condition indent = 1 @@ -274,6 +284,8 @@ dense = tuple(range(argcounts[0], argcounts[-1]+1)) == argcounts if len(argcounts) == 1: yield " if argc == %d:" % argcounts + trailer = [" else:"] + trailer += [" raise TypeError('function takes exactly 5 arguments (%d given)'%argc)"] elif dense and argcounts[0] == 0: yield " if argc <= %d:" % argcounts[-1] elif dense and argcounts[-1] == maxprobe-1: @@ -284,6 +296,8 @@ yield " if argc in %r:" % (argcounts, ) for order, line in ordered_statements: yield indent * " " + line + if trailer: + for line in trailer : yield line def tryGenerate__str__(exc, maxprobe=20): if exc in known__str__: From tismer at codespeak.net Sat May 14 03:51:00 2005 From: tismer at codespeak.net (tismer at codespeak.net) Date: Sat, 14 May 2005 03:51:00 +0200 (CEST) Subject: [pypy-svn] r12254 - pypy/dist/pypy/annotation Message-ID: <20050514015100.2F5E927B9E@code1.codespeak.net> Author: tismer Date: Sat May 14 03:50:59 2005 New Revision: 12254 Modified: pypy/dist/pypy/annotation/model.py Log: documenting some real efforts with no real success. Modified: pypy/dist/pypy/annotation/model.py ============================================================================== --- pypy/dist/pypy/annotation/model.py (original) +++ pypy/dist/pypy/annotation/model.py Sat May 14 03:50:59 2005 @@ -34,17 +34,35 @@ from pypy.objspace.flow.model import Constant from pypy.tool.tls import tlsobject import inspect - +import copy DEBUG = True # set to False to disable recording of debugging information TLS = tlsobject() +""" +Some history (Chris): + +As a first approach to break this thing down, I slottified +all of these objects. The result was not overwhelming: +A savingof 5MB,but four percent of slowdown, since object +comparison got much more expensive, by lacking a __dict__. + +So I trashed 8 hours of work, without a check-in. (Just +writing this here to leave *some* trace of work). + +Then I tried to make allinstances unique and wrote a lot +of attribute tracking code here, locked write access +outside of __init__, and patched manz modules and serveral +hundred lines of code. + +""" class SomeObject: """The set of all objects. Each instance stands for an arbitrary object about which nothing is known.""" __metaclass__ = extendabletype knowntype = object + def __eq__(self, other): return (self.__class__ is other.__class__ and self.__dict__ == other.__dict__) @@ -88,6 +106,7 @@ def __new__(cls, *args, **kw): self = super(SomeObject, cls).__new__(cls, *args, **kw) if DEBUG: + so = SomeObject try: bookkeeper = pypy.annotation.bookkeeper.getbookkeeper() position_key = bookkeeper.position_key @@ -96,9 +115,11 @@ else: SomeObject._coming_from[id(self)] = position_key, None return self + def origin(self): return SomeObject._coming_from.get(id(self), (None, None))[0] origin = property(origin) + def caused_by_merge(self): return SomeObject._coming_from.get(id(self), (None, None))[1] def set_caused_by_merge(self, nvalue): @@ -106,6 +127,9 @@ caused_by_merge = property(caused_by_merge, set_caused_by_merge) del set_caused_by_merge + def __setattr__(self, key, value): + object.__setattr__(self, key, value) + class SomeFloat(SomeObject): "Stands for a float or an integer." @@ -274,6 +298,7 @@ def __init__(self, ll_ptrtype): self.ll_ptrtype = ll_ptrtype + from pypy.rpython import lltypes annotation_to_ll_map = [ From arigo at codespeak.net Sat May 14 11:59:09 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Sat, 14 May 2005 11:59:09 +0200 (CEST) Subject: [pypy-svn] r12257 - pypy/dist/pypy/rpython Message-ID: <20050514095909.603E827BA7@code1.codespeak.net> Author: arigo Date: Sat May 14 11:59:09 2005 New Revision: 12257 Modified: pypy/dist/pypy/rpython/rlist.py pypy/dist/pypy/rpython/typer.py Log: Slightly saner approach to building and registering list operations. Modified: pypy/dist/pypy/rpython/rlist.py ============================================================================== --- pypy/dist/pypy/rpython/rlist.py (original) +++ pypy/dist/pypy/rpython/rlist.py Sat May 14 11:59:09 2005 @@ -4,66 +4,61 @@ from pypy.tool.template import compile_template +class ListType: + + def __init__(self, s_list): + assert isinstance(s_list, SomeList) + self.s_list = s_list + self.s_item = s_list.listdef.listitem.s_value + self.LIST = ForwardReference() + self.LISTPTR = GcPtr(self.LIST) + #self.ITEM = ... see below + + def define(self, typer): + self.ITEM = typer.annotation2concretetype(self.s_item) + self.LIST.become(Struct("list", + ("items", GcPtr(Array(('item', self.ITEM)))))) + + def getitem(l, i): + return l.items[i].item + + typer['getitem', self.s_list, SomeInteger()] = ( + getitem, self.LISTPTR, Signed, self.ITEM) + + ## def append(l, newitem): + ## length = len(l.items) + ## newitems = malloc(List_typ.items.TO, length+1) + ## i = 0 + ## while i Author: arigo Date: Sat May 14 12:20:49 2005 New Revision: 12258 Modified: pypy/dist/pypy/tool/template.py pypy/dist/pypy/translator/typer.py Log: - compile_template() can accept a plain string. - the TyperError exception tries to show where the problem is. Modified: pypy/dist/pypy/tool/template.py ============================================================================== --- pypy/dist/pypy/tool/template.py (original) +++ pypy/dist/pypy/tool/template.py Sat May 14 12:20:49 2005 @@ -4,19 +4,25 @@ def compile_template(source, resultname): - """Compiles the source code (a py.code.Source or a list/generator of lines) + """Compiles the source code (a string or a list/generator of lines) which should be a definition for a function named 'resultname'. The caller's global dict and local variable bindings are captured. """ if not isinstance(source, py.code.Source): - lines = list(source) + if isinstance(source, str): + lines = [source] + else: + lines = list(source) lines.append('') source = py.code.Source('\n'.join(lines)) caller = sys._getframe(1) locals = caller.f_locals - localnames = locals.keys() - localnames.sort() + if locals is caller.f_globals: + localnames = [] + else: + localnames = locals.keys() + localnames.sort() values = [locals[key] for key in localnames] source = source.putaround( Modified: pypy/dist/pypy/translator/typer.py ============================================================================== --- pypy/dist/pypy/translator/typer.py (original) +++ pypy/dist/pypy/translator/typer.py Sat May 14 12:20:49 2005 @@ -6,7 +6,11 @@ class TyperError(Exception): - pass + def __str__(self): + result = Exception.__str__(self) + if hasattr(self, 'where'): + result += '\n.. %r\n.. %r' % self.where + return result class Specializer: @@ -120,7 +124,11 @@ # make a specialized version of the current operation # (which may become several operations) - flatten_ops(self.specialized_op(op, bindings), newops) + try: + flatten_ops(self.specialized_op(op, bindings), newops) + except TyperError, e: + e.where = (block, op) + raise block.operations[:] = newops self.insert_link_conversions(block) @@ -150,24 +158,28 @@ # insert the needed conversions on the links can_insert_here = block.exitswitch is None and len(block.exits) == 1 for link in block.exits: - for i in range(len(link.args)): - a1 = link.args[i] - if a1 in (link.last_exception, link.last_exc_value):# treated specially in gen_link - continue - a2 = link.target.inputargs[i] - a2type = self.setbesttype(a2) - a1, convops = self.convertvar(a1, a2type) - if convops and not can_insert_here: - # cannot insert conversion operations around a single - # link, unless it is the only exit of this block. - # create a new block along the link... - newblock = insert_empty_block(self.annotator.translator, - link) - # ...and do the conversions there. - self.insert_link_conversions(newblock) - break # done with this link - flatten_ops(convops, block.operations) - link.args[i] = a1 + try: + for i in range(len(link.args)): + a1 = link.args[i] + if a1 in (link.last_exception, link.last_exc_value):# treated specially in gen_link + continue + a2 = link.target.inputargs[i] + a2type = self.setbesttype(a2) + a1, convops = self.convertvar(a1, a2type) + if convops and not can_insert_here: + # cannot insert conversion operations around a single + # link, unless it is the only exit of this block. + # create a new block along the link... + newblock = insert_empty_block(self.annotator.translator, + link) + # ...and do the conversions there. + self.insert_link_conversions(newblock) + break # done with this link + flatten_ops(convops, block.operations) + link.args[i] = a1 + except TyperError, e: + e.where = (block, link) + raise def specialized_op(self, op, bindings): From arigo at codespeak.net Sat May 14 13:22:05 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Sat, 14 May 2005 13:22:05 +0200 (CEST) Subject: [pypy-svn] r12261 - pypy/dist/pypy/annotation Message-ID: <20050514112205.110F727B84@code1.codespeak.net> Author: arigo Date: Sat May 14 13:22:04 2005 New Revision: 12261 Modified: pypy/dist/pypy/annotation/binaryop.py pypy/dist/pypy/annotation/listdef.py pypy/dist/pypy/annotation/model.py Log: Made SomeObject.contains() robust: now union() methods always raise UnionError if they fail; in addition, they are not allowed to have side-effects if called by contains() -- a thread-local hack :-( Modified: pypy/dist/pypy/annotation/binaryop.py ============================================================================== --- pypy/dist/pypy/annotation/binaryop.py (original) +++ pypy/dist/pypy/annotation/binaryop.py Sat May 14 13:22:04 2005 @@ -8,7 +8,7 @@ from pypy.annotation.model import SomeTuple, SomeImpossibleValue from pypy.annotation.model import SomeInstance, SomeBuiltin, SomeIterator from pypy.annotation.model import SomePBC, SomeSlice, SomeFloat -from pypy.annotation.model import unionof, set, setunion, missing_operation +from pypy.annotation.model import unionof, UnionError, set, missing_operation from pypy.annotation.bookkeeper import getbookkeeper from pypy.annotation.classdef import isclassdef from pypy.objspace.flow.model import Constant @@ -379,8 +379,7 @@ def union((bltn1, bltn2)): if bltn1.analyser != bltn2.analyser: - assert False, "merging incompatible builtins == BAD!" - return SomeObject() + raise UnionError("merging incompatible builtins == BAD!") else: s_self = unionof(bltn1.s_self, bltn2.s_self) return SomeBuiltin(bltn1.analyser, s_self) @@ -393,7 +392,7 @@ for x, classdef in pbc2.prebuiltinstances.items(): if x in d: if bool(isclassdef(classdef)) ^ bool(isclassdef(d[x])): - raise Exception( + raise UnionError( "union failed for %r with classdefs %r and %r" % (x, classdef, d[x])) if isclassdef(classdef): @@ -404,9 +403,10 @@ if x in cand.cls.__dict__.values(): break else: - assert False, ("confused pbc union trying unwarranted" - "moving up of method %s from pair %s %s" % - (x, d[x], classdef2)) + raise UnionError( + "confused pbc union trying unwarranted" + "moving up of method %s from pair %s %s" % + (x, d[x], classdef2)) d[x] = classdef result = SomePBC(d) return result Modified: pypy/dist/pypy/annotation/listdef.py ============================================================================== --- pypy/dist/pypy/annotation/listdef.py (original) +++ pypy/dist/pypy/annotation/listdef.py Sat May 14 13:22:04 2005 @@ -1,4 +1,5 @@ -from pypy.annotation.model import SomeObject, SomeImpossibleValue, tracking_unionof +from pypy.annotation.model import SomeObject, SomeImpossibleValue +from pypy.annotation.model import tracking_unionof, TLS, UnionError class ListItem: @@ -11,6 +12,8 @@ def merge(self, other): if self is not other: + if getattr(TLS, 'no_side_effects_in_union', 0): + raise UnionError("merging list/dict items") self.itemof.update(other.itemof) self.read_locations.update(other.read_locations) self.patch() # which should patch all refs to 'other' Modified: pypy/dist/pypy/annotation/model.py ============================================================================== --- pypy/dist/pypy/annotation/model.py (original) +++ pypy/dist/pypy/annotation/model.py Sat May 14 13:22:04 2005 @@ -95,7 +95,19 @@ return t.__name__ def contains(self, other): - return self == other or pair(self, other).union() == self + if self == other: + return True + try: + TLS.no_side_effects_in_union += 1 + except AttributeError: + TLS.no_side_effects_in_union = 1 + try: + try: + return pair(self, other).union() == self + except UnionError: + return False + finally: + TLS.no_side_effects_in_union -= 1 def is_constant(self): return hasattr(self, 'const') @@ -306,6 +318,7 @@ (SomeInteger(), lltypes.Signed), (SomeInteger(nonneg=True, unsigned=True), lltypes.Unsigned), (SomeChar(), lltypes.Char), + (SomePBC({None: True}), lltypes.Void), ] def annotation_to_lltype(s_val, info=None): @@ -336,6 +349,10 @@ # ____________________________________________________________ +class UnionError(Exception): + """Signals an suspicious attempt at taking the union of + deeply incompatible SomeXxx instances.""" + def unionof(*somevalues): "The most precise SomeValue instance that contains all the values." s1 = SomeImpossibleValue() From arigo at codespeak.net Sat May 14 13:50:40 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Sat, 14 May 2005 13:50:40 +0200 (CEST) Subject: [pypy-svn] r12263 - in pypy/dist/pypy/rpython: . test Message-ID: <20050514115040.AE5E227BA7@code1.codespeak.net> Author: arigo Date: Sat May 14 13:50:40 2005 New Revision: 12263 Modified: pypy/dist/pypy/rpython/lltypes.py pypy/dist/pypy/rpython/rlist.py pypy/dist/pypy/rpython/test/test_rlist.py pypy/dist/pypy/rpython/typer.py Log: list.append() and supporting code. Modified: pypy/dist/pypy/rpython/lltypes.py ============================================================================== --- pypy/dist/pypy/rpython/lltypes.py (original) +++ pypy/dist/pypy/rpython/lltypes.py Sat May 14 13:50:40 2005 @@ -194,7 +194,11 @@ def _example(self): o = self.TO._container_example() return _ptr(self, o) - + + def withflags(self, **flags): + newflags = self.flags.copy() + newflags.update(flags) + return _PtrType(self.TO, **newflags) def GcPtr(TO, **flags): return _PtrType(TO, gc=True, **flags) Modified: pypy/dist/pypy/rpython/rlist.py ============================================================================== --- pypy/dist/pypy/rpython/rlist.py (original) +++ pypy/dist/pypy/rpython/rlist.py Sat May 14 13:50:40 2005 @@ -16,27 +16,30 @@ def define(self, typer): self.ITEM = typer.annotation2concretetype(self.s_item) - self.LIST.become(Struct("list", - ("items", GcPtr(Array(('item', self.ITEM)))))) + LISTPTR = self.LISTPTR + LIST = self.LIST + ITEM = self.ITEM + LIST.become(Struct("list", + ("items", GcPtr(Array(('item', ITEM)))))) def getitem(l, i): return l.items[i].item typer['getitem', self.s_list, SomeInteger()] = ( - getitem, self.LISTPTR, Signed, self.ITEM) + getitem, LISTPTR, Signed, ITEM) - ## def append(l, newitem): - ## length = len(l.items) - ## newitems = malloc(List_typ.items.TO, length+1) - ## i = 0 - ## while i v1 = cast_flags(self) + # v2 = simple_call(v1, ...) --> v2 = simple_call(meth, v1, ...) + # + # where 'v1' becomes a pointer with the (method='method_name') flag. + # It points to 'self', but the flag modifies its meaning to + # "pointer to the method 'method_name' of self" instead of just + # "pointer to self". + # + method_name = pattern[0] + s_self = pattern[1] + method = substitution[0] + SELFPTR = substitution[1] + METHODPTR = SELFPTR.withflags(method=method_name) + s_method_name = self.annotator.bookkeeper.immutablevalue(method_name) + + self['getattr', s_self, s_method_name] = ( + 'cast_flags', SELFPTR, None, METHODPTR) + + s_method = s_self.find_method(method_name) + self[('simple_call', s_method) + pattern[2:]] = ( + method, SELFPTR) + substitution[2:] + def maketype(self, cls, s_annotation): try: return self.typecache[cls, s_annotation] From hpk at codespeak.net Sat May 14 16:57:58 2005 From: hpk at codespeak.net (hpk at codespeak.net) Date: Sat, 14 May 2005 16:57:58 +0200 (CEST) Subject: [pypy-svn] r12265 - pypy/dist/pypy/documentation/revreport Message-ID: <20050514145758.DC74227B9A@code1.codespeak.net> Author: hpk Date: Sat May 14 16:57:58 2005 New Revision: 12265 Modified: pypy/dist/pypy/documentation/revreport/revreport.py Log: test checkin (for tracker/svn connection) issue49 resolved let's see what that brings. Modified: pypy/dist/pypy/documentation/revreport/revreport.py ============================================================================== --- pypy/dist/pypy/documentation/revreport/revreport.py (original) +++ pypy/dist/pypy/documentation/revreport/revreport.py Sat May 14 16:57:58 2005 @@ -4,13 +4,14 @@ import py from pypy.documentation.revreport import delta from pypy.tool.pypyrev import pypyrev -from py.__.test.tool.outerrcapture import SimpleOutErrCapture +from py.__.misc.simplecapture import SimpleOutErrCapture BASE = py.path.local(delta.__file__).dirpath() DEST = BASE.join('revdata') assert DEST.dirpath().check() + def updatecurrent(revdir): l = [] for x in DEST.listdir(): @@ -41,17 +42,6 @@ if py.std.sys.stdout.isatty(): delta.genreport(revdir) else: - capture = SimpleOutErrCapture() - try: - delta.genreport(revdir) - except: - out, err = capture.reset() - print "stdout", out - print "stderr", err - raise - else: - out, err = capture.reset() - print "stdout" - print out + res, out, err = callcapture(delta.genreport, revdir) print "generated into", revdir updatecurrent(revdir) From hpk at codespeak.net Sat May 14 17:16:46 2005 From: hpk at codespeak.net (hpk at codespeak.net) Date: Sat, 14 May 2005 17:16:46 +0200 (CEST) Subject: [pypy-svn] r12266 - pypy/dist/pypy/documentation/revreport Message-ID: <20050514151646.B4ACF27B9A@code1.codespeak.net> Author: hpk Date: Sat May 14 17:16:46 2005 New Revision: 12266 Modified: pypy/dist/pypy/documentation/revreport/revreport.py Log: use correct stdout/err capturing Modified: pypy/dist/pypy/documentation/revreport/revreport.py ============================================================================== --- pypy/dist/pypy/documentation/revreport/revreport.py (original) +++ pypy/dist/pypy/documentation/revreport/revreport.py Sat May 14 17:16:46 2005 @@ -4,7 +4,7 @@ import py from pypy.documentation.revreport import delta from pypy.tool.pypyrev import pypyrev -from py.__.misc.simplecapture import SimpleOutErrCapture +from py.__.misc.simplecapture import callcapture BASE = py.path.local(delta.__file__).dirpath() DEST = BASE.join('revdata') From arigo at codespeak.net Sat May 14 21:47:21 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Sat, 14 May 2005 21:47:21 +0200 (CEST) Subject: [pypy-svn] r12271 - pypy/dist/pypy/documentation Message-ID: <20050514194721.0572C27BBC@code1.codespeak.net> Author: arigo Date: Sat May 14 21:47:20 2005 New Revision: 12271 Modified: pypy/dist/pypy/documentation/translation.txt Log: Clarification. Modified: pypy/dist/pypy/documentation/translation.txt ============================================================================== --- pypy/dist/pypy/documentation/translation.txt (original) +++ pypy/dist/pypy/documentation/translation.txt Sat May 14 21:47:20 2005 @@ -461,7 +461,7 @@ * Each operation, with its argument's annotation, is looked up in a table which specifies with which low-level operation(s) it should be substituted. If needed, the arguments are first converted (with extra operations) from their current ``concretetype`` to the required low-level types. For constant arguments, we just attach the ``concretetype`` to the Constant instance; as for Variables, this tells the code generator of which type the constant really is. Finally, the substitution rules specify the ``concretetype`` of the result. It is attached to the result Variable, and will be used further down the block to detect when conversions are needed. -* When a block has been transformed in this way, all the links are considered; if the concrete types of the Variables that exit do not match the canonical low-level types expected by the target block, conversions are inserted. +* When a block has been transformed in this way, all the links are considered; if the concrete types of the Variables that exit do not match the canonical low-level types expected by the target block, conversions are inserted -- they are put in a new block inserted along the link, as they are of no concern to the other exit links. This may look like flowing, similar to what the annotator does, but it is limited to a single block; for global coherency it trusts the more involved fixpoint-based algorithm run by the annotator. From pedronis at codespeak.net Sun May 15 01:11:17 2005 From: pedronis at codespeak.net (pedronis at codespeak.net) Date: Sun, 15 May 2005 01:11:17 +0200 (CEST) Subject: [pypy-svn] r12274 - pypy/dist/pypy/annotation Message-ID: <20050514231117.4B97A27BCE@code1.codespeak.net> Author: pedronis Date: Sun May 15 01:11:17 2005 New Revision: 12274 Modified: pypy/dist/pypy/annotation/bookkeeper.py Log: with the change to a safe contains union, we need to guarantee that we produce the same listdef each time for global dicts/lists differently. Before contains itself would basically unify the new fresh list/dictdef with all the old ones Modified: pypy/dist/pypy/annotation/bookkeeper.py ============================================================================== --- pypy/dist/pypy/annotation/bookkeeper.py (original) +++ pypy/dist/pypy/annotation/bookkeeper.py Sun May 15 01:11:17 2005 @@ -120,6 +120,7 @@ dictdef.generalize_value(s_value) return SomeDict(dictdef) + immutable_cache = {} def immutablevalue(self, x): """The most precise SomeValue instance that contains the @@ -141,13 +142,21 @@ elif tp is float: result = SomeFloat() elif tp is list: - items_s = [self.immutablevalue(e) for e in x] - result = SomeList(ListDef(self, unionof(*items_s))) + try: + return self.immutable_cache[id(x)] + except KeyError: + items_s = [self.immutablevalue(e) for e in x] + result = SomeList(ListDef(self, unionof(*items_s))) + self.immutable_cache[id(x)] = result elif tp is dict: # exactly a dict - keys_s = [self.immutablevalue(e) for e in x.keys()] - values_s = [self.immutablevalue(e) for e in x.values()] - result = SomeDict(DictDef(self, unionof(*keys_s), - unionof(*values_s))) + try: + return self.immutable_cache[id(x)] + except KeyError: + keys_s = [self.immutablevalue(e) for e in x.keys()] + values_s = [self.immutablevalue(e) for e in x.values()] + result = SomeDict(DictDef(self, unionof(*keys_s), + unionof(*values_s))) + self.immutable_cache[id(x)] = result elif ishashable(x) and x in BUILTIN_ANALYZERS: result = SomeBuiltin(BUILTIN_ANALYZERS[x]) elif callable(x) or isinstance(x, staticmethod): # XXX From tismer at codespeak.net Sun May 15 02:00:40 2005 From: tismer at codespeak.net (tismer at codespeak.net) Date: Sun, 15 May 2005 02:00:40 +0200 (CEST) Subject: [pypy-svn] r12275 - pypy/dist/pypy/documentation Message-ID: <20050515000040.F22D827BCE@code1.codespeak.net> Author: tismer Date: Sun May 15 02:00:40 2005 New Revision: 12275 Modified: pypy/dist/pypy/documentation/translation.txt Log: typo Modified: pypy/dist/pypy/documentation/translation.txt ============================================================================== --- pypy/dist/pypy/documentation/translation.txt (original) +++ pypy/dist/pypy/documentation/translation.txt Sun May 15 02:00:40 2005 @@ -505,7 +505,7 @@ MyStructType = Struct('somename', ('field1', Type1), ('field2', Type2)...) -This declares a structure (or a Pascal ``record``) containing the specified named fields with the given types. The field names cannot start with an underscope. As noted above, you cannot directly manipulate structure objects, but only pointer to structures living in the heap. +This declares a structure (or a Pascal ``record``) containing the specified named fields with the given types. The field names cannot start with an underscore. As noted above, you cannot directly manipulate structure objects, but only pointer to structures living in the heap. By contrast, the fields themselves can be of primitive, pointer or container type. When a structure contains another structure as a field we say that the latter is "inlined" in the former: the bigger structure contains the smaller one as part of its memory layout. From tismer at codespeak.net Sun May 15 02:32:02 2005 From: tismer at codespeak.net (tismer at codespeak.net) Date: Sun, 15 May 2005 02:32:02 +0200 (CEST) Subject: [pypy-svn] r12276 - pypy/dist/goal Message-ID: <20050515003202.4AB8F27BCE@code1.codespeak.net> Author: tismer Date: Sun May 15 02:32:02 2005 New Revision: 12276 Modified: pypy/dist/goal/translate_pypy.py Log: for convenience, targetspec may or may not specify .py (useful for tabbing) Modified: pypy/dist/goal/translate_pypy.py ============================================================================== --- pypy/dist/goal/translate_pypy.py (original) +++ pypy/dist/goal/translate_pypy.py Sun May 15 02:32:02 2005 @@ -10,7 +10,7 @@ targetspec.py is a python file defining what is the translation target and setting things up for it, it should have a target function returning an entry_point ...; - defaults to targetpypy + defaults to targetpypy. The .py suffix is optional. -text Don't start the Pygame viewer -no-a Don't infer annotations, just translate everything -no-s Don't simplify the graph after annotation @@ -198,7 +198,11 @@ listen_port = int(arg) except ValueError: if os.path.isfile(arg+'.py'): + assert not os.path.isfile(arg), ( + "ambiguous file naming, please rename %s" % arg) targetspec = arg + elif os.path.isfile(arg) and arg.endswith('.py'): + targetspec = arg[:-3] elif arg.startswith('-huge='): huge = int(arg[6:]) else: From pedronis at codespeak.net Sun May 15 03:29:57 2005 From: pedronis at codespeak.net (pedronis at codespeak.net) Date: Sun, 15 May 2005 03:29:57 +0200 (CEST) Subject: [pypy-svn] r12277 - pypy/dist/pypy/annotation Message-ID: <20050515012957.AB0CB27BD3@code1.codespeak.net> Author: pedronis Date: Sun May 15 03:29:57 2005 New Revision: 12277 Modified: pypy/dist/pypy/annotation/binaryop.py pypy/dist/pypy/annotation/model.py pypy/dist/pypy/annotation/unaryop.py Log: more consistent faking that there are only new-style classes, so knowntype cannot be classobj use SomeObject(knowntype=type) to carry types around, before we used a bare SomeObject preserve .const and .knowntype if possible when unifying SomeObjects do possibly the right thing when unifying SomeObjects with == .const and attached is_type_of Modified: pypy/dist/pypy/annotation/binaryop.py ============================================================================== --- pypy/dist/pypy/annotation/binaryop.py (original) +++ pypy/dist/pypy/annotation/binaryop.py Sun May 15 03:29:57 2005 @@ -49,10 +49,24 @@ return obj1 else: result = SomeObject() + if obj1.knowntype == obj2.knowntype and obj1.knowntype != object: + result.knowntype = obj1.knowntype is_type_of1 = getattr(obj1, 'is_type_of', None) is_type_of2 = getattr(obj2, 'is_type_of', None) - if is_type_of1 and is_type_of1 == is_type_of2: - result.is_type_of = is_type_of1 + if obj1.is_constant() and obj2.is_constant() and obj1.const == obj2.const: + result.const = obj1.const + is_type_of = {} + if is_type_of1: + for v in is_type_of1: + is_type_of[v] = True + if is_type_of2: + for v in is_type_of2: + is_type_of[v] = True + if is_type_of: + result.is_type_of = is_type_of + else: + if is_type_of1 and is_type_of1 == is_type_of2: + result.is_type_of = is_type_of1 # try to preserve the origin of SomeObjects if obj1 == result: return obj1 Modified: pypy/dist/pypy/annotation/model.py ============================================================================== --- pypy/dist/pypy/annotation/model.py (original) +++ pypy/dist/pypy/annotation/model.py Sun May 15 03:29:57 2005 @@ -130,7 +130,10 @@ def origin(self): return SomeObject._coming_from.get(id(self), (None, None))[0] - origin = property(origin) + def set_origin(self, nvalue): + SomeObject._coming_from[id(self)] = nvalue, self.caused_by_merge + origin = property(origin, set_origin) + del set_origin def caused_by_merge(self): return SomeObject._coming_from.get(id(self), (None, None))[1] @@ -260,6 +263,8 @@ [new_or_old_class(x) for x in prebuiltinstances if x is not None]) + if self.knowntype == type(Exception): + self.knowntype = type if prebuiltinstances.values() == [True]: # hack for the convenience of direct callers to SomePBC(): # only if there is a single object in prebuiltinstances and @@ -364,7 +369,11 @@ return s1 def tracking_unionof(ctxt, *somevalues): - return unionof(*somevalues) + s1 = unionof(*somevalues) + if not s1.origin and type(ctxt) is tuple: + s1.origin = ctxt+(0,) + return s1 + # ____________________________________________________________ Modified: pypy/dist/pypy/annotation/unaryop.py ============================================================================== --- pypy/dist/pypy/annotation/unaryop.py (original) +++ pypy/dist/pypy/annotation/unaryop.py Sun May 15 03:29:57 2005 @@ -41,6 +41,7 @@ r = immutablevalue(obj.knowntype) else: r = SomeObject() + r.knowntype = type bk = getbookkeeper() fn, block, i = bk.position_key annotator = bk.annotator From pedronis at codespeak.net Sun May 15 03:38:56 2005 From: pedronis at codespeak.net (pedronis at codespeak.net) Date: Sun, 15 May 2005 03:38:56 +0200 (CEST) Subject: [pypy-svn] r12278 - pypy/dist/pypy/objspace/flow Message-ID: <20050515013856.819C027BD3@code1.codespeak.net> Author: pedronis Date: Sun May 15 03:38:56 2005 New Revision: 12278 Modified: pypy/dist/pypy/objspace/flow/flowcontext.py pypy/dist/pypy/objspace/flow/objspace.py Log: attach a constant exception type too as .last_exception to exception links; propagate it fix some last cases where the graph could contain not normalized exception, StopIteration case and ValueError from unpacking Modified: pypy/dist/pypy/objspace/flow/flowcontext.py ============================================================================== --- pypy/dist/pypy/objspace/flow/flowcontext.py (original) +++ pypy/dist/pypy/objspace/flow/flowcontext.py Sun May 15 03:38:56 2005 @@ -20,11 +20,13 @@ class SpamBlock(Block): - dead = False - + + __slots__ = "dead framestate".split() + def __init__(self, framestate): Block.__init__(self, framestate.getvariables()) self.framestate = framestate + self.dead = False def patchframe(self, frame): if self.dead: @@ -35,6 +37,8 @@ class EggBlock(Block): + __slots__ = "prevblock booloutcome last_exception".split() + def __init__(self, inputargs, prevblock, booloutcome): Block.__init__(self, inputargs) self.prevblock = prevblock @@ -55,6 +59,9 @@ prevblock = block return recorder + def extravars(self, last_exception=None, last_exc_value=None): + self.last_exception = last_exception + # ____________________________________________________________ class Recorder: @@ -117,18 +124,17 @@ elif replace_last_variable_except_in_first_case is not None: assert block.operations[-1].result is bvars[-1] vars = bvars[:-1] - for name in replace_last_variable_except_in_first_case: - newvar = Variable(name) + vars2 = bvars[:-1] + for name, newvar in replace_last_variable_except_in_first_case(case): attach[name] = newvar vars.append(newvar) - vars2 = bvars[:-1] - while len(vars2) < len(vars): vars2.append(Variable()) egg = EggBlock(vars2, block, case) ec.pendingblocks.append(egg) link = Link(vars, egg, case) if attach: link.extravars(**attach) + egg.extravars(**attach) # xxx links.append(link) block.exitswitch = w_condition @@ -218,15 +224,23 @@ return self.recorder.guessbool(self, w_condition, **kwds) def guessexception(self, *classes): + def replace_exc_values(case): + if case is not Exception: + yield 'last_exception', Constant(case) + yield 'last_exc_value', Variable('last_exc_value') + else: + yield 'last_exception', Variable('last_exception') + yield 'last_exc_value', Variable('last_exc_value') outcome = self.guessbool(Constant(last_exception), cases = [None] + list(classes), - replace_last_variable_except_in_first_case = [ - 'last_exception', # exc. class - 'last_exc_value']) # exc. value + replace_last_variable_except_in_first_case = replace_exc_values) if outcome is None: w_exc_cls, w_exc_value = None, None else: - w_exc_cls, w_exc_value = self.recorder.crnt_block.inputargs[-2:] + egg = self.recorder.crnt_block + w_exc_cls, w_exc_value = egg.inputargs[-2:] + if isinstance(egg.last_exception, Constant): + w_exc_cls = egg.last_exception return outcome, w_exc_cls, w_exc_value def build_flow(self): @@ -263,6 +277,7 @@ self.recorder.crnt_block.closeblock(link) except OperationError, e: + print "OE", e.w_type, e.w_value link = Link([e.w_type, e.w_value], self.graph.exceptblock) self.recorder.crnt_block.closeblock(link) Modified: pypy/dist/pypy/objspace/flow/objspace.py ============================================================================== --- pypy/dist/pypy/objspace/flow/objspace.py (original) +++ pypy/dist/pypy/objspace/flow/objspace.py Sun May 15 03:38:56 2005 @@ -284,7 +284,9 @@ w_len = self.len(w_iterable) w_correct = self.eq(w_len, self.wrap(expected_length)) if not self.is_true(w_correct): - raise OperationError(self.w_ValueError, self.w_None) + e = OperationError(self.w_ValueError, self.w_None) + e.normalize_exception(self) + raise e return [self.do_operation('getitem', w_iterable, self.wrap(i)) for i in range(expected_length)] return ObjSpace.unpackiterable(self, w_iterable, expected_length) @@ -313,7 +315,7 @@ context = self.getexecutioncontext() outcome, w_exc_cls, w_exc_value = context.guessexception(StopIteration) if outcome is StopIteration: - raise OperationError(self.w_StopIteration, self.w_None) + raise OperationError(self.w_StopIteration, w_exc_value) else: return w_item @@ -387,9 +389,10 @@ # we assume that the caught exc_cls will be exactly the # one specified by 'outcome', and not a subclass of it, # unless 'outcome' is Exception. - if outcome is not Exception: - w_exc_cls = Constant(outcome) - raise flowcontext.ImplicitOperationError(w_exc_cls, + #if outcome is not Exception: + #w_exc_cls = Constant(outcome) Now done by guessexception itself + #pass + raise flowcontext.ImplicitOperationError(w_exc_cls, w_exc_value) # ______________________________________________________________________ From pedronis at codespeak.net Sun May 15 03:48:36 2005 From: pedronis at codespeak.net (pedronis at codespeak.net) Date: Sun, 15 May 2005 03:48:36 +0200 (CEST) Subject: [pypy-svn] r12279 - in pypy/dist/pypy/translator: . test Message-ID: <20050515014836.9949D27BD3@code1.codespeak.net> Author: pedronis Date: Sun May 15 03:48:36 2005 New Revision: 12279 Modified: pypy/dist/pypy/translator/annrpython.py pypy/dist/pypy/translator/test/test_annrpython.py Log: a bit more precision in annotating exception handling code (with tests) ! propagate exc values as at least SomeInstance(Exception), unclear if we want this always propagate exc types as SomeObject(knowntype=type) possibly with .const set and a proper .is_type_of together with the changes to flowspace and annotation/ subdir, this enables better treatment of exception handling code where constant exc types are present in the graph. It seems that after these changes we don't have anymore bare SomeObjects in targetpypymain related to exception handling. Modified: pypy/dist/pypy/translator/annrpython.py ============================================================================== --- pypy/dist/pypy/translator/annrpython.py (original) +++ pypy/dist/pypy/translator/annrpython.py Sun May 15 03:48:36 2005 @@ -439,10 +439,13 @@ if isinstance(link.exitcase, (types.ClassType, type)) \ and issubclass(link.exitcase, Exception): last_exception_object = annmodel.SomeObject() - if link.exitcase is Exception: - last_exc_value_object = annmodel.SomeObject() - else: - last_exc_value_object = self.bookkeeper.valueoftype(link.exitcase) + last_exception_object.knowntype = type + if isinstance(last_exception_var, Constant): + last_exception_object.const = last_exception_var.value + #if link.exitcase is Exception: + # last_exc_value_object = annmodel.SomeObject() + #else: + last_exc_value_object = self.bookkeeper.valueoftype(link.exitcase) last_exc_value_vars = [] in_except_block = True # not needed! @@ -454,10 +457,10 @@ for a,v in zip(link.args,link.target.inputargs): renaming.setdefault(a, []).append(v) for a,v in zip(link.args,link.target.inputargs): - if a == last_exception_var: + if a is last_exception_var: assert in_except_block cells.append(last_exception_object) - elif a == last_exc_value_var: + elif a is last_exc_value_var: assert in_except_block cells.append(last_exc_value_object) last_exc_value_vars.append(v) @@ -471,7 +474,12 @@ for v in cell.is_type_of: new_vs = renaming.get(v,[]) renamed_is_type_of += new_vs - cell = annmodel.SomeObject() + newcell = annmodel.SomeObject() + if cell.knowntype == type: + newcell.knowntype = type + if cell.is_constant(): + newcell.const = cell.const + cell = newcell cell.is_type_of = renamed_is_type_of cells.append(cell) Modified: pypy/dist/pypy/translator/test/test_annrpython.py ============================================================================== --- pypy/dist/pypy/translator/test/test_annrpython.py (original) +++ pypy/dist/pypy/translator/test/test_annrpython.py Sun May 15 03:48:36 2005 @@ -933,6 +933,75 @@ [int]) assert s == a.bookkeeper.immutablevalue(None) + def test_reraiseKeyError(self): + def f(dic): + try: + dic[5] + except KeyError: + raise + a = self.RPythonAnnotator() + a.build_types(f, [dict]) + fg = a.translator.getflowgraph(f) + et, ev = fg.exceptblock.inputargs + t = annmodel.SomeObject() + t.knowntype = type + t.const = KeyError + t.is_type_of = [ev] + assert a.binding(et) == t + assert isinstance(a.binding(ev), annmodel.SomeInstance) and a.binding(ev).classdef.cls == KeyError + + def test_reraiseAnything(self): + def f(dic): + try: + dic[5] + except: + raise + a = self.RPythonAnnotator() + a.build_types(f, [dict]) + fg = a.translator.getflowgraph(f) + et, ev = fg.exceptblock.inputargs + t = annmodel.SomeObject() + t.knowntype = type + t.is_type_of = [ev] + assert a.binding(et) == t + assert isinstance(a.binding(ev), annmodel.SomeInstance) and a.binding(ev).classdef.cls == LookupError + + def test_exception_mixing(self): + def h(): + pass + + def g(): + pass + + class X(Exception): + def __init__(self, x=0): + self.x = x + + def f(a, l): + if a==1: + raise X + elif a==2: + raise X(1) + elif a==3: + raise X,4 + else: + try: + l[0] + x,y = l + g() + finally: + h() + a = self.RPythonAnnotator() + a.build_types(f, [int, list]) + fg = a.translator.getflowgraph(f) + et, ev = fg.exceptblock.inputargs + t = annmodel.SomeObject() + t.knowntype = type + t.is_type_of = [ev] + assert a.binding(et) == t + assert isinstance(a.binding(ev), annmodel.SomeInstance) and a.binding(ev).classdef.cls == Exception + + def g(n): return [0,1,2,n] From pedronis at codespeak.net Sun May 15 03:59:01 2005 From: pedronis at codespeak.net (pedronis at codespeak.net) Date: Sun, 15 May 2005 03:59:01 +0200 (CEST) Subject: [pypy-svn] r12280 - pypy/dist/pypy/objspace/flow Message-ID: <20050515015901.3DD3F27BD3@code1.codespeak.net> Author: pedronis Date: Sun May 15 03:59:01 2005 New Revision: 12280 Modified: pypy/dist/pypy/objspace/flow/flowcontext.py Log: oops, disable debug print Modified: pypy/dist/pypy/objspace/flow/flowcontext.py ============================================================================== --- pypy/dist/pypy/objspace/flow/flowcontext.py (original) +++ pypy/dist/pypy/objspace/flow/flowcontext.py Sun May 15 03:59:01 2005 @@ -277,7 +277,7 @@ self.recorder.crnt_block.closeblock(link) except OperationError, e: - print "OE", e.w_type, e.w_value + #print "OE", e.w_type, e.w_value link = Link([e.w_type, e.w_value], self.graph.exceptblock) self.recorder.crnt_block.closeblock(link) From hpk at codespeak.net Sun May 15 10:34:47 2005 From: hpk at codespeak.net (hpk at codespeak.net) Date: Sun, 15 May 2005 10:34:47 +0200 (CEST) Subject: [pypy-svn] r12283 - pypy/dist/pypy/documentation Message-ID: <20050515083447.82AE427BB6@code1.codespeak.net> Author: hpk Date: Sun May 15 10:34:47 2005 New Revision: 12283 Modified: pypy/dist/pypy/documentation/coding-guide.txt Log: a section about the new development tracker (we should probably shift this to getting_started.txt though) Modified: pypy/dist/pypy/documentation/coding-guide.txt ============================================================================== --- pypy/dist/pypy/documentation/coding-guide.txt (original) +++ pypy/dist/pypy/documentation/coding-guide.txt Sun May 15 10:34:47 2005 @@ -485,6 +485,53 @@ allows checkin/checkout in native line-ending format. +Using the development bug/feature tracker +========================================= + +We have a `development tracker`_, based on Richard Jones' +`roundup`_ application. You can file bugs, +feature requests or see what's going on +for the next milestone, both from an E-Mail and from a +web interface. + +use your codespeak login or register +------------------------------------ + +If you already committed to the PyPy source code, chances +are that you can simply use your codespeak login that +you use for subversion or for shell access. + +If you are not a commiter then you can still `register with +the tracker`_ easily. + +modifying Issues from svn commit messages +----------------------------------------- + +If you are committing something related to +an issue in the development tracker you +can correlate your login message to a tracker +item by following these rules: + +- put the content of ``issueN STATUS`` on a single + new line + +- `N` must be an existing issue number from the `development tracker`_. + +- STATUS is one of:: + + unread + chatting + need-eg (jargon for "need example") + in-progress + testing + done-cbb (jargon for 'done, could-be-better') + resolved + +.. _`register with the tracker`: https://codespeak.net/issue/pypy-dev/user?@template=register +.. _`development tracker`: http://codespeak.net/issue/pypy-dev/ +.. _`roundup`: http://roundup.sf.net + + Test Design ============= From arigo at codespeak.net Sun May 15 13:23:40 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Sun, 15 May 2005 13:23:40 +0200 (CEST) Subject: [pypy-svn] r12284 - pypy/dist/pypy/tool/pytest/test Message-ID: <20050515112340.E400D27BB2@code1.codespeak.net> Author: arigo Date: Sun May 15 13:23:40 2005 New Revision: 12284 Modified: pypy/dist/pypy/tool/pytest/test/test_overview.py Log: Skip the test if the testresult directory is not there. Modified: pypy/dist/pypy/tool/pytest/test/test_overview.py ============================================================================== --- pypy/dist/pypy/tool/pytest/test/test_overview.py (original) +++ pypy/dist/pypy/tool/pytest/test/test_overview.py Sun May 15 13:23:40 2005 @@ -1,9 +1,12 @@ import py +from pypy.tool.pytest.confpath import testresultdir from pypy.tool.pytest.overview import ResultCache class TestResultCache: def setup_class(cls): + if not testresultdir.check(dir=1): + py.test.skip("testresult directory not checked out") cls.rc = ResultCache() cls.rc.parselatest() From arigo at codespeak.net Sun May 15 14:37:35 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Sun, 15 May 2005 14:37:35 +0200 (CEST) Subject: [pypy-svn] r12285 - pypy/dist/pypy/interpreter Message-ID: <20050515123735.5044827BB9@code1.codespeak.net> Author: arigo Date: Sun May 15 14:37:35 2005 New Revision: 12285 Modified: pypy/dist/pypy/interpreter/typedef.py Log: Exception text change to make the CPython outputtest test_generator more happy. Modified: pypy/dist/pypy/interpreter/typedef.py ============================================================================== --- pypy/dist/pypy/interpreter/typedef.py (original) +++ pypy/dist/pypy/interpreter/typedef.py Sun May 15 14:37:35 2005 @@ -183,7 +183,7 @@ fset = property.fset if fset is None: raise OperationError(space.w_TypeError, - space.wrap("read-only attribute")) + space.wrap("readonly attribute")) fset(space, w_obj, w_value) def descr_property_del(space, property, w_obj): From arigo at codespeak.net Sun May 15 14:56:55 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Sun, 15 May 2005 14:56:55 +0200 (CEST) Subject: [pypy-svn] r12286 - pypy/dist/pypy/documentation Message-ID: <20050515125655.4498D27BC2@code1.codespeak.net> Author: arigo Date: Sun May 15 14:56:55 2005 New Revision: 12286 Modified: pypy/dist/pypy/documentation/translation.txt Log: issue7 resolved Too much simplification was done in this example; added a 'return' to force the computed value to be used. Modified: pypy/dist/pypy/documentation/translation.txt ============================================================================== --- pypy/dist/pypy/documentation/translation.txt (original) +++ pypy/dist/pypy/documentation/translation.txt Sun May 15 14:56:55 2005 @@ -151,19 +151,20 @@ while n: i = i + n n = n - 1 + return i whose flow graph is:: - start -----. ,-----------------. - | n1 0 | m3 j3 | - V v | - +-------------------+ | - | input: n2 i2 | | - | v2 = is_true(n2) | | - +-------------------+ | + start -----. + | n1 0 + V + +-------------------+ + | input: n2 i2 | + | v2 = is_true(n2) | <-----------. + +-------------------+ m3 j3 | | | | |ifFalse |ifTrue | - return <---' | n2 i2 | + return <---' i2 | n2 i2 | V | +--------------------+ | | input: n3 i3 | | From pedronis at codespeak.net Sun May 15 15:05:47 2005 From: pedronis at codespeak.net (pedronis at codespeak.net) Date: Sun, 15 May 2005 15:05:47 +0200 (CEST) Subject: [pypy-svn] r12287 - in pypy/dist/pypy/objspace/std: . test Message-ID: <20050515130547.0157627BDB@code1.codespeak.net> Author: pedronis Date: Sun May 15 15:05:47 2005 New Revision: 12287 Modified: pypy/dist/pypy/objspace/std/dictobject.py pypy/dist/pypy/objspace/std/test/test_dictobject.py Log: made dict comparison more similar to CPython with some tests, and a bit more robust Modified: pypy/dist/pypy/objspace/std/dictobject.py ============================================================================== --- pypy/dist/pypy/objspace/std/dictobject.py (original) +++ pypy/dist/pypy/objspace/std/dictobject.py Sun May 15 15:05:47 2005 @@ -177,14 +177,44 @@ if len(dataleft) != len(dataright): return space.w_False for entry in dataleft: + w_val = entry.w_value + if w_val is None: + continue + w_key = entry.w_key try: - w_rightval = space.getitem(w_right, entry.w_key) - except OperationError: - return space.w_False - if not space.is_true(space.eq(entry.w_value, w_rightval)): + w_rightval = space.getitem(w_right, w_key) + except OperationError, e: + if e.match(space, space.w_KeyError): + return space.w_False + raise + if not space.is_true(space.eq(w_val, w_rightval)): return space.w_False return space.w_True - + +def characterize(space, adata, w_b): + """ (similar to CPython) + returns the smallest key in adata for which b's value is different or absent and this value """ + w_smallest_diff_a_key = None + w_its_value = None + for entry in adata: + w_val = entry.w_value + if w_val is None: + continue + w_key = entry.w_key + if w_smallest_diff_a_key is None or space.is_true(space.lt(w_key, w_smallest_diff_a_key)): + try: + w_b_value = space.getitem(w_b, w_key) + except OperationError, e: + if not e.match(space, space.w_KeyError): + raise + w_its_value = w_val + w_smallest_diff_a_key = w_key + else: + if not space.eq_w(w_val, w_b_value): + w_its_value = w_val + w_smallest_diff_a_key = w_key + return w_smallest_diff_a_key, w_its_value + def lt__Dict_Dict(space, w_left, w_right): # Different sizes, no problem dataleft = w_left.non_empties() @@ -195,18 +225,17 @@ return space.w_False # Same size - for entry in dataleft: - # This is incorrect, but we need to decide what comparisons on - # dictionaries of equal size actually means - # The Python language specification is silent on the subject - try: - w_rightval = space.getitem(w_right, entry.w_key) - except OperationError: - return space.w_True - if space.is_true(space.lt(entry.w_value, w_rightval)): - return space.w_True - # The dictionaries are equal. This is correct. - return space.w_False + w_leftdiff, w_leftval = characterize(space, dataleft, w_right) + if w_leftdiff is None: + return space.w_False + w_rightdiff, w_rightval = characterize(space, dataright, w_left) + w_res = space.w_False + if w_rightdiff is not None: + w_res = space.lt(w_leftdiff, w_rightdiff) + if space.is_w(w_res, space.w_False) and space.eq_w(w_leftdiff, w_rightdiff) and w_rightval is not None: + w_res = space.lt(w_leftval, w_rightval) + return w_res + def hash__Dict(space,w_dict): raise OperationError(space.w_TypeError,space.wrap("dict objects are unhashable")) Modified: pypy/dist/pypy/objspace/std/test/test_dictobject.py ============================================================================== --- pypy/dist/pypy/objspace/std/test/test_dictobject.py (original) +++ pypy/dist/pypy/objspace/std/test/test_dictobject.py Sun May 15 15:05:47 2005 @@ -256,6 +256,16 @@ bool = d1 < d4 assert bool == False + def test_lt2(self): + assert {'a': 1 } < { 'a': 2 } + assert not {'a': 1 } > { 'a': 2 } + assert not {'a': 1, 'b': 0 } > { 'a': 2, 'b': 0 } + assert {'a': 1, 'b': 0 } < { 'a': 2, 'b': 0 } + assert {'a': 1, 'b': 0 } < { 'a': 1, 'b': 2 } + assert not {'a': 1, 'b': 0 } < { 'a': 1, 'b': -2 } + assert {'a': 1 } < { 'b': 1} + assert {'a': 1, 'x': 2 } < { 'b': 1, 'x': 2} + def test_str_repr(self): assert '{}' == str({}) assert '{1: 2}' == str({1: 2}) From arigo at codespeak.net Sun May 15 15:05:53 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Sun, 15 May 2005 15:05:53 +0200 (CEST) Subject: [pypy-svn] r12288 - pypy/dist/pypy/interpreter Message-ID: <20050515130553.B32D527BE1@code1.codespeak.net> Author: arigo Date: Sun May 15 15:05:53 2005 New Revision: 12288 Modified: pypy/dist/pypy/interpreter/function.py pypy/dist/pypy/interpreter/generator.py pypy/dist/pypy/interpreter/typedef.py Log: Some docstrings in the built-in types' methods. Modified: pypy/dist/pypy/interpreter/function.py ============================================================================== --- pypy/dist/pypy/interpreter/function.py (original) +++ pypy/dist/pypy/interpreter/function.py Sun May 15 15:05:53 2005 @@ -151,6 +151,7 @@ return w_res def descr_function_get(space, w_function, w_obj, w_cls=None): + """functionobject.__get__(obj[, type]) -> method""" # this is not defined as a method on Function because it's generally # useful logic: w_function can be any callable. It is used by Method too. asking_for_bound = (space.is_w(w_cls, space.w_None) or @@ -284,6 +285,7 @@ self.w_function = w_function def descr_staticmethod_get(self, w_obj, w_cls=None): + """staticmethod(x).__get__(obj[, type]) -> x""" return self.w_function class BuiltinFunction(Function): Modified: pypy/dist/pypy/interpreter/generator.py ============================================================================== --- pypy/dist/pypy/interpreter/generator.py (original) +++ pypy/dist/pypy/interpreter/generator.py Sun May 15 15:05:53 2005 @@ -44,9 +44,11 @@ self.exhausted = False def descr__iter__(self): + """x.__iter__() <==> iter(x)""" return self.space.wrap(self) def descr_next(self): + """x.next() -> the next value, or raise StopIteration""" space = self.space if self.running: raise OperationError(space.w_ValueError, Modified: pypy/dist/pypy/interpreter/typedef.py ============================================================================== --- pypy/dist/pypy/interpreter/typedef.py (original) +++ pypy/dist/pypy/interpreter/typedef.py Sun May 15 15:05:53 2005 @@ -172,6 +172,8 @@ self.doc = doc def descr_property_get(space, property, w_obj, w_cls=None): + """property.__get__(obj[, type]) -> value + Read the value of the property of the given obj.""" # XXX HAAAAAAAAAAAACK (but possibly a good one) if w_obj == space.w_None and not space.is_true(space.is_(w_cls, space.type(space.w_None))): #print property, w_obj, w_cls @@ -180,6 +182,8 @@ return property.fget(space, w_obj) def descr_property_set(space, property, w_obj, w_value): + """property.__set__(obj, value) + Change the value of the property of the given obj.""" fset = property.fset if fset is None: raise OperationError(space.w_TypeError, @@ -187,6 +191,8 @@ fset(space, w_obj, w_value) def descr_property_del(space, property, w_obj): + """property.__delete__(obj) + Delete the value of the property from the given obj.""" fdel = property.fdel if fdel is None: raise OperationError(space.w_AttributeError, @@ -237,6 +243,8 @@ (self.name, self.w_cls.name, space.type(w_obj).name))) def descr_member_get(space, member, w_obj, w_w_cls=None): + """member.__get__(obj[, type]) -> value + Read the slot 'member' of the given 'obj'.""" if space.is_w(w_obj, space.w_None): return space.wrap(member) else: @@ -249,11 +257,15 @@ return w_result def descr_member_set(space, member, w_obj, w_value): + """member.__set__(obj, value) + Write into the slot 'member' of the given 'obj'.""" self = member self.typecheck(space, w_obj) w_obj.slots_w[self.index] = w_value def descr_member_del(space, member, w_obj): + """member.__delete__(obj) + Delete the value of the slot 'member' from the given 'obj'.""" self = member self.typecheck(space, w_obj) w_obj.slots_w[self.index] = None From pedronis at codespeak.net Sun May 15 15:29:33 2005 From: pedronis at codespeak.net (pedronis at codespeak.net) Date: Sun, 15 May 2005 15:29:33 +0200 (CEST) Subject: [pypy-svn] r12289 - in pypy/dist/pypy: interpreter objspace/std objspace/std/test Message-ID: <20050515132933.7273B27BDD@code1.codespeak.net> Author: pedronis Date: Sun May 15 15:29:33 2005 New Revision: 12289 Modified: pypy/dist/pypy/interpreter/baseobjspace.py pypy/dist/pypy/objspace/std/dictobject.py pypy/dist/pypy/objspace/std/test/test_dictobject.py Log: let .eq_w shortcut through is_w. Use eq_w in dict lookup logic. Modified: pypy/dist/pypy/interpreter/baseobjspace.py ============================================================================== --- pypy/dist/pypy/interpreter/baseobjspace.py (original) +++ pypy/dist/pypy/interpreter/baseobjspace.py Sun May 15 15:29:33 2005 @@ -171,7 +171,7 @@ def eq_w(self, w_obj1, w_obj2): """shortcut for space.is_true(space.eq(w_obj1, w_obj2))""" - return self.is_true(self.eq(w_obj1, w_obj2)) + return self.is_w(w_obj1, w_obj2) or self.is_true(self.eq(w_obj1, w_obj2)) def is_w(self, w_obj1, w_obj2): """shortcut for space.is_true(space.is_(w_obj1, w_obj2))""" Modified: pypy/dist/pypy/objspace/std/dictobject.py ============================================================================== --- pypy/dist/pypy/objspace/std/dictobject.py (original) +++ pypy/dist/pypy/objspace/std/dictobject.py Sun May 15 15:29:33 2005 @@ -70,14 +70,12 @@ i = lookup_hash % len(self.data) entry = self.data[i] - if entry.w_key is None or \ - space.is_true(space.is_(w_lookup, entry.w_key)): + if entry.w_key is None or space.is_w(w_lookup, entry.w_key): return entry if entry.w_key is self.w_dummy: freeslot = entry else: - if entry.hash == lookup_hash and space.is_true( - space.eq(entry.w_key, w_lookup)): + if entry.hash == lookup_hash and space.eq_w(entry.w_key, w_lookup): return entry freeslot = None @@ -91,8 +89,7 @@ else: return entry if entry.hash == lookup_hash and entry.w_key is not self.w_dummy \ - and space.is_true( - space.eq(entry.w_key, w_lookup)): + and space.eq_w(entry.w_key, w_lookup): return entry if entry.w_key is self.w_dummy and freeslot is None: freeslot = entry Modified: pypy/dist/pypy/objspace/std/test/test_dictobject.py ============================================================================== --- pypy/dist/pypy/objspace/std/test/test_dictobject.py (original) +++ pypy/dist/pypy/objspace/std/test/test_dictobject.py Sun May 15 15:29:33 2005 @@ -322,8 +322,10 @@ return x def is_(self, x, y): return x is y + is_w = is_ def eq(self, x, y): return x == y + eq_w = eq def newlist(self, l): return [] From ale at codespeak.net Sun May 15 15:46:28 2005 From: ale at codespeak.net (ale at codespeak.net) Date: Sun, 15 May 2005 15:46:28 +0200 (CEST) Subject: [pypy-svn] r12291 - pypy/dist/pypy/objspace/std Message-ID: <20050515134628.5EB2B27B8E@code1.codespeak.net> Author: ale Date: Sun May 15 15:46:28 2005 New Revision: 12291 Modified: pypy/dist/pypy/objspace/std/stringobject.py pypy/dist/pypy/objspace/std/stringtype.py Log: Added encode method Modified: pypy/dist/pypy/objspace/std/stringobject.py ============================================================================== --- pypy/dist/pypy/objspace/std/stringobject.py (original) +++ pypy/dist/pypy/objspace/std/stringobject.py Sun May 15 15:46:28 2005 @@ -994,6 +994,15 @@ return codecs.getdecoder(encoding)(str)[0] else: return codecs.getdecoder(encoding)(str, errors)[0] + + def str_encode__String_ANY_ANY(str, encoding=None, errors=None): + import codecs + if encoding is None and errors is None: + return unicode(str) + elif errors is None: + return codecs.getencoder(encoding)(str)[0] + else: + return codecs.getencoder(encoding)(str, errors)[0] ''', filename=__file__) # this one should do the import of _formatting: @@ -1012,6 +1021,7 @@ str_translate__String_ANY_ANY = app.interphook('str_translate__String_ANY_ANY') str_decode__String_ANY_ANY = app.interphook('str_decode__String_ANY_ANY') +str_encode__String_ANY_ANY = app.interphook('str_encode__String_ANY_ANY') repr__String = app.interphook('repr__String') mod__String_ANY = app2.interphook('mod__String_ANY') Modified: pypy/dist/pypy/objspace/std/stringtype.py ============================================================================== --- pypy/dist/pypy/objspace/std/stringtype.py (original) +++ pypy/dist/pypy/objspace/std/stringtype.py Sun May 15 15:46:28 2005 @@ -36,6 +36,7 @@ str_startswith = MultiMethod('startswith', 4, defaults=(0, maxint)) str_translate = MultiMethod('translate', 3, defaults=('',)) #unicode mimic not supported now str_decode = MultiMethod('decode', 3, defaults=(None, None)) +str_encode = MultiMethod('encode', 3, defaults=(None, None)) # ____________________________________________________________ From arigo at codespeak.net Sun May 15 15:52:32 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Sun, 15 May 2005 15:52:32 +0200 (CEST) Subject: [pypy-svn] r12292 - pypy/dist/lib-python/modified-2.3.4/test Message-ID: <20050515135232.9E8F027B9E@code1.codespeak.net> Author: arigo Date: Sun May 15 15:52:32 2005 New Revision: 12292 Modified: pypy/dist/lib-python/modified-2.3.4/test/test_descr.py Log: Fixes to strange tests. Modified: pypy/dist/lib-python/modified-2.3.4/test/test_descr.py ============================================================================== --- pypy/dist/lib-python/modified-2.3.4/test/test_descr.py (original) +++ pypy/dist/lib-python/modified-2.3.4/test/test_descr.py Sun May 15 15:52:32 2005 @@ -20,7 +20,7 @@ m = getattr(t, meth) while meth not in t.__dict__: t = t.__bases__[0] - vereq(m, t.__dict__[meth]) + vereq(t.__dict__[meth](a), res) vereq(m(a), res) bm = getattr(a, meth) vereq(bm(), res) @@ -38,7 +38,7 @@ m = getattr(t, meth) while meth not in t.__dict__: t = t.__bases__[0] - vereq(m, t.__dict__[meth]) + vereq(t.__dict__[meth](a, b), res) vereq(m(a, b), res) bm = getattr(a, meth) vereq(bm(b), res) @@ -362,8 +362,8 @@ pass # Two essentially featureless objects, just inheriting stuff from - # object. - vereq(dir(None), dir(Ellipsis)) + # object. NB. in PyPy, dir(None) additionally contains '__nonzero__'. + vereq(dir(object()), dir(Ellipsis)) # Nasty test case for proxied objects class Wrapper(object): From arigo at codespeak.net Sun May 15 16:15:48 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Sun, 15 May 2005 16:15:48 +0200 (CEST) Subject: [pypy-svn] r12293 - in pypy/dist/pypy/objspace/std: . test Message-ID: <20050515141548.8A9E127BBA@code1.codespeak.net> Author: arigo Date: Sun May 15 16:15:48 2005 New Revision: 12293 Modified: pypy/dist/pypy/objspace/std/test/test_typeobject.py pypy/dist/pypy/objspace/std/typeobject.py Log: Oups, I broke abstract_mro() in r11532. Fixed and added a test. Modified: pypy/dist/pypy/objspace/std/test/test_typeobject.py ============================================================================== --- pypy/dist/pypy/objspace/std/test/test_typeobject.py (original) +++ pypy/dist/pypy/objspace/std/test/test_typeobject.py Sun May 15 16:15:48 2005 @@ -158,11 +158,16 @@ def test_abstract_mro(self): class A1: __metaclass__ = _classobj - class A2(A1): + class B1(A1): pass - class A3(A2, object): + class C1(A1): + pass + class D1(B1, C1): + pass + class E1(D1, object): __metaclass__ = type - assert A3.__mro__ == (A3, A2, A1, object) + # old-style MRO in the classical part of the parent hierarchy + assert E1.__mro__ == (E1, D1, B1, A1, C1, object) def test_nodoc(self): class NoDoc(object): Modified: pypy/dist/pypy/objspace/std/typeobject.py ============================================================================== --- pypy/dist/pypy/objspace/std/typeobject.py (original) +++ pypy/dist/pypy/objspace/std/typeobject.py Sun May 15 16:15:48 2005 @@ -310,13 +310,15 @@ abstract_mro = gateway.applevel(""" def abstract_mro(klass): # abstract/classic mro - mro = [klass] - for klass in mro: - if not isinstance(klass.__bases__, tuple): - raise TypeError, '__bases__ must be a tuple' - for base in klass.__bases__: - if base not in mro: - mro.append(base) + mro = [] + stack = [klass] + while stack: + klass = stack.pop() + if klass not in mro: + mro.append(klass) + if not isinstance(klass.__bases__, tuple): + raise TypeError, '__bases__ must be a tuple' + stack += klass.__bases__[::-1] return mro """, filename=__file__).interphook("abstract_mro") From arigo at codespeak.net Sun May 15 16:33:50 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Sun, 15 May 2005 16:33:50 +0200 (CEST) Subject: [pypy-svn] r12294 - pypy/dist/lib-python/modified-2.3.4/test Message-ID: <20050515143350.62FB527BB2@code1.codespeak.net> Author: arigo Date: Sun May 15 16:33:50 2005 New Revision: 12294 Added: pypy/dist/lib-python/modified-2.3.4/test/test_mutants.py - copied, changed from r12289, pypy/dist/lib-python/2.3.4/test/test_mutants.py Log: A version of test_mutants that doesn't time out (and passes!). Copied: pypy/dist/lib-python/modified-2.3.4/test/test_mutants.py (from r12289, pypy/dist/lib-python/2.3.4/test/test_mutants.py) ============================================================================== --- pypy/dist/lib-python/2.3.4/test/test_mutants.py (original) +++ pypy/dist/lib-python/modified-2.3.4/test/test_mutants.py Sun May 15 16:33:50 2005 @@ -151,7 +151,7 @@ test_one(random.randrange(1, 100)) # See last comment block for clues about good values for n. -test(100) +test(20) ########################################################################## # Another segfault bug, distilled by Michael Hudson from a c.l.py post. From pedronis at codespeak.net Sun May 15 16:47:44 2005 From: pedronis at codespeak.net (pedronis at codespeak.net) Date: Sun, 15 May 2005 16:47:44 +0200 (CEST) Subject: [pypy-svn] r12296 - in pypy/dist/pypy/objspace/std: . test Message-ID: <20050515144744.4247A27BB6@code1.codespeak.net> Author: pedronis Date: Sun May 15 16:47:44 2005 New Revision: 12296 Modified: pypy/dist/pypy/objspace/std/test/test_typeobject.py pypy/dist/pypy/objspace/std/typeobject.py Log: name mangling (code from compiler/misc.py) for slots and test Modified: pypy/dist/pypy/objspace/std/test/test_typeobject.py ============================================================================== --- pypy/dist/pypy/objspace/std/test/test_typeobject.py (original) +++ pypy/dist/pypy/objspace/std/test/test_typeobject.py Sun May 15 16:47:44 2005 @@ -277,6 +277,25 @@ raises(TypeError, A.__dict__['x'].__set__, z, 1) raises(TypeError, A.__dict__['x'].__delete__, z) + def test_slot_mangling(self): + class A(object): + __slots__ = ('x', '__x','__xxx__','__','__dict__') + a = A() + assert '__dict__' in A.__dict__ + assert '__' in A.__dict__ + assert '__xxx__' in A.__dict__ + assert 'x' in A.__dict__ + assert '_A__x' in A.__dict__ + a.x = 1 + a._A__x = 2 + a.__xxx__ = 3 + a.__ = 4 + assert a.x == 1 + assert a._A__x == 2 + assert a.__xxx__ == 3 + assert a.__ == 4 + assert a.__dict__ == {} + def test_repr(self): globals()['__name__'] = 'a' class A(object): Modified: pypy/dist/pypy/objspace/std/typeobject.py ============================================================================== --- pypy/dist/pypy/objspace/std/typeobject.py (original) +++ pypy/dist/pypy/objspace/std/typeobject.py Sun May 15 16:47:44 2005 @@ -7,6 +7,31 @@ from copy_reg import _HEAPTYPE +# from compiler/misc.py + +MANGLE_LEN = 256 # magic constant from compile.c + +def _mangle(name, klass): + if not name.startswith('__'): + return name + if len(name) + 2 >= MANGLE_LEN: + return name + if name.endswith('__'): + return name + try: + i = 0 + while klass[i] == '_': + i = i + 1 + except IndexError: + return name + klass = klass[i:] + + tlen = len(klass) + len(name) + if tlen > MANGLE_LEN: + klass = klass[:MANGLE_LEN-tlen] + + return "_%s%s" % (klass, name) + class W_TypeObject(W_Object): from pypy.objspace.std.typetype import type_typedef as typedef @@ -109,6 +134,7 @@ wantdict = True else: # create member + slot_name = _mangle(slot_name, name) w_self.dict_w[slot_name] = space.wrap(Member(nslots, slot_name, w_self)) nslots += 1 From arigo at codespeak.net Sun May 15 17:00:21 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Sun, 15 May 2005 17:00:21 +0200 (CEST) Subject: [pypy-svn] r12297 - in pypy/dist/pypy/module: builtin test Message-ID: <20050515150021.6169F27BC2@code1.codespeak.net> Author: arigo Date: Sun May 15 17:00:21 2005 New Revision: 12297 Modified: pypy/dist/pypy/module/builtin/app_descriptor.py pypy/dist/pypy/module/test/test_newstyleclasses.py Log: super() is definitely tricky to get right... A hard-to-find typo ('typ' vs 'type') and a type(_self_) instead of a _self_class_ prevented it from working with class methods. Modified: pypy/dist/pypy/module/builtin/app_descriptor.py ============================================================================== --- pypy/dist/pypy/module/builtin/app_descriptor.py (original) +++ pypy/dist/pypy/module/builtin/app_descriptor.py Sun May 15 17:00:21 2005 @@ -121,7 +121,7 @@ def __init__(self, typ, obj=None): if obj is None: objcls = None # unbound super object - elif _issubtype(type(obj), type) and _issubtype(obj, type): + elif _issubtype(type(obj), type) and _issubtype(obj, typ): objcls = obj # special case for class methods elif _issubtype(type(obj), typ): objcls = type(obj) # normal case @@ -134,9 +134,8 @@ self.__self__ = obj self.__self_class__ = objcls def __get__(self, obj, type=None): - ga = object.__getattribute__ - if ga(self, '__self__') is None and obj is not None: - return super(ga(self, '__thisclass__'), obj) + if super.__self__.__get__(self) is None and obj is not None: + return super(super.__thisclass__.__get__(self), obj) else: return self def __getattribute__(self, attr): @@ -157,6 +156,8 @@ continue if hasattr(x, '__get__'): _self_ = super.__self__.__get__(self) - x = x.__get__(_self_, type(_self_)) + if _self_ is _self_class_: + _self_ = None # performs an unbound __get__ + x = x.__get__(_self_, _self_class_) return x return object.__getattribute__(self, attr) # fall-back Modified: pypy/dist/pypy/module/test/test_newstyleclasses.py ============================================================================== --- pypy/dist/pypy/module/test/test_newstyleclasses.py (original) +++ pypy/dist/pypy/module/test/test_newstyleclasses.py Sun May 15 17:00:21 2005 @@ -69,3 +69,14 @@ assert isinstance(A, xtype) a = A() assert isinstance(a, A) + + def test_super_classmethod(self): + class A(object): + def f(cls): + return cls + f = classmethod(f) + class B(A): + def f(cls): + return [cls, super(B, cls).f()] + f = classmethod(f) + assert B().f() == [B, B] From arigo at codespeak.net Sun May 15 17:10:02 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Sun, 15 May 2005 17:10:02 +0200 (CEST) Subject: [pypy-svn] r12298 - in pypy/dist/pypy/translator: . c c/test Message-ID: <20050515151002.2F65B27BCF@code1.codespeak.net> Author: arigo Date: Sun May 15 17:10:01 2005 New Revision: 12298 Added: pypy/dist/pypy/translator/c/ (props changed) pypy/dist/pypy/translator/c/__init__.py - copied unchanged from r12256, pypy/dist/pypy/translator/genc/__init__.py pypy/dist/pypy/translator/c/autopath.py - copied unchanged from r12256, pypy/dist/pypy/translator/genc/autopath.py pypy/dist/pypy/translator/c/database.py (contents, props changed) pypy/dist/pypy/translator/c/funcdef.py - copied, changed from r12256, pypy/dist/pypy/translator/genc/funcdef.py pypy/dist/pypy/translator/c/node.py (contents, props changed) pypy/dist/pypy/translator/c/primitive.py (contents, props changed) pypy/dist/pypy/translator/c/pyobj.py - copied, changed from r12256, pypy/dist/pypy/translator/genc/pyobjtype.py pypy/dist/pypy/translator/c/repr.py (contents, props changed) pypy/dist/pypy/translator/c/struct.py (contents, props changed) pypy/dist/pypy/translator/c/test/ (props changed) pypy/dist/pypy/translator/c/test/__init__.py - copied unchanged from r12256, pypy/dist/pypy/translator/genc/test/__init__.py pypy/dist/pypy/translator/c/test/autopath.py - copied unchanged from r12256, pypy/dist/pypy/translator/genc/test/autopath.py pypy/dist/pypy/translator/c/test/test_database.py (contents, props changed) Modified: pypy/dist/pypy/translator/translator.py Log: Checking in an attempt at a cleaner C code generator, sitting in my working copy from yesterday. Not finished in any way! Doesn't run! Added: pypy/dist/pypy/translator/c/database.py ============================================================================== --- (empty file) +++ pypy/dist/pypy/translator/c/database.py Sun May 15 17:10:01 2005 @@ -0,0 +1,86 @@ +from pypy.translator.gensupp import NameManager +from pypy.rpython.lltypes import Primitive, _PtrType, typeOf +from pypy.rpython.lltypes import Struct, Array, FuncType, PyObject +from pypy.rpython.typer import PyObjPtr +from pypy.objspace.flow.model import Constant +from pypy.translator.c.primitive import PrimitiveName, PrimitiveType +from pypy.translator.c.node import StructDefNode, ArrayDefNode +from pypy.translator.c.node import ContainerNodeClass + +# ____________________________________________________________ + +class LowLevelDatabase: + + def __init__(self): + self.structdefnodes = {} + self.structdeflist = [] + self.containernodes = {} + self.containerlist = [] + self.namespace = NameManager() + # keywords cannot be reused. This is the C99 draft's list. + self.namespace.make_reserved_names(''' + auto enum restrict unsigned + break extern return void + case float short volatile + char for signed while + const goto sizeof _Bool + continue if static _Complex + default inline struct _Imaginary + do int switch + double long typedef + else register union + ''') + + def gettype(self, T, who_asks=None): + if isinstance(T, Primitive): + return PrimitiveType[T] + elif isinstance(T, _PtrType): + typename = self.gettype(T.TO) # who_asks not propagated + return typename.replace('@', '*@') + elif isinstance(T, (Struct, Array)): + try: + node = self.structdefnodes[T] + except KeyError: + if isinstance(T, Struct): + node = StructDefNode(self, T) + else: + node = ArrayDefNode(self, T) + self.structdefnodes[T] = node + self.structdeflist.append(node) + if who_asks is not None: + who_asks.dependencies[node] = True + return 'struct %s @' % node.name + elif isinstance(T, PyObject): + return 'PyObject' + elif isinstance(T, FuncType): + resulttype = self.gettype(T.RESULT) + argtypes = ', '.join([self.gettype(ARG) for ARG in T.ARGS + if ARG != Void]) + if argtypes: + argtypes = argtypes.replace('@', '') + else: + argtypes = 'void' + return resulttype.replace('@', '(@)(%s)' % argtypes) + else: + raise Exception("don't know about type %r" % (T,)) + + def get(self, obj): + T = typeOf(obj) + if isinstance(T, Primitive): + return PrimitiveName[T](obj) + elif isinstance(T, _PtrType): + try: + node = self.containernodes[obj] + except KeyError: + nodecls = ContainerNodeClass[T.TO.__class__] + node = nodecls(self, T.TO, obj) + self.containernodes[obj] = node + self.containerlist.append(node) + return node.ptrname + else: + raise Exception("don't know about %r" % (obj,)) + + def complete(self): + for node in self.containerlist: + for value in node.enum_dependencies(self): + self.get(value) Copied: pypy/dist/pypy/translator/c/funcdef.py (from r12256, pypy/dist/pypy/translator/genc/funcdef.py) ============================================================================== --- pypy/dist/pypy/translator/genc/funcdef.py (original) +++ pypy/dist/pypy/translator/c/funcdef.py Sun May 15 17:10:01 2005 @@ -6,10 +6,7 @@ from pypy.objspace.flow.model import last_exception from pypy.translator.simplify import simplify_graph from pypy.translator.unsimplify import remove_direct_loops -from pypy.translator.genc.inttype import CIntType -from pypy.translator.genc.nonetype import CNoneType -from pypy.translator.genc.functype import CFuncPtrType -from pypy.translator.genc.pyobjtype import CBorrowedPyObjectType +from pypy.rpython.typer import PyObjPtr from pypy.interpreter.pycode import CO_VARARGS from pypy.tool.compile import compile2 from types import FunctionType @@ -98,15 +95,12 @@ def ctypeof(self, var_or_const): - try: - return var_or_const.concretetype - except AttributeError: - return self.genc.pyobjtype + return getattr(var_or_const, 'concretetype', PyObjPtr) def get_globalobject(self): if self.globalobject_name is None: self.wrapper_name = 'py' + self.fast_name - self.globalobject_name = self.genc.pyobjtype.uniquename('gfunc_' + + self.globalobject_name = self.genc.pyobj.uniquename('gfunc_' + self.base_name) return self.globalobject_name Added: pypy/dist/pypy/translator/c/node.py ============================================================================== --- (empty file) +++ pypy/dist/pypy/translator/c/node.py Sun May 15 17:10:01 2005 @@ -0,0 +1,67 @@ +from __future__ import generators +from pypy.translator.gensupp import C_IDENTIFIER +from pypy.rpython.lltypes import Struct, Array, FuncType, PyObject + + +class StructDefNode: + + def __init__(self, db, STRUCT): + self.STRUCT = STRUCT + self.name = db.namespace.uniquename(STRUCT._name) + self.dependencies = {} + self.typenames = [] + for name in STRUCT._names: + T = STRUCT._flds[name] + self.typenames.append(db.gettype(T, who_asks=self)) + + +class ArrayDefNode: + + def __init__(self, db, ARRAY): + self.ARRAY = ARRAY + self.name = db.namespace.uniquename('array') + self.dependencies = {} + self.structname = db.gettype(ARRAY.OF, who_asks=self) + + +class ContainerNode: + + def __init__(self, db, T, obj): + self.T = T + self.obj = obj + self.name = db.namespace.uniquename('g_' + self.basename()) + self.ptrname = '&' + self.name + self.dependencies = {} + self.typename = db.gettype(T, who_asks=self) + + +class StructNode(ContainerNode): + def basename(self): + return self.T._name + def enum_dependencies(self, db): + for name in self.T._names: + yield getattr(self.obj, name) + +class ArrayNode(ContainerNode): + def basename(self): + return 'array' + def enum_dependencies(self, db): + for i in range(len(self.obj)): + yield self.obj[i] + +class FuncNode(ContainerNode): + def basename(self): + return self.obj._name + def enum_dependencies(self, db): + Booom + +class PyObjectNode(ContainerNode): + basename = 'BOOOM' + + +ContainerNodeClass = { + Struct: StructNode, + Array: ArrayNode, + FuncType: FuncNode, + PyObject: PyObjectNode, + } Added: pypy/dist/pypy/translator/c/primitive.py ============================================================================== --- (empty file) +++ pypy/dist/pypy/translator/c/primitive.py Sun May 15 17:10:01 2005 @@ -0,0 +1,42 @@ +from pypy.rpython.lltypes import * + +# ____________________________________________________________ +# +# Primitives + +def name_signed(value): + return '%d' % value + +def name_unsigned(value): + assert value >= 0 + return '%d' % value + +def name_char(value): + value = value + assert type(value) is str and len(value) == 1 + if ' ' <= value < '\x7f': + return "'%s'" % (value.replace("'", r"\'"),) + else: + return '%d' % ord(value) + +def name_bool(value): + return '%d' % value + +def name_void(value): + return '/* nothing */' + +PrimitiveName = { + Signed: name_signed, + Unsigned: name_unsigned, + Char: name_char, + Bool: name_bool, + Void: name_void, + } + +PrimitiveType = { + Signed: 'long @', + Unsigned: 'unsigned long @', + Char: 'char @', + Bool: 'char @', + Void: 'void @', + } Copied: pypy/dist/pypy/translator/c/pyobj.py (from r12256, pypy/dist/pypy/translator/genc/pyobjtype.py) ============================================================================== --- pypy/dist/pypy/translator/genc/pyobjtype.py (original) +++ pypy/dist/pypy/translator/c/pyobj.py Sun May 15 17:10:01 2005 @@ -1,9 +1,12 @@ from __future__ import generators import autopath, os, sys, __builtin__, marshal, zlib +from types import FunctionType, CodeType, InstanceType, ClassType + from pypy.objspace.flow.model import Variable, Constant from pypy.translator.gensupp import builtin_base, NameManager -from pypy.translator.genc.basetype import CType -from types import FunctionType, CodeType, InstanceType, ClassType +from pypy.translator.c.repr import Repr + +from pypy.translator.gensupp import builtin_base, NameManager from pypy.rpython.rarithmetic import r_int, r_uint @@ -13,17 +16,16 @@ # Should this be registered with the annotator? from pypy.interpreter.baseobjspace import ObjSpace -class CPyObjectType(CType): - """The PyObject* C type. + +class ReprPyObject(Repr): + """Handles 'PyObject*'; factored out from GenC. This class contains all the nameof_xxx() methods that allow a wild variety of Python objects to be 'pickled' as Python source code that will reconstruct them. """ - typename = 'pyobj' - error_return = 'NULL' def __init__(self, translator): - super(CPyObjectType, self).__init__(translator) + self.translator = translator self.namespace = NameManager() # keywords cannot be reused. This is the C99 draft's list. self.namespace.make_reserved_names(''' @@ -435,9 +437,6 @@ def later(self, gen): self.latercode.append((gen, self.debugstack)) - def init_globals(self, genc): - yield 'typedef PyObject* pyobj;' - def collect_globals(self, genc): while self.latercode: gen, self.debugstack = self.latercode.pop() @@ -471,11 +470,3 @@ co = compile(source, genc.modname, 'exec') del source return marshal.dumps(co) - - -class CBorrowedPyObjectType(CType): - typename = 'borrowedpyobj' - error_return = 'NULL' - - def init_globals(self, genc): - yield 'typedef PyObject* borrowedpyobj;' Added: pypy/dist/pypy/translator/c/repr.py ============================================================================== --- (empty file) +++ pypy/dist/pypy/translator/c/repr.py Sun May 15 17:10:01 2005 @@ -0,0 +1,17 @@ + +class Repr: + """Base class: a representation of a constant value of a specific type. + Each Repr instance knows how to generate C code that defines the + corresponding value, and which C expression can be used to read it. + """ + def __init__(self, db, lowleveltype, value): + self.db = db + self.lowleveltype = lowleveltype + self.value = value + + def follow_references(self): + pass + + def follow_type_references(db, lowleveltype): + pass + follow_type_references = staticmethod(follow_type_references) Added: pypy/dist/pypy/translator/c/struct.py ============================================================================== --- (empty file) +++ pypy/dist/pypy/translator/c/struct.py Sun May 15 17:10:01 2005 @@ -0,0 +1,12 @@ +from pypy.rpython.lltypes import * +from pypy.translator.c.repr import Repr + + +class ReprStruct(Repr): + + def follow_type_references(db, lowleveltype): + T = lowleveltype.TO + assert isinstance(T, Struct) + for name in T._names: + db.getlltype(T._flds[name]) + follow_type_references = staticmethod(follow_type_references) Added: pypy/dist/pypy/translator/c/test/test_database.py ============================================================================== --- (empty file) +++ pypy/dist/pypy/translator/c/test/test_database.py Sun May 15 17:10:01 2005 @@ -0,0 +1,49 @@ +import autopath +from pypy.rpython.lltypes import * +from pypy.translator.c.database import LowLevelDatabase +from pypy.objspace.flow.model import Constant +from pypy.rpython.lltypes import Struct, Array, malloc + + + +def test_primitive(): + db = LowLevelDatabase() + assert db.get(5) == '5' + assert db.get(True) == '1' + +def test_struct(): + db = LowLevelDatabase() + S = Struct('test', ('x', Signed)) + s = malloc(S) + s.x = 42 + assert db.get(s).startswith('&g_') + assert db.containernodes.keys() == [s] + assert db.structdefnodes.keys() == [S] + +def test_inlined_struct(): + db = LowLevelDatabase() + S = Struct('test', ('x', Struct('subtest', ('y', Signed)))) + s = malloc(S) + s.x.y = 42 + assert db.get(s).startswith('&g_') + assert db.containernodes.keys() == [s] + assert len(db.structdefnodes) == 2 + assert S in db.structdefnodes + assert S.x in db.structdefnodes + +def test_complete(): + db = LowLevelDatabase() + T = Struct('subtest', ('y', Signed)) + S = Struct('test', ('x', GcPtr(T))) + s = malloc(S) + s.x = malloc(T) + s.x.y = 42 + assert db.get(s).startswith('&g_') + assert db.containernodes.keys() == [s] + db.complete() + assert len(db.containernodes) == 2 + assert s in db.containernodes + assert s.x in db.containernodes + assert len(db.structdefnodes) == 2 + assert S in db.structdefnodes + assert S.x.TO in db.structdefnodes Modified: pypy/dist/pypy/translator/translator.py ============================================================================== --- pypy/dist/pypy/translator/translator.py (original) +++ pypy/dist/pypy/translator/translator.py Sun May 15 17:10:01 2005 @@ -279,6 +279,7 @@ ## return impossiblevalue def getconcretetype(self, cls, *args): + "DEPRECATED. To be removed" # Return a (cached) 'concrete type' object attached to this translator. # Concrete types are what is put in the 'concretetype' attribute of # the Variables and Constants of the flow graphs by typer.py to guide From arigo at codespeak.net Sun May 15 17:16:50 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Sun, 15 May 2005 17:16:50 +0200 (CEST) Subject: [pypy-svn] r12299 - in pypy/dist/pypy/interpreter: . test Message-ID: <20050515151650.9076627BBA@code1.codespeak.net> Author: arigo Date: Sun May 15 17:16:50 2005 New Revision: 12299 Modified: pypy/dist/pypy/interpreter/function.py pypy/dist/pypy/interpreter/test/test_function.py Log: The repr of method objects need to use w_class.getname() instead of read w_class.name directly, because we have no control over what w_class can be (e.g. old-style classes don't have such an interp-level attribute). Use getrepr() instead of uid(). Modified: pypy/dist/pypy/interpreter/function.py ============================================================================== --- pypy/dist/pypy/interpreter/function.py (original) +++ pypy/dist/pypy/interpreter/function.py Sun May 15 17:16:50 2005 @@ -11,7 +11,6 @@ from pypy.interpreter.argument import Arguments from pypy.interpreter.eval import Code from pypy.interpreter.gateway import NoneNotWrapped -from pypy.tool.uid import uid class Function(Wrappable): """A function is a code object captured with some environment: @@ -251,13 +250,13 @@ w_class = space.type(self.w_instance) else: w_class = self.w_class - typename = w_class.name + typename = w_class.getname(self.space, '?') if self.w_instance is None: s = "" %(name, typename) + return space.wrap(s) else: - s = "" %( - name, typename, uid(self.w_instance)) - return space.wrap(s) + info = "method %s of %s object" % (name, typename) + return self.w_instance.getrepr(self.space, info) def descr_method_getattribute(self, w_attr): space = self.space Modified: pypy/dist/pypy/interpreter/test/test_function.py ============================================================================== --- pypy/dist/pypy/interpreter/test/test_function.py (original) +++ pypy/dist/pypy/interpreter/test/test_function.py Sun May 15 17:16:50 2005 @@ -197,10 +197,17 @@ assert repr(dict.items) == "" class A(object): def f(self): - pass + pass assert repr(A.f) == "" assert repr(A().f).startswith("" + assert repr(B().f).startswith(" Author: arigo Date: Sun May 15 17:33:45 2005 New Revision: 12300 Modified: pypy/dist/pypy/module/builtin/app_descriptor.py Log: More strange code in super()... blame CPython :-/ Modified: pypy/dist/pypy/module/builtin/app_descriptor.py ============================================================================== --- pypy/dist/pypy/module/builtin/app_descriptor.py (original) +++ pypy/dist/pypy/module/builtin/app_descriptor.py Sun May 15 17:33:45 2005 @@ -134,10 +134,10 @@ self.__self__ = obj self.__self_class__ = objcls def __get__(self, obj, type=None): - if super.__self__.__get__(self) is None and obj is not None: - return super(super.__thisclass__.__get__(self), obj) - else: + if obj is None or super.__self__.__get__(self) is not None: return self + else: + return self.__class__(super.__thisclass__.__get__(self), obj) def __getattribute__(self, attr): _self_class_ = super.__self_class__.__get__(self) if (attr != '__class__' # we want super().__class__ to be the real class From arigo at codespeak.net Sun May 15 17:57:44 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Sun, 15 May 2005 17:57:44 +0200 (CEST) Subject: [pypy-svn] r12301 - in pypy/dist/pypy/objspace: . test Message-ID: <20050515155744.4788B27BCF@code1.codespeak.net> Author: arigo Date: Sun May 15 17:57:44 2005 New Revision: 12301 Modified: pypy/dist/pypy/objspace/descroperation.py pypy/dist/pypy/objspace/test/test_descroperation.py Log: Oups. DescrOperation was using wrong rules for which binary operators to call in the presence of subclassing. Wasn't tested... Modified: pypy/dist/pypy/objspace/descroperation.py ============================================================================== --- pypy/dist/pypy/objspace/descroperation.py (original) +++ pypy/dist/pypy/objspace/descroperation.py Sun May 15 17:57:44 2005 @@ -223,7 +223,7 @@ w_right_impl = None else: w_right_impl = space.lookup(w_obj2, '__rpow__') - if space.is_true(space.issubtype(w_typ1, w_typ2)): + if space.is_true(space.issubtype(w_typ2, w_typ1)): w_obj1, w_obj2 = w_obj2, w_obj1 w_left_impl, w_right_impl = w_right_impl, w_left_impl if w_left_impl is not None: @@ -358,7 +358,7 @@ w_right_impl = None else: w_right_impl = space.lookup(w_obj2, '__coerce__') - if space.is_true(space.issubtype(w_typ1, w_typ2)): + if space.is_true(space.issubtype(w_typ2, w_typ1)): w_obj1, w_obj2 = w_obj2, w_obj1 w_left_impl, w_right_impl = w_right_impl, w_left_impl @@ -415,7 +415,7 @@ w_right_impl = None else: w_right_impl = space.lookup(w_obj2, '__cmp__') - if space.is_true(space.issubtype(w_typ1, w_typ2)): + if space.is_true(space.issubtype(w_typ2, w_typ1)): w_obj1, w_obj2 = w_obj2, w_obj1 w_left_impl, w_right_impl = w_right_impl, w_left_impl do_neg1, do_neg2 = do_neg2, do_neg1 @@ -458,7 +458,7 @@ w_right_impl = None else: w_right_impl = space.lookup(w_obj2, right) - if space.is_true(space.issubtype(w_typ1, w_typ2)): + if space.is_true(space.issubtype(w_typ2, w_typ1)): w_obj1, w_obj2 = w_obj2, w_obj1 w_left_impl, w_right_impl = w_right_impl, w_left_impl @@ -519,7 +519,7 @@ w_right_impl = None else: w_right_impl = space.lookup(w_obj2, right) - if space.is_true(space.issubtype(w_typ1, w_typ2)): + if space.is_true(space.issubtype(w_typ2, w_typ1)): w_obj1, w_obj2 = w_obj2, w_obj1 w_left_impl, w_right_impl = w_right_impl, w_left_impl Modified: pypy/dist/pypy/objspace/test/test_descroperation.py ============================================================================== --- pypy/dist/pypy/objspace/test/test_descroperation.py (original) +++ pypy/dist/pypy/objspace/test/test_descroperation.py Sun May 15 17:57:44 2005 @@ -16,6 +16,67 @@ class AppTest_Descroperation: + def test_special_methods(self): + class A(object): + def __lt__(self, other): + return "lt" + def __imul__(self, other): + return "imul" + def __sub__(self, other): + return "sub" + def __rsub__(self, other): + return "rsub" + def __pow__(self, other): + return "pow" + def __rpow__(self, other): + return "rpow" + def __neg__(self): + return "neg" + a = A() + assert (a < 5) == "lt" + assert (object() > a) == "lt" + a1 = a + a1 *= 4 + assert a1 == "imul" + assert a - 2 == "sub" + assert object() - a == "rsub" + assert a ** 2 == "pow" + assert object() ** a == "rpow" + assert -a == "neg" + + class B(A): + def __lt__(self, other): + return "B's lt" + def __imul__(self, other): + return "B's imul" + def __sub__(self, other): + return "B's sub" + def __rsub__(self, other): + return "B's rsub" + def __pow__(self, other): + return "B's pow" + def __rpow__(self, other): + return "B's rpow" + def __neg__(self): + return "B's neg" + + b = B() + assert (a < b) == "lt" + assert (b > a) == "lt" + b1 = b + b1 *= a + assert b1 == "B's imul" + a1 = a + a1 *= b + assert a1 == "imul" + assert a - b == "B's rsub" + assert b - a == "B's sub" + assert b - b == "B's sub" + assert a ** b == "B's rpow" + assert b ** a == "B's pow" + assert b ** b == "B's pow" + assert -b == "B's neg" + def test_getslice(self): class Sq(object): def __getslice__(self, start, stop): From tismer at codespeak.net Sun May 15 18:11:59 2005 From: tismer at codespeak.net (tismer at codespeak.net) Date: Sun, 15 May 2005 18:11:59 +0200 (CEST) Subject: [pypy-svn] r12302 - pypy/dist/pypy/tool Message-ID: <20050515161159.B79D327BB9@code1.codespeak.net> Author: tismer Date: Sun May 15 18:11:59 2005 New Revision: 12302 Modified: pypy/dist/pypy/tool/sourcetools.py Log: trying to give better info in case we cannot find the source code Modified: pypy/dist/pypy/tool/sourcetools.py ============================================================================== --- pypy/dist/pypy/tool/sourcetools.py (original) +++ pypy/dist/pypy/tool/sourcetools.py Sun May 15 18:11:59 2005 @@ -58,7 +58,11 @@ Indentation is automatically corrected. """ if self.srctext: - p = self.srctext.index(src) + try: + p = self.srctext.index(src) + except ValueError, e: + e.args = "Source text not found in %s - use a raw string" % self.srcname + raise prelines = self.srctext[:p].count("\n") + 1 else: prelines = 0 From arigo at codespeak.net Sun May 15 18:14:12 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Sun, 15 May 2005 18:14:12 +0200 (CEST) Subject: [pypy-svn] r12303 - pypy/dist/pypy/objspace/std Message-ID: <20050515161412.CD02F27BB9@code1.codespeak.net> Author: arigo Date: Sun May 15 18:14:12 2005 New Revision: 12303 Modified: pypy/dist/pypy/objspace/std/fake.py pypy/dist/pypy/objspace/std/floattype.py pypy/dist/pypy/objspace/std/inttype.py pypy/dist/pypy/objspace/std/longtype.py pypy/dist/pypy/objspace/std/stringtype.py pypy/dist/pypy/objspace/std/tupletype.py Log: Use the same keyword arguments as CPython for constructing built-in types, e.g. int(x=5). Modified: pypy/dist/pypy/objspace/std/fake.py ============================================================================== --- pypy/dist/pypy/objspace/std/fake.py (original) +++ pypy/dist/pypy/objspace/std/fake.py Sun May 15 18:14:12 2005 @@ -78,10 +78,13 @@ kw['__module__'] = cpy_type.__module__ - def fake__new__(space, w_type, args_w): + def fake__new__(space, w_type, __args__): + args_w, kwds_w = __args__.unpack() args = [space.unwrap(w_arg) for w_arg in args_w] + kwds = dict([(key, space.unwrap(w_value)) + for (key, w_value) in kwds_w.items()]) try: - r = cpy_type.__new__(cpy_type, *args) + r = cpy_type.__new__(cpy_type, *args, **kwds) except: wrap_exception(space) raise @@ -92,7 +95,7 @@ kw['__new__'] = gateway.interp2app(fake__new__, unwrap_spec = [baseobjspace.ObjSpace, baseobjspace.W_Root, - 'args_w']) + gateway.Arguments]) if cpy_type.__base__ is not object: assert cpy_type.__base__ is basestring from pypy.objspace.std.basestringtype import basestring_typedef Modified: pypy/dist/pypy/objspace/std/floattype.py ============================================================================== --- pypy/dist/pypy/objspace/std/floattype.py (original) +++ pypy/dist/pypy/objspace/std/floattype.py Sun May 15 18:14:12 2005 @@ -1,8 +1,9 @@ from pypy.objspace.std.stdtypedef import * from pypy.interpreter.error import OperationError -def descr__new__(space, w_floattype, w_value=0.0): +def descr__new__(space, w_floattype, w_x=0.0): from pypy.objspace.std.floatobject import W_FloatObject + w_value = w_x # 'x' is the keyword argument name in CPython if space.is_true(space.isinstance(w_value, space.w_str)): try: value = float(space.str_w(w_value)) Modified: pypy/dist/pypy/objspace/std/inttype.py ============================================================================== --- pypy/dist/pypy/objspace/std/inttype.py (original) +++ pypy/dist/pypy/objspace/std/inttype.py Sun May 15 18:14:12 2005 @@ -11,9 +11,10 @@ raise OperationError(space.w_ValueError, space.wrap(e.msg)) -def descr__new__(space, w_inttype, w_value=0, w_base=NoneNotWrapped): +def descr__new__(space, w_inttype, w_x=0, w_base=NoneNotWrapped): from pypy.objspace.std.intobject import W_IntObject w_longval = None + w_value = w_x # 'x' is the keyword argument name in CPython value = 0 if w_base is None: # check for easy cases Modified: pypy/dist/pypy/objspace/std/longtype.py ============================================================================== --- pypy/dist/pypy/objspace/std/longtype.py (original) +++ pypy/dist/pypy/objspace/std/longtype.py Sun May 15 18:14:12 2005 @@ -5,8 +5,9 @@ from pypy.interpreter.gateway import NoneNotWrapped from pypy.rpython.rarithmetic import r_uint -def descr__new__(space, w_longtype, w_value=0, w_base=NoneNotWrapped): +def descr__new__(space, w_longtype, w_x=0, w_base=NoneNotWrapped): from pypy.objspace.std.longobject import W_LongObject, args_from_long + w_value = w_x # 'x' is the keyword argument name in CPython if w_base is None: # check for easy cases if isinstance(w_value, W_LongObject): Modified: pypy/dist/pypy/objspace/std/stringtype.py ============================================================================== --- pypy/dist/pypy/objspace/std/stringtype.py (original) +++ pypy/dist/pypy/objspace/std/stringtype.py Sun May 15 18:14:12 2005 @@ -40,9 +40,9 @@ # ____________________________________________________________ -def descr__new__(space, w_stringtype, w_obj=''): +def descr__new__(space, w_stringtype, w_object=''): from pypy.objspace.std.stringobject import W_StringObject - w_obj = space.str(w_obj) + w_obj = space.str(w_object) if space.is_true(space.is_(w_stringtype, space.w_str)): return w_obj # XXX might be reworked when space.str() typechecks value = space.str_w(w_obj) Modified: pypy/dist/pypy/objspace/std/tupletype.py ============================================================================== --- pypy/dist/pypy/objspace/std/tupletype.py (original) +++ pypy/dist/pypy/objspace/std/tupletype.py Sun May 15 18:14:12 2005 @@ -1,15 +1,15 @@ from pypy.objspace.std.stdtypedef import * from pypy.interpreter.gateway import NoneNotWrapped -def descr__new__(space, w_tupletype, w_items=NoneNotWrapped): +def descr__new__(space, w_tupletype, w_sequence=NoneNotWrapped): from pypy.objspace.std.tupleobject import W_TupleObject - if w_items is None: + if w_sequence is None: tuple_w = [] elif (space.is_w(w_tupletype, space.w_tuple) and - space.is_w(space.type(w_items), space.w_tuple)): - return w_items + space.is_w(space.type(w_sequence), space.w_tuple)): + return w_sequence else: - tuple_w = space.unpackiterable(w_items) + tuple_w = space.unpackiterable(w_sequence) w_obj = space.allocate_instance(W_TupleObject, w_tupletype) W_TupleObject.__init__(w_obj, space, tuple_w) return w_obj From arigo at codespeak.net Sun May 15 18:40:12 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Sun, 15 May 2005 18:40:12 +0200 (CEST) Subject: [pypy-svn] r12307 - pypy/dist/lib-python/modified-2.3.4/test Message-ID: <20050515164012.1404727BB6@code1.codespeak.net> Author: arigo Date: Sun May 15 18:40:11 2005 New Revision: 12307 Modified: pypy/dist/lib-python/modified-2.3.4/test/test_descr.py Log: Lower the number of iteration in a couple of loops. Modified: pypy/dist/lib-python/modified-2.3.4/test/test_descr.py ============================================================================== --- pypy/dist/lib-python/modified-2.3.4/test/test_descr.py (original) +++ pypy/dist/lib-python/modified-2.3.4/test/test_descr.py Sun May 15 18:40:11 2005 @@ -2204,7 +2204,7 @@ vereq(a, (1,2,3,4,5,6,7,8,9,0)) vereq(a.rev(), madtuple((0,9,8,7,6,5,4,3,2,1))) vereq(a.rev().rev(), madtuple((1,2,3,4,5,6,7,8,9,0))) - for i in range(512): + for i in range(10): t = madtuple(range(i)) u = t.rev() v = u.rev() @@ -2239,7 +2239,7 @@ vereq(s, "abcdefghijklmnopqrstuvwxyz") vereq(s.rev(), madstring("zyxwvutsrqponmlkjihgfedcba")) vereq(s.rev().rev(), madstring("abcdefghijklmnopqrstuvwxyz")) - for i in range(256): + for i in range(10): s = madstring("".join(map(chr, range(i)))) t = s.rev() u = t.rev() From hpk at codespeak.net Sun May 15 18:44:28 2005 From: hpk at codespeak.net (hpk at codespeak.net) Date: Sun, 15 May 2005 18:44:28 +0200 (CEST) Subject: [pypy-svn] r12308 - pypy/dist/pypy/documentation Message-ID: <20050515164428.537BF27BB6@code1.codespeak.net> Author: hpk Date: Sun May 15 18:44:28 2005 New Revision: 12308 Modified: pypy/dist/pypy/documentation/objspace.txt Log: fix prompt of example Modified: pypy/dist/pypy/documentation/objspace.txt ============================================================================== --- pypy/dist/pypy/documentation/objspace.txt (original) +++ pypy/dist/pypy/documentation/objspace.txt Sun May 15 18:44:28 2005 @@ -214,18 +214,18 @@ Example usage:: $ python interpreter/py.py -o thunk - >>> def f(): + >>>> def f(): ... print 'computing...' ... return 6*7 ... - >>> x = thunk(f) - >>> x + >>>> x = thunk(f) + >>>> x computing... 42 - >>> x + >>>> x 42 - >>> y = thunk(f) - >>> type(y) + >>>> y = thunk(f) + >>>> type(y) computing... From pedronis at codespeak.net Sun May 15 18:45:03 2005 From: pedronis at codespeak.net (pedronis at codespeak.net) Date: Sun, 15 May 2005 18:45:03 +0200 (CEST) Subject: [pypy-svn] r12309 - pypy/dist/lib-python/modified-2.3.4/test Message-ID: <20050515164503.D80F427BB9@code1.codespeak.net> Author: pedronis Date: Sun May 15 18:45:03 2005 New Revision: 12309 Modified: pypy/dist/lib-python/modified-2.3.4/test/test_descr.py Log: plaecholder should print the name of the function skipped Modified: pypy/dist/lib-python/modified-2.3.4/test/test_descr.py ============================================================================== --- pypy/dist/lib-python/modified-2.3.4/test/test_descr.py (original) +++ pypy/dist/lib-python/modified-2.3.4/test/test_descr.py Sun May 15 18:45:03 2005 @@ -3956,9 +3956,9 @@ pass def placeholder(func,msg): - def plh(): - raise NotRun,"Not run: %s!" % msg - return plh + def not_run(): + raise NotRun,"'%s' test not run: %s!" % (func.__name__, msg) + return not_run def test_main(): testfuncs = [ From cfbolz at codespeak.net Sun May 15 18:58:18 2005 From: cfbolz at codespeak.net (cfbolz at codespeak.net) Date: Sun, 15 May 2005 18:58:18 +0200 (CEST) Subject: [pypy-svn] r12311 - pypy/dist/pypy/documentation Message-ID: <20050515165818.C7D4927BB6@code1.codespeak.net> Author: cfbolz Date: Sun May 15 18:58:18 2005 New Revision: 12311 Modified: pypy/dist/pypy/documentation/translation.txt Log: Fixed some errors and added the LLVM-code of the example function in the flow graph section. Modified: pypy/dist/pypy/documentation/translation.txt ============================================================================== --- pypy/dist/pypy/documentation/translation.txt (original) +++ pypy/dist/pypy/documentation/translation.txt Sun May 15 18:58:18 2005 @@ -106,6 +106,7 @@ the ``SomeXxx`` instance. + Annotator -------------------------- @@ -141,6 +142,8 @@ deduce that v2 (and hence the function's return value) is ``SomeInteger()``. +.. _above: + This step-by-step annotation phase proceeds through all the operations in a block, and then along the links between the blocks of the flow graph. If there are loops in the flow graph, then the links will close @@ -593,20 +596,22 @@ Overview -------- -XXX preliminary notes only +Note that the LLVM back-end is in a state of constant flux and thus this are +preliminary notes only. The task of GenLLVM is to convert a flow graph into `LLVM code`_, which can then be optimized and compiled by LLVM. GenLLVM depends heavily on the annotations, functions without annotations cannot be translated. The flowgraph is not changed by GenLLVM in contrast to GenC. After the generation and compilation of the LLVM code a wrapper is generated (at the moment with the -help of Pyrex) wich wraps the arguments and return value of the entry -function. Thus it is possible to call the entry function from Python. +help of Pyrex) wich performs the conversion of arguments and return value of +the entry function to the types used by LLVM. Thus it is possible to call the +entry function from Python. GenLLVM does not depend on the CPython runtime which has the drawback that most functions with SomeObject annotations cannot be compiled properly -- the only operations that are allowed on variables with SomeObject annotations are -isinstance and type. +``isinstance`` and ``type``. GenLLVM creates for every object in the flow graph (e.g. constants, variables, blocks...) an LLVM 'representation'. This representation knows how to @@ -615,21 +620,21 @@ Some examples to make this cleare: A `ClassRepr`_ object represents a class, a `FuncRepr`_ object represent a function (or method). The following happens if -the space operation ``simple_call`` is performed in a flow grap: An -appropriate ``FuncRepr`` object is constructed which generates LLVM code for -the function it represents. Then the ``FuncRepr`` inserts the appropriate LLVM -instructions into the LLVM code of the function it is called from (sometime -this is more than just a call: the arguments have to be casted, -etc). Something similar happens if a class is instantiated: A ``ClassRepr`` is -created which generates LLVM that allocates enough memory for an instance of -the class and then (if the class or a subclass has an ``__init__`` method) -tells the ``FuncRepr`` of the appropriate ``__init__`` method to generate the -code for the call to it. +the space operation ``simple_call`` is performed on a function: An appropriate +``FuncRepr`` object is constructed which generates LLVM code for the function +it represents. Then the ``FuncRepr`` inserts the appropriate LLVM instructions +into the LLVM code of the function it is called from (sometime this is more +than just a call: the arguments have to be casted, etc). Something similar +happens if a class is instantiated: A ``ClassRepr`` is created which then +generates LLVM code that allocates enough memory for an instance of the class +and then (if the class or a base class has an ``__init__`` method) tells the +``FuncRepr`` of the appropriate ``__init__`` method to generate the code for +the call to it. Every representation object has a some other representations it depends on: A ``ListRepr`` of lists instances of a class depends on the ``ClassRepr`` of -that class. This is to ensure that the typedef for that is written after the -typedef of the class. To ensure this the dependency tree of representations +that class. To ensure that the typedef of of the class is written to the llvm +file before the typedef of the list, the dependency tree of representations traversed depth first when the LLVM code is written to a file. .. _`LLVM code`: http://www.llvm.org @@ -644,10 +649,11 @@ ++++++++++++++++++++++ There are some objects that have direct counterparts in LLVM: ints, floats, -chars (strings of length 1). Most space operations involving those are +chars (strings of length 1), bools. Most space operations involving those are implemented as `tiny function`_ (LLVM doesn't support macros since LLVM's .ll files correspond directly to its bytecode format so that round trip -conversions are nearly lossless). +conversions are nearly lossless). These are so simple that they are always +inlined by the LLVM optimizer so this doesn't lead to any performance penalty. Function representation @@ -658,7 +664,7 @@ control structures that the flow graphs feature: A function consists of basic blocks that end with links to other blocks, data flows along these links. The data flow is handled in LLVM by phi nodes: at the beginning of every block phi -nodes may be inserted. It determines the value of a variable depending on +nodes may be inserted. Those determine the value of a variable depending on which block branched to the currect block. Example:: block1: @@ -666,6 +672,28 @@ Here %b is 1 if control came from block0 and 2 if control came from block2. +The following code is generated for the function ``g`` defined above_:: + + int %g(int %n1) { + block0: + br label %block1 + block1: + %n2 = phi int [%n1, %block0], [%m3, %block3] + %i2 = phi int [0, %block0], [%j3, %block3] + %v2 = call bool %std.is_true(int %n2) + br bool %v2, label %block3, label %block2 + block2: + %i4 = phi int [%i2, %block1] + ret int %i4 + block3: + %n3 = phi int [%n2, %block1] + %i3 = phi int [%i2, %block1] + %j3 = call int %std.add(int %i3, int %n3) + %m3 = call int %std.sub(int %n3, int 1) + br label %block1 + } + +Note how the phi nodes correspond to the links in the control flow graph. List representation +++++++++++++++++++ From cfbolz at codespeak.net Sun May 15 18:59:30 2005 From: cfbolz at codespeak.net (cfbolz at codespeak.net) Date: Sun, 15 May 2005 18:59:30 +0200 (CEST) Subject: [pypy-svn] r12312 - pypy/dist/pypy/documentation Message-ID: <20050515165930.9BA2927BB9@code1.codespeak.net> Author: cfbolz Date: Sun May 15 18:59:29 2005 New Revision: 12312 Modified: pypy/dist/pypy/documentation/getting_started.txt Log: Added a section on how to compile to C and LLVM code in the translator examples. Some small fixes. Modified: pypy/dist/pypy/documentation/getting_started.txt ============================================================================== --- pypy/dist/pypy/documentation/getting_started.txt (original) +++ pypy/dist/pypy/documentation/getting_started.txt Sun May 15 18:59:29 2005 @@ -13,7 +13,8 @@ Checking out & running PyPy as a two-liner ------------------------------------------ -There is no public release yet, but you can easily do:: +The public releases are avaiable on the `download page`_. If you want the +bleeding edge development version you can also do:: svn co http://codespeak.net/svn/pypy/dist pypy-dist @@ -33,6 +34,7 @@ And here is some information to `install a subversion client`_. .. _`browse the pypy source code`: http://codespeak.net/svn/pypy/dist +.. _`download page`: http://codespeak.net/pypy/XXX_download_page_XXX coding style and testing ------------------------ @@ -42,7 +44,7 @@ testing this would become very hard and fragile). For an overview of how we organize our codebase please look at our -`coding-guide document`_. +`coding-guide document`_. For running all PyPy tests you can issue:: @@ -54,10 +56,10 @@ filename/directory arguments. If you want to have write access to the codespeak respository -please send a mail to jum at anubis han de or hpk at merlinux de +please send a mail to *jum at anubis han de* or *hpk at merlinux de* in order to ask for a username and password. Please mention what you want to do -within the pypy project. Even better, come to our next sprint so that we can get -to know you. +within the pypy project. Even better, come to our next sprint so that we can +get to know you. Viewing documentation --------------------- @@ -83,7 +85,7 @@ follow these instructions, which assume that you are working in a DOS box (Windows) or terminal (MacOS/X or Linux). -detailed steps +detailed steps -------------- 1. Download and install subversion_ if you do not already have it. @@ -186,16 +188,18 @@ ``test/snippet.py``. For example:: >>> t = Translator(test.is_perfect_number) - >>> t.simplify() >>> t.view() 4. We have a type annotator that can completely infer types for functions like ``is_perfect_number``:: - >>> t.annotate([int]) + >>> a = t.annotate([int]) >>> t.view() - Move the mouse over variable names (in red) to see their inferred types. + Move the mouse over variable names (in red) to see their inferred types. To + perform simplifications based on the annotation you can do:: + + >>> a.simplify() 5. The graph can be turned into Pyrex code, with types if ``annotate()`` was called:: @@ -209,6 +213,29 @@ Python source code. This is because the Pyrex code is generated from the graph only, without reference to the original source. +6. In the same manner the graph can be compiled to C code:: + + >>> a.specialize() + >>> f = t.ccompile() + + The first command replaces operations with variables of types that are + avaiable in C (e.g. int) with low level version. This can be ommited if no + annotation (step 4) has been performed. + +7. If you feel adventureous (and have LLVM installed and on your path) you can + also try to compile the graph with LLVM. This is still quite experimental + and only works with some functions: One of the most visible restriction is + that return type of the entry function has to be and int, float or bool. To + try it do:: + + >>> from pypy.translator.llvm.genllvm import llvmcompile + >>> f = llvmcompile(t, optimize=True) + >>> f(28) + 1 + + This works only with fully annotated graphs. + + Where to start reading the sources ---------------------------------- @@ -250,8 +277,7 @@ read the archives online) or show up irc.freenode.net:6667, channel #pypy. * To help PyPy become Python-the-next-generation, you may write some - `unit tests`_ and file some `bug reports`_ (although we are not really - actively using the issue tracker yet, watch out :-) + `unit tests`_ and file some `bug reports`_. .. _optionaltool: @@ -283,7 +309,7 @@ * llvm: One of our backends uses the `low level virtual machine`_ to generate - processor independant machine level code. + processor independant machine level code. * CLISP:: From cfbolz at codespeak.net Sun May 15 19:02:00 2005 From: cfbolz at codespeak.net (cfbolz at codespeak.net) Date: Sun, 15 May 2005 19:02:00 +0200 (CEST) Subject: [pypy-svn] r12313 - pypy/dist/pypy/translator/llvm Message-ID: <20050515170200.EA52027BBA@code1.codespeak.net> Author: cfbolz Date: Sun May 15 19:02:00 2005 New Revision: 12313 Modified: pypy/dist/pypy/translator/llvm/build_llvm_module.py pypy/dist/pypy/translator/llvm/classrepr.py pypy/dist/pypy/translator/llvm/funcrepr.py pypy/dist/pypy/translator/llvm/genllvm.py pypy/dist/pypy/translator/llvm/intlist.c pypy/dist/pypy/translator/llvm/list.c pypy/dist/pypy/translator/llvm/llvmbc.py pypy/dist/pypy/translator/llvm/make_runtime.py pypy/dist/pypy/translator/llvm/memorylayout.py pypy/dist/pypy/translator/llvm/pbcrepr.py pypy/dist/pypy/translator/llvm/representation.py pypy/dist/pypy/translator/llvm/seqrepr.py pypy/dist/pypy/translator/llvm/typerepr.py Log: Fixed exceptions in genllvm. Added a short doc string to every file. Modified: pypy/dist/pypy/translator/llvm/build_llvm_module.py ============================================================================== --- pypy/dist/pypy/translator/llvm/build_llvm_module.py (original) +++ pypy/dist/pypy/translator/llvm/build_llvm_module.py Sun May 15 19:02:00 2005 @@ -1,5 +1,5 @@ """ -Build a pyrex module out of llvmfile +Build a Python module out of llvmfile and a Pyrex wrapper file. """ import autopath Modified: pypy/dist/pypy/translator/llvm/classrepr.py ============================================================================== --- pypy/dist/pypy/translator/llvm/classrepr.py (original) +++ pypy/dist/pypy/translator/llvm/classrepr.py Sun May 15 19:02:00 2005 @@ -1,3 +1,8 @@ +""" +The representations of classes and Exceptions live here. Classes are +implemented as structs. +""" + import autopath import sets Modified: pypy/dist/pypy/translator/llvm/funcrepr.py ============================================================================== --- pypy/dist/pypy/translator/llvm/funcrepr.py (original) +++ pypy/dist/pypy/translator/llvm/funcrepr.py Sun May 15 19:02:00 2005 @@ -1,3 +1,7 @@ +""" +The representations of Functions/Methods/Builtin Functions. +""" + import autopath import sets, inspect @@ -10,7 +14,9 @@ from pypy.translator.llvm import llvmbc from pypy.translator.unsimplify import remove_double_links -from pypy.translator.llvm.representation import debug, LLVMRepr, CompileError, last_exception, last_exc_value +from pypy.translator.llvm.representation import debug, LLVMRepr, CompileError +from pypy.translator.llvm.representation import last_exception, last_exc_value +from pypy.translator.llvm.representation import SimpleRepr from pypy.translator.llvm.typerepr import TypeRepr, PointerTypeRepr debug = False @@ -348,8 +354,8 @@ pass def create_terminator_instr(self): - l_exc = self.gen.get_repr(self.pyblock.inputargs[0]) - l_val = self.gen.get_repr(self.pyblock.inputargs[1]) + l_exc = self.l_args[0] + l_val = self.l_args[1] l_last_exception = self.gen.get_repr(last_exception) l_last_exc_value = self.gen.get_repr(last_exc_value) self.l_func.dependencies.update([l_exc, l_val, l_last_exception, @@ -381,7 +387,13 @@ self.link = link self.l_func = l_func self.gen = gen - self.l_args = [self.gen.get_repr(a) for a in self.link.args] + if link.exitcase == Exception: + self.l_args = [SimpleRepr("%std.class**", + "%std.last_exception.type", gen), + SimpleRepr("%std.exception**", + "%std.last_exception.value", gen)] + else: + self.l_args = [self.gen.get_repr(a) for a in self.link.args] self.l_targetargs = [self.gen.get_repr(a) for a in self.link.target.inputargs] self.l_func.dependencies.update(self.l_args) Modified: pypy/dist/pypy/translator/llvm/genllvm.py ============================================================================== --- pypy/dist/pypy/translator/llvm/genllvm.py (original) +++ pypy/dist/pypy/translator/llvm/genllvm.py Sun May 15 19:02:00 2005 @@ -1,5 +1,14 @@ """ -Generate a llvm .ll file from an annotated flowgraph. +This is the entry point of genllvm. This file can also be used with python -i +to interactively test genllvm. + +The class LLVMGenerator coordinates the creation of LLVM representations and +drives the creation of the .ll file and the compilation: +The methods get_repr loops over all Repr classes and calls there static get +method. If this method returns None, it continues searching, else it returns +the object. It caches representations so that only one is generated for a given +object. + """ import autopath Modified: pypy/dist/pypy/translator/llvm/intlist.c ============================================================================== --- pypy/dist/pypy/translator/llvm/intlist.c (original) +++ pypy/dist/pypy/translator/llvm/intlist.c Sun May 15 19:02:00 2005 @@ -1,3 +1,5 @@ +/* implementation of range. This file is transformed to int_list.ll by +make_runtime.py */ #include struct list_int { Modified: pypy/dist/pypy/translator/llvm/list.c ============================================================================== --- pypy/dist/pypy/translator/llvm/list.c (original) +++ pypy/dist/pypy/translator/llvm/list.c Sun May 15 19:02:00 2005 @@ -1,3 +1,5 @@ +/* implementation of list methods. This file is transformed to list_template.ll + by make_runtime.py */ #include signed char unwind(); Modified: pypy/dist/pypy/translator/llvm/llvmbc.py ============================================================================== --- pypy/dist/pypy/translator/llvm/llvmbc.py (original) +++ pypy/dist/pypy/translator/llvm/llvmbc.py Sun May 15 19:02:00 2005 @@ -1,5 +1,6 @@ """ -Some simple classes that output LLVM-assembler. +Some simple classes that output LLVM-assembler. Most functions here take +subclases of LLVMRepr as arguments. """ import autopath Modified: pypy/dist/pypy/translator/llvm/make_runtime.py ============================================================================== --- pypy/dist/pypy/translator/llvm/make_runtime.py (original) +++ pypy/dist/pypy/translator/llvm/make_runtime.py Sun May 15 19:02:00 2005 @@ -1,3 +1,9 @@ +""" +This file produces the .ll files with the implementations of lists and the +implementations of simple space operations (like add, mul, sub, div for float, +bool, int). +""" + import autopath import os Modified: pypy/dist/pypy/translator/llvm/memorylayout.py ============================================================================== --- pypy/dist/pypy/translator/llvm/memorylayout.py (original) +++ pypy/dist/pypy/translator/llvm/memorylayout.py Sun May 15 19:02:00 2005 @@ -1,3 +1,8 @@ +""" +The MemoryLayout class helps with the layouting structs in memory. +""" + + import autopath import sets @@ -8,6 +13,8 @@ debug = False +#XXX This is all mostly experimental + class MemoryLayout(object): def __init__(self, attrs, l_types, gen): self.attrs = attrs Modified: pypy/dist/pypy/translator/llvm/pbcrepr.py ============================================================================== --- pypy/dist/pypy/translator/llvm/pbcrepr.py (original) +++ pypy/dist/pypy/translator/llvm/pbcrepr.py Sun May 15 19:02:00 2005 @@ -1,3 +1,8 @@ +""" +The representations of prebuilt constants. This implementation is still rather +limited. +""" + import autopath import sets Modified: pypy/dist/pypy/translator/llvm/representation.py ============================================================================== --- pypy/dist/pypy/translator/llvm/representation.py (original) +++ pypy/dist/pypy/translator/llvm/representation.py Sun May 15 19:02:00 2005 @@ -1,9 +1,27 @@ +""" +LLVMRepr is the base class for all LLVM representations of nearly any Python +object. A representation knows the name and type of an object in LLVM. It is +responsible for generating the neccessary global definitions and functions the +objects needs to be represented in LLVM. + +Each representation has a set of dependencies. The LLVMGenerator makes sure +that the definitions of an object the represenation depends on are written to +the file first. + +All the representation classes define a static ``get`` method. It should return +an appropriate representation of the object if it can be represented by the +class and None if not. + +Most representations are generated by calling the LLVMGenerators get_repr +method. Thus the representation classes do not need to know anything about each +other. +""" import autopath import sets from pypy.objspace.flow.model import Variable, Constant -# xxx tweak just so that unrelated tests can work -from pypy.objspace.flow.model import last_exception # this one is only used for the exitswitch now!!! +from pypy.objspace.flow.model import last_exception +# this is only used as a token for the pointer to the last exception object last_exc_value = object() from pypy.annotation import model as annmodel Modified: pypy/dist/pypy/translator/llvm/seqrepr.py ============================================================================== --- pypy/dist/pypy/translator/llvm/seqrepr.py (original) +++ pypy/dist/pypy/translator/llvm/seqrepr.py Sun May 15 19:02:00 2005 @@ -1,3 +1,7 @@ +""" +The representations of lists and tuples. +""" + import autopath import sets Modified: pypy/dist/pypy/translator/llvm/typerepr.py ============================================================================== --- pypy/dist/pypy/translator/llvm/typerepr.py (original) +++ pypy/dist/pypy/translator/llvm/typerepr.py Sun May 15 19:02:00 2005 @@ -1,3 +1,8 @@ +""" +The representations of objects that can be the type of other objects. +""" + + import autopath import sets From arigo at codespeak.net Sun May 15 19:02:09 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Sun, 15 May 2005 19:02:09 +0200 (CEST) Subject: [pypy-svn] r12314 - in pypy/dist/pypy/objspace/std: . test Message-ID: <20050515170209.9826E27BCF@code1.codespeak.net> Author: arigo Date: Sun May 15 19:02:09 2005 New Revision: 12314 Modified: pypy/dist/pypy/objspace/std/stringobject.py pypy/dist/pypy/objspace/std/test/test_stringobject.py Log: str.split('') should raise ValueError instead of trying to build an infinite list of empty strings... Modified: pypy/dist/pypy/objspace/std/stringobject.py ============================================================================== --- pypy/dist/pypy/objspace/std/stringobject.py (original) +++ pypy/dist/pypy/objspace/std/stringobject.py Sun May 15 19:02:09 2005 @@ -263,6 +263,8 @@ value = w_self._value by = w_by._value bylen = len(by) + if bylen == 0: + raise OperationError(space.w_ValueError, space.wrap("empty separator")) maxsplit = space.int_w(w_maxsplit) #if maxsplit is default, then you have no limit Modified: pypy/dist/pypy/objspace/std/test/test_stringobject.py ============================================================================== --- pypy/dist/pypy/objspace/std/test/test_stringobject.py (original) +++ pypy/dist/pypy/objspace/std/test/test_stringobject.py Sun May 15 19:02:09 2005 @@ -140,6 +140,7 @@ assert 'a b c d '.split() == ['a', 'b', 'c', 'd'] assert 'a//b//c//d'.split('//') == ['a', 'b', 'c', 'd'] assert 'endcase test'.split('test') == ['endcase ', ''] + raises(ValueError, 'abc'.split, '') def test_split_splitchar(self): assert "/a/b/c".split('/') == ['','a','b','c'] From arigo at codespeak.net Sun May 15 19:03:24 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Sun, 15 May 2005 19:03:24 +0200 (CEST) Subject: [pypy-svn] r12315 - pypy/dist/lib-python/modified-2.3.4/test Message-ID: <20050515170324.5A9B827BBA@code1.codespeak.net> Author: arigo Date: Sun May 15 19:03:24 2005 New Revision: 12315 Modified: pypy/dist/lib-python/modified-2.3.4/test/test_descr.py Log: Re-enabled the single disabled test, which now appear to work. Modified: pypy/dist/lib-python/modified-2.3.4/test/test_descr.py ============================================================================== --- pypy/dist/lib-python/modified-2.3.4/test/test_descr.py (original) +++ pypy/dist/lib-python/modified-2.3.4/test/test_descr.py Sun May 15 19:03:24 2005 @@ -4023,7 +4023,7 @@ kwdargs, delhook, hashinherit, - placeholder(strops,"PyPy starts mem trashing with this one"), + strops, deepcopyrecursive, modules, dictproxyiterkeys, From hpk at codespeak.net Sun May 15 19:48:03 2005 From: hpk at codespeak.net (hpk at codespeak.net) Date: Sun, 15 May 2005 19:48:03 +0200 (CEST) Subject: [pypy-svn] r12319 - pypy/dist/pypy/documentation Message-ID: <20050515174803.80FC327BCF@code1.codespeak.net> Author: hpk Date: Sun May 15 19:48:03 2005 New Revision: 12319 Modified: pypy/dist/pypy/documentation/conftest.py pypy/dist/pypy/documentation/getting_started.txt Log: issue4 testing There is now preliminary doctest support for our documentation files executing ">>>" prompts at interpreter level with the doctest module behind the scenes. This makes some code snippets fail but also many of them work. In getting_started.txt you'll see the way you can specify scopes that will not be shown in the generated html. .. >>> from os.path import abspath >>> assert abspath will pass the doctest and the import-line will be ignored by html generation (at least it should be). Let's see if this approach is sensible enough. Applevel doctests (i.e. >>>> prompts) are not implemented yet and are probably a post-M0.5 matter. (and running them simply at app level would be at least be slow if not somewhat messy). P.S.: you need to "svn up" at dist-level because most of the doctest support code comes with the py lib but upgrading at dist-level is always a good idea. Modified: pypy/dist/pypy/documentation/conftest.py ============================================================================== --- pypy/dist/pypy/documentation/conftest.py (original) +++ pypy/dist/pypy/documentation/conftest.py Sun May 15 19:48:03 2005 @@ -1,3 +1,26 @@ +import py +from py.__.documentation.conftest import Directory, DoctestText, ReSTChecker -from py.__.documentation.conftest import * +class PyPyDoctestText(DoctestText): + def execute(self, module, docstring): + # XXX execute PyPy prompts as well + l = [] + for line in docstring.split('\n'): + if line.find('>>>>') != -1: + line = "" + l.append(line) + text = "\n".join(l) + super(PyPyDoctestText, self).execute(module, text) + #mod = py.std.types.ModuleType(self.fspath.basename, text) + #self.mergescopes(mod, scopes) + #failed, tot = py.std.doctest.testmod(mod, verbose=1) + #if failed: + # py.test.fail("doctest %s: %s failed out of %s" %( + # self.fspath, failed, tot)) + +class PyPyReSTChecker(ReSTChecker): + DoctestText = PyPyDoctestText + +class Directory(Directory): + ReSTChecker = PyPyReSTChecker Modified: pypy/dist/pypy/documentation/getting_started.txt ============================================================================== --- pypy/dist/pypy/documentation/getting_started.txt (original) +++ pypy/dist/pypy/documentation/getting_started.txt Sun May 15 19:48:03 2005 @@ -189,6 +189,9 @@ >>> t = Translator(test.is_perfect_number) >>> t.view() + +.. >>> from pypy.translator.translator import Translator +.. >>> from pypy.translator.test import snippet as test 4. We have a type annotator that can completely infer types for functions like ``is_perfect_number``:: From hpk at codespeak.net Sun May 15 19:57:58 2005 From: hpk at codespeak.net (hpk at codespeak.net) Date: Sun, 15 May 2005 19:57:58 +0200 (CEST) Subject: [pypy-svn] r12320 - pypy/dist/pypy/documentation Message-ID: <20050515175758.90AB727BC2@code1.codespeak.net> Author: hpk Date: Sun May 15 19:57:58 2005 New Revision: 12320 Modified: pypy/dist/pypy/documentation/getting_started.txt Log: i am unsure what to do about things such as t.view() which start a full gui. commenting t.view() out for now to stop the tests opening pygame-windows Modified: pypy/dist/pypy/documentation/getting_started.txt ============================================================================== --- pypy/dist/pypy/documentation/getting_started.txt (original) +++ pypy/dist/pypy/documentation/getting_started.txt Sun May 15 19:57:58 2005 @@ -188,7 +188,7 @@ ``test/snippet.py``. For example:: >>> t = Translator(test.is_perfect_number) - >>> t.view() + >>> #t.view() .. >>> from pypy.translator.translator import Translator .. >>> from pypy.translator.test import snippet as test @@ -197,7 +197,7 @@ ``is_perfect_number``:: >>> a = t.annotate([int]) - >>> t.view() + >>> #t.view() Move the mouse over variable names (in red) to see their inferred types. To perform simplifications based on the annotation you can do:: From pedronis at codespeak.net Sun May 15 20:33:52 2005 From: pedronis at codespeak.net (pedronis at codespeak.net) Date: Sun, 15 May 2005 20:33:52 +0200 (CEST) Subject: [pypy-svn] r12321 - in pypy/dist/pypy/objspace/std: . test Message-ID: <20050515183352.C1FC627BB9@code1.codespeak.net> Author: pedronis Date: Sun May 15 20:33:52 2005 New Revision: 12321 Modified: pypy/dist/pypy/objspace/std/test/test_typeobject.py pypy/dist/pypy/objspace/std/typeobject.py Log: raise an error if trying to create an new-style class with only old style bases Modified: pypy/dist/pypy/objspace/std/test/test_typeobject.py ============================================================================== --- pypy/dist/pypy/objspace/std/test/test_typeobject.py (original) +++ pypy/dist/pypy/objspace/std/test/test_typeobject.py Sun May 15 20:33:52 2005 @@ -338,3 +338,8 @@ __metaclass__ = T assert d == ['miss'] assert C.x() == 1 + + def test_only_classic_bases_fails(self): + class C: + __metaclass__ = _classobj + raises(TypeError, type, 'D', (C,), {}) Modified: pypy/dist/pypy/objspace/std/typeobject.py ============================================================================== --- pypy/dist/pypy/objspace/std/typeobject.py (original) +++ pypy/dist/pypy/objspace/std/typeobject.py Sun May 15 20:33:52 2005 @@ -92,10 +92,12 @@ w_self.hasdict = False hasoldstylebase = False w_most_derived_base_with_slots = None + newstyle = False for w_base in bases_w: if not isinstance(w_base, W_TypeObject): hasoldstylebase = True continue + newstyle = True if w_base.nslots != 0: if w_most_derived_base_with_slots is None: w_most_derived_base_with_slots = w_base @@ -107,6 +109,10 @@ space.wrap("instance layout conflicts in " "multiple inheritance")) w_self.hasdict = w_self.hasdict or w_base.hasdict + if not newstyle: # only classic bases + raise OperationError(space.w_TypeError, + space.wrap("a new-style class can't have only classic bases")) + if w_most_derived_base_with_slots: nslots = w_most_derived_base_with_slots.nslots w_self.w_bestbase = w_most_derived_base_with_slots From pedronis at codespeak.net Sun May 15 20:39:41 2005 From: pedronis at codespeak.net (pedronis at codespeak.net) Date: Sun, 15 May 2005 20:39:41 +0200 (CEST) Subject: [pypy-svn] r12322 - pypy/dist/pypy/objspace/std Message-ID: <20050515183941.9247D27BBA@code1.codespeak.net> Author: pedronis Date: Sun May 15 20:39:41 2005 New Revision: 12322 Modified: pypy/dist/pypy/objspace/std/typeobject.py Log: assure that .__base__ is new-style Modified: pypy/dist/pypy/objspace/std/typeobject.py ============================================================================== --- pypy/dist/pypy/objspace/std/typeobject.py (original) +++ pypy/dist/pypy/objspace/std/typeobject.py Sun May 15 20:39:41 2005 @@ -92,12 +92,13 @@ w_self.hasdict = False hasoldstylebase = False w_most_derived_base_with_slots = None - newstyle = False + w_newstyle = None for w_base in bases_w: if not isinstance(w_base, W_TypeObject): hasoldstylebase = True continue - newstyle = True + if not w_newstyle: + w_newstyle = w_base if w_base.nslots != 0: if w_most_derived_base_with_slots is None: w_most_derived_base_with_slots = w_base @@ -109,7 +110,7 @@ space.wrap("instance layout conflicts in " "multiple inheritance")) w_self.hasdict = w_self.hasdict or w_base.hasdict - if not newstyle: # only classic bases + if not w_newstyle: # only classic bases raise OperationError(space.w_TypeError, space.wrap("a new-style class can't have only classic bases")) @@ -120,7 +121,7 @@ nslots = 0 if w_self.w_bestbase is None: - w_self.w_bestbase = bases_w[0] + w_self.w_bestbase = w_newstyle wantdict = True if '__slots__' in dict_w: From cfbolz at codespeak.net Sun May 15 20:41:48 2005 From: cfbolz at codespeak.net (cfbolz at codespeak.net) Date: Sun, 15 May 2005 20:41:48 +0200 (CEST) Subject: [pypy-svn] r12323 - pypy/dist/pypy/documentation Message-ID: <20050515184148.235A027BCD@code1.codespeak.net> Author: cfbolz Date: Sun May 15 20:41:47 2005 New Revision: 12323 Modified: pypy/dist/pypy/documentation/getting_started.txt Log: Fix link to tracker. Modified: pypy/dist/pypy/documentation/getting_started.txt ============================================================================== --- pypy/dist/pypy/documentation/getting_started.txt (original) +++ pypy/dist/pypy/documentation/getting_started.txt Sun May 15 20:41:47 2005 @@ -350,7 +350,7 @@ .. _documentation: http://codespeak.net/pypy/index.cgi?doc .. _wiki: http://codespeak.net/moin/pypy/moin.cgi/FrontPage?action=show .. _unit tests: http://codespeak.net/pypy/index.cgi?doc/testdesign.html -.. _bug reports: http://codespeak.net/issues/pypy/ +.. _bug reports: http://codespeak.net/issues/pypy-dev/ From ale at codespeak.net Sun May 15 20:52:35 2005 From: ale at codespeak.net (ale at codespeak.net) Date: Sun, 15 May 2005 20:52:35 +0200 (CEST) Subject: [pypy-svn] r12324 - pypy/dist/pypy/objspace/std Message-ID: <20050515185235.8D3ED27BCF@code1.codespeak.net> Author: ale Date: Sun May 15 20:52:35 2005 New Revision: 12324 Modified: pypy/dist/pypy/objspace/std/stringobject.py Log: Added a MultiMethod for catching the situation tested in test_str.py : " 'abc'.__mul__('') " which should raise a TypeError (but raised a NotImplementedError instead). The remaining failing test in test_str.py is due to a missing __getslice__ method. Do we want to have strings to have __getslice__ ? (It is deprecated since 2.0 so I would vote no) Modified: pypy/dist/pypy/objspace/std/stringobject.py ============================================================================== --- pypy/dist/pypy/objspace/std/stringobject.py (original) +++ pypy/dist/pypy/objspace/std/stringobject.py Sun May 15 20:52:35 2005 @@ -916,6 +916,9 @@ def mul__String_ANY(space, w_str, w_times): return mul_string_times(space, w_str, w_times) +def mul__String_String(space, w_str, w_times): + raise OperationError( space.w_TypeError, space.wrap("an integer is required")) + def mul__ANY_String(space, w_times, w_str): return mul_string_times(space, w_str, w_times) From cfbolz at codespeak.net Sun May 15 21:03:06 2005 From: cfbolz at codespeak.net (cfbolz at codespeak.net) Date: Sun, 15 May 2005 21:03:06 +0200 (CEST) Subject: [pypy-svn] r12325 - pypy/dist/pypy/documentation Message-ID: <20050515190306.5C8BA27BCF@code1.codespeak.net> Author: cfbolz Date: Sun May 15 21:03:06 2005 New Revision: 12325 Modified: pypy/dist/pypy/documentation/getting_started.txt Log: argh! adress still not right. Modified: pypy/dist/pypy/documentation/getting_started.txt ============================================================================== --- pypy/dist/pypy/documentation/getting_started.txt (original) +++ pypy/dist/pypy/documentation/getting_started.txt Sun May 15 21:03:06 2005 @@ -350,7 +350,7 @@ .. _documentation: http://codespeak.net/pypy/index.cgi?doc .. _wiki: http://codespeak.net/moin/pypy/moin.cgi/FrontPage?action=show .. _unit tests: http://codespeak.net/pypy/index.cgi?doc/testdesign.html -.. _bug reports: http://codespeak.net/issues/pypy-dev/ +.. _bug reports: https://codespeak.net/issues/pypy-dev/ From cfbolz at codespeak.net Sun May 15 21:04:49 2005 From: cfbolz at codespeak.net (cfbolz at codespeak.net) Date: Sun, 15 May 2005 21:04:49 +0200 (CEST) Subject: [pypy-svn] r12326 - pypy/dist/pypy/documentation Message-ID: <20050515190449.BE8BD27BD9@code1.codespeak.net> Author: cfbolz Date: Sun May 15 21:04:49 2005 New Revision: 12326 Modified: pypy/dist/pypy/documentation/getting_started.txt Log: It's sunday. My brain is not working. Modified: pypy/dist/pypy/documentation/getting_started.txt ============================================================================== --- pypy/dist/pypy/documentation/getting_started.txt (original) +++ pypy/dist/pypy/documentation/getting_started.txt Sun May 15 21:04:49 2005 @@ -350,7 +350,7 @@ .. _documentation: http://codespeak.net/pypy/index.cgi?doc .. _wiki: http://codespeak.net/moin/pypy/moin.cgi/FrontPage?action=show .. _unit tests: http://codespeak.net/pypy/index.cgi?doc/testdesign.html -.. _bug reports: https://codespeak.net/issues/pypy-dev/ +.. _bug reports: https://codespeak.net/issue/pypy-dev/ From pedronis at codespeak.net Sun May 15 21:43:20 2005 From: pedronis at codespeak.net (pedronis at codespeak.net) Date: Sun, 15 May 2005 21:43:20 +0200 (CEST) Subject: [pypy-svn] r12327 - in pypy/dist/pypy: interpreter objspace/std objspace/std/test Message-ID: <20050515194320.CF07327B82@code1.codespeak.net> Author: pedronis Date: Sun May 15 21:43:20 2005 New Revision: 12327 Modified: pypy/dist/pypy/interpreter/baseobjspace.py pypy/dist/pypy/interpreter/typedef.py pypy/dist/pypy/objspace/std/objecttype.py pypy/dist/pypy/objspace/std/test/test_typeobject.py pypy/dist/pypy/objspace/std/typeobject.py Log: supporting for modifying .__class__ on objects Modified: pypy/dist/pypy/interpreter/baseobjspace.py ============================================================================== --- pypy/dist/pypy/interpreter/baseobjspace.py (original) +++ pypy/dist/pypy/interpreter/baseobjspace.py Sun May 15 21:43:20 2005 @@ -28,6 +28,10 @@ def getclass(self, space): return space.gettypeobject(self.typedef) + def setclass(self, space, w_subtype): + raise OperationError(space.w_TypeError, + space.wrap("__class__ assignment: only for heap types")) + def getname(self, space, default): try: return space.str_w(space.getattr(self, space.wrap('__name__'))) Modified: pypy/dist/pypy/interpreter/typedef.py ============================================================================== --- pypy/dist/pypy/interpreter/typedef.py (original) +++ pypy/dist/pypy/interpreter/typedef.py Sun May 15 21:43:20 2005 @@ -56,8 +56,8 @@ def getclass(self, space): return self.w__class__ - def setclass(self, w_subtype): - # XXX sanity checks here + def setclass(self, space, w_subtype): + # only used by descr_set___class__ self.w__class__ = w_subtype def __del__(self): Modified: pypy/dist/pypy/objspace/std/objecttype.py ============================================================================== --- pypy/dist/pypy/objspace/std/objecttype.py (original) +++ pypy/dist/pypy/objspace/std/objecttype.py Sun May 15 21:43:20 2005 @@ -16,6 +16,21 @@ def descr__class__(space, w_obj): return space.type(w_obj) +def descr_set___class__(space, w_obj, w_newcls): + from pypy.objspace.std.typeobject import W_TypeObject + if not isinstance(w_newcls, W_TypeObject): + raise OperationError(space.w_TypeError, + space.wrap("__class__ must be set to new-style class, not '%s' object" % + space.type(w_newcls).getname(space, '?'))) + w_oldcls = space.type(w_obj) + if w_oldcls.get_layout() == w_newcls.get_layout() and w_oldcls.hasdict == w_newcls.hasdict: + w_obj.setclass(space, w_newcls) + else: + raise OperationError(space.w_TypeError, + space.wrap("__class__ assignment: '%s' object layout differs from '%s'" % + (w_oldcls.getname(space, '?'), w_newcls.getname(space, '?')))) + + def descr__new__(space, w_type, __args__): from pypy.objspace.std.objectobject import W_ObjectObject from pypy.objspace.std.typetype import _precheck_for_new @@ -139,7 +154,7 @@ __delattr__ = gateway.interp2app(Object.descr__delattr__.im_func), __str__ = gateway.interp2app(descr__str__), __repr__ = gateway.interp2app(descr__repr__), - __class__ = GetSetProperty(descr__class__), + __class__ = GetSetProperty(descr__class__, descr_set___class__), __new__ = newmethod(descr__new__, unwrap_spec = [gateway.ObjSpace,gateway.W_Root,gateway.Arguments]), __hash__ = gateway.interp2app(descr__hash__), Modified: pypy/dist/pypy/objspace/std/test/test_typeobject.py ============================================================================== --- pypy/dist/pypy/objspace/std/test/test_typeobject.py (original) +++ pypy/dist/pypy/objspace/std/test/test_typeobject.py Sun May 15 21:43:20 2005 @@ -343,3 +343,88 @@ class C: __metaclass__ = _classobj raises(TypeError, type, 'D', (C,), {}) + + def test_set___class__(self): + raises(TypeError, "1 .__class__ = int") + raises(TypeError, "1 .__class__ = bool") + class A(object): + pass + class B(object): + pass + a = A() + a.__class__ = B + assert a.__class__ == B + class A(object): + __slots__ = ('a',) + class B(A): + pass + class C(B): + pass + class D(A): + pass + d = D() + d.__class__ = C + assert d.__class__ == C + d.__class__ = B + assert d.__class__ == B + raises(TypeError, "d.__class__ = A") + d.__class__ = C + assert d.__class__ == C + d.__class__ = D + assert d.__class__ == D + class AA(object): + __slots__ = ('a',) + aa = AA() + raises(TypeError, "aa.__class__ = A") + raises(TypeError, "aa.__class__ = object") + class Z1(A): + pass + class Z2(A): + __slots__ = ['__dict__'] + z1 = Z1() + z1.__class__ = Z2 + assert z1.__class__ == Z2 + z2 = Z2() + z2.__class__ = Z1 + assert z2.__class__ == Z1 + + class I(int): + pass + class F(float): + pass + f = F() + raises(TypeError, "f.__class__ = I") + i = I() + raises(TypeError, "i.__class__ = F") + raises(TypeError, "i.__class__ = int") + + class I2(int): + pass + class I3(I2): + __slots__ = ['a'] + class I4(I3): + pass + + i = I() + i2 = I() + i.__class__ = I2 + i2.__class__ = I + assert i.__class__ == I2 + assert i2.__class__ == I + + i3 = I3() + raises(TypeError, "i3.__class__ = I2") + i3.__class__ = I4 + assert i3.__class__ == I4 + i3.__class__ = I3 + assert i3.__class__ == I3 + + class X(object): + pass + class Y(object): + __slots__ = () + raises(TypeError, "X().__class__ = Y") + raises(TypeError, "Y().__class__ = X") + + raises(TypeError, "X().__class__ = object") + raises(TypeError, "X().__class__ = 1") Modified: pypy/dist/pypy/objspace/std/typeobject.py ============================================================================== --- pypy/dist/pypy/objspace/std/typeobject.py (original) +++ pypy/dist/pypy/objspace/std/typeobject.py Sun May 15 21:43:20 2005 @@ -164,6 +164,17 @@ w_self.mro_w = w_self.compute_mro() + # compute the most parent class with the same layout as us + def get_layout(w_self): + w_bestbase = w_self.w_bestbase + if w_bestbase is None: # object + return w_self + if w_self.instancetypedef is not w_bestbase.instancetypedef: + return w_self + if w_self.nslots == w_bestbase.nslots: + return w_bestbase.get_layout() + return w_self + def compute_mro(w_self): return compute_C3_mro(w_self.space, w_self) From arigo at codespeak.net Sun May 15 21:53:38 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Sun, 15 May 2005 21:53:38 +0200 (CEST) Subject: [pypy-svn] r12328 - in pypy/dist/pypy/lib: . test2 Message-ID: <20050515195338.92BE927BB2@code1.codespeak.net> Author: arigo Date: Sun May 15 21:53:38 2005 New Revision: 12328 Modified: pypy/dist/pypy/lib/_file.py pypy/dist/pypy/lib/test2/test_file_extra.py Log: - docstrings in _file.py - implemented readline(size) -- slowly, though - added a few tests for file Modified: pypy/dist/pypy/lib/_file.py ============================================================================== --- pypy/dist/pypy/lib/_file.py (original) +++ pypy/dist/pypy/lib/_file.py Sun May 15 21:53:38 2005 @@ -144,17 +144,29 @@ self.stream = _sio.TextOutputFilter(self.stream) if reading: self.stream = _sio.TextInputFilter(self.stream) - self.getnewlines = self.stream.getnewlines def getnewlines(self): - return None # can be overridden in the instance + "end-of-line convention used in this file" + if isinstance(self.stream, _sio.TextInputFilter): + return self.stream.getnewlines() + else: + return None - mode = property(lambda self: self._mode) - name = property(lambda self: self._name) - closed = property(lambda self: self._closed) - newlines = property(lambda self: self.getnewlines()) + mode = property(lambda self: self._mode, + doc = "file mode ('r', 'U', 'w', 'a', " + "possibly with 'b' or '+' added)") + name = property(lambda self: self._name, doc = "file name") + closed = property(lambda self: self._closed, + doc = "True if the file is closed") + newlines = property(lambda self: self.getnewlines(), + doc = "end-of-line convention used in this file") def read(self, n=-1): + """read([size]) -> read at most size bytes, returned as a string. + +If the size argument is negative or omitted, read until EOF is reached. +Notice that when in non-blocking mode, less data than what was requested +may be returned, even if no size parameter was given.""" if self._closed: raise ValueError('I/O operation on closed file') if n < 0: @@ -169,54 +181,101 @@ result.append(data) return ''.join(result) - def readall(self): - if self._closed: - raise ValueError('I/O operation on closed file') - return self.stream.readall() + def readline(self, size=-1): + """readline([size]) -> next line from the file, as a string. - def readline(self): +Retain newline. A non-negative size argument limits the maximum +number of bytes to return (an incomplete line may be returned then). +Return an empty string at EOF.""" if self._closed: raise ValueError('I/O operation on closed file') - return self.stream.readline() + if size < 0: + return self.stream.readline() + else: + # XXX slow + chars = [] + for i in xrange(size): + char = self.stream.read(1) + chars.append(char) + if char == '' or char == '\n': + break + return ''.join(chars) - def readlines(self, sizehint=0): + def readlines(self, size=-1): + """readlines([size]) -> list of strings, each a line from the file. + +Call readline() repeatedly and return a list of the lines so read. +The optional size argument, if given, is an approximate bound on the +total number of bytes in the lines returned.""" if self._closed: raise ValueError('I/O operation on closed file') - return list(iter(self.stream.readline, "")) + if size < 0: + return list(iter(self.stream.readline, "")) + else: + result = [] + while size > 0: + line = self.stream.readline() + if not line: + break + result.append(line) + size -= len(line) + return result def write(self, data): + """write(str) -> None. Write string str to file. + +Note that due to buffering, flush() or close() may be needed before +the file on disk reflects the data written.""" if self._closed: raise ValueError('I/O operation on closed file') if not isinstance(data, str): raise TypeError('write() argument must be a string (for now)') return self.stream.write(data) - def writelines(self, lines): + def writelines(self, sequence_of_strings): + """writelines(sequence_of_strings) -> None. Write the strings to the file. + +Note that newlines are not added. The sequence can be any iterable object +producing strings. This is equivalent to calling write() for each string.""" if self._closed: raise ValueError('I/O operation on closed file') - for line in lines: + for line in sequence_of_strings: if not isinstance(line, str): raise TypeError('writelines() argument must be a list ' 'of strings') self.stream.write(line) def tell(self): + """tell() -> current file position, an integer (may be a long integer).""" if self._closed: raise ValueError('I/O operation on closed file') return self.stream.tell() def seek(self, offset, whence=0): + """seek(offset[, whence]) -> None. Move to new file position. + +Argument offset is a byte count. Optional argument whence defaults to +0 (offset from start of file, offset should be >= 0); other values are 1 +(move relative to current position, positive or negative), and 2 (move +relative to end of file, usually negative, although many platforms allow +seeking beyond the end of a file). If the file is opened in text mode, +only offsets returned by tell() are legal. Use of other offsets causes +undefined behavior. +Note that not all file objects are seekable.""" if self._closed: raise ValueError('I/O operation on closed file') self.stream.seek(offset, whence) def __iter__(self): + """Iterating over files, as in 'for line in f:', returns each line of +the file one by one.""" if self._closed: raise ValueError('I/O operation on closed file') return self xreadlines = __iter__ def next(self): + """next() -> the next line in the file, or raise StopIteration""" if self._closed: raise ValueError('I/O operation on closed file') line = self.stream.readline() @@ -225,6 +284,9 @@ return line def truncate(self, size=None): + """truncate([size]) -> None. Truncate the file to at most size bytes. + +Size defaults to the current file position, as returned by tell().""" if self._closed: raise ValueError('I/O operation on closed file') if size is None: @@ -232,11 +294,18 @@ self.stream.truncate(size) def flush(self): + """flush() -> None. Flush the internal I/O buffer.""" if self._closed: raise ValueError('I/O operation on closed file') self.stream.flush() def close(self): + """close() -> None or (perhaps) an integer. Close the file. + +Sets data attribute .closed to True. A closed file cannot be used for +further I/O operations. close() may be called more than once without +error. Some kinds of file objects (for example, opened by popen()) +may return an exit status upon closing.""" if not self._closed: self._closed = True self.stream.close() @@ -244,7 +313,7 @@ __del__ = close def readinto(self, a): - 'Obsolete method, do not use it.' + """readinto() -> Undocumented. Don't use this; it may go away.""" if self._closed: raise ValueError('I/O operation on closed file') from array import array @@ -257,11 +326,15 @@ return len(data) def fileno(self): + '''fileno() -> integer "file descriptor". + +This is needed for lower-level file interfaces, such os.read().''' if self._closed: raise ValueError('I/O operation on closed file') return self.fd def isatty(self): + """isatty() -> true or false. True if the file is connected to a tty device.""" if self._closed: raise ValueError('I/O operation on closed file') return os.isatty(self.fd) Modified: pypy/dist/pypy/lib/test2/test_file_extra.py ============================================================================== --- pypy/dist/pypy/lib/test2/test_file_extra.py (original) +++ pypy/dist/pypy/lib/test2/test_file_extra.py Sun May 15 21:53:38 2005 @@ -26,3 +26,21 @@ data1 = self.fd.read() data2 = open(__file__, 'r').read() assert data1 == data2 + + def test_readline(self): + cpyfile = open(__file__, 'r') + assert self.fd.readline() == cpyfile.readline() + for i in range(-1, 10): + assert self.fd.readline(i) == cpyfile.readline(i) + + def test_readlines(self): + fn = str(udir.join('temptestfile')) + lines = ['line%d\n' % i for i in range(10000)] + f=_file.file(fn, 'w') + f.writelines(lines) + f.close() + assert open(fn, 'r').readlines() == lines + assert _file.file(fn, 'r').readlines() == lines + somelines = _file.file(fn, 'r').readlines(20000) + assert len(somelines) > 2000 + assert somelines == lines[:len(somelines)] From arigo at codespeak.net Sun May 15 23:12:07 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Sun, 15 May 2005 23:12:07 +0200 (CEST) Subject: [pypy-svn] r12330 - in pypy/dist/pypy: interpreter objspace/std Message-ID: <20050515211207.D0F9927BB6@code1.codespeak.net> Author: arigo Date: Sun May 15 23:12:07 2005 New Revision: 12330 Modified: pypy/dist/pypy/interpreter/baseobjspace.py pypy/dist/pypy/interpreter/function.py pypy/dist/pypy/interpreter/typedef.py pypy/dist/pypy/objspace/std/stdtypedef.py pypy/dist/pypy/objspace/std/typeobject.py Log: Moved setdict() to the base W_Root, where it belongs. Changed its signature to include a 'space' argument. Do the proper check in descr_get_dict(). Added support for 'del a.__dict__' on user-defined instances, which is essentially equivalent to 'a.__dict__ = {}'... (blame CPython compliancy tests for the last one) Modified: pypy/dist/pypy/interpreter/baseobjspace.py ============================================================================== --- pypy/dist/pypy/interpreter/baseobjspace.py (original) +++ pypy/dist/pypy/interpreter/baseobjspace.py Sun May 15 23:12:07 2005 @@ -24,7 +24,13 @@ if not e.match(space, space.w_KeyError): raise return None - + + def setdict(self, space): + typename = space.type(self).getname(space, '?') + raise OperationError(space.w_TypeError, + space.wrap("attribute '__dict__' of %s objects " + "is not writable" % typename)) + def getclass(self, space): return space.gettypeobject(self.typedef) Modified: pypy/dist/pypy/interpreter/function.py ============================================================================== --- pypy/dist/pypy/interpreter/function.py (original) +++ pypy/dist/pypy/interpreter/function.py Sun May 15 23:12:07 2005 @@ -43,8 +43,7 @@ def getdict(self): return self.w_func_dict - def setdict(self, w_dict): - space = self.space + def setdict(self, space, w_dict): if not space.is_true(space.isinstance( w_dict, space.w_dict )): raise OperationError( space.w_TypeError, space.wrap("setting function's dictionary to a non-dict") ) self.w_func_dict = w_dict Modified: pypy/dist/pypy/interpreter/typedef.py ============================================================================== --- pypy/dist/pypy/interpreter/typedef.py (original) +++ pypy/dist/pypy/interpreter/typedef.py Sun May 15 23:12:07 2005 @@ -80,8 +80,7 @@ def getdict(self): return self.w__dict__ - def setdict(self, w_dict): - space = self.space + def setdict(self, space, w_dict): if not space.is_true(space.isinstance(w_dict, space.w_dict)): raise OperationError(space.w_TypeError, space.wrap("setting dictionary to a non-dict")) @@ -300,7 +299,11 @@ def descr_get_dict(space, obj): w_dict = obj.getdict() - assert w_dict is not None, repr(obj) + if w_dict is None: + typename = space.type(w_obj).getname(space, '?') + raise OperationError(space.w_TypeError, + space.wrap("descriptor '__dict__' doesn't apply to" + " '%s' objects" % typename)) return w_dict def descr_get_dict_may_be_None(space, obj): @@ -310,7 +313,7 @@ return w_dict def descr_set_dict(space, obj, w_dict): - obj.setdict(w_dict) + obj.setdict(space, w_dict) def generic_ne(space, w_obj1, w_obj2): if space.eq_w(w_obj1, w_obj2): Modified: pypy/dist/pypy/objspace/std/stdtypedef.py ============================================================================== --- pypy/dist/pypy/objspace/std/stdtypedef.py (original) +++ pypy/dist/pypy/objspace/std/stdtypedef.py Sun May 15 23:12:07 2005 @@ -1,6 +1,7 @@ from pypy.interpreter import eval, function, gateway from pypy.interpreter.error import OperationError from pypy.interpreter.typedef import TypeDef, GetSetProperty, Member +from pypy.interpreter.typedef import descr_get_dict, descr_set_dict from pypy.interpreter.baseobjspace import SpaceCache from pypy.objspace.std.model import MultiMethod, FailedToImplement from pypy.tool.compile import compile2 @@ -31,15 +32,10 @@ a = a.base return True -def descr_get_dict(space, w_obj): # xxx typecheck - w_dict = w_obj.getdict() - assert w_dict is not None, repr(w_obj) - return w_dict +def descr_del_dict(space, w_obj): # blame CPython for the existence of this one + w_obj.setdict(space, space.newdict([])) -def descr_set_dict(space, w_obj, w_dict): # xxx typecheck - w_obj.setdict(w_dict) - -std_dict_descr = GetSetProperty(descr_get_dict, descr_set_dict) +std_dict_descr = GetSetProperty(descr_get_dict, descr_set_dict, descr_del_dict) def newmethod(descr_new, unwrap_spec=None): "NOT_RPYTHON: initialization-time only." Modified: pypy/dist/pypy/objspace/std/typeobject.py ============================================================================== --- pypy/dist/pypy/objspace/std/typeobject.py (original) +++ pypy/dist/pypy/objspace/std/typeobject.py Sun May 15 23:12:07 2005 @@ -253,12 +253,6 @@ dictspec.append((space.wrap(key), w_value)) return space.newdict(dictspec) - def setdict(w_self, w_dict): - space = w_self.space - raise OperationError(space.w_TypeError, - space.wrap("attribute '__dict__' of type objects " - "is not writable")) - def unwrap(w_self): if hasattr(w_self.instancetypedef, 'fakedcpytype'): return w_self.instancetypedef.fakedcpytype From cfbolz at codespeak.net Sun May 15 23:39:44 2005 From: cfbolz at codespeak.net (cfbolz at codespeak.net) Date: Sun, 15 May 2005 23:39:44 +0200 (CEST) Subject: [pypy-svn] r12331 - pypy/dist/pypy/module/builtin Message-ID: <20050515213944.4C25527BB6@code1.codespeak.net> Author: cfbolz Date: Sun May 15 23:39:44 2005 New Revision: 12331 Modified: pypy/dist/pypy/module/builtin/app_complex.py Log: made complex a bit more platform independent. Works on windows for me now, too. Modified: pypy/dist/pypy/module/builtin/app_complex.py ============================================================================== --- pypy/dist/pypy/module/builtin/app_complex.py (original) +++ pypy/dist/pypy/module/builtin/app_complex.py Sun May 15 23:39:44 2005 @@ -3,6 +3,10 @@ Plain Python definition of the 'complex' type. """ + +#XXX Hack: This float is supposed to overflow to inf +OVERFLOWED_FLOAT = float("1e10000000000000000000000000000000") + class complex(object): """complex(real[, imag]) -> complex number @@ -82,12 +86,12 @@ if len(y) <= 1: y += "1" f = float(y) - if abs(f) == float("inf"): + if abs(f) == OVERFLOWED_FLOAT: raise ValueError, "float() out of range: %s" % y return 0, f if y == "": f = float(x) - if abs(f) == float("inf"): + if abs(f) == OVERFLOWED_FLOAT: raise ValueError, "float() out of range: %s" % x return f, 0 if y[-1] != "j": @@ -98,14 +102,16 @@ if x in "+-": x += "1.0" f = float(x) - if abs(f) == float("inf"): + if abs(f) == OVERFLOWED_FLOAT: raise ValueError, "float() out of range: %s" % x return 0, f if y in "+-": y += "1.0" x = float(x) y = float(y) - if abs(x) == float("inf") or abs(y) == float("inf"): + if abs(x) == OVERFLOWED_FLOAT: + raise ValueError, "float() out of range: %s" % x + if abs(y) == OVERFLOWED_FLOAT: raise ValueError, "float() out of range: %s" % y return x, y From arigo at codespeak.net Sun May 15 23:46:20 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Sun, 15 May 2005 23:46:20 +0200 (CEST) Subject: [pypy-svn] r12332 - in pypy/dist/pypy: interpreter objspace objspace/std Message-ID: <20050515214620.6F30527BB6@code1.codespeak.net> Author: arigo Date: Sun May 15 23:46:20 2005 New Revision: 12332 Modified: pypy/dist/pypy/interpreter/baseobjspace.py pypy/dist/pypy/interpreter/module.py pypy/dist/pypy/interpreter/typedef.py pypy/dist/pypy/objspace/descroperation.py pypy/dist/pypy/objspace/std/typeobject.py Log: Sanitized the __dict__ attribute of module objects, by giving up trying to emulate CPython's behavior of having __dict__ set to None if module.__init__ is not called, but changed to a real dict as soon as an attribute is stored into the module... Got rid of space.getdict() and space.getdictvalue() -- veeery old interface mostly used in descroperation.py only, now replaced by W_Root.getdict/value(). Modified: pypy/dist/pypy/interpreter/baseobjspace.py ============================================================================== --- pypy/dist/pypy/interpreter/baseobjspace.py (original) +++ pypy/dist/pypy/interpreter/baseobjspace.py Sun May 15 23:46:20 2005 @@ -25,7 +25,7 @@ raise return None - def setdict(self, space): + def setdict(self, space, w_dict): typename = space.type(self).getname(space, '?') raise OperationError(space.w_TypeError, space.wrap("attribute '__dict__' of %s objects " Modified: pypy/dist/pypy/interpreter/module.py ============================================================================== --- pypy/dist/pypy/interpreter/module.py (original) +++ pypy/dist/pypy/interpreter/module.py Sun May 15 23:46:20 2005 @@ -12,11 +12,9 @@ self.space = space if w_dict is None: w_dict = space.newdict([]) - elif space.is_w(w_dict, space.w_None): - w_dict = None self.w_dict = w_dict self.w_name = w_name - if w_name is not None and w_dict is not None: + if w_name is not None: space.setitem(w_dict, space.wrap('__name__'), w_name) def getdict(self): @@ -24,7 +22,7 @@ def descr_module__new__(space, w_subtype, __args__): module = space.allocate_instance(Module, w_subtype) - Module.__init__(module, space, space.wrap('?'), space.w_None) + Module.__init__(module, space, None) return space.wrap(module) def descr_module__init__(self, w_name, w_doc=None): @@ -32,8 +30,5 @@ self.w_name = w_name if w_doc is None: w_doc = space.w_None - w_dict = self.getdict() - if w_dict is None: - w_dict = self.w_dict = space.newdict([]) - space.setitem(w_dict, space.wrap('__name__'), w_name) - space.setitem(w_dict, space.wrap('__doc__'), w_doc) + space.setitem(self.w_dict, space.wrap('__name__'), w_name) + space.setitem(self.w_dict, space.wrap('__doc__'), w_doc) Modified: pypy/dist/pypy/interpreter/typedef.py ============================================================================== --- pypy/dist/pypy/interpreter/typedef.py (original) +++ pypy/dist/pypy/interpreter/typedef.py Sun May 15 23:46:20 2005 @@ -306,12 +306,6 @@ " '%s' objects" % typename)) return w_dict -def descr_get_dict_may_be_None(space, obj): - w_dict = obj.getdict() - if w_dict is None: - return space.w_None - return w_dict - def descr_set_dict(space, obj, w_dict): obj.setdict(space, w_dict) @@ -391,7 +385,7 @@ __new__ = interp2app(Module.descr_module__new__.im_func, unwrap_spec=[ObjSpace, W_Root, Arguments]), __init__ = interp2app(Module.descr_module__init__), - __dict__ = GetSetProperty(descr_get_dict_may_be_None, cls=Module), # module dictionaries are readonly attributes + __dict__ = GetSetProperty(descr_get_dict, cls=Module), # module dictionaries are readonly attributes __doc__ = 'module(name[, doc])\n\nCreate a module object.\nThe name must be a string; the optional doc argument can have any type.' ) Modified: pypy/dist/pypy/objspace/descroperation.py ============================================================================== --- pypy/dist/pypy/objspace/descroperation.py (original) +++ pypy/dist/pypy/objspace/descroperation.py Sun May 15 23:46:20 2005 @@ -21,7 +21,7 @@ if w_descr is not None: if space.is_data_descr(w_descr): return space.get(w_descr, w_obj) - w_value = space.getdictvalue(w_obj, name) + w_value = w_obj.getdictvalue(space, name) if w_value is not None: return w_value if w_descr is not None: @@ -33,10 +33,12 @@ w_descr = space.lookup(w_obj, name) if w_descr is not None: if space.is_data_descr(w_descr): - return space.set(w_descr, w_obj, w_value) - w_dict = space.getdict(w_obj) + space.set(w_descr, w_obj, w_value) + return + w_dict = w_obj.getdict() if w_dict is not None: - return space.setitem(w_dict, w_name, w_value) + space.setitem(w_dict, w_name, w_value) + return raiseattrerror(space, w_obj, name, w_descr) def descr__delattr__(space, w_obj, w_name): @@ -45,17 +47,18 @@ if w_descr is not None: if space.is_data_descr(w_descr): return space.delete(w_descr, w_obj) - w_dict = space.getdict(w_obj) + w_dict = w_obj.getdict() if w_dict is not None: try: - return space.delitem(w_dict, w_name) + space.delitem(w_dict, w_name) + return except OperationError, ex: if not ex.match(space, space.w_KeyError): raise raiseattrerror(space, w_obj, name, w_descr) def descr__init__(space, w_obj, __args__): - pass # XXX some strange checking maybe + pass class DescrOperation: _mixin_ = True @@ -64,12 +67,6 @@ ec._compare_nesting = 0 ec._cmp_state = {} - def getdict(space, w_obj): - return w_obj.getdict() - - def getdictvalue(space, w_obj, attr): - return w_obj.getdictvalue(space, attr) - def is_data_descr(space, w_obj): return space.lookup(w_obj, '__set__') is not None Modified: pypy/dist/pypy/objspace/std/typeobject.py ============================================================================== --- pypy/dist/pypy/objspace/std/typeobject.py (original) +++ pypy/dist/pypy/objspace/std/typeobject.py Sun May 15 23:46:20 2005 @@ -204,7 +204,7 @@ # note that this doesn't call __get__ on the result at all space = w_self.space for w_class in w_self.mro_w: - w_value = space.getdictvalue(w_class, key) + w_value = w_class.getdictvalue(space, key) if w_value is not None: return w_value return None @@ -214,7 +214,7 @@ # attribute was found space = w_self.space for w_class in w_self.mro_w: - w_value = space.getdictvalue(w_class, key) + w_value = w_class.getdictvalue(space, key) if w_value is not None: return w_class, w_value return None, None From arigo at codespeak.net Sun May 15 23:48:37 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Sun, 15 May 2005 23:48:37 +0200 (CEST) Subject: [pypy-svn] r12333 - pypy/dist/lib-python/modified-2.3.4/test Message-ID: <20050515214837.918B527BB6@code1.codespeak.net> Author: arigo Date: Sun May 15 23:48:37 2005 New Revision: 12333 Added: pypy/dist/lib-python/modified-2.3.4/test/test_module.py - copied, changed from r12330, pypy/dist/lib-python/2.3.4/test/test_module.py Modified: pypy/dist/lib-python/modified-2.3.4/test/test_descr.py Log: Modified the tests to check about a non-__init__alized module's dictionary; now checks that it's a false value (None or {}, basically) instead of specifically None. Modified: pypy/dist/lib-python/modified-2.3.4/test/test_descr.py ============================================================================== --- pypy/dist/lib-python/modified-2.3.4/test/test_descr.py (original) +++ pypy/dist/lib-python/modified-2.3.4/test/test_descr.py Sun May 15 23:48:37 2005 @@ -2699,7 +2699,7 @@ raise TestFailed, "shouldn't allow %r.__class__ = %r" % (x, C) try: delattr(x, "__class__") - except TypeError: + except (TypeError, AttributeError): pass else: raise TestFailed, "shouldn't allow del %r.__class__" % x @@ -3236,7 +3236,7 @@ vereq(hasattr(m, "__name__"), 0) vereq(hasattr(m, "__file__"), 0) vereq(hasattr(m, "foo"), 0) - vereq(m.__dict__, None) + vereq(bool(m.__dict__), False) m.foo = 1 vereq(m.__dict__, {"foo": 1}) Copied: pypy/dist/lib-python/modified-2.3.4/test/test_module.py (from r12330, pypy/dist/lib-python/2.3.4/test/test_module.py) ============================================================================== --- pypy/dist/lib-python/2.3.4/test/test_module.py (original) +++ pypy/dist/lib-python/modified-2.3.4/test/test_module.py Sun May 15 23:48:37 2005 @@ -7,7 +7,7 @@ # An uninitialized module has no __dict__ or __name__, and __doc__ is None foo = module.__new__(module) -verify(foo.__dict__ is None) +verify(not foo.__dict__) try: s = foo.__name__ except AttributeError: From arigo at codespeak.net Mon May 16 00:33:00 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Mon, 16 May 2005 00:33:00 +0200 (CEST) Subject: [pypy-svn] r12336 - in pypy/dist/pypy/objspace: . std std/test Message-ID: <20050515223300.6D52427BCD@code1.codespeak.net> Author: arigo Date: Mon May 16 00:33:00 2005 New Revision: 12336 Modified: pypy/dist/pypy/objspace/descroperation.py pypy/dist/pypy/objspace/std/test/test_typeobject.py pypy/dist/pypy/objspace/std/typeobject.py pypy/dist/pypy/objspace/std/typetype.py Log: Made the __name__ of types writeable. This triggered a chain of obscure and mostly funny problems leading to eventual bug fixes. Modified: pypy/dist/pypy/objspace/descroperation.py ============================================================================== --- pypy/dist/pypy/objspace/descroperation.py (original) +++ pypy/dist/pypy/objspace/descroperation.py Mon May 16 00:33:00 2005 @@ -46,7 +46,8 @@ w_descr = space.lookup(w_obj, name) if w_descr is not None: if space.is_data_descr(w_descr): - return space.delete(w_descr, w_obj) + space.delete(w_descr, w_obj) + return w_dict = w_obj.getdict() if w_dict is not None: try: Modified: pypy/dist/pypy/objspace/std/test/test_typeobject.py ============================================================================== --- pypy/dist/pypy/objspace/std/test/test_typeobject.py (original) +++ pypy/dist/pypy/objspace/std/test/test_typeobject.py Mon May 16 00:33:00 2005 @@ -428,3 +428,11 @@ raises(TypeError, "X().__class__ = object") raises(TypeError, "X().__class__ = 1") + + def test_name(self): + class Abc(object): + pass + assert Abc.__name__ == 'Abc' + Abc.__name__ = 'Def' + assert Abc.__name__ == 'Def' + raises(TypeError, "Abc.__name__ = 42") Modified: pypy/dist/pypy/objspace/std/typeobject.py ============================================================================== --- pypy/dist/pypy/objspace/std/typeobject.py (original) +++ pypy/dist/pypy/objspace/std/typeobject.py Mon May 16 00:33:00 2005 @@ -322,26 +322,17 @@ raise OperationError(space.w_AttributeError, space.wrap(msg)) def setattr__Type_ANY_ANY(space, w_type, w_name, w_value): + # Note. This is exactly the same thing as descroperation.descr__setattr__, + # but it is needed at bootstrap to avoid a call to w_type.getdict() which + # would un-lazify the whole type. name = space.str_w(w_name) w_descr = space.lookup(w_type, name) if w_descr is not None: if space.is_data_descr(w_descr): - space.set(w_descr,w_type,space.type(w_type)) + space.set(w_descr, w_type, w_value) + return w_type.dict_w[name] = w_value -def delattr__Type_ANY(space, w_type, w_name): - if w_type.lazyloaders: - w_type._freeze_() # force un-lazification - name = space.str_w(w_name) - w_descr = space.lookup(w_type, name) - if w_descr is not None: - if space.is_data_descr(w_descr): - space.delete(w_descr, space.type(w_type)) - del w_type.dict_w[name] - -# XXX __delattr__ -# XXX __hash__ ?? - # ____________________________________________________________ Modified: pypy/dist/pypy/objspace/std/typetype.py ============================================================================== --- pypy/dist/pypy/objspace/std/typetype.py (original) +++ pypy/dist/pypy/objspace/std/typetype.py Mon May 16 00:33:00 2005 @@ -64,6 +64,14 @@ w_type = _check(space, w_type) return space.wrap(w_type.name) +def descr_set__name__(space, w_type, w_value): + w_type = _check(space, w_type) + if not w_type.is_heaptype(): + raise OperationError(space.w_TypeError, + space.wrap("can't set %s.__name__" % + w_type.name)) + w_type.name = space.str_w(w_value) + def descr_get__mro__(space, w_type): w_type = _check(space, w_type) # XXX this should be inside typeobject.py @@ -124,17 +132,13 @@ raise OperationError(space.w_TypeError, space.wrap("can't set %s.__module__" % w_type.name)) - if w_value is None: - raise OperationError(space.w_TypeError, - space.wrap("can't delete %s.__module__" % - w_type.name)) w_type.dict_w['__module__'] = w_value # ____________________________________________________________ type_typedef = StdTypeDef("type", __new__ = newmethod(descr__new__), - __name__ = GetSetProperty(descr_get__name__), + __name__ = GetSetProperty(descr_get__name__, descr_set__name__), __bases__ = GetSetProperty(descr__bases), __base__ = GetSetProperty(descr__base), __mro__ = GetSetProperty(descr_get__mro__), From arigo at codespeak.net Mon May 16 01:09:53 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Mon, 16 May 2005 01:09:53 +0200 (CEST) Subject: [pypy-svn] r12338 - pypy/dist/pypy/objspace/test Message-ID: <20050515230953.5955B27BCD@code1.codespeak.net> Author: arigo Date: Mon May 16 01:09:53 2005 New Revision: 12338 Modified: pypy/dist/pypy/objspace/test/test_descroperation.py Log: Completed tests, in search for a strange failure in test_descr.py... Modified: pypy/dist/pypy/objspace/test/test_descroperation.py ============================================================================== --- pypy/dist/pypy/objspace/test/test_descroperation.py (original) +++ pypy/dist/pypy/objspace/test/test_descroperation.py Mon May 16 01:09:53 2005 @@ -39,8 +39,12 @@ a1 *= 4 assert a1 == "imul" assert a - 2 == "sub" + assert a - object() == "sub" + assert 2 - a == "rsub" assert object() - a == "rsub" assert a ** 2 == "pow" + assert a ** object() == "pow" + assert 2 ** a == "rpow" assert object() ** a == "rpow" assert -a == "neg" From pedronis at codespeak.net Mon May 16 02:01:25 2005 From: pedronis at codespeak.net (pedronis at codespeak.net) Date: Mon, 16 May 2005 02:01:25 +0200 (CEST) Subject: [pypy-svn] r12339 - in pypy/dist/pypy/objspace: . std test Message-ID: <20050516000125.7F27927BCD@code1.codespeak.net> Author: pedronis Date: Mon May 16 02:01:25 2005 New Revision: 12339 Modified: pypy/dist/pypy/objspace/descroperation.py pypy/dist/pypy/objspace/std/objspace.py pypy/dist/pypy/objspace/test/test_descroperation.py Log: more subtle logic for dealing with r operators and subclasses for the case that the subclass does not redefine them (tests and we pass test_descr.subclass_right_op) Modified: pypy/dist/pypy/objspace/descroperation.py ============================================================================== --- pypy/dist/pypy/objspace/descroperation.py (original) +++ pypy/dist/pypy/objspace/descroperation.py Mon May 16 02:01:25 2005 @@ -216,12 +216,12 @@ def pow(space, w_obj1, w_obj2, w_obj3): w_typ1 = space.type(w_obj1) w_typ2 = space.type(w_obj2) - w_left_impl = space.lookup(w_obj1, '__pow__') + w_left_src, w_left_impl = space.lookup_where(w_obj1, '__pow__') if space.is_true(space.is_(w_typ1, w_typ2)): w_right_impl = None else: - w_right_impl = space.lookup(w_obj2, '__rpow__') - if space.is_true(space.issubtype(w_typ2, w_typ1)): + w_right_src, w_right_impl = space.lookup_where(w_obj2, '__rpow__') + if space.is_true(space.issubtype(w_typ2, w_typ1)) and not space.is_w(w_left_src, w_right_src): w_obj1, w_obj2 = w_obj2, w_obj1 w_left_impl, w_right_impl = w_right_impl, w_left_impl if w_left_impl is not None: @@ -351,12 +351,12 @@ def coerce(space, w_obj1, w_obj2): w_typ1 = space.type(w_obj1) w_typ2 = space.type(w_obj2) - w_left_impl = space.lookup(w_obj1, '__coerce__') + w_left_src, w_left_impl = space.lookup_where(w_obj1, '__coerce__') if space.is_true(space.is_(w_typ1, w_typ2)): w_right_impl = None else: - w_right_impl = space.lookup(w_obj2, '__coerce__') - if space.is_true(space.issubtype(w_typ2, w_typ1)): + w_right_src, w_right_impl = space.lookup_where(w_obj2, '__coerce__') + if space.is_true(space.issubtype(w_typ2, w_typ1)) and not space.is_w(w_left_src, w_right_src): w_obj1, w_obj2 = w_obj2, w_obj1 w_left_impl, w_right_impl = w_right_impl, w_left_impl @@ -406,14 +406,14 @@ def _cmp(space, w_obj1, w_obj2): w_typ1 = space.type(w_obj1) w_typ2 = space.type(w_obj2) - w_left_impl = space.lookup(w_obj1, '__cmp__') + w_left_src, w_left_impl = space.lookup_where(w_obj1, '__cmp__') do_neg1 = False do_neg2 = True if space.is_true(space.is_(w_typ1, w_typ2)): w_right_impl = None else: - w_right_impl = space.lookup(w_obj2, '__cmp__') - if space.is_true(space.issubtype(w_typ2, w_typ1)): + w_right_src, w_right_impl = space.lookup_where(w_obj2, '__cmp__') + if space.is_true(space.issubtype(w_typ2, w_typ1)) and not space.is_w(w_right_src, w_left_src): w_obj1, w_obj2 = w_obj2, w_obj1 w_left_impl, w_right_impl = w_right_impl, w_left_impl do_neg1, do_neg2 = do_neg2, do_neg1 @@ -451,12 +451,12 @@ def binop_impl(space, w_obj1, w_obj2): w_typ1 = space.type(w_obj1) w_typ2 = space.type(w_obj2) - w_left_impl = space.lookup(w_obj1, left) + w_left_src, w_left_impl = space.lookup_where(w_obj1, left) if space.is_true(space.is_(w_typ1, w_typ2)): w_right_impl = None else: - w_right_impl = space.lookup(w_obj2, right) - if space.is_true(space.issubtype(w_typ2, w_typ1)): + w_right_src, w_right_impl = space.lookup_where(w_obj2, right) + if space.is_true(space.issubtype(w_typ2, w_typ1)) and not space.is_w(w_right_src, w_left_src): w_obj1, w_obj2 = w_obj2, w_obj1 w_left_impl, w_right_impl = w_right_impl, w_left_impl @@ -476,7 +476,7 @@ def comparison_impl(space, w_obj1, w_obj2): w_typ1 = space.type(w_obj1) w_typ2 = space.type(w_obj2) - w_left_impl = space.lookup(w_obj1, left) + w_left_src, w_left_impl = space.lookup_where(w_obj1, left) w_first = w_obj1 w_second = w_obj2 @@ -516,8 +516,8 @@ if space.is_true(space.is_(w_typ1, w_typ2)): w_right_impl = None else: - w_right_impl = space.lookup(w_obj2, right) - if space.is_true(space.issubtype(w_typ2, w_typ1)): + w_right_src, w_right_impl = space.lookup_where(w_obj2, right) + if space.is_true(space.issubtype(w_typ2, w_typ1)) and not space.is_w(w_right_src, w_left_src): w_obj1, w_obj2 = w_obj2, w_obj1 w_left_impl, w_right_impl = w_right_impl, w_left_impl Modified: pypy/dist/pypy/objspace/std/objspace.py ============================================================================== --- pypy/dist/pypy/objspace/std/objspace.py (original) +++ pypy/dist/pypy/objspace/std/objspace.py Mon May 16 02:01:25 2005 @@ -279,6 +279,10 @@ w_type = w_obj.getclass(self) return w_type.lookup(name) + def lookup_where(self, w_obj, name): + w_type = w_obj.getclass(self) + return w_type.lookup_where(name) + def allocate_instance(self, cls, w_subtype): """Allocate the memory needed for an instance of an internal or user-defined type, without actually __init__ializing the instance.""" Modified: pypy/dist/pypy/objspace/test/test_descroperation.py ============================================================================== --- pypy/dist/pypy/objspace/test/test_descroperation.py (original) +++ pypy/dist/pypy/objspace/test/test_descroperation.py Mon May 16 02:01:25 2005 @@ -81,6 +81,19 @@ assert b ** b == "B's pow" assert -b == "B's neg" + class C(B): + pass + c = C() + assert c - 1 == "B's sub" + assert 1 - c == "B's rsub" + assert c - b == "B's sub" + assert b - c == "B's sub" + + assert c ** 1 == "B's pow" + assert 1 ** c == "B's rpow" + assert c ** b == "B's pow" + assert b ** c == "B's pow" + def test_getslice(self): class Sq(object): def __getslice__(self, start, stop): From pedronis at codespeak.net Mon May 16 02:39:50 2005 From: pedronis at codespeak.net (pedronis at codespeak.net) Date: Mon, 16 May 2005 02:39:50 +0200 (CEST) Subject: [pypy-svn] r12341 - pypy/dist/pypy/objspace/std Message-ID: <20050516003950.9682527BCD@code1.codespeak.net> Author: pedronis Date: Mon May 16 02:39:50 2005 New Revision: 12341 Modified: pypy/dist/pypy/objspace/std/typeobject.py Log: reintroudeced delattr to fix del D.__hash__ kind of manipulations Modified: pypy/dist/pypy/objspace/std/typeobject.py ============================================================================== --- pypy/dist/pypy/objspace/std/typeobject.py (original) +++ pypy/dist/pypy/objspace/std/typeobject.py Mon May 16 02:39:50 2005 @@ -333,6 +333,21 @@ return w_type.dict_w[name] = w_value +def delattr__Type_ANY(space, w_type, w_name): + if w_type.lazyloaders: + w_type._freeze_() # force un-lazification + name = space.str_w(w_name) + w_descr = space.lookup(w_type, name) + if w_descr is not None: + if space.is_data_descr(w_descr): + space.delete(w_descr, w_type) + return + try: + del w_type.dict_w[name] + return + except KeyError: + raise OperationError(space.w_AttributeError, w_name) + # ____________________________________________________________ From hpk at codespeak.net Mon May 16 10:25:58 2005 From: hpk at codespeak.net (hpk at codespeak.net) Date: Mon, 16 May 2005 10:25:58 +0200 (CEST) Subject: [pypy-svn] r12345 - pypy/dist/pypy/documentation/website Message-ID: <20050516082558.3EED827BDA@code1.codespeak.net> Author: hpk Date: Mon May 16 10:25:57 2005 New Revision: 12345 Added: pypy/dist/pypy/documentation/website/ (props changed) pypy/dist/pypy/documentation/website/communication.txt pypy/dist/pypy/documentation/website/home.txt pypy/dist/pypy/documentation/website/install.txt (contents, props changed) Log: issue1 in-progress made a start at the pypy/documentation/website directory i mentioned earlier in the issue. Converted the html files from the website into similar ReST (it will look different though, i guess) and added a first 'install' page (i think we should merge the getting_started.txt information somehow). This is not integrated with the actual PyPy web page yet. On a side note, I intend to turn the 'lists' menu item into a 'com' or 'communication' one as it makes sense to reference all mailing lists, IRC and issue trackers probably as well as some individuals people with emails even. (sometimes you don't want to communicate to a whole group). Added: pypy/dist/pypy/documentation/website/communication.txt ============================================================================== --- (empty file) +++ pypy/dist/pypy/documentation/website/communication.txt Mon May 16 10:25:57 2005 @@ -0,0 +1,33 @@ +PyPy mailing lists +================== + +`development mailing list`_ for conceptual and coding discussions (low to medium traffic). + +`subversion commit mailing list`_ all updates to the trunk/branch source and documentation tree. + +`sprint mailing list`_ for people (interested in) attending upcoming sprints. + +`EU partner mailing list`_ for people involved with EU administrative details + +.. _`sprint mailing list`: http://codespeak.net/mailman/listinfo/pypy-sprint +.. _`subversion commit mailing list`: http://codespeak.net/mailman/listinfo/pypy-svn +.. _`development mailing list`: http://codespeak.net/mailman/listinfo/pypy-dev +.. _`EU partner mailing list`: http://codespeak.net/mailman/listinfo/pypy-funding + + +PyPy issue trackers +=================== + +`development bug/feature tracker`_ for filing bugs and feature requests. +`EU milestone/issue tracking`_ for organizing work on EU-project milestones and deliverables + +.. _`EU milestone/issue tracking`: https://codespeak.net/issue/pypy-eu/ +.. _`development bug/feature tracker`: https://codespeak.net/issue/pypy-dev/ + +IRC Channel #pypy on freenode +============================= + +Many of the core developers are hanging out at #pypy on irc.freenode.net. +You are welcome to join and ask questions even more so if you are interested +in participating in some parts of the PyPy project. + Added: pypy/dist/pypy/documentation/website/home.txt ============================================================================== --- (empty file) +++ pypy/dist/pypy/documentation/website/home.txt Mon May 16 10:25:57 2005 @@ -0,0 +1,37 @@ +Implementing Python in Python +============================= + +The PyPy project aims at producing a simple runtime-system for the Python +language. We want to express the basic abstractions within the +Python Language itself. We later want to have a minimal +core which is not written in Python and doesn't need CPython anymore. +We want to take care that technologies such as `Psyco`_ and `Stackless`_ +will easily integrate. Simplicity and Flexibilty are the foremost goals. +Rumors have it that the secret goal is being faster-than-C which is +nonsense, isn't it? + +.. _Psyco: http://psyco.sf.net +.. _Stackless: http://stackless.com + + +(May 4th 2005) Next Sprint(s) around EuroPython 2005 +===================================================== + +The next sprint is scheduled right after EuroPython 2005 in G?theborg, Sweden. +We take a day of break after the conference and do the sprint from 1st-7th +of July 2005. Additionally there will be a four day Pre-EuroPython sprint +for people who already are familiar with the PyPy code base. + +(March 28th 2005) Pycon 2005 Sprint in Washington finished +========================================================== + +Our `Pycon 2005 Sprint`_ finished and was a good success. In our new +`revision report`_ we track information on compliancy with CPython. During the +conferences we made good contacts with other Python implementors and look +forward to closer cooperation. + 28 March. 2005 + + +.. _`revision report`: http://codespeak.net/pypy/rev/current/ +.. _`Pycon 2005 Sprint`: http://codespeak.net/svn/pypy/extradoc/sprintinfo/pycon2005-announcement.txt + Added: pypy/dist/pypy/documentation/website/install.txt ============================================================================== --- (empty file) +++ pypy/dist/pypy/documentation/website/install.txt Mon May 16 10:25:57 2005 @@ -0,0 +1,19 @@ + +Download and install PyPy +========================= + +XXX merge with getting_started somehow? + +There are currently two ways to install PyPy. If you have a subversion +client we recommend that you just follow the `getting started`_ +information on how to checkout and play around. + +Otherwise you can download and unpack one of the following files: + +*pypy-0.6* + `pypy-0.6.tar.gz`_ + `pypy-0.6.zip`_ + +.. _`pypy-0.6.tar.gz`: http://codespeak.net/download/pypy/pypy-0.6.tar.gz +.. _`pypy-0.6.zip`: http://codespeak.net/download/pypy/pypy-0.6.zip +.. _`getting started`: ../getting_started.html From hpk at codespeak.net Mon May 16 12:29:36 2005 From: hpk at codespeak.net (hpk at codespeak.net) Date: Mon, 16 May 2005 12:29:36 +0200 (CEST) Subject: [pypy-svn] r12347 - pypy/dist/pypy/documentation/website Message-ID: <20050516102936.2564B27BDB@code1.codespeak.net> Author: hpk Date: Mon May 16 12:29:35 2005 New Revision: 12347 Added: pypy/dist/pypy/documentation/website/contact.txt (props changed) - copied unchanged from r12345, pypy/dist/pypy/documentation/website/communication.txt Removed: pypy/dist/pypy/documentation/website/communication.txt Modified: pypy/dist/pypy/documentation/website/home.txt (props changed) Log: rename communication -> contact fixeol Deleted: /pypy/dist/pypy/documentation/website/communication.txt ============================================================================== --- /pypy/dist/pypy/documentation/website/communication.txt Mon May 16 12:29:35 2005 +++ (empty file) @@ -1,33 +0,0 @@ -PyPy mailing lists -================== - -`development mailing list`_ for conceptual and coding discussions (low to medium traffic). - -`subversion commit mailing list`_ all updates to the trunk/branch source and documentation tree. - -`sprint mailing list`_ for people (interested in) attending upcoming sprints. - -`EU partner mailing list`_ for people involved with EU administrative details - -.. _`sprint mailing list`: http://codespeak.net/mailman/listinfo/pypy-sprint -.. _`subversion commit mailing list`: http://codespeak.net/mailman/listinfo/pypy-svn -.. _`development mailing list`: http://codespeak.net/mailman/listinfo/pypy-dev -.. _`EU partner mailing list`: http://codespeak.net/mailman/listinfo/pypy-funding - - -PyPy issue trackers -=================== - -`development bug/feature tracker`_ for filing bugs and feature requests. -`EU milestone/issue tracking`_ for organizing work on EU-project milestones and deliverables - -.. _`EU milestone/issue tracking`: https://codespeak.net/issue/pypy-eu/ -.. _`development bug/feature tracker`: https://codespeak.net/issue/pypy-dev/ - -IRC Channel #pypy on freenode -============================= - -Many of the core developers are hanging out at #pypy on irc.freenode.net. -You are welcome to join and ask questions even more so if you are interested -in participating in some parts of the PyPy project. - From pedronis at codespeak.net Mon May 16 13:51:56 2005 From: pedronis at codespeak.net (pedronis at codespeak.net) Date: Mon, 16 May 2005 13:51:56 +0200 (CEST) Subject: [pypy-svn] r12348 - pypy/dist/lib-python/modified-2.3.4/test Message-ID: <20050516115156.C56CD27BDB@code1.codespeak.net> Author: pedronis Date: Mon May 16 13:51:56 2005 New Revision: 12348 Modified: pypy/dist/lib-python/modified-2.3.4/test/test_descr.py Log: change to not depend on bound methods repr Modified: pypy/dist/lib-python/modified-2.3.4/test/test_descr.py ============================================================================== --- pypy/dist/lib-python/modified-2.3.4/test/test_descr.py (original) +++ pypy/dist/lib-python/modified-2.3.4/test/test_descr.py Mon May 16 13:51:56 2005 @@ -1557,7 +1557,7 @@ class E: # *not* subclassing from C foo = C.foo vereq(E().foo, C.foo) # i.e., unbound - verify(repr(C.foo.__get__(C())).startswith(" Author: pedronis Date: Mon May 16 14:04:45 2005 New Revision: 12349 Modified: pypy/dist/pypy/objspace/std/objecttype.py pypy/dist/pypy/objspace/std/test/test_typeobject.py Log: explicitly disallow type('I',(int,), {'__slots__': ()})().__class__ = int Modified: pypy/dist/pypy/objspace/std/objecttype.py ============================================================================== --- pypy/dist/pypy/objspace/std/objecttype.py (original) +++ pypy/dist/pypy/objspace/std/objecttype.py Mon May 16 14:04:45 2005 @@ -22,6 +22,9 @@ raise OperationError(space.w_TypeError, space.wrap("__class__ must be set to new-style class, not '%s' object" % space.type(w_newcls).getname(space, '?'))) + if not w_newcls.is_heaptype(): + raise OperationError(space.w_TypeError, + space.wrap("__class__ assignment: only for heap types")) w_oldcls = space.type(w_obj) if w_oldcls.get_layout() == w_newcls.get_layout() and w_oldcls.hasdict == w_newcls.hasdict: w_obj.setclass(space, w_newcls) Modified: pypy/dist/pypy/objspace/std/test/test_typeobject.py ============================================================================== --- pypy/dist/pypy/objspace/std/test/test_typeobject.py (original) +++ pypy/dist/pypy/objspace/std/test/test_typeobject.py Mon May 16 14:04:45 2005 @@ -406,6 +406,7 @@ pass i = I() + i2 = I() i.__class__ = I2 i2.__class__ = I @@ -429,6 +430,10 @@ raises(TypeError, "X().__class__ = object") raises(TypeError, "X().__class__ = 1") + class Int(int): __slots__ = [] + + raises(TypeError, "Int().__class__ = int") + def test_name(self): class Abc(object): pass From hpk at codespeak.net Mon May 16 14:17:57 2005 From: hpk at codespeak.net (hpk at codespeak.net) Date: Mon, 16 May 2005 14:17:57 +0200 (CEST) Subject: [pypy-svn] r12350 - in pypy: dist/pypy/documentation/website www/pypywww www/pypywww/render Message-ID: <20050516121757.7688627BDE@code1.codespeak.net> Author: hpk Date: Mon May 16 14:17:57 2005 New Revision: 12350 Added: pypy/dist/pypy/documentation/website/news.txt - copied, changed from r12348, pypy/dist/pypy/documentation/website/home.txt Modified: pypy/dist/pypy/documentation/website/contact.txt pypy/dist/pypy/documentation/website/home.txt pypy/dist/pypy/documentation/website/install.txt pypy/www/pypywww/config.py pypy/www/pypywww/render/doc.py pypy/www/pypywww/render/main.py pypy/www/pypywww/render/page.py Log: issue1 testing The new webpage is now online, please have a look at see if you like it this way. Main changes: - there is now a 'home' and 'news' page - there is now a 'contact' page listing not only mailing lists but issue tracker and IRC information - there is a very preliminary 'install' document (should i take that out unless it's ready?) - From now on the website contents come from pypy/documentation/website so if you want to fix a typo or add information then just commit it locally - it will trigger the website to be updated (usually quick but it depends a bit). - Be sure to always issue 'py.test' when changing documentation and especially website content. py.test will check ReST conformance and some link integrity. (run 'py.test -R' to also check that all your remote links are fine). - what is missing: the update of mailman's list templates (the script that does it automatically is way out of date, sigh) Modified: pypy/dist/pypy/documentation/website/contact.txt ============================================================================== --- pypy/dist/pypy/documentation/website/contact.txt (original) +++ pypy/dist/pypy/documentation/website/contact.txt Mon May 16 14:17:57 2005 @@ -1,13 +1,13 @@ PyPy mailing lists ================== -`development mailing list`_ for conceptual and coding discussions (low to medium traffic). +* `development mailing list`_ for conceptual and coding discussions (low to medium traffic). -`subversion commit mailing list`_ all updates to the trunk/branch source and documentation tree. +* `subversion commit mailing list`_ all updates to the trunk/branch source and documentation tree. -`sprint mailing list`_ for people (interested in) attending upcoming sprints. +* `sprint mailing list`_ for people (interested in) attending upcoming sprints. -`EU partner mailing list`_ for people involved with EU administrative details +* `EU partner mailing list`_ for people involved with EU administrative details .. _`sprint mailing list`: http://codespeak.net/mailman/listinfo/pypy-sprint .. _`subversion commit mailing list`: http://codespeak.net/mailman/listinfo/pypy-svn @@ -18,10 +18,12 @@ PyPy issue trackers =================== -`development bug/feature tracker`_ for filing bugs and feature requests. -`EU milestone/issue tracking`_ for organizing work on EU-project milestones and deliverables +* `development bug/feature tracker`_ for filing bugs and feature requests. + +* `EU milestone/issue tracking`_ for organizing work on EU-project milestones and deliverables .. _`EU milestone/issue tracking`: https://codespeak.net/issue/pypy-eu/ + .. _`development bug/feature tracker`: https://codespeak.net/issue/pypy-dev/ IRC Channel #pypy on freenode @@ -30,4 +32,3 @@ Many of the core developers are hanging out at #pypy on irc.freenode.net. You are welcome to join and ask questions even more so if you are interested in participating in some parts of the PyPy project. - Modified: pypy/dist/pypy/documentation/website/home.txt ============================================================================== --- pypy/dist/pypy/documentation/website/home.txt (original) +++ pypy/dist/pypy/documentation/website/home.txt Mon May 16 14:17:57 2005 @@ -1,5 +1,5 @@ -Implementing Python in Python -============================= +PyPy: Implementing Python in Python +=================================== The PyPy project aims at producing a simple runtime-system for the Python language. We want to express the basic abstractions within the @@ -12,26 +12,3 @@ .. _Psyco: http://psyco.sf.net .. _Stackless: http://stackless.com - - -(May 4th 2005) Next Sprint(s) around EuroPython 2005 -===================================================== - -The next sprint is scheduled right after EuroPython 2005 in G?theborg, Sweden. -We take a day of break after the conference and do the sprint from 1st-7th -of July 2005. Additionally there will be a four day Pre-EuroPython sprint -for people who already are familiar with the PyPy code base. - -(March 28th 2005) Pycon 2005 Sprint in Washington finished -========================================================== - -Our `Pycon 2005 Sprint`_ finished and was a good success. In our new -`revision report`_ we track information on compliancy with CPython. During the -conferences we made good contacts with other Python implementors and look -forward to closer cooperation. - 28 March. 2005 - - -.. _`revision report`: http://codespeak.net/pypy/rev/current/ -.. _`Pycon 2005 Sprint`: http://codespeak.net/svn/pypy/extradoc/sprintinfo/pycon2005-announcement.txt - Modified: pypy/dist/pypy/documentation/website/install.txt ============================================================================== --- pypy/dist/pypy/documentation/website/install.txt (original) +++ pypy/dist/pypy/documentation/website/install.txt Mon May 16 14:17:57 2005 @@ -1,7 +1,7 @@ - Download and install PyPy ========================= +XXX CAUTION: this page does not contain correct information yet XXX merge with getting_started somehow? There are currently two ways to install PyPy. If you have a subversion @@ -12,6 +12,7 @@ *pypy-0.6* `pypy-0.6.tar.gz`_ + `pypy-0.6.zip`_ .. _`pypy-0.6.tar.gz`: http://codespeak.net/download/pypy/pypy-0.6.tar.gz Copied: pypy/dist/pypy/documentation/website/news.txt (from r12348, pypy/dist/pypy/documentation/website/home.txt) ============================================================================== --- pypy/dist/pypy/documentation/website/home.txt (original) +++ pypy/dist/pypy/documentation/website/news.txt Mon May 16 14:17:57 2005 @@ -1,36 +1,22 @@ -Implementing Python in Python -============================= - -The PyPy project aims at producing a simple runtime-system for the Python -language. We want to express the basic abstractions within the -Python Language itself. We later want to have a minimal -core which is not written in Python and doesn't need CPython anymore. -We want to take care that technologies such as `Psyco`_ and `Stackless`_ -will easily integrate. Simplicity and Flexibilty are the foremost goals. -Rumors have it that the secret goal is being faster-than-C which is -nonsense, isn't it? - -.. _Psyco: http://psyco.sf.net -.. _Stackless: http://stackless.com - - -(May 4th 2005) Next Sprint(s) around EuroPython 2005 -===================================================== +Next Sprint after EuroPython 2005 1st-7th July +====================================================== The next sprint is scheduled right after EuroPython 2005 in G?theborg, Sweden. -We take a day of break after the conference and do the sprint from 1st-7th -of July 2005. Additionally there will be a four day Pre-EuroPython sprint +We take a day of break after the conference and start sprinting from 1st-7th +of July 2005. The sprint theme is likely to be related strongly to +translation and working towards getting a first self-contained PyPy +version. Additionally there will be a four day Pre-EuroPython sprint for people who already are familiar with the PyPy code base. +*(05/04/2005)* -(March 28th 2005) Pycon 2005 Sprint in Washington finished +Pycon 2005 Sprint in Washington finished ========================================================== Our `Pycon 2005 Sprint`_ finished and was a good success. In our new `revision report`_ we track information on compliancy with CPython. During the conferences we made good contacts with other Python implementors and look forward to closer cooperation. - 28 March. 2005 - +*(03/28/2005)* .. _`revision report`: http://codespeak.net/pypy/rev/current/ .. _`Pycon 2005 Sprint`: http://codespeak.net/svn/pypy/extradoc/sprintinfo/pycon2005-announcement.txt Modified: pypy/www/pypywww/config.py ============================================================================== --- pypy/www/pypywww/config.py (original) +++ pypy/www/pypywww/config.py Mon May 16 14:17:57 2005 @@ -10,6 +10,7 @@ self.rawpath = self.wwwdir / 'rawdoc' assert self.rawpath.check() self.localdocpath = self.wwwdir.dirpath() / 'dist' / 'pypy' / 'documentation' + self.localwebsitedocs = self.localdocpath.join('website') assert self.localdocpath.check() self.localextradocpath = self.wwwdir.dirpath() / 'extradoc' assert self.localextradocpath.check() Modified: pypy/www/pypywww/render/doc.py ============================================================================== --- pypy/www/pypywww/render/doc.py (original) +++ pypy/www/pypywww/render/doc.py Mon May 16 14:17:57 2005 @@ -106,14 +106,8 @@ return self.gen_content(docpath) def set_doc_redirect(self, reldoc): - root = iexec.getinstance(html.html) - head = root[0] url = self.gw.url.new(query='doc/%s' % reldoc) - head.append(html.meta(" ", **{ - 'HTTP-EQUIV': "Refresh", - 'CONTENT': "0; URL=%s" % str(url)})) - : - + self.set_redirect(url) def gen_navlist(self, basepath): navpath = basepath.join('navlist') @@ -204,3 +198,13 @@ self.gen_treeview(dir) for dir in last: self.gen_treeview(dir) + +class WebsitePage(Documentation): + def __init__(self, fname): + super(WebsitePage, self).__init__() + self.fname = fname + + def content(self): + self.config = getconfig() + fspath = self.config.localwebsitedocs.join(self.fname).new(ext='.html') + xml.append(unicode(fspath.read(), 'utf8')) Modified: pypy/www/pypywww/render/main.py ============================================================================== --- pypy/www/pypywww/render/main.py (original) +++ pypy/www/pypywww/render/main.py Mon May 16 14:17:57 2005 @@ -3,7 +3,7 @@ py.magic.autopath() from pypywww.render.page import Page from pypywww.render.raw import RawHtmlView -from pypywww.render.doc import Documentation +from pypywww.render.doc import Documentation, WebsitePage from xpy import http from py import path @@ -17,6 +17,13 @@ #print "making url", str(url), "from", str(gw.url) return str(url) +class Redirect(Documentation): + def __init__(self, newurl): + self.newurl = newurl + + def content(self): + self.set_redirect(self.newurl) + class ExtMenuItem(MenuItem): def __init__(self, name, url): self.name = name @@ -27,15 +34,21 @@ return gw.url.new(self._url) menuitems = [ - MenuItem('home'), MenuItem('doc'), MenuItem('lists'), - ExtMenuItem('issues' , '/issue/pypy-dev/'), #MenuItem('source'), + MenuItem('home'), MenuItem('news'), MenuItem('doc'), + MenuItem('contact'), MenuItem('install'), + ExtMenuItem('issues' , 'https://codespeak.net/issue/pypy-dev/'), #MenuItem('source'), ExtMenuItem('moin', '/moin/pypy/moin.cgi/FrontPage?action=show'), ] rendermap = { - 'home' : RawHtmlView('home'), + #'home' : RawHtmlView('home'), 'doc' : Documentation(), 'extradoc' : Documentation(), + 'install' : WebsitePage('install'), + 'contact' : WebsitePage('contact'), + 'news' : WebsitePage('news'), + 'lists' : Redirect('https://codespeak.net/pypy/index.cgi?contact'), + 'home' : WebsitePage('home'), #'source' : RawHtmlView('source'), 'summary1' : RawHtmlView('summary1'), 'summary2' : RawHtmlView('summary2'), @@ -58,4 +71,3 @@ class Dump(Page): def content(self): http.getgateway().dump() - Modified: pypy/www/pypywww/render/page.py ============================================================================== --- pypy/www/pypywww/render/page.py (original) +++ pypy/www/pypywww/render/page.py Mon May 16 14:17:57 2005 @@ -3,12 +3,22 @@ # ===================================================================== from xpy import html, http, xml from pypywww.config import getconfig +import iexec class Page(object): def gettitle(self): return "PyPy %s" % http.getgateway().name + def set_redirect(self, url): + root = iexec.getinstance(html.html) + head = root[0] + head.append(html.meta(" ", **{ + 'HTTP-EQUIV': "Refresh", + 'CONTENT': "0; URL=%s" % str(url)})) + : + + def render(self): : : From hpk at codespeak.net Mon May 16 14:54:44 2005 From: hpk at codespeak.net (hpk at codespeak.net) Date: Mon, 16 May 2005 14:54:44 +0200 (CEST) Subject: [pypy-svn] r12354 - in pypy: dist/pypy/documentation/website www/pypywww/render Message-ID: <20050516125444.81FD527BDD@code1.codespeak.net> Author: hpk Date: Mon May 16 14:54:44 2005 New Revision: 12354 Removed: pypy/dist/pypy/documentation/website/home.txt Modified: pypy/dist/pypy/documentation/website/news.txt pypy/www/pypywww/render/main.py Log: issue1 testing refactored web page after a round of comments/discussion with Samuele. Basically the home and news page are now merged again and the home page is directly the 'news' page. Deleted: /pypy/dist/pypy/documentation/website/home.txt ============================================================================== --- /pypy/dist/pypy/documentation/website/home.txt Mon May 16 14:54:44 2005 +++ (empty file) @@ -1,14 +0,0 @@ -PyPy: Implementing Python in Python -=================================== - -The PyPy project aims at producing a simple runtime-system for the Python -language. We want to express the basic abstractions within the -Python Language itself. We later want to have a minimal -core which is not written in Python and doesn't need CPython anymore. -We want to take care that technologies such as `Psyco`_ and `Stackless`_ -will easily integrate. Simplicity and Flexibilty are the foremost goals. -Rumors have it that the secret goal is being faster-than-C which is -nonsense, isn't it? - -.. _Psyco: http://psyco.sf.net -.. _Stackless: http://stackless.com Modified: pypy/dist/pypy/documentation/website/news.txt ============================================================================== --- pypy/dist/pypy/documentation/website/news.txt (original) +++ pypy/dist/pypy/documentation/website/news.txt Mon May 16 14:54:44 2005 @@ -1,3 +1,18 @@ + + + The PyPy project aims at producing a simple runtime-system for the Python + language. We want to express the basic abstractions within the + Python Language itself. We later want to have a minimal + core which is not written in Python and doesn't need CPython anymore. + We want to take care that technologies such as `Psyco`_ and `Stackless`_ + will easily integrate. Simplicity and Flexibilty are the foremost goals. + Rumors have it that the secret goal is being faster-than-C which is + nonsense, isn't it? + +.. _Psyco: http://psyco.sf.net +.. _Stackless: http://stackless.com + + Next Sprint after EuroPython 2005 1st-7th July ====================================================== @@ -21,3 +36,4 @@ .. _`revision report`: http://codespeak.net/pypy/rev/current/ .. _`Pycon 2005 Sprint`: http://codespeak.net/svn/pypy/extradoc/sprintinfo/pycon2005-announcement.txt + Modified: pypy/www/pypywww/render/main.py ============================================================================== --- pypy/www/pypywww/render/main.py (original) +++ pypy/www/pypywww/render/main.py Mon May 16 14:54:44 2005 @@ -34,7 +34,7 @@ return gw.url.new(self._url) menuitems = [ - MenuItem('home'), MenuItem('news'), MenuItem('doc'), + MenuItem('news'), MenuItem('doc'), MenuItem('contact'), MenuItem('install'), ExtMenuItem('issues' , 'https://codespeak.net/issue/pypy-dev/'), #MenuItem('source'), ExtMenuItem('moin', '/moin/pypy/moin.cgi/FrontPage?action=show'), @@ -48,7 +48,7 @@ 'contact' : WebsitePage('contact'), 'news' : WebsitePage('news'), 'lists' : Redirect('https://codespeak.net/pypy/index.cgi?contact'), - 'home' : WebsitePage('home'), + 'home' : Redirect('https://codespeak.net/pypy/index.cgi?news'), #'source' : RawHtmlView('source'), 'summary1' : RawHtmlView('summary1'), 'summary2' : RawHtmlView('summary2'), From pedronis at codespeak.net Mon May 16 15:07:00 2005 From: pedronis at codespeak.net (pedronis at codespeak.net) Date: Mon, 16 May 2005 15:07:00 +0200 (CEST) Subject: [pypy-svn] r12355 - pypy/dist/pypy/module/builtin Message-ID: <20050516130700.DCE6A27BD9@code1.codespeak.net> Author: pedronis Date: Mon May 16 15:07:00 2005 New Revision: 12355 Modified: pypy/dist/pypy/module/builtin/app_descriptor.py Log: classmethod should check that their arg is callable (test_descr checks for this) Modified: pypy/dist/pypy/module/builtin/app_descriptor.py ============================================================================== --- pypy/dist/pypy/module/builtin/app_descriptor.py (original) +++ pypy/dist/pypy/module/builtin/app_descriptor.py Mon May 16 15:07:00 2005 @@ -22,6 +22,8 @@ __slots__ = ['_f'] def __init__(self, f): + if not callable(f): + raise TypeError, "'%s' object is not callable" % type(f).__name__ self._f = f def __get__(self, obj, klass=None): From arigo at codespeak.net Mon May 16 15:10:30 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Mon, 16 May 2005 15:10:30 +0200 (CEST) Subject: [pypy-svn] r12356 - pypy/dist/pypy/documentation Message-ID: <20050516131030.4DB5E27BD9@code1.codespeak.net> Author: arigo Date: Mon May 16 15:10:30 2005 New Revision: 12356 Modified: pypy/dist/pypy/documentation/objspace.txt Log: issue24 resolved Updated the flowgraph model to the latest exception-Variable-over-links mechanism. Modified: pypy/dist/pypy/documentation/objspace.txt ============================================================================== --- pypy/dist/pypy/documentation/objspace.txt (original) +++ pypy/dist/pypy/documentation/objspace.txt Mon May 16 15:10:30 2005 @@ -298,9 +298,13 @@ :target: the target Block to which this Link points to. :args: a list of Variables and Constants, of the same size as the target Block's inputargs, which gives all the values passed into the next block. (Note that each Variable used in the prevblock may appear zero, one or more times in the ``args`` list.) :exitcase: see above. + :last_exception: None or a Variable; see below. + :last_exc_value: None or a Variable; see below. Note that ``args`` uses Variables from the prevblock, which are matched to the target block's ``inputargs`` by position, as in a tuple assignment or function call would do. + If the link is an exception-catching one, the ``last_exception`` and ``last_exc_value`` are set to two fresh Variables that are considered to be created when the link is entered; at run-time, they will hold the exception class and value, respectively. These two new variables can only be used in the same link's ``args`` list, to be passed to the next block (as usual, they may actually not appear at all, or appear several times in ``args``). + SpaceOperation A recorded (or otherwise generated) basic operation. @@ -327,9 +331,6 @@ A Constant can occasionally store a mutable Python object. It represents a static, pre-initialized, read-only version of that object. The flow graph should not attempt to actually mutate such Constants. -XXX talk about implicit exceptions - - How the FlowObjSpace works -------------------------- From arigo at codespeak.net Mon May 16 15:49:31 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Mon, 16 May 2005 15:49:31 +0200 (CEST) Subject: [pypy-svn] r12357 - pypy/dist/pypy/objspace/std Message-ID: <20050516134931.1934F27BD9@code1.codespeak.net> Author: arigo Date: Mon May 16 15:49:30 2005 New Revision: 12357 Modified: pypy/dist/pypy/objspace/std/objspace.py Log: Initialization order issue: must create old-style classes before they are seen by the chain of calls dict.fromkeys = classmethod(fromkeys) ==> callable(fromkeys) ==> isinstance() ==> _instance Modified: pypy/dist/pypy/objspace/std/objspace.py ============================================================================== --- pypy/dist/pypy/objspace/std/objspace.py (original) +++ pypy/dist/pypy/objspace/std/objspace.py Mon May 16 15:49:30 2005 @@ -81,6 +81,7 @@ # dummy old-style classes types self.w_classobj = W_TypeObject(self, 'classobj', [self.w_object], {}) self.w_instance = W_TypeObject(self, 'instance', [self.w_object], {}) + self.setup_old_style_classes() # fix up a problem where multimethods apparently don't # like to define this at interp-level @@ -93,8 +94,6 @@ return r dict.fromkeys = classmethod(fromkeys) """) - # old-style classes - self.setup_old_style_classes() def enable_old_style_classes_as_default_metaclass(self): self.setitem(self.builtin.w_dict, self.wrap('__metaclass__'), self.w_classobj) @@ -112,6 +111,7 @@ from pypy.module import classobjinterp # sanity check that this approach is working and is not too late assert not self.is_true(self.contains(self.builtin.w_dict,self.wrap('_classobj'))),"app-level code has seen dummy old style classes" + assert not self.is_true(self.contains(self.builtin.w_dict,self.wrap('_instance'))),"app-level code has seen dummy old style classes" w_setup = classobjinterp.initclassobj(self) w_classobj, w_instance, w_purify = self.unpackiterable(w_setup) self.call_function(w_purify) From arigo at codespeak.net Mon May 16 15:56:22 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Mon, 16 May 2005 15:56:22 +0200 (CEST) Subject: [pypy-svn] r12358 - pypy/dist/pypy/objspace/std Message-ID: <20050516135622.88E8327BD9@code1.codespeak.net> Author: arigo Date: Mon May 16 15:56:22 2005 New Revision: 12358 Modified: pypy/dist/pypy/objspace/std/dictobject.py Log: W_DictObject: got rid of non_empties(), which was a bit useless because in most usages we still need to check if entries have been deleted in the meantime by mutating space operations. Changed a few space.getitem() with direct calls to lookdict(). --This line, and those below, will be ignored-- M std/dictobject.py Modified: pypy/dist/pypy/objspace/std/dictobject.py ============================================================================== --- pypy/dist/pypy/objspace/std/dictobject.py (original) +++ pypy/dist/pypy/objspace/std/dictobject.py Mon May 16 15:56:22 2005 @@ -61,9 +61,6 @@ if entry.w_value is not None: self.insert(entry.hash, entry.w_key, entry.w_value) - def non_empties(self): - return [entry for entry in self.data if entry.w_value is not None] - def lookdict(self, lookup_hash, w_lookup): assert isinstance(lookup_hash, r_uint) space = self.space @@ -98,9 +95,10 @@ def unwrap(w_dict): space = w_dict.space result = {} - for entry in w_dict.non_empties(): - # XXX generic mixed types unwrap - result[space.unwrap(entry.w_key)] = space.unwrap(entry.w_value) + for entry in w_dict.data: + if entry.w_value is not None: + # XXX generic mixed types unwrap + result[space.unwrap(entry.w_key)] = space.unwrap(entry.w_value) return result registerimplementation(W_DictObject) @@ -169,22 +167,16 @@ if space.is_true(space.is_(w_left, w_right)): return space.w_True - dataleft = w_left.non_empties() - dataright = w_right.non_empties() - if len(dataleft) != len(dataright): + if w_left.used != w_right.used: return space.w_False - for entry in dataleft: + for entry in w_left.data: w_val = entry.w_value if w_val is None: continue - w_key = entry.w_key - try: - w_rightval = space.getitem(w_right, w_key) - except OperationError, e: - if e.match(space, space.w_KeyError): - return space.w_False - raise - if not space.is_true(space.eq(w_val, w_rightval)): + rightentry = w_right.lookdict(entry.hash, entry.w_key) + if rightentry.w_value is None: + return space.w_False + if not space.eq_w(w_val, rightentry.w_value): return space.w_False return space.w_True @@ -199,33 +191,28 @@ continue w_key = entry.w_key if w_smallest_diff_a_key is None or space.is_true(space.lt(w_key, w_smallest_diff_a_key)): - try: - w_b_value = space.getitem(w_b, w_key) - except OperationError, e: - if not e.match(space, space.w_KeyError): - raise + b_entry = w_b.lookdict(entry.hash, w_key) + if b_entry.w_value is None: w_its_value = w_val w_smallest_diff_a_key = w_key else: - if not space.eq_w(w_val, w_b_value): + if not space.eq_w(w_val, b_entry.w_value): w_its_value = w_val w_smallest_diff_a_key = w_key return w_smallest_diff_a_key, w_its_value def lt__Dict_Dict(space, w_left, w_right): # Different sizes, no problem - dataleft = w_left.non_empties() - dataright = w_right.non_empties() - if len(dataleft) < len(dataright): + if w_left.used < w_right.used: return space.w_True - if len(dataleft) > len(dataright): + if w_left.used > w_right.used: return space.w_False # Same size - w_leftdiff, w_leftval = characterize(space, dataleft, w_right) + w_leftdiff, w_leftval = characterize(space, w_left.data, w_right) if w_leftdiff is None: return space.w_False - w_rightdiff, w_rightval = characterize(space, dataright, w_left) + w_rightdiff, w_rightval = characterize(space, w_right.data, w_left) w_res = space.w_False if w_rightdiff is not None: w_res = space.lt(w_leftdiff, w_rightdiff) From arigo at codespeak.net Mon May 16 16:18:19 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Mon, 16 May 2005 16:18:19 +0200 (CEST) Subject: [pypy-svn] r12360 - pypy/dist/pypy/module/recparser/test/samples Message-ID: <20050516141819.2CE6027BD9@code1.codespeak.net> Author: arigo Date: Mon May 16 16:18:18 2005 New Revision: 12360 Added: pypy/dist/pypy/module/recparser/test/samples/snippet_only_one_comment.DISABLED - copied unchanged from r12356, pypy/dist/pypy/module/recparser/test/samples/snippet_only_one_comment.py Removed: pypy/dist/pypy/module/recparser/test/samples/snippet_only_one_comment.py Log: Disabled the failing recmodule snippet test. Deleted: /pypy/dist/pypy/module/recparser/test/samples/snippet_only_one_comment.py ============================================================================== --- /pypy/dist/pypy/module/recparser/test/samples/snippet_only_one_comment.py Mon May 16 16:18:18 2005 +++ (empty file) @@ -1 +0,0 @@ -# only one comment From arigo at codespeak.net Mon May 16 16:18:58 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Mon, 16 May 2005 16:18:58 +0200 (CEST) Subject: [pypy-svn] r12361 - pypy/dist/pypy/objspace/std Message-ID: <20050516141858.D4FBB27BD9@code1.codespeak.net> Author: arigo Date: Mon May 16 16:18:58 2005 New Revision: 12361 Modified: pypy/dist/pypy/objspace/std/dictobject.py Log: Made W_DictObject.lookdict() safer: now it can no longer return an entry that doesn't belong to the dict table any more. Modified: pypy/dist/pypy/objspace/std/dictobject.py ============================================================================== --- pypy/dist/pypy/objspace/std/dictobject.py (original) +++ pypy/dist/pypy/objspace/std/dictobject.py Mon May 16 16:18:58 2005 @@ -64,22 +64,28 @@ def lookdict(self, lookup_hash, w_lookup): assert isinstance(lookup_hash, r_uint) space = self.space - i = lookup_hash % len(self.data) + data = self.data + i = lookup_hash % len(data) - entry = self.data[i] + entry = data[i] if entry.w_key is None or space.is_w(w_lookup, entry.w_key): return entry if entry.w_key is self.w_dummy: freeslot = entry else: if entry.hash == lookup_hash and space.eq_w(entry.w_key, w_lookup): + if self.data is not data: + # the eq_w() modified the dict sufficiently to have it + # switch to another table. Can't return 'entry', which + # belongs to the old table. Start over... + return self.lookdict(lookup_hash, w_lookup) return entry freeslot = None perturb = lookup_hash while 1: i = (i << 2) + i + perturb + 1 - entry = self.data[i%len(self.data)] + entry = data[i%len(data)] if entry.w_key is None: if freeslot: return freeslot @@ -87,6 +93,11 @@ return entry if entry.hash == lookup_hash and entry.w_key is not self.w_dummy \ and space.eq_w(entry.w_key, w_lookup): + if self.data is not data: + # the eq_w() modified the dict sufficiently to have it + # switch to another table. Can't return 'entry', which + # belongs to the old table. Start over... + return self.lookdict(lookup_hash, w_lookup) return entry if entry.w_key is self.w_dummy and freeslot is None: freeslot = entry From pedronis at codespeak.net Mon May 16 17:11:21 2005 From: pedronis at codespeak.net (pedronis at codespeak.net) Date: Mon, 16 May 2005 17:11:21 +0200 (CEST) Subject: [pypy-svn] r12364 - pypy/dist/pypy/objspace/std Message-ID: <20050516151121.5E8E927BDB@code1.codespeak.net> Author: pedronis Date: Mon May 16 17:11:21 2005 New Revision: 12364 Modified: pypy/dist/pypy/objspace/std/stdtypedef.py pypy/dist/pypy/objspace/std/typeobject.py pypy/dist/pypy/objspace/std/typetype.py Log: make W_TypeObject.getdict return a dict-proxy directly. Given that we have getdictvalue we will get proper behavior from object.__getattribute__, object.__setattr__ and object.__delattr__ will fail (slightly differently) as it happens on CPython. Notice, right now int.a = 3 still works on PyPy Modified: pypy/dist/pypy/objspace/std/stdtypedef.py ============================================================================== --- pypy/dist/pypy/objspace/std/stdtypedef.py (original) +++ pypy/dist/pypy/objspace/std/stdtypedef.py Mon May 16 17:11:21 2005 @@ -8,7 +8,7 @@ __all__ = ['StdTypeDef', 'newmethod', 'gateway', 'GetSetProperty', 'Member', - 'MultiMethod'] + 'MultiMethod', 'descr_get_dict'] class StdTypeDef(TypeDef): Modified: pypy/dist/pypy/objspace/std/typeobject.py ============================================================================== --- pypy/dist/pypy/objspace/std/typeobject.py (original) +++ pypy/dist/pypy/objspace/std/typeobject.py Mon May 16 17:11:21 2005 @@ -4,6 +4,7 @@ from pypy.interpreter import gateway from pypy.objspace.std.stdtypedef import std_dict_descr, issubtypedef, Member from pypy.objspace.std.objecttype import object_typedef +from pypy.objspace.std.dictproxyobject import W_DictProxyObject from copy_reg import _HEAPTYPE @@ -243,15 +244,14 @@ del w_self.lazyloaders return False - def getdict(w_self): - # XXX should return a + def getdict(w_self): # returning a dict-proxy! if w_self.lazyloaders: w_self._freeze_() # force un-lazification space = w_self.space dictspec = [] for key, w_value in w_self.dict_w.items(): dictspec.append((space.wrap(key), w_value)) - return space.newdict(dictspec) + return W_DictProxyObject(space, space.newdict(dictspec)) def unwrap(w_self): if hasattr(w_self.instancetypedef, 'fakedcpytype'): Modified: pypy/dist/pypy/objspace/std/typetype.py ============================================================================== --- pypy/dist/pypy/objspace/std/typetype.py (original) +++ pypy/dist/pypy/objspace/std/typetype.py Mon May 16 17:11:21 2005 @@ -1,6 +1,5 @@ from pypy.interpreter.error import OperationError from pypy.objspace.std.stdtypedef import * -from pypy.objspace.std.dictproxyobject import descr_get_dictproxy def descr__new__(space, w_typetype, w_name, w_bases, w_dict): "This is used to create user-defined classes only." @@ -142,7 +141,7 @@ __bases__ = GetSetProperty(descr__bases), __base__ = GetSetProperty(descr__base), __mro__ = GetSetProperty(descr_get__mro__), - __dict__ = GetSetProperty(descr_get_dictproxy), + __dict__ = GetSetProperty(descr_get_dict), __doc__ = GetSetProperty(descr__doc), mro = gateway.interp2app(descr_mro), __flags__ = GetSetProperty(descr__flags), From arigo at codespeak.net Mon May 16 17:17:57 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Mon, 16 May 2005 17:17:57 +0200 (CEST) Subject: [pypy-svn] r12365 - in pypy/dist/pypy: interpreter objspace objspace/flow translator Message-ID: <20050516151757.E88D227BDB@code1.codespeak.net> Author: arigo Date: Mon May 16 17:17:57 2005 New Revision: 12365 Modified: pypy/dist/pypy/interpreter/baseobjspace.py pypy/dist/pypy/interpreter/eval.py pypy/dist/pypy/interpreter/executioncontext.py pypy/dist/pypy/interpreter/generator.py pypy/dist/pypy/interpreter/interactive.py pypy/dist/pypy/interpreter/main.py pypy/dist/pypy/interpreter/miscutils.py pypy/dist/pypy/interpreter/pyframe.py pypy/dist/pypy/objspace/flow/objspace.py pypy/dist/pypy/objspace/trace.py pypy/dist/pypy/translator/geninterplevel.py Log: issue26 resolved Got rid of getthreadlocals() and the strange interactions with execution contexts that disappear if there is no frame left in the frame stack. Now each space creates a single ExecutionContext and saves it in a private attribute. (The attribute is private to continue to force the use of space.getexecutioncontext(), which in the future should be modified to cache and return one ExecutionContext per thread.) Fixed a large number of small API functions that don't need so many arguments any more, e.g. enter()/leave(). Bumped geninterplevel's version number -- cache issues detected... Modified: pypy/dist/pypy/interpreter/baseobjspace.py ============================================================================== --- pypy/dist/pypy/interpreter/baseobjspace.py (original) +++ pypy/dist/pypy/interpreter/baseobjspace.py Mon May 16 17:17:57 2005 @@ -1,6 +1,5 @@ from pypy.interpreter.executioncontext import ExecutionContext from pypy.interpreter.error import OperationError -from pypy.interpreter.miscutils import getthreadlocals from pypy.interpreter.argument import Arguments from pypy.tool.cache import Cache from pypy.rpython.rarithmetic import r_uint @@ -98,6 +97,7 @@ # set recursion limit # sets all the internal descriptors self.initialize() + self.getexecutioncontext() # force its creation, if not already done def __repr__(self): return self.__class__.__name__ @@ -157,10 +157,15 @@ def getexecutioncontext(self): "Return what we consider to be the active execution context." - ec = getthreadlocals().executioncontext - if ec is None: - ec = self.createexecutioncontext() - return ec + # XXX as long as we have no threads, just store the execution context + # in an attribute made private to prevent outside access. When + # we have threads, this should create a new execution context + # if we haven't seen one in the current thread yet. + try: + return self.__current_ec + except AttributeError: + self.__current_ec = ec = self.createexecutioncontext() + return ec def createexecutioncontext(self): "Factory function for execution contexts." Modified: pypy/dist/pypy/interpreter/eval.py ============================================================================== --- pypy/dist/pypy/interpreter/eval.py (original) +++ pypy/dist/pypy/interpreter/eval.py Mon May 16 17:17:57 2005 @@ -65,11 +65,11 @@ def resume(self): "Resume the execution of the frame from its current state." executioncontext = self.space.getexecutioncontext() - previous = executioncontext.enter(self) + executioncontext.enter(self) try: result = self.eval(executioncontext) finally: - executioncontext.leave(previous, self) + executioncontext.leave(self) return result # running a frame is usually the same as resuming it from its Modified: pypy/dist/pypy/interpreter/executioncontext.py ============================================================================== --- pypy/dist/pypy/interpreter/executioncontext.py (original) +++ pypy/dist/pypy/interpreter/executioncontext.py Mon May 16 17:17:57 2005 @@ -1,5 +1,5 @@ import sys -from pypy.interpreter.miscutils import getthreadlocals, Stack +from pypy.interpreter.miscutils import Stack from pypy.interpreter.error import OperationError from pypy.interpreter.compiler import CPythonCompiler @@ -20,10 +20,6 @@ if self.framestack.depth() > self.space.sys.recursionlimit: raise OperationError(self.space.w_RuntimeError, self.space.wrap("maximum recursion depth exceeded")) - locals = getthreadlocals() - previous_ec = locals.executioncontext - locals.executioncontext = self - try: frame.f_back = self.framestack.top() except: @@ -31,18 +27,14 @@ if not frame.code.hidden_applevel: self.framestack.push(frame) - return previous_ec - - def leave(self, previous_ec, frame): + + def leave(self, frame): if self.w_profilefunc: self._trace(frame, 'leaveframe', None) if not frame.code.hidden_applevel: self.framestack.pop() - locals = getthreadlocals() - locals.executioncontext = previous_ec - def get_builtin(self): try: return self.framestack.top().builtin Modified: pypy/dist/pypy/interpreter/generator.py ============================================================================== --- pypy/dist/pypy/interpreter/generator.py (original) +++ pypy/dist/pypy/interpreter/generator.py Mon May 16 17:17:57 2005 @@ -76,7 +76,7 @@ def __init__(self, w_yieldvalue): self.w_yieldvalue = w_yieldvalue - def action(self, frame, last_instr, executioncontext): + def action(self, frame): raise ExitFrame(self.w_yieldvalue) class SGeneratorReturn(ControlFlowException): Modified: pypy/dist/pypy/interpreter/interactive.py ============================================================================== --- pypy/dist/pypy/interpreter/interactive.py (original) +++ pypy/dist/pypy/interpreter/interactive.py Mon May 16 17:17:57 2005 @@ -1,7 +1,7 @@ import autopath from pypy.interpreter import error -from pypy.interpreter import executioncontext, baseobjspace, module, main +from pypy.interpreter import baseobjspace, module, main import sys import code import time @@ -91,7 +91,6 @@ self.space = objspace self.verbose = verbose space = self.space - self.ec = space.createexecutioncontext() self.console_compiler_flags = 0 mainmodule = main.ensure__main__(space) @@ -103,10 +102,6 @@ space.exec_("__pytrace__ = 0", self.w_globals, self.w_globals) self.tracelevel = 0 - def get_ec(self): - # XXX Wont handle threads - return self.ec - def enable_command_line_completer(self): try: import readline Modified: pypy/dist/pypy/interpreter/main.py ============================================================================== --- pypy/dist/pypy/interpreter/main.py (original) +++ pypy/dist/pypy/interpreter/main.py Mon May 16 17:17:57 2005 @@ -1,5 +1,5 @@ import autopath -from pypy.interpreter import executioncontext, module, eval +from pypy.interpreter import module, eval from pypy.interpreter.error import OperationError from pypy.interpreter.pycode import PyCode import sys, types Modified: pypy/dist/pypy/interpreter/miscutils.py ============================================================================== --- pypy/dist/pypy/interpreter/miscutils.py (original) +++ pypy/dist/pypy/interpreter/miscutils.py Mon May 16 17:17:57 2005 @@ -77,15 +77,3 @@ def items(self): return self.cls.__dict__.items() - - -class ThreadLocals: - """Thread-local storage.""" - - def __init__(self): - self.executioncontext = None - -# XXX no thread support yet, so this is easy :-) -_locals = ThreadLocals() -def getthreadlocals(): - return _locals Modified: pypy/dist/pypy/interpreter/pyframe.py ============================================================================== --- pypy/dist/pypy/interpreter/pyframe.py (original) +++ pypy/dist/pypy/interpreter/pyframe.py Mon May 16 17:17:57 2005 @@ -113,7 +113,7 @@ except ControlFlowException, ctlflowexc: # we have a reason to change the control flow # (typically unroll the stack) - ctlflowexc.action(self, self.last_instr, executioncontext) + ctlflowexc.action(self) except ExitFrame, e: # leave that frame @@ -436,7 +436,7 @@ WHY_YIELD SYieldValue """ - def action(self, frame, last_instr, executioncontext): + def action(self, frame): "Default unroller implementation." while not frame.blockstack.empty(): block = frame.blockstack.pop() @@ -464,10 +464,9 @@ def __init__(self, operr): self.operr = operr - def action(self, frame, last_instr, executioncontext): + def action(self, frame): frame.last_exception = self.operr - ControlFlowException.action(self, frame, - last_instr, executioncontext) + ControlFlowException.action(self, frame) def emptystack(self, frame): # propagate the exception to the caller Modified: pypy/dist/pypy/objspace/flow/objspace.py ============================================================================== --- pypy/dist/pypy/objspace/flow/objspace.py (original) +++ pypy/dist/pypy/objspace/flow/objspace.py Mon May 16 17:17:57 2005 @@ -173,7 +173,7 @@ return None def getexecutioncontext(self): - return self.executioncontext + return getattr(self, 'executioncontext', None) def setup_executioncontext(self, ec): self.executioncontext = ec Modified: pypy/dist/pypy/objspace/trace.py ============================================================================== --- pypy/dist/pypy/objspace/trace.py (original) +++ pypy/dist/pypy/objspace/trace.py Mon May 16 17:17:57 2005 @@ -109,12 +109,12 @@ def enter(self, frame): """ called just before (continuing to) evaluating a frame. """ self.result.append(EnterFrame(frame)) - return self.ec.enter(frame) + self.ec.enter(frame) - def leave(self, previous_ec, frame): + def leave(self, frame): """ called just after evaluating of a frame is suspended/finished. """ self.result.append(LeaveFrame(frame)) - return self.ec.leave(previous_ec, frame) + self.ec.leave(frame) def bytecode_trace(self, frame): """ called just before execution of a bytecode. """ Modified: pypy/dist/pypy/translator/geninterplevel.py ============================================================================== --- pypy/dist/pypy/translator/geninterplevel.py (original) +++ pypy/dist/pypy/translator/geninterplevel.py Mon May 16 17:17:57 2005 @@ -50,7 +50,7 @@ import pypy # __path__ import py.path -GI_VERSION = '1.0.5' # bump this for substantial changes +GI_VERSION = '1.0.6' # bump this for substantial changes # ____________________________________________________________ def eval_helper(self, typename, expr): From lac at codespeak.net Mon May 16 17:19:20 2005 From: lac at codespeak.net (lac at codespeak.net) Date: Mon, 16 May 2005 17:19:20 +0200 (CEST) Subject: [pypy-svn] r12366 - pypy/dist/pypy/documentation/website Message-ID: <20050516151920.010D827BDB@code1.codespeak.net> Author: lac Date: Mon May 16 17:19:20 2005 New Revision: 12366 Modified: pypy/dist/pypy/documentation/website/news.txt Log: Fix typo Modified: pypy/dist/pypy/documentation/website/news.txt ============================================================================== --- pypy/dist/pypy/documentation/website/news.txt (original) +++ pypy/dist/pypy/documentation/website/news.txt Mon May 16 17:19:20 2005 @@ -16,7 +16,7 @@ Next Sprint after EuroPython 2005 1st-7th July ====================================================== -The next sprint is scheduled right after EuroPython 2005 in G?theborg, Sweden. +The next sprint is scheduled right after EuroPython 2005 in G?teborg, Sweden. We take a day of break after the conference and start sprinting from 1st-7th of July 2005. The sprint theme is likely to be related strongly to translation and working towards getting a first self-contained PyPy From arigo at codespeak.net Mon May 16 17:41:10 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Mon, 16 May 2005 17:41:10 +0200 (CEST) Subject: [pypy-svn] r12368 - pypy/dist/pypy/module/test Message-ID: <20050516154110.628BC27BD9@code1.codespeak.net> Author: arigo Date: Mon May 16 17:41:10 2005 New Revision: 12368 Modified: pypy/dist/pypy/module/test/test_sysmodule.py Log: Reset sys.settrace() to None after the test. Because we cache the ExecutionContext, tests can now influence each other... not sure if we should fix this or keep it to (painfully) detect tests that leave a broken ExecutionContext behind... Modified: pypy/dist/pypy/module/test/test_sysmodule.py ============================================================================== --- pypy/dist/pypy/module/test/test_sysmodule.py (original) +++ pypy/dist/pypy/module/test/test_sysmodule.py Mon May 16 17:41:10 2005 @@ -358,5 +358,8 @@ def x(): pass sys.settrace(trace) - x() + try: + x() + finally: + sys.settrace(None) assert len(counts) == 1 From arigo at codespeak.net Mon May 16 17:44:36 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Mon, 16 May 2005 17:44:36 +0200 (CEST) Subject: [pypy-svn] r12370 - pypy/dist/pypy/rpython/test Message-ID: <20050516154436.2369C27BD9@code1.codespeak.net> Author: arigo Date: Mon May 16 17:44:35 2005 New Revision: 12370 Modified: pypy/dist/pypy/rpython/test/test_rlist.py Log: Disabled the failing test_rlist for now. Modified: pypy/dist/pypy/rpython/test/test_rlist.py ============================================================================== --- pypy/dist/pypy/rpython/test/test_rlist.py (original) +++ pypy/dist/pypy/rpython/test/test_rlist.py Mon May 16 17:44:35 2005 @@ -16,7 +16,7 @@ assert "did not crash" -def test_append(): +def NOT_READY_test_append(): def dummyfn(): l = [] l.append(5) From tismer at codespeak.net Mon May 16 18:09:54 2005 From: tismer at codespeak.net (tismer at codespeak.net) Date: Mon, 16 May 2005 18:09:54 +0200 (CEST) Subject: [pypy-svn] r12371 - pypy/dist/pypy/interpreter Message-ID: <20050516160954.738EF27BB2@code1.codespeak.net> Author: tismer Date: Mon May 16 18:09:54 2005 New Revision: 12371 Modified: pypy/dist/pypy/interpreter/typedef.py Log: found a small typo by runing targetpypymain Modified: pypy/dist/pypy/interpreter/typedef.py ============================================================================== --- pypy/dist/pypy/interpreter/typedef.py (original) +++ pypy/dist/pypy/interpreter/typedef.py Mon May 16 18:09:54 2005 @@ -297,8 +297,8 @@ from pypy.interpreter.nestedscope import Cell from pypy.interpreter.special import NotImplemented, Ellipsis -def descr_get_dict(space, obj): - w_dict = obj.getdict() +def descr_get_dict(space, w_obj): + w_dict = w_obj.getdict() if w_dict is None: typename = space.type(w_obj).getname(space, '?') raise OperationError(space.w_TypeError, @@ -306,8 +306,8 @@ " '%s' objects" % typename)) return w_dict -def descr_set_dict(space, obj, w_dict): - obj.setdict(space, w_dict) +def descr_set_dict(space, w_obj, w_dict): + w_obj.setdict(space, w_dict) def generic_ne(space, w_obj1, w_obj2): if space.eq_w(w_obj1, w_obj2): From arigo at codespeak.net Mon May 16 18:16:28 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Mon, 16 May 2005 18:16:28 +0200 (CEST) Subject: [pypy-svn] r12372 - pypy/dist/pypy/interpreter/test Message-ID: <20050516161628.2A45227BB9@code1.codespeak.net> Author: arigo Date: Mon May 16 18:16:27 2005 New Revision: 12372 Modified: pypy/dist/pypy/interpreter/test/test_typedef.py Log: Tests for the previous fix in typedef.py. Modified: pypy/dist/pypy/interpreter/test/test_typedef.py ============================================================================== --- pypy/dist/pypy/interpreter/test/test_typedef.py (original) +++ pypy/dist/pypy/interpreter/test/test_typedef.py Mon May 16 18:16:27 2005 @@ -23,3 +23,20 @@ assert hasattr(tb, 'tb_lasti') assert hasattr(tb, 'tb_lineno') assert hasattr(tb, 'tb_next') + + def test_descr_dict(self): + def f(): + pass + dictdescr = type(f).__dict__['__dict__'] # only for functions + assert dictdescr.__get__(f) is f.__dict__ + raises(TypeError, dictdescr.__get__, 5) + d = {} + dictdescr.__set__(f, d) + assert f.__dict__ is d + raises(TypeError, dictdescr.__set__, f, "not a dict") + raises(TypeError, dictdescr.__set__, 5, d) + # in PyPy, the following descr applies to any object that has a dict, + # but not to objects without a dict, obviously + dictdescr = type.__dict__['__dict__'] + raises(TypeError, dictdescr.__get__, 5) + raises(TypeError, dictdescr.__set__, 5, d) From arigo at codespeak.net Mon May 16 18:24:35 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Mon, 16 May 2005 18:24:35 +0200 (CEST) Subject: [pypy-svn] r12374 - pypy/dist/pypy/objspace/std Message-ID: <20050516162435.A1C9427BD9@code1.codespeak.net> Author: arigo Date: Mon May 16 18:24:35 2005 New Revision: 12374 Modified: pypy/dist/pypy/objspace/std/fake.py Log: targetpypy-friendliness. Modified: pypy/dist/pypy/objspace/std/fake.py ============================================================================== --- pypy/dist/pypy/objspace/std/fake.py (original) +++ pypy/dist/pypy/objspace/std/fake.py Mon May 16 18:24:35 2005 @@ -81,10 +81,11 @@ def fake__new__(space, w_type, __args__): args_w, kwds_w = __args__.unpack() args = [space.unwrap(w_arg) for w_arg in args_w] - kwds = dict([(key, space.unwrap(w_value)) - for (key, w_value) in kwds_w.items()]) + kwds = {} + for (key, w_value) in kwds_w.items(): + kwds[key] = space.unwrap(w_value) try: - r = cpy_type.__new__(cpy_type, *args, **kwds) + r = apply(cpy_type.__new__, [cpy_type]+args, kwds) except: wrap_exception(space) raise From arigo at codespeak.net Mon May 16 19:40:32 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Mon, 16 May 2005 19:40:32 +0200 (CEST) Subject: [pypy-svn] r12381 - in pypy/dist: lib-python/modified-2.3.4/test pypy/objspace/std Message-ID: <20050516174032.E9FD727BB2@code1.codespeak.net> Author: arigo Date: Mon May 16 19:40:32 2005 New Revision: 12381 Modified: pypy/dist/lib-python/modified-2.3.4/test/string_tests.py pypy/dist/pypy/objspace/std/stringobject.py Log: Fixed the CPython test about strings: it was not intended to test what occurs when we call the special methods of strings, but only the usual operators. The difference is clear between str.__mul__ and the * operator, where the former shouldn't raise a TypeError because it is only half of the implementation of the binary operator *. Now the CPython test should test the right thing. Reverted the stringobject.py change about str.__mul__, which is no longer needed to hide this problem. (str*str has always been raising a TypeError in PyPy, even if str.__mul__(str) not.) Modified: pypy/dist/lib-python/modified-2.3.4/test/string_tests.py ============================================================================== --- pypy/dist/lib-python/modified-2.3.4/test/string_tests.py (original) +++ pypy/dist/lib-python/modified-2.3.4/test/string_tests.py Mon May 16 19:40:32 2005 @@ -2,7 +2,7 @@ Common tests shared by test_str, test_unicode, test_userstring and test_string. """ -import unittest, string, sys +import unittest, string, sys, operator from test import test_support from UserList import UserList @@ -64,6 +64,16 @@ realresult = getattr(object, methodname)(*args) self.assert_(object is not realresult) + # check that op(*args) returns result + def checkop(self, result, op, *args): + result = self.fixtype(result) + args = self.fixtype(args) + realresult = op(*args) + self.assertEqual( + result, + realresult + ) + # check that object.method(*args) raises exc def checkraises(self, exc, object, methodname, *args): object = self.fixtype(object) @@ -74,12 +84,26 @@ *args ) + # check that op(*args) raises exc + def checkopraises(self, exc, op, *args): + args = self.fixtype(args) + self.assertRaises( + exc, + op, + *args + ) + # call object.method(*args) without any checks def checkcall(self, object, methodname, *args): object = self.fixtype(object) args = self.fixtype(args) getattr(object, methodname)(*args) + # call op(*args) without any checks + def checkopcall(self, op, *args): + args = self.fixtype(args) + op(*args) + def test_capitalize(self): self.checkequal(' hello ', ' hello ', 'capitalize') self.checkequal('Hello ', 'Hello ','capitalize') @@ -460,50 +484,50 @@ self.checkraises(TypeError, 'hello', 'endswith', 42) def test___contains__(self): - self.checkequal(True, '', '__contains__', '') # vereq('' in '', True) - self.checkequal(True, 'abc', '__contains__', '') # vereq('' in 'abc', True) - self.checkequal(False, 'abc', '__contains__', '\0') # vereq('\0' in 'abc', False) - self.checkequal(True, '\0abc', '__contains__', '\0') # vereq('\0' in '\0abc', True) - self.checkequal(True, 'abc\0', '__contains__', '\0') # vereq('\0' in 'abc\0', True) - self.checkequal(True, '\0abc', '__contains__', 'a') # vereq('a' in '\0abc', True) - self.checkequal(True, 'asdf', '__contains__', 'asdf') # vereq('asdf' in 'asdf', True) - self.checkequal(False, 'asd', '__contains__', 'asdf') # vereq('asdf' in 'asd', False) - self.checkequal(False, '', '__contains__', 'asdf') # vereq('asdf' in '', False) + self.checkop(True, operator.contains, '', '') # vereq('' in '', True) + self.checkop(True, operator.contains, 'abc', '') # vereq('' in 'abc', True) + self.checkop(False, operator.contains, 'abc', '\0') # vereq('\0' in 'abc', False) + self.checkop(True, operator.contains, '\0abc', '\0') # vereq('\0' in '\0abc', True) + self.checkop(True, operator.contains, 'abc\0', '\0') # vereq('\0' in 'abc\0', True) + self.checkop(True, operator.contains, '\0abc', 'a') # vereq('a' in '\0abc', True) + self.checkop(True, operator.contains, 'asdf', 'asdf') # vereq('asdf' in 'asdf', True) + self.checkop(False, operator.contains, 'asd', 'asdf') # vereq('asdf' in 'asd', False) + self.checkop(False, operator.contains, '', 'asdf') # vereq('asdf' in '', False) def test_subscript(self): - self.checkequal(u'a', 'abc', '__getitem__', 0) - self.checkequal(u'c', 'abc', '__getitem__', -1) - self.checkequal(u'a', 'abc', '__getitem__', 0L) - self.checkequal(u'abc', 'abc', '__getitem__', slice(0, 3)) - self.checkequal(u'abc', 'abc', '__getitem__', slice(0, 1000)) - self.checkequal(u'a', 'abc', '__getitem__', slice(0, 1)) - self.checkequal(u'', 'abc', '__getitem__', slice(0, 0)) + self.checkop(u'a', operator.getitem, 'abc', 0) + self.checkop(u'c', operator.getitem, 'abc', -1) + self.checkop(u'a', operator.getitem, 'abc', 0L) + self.checkop(u'abc', operator.getitem, 'abc', slice(0, 3)) + self.checkop(u'abc', operator.getitem, 'abc', slice(0, 1000)) + self.checkop(u'a', operator.getitem, 'abc', slice(0, 1)) + self.checkop(u'', operator.getitem, 'abc', slice(0, 0)) # FIXME What about negative indizes? This is handled differently by [] and __getitem__(slice) - self.checkraises(TypeError, 'abc', '__getitem__', 'def') + self.checkopraises(TypeError, operator.getitem, 'abc', 'def') def test_slice(self): - self.checkequal('abc', 'abc', '__getslice__', 0, 1000) - self.checkequal('abc', 'abc', '__getslice__', 0, 3) - self.checkequal('ab', 'abc', '__getslice__', 0, 2) - self.checkequal('bc', 'abc', '__getslice__', 1, 3) - self.checkequal('b', 'abc', '__getslice__', 1, 2) - self.checkequal('', 'abc', '__getslice__', 2, 2) - self.checkequal('', 'abc', '__getslice__', 1000, 1000) - self.checkequal('', 'abc', '__getslice__', 2000, 1000) - self.checkequal('', 'abc', '__getslice__', 2, 1) + self.checkop('abc', operator.getslice, 'abc', 0, 1000) + self.checkop('abc', operator.getslice, 'abc', 0, 3) + self.checkop('ab', operator.getslice, 'abc', 0, 2) + self.checkop('bc', operator.getslice, 'abc', 1, 3) + self.checkop('b', operator.getslice, 'abc', 1, 2) + self.checkop('', operator.getslice, 'abc', 2, 2) + self.checkop('', operator.getslice, 'abc', 1000, 1000) + self.checkop('', operator.getslice, 'abc', 2000, 1000) + self.checkop('', operator.getslice, 'abc', 2, 1) # FIXME What about negative indizes? This is handled differently by [] and __getslice__ - self.checkraises(TypeError, 'abc', '__getslice__', 'def') + self.checkopraises(TypeError, operator.getslice, 'abc', 'def') def test_mul(self): - self.checkequal('', 'abc', '__mul__', -1) - self.checkequal('', 'abc', '__mul__', 0) - self.checkequal('abc', 'abc', '__mul__', 1) - self.checkequal('abcabcabc', 'abc', '__mul__', 3) - self.checkraises(TypeError, 'abc', '__mul__') - self.checkraises(TypeError, 'abc', '__mul__', '') - self.checkraises(OverflowError, 10000*'abc', '__mul__', 2000000000) + self.checkop('', operator.mul, 'abc', -1) + self.checkop('', operator.mul, 'abc', 0) + self.checkop('abc', operator.mul, 'abc', 1) + self.checkop('abcabcabc', operator.mul, 'abc', 3) + self.checkopraises(TypeError, operator.mul, 'abc') + self.checkopraises(TypeError, operator.mul, 'abc', '') + self.checkopraises(OverflowError, operator.mul, 10000*'abc', 2000000000) def test_join(self): # join now works with any sequence type @@ -535,39 +559,39 @@ self.checkraises(TypeError, ' ', 'join', Sequence([7, 'hello', 123L])) def test_formatting(self): - self.checkequal('+hello+', '+%s+', '__mod__', 'hello') - self.checkequal('+10+', '+%d+', '__mod__', 10) - self.checkequal('a', "%c", '__mod__', "a") - self.checkequal('a', "%c", '__mod__', "a") - self.checkequal('"', "%c", '__mod__', 34) - self.checkequal('$', "%c", '__mod__', 36) - self.checkequal('10', "%d", '__mod__', 10) - self.checkequal('\x7f', "%c", '__mod__', 0x7f) + self.checkop('+hello+', operator.mod, '+%s+', 'hello') + self.checkop('+10+', operator.mod, '+%d+', 10) + self.checkop('a', operator.mod, "%c", "a") + self.checkop('a', operator.mod, "%c", "a") + self.checkop('"', operator.mod, "%c", 34) + self.checkop('$', operator.mod, "%c", 36) + self.checkop('10', operator.mod, "%d", 10) + self.checkop('\x7f', operator.mod, "%c", 0x7f) for ordinal in (-100, 0x200000): # unicode raises ValueError, str raises OverflowError - self.checkraises((ValueError, OverflowError), '%c', '__mod__', ordinal) + self.checkopraises((ValueError, OverflowError), operator.mod, '%c', ordinal) - self.checkequal(' 42', '%3ld', '__mod__', 42) - self.checkequal('0042.00', '%07.2f', '__mod__', 42) - self.checkequal('0042.00', '%07.2F', '__mod__', 42) - - self.checkraises(TypeError, 'abc', '__mod__') - self.checkraises(TypeError, '%(foo)s', '__mod__', 42) - self.checkraises(TypeError, '%s%s', '__mod__', (42,)) - self.checkraises(TypeError, '%c', '__mod__', (None,)) - self.checkraises(ValueError, '%(foo', '__mod__', {}) - self.checkraises(TypeError, '%(foo)s %(bar)s', '__mod__', ('foo', 42)) + self.checkop(' 42', operator.mod, '%3ld', 42) + self.checkop('0042.00', operator.mod, '%07.2f', 42) + self.checkop('0042.00', operator.mod, '%07.2F', 42) + + self.checkopraises(TypeError, operator.mod, 'abc') + self.checkopraises(TypeError, operator.mod, '%(foo)s', 42) + self.checkopraises(TypeError, operator.mod, '%s%s', (42,)) + self.checkopraises(TypeError, operator.mod, '%c', (None,)) + self.checkopraises(ValueError, operator.mod, '%(foo', {}) + self.checkopraises(TypeError, operator.mod, '%(foo)s %(bar)s', ('foo', 42)) # argument names with properly nested brackets are supported - self.checkequal('bar', '%((foo))s', '__mod__', {'(foo)': 'bar'}) + self.checkop('bar', operator.mod, '%((foo))s', {'(foo)': 'bar'}) # 100 is a magic number in PyUnicode_Format, this forces a resize - self.checkequal(103*'a'+'x', '%sx', '__mod__', 103*'a') + self.checkop(103*'a'+'x', operator.mod, '%sx', 103*'a') - self.checkraises(TypeError, '%*s', '__mod__', ('foo', 'bar')) - self.checkraises(TypeError, '%10.*f', '__mod__', ('foo', 42.)) - self.checkraises(ValueError, '%10', '__mod__', (42,)) + self.checkopraises(TypeError, operator.mod, '%*s', ('foo', 'bar')) + self.checkopraises(TypeError, operator.mod, '%10.*f', ('foo', 42.)) + self.checkopraises(ValueError, operator.mod, '%10', (42,)) def test_floatformatting(self): # float formatting @@ -582,7 +606,7 @@ (99, 123)]: format = '%%.%if' % prec try: - self.checkcall(format, "__mod__", value) + self.checkopcall(operator.mod, format, value) except OverflowError: self.failUnless(abs(value) < 1e25 and prec >= 67, "OverflowError on small examples") Modified: pypy/dist/pypy/objspace/std/stringobject.py ============================================================================== --- pypy/dist/pypy/objspace/std/stringobject.py (original) +++ pypy/dist/pypy/objspace/std/stringobject.py Mon May 16 19:40:32 2005 @@ -916,9 +916,6 @@ def mul__String_ANY(space, w_str, w_times): return mul_string_times(space, w_str, w_times) -def mul__String_String(space, w_str, w_times): - raise OperationError( space.w_TypeError, space.wrap("an integer is required")) - def mul__ANY_String(space, w_times, w_str): return mul_string_times(space, w_str, w_times) From hpk at codespeak.net Mon May 16 19:52:38 2005 From: hpk at codespeak.net (hpk at codespeak.net) Date: Mon, 16 May 2005 19:52:38 +0200 (CEST) Subject: [pypy-svn] r12385 - in pypy/dist/pypy/documentation: . website Message-ID: <20050516175238.14D9C27BB2@code1.codespeak.net> Author: hpk Date: Mon May 16 19:52:37 2005 New Revision: 12385 Modified: pypy/dist/pypy/documentation/ (props changed) pypy/dist/pypy/documentation/website/ (props changed) Log: ignore helper cache files for webpage From arigo at codespeak.net Mon May 16 20:14:47 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Mon, 16 May 2005 20:14:47 +0200 (CEST) Subject: [pypy-svn] r12386 - pypy/dist/pypy/annotation Message-ID: <20050516181447.4171027BB9@code1.codespeak.net> Author: arigo Date: Mon May 16 20:14:47 2005 New Revision: 12386 Modified: pypy/dist/pypy/annotation/bookkeeper.py Log: Attach a .const attribute in this case too. Modified: pypy/dist/pypy/annotation/bookkeeper.py ============================================================================== --- pypy/dist/pypy/annotation/bookkeeper.py (original) +++ pypy/dist/pypy/annotation/bookkeeper.py Mon May 16 20:14:47 2005 @@ -189,7 +189,7 @@ self.seen_mutable[x] = True for attr in x.__dict__: clsdef.add_source_for_attribute(attr, x) # can trigger reflowing - return SomeInstance(clsdef) + result = SomeInstance(clsdef) elif x is None: return self.getpbc(None) else: From pedronis at codespeak.net Mon May 16 20:25:35 2005 From: pedronis at codespeak.net (pedronis at codespeak.net) Date: Mon, 16 May 2005 20:25:35 +0200 (CEST) Subject: [pypy-svn] r12387 - pypy/dist/pypy/annotation Message-ID: <20050516182535.62ACE27BB9@code1.codespeak.net> Author: pedronis Date: Mon May 16 20:25:35 2005 New Revision: 12387 Modified: pypy/dist/pypy/annotation/binaryop.py Log: assertion to check that we don't regress to unspecialized versions of classes Modified: pypy/dist/pypy/annotation/binaryop.py ============================================================================== --- pypy/dist/pypy/annotation/binaryop.py (original) +++ pypy/dist/pypy/annotation/binaryop.py Mon May 16 20:25:35 2005 @@ -381,6 +381,8 @@ if basedef is None: # print warning? return SomeObject() + assert '_specialize_' not in basedef.cls.__dict__, ( + "instance union degenerating to unspecialized version: %s" % basedef) return SomeInstance(basedef, can_be_None=ins1.can_be_None or ins2.can_be_None) class __extend__(pairtype(SomeIterator, SomeIterator)): From arigo at codespeak.net Mon May 16 20:46:14 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Mon, 16 May 2005 20:46:14 +0200 (CEST) Subject: [pypy-svn] r12388 - in pypy/dist/pypy: interpreter objspace/std Message-ID: <20050516184614.603FC27BC2@code1.codespeak.net> Author: arigo Date: Mon May 16 20:46:14 2005 New Revision: 12388 Modified: pypy/dist/pypy/interpreter/baseobjspace.py pypy/dist/pypy/interpreter/miscutils.py pypy/dist/pypy/objspace/std/objspace.py Log: Resurrected ThreadLocals, attaching a threadlocals instance on the space. Now getexecutioncontext() can do the right thing thread-wise, and most importantly it allows to us to restore annotator-happiness. The problem we had is hinted to in the comments of ObjSpace._freeze_(). --This line, and those below, will be ignored-- M pypy/interpreter/miscutils.py M pypy/interpreter/baseobjspace.py M pypy/objspace/std/objspace.py Modified: pypy/dist/pypy/interpreter/baseobjspace.py ============================================================================== --- pypy/dist/pypy/interpreter/baseobjspace.py (original) +++ pypy/dist/pypy/interpreter/baseobjspace.py Mon May 16 20:46:14 2005 @@ -1,6 +1,7 @@ from pypy.interpreter.executioncontext import ExecutionContext from pypy.interpreter.error import OperationError from pypy.interpreter.argument import Arguments +from pypy.interpreter.miscutils import ThreadLocals from pypy.tool.cache import Cache from pypy.rpython.rarithmetic import r_uint @@ -94,11 +95,11 @@ def __init__(self): "NOT_RPYTHON: Basic initialization of objects." self.fromcache = InternalSpaceCache(self).getorbuild + self.threadlocals = ThreadLocals() # set recursion limit # sets all the internal descriptors self.initialize() - self.getexecutioncontext() # force its creation, if not already done - + def __repr__(self): return self.__class__.__name__ @@ -157,15 +158,18 @@ def getexecutioncontext(self): "Return what we consider to be the active execution context." - # XXX as long as we have no threads, just store the execution context - # in an attribute made private to prevent outside access. When - # we have threads, this should create a new execution context - # if we haven't seen one in the current thread yet. - try: - return self.__current_ec - except AttributeError: - self.__current_ec = ec = self.createexecutioncontext() - return ec + ec = self.threadlocals.executioncontext + if ec is None: + ec = self.createexecutioncontext() + self.threadlocals.executioncontext = ec + return ec + + def _freeze_(self): + # Important: the annotator must not see a prebuilt ExecutionContext + # for reasons related to the specialization of the framestack attribute + # so we make sure there is no executioncontext at freeze-time + self.threadlocals.executioncontext = None + return True def createexecutioncontext(self): "Factory function for execution contexts." Modified: pypy/dist/pypy/interpreter/miscutils.py ============================================================================== --- pypy/dist/pypy/interpreter/miscutils.py (original) +++ pypy/dist/pypy/interpreter/miscutils.py Mon May 16 20:46:14 2005 @@ -77,3 +77,12 @@ def items(self): return self.cls.__dict__.items() + + +class ThreadLocals: + """Thread-local storage.""" + # XXX this is not really thread-local at the moment. + # XXX reconsider how this should be implemented when we add threads. + + def __init__(self): + self.executioncontext = None Modified: pypy/dist/pypy/objspace/std/objspace.py ============================================================================== --- pypy/dist/pypy/objspace/std/objspace.py (original) +++ pypy/dist/pypy/objspace/std/objspace.py Mon May 16 20:46:14 2005 @@ -28,9 +28,6 @@ PACKAGE_PATH = 'objspace.std' - def _freeze_(self): - return True - def initialize(self): "NOT_RPYTHON: only for initializing the space." self._typecache = Cache() From arigo at codespeak.net Mon May 16 20:59:39 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Mon, 16 May 2005 20:59:39 +0200 (CEST) Subject: [pypy-svn] r12389 - pypy/dist/pypy/translator/test Message-ID: <20050516185939.8845227BC2@code1.codespeak.net> Author: arigo Date: Mon May 16 20:59:39 2005 New Revision: 12389 Modified: pypy/dist/pypy/translator/test/test_annrpython.py Log: Fixed the test, failing after the addition of the .const attribute in the result computed by the annotator. Modified: pypy/dist/pypy/translator/test/test_annrpython.py ============================================================================== --- pypy/dist/pypy/translator/test/test_annrpython.py (original) +++ pypy/dist/pypy/translator/test/test_annrpython.py Mon May 16 20:59:39 2005 @@ -703,7 +703,8 @@ a = self.RPythonAnnotator() s = a.build_types(lambda: myobj, []) assert myobj.called - assert s == annmodel.SomeInstance(a.bookkeeper.getclassdef(Stuff)) + assert isinstance(s, annmodel.SomeInstance) + assert s.classdef is a.bookkeeper.getclassdef(Stuff) def test_circular_mutable_getattr(self): class C: From pedronis at codespeak.net Mon May 16 21:18:21 2005 From: pedronis at codespeak.net (pedronis at codespeak.net) Date: Mon, 16 May 2005 21:18:21 +0200 (CEST) Subject: [pypy-svn] r12390 - pypy/dist/pypy/annotation Message-ID: <20050516191821.DADA727BB2@code1.codespeak.net> Author: pedronis Date: Mon May 16 21:18:21 2005 New Revision: 12390 Modified: pypy/dist/pypy/annotation/binaryop.py Log: remove the assert, we need be more careful Modified: pypy/dist/pypy/annotation/binaryop.py ============================================================================== --- pypy/dist/pypy/annotation/binaryop.py (original) +++ pypy/dist/pypy/annotation/binaryop.py Mon May 16 21:18:21 2005 @@ -381,8 +381,6 @@ if basedef is None: # print warning? return SomeObject() - assert '_specialize_' not in basedef.cls.__dict__, ( - "instance union degenerating to unspecialized version: %s" % basedef) return SomeInstance(basedef, can_be_None=ins1.can_be_None or ins2.can_be_None) class __extend__(pairtype(SomeIterator, SomeIterator)): From hpk at codespeak.net Mon May 16 21:59:38 2005 From: hpk at codespeak.net (hpk at codespeak.net) Date: Mon, 16 May 2005 21:59:38 +0200 (CEST) Subject: [pypy-svn] r12391 - pypy/dist/pypy/documentation Message-ID: <20050516195938.5EB4327BB2@code1.codespeak.net> Author: hpk Date: Mon May 16 21:59:38 2005 New Revision: 12391 Modified: pypy/dist/pypy/documentation/conftest.py pypy/dist/pypy/documentation/getting_started.txt Log: issue4 deferred i now think that we cannot easily have doctests run over our current documentation. It fails at various places due to LLVM not running on AMD64 and t.view() invoking pygame windows etc.pp. We need to develop a somewhat more sophisticated approach towards testing our >>> prompts in documentation. Deferring to M1.0. Modified: pypy/dist/pypy/documentation/conftest.py ============================================================================== --- pypy/dist/pypy/documentation/conftest.py (original) +++ pypy/dist/pypy/documentation/conftest.py Mon May 16 21:59:38 2005 @@ -2,6 +2,11 @@ from py.__.documentation.conftest import Directory, DoctestText, ReSTChecker class PyPyDoctestText(DoctestText): + + def run(self): + # XXX refine doctest support with respect to scoping + return + def execute(self, module, docstring): # XXX execute PyPy prompts as well l = [] Modified: pypy/dist/pypy/documentation/getting_started.txt ============================================================================== --- pypy/dist/pypy/documentation/getting_started.txt (original) +++ pypy/dist/pypy/documentation/getting_started.txt Mon May 16 21:59:38 2005 @@ -188,7 +188,7 @@ ``test/snippet.py``. For example:: >>> t = Translator(test.is_perfect_number) - >>> #t.view() + >>> t.view() .. >>> from pypy.translator.translator import Translator .. >>> from pypy.translator.test import snippet as test @@ -197,7 +197,7 @@ ``is_perfect_number``:: >>> a = t.annotate([int]) - >>> #t.view() + >>> t.view() Move the mouse over variable names (in red) to see their inferred types. To perform simplifications based on the annotation you can do:: From hpk at codespeak.net Tue May 17 00:34:26 2005 From: hpk at codespeak.net (hpk at codespeak.net) Date: Tue, 17 May 2005 00:34:26 +0200 (CEST) Subject: [pypy-svn] r12394 - pypy/dist/pypy/documentation Message-ID: <20050516223426.F05F627BB9@code1.codespeak.net> Author: hpk Date: Tue May 17 00:34:26 2005 New Revision: 12394 Modified: pypy/dist/pypy/documentation/getting_started.txt Log: issue37 in-progress introduced the 0.6 release and according explanations into the getting started document. Basically i try to make downloading/unpacking the upcoming 0.6 release an alternative to using an 'svn co' line. Also i tried to avoid all the duplicate information we have everywhere. Somehow i don't like the very detailed subversion steps anymore. People who don't have subversion are likely to just use the tar/zip files and the others could be pointed to some official subversion documentation. So I think we should further refactor the getting started document accordingly and remove subversion details. This part of the documentation stems from a time where almost nobody had subversion installed except us :-) Modified: pypy/dist/pypy/documentation/getting_started.txt ============================================================================== --- pypy/dist/pypy/documentation/getting_started.txt (original) +++ pypy/dist/pypy/documentation/getting_started.txt Tue May 17 00:34:26 2005 @@ -10,88 +10,81 @@ Just the facts ============== -Checking out & running PyPy as a two-liner ------------------------------------------- +getting & running the PyPy 0.6 release +--------------------------------------- -The public releases are avaiable on the `download page`_. If you want the -bleeding edge development version you can also do:: +Download one of the following release files and unpack it: - svn co http://codespeak.net/svn/pypy/dist pypy-dist +*pypy-0.6 (not released yet)* + + * download `pypy-0.6.zip` or `pypy-0.6.tar.gz` and unpack it + + * alternatively run ``svn co http://codespeak.net/svn/pypy/tag/0.6 pypy-0.6`` -and after checkout you can get a PyPy interpreter via:: +then change to the ``pypy-0.6`` directory +and execute the following command line:: - python pypy-dist/pypy/interpreter/py.py - -have fun :-) + python pypy/interpreter/py.py -You can also go the more `detailed version`_ of this two-liner. +This will give you a PyPy prompt, i.e. a very compliant +Python interpreter implemented in Python. Because this version +of PyPy still runs on top of CPython, it runs around 3000-4000 +times slower than the original CPython. The 0.6 release focus +really was on compliancy: PyPy passes around `90% of CPythons core +language regression tests`_. -Browsing via HTTP and getting an svn client -------------------------------------------- +.. _`90% of CPythons core language regression tests`: http://codespeak.net/~hpk/pypy-testresult/ -You can `browse the pypy source code`_ directly via http. -(sorry, viewcvs is still not stable enough with subversion). -And here is some information to `install a subversion client`_. +Svn-check out & run the latest PyPy as a two-liner (with svn) +------------------------------------------------------------- -.. _`browse the pypy source code`: http://codespeak.net/svn/pypy/dist -.. _`download page`: http://codespeak.net/pypy/XXX_download_page_XXX +If you want to play with the ongoing development version +of PyPy you can simply do:: -coding style and testing ------------------------- - -We keep a strong focus on testing because we want to be able -to refactor things all the time (without proper automated -testing this would become very hard and fragile). + svn co http://codespeak.net/svn/pypy/dist pypy-dist -For an overview of how we organize our codebase please look at our -`coding-guide document`_. +and after checkout you can get a PyPy interpreter via:: -For running all PyPy tests you can issue:: + python pypy-dist/pypy/interpreter/py.py - cd pypy-dist/pypy/ - python test_all.py +have fun :-) -test_all.py really is another name for `py.test`_ which is a testing -tool working from the current directory unless you specify -filename/directory arguments. +You may go to the more `detailed version`_ of this two-liner. -If you want to have write access to the codespeak respository -please send a mail to *jum at anubis han de* or *hpk at merlinux de* -in order to ask for a username and password. Please mention what you want to do -within the pypy project. Even better, come to our next sprint so that we can -get to know you. +Understanding PyPy's architecture +--------------------------------- -Viewing documentation ---------------------- +For in-depth information about architecture and coding style head over +to the `documentation section`_ where you'll find lots of interesting +information. Additionally, in true hacker spirit, you may just +`start reading sources`_ . -PyPy documentation is generated from reST textfiles in the pypy/documentation directory -of our pypy-subversion repository. Go to the `documentation start page`_ -and look around. +.. _`documentation section`: index.html -.. _`documentation start page`: index.html -.. _`coding-guide document`: coding-guide.html -.. _`py.test`: http://codespeak.net/py/current/doc/test.html +running all of PyPy's tests +--------------------------- -.. _`detailed version`: +If you want to see if PyPy works on your machine/platform +you can simply run PyPy's large test suite with:: -The long'n detailed version -=========================== + python pypy/test_all.py -PyPy sources can be browsed on the web at: +test_all.py is just another name for `py.test`_ which is the +testing tool that we are using and enhancing for PyPy. - http://codespeak.net/svn/pypy/dist +.. _`py.test`: http://codespeak.net/py/current/doc/test.html +.. _`detailed version`: -Once you are ready to download and try PyPy out, -follow these instructions, which assume that you -are working in a DOS box (Windows) or terminal (MacOS/X or Linux). +The long'n detailed version (using subversion) +============================================== -detailed steps --------------- +The following instructions are supposed to work from +a DOS box (Win32) or from a terminal (MacOSX/Linux/Unix). 1. Download and install subversion_ if you do not already have it. 2. Change to the directory where you wish to install the source tree, - and use subversion to download the source:: + and use subversion to checkout the source:: svn co http://codespeak.net/svn/pypy/dist pypy-dist @@ -135,7 +128,6 @@ python py.py ../../lib-python/modified-2.3.4/test/pystone.py 10 - 6. The PyPy project uses test-driven-development. Right now, there are a couple of different categories of tests which you can run. To run all the unit tests:: @@ -238,8 +230,9 @@ This works only with fully annotated graphs. - +.. _`start reading sources`: + Where to start reading the sources ---------------------------------- From hpk at codespeak.net Tue May 17 00:46:24 2005 From: hpk at codespeak.net (hpk at codespeak.net) Date: Tue, 17 May 2005 00:46:24 +0200 (CEST) Subject: [pypy-svn] r12395 - pypy/dist/pypy/documentation Message-ID: <20050516224624.CB38627B82@code1.codespeak.net> Author: hpk Date: Tue May 17 00:46:24 2005 New Revision: 12395 Modified: pypy/dist/pypy/documentation/getting_started.txt Log: turn the additional tools' links into actual links Modified: pypy/dist/pypy/documentation/getting_started.txt ============================================================================== --- pypy/dist/pypy/documentation/getting_started.txt (original) +++ pypy/dist/pypy/documentation/getting_started.txt Tue May 17 00:46:24 2005 @@ -281,39 +281,38 @@ ----------------------------------------------- We use some optional tools for working on pypy. They are not required to run -all the tests or to get an interactive PyPy prompt but they help to understand -and debug PyPy. +the basic tests or to get an interactive PyPy prompt but they help to understand +and debug PyPy especially for the ongoing translation work. Recommended tools +++++++++++++++++ -* graphviz:: +*graphviz* (used for visualizing the control-flow) - http://www.research.att.com/sw/tools/graphviz/download.html_ + http://www.research.att.com/sw/tools/graphviz/download.html -* pygame:: +*pygame* (to visualize control flow and annotation analysis of python programs) - http://www.pygame.org/download.shtml_ - - - on MAC OSX: XXX (please provide help on how to sanely - install pygame on OSX) + http://www.pygame.org/download.shtml Optional tools ++++++++++++++ -* llvm: +*llvm* + + (used for the optional LLVM translation backend) One of our backends uses the `low level virtual machine`_ to generate processor independant machine level code. -* CLISP:: +*CLISP* + (used for the optional Lisp translation backend) http://clisp.cons.org/_ .. _`low level virtual machine`: http://llvm.cs.uiuc.edu/ - -------------------------------------------------------------------------------- .. _Dot Graphviz: http://www.research.att.com/sw/tools/graphviz/ From hpk at codespeak.net Tue May 17 00:47:09 2005 From: hpk at codespeak.net (hpk at codespeak.net) Date: Tue, 17 May 2005 00:47:09 +0200 (CEST) Subject: [pypy-svn] r12396 - pypy/dist/pypy/documentation Message-ID: <20050516224709.D3E5427B82@code1.codespeak.net> Author: hpk Date: Tue May 17 00:47:09 2005 New Revision: 12396 Modified: pypy/dist/pypy/documentation/getting_started.txt Log: fix typo Modified: pypy/dist/pypy/documentation/getting_started.txt ============================================================================== --- pypy/dist/pypy/documentation/getting_started.txt (original) +++ pypy/dist/pypy/documentation/getting_started.txt Tue May 17 00:47:09 2005 @@ -35,8 +35,8 @@ .. _`90% of CPythons core language regression tests`: http://codespeak.net/~hpk/pypy-testresult/ -Svn-check out & run the latest PyPy as a two-liner (with svn) -------------------------------------------------------------- +Svn-check out & run the latest PyPy as a two-liner +-------------------------------------------------- If you want to play with the ongoing development version of PyPy you can simply do:: From cfbolz at codespeak.net Tue May 17 01:52:26 2005 From: cfbolz at codespeak.net (cfbolz at codespeak.net) Date: Tue, 17 May 2005 01:52:26 +0200 (CEST) Subject: [pypy-svn] r12397 - pypy/dist/pypy/documentation Message-ID: <20050516235226.62BED27B8E@code1.codespeak.net> Author: cfbolz Date: Tue May 17 01:52:26 2005 New Revision: 12397 Modified: pypy/dist/pypy/documentation/getting_started.txt Log: issue37 in-progress Tried to make the detailed version of how to use PyPy independent of the method PyPy was obtained (via svn or a release). Modified: pypy/dist/pypy/documentation/getting_started.txt ============================================================================== --- pypy/dist/pypy/documentation/getting_started.txt (original) +++ pypy/dist/pypy/documentation/getting_started.txt Tue May 17 01:52:26 2005 @@ -33,17 +33,25 @@ really was on compliancy: PyPy passes around `90% of CPythons core language regression tests`_. +You may go to the more `detailed version`_ of this two-liner. + .. _`90% of CPythons core language regression tests`: http://codespeak.net/~hpk/pypy-testresult/ Svn-check out & run the latest PyPy as a two-liner -------------------------------------------------- If you want to play with the ongoing development version -of PyPy you can simply do:: +of PyPy you can check out it out from repository using subversion. To do this +download and install subversion_ if you don't allready have it. Then you can +simply do on the command line (DOS box or terminal):: svn co http://codespeak.net/svn/pypy/dist pypy-dist -and after checkout you can get a PyPy interpreter via:: +This will create a directory named ``pypy-dist``, and will get you the PyPy +source in ``pypy-dist/pypy`` and documentation files in +``pypy-dist/pypy/documentation``. + +After checkout you can get a PyPy interpreter via:: python pypy-dist/pypy/interpreter/py.py @@ -75,32 +83,24 @@ .. _`py.test`: http://codespeak.net/py/current/doc/test.html .. _`detailed version`: -The long'n detailed version (using subversion) +The long'n detailed version of how to use PyPy ============================================== -The following instructions are supposed to work from -a DOS box (Win32) or from a terminal (MacOSX/Linux/Unix). - -1. Download and install subversion_ if you do not already have it. +The following assumes that you have successfully downloaded and exctracted the +PyPy release or have checked out PyPy using svn. It assumes that you are in +the top level directory of the PyPy source tree, e.g. pypy-x.x (if you +got a release) or pypy-dist (if you checked out the most recent version using +subversion). -2. Change to the directory where you wish to install the source tree, - and use subversion to checkout the source:: - - svn co http://codespeak.net/svn/pypy/dist pypy-dist - - This will create a directory named ``pypy-dist``, and will get - you the PyPy source in ``pypy-dist/pypy`` and documentation - files in ``pypy-dist/pypy/documentation``. - -3. To start interpreting Python with PyPy, use Python 2.3 or greater:: +1. To start interpreting Python with PyPy, use Python 2.3 or greater:: - cd pypy-dist/pypy/interpreter + cd pypy/interpreter python py.py After a few seconds, you should be at the PyPy prompt, which is the same as the Python prompt, but with an extra ">". -4. Now you are ready to start running Python code. Some real Python +2. Now you are ready to start running Python code. Some real Python modules will not run yet, and others will run too slowly to be worth waiting for, but a few are fun to run:: @@ -114,9 +114,9 @@ on the current PyPy implementation. -5. To list the PyPy interpreter command line options, type:: +3. To list the PyPy interpreter command line options, type:: - cd pypy-dist/pypy/interpreter + cd pypy/interpreter python py.py --help As an example of using PyPy from the command line, you could type:: @@ -128,17 +128,16 @@ python py.py ../../lib-python/modified-2.3.4/test/pystone.py 10 -6. The PyPy project uses test-driven-development. Right now, there are +3. The PyPy project uses test-driven-development. Right now, there are a couple of different categories of tests which you can run. To run all the unit tests:: - cd pypy-dist/pypy + cd pypy python test_all.py Alternatively, you may run subtests by going to the correct subdirectory and running them individually:: - cd pypy-dist/pypy python test_all.py module/test/test_builtin.py ``test_all.py`` is actually just a synonym for `py.test`_ which is @@ -150,12 +149,12 @@ Finally, there are standard regression tests which you can run like this:: - cd pypy-dist/lib-python-2.3.4/test - python ../../pypy/test_all.py + cd lib-python-2.3.4/test + python ../../pypy/test_all.py -E or if you have `installed py.test`_ then you simply say:: - py.test + py.test -E from the lib-python-2.3.4/test directory. @@ -173,7 +172,7 @@ 3. Type:: - cd pypy-dist/pypy/translator + cd pypy/translator python -i translator.py Test snippets of translatable code are provided in the file @@ -237,31 +236,32 @@ ---------------------------------- PyPy is made from parts that are relatively independent from each other. -You should start looking at the part that attracts you most: +You should start looking at the part that attracts you most (all parts are +relative to the PyPy toplevel directory): -* `pypy-dist/pypy/interpreter`_ contains the basic interpreter: bytecode dispatcher +* `pypy/interpreter`_ contains the basic interpreter: bytecode dispatcher in pyopcode.py_, frame and code objects in eval.py_ and pyframe.py_, function objects and argument passing in function.py_ and argument.py_, the object space interface definition in baseobjspace.py_, modules in module.py_ and lazymodule.py_. Core types supporting the interpreter are defined in typedef.py_. -* `pypy-dist/pypy/objspace/std`_ contains the `Standard object space`_. The main file +* `pypy/objspace/std`_ contains the `Standard object space`_. The main file is objspace.py_. For each type, the files ``xxxtype.py`` and ``xxxobject.py`` contain respectively the definition of the type and its (default) implementation. -* `pypy-dist/pypy/objspace`_ contains a few other object spaces: the thunk_ +* `pypy/objspace`_ contains a few other object spaces: the thunk_ one, the trace_ one, the flow_ one. The latter is a relatively short piece of code that builds the control flow graphs when the interpreter runs in it. -* `pypy-dist/pypy/translator`_ contains the code analysis and generation stuff. +* `pypy/translator`_ contains the code analysis and generation stuff. Start reading from translator.py_, from which it should be easy to follow the pieces of code involved in the various translation phases. -* `pypy-dist/pypy/annotation`_ contains the data model for the type annotation that +* `pypy/annotation`_ contains the data model for the type annotation that can be inferred about a graph. The graph "walker" that uses this is in - `pypy-dist/pypy/translator/annrpython.py`_. + `pypy/translator/annrpython.py`_. To learn more @@ -271,6 +271,7 @@ read around in the documentation_ and the wiki_, and consider subscribing to the `mailing lists`_ (or simply read the archives online) or show up irc.freenode.net:6667, channel #pypy. + The logs of the channel can be found at http://nimrod.terra-link.net/pypy/_. * To help PyPy become Python-the-next-generation, you may write some `unit tests`_ and file some `bug reports`_. @@ -281,8 +282,8 @@ ----------------------------------------------- We use some optional tools for working on pypy. They are not required to run -the basic tests or to get an interactive PyPy prompt but they help to understand -and debug PyPy especially for the ongoing translation work. +the basic tests or to get an interactive PyPy prompt but they help to +understand and debug PyPy especially for the ongoing translation work. Recommended tools +++++++++++++++++ @@ -317,7 +318,7 @@ .. _Dot Graphviz: http://www.research.att.com/sw/tools/graphviz/ .. _Pygame: http://www.pygame.org/ -.. _pypy-dist/pypy/interpreter: http://codespeak.net/svn/pypy/dist/pypy/interpreter/ +.. _pypy/interpreter: http://codespeak.net/svn/pypy/dist/pypy/interpreter/ .. _pyopcode.py: http://codespeak.net/svn/pypy/dist/pypy/interpreter/pyopcode.py .. _eval.py: http://codespeak.net/svn/pypy/dist/pypy/interpreter/eval.py .. _pyframe.py: http://codespeak.net/svn/pypy/dist/pypy/interpreter/pyframe.py @@ -327,17 +328,17 @@ .. _module.py: http://codespeak.net/svn/pypy/dist/pypy/interpreter/module.py .. _lazymodule.py: http://codespeak.net/svn/pypy/dist/pypy/interpreter/lazymodule.py .. _typedef.py: http://codespeak.net/svn/pypy/dist/pypy/interpreter/typedef.py -.. _pypy-dist/pypy/objspace/std: http://codespeak.net/svn/pypy/dist/pypy/objspace/std/ +.. _pypy/objspace/std: http://codespeak.net/svn/pypy/dist/pypy/objspace/std/ .. _Standard object space: http://codespeak.net/pypy/index.cgi?doc/stdobjspace.html .. _objspace.py: http://codespeak.net/svn/pypy/dist/pypy/objspace/std/objspace.py -.. _pypy-dist/pypy/objspace: http://codespeak.net/svn/pypy/dist/pypy/objspace/ +.. _pypy/objspace: http://codespeak.net/svn/pypy/dist/pypy/objspace/ .. _thunk: http://codespeak.net/svn/pypy/dist/pypy/objspace/thunk.py .. _trace: http://codespeak.net/svn/pypy/dist/pypy/objspace/trace.py .. _flow: http://codespeak.net/svn/pypy/dist/pypy/objspace/flow/ -.. _pypy-dist/pypy/translator: http://codespeak.net/svn/pypy/dist/pypy/translator/ +.. _pypy/translator: http://codespeak.net/svn/pypy/dist/pypy/translator/ .. _translator.py: http://codespeak.net/svn/pypy/dist/pypy/translator/translator.py -.. _pypy-dist/pypy/annotation: http://codespeak.net/svn/pypy/dist/pypy/annotation/ -.. _pypy-dist/pypy/translator/annrpython.py: http://codespeak.net/svn/pypy/dist/pypy/translator/annrpython.py +.. _pypy/annotation: http://codespeak.net/svn/pypy/dist/pypy/annotation/ +.. _pypy/translator/annrpython.py: http://codespeak.net/svn/pypy/dist/pypy/translator/annrpython.py .. _mailing lists: http://codespeak.net/pypy/index.cgi?lists .. _documentation: http://codespeak.net/pypy/index.cgi?doc .. _wiki: http://codespeak.net/moin/pypy/moin.cgi/FrontPage?action=show From cfbolz at codespeak.net Tue May 17 01:54:51 2005 From: cfbolz at codespeak.net (cfbolz at codespeak.net) Date: Tue, 17 May 2005 01:54:51 +0200 (CEST) Subject: [pypy-svn] r12398 - pypy/dist/pypy/documentation Message-ID: <20050516235451.BA2A427B8E@code1.codespeak.net> Author: cfbolz Date: Tue May 17 01:54:51 2005 New Revision: 12398 Modified: pypy/dist/pypy/documentation/getting_started.txt Log: There are three types of programmers: those who can count to three and those who can't. Modified: pypy/dist/pypy/documentation/getting_started.txt ============================================================================== --- pypy/dist/pypy/documentation/getting_started.txt (original) +++ pypy/dist/pypy/documentation/getting_started.txt Tue May 17 01:54:51 2005 @@ -128,7 +128,7 @@ python py.py ../../lib-python/modified-2.3.4/test/pystone.py 10 -3. The PyPy project uses test-driven-development. Right now, there are +4. The PyPy project uses test-driven-development. Right now, there are a couple of different categories of tests which you can run. To run all the unit tests:: From cfbolz at codespeak.net Tue May 17 02:15:11 2005 From: cfbolz at codespeak.net (cfbolz at codespeak.net) Date: Tue, 17 May 2005 02:15:11 +0200 (CEST) Subject: [pypy-svn] r12399 - pypy/dist/pypy/documentation Message-ID: <20050517001511.2A6D327B8E@code1.codespeak.net> Author: cfbolz Date: Tue May 17 02:15:10 2005 New Revision: 12399 Added: pypy/dist/pypy/documentation/svn-help.txt Modified: pypy/dist/pypy/documentation/coding-guide.txt pypy/dist/pypy/documentation/getting_started.txt Log: issue37 in-progress moved the section about subversion from getting_started to svn-help. Should this rather be in coding-guide? Modified: pypy/dist/pypy/documentation/coding-guide.txt ============================================================================== --- pypy/dist/pypy/documentation/coding-guide.txt (original) +++ pypy/dist/pypy/documentation/coding-guide.txt Tue May 17 02:15:10 2005 @@ -484,6 +484,10 @@ that the property 'svn:eol-style' is set to native which allows checkin/checkout in native line-ending format. +- To learn more about how to use subversion read `this document`_. + +.. _`this document`: svn-help.html + Using the development bug/feature tracker ========================================= Modified: pypy/dist/pypy/documentation/getting_started.txt ============================================================================== --- pypy/dist/pypy/documentation/getting_started.txt (original) +++ pypy/dist/pypy/documentation/getting_started.txt Tue May 17 02:15:10 2005 @@ -57,7 +57,8 @@ have fun :-) -You may go to the more `detailed version`_ of this two-liner. +If you want to know more about our subversion read this_. You may also want to +go to more `detailed version`_ of this two-liner below. Understanding PyPy's architecture --------------------------------- @@ -348,179 +349,5 @@ -.. _subversion: -.. _`install a subversion client`: -.. _howtosvn: - -subversion -========== - - -The PyPy codebase, documentation and web pages are controlled by subversion. -If you already know how to use it here is the URL you need to interact -with subversion: - -``http://codespeak.net/svn/pypy/dist`` - -If you don't know what to do then Jens-Uwe Mager has prepared some -installation files which should help you to install subversion on -your computer. - -+ Download Unix source tarball or prepackaged versions_ for MacOS, Windows, FreeBSD and Linux - -+ Additional information for Windows users: - - * See Microsoft website_ if you have .DLL issues. - - * Windows Installer file for Tortoise SVN (like Tortoise CVS) GUI_ - (Pick the UNICODE version for Windows 2000 and XP and - see Win_ 2000, NT if you have problems loading it.) - -+ Local copy of MacOS_ X binary tar ball - (This requires at least OS X 10.3) - -+ Debian instructions below... - -btw, HowToInstallServer_ sketches how to install a subversion server on Linux (not as easy as the client install). You don't need to install server side files to get your client going. - -Getting started ------------------ - -If you're just getting started with subversion, here's a simple how-to. -For complete information, you can go read the subversion guide_. - -**Download and install the appropriate installation file of subversion above.** - -For linux: - -download the tarball. unzip and untar it. Then type *./configure*. Then, as root, *make* followed by *make install*. Voil? ... a subversion client. - -For Debian users:: - - $ apt-get install subversion-tools - -People using Debian *stable* first need to add the following line to ``/etc/apt/sources.list`` (thanks backports_!):: - - deb http://fs.cs.fhm.edu/mirror/backports.org/debian stable subversion - -Note that you can always go look at the files online_ with your browser, located at: http://codespeak.net/svn/pypy/dist -But, you'll want to check out your own local copies to work on. - -Check out and Check in ----------------------------- - -There are currently two directories you'll want to check out: /src and /doc -In order to get the sourcecode and docs downloaded onto your drive, open a shell or commandline and type:: - - $ svn co http://codespeak.net/svn/pypy/dist - $ svn co http://codespeak.net/svn/pypy/extradoc - -If you are behind a dump proxy this may or may not work; see below. - -Once you've got the files checked out to your own system, you can use your favorite text editor to change to files. Be sure to read the coding-guide_ and other documentation files before doing a lot of work on the source code. Before doing any work, make sure you're using the most recent update with:: - - $ svn up - -this will update whichever subdirectory you're in (doc or src). - -When you're ready to **check in** a file, - -cd to your local checked out sourcecode directory, and if necessary, copy the file over from wherever you worked on it:: - - $ cp ~/mydir/filename.ext filename.ext - -If you're adding a brand-new file:: - - $ svn add filename.ext - -Then, to **commit** it:: - - $ svn ci -m "your comments about what changes your committing" - $ your password: (this may not be necessary) - -You'll see something like the following:: - - Adding goals/stringcomp.py - Transmitting file data . - Committed revision 578. - -or:: - - Sending coding-guide.txt - Transmitting file data . - Committed revision 631. - -Check online on the check-in archives_ and you'll see your revision. Feel free to add a documentation file on any major changes you've made! - -Some other useful subversion tricks: --------------------------------------- - -**Be sure to remember ``svn`` in the commandline in the following commands.** - -``$ svn mv filename.ext`` - to move or rename a file - -``$ svn rm filename.ext`` - to remove (delete) a file - -``$ svn status`` - will let you know what changes you've made compared to the current repository version - -``$ svn revert filename.ext`` - will fix problems if you deleted or moved a file without telling svn. - -``$ svn cleanup`` - last resort to fix it if you've got a totally messed up local copy. - Use this if you see error messages about ``locked`` files that you can't fix otherwise. - -Circumventing proxies ----------------------------- - -Some proxies don't let extended HTTP commands through. If you have an -error complaining about a bad request, you can ask subversion to use the -alternate port 8080 to connect to codespeak.net by adding the following -lines in a file ``~/.subversion/servers`` (on Unix) or -``%APPDATA%\Subversion\servers`` (on Windows):: - - [groups] - codespeak = codespeak.net - - [codespeak] - http-proxy-host = codespeak.net - http-proxy-port = 8080 - -How to Avoid Line-ending Hell ------------------------------ - -We will assume that whenever you create a .txt or a .py file, you would -like other people to be able to read it with the line endings their -OS prefers, even if that is different from the one your OS likes. This -could occasionally be wrong -- say when you are specifically testing -that code you are writing handles line endings properly -- but this is -what you want by default. Binary files, on the other hand, should be -stored exactly as is. This has to be set on every client. Here is how: - -In your home directory edit .subversion/config and comment in :: - - enable-auto-props = yes - - *.txt = svn:eol-style=native - -and add a line for .py files. - --------------------------------------------------------------------------------- - - -.. _website: http://support.microsoft.com/default.aspx?scid=kb%3Ben-us%3B259403 -.. _GUI: http://tortoisesvn.tigris.org/servlets/ProjectDocumentList?folderID=616 -.. _MacOS: http://codespeak.net/~jum/svn-1.1.3-darwin-ppc.tar.gz -.. _versions: http://subversion.tigris.org/project_packages.html -.. _Win: http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=4B6140F9-2D36-4977-8FA1-6F8A0F5DCA8F - -.. _guide: http://svnbook.red-bean.com/book.html#svn-ch-1 -.. _archives: http://codespeak.net/pipermail/pypy-svn/ -.. _online: http://codespeak.net/svn/pypy/dist/ -.. _coding-guide: coding-guide.html -.. _HowToInstallServer: http://codespeak.net/moin/pypy/moin.cgi/HowToInstallServer -.. _backports: http://www.backports.org - +.. _subversion: svn-help.html +.. _this: svn-help.html Added: pypy/dist/pypy/documentation/svn-help.txt ============================================================================== --- (empty file) +++ pypy/dist/pypy/documentation/svn-help.txt Tue May 17 02:15:10 2005 @@ -0,0 +1,168 @@ + +subversion +========== + + +The PyPy codebase, documentation and web pages are controlled by subversion. +If you already know how to use it here is the URL you need to interact +with subversion: + +``http://codespeak.net/svn/pypy/dist`` + +If you don't know what to do then Jens-Uwe Mager has prepared some +installation files which should help you to install subversion on +your computer. + ++ Download Unix source tarball or prepackaged versions_ for MacOS, Windows, FreeBSD and Linux + ++ Additional information for Windows users: + + * See Microsoft website_ if you have .DLL issues. + + * Windows Installer file for Tortoise SVN (like Tortoise CVS) GUI_ + (Pick the UNICODE version for Windows 2000 and XP and + see Win_ 2000, NT if you have problems loading it.) + ++ Local copy of MacOS_ X binary tar ball + (This requires at least OS X 10.3) + ++ Debian instructions below... + +btw, HowToInstallServer_ sketches how to install a subversion server on Linux (not as easy as the client install). You don't need to install server side files to get your client going. + +Getting started +----------------- + +If you're just getting started with subversion, here's a simple how-to. +For complete information, you can go read the subversion guide_. + +**Download and install the appropriate installation file of subversion above.** + +For linux: + +download the tarball. unzip and untar it. Then type *./configure*. Then, as root, *make* followed by *make install*. Voil? ... a subversion client. + +For Debian users:: + + $ apt-get install subversion-tools + +People using Debian *stable* first need to add the following line to ``/etc/apt/sources.list`` (thanks backports_!):: + + deb http://fs.cs.fhm.edu/mirror/backports.org/debian stable subversion + +Note that you can always go look at the files online_ with your browser, located at: http://codespeak.net/svn/pypy/dist +But, you'll want to check out your own local copies to work on. + +Check out and Check in +---------------------------- + +There are currently two directories you'll want to check out: /src and /doc +In order to get the sourcecode and docs downloaded onto your drive, open a shell or commandline and type:: + + $ svn co http://codespeak.net/svn/pypy/dist + $ svn co http://codespeak.net/svn/pypy/extradoc + +If you are behind a dump proxy this may or may not work; see below. + +Once you've got the files checked out to your own system, you can use your favorite text editor to change to files. Be sure to read the coding-guide_ and other documentation files before doing a lot of work on the source code. Before doing any work, make sure you're using the most recent update with:: + + $ svn up + +this will update whichever subdirectory you're in (doc or src). + +When you're ready to **check in** a file, + +cd to your local checked out sourcecode directory, and if necessary, copy the file over from wherever you worked on it:: + + $ cp ~/mydir/filename.ext filename.ext + +If you're adding a brand-new file:: + + $ svn add filename.ext + +Then, to **commit** it:: + + $ svn ci -m "your comments about what changes your committing" + $ your password: (this may not be necessary) + +You'll see something like the following:: + + Adding goals/stringcomp.py + Transmitting file data . + Committed revision 578. + +or:: + + Sending coding-guide.txt + Transmitting file data . + Committed revision 631. + +Check online on the check-in archives_ and you'll see your revision. Feel free to add a documentation file on any major changes you've made! + +Some other useful subversion tricks: +-------------------------------------- + +**Be sure to remember ``svn`` in the commandline in the following commands.** + +``$ svn mv filename.ext`` + to move or rename a file + +``$ svn rm filename.ext`` + to remove (delete) a file + +``$ svn status`` + will let you know what changes you've made compared to the current repository version + +``$ svn revert filename.ext`` + will fix problems if you deleted or moved a file without telling svn. + +``$ svn cleanup`` + last resort to fix it if you've got a totally messed up local copy. + Use this if you see error messages about ``locked`` files that you can't fix otherwise. + +Circumventing proxies +---------------------------- + +Some proxies don't let extended HTTP commands through. If you have an +error complaining about a bad request, you can ask subversion to use the +alternate port 8080 to connect to codespeak.net by adding the following +lines in a file ``~/.subversion/servers`` (on Unix) or +``%APPDATA%\Subversion\servers`` (on Windows):: + + [groups] + codespeak = codespeak.net + + [codespeak] + http-proxy-host = codespeak.net + http-proxy-port = 8080 + +How to Avoid Line-ending Hell +----------------------------- + +We will assume that whenever you create a .txt or a .py file, you would +like other people to be able to read it with the line endings their +OS prefers, even if that is different from the one your OS likes. This +could occasionally be wrong -- say when you are specifically testing +that code you are writing handles line endings properly -- but this is +what you want by default. Binary files, on the other hand, should be +stored exactly as is. This has to be set on every client. Here is how: + +In your home directory edit .subversion/config and comment in :: + + enable-auto-props = yes + + *.txt = svn:eol-style=native + +and add a line for .py files. + +-------------------------------------------------------------------------------- +.. _website: http://support.microsoft.com/default.aspx?scid=kb%3Ben-us%3B259403 +.. _GUI: http://tortoisesvn.tigris.org/servlets/ProjectDocumentList?folderID=616 +.. _MacOS: http://codespeak.net/~jum/svn-1.1.3-darwin-ppc.tar.gz +.. _versions: http://subversion.tigris.org/project_packages.html +.. _Win: http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=4B6140F9-2D36-4977-8FA1-6F8A0F5DCA8F +.. _HowToInstallServer: http://codespeak.net/moin/pypy/moin.cgi/HowToInstallServer +.. _guide: http://svnbook.red-bean.com/book.html#svn-ch-1 +.. _backports: http://www.backports.org +.. _online: http://codespeak.net/svn/pypy/dist/ +.. _coding-guide: coding-guide.html From tismer at codespeak.net Tue May 17 04:54:15 2005 From: tismer at codespeak.net (tismer at codespeak.net) Date: Tue, 17 May 2005 04:54:15 +0200 (CEST) Subject: [pypy-svn] r12400 - in pypy/dist/pypy: annotation objspace/flow Message-ID: <20050517025415.AD47A27BB2@code1.codespeak.net> Author: tismer Date: Tue May 17 04:54:15 2005 New Revision: 12400 Modified: pypy/dist/pypy/annotation/builtin.py pypy/dist/pypy/objspace/flow/specialcase.py Log: solved the windows compatibility issue (puuh). The import of sys is now deferred to runtime. The trick is to capture the import and special-case import of sys. Instead of an import the Constant(sys) is used and pushed through function unspecialize(). unspecialize() turns sys into a SomeObject variable. Modified: pypy/dist/pypy/annotation/builtin.py ============================================================================== --- pypy/dist/pypy/annotation/builtin.py (original) +++ pypy/dist/pypy/annotation/builtin.py Tue May 17 04:54:15 2005 @@ -195,6 +195,10 @@ def time_func(): return SomeFloat() +def write_func(*args): + return SomeBool() + # XXX I would like to use SomeNone here. How? + # collect all functions import __builtin__ BUILTIN_ANALYZERS = {} @@ -232,6 +236,8 @@ BUILTIN_ANALYZERS[time.time] = time_func BUILTIN_ANALYZERS[time.clock] = time_func +# sys.stdout +BUILTIN_ANALYZERS[sys.stdout.write] = write_func # annotation of low-level types from pypy.annotation.model import SomePtr Modified: pypy/dist/pypy/objspace/flow/specialcase.py ============================================================================== --- pypy/dist/pypy/objspace/flow/specialcase.py (original) +++ pypy/dist/pypy/objspace/flow/specialcase.py Tue May 17 04:54:15 2005 @@ -1,18 +1,35 @@ -import types, operator +import types, operator, sys from pypy.interpreter import pyframe, baseobjspace from pypy.interpreter.error import OperationError from pypy.objspace.flow.objspace import UnwrapException from pypy.objspace.flow.model import Constant from pypy.objspace.flow.operation import OperationName, Arity +def unspecialize(obj): + # turn a constant into SomeObject + # XXX this may become harder when the annotator gets smarter + # maybe we need to add a special function like ovfcheck. + if id(0) != id(None): + return obj def sc_import(space, fn, args): w_name, w_glob, w_loc, w_frm = args.fixedunpack(4) - return space.wrap(__import__(space.unwrap(w_name), + name = space.unwrap(w_name) + if name == 'sys': + return space.do_operation('simple_call', Constant(unspecialize), + Constant(sys)) + return space.wrap(__import__(name, space.unwrap(w_glob), space.unwrap(w_loc), space.unwrap(w_frm))) +def sc_write(space, fn, args): + args_w, kwds_w = args.unpack() + assert kwds_w == {}, "should not call %r with keyword arguments" % (fn,) + # make sure that we write to the basic sys.__stdout__ + syswrite = sys.__stdout__.write + return space.do_operation('simple_call', Constant(syswrite), *args_w) + def sc_operator(space, fn, args): args_w, kwds_w = args.unpack() assert kwds_w == {}, "should not call %r with keyword arguments" % (fn,) @@ -42,6 +59,9 @@ # space.specialcases[fn] = sc_normalize_exception if space.do_imports_immediately: space.specialcases[__import__] = sc_import + # support sys.stdout + space.specialcases[sys.stdout.write] = sc_write + space.specialcases[sys.__stdout__.write] = sc_write # turn calls to built-in functions to the corresponding operation, # if possible for fn in OperationName: From tismer at codespeak.net Tue May 17 05:12:47 2005 From: tismer at codespeak.net (tismer at codespeak.net) Date: Tue, 17 May 2005 05:12:47 +0200 (CEST) Subject: [pypy-svn] r12401 - pypy/dist/pypy/objspace/flow Message-ID: <20050517031247.EA92A27BC2@code1.codespeak.net> Author: tismer Date: Tue May 17 05:12:47 2005 New Revision: 12401 Modified: pypy/dist/pypy/objspace/flow/specialcase.py Log: ignore the arguments to __import__; instead, we just check the result. If it is sys, do the special thing. Modified: pypy/dist/pypy/objspace/flow/specialcase.py ============================================================================== --- pypy/dist/pypy/objspace/flow/specialcase.py (original) +++ pypy/dist/pypy/objspace/flow/specialcase.py Tue May 17 05:12:47 2005 @@ -14,14 +14,13 @@ def sc_import(space, fn, args): w_name, w_glob, w_loc, w_frm = args.fixedunpack(4) - name = space.unwrap(w_name) - if name == 'sys': + mod = __import__(space.unwrap(w_name), space.unwrap(w_glob), + space.unwrap(w_loc), space.unwrap(w_frm)) + if mod is sys: return space.do_operation('simple_call', Constant(unspecialize), Constant(sys)) - return space.wrap(__import__(name, - space.unwrap(w_glob), - space.unwrap(w_loc), - space.unwrap(w_frm))) + else: + return space.wrap(mod) def sc_write(space, fn, args): args_w, kwds_w = args.unpack() From hpk at codespeak.net Tue May 17 08:55:15 2005 From: hpk at codespeak.net (hpk at codespeak.net) Date: Tue, 17 May 2005 08:55:15 +0200 (CEST) Subject: [pypy-svn] r12402 - pypy/dist/pypy/documentation Message-ID: <20050517065515.A1F5E27BC2@code1.codespeak.net> Author: hpk Date: Tue May 17 08:55:15 2005 New Revision: 12402 Modified: pypy/dist/pypy/documentation/svn-help.txt Log: fixed ReST formatting and linking please try to run tests in the documentation directory before checking in, possibly even 'py.test -Rv' for including checks of remote links. It's really useful especially when moving things around. Modified: pypy/dist/pypy/documentation/svn-help.txt ============================================================================== --- pypy/dist/pypy/documentation/svn-help.txt (original) +++ pypy/dist/pypy/documentation/svn-help.txt Tue May 17 08:55:15 2005 @@ -97,7 +97,9 @@ Transmitting file data . Committed revision 631. -Check online on the check-in archives_ and you'll see your revision. Feel free to add a documentation file on any major changes you've made! +Check online on the `svn-commit archives`_ and you'll see your revision. Feel free to add a documentation file on any major changes you've made! + +.. _`svn-commit archives`: http://codespeak.net/pipermail/pypy-svn/ Some other useful subversion tricks: -------------------------------------- @@ -155,7 +157,8 @@ and add a line for .py files. --------------------------------------------------------------------------------- + + .. _website: http://support.microsoft.com/default.aspx?scid=kb%3Ben-us%3B259403 .. _GUI: http://tortoisesvn.tigris.org/servlets/ProjectDocumentList?folderID=616 .. _MacOS: http://codespeak.net/~jum/svn-1.1.3-darwin-ppc.tar.gz From hpk at codespeak.net Tue May 17 08:57:19 2005 From: hpk at codespeak.net (hpk at codespeak.net) Date: Tue, 17 May 2005 08:57:19 +0200 (CEST) Subject: [pypy-svn] r12403 - pypy/dist/pypy/documentation Message-ID: <20050517065719.6568C27BC2@code1.codespeak.net> Author: hpk Date: Tue May 17 08:57:18 2005 New Revision: 12403 Modified: pypy/dist/pypy/documentation/getting_started.txt Log: fixed/streamlined the grammar a bit Modified: pypy/dist/pypy/documentation/getting_started.txt ============================================================================== --- pypy/dist/pypy/documentation/getting_started.txt (original) +++ pypy/dist/pypy/documentation/getting_started.txt Tue May 17 08:57:18 2005 @@ -40,10 +40,10 @@ Svn-check out & run the latest PyPy as a two-liner -------------------------------------------------- -If you want to play with the ongoing development version -of PyPy you can check out it out from repository using subversion. To do this -download and install subversion_ if you don't allready have it. Then you can -simply do on the command line (DOS box or terminal):: +If you want to play with the ongoing development PyPy version +you can check it out from the repository using subversion. Download +and install subversion_ if you don't allready have it. Then you can +issue on the command line (DOS box or terminal):: svn co http://codespeak.net/svn/pypy/dist pypy-dist @@ -57,8 +57,9 @@ have fun :-) -If you want to know more about our subversion read this_. You may also want to -go to more `detailed version`_ of this two-liner below. +If you want to know more how to get started with subversion read this_. +You may also want to go to more `detailed version`_ of this +two-liner below. Understanding PyPy's architecture --------------------------------- From cfbolz at codespeak.net Tue May 17 11:30:40 2005 From: cfbolz at codespeak.net (cfbolz at codespeak.net) Date: Tue, 17 May 2005 11:30:40 +0200 (CEST) Subject: [pypy-svn] r12404 - pypy/dist/pypy/documentation Message-ID: <20050517093040.8ABA227BCF@code1.codespeak.net> Author: cfbolz Date: Tue May 17 11:30:40 2005 New Revision: 12404 Modified: pypy/dist/pypy/documentation/getting_started.txt Log: fix typo Modified: pypy/dist/pypy/documentation/getting_started.txt ============================================================================== --- pypy/dist/pypy/documentation/getting_started.txt (original) +++ pypy/dist/pypy/documentation/getting_started.txt Tue May 17 11:30:40 2005 @@ -58,7 +58,7 @@ have fun :-) If you want to know more how to get started with subversion read this_. -You may also want to go to more `detailed version`_ of this +You may also want to go to the more `detailed version`_ of this two-liner below. Understanding PyPy's architecture From cfbolz at codespeak.net Tue May 17 12:32:59 2005 From: cfbolz at codespeak.net (cfbolz at codespeak.net) Date: Tue, 17 May 2005 12:32:59 +0200 (CEST) Subject: [pypy-svn] r12406 - pypy/dist/pypy/documentation/website Message-ID: <20050517103259.026E527BCF@code1.codespeak.net> Author: cfbolz Date: Tue May 17 12:32:59 2005 New Revision: 12406 Modified: pypy/dist/pypy/documentation/website/contact.txt Log: issue45 in-progress added a link to all the IRC logs to the contact page. Modified: pypy/dist/pypy/documentation/website/contact.txt ============================================================================== --- pypy/dist/pypy/documentation/website/contact.txt (original) +++ pypy/dist/pypy/documentation/website/contact.txt Tue May 17 12:32:59 2005 @@ -31,4 +31,7 @@ Many of the core developers are hanging out at #pypy on irc.freenode.net. You are welcome to join and ask questions even more so if you are interested -in participating in some parts of the PyPy project. +in participating in some parts of the PyPy project. You can find the logs of +the channel here_. + +.. _here: http://nimrod.terra-link.net/pypy \ No newline at end of file From cfbolz at codespeak.net Tue May 17 13:30:36 2005 From: cfbolz at codespeak.net (cfbolz at codespeak.net) Date: Tue, 17 May 2005 13:30:36 +0200 (CEST) Subject: [pypy-svn] r12408 - pypy/dist/lib-python/modified-2.3.4 Message-ID: <20050517113036.A42BB27BDA@code1.codespeak.net> Author: cfbolz Date: Tue May 17 13:30:36 2005 New Revision: 12408 Added: pypy/dist/lib-python/modified-2.3.4/sre_compile.py - copied, changed from r12405, pypy/dist/lib-python/2.3.4/sre_compile.py Log: issue42 testing I changed the assert statement to make it compatible with CPython 2.4. Copied: pypy/dist/lib-python/modified-2.3.4/sre_compile.py (from r12405, pypy/dist/lib-python/2.3.4/sre_compile.py) ============================================================================== --- pypy/dist/lib-python/2.3.4/sre_compile.py (original) +++ pypy/dist/lib-python/modified-2.3.4/sre_compile.py Tue May 17 13:30:36 2005 @@ -14,7 +14,7 @@ from sre_constants import * -assert _sre.MAGIC == MAGIC, "SRE module mismatch" +assert _sre.MAGIC >= MAGIC, "SRE module mismatch" if _sre.CODESIZE == 2: MAXCODE = 65535 From hpk at codespeak.net Tue May 17 15:43:08 2005 From: hpk at codespeak.net (hpk at codespeak.net) Date: Tue, 17 May 2005 15:43:08 +0200 (CEST) Subject: [pypy-svn] r12413 - pypy/dist/pypy/documentation Message-ID: <20050517134308.5DA5A27BF7@code1.codespeak.net> Author: hpk Date: Tue May 17 15:43:08 2005 New Revision: 12413 Modified: pypy/dist/pypy/documentation/coding-guide.txt pypy/dist/pypy/documentation/getting_started.txt pypy/dist/pypy/documentation/svn-help.txt Log: issue37 in-progress issue15 in-progress (probably the world will implode trying to use two issue references but i had to try it :-) M documentation/getting_started.txt - refactor and streamlining - detailed version -> interesting starting points - reference svn-help M documentation/svn-help.txt - cut it a bit by not repeating endlessly where to find PyPy sources M documentation/coding-guide.txt - scrap out ReST help and simply reference the ReST quickstart (it's better and you can start by looking at existing documentation anyway) Modified: pypy/dist/pypy/documentation/coding-guide.txt ============================================================================== --- pypy/dist/pypy/documentation/coding-guide.txt (original) +++ pypy/dist/pypy/documentation/coding-guide.txt Tue May 17 15:43:08 2005 @@ -489,6 +489,8 @@ .. _`this document`: svn-help.html +.. _`using development tracker`: + Using the development bug/feature tracker ========================================= @@ -536,8 +538,10 @@ .. _`roundup`: http://roundup.sf.net -Test Design -============= +.. _`testing in PyPy`: + +Testing in PyPy +=============== Our tests are based on the new `py.test`_ tool which lets you write unittests without boilerplate. All tests of modules @@ -625,57 +629,24 @@ upon import will make sure that sys.path contains the directory where 'pypy' is in. -PyPy Documentation -================== - -Adding documentation --------------------- - -Please add new or updated documentation by checking it in to the appropriate -directory in subversion, usually under -http://codespeak.net/svn/pypy/dist/pypy/documentation - -+ Remember to run ``svn up`` **before** doing any commit. -+ All filenames should be lowercase, and documentation should be .txt files. -+ Mark-up the documentation with reST so it can generate a pretty html version. -+ On the server side a commit on the doc-subtree will immediately update the webpage. - -*Note* If you don't markup the textfile, it'll still be checked in, but when docutils -runs the parser, it'll look ugly on the website. So run docutils yourself before you commit it. - -Some reST basics: ------------------ +.. _`change documentation and website`: -There should be a title on your page. Do it like this:: +Changing documentation and website +================================== - Here is my Title - ================== +documentation/website files in your local checkout +--------------------------------------------------- - Here is a section title - ------------------------- +Most of the PyPy's documentation and website is kept in +`pypy/documentation` and `pypy/documentation/website` respectively. +You can simply edit or add '.txt' files which contain ReST-markuped +files. Here is a `ReST quickstart`_ but you can also just look +at the existing documentation and see how things work. -Make sure you have a blank line after your = or - lines or it will give you an error. -For marking a block of code so it'll look right, you can:: +.. _`ReST quickstart`: http://docutils.sourceforge.net/docs/rst/quickref.html - Put a line of text ending with :: - indent your code at least one space - my code - more code - even more code - still more code - -End of the "block" occurs whenever you unindent back to the same level as the -text with the ``::`` at the end. - -Using an underscore after a word like ``this_`` will make reST think you want a hyperlink. -To avoid that (especially with things like ``wrap_``), you can use the `` back quote `` -to mark it as plain text. - -You can get more info on reST markup at http://docutils.sourceforge.net/docs/rst/quickref.html - - -Automatically testing documentation changes -------------------------------------------- +Automatically test documentation/website changes +------------------------------------------------ .. _`docutils home page`: .. _`docutils`: http://docutils.sourceforge.net/ @@ -688,7 +659,7 @@ python ../test_all.py If you see no failures chances are high that your modifications at least -don't produce ReST-errors or wron local references. A side effect of running +don't produce ReST-errors or wrong local references. A side effect of running the tests is that you have `.html` files in the documentation directory which you can point your browser to! @@ -699,3 +670,4 @@ which will check that remote URLs are reachable. + Modified: pypy/dist/pypy/documentation/getting_started.txt ============================================================================== --- pypy/dist/pypy/documentation/getting_started.txt (original) +++ pypy/dist/pypy/documentation/getting_started.txt Tue May 17 15:43:08 2005 @@ -33,7 +33,8 @@ really was on compliancy: PyPy passes around `90% of CPythons core language regression tests`_. -You may go to the more `detailed version`_ of this two-liner. +Have a look at `interesting starting points`_ +for guidance on how to continue. .. _`90% of CPythons core language regression tests`: http://codespeak.net/~hpk/pypy-testresult/ @@ -57,17 +58,19 @@ have fun :-) -If you want to know more how to get started with subversion read this_. -You may also want to go to the more `detailed version`_ of this -two-liner below. +We have some `help on installing subversion`_ for PyPy. +Have a look at `interesting starting points`_ +for some guidance on how to continue. + +.. _`help on installing subversion`: svn-help.html Understanding PyPy's architecture --------------------------------- -For in-depth information about architecture and coding style head over -to the `documentation section`_ where you'll find lots of interesting -information. Additionally, in true hacker spirit, you may just -`start reading sources`_ . +For in-depth information about architecture and coding documentation +head over to the `documentation section`_ where you'll find lots of +interesting information. Additionally, in true hacker spirit, you +may just `start reading sources`_ . .. _`documentation section`: index.html @@ -83,10 +86,20 @@ testing tool that we are using and enhancing for PyPy. .. _`py.test`: http://codespeak.net/py/current/doc/test.html -.. _`detailed version`: +.. _`interesting starting points`: + +Filing bugs or feature requests +------------------------------- + +You may file `bug reports`_ on our issue tracker which is +also accessible through the 'issues' top menu of +the PyPy website. `using the development tracker`_ has +more detailed information on specific features of the tracker. + +.. _`using the development tracker`: coding-guide.html#using-development-tracker -The long'n detailed version of how to use PyPy -============================================== +Interesting Starting Points in PyPy +=================================== The following assumes that you have successfully downloaded and exctracted the PyPy release or have checked out PyPy using svn. It assumes that you are in @@ -162,6 +175,7 @@ .. _`installed py.test`: http://codespeak.net/py/current/doc/getting_started.html + Trying out the translator ------------------------- @@ -269,15 +283,18 @@ To learn more ------------- -* To learn more about PyPy and its development process, head - read around in the documentation_ and the wiki_, and consider - subscribing to the `mailing lists`_ (or simply - read the archives online) or show up irc.freenode.net:6667, channel #pypy. - The logs of the channel can be found at http://nimrod.terra-link.net/pypy/_. - -* To help PyPy become Python-the-next-generation, you may write some - `unit tests`_ and file some `bug reports`_. +* To learn more about PyPy and its development process, + read around in the documentation_ and consider + subscribing to the `mailing lists`_ (or simply + read the archives online) + +* show up on irc.freenode.net:6667, channel #pypy and ask + questions. The logs of the channel can be found at + http://nimrod.terra-link.net/pypy/_. +* To help PyPy become Python-the-next-generation, you + are invited to participate in its development. + .. _optionaltool: Additional Tools for running (and hacking) PyPy @@ -351,4 +368,3 @@ .. _subversion: svn-help.html -.. _this: svn-help.html Modified: pypy/dist/pypy/documentation/svn-help.txt ============================================================================== --- pypy/dist/pypy/documentation/svn-help.txt (original) +++ pypy/dist/pypy/documentation/svn-help.txt Tue May 17 15:43:08 2005 @@ -1,17 +1,9 @@ -subversion -========== +Installing subversion for PyPy +============================== - -The PyPy codebase, documentation and web pages are controlled by subversion. -If you already know how to use it here is the URL you need to interact -with subversion: - -``http://codespeak.net/svn/pypy/dist`` - -If you don't know what to do then Jens-Uwe Mager has prepared some -installation files which should help you to install subversion on -your computer. +Jens-Uwe Mager has prepared some installation files which should +help you to install subversion on your computer. + Download Unix source tarball or prepackaged versions_ for MacOS, Windows, FreeBSD and Linux @@ -28,8 +20,6 @@ + Debian instructions below... -btw, HowToInstallServer_ sketches how to install a subversion server on Linux (not as easy as the client install). You don't need to install server side files to get your client going. - Getting started ----------------- From hpk at codespeak.net Tue May 17 16:26:36 2005 From: hpk at codespeak.net (hpk at codespeak.net) Date: Tue, 17 May 2005 16:26:36 +0200 (CEST) Subject: [pypy-svn] r12414 - pypy/dist/pypy/documentation Message-ID: <20050517142636.C89BC27BF7@code1.codespeak.net> Author: hpk Date: Tue May 17 16:26:36 2005 New Revision: 12414 Modified: pypy/dist/pypy/documentation/index.txt Log: added a link to the testreports. Modified: pypy/dist/pypy/documentation/index.txt ============================================================================== --- pypy/dist/pypy/documentation/index.txt (original) +++ pypy/dist/pypy/documentation/index.txt Tue May 17 16:26:36 2005 @@ -19,9 +19,11 @@ about our low level code generator backends. * recently-modified_ shows a list of recently modified - documentation while `revision report`_ shows status - information about ongoing pypy development + documentation while `revision report`_ and the automated + `compliance test report`_ shows status + information about ongoing pypy development. +.. _`compliance test report`: http://codespeak.net/~hpk/pypy-testresult/ .. _`objspace`: objspace.html .. _`translation`: translation.html .. _`coding-guide`: coding-guide.html From arigo at codespeak.net Tue May 17 16:27:36 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Tue, 17 May 2005 16:27:36 +0200 (CEST) Subject: [pypy-svn] r12415 - in pypy/dist/pypy/lib: . test2 Message-ID: <20050517142736.CF97027BD1@code1.codespeak.net> Author: arigo Date: Tue May 17 16:27:36 2005 New Revision: 12415 Modified: pypy/dist/pypy/lib/_sio.py pypy/dist/pypy/lib/test2/test_file_extra.py Log: Fixed a bug in _sio found by tests. Added stress-tests for plain binary files. Modified: pypy/dist/pypy/lib/_sio.py ============================================================================== --- pypy/dist/pypy/lib/_sio.py (original) +++ pypy/dist/pypy/lib/_sio.py Tue May 17 16:27:36 2005 @@ -679,6 +679,8 @@ of a tell() that moves beyond a newline character may in the same way give the wrong result. """ + if whence == 1: + offset -= len(self.buf) # correct for already-read-ahead character self.base.seek(offset, whence) self.atcr = False self.buf = "" @@ -705,7 +707,7 @@ self.buf = "" if self.buf: try: - self.do_seek(-len(self.buf), 1) + self.base.seek(-len(self.buf), 1) except NotImplementedError: pass else: Modified: pypy/dist/pypy/lib/test2/test_file_extra.py ============================================================================== --- pypy/dist/pypy/lib/test2/test_file_extra.py (original) +++ pypy/dist/pypy/lib/test2/test_file_extra.py Tue May 17 16:27:36 2005 @@ -1,4 +1,4 @@ -import os +import os, random from pypy.lib import _file from pypy.tool.udir import udir import py @@ -35,12 +35,78 @@ def test_readlines(self): fn = str(udir.join('temptestfile')) - lines = ['line%d\n' % i for i in range(10000)] + lines = ['line%d\n' % i for i in range(1000)] f=_file.file(fn, 'w') f.writelines(lines) f.close() assert open(fn, 'r').readlines() == lines assert _file.file(fn, 'r').readlines() == lines - somelines = _file.file(fn, 'r').readlines(20000) - assert len(somelines) > 2000 + somelines = _file.file(fn, 'r').readlines(2000) + assert len(somelines) > 200 assert somelines == lines[:len(somelines)] + + def stresstest(self, flags, checkflags, eolstyles): + fn = str(udir.join('temptestfile')) + f = _file.file(fn, flags) + expected = '' + pos = 0 + for i in range(5000): + x = random.random() + if x < 0.4: + l = int(x*100) + buf = f.read(l) + assert buf == expected[pos:pos+l] + pos += len(buf) + elif x < 0.75: + writeeol, expecteol = random.choice(eolstyles) + x = str(x) + buf1 = x+writeeol + buf2 = x+expecteol + f.write(buf1) + expected = expected[:pos] + buf2 + expected[pos+len(buf2):] + pos += len(buf2) + elif x < 0.80: + pos = random.randint(0, len(expected)) + f.seek(pos) + elif x < 0.85: + pos = random.randint(0, len(expected)) + f.seek(pos - len(expected), 2) + elif x < 0.90: + currentpos = pos + pos = random.randint(0, len(expected)) + f.seek(pos - currentpos, 1) + elif x < 0.95: + assert f.tell() == pos + else: + f.flush() + g = open(fn, checkflags) + buf = g.read() + g.close() + assert buf == expected + f.close() + g = open(fn, checkflags) + buf = g.read() + g.close() + assert buf == expected + + def test_rw_bin(self): + self.stresstest('w+b', 'rb', [('', ''), ('\n', '\n'), + ('\r', '\r'), ('\r\n', '\r\n')]) + + def test_rw(self): + # XXX tests in progress + fn = str(udir.join('temptestfile')) + f = _file.file(fn, 'w+') + f.write('hello\nworld\n') + f.seek(0) + assert f.read() == 'hello\nworld\n' + f.close() + + def test_rw_universal(self): + # XXX tests in progress + fn = str(udir.join('temptestfile')) + f = _file.file(fn, 'w+U') + f.write('hello\r\nworld\r\n') + f.seek(0) + assert f.read() == 'hello\nworld\n' + f.close() From ac at codespeak.net Tue May 17 17:13:57 2005 From: ac at codespeak.net (ac at codespeak.net) Date: Tue, 17 May 2005 17:13:57 +0200 (CEST) Subject: [pypy-svn] r12416 - pypy/branch/non-fake-unicode/pypy/module/unicodedata Message-ID: <20050517151357.21D2427C0E@code1.codespeak.net> Author: ac Date: Tue May 17 17:13:56 2005 New Revision: 12416 Added: pypy/branch/non-fake-unicode/pypy/module/unicodedata/CompositionExclusions-3.2.0.txt pypy/branch/non-fake-unicode/pypy/module/unicodedata/CompositionExclusions-4.1.0.txt pypy/branch/non-fake-unicode/pypy/module/unicodedata/unicodedb.py (contents, props changed) Modified: pypy/branch/non-fake-unicode/pypy/module/unicodedata/generate_unicodedb.py Log: A working unicodedata with only decomposition() and normalize() missing. Added: pypy/branch/non-fake-unicode/pypy/module/unicodedata/CompositionExclusions-3.2.0.txt ============================================================================== --- (empty file) +++ pypy/branch/non-fake-unicode/pypy/module/unicodedata/CompositionExclusions-3.2.0.txt Tue May 17 17:13:56 2005 @@ -0,0 +1,176 @@ +# CompositionExclusions-3.2.0.txt +# Date: 2002-03-19,23:30:28 GMT [MD] +# +# This file lists the characters from the UAX #15 Composition Exclusion Table. +# +# The format of the comments in this file has been updated since the last version, +# CompositionExclusions-3.txt. The only substantive change to this file between that +# version and this one is the addition of U+2ADC FORKING. +# +# For more information, see +# http://www.unicode.org/unicode/reports/tr15/#Primary Exclusion List Table +# ================================================ + +# (1) Script Specifics +# This list of characters cannot be derived from the UnicodeData file. +# ================================================ + +0958 # DEVANAGARI LETTER QA +0959 # DEVANAGARI LETTER KHHA +095A # DEVANAGARI LETTER GHHA +095B # DEVANAGARI LETTER ZA +095C # DEVANAGARI LETTER DDDHA +095D # DEVANAGARI LETTER RHA +095E # DEVANAGARI LETTER FA +095F # DEVANAGARI LETTER YYA +09DC # BENGALI LETTER RRA +09DD # BENGALI LETTER RHA +09DF # BENGALI LETTER YYA +0A33 # GURMUKHI LETTER LLA +0A36 # GURMUKHI LETTER SHA +0A59 # GURMUKHI LETTER KHHA +0A5A # GURMUKHI LETTER GHHA +0A5B # GURMUKHI LETTER ZA +0A5E # GURMUKHI LETTER FA +0B5C # ORIYA LETTER RRA +0B5D # ORIYA LETTER RHA +0F43 # TIBETAN LETTER GHA +0F4D # TIBETAN LETTER DDHA +0F52 # TIBETAN LETTER DHA +0F57 # TIBETAN LETTER BHA +0F5C # TIBETAN LETTER DZHA +0F69 # TIBETAN LETTER KSSA +0F76 # TIBETAN VOWEL SIGN VOCALIC R +0F78 # TIBETAN VOWEL SIGN VOCALIC L +0F93 # TIBETAN SUBJOINED LETTER GHA +0F9D # TIBETAN SUBJOINED LETTER DDHA +0FA2 # TIBETAN SUBJOINED LETTER DHA +0FA7 # TIBETAN SUBJOINED LETTER BHA +0FAC # TIBETAN SUBJOINED LETTER DZHA +0FB9 # TIBETAN SUBJOINED LETTER KSSA +FB1D # HEBREW LETTER YOD WITH HIRIQ +FB1F # HEBREW LIGATURE YIDDISH YOD YOD PATAH +FB2A # HEBREW LETTER SHIN WITH SHIN DOT +FB2B # HEBREW LETTER SHIN WITH SIN DOT +FB2C # HEBREW LETTER SHIN WITH DAGESH AND SHIN DOT +FB2D # HEBREW LETTER SHIN WITH DAGESH AND SIN DOT +FB2E # HEBREW LETTER ALEF WITH PATAH +FB2F # HEBREW LETTER ALEF WITH QAMATS +FB30 # HEBREW LETTER ALEF WITH MAPIQ +FB31 # HEBREW LETTER BET WITH DAGESH +FB32 # HEBREW LETTER GIMEL WITH DAGESH +FB33 # HEBREW LETTER DALET WITH DAGESH +FB34 # HEBREW LETTER HE WITH MAPIQ +FB35 # HEBREW LETTER VAV WITH DAGESH +FB36 # HEBREW LETTER ZAYIN WITH DAGESH +FB38 # HEBREW LETTER TET WITH DAGESH +FB39 # HEBREW LETTER YOD WITH DAGESH +FB3A # HEBREW LETTER FINAL KAF WITH DAGESH +FB3B # HEBREW LETTER KAF WITH DAGESH +FB3C # HEBREW LETTER LAMED WITH DAGESH +FB3E # HEBREW LETTER MEM WITH DAGESH +FB40 # HEBREW LETTER NUN WITH DAGESH +FB41 # HEBREW LETTER SAMEKH WITH DAGESH +FB43 # HEBREW LETTER FINAL PE WITH DAGESH +FB44 # HEBREW LETTER PE WITH DAGESH +FB46 # HEBREW LETTER TSADI WITH DAGESH +FB47 # HEBREW LETTER QOF WITH DAGESH +FB48 # HEBREW LETTER RESH WITH DAGESH +FB49 # HEBREW LETTER SHIN WITH DAGESH +FB4A # HEBREW LETTER TAV WITH DAGESH +FB4B # HEBREW LETTER VAV WITH HOLAM +FB4C # HEBREW LETTER BET WITH RAFE +FB4D # HEBREW LETTER KAF WITH RAFE +FB4E # HEBREW LETTER PE WITH RAFE + +# Total code points: 67 + +# ================================================ +# (2) Post Composition Version precomposed characters +# These characters cannot be derived solely from the UnicodeData.txt file +# in this version of Unicode. +# ================================================ + +2ADC # FORKING +1D15E # MUSICAL SYMBOL HALF NOTE +1D15F # MUSICAL SYMBOL QUARTER NOTE +1D160 # MUSICAL SYMBOL EIGHTH NOTE +1D161 # MUSICAL SYMBOL SIXTEENTH NOTE +1D162 # MUSICAL SYMBOL THIRTY-SECOND NOTE +1D163 # MUSICAL SYMBOL SIXTY-FOURTH NOTE +1D164 # MUSICAL SYMBOL ONE HUNDRED TWENTY-EIGHTH NOTE +1D1BB # MUSICAL SYMBOL MINIMA +1D1BC # MUSICAL SYMBOL MINIMA BLACK +1D1BD # MUSICAL SYMBOL SEMIMINIMA WHITE +1D1BE # MUSICAL SYMBOL SEMIMINIMA BLACK +1D1BF # MUSICAL SYMBOL FUSA WHITE +1D1C0 # MUSICAL SYMBOL FUSA BLACK + +# Total code points: 14 + +# ================================================ +# (3) Singleton Decompositions +# These characters can be derived from the UnicodeData file +# by including all characters whose canonical decomposition +# consists of a single character. +# These characters are simply quoted here for reference. +# ================================================ + +# 0340..0341 [2] COMBINING GRAVE TONE MARK..COMBINING ACUTE TONE MARK +# 0343 COMBINING GREEK KORONIS +# 0374 GREEK NUMERAL SIGN +# 037E GREEK QUESTION MARK +# 0387 GREEK ANO TELEIA +# 1F71 GREEK SMALL LETTER ALPHA WITH OXIA +# 1F73 GREEK SMALL LETTER EPSILON WITH OXIA +# 1F75 GREEK SMALL LETTER ETA WITH OXIA +# 1F77 GREEK SMALL LETTER IOTA WITH OXIA +# 1F79 GREEK SMALL LETTER OMICRON WITH OXIA +# 1F7B GREEK SMALL LETTER UPSILON WITH OXIA +# 1F7D GREEK SMALL LETTER OMEGA WITH OXIA +# 1FBB GREEK CAPITAL LETTER ALPHA WITH OXIA +# 1FBE GREEK PROSGEGRAMMENI +# 1FC9 GREEK CAPITAL LETTER EPSILON WITH OXIA +# 1FCB GREEK CAPITAL LETTER ETA WITH OXIA +# 1FD3 GREEK SMALL LETTER IOTA WITH DIALYTIKA AND OXIA +# 1FDB GREEK CAPITAL LETTER IOTA WITH OXIA +# 1FE3 GREEK SMALL LETTER UPSILON WITH DIALYTIKA AND OXIA +# 1FEB GREEK CAPITAL LETTER UPSILON WITH OXIA +# 1FEE..1FEF [2] GREEK DIALYTIKA AND OXIA..GREEK VARIA +# 1FF9 GREEK CAPITAL LETTER OMICRON WITH OXIA +# 1FFB GREEK CAPITAL LETTER OMEGA WITH OXIA +# 1FFD GREEK OXIA +# 2000..2001 [2] EN QUAD..EM QUAD +# 2126 OHM SIGN +# 212A..212B [2] KELVIN SIGN..ANGSTROM SIGN +# 2329 LEFT-POINTING ANGLE BRACKET +# 232A RIGHT-POINTING ANGLE BRACKET +# F900..FA0D [270] CJK COMPATIBILITY IDEOGRAPH-F900..CJK COMPATIBILITY IDEOGRAPH-FA0D +# FA10 CJK COMPATIBILITY IDEOGRAPH-FA10 +# FA12 CJK COMPATIBILITY IDEOGRAPH-FA12 +# FA15..FA1E [10] CJK COMPATIBILITY IDEOGRAPH-FA15..CJK COMPATIBILITY IDEOGRAPH-FA1E +# FA20 CJK COMPATIBILITY IDEOGRAPH-FA20 +# FA22 CJK COMPATIBILITY IDEOGRAPH-FA22 +# FA25..FA26 [2] CJK COMPATIBILITY IDEOGRAPH-FA25..CJK COMPATIBILITY IDEOGRAPH-FA26 +# FA2A..FA2D [4] CJK COMPATIBILITY IDEOGRAPH-FA2A..CJK COMPATIBILITY IDEOGRAPH-FA2D +# FA30..FA6A [59] CJK COMPATIBILITY IDEOGRAPH-FA30..CJK COMPATIBILITY IDEOGRAPH-FA6A +# 2F800..2FA1D [542] CJK COMPATIBILITY IDEOGRAPH-2F800..CJK COMPATIBILITY IDEOGRAPH-2FA1D + +# Total code points: 924 + +# ================================================ +# (4) Non-Starter Decompositions +# These characters can be derived from the UnicodeData file +# by including all characters whose canonical decomposition consists +# of a sequence of characters, the first of which has a non-zero +# combining class. +# These characters are simply quoted here for reference. +# ================================================ + +# 0344 COMBINING GREEK DIALYTIKA TONOS +# 0F73 TIBETAN VOWEL SIGN II +# 0F75 TIBETAN VOWEL SIGN UU +# 0F81 TIBETAN VOWEL SIGN REVERSED II + +# Total code points: 4 + Added: pypy/branch/non-fake-unicode/pypy/module/unicodedata/CompositionExclusions-4.1.0.txt ============================================================================== --- (empty file) +++ pypy/branch/non-fake-unicode/pypy/module/unicodedata/CompositionExclusions-4.1.0.txt Tue May 17 17:13:56 2005 @@ -0,0 +1,179 @@ +# CompositionExclusions-4.1.0.txt +# Date: 2005-03-17, 15:21:00 PST [KW] +# +# This file lists the characters from the UAX #15 Composition Exclusion Table. +# +# This file is a normative contributory data file in the +# Unicode Character Database. +# +# Copyright (c) 1991-2005 Unicode, Inc. +# For terms of use, see http://www.unicode.org/terms_of_use.html +# +# For more information, see +# http://www.unicode.org/unicode/reports/tr15/#Primary Exclusion List Table +# ================================================ + +# (1) Script Specifics +# This list of characters cannot be derived from the UnicodeData file. +# ================================================ + +0958 # DEVANAGARI LETTER QA +0959 # DEVANAGARI LETTER KHHA +095A # DEVANAGARI LETTER GHHA +095B # DEVANAGARI LETTER ZA +095C # DEVANAGARI LETTER DDDHA +095D # DEVANAGARI LETTER RHA +095E # DEVANAGARI LETTER FA +095F # DEVANAGARI LETTER YYA +09DC # BENGALI LETTER RRA +09DD # BENGALI LETTER RHA +09DF # BENGALI LETTER YYA +0A33 # GURMUKHI LETTER LLA +0A36 # GURMUKHI LETTER SHA +0A59 # GURMUKHI LETTER KHHA +0A5A # GURMUKHI LETTER GHHA +0A5B # GURMUKHI LETTER ZA +0A5E # GURMUKHI LETTER FA +0B5C # ORIYA LETTER RRA +0B5D # ORIYA LETTER RHA +0F43 # TIBETAN LETTER GHA +0F4D # TIBETAN LETTER DDHA +0F52 # TIBETAN LETTER DHA +0F57 # TIBETAN LETTER BHA +0F5C # TIBETAN LETTER DZHA +0F69 # TIBETAN LETTER KSSA +0F76 # TIBETAN VOWEL SIGN VOCALIC R +0F78 # TIBETAN VOWEL SIGN VOCALIC L +0F93 # TIBETAN SUBJOINED LETTER GHA +0F9D # TIBETAN SUBJOINED LETTER DDHA +0FA2 # TIBETAN SUBJOINED LETTER DHA +0FA7 # TIBETAN SUBJOINED LETTER BHA +0FAC # TIBETAN SUBJOINED LETTER DZHA +0FB9 # TIBETAN SUBJOINED LETTER KSSA +FB1D # HEBREW LETTER YOD WITH HIRIQ +FB1F # HEBREW LIGATURE YIDDISH YOD YOD PATAH +FB2A # HEBREW LETTER SHIN WITH SHIN DOT +FB2B # HEBREW LETTER SHIN WITH SIN DOT +FB2C # HEBREW LETTER SHIN WITH DAGESH AND SHIN DOT +FB2D # HEBREW LETTER SHIN WITH DAGESH AND SIN DOT +FB2E # HEBREW LETTER ALEF WITH PATAH +FB2F # HEBREW LETTER ALEF WITH QAMATS +FB30 # HEBREW LETTER ALEF WITH MAPIQ +FB31 # HEBREW LETTER BET WITH DAGESH +FB32 # HEBREW LETTER GIMEL WITH DAGESH +FB33 # HEBREW LETTER DALET WITH DAGESH +FB34 # HEBREW LETTER HE WITH MAPIQ +FB35 # HEBREW LETTER VAV WITH DAGESH +FB36 # HEBREW LETTER ZAYIN WITH DAGESH +FB38 # HEBREW LETTER TET WITH DAGESH +FB39 # HEBREW LETTER YOD WITH DAGESH +FB3A # HEBREW LETTER FINAL KAF WITH DAGESH +FB3B # HEBREW LETTER KAF WITH DAGESH +FB3C # HEBREW LETTER LAMED WITH DAGESH +FB3E # HEBREW LETTER MEM WITH DAGESH +FB40 # HEBREW LETTER NUN WITH DAGESH +FB41 # HEBREW LETTER SAMEKH WITH DAGESH +FB43 # HEBREW LETTER FINAL PE WITH DAGESH +FB44 # HEBREW LETTER PE WITH DAGESH +FB46 # HEBREW LETTER TSADI WITH DAGESH +FB47 # HEBREW LETTER QOF WITH DAGESH +FB48 # HEBREW LETTER RESH WITH DAGESH +FB49 # HEBREW LETTER SHIN WITH DAGESH +FB4A # HEBREW LETTER TAV WITH DAGESH +FB4B # HEBREW LETTER VAV WITH HOLAM +FB4C # HEBREW LETTER BET WITH RAFE +FB4D # HEBREW LETTER KAF WITH RAFE +FB4E # HEBREW LETTER PE WITH RAFE + +# Total code points: 67 + +# ================================================ +# (2) Post Composition Version precomposed characters +# These characters cannot be derived solely from the UnicodeData.txt file +# in this version of Unicode. +# ================================================ + +2ADC # FORKING +1D15E # MUSICAL SYMBOL HALF NOTE +1D15F # MUSICAL SYMBOL QUARTER NOTE +1D160 # MUSICAL SYMBOL EIGHTH NOTE +1D161 # MUSICAL SYMBOL SIXTEENTH NOTE +1D162 # MUSICAL SYMBOL THIRTY-SECOND NOTE +1D163 # MUSICAL SYMBOL SIXTY-FOURTH NOTE +1D164 # MUSICAL SYMBOL ONE HUNDRED TWENTY-EIGHTH NOTE +1D1BB # MUSICAL SYMBOL MINIMA +1D1BC # MUSICAL SYMBOL MINIMA BLACK +1D1BD # MUSICAL SYMBOL SEMIMINIMA WHITE +1D1BE # MUSICAL SYMBOL SEMIMINIMA BLACK +1D1BF # MUSICAL SYMBOL FUSA WHITE +1D1C0 # MUSICAL SYMBOL FUSA BLACK + +# Total code points: 14 + +# ================================================ +# (3) Singleton Decompositions +# These characters can be derived from the UnicodeData file +# by including all characters whose canonical decomposition +# consists of a single character. +# These characters are simply quoted here for reference. +# ================================================ + +# 0340..0341 [2] COMBINING GRAVE TONE MARK..COMBINING ACUTE TONE MARK +# 0343 COMBINING GREEK KORONIS +# 0374 GREEK NUMERAL SIGN +# 037E GREEK QUESTION MARK +# 0387 GREEK ANO TELEIA +# 1F71 GREEK SMALL LETTER ALPHA WITH OXIA +# 1F73 GREEK SMALL LETTER EPSILON WITH OXIA +# 1F75 GREEK SMALL LETTER ETA WITH OXIA +# 1F77 GREEK SMALL LETTER IOTA WITH OXIA +# 1F79 GREEK SMALL LETTER OMICRON WITH OXIA +# 1F7B GREEK SMALL LETTER UPSILON WITH OXIA +# 1F7D GREEK SMALL LETTER OMEGA WITH OXIA +# 1FBB GREEK CAPITAL LETTER ALPHA WITH OXIA +# 1FBE GREEK PROSGEGRAMMENI +# 1FC9 GREEK CAPITAL LETTER EPSILON WITH OXIA +# 1FCB GREEK CAPITAL LETTER ETA WITH OXIA +# 1FD3 GREEK SMALL LETTER IOTA WITH DIALYTIKA AND OXIA +# 1FDB GREEK CAPITAL LETTER IOTA WITH OXIA +# 1FE3 GREEK SMALL LETTER UPSILON WITH DIALYTIKA AND OXIA +# 1FEB GREEK CAPITAL LETTER UPSILON WITH OXIA +# 1FEE..1FEF [2] GREEK DIALYTIKA AND OXIA..GREEK VARIA +# 1FF9 GREEK CAPITAL LETTER OMICRON WITH OXIA +# 1FFB GREEK CAPITAL LETTER OMEGA WITH OXIA +# 1FFD GREEK OXIA +# 2000..2001 [2] EN QUAD..EM QUAD +# 2126 OHM SIGN +# 212A..212B [2] KELVIN SIGN..ANGSTROM SIGN +# 2329 LEFT-POINTING ANGLE BRACKET +# 232A RIGHT-POINTING ANGLE BRACKET +# F900..FA0D [270] CJK COMPATIBILITY IDEOGRAPH-F900..CJK COMPATIBILITY IDEOGRAPH-FA0D +# FA10 CJK COMPATIBILITY IDEOGRAPH-FA10 +# FA12 CJK COMPATIBILITY IDEOGRAPH-FA12 +# FA15..FA1E [10] CJK COMPATIBILITY IDEOGRAPH-FA15..CJK COMPATIBILITY IDEOGRAPH-FA1E +# FA20 CJK COMPATIBILITY IDEOGRAPH-FA20 +# FA22 CJK COMPATIBILITY IDEOGRAPH-FA22 +# FA25..FA26 [2] CJK COMPATIBILITY IDEOGRAPH-FA25..CJK COMPATIBILITY IDEOGRAPH-FA26 +# FA2A..FA2D [4] CJK COMPATIBILITY IDEOGRAPH-FA2A..CJK COMPATIBILITY IDEOGRAPH-FA2D +# FA30..FA6A [59] CJK COMPATIBILITY IDEOGRAPH-FA30..CJK COMPATIBILITY IDEOGRAPH-FA6A +# FA70..FAD9 [106] CJK COMPATIBILITY IDEOGRAPH-FA70..CJK COMPATIBILITY IDEOGRAPH-FAD9 +# 2F800..2FA1D [542] CJK COMPATIBILITY IDEOGRAPH-2F800..CJK COMPATIBILITY IDEOGRAPH-2FA1D + +# Total code points: 924 + +# ================================================ +# (4) Non-Starter Decompositions +# These characters can be derived from the UnicodeData file +# by including all characters whose canonical decomposition consists +# of a sequence of characters, the first of which has a non-zero +# combining class. +# These characters are simply quoted here for reference. +# ================================================ + +# 0344 COMBINING GREEK DIALYTIKA TONOS +# 0F73 TIBETAN VOWEL SIGN II +# 0F75 TIBETAN VOWEL SIGN UU +# 0F81 TIBETAN VOWEL SIGN REVERSED II + +# Total code points: 4 + Modified: pypy/branch/non-fake-unicode/pypy/module/unicodedata/generate_unicodedb.py ============================================================================== --- pypy/branch/non-fake-unicode/pypy/module/unicodedata/generate_unicodedb.py (original) +++ pypy/branch/non-fake-unicode/pypy/module/unicodedata/generate_unicodedb.py Tue May 17 17:13:56 2005 @@ -1,10 +1,7 @@ #!/usr/bin/env python import sys -class Unicodechar(object): - __slots__ = '''code name category combining bidirectional - decomposition decomposition_tag decimal digit numeric - mirrored upper lower title'''.split() +class Unicodechar: def __init__(self, data): if not data[1] or data[1][0] == '<' and data[1][-1] == '>': self.name = None @@ -40,6 +37,7 @@ except ValueError: self.numeric = float(data[8]) self.mirrored = (data[9] == 'Y') + self.upper = None if data[12]: self.upper = int(data[12], 16) self.lower = None @@ -49,10 +47,6 @@ if data[14]: self.title = int(data[14], 16) - def isspace(self): - return (self.category == 'Zs' or - self.bidirectional in ('WS', 'B' or 'S')) - def read_unicodedata(infile): rangeFirst = {} rangeLast = {} @@ -93,7 +87,21 @@ print >> outfile, '}' print >> outfile -def writeCategory(outfile, table, name, categoryNames): +class Cache: + def __init__(self): + self._cache = {} + self._strings = [] + def get(self, string): + try: + return self._cache[string] + except KeyError: + index = len(self._cache) + self._cache[string] = index + self._strings.append(string) + return index + +def writeCategory(_outfile, table, name, categoryNames): + cache = Cache() print >> outfile, '_%s_names = %r' % (name, categoryNames) print >> outfile, '_%s = "".join([' % name for i in range(0, len(table), 64): @@ -108,10 +116,52 @@ '''%(name, name, name) +def writeCategory(outfile, table, name, categoryNames): + pgbits = 8 + chunksize = 64 + pgsize = 1 << pgbits + bytemask = ~(-1 << pgbits) + pages = [] + print >> outfile, '_%s_names = %r' % (name, categoryNames) + print >> outfile, '_%s_pgtbl = "".join([' % name + line = [] + for i in range(0, len(table), pgsize): + result = [] + for char in table[i:i + pgsize]: + result.append(chr(categoryNames.index(getattr(char, name)))) + categorytbl = ''.join(result) + try: + page = pages.index(categorytbl) + except ValueError: + page = len(pages) + pages.append(categorytbl) + assert len(pages) < 256, 'Too many unique pages for category %s.' % name + line.append(chr(page)) + if len(line) >= chunksize: + print >> outfile, repr(''.join(line)) + line = [] + if len(line) > 0: + print >> outfile, repr(''.join(line)) + print >> outfile, '])' + + # Dump pgtbl + print >> outfile, '_%s = ( ' % name + for page_string in pages: + print >> outfile, '"".join([' + for index in range(0, len(page_string), chunksize): + print >> outfile, repr(page_string[index:index + chunksize]) + print >> outfile, ']),' + print >> outfile, ')' + print >> outfile, ''' +def %s(code): + return _%s_names[ord(_%s[ord(_%s_pgtbl[code >> %d])][code & %d])] +'''%(name, name, name, name, pgbits, bytemask) + def writeUnicodedata(version, table, outfile): # Version print >> outfile, 'version = %r' % version print >> outfile + # Character names print >> outfile, '_charnames = {' for code in range(len(table)): @@ -127,6 +177,7 @@ def name(code): return _charnames[code] ''' + # Categories categories = {} bidirs = {} @@ -153,6 +204,8 @@ return category(code) == "Lu" def istitle(code): return category(code) == "Lt" +def iscased(code): + return category(code) in ("Ll", "Lu", "Lt") def isalpha(code): return category(code) in ("Lm", "Lt", "Lu", "Ll", "Lo") def islinebreak(code): @@ -206,6 +259,53 @@ ''' # Mirrored + mirrored = {} + for code in range(len(table)): + if table[code].mirrored: + mirrored[code] = 1 + writeDict(outfile, '_mirrored', mirrored) + print >> outfile, ''' +def mirrored(code): + return _mirrored.get(code, 0) + +''' + # Case conversion + toupper = {} + tolower = {} + totitle = {} + for code in range(len(table)): + if table[code].upper: + toupper[code] = table[code].upper + if table[code].lower: + tolower[code] = table[code].lower + if table[code].title: + totitle[code] = table[code].title + writeDict(outfile, '_toupper', toupper) + writeDict(outfile, '_tolower', tolower) + writeDict(outfile, '_totitle', totitle) + print >> outfile, ''' +def toupper(code): + return _toupper.get(code, code) +def tolower(code): + return _tolower.get(code, code) +def totitle(code): + return _totitle.get(code, code) + +''' + # Mirrored + mirrored = dict([(code, 1) for char in table + if char.mirrored]) + mirrored = {} + for code in range(len(table)): + if table[code].mirrored: + mirrored[code] = 1 + writeDict(outfile, '_mirrored', mirrored) + print >> outfile, ''' +def mirrored(code): + return _mirrored.get(code, 0) + +''' + # Mirrored mirrored = dict([(code, 1) for char in table if char.mirrored]) mirrored = {} Added: pypy/branch/non-fake-unicode/pypy/module/unicodedata/unicodedb.py ============================================================================== --- (empty file) +++ pypy/branch/non-fake-unicode/pypy/module/unicodedata/unicodedb.py Tue May 17 17:13:56 2005 @@ -0,0 +1,20026 @@ +# UNICODE CHARACTER DATABASE +# This file was genrated with the command: +# ./generate_unicodedb.py -o unicodedb.py UnicodeData-3.2.0.txt CompositionExclusions-3.2.0.txt + +version = '3.2.0' + +_charnames = { +32: 'SPACE', +33: 'EXCLAMATION MARK', +34: 'QUOTATION MARK', +35: 'NUMBER SIGN', +36: 'DOLLAR SIGN', +37: 'PERCENT SIGN', +38: 'AMPERSAND', +39: 'APOSTROPHE', +40: 'LEFT PARENTHESIS', +41: 'RIGHT PARENTHESIS', +42: 'ASTERISK', +43: 'PLUS SIGN', +44: 'COMMA', +45: 'HYPHEN-MINUS', +46: 'FULL STOP', +47: 'SOLIDUS', +48: 'DIGIT ZERO', +49: 'DIGIT ONE', +50: 'DIGIT TWO', +51: 'DIGIT THREE', +52: 'DIGIT FOUR', +53: 'DIGIT FIVE', +54: 'DIGIT SIX', +55: 'DIGIT SEVEN', +56: 'DIGIT EIGHT', +57: 'DIGIT NINE', +58: 'COLON', +59: 'SEMICOLON', +60: 'LESS-THAN SIGN', +61: 'EQUALS SIGN', +62: 'GREATER-THAN SIGN', +63: 'QUESTION MARK', +64: 'COMMERCIAL AT', +65: 'LATIN CAPITAL LETTER A', +66: 'LATIN CAPITAL LETTER B', +67: 'LATIN CAPITAL LETTER C', +68: 'LATIN CAPITAL LETTER D', +69: 'LATIN CAPITAL LETTER E', +70: 'LATIN CAPITAL LETTER F', +71: 'LATIN CAPITAL LETTER G', +72: 'LATIN CAPITAL LETTER H', +73: 'LATIN CAPITAL LETTER I', +74: 'LATIN CAPITAL LETTER J', +75: 'LATIN CAPITAL LETTER K', +76: 'LATIN CAPITAL LETTER L', +77: 'LATIN CAPITAL LETTER M', +78: 'LATIN CAPITAL LETTER N', +79: 'LATIN CAPITAL LETTER O', +80: 'LATIN CAPITAL LETTER P', +81: 'LATIN CAPITAL LETTER Q', +82: 'LATIN CAPITAL LETTER R', +83: 'LATIN CAPITAL LETTER S', +84: 'LATIN CAPITAL LETTER T', +85: 'LATIN CAPITAL LETTER U', +86: 'LATIN CAPITAL LETTER V', +87: 'LATIN CAPITAL LETTER W', +88: 'LATIN CAPITAL LETTER X', +89: 'LATIN CAPITAL LETTER Y', +90: 'LATIN CAPITAL LETTER Z', +91: 'LEFT SQUARE BRACKET', +92: 'REVERSE SOLIDUS', +93: 'RIGHT SQUARE BRACKET', +94: 'CIRCUMFLEX ACCENT', +95: 'LOW LINE', +96: 'GRAVE ACCENT', +97: 'LATIN SMALL LETTER A', +98: 'LATIN SMALL LETTER B', +99: 'LATIN SMALL LETTER C', +100: 'LATIN SMALL LETTER D', +101: 'LATIN SMALL LETTER E', +102: 'LATIN SMALL LETTER F', +103: 'LATIN SMALL LETTER G', +104: 'LATIN SMALL LETTER H', +105: 'LATIN SMALL LETTER I', +106: 'LATIN SMALL LETTER J', +107: 'LATIN SMALL LETTER K', +108: 'LATIN SMALL LETTER L', +109: 'LATIN SMALL LETTER M', +110: 'LATIN SMALL LETTER N', +111: 'LATIN SMALL LETTER O', +112: 'LATIN SMALL LETTER P', +113: 'LATIN SMALL LETTER Q', +114: 'LATIN SMALL LETTER R', +115: 'LATIN SMALL LETTER S', +116: 'LATIN SMALL LETTER T', +117: 'LATIN SMALL LETTER U', +118: 'LATIN SMALL LETTER V', +119: 'LATIN SMALL LETTER W', +120: 'LATIN SMALL LETTER X', +121: 'LATIN SMALL LETTER Y', +122: 'LATIN SMALL LETTER Z', +123: 'LEFT CURLY BRACKET', +124: 'VERTICAL LINE', +125: 'RIGHT CURLY BRACKET', +126: 'TILDE', +160: 'NO-BREAK SPACE', +161: 'INVERTED EXCLAMATION MARK', +162: 'CENT SIGN', +163: 'POUND SIGN', +164: 'CURRENCY SIGN', +165: 'YEN SIGN', +166: 'BROKEN BAR', +167: 'SECTION SIGN', +168: 'DIAERESIS', +169: 'COPYRIGHT SIGN', +170: 'FEMININE ORDINAL INDICATOR', +171: 'LEFT-POINTING DOUBLE ANGLE QUOTATION MARK', +172: 'NOT SIGN', +173: 'SOFT HYPHEN', +174: 'REGISTERED SIGN', +175: 'MACRON', +176: 'DEGREE SIGN', +177: 'PLUS-MINUS SIGN', +178: 'SUPERSCRIPT TWO', +179: 'SUPERSCRIPT THREE', +180: 'ACUTE ACCENT', +181: 'MICRO SIGN', +182: 'PILCROW SIGN', +183: 'MIDDLE DOT', +184: 'CEDILLA', +185: 'SUPERSCRIPT ONE', +186: 'MASCULINE ORDINAL INDICATOR', +187: 'RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK', +188: 'VULGAR FRACTION ONE QUARTER', +189: 'VULGAR FRACTION ONE HALF', +190: 'VULGAR FRACTION THREE QUARTERS', +191: 'INVERTED QUESTION MARK', +192: 'LATIN CAPITAL LETTER A WITH GRAVE', +193: 'LATIN CAPITAL LETTER A WITH ACUTE', +194: 'LATIN CAPITAL LETTER A WITH CIRCUMFLEX', +195: 'LATIN CAPITAL LETTER A WITH TILDE', +196: 'LATIN CAPITAL LETTER A WITH DIAERESIS', +197: 'LATIN CAPITAL LETTER A WITH RING ABOVE', +198: 'LATIN CAPITAL LETTER AE', +199: 'LATIN CAPITAL LETTER C WITH CEDILLA', +200: 'LATIN CAPITAL LETTER E WITH GRAVE', +201: 'LATIN CAPITAL LETTER E WITH ACUTE', +202: 'LATIN CAPITAL LETTER E WITH CIRCUMFLEX', +203: 'LATIN CAPITAL LETTER E WITH DIAERESIS', +204: 'LATIN CAPITAL LETTER I WITH GRAVE', +205: 'LATIN CAPITAL LETTER I WITH ACUTE', +206: 'LATIN CAPITAL LETTER I WITH CIRCUMFLEX', +207: 'LATIN CAPITAL LETTER I WITH DIAERESIS', +208: 'LATIN CAPITAL LETTER ETH', +209: 'LATIN CAPITAL LETTER N WITH TILDE', +210: 'LATIN CAPITAL LETTER O WITH GRAVE', +211: 'LATIN CAPITAL LETTER O WITH ACUTE', +212: 'LATIN CAPITAL LETTER O WITH CIRCUMFLEX', +213: 'LATIN CAPITAL LETTER O WITH TILDE', +214: 'LATIN CAPITAL LETTER O WITH DIAERESIS', +215: 'MULTIPLICATION SIGN', +216: 'LATIN CAPITAL LETTER O WITH STROKE', +217: 'LATIN CAPITAL LETTER U WITH GRAVE', +218: 'LATIN CAPITAL LETTER U WITH ACUTE', +219: 'LATIN CAPITAL LETTER U WITH CIRCUMFLEX', +220: 'LATIN CAPITAL LETTER U WITH DIAERESIS', +221: 'LATIN CAPITAL LETTER Y WITH ACUTE', +222: 'LATIN CAPITAL LETTER THORN', +223: 'LATIN SMALL LETTER SHARP S', +224: 'LATIN SMALL LETTER A WITH GRAVE', +225: 'LATIN SMALL LETTER A WITH ACUTE', +226: 'LATIN SMALL LETTER A WITH CIRCUMFLEX', +227: 'LATIN SMALL LETTER A WITH TILDE', +228: 'LATIN SMALL LETTER A WITH DIAERESIS', +229: 'LATIN SMALL LETTER A WITH RING ABOVE', +230: 'LATIN SMALL LETTER AE', +231: 'LATIN SMALL LETTER C WITH CEDILLA', +232: 'LATIN SMALL LETTER E WITH GRAVE', +233: 'LATIN SMALL LETTER E WITH ACUTE', +234: 'LATIN SMALL LETTER E WITH CIRCUMFLEX', +235: 'LATIN SMALL LETTER E WITH DIAERESIS', +236: 'LATIN SMALL LETTER I WITH GRAVE', +237: 'LATIN SMALL LETTER I WITH ACUTE', +238: 'LATIN SMALL LETTER I WITH CIRCUMFLEX', +239: 'LATIN SMALL LETTER I WITH DIAERESIS', +240: 'LATIN SMALL LETTER ETH', +241: 'LATIN SMALL LETTER N WITH TILDE', +242: 'LATIN SMALL LETTER O WITH GRAVE', +243: 'LATIN SMALL LETTER O WITH ACUTE', +244: 'LATIN SMALL LETTER O WITH CIRCUMFLEX', +245: 'LATIN SMALL LETTER O WITH TILDE', +246: 'LATIN SMALL LETTER O WITH DIAERESIS', +247: 'DIVISION SIGN', +248: 'LATIN SMALL LETTER O WITH STROKE', +249: 'LATIN SMALL LETTER U WITH GRAVE', +250: 'LATIN SMALL LETTER U WITH ACUTE', +251: 'LATIN SMALL LETTER U WITH CIRCUMFLEX', +252: 'LATIN SMALL LETTER U WITH DIAERESIS', +253: 'LATIN SMALL LETTER Y WITH ACUTE', +254: 'LATIN SMALL LETTER THORN', +255: 'LATIN SMALL LETTER Y WITH DIAERESIS', +256: 'LATIN CAPITAL LETTER A WITH MACRON', +257: 'LATIN SMALL LETTER A WITH MACRON', +258: 'LATIN CAPITAL LETTER A WITH BREVE', +259: 'LATIN SMALL LETTER A WITH BREVE', +260: 'LATIN CAPITAL LETTER A WITH OGONEK', +261: 'LATIN SMALL LETTER A WITH OGONEK', +262: 'LATIN CAPITAL LETTER C WITH ACUTE', +263: 'LATIN SMALL LETTER C WITH ACUTE', +264: 'LATIN CAPITAL LETTER C WITH CIRCUMFLEX', +265: 'LATIN SMALL LETTER C WITH CIRCUMFLEX', +266: 'LATIN CAPITAL LETTER C WITH DOT ABOVE', +267: 'LATIN SMALL LETTER C WITH DOT ABOVE', +268: 'LATIN CAPITAL LETTER C WITH CARON', +269: 'LATIN SMALL LETTER C WITH CARON', +270: 'LATIN CAPITAL LETTER D WITH CARON', +271: 'LATIN SMALL LETTER D WITH CARON', +272: 'LATIN CAPITAL LETTER D WITH STROKE', +273: 'LATIN SMALL LETTER D WITH STROKE', +274: 'LATIN CAPITAL LETTER E WITH MACRON', +275: 'LATIN SMALL LETTER E WITH MACRON', +276: 'LATIN CAPITAL LETTER E WITH BREVE', +277: 'LATIN SMALL LETTER E WITH BREVE', +278: 'LATIN CAPITAL LETTER E WITH DOT ABOVE', +279: 'LATIN SMALL LETTER E WITH DOT ABOVE', +280: 'LATIN CAPITAL LETTER E WITH OGONEK', +281: 'LATIN SMALL LETTER E WITH OGONEK', +282: 'LATIN CAPITAL LETTER E WITH CARON', +283: 'LATIN SMALL LETTER E WITH CARON', +284: 'LATIN CAPITAL LETTER G WITH CIRCUMFLEX', +285: 'LATIN SMALL LETTER G WITH CIRCUMFLEX', +286: 'LATIN CAPITAL LETTER G WITH BREVE', +287: 'LATIN SMALL LETTER G WITH BREVE', +288: 'LATIN CAPITAL LETTER G WITH DOT ABOVE', +289: 'LATIN SMALL LETTER G WITH DOT ABOVE', +290: 'LATIN CAPITAL LETTER G WITH CEDILLA', +291: 'LATIN SMALL LETTER G WITH CEDILLA', +292: 'LATIN CAPITAL LETTER H WITH CIRCUMFLEX', +293: 'LATIN SMALL LETTER H WITH CIRCUMFLEX', +294: 'LATIN CAPITAL LETTER H WITH STROKE', +295: 'LATIN SMALL LETTER H WITH STROKE', +296: 'LATIN CAPITAL LETTER I WITH TILDE', +297: 'LATIN SMALL LETTER I WITH TILDE', +298: 'LATIN CAPITAL LETTER I WITH MACRON', +299: 'LATIN SMALL LETTER I WITH MACRON', +300: 'LATIN CAPITAL LETTER I WITH BREVE', +301: 'LATIN SMALL LETTER I WITH BREVE', +302: 'LATIN CAPITAL LETTER I WITH OGONEK', +303: 'LATIN SMALL LETTER I WITH OGONEK', +304: 'LATIN CAPITAL LETTER I WITH DOT ABOVE', +305: 'LATIN SMALL LETTER DOTLESS I', +306: 'LATIN CAPITAL LIGATURE IJ', +307: 'LATIN SMALL LIGATURE IJ', +308: 'LATIN CAPITAL LETTER J WITH CIRCUMFLEX', +309: 'LATIN SMALL LETTER J WITH CIRCUMFLEX', +310: 'LATIN CAPITAL LETTER K WITH CEDILLA', +311: 'LATIN SMALL LETTER K WITH CEDILLA', +312: 'LATIN SMALL LETTER KRA', +313: 'LATIN CAPITAL LETTER L WITH ACUTE', +314: 'LATIN SMALL LETTER L WITH ACUTE', +315: 'LATIN CAPITAL LETTER L WITH CEDILLA', +316: 'LATIN SMALL LETTER L WITH CEDILLA', +317: 'LATIN CAPITAL LETTER L WITH CARON', +318: 'LATIN SMALL LETTER L WITH CARON', +319: 'LATIN CAPITAL LETTER L WITH MIDDLE DOT', +320: 'LATIN SMALL LETTER L WITH MIDDLE DOT', +321: 'LATIN CAPITAL LETTER L WITH STROKE', +322: 'LATIN SMALL LETTER L WITH STROKE', +323: 'LATIN CAPITAL LETTER N WITH ACUTE', +324: 'LATIN SMALL LETTER N WITH ACUTE', +325: 'LATIN CAPITAL LETTER N WITH CEDILLA', +326: 'LATIN SMALL LETTER N WITH CEDILLA', +327: 'LATIN CAPITAL LETTER N WITH CARON', +328: 'LATIN SMALL LETTER N WITH CARON', +329: 'LATIN SMALL LETTER N PRECEDED BY APOSTROPHE', +330: 'LATIN CAPITAL LETTER ENG', +331: 'LATIN SMALL LETTER ENG', +332: 'LATIN CAPITAL LETTER O WITH MACRON', +333: 'LATIN SMALL LETTER O WITH MACRON', +334: 'LATIN CAPITAL LETTER O WITH BREVE', +335: 'LATIN SMALL LETTER O WITH BREVE', +336: 'LATIN CAPITAL LETTER O WITH DOUBLE ACUTE', +337: 'LATIN SMALL LETTER O WITH DOUBLE ACUTE', +338: 'LATIN CAPITAL LIGATURE OE', +339: 'LATIN SMALL LIGATURE OE', +340: 'LATIN CAPITAL LETTER R WITH ACUTE', +341: 'LATIN SMALL LETTER R WITH ACUTE', +342: 'LATIN CAPITAL LETTER R WITH CEDILLA', +343: 'LATIN SMALL LETTER R WITH CEDILLA', +344: 'LATIN CAPITAL LETTER R WITH CARON', +345: 'LATIN SMALL LETTER R WITH CARON', +346: 'LATIN CAPITAL LETTER S WITH ACUTE', +347: 'LATIN SMALL LETTER S WITH ACUTE', +348: 'LATIN CAPITAL LETTER S WITH CIRCUMFLEX', +349: 'LATIN SMALL LETTER S WITH CIRCUMFLEX', +350: 'LATIN CAPITAL LETTER S WITH CEDILLA', +351: 'LATIN SMALL LETTER S WITH CEDILLA', +352: 'LATIN CAPITAL LETTER S WITH CARON', +353: 'LATIN SMALL LETTER S WITH CARON', +354: 'LATIN CAPITAL LETTER T WITH CEDILLA', +355: 'LATIN SMALL LETTER T WITH CEDILLA', +356: 'LATIN CAPITAL LETTER T WITH CARON', +357: 'LATIN SMALL LETTER T WITH CARON', +358: 'LATIN CAPITAL LETTER T WITH STROKE', +359: 'LATIN SMALL LETTER T WITH STROKE', +360: 'LATIN CAPITAL LETTER U WITH TILDE', +361: 'LATIN SMALL LETTER U WITH TILDE', +362: 'LATIN CAPITAL LETTER U WITH MACRON', +363: 'LATIN SMALL LETTER U WITH MACRON', +364: 'LATIN CAPITAL LETTER U WITH BREVE', +365: 'LATIN SMALL LETTER U WITH BREVE', +366: 'LATIN CAPITAL LETTER U WITH RING ABOVE', +367: 'LATIN SMALL LETTER U WITH RING ABOVE', +368: 'LATIN CAPITAL LETTER U WITH DOUBLE ACUTE', +369: 'LATIN SMALL LETTER U WITH DOUBLE ACUTE', +370: 'LATIN CAPITAL LETTER U WITH OGONEK', +371: 'LATIN SMALL LETTER U WITH OGONEK', +372: 'LATIN CAPITAL LETTER W WITH CIRCUMFLEX', +373: 'LATIN SMALL LETTER W WITH CIRCUMFLEX', +374: 'LATIN CAPITAL LETTER Y WITH CIRCUMFLEX', +375: 'LATIN SMALL LETTER Y WITH CIRCUMFLEX', +376: 'LATIN CAPITAL LETTER Y WITH DIAERESIS', +377: 'LATIN CAPITAL LETTER Z WITH ACUTE', +378: 'LATIN SMALL LETTER Z WITH ACUTE', +379: 'LATIN CAPITAL LETTER Z WITH DOT ABOVE', +380: 'LATIN SMALL LETTER Z WITH DOT ABOVE', +381: 'LATIN CAPITAL LETTER Z WITH CARON', +382: 'LATIN SMALL LETTER Z WITH CARON', +383: 'LATIN SMALL LETTER LONG S', +384: 'LATIN SMALL LETTER B WITH STROKE', +385: 'LATIN CAPITAL LETTER B WITH HOOK', +386: 'LATIN CAPITAL LETTER B WITH TOPBAR', +387: 'LATIN SMALL LETTER B WITH TOPBAR', +388: 'LATIN CAPITAL LETTER TONE SIX', +389: 'LATIN SMALL LETTER TONE SIX', +390: 'LATIN CAPITAL LETTER OPEN O', +391: 'LATIN CAPITAL LETTER C WITH HOOK', +392: 'LATIN SMALL LETTER C WITH HOOK', +393: 'LATIN CAPITAL LETTER AFRICAN D', +394: 'LATIN CAPITAL LETTER D WITH HOOK', +395: 'LATIN CAPITAL LETTER D WITH TOPBAR', +396: 'LATIN SMALL LETTER D WITH TOPBAR', +397: 'LATIN SMALL LETTER TURNED DELTA', +398: 'LATIN CAPITAL LETTER REVERSED E', +399: 'LATIN CAPITAL LETTER SCHWA', +400: 'LATIN CAPITAL LETTER OPEN E', +401: 'LATIN CAPITAL LETTER F WITH HOOK', +402: 'LATIN SMALL LETTER F WITH HOOK', +403: 'LATIN CAPITAL LETTER G WITH HOOK', +404: 'LATIN CAPITAL LETTER GAMMA', +405: 'LATIN SMALL LETTER HV', +406: 'LATIN CAPITAL LETTER IOTA', +407: 'LATIN CAPITAL LETTER I WITH STROKE', +408: 'LATIN CAPITAL LETTER K WITH HOOK', +409: 'LATIN SMALL LETTER K WITH HOOK', +410: 'LATIN SMALL LETTER L WITH BAR', +411: 'LATIN SMALL LETTER LAMBDA WITH STROKE', +412: 'LATIN CAPITAL LETTER TURNED M', +413: 'LATIN CAPITAL LETTER N WITH LEFT HOOK', +414: 'LATIN SMALL LETTER N WITH LONG RIGHT LEG', +415: 'LATIN CAPITAL LETTER O WITH MIDDLE TILDE', +416: 'LATIN CAPITAL LETTER O WITH HORN', +417: 'LATIN SMALL LETTER O WITH HORN', +418: 'LATIN CAPITAL LETTER OI', +419: 'LATIN SMALL LETTER OI', +420: 'LATIN CAPITAL LETTER P WITH HOOK', +421: 'LATIN SMALL LETTER P WITH HOOK', +422: 'LATIN LETTER YR', +423: 'LATIN CAPITAL LETTER TONE TWO', +424: 'LATIN SMALL LETTER TONE TWO', +425: 'LATIN CAPITAL LETTER ESH', +426: 'LATIN LETTER REVERSED ESH LOOP', +427: 'LATIN SMALL LETTER T WITH PALATAL HOOK', +428: 'LATIN CAPITAL LETTER T WITH HOOK', +429: 'LATIN SMALL LETTER T WITH HOOK', +430: 'LATIN CAPITAL LETTER T WITH RETROFLEX HOOK', +431: 'LATIN CAPITAL LETTER U WITH HORN', +432: 'LATIN SMALL LETTER U WITH HORN', +433: 'LATIN CAPITAL LETTER UPSILON', +434: 'LATIN CAPITAL LETTER V WITH HOOK', +435: 'LATIN CAPITAL LETTER Y WITH HOOK', +436: 'LATIN SMALL LETTER Y WITH HOOK', +437: 'LATIN CAPITAL LETTER Z WITH STROKE', +438: 'LATIN SMALL LETTER Z WITH STROKE', +439: 'LATIN CAPITAL LETTER EZH', +440: 'LATIN CAPITAL LETTER EZH REVERSED', +441: 'LATIN SMALL LETTER EZH REVERSED', +442: 'LATIN SMALL LETTER EZH WITH TAIL', +443: 'LATIN LETTER TWO WITH STROKE', +444: 'LATIN CAPITAL LETTER TONE FIVE', +445: 'LATIN SMALL LETTER TONE FIVE', +446: 'LATIN LETTER INVERTED GLOTTAL STOP WITH STROKE', +447: 'LATIN LETTER WYNN', +448: 'LATIN LETTER DENTAL CLICK', +449: 'LATIN LETTER LATERAL CLICK', +450: 'LATIN LETTER ALVEOLAR CLICK', +451: 'LATIN LETTER RETROFLEX CLICK', +452: 'LATIN CAPITAL LETTER DZ WITH CARON', +453: 'LATIN CAPITAL LETTER D WITH SMALL LETTER Z WITH CARON', +454: 'LATIN SMALL LETTER DZ WITH CARON', +455: 'LATIN CAPITAL LETTER LJ', +456: 'LATIN CAPITAL LETTER L WITH SMALL LETTER J', +457: 'LATIN SMALL LETTER LJ', +458: 'LATIN CAPITAL LETTER NJ', +459: 'LATIN CAPITAL LETTER N WITH SMALL LETTER J', +460: 'LATIN SMALL LETTER NJ', +461: 'LATIN CAPITAL LETTER A WITH CARON', +462: 'LATIN SMALL LETTER A WITH CARON', +463: 'LATIN CAPITAL LETTER I WITH CARON', +464: 'LATIN SMALL LETTER I WITH CARON', +465: 'LATIN CAPITAL LETTER O WITH CARON', +466: 'LATIN SMALL LETTER O WITH CARON', +467: 'LATIN CAPITAL LETTER U WITH CARON', +468: 'LATIN SMALL LETTER U WITH CARON', +469: 'LATIN CAPITAL LETTER U WITH DIAERESIS AND MACRON', +470: 'LATIN SMALL LETTER U WITH DIAERESIS AND MACRON', +471: 'LATIN CAPITAL LETTER U WITH DIAERESIS AND ACUTE', +472: 'LATIN SMALL LETTER U WITH DIAERESIS AND ACUTE', +473: 'LATIN CAPITAL LETTER U WITH DIAERESIS AND CARON', +474: 'LATIN SMALL LETTER U WITH DIAERESIS AND CARON', +475: 'LATIN CAPITAL LETTER U WITH DIAERESIS AND GRAVE', +476: 'LATIN SMALL LETTER U WITH DIAERESIS AND GRAVE', +477: 'LATIN SMALL LETTER TURNED E', +478: 'LATIN CAPITAL LETTER A WITH DIAERESIS AND MACRON', +479: 'LATIN SMALL LETTER A WITH DIAERESIS AND MACRON', +480: 'LATIN CAPITAL LETTER A WITH DOT ABOVE AND MACRON', +481: 'LATIN SMALL LETTER A WITH DOT ABOVE AND MACRON', +482: 'LATIN CAPITAL LETTER AE WITH MACRON', +483: 'LATIN SMALL LETTER AE WITH MACRON', +484: 'LATIN CAPITAL LETTER G WITH STROKE', +485: 'LATIN SMALL LETTER G WITH STROKE', +486: 'LATIN CAPITAL LETTER G WITH CARON', +487: 'LATIN SMALL LETTER G WITH CARON', +488: 'LATIN CAPITAL LETTER K WITH CARON', +489: 'LATIN SMALL LETTER K WITH CARON', +490: 'LATIN CAPITAL LETTER O WITH OGONEK', +491: 'LATIN SMALL LETTER O WITH OGONEK', +492: 'LATIN CAPITAL LETTER O WITH OGONEK AND MACRON', +493: 'LATIN SMALL LETTER O WITH OGONEK AND MACRON', +494: 'LATIN CAPITAL LETTER EZH WITH CARON', +495: 'LATIN SMALL LETTER EZH WITH CARON', +496: 'LATIN SMALL LETTER J WITH CARON', +497: 'LATIN CAPITAL LETTER DZ', +498: 'LATIN CAPITAL LETTER D WITH SMALL LETTER Z', +499: 'LATIN SMALL LETTER DZ', +500: 'LATIN CAPITAL LETTER G WITH ACUTE', +501: 'LATIN SMALL LETTER G WITH ACUTE', +502: 'LATIN CAPITAL LETTER HWAIR', +503: 'LATIN CAPITAL LETTER WYNN', +504: 'LATIN CAPITAL LETTER N WITH GRAVE', +505: 'LATIN SMALL LETTER N WITH GRAVE', +506: 'LATIN CAPITAL LETTER A WITH RING ABOVE AND ACUTE', +507: 'LATIN SMALL LETTER A WITH RING ABOVE AND ACUTE', +508: 'LATIN CAPITAL LETTER AE WITH ACUTE', +509: 'LATIN SMALL LETTER AE WITH ACUTE', +510: 'LATIN CAPITAL LETTER O WITH STROKE AND ACUTE', +511: 'LATIN SMALL LETTER O WITH STROKE AND ACUTE', +512: 'LATIN CAPITAL LETTER A WITH DOUBLE GRAVE', +513: 'LATIN SMALL LETTER A WITH DOUBLE GRAVE', +514: 'LATIN CAPITAL LETTER A WITH INVERTED BREVE', +515: 'LATIN SMALL LETTER A WITH INVERTED BREVE', +516: 'LATIN CAPITAL LETTER E WITH DOUBLE GRAVE', +517: 'LATIN SMALL LETTER E WITH DOUBLE GRAVE', +518: 'LATIN CAPITAL LETTER E WITH INVERTED BREVE', +519: 'LATIN SMALL LETTER E WITH INVERTED BREVE', +520: 'LATIN CAPITAL LETTER I WITH DOUBLE GRAVE', +521: 'LATIN SMALL LETTER I WITH DOUBLE GRAVE', +522: 'LATIN CAPITAL LETTER I WITH INVERTED BREVE', +523: 'LATIN SMALL LETTER I WITH INVERTED BREVE', +524: 'LATIN CAPITAL LETTER O WITH DOUBLE GRAVE', +525: 'LATIN SMALL LETTER O WITH DOUBLE GRAVE', +526: 'LATIN CAPITAL LETTER O WITH INVERTED BREVE', +527: 'LATIN SMALL LETTER O WITH INVERTED BREVE', +528: 'LATIN CAPITAL LETTER R WITH DOUBLE GRAVE', +529: 'LATIN SMALL LETTER R WITH DOUBLE GRAVE', +530: 'LATIN CAPITAL LETTER R WITH INVERTED BREVE', +531: 'LATIN SMALL LETTER R WITH INVERTED BREVE', +532: 'LATIN CAPITAL LETTER U WITH DOUBLE GRAVE', +533: 'LATIN SMALL LETTER U WITH DOUBLE GRAVE', +534: 'LATIN CAPITAL LETTER U WITH INVERTED BREVE', +535: 'LATIN SMALL LETTER U WITH INVERTED BREVE', +536: 'LATIN CAPITAL LETTER S WITH COMMA BELOW', +537: 'LATIN SMALL LETTER S WITH COMMA BELOW', +538: 'LATIN CAPITAL LETTER T WITH COMMA BELOW', +539: 'LATIN SMALL LETTER T WITH COMMA BELOW', +540: 'LATIN CAPITAL LETTER YOGH', +541: 'LATIN SMALL LETTER YOGH', +542: 'LATIN CAPITAL LETTER H WITH CARON', +543: 'LATIN SMALL LETTER H WITH CARON', +544: 'LATIN CAPITAL LETTER N WITH LONG RIGHT LEG', +546: 'LATIN CAPITAL LETTER OU', +547: 'LATIN SMALL LETTER OU', +548: 'LATIN CAPITAL LETTER Z WITH HOOK', +549: 'LATIN SMALL LETTER Z WITH HOOK', +550: 'LATIN CAPITAL LETTER A WITH DOT ABOVE', +551: 'LATIN SMALL LETTER A WITH DOT ABOVE', +552: 'LATIN CAPITAL LETTER E WITH CEDILLA', +553: 'LATIN SMALL LETTER E WITH CEDILLA', +554: 'LATIN CAPITAL LETTER O WITH DIAERESIS AND MACRON', +555: 'LATIN SMALL LETTER O WITH DIAERESIS AND MACRON', +556: 'LATIN CAPITAL LETTER O WITH TILDE AND MACRON', +557: 'LATIN SMALL LETTER O WITH TILDE AND MACRON', +558: 'LATIN CAPITAL LETTER O WITH DOT ABOVE', +559: 'LATIN SMALL LETTER O WITH DOT ABOVE', +560: 'LATIN CAPITAL LETTER O WITH DOT ABOVE AND MACRON', +561: 'LATIN SMALL LETTER O WITH DOT ABOVE AND MACRON', +562: 'LATIN CAPITAL LETTER Y WITH MACRON', +563: 'LATIN SMALL LETTER Y WITH MACRON', +592: 'LATIN SMALL LETTER TURNED A', +593: 'LATIN SMALL LETTER ALPHA', +594: 'LATIN SMALL LETTER TURNED ALPHA', +595: 'LATIN SMALL LETTER B WITH HOOK', +596: 'LATIN SMALL LETTER OPEN O', +597: 'LATIN SMALL LETTER C WITH CURL', +598: 'LATIN SMALL LETTER D WITH TAIL', +599: 'LATIN SMALL LETTER D WITH HOOK', +600: 'LATIN SMALL LETTER REVERSED E', +601: 'LATIN SMALL LETTER SCHWA', +602: 'LATIN SMALL LETTER SCHWA WITH HOOK', +603: 'LATIN SMALL LETTER OPEN E', +604: 'LATIN SMALL LETTER REVERSED OPEN E', +605: 'LATIN SMALL LETTER REVERSED OPEN E WITH HOOK', +606: 'LATIN SMALL LETTER CLOSED REVERSED OPEN E', +607: 'LATIN SMALL LETTER DOTLESS J WITH STROKE', +608: 'LATIN SMALL LETTER G WITH HOOK', +609: 'LATIN SMALL LETTER SCRIPT G', +610: 'LATIN LETTER SMALL CAPITAL G', +611: 'LATIN SMALL LETTER GAMMA', +612: 'LATIN SMALL LETTER RAMS HORN', +613: 'LATIN SMALL LETTER TURNED H', +614: 'LATIN SMALL LETTER H WITH HOOK', +615: 'LATIN SMALL LETTER HENG WITH HOOK', +616: 'LATIN SMALL LETTER I WITH STROKE', +617: 'LATIN SMALL LETTER IOTA', +618: 'LATIN LETTER SMALL CAPITAL I', +619: 'LATIN SMALL LETTER L WITH MIDDLE TILDE', +620: 'LATIN SMALL LETTER L WITH BELT', +621: 'LATIN SMALL LETTER L WITH RETROFLEX HOOK', +622: 'LATIN SMALL LETTER LEZH', +623: 'LATIN SMALL LETTER TURNED M', +624: 'LATIN SMALL LETTER TURNED M WITH LONG LEG', +625: 'LATIN SMALL LETTER M WITH HOOK', +626: 'LATIN SMALL LETTER N WITH LEFT HOOK', +627: 'LATIN SMALL LETTER N WITH RETROFLEX HOOK', +628: 'LATIN LETTER SMALL CAPITAL N', +629: 'LATIN SMALL LETTER BARRED O', +630: 'LATIN LETTER SMALL CAPITAL OE', +631: 'LATIN SMALL LETTER CLOSED OMEGA', +632: 'LATIN SMALL LETTER PHI', +633: 'LATIN SMALL LETTER TURNED R', +634: 'LATIN SMALL LETTER TURNED R WITH LONG LEG', +635: 'LATIN SMALL LETTER TURNED R WITH HOOK', +636: 'LATIN SMALL LETTER R WITH LONG LEG', +637: 'LATIN SMALL LETTER R WITH TAIL', +638: 'LATIN SMALL LETTER R WITH FISHHOOK', +639: 'LATIN SMALL LETTER REVERSED R WITH FISHHOOK', +640: 'LATIN LETTER SMALL CAPITAL R', +641: 'LATIN LETTER SMALL CAPITAL INVERTED R', +642: 'LATIN SMALL LETTER S WITH HOOK', +643: 'LATIN SMALL LETTER ESH', +644: 'LATIN SMALL LETTER DOTLESS J WITH STROKE AND HOOK', +645: 'LATIN SMALL LETTER SQUAT REVERSED ESH', +646: 'LATIN SMALL LETTER ESH WITH CURL', +647: 'LATIN SMALL LETTER TURNED T', +648: 'LATIN SMALL LETTER T WITH RETROFLEX HOOK', +649: 'LATIN SMALL LETTER U BAR', +650: 'LATIN SMALL LETTER UPSILON', +651: 'LATIN SMALL LETTER V WITH HOOK', +652: 'LATIN SMALL LETTER TURNED V', +653: 'LATIN SMALL LETTER TURNED W', +654: 'LATIN SMALL LETTER TURNED Y', +655: 'LATIN LETTER SMALL CAPITAL Y', +656: 'LATIN SMALL LETTER Z WITH RETROFLEX HOOK', +657: 'LATIN SMALL LETTER Z WITH CURL', +658: 'LATIN SMALL LETTER EZH', +659: 'LATIN SMALL LETTER EZH WITH CURL', +660: 'LATIN LETTER GLOTTAL STOP', +661: 'LATIN LETTER PHARYNGEAL VOICED FRICATIVE', +662: 'LATIN LETTER INVERTED GLOTTAL STOP', +663: 'LATIN LETTER STRETCHED C', +664: 'LATIN LETTER BILABIAL CLICK', +665: 'LATIN LETTER SMALL CAPITAL B', +666: 'LATIN SMALL LETTER CLOSED OPEN E', +667: 'LATIN LETTER SMALL CAPITAL G WITH HOOK', +668: 'LATIN LETTER SMALL CAPITAL H', +669: 'LATIN SMALL LETTER J WITH CROSSED-TAIL', +670: 'LATIN SMALL LETTER TURNED K', +671: 'LATIN LETTER SMALL CAPITAL L', +672: 'LATIN SMALL LETTER Q WITH HOOK', +673: 'LATIN LETTER GLOTTAL STOP WITH STROKE', +674: 'LATIN LETTER REVERSED GLOTTAL STOP WITH STROKE', +675: 'LATIN SMALL LETTER DZ DIGRAPH', +676: 'LATIN SMALL LETTER DEZH DIGRAPH', +677: 'LATIN SMALL LETTER DZ DIGRAPH WITH CURL', +678: 'LATIN SMALL LETTER TS DIGRAPH', +679: 'LATIN SMALL LETTER TESH DIGRAPH', +680: 'LATIN SMALL LETTER TC DIGRAPH WITH CURL', +681: 'LATIN SMALL LETTER FENG DIGRAPH', +682: 'LATIN SMALL LETTER LS DIGRAPH', +683: 'LATIN SMALL LETTER LZ DIGRAPH', +684: 'LATIN LETTER BILABIAL PERCUSSIVE', +685: 'LATIN LETTER BIDENTAL PERCUSSIVE', +688: 'MODIFIER LETTER SMALL H', +689: 'MODIFIER LETTER SMALL H WITH HOOK', +690: 'MODIFIER LETTER SMALL J', +691: 'MODIFIER LETTER SMALL R', +692: 'MODIFIER LETTER SMALL TURNED R', +693: 'MODIFIER LETTER SMALL TURNED R WITH HOOK', +694: 'MODIFIER LETTER SMALL CAPITAL INVERTED R', +695: 'MODIFIER LETTER SMALL W', +696: 'MODIFIER LETTER SMALL Y', +697: 'MODIFIER LETTER PRIME', +698: 'MODIFIER LETTER DOUBLE PRIME', +699: 'MODIFIER LETTER TURNED COMMA', +700: 'MODIFIER LETTER APOSTROPHE', +701: 'MODIFIER LETTER REVERSED COMMA', +702: 'MODIFIER LETTER RIGHT HALF RING', +703: 'MODIFIER LETTER LEFT HALF RING', +704: 'MODIFIER LETTER GLOTTAL STOP', +705: 'MODIFIER LETTER REVERSED GLOTTAL STOP', +706: 'MODIFIER LETTER LEFT ARROWHEAD', +707: 'MODIFIER LETTER RIGHT ARROWHEAD', +708: 'MODIFIER LETTER UP ARROWHEAD', +709: 'MODIFIER LETTER DOWN ARROWHEAD', +710: 'MODIFIER LETTER CIRCUMFLEX ACCENT', +711: 'CARON', +712: 'MODIFIER LETTER VERTICAL LINE', +713: 'MODIFIER LETTER MACRON', +714: 'MODIFIER LETTER ACUTE ACCENT', +715: 'MODIFIER LETTER GRAVE ACCENT', +716: 'MODIFIER LETTER LOW VERTICAL LINE', +717: 'MODIFIER LETTER LOW MACRON', +718: 'MODIFIER LETTER LOW GRAVE ACCENT', +719: 'MODIFIER LETTER LOW ACUTE ACCENT', +720: 'MODIFIER LETTER TRIANGULAR COLON', +721: 'MODIFIER LETTER HALF TRIANGULAR COLON', +722: 'MODIFIER LETTER CENTRED RIGHT HALF RING', +723: 'MODIFIER LETTER CENTRED LEFT HALF RING', +724: 'MODIFIER LETTER UP TACK', +725: 'MODIFIER LETTER DOWN TACK', +726: 'MODIFIER LETTER PLUS SIGN', +727: 'MODIFIER LETTER MINUS SIGN', +728: 'BREVE', +729: 'DOT ABOVE', +730: 'RING ABOVE', +731: 'OGONEK', +732: 'SMALL TILDE', +733: 'DOUBLE ACUTE ACCENT', +734: 'MODIFIER LETTER RHOTIC HOOK', +735: 'MODIFIER LETTER CROSS ACCENT', +736: 'MODIFIER LETTER SMALL GAMMA', +737: 'MODIFIER LETTER SMALL L', +738: 'MODIFIER LETTER SMALL S', +739: 'MODIFIER LETTER SMALL X', +740: 'MODIFIER LETTER SMALL REVERSED GLOTTAL STOP', +741: 'MODIFIER LETTER EXTRA-HIGH TONE BAR', +742: 'MODIFIER LETTER HIGH TONE BAR', +743: 'MODIFIER LETTER MID TONE BAR', +744: 'MODIFIER LETTER LOW TONE BAR', +745: 'MODIFIER LETTER EXTRA-LOW TONE BAR', +746: 'MODIFIER LETTER YIN DEPARTING TONE MARK', +747: 'MODIFIER LETTER YANG DEPARTING TONE MARK', +748: 'MODIFIER LETTER VOICING', +749: 'MODIFIER LETTER UNASPIRATED', +750: 'MODIFIER LETTER DOUBLE APOSTROPHE', +768: 'COMBINING GRAVE ACCENT', +769: 'COMBINING ACUTE ACCENT', +770: 'COMBINING CIRCUMFLEX ACCENT', +771: 'COMBINING TILDE', +772: 'COMBINING MACRON', +773: 'COMBINING OVERLINE', +774: 'COMBINING BREVE', +775: 'COMBINING DOT ABOVE', +776: 'COMBINING DIAERESIS', +777: 'COMBINING HOOK ABOVE', +778: 'COMBINING RING ABOVE', +779: 'COMBINING DOUBLE ACUTE ACCENT', +780: 'COMBINING CARON', +781: 'COMBINING VERTICAL LINE ABOVE', +782: 'COMBINING DOUBLE VERTICAL LINE ABOVE', +783: 'COMBINING DOUBLE GRAVE ACCENT', +784: 'COMBINING CANDRABINDU', +785: 'COMBINING INVERTED BREVE', +786: 'COMBINING TURNED COMMA ABOVE', +787: 'COMBINING COMMA ABOVE', +788: 'COMBINING REVERSED COMMA ABOVE', +789: 'COMBINING COMMA ABOVE RIGHT', +790: 'COMBINING GRAVE ACCENT BELOW', +791: 'COMBINING ACUTE ACCENT BELOW', +792: 'COMBINING LEFT TACK BELOW', +793: 'COMBINING RIGHT TACK BELOW', +794: 'COMBINING LEFT ANGLE ABOVE', +795: 'COMBINING HORN', +796: 'COMBINING LEFT HALF RING BELOW', +797: 'COMBINING UP TACK BELOW', +798: 'COMBINING DOWN TACK BELOW', +799: 'COMBINING PLUS SIGN BELOW', +800: 'COMBINING MINUS SIGN BELOW', +801: 'COMBINING PALATALIZED HOOK BELOW', +802: 'COMBINING RETROFLEX HOOK BELOW', +803: 'COMBINING DOT BELOW', +804: 'COMBINING DIAERESIS BELOW', +805: 'COMBINING RING BELOW', +806: 'COMBINING COMMA BELOW', +807: 'COMBINING CEDILLA', +808: 'COMBINING OGONEK', +809: 'COMBINING VERTICAL LINE BELOW', +810: 'COMBINING BRIDGE BELOW', +811: 'COMBINING INVERTED DOUBLE ARCH BELOW', +812: 'COMBINING CARON BELOW', +813: 'COMBINING CIRCUMFLEX ACCENT BELOW', +814: 'COMBINING BREVE BELOW', +815: 'COMBINING INVERTED BREVE BELOW', +816: 'COMBINING TILDE BELOW', +817: 'COMBINING MACRON BELOW', +818: 'COMBINING LOW LINE', +819: 'COMBINING DOUBLE LOW LINE', +820: 'COMBINING TILDE OVERLAY', +821: 'COMBINING SHORT STROKE OVERLAY', +822: 'COMBINING LONG STROKE OVERLAY', +823: 'COMBINING SHORT SOLIDUS OVERLAY', +824: 'COMBINING LONG SOLIDUS OVERLAY', +825: 'COMBINING RIGHT HALF RING BELOW', +826: 'COMBINING INVERTED BRIDGE BELOW', +827: 'COMBINING SQUARE BELOW', +828: 'COMBINING SEAGULL BELOW', +829: 'COMBINING X ABOVE', +830: 'COMBINING VERTICAL TILDE', +831: 'COMBINING DOUBLE OVERLINE', +832: 'COMBINING GRAVE TONE MARK', +833: 'COMBINING ACUTE TONE MARK', +834: 'COMBINING GREEK PERISPOMENI', +835: 'COMBINING GREEK KORONIS', +836: 'COMBINING GREEK DIALYTIKA TONOS', +837: 'COMBINING GREEK YPOGEGRAMMENI', +838: 'COMBINING BRIDGE ABOVE', +839: 'COMBINING EQUALS SIGN BELOW', +840: 'COMBINING DOUBLE VERTICAL LINE BELOW', +841: 'COMBINING LEFT ANGLE BELOW', +842: 'COMBINING NOT TILDE ABOVE', +843: 'COMBINING HOMOTHETIC ABOVE', +844: 'COMBINING ALMOST EQUAL TO ABOVE', +845: 'COMBINING LEFT RIGHT ARROW BELOW', +846: 'COMBINING UPWARDS ARROW BELOW', +847: 'COMBINING GRAPHEME JOINER', +864: 'COMBINING DOUBLE TILDE', +865: 'COMBINING DOUBLE INVERTED BREVE', +866: 'COMBINING DOUBLE RIGHTWARDS ARROW BELOW', +867: 'COMBINING LATIN SMALL LETTER A', +868: 'COMBINING LATIN SMALL LETTER E', +869: 'COMBINING LATIN SMALL LETTER I', +870: 'COMBINING LATIN SMALL LETTER O', +871: 'COMBINING LATIN SMALL LETTER U', +872: 'COMBINING LATIN SMALL LETTER C', +873: 'COMBINING LATIN SMALL LETTER D', +874: 'COMBINING LATIN SMALL LETTER H', +875: 'COMBINING LATIN SMALL LETTER M', +876: 'COMBINING LATIN SMALL LETTER R', +877: 'COMBINING LATIN SMALL LETTER T', +878: 'COMBINING LATIN SMALL LETTER V', +879: 'COMBINING LATIN SMALL LETTER X', +884: 'GREEK NUMERAL SIGN', +885: 'GREEK LOWER NUMERAL SIGN', +890: 'GREEK YPOGEGRAMMENI', +894: 'GREEK QUESTION MARK', +900: 'GREEK TONOS', +901: 'GREEK DIALYTIKA TONOS', +902: 'GREEK CAPITAL LETTER ALPHA WITH TONOS', +903: 'GREEK ANO TELEIA', +904: 'GREEK CAPITAL LETTER EPSILON WITH TONOS', +905: 'GREEK CAPITAL LETTER ETA WITH TONOS', +906: 'GREEK CAPITAL LETTER IOTA WITH TONOS', +908: 'GREEK CAPITAL LETTER OMICRON WITH TONOS', +910: 'GREEK CAPITAL LETTER UPSILON WITH TONOS', +911: 'GREEK CAPITAL LETTER OMEGA WITH TONOS', +912: 'GREEK SMALL LETTER IOTA WITH DIALYTIKA AND TONOS', +913: 'GREEK CAPITAL LETTER ALPHA', +914: 'GREEK CAPITAL LETTER BETA', +915: 'GREEK CAPITAL LETTER GAMMA', +916: 'GREEK CAPITAL LETTER DELTA', +917: 'GREEK CAPITAL LETTER EPSILON', +918: 'GREEK CAPITAL LETTER ZETA', +919: 'GREEK CAPITAL LETTER ETA', +920: 'GREEK CAPITAL LETTER THETA', +921: 'GREEK CAPITAL LETTER IOTA', +922: 'GREEK CAPITAL LETTER KAPPA', +923: 'GREEK CAPITAL LETTER LAMDA', +924: 'GREEK CAPITAL LETTER MU', +925: 'GREEK CAPITAL LETTER NU', +926: 'GREEK CAPITAL LETTER XI', +927: 'GREEK CAPITAL LETTER OMICRON', +928: 'GREEK CAPITAL LETTER PI', +929: 'GREEK CAPITAL LETTER RHO', +931: 'GREEK CAPITAL LETTER SIGMA', +932: 'GREEK CAPITAL LETTER TAU', +933: 'GREEK CAPITAL LETTER UPSILON', +934: 'GREEK CAPITAL LETTER PHI', +935: 'GREEK CAPITAL LETTER CHI', +936: 'GREEK CAPITAL LETTER PSI', +937: 'GREEK CAPITAL LETTER OMEGA', +938: 'GREEK CAPITAL LETTER IOTA WITH DIALYTIKA', +939: 'GREEK CAPITAL LETTER UPSILON WITH DIALYTIKA', +940: 'GREEK SMALL LETTER ALPHA WITH TONOS', +941: 'GREEK SMALL LETTER EPSILON WITH TONOS', +942: 'GREEK SMALL LETTER ETA WITH TONOS', +943: 'GREEK SMALL LETTER IOTA WITH TONOS', +944: 'GREEK SMALL LETTER UPSILON WITH DIALYTIKA AND TONOS', +945: 'GREEK SMALL LETTER ALPHA', +946: 'GREEK SMALL LETTER BETA', +947: 'GREEK SMALL LETTER GAMMA', +948: 'GREEK SMALL LETTER DELTA', +949: 'GREEK SMALL LETTER EPSILON', +950: 'GREEK SMALL LETTER ZETA', +951: 'GREEK SMALL LETTER ETA', +952: 'GREEK SMALL LETTER THETA', +953: 'GREEK SMALL LETTER IOTA', +954: 'GREEK SMALL LETTER KAPPA', +955: 'GREEK SMALL LETTER LAMDA', +956: 'GREEK SMALL LETTER MU', +957: 'GREEK SMALL LETTER NU', +958: 'GREEK SMALL LETTER XI', +959: 'GREEK SMALL LETTER OMICRON', +960: 'GREEK SMALL LETTER PI', +961: 'GREEK SMALL LETTER RHO', +962: 'GREEK SMALL LETTER FINAL SIGMA', +963: 'GREEK SMALL LETTER SIGMA', +964: 'GREEK SMALL LETTER TAU', +965: 'GREEK SMALL LETTER UPSILON', +966: 'GREEK SMALL LETTER PHI', +967: 'GREEK SMALL LETTER CHI', +968: 'GREEK SMALL LETTER PSI', +969: 'GREEK SMALL LETTER OMEGA', +970: 'GREEK SMALL LETTER IOTA WITH DIALYTIKA', +971: 'GREEK SMALL LETTER UPSILON WITH DIALYTIKA', +972: 'GREEK SMALL LETTER OMICRON WITH TONOS', +973: 'GREEK SMALL LETTER UPSILON WITH TONOS', +974: 'GREEK SMALL LETTER OMEGA WITH TONOS', +976: 'GREEK BETA SYMBOL', +977: 'GREEK THETA SYMBOL', +978: 'GREEK UPSILON WITH HOOK SYMBOL', +979: 'GREEK UPSILON WITH ACUTE AND HOOK SYMBOL', +980: 'GREEK UPSILON WITH DIAERESIS AND HOOK SYMBOL', +981: 'GREEK PHI SYMBOL', +982: 'GREEK PI SYMBOL', +983: 'GREEK KAI SYMBOL', +984: 'GREEK LETTER ARCHAIC KOPPA', +985: 'GREEK SMALL LETTER ARCHAIC KOPPA', +986: 'GREEK LETTER STIGMA', +987: 'GREEK SMALL LETTER STIGMA', +988: 'GREEK LETTER DIGAMMA', +989: 'GREEK SMALL LETTER DIGAMMA', +990: 'GREEK LETTER KOPPA', +991: 'GREEK SMALL LETTER KOPPA', +992: 'GREEK LETTER SAMPI', +993: 'GREEK SMALL LETTER SAMPI', +994: 'COPTIC CAPITAL LETTER SHEI', +995: 'COPTIC SMALL LETTER SHEI', +996: 'COPTIC CAPITAL LETTER FEI', +997: 'COPTIC SMALL LETTER FEI', +998: 'COPTIC CAPITAL LETTER KHEI', +999: 'COPTIC SMALL LETTER KHEI', +1000: 'COPTIC CAPITAL LETTER HORI', +1001: 'COPTIC SMALL LETTER HORI', +1002: 'COPTIC CAPITAL LETTER GANGIA', +1003: 'COPTIC SMALL LETTER GANGIA', +1004: 'COPTIC CAPITAL LETTER SHIMA', +1005: 'COPTIC SMALL LETTER SHIMA', +1006: 'COPTIC CAPITAL LETTER DEI', +1007: 'COPTIC SMALL LETTER DEI', +1008: 'GREEK KAPPA SYMBOL', +1009: 'GREEK RHO SYMBOL', +1010: 'GREEK LUNATE SIGMA SYMBOL', +1011: 'GREEK LETTER YOT', +1012: 'GREEK CAPITAL THETA SYMBOL', +1013: 'GREEK LUNATE EPSILON SYMBOL', +1014: 'GREEK REVERSED LUNATE EPSILON SYMBOL', +1024: 'CYRILLIC CAPITAL LETTER IE WITH GRAVE', +1025: 'CYRILLIC CAPITAL LETTER IO', +1026: 'CYRILLIC CAPITAL LETTER DJE', +1027: 'CYRILLIC CAPITAL LETTER GJE', +1028: 'CYRILLIC CAPITAL LETTER UKRAINIAN IE', +1029: 'CYRILLIC CAPITAL LETTER DZE', +1030: 'CYRILLIC CAPITAL LETTER BYELORUSSIAN-UKRAINIAN I', +1031: 'CYRILLIC CAPITAL LETTER YI', +1032: 'CYRILLIC CAPITAL LETTER JE', +1033: 'CYRILLIC CAPITAL LETTER LJE', +1034: 'CYRILLIC CAPITAL LETTER NJE', +1035: 'CYRILLIC CAPITAL LETTER TSHE', +1036: 'CYRILLIC CAPITAL LETTER KJE', +1037: 'CYRILLIC CAPITAL LETTER I WITH GRAVE', +1038: 'CYRILLIC CAPITAL LETTER SHORT U', +1039: 'CYRILLIC CAPITAL LETTER DZHE', +1040: 'CYRILLIC CAPITAL LETTER A', +1041: 'CYRILLIC CAPITAL LETTER BE', +1042: 'CYRILLIC CAPITAL LETTER VE', +1043: 'CYRILLIC CAPITAL LETTER GHE', +1044: 'CYRILLIC CAPITAL LETTER DE', +1045: 'CYRILLIC CAPITAL LETTER IE', +1046: 'CYRILLIC CAPITAL LETTER ZHE', +1047: 'CYRILLIC CAPITAL LETTER ZE', +1048: 'CYRILLIC CAPITAL LETTER I', +1049: 'CYRILLIC CAPITAL LETTER SHORT I', +1050: 'CYRILLIC CAPITAL LETTER KA', +1051: 'CYRILLIC CAPITAL LETTER EL', +1052: 'CYRILLIC CAPITAL LETTER EM', +1053: 'CYRILLIC CAPITAL LETTER EN', +1054: 'CYRILLIC CAPITAL LETTER O', +1055: 'CYRILLIC CAPITAL LETTER PE', +1056: 'CYRILLIC CAPITAL LETTER ER', +1057: 'CYRILLIC CAPITAL LETTER ES', +1058: 'CYRILLIC CAPITAL LETTER TE', +1059: 'CYRILLIC CAPITAL LETTER U', +1060: 'CYRILLIC CAPITAL LETTER EF', +1061: 'CYRILLIC CAPITAL LETTER HA', +1062: 'CYRILLIC CAPITAL LETTER TSE', +1063: 'CYRILLIC CAPITAL LETTER CHE', +1064: 'CYRILLIC CAPITAL LETTER SHA', +1065: 'CYRILLIC CAPITAL LETTER SHCHA', +1066: 'CYRILLIC CAPITAL LETTER HARD SIGN', +1067: 'CYRILLIC CAPITAL LETTER YERU', +1068: 'CYRILLIC CAPITAL LETTER SOFT SIGN', +1069: 'CYRILLIC CAPITAL LETTER E', +1070: 'CYRILLIC CAPITAL LETTER YU', +1071: 'CYRILLIC CAPITAL LETTER YA', +1072: 'CYRILLIC SMALL LETTER A', +1073: 'CYRILLIC SMALL LETTER BE', +1074: 'CYRILLIC SMALL LETTER VE', +1075: 'CYRILLIC SMALL LETTER GHE', +1076: 'CYRILLIC SMALL LETTER DE', +1077: 'CYRILLIC SMALL LETTER IE', +1078: 'CYRILLIC SMALL LETTER ZHE', +1079: 'CYRILLIC SMALL LETTER ZE', +1080: 'CYRILLIC SMALL LETTER I', +1081: 'CYRILLIC SMALL LETTER SHORT I', +1082: 'CYRILLIC SMALL LETTER KA', +1083: 'CYRILLIC SMALL LETTER EL', +1084: 'CYRILLIC SMALL LETTER EM', +1085: 'CYRILLIC SMALL LETTER EN', +1086: 'CYRILLIC SMALL LETTER O', +1087: 'CYRILLIC SMALL LETTER PE', +1088: 'CYRILLIC SMALL LETTER ER', +1089: 'CYRILLIC SMALL LETTER ES', +1090: 'CYRILLIC SMALL LETTER TE', +1091: 'CYRILLIC SMALL LETTER U', +1092: 'CYRILLIC SMALL LETTER EF', +1093: 'CYRILLIC SMALL LETTER HA', +1094: 'CYRILLIC SMALL LETTER TSE', +1095: 'CYRILLIC SMALL LETTER CHE', +1096: 'CYRILLIC SMALL LETTER SHA', +1097: 'CYRILLIC SMALL LETTER SHCHA', +1098: 'CYRILLIC SMALL LETTER HARD SIGN', +1099: 'CYRILLIC SMALL LETTER YERU', +1100: 'CYRILLIC SMALL LETTER SOFT SIGN', +1101: 'CYRILLIC SMALL LETTER E', +1102: 'CYRILLIC SMALL LETTER YU', +1103: 'CYRILLIC SMALL LETTER YA', +1104: 'CYRILLIC SMALL LETTER IE WITH GRAVE', +1105: 'CYRILLIC SMALL LETTER IO', +1106: 'CYRILLIC SMALL LETTER DJE', +1107: 'CYRILLIC SMALL LETTER GJE', +1108: 'CYRILLIC SMALL LETTER UKRAINIAN IE', +1109: 'CYRILLIC SMALL LETTER DZE', +1110: 'CYRILLIC SMALL LETTER BYELORUSSIAN-UKRAINIAN I', +1111: 'CYRILLIC SMALL LETTER YI', +1112: 'CYRILLIC SMALL LETTER JE', +1113: 'CYRILLIC SMALL LETTER LJE', +1114: 'CYRILLIC SMALL LETTER NJE', +1115: 'CYRILLIC SMALL LETTER TSHE', +1116: 'CYRILLIC SMALL LETTER KJE', +1117: 'CYRILLIC SMALL LETTER I WITH GRAVE', +1118: 'CYRILLIC SMALL LETTER SHORT U', +1119: 'CYRILLIC SMALL LETTER DZHE', +1120: 'CYRILLIC CAPITAL LETTER OMEGA', +1121: 'CYRILLIC SMALL LETTER OMEGA', +1122: 'CYRILLIC CAPITAL LETTER YAT', +1123: 'CYRILLIC SMALL LETTER YAT', +1124: 'CYRILLIC CAPITAL LETTER IOTIFIED E', +1125: 'CYRILLIC SMALL LETTER IOTIFIED E', +1126: 'CYRILLIC CAPITAL LETTER LITTLE YUS', +1127: 'CYRILLIC SMALL LETTER LITTLE YUS', +1128: 'CYRILLIC CAPITAL LETTER IOTIFIED LITTLE YUS', +1129: 'CYRILLIC SMALL LETTER IOTIFIED LITTLE YUS', +1130: 'CYRILLIC CAPITAL LETTER BIG YUS', +1131: 'CYRILLIC SMALL LETTER BIG YUS', +1132: 'CYRILLIC CAPITAL LETTER IOTIFIED BIG YUS', +1133: 'CYRILLIC SMALL LETTER IOTIFIED BIG YUS', +1134: 'CYRILLIC CAPITAL LETTER KSI', +1135: 'CYRILLIC SMALL LETTER KSI', +1136: 'CYRILLIC CAPITAL LETTER PSI', +1137: 'CYRILLIC SMALL LETTER PSI', +1138: 'CYRILLIC CAPITAL LETTER FITA', +1139: 'CYRILLIC SMALL LETTER FITA', +1140: 'CYRILLIC CAPITAL LETTER IZHITSA', +1141: 'CYRILLIC SMALL LETTER IZHITSA', +1142: 'CYRILLIC CAPITAL LETTER IZHITSA WITH DOUBLE GRAVE ACCENT', +1143: 'CYRILLIC SMALL LETTER IZHITSA WITH DOUBLE GRAVE ACCENT', +1144: 'CYRILLIC CAPITAL LETTER UK', +1145: 'CYRILLIC SMALL LETTER UK', +1146: 'CYRILLIC CAPITAL LETTER ROUND OMEGA', +1147: 'CYRILLIC SMALL LETTER ROUND OMEGA', +1148: 'CYRILLIC CAPITAL LETTER OMEGA WITH TITLO', +1149: 'CYRILLIC SMALL LETTER OMEGA WITH TITLO', +1150: 'CYRILLIC CAPITAL LETTER OT', +1151: 'CYRILLIC SMALL LETTER OT', +1152: 'CYRILLIC CAPITAL LETTER KOPPA', +1153: 'CYRILLIC SMALL LETTER KOPPA', +1154: 'CYRILLIC THOUSANDS SIGN', +1155: 'COMBINING CYRILLIC TITLO', +1156: 'COMBINING CYRILLIC PALATALIZATION', +1157: 'COMBINING CYRILLIC DASIA PNEUMATA', +1158: 'COMBINING CYRILLIC PSILI PNEUMATA', +1160: 'COMBINING CYRILLIC HUNDRED THOUSANDS SIGN', +1161: 'COMBINING CYRILLIC MILLIONS SIGN', +1162: 'CYRILLIC CAPITAL LETTER SHORT I WITH TAIL', +1163: 'CYRILLIC SMALL LETTER SHORT I WITH TAIL', +1164: 'CYRILLIC CAPITAL LETTER SEMISOFT SIGN', +1165: 'CYRILLIC SMALL LETTER SEMISOFT SIGN', +1166: 'CYRILLIC CAPITAL LETTER ER WITH TICK', +1167: 'CYRILLIC SMALL LETTER ER WITH TICK', +1168: 'CYRILLIC CAPITAL LETTER GHE WITH UPTURN', +1169: 'CYRILLIC SMALL LETTER GHE WITH UPTURN', +1170: 'CYRILLIC CAPITAL LETTER GHE WITH STROKE', +1171: 'CYRILLIC SMALL LETTER GHE WITH STROKE', +1172: 'CYRILLIC CAPITAL LETTER GHE WITH MIDDLE HOOK', +1173: 'CYRILLIC SMALL LETTER GHE WITH MIDDLE HOOK', +1174: 'CYRILLIC CAPITAL LETTER ZHE WITH DESCENDER', +1175: 'CYRILLIC SMALL LETTER ZHE WITH DESCENDER', +1176: 'CYRILLIC CAPITAL LETTER ZE WITH DESCENDER', +1177: 'CYRILLIC SMALL LETTER ZE WITH DESCENDER', +1178: 'CYRILLIC CAPITAL LETTER KA WITH DESCENDER', +1179: 'CYRILLIC SMALL LETTER KA WITH DESCENDER', +1180: 'CYRILLIC CAPITAL LETTER KA WITH VERTICAL STROKE', +1181: 'CYRILLIC SMALL LETTER KA WITH VERTICAL STROKE', +1182: 'CYRILLIC CAPITAL LETTER KA WITH STROKE', +1183: 'CYRILLIC SMALL LETTER KA WITH STROKE', +1184: 'CYRILLIC CAPITAL LETTER BASHKIR KA', +1185: 'CYRILLIC SMALL LETTER BASHKIR KA', +1186: 'CYRILLIC CAPITAL LETTER EN WITH DESCENDER', +1187: 'CYRILLIC SMALL LETTER EN WITH DESCENDER', +1188: 'CYRILLIC CAPITAL LIGATURE EN GHE', +1189: 'CYRILLIC SMALL LIGATURE EN GHE', +1190: 'CYRILLIC CAPITAL LETTER PE WITH MIDDLE HOOK', +1191: 'CYRILLIC SMALL LETTER PE WITH MIDDLE HOOK', +1192: 'CYRILLIC CAPITAL LETTER ABKHASIAN HA', +1193: 'CYRILLIC SMALL LETTER ABKHASIAN HA', +1194: 'CYRILLIC CAPITAL LETTER ES WITH DESCENDER', +1195: 'CYRILLIC SMALL LETTER ES WITH DESCENDER', +1196: 'CYRILLIC CAPITAL LETTER TE WITH DESCENDER', +1197: 'CYRILLIC SMALL LETTER TE WITH DESCENDER', +1198: 'CYRILLIC CAPITAL LETTER STRAIGHT U', +1199: 'CYRILLIC SMALL LETTER STRAIGHT U', +1200: 'CYRILLIC CAPITAL LETTER STRAIGHT U WITH STROKE', +1201: 'CYRILLIC SMALL LETTER STRAIGHT U WITH STROKE', +1202: 'CYRILLIC CAPITAL LETTER HA WITH DESCENDER', +1203: 'CYRILLIC SMALL LETTER HA WITH DESCENDER', +1204: 'CYRILLIC CAPITAL LIGATURE TE TSE', +1205: 'CYRILLIC SMALL LIGATURE TE TSE', +1206: 'CYRILLIC CAPITAL LETTER CHE WITH DESCENDER', +1207: 'CYRILLIC SMALL LETTER CHE WITH DESCENDER', +1208: 'CYRILLIC CAPITAL LETTER CHE WITH VERTICAL STROKE', +1209: 'CYRILLIC SMALL LETTER CHE WITH VERTICAL STROKE', +1210: 'CYRILLIC CAPITAL LETTER SHHA', +1211: 'CYRILLIC SMALL LETTER SHHA', +1212: 'CYRILLIC CAPITAL LETTER ABKHASIAN CHE', +1213: 'CYRILLIC SMALL LETTER ABKHASIAN CHE', +1214: 'CYRILLIC CAPITAL LETTER ABKHASIAN CHE WITH DESCENDER', +1215: 'CYRILLIC SMALL LETTER ABKHASIAN CHE WITH DESCENDER', +1216: 'CYRILLIC LETTER PALOCHKA', +1217: 'CYRILLIC CAPITAL LETTER ZHE WITH BREVE', +1218: 'CYRILLIC SMALL LETTER ZHE WITH BREVE', +1219: 'CYRILLIC CAPITAL LETTER KA WITH HOOK', +1220: 'CYRILLIC SMALL LETTER KA WITH HOOK', +1221: 'CYRILLIC CAPITAL LETTER EL WITH TAIL', +1222: 'CYRILLIC SMALL LETTER EL WITH TAIL', +1223: 'CYRILLIC CAPITAL LETTER EN WITH HOOK', +1224: 'CYRILLIC SMALL LETTER EN WITH HOOK', +1225: 'CYRILLIC CAPITAL LETTER EN WITH TAIL', +1226: 'CYRILLIC SMALL LETTER EN WITH TAIL', +1227: 'CYRILLIC CAPITAL LETTER KHAKASSIAN CHE', +1228: 'CYRILLIC SMALL LETTER KHAKASSIAN CHE', +1229: 'CYRILLIC CAPITAL LETTER EM WITH TAIL', +1230: 'CYRILLIC SMALL LETTER EM WITH TAIL', +1232: 'CYRILLIC CAPITAL LETTER A WITH BREVE', +1233: 'CYRILLIC SMALL LETTER A WITH BREVE', +1234: 'CYRILLIC CAPITAL LETTER A WITH DIAERESIS', +1235: 'CYRILLIC SMALL LETTER A WITH DIAERESIS', +1236: 'CYRILLIC CAPITAL LIGATURE A IE', +1237: 'CYRILLIC SMALL LIGATURE A IE', +1238: 'CYRILLIC CAPITAL LETTER IE WITH BREVE', +1239: 'CYRILLIC SMALL LETTER IE WITH BREVE', +1240: 'CYRILLIC CAPITAL LETTER SCHWA', +1241: 'CYRILLIC SMALL LETTER SCHWA', +1242: 'CYRILLIC CAPITAL LETTER SCHWA WITH DIAERESIS', +1243: 'CYRILLIC SMALL LETTER SCHWA WITH DIAERESIS', +1244: 'CYRILLIC CAPITAL LETTER ZHE WITH DIAERESIS', +1245: 'CYRILLIC SMALL LETTER ZHE WITH DIAERESIS', +1246: 'CYRILLIC CAPITAL LETTER ZE WITH DIAERESIS', +1247: 'CYRILLIC SMALL LETTER ZE WITH DIAERESIS', +1248: 'CYRILLIC CAPITAL LETTER ABKHASIAN DZE', +1249: 'CYRILLIC SMALL LETTER ABKHASIAN DZE', +1250: 'CYRILLIC CAPITAL LETTER I WITH MACRON', +1251: 'CYRILLIC SMALL LETTER I WITH MACRON', +1252: 'CYRILLIC CAPITAL LETTER I WITH DIAERESIS', +1253: 'CYRILLIC SMALL LETTER I WITH DIAERESIS', +1254: 'CYRILLIC CAPITAL LETTER O WITH DIAERESIS', +1255: 'CYRILLIC SMALL LETTER O WITH DIAERESIS', +1256: 'CYRILLIC CAPITAL LETTER BARRED O', +1257: 'CYRILLIC SMALL LETTER BARRED O', +1258: 'CYRILLIC CAPITAL LETTER BARRED O WITH DIAERESIS', +1259: 'CYRILLIC SMALL LETTER BARRED O WITH DIAERESIS', +1260: 'CYRILLIC CAPITAL LETTER E WITH DIAERESIS', +1261: 'CYRILLIC SMALL LETTER E WITH DIAERESIS', +1262: 'CYRILLIC CAPITAL LETTER U WITH MACRON', +1263: 'CYRILLIC SMALL LETTER U WITH MACRON', +1264: 'CYRILLIC CAPITAL LETTER U WITH DIAERESIS', +1265: 'CYRILLIC SMALL LETTER U WITH DIAERESIS', +1266: 'CYRILLIC CAPITAL LETTER U WITH DOUBLE ACUTE', +1267: 'CYRILLIC SMALL LETTER U WITH DOUBLE ACUTE', +1268: 'CYRILLIC CAPITAL LETTER CHE WITH DIAERESIS', +1269: 'CYRILLIC SMALL LETTER CHE WITH DIAERESIS', +1272: 'CYRILLIC CAPITAL LETTER YERU WITH DIAERESIS', +1273: 'CYRILLIC SMALL LETTER YERU WITH DIAERESIS', +1280: 'CYRILLIC CAPITAL LETTER KOMI DE', +1281: 'CYRILLIC SMALL LETTER KOMI DE', +1282: 'CYRILLIC CAPITAL LETTER KOMI DJE', +1283: 'CYRILLIC SMALL LETTER KOMI DJE', +1284: 'CYRILLIC CAPITAL LETTER KOMI ZJE', +1285: 'CYRILLIC SMALL LETTER KOMI ZJE', +1286: 'CYRILLIC CAPITAL LETTER KOMI DZJE', +1287: 'CYRILLIC SMALL LETTER KOMI DZJE', +1288: 'CYRILLIC CAPITAL LETTER KOMI LJE', +1289: 'CYRILLIC SMALL LETTER KOMI LJE', +1290: 'CYRILLIC CAPITAL LETTER KOMI NJE', +1291: 'CYRILLIC SMALL LETTER KOMI NJE', +1292: 'CYRILLIC CAPITAL LETTER KOMI SJE', +1293: 'CYRILLIC SMALL LETTER KOMI SJE', +1294: 'CYRILLIC CAPITAL LETTER KOMI TJE', +1295: 'CYRILLIC SMALL LETTER KOMI TJE', +1329: 'ARMENIAN CAPITAL LETTER AYB', +1330: 'ARMENIAN CAPITAL LETTER BEN', +1331: 'ARMENIAN CAPITAL LETTER GIM', +1332: 'ARMENIAN CAPITAL LETTER DA', +1333: 'ARMENIAN CAPITAL LETTER ECH', +1334: 'ARMENIAN CAPITAL LETTER ZA', +1335: 'ARMENIAN CAPITAL LETTER EH', +1336: 'ARMENIAN CAPITAL LETTER ET', +1337: 'ARMENIAN CAPITAL LETTER TO', +1338: 'ARMENIAN CAPITAL LETTER ZHE', +1339: 'ARMENIAN CAPITAL LETTER INI', +1340: 'ARMENIAN CAPITAL LETTER LIWN', +1341: 'ARMENIAN CAPITAL LETTER XEH', +1342: 'ARMENIAN CAPITAL LETTER CA', +1343: 'ARMENIAN CAPITAL LETTER KEN', +1344: 'ARMENIAN CAPITAL LETTER HO', +1345: 'ARMENIAN CAPITAL LETTER JA', +1346: 'ARMENIAN CAPITAL LETTER GHAD', +1347: 'ARMENIAN CAPITAL LETTER CHEH', +1348: 'ARMENIAN CAPITAL LETTER MEN', +1349: 'ARMENIAN CAPITAL LETTER YI', +1350: 'ARMENIAN CAPITAL LETTER NOW', +1351: 'ARMENIAN CAPITAL LETTER SHA', +1352: 'ARMENIAN CAPITAL LETTER VO', +1353: 'ARMENIAN CAPITAL LETTER CHA', +1354: 'ARMENIAN CAPITAL LETTER PEH', +1355: 'ARMENIAN CAPITAL LETTER JHEH', +1356: 'ARMENIAN CAPITAL LETTER RA', +1357: 'ARMENIAN CAPITAL LETTER SEH', +1358: 'ARMENIAN CAPITAL LETTER VEW', +1359: 'ARMENIAN CAPITAL LETTER TIWN', +1360: 'ARMENIAN CAPITAL LETTER REH', +1361: 'ARMENIAN CAPITAL LETTER CO', +1362: 'ARMENIAN CAPITAL LETTER YIWN', +1363: 'ARMENIAN CAPITAL LETTER PIWR', +1364: 'ARMENIAN CAPITAL LETTER KEH', +1365: 'ARMENIAN CAPITAL LETTER OH', +1366: 'ARMENIAN CAPITAL LETTER FEH', +1369: 'ARMENIAN MODIFIER LETTER LEFT HALF RING', +1370: 'ARMENIAN APOSTROPHE', +1371: 'ARMENIAN EMPHASIS MARK', +1372: 'ARMENIAN EXCLAMATION MARK', +1373: 'ARMENIAN COMMA', +1374: 'ARMENIAN QUESTION MARK', +1375: 'ARMENIAN ABBREVIATION MARK', +1377: 'ARMENIAN SMALL LETTER AYB', +1378: 'ARMENIAN SMALL LETTER BEN', +1379: 'ARMENIAN SMALL LETTER GIM', +1380: 'ARMENIAN SMALL LETTER DA', +1381: 'ARMENIAN SMALL LETTER ECH', +1382: 'ARMENIAN SMALL LETTER ZA', +1383: 'ARMENIAN SMALL LETTER EH', +1384: 'ARMENIAN SMALL LETTER ET', +1385: 'ARMENIAN SMALL LETTER TO', +1386: 'ARMENIAN SMALL LETTER ZHE', +1387: 'ARMENIAN SMALL LETTER INI', +1388: 'ARMENIAN SMALL LETTER LIWN', +1389: 'ARMENIAN SMALL LETTER XEH', +1390: 'ARMENIAN SMALL LETTER CA', +1391: 'ARMENIAN SMALL LETTER KEN', +1392: 'ARMENIAN SMALL LETTER HO', +1393: 'ARMENIAN SMALL LETTER JA', +1394: 'ARMENIAN SMALL LETTER GHAD', +1395: 'ARMENIAN SMALL LETTER CHEH', +1396: 'ARMENIAN SMALL LETTER MEN', +1397: 'ARMENIAN SMALL LETTER YI', +1398: 'ARMENIAN SMALL LETTER NOW', +1399: 'ARMENIAN SMALL LETTER SHA', +1400: 'ARMENIAN SMALL LETTER VO', +1401: 'ARMENIAN SMALL LETTER CHA', +1402: 'ARMENIAN SMALL LETTER PEH', +1403: 'ARMENIAN SMALL LETTER JHEH', +1404: 'ARMENIAN SMALL LETTER RA', +1405: 'ARMENIAN SMALL LETTER SEH', +1406: 'ARMENIAN SMALL LETTER VEW', +1407: 'ARMENIAN SMALL LETTER TIWN', +1408: 'ARMENIAN SMALL LETTER REH', +1409: 'ARMENIAN SMALL LETTER CO', +1410: 'ARMENIAN SMALL LETTER YIWN', +1411: 'ARMENIAN SMALL LETTER PIWR', +1412: 'ARMENIAN SMALL LETTER KEH', +1413: 'ARMENIAN SMALL LETTER OH', +1414: 'ARMENIAN SMALL LETTER FEH', +1415: 'ARMENIAN SMALL LIGATURE ECH YIWN', +1417: 'ARMENIAN FULL STOP', +1418: 'ARMENIAN HYPHEN', +1425: 'HEBREW ACCENT ETNAHTA', +1426: 'HEBREW ACCENT SEGOL', +1427: 'HEBREW ACCENT SHALSHELET', +1428: 'HEBREW ACCENT ZAQEF QATAN', +1429: 'HEBREW ACCENT ZAQEF GADOL', +1430: 'HEBREW ACCENT TIPEHA', +1431: 'HEBREW ACCENT REVIA', +1432: 'HEBREW ACCENT ZARQA', +1433: 'HEBREW ACCENT PASHTA', +1434: 'HEBREW ACCENT YETIV', +1435: 'HEBREW ACCENT TEVIR', +1436: 'HEBREW ACCENT GERESH', +1437: 'HEBREW ACCENT GERESH MUQDAM', +1438: 'HEBREW ACCENT GERSHAYIM', +1439: 'HEBREW ACCENT QARNEY PARA', +1440: 'HEBREW ACCENT TELISHA GEDOLA', +1441: 'HEBREW ACCENT PAZER', +1443: 'HEBREW ACCENT MUNAH', +1444: 'HEBREW ACCENT MAHAPAKH', +1445: 'HEBREW ACCENT MERKHA', +1446: 'HEBREW ACCENT MERKHA KEFULA', +1447: 'HEBREW ACCENT DARGA', +1448: 'HEBREW ACCENT QADMA', +1449: 'HEBREW ACCENT TELISHA QETANA', +1450: 'HEBREW ACCENT YERAH BEN YOMO', +1451: 'HEBREW ACCENT OLE', +1452: 'HEBREW ACCENT ILUY', +1453: 'HEBREW ACCENT DEHI', +1454: 'HEBREW ACCENT ZINOR', +1455: 'HEBREW MARK MASORA CIRCLE', +1456: 'HEBREW POINT SHEVA', +1457: 'HEBREW POINT HATAF SEGOL', +1458: 'HEBREW POINT HATAF PATAH', +1459: 'HEBREW POINT HATAF QAMATS', +1460: 'HEBREW POINT HIRIQ', +1461: 'HEBREW POINT TSERE', +1462: 'HEBREW POINT SEGOL', +1463: 'HEBREW POINT PATAH', +1464: 'HEBREW POINT QAMATS', +1465: 'HEBREW POINT HOLAM', +1467: 'HEBREW POINT QUBUTS', +1468: 'HEBREW POINT DAGESH OR MAPIQ', +1469: 'HEBREW POINT METEG', +1470: 'HEBREW PUNCTUATION MAQAF', +1471: 'HEBREW POINT RAFE', +1472: 'HEBREW PUNCTUATION PASEQ', +1473: 'HEBREW POINT SHIN DOT', +1474: 'HEBREW POINT SIN DOT', +1475: 'HEBREW PUNCTUATION SOF PASUQ', +1476: 'HEBREW MARK UPPER DOT', +1488: 'HEBREW LETTER ALEF', +1489: 'HEBREW LETTER BET', +1490: 'HEBREW LETTER GIMEL', +1491: 'HEBREW LETTER DALET', +1492: 'HEBREW LETTER HE', +1493: 'HEBREW LETTER VAV', +1494: 'HEBREW LETTER ZAYIN', +1495: 'HEBREW LETTER HET', +1496: 'HEBREW LETTER TET', +1497: 'HEBREW LETTER YOD', +1498: 'HEBREW LETTER FINAL KAF', +1499: 'HEBREW LETTER KAF', +1500: 'HEBREW LETTER LAMED', +1501: 'HEBREW LETTER FINAL MEM', +1502: 'HEBREW LETTER MEM', +1503: 'HEBREW LETTER FINAL NUN', +1504: 'HEBREW LETTER NUN', +1505: 'HEBREW LETTER SAMEKH', +1506: 'HEBREW LETTER AYIN', +1507: 'HEBREW LETTER FINAL PE', +1508: 'HEBREW LETTER PE', +1509: 'HEBREW LETTER FINAL TSADI', +1510: 'HEBREW LETTER TSADI', +1511: 'HEBREW LETTER QOF', +1512: 'HEBREW LETTER RESH', +1513: 'HEBREW LETTER SHIN', +1514: 'HEBREW LETTER TAV', +1520: 'HEBREW LIGATURE YIDDISH DOUBLE VAV', +1521: 'HEBREW LIGATURE YIDDISH VAV YOD', +1522: 'HEBREW LIGATURE YIDDISH DOUBLE YOD', +1523: 'HEBREW PUNCTUATION GERESH', +1524: 'HEBREW PUNCTUATION GERSHAYIM', +1548: 'ARABIC COMMA', +1563: 'ARABIC SEMICOLON', +1567: 'ARABIC QUESTION MARK', +1569: 'ARABIC LETTER HAMZA', +1570: 'ARABIC LETTER ALEF WITH MADDA ABOVE', +1571: 'ARABIC LETTER ALEF WITH HAMZA ABOVE', +1572: 'ARABIC LETTER WAW WITH HAMZA ABOVE', +1573: 'ARABIC LETTER ALEF WITH HAMZA BELOW', +1574: 'ARABIC LETTER YEH WITH HAMZA ABOVE', +1575: 'ARABIC LETTER ALEF', +1576: 'ARABIC LETTER BEH', +1577: 'ARABIC LETTER TEH MARBUTA', +1578: 'ARABIC LETTER TEH', +1579: 'ARABIC LETTER THEH', +1580: 'ARABIC LETTER JEEM', +1581: 'ARABIC LETTER HAH', +1582: 'ARABIC LETTER KHAH', +1583: 'ARABIC LETTER DAL', +1584: 'ARABIC LETTER THAL', +1585: 'ARABIC LETTER REH', +1586: 'ARABIC LETTER ZAIN', +1587: 'ARABIC LETTER SEEN', +1588: 'ARABIC LETTER SHEEN', +1589: 'ARABIC LETTER SAD', +1590: 'ARABIC LETTER DAD', +1591: 'ARABIC LETTER TAH', +1592: 'ARABIC LETTER ZAH', +1593: 'ARABIC LETTER AIN', +1594: 'ARABIC LETTER GHAIN', +1600: 'ARABIC TATWEEL', +1601: 'ARABIC LETTER FEH', +1602: 'ARABIC LETTER QAF', +1603: 'ARABIC LETTER KAF', +1604: 'ARABIC LETTER LAM', +1605: 'ARABIC LETTER MEEM', +1606: 'ARABIC LETTER NOON', +1607: 'ARABIC LETTER HEH', +1608: 'ARABIC LETTER WAW', +1609: 'ARABIC LETTER ALEF MAKSURA', +1610: 'ARABIC LETTER YEH', +1611: 'ARABIC FATHATAN', +1612: 'ARABIC DAMMATAN', +1613: 'ARABIC KASRATAN', +1614: 'ARABIC FATHA', +1615: 'ARABIC DAMMA', +1616: 'ARABIC KASRA', +1617: 'ARABIC SHADDA', +1618: 'ARABIC SUKUN', +1619: 'ARABIC MADDAH ABOVE', +1620: 'ARABIC HAMZA ABOVE', +1621: 'ARABIC HAMZA BELOW', +1632: 'ARABIC-INDIC DIGIT ZERO', +1633: 'ARABIC-INDIC DIGIT ONE', +1634: 'ARABIC-INDIC DIGIT TWO', +1635: 'ARABIC-INDIC DIGIT THREE', +1636: 'ARABIC-INDIC DIGIT FOUR', +1637: 'ARABIC-INDIC DIGIT FIVE', +1638: 'ARABIC-INDIC DIGIT SIX', +1639: 'ARABIC-INDIC DIGIT SEVEN', +1640: 'ARABIC-INDIC DIGIT EIGHT', +1641: 'ARABIC-INDIC DIGIT NINE', +1642: 'ARABIC PERCENT SIGN', +1643: 'ARABIC DECIMAL SEPARATOR', +1644: 'ARABIC THOUSANDS SEPARATOR', +1645: 'ARABIC FIVE POINTED STAR', +1646: 'ARABIC LETTER DOTLESS BEH', +1647: 'ARABIC LETTER DOTLESS QAF', +1648: 'ARABIC LETTER SUPERSCRIPT ALEF', +1649: 'ARABIC LETTER ALEF WASLA', +1650: 'ARABIC LETTER ALEF WITH WAVY HAMZA ABOVE', +1651: 'ARABIC LETTER ALEF WITH WAVY HAMZA BELOW', +1652: 'ARABIC LETTER HIGH HAMZA', +1653: 'ARABIC LETTER HIGH HAMZA ALEF', +1654: 'ARABIC LETTER HIGH HAMZA WAW', +1655: 'ARABIC LETTER U WITH HAMZA ABOVE', +1656: 'ARABIC LETTER HIGH HAMZA YEH', +1657: 'ARABIC LETTER TTEH', +1658: 'ARABIC LETTER TTEHEH', +1659: 'ARABIC LETTER BEEH', +1660: 'ARABIC LETTER TEH WITH RING', +1661: 'ARABIC LETTER TEH WITH THREE DOTS ABOVE DOWNWARDS', +1662: 'ARABIC LETTER PEH', +1663: 'ARABIC LETTER TEHEH', +1664: 'ARABIC LETTER BEHEH', +1665: 'ARABIC LETTER HAH WITH HAMZA ABOVE', +1666: 'ARABIC LETTER HAH WITH TWO DOTS VERTICAL ABOVE', +1667: 'ARABIC LETTER NYEH', +1668: 'ARABIC LETTER DYEH', +1669: 'ARABIC LETTER HAH WITH THREE DOTS ABOVE', +1670: 'ARABIC LETTER TCHEH', +1671: 'ARABIC LETTER TCHEHEH', +1672: 'ARABIC LETTER DDAL', +1673: 'ARABIC LETTER DAL WITH RING', +1674: 'ARABIC LETTER DAL WITH DOT BELOW', +1675: 'ARABIC LETTER DAL WITH DOT BELOW AND SMALL TAH', +1676: 'ARABIC LETTER DAHAL', +1677: 'ARABIC LETTER DDAHAL', +1678: 'ARABIC LETTER DUL', +1679: 'ARABIC LETTER DAL WITH THREE DOTS ABOVE DOWNWARDS', +1680: 'ARABIC LETTER DAL WITH FOUR DOTS ABOVE', +1681: 'ARABIC LETTER RREH', +1682: 'ARABIC LETTER REH WITH SMALL V', +1683: 'ARABIC LETTER REH WITH RING', +1684: 'ARABIC LETTER REH WITH DOT BELOW', +1685: 'ARABIC LETTER REH WITH SMALL V BELOW', +1686: 'ARABIC LETTER REH WITH DOT BELOW AND DOT ABOVE', +1687: 'ARABIC LETTER REH WITH TWO DOTS ABOVE', +1688: 'ARABIC LETTER JEH', +1689: 'ARABIC LETTER REH WITH FOUR DOTS ABOVE', +1690: 'ARABIC LETTER SEEN WITH DOT BELOW AND DOT ABOVE', +1691: 'ARABIC LETTER SEEN WITH THREE DOTS BELOW', +1692: 'ARABIC LETTER SEEN WITH THREE DOTS BELOW AND THREE DOTS ABOVE', +1693: 'ARABIC LETTER SAD WITH TWO DOTS BELOW', +1694: 'ARABIC LETTER SAD WITH THREE DOTS ABOVE', +1695: 'ARABIC LETTER TAH WITH THREE DOTS ABOVE', +1696: 'ARABIC LETTER AIN WITH THREE DOTS ABOVE', +1697: 'ARABIC LETTER DOTLESS FEH', +1698: 'ARABIC LETTER FEH WITH DOT MOVED BELOW', +1699: 'ARABIC LETTER FEH WITH DOT BELOW', +1700: 'ARABIC LETTER VEH', +1701: 'ARABIC LETTER FEH WITH THREE DOTS BELOW', +1702: 'ARABIC LETTER PEHEH', +1703: 'ARABIC LETTER QAF WITH DOT ABOVE', +1704: 'ARABIC LETTER QAF WITH THREE DOTS ABOVE', +1705: 'ARABIC LETTER KEHEH', +1706: 'ARABIC LETTER SWASH KAF', +1707: 'ARABIC LETTER KAF WITH RING', +1708: 'ARABIC LETTER KAF WITH DOT ABOVE', +1709: 'ARABIC LETTER NG', +1710: 'ARABIC LETTER KAF WITH THREE DOTS BELOW', +1711: 'ARABIC LETTER GAF', +1712: 'ARABIC LETTER GAF WITH RING', +1713: 'ARABIC LETTER NGOEH', +1714: 'ARABIC LETTER GAF WITH TWO DOTS BELOW', +1715: 'ARABIC LETTER GUEH', +1716: 'ARABIC LETTER GAF WITH THREE DOTS ABOVE', +1717: 'ARABIC LETTER LAM WITH SMALL V', +1718: 'ARABIC LETTER LAM WITH DOT ABOVE', +1719: 'ARABIC LETTER LAM WITH THREE DOTS ABOVE', +1720: 'ARABIC LETTER LAM WITH THREE DOTS BELOW', +1721: 'ARABIC LETTER NOON WITH DOT BELOW', +1722: 'ARABIC LETTER NOON GHUNNA', +1723: 'ARABIC LETTER RNOON', +1724: 'ARABIC LETTER NOON WITH RING', +1725: 'ARABIC LETTER NOON WITH THREE DOTS ABOVE', +1726: 'ARABIC LETTER HEH DOACHASHMEE', +1727: 'ARABIC LETTER TCHEH WITH DOT ABOVE', +1728: 'ARABIC LETTER HEH WITH YEH ABOVE', +1729: 'ARABIC LETTER HEH GOAL', +1730: 'ARABIC LETTER HEH GOAL WITH HAMZA ABOVE', +1731: 'ARABIC LETTER TEH MARBUTA GOAL', +1732: 'ARABIC LETTER WAW WITH RING', +1733: 'ARABIC LETTER KIRGHIZ OE', +1734: 'ARABIC LETTER OE', +1735: 'ARABIC LETTER U', +1736: 'ARABIC LETTER YU', +1737: 'ARABIC LETTER KIRGHIZ YU', +1738: 'ARABIC LETTER WAW WITH TWO DOTS ABOVE', +1739: 'ARABIC LETTER VE', +1740: 'ARABIC LETTER FARSI YEH', +1741: 'ARABIC LETTER YEH WITH TAIL', +1742: 'ARABIC LETTER YEH WITH SMALL V', +1743: 'ARABIC LETTER WAW WITH DOT ABOVE', +1744: 'ARABIC LETTER E', +1745: 'ARABIC LETTER YEH WITH THREE DOTS BELOW', +1746: 'ARABIC LETTER YEH BARREE', +1747: 'ARABIC LETTER YEH BARREE WITH HAMZA ABOVE', +1748: 'ARABIC FULL STOP', +1749: 'ARABIC LETTER AE', +1750: 'ARABIC SMALL HIGH LIGATURE SAD WITH LAM WITH ALEF MAKSURA', +1751: 'ARABIC SMALL HIGH LIGATURE QAF WITH LAM WITH ALEF MAKSURA', +1752: 'ARABIC SMALL HIGH MEEM INITIAL FORM', +1753: 'ARABIC SMALL HIGH LAM ALEF', +1754: 'ARABIC SMALL HIGH JEEM', +1755: 'ARABIC SMALL HIGH THREE DOTS', +1756: 'ARABIC SMALL HIGH SEEN', +1757: 'ARABIC END OF AYAH', +1758: 'ARABIC START OF RUB EL HIZB', +1759: 'ARABIC SMALL HIGH ROUNDED ZERO', +1760: 'ARABIC SMALL HIGH UPRIGHT RECTANGULAR ZERO', +1761: 'ARABIC SMALL HIGH DOTLESS HEAD OF KHAH', +1762: 'ARABIC SMALL HIGH MEEM ISOLATED FORM', +1763: 'ARABIC SMALL LOW SEEN', +1764: 'ARABIC SMALL HIGH MADDA', +1765: 'ARABIC SMALL WAW', +1766: 'ARABIC SMALL YEH', +1767: 'ARABIC SMALL HIGH YEH', +1768: 'ARABIC SMALL HIGH NOON', +1769: 'ARABIC PLACE OF SAJDAH', +1770: 'ARABIC EMPTY CENTRE LOW STOP', +1771: 'ARABIC EMPTY CENTRE HIGH STOP', +1772: 'ARABIC ROUNDED HIGH STOP WITH FILLED CENTRE', +1773: 'ARABIC SMALL LOW MEEM', +1776: 'EXTENDED ARABIC-INDIC DIGIT ZERO', +1777: 'EXTENDED ARABIC-INDIC DIGIT ONE', +1778: 'EXTENDED ARABIC-INDIC DIGIT TWO', +1779: 'EXTENDED ARABIC-INDIC DIGIT THREE', +1780: 'EXTENDED ARABIC-INDIC DIGIT FOUR', +1781: 'EXTENDED ARABIC-INDIC DIGIT FIVE', +1782: 'EXTENDED ARABIC-INDIC DIGIT SIX', +1783: 'EXTENDED ARABIC-INDIC DIGIT SEVEN', +1784: 'EXTENDED ARABIC-INDIC DIGIT EIGHT', +1785: 'EXTENDED ARABIC-INDIC DIGIT NINE', +1786: 'ARABIC LETTER SHEEN WITH DOT BELOW', +1787: 'ARABIC LETTER DAD WITH DOT BELOW', +1788: 'ARABIC LETTER GHAIN WITH DOT BELOW', +1789: 'ARABIC SIGN SINDHI AMPERSAND', +1790: 'ARABIC SIGN SINDHI POSTPOSITION MEN', +1792: 'SYRIAC END OF PARAGRAPH', +1793: 'SYRIAC SUPRALINEAR FULL STOP', +1794: 'SYRIAC SUBLINEAR FULL STOP', +1795: 'SYRIAC SUPRALINEAR COLON', +1796: 'SYRIAC SUBLINEAR COLON', +1797: 'SYRIAC HORIZONTAL COLON', +1798: 'SYRIAC COLON SKEWED LEFT', +1799: 'SYRIAC COLON SKEWED RIGHT', +1800: 'SYRIAC SUPRALINEAR COLON SKEWED LEFT', +1801: 'SYRIAC SUBLINEAR COLON SKEWED RIGHT', +1802: 'SYRIAC CONTRACTION', +1803: 'SYRIAC HARKLEAN OBELUS', +1804: 'SYRIAC HARKLEAN METOBELUS', +1805: 'SYRIAC HARKLEAN ASTERISCUS', +1807: 'SYRIAC ABBREVIATION MARK', +1808: 'SYRIAC LETTER ALAPH', +1809: 'SYRIAC LETTER SUPERSCRIPT ALAPH', +1810: 'SYRIAC LETTER BETH', +1811: 'SYRIAC LETTER GAMAL', +1812: 'SYRIAC LETTER GAMAL GARSHUNI', +1813: 'SYRIAC LETTER DALATH', +1814: 'SYRIAC LETTER DOTLESS DALATH RISH', +1815: 'SYRIAC LETTER HE', +1816: 'SYRIAC LETTER WAW', +1817: 'SYRIAC LETTER ZAIN', +1818: 'SYRIAC LETTER HETH', +1819: 'SYRIAC LETTER TETH', +1820: 'SYRIAC LETTER TETH GARSHUNI', +1821: 'SYRIAC LETTER YUDH', +1822: 'SYRIAC LETTER YUDH HE', +1823: 'SYRIAC LETTER KAPH', +1824: 'SYRIAC LETTER LAMADH', +1825: 'SYRIAC LETTER MIM', +1826: 'SYRIAC LETTER NUN', +1827: 'SYRIAC LETTER SEMKATH', +1828: 'SYRIAC LETTER FINAL SEMKATH', +1829: 'SYRIAC LETTER E', +1830: 'SYRIAC LETTER PE', +1831: 'SYRIAC LETTER REVERSED PE', +1832: 'SYRIAC LETTER SADHE', +1833: 'SYRIAC LETTER QAPH', +1834: 'SYRIAC LETTER RISH', +1835: 'SYRIAC LETTER SHIN', +1836: 'SYRIAC LETTER TAW', +1840: 'SYRIAC PTHAHA ABOVE', +1841: 'SYRIAC PTHAHA BELOW', +1842: 'SYRIAC PTHAHA DOTTED', +1843: 'SYRIAC ZQAPHA ABOVE', +1844: 'SYRIAC ZQAPHA BELOW', +1845: 'SYRIAC ZQAPHA DOTTED', +1846: 'SYRIAC RBASA ABOVE', +1847: 'SYRIAC RBASA BELOW', +1848: 'SYRIAC DOTTED ZLAMA HORIZONTAL', +1849: 'SYRIAC DOTTED ZLAMA ANGULAR', +1850: 'SYRIAC HBASA ABOVE', +1851: 'SYRIAC HBASA BELOW', +1852: 'SYRIAC HBASA-ESASA DOTTED', +1853: 'SYRIAC ESASA ABOVE', +1854: 'SYRIAC ESASA BELOW', +1855: 'SYRIAC RWAHA', +1856: 'SYRIAC FEMININE DOT', +1857: 'SYRIAC QUSHSHAYA', +1858: 'SYRIAC RUKKAKHA', +1859: 'SYRIAC TWO VERTICAL DOTS ABOVE', +1860: 'SYRIAC TWO VERTICAL DOTS BELOW', +1861: 'SYRIAC THREE DOTS ABOVE', +1862: 'SYRIAC THREE DOTS BELOW', +1863: 'SYRIAC OBLIQUE LINE ABOVE', +1864: 'SYRIAC OBLIQUE LINE BELOW', +1865: 'SYRIAC MUSIC', +1866: 'SYRIAC BARREKH', +1920: 'THAANA LETTER HAA', +1921: 'THAANA LETTER SHAVIYANI', +1922: 'THAANA LETTER NOONU', +1923: 'THAANA LETTER RAA', +1924: 'THAANA LETTER BAA', +1925: 'THAANA LETTER LHAVIYANI', +1926: 'THAANA LETTER KAAFU', +1927: 'THAANA LETTER ALIFU', +1928: 'THAANA LETTER VAAVU', +1929: 'THAANA LETTER MEEMU', +1930: 'THAANA LETTER FAAFU', +1931: 'THAANA LETTER DHAALU', +1932: 'THAANA LETTER THAA', +1933: 'THAANA LETTER LAAMU', +1934: 'THAANA LETTER GAAFU', +1935: 'THAANA LETTER GNAVIYANI', +1936: 'THAANA LETTER SEENU', +1937: 'THAANA LETTER DAVIYANI', +1938: 'THAANA LETTER ZAVIYANI', +1939: 'THAANA LETTER TAVIYANI', +1940: 'THAANA LETTER YAA', +1941: 'THAANA LETTER PAVIYANI', +1942: 'THAANA LETTER JAVIYANI', +1943: 'THAANA LETTER CHAVIYANI', +1944: 'THAANA LETTER TTAA', +1945: 'THAANA LETTER HHAA', +1946: 'THAANA LETTER KHAA', +1947: 'THAANA LETTER THAALU', +1948: 'THAANA LETTER ZAA', +1949: 'THAANA LETTER SHEENU', +1950: 'THAANA LETTER SAADHU', +1951: 'THAANA LETTER DAADHU', +1952: 'THAANA LETTER TO', +1953: 'THAANA LETTER ZO', +1954: 'THAANA LETTER AINU', +1955: 'THAANA LETTER GHAINU', +1956: 'THAANA LETTER QAAFU', +1957: 'THAANA LETTER WAAVU', +1958: 'THAANA ABAFILI', +1959: 'THAANA AABAAFILI', +1960: 'THAANA IBIFILI', +1961: 'THAANA EEBEEFILI', +1962: 'THAANA UBUFILI', +1963: 'THAANA OOBOOFILI', +1964: 'THAANA EBEFILI', +1965: 'THAANA EYBEYFILI', +1966: 'THAANA OBOFILI', +1967: 'THAANA OABOAFILI', +1968: 'THAANA SUKUN', +1969: 'THAANA LETTER NAA', +2305: 'DEVANAGARI SIGN CANDRABINDU', +2306: 'DEVANAGARI SIGN ANUSVARA', +2307: 'DEVANAGARI SIGN VISARGA', +2309: 'DEVANAGARI LETTER A', +2310: 'DEVANAGARI LETTER AA', +2311: 'DEVANAGARI LETTER I', +2312: 'DEVANAGARI LETTER II', +2313: 'DEVANAGARI LETTER U', +2314: 'DEVANAGARI LETTER UU', +2315: 'DEVANAGARI LETTER VOCALIC R', +2316: 'DEVANAGARI LETTER VOCALIC L', +2317: 'DEVANAGARI LETTER CANDRA E', +2318: 'DEVANAGARI LETTER SHORT E', +2319: 'DEVANAGARI LETTER E', +2320: 'DEVANAGARI LETTER AI', +2321: 'DEVANAGARI LETTER CANDRA O', +2322: 'DEVANAGARI LETTER SHORT O', +2323: 'DEVANAGARI LETTER O', +2324: 'DEVANAGARI LETTER AU', +2325: 'DEVANAGARI LETTER KA', +2326: 'DEVANAGARI LETTER KHA', +2327: 'DEVANAGARI LETTER GA', +2328: 'DEVANAGARI LETTER GHA', +2329: 'DEVANAGARI LETTER NGA', +2330: 'DEVANAGARI LETTER CA', +2331: 'DEVANAGARI LETTER CHA', +2332: 'DEVANAGARI LETTER JA', +2333: 'DEVANAGARI LETTER JHA', +2334: 'DEVANAGARI LETTER NYA', +2335: 'DEVANAGARI LETTER TTA', +2336: 'DEVANAGARI LETTER TTHA', +2337: 'DEVANAGARI LETTER DDA', +2338: 'DEVANAGARI LETTER DDHA', +2339: 'DEVANAGARI LETTER NNA', +2340: 'DEVANAGARI LETTER TA', +2341: 'DEVANAGARI LETTER THA', +2342: 'DEVANAGARI LETTER DA', +2343: 'DEVANAGARI LETTER DHA', +2344: 'DEVANAGARI LETTER NA', +2345: 'DEVANAGARI LETTER NNNA', +2346: 'DEVANAGARI LETTER PA', +2347: 'DEVANAGARI LETTER PHA', +2348: 'DEVANAGARI LETTER BA', +2349: 'DEVANAGARI LETTER BHA', +2350: 'DEVANAGARI LETTER MA', +2351: 'DEVANAGARI LETTER YA', +2352: 'DEVANAGARI LETTER RA', +2353: 'DEVANAGARI LETTER RRA', +2354: 'DEVANAGARI LETTER LA', +2355: 'DEVANAGARI LETTER LLA', +2356: 'DEVANAGARI LETTER LLLA', +2357: 'DEVANAGARI LETTER VA', +2358: 'DEVANAGARI LETTER SHA', +2359: 'DEVANAGARI LETTER SSA', +2360: 'DEVANAGARI LETTER SA', +2361: 'DEVANAGARI LETTER HA', +2364: 'DEVANAGARI SIGN NUKTA', +2365: 'DEVANAGARI SIGN AVAGRAHA', +2366: 'DEVANAGARI VOWEL SIGN AA', +2367: 'DEVANAGARI VOWEL SIGN I', +2368: 'DEVANAGARI VOWEL SIGN II', +2369: 'DEVANAGARI VOWEL SIGN U', +2370: 'DEVANAGARI VOWEL SIGN UU', +2371: 'DEVANAGARI VOWEL SIGN VOCALIC R', +2372: 'DEVANAGARI VOWEL SIGN VOCALIC RR', +2373: 'DEVANAGARI VOWEL SIGN CANDRA E', +2374: 'DEVANAGARI VOWEL SIGN SHORT E', +2375: 'DEVANAGARI VOWEL SIGN E', +2376: 'DEVANAGARI VOWEL SIGN AI', +2377: 'DEVANAGARI VOWEL SIGN CANDRA O', +2378: 'DEVANAGARI VOWEL SIGN SHORT O', +2379: 'DEVANAGARI VOWEL SIGN O', +2380: 'DEVANAGARI VOWEL SIGN AU', +2381: 'DEVANAGARI SIGN VIRAMA', +2384: 'DEVANAGARI OM', +2385: 'DEVANAGARI STRESS SIGN UDATTA', +2386: 'DEVANAGARI STRESS SIGN ANUDATTA', +2387: 'DEVANAGARI GRAVE ACCENT', +2388: 'DEVANAGARI ACUTE ACCENT', +2392: 'DEVANAGARI LETTER QA', +2393: 'DEVANAGARI LETTER KHHA', +2394: 'DEVANAGARI LETTER GHHA', +2395: 'DEVANAGARI LETTER ZA', +2396: 'DEVANAGARI LETTER DDDHA', +2397: 'DEVANAGARI LETTER RHA', +2398: 'DEVANAGARI LETTER FA', +2399: 'DEVANAGARI LETTER YYA', +2400: 'DEVANAGARI LETTER VOCALIC RR', +2401: 'DEVANAGARI LETTER VOCALIC LL', +2402: 'DEVANAGARI VOWEL SIGN VOCALIC L', +2403: 'DEVANAGARI VOWEL SIGN VOCALIC LL', +2404: 'DEVANAGARI DANDA', +2405: 'DEVANAGARI DOUBLE DANDA', +2406: 'DEVANAGARI DIGIT ZERO', +2407: 'DEVANAGARI DIGIT ONE', +2408: 'DEVANAGARI DIGIT TWO', +2409: 'DEVANAGARI DIGIT THREE', +2410: 'DEVANAGARI DIGIT FOUR', +2411: 'DEVANAGARI DIGIT FIVE', +2412: 'DEVANAGARI DIGIT SIX', +2413: 'DEVANAGARI DIGIT SEVEN', +2414: 'DEVANAGARI DIGIT EIGHT', +2415: 'DEVANAGARI DIGIT NINE', +2416: 'DEVANAGARI ABBREVIATION SIGN', +2433: 'BENGALI SIGN CANDRABINDU', +2434: 'BENGALI SIGN ANUSVARA', +2435: 'BENGALI SIGN VISARGA', +2437: 'BENGALI LETTER A', +2438: 'BENGALI LETTER AA', +2439: 'BENGALI LETTER I', +2440: 'BENGALI LETTER II', +2441: 'BENGALI LETTER U', +2442: 'BENGALI LETTER UU', +2443: 'BENGALI LETTER VOCALIC R', +2444: 'BENGALI LETTER VOCALIC L', +2447: 'BENGALI LETTER E', +2448: 'BENGALI LETTER AI', +2451: 'BENGALI LETTER O', +2452: 'BENGALI LETTER AU', +2453: 'BENGALI LETTER KA', +2454: 'BENGALI LETTER KHA', +2455: 'BENGALI LETTER GA', +2456: 'BENGALI LETTER GHA', +2457: 'BENGALI LETTER NGA', +2458: 'BENGALI LETTER CA', +2459: 'BENGALI LETTER CHA', +2460: 'BENGALI LETTER JA', +2461: 'BENGALI LETTER JHA', +2462: 'BENGALI LETTER NYA', +2463: 'BENGALI LETTER TTA', +2464: 'BENGALI LETTER TTHA', +2465: 'BENGALI LETTER DDA', +2466: 'BENGALI LETTER DDHA', +2467: 'BENGALI LETTER NNA', +2468: 'BENGALI LETTER TA', +2469: 'BENGALI LETTER THA', +2470: 'BENGALI LETTER DA', +2471: 'BENGALI LETTER DHA', +2472: 'BENGALI LETTER NA', +2474: 'BENGALI LETTER PA', +2475: 'BENGALI LETTER PHA', +2476: 'BENGALI LETTER BA', +2477: 'BENGALI LETTER BHA', +2478: 'BENGALI LETTER MA', +2479: 'BENGALI LETTER YA', +2480: 'BENGALI LETTER RA', +2482: 'BENGALI LETTER LA', +2486: 'BENGALI LETTER SHA', +2487: 'BENGALI LETTER SSA', +2488: 'BENGALI LETTER SA', +2489: 'BENGALI LETTER HA', +2492: 'BENGALI SIGN NUKTA', +2494: 'BENGALI VOWEL SIGN AA', +2495: 'BENGALI VOWEL SIGN I', +2496: 'BENGALI VOWEL SIGN II', +2497: 'BENGALI VOWEL SIGN U', +2498: 'BENGALI VOWEL SIGN UU', +2499: 'BENGALI VOWEL SIGN VOCALIC R', +2500: 'BENGALI VOWEL SIGN VOCALIC RR', +2503: 'BENGALI VOWEL SIGN E', +2504: 'BENGALI VOWEL SIGN AI', +2507: 'BENGALI VOWEL SIGN O', +2508: 'BENGALI VOWEL SIGN AU', +2509: 'BENGALI SIGN VIRAMA', +2519: 'BENGALI AU LENGTH MARK', +2524: 'BENGALI LETTER RRA', +2525: 'BENGALI LETTER RHA', +2527: 'BENGALI LETTER YYA', +2528: 'BENGALI LETTER VOCALIC RR', +2529: 'BENGALI LETTER VOCALIC LL', +2530: 'BENGALI VOWEL SIGN VOCALIC L', +2531: 'BENGALI VOWEL SIGN VOCALIC LL', +2534: 'BENGALI DIGIT ZERO', +2535: 'BENGALI DIGIT ONE', +2536: 'BENGALI DIGIT TWO', +2537: 'BENGALI DIGIT THREE', +2538: 'BENGALI DIGIT FOUR', +2539: 'BENGALI DIGIT FIVE', +2540: 'BENGALI DIGIT SIX', +2541: 'BENGALI DIGIT SEVEN', +2542: 'BENGALI DIGIT EIGHT', +2543: 'BENGALI DIGIT NINE', +2544: 'BENGALI LETTER RA WITH MIDDLE DIAGONAL', +2545: 'BENGALI LETTER RA WITH LOWER DIAGONAL', +2546: 'BENGALI RUPEE MARK', +2547: 'BENGALI RUPEE SIGN', +2548: 'BENGALI CURRENCY NUMERATOR ONE', +2549: 'BENGALI CURRENCY NUMERATOR TWO', +2550: 'BENGALI CURRENCY NUMERATOR THREE', +2551: 'BENGALI CURRENCY NUMERATOR FOUR', +2552: 'BENGALI CURRENCY NUMERATOR ONE LESS THAN THE DENOMINATOR', +2553: 'BENGALI CURRENCY DENOMINATOR SIXTEEN', +2554: 'BENGALI ISSHAR', +2562: 'GURMUKHI SIGN BINDI', +2565: 'GURMUKHI LETTER A', +2566: 'GURMUKHI LETTER AA', +2567: 'GURMUKHI LETTER I', +2568: 'GURMUKHI LETTER II', +2569: 'GURMUKHI LETTER U', +2570: 'GURMUKHI LETTER UU', +2575: 'GURMUKHI LETTER EE', +2576: 'GURMUKHI LETTER AI', +2579: 'GURMUKHI LETTER OO', +2580: 'GURMUKHI LETTER AU', +2581: 'GURMUKHI LETTER KA', +2582: 'GURMUKHI LETTER KHA', +2583: 'GURMUKHI LETTER GA', +2584: 'GURMUKHI LETTER GHA', +2585: 'GURMUKHI LETTER NGA', +2586: 'GURMUKHI LETTER CA', +2587: 'GURMUKHI LETTER CHA', +2588: 'GURMUKHI LETTER JA', +2589: 'GURMUKHI LETTER JHA', +2590: 'GURMUKHI LETTER NYA', +2591: 'GURMUKHI LETTER TTA', +2592: 'GURMUKHI LETTER TTHA', +2593: 'GURMUKHI LETTER DDA', +2594: 'GURMUKHI LETTER DDHA', +2595: 'GURMUKHI LETTER NNA', +2596: 'GURMUKHI LETTER TA', +2597: 'GURMUKHI LETTER THA', +2598: 'GURMUKHI LETTER DA', +2599: 'GURMUKHI LETTER DHA', +2600: 'GURMUKHI LETTER NA', +2602: 'GURMUKHI LETTER PA', +2603: 'GURMUKHI LETTER PHA', +2604: 'GURMUKHI LETTER BA', +2605: 'GURMUKHI LETTER BHA', +2606: 'GURMUKHI LETTER MA', +2607: 'GURMUKHI LETTER YA', +2608: 'GURMUKHI LETTER RA', +2610: 'GURMUKHI LETTER LA', +2611: 'GURMUKHI LETTER LLA', +2613: 'GURMUKHI LETTER VA', +2614: 'GURMUKHI LETTER SHA', +2616: 'GURMUKHI LETTER SA', +2617: 'GURMUKHI LETTER HA', +2620: 'GURMUKHI SIGN NUKTA', +2622: 'GURMUKHI VOWEL SIGN AA', +2623: 'GURMUKHI VOWEL SIGN I', +2624: 'GURMUKHI VOWEL SIGN II', +2625: 'GURMUKHI VOWEL SIGN U', +2626: 'GURMUKHI VOWEL SIGN UU', +2631: 'GURMUKHI VOWEL SIGN EE', +2632: 'GURMUKHI VOWEL SIGN AI', +2635: 'GURMUKHI VOWEL SIGN OO', +2636: 'GURMUKHI VOWEL SIGN AU', +2637: 'GURMUKHI SIGN VIRAMA', +2649: 'GURMUKHI LETTER KHHA', +2650: 'GURMUKHI LETTER GHHA', +2651: 'GURMUKHI LETTER ZA', +2652: 'GURMUKHI LETTER RRA', +2654: 'GURMUKHI LETTER FA', +2662: 'GURMUKHI DIGIT ZERO', +2663: 'GURMUKHI DIGIT ONE', +2664: 'GURMUKHI DIGIT TWO', +2665: 'GURMUKHI DIGIT THREE', +2666: 'GURMUKHI DIGIT FOUR', +2667: 'GURMUKHI DIGIT FIVE', +2668: 'GURMUKHI DIGIT SIX', +2669: 'GURMUKHI DIGIT SEVEN', +2670: 'GURMUKHI DIGIT EIGHT', +2671: 'GURMUKHI DIGIT NINE', +2672: 'GURMUKHI TIPPI', +2673: 'GURMUKHI ADDAK', +2674: 'GURMUKHI IRI', +2675: 'GURMUKHI URA', +2676: 'GURMUKHI EK ONKAR', +2689: 'GUJARATI SIGN CANDRABINDU', +2690: 'GUJARATI SIGN ANUSVARA', +2691: 'GUJARATI SIGN VISARGA', +2693: 'GUJARATI LETTER A', +2694: 'GUJARATI LETTER AA', +2695: 'GUJARATI LETTER I', +2696: 'GUJARATI LETTER II', +2697: 'GUJARATI LETTER U', +2698: 'GUJARATI LETTER UU', +2699: 'GUJARATI LETTER VOCALIC R', +2701: 'GUJARATI VOWEL CANDRA E', +2703: 'GUJARATI LETTER E', +2704: 'GUJARATI LETTER AI', +2705: 'GUJARATI VOWEL CANDRA O', +2707: 'GUJARATI LETTER O', +2708: 'GUJARATI LETTER AU', +2709: 'GUJARATI LETTER KA', +2710: 'GUJARATI LETTER KHA', +2711: 'GUJARATI LETTER GA', +2712: 'GUJARATI LETTER GHA', +2713: 'GUJARATI LETTER NGA', +2714: 'GUJARATI LETTER CA', +2715: 'GUJARATI LETTER CHA', +2716: 'GUJARATI LETTER JA', +2717: 'GUJARATI LETTER JHA', +2718: 'GUJARATI LETTER NYA', +2719: 'GUJARATI LETTER TTA', +2720: 'GUJARATI LETTER TTHA', +2721: 'GUJARATI LETTER DDA', +2722: 'GUJARATI LETTER DDHA', +2723: 'GUJARATI LETTER NNA', +2724: 'GUJARATI LETTER TA', +2725: 'GUJARATI LETTER THA', +2726: 'GUJARATI LETTER DA', +2727: 'GUJARATI LETTER DHA', +2728: 'GUJARATI LETTER NA', +2730: 'GUJARATI LETTER PA', +2731: 'GUJARATI LETTER PHA', +2732: 'GUJARATI LETTER BA', +2733: 'GUJARATI LETTER BHA', +2734: 'GUJARATI LETTER MA', +2735: 'GUJARATI LETTER YA', +2736: 'GUJARATI LETTER RA', +2738: 'GUJARATI LETTER LA', +2739: 'GUJARATI LETTER LLA', +2741: 'GUJARATI LETTER VA', +2742: 'GUJARATI LETTER SHA', +2743: 'GUJARATI LETTER SSA', +2744: 'GUJARATI LETTER SA', +2745: 'GUJARATI LETTER HA', +2748: 'GUJARATI SIGN NUKTA', +2749: 'GUJARATI SIGN AVAGRAHA', +2750: 'GUJARATI VOWEL SIGN AA', +2751: 'GUJARATI VOWEL SIGN I', +2752: 'GUJARATI VOWEL SIGN II', +2753: 'GUJARATI VOWEL SIGN U', +2754: 'GUJARATI VOWEL SIGN UU', +2755: 'GUJARATI VOWEL SIGN VOCALIC R', +2756: 'GUJARATI VOWEL SIGN VOCALIC RR', +2757: 'GUJARATI VOWEL SIGN CANDRA E', +2759: 'GUJARATI VOWEL SIGN E', +2760: 'GUJARATI VOWEL SIGN AI', +2761: 'GUJARATI VOWEL SIGN CANDRA O', +2763: 'GUJARATI VOWEL SIGN O', +2764: 'GUJARATI VOWEL SIGN AU', +2765: 'GUJARATI SIGN VIRAMA', +2768: 'GUJARATI OM', +2784: 'GUJARATI LETTER VOCALIC RR', +2790: 'GUJARATI DIGIT ZERO', +2791: 'GUJARATI DIGIT ONE', +2792: 'GUJARATI DIGIT TWO', +2793: 'GUJARATI DIGIT THREE', +2794: 'GUJARATI DIGIT FOUR', +2795: 'GUJARATI DIGIT FIVE', +2796: 'GUJARATI DIGIT SIX', +2797: 'GUJARATI DIGIT SEVEN', +2798: 'GUJARATI DIGIT EIGHT', +2799: 'GUJARATI DIGIT NINE', +2817: 'ORIYA SIGN CANDRABINDU', +2818: 'ORIYA SIGN ANUSVARA', +2819: 'ORIYA SIGN VISARGA', +2821: 'ORIYA LETTER A', +2822: 'ORIYA LETTER AA', +2823: 'ORIYA LETTER I', +2824: 'ORIYA LETTER II', +2825: 'ORIYA LETTER U', +2826: 'ORIYA LETTER UU', +2827: 'ORIYA LETTER VOCALIC R', +2828: 'ORIYA LETTER VOCALIC L', +2831: 'ORIYA LETTER E', +2832: 'ORIYA LETTER AI', +2835: 'ORIYA LETTER O', +2836: 'ORIYA LETTER AU', +2837: 'ORIYA LETTER KA', +2838: 'ORIYA LETTER KHA', +2839: 'ORIYA LETTER GA', +2840: 'ORIYA LETTER GHA', +2841: 'ORIYA LETTER NGA', +2842: 'ORIYA LETTER CA', +2843: 'ORIYA LETTER CHA', +2844: 'ORIYA LETTER JA', +2845: 'ORIYA LETTER JHA', +2846: 'ORIYA LETTER NYA', +2847: 'ORIYA LETTER TTA', +2848: 'ORIYA LETTER TTHA', +2849: 'ORIYA LETTER DDA', +2850: 'ORIYA LETTER DDHA', +2851: 'ORIYA LETTER NNA', +2852: 'ORIYA LETTER TA', +2853: 'ORIYA LETTER THA', +2854: 'ORIYA LETTER DA', +2855: 'ORIYA LETTER DHA', +2856: 'ORIYA LETTER NA', +2858: 'ORIYA LETTER PA', +2859: 'ORIYA LETTER PHA', +2860: 'ORIYA LETTER BA', +2861: 'ORIYA LETTER BHA', +2862: 'ORIYA LETTER MA', +2863: 'ORIYA LETTER YA', +2864: 'ORIYA LETTER RA', +2866: 'ORIYA LETTER LA', +2867: 'ORIYA LETTER LLA', +2870: 'ORIYA LETTER SHA', +2871: 'ORIYA LETTER SSA', +2872: 'ORIYA LETTER SA', +2873: 'ORIYA LETTER HA', +2876: 'ORIYA SIGN NUKTA', +2877: 'ORIYA SIGN AVAGRAHA', +2878: 'ORIYA VOWEL SIGN AA', +2879: 'ORIYA VOWEL SIGN I', +2880: 'ORIYA VOWEL SIGN II', +2881: 'ORIYA VOWEL SIGN U', +2882: 'ORIYA VOWEL SIGN UU', +2883: 'ORIYA VOWEL SIGN VOCALIC R', +2887: 'ORIYA VOWEL SIGN E', +2888: 'ORIYA VOWEL SIGN AI', +2891: 'ORIYA VOWEL SIGN O', +2892: 'ORIYA VOWEL SIGN AU', +2893: 'ORIYA SIGN VIRAMA', +2902: 'ORIYA AI LENGTH MARK', +2903: 'ORIYA AU LENGTH MARK', +2908: 'ORIYA LETTER RRA', +2909: 'ORIYA LETTER RHA', +2911: 'ORIYA LETTER YYA', +2912: 'ORIYA LETTER VOCALIC RR', +2913: 'ORIYA LETTER VOCALIC LL', +2918: 'ORIYA DIGIT ZERO', +2919: 'ORIYA DIGIT ONE', +2920: 'ORIYA DIGIT TWO', +2921: 'ORIYA DIGIT THREE', +2922: 'ORIYA DIGIT FOUR', +2923: 'ORIYA DIGIT FIVE', +2924: 'ORIYA DIGIT SIX', +2925: 'ORIYA DIGIT SEVEN', +2926: 'ORIYA DIGIT EIGHT', +2927: 'ORIYA DIGIT NINE', +2928: 'ORIYA ISSHAR', +2946: 'TAMIL SIGN ANUSVARA', +2947: 'TAMIL SIGN VISARGA', +2949: 'TAMIL LETTER A', +2950: 'TAMIL LETTER AA', +2951: 'TAMIL LETTER I', +2952: 'TAMIL LETTER II', +2953: 'TAMIL LETTER U', +2954: 'TAMIL LETTER UU', +2958: 'TAMIL LETTER E', +2959: 'TAMIL LETTER EE', +2960: 'TAMIL LETTER AI', +2962: 'TAMIL LETTER O', +2963: 'TAMIL LETTER OO', +2964: 'TAMIL LETTER AU', +2965: 'TAMIL LETTER KA', +2969: 'TAMIL LETTER NGA', +2970: 'TAMIL LETTER CA', +2972: 'TAMIL LETTER JA', +2974: 'TAMIL LETTER NYA', +2975: 'TAMIL LETTER TTA', +2979: 'TAMIL LETTER NNA', +2980: 'TAMIL LETTER TA', +2984: 'TAMIL LETTER NA', +2985: 'TAMIL LETTER NNNA', +2986: 'TAMIL LETTER PA', +2990: 'TAMIL LETTER MA', +2991: 'TAMIL LETTER YA', +2992: 'TAMIL LETTER RA', +2993: 'TAMIL LETTER RRA', +2994: 'TAMIL LETTER LA', +2995: 'TAMIL LETTER LLA', +2996: 'TAMIL LETTER LLLA', +2997: 'TAMIL LETTER VA', +2999: 'TAMIL LETTER SSA', +3000: 'TAMIL LETTER SA', +3001: 'TAMIL LETTER HA', +3006: 'TAMIL VOWEL SIGN AA', +3007: 'TAMIL VOWEL SIGN I', +3008: 'TAMIL VOWEL SIGN II', +3009: 'TAMIL VOWEL SIGN U', +3010: 'TAMIL VOWEL SIGN UU', +3014: 'TAMIL VOWEL SIGN E', +3015: 'TAMIL VOWEL SIGN EE', +3016: 'TAMIL VOWEL SIGN AI', +3018: 'TAMIL VOWEL SIGN O', +3019: 'TAMIL VOWEL SIGN OO', +3020: 'TAMIL VOWEL SIGN AU', +3021: 'TAMIL SIGN VIRAMA', +3031: 'TAMIL AU LENGTH MARK', +3047: 'TAMIL DIGIT ONE', +3048: 'TAMIL DIGIT TWO', +3049: 'TAMIL DIGIT THREE', +3050: 'TAMIL DIGIT FOUR', +3051: 'TAMIL DIGIT FIVE', +3052: 'TAMIL DIGIT SIX', +3053: 'TAMIL DIGIT SEVEN', +3054: 'TAMIL DIGIT EIGHT', +3055: 'TAMIL DIGIT NINE', +3056: 'TAMIL NUMBER TEN', +3057: 'TAMIL NUMBER ONE HUNDRED', +3058: 'TAMIL NUMBER ONE THOUSAND', +3073: 'TELUGU SIGN CANDRABINDU', +3074: 'TELUGU SIGN ANUSVARA', +3075: 'TELUGU SIGN VISARGA', +3077: 'TELUGU LETTER A', +3078: 'TELUGU LETTER AA', +3079: 'TELUGU LETTER I', +3080: 'TELUGU LETTER II', +3081: 'TELUGU LETTER U', +3082: 'TELUGU LETTER UU', +3083: 'TELUGU LETTER VOCALIC R', +3084: 'TELUGU LETTER VOCALIC L', +3086: 'TELUGU LETTER E', +3087: 'TELUGU LETTER EE', +3088: 'TELUGU LETTER AI', +3090: 'TELUGU LETTER O', +3091: 'TELUGU LETTER OO', +3092: 'TELUGU LETTER AU', +3093: 'TELUGU LETTER KA', +3094: 'TELUGU LETTER KHA', +3095: 'TELUGU LETTER GA', +3096: 'TELUGU LETTER GHA', +3097: 'TELUGU LETTER NGA', +3098: 'TELUGU LETTER CA', +3099: 'TELUGU LETTER CHA', +3100: 'TELUGU LETTER JA', +3101: 'TELUGU LETTER JHA', +3102: 'TELUGU LETTER NYA', +3103: 'TELUGU LETTER TTA', +3104: 'TELUGU LETTER TTHA', +3105: 'TELUGU LETTER DDA', +3106: 'TELUGU LETTER DDHA', +3107: 'TELUGU LETTER NNA', +3108: 'TELUGU LETTER TA', +3109: 'TELUGU LETTER THA', +3110: 'TELUGU LETTER DA', +3111: 'TELUGU LETTER DHA', +3112: 'TELUGU LETTER NA', +3114: 'TELUGU LETTER PA', +3115: 'TELUGU LETTER PHA', +3116: 'TELUGU LETTER BA', +3117: 'TELUGU LETTER BHA', +3118: 'TELUGU LETTER MA', +3119: 'TELUGU LETTER YA', +3120: 'TELUGU LETTER RA', +3121: 'TELUGU LETTER RRA', +3122: 'TELUGU LETTER LA', +3123: 'TELUGU LETTER LLA', +3125: 'TELUGU LETTER VA', +3126: 'TELUGU LETTER SHA', +3127: 'TELUGU LETTER SSA', +3128: 'TELUGU LETTER SA', +3129: 'TELUGU LETTER HA', +3134: 'TELUGU VOWEL SIGN AA', +3135: 'TELUGU VOWEL SIGN I', +3136: 'TELUGU VOWEL SIGN II', +3137: 'TELUGU VOWEL SIGN U', +3138: 'TELUGU VOWEL SIGN UU', +3139: 'TELUGU VOWEL SIGN VOCALIC R', +3140: 'TELUGU VOWEL SIGN VOCALIC RR', +3142: 'TELUGU VOWEL SIGN E', +3143: 'TELUGU VOWEL SIGN EE', +3144: 'TELUGU VOWEL SIGN AI', +3146: 'TELUGU VOWEL SIGN O', +3147: 'TELUGU VOWEL SIGN OO', +3148: 'TELUGU VOWEL SIGN AU', +3149: 'TELUGU SIGN VIRAMA', +3157: 'TELUGU LENGTH MARK', +3158: 'TELUGU AI LENGTH MARK', +3168: 'TELUGU LETTER VOCALIC RR', +3169: 'TELUGU LETTER VOCALIC LL', +3174: 'TELUGU DIGIT ZERO', +3175: 'TELUGU DIGIT ONE', +3176: 'TELUGU DIGIT TWO', +3177: 'TELUGU DIGIT THREE', +3178: 'TELUGU DIGIT FOUR', +3179: 'TELUGU DIGIT FIVE', +3180: 'TELUGU DIGIT SIX', +3181: 'TELUGU DIGIT SEVEN', +3182: 'TELUGU DIGIT EIGHT', +3183: 'TELUGU DIGIT NINE', +3202: 'KANNADA SIGN ANUSVARA', +3203: 'KANNADA SIGN VISARGA', +3205: 'KANNADA LETTER A', +3206: 'KANNADA LETTER AA', +3207: 'KANNADA LETTER I', +3208: 'KANNADA LETTER II', +3209: 'KANNADA LETTER U', +3210: 'KANNADA LETTER UU', +3211: 'KANNADA LETTER VOCALIC R', +3212: 'KANNADA LETTER VOCALIC L', +3214: 'KANNADA LETTER E', +3215: 'KANNADA LETTER EE', +3216: 'KANNADA LETTER AI', +3218: 'KANNADA LETTER O', +3219: 'KANNADA LETTER OO', +3220: 'KANNADA LETTER AU', +3221: 'KANNADA LETTER KA', +3222: 'KANNADA LETTER KHA', +3223: 'KANNADA LETTER GA', +3224: 'KANNADA LETTER GHA', +3225: 'KANNADA LETTER NGA', +3226: 'KANNADA LETTER CA', +3227: 'KANNADA LETTER CHA', +3228: 'KANNADA LETTER JA', +3229: 'KANNADA LETTER JHA', +3230: 'KANNADA LETTER NYA', +3231: 'KANNADA LETTER TTA', +3232: 'KANNADA LETTER TTHA', +3233: 'KANNADA LETTER DDA', +3234: 'KANNADA LETTER DDHA', +3235: 'KANNADA LETTER NNA', +3236: 'KANNADA LETTER TA', +3237: 'KANNADA LETTER THA', +3238: 'KANNADA LETTER DA', +3239: 'KANNADA LETTER DHA', +3240: 'KANNADA LETTER NA', +3242: 'KANNADA LETTER PA', +3243: 'KANNADA LETTER PHA', +3244: 'KANNADA LETTER BA', +3245: 'KANNADA LETTER BHA', +3246: 'KANNADA LETTER MA', +3247: 'KANNADA LETTER YA', +3248: 'KANNADA LETTER RA', +3249: 'KANNADA LETTER RRA', +3250: 'KANNADA LETTER LA', +3251: 'KANNADA LETTER LLA', +3253: 'KANNADA LETTER VA', +3254: 'KANNADA LETTER SHA', +3255: 'KANNADA LETTER SSA', +3256: 'KANNADA LETTER SA', +3257: 'KANNADA LETTER HA', +3262: 'KANNADA VOWEL SIGN AA', +3263: 'KANNADA VOWEL SIGN I', +3264: 'KANNADA VOWEL SIGN II', +3265: 'KANNADA VOWEL SIGN U', +3266: 'KANNADA VOWEL SIGN UU', +3267: 'KANNADA VOWEL SIGN VOCALIC R', +3268: 'KANNADA VOWEL SIGN VOCALIC RR', +3270: 'KANNADA VOWEL SIGN E', +3271: 'KANNADA VOWEL SIGN EE', +3272: 'KANNADA VOWEL SIGN AI', +3274: 'KANNADA VOWEL SIGN O', +3275: 'KANNADA VOWEL SIGN OO', +3276: 'KANNADA VOWEL SIGN AU', +3277: 'KANNADA SIGN VIRAMA', +3285: 'KANNADA LENGTH MARK', +3286: 'KANNADA AI LENGTH MARK', +3294: 'KANNADA LETTER FA', +3296: 'KANNADA LETTER VOCALIC RR', +3297: 'KANNADA LETTER VOCALIC LL', +3302: 'KANNADA DIGIT ZERO', +3303: 'KANNADA DIGIT ONE', +3304: 'KANNADA DIGIT TWO', +3305: 'KANNADA DIGIT THREE', +3306: 'KANNADA DIGIT FOUR', +3307: 'KANNADA DIGIT FIVE', +3308: 'KANNADA DIGIT SIX', +3309: 'KANNADA DIGIT SEVEN', +3310: 'KANNADA DIGIT EIGHT', +3311: 'KANNADA DIGIT NINE', +3330: 'MALAYALAM SIGN ANUSVARA', +3331: 'MALAYALAM SIGN VISARGA', +3333: 'MALAYALAM LETTER A', +3334: 'MALAYALAM LETTER AA', +3335: 'MALAYALAM LETTER I', +3336: 'MALAYALAM LETTER II', +3337: 'MALAYALAM LETTER U', +3338: 'MALAYALAM LETTER UU', +3339: 'MALAYALAM LETTER VOCALIC R', +3340: 'MALAYALAM LETTER VOCALIC L', +3342: 'MALAYALAM LETTER E', +3343: 'MALAYALAM LETTER EE', +3344: 'MALAYALAM LETTER AI', +3346: 'MALAYALAM LETTER O', +3347: 'MALAYALAM LETTER OO', +3348: 'MALAYALAM LETTER AU', +3349: 'MALAYALAM LETTER KA', +3350: 'MALAYALAM LETTER KHA', +3351: 'MALAYALAM LETTER GA', +3352: 'MALAYALAM LETTER GHA', +3353: 'MALAYALAM LETTER NGA', +3354: 'MALAYALAM LETTER CA', +3355: 'MALAYALAM LETTER CHA', +3356: 'MALAYALAM LETTER JA', +3357: 'MALAYALAM LETTER JHA', +3358: 'MALAYALAM LETTER NYA', +3359: 'MALAYALAM LETTER TTA', +3360: 'MALAYALAM LETTER TTHA', +3361: 'MALAYALAM LETTER DDA', +3362: 'MALAYALAM LETTER DDHA', +3363: 'MALAYALAM LETTER NNA', +3364: 'MALAYALAM LETTER TA', +3365: 'MALAYALAM LETTER THA', +3366: 'MALAYALAM LETTER DA', +3367: 'MALAYALAM LETTER DHA', +3368: 'MALAYALAM LETTER NA', +3370: 'MALAYALAM LETTER PA', +3371: 'MALAYALAM LETTER PHA', +3372: 'MALAYALAM LETTER BA', +3373: 'MALAYALAM LETTER BHA', +3374: 'MALAYALAM LETTER MA', +3375: 'MALAYALAM LETTER YA', +3376: 'MALAYALAM LETTER RA', +3377: 'MALAYALAM LETTER RRA', +3378: 'MALAYALAM LETTER LA', +3379: 'MALAYALAM LETTER LLA', +3380: 'MALAYALAM LETTER LLLA', +3381: 'MALAYALAM LETTER VA', +3382: 'MALAYALAM LETTER SHA', +3383: 'MALAYALAM LETTER SSA', +3384: 'MALAYALAM LETTER SA', +3385: 'MALAYALAM LETTER HA', +3390: 'MALAYALAM VOWEL SIGN AA', +3391: 'MALAYALAM VOWEL SIGN I', +3392: 'MALAYALAM VOWEL SIGN II', +3393: 'MALAYALAM VOWEL SIGN U', +3394: 'MALAYALAM VOWEL SIGN UU', +3395: 'MALAYALAM VOWEL SIGN VOCALIC R', +3398: 'MALAYALAM VOWEL SIGN E', +3399: 'MALAYALAM VOWEL SIGN EE', +3400: 'MALAYALAM VOWEL SIGN AI', +3402: 'MALAYALAM VOWEL SIGN O', +3403: 'MALAYALAM VOWEL SIGN OO', +3404: 'MALAYALAM VOWEL SIGN AU', +3405: 'MALAYALAM SIGN VIRAMA', +3415: 'MALAYALAM AU LENGTH MARK', +3424: 'MALAYALAM LETTER VOCALIC RR', +3425: 'MALAYALAM LETTER VOCALIC LL', +3430: 'MALAYALAM DIGIT ZERO', +3431: 'MALAYALAM DIGIT ONE', +3432: 'MALAYALAM DIGIT TWO', +3433: 'MALAYALAM DIGIT THREE', +3434: 'MALAYALAM DIGIT FOUR', +3435: 'MALAYALAM DIGIT FIVE', +3436: 'MALAYALAM DIGIT SIX', +3437: 'MALAYALAM DIGIT SEVEN', +3438: 'MALAYALAM DIGIT EIGHT', +3439: 'MALAYALAM DIGIT NINE', +3458: 'SINHALA SIGN ANUSVARAYA', +3459: 'SINHALA SIGN VISARGAYA', +3461: 'SINHALA LETTER AYANNA', +3462: 'SINHALA LETTER AAYANNA', +3463: 'SINHALA LETTER AEYANNA', +3464: 'SINHALA LETTER AEEYANNA', +3465: 'SINHALA LETTER IYANNA', +3466: 'SINHALA LETTER IIYANNA', +3467: 'SINHALA LETTER UYANNA', +3468: 'SINHALA LETTER UUYANNA', +3469: 'SINHALA LETTER IRUYANNA', +3470: 'SINHALA LETTER IRUUYANNA', +3471: 'SINHALA LETTER ILUYANNA', +3472: 'SINHALA LETTER ILUUYANNA', +3473: 'SINHALA LETTER EYANNA', +3474: 'SINHALA LETTER EEYANNA', +3475: 'SINHALA LETTER AIYANNA', +3476: 'SINHALA LETTER OYANNA', +3477: 'SINHALA LETTER OOYANNA', +3478: 'SINHALA LETTER AUYANNA', +3482: 'SINHALA LETTER ALPAPRAANA KAYANNA', +3483: 'SINHALA LETTER MAHAAPRAANA KAYANNA', +3484: 'SINHALA LETTER ALPAPRAANA GAYANNA', +3485: 'SINHALA LETTER MAHAAPRAANA GAYANNA', +3486: 'SINHALA LETTER KANTAJA NAASIKYAYA', +3487: 'SINHALA LETTER SANYAKA GAYANNA', +3488: 'SINHALA LETTER ALPAPRAANA CAYANNA', +3489: 'SINHALA LETTER MAHAAPRAANA CAYANNA', +3490: 'SINHALA LETTER ALPAPRAANA JAYANNA', +3491: 'SINHALA LETTER MAHAAPRAANA JAYANNA', +3492: 'SINHALA LETTER TAALUJA NAASIKYAYA', +3493: 'SINHALA LETTER TAALUJA SANYOOGA NAAKSIKYAYA', +3494: 'SINHALA LETTER SANYAKA JAYANNA', +3495: 'SINHALA LETTER ALPAPRAANA TTAYANNA', +3496: 'SINHALA LETTER MAHAAPRAANA TTAYANNA', +3497: 'SINHALA LETTER ALPAPRAANA DDAYANNA', +3498: 'SINHALA LETTER MAHAAPRAANA DDAYANNA', +3499: 'SINHALA LETTER MUURDHAJA NAYANNA', +3500: 'SINHALA LETTER SANYAKA DDAYANNA', +3501: 'SINHALA LETTER ALPAPRAANA TAYANNA', +3502: 'SINHALA LETTER MAHAAPRAANA TAYANNA', +3503: 'SINHALA LETTER ALPAPRAANA DAYANNA', +3504: 'SINHALA LETTER MAHAAPRAANA DAYANNA', +3505: 'SINHALA LETTER DANTAJA NAYANNA', +3507: 'SINHALA LETTER SANYAKA DAYANNA', +3508: 'SINHALA LETTER ALPAPRAANA PAYANNA', +3509: 'SINHALA LETTER MAHAAPRAANA PAYANNA', +3510: 'SINHALA LETTER ALPAPRAANA BAYANNA', +3511: 'SINHALA LETTER MAHAAPRAANA BAYANNA', +3512: 'SINHALA LETTER MAYANNA', +3513: 'SINHALA LETTER AMBA BAYANNA', +3514: 'SINHALA LETTER YAYANNA', +3515: 'SINHALA LETTER RAYANNA', +3517: 'SINHALA LETTER DANTAJA LAYANNA', +3520: 'SINHALA LETTER VAYANNA', +3521: 'SINHALA LETTER TAALUJA SAYANNA', +3522: 'SINHALA LETTER MUURDHAJA SAYANNA', +3523: 'SINHALA LETTER DANTAJA SAYANNA', +3524: 'SINHALA LETTER HAYANNA', +3525: 'SINHALA LETTER MUURDHAJA LAYANNA', +3526: 'SINHALA LETTER FAYANNA', +3530: 'SINHALA SIGN AL-LAKUNA', +3535: 'SINHALA VOWEL SIGN AELA-PILLA', +3536: 'SINHALA VOWEL SIGN KETTI AEDA-PILLA', +3537: 'SINHALA VOWEL SIGN DIGA AEDA-PILLA', +3538: 'SINHALA VOWEL SIGN KETTI IS-PILLA', +3539: 'SINHALA VOWEL SIGN DIGA IS-PILLA', +3540: 'SINHALA VOWEL SIGN KETTI PAA-PILLA', +3542: 'SINHALA VOWEL SIGN DIGA PAA-PILLA', +3544: 'SINHALA VOWEL SIGN GAETTA-PILLA', +3545: 'SINHALA VOWEL SIGN KOMBUVA', +3546: 'SINHALA VOWEL SIGN DIGA KOMBUVA', +3547: 'SINHALA VOWEL SIGN KOMBU DEKA', +3548: 'SINHALA VOWEL SIGN KOMBUVA HAA AELA-PILLA', +3549: 'SINHALA VOWEL SIGN KOMBUVA HAA DIGA AELA-PILLA', +3550: 'SINHALA VOWEL SIGN KOMBUVA HAA GAYANUKITTA', +3551: 'SINHALA VOWEL SIGN GAYANUKITTA', +3570: 'SINHALA VOWEL SIGN DIGA GAETTA-PILLA', +3571: 'SINHALA VOWEL SIGN DIGA GAYANUKITTA', +3572: 'SINHALA PUNCTUATION KUNDDALIYA', +3585: 'THAI CHARACTER KO KAI', +3586: 'THAI CHARACTER KHO KHAI', +3587: 'THAI CHARACTER KHO KHUAT', +3588: 'THAI CHARACTER KHO KHWAI', +3589: 'THAI CHARACTER KHO KHON', +3590: 'THAI CHARACTER KHO RAKHANG', +3591: 'THAI CHARACTER NGO NGU', +3592: 'THAI CHARACTER CHO CHAN', +3593: 'THAI CHARACTER CHO CHING', +3594: 'THAI CHARACTER CHO CHANG', +3595: 'THAI CHARACTER SO SO', +3596: 'THAI CHARACTER CHO CHOE', +3597: 'THAI CHARACTER YO YING', +3598: 'THAI CHARACTER DO CHADA', +3599: 'THAI CHARACTER TO PATAK', +3600: 'THAI CHARACTER THO THAN', +3601: 'THAI CHARACTER THO NANGMONTHO', +3602: 'THAI CHARACTER THO PHUTHAO', +3603: 'THAI CHARACTER NO NEN', +3604: 'THAI CHARACTER DO DEK', +3605: 'THAI CHARACTER TO TAO', +3606: 'THAI CHARACTER THO THUNG', +3607: 'THAI CHARACTER THO THAHAN', +3608: 'THAI CHARACTER THO THONG', +3609: 'THAI CHARACTER NO NU', +3610: 'THAI CHARACTER BO BAIMAI', +3611: 'THAI CHARACTER PO PLA', +3612: 'THAI CHARACTER PHO PHUNG', +3613: 'THAI CHARACTER FO FA', +3614: 'THAI CHARACTER PHO PHAN', +3615: 'THAI CHARACTER FO FAN', +3616: 'THAI CHARACTER PHO SAMPHAO', +3617: 'THAI CHARACTER MO MA', +3618: 'THAI CHARACTER YO YAK', +3619: 'THAI CHARACTER RO RUA', +3620: 'THAI CHARACTER RU', +3621: 'THAI CHARACTER LO LING', +3622: 'THAI CHARACTER LU', +3623: 'THAI CHARACTER WO WAEN', +3624: 'THAI CHARACTER SO SALA', +3625: 'THAI CHARACTER SO RUSI', +3626: 'THAI CHARACTER SO SUA', +3627: 'THAI CHARACTER HO HIP', +3628: 'THAI CHARACTER LO CHULA', +3629: 'THAI CHARACTER O ANG', +3630: 'THAI CHARACTER HO NOKHUK', +3631: 'THAI CHARACTER PAIYANNOI', +3632: 'THAI CHARACTER SARA A', +3633: 'THAI CHARACTER MAI HAN-AKAT', +3634: 'THAI CHARACTER SARA AA', +3635: 'THAI CHARACTER SARA AM', +3636: 'THAI CHARACTER SARA I', +3637: 'THAI CHARACTER SARA II', +3638: 'THAI CHARACTER SARA UE', +3639: 'THAI CHARACTER SARA UEE', +3640: 'THAI CHARACTER SARA U', +3641: 'THAI CHARACTER SARA UU', +3642: 'THAI CHARACTER PHINTHU', +3647: 'THAI CURRENCY SYMBOL BAHT', +3648: 'THAI CHARACTER SARA E', +3649: 'THAI CHARACTER SARA AE', +3650: 'THAI CHARACTER SARA O', +3651: 'THAI CHARACTER SARA AI MAIMUAN', +3652: 'THAI CHARACTER SARA AI MAIMALAI', +3653: 'THAI CHARACTER LAKKHANGYAO', +3654: 'THAI CHARACTER MAIYAMOK', +3655: 'THAI CHARACTER MAITAIKHU', +3656: 'THAI CHARACTER MAI EK', +3657: 'THAI CHARACTER MAI THO', +3658: 'THAI CHARACTER MAI TRI', +3659: 'THAI CHARACTER MAI CHATTAWA', +3660: 'THAI CHARACTER THANTHAKHAT', +3661: 'THAI CHARACTER NIKHAHIT', +3662: 'THAI CHARACTER YAMAKKAN', +3663: 'THAI CHARACTER FONGMAN', +3664: 'THAI DIGIT ZERO', +3665: 'THAI DIGIT ONE', +3666: 'THAI DIGIT TWO', +3667: 'THAI DIGIT THREE', +3668: 'THAI DIGIT FOUR', +3669: 'THAI DIGIT FIVE', +3670: 'THAI DIGIT SIX', +3671: 'THAI DIGIT SEVEN', +3672: 'THAI DIGIT EIGHT', +3673: 'THAI DIGIT NINE', +3674: 'THAI CHARACTER ANGKHANKHU', +3675: 'THAI CHARACTER KHOMUT', +3713: 'LAO LETTER KO', +3714: 'LAO LETTER KHO SUNG', +3716: 'LAO LETTER KHO TAM', +3719: 'LAO LETTER NGO', +3720: 'LAO LETTER CO', +3722: 'LAO LETTER SO TAM', +3725: 'LAO LETTER NYO', +3732: 'LAO LETTER DO', +3733: 'LAO LETTER TO', +3734: 'LAO LETTER THO SUNG', +3735: 'LAO LETTER THO TAM', +3737: 'LAO LETTER NO', +3738: 'LAO LETTER BO', +3739: 'LAO LETTER PO', +3740: 'LAO LETTER PHO SUNG', +3741: 'LAO LETTER FO TAM', +3742: 'LAO LETTER PHO TAM', +3743: 'LAO LETTER FO SUNG', +3745: 'LAO LETTER MO', +3746: 'LAO LETTER YO', +3747: 'LAO LETTER LO LING', +3749: 'LAO LETTER LO LOOT', +3751: 'LAO LETTER WO', +3754: 'LAO LETTER SO SUNG', +3755: 'LAO LETTER HO SUNG', +3757: 'LAO LETTER O', +3758: 'LAO LETTER HO TAM', +3759: 'LAO ELLIPSIS', +3760: 'LAO VOWEL SIGN A', +3761: 'LAO VOWEL SIGN MAI KAN', +3762: 'LAO VOWEL SIGN AA', +3763: 'LAO VOWEL SIGN AM', +3764: 'LAO VOWEL SIGN I', +3765: 'LAO VOWEL SIGN II', +3766: 'LAO VOWEL SIGN Y', +3767: 'LAO VOWEL SIGN YY', +3768: 'LAO VOWEL SIGN U', +3769: 'LAO VOWEL SIGN UU', +3771: 'LAO VOWEL SIGN MAI KON', +3772: 'LAO SEMIVOWEL SIGN LO', +3773: 'LAO SEMIVOWEL SIGN NYO', +3776: 'LAO VOWEL SIGN E', +3777: 'LAO VOWEL SIGN EI', +3778: 'LAO VOWEL SIGN O', +3779: 'LAO VOWEL SIGN AY', +3780: 'LAO VOWEL SIGN AI', +3782: 'LAO KO LA', +3784: 'LAO TONE MAI EK', +3785: 'LAO TONE MAI THO', +3786: 'LAO TONE MAI TI', +3787: 'LAO TONE MAI CATAWA', +3788: 'LAO CANCELLATION MARK', +3789: 'LAO NIGGAHITA', +3792: 'LAO DIGIT ZERO', +3793: 'LAO DIGIT ONE', +3794: 'LAO DIGIT TWO', +3795: 'LAO DIGIT THREE', +3796: 'LAO DIGIT FOUR', +3797: 'LAO DIGIT FIVE', +3798: 'LAO DIGIT SIX', +3799: 'LAO DIGIT SEVEN', +3800: 'LAO DIGIT EIGHT', +3801: 'LAO DIGIT NINE', +3804: 'LAO HO NO', +3805: 'LAO HO MO', +3840: 'TIBETAN SYLLABLE OM', +3841: 'TIBETAN MARK GTER YIG MGO TRUNCATED A', +3842: 'TIBETAN MARK GTER YIG MGO -UM RNAM BCAD MA', +3843: 'TIBETAN MARK GTER YIG MGO -UM GTER TSHEG MA', +3844: 'TIBETAN MARK INITIAL YIG MGO MDUN MA', +3845: 'TIBETAN MARK CLOSING YIG MGO SGAB MA', +3846: 'TIBETAN MARK CARET YIG MGO PHUR SHAD MA', +3847: 'TIBETAN MARK YIG MGO TSHEG SHAD MA', +3848: 'TIBETAN MARK SBRUL SHAD', +3849: 'TIBETAN MARK BSKUR YIG MGO', +3850: 'TIBETAN MARK BKA- SHOG YIG MGO', +3851: 'TIBETAN MARK INTERSYLLABIC TSHEG', +3852: 'TIBETAN MARK DELIMITER TSHEG BSTAR', +3853: 'TIBETAN MARK SHAD', +3854: 'TIBETAN MARK NYIS SHAD', +3855: 'TIBETAN MARK TSHEG SHAD', +3856: 'TIBETAN MARK NYIS TSHEG SHAD', +3857: 'TIBETAN MARK RIN CHEN SPUNGS SHAD', +3858: 'TIBETAN MARK RGYA GRAM SHAD', +3859: 'TIBETAN MARK CARET -DZUD RTAGS ME LONG CAN', +3860: 'TIBETAN MARK GTER TSHEG', +3861: 'TIBETAN LOGOTYPE SIGN CHAD RTAGS', +3862: 'TIBETAN LOGOTYPE SIGN LHAG RTAGS', +3863: 'TIBETAN ASTROLOGICAL SIGN SGRA GCAN -CHAR RTAGS', +3864: 'TIBETAN ASTROLOGICAL SIGN -KHYUD PA', +3865: 'TIBETAN ASTROLOGICAL SIGN SDONG TSHUGS', +3866: 'TIBETAN SIGN RDEL DKAR GCIG', +3867: 'TIBETAN SIGN RDEL DKAR GNYIS', +3868: 'TIBETAN SIGN RDEL DKAR GSUM', +3869: 'TIBETAN SIGN RDEL NAG GCIG', +3870: 'TIBETAN SIGN RDEL NAG GNYIS', +3871: 'TIBETAN SIGN RDEL DKAR RDEL NAG', +3872: 'TIBETAN DIGIT ZERO', +3873: 'TIBETAN DIGIT ONE', +3874: 'TIBETAN DIGIT TWO', +3875: 'TIBETAN DIGIT THREE', +3876: 'TIBETAN DIGIT FOUR', +3877: 'TIBETAN DIGIT FIVE', +3878: 'TIBETAN DIGIT SIX', +3879: 'TIBETAN DIGIT SEVEN', +3880: 'TIBETAN DIGIT EIGHT', +3881: 'TIBETAN DIGIT NINE', +3882: 'TIBETAN DIGIT HALF ONE', +3883: 'TIBETAN DIGIT HALF TWO', +3884: 'TIBETAN DIGIT HALF THREE', +3885: 'TIBETAN DIGIT HALF FOUR', +3886: 'TIBETAN DIGIT HALF FIVE', +3887: 'TIBETAN DIGIT HALF SIX', +3888: 'TIBETAN DIGIT HALF SEVEN', +3889: 'TIBETAN DIGIT HALF EIGHT', +3890: 'TIBETAN DIGIT HALF NINE', +3891: 'TIBETAN DIGIT HALF ZERO', +3892: 'TIBETAN MARK BSDUS RTAGS', +3893: 'TIBETAN MARK NGAS BZUNG NYI ZLA', +3894: 'TIBETAN MARK CARET -DZUD RTAGS BZHI MIG CAN', +3895: 'TIBETAN MARK NGAS BZUNG SGOR RTAGS', +3896: 'TIBETAN MARK CHE MGO', +3897: 'TIBETAN MARK TSA -PHRU', +3898: 'TIBETAN MARK GUG RTAGS GYON', +3899: 'TIBETAN MARK GUG RTAGS GYAS', +3900: 'TIBETAN MARK ANG KHANG GYON', +3901: 'TIBETAN MARK ANG KHANG GYAS', +3902: 'TIBETAN SIGN YAR TSHES', +3903: 'TIBETAN SIGN MAR TSHES', +3904: 'TIBETAN LETTER KA', +3905: 'TIBETAN LETTER KHA', +3906: 'TIBETAN LETTER GA', +3907: 'TIBETAN LETTER GHA', +3908: 'TIBETAN LETTER NGA', +3909: 'TIBETAN LETTER CA', +3910: 'TIBETAN LETTER CHA', +3911: 'TIBETAN LETTER JA', +3913: 'TIBETAN LETTER NYA', +3914: 'TIBETAN LETTER TTA', +3915: 'TIBETAN LETTER TTHA', +3916: 'TIBETAN LETTER DDA', +3917: 'TIBETAN LETTER DDHA', +3918: 'TIBETAN LETTER NNA', +3919: 'TIBETAN LETTER TA', +3920: 'TIBETAN LETTER THA', +3921: 'TIBETAN LETTER DA', +3922: 'TIBETAN LETTER DHA', +3923: 'TIBETAN LETTER NA', +3924: 'TIBETAN LETTER PA', +3925: 'TIBETAN LETTER PHA', +3926: 'TIBETAN LETTER BA', +3927: 'TIBETAN LETTER BHA', +3928: 'TIBETAN LETTER MA', +3929: 'TIBETAN LETTER TSA', +3930: 'TIBETAN LETTER TSHA', +3931: 'TIBETAN LETTER DZA', +3932: 'TIBETAN LETTER DZHA', +3933: 'TIBETAN LETTER WA', +3934: 'TIBETAN LETTER ZHA', +3935: 'TIBETAN LETTER ZA', +3936: 'TIBETAN LETTER -A', +3937: 'TIBETAN LETTER YA', +3938: 'TIBETAN LETTER RA', +3939: 'TIBETAN LETTER LA', +3940: 'TIBETAN LETTER SHA', +3941: 'TIBETAN LETTER SSA', +3942: 'TIBETAN LETTER SA', +3943: 'TIBETAN LETTER HA', +3944: 'TIBETAN LETTER A', +3945: 'TIBETAN LETTER KSSA', +3946: 'TIBETAN LETTER FIXED-FORM RA', +3953: 'TIBETAN VOWEL SIGN AA', +3954: 'TIBETAN VOWEL SIGN I', +3955: 'TIBETAN VOWEL SIGN II', +3956: 'TIBETAN VOWEL SIGN U', +3957: 'TIBETAN VOWEL SIGN UU', +3958: 'TIBETAN VOWEL SIGN VOCALIC R', +3959: 'TIBETAN VOWEL SIGN VOCALIC RR', +3960: 'TIBETAN VOWEL SIGN VOCALIC L', +3961: 'TIBETAN VOWEL SIGN VOCALIC LL', +3962: 'TIBETAN VOWEL SIGN E', +3963: 'TIBETAN VOWEL SIGN EE', +3964: 'TIBETAN VOWEL SIGN O', +3965: 'TIBETAN VOWEL SIGN OO', +3966: 'TIBETAN SIGN RJES SU NGA RO', +3967: 'TIBETAN SIGN RNAM BCAD', +3968: 'TIBETAN VOWEL SIGN REVERSED I', +3969: 'TIBETAN VOWEL SIGN REVERSED II', +3970: 'TIBETAN SIGN NYI ZLA NAA DA', +3971: 'TIBETAN SIGN SNA LDAN', +3972: 'TIBETAN MARK HALANTA', +3973: 'TIBETAN MARK PALUTA', +3974: 'TIBETAN SIGN LCI RTAGS', +3975: 'TIBETAN SIGN YANG RTAGS', +3976: 'TIBETAN SIGN LCE TSA CAN', +3977: 'TIBETAN SIGN MCHU CAN', +3978: 'TIBETAN SIGN GRU CAN RGYINGS', +3979: 'TIBETAN SIGN GRU MED RGYINGS', +3984: 'TIBETAN SUBJOINED LETTER KA', +3985: 'TIBETAN SUBJOINED LETTER KHA', +3986: 'TIBETAN SUBJOINED LETTER GA', +3987: 'TIBETAN SUBJOINED LETTER GHA', +3988: 'TIBETAN SUBJOINED LETTER NGA', +3989: 'TIBETAN SUBJOINED LETTER CA', +3990: 'TIBETAN SUBJOINED LETTER CHA', +3991: 'TIBETAN SUBJOINED LETTER JA', +3993: 'TIBETAN SUBJOINED LETTER NYA', +3994: 'TIBETAN SUBJOINED LETTER TTA', +3995: 'TIBETAN SUBJOINED LETTER TTHA', +3996: 'TIBETAN SUBJOINED LETTER DDA', +3997: 'TIBETAN SUBJOINED LETTER DDHA', +3998: 'TIBETAN SUBJOINED LETTER NNA', +3999: 'TIBETAN SUBJOINED LETTER TA', +4000: 'TIBETAN SUBJOINED LETTER THA', +4001: 'TIBETAN SUBJOINED LETTER DA', +4002: 'TIBETAN SUBJOINED LETTER DHA', +4003: 'TIBETAN SUBJOINED LETTER NA', +4004: 'TIBETAN SUBJOINED LETTER PA', +4005: 'TIBETAN SUBJOINED LETTER PHA', +4006: 'TIBETAN SUBJOINED LETTER BA', +4007: 'TIBETAN SUBJOINED LETTER BHA', +4008: 'TIBETAN SUBJOINED LETTER MA', +4009: 'TIBETAN SUBJOINED LETTER TSA', +4010: 'TIBETAN SUBJOINED LETTER TSHA', +4011: 'TIBETAN SUBJOINED LETTER DZA', +4012: 'TIBETAN SUBJOINED LETTER DZHA', +4013: 'TIBETAN SUBJOINED LETTER WA', +4014: 'TIBETAN SUBJOINED LETTER ZHA', +4015: 'TIBETAN SUBJOINED LETTER ZA', +4016: 'TIBETAN SUBJOINED LETTER -A', +4017: 'TIBETAN SUBJOINED LETTER YA', +4018: 'TIBETAN SUBJOINED LETTER RA', +4019: 'TIBETAN SUBJOINED LETTER LA', +4020: 'TIBETAN SUBJOINED LETTER SHA', +4021: 'TIBETAN SUBJOINED LETTER SSA', +4022: 'TIBETAN SUBJOINED LETTER SA', +4023: 'TIBETAN SUBJOINED LETTER HA', +4024: 'TIBETAN SUBJOINED LETTER A', +4025: 'TIBETAN SUBJOINED LETTER KSSA', +4026: 'TIBETAN SUBJOINED LETTER FIXED-FORM WA', +4027: 'TIBETAN SUBJOINED LETTER FIXED-FORM YA', +4028: 'TIBETAN SUBJOINED LETTER FIXED-FORM RA', +4030: 'TIBETAN KU RU KHA', +4031: 'TIBETAN KU RU KHA BZHI MIG CAN', +4032: 'TIBETAN CANTILLATION SIGN HEAVY BEAT', +4033: 'TIBETAN CANTILLATION SIGN LIGHT BEAT', +4034: 'TIBETAN CANTILLATION SIGN CANG TE-U', +4035: 'TIBETAN CANTILLATION SIGN SBUB -CHAL', +4036: 'TIBETAN SYMBOL DRIL BU', +4037: 'TIBETAN SYMBOL RDO RJE', +4038: 'TIBETAN SYMBOL PADMA GDAN', +4039: 'TIBETAN SYMBOL RDO RJE RGYA GRAM', +4040: 'TIBETAN SYMBOL PHUR PA', +4041: 'TIBETAN SYMBOL NOR BU', +4042: 'TIBETAN SYMBOL NOR BU NYIS -KHYIL', +4043: 'TIBETAN SYMBOL NOR BU GSUM -KHYIL', +4044: 'TIBETAN SYMBOL NOR BU BZHI -KHYIL', +4047: 'TIBETAN SIGN RDEL NAG GSUM', +4096: 'MYANMAR LETTER KA', +4097: 'MYANMAR LETTER KHA', +4098: 'MYANMAR LETTER GA', +4099: 'MYANMAR LETTER GHA', +4100: 'MYANMAR LETTER NGA', +4101: 'MYANMAR LETTER CA', +4102: 'MYANMAR LETTER CHA', +4103: 'MYANMAR LETTER JA', +4104: 'MYANMAR LETTER JHA', +4105: 'MYANMAR LETTER NYA', +4106: 'MYANMAR LETTER NNYA', +4107: 'MYANMAR LETTER TTA', +4108: 'MYANMAR LETTER TTHA', +4109: 'MYANMAR LETTER DDA', +4110: 'MYANMAR LETTER DDHA', +4111: 'MYANMAR LETTER NNA', +4112: 'MYANMAR LETTER TA', +4113: 'MYANMAR LETTER THA', +4114: 'MYANMAR LETTER DA', +4115: 'MYANMAR LETTER DHA', +4116: 'MYANMAR LETTER NA', +4117: 'MYANMAR LETTER PA', +4118: 'MYANMAR LETTER PHA', +4119: 'MYANMAR LETTER BA', +4120: 'MYANMAR LETTER BHA', +4121: 'MYANMAR LETTER MA', +4122: 'MYANMAR LETTER YA', +4123: 'MYANMAR LETTER RA', +4124: 'MYANMAR LETTER LA', +4125: 'MYANMAR LETTER WA', +4126: 'MYANMAR LETTER SA', +4127: 'MYANMAR LETTER HA', +4128: 'MYANMAR LETTER LLA', +4129: 'MYANMAR LETTER A', +4131: 'MYANMAR LETTER I', +4132: 'MYANMAR LETTER II', +4133: 'MYANMAR LETTER U', +4134: 'MYANMAR LETTER UU', +4135: 'MYANMAR LETTER E', +4137: 'MYANMAR LETTER O', +4138: 'MYANMAR LETTER AU', +4140: 'MYANMAR VOWEL SIGN AA', +4141: 'MYANMAR VOWEL SIGN I', +4142: 'MYANMAR VOWEL SIGN II', +4143: 'MYANMAR VOWEL SIGN U', +4144: 'MYANMAR VOWEL SIGN UU', +4145: 'MYANMAR VOWEL SIGN E', +4146: 'MYANMAR VOWEL SIGN AI', +4150: 'MYANMAR SIGN ANUSVARA', +4151: 'MYANMAR SIGN DOT BELOW', +4152: 'MYANMAR SIGN VISARGA', +4153: 'MYANMAR SIGN VIRAMA', +4160: 'MYANMAR DIGIT ZERO', +4161: 'MYANMAR DIGIT ONE', +4162: 'MYANMAR DIGIT TWO', +4163: 'MYANMAR DIGIT THREE', +4164: 'MYANMAR DIGIT FOUR', +4165: 'MYANMAR DIGIT FIVE', +4166: 'MYANMAR DIGIT SIX', +4167: 'MYANMAR DIGIT SEVEN', +4168: 'MYANMAR DIGIT EIGHT', +4169: 'MYANMAR DIGIT NINE', +4170: 'MYANMAR SIGN LITTLE SECTION', +4171: 'MYANMAR SIGN SECTION', +4172: 'MYANMAR SYMBOL LOCATIVE', +4173: 'MYANMAR SYMBOL COMPLETED', +4174: 'MYANMAR SYMBOL AFOREMENTIONED', +4175: 'MYANMAR SYMBOL GENITIVE', +4176: 'MYANMAR LETTER SHA', +4177: 'MYANMAR LETTER SSA', +4178: 'MYANMAR LETTER VOCALIC R', +4179: 'MYANMAR LETTER VOCALIC RR', +4180: 'MYANMAR LETTER VOCALIC L', +4181: 'MYANMAR LETTER VOCALIC LL', +4182: 'MYANMAR VOWEL SIGN VOCALIC R', +4183: 'MYANMAR VOWEL SIGN VOCALIC RR', +4184: 'MYANMAR VOWEL SIGN VOCALIC L', +4185: 'MYANMAR VOWEL SIGN VOCALIC LL', +4256: 'GEORGIAN CAPITAL LETTER AN', +4257: 'GEORGIAN CAPITAL LETTER BAN', +4258: 'GEORGIAN CAPITAL LETTER GAN', +4259: 'GEORGIAN CAPITAL LETTER DON', +4260: 'GEORGIAN CAPITAL LETTER EN', +4261: 'GEORGIAN CAPITAL LETTER VIN', +4262: 'GEORGIAN CAPITAL LETTER ZEN', +4263: 'GEORGIAN CAPITAL LETTER TAN', +4264: 'GEORGIAN CAPITAL LETTER IN', +4265: 'GEORGIAN CAPITAL LETTER KAN', +4266: 'GEORGIAN CAPITAL LETTER LAS', +4267: 'GEORGIAN CAPITAL LETTER MAN', +4268: 'GEORGIAN CAPITAL LETTER NAR', +4269: 'GEORGIAN CAPITAL LETTER ON', +4270: 'GEORGIAN CAPITAL LETTER PAR', +4271: 'GEORGIAN CAPITAL LETTER ZHAR', +4272: 'GEORGIAN CAPITAL LETTER RAE', +4273: 'GEORGIAN CAPITAL LETTER SAN', +4274: 'GEORGIAN CAPITAL LETTER TAR', +4275: 'GEORGIAN CAPITAL LETTER UN', +4276: 'GEORGIAN CAPITAL LETTER PHAR', +4277: 'GEORGIAN CAPITAL LETTER KHAR', +4278: 'GEORGIAN CAPITAL LETTER GHAN', +4279: 'GEORGIAN CAPITAL LETTER QAR', +4280: 'GEORGIAN CAPITAL LETTER SHIN', +4281: 'GEORGIAN CAPITAL LETTER CHIN', +4282: 'GEORGIAN CAPITAL LETTER CAN', +4283: 'GEORGIAN CAPITAL LETTER JIL', +4284: 'GEORGIAN CAPITAL LETTER CIL', +4285: 'GEORGIAN CAPITAL LETTER CHAR', +4286: 'GEORGIAN CAPITAL LETTER XAN', +4287: 'GEORGIAN CAPITAL LETTER JHAN', +4288: 'GEORGIAN CAPITAL LETTER HAE', +4289: 'GEORGIAN CAPITAL LETTER HE', +4290: 'GEORGIAN CAPITAL LETTER HIE', +4291: 'GEORGIAN CAPITAL LETTER WE', +4292: 'GEORGIAN CAPITAL LETTER HAR', +4293: 'GEORGIAN CAPITAL LETTER HOE', +4304: 'GEORGIAN LETTER AN', +4305: 'GEORGIAN LETTER BAN', +4306: 'GEORGIAN LETTER GAN', +4307: 'GEORGIAN LETTER DON', +4308: 'GEORGIAN LETTER EN', +4309: 'GEORGIAN LETTER VIN', +4310: 'GEORGIAN LETTER ZEN', +4311: 'GEORGIAN LETTER TAN', +4312: 'GEORGIAN LETTER IN', +4313: 'GEORGIAN LETTER KAN', +4314: 'GEORGIAN LETTER LAS', +4315: 'GEORGIAN LETTER MAN', +4316: 'GEORGIAN LETTER NAR', +4317: 'GEORGIAN LETTER ON', +4318: 'GEORGIAN LETTER PAR', +4319: 'GEORGIAN LETTER ZHAR', +4320: 'GEORGIAN LETTER RAE', +4321: 'GEORGIAN LETTER SAN', +4322: 'GEORGIAN LETTER TAR', +4323: 'GEORGIAN LETTER UN', +4324: 'GEORGIAN LETTER PHAR', +4325: 'GEORGIAN LETTER KHAR', +4326: 'GEORGIAN LETTER GHAN', +4327: 'GEORGIAN LETTER QAR', +4328: 'GEORGIAN LETTER SHIN', +4329: 'GEORGIAN LETTER CHIN', +4330: 'GEORGIAN LETTER CAN', +4331: 'GEORGIAN LETTER JIL', +4332: 'GEORGIAN LETTER CIL', +4333: 'GEORGIAN LETTER CHAR', +4334: 'GEORGIAN LETTER XAN', +4335: 'GEORGIAN LETTER JHAN', +4336: 'GEORGIAN LETTER HAE', +4337: 'GEORGIAN LETTER HE', +4338: 'GEORGIAN LETTER HIE', +4339: 'GEORGIAN LETTER WE', +4340: 'GEORGIAN LETTER HAR', +4341: 'GEORGIAN LETTER HOE', +4342: 'GEORGIAN LETTER FI', +4343: 'GEORGIAN LETTER YN', +4344: 'GEORGIAN LETTER ELIFI', +4347: 'GEORGIAN PARAGRAPH SEPARATOR', +4352: 'HANGUL CHOSEONG KIYEOK', +4353: 'HANGUL CHOSEONG SSANGKIYEOK', +4354: 'HANGUL CHOSEONG NIEUN', +4355: 'HANGUL CHOSEONG TIKEUT', +4356: 'HANGUL CHOSEONG SSANGTIKEUT', +4357: 'HANGUL CHOSEONG RIEUL', +4358: 'HANGUL CHOSEONG MIEUM', +4359: 'HANGUL CHOSEONG PIEUP', +4360: 'HANGUL CHOSEONG SSANGPIEUP', +4361: 'HANGUL CHOSEONG SIOS', +4362: 'HANGUL CHOSEONG SSANGSIOS', +4363: 'HANGUL CHOSEONG IEUNG', +4364: 'HANGUL CHOSEONG CIEUC', +4365: 'HANGUL CHOSEONG SSANGCIEUC', +4366: 'HANGUL CHOSEONG CHIEUCH', +4367: 'HANGUL CHOSEONG KHIEUKH', +4368: 'HANGUL CHOSEONG THIEUTH', +4369: 'HANGUL CHOSEONG PHIEUPH', +4370: 'HANGUL CHOSEONG HIEUH', +4371: 'HANGUL CHOSEONG NIEUN-KIYEOK', +4372: 'HANGUL CHOSEONG SSANGNIEUN', +4373: 'HANGUL CHOSEONG NIEUN-TIKEUT', +4374: 'HANGUL CHOSEONG NIEUN-PIEUP', +4375: 'HANGUL CHOSEONG TIKEUT-KIYEOK', +4376: 'HANGUL CHOSEONG RIEUL-NIEUN', +4377: 'HANGUL CHOSEONG SSANGRIEUL', +4378: 'HANGUL CHOSEONG RIEUL-HIEUH', +4379: 'HANGUL CHOSEONG KAPYEOUNRIEUL', +4380: 'HANGUL CHOSEONG MIEUM-PIEUP', +4381: 'HANGUL CHOSEONG KAPYEOUNMIEUM', +4382: 'HANGUL CHOSEONG PIEUP-KIYEOK', +4383: 'HANGUL CHOSEONG PIEUP-NIEUN', +4384: 'HANGUL CHOSEONG PIEUP-TIKEUT', +4385: 'HANGUL CHOSEONG PIEUP-SIOS', +4386: 'HANGUL CHOSEONG PIEUP-SIOS-KIYEOK', +4387: 'HANGUL CHOSEONG PIEUP-SIOS-TIKEUT', +4388: 'HANGUL CHOSEONG PIEUP-SIOS-PIEUP', +4389: 'HANGUL CHOSEONG PIEUP-SSANGSIOS', +4390: 'HANGUL CHOSEONG PIEUP-SIOS-CIEUC', +4391: 'HANGUL CHOSEONG PIEUP-CIEUC', +4392: 'HANGUL CHOSEONG PIEUP-CHIEUCH', +4393: 'HANGUL CHOSEONG PIEUP-THIEUTH', +4394: 'HANGUL CHOSEONG PIEUP-PHIEUPH', +4395: 'HANGUL CHOSEONG KAPYEOUNPIEUP', +4396: 'HANGUL CHOSEONG KAPYEOUNSSANGPIEUP', +4397: 'HANGUL CHOSEONG SIOS-KIYEOK', +4398: 'HANGUL CHOSEONG SIOS-NIEUN', +4399: 'HANGUL CHOSEONG SIOS-TIKEUT', +4400: 'HANGUL CHOSEONG SIOS-RIEUL', +4401: 'HANGUL CHOSEONG SIOS-MIEUM', +4402: 'HANGUL CHOSEONG SIOS-PIEUP', +4403: 'HANGUL CHOSEONG SIOS-PIEUP-KIYEOK', +4404: 'HANGUL CHOSEONG SIOS-SSANGSIOS', +4405: 'HANGUL CHOSEONG SIOS-IEUNG', +4406: 'HANGUL CHOSEONG SIOS-CIEUC', +4407: 'HANGUL CHOSEONG SIOS-CHIEUCH', +4408: 'HANGUL CHOSEONG SIOS-KHIEUKH', +4409: 'HANGUL CHOSEONG SIOS-THIEUTH', +4410: 'HANGUL CHOSEONG SIOS-PHIEUPH', +4411: 'HANGUL CHOSEONG SIOS-HIEUH', +4412: 'HANGUL CHOSEONG CHITUEUMSIOS', +4413: 'HANGUL CHOSEONG CHITUEUMSSANGSIOS', +4414: 'HANGUL CHOSEONG CEONGCHIEUMSIOS', +4415: 'HANGUL CHOSEONG CEONGCHIEUMSSANGSIOS', +4416: 'HANGUL CHOSEONG PANSIOS', +4417: 'HANGUL CHOSEONG IEUNG-KIYEOK', +4418: 'HANGUL CHOSEONG IEUNG-TIKEUT', +4419: 'HANGUL CHOSEONG IEUNG-MIEUM', +4420: 'HANGUL CHOSEONG IEUNG-PIEUP', +4421: 'HANGUL CHOSEONG IEUNG-SIOS', +4422: 'HANGUL CHOSEONG IEUNG-PANSIOS', +4423: 'HANGUL CHOSEONG SSANGIEUNG', +4424: 'HANGUL CHOSEONG IEUNG-CIEUC', +4425: 'HANGUL CHOSEONG IEUNG-CHIEUCH', +4426: 'HANGUL CHOSEONG IEUNG-THIEUTH', +4427: 'HANGUL CHOSEONG IEUNG-PHIEUPH', +4428: 'HANGUL CHOSEONG YESIEUNG', +4429: 'HANGUL CHOSEONG CIEUC-IEUNG', +4430: 'HANGUL CHOSEONG CHITUEUMCIEUC', +4431: 'HANGUL CHOSEONG CHITUEUMSSANGCIEUC', +4432: 'HANGUL CHOSEONG CEONGCHIEUMCIEUC', +4433: 'HANGUL CHOSEONG CEONGCHIEUMSSANGCIEUC', +4434: 'HANGUL CHOSEONG CHIEUCH-KHIEUKH', +4435: 'HANGUL CHOSEONG CHIEUCH-HIEUH', +4436: 'HANGUL CHOSEONG CHITUEUMCHIEUCH', +4437: 'HANGUL CHOSEONG CEONGCHIEUMCHIEUCH', +4438: 'HANGUL CHOSEONG PHIEUPH-PIEUP', +4439: 'HANGUL CHOSEONG KAPYEOUNPHIEUPH', +4440: 'HANGUL CHOSEONG SSANGHIEUH', +4441: 'HANGUL CHOSEONG YEORINHIEUH', +4447: 'HANGUL CHOSEONG FILLER', +4448: 'HANGUL JUNGSEONG FILLER', +4449: 'HANGUL JUNGSEONG A', +4450: 'HANGUL JUNGSEONG AE', +4451: 'HANGUL JUNGSEONG YA', +4452: 'HANGUL JUNGSEONG YAE', +4453: 'HANGUL JUNGSEONG EO', +4454: 'HANGUL JUNGSEONG E', +4455: 'HANGUL JUNGSEONG YEO', +4456: 'HANGUL JUNGSEONG YE', +4457: 'HANGUL JUNGSEONG O', +4458: 'HANGUL JUNGSEONG WA', +4459: 'HANGUL JUNGSEONG WAE', +4460: 'HANGUL JUNGSEONG OE', +4461: 'HANGUL JUNGSEONG YO', +4462: 'HANGUL JUNGSEONG U', +4463: 'HANGUL JUNGSEONG WEO', +4464: 'HANGUL JUNGSEONG WE', +4465: 'HANGUL JUNGSEONG WI', +4466: 'HANGUL JUNGSEONG YU', +4467: 'HANGUL JUNGSEONG EU', +4468: 'HANGUL JUNGSEONG YI', +4469: 'HANGUL JUNGSEONG I', +4470: 'HANGUL JUNGSEONG A-O', +4471: 'HANGUL JUNGSEONG A-U', +4472: 'HANGUL JUNGSEONG YA-O', +4473: 'HANGUL JUNGSEONG YA-YO', +4474: 'HANGUL JUNGSEONG EO-O', +4475: 'HANGUL JUNGSEONG EO-U', +4476: 'HANGUL JUNGSEONG EO-EU', +4477: 'HANGUL JUNGSEONG YEO-O', +4478: 'HANGUL JUNGSEONG YEO-U', +4479: 'HANGUL JUNGSEONG O-EO', +4480: 'HANGUL JUNGSEONG O-E', +4481: 'HANGUL JUNGSEONG O-YE', +4482: 'HANGUL JUNGSEONG O-O', +4483: 'HANGUL JUNGSEONG O-U', +4484: 'HANGUL JUNGSEONG YO-YA', +4485: 'HANGUL JUNGSEONG YO-YAE', +4486: 'HANGUL JUNGSEONG YO-YEO', +4487: 'HANGUL JUNGSEONG YO-O', +4488: 'HANGUL JUNGSEONG YO-I', +4489: 'HANGUL JUNGSEONG U-A', +4490: 'HANGUL JUNGSEONG U-AE', +4491: 'HANGUL JUNGSEONG U-EO-EU', +4492: 'HANGUL JUNGSEONG U-YE', +4493: 'HANGUL JUNGSEONG U-U', +4494: 'HANGUL JUNGSEONG YU-A', +4495: 'HANGUL JUNGSEONG YU-EO', +4496: 'HANGUL JUNGSEONG YU-E', +4497: 'HANGUL JUNGSEONG YU-YEO', +4498: 'HANGUL JUNGSEONG YU-YE', +4499: 'HANGUL JUNGSEONG YU-U', +4500: 'HANGUL JUNGSEONG YU-I', +4501: 'HANGUL JUNGSEONG EU-U', +4502: 'HANGUL JUNGSEONG EU-EU', +4503: 'HANGUL JUNGSEONG YI-U', +4504: 'HANGUL JUNGSEONG I-A', +4505: 'HANGUL JUNGSEONG I-YA', +4506: 'HANGUL JUNGSEONG I-O', +4507: 'HANGUL JUNGSEONG I-U', +4508: 'HANGUL JUNGSEONG I-EU', +4509: 'HANGUL JUNGSEONG I-ARAEA', +4510: 'HANGUL JUNGSEONG ARAEA', +4511: 'HANGUL JUNGSEONG ARAEA-EO', +4512: 'HANGUL JUNGSEONG ARAEA-U', +4513: 'HANGUL JUNGSEONG ARAEA-I', +4514: 'HANGUL JUNGSEONG SSANGARAEA', +4520: 'HANGUL JONGSEONG KIYEOK', +4521: 'HANGUL JONGSEONG SSANGKIYEOK', +4522: 'HANGUL JONGSEONG KIYEOK-SIOS', +4523: 'HANGUL JONGSEONG NIEUN', +4524: 'HANGUL JONGSEONG NIEUN-CIEUC', +4525: 'HANGUL JONGSEONG NIEUN-HIEUH', +4526: 'HANGUL JONGSEONG TIKEUT', +4527: 'HANGUL JONGSEONG RIEUL', +4528: 'HANGUL JONGSEONG RIEUL-KIYEOK', +4529: 'HANGUL JONGSEONG RIEUL-MIEUM', +4530: 'HANGUL JONGSEONG RIEUL-PIEUP', +4531: 'HANGUL JONGSEONG RIEUL-SIOS', +4532: 'HANGUL JONGSEONG RIEUL-THIEUTH', +4533: 'HANGUL JONGSEONG RIEUL-PHIEUPH', +4534: 'HANGUL JONGSEONG RIEUL-HIEUH', +4535: 'HANGUL JONGSEONG MIEUM', +4536: 'HANGUL JONGSEONG PIEUP', +4537: 'HANGUL JONGSEONG PIEUP-SIOS', +4538: 'HANGUL JONGSEONG SIOS', +4539: 'HANGUL JONGSEONG SSANGSIOS', +4540: 'HANGUL JONGSEONG IEUNG', +4541: 'HANGUL JONGSEONG CIEUC', +4542: 'HANGUL JONGSEONG CHIEUCH', +4543: 'HANGUL JONGSEONG KHIEUKH', +4544: 'HANGUL JONGSEONG THIEUTH', +4545: 'HANGUL JONGSEONG PHIEUPH', +4546: 'HANGUL JONGSEONG HIEUH', +4547: 'HANGUL JONGSEONG KIYEOK-RIEUL', +4548: 'HANGUL JONGSEONG KIYEOK-SIOS-KIYEOK', +4549: 'HANGUL JONGSEONG NIEUN-KIYEOK', +4550: 'HANGUL JONGSEONG NIEUN-TIKEUT', +4551: 'HANGUL JONGSEONG NIEUN-SIOS', +4552: 'HANGUL JONGSEONG NIEUN-PANSIOS', +4553: 'HANGUL JONGSEONG NIEUN-THIEUTH', +4554: 'HANGUL JONGSEONG TIKEUT-KIYEOK', +4555: 'HANGUL JONGSEONG TIKEUT-RIEUL', +4556: 'HANGUL JONGSEONG RIEUL-KIYEOK-SIOS', +4557: 'HANGUL JONGSEONG RIEUL-NIEUN', +4558: 'HANGUL JONGSEONG RIEUL-TIKEUT', +4559: 'HANGUL JONGSEONG RIEUL-TIKEUT-HIEUH', +4560: 'HANGUL JONGSEONG SSANGRIEUL', +4561: 'HANGUL JONGSEONG RIEUL-MIEUM-KIYEOK', +4562: 'HANGUL JONGSEONG RIEUL-MIEUM-SIOS', +4563: 'HANGUL JONGSEONG RIEUL-PIEUP-SIOS', +4564: 'HANGUL JONGSEONG RIEUL-PIEUP-HIEUH', +4565: 'HANGUL JONGSEONG RIEUL-KAPYEOUNPIEUP', +4566: 'HANGUL JONGSEONG RIEUL-SSANGSIOS', +4567: 'HANGUL JONGSEONG RIEUL-PANSIOS', +4568: 'HANGUL JONGSEONG RIEUL-KHIEUKH', +4569: 'HANGUL JONGSEONG RIEUL-YEORINHIEUH', +4570: 'HANGUL JONGSEONG MIEUM-KIYEOK', +4571: 'HANGUL JONGSEONG MIEUM-RIEUL', +4572: 'HANGUL JONGSEONG MIEUM-PIEUP', +4573: 'HANGUL JONGSEONG MIEUM-SIOS', +4574: 'HANGUL JONGSEONG MIEUM-SSANGSIOS', +4575: 'HANGUL JONGSEONG MIEUM-PANSIOS', +4576: 'HANGUL JONGSEONG MIEUM-CHIEUCH', +4577: 'HANGUL JONGSEONG MIEUM-HIEUH', +4578: 'HANGUL JONGSEONG KAPYEOUNMIEUM', +4579: 'HANGUL JONGSEONG PIEUP-RIEUL', +4580: 'HANGUL JONGSEONG PIEUP-PHIEUPH', +4581: 'HANGUL JONGSEONG PIEUP-HIEUH', +4582: 'HANGUL JONGSEONG KAPYEOUNPIEUP', +4583: 'HANGUL JONGSEONG SIOS-KIYEOK', +4584: 'HANGUL JONGSEONG SIOS-TIKEUT', +4585: 'HANGUL JONGSEONG SIOS-RIEUL', +4586: 'HANGUL JONGSEONG SIOS-PIEUP', +4587: 'HANGUL JONGSEONG PANSIOS', +4588: 'HANGUL JONGSEONG IEUNG-KIYEOK', +4589: 'HANGUL JONGSEONG IEUNG-SSANGKIYEOK', +4590: 'HANGUL JONGSEONG SSANGIEUNG', +4591: 'HANGUL JONGSEONG IEUNG-KHIEUKH', +4592: 'HANGUL JONGSEONG YESIEUNG', +4593: 'HANGUL JONGSEONG YESIEUNG-SIOS', +4594: 'HANGUL JONGSEONG YESIEUNG-PANSIOS', +4595: 'HANGUL JONGSEONG PHIEUPH-PIEUP', +4596: 'HANGUL JONGSEONG KAPYEOUNPHIEUPH', +4597: 'HANGUL JONGSEONG HIEUH-NIEUN', +4598: 'HANGUL JONGSEONG HIEUH-RIEUL', +4599: 'HANGUL JONGSEONG HIEUH-MIEUM', +4600: 'HANGUL JONGSEONG HIEUH-PIEUP', +4601: 'HANGUL JONGSEONG YEORINHIEUH', +4608: 'ETHIOPIC SYLLABLE HA', +4609: 'ETHIOPIC SYLLABLE HU', +4610: 'ETHIOPIC SYLLABLE HI', +4611: 'ETHIOPIC SYLLABLE HAA', +4612: 'ETHIOPIC SYLLABLE HEE', +4613: 'ETHIOPIC SYLLABLE HE', +4614: 'ETHIOPIC SYLLABLE HO', +4616: 'ETHIOPIC SYLLABLE LA', +4617: 'ETHIOPIC SYLLABLE LU', +4618: 'ETHIOPIC SYLLABLE LI', +4619: 'ETHIOPIC SYLLABLE LAA', +4620: 'ETHIOPIC SYLLABLE LEE', +4621: 'ETHIOPIC SYLLABLE LE', +4622: 'ETHIOPIC SYLLABLE LO', +4623: 'ETHIOPIC SYLLABLE LWA', +4624: 'ETHIOPIC SYLLABLE HHA', +4625: 'ETHIOPIC SYLLABLE HHU', +4626: 'ETHIOPIC SYLLABLE HHI', +4627: 'ETHIOPIC SYLLABLE HHAA', +4628: 'ETHIOPIC SYLLABLE HHEE', +4629: 'ETHIOPIC SYLLABLE HHE', +4630: 'ETHIOPIC SYLLABLE HHO', +4631: 'ETHIOPIC SYLLABLE HHWA', +4632: 'ETHIOPIC SYLLABLE MA', +4633: 'ETHIOPIC SYLLABLE MU', +4634: 'ETHIOPIC SYLLABLE MI', +4635: 'ETHIOPIC SYLLABLE MAA', +4636: 'ETHIOPIC SYLLABLE MEE', +4637: 'ETHIOPIC SYLLABLE ME', +4638: 'ETHIOPIC SYLLABLE MO', +4639: 'ETHIOPIC SYLLABLE MWA', +4640: 'ETHIOPIC SYLLABLE SZA', +4641: 'ETHIOPIC SYLLABLE SZU', +4642: 'ETHIOPIC SYLLABLE SZI', +4643: 'ETHIOPIC SYLLABLE SZAA', +4644: 'ETHIOPIC SYLLABLE SZEE', +4645: 'ETHIOPIC SYLLABLE SZE', +4646: 'ETHIOPIC SYLLABLE SZO', +4647: 'ETHIOPIC SYLLABLE SZWA', +4648: 'ETHIOPIC SYLLABLE RA', +4649: 'ETHIOPIC SYLLABLE RU', +4650: 'ETHIOPIC SYLLABLE RI', +4651: 'ETHIOPIC SYLLABLE RAA', +4652: 'ETHIOPIC SYLLABLE REE', +4653: 'ETHIOPIC SYLLABLE RE', +4654: 'ETHIOPIC SYLLABLE RO', +4655: 'ETHIOPIC SYLLABLE RWA', +4656: 'ETHIOPIC SYLLABLE SA', +4657: 'ETHIOPIC SYLLABLE SU', +4658: 'ETHIOPIC SYLLABLE SI', +4659: 'ETHIOPIC SYLLABLE SAA', +4660: 'ETHIOPIC SYLLABLE SEE', +4661: 'ETHIOPIC SYLLABLE SE', +4662: 'ETHIOPIC SYLLABLE SO', +4663: 'ETHIOPIC SYLLABLE SWA', +4664: 'ETHIOPIC SYLLABLE SHA', +4665: 'ETHIOPIC SYLLABLE SHU', +4666: 'ETHIOPIC SYLLABLE SHI', +4667: 'ETHIOPIC SYLLABLE SHAA', +4668: 'ETHIOPIC SYLLABLE SHEE', +4669: 'ETHIOPIC SYLLABLE SHE', +4670: 'ETHIOPIC SYLLABLE SHO', +4671: 'ETHIOPIC SYLLABLE SHWA', +4672: 'ETHIOPIC SYLLABLE QA', +4673: 'ETHIOPIC SYLLABLE QU', +4674: 'ETHIOPIC SYLLABLE QI', +4675: 'ETHIOPIC SYLLABLE QAA', +4676: 'ETHIOPIC SYLLABLE QEE', +4677: 'ETHIOPIC SYLLABLE QE', +4678: 'ETHIOPIC SYLLABLE QO', +4680: 'ETHIOPIC SYLLABLE QWA', +4682: 'ETHIOPIC SYLLABLE QWI', +4683: 'ETHIOPIC SYLLABLE QWAA', +4684: 'ETHIOPIC SYLLABLE QWEE', +4685: 'ETHIOPIC SYLLABLE QWE', +4688: 'ETHIOPIC SYLLABLE QHA', +4689: 'ETHIOPIC SYLLABLE QHU', +4690: 'ETHIOPIC SYLLABLE QHI', +4691: 'ETHIOPIC SYLLABLE QHAA', +4692: 'ETHIOPIC SYLLABLE QHEE', +4693: 'ETHIOPIC SYLLABLE QHE', +4694: 'ETHIOPIC SYLLABLE QHO', +4696: 'ETHIOPIC SYLLABLE QHWA', +4698: 'ETHIOPIC SYLLABLE QHWI', +4699: 'ETHIOPIC SYLLABLE QHWAA', +4700: 'ETHIOPIC SYLLABLE QHWEE', +4701: 'ETHIOPIC SYLLABLE QHWE', +4704: 'ETHIOPIC SYLLABLE BA', +4705: 'ETHIOPIC SYLLABLE BU', +4706: 'ETHIOPIC SYLLABLE BI', +4707: 'ETHIOPIC SYLLABLE BAA', +4708: 'ETHIOPIC SYLLABLE BEE', +4709: 'ETHIOPIC SYLLABLE BE', +4710: 'ETHIOPIC SYLLABLE BO', +4711: 'ETHIOPIC SYLLABLE BWA', +4712: 'ETHIOPIC SYLLABLE VA', +4713: 'ETHIOPIC SYLLABLE VU', +4714: 'ETHIOPIC SYLLABLE VI', +4715: 'ETHIOPIC SYLLABLE VAA', +4716: 'ETHIOPIC SYLLABLE VEE', +4717: 'ETHIOPIC SYLLABLE VE', +4718: 'ETHIOPIC SYLLABLE VO', +4719: 'ETHIOPIC SYLLABLE VWA', +4720: 'ETHIOPIC SYLLABLE TA', +4721: 'ETHIOPIC SYLLABLE TU', +4722: 'ETHIOPIC SYLLABLE TI', +4723: 'ETHIOPIC SYLLABLE TAA', +4724: 'ETHIOPIC SYLLABLE TEE', +4725: 'ETHIOPIC SYLLABLE TE', +4726: 'ETHIOPIC SYLLABLE TO', +4727: 'ETHIOPIC SYLLABLE TWA', +4728: 'ETHIOPIC SYLLABLE CA', +4729: 'ETHIOPIC SYLLABLE CU', +4730: 'ETHIOPIC SYLLABLE CI', +4731: 'ETHIOPIC SYLLABLE CAA', +4732: 'ETHIOPIC SYLLABLE CEE', +4733: 'ETHIOPIC SYLLABLE CE', +4734: 'ETHIOPIC SYLLABLE CO', +4735: 'ETHIOPIC SYLLABLE CWA', +4736: 'ETHIOPIC SYLLABLE XA', +4737: 'ETHIOPIC SYLLABLE XU', +4738: 'ETHIOPIC SYLLABLE XI', +4739: 'ETHIOPIC SYLLABLE XAA', +4740: 'ETHIOPIC SYLLABLE XEE', +4741: 'ETHIOPIC SYLLABLE XE', +4742: 'ETHIOPIC SYLLABLE XO', +4744: 'ETHIOPIC SYLLABLE XWA', +4746: 'ETHIOPIC SYLLABLE XWI', +4747: 'ETHIOPIC SYLLABLE XWAA', +4748: 'ETHIOPIC SYLLABLE XWEE', +4749: 'ETHIOPIC SYLLABLE XWE', +4752: 'ETHIOPIC SYLLABLE NA', +4753: 'ETHIOPIC SYLLABLE NU', +4754: 'ETHIOPIC SYLLABLE NI', +4755: 'ETHIOPIC SYLLABLE NAA', +4756: 'ETHIOPIC SYLLABLE NEE', +4757: 'ETHIOPIC SYLLABLE NE', +4758: 'ETHIOPIC SYLLABLE NO', +4759: 'ETHIOPIC SYLLABLE NWA', +4760: 'ETHIOPIC SYLLABLE NYA', +4761: 'ETHIOPIC SYLLABLE NYU', +4762: 'ETHIOPIC SYLLABLE NYI', +4763: 'ETHIOPIC SYLLABLE NYAA', +4764: 'ETHIOPIC SYLLABLE NYEE', +4765: 'ETHIOPIC SYLLABLE NYE', +4766: 'ETHIOPIC SYLLABLE NYO', +4767: 'ETHIOPIC SYLLABLE NYWA', +4768: 'ETHIOPIC SYLLABLE GLOTTAL A', +4769: 'ETHIOPIC SYLLABLE GLOTTAL U', +4770: 'ETHIOPIC SYLLABLE GLOTTAL I', +4771: 'ETHIOPIC SYLLABLE GLOTTAL AA', +4772: 'ETHIOPIC SYLLABLE GLOTTAL EE', +4773: 'ETHIOPIC SYLLABLE GLOTTAL E', +4774: 'ETHIOPIC SYLLABLE GLOTTAL O', +4775: 'ETHIOPIC SYLLABLE GLOTTAL WA', +4776: 'ETHIOPIC SYLLABLE KA', +4777: 'ETHIOPIC SYLLABLE KU', +4778: 'ETHIOPIC SYLLABLE KI', +4779: 'ETHIOPIC SYLLABLE KAA', +4780: 'ETHIOPIC SYLLABLE KEE', +4781: 'ETHIOPIC SYLLABLE KE', +4782: 'ETHIOPIC SYLLABLE KO', +4784: 'ETHIOPIC SYLLABLE KWA', +4786: 'ETHIOPIC SYLLABLE KWI', +4787: 'ETHIOPIC SYLLABLE KWAA', +4788: 'ETHIOPIC SYLLABLE KWEE', +4789: 'ETHIOPIC SYLLABLE KWE', +4792: 'ETHIOPIC SYLLABLE KXA', +4793: 'ETHIOPIC SYLLABLE KXU', +4794: 'ETHIOPIC SYLLABLE KXI', +4795: 'ETHIOPIC SYLLABLE KXAA', +4796: 'ETHIOPIC SYLLABLE KXEE', +4797: 'ETHIOPIC SYLLABLE KXE', +4798: 'ETHIOPIC SYLLABLE KXO', +4800: 'ETHIOPIC SYLLABLE KXWA', +4802: 'ETHIOPIC SYLLABLE KXWI', +4803: 'ETHIOPIC SYLLABLE KXWAA', +4804: 'ETHIOPIC SYLLABLE KXWEE', +4805: 'ETHIOPIC SYLLABLE KXWE', +4808: 'ETHIOPIC SYLLABLE WA', +4809: 'ETHIOPIC SYLLABLE WU', +4810: 'ETHIOPIC SYLLABLE WI', +4811: 'ETHIOPIC SYLLABLE WAA', +4812: 'ETHIOPIC SYLLABLE WEE', +4813: 'ETHIOPIC SYLLABLE WE', +4814: 'ETHIOPIC SYLLABLE WO', +4816: 'ETHIOPIC SYLLABLE PHARYNGEAL A', +4817: 'ETHIOPIC SYLLABLE PHARYNGEAL U', +4818: 'ETHIOPIC SYLLABLE PHARYNGEAL I', +4819: 'ETHIOPIC SYLLABLE PHARYNGEAL AA', +4820: 'ETHIOPIC SYLLABLE PHARYNGEAL EE', +4821: 'ETHIOPIC SYLLABLE PHARYNGEAL E', +4822: 'ETHIOPIC SYLLABLE PHARYNGEAL O', +4824: 'ETHIOPIC SYLLABLE ZA', +4825: 'ETHIOPIC SYLLABLE ZU', +4826: 'ETHIOPIC SYLLABLE ZI', +4827: 'ETHIOPIC SYLLABLE ZAA', +4828: 'ETHIOPIC SYLLABLE ZEE', +4829: 'ETHIOPIC SYLLABLE ZE', +4830: 'ETHIOPIC SYLLABLE ZO', +4831: 'ETHIOPIC SYLLABLE ZWA', +4832: 'ETHIOPIC SYLLABLE ZHA', +4833: 'ETHIOPIC SYLLABLE ZHU', +4834: 'ETHIOPIC SYLLABLE ZHI', +4835: 'ETHIOPIC SYLLABLE ZHAA', +4836: 'ETHIOPIC SYLLABLE ZHEE', +4837: 'ETHIOPIC SYLLABLE ZHE', +4838: 'ETHIOPIC SYLLABLE ZHO', +4839: 'ETHIOPIC SYLLABLE ZHWA', +4840: 'ETHIOPIC SYLLABLE YA', +4841: 'ETHIOPIC SYLLABLE YU', +4842: 'ETHIOPIC SYLLABLE YI', +4843: 'ETHIOPIC SYLLABLE YAA', +4844: 'ETHIOPIC SYLLABLE YEE', +4845: 'ETHIOPIC SYLLABLE YE', +4846: 'ETHIOPIC SYLLABLE YO', +4848: 'ETHIOPIC SYLLABLE DA', +4849: 'ETHIOPIC SYLLABLE DU', +4850: 'ETHIOPIC SYLLABLE DI', +4851: 'ETHIOPIC SYLLABLE DAA', +4852: 'ETHIOPIC SYLLABLE DEE', +4853: 'ETHIOPIC SYLLABLE DE', +4854: 'ETHIOPIC SYLLABLE DO', +4855: 'ETHIOPIC SYLLABLE DWA', +4856: 'ETHIOPIC SYLLABLE DDA', +4857: 'ETHIOPIC SYLLABLE DDU', +4858: 'ETHIOPIC SYLLABLE DDI', +4859: 'ETHIOPIC SYLLABLE DDAA', +4860: 'ETHIOPIC SYLLABLE DDEE', +4861: 'ETHIOPIC SYLLABLE DDE', +4862: 'ETHIOPIC SYLLABLE DDO', +4863: 'ETHIOPIC SYLLABLE DDWA', +4864: 'ETHIOPIC SYLLABLE JA', +4865: 'ETHIOPIC SYLLABLE JU', +4866: 'ETHIOPIC SYLLABLE JI', +4867: 'ETHIOPIC SYLLABLE JAA', +4868: 'ETHIOPIC SYLLABLE JEE', +4869: 'ETHIOPIC SYLLABLE JE', +4870: 'ETHIOPIC SYLLABLE JO', +4871: 'ETHIOPIC SYLLABLE JWA', +4872: 'ETHIOPIC SYLLABLE GA', +4873: 'ETHIOPIC SYLLABLE GU', +4874: 'ETHIOPIC SYLLABLE GI', +4875: 'ETHIOPIC SYLLABLE GAA', +4876: 'ETHIOPIC SYLLABLE GEE', +4877: 'ETHIOPIC SYLLABLE GE', +4878: 'ETHIOPIC SYLLABLE GO', +4880: 'ETHIOPIC SYLLABLE GWA', +4882: 'ETHIOPIC SYLLABLE GWI', +4883: 'ETHIOPIC SYLLABLE GWAA', +4884: 'ETHIOPIC SYLLABLE GWEE', +4885: 'ETHIOPIC SYLLABLE GWE', +4888: 'ETHIOPIC SYLLABLE GGA', +4889: 'ETHIOPIC SYLLABLE GGU', +4890: 'ETHIOPIC SYLLABLE GGI', +4891: 'ETHIOPIC SYLLABLE GGAA', +4892: 'ETHIOPIC SYLLABLE GGEE', +4893: 'ETHIOPIC SYLLABLE GGE', +4894: 'ETHIOPIC SYLLABLE GGO', +4896: 'ETHIOPIC SYLLABLE THA', +4897: 'ETHIOPIC SYLLABLE THU', +4898: 'ETHIOPIC SYLLABLE THI', +4899: 'ETHIOPIC SYLLABLE THAA', +4900: 'ETHIOPIC SYLLABLE THEE', +4901: 'ETHIOPIC SYLLABLE THE', +4902: 'ETHIOPIC SYLLABLE THO', +4903: 'ETHIOPIC SYLLABLE THWA', +4904: 'ETHIOPIC SYLLABLE CHA', +4905: 'ETHIOPIC SYLLABLE CHU', +4906: 'ETHIOPIC SYLLABLE CHI', +4907: 'ETHIOPIC SYLLABLE CHAA', +4908: 'ETHIOPIC SYLLABLE CHEE', +4909: 'ETHIOPIC SYLLABLE CHE', +4910: 'ETHIOPIC SYLLABLE CHO', +4911: 'ETHIOPIC SYLLABLE CHWA', +4912: 'ETHIOPIC SYLLABLE PHA', +4913: 'ETHIOPIC SYLLABLE PHU', +4914: 'ETHIOPIC SYLLABLE PHI', +4915: 'ETHIOPIC SYLLABLE PHAA', +4916: 'ETHIOPIC SYLLABLE PHEE', +4917: 'ETHIOPIC SYLLABLE PHE', +4918: 'ETHIOPIC SYLLABLE PHO', +4919: 'ETHIOPIC SYLLABLE PHWA', +4920: 'ETHIOPIC SYLLABLE TSA', +4921: 'ETHIOPIC SYLLABLE TSU', +4922: 'ETHIOPIC SYLLABLE TSI', +4923: 'ETHIOPIC SYLLABLE TSAA', +4924: 'ETHIOPIC SYLLABLE TSEE', +4925: 'ETHIOPIC SYLLABLE TSE', +4926: 'ETHIOPIC SYLLABLE TSO', +4927: 'ETHIOPIC SYLLABLE TSWA', +4928: 'ETHIOPIC SYLLABLE TZA', +4929: 'ETHIOPIC SYLLABLE TZU', +4930: 'ETHIOPIC SYLLABLE TZI', +4931: 'ETHIOPIC SYLLABLE TZAA', +4932: 'ETHIOPIC SYLLABLE TZEE', +4933: 'ETHIOPIC SYLLABLE TZE', +4934: 'ETHIOPIC SYLLABLE TZO', +4936: 'ETHIOPIC SYLLABLE FA', +4937: 'ETHIOPIC SYLLABLE FU', +4938: 'ETHIOPIC SYLLABLE FI', +4939: 'ETHIOPIC SYLLABLE FAA', +4940: 'ETHIOPIC SYLLABLE FEE', +4941: 'ETHIOPIC SYLLABLE FE', +4942: 'ETHIOPIC SYLLABLE FO', +4943: 'ETHIOPIC SYLLABLE FWA', +4944: 'ETHIOPIC SYLLABLE PA', +4945: 'ETHIOPIC SYLLABLE PU', +4946: 'ETHIOPIC SYLLABLE PI', +4947: 'ETHIOPIC SYLLABLE PAA', +4948: 'ETHIOPIC SYLLABLE PEE', +4949: 'ETHIOPIC SYLLABLE PE', +4950: 'ETHIOPIC SYLLABLE PO', +4951: 'ETHIOPIC SYLLABLE PWA', +4952: 'ETHIOPIC SYLLABLE RYA', +4953: 'ETHIOPIC SYLLABLE MYA', +4954: 'ETHIOPIC SYLLABLE FYA', +4961: 'ETHIOPIC WORDSPACE', +4962: 'ETHIOPIC FULL STOP', +4963: 'ETHIOPIC COMMA', +4964: 'ETHIOPIC SEMICOLON', +4965: 'ETHIOPIC COLON', +4966: 'ETHIOPIC PREFACE COLON', +4967: 'ETHIOPIC QUESTION MARK', +4968: 'ETHIOPIC PARAGRAPH SEPARATOR', +4969: 'ETHIOPIC DIGIT ONE', +4970: 'ETHIOPIC DIGIT TWO', +4971: 'ETHIOPIC DIGIT THREE', +4972: 'ETHIOPIC DIGIT FOUR', +4973: 'ETHIOPIC DIGIT FIVE', +4974: 'ETHIOPIC DIGIT SIX', +4975: 'ETHIOPIC DIGIT SEVEN', +4976: 'ETHIOPIC DIGIT EIGHT', +4977: 'ETHIOPIC DIGIT NINE', +4978: 'ETHIOPIC NUMBER TEN', +4979: 'ETHIOPIC NUMBER TWENTY', +4980: 'ETHIOPIC NUMBER THIRTY', +4981: 'ETHIOPIC NUMBER FORTY', +4982: 'ETHIOPIC NUMBER FIFTY', +4983: 'ETHIOPIC NUMBER SIXTY', +4984: 'ETHIOPIC NUMBER SEVENTY', +4985: 'ETHIOPIC NUMBER EIGHTY', +4986: 'ETHIOPIC NUMBER NINETY', +4987: 'ETHIOPIC NUMBER HUNDRED', +4988: 'ETHIOPIC NUMBER TEN THOUSAND', +5024: 'CHEROKEE LETTER A', +5025: 'CHEROKEE LETTER E', +5026: 'CHEROKEE LETTER I', +5027: 'CHEROKEE LETTER O', +5028: 'CHEROKEE LETTER U', +5029: 'CHEROKEE LETTER V', +5030: 'CHEROKEE LETTER GA', +5031: 'CHEROKEE LETTER KA', +5032: 'CHEROKEE LETTER GE', +5033: 'CHEROKEE LETTER GI', +5034: 'CHEROKEE LETTER GO', +5035: 'CHEROKEE LETTER GU', +5036: 'CHEROKEE LETTER GV', +5037: 'CHEROKEE LETTER HA', +5038: 'CHEROKEE LETTER HE', +5039: 'CHEROKEE LETTER HI', +5040: 'CHEROKEE LETTER HO', +5041: 'CHEROKEE LETTER HU', +5042: 'CHEROKEE LETTER HV', +5043: 'CHEROKEE LETTER LA', +5044: 'CHEROKEE LETTER LE', +5045: 'CHEROKEE LETTER LI', +5046: 'CHEROKEE LETTER LO', +5047: 'CHEROKEE LETTER LU', +5048: 'CHEROKEE LETTER LV', +5049: 'CHEROKEE LETTER MA', +5050: 'CHEROKEE LETTER ME', +5051: 'CHEROKEE LETTER MI', +5052: 'CHEROKEE LETTER MO', +5053: 'CHEROKEE LETTER MU', +5054: 'CHEROKEE LETTER NA', +5055: 'CHEROKEE LETTER HNA', +5056: 'CHEROKEE LETTER NAH', +5057: 'CHEROKEE LETTER NE', +5058: 'CHEROKEE LETTER NI', +5059: 'CHEROKEE LETTER NO', +5060: 'CHEROKEE LETTER NU', +5061: 'CHEROKEE LETTER NV', +5062: 'CHEROKEE LETTER QUA', +5063: 'CHEROKEE LETTER QUE', +5064: 'CHEROKEE LETTER QUI', +5065: 'CHEROKEE LETTER QUO', +5066: 'CHEROKEE LETTER QUU', +5067: 'CHEROKEE LETTER QUV', +5068: 'CHEROKEE LETTER SA', +5069: 'CHEROKEE LETTER S', +5070: 'CHEROKEE LETTER SE', +5071: 'CHEROKEE LETTER SI', +5072: 'CHEROKEE LETTER SO', +5073: 'CHEROKEE LETTER SU', +5074: 'CHEROKEE LETTER SV', +5075: 'CHEROKEE LETTER DA', +5076: 'CHEROKEE LETTER TA', +5077: 'CHEROKEE LETTER DE', +5078: 'CHEROKEE LETTER TE', +5079: 'CHEROKEE LETTER DI', +5080: 'CHEROKEE LETTER TI', +5081: 'CHEROKEE LETTER DO', +5082: 'CHEROKEE LETTER DU', +5083: 'CHEROKEE LETTER DV', +5084: 'CHEROKEE LETTER DLA', +5085: 'CHEROKEE LETTER TLA', +5086: 'CHEROKEE LETTER TLE', +5087: 'CHEROKEE LETTER TLI', +5088: 'CHEROKEE LETTER TLO', +5089: 'CHEROKEE LETTER TLU', +5090: 'CHEROKEE LETTER TLV', +5091: 'CHEROKEE LETTER TSA', +5092: 'CHEROKEE LETTER TSE', +5093: 'CHEROKEE LETTER TSI', +5094: 'CHEROKEE LETTER TSO', +5095: 'CHEROKEE LETTER TSU', +5096: 'CHEROKEE LETTER TSV', +5097: 'CHEROKEE LETTER WA', +5098: 'CHEROKEE LETTER WE', +5099: 'CHEROKEE LETTER WI', +5100: 'CHEROKEE LETTER WO', +5101: 'CHEROKEE LETTER WU', +5102: 'CHEROKEE LETTER WV', +5103: 'CHEROKEE LETTER YA', +5104: 'CHEROKEE LETTER YE', +5105: 'CHEROKEE LETTER YI', +5106: 'CHEROKEE LETTER YO', +5107: 'CHEROKEE LETTER YU', +5108: 'CHEROKEE LETTER YV', +5121: 'CANADIAN SYLLABICS E', +5122: 'CANADIAN SYLLABICS AAI', +5123: 'CANADIAN SYLLABICS I', +5124: 'CANADIAN SYLLABICS II', +5125: 'CANADIAN SYLLABICS O', +5126: 'CANADIAN SYLLABICS OO', +5127: 'CANADIAN SYLLABICS Y-CREE OO', +5128: 'CANADIAN SYLLABICS CARRIER EE', +5129: 'CANADIAN SYLLABICS CARRIER I', +5130: 'CANADIAN SYLLABICS A', +5131: 'CANADIAN SYLLABICS AA', +5132: 'CANADIAN SYLLABICS WE', +5133: 'CANADIAN SYLLABICS WEST-CREE WE', +5134: 'CANADIAN SYLLABICS WI', +5135: 'CANADIAN SYLLABICS WEST-CREE WI', +5136: 'CANADIAN SYLLABICS WII', +5137: 'CANADIAN SYLLABICS WEST-CREE WII', +5138: 'CANADIAN SYLLABICS WO', +5139: 'CANADIAN SYLLABICS WEST-CREE WO', +5140: 'CANADIAN SYLLABICS WOO', +5141: 'CANADIAN SYLLABICS WEST-CREE WOO', +5142: 'CANADIAN SYLLABICS NASKAPI WOO', +5143: 'CANADIAN SYLLABICS WA', +5144: 'CANADIAN SYLLABICS WEST-CREE WA', +5145: 'CANADIAN SYLLABICS WAA', +5146: 'CANADIAN SYLLABICS WEST-CREE WAA', +5147: 'CANADIAN SYLLABICS NASKAPI WAA', +5148: 'CANADIAN SYLLABICS AI', +5149: 'CANADIAN SYLLABICS Y-CREE W', +5150: 'CANADIAN SYLLABICS GLOTTAL STOP', +5151: 'CANADIAN SYLLABICS FINAL ACUTE', +5152: 'CANADIAN SYLLABICS FINAL GRAVE', +5153: 'CANADIAN SYLLABICS FINAL BOTTOM HALF RING', +5154: 'CANADIAN SYLLABICS FINAL TOP HALF RING', +5155: 'CANADIAN SYLLABICS FINAL RIGHT HALF RING', +5156: 'CANADIAN SYLLABICS FINAL RING', +5157: 'CANADIAN SYLLABICS FINAL DOUBLE ACUTE', +5158: 'CANADIAN SYLLABICS FINAL DOUBLE SHORT VERTICAL STROKES', +5159: 'CANADIAN SYLLABICS FINAL MIDDLE DOT', +5160: 'CANADIAN SYLLABICS FINAL SHORT HORIZONTAL STROKE', +5161: 'CANADIAN SYLLABICS FINAL PLUS', +5162: 'CANADIAN SYLLABICS FINAL DOWN TACK', +5163: 'CANADIAN SYLLABICS EN', +5164: 'CANADIAN SYLLABICS IN', +5165: 'CANADIAN SYLLABICS ON', +5166: 'CANADIAN SYLLABICS AN', +5167: 'CANADIAN SYLLABICS PE', +5168: 'CANADIAN SYLLABICS PAAI', +5169: 'CANADIAN SYLLABICS PI', +5170: 'CANADIAN SYLLABICS PII', +5171: 'CANADIAN SYLLABICS PO', +5172: 'CANADIAN SYLLABICS POO', +5173: 'CANADIAN SYLLABICS Y-CREE POO', +5174: 'CANADIAN SYLLABICS CARRIER HEE', +5175: 'CANADIAN SYLLABICS CARRIER HI', +5176: 'CANADIAN SYLLABICS PA', +5177: 'CANADIAN SYLLABICS PAA', +5178: 'CANADIAN SYLLABICS PWE', +5179: 'CANADIAN SYLLABICS WEST-CREE PWE', +5180: 'CANADIAN SYLLABICS PWI', +5181: 'CANADIAN SYLLABICS WEST-CREE PWI', +5182: 'CANADIAN SYLLABICS PWII', +5183: 'CANADIAN SYLLABICS WEST-CREE PWII', +5184: 'CANADIAN SYLLABICS PWO', +5185: 'CANADIAN SYLLABICS WEST-CREE PWO', +5186: 'CANADIAN SYLLABICS PWOO', +5187: 'CANADIAN SYLLABICS WEST-CREE PWOO', +5188: 'CANADIAN SYLLABICS PWA', +5189: 'CANADIAN SYLLABICS WEST-CREE PWA', +5190: 'CANADIAN SYLLABICS PWAA', +5191: 'CANADIAN SYLLABICS WEST-CREE PWAA', +5192: 'CANADIAN SYLLABICS Y-CREE PWAA', +5193: 'CANADIAN SYLLABICS P', +5194: 'CANADIAN SYLLABICS WEST-CREE P', +5195: 'CANADIAN SYLLABICS CARRIER H', +5196: 'CANADIAN SYLLABICS TE', +5197: 'CANADIAN SYLLABICS TAAI', +5198: 'CANADIAN SYLLABICS TI', +5199: 'CANADIAN SYLLABICS TII', +5200: 'CANADIAN SYLLABICS TO', +5201: 'CANADIAN SYLLABICS TOO', +5202: 'CANADIAN SYLLABICS Y-CREE TOO', +5203: 'CANADIAN SYLLABICS CARRIER DEE', +5204: 'CANADIAN SYLLABICS CARRIER DI', +5205: 'CANADIAN SYLLABICS TA', +5206: 'CANADIAN SYLLABICS TAA', +5207: 'CANADIAN SYLLABICS TWE', +5208: 'CANADIAN SYLLABICS WEST-CREE TWE', +5209: 'CANADIAN SYLLABICS TWI', +5210: 'CANADIAN SYLLABICS WEST-CREE TWI', +5211: 'CANADIAN SYLLABICS TWII', +5212: 'CANADIAN SYLLABICS WEST-CREE TWII', +5213: 'CANADIAN SYLLABICS TWO', +5214: 'CANADIAN SYLLABICS WEST-CREE TWO', +5215: 'CANADIAN SYLLABICS TWOO', +5216: 'CANADIAN SYLLABICS WEST-CREE TWOO', +5217: 'CANADIAN SYLLABICS TWA', +5218: 'CANADIAN SYLLABICS WEST-CREE TWA', +5219: 'CANADIAN SYLLABICS TWAA', +5220: 'CANADIAN SYLLABICS WEST-CREE TWAA', +5221: 'CANADIAN SYLLABICS NASKAPI TWAA', +5222: 'CANADIAN SYLLABICS T', +5223: 'CANADIAN SYLLABICS TTE', +5224: 'CANADIAN SYLLABICS TTI', +5225: 'CANADIAN SYLLABICS TTO', +5226: 'CANADIAN SYLLABICS TTA', +5227: 'CANADIAN SYLLABICS KE', +5228: 'CANADIAN SYLLABICS KAAI', +5229: 'CANADIAN SYLLABICS KI', +5230: 'CANADIAN SYLLABICS KII', +5231: 'CANADIAN SYLLABICS KO', +5232: 'CANADIAN SYLLABICS KOO', +5233: 'CANADIAN SYLLABICS Y-CREE KOO', +5234: 'CANADIAN SYLLABICS KA', +5235: 'CANADIAN SYLLABICS KAA', +5236: 'CANADIAN SYLLABICS KWE', +5237: 'CANADIAN SYLLABICS WEST-CREE KWE', +5238: 'CANADIAN SYLLABICS KWI', +5239: 'CANADIAN SYLLABICS WEST-CREE KWI', +5240: 'CANADIAN SYLLABICS KWII', +5241: 'CANADIAN SYLLABICS WEST-CREE KWII', +5242: 'CANADIAN SYLLABICS KWO', +5243: 'CANADIAN SYLLABICS WEST-CREE KWO', +5244: 'CANADIAN SYLLABICS KWOO', +5245: 'CANADIAN SYLLABICS WEST-CREE KWOO', +5246: 'CANADIAN SYLLABICS KWA', +5247: 'CANADIAN SYLLABICS WEST-CREE KWA', +5248: 'CANADIAN SYLLABICS KWAA', +5249: 'CANADIAN SYLLABICS WEST-CREE KWAA', +5250: 'CANADIAN SYLLABICS NASKAPI KWAA', +5251: 'CANADIAN SYLLABICS K', +5252: 'CANADIAN SYLLABICS KW', +5253: 'CANADIAN SYLLABICS SOUTH-SLAVEY KEH', +5254: 'CANADIAN SYLLABICS SOUTH-SLAVEY KIH', +5255: 'CANADIAN SYLLABICS SOUTH-SLAVEY KOH', +5256: 'CANADIAN SYLLABICS SOUTH-SLAVEY KAH', +5257: 'CANADIAN SYLLABICS CE', +5258: 'CANADIAN SYLLABICS CAAI', +5259: 'CANADIAN SYLLABICS CI', +5260: 'CANADIAN SYLLABICS CII', +5261: 'CANADIAN SYLLABICS CO', +5262: 'CANADIAN SYLLABICS COO', +5263: 'CANADIAN SYLLABICS Y-CREE COO', +5264: 'CANADIAN SYLLABICS CA', +5265: 'CANADIAN SYLLABICS CAA', +5266: 'CANADIAN SYLLABICS CWE', +5267: 'CANADIAN SYLLABICS WEST-CREE CWE', +5268: 'CANADIAN SYLLABICS CWI', +5269: 'CANADIAN SYLLABICS WEST-CREE CWI', +5270: 'CANADIAN SYLLABICS CWII', +5271: 'CANADIAN SYLLABICS WEST-CREE CWII', +5272: 'CANADIAN SYLLABICS CWO', +5273: 'CANADIAN SYLLABICS WEST-CREE CWO', +5274: 'CANADIAN SYLLABICS CWOO', +5275: 'CANADIAN SYLLABICS WEST-CREE CWOO', +5276: 'CANADIAN SYLLABICS CWA', +5277: 'CANADIAN SYLLABICS WEST-CREE CWA', +5278: 'CANADIAN SYLLABICS CWAA', +5279: 'CANADIAN SYLLABICS WEST-CREE CWAA', +5280: 'CANADIAN SYLLABICS NASKAPI CWAA', +5281: 'CANADIAN SYLLABICS C', +5282: 'CANADIAN SYLLABICS SAYISI TH', +5283: 'CANADIAN SYLLABICS ME', +5284: 'CANADIAN SYLLABICS MAAI', +5285: 'CANADIAN SYLLABICS MI', +5286: 'CANADIAN SYLLABICS MII', +5287: 'CANADIAN SYLLABICS MO', +5288: 'CANADIAN SYLLABICS MOO', +5289: 'CANADIAN SYLLABICS Y-CREE MOO', +5290: 'CANADIAN SYLLABICS MA', +5291: 'CANADIAN SYLLABICS MAA', +5292: 'CANADIAN SYLLABICS MWE', +5293: 'CANADIAN SYLLABICS WEST-CREE MWE', +5294: 'CANADIAN SYLLABICS MWI', +5295: 'CANADIAN SYLLABICS WEST-CREE MWI', +5296: 'CANADIAN SYLLABICS MWII', +5297: 'CANADIAN SYLLABICS WEST-CREE MWII', +5298: 'CANADIAN SYLLABICS MWO', +5299: 'CANADIAN SYLLABICS WEST-CREE MWO', +5300: 'CANADIAN SYLLABICS MWOO', +5301: 'CANADIAN SYLLABICS WEST-CREE MWOO', +5302: 'CANADIAN SYLLABICS MWA', +5303: 'CANADIAN SYLLABICS WEST-CREE MWA', +5304: 'CANADIAN SYLLABICS MWAA', +5305: 'CANADIAN SYLLABICS WEST-CREE MWAA', +5306: 'CANADIAN SYLLABICS NASKAPI MWAA', +5307: 'CANADIAN SYLLABICS M', +5308: 'CANADIAN SYLLABICS WEST-CREE M', +5309: 'CANADIAN SYLLABICS MH', +5310: 'CANADIAN SYLLABICS ATHAPASCAN M', +5311: 'CANADIAN SYLLABICS SAYISI M', +5312: 'CANADIAN SYLLABICS NE', +5313: 'CANADIAN SYLLABICS NAAI', +5314: 'CANADIAN SYLLABICS NI', +5315: 'CANADIAN SYLLABICS NII', +5316: 'CANADIAN SYLLABICS NO', +5317: 'CANADIAN SYLLABICS NOO', +5318: 'CANADIAN SYLLABICS Y-CREE NOO', +5319: 'CANADIAN SYLLABICS NA', +5320: 'CANADIAN SYLLABICS NAA', +5321: 'CANADIAN SYLLABICS NWE', +5322: 'CANADIAN SYLLABICS WEST-CREE NWE', +5323: 'CANADIAN SYLLABICS NWA', +5324: 'CANADIAN SYLLABICS WEST-CREE NWA', +5325: 'CANADIAN SYLLABICS NWAA', +5326: 'CANADIAN SYLLABICS WEST-CREE NWAA', +5327: 'CANADIAN SYLLABICS NASKAPI NWAA', +5328: 'CANADIAN SYLLABICS N', +5329: 'CANADIAN SYLLABICS CARRIER NG', +5330: 'CANADIAN SYLLABICS NH', +5331: 'CANADIAN SYLLABICS LE', +5332: 'CANADIAN SYLLABICS LAAI', +5333: 'CANADIAN SYLLABICS LI', +5334: 'CANADIAN SYLLABICS LII', +5335: 'CANADIAN SYLLABICS LO', +5336: 'CANADIAN SYLLABICS LOO', +5337: 'CANADIAN SYLLABICS Y-CREE LOO', +5338: 'CANADIAN SYLLABICS LA', +5339: 'CANADIAN SYLLABICS LAA', +5340: 'CANADIAN SYLLABICS LWE', +5341: 'CANADIAN SYLLABICS WEST-CREE LWE', +5342: 'CANADIAN SYLLABICS LWI', +5343: 'CANADIAN SYLLABICS WEST-CREE LWI', +5344: 'CANADIAN SYLLABICS LWII', +5345: 'CANADIAN SYLLABICS WEST-CREE LWII', +5346: 'CANADIAN SYLLABICS LWO', +5347: 'CANADIAN SYLLABICS WEST-CREE LWO', +5348: 'CANADIAN SYLLABICS LWOO', +5349: 'CANADIAN SYLLABICS WEST-CREE LWOO', +5350: 'CANADIAN SYLLABICS LWA', +5351: 'CANADIAN SYLLABICS WEST-CREE LWA', +5352: 'CANADIAN SYLLABICS LWAA', +5353: 'CANADIAN SYLLABICS WEST-CREE LWAA', +5354: 'CANADIAN SYLLABICS L', +5355: 'CANADIAN SYLLABICS WEST-CREE L', +5356: 'CANADIAN SYLLABICS MEDIAL L', +5357: 'CANADIAN SYLLABICS SE', +5358: 'CANADIAN SYLLABICS SAAI', +5359: 'CANADIAN SYLLABICS SI', +5360: 'CANADIAN SYLLABICS SII', +5361: 'CANADIAN SYLLABICS SO', +5362: 'CANADIAN SYLLABICS SOO', +5363: 'CANADIAN SYLLABICS Y-CREE SOO', +5364: 'CANADIAN SYLLABICS SA', +5365: 'CANADIAN SYLLABICS SAA', +5366: 'CANADIAN SYLLABICS SWE', +5367: 'CANADIAN SYLLABICS WEST-CREE SWE', +5368: 'CANADIAN SYLLABICS SWI', +5369: 'CANADIAN SYLLABICS WEST-CREE SWI', +5370: 'CANADIAN SYLLABICS SWII', +5371: 'CANADIAN SYLLABICS WEST-CREE SWII', +5372: 'CANADIAN SYLLABICS SWO', +5373: 'CANADIAN SYLLABICS WEST-CREE SWO', +5374: 'CANADIAN SYLLABICS SWOO', +5375: 'CANADIAN SYLLABICS WEST-CREE SWOO', +5376: 'CANADIAN SYLLABICS SWA', +5377: 'CANADIAN SYLLABICS WEST-CREE SWA', +5378: 'CANADIAN SYLLABICS SWAA', +5379: 'CANADIAN SYLLABICS WEST-CREE SWAA', +5380: 'CANADIAN SYLLABICS NASKAPI SWAA', +5381: 'CANADIAN SYLLABICS S', +5382: 'CANADIAN SYLLABICS ATHAPASCAN S', +5383: 'CANADIAN SYLLABICS SW', +5384: 'CANADIAN SYLLABICS BLACKFOOT S', +5385: 'CANADIAN SYLLABICS MOOSE-CREE SK', +5386: 'CANADIAN SYLLABICS NASKAPI SKW', +5387: 'CANADIAN SYLLABICS NASKAPI S-W', +5388: 'CANADIAN SYLLABICS NASKAPI SPWA', +5389: 'CANADIAN SYLLABICS NASKAPI STWA', +5390: 'CANADIAN SYLLABICS NASKAPI SKWA', +5391: 'CANADIAN SYLLABICS NASKAPI SCWA', +5392: 'CANADIAN SYLLABICS SHE', +5393: 'CANADIAN SYLLABICS SHI', +5394: 'CANADIAN SYLLABICS SHII', +5395: 'CANADIAN SYLLABICS SHO', +5396: 'CANADIAN SYLLABICS SHOO', +5397: 'CANADIAN SYLLABICS SHA', +5398: 'CANADIAN SYLLABICS SHAA', +5399: 'CANADIAN SYLLABICS SHWE', +5400: 'CANADIAN SYLLABICS WEST-CREE SHWE', +5401: 'CANADIAN SYLLABICS SHWI', +5402: 'CANADIAN SYLLABICS WEST-CREE SHWI', +5403: 'CANADIAN SYLLABICS SHWII', +5404: 'CANADIAN SYLLABICS WEST-CREE SHWII', +5405: 'CANADIAN SYLLABICS SHWO', +5406: 'CANADIAN SYLLABICS WEST-CREE SHWO', +5407: 'CANADIAN SYLLABICS SHWOO', +5408: 'CANADIAN SYLLABICS WEST-CREE SHWOO', +5409: 'CANADIAN SYLLABICS SHWA', +5410: 'CANADIAN SYLLABICS WEST-CREE SHWA', +5411: 'CANADIAN SYLLABICS SHWAA', +5412: 'CANADIAN SYLLABICS WEST-CREE SHWAA', +5413: 'CANADIAN SYLLABICS SH', +5414: 'CANADIAN SYLLABICS YE', +5415: 'CANADIAN SYLLABICS YAAI', +5416: 'CANADIAN SYLLABICS YI', +5417: 'CANADIAN SYLLABICS YII', +5418: 'CANADIAN SYLLABICS YO', +5419: 'CANADIAN SYLLABICS YOO', +5420: 'CANADIAN SYLLABICS Y-CREE YOO', +5421: 'CANADIAN SYLLABICS YA', +5422: 'CANADIAN SYLLABICS YAA', +5423: 'CANADIAN SYLLABICS YWE', +5424: 'CANADIAN SYLLABICS WEST-CREE YWE', +5425: 'CANADIAN SYLLABICS YWI', +5426: 'CANADIAN SYLLABICS WEST-CREE YWI', +5427: 'CANADIAN SYLLABICS YWII', +5428: 'CANADIAN SYLLABICS WEST-CREE YWII', +5429: 'CANADIAN SYLLABICS YWO', +5430: 'CANADIAN SYLLABICS WEST-CREE YWO', +5431: 'CANADIAN SYLLABICS YWOO', +5432: 'CANADIAN SYLLABICS WEST-CREE YWOO', +5433: 'CANADIAN SYLLABICS YWA', +5434: 'CANADIAN SYLLABICS WEST-CREE YWA', +5435: 'CANADIAN SYLLABICS YWAA', +5436: 'CANADIAN SYLLABICS WEST-CREE YWAA', +5437: 'CANADIAN SYLLABICS NASKAPI YWAA', +5438: 'CANADIAN SYLLABICS Y', +5439: 'CANADIAN SYLLABICS BIBLE-CREE Y', +5440: 'CANADIAN SYLLABICS WEST-CREE Y', +5441: 'CANADIAN SYLLABICS SAYISI YI', +5442: 'CANADIAN SYLLABICS RE', +5443: 'CANADIAN SYLLABICS R-CREE RE', +5444: 'CANADIAN SYLLABICS WEST-CREE LE', +5445: 'CANADIAN SYLLABICS RAAI', +5446: 'CANADIAN SYLLABICS RI', +5447: 'CANADIAN SYLLABICS RII', +5448: 'CANADIAN SYLLABICS RO', +5449: 'CANADIAN SYLLABICS ROO', +5450: 'CANADIAN SYLLABICS WEST-CREE LO', +5451: 'CANADIAN SYLLABICS RA', +5452: 'CANADIAN SYLLABICS RAA', +5453: 'CANADIAN SYLLABICS WEST-CREE LA', +5454: 'CANADIAN SYLLABICS RWAA', +5455: 'CANADIAN SYLLABICS WEST-CREE RWAA', +5456: 'CANADIAN SYLLABICS R', +5457: 'CANADIAN SYLLABICS WEST-CREE R', +5458: 'CANADIAN SYLLABICS MEDIAL R', +5459: 'CANADIAN SYLLABICS FE', +5460: 'CANADIAN SYLLABICS FAAI', +5461: 'CANADIAN SYLLABICS FI', +5462: 'CANADIAN SYLLABICS FII', +5463: 'CANADIAN SYLLABICS FO', +5464: 'CANADIAN SYLLABICS FOO', +5465: 'CANADIAN SYLLABICS FA', +5466: 'CANADIAN SYLLABICS FAA', +5467: 'CANADIAN SYLLABICS FWAA', +5468: 'CANADIAN SYLLABICS WEST-CREE FWAA', +5469: 'CANADIAN SYLLABICS F', +5470: 'CANADIAN SYLLABICS THE', +5471: 'CANADIAN SYLLABICS N-CREE THE', +5472: 'CANADIAN SYLLABICS THI', +5473: 'CANADIAN SYLLABICS N-CREE THI', +5474: 'CANADIAN SYLLABICS THII', +5475: 'CANADIAN SYLLABICS N-CREE THII', +5476: 'CANADIAN SYLLABICS THO', +5477: 'CANADIAN SYLLABICS THOO', +5478: 'CANADIAN SYLLABICS THA', +5479: 'CANADIAN SYLLABICS THAA', +5480: 'CANADIAN SYLLABICS THWAA', +5481: 'CANADIAN SYLLABICS WEST-CREE THWAA', +5482: 'CANADIAN SYLLABICS TH', +5483: 'CANADIAN SYLLABICS TTHE', +5484: 'CANADIAN SYLLABICS TTHI', +5485: 'CANADIAN SYLLABICS TTHO', +5486: 'CANADIAN SYLLABICS TTHA', +5487: 'CANADIAN SYLLABICS TTH', +5488: 'CANADIAN SYLLABICS TYE', +5489: 'CANADIAN SYLLABICS TYI', +5490: 'CANADIAN SYLLABICS TYO', +5491: 'CANADIAN SYLLABICS TYA', +5492: 'CANADIAN SYLLABICS NUNAVIK HE', +5493: 'CANADIAN SYLLABICS NUNAVIK HI', +5494: 'CANADIAN SYLLABICS NUNAVIK HII', +5495: 'CANADIAN SYLLABICS NUNAVIK HO', +5496: 'CANADIAN SYLLABICS NUNAVIK HOO', +5497: 'CANADIAN SYLLABICS NUNAVIK HA', +5498: 'CANADIAN SYLLABICS NUNAVIK HAA', +5499: 'CANADIAN SYLLABICS NUNAVIK H', +5500: 'CANADIAN SYLLABICS NUNAVUT H', +5501: 'CANADIAN SYLLABICS HK', +5502: 'CANADIAN SYLLABICS QAAI', +5503: 'CANADIAN SYLLABICS QI', +5504: 'CANADIAN SYLLABICS QII', +5505: 'CANADIAN SYLLABICS QO', +5506: 'CANADIAN SYLLABICS QOO', +5507: 'CANADIAN SYLLABICS QA', +5508: 'CANADIAN SYLLABICS QAA', +5509: 'CANADIAN SYLLABICS Q', +5510: 'CANADIAN SYLLABICS TLHE', +5511: 'CANADIAN SYLLABICS TLHI', +5512: 'CANADIAN SYLLABICS TLHO', +5513: 'CANADIAN SYLLABICS TLHA', +5514: 'CANADIAN SYLLABICS WEST-CREE RE', +5515: 'CANADIAN SYLLABICS WEST-CREE RI', +5516: 'CANADIAN SYLLABICS WEST-CREE RO', +5517: 'CANADIAN SYLLABICS WEST-CREE RA', +5518: 'CANADIAN SYLLABICS NGAAI', +5519: 'CANADIAN SYLLABICS NGI', +5520: 'CANADIAN SYLLABICS NGII', +5521: 'CANADIAN SYLLABICS NGO', +5522: 'CANADIAN SYLLABICS NGOO', +5523: 'CANADIAN SYLLABICS NGA', +5524: 'CANADIAN SYLLABICS NGAA', +5525: 'CANADIAN SYLLABICS NG', +5526: 'CANADIAN SYLLABICS NNG', +5527: 'CANADIAN SYLLABICS SAYISI SHE', +5528: 'CANADIAN SYLLABICS SAYISI SHI', +5529: 'CANADIAN SYLLABICS SAYISI SHO', +5530: 'CANADIAN SYLLABICS SAYISI SHA', +5531: 'CANADIAN SYLLABICS WOODS-CREE THE', +5532: 'CANADIAN SYLLABICS WOODS-CREE THI', +5533: 'CANADIAN SYLLABICS WOODS-CREE THO', +5534: 'CANADIAN SYLLABICS WOODS-CREE THA', +5535: 'CANADIAN SYLLABICS WOODS-CREE TH', +5536: 'CANADIAN SYLLABICS LHI', +5537: 'CANADIAN SYLLABICS LHII', +5538: 'CANADIAN SYLLABICS LHO', +5539: 'CANADIAN SYLLABICS LHOO', +5540: 'CANADIAN SYLLABICS LHA', +5541: 'CANADIAN SYLLABICS LHAA', +5542: 'CANADIAN SYLLABICS LH', +5543: 'CANADIAN SYLLABICS TH-CREE THE', +5544: 'CANADIAN SYLLABICS TH-CREE THI', +5545: 'CANADIAN SYLLABICS TH-CREE THII', +5546: 'CANADIAN SYLLABICS TH-CREE THO', +5547: 'CANADIAN SYLLABICS TH-CREE THOO', +5548: 'CANADIAN SYLLABICS TH-CREE THA', +5549: 'CANADIAN SYLLABICS TH-CREE THAA', +5550: 'CANADIAN SYLLABICS TH-CREE TH', +5551: 'CANADIAN SYLLABICS AIVILIK B', +5552: 'CANADIAN SYLLABICS BLACKFOOT E', +5553: 'CANADIAN SYLLABICS BLACKFOOT I', +5554: 'CANADIAN SYLLABICS BLACKFOOT O', +5555: 'CANADIAN SYLLABICS BLACKFOOT A', +5556: 'CANADIAN SYLLABICS BLACKFOOT WE', +5557: 'CANADIAN SYLLABICS BLACKFOOT WI', +5558: 'CANADIAN SYLLABICS BLACKFOOT WO', +5559: 'CANADIAN SYLLABICS BLACKFOOT WA', +5560: 'CANADIAN SYLLABICS BLACKFOOT NE', +5561: 'CANADIAN SYLLABICS BLACKFOOT NI', +5562: 'CANADIAN SYLLABICS BLACKFOOT NO', +5563: 'CANADIAN SYLLABICS BLACKFOOT NA', +5564: 'CANADIAN SYLLABICS BLACKFOOT KE', +5565: 'CANADIAN SYLLABICS BLACKFOOT KI', +5566: 'CANADIAN SYLLABICS BLACKFOOT KO', +5567: 'CANADIAN SYLLABICS BLACKFOOT KA', +5568: 'CANADIAN SYLLABICS SAYISI HE', +5569: 'CANADIAN SYLLABICS SAYISI HI', +5570: 'CANADIAN SYLLABICS SAYISI HO', +5571: 'CANADIAN SYLLABICS SAYISI HA', +5572: 'CANADIAN SYLLABICS CARRIER GHU', +5573: 'CANADIAN SYLLABICS CARRIER GHO', +5574: 'CANADIAN SYLLABICS CARRIER GHE', +5575: 'CANADIAN SYLLABICS CARRIER GHEE', +5576: 'CANADIAN SYLLABICS CARRIER GHI', +5577: 'CANADIAN SYLLABICS CARRIER GHA', +5578: 'CANADIAN SYLLABICS CARRIER RU', +5579: 'CANADIAN SYLLABICS CARRIER RO', +5580: 'CANADIAN SYLLABICS CARRIER RE', +5581: 'CANADIAN SYLLABICS CARRIER REE', +5582: 'CANADIAN SYLLABICS CARRIER RI', +5583: 'CANADIAN SYLLABICS CARRIER RA', +5584: 'CANADIAN SYLLABICS CARRIER WU', +5585: 'CANADIAN SYLLABICS CARRIER WO', +5586: 'CANADIAN SYLLABICS CARRIER WE', +5587: 'CANADIAN SYLLABICS CARRIER WEE', +5588: 'CANADIAN SYLLABICS CARRIER WI', +5589: 'CANADIAN SYLLABICS CARRIER WA', +5590: 'CANADIAN SYLLABICS CARRIER HWU', +5591: 'CANADIAN SYLLABICS CARRIER HWO', +5592: 'CANADIAN SYLLABICS CARRIER HWE', +5593: 'CANADIAN SYLLABICS CARRIER HWEE', +5594: 'CANADIAN SYLLABICS CARRIER HWI', +5595: 'CANADIAN SYLLABICS CARRIER HWA', +5596: 'CANADIAN SYLLABICS CARRIER THU', +5597: 'CANADIAN SYLLABICS CARRIER THO', +5598: 'CANADIAN SYLLABICS CARRIER THE', +5599: 'CANADIAN SYLLABICS CARRIER THEE', +5600: 'CANADIAN SYLLABICS CARRIER THI', +5601: 'CANADIAN SYLLABICS CARRIER THA', +5602: 'CANADIAN SYLLABICS CARRIER TTU', +5603: 'CANADIAN SYLLABICS CARRIER TTO', +5604: 'CANADIAN SYLLABICS CARRIER TTE', +5605: 'CANADIAN SYLLABICS CARRIER TTEE', +5606: 'CANADIAN SYLLABICS CARRIER TTI', +5607: 'CANADIAN SYLLABICS CARRIER TTA', +5608: 'CANADIAN SYLLABICS CARRIER PU', +5609: 'CANADIAN SYLLABICS CARRIER PO', +5610: 'CANADIAN SYLLABICS CARRIER PE', +5611: 'CANADIAN SYLLABICS CARRIER PEE', +5612: 'CANADIAN SYLLABICS CARRIER PI', +5613: 'CANADIAN SYLLABICS CARRIER PA', +5614: 'CANADIAN SYLLABICS CARRIER P', +5615: 'CANADIAN SYLLABICS CARRIER GU', +5616: 'CANADIAN SYLLABICS CARRIER GO', +5617: 'CANADIAN SYLLABICS CARRIER GE', +5618: 'CANADIAN SYLLABICS CARRIER GEE', +5619: 'CANADIAN SYLLABICS CARRIER GI', +5620: 'CANADIAN SYLLABICS CARRIER GA', +5621: 'CANADIAN SYLLABICS CARRIER KHU', +5622: 'CANADIAN SYLLABICS CARRIER KHO', +5623: 'CANADIAN SYLLABICS CARRIER KHE', +5624: 'CANADIAN SYLLABICS CARRIER KHEE', +5625: 'CANADIAN SYLLABICS CARRIER KHI', +5626: 'CANADIAN SYLLABICS CARRIER KHA', +5627: 'CANADIAN SYLLABICS CARRIER KKU', +5628: 'CANADIAN SYLLABICS CARRIER KKO', +5629: 'CANADIAN SYLLABICS CARRIER KKE', +5630: 'CANADIAN SYLLABICS CARRIER KKEE', +5631: 'CANADIAN SYLLABICS CARRIER KKI', +5632: 'CANADIAN SYLLABICS CARRIER KKA', +5633: 'CANADIAN SYLLABICS CARRIER KK', +5634: 'CANADIAN SYLLABICS CARRIER NU', +5635: 'CANADIAN SYLLABICS CARRIER NO', +5636: 'CANADIAN SYLLABICS CARRIER NE', +5637: 'CANADIAN SYLLABICS CARRIER NEE', +5638: 'CANADIAN SYLLABICS CARRIER NI', +5639: 'CANADIAN SYLLABICS CARRIER NA', +5640: 'CANADIAN SYLLABICS CARRIER MU', +5641: 'CANADIAN SYLLABICS CARRIER MO', +5642: 'CANADIAN SYLLABICS CARRIER ME', +5643: 'CANADIAN SYLLABICS CARRIER MEE', +5644: 'CANADIAN SYLLABICS CARRIER MI', +5645: 'CANADIAN SYLLABICS CARRIER MA', +5646: 'CANADIAN SYLLABICS CARRIER YU', +5647: 'CANADIAN SYLLABICS CARRIER YO', +5648: 'CANADIAN SYLLABICS CARRIER YE', +5649: 'CANADIAN SYLLABICS CARRIER YEE', +5650: 'CANADIAN SYLLABICS CARRIER YI', +5651: 'CANADIAN SYLLABICS CARRIER YA', +5652: 'CANADIAN SYLLABICS CARRIER JU', +5653: 'CANADIAN SYLLABICS SAYISI JU', +5654: 'CANADIAN SYLLABICS CARRIER JO', +5655: 'CANADIAN SYLLABICS CARRIER JE', +5656: 'CANADIAN SYLLABICS CARRIER JEE', +5657: 'CANADIAN SYLLABICS CARRIER JI', +5658: 'CANADIAN SYLLABICS SAYISI JI', +5659: 'CANADIAN SYLLABICS CARRIER JA', +5660: 'CANADIAN SYLLABICS CARRIER JJU', +5661: 'CANADIAN SYLLABICS CARRIER JJO', +5662: 'CANADIAN SYLLABICS CARRIER JJE', +5663: 'CANADIAN SYLLABICS CARRIER JJEE', +5664: 'CANADIAN SYLLABICS CARRIER JJI', +5665: 'CANADIAN SYLLABICS CARRIER JJA', +5666: 'CANADIAN SYLLABICS CARRIER LU', +5667: 'CANADIAN SYLLABICS CARRIER LO', +5668: 'CANADIAN SYLLABICS CARRIER LE', +5669: 'CANADIAN SYLLABICS CARRIER LEE', +5670: 'CANADIAN SYLLABICS CARRIER LI', +5671: 'CANADIAN SYLLABICS CARRIER LA', +5672: 'CANADIAN SYLLABICS CARRIER DLU', +5673: 'CANADIAN SYLLABICS CARRIER DLO', +5674: 'CANADIAN SYLLABICS CARRIER DLE', +5675: 'CANADIAN SYLLABICS CARRIER DLEE', +5676: 'CANADIAN SYLLABICS CARRIER DLI', +5677: 'CANADIAN SYLLABICS CARRIER DLA', +5678: 'CANADIAN SYLLABICS CARRIER LHU', +5679: 'CANADIAN SYLLABICS CARRIER LHO', +5680: 'CANADIAN SYLLABICS CARRIER LHE', +5681: 'CANADIAN SYLLABICS CARRIER LHEE', +5682: 'CANADIAN SYLLABICS CARRIER LHI', +5683: 'CANADIAN SYLLABICS CARRIER LHA', +5684: 'CANADIAN SYLLABICS CARRIER TLHU', +5685: 'CANADIAN SYLLABICS CARRIER TLHO', +5686: 'CANADIAN SYLLABICS CARRIER TLHE', +5687: 'CANADIAN SYLLABICS CARRIER TLHEE', +5688: 'CANADIAN SYLLABICS CARRIER TLHI', +5689: 'CANADIAN SYLLABICS CARRIER TLHA', +5690: 'CANADIAN SYLLABICS CARRIER TLU', +5691: 'CANADIAN SYLLABICS CARRIER TLO', +5692: 'CANADIAN SYLLABICS CARRIER TLE', +5693: 'CANADIAN SYLLABICS CARRIER TLEE', +5694: 'CANADIAN SYLLABICS CARRIER TLI', +5695: 'CANADIAN SYLLABICS CARRIER TLA', +5696: 'CANADIAN SYLLABICS CARRIER ZU', +5697: 'CANADIAN SYLLABICS CARRIER ZO', +5698: 'CANADIAN SYLLABICS CARRIER ZE', +5699: 'CANADIAN SYLLABICS CARRIER ZEE', +5700: 'CANADIAN SYLLABICS CARRIER ZI', +5701: 'CANADIAN SYLLABICS CARRIER ZA', +5702: 'CANADIAN SYLLABICS CARRIER Z', +5703: 'CANADIAN SYLLABICS CARRIER INITIAL Z', +5704: 'CANADIAN SYLLABICS CARRIER DZU', +5705: 'CANADIAN SYLLABICS CARRIER DZO', +5706: 'CANADIAN SYLLABICS CARRIER DZE', +5707: 'CANADIAN SYLLABICS CARRIER DZEE', +5708: 'CANADIAN SYLLABICS CARRIER DZI', +5709: 'CANADIAN SYLLABICS CARRIER DZA', +5710: 'CANADIAN SYLLABICS CARRIER SU', +5711: 'CANADIAN SYLLABICS CARRIER SO', +5712: 'CANADIAN SYLLABICS CARRIER SE', +5713: 'CANADIAN SYLLABICS CARRIER SEE', +5714: 'CANADIAN SYLLABICS CARRIER SI', +5715: 'CANADIAN SYLLABICS CARRIER SA', +5716: 'CANADIAN SYLLABICS CARRIER SHU', +5717: 'CANADIAN SYLLABICS CARRIER SHO', +5718: 'CANADIAN SYLLABICS CARRIER SHE', +5719: 'CANADIAN SYLLABICS CARRIER SHEE', +5720: 'CANADIAN SYLLABICS CARRIER SHI', +5721: 'CANADIAN SYLLABICS CARRIER SHA', +5722: 'CANADIAN SYLLABICS CARRIER SH', +5723: 'CANADIAN SYLLABICS CARRIER TSU', +5724: 'CANADIAN SYLLABICS CARRIER TSO', +5725: 'CANADIAN SYLLABICS CARRIER TSE', +5726: 'CANADIAN SYLLABICS CARRIER TSEE', +5727: 'CANADIAN SYLLABICS CARRIER TSI', +5728: 'CANADIAN SYLLABICS CARRIER TSA', +5729: 'CANADIAN SYLLABICS CARRIER CHU', +5730: 'CANADIAN SYLLABICS CARRIER CHO', +5731: 'CANADIAN SYLLABICS CARRIER CHE', +5732: 'CANADIAN SYLLABICS CARRIER CHEE', +5733: 'CANADIAN SYLLABICS CARRIER CHI', +5734: 'CANADIAN SYLLABICS CARRIER CHA', +5735: 'CANADIAN SYLLABICS CARRIER TTSU', +5736: 'CANADIAN SYLLABICS CARRIER TTSO', +5737: 'CANADIAN SYLLABICS CARRIER TTSE', +5738: 'CANADIAN SYLLABICS CARRIER TTSEE', +5739: 'CANADIAN SYLLABICS CARRIER TTSI', +5740: 'CANADIAN SYLLABICS CARRIER TTSA', +5741: 'CANADIAN SYLLABICS CHI SIGN', +5742: 'CANADIAN SYLLABICS FULL STOP', +5743: 'CANADIAN SYLLABICS QAI', +5744: 'CANADIAN SYLLABICS NGAI', +5745: 'CANADIAN SYLLABICS NNGI', +5746: 'CANADIAN SYLLABICS NNGII', +5747: 'CANADIAN SYLLABICS NNGO', +5748: 'CANADIAN SYLLABICS NNGOO', +5749: 'CANADIAN SYLLABICS NNGA', +5750: 'CANADIAN SYLLABICS NNGAA', +5760: 'OGHAM SPACE MARK', +5761: 'OGHAM LETTER BEITH', +5762: 'OGHAM LETTER LUIS', +5763: 'OGHAM LETTER FEARN', +5764: 'OGHAM LETTER SAIL', +5765: 'OGHAM LETTER NION', +5766: 'OGHAM LETTER UATH', +5767: 'OGHAM LETTER DAIR', +5768: 'OGHAM LETTER TINNE', +5769: 'OGHAM LETTER COLL', +5770: 'OGHAM LETTER CEIRT', +5771: 'OGHAM LETTER MUIN', +5772: 'OGHAM LETTER GORT', +5773: 'OGHAM LETTER NGEADAL', +5774: 'OGHAM LETTER STRAIF', +5775: 'OGHAM LETTER RUIS', +5776: 'OGHAM LETTER AILM', +5777: 'OGHAM LETTER ONN', +5778: 'OGHAM LETTER UR', +5779: 'OGHAM LETTER EADHADH', +5780: 'OGHAM LETTER IODHADH', +5781: 'OGHAM LETTER EABHADH', +5782: 'OGHAM LETTER OR', +5783: 'OGHAM LETTER UILLEANN', +5784: 'OGHAM LETTER IFIN', +5785: 'OGHAM LETTER EAMHANCHOLL', +5786: 'OGHAM LETTER PEITH', +5787: 'OGHAM FEATHER MARK', +5788: 'OGHAM REVERSED FEATHER MARK', +5792: 'RUNIC LETTER FEHU FEOH FE F', +5793: 'RUNIC LETTER V', +5794: 'RUNIC LETTER URUZ UR U', +5795: 'RUNIC LETTER YR', +5796: 'RUNIC LETTER Y', +5797: 'RUNIC LETTER W', +5798: 'RUNIC LETTER THURISAZ THURS THORN', +5799: 'RUNIC LETTER ETH', +5800: 'RUNIC LETTER ANSUZ A', +5801: 'RUNIC LETTER OS O', +5802: 'RUNIC LETTER AC A', +5803: 'RUNIC LETTER AESC', +5804: 'RUNIC LETTER LONG-BRANCH-OSS O', +5805: 'RUNIC LETTER SHORT-TWIG-OSS O', +5806: 'RUNIC LETTER O', +5807: 'RUNIC LETTER OE', +5808: 'RUNIC LETTER ON', +5809: 'RUNIC LETTER RAIDO RAD REID R', +5810: 'RUNIC LETTER KAUNA', +5811: 'RUNIC LETTER CEN', +5812: 'RUNIC LETTER KAUN K', +5813: 'RUNIC LETTER G', +5814: 'RUNIC LETTER ENG', +5815: 'RUNIC LETTER GEBO GYFU G', +5816: 'RUNIC LETTER GAR', +5817: 'RUNIC LETTER WUNJO WYNN W', +5818: 'RUNIC LETTER HAGLAZ H', +5819: 'RUNIC LETTER HAEGL H', +5820: 'RUNIC LETTER LONG-BRANCH-HAGALL H', +5821: 'RUNIC LETTER SHORT-TWIG-HAGALL H', +5822: 'RUNIC LETTER NAUDIZ NYD NAUD N', +5823: 'RUNIC LETTER SHORT-TWIG-NAUD N', +5824: 'RUNIC LETTER DOTTED-N', +5825: 'RUNIC LETTER ISAZ IS ISS I', +5826: 'RUNIC LETTER E', +5827: 'RUNIC LETTER JERAN J', +5828: 'RUNIC LETTER GER', +5829: 'RUNIC LETTER LONG-BRANCH-AR AE', +5830: 'RUNIC LETTER SHORT-TWIG-AR A', +5831: 'RUNIC LETTER IWAZ EOH', +5832: 'RUNIC LETTER PERTHO PEORTH P', +5833: 'RUNIC LETTER ALGIZ EOLHX', +5834: 'RUNIC LETTER SOWILO S', +5835: 'RUNIC LETTER SIGEL LONG-BRANCH-SOL S', +5836: 'RUNIC LETTER SHORT-TWIG-SOL S', +5837: 'RUNIC LETTER C', +5838: 'RUNIC LETTER Z', +5839: 'RUNIC LETTER TIWAZ TIR TYR T', +5840: 'RUNIC LETTER SHORT-TWIG-TYR T', +5841: 'RUNIC LETTER D', +5842: 'RUNIC LETTER BERKANAN BEORC BJARKAN B', +5843: 'RUNIC LETTER SHORT-TWIG-BJARKAN B', +5844: 'RUNIC LETTER DOTTED-P', +5845: 'RUNIC LETTER OPEN-P', +5846: 'RUNIC LETTER EHWAZ EH E', +5847: 'RUNIC LETTER MANNAZ MAN M', +5848: 'RUNIC LETTER LONG-BRANCH-MADR M', +5849: 'RUNIC LETTER SHORT-TWIG-MADR M', +5850: 'RUNIC LETTER LAUKAZ LAGU LOGR L', +5851: 'RUNIC LETTER DOTTED-L', +5852: 'RUNIC LETTER INGWAZ', +5853: 'RUNIC LETTER ING', +5854: 'RUNIC LETTER DAGAZ DAEG D', +5855: 'RUNIC LETTER OTHALAN ETHEL O', +5856: 'RUNIC LETTER EAR', +5857: 'RUNIC LETTER IOR', +5858: 'RUNIC LETTER CWEORTH', +5859: 'RUNIC LETTER CALC', +5860: 'RUNIC LETTER CEALC', +5861: 'RUNIC LETTER STAN', +5862: 'RUNIC LETTER LONG-BRANCH-YR', +5863: 'RUNIC LETTER SHORT-TWIG-YR', +5864: 'RUNIC LETTER ICELANDIC-YR', +5865: 'RUNIC LETTER Q', +5866: 'RUNIC LETTER X', +5867: 'RUNIC SINGLE PUNCTUATION', +5868: 'RUNIC MULTIPLE PUNCTUATION', +5869: 'RUNIC CROSS PUNCTUATION', +5870: 'RUNIC ARLAUG SYMBOL', +5871: 'RUNIC TVIMADUR SYMBOL', +5872: 'RUNIC BELGTHOR SYMBOL', +5888: 'TAGALOG LETTER A', +5889: 'TAGALOG LETTER I', +5890: 'TAGALOG LETTER U', +5891: 'TAGALOG LETTER KA', +5892: 'TAGALOG LETTER GA', +5893: 'TAGALOG LETTER NGA', +5894: 'TAGALOG LETTER TA', +5895: 'TAGALOG LETTER DA', +5896: 'TAGALOG LETTER NA', +5897: 'TAGALOG LETTER PA', +5898: 'TAGALOG LETTER BA', +5899: 'TAGALOG LETTER MA', +5900: 'TAGALOG LETTER YA', +5902: 'TAGALOG LETTER LA', +5903: 'TAGALOG LETTER WA', +5904: 'TAGALOG LETTER SA', +5905: 'TAGALOG LETTER HA', +5906: 'TAGALOG VOWEL SIGN I', +5907: 'TAGALOG VOWEL SIGN U', +5908: 'TAGALOG SIGN VIRAMA', +5920: 'HANUNOO LETTER A', +5921: 'HANUNOO LETTER I', +5922: 'HANUNOO LETTER U', +5923: 'HANUNOO LETTER KA', +5924: 'HANUNOO LETTER GA', +5925: 'HANUNOO LETTER NGA', +5926: 'HANUNOO LETTER TA', +5927: 'HANUNOO LETTER DA', +5928: 'HANUNOO LETTER NA', +5929: 'HANUNOO LETTER PA', +5930: 'HANUNOO LETTER BA', +5931: 'HANUNOO LETTER MA', +5932: 'HANUNOO LETTER YA', +5933: 'HANUNOO LETTER RA', +5934: 'HANUNOO LETTER LA', +5935: 'HANUNOO LETTER WA', +5936: 'HANUNOO LETTER SA', +5937: 'HANUNOO LETTER HA', +5938: 'HANUNOO VOWEL SIGN I', +5939: 'HANUNOO VOWEL SIGN U', +5940: 'HANUNOO SIGN PAMUDPOD', +5941: 'PHILIPPINE SINGLE PUNCTUATION', +5942: 'PHILIPPINE DOUBLE PUNCTUATION', +5952: 'BUHID LETTER A', +5953: 'BUHID LETTER I', +5954: 'BUHID LETTER U', +5955: 'BUHID LETTER KA', +5956: 'BUHID LETTER GA', +5957: 'BUHID LETTER NGA', +5958: 'BUHID LETTER TA', +5959: 'BUHID LETTER DA', +5960: 'BUHID LETTER NA', +5961: 'BUHID LETTER PA', +5962: 'BUHID LETTER BA', +5963: 'BUHID LETTER MA', +5964: 'BUHID LETTER YA', +5965: 'BUHID LETTER RA', +5966: 'BUHID LETTER LA', +5967: 'BUHID LETTER WA', +5968: 'BUHID LETTER SA', +5969: 'BUHID LETTER HA', +5970: 'BUHID VOWEL SIGN I', +5971: 'BUHID VOWEL SIGN U', +5984: 'TAGBANWA LETTER A', +5985: 'TAGBANWA LETTER I', +5986: 'TAGBANWA LETTER U', +5987: 'TAGBANWA LETTER KA', +5988: 'TAGBANWA LETTER GA', +5989: 'TAGBANWA LETTER NGA', +5990: 'TAGBANWA LETTER TA', +5991: 'TAGBANWA LETTER DA', +5992: 'TAGBANWA LETTER NA', +5993: 'TAGBANWA LETTER PA', +5994: 'TAGBANWA LETTER BA', +5995: 'TAGBANWA LETTER MA', +5996: 'TAGBANWA LETTER YA', +5998: 'TAGBANWA LETTER LA', +5999: 'TAGBANWA LETTER WA', +6000: 'TAGBANWA LETTER SA', +6002: 'TAGBANWA VOWEL SIGN I', +6003: 'TAGBANWA VOWEL SIGN U', +6016: 'KHMER LETTER KA', +6017: 'KHMER LETTER KHA', +6018: 'KHMER LETTER KO', +6019: 'KHMER LETTER KHO', +6020: 'KHMER LETTER NGO', +6021: 'KHMER LETTER CA', +6022: 'KHMER LETTER CHA', +6023: 'KHMER LETTER CO', +6024: 'KHMER LETTER CHO', +6025: 'KHMER LETTER NYO', +6026: 'KHMER LETTER DA', +6027: 'KHMER LETTER TTHA', +6028: 'KHMER LETTER DO', +6029: 'KHMER LETTER TTHO', +6030: 'KHMER LETTER NNO', +6031: 'KHMER LETTER TA', +6032: 'KHMER LETTER THA', +6033: 'KHMER LETTER TO', +6034: 'KHMER LETTER THO', +6035: 'KHMER LETTER NO', +6036: 'KHMER LETTER BA', +6037: 'KHMER LETTER PHA', +6038: 'KHMER LETTER PO', +6039: 'KHMER LETTER PHO', +6040: 'KHMER LETTER MO', +6041: 'KHMER LETTER YO', +6042: 'KHMER LETTER RO', +6043: 'KHMER LETTER LO', +6044: 'KHMER LETTER VO', +6045: 'KHMER LETTER SHA', +6046: 'KHMER LETTER SSO', +6047: 'KHMER LETTER SA', +6048: 'KHMER LETTER HA', +6049: 'KHMER LETTER LA', +6050: 'KHMER LETTER QA', +6051: 'KHMER INDEPENDENT VOWEL QAQ', +6052: 'KHMER INDEPENDENT VOWEL QAA', +6053: 'KHMER INDEPENDENT VOWEL QI', +6054: 'KHMER INDEPENDENT VOWEL QII', +6055: 'KHMER INDEPENDENT VOWEL QU', +6056: 'KHMER INDEPENDENT VOWEL QUK', +6057: 'KHMER INDEPENDENT VOWEL QUU', +6058: 'KHMER INDEPENDENT VOWEL QUUV', +6059: 'KHMER INDEPENDENT VOWEL RY', +6060: 'KHMER INDEPENDENT VOWEL RYY', +6061: 'KHMER INDEPENDENT VOWEL LY', +6062: 'KHMER INDEPENDENT VOWEL LYY', +6063: 'KHMER INDEPENDENT VOWEL QE', +6064: 'KHMER INDEPENDENT VOWEL QAI', +6065: 'KHMER INDEPENDENT VOWEL QOO TYPE ONE', +6066: 'KHMER INDEPENDENT VOWEL QOO TYPE TWO', +6067: 'KHMER INDEPENDENT VOWEL QAU', +6068: 'KHMER VOWEL INHERENT AQ', +6069: 'KHMER VOWEL INHERENT AA', +6070: 'KHMER VOWEL SIGN AA', +6071: 'KHMER VOWEL SIGN I', +6072: 'KHMER VOWEL SIGN II', +6073: 'KHMER VOWEL SIGN Y', +6074: 'KHMER VOWEL SIGN YY', +6075: 'KHMER VOWEL SIGN U', +6076: 'KHMER VOWEL SIGN UU', +6077: 'KHMER VOWEL SIGN UA', +6078: 'KHMER VOWEL SIGN OE', +6079: 'KHMER VOWEL SIGN YA', +6080: 'KHMER VOWEL SIGN IE', +6081: 'KHMER VOWEL SIGN E', +6082: 'KHMER VOWEL SIGN AE', +6083: 'KHMER VOWEL SIGN AI', +6084: 'KHMER VOWEL SIGN OO', +6085: 'KHMER VOWEL SIGN AU', +6086: 'KHMER SIGN NIKAHIT', +6087: 'KHMER SIGN REAHMUK', +6088: 'KHMER SIGN YUUKALEAPINTU', +6089: 'KHMER SIGN MUUSIKATOAN', +6090: 'KHMER SIGN TRIISAP', +6091: 'KHMER SIGN BANTOC', +6092: 'KHMER SIGN ROBAT', +6093: 'KHMER SIGN TOANDAKHIAT', +6094: 'KHMER SIGN KAKABAT', +6095: 'KHMER SIGN AHSDA', +6096: 'KHMER SIGN SAMYOK SANNYA', +6097: 'KHMER SIGN VIRIAM', +6098: 'KHMER SIGN COENG', +6099: 'KHMER SIGN BATHAMASAT', +6100: 'KHMER SIGN KHAN', +6101: 'KHMER SIGN BARIYOOSAN', +6102: 'KHMER SIGN CAMNUC PII KUUH', +6103: 'KHMER SIGN LEK TOO', +6104: 'KHMER SIGN BEYYAL', +6105: 'KHMER SIGN PHNAEK MUAN', +6106: 'KHMER SIGN KOOMUUT', +6107: 'KHMER CURRENCY SYMBOL RIEL', +6108: 'KHMER SIGN AVAKRAHASANYA', +6112: 'KHMER DIGIT ZERO', +6113: 'KHMER DIGIT ONE', +6114: 'KHMER DIGIT TWO', +6115: 'KHMER DIGIT THREE', +6116: 'KHMER DIGIT FOUR', +6117: 'KHMER DIGIT FIVE', +6118: 'KHMER DIGIT SIX', +6119: 'KHMER DIGIT SEVEN', +6120: 'KHMER DIGIT EIGHT', +6121: 'KHMER DIGIT NINE', +6144: 'MONGOLIAN BIRGA', +6145: 'MONGOLIAN ELLIPSIS', +6146: 'MONGOLIAN COMMA', +6147: 'MONGOLIAN FULL STOP', +6148: 'MONGOLIAN COLON', +6149: 'MONGOLIAN FOUR DOTS', +6150: 'MONGOLIAN TODO SOFT HYPHEN', +6151: 'MONGOLIAN SIBE SYLLABLE BOUNDARY MARKER', +6152: 'MONGOLIAN MANCHU COMMA', +6153: 'MONGOLIAN MANCHU FULL STOP', +6154: 'MONGOLIAN NIRUGU', +6155: 'MONGOLIAN FREE VARIATION SELECTOR ONE', +6156: 'MONGOLIAN FREE VARIATION SELECTOR TWO', +6157: 'MONGOLIAN FREE VARIATION SELECTOR THREE', +6158: 'MONGOLIAN VOWEL SEPARATOR', +6160: 'MONGOLIAN DIGIT ZERO', +6161: 'MONGOLIAN DIGIT ONE', +6162: 'MONGOLIAN DIGIT TWO', +6163: 'MONGOLIAN DIGIT THREE', +6164: 'MONGOLIAN DIGIT FOUR', +6165: 'MONGOLIAN DIGIT FIVE', +6166: 'MONGOLIAN DIGIT SIX', +6167: 'MONGOLIAN DIGIT SEVEN', +6168: 'MONGOLIAN DIGIT EIGHT', +6169: 'MONGOLIAN DIGIT NINE', +6176: 'MONGOLIAN LETTER A', +6177: 'MONGOLIAN LETTER E', +6178: 'MONGOLIAN LETTER I', +6179: 'MONGOLIAN LETTER O', +6180: 'MONGOLIAN LETTER U', +6181: 'MONGOLIAN LETTER OE', +6182: 'MONGOLIAN LETTER UE', +6183: 'MONGOLIAN LETTER EE', +6184: 'MONGOLIAN LETTER NA', +6185: 'MONGOLIAN LETTER ANG', +6186: 'MONGOLIAN LETTER BA', +6187: 'MONGOLIAN LETTER PA', +6188: 'MONGOLIAN LETTER QA', +6189: 'MONGOLIAN LETTER GA', +6190: 'MONGOLIAN LETTER MA', +6191: 'MONGOLIAN LETTER LA', +6192: 'MONGOLIAN LETTER SA', +6193: 'MONGOLIAN LETTER SHA', +6194: 'MONGOLIAN LETTER TA', +6195: 'MONGOLIAN LETTER DA', +6196: 'MONGOLIAN LETTER CHA', +6197: 'MONGOLIAN LETTER JA', +6198: 'MONGOLIAN LETTER YA', +6199: 'MONGOLIAN LETTER RA', +6200: 'MONGOLIAN LETTER WA', +6201: 'MONGOLIAN LETTER FA', +6202: 'MONGOLIAN LETTER KA', +6203: 'MONGOLIAN LETTER KHA', +6204: 'MONGOLIAN LETTER TSA', +6205: 'MONGOLIAN LETTER ZA', +6206: 'MONGOLIAN LETTER HAA', +6207: 'MONGOLIAN LETTER ZRA', +6208: 'MONGOLIAN LETTER LHA', +6209: 'MONGOLIAN LETTER ZHI', +6210: 'MONGOLIAN LETTER CHI', +6211: 'MONGOLIAN LETTER TODO LONG VOWEL SIGN', +6212: 'MONGOLIAN LETTER TODO E', +6213: 'MONGOLIAN LETTER TODO I', +6214: 'MONGOLIAN LETTER TODO O', +6215: 'MONGOLIAN LETTER TODO U', +6216: 'MONGOLIAN LETTER TODO OE', +6217: 'MONGOLIAN LETTER TODO UE', +6218: 'MONGOLIAN LETTER TODO ANG', +6219: 'MONGOLIAN LETTER TODO BA', +6220: 'MONGOLIAN LETTER TODO PA', +6221: 'MONGOLIAN LETTER TODO QA', +6222: 'MONGOLIAN LETTER TODO GA', +6223: 'MONGOLIAN LETTER TODO MA', +6224: 'MONGOLIAN LETTER TODO TA', +6225: 'MONGOLIAN LETTER TODO DA', +6226: 'MONGOLIAN LETTER TODO CHA', +6227: 'MONGOLIAN LETTER TODO JA', +6228: 'MONGOLIAN LETTER TODO TSA', +6229: 'MONGOLIAN LETTER TODO YA', +6230: 'MONGOLIAN LETTER TODO WA', +6231: 'MONGOLIAN LETTER TODO KA', +6232: 'MONGOLIAN LETTER TODO GAA', +6233: 'MONGOLIAN LETTER TODO HAA', +6234: 'MONGOLIAN LETTER TODO JIA', +6235: 'MONGOLIAN LETTER TODO NIA', +6236: 'MONGOLIAN LETTER TODO DZA', +6237: 'MONGOLIAN LETTER SIBE E', +6238: 'MONGOLIAN LETTER SIBE I', +6239: 'MONGOLIAN LETTER SIBE IY', +6240: 'MONGOLIAN LETTER SIBE UE', +6241: 'MONGOLIAN LETTER SIBE U', +6242: 'MONGOLIAN LETTER SIBE ANG', +6243: 'MONGOLIAN LETTER SIBE KA', +6244: 'MONGOLIAN LETTER SIBE GA', +6245: 'MONGOLIAN LETTER SIBE HA', +6246: 'MONGOLIAN LETTER SIBE PA', +6247: 'MONGOLIAN LETTER SIBE SHA', +6248: 'MONGOLIAN LETTER SIBE TA', +6249: 'MONGOLIAN LETTER SIBE DA', +6250: 'MONGOLIAN LETTER SIBE JA', +6251: 'MONGOLIAN LETTER SIBE FA', +6252: 'MONGOLIAN LETTER SIBE GAA', +6253: 'MONGOLIAN LETTER SIBE HAA', +6254: 'MONGOLIAN LETTER SIBE TSA', +6255: 'MONGOLIAN LETTER SIBE ZA', +6256: 'MONGOLIAN LETTER SIBE RAA', +6257: 'MONGOLIAN LETTER SIBE CHA', +6258: 'MONGOLIAN LETTER SIBE ZHA', +6259: 'MONGOLIAN LETTER MANCHU I', +6260: 'MONGOLIAN LETTER MANCHU KA', +6261: 'MONGOLIAN LETTER MANCHU RA', +6262: 'MONGOLIAN LETTER MANCHU FA', +6263: 'MONGOLIAN LETTER MANCHU ZHA', +6272: 'MONGOLIAN LETTER ALI GALI ANUSVARA ONE', +6273: 'MONGOLIAN LETTER ALI GALI VISARGA ONE', +6274: 'MONGOLIAN LETTER ALI GALI DAMARU', +6275: 'MONGOLIAN LETTER ALI GALI UBADAMA', +6276: 'MONGOLIAN LETTER ALI GALI INVERTED UBADAMA', +6277: 'MONGOLIAN LETTER ALI GALI BALUDA', +6278: 'MONGOLIAN LETTER ALI GALI THREE BALUDA', +6279: 'MONGOLIAN LETTER ALI GALI A', +6280: 'MONGOLIAN LETTER ALI GALI I', +6281: 'MONGOLIAN LETTER ALI GALI KA', +6282: 'MONGOLIAN LETTER ALI GALI NGA', +6283: 'MONGOLIAN LETTER ALI GALI CA', +6284: 'MONGOLIAN LETTER ALI GALI TTA', +6285: 'MONGOLIAN LETTER ALI GALI TTHA', +6286: 'MONGOLIAN LETTER ALI GALI DDA', +6287: 'MONGOLIAN LETTER ALI GALI NNA', +6288: 'MONGOLIAN LETTER ALI GALI TA', +6289: 'MONGOLIAN LETTER ALI GALI DA', +6290: 'MONGOLIAN LETTER ALI GALI PA', +6291: 'MONGOLIAN LETTER ALI GALI PHA', +6292: 'MONGOLIAN LETTER ALI GALI SSA', +6293: 'MONGOLIAN LETTER ALI GALI ZHA', +6294: 'MONGOLIAN LETTER ALI GALI ZA', +6295: 'MONGOLIAN LETTER ALI GALI AH', +6296: 'MONGOLIAN LETTER TODO ALI GALI TA', +6297: 'MONGOLIAN LETTER TODO ALI GALI ZHA', +6298: 'MONGOLIAN LETTER MANCHU ALI GALI GHA', +6299: 'MONGOLIAN LETTER MANCHU ALI GALI NGA', +6300: 'MONGOLIAN LETTER MANCHU ALI GALI CA', +6301: 'MONGOLIAN LETTER MANCHU ALI GALI JHA', +6302: 'MONGOLIAN LETTER MANCHU ALI GALI TTA', +6303: 'MONGOLIAN LETTER MANCHU ALI GALI DDHA', +6304: 'MONGOLIAN LETTER MANCHU ALI GALI TA', +6305: 'MONGOLIAN LETTER MANCHU ALI GALI DHA', +6306: 'MONGOLIAN LETTER MANCHU ALI GALI SSA', +6307: 'MONGOLIAN LETTER MANCHU ALI GALI CYA', +6308: 'MONGOLIAN LETTER MANCHU ALI GALI ZHA', +6309: 'MONGOLIAN LETTER MANCHU ALI GALI ZA', +6310: 'MONGOLIAN LETTER ALI GALI HALF U', +6311: 'MONGOLIAN LETTER ALI GALI HALF YA', +6312: 'MONGOLIAN LETTER MANCHU ALI GALI BHA', +6313: 'MONGOLIAN LETTER ALI GALI DAGALGA', +7680: 'LATIN CAPITAL LETTER A WITH RING BELOW', +7681: 'LATIN SMALL LETTER A WITH RING BELOW', +7682: 'LATIN CAPITAL LETTER B WITH DOT ABOVE', +7683: 'LATIN SMALL LETTER B WITH DOT ABOVE', +7684: 'LATIN CAPITAL LETTER B WITH DOT BELOW', +7685: 'LATIN SMALL LETTER B WITH DOT BELOW', +7686: 'LATIN CAPITAL LETTER B WITH LINE BELOW', +7687: 'LATIN SMALL LETTER B WITH LINE BELOW', +7688: 'LATIN CAPITAL LETTER C WITH CEDILLA AND ACUTE', +7689: 'LATIN SMALL LETTER C WITH CEDILLA AND ACUTE', +7690: 'LATIN CAPITAL LETTER D WITH DOT ABOVE', +7691: 'LATIN SMALL LETTER D WITH DOT ABOVE', +7692: 'LATIN CAPITAL LETTER D WITH DOT BELOW', +7693: 'LATIN SMALL LETTER D WITH DOT BELOW', +7694: 'LATIN CAPITAL LETTER D WITH LINE BELOW', +7695: 'LATIN SMALL LETTER D WITH LINE BELOW', +7696: 'LATIN CAPITAL LETTER D WITH CEDILLA', +7697: 'LATIN SMALL LETTER D WITH CEDILLA', +7698: 'LATIN CAPITAL LETTER D WITH CIRCUMFLEX BELOW', +7699: 'LATIN SMALL LETTER D WITH CIRCUMFLEX BELOW', +7700: 'LATIN CAPITAL LETTER E WITH MACRON AND GRAVE', +7701: 'LATIN SMALL LETTER E WITH MACRON AND GRAVE', +7702: 'LATIN CAPITAL LETTER E WITH MACRON AND ACUTE', +7703: 'LATIN SMALL LETTER E WITH MACRON AND ACUTE', +7704: 'LATIN CAPITAL LETTER E WITH CIRCUMFLEX BELOW', +7705: 'LATIN SMALL LETTER E WITH CIRCUMFLEX BELOW', +7706: 'LATIN CAPITAL LETTER E WITH TILDE BELOW', +7707: 'LATIN SMALL LETTER E WITH TILDE BELOW', +7708: 'LATIN CAPITAL LETTER E WITH CEDILLA AND BREVE', +7709: 'LATIN SMALL LETTER E WITH CEDILLA AND BREVE', +7710: 'LATIN CAPITAL LETTER F WITH DOT ABOVE', +7711: 'LATIN SMALL LETTER F WITH DOT ABOVE', +7712: 'LATIN CAPITAL LETTER G WITH MACRON', +7713: 'LATIN SMALL LETTER G WITH MACRON', +7714: 'LATIN CAPITAL LETTER H WITH DOT ABOVE', +7715: 'LATIN SMALL LETTER H WITH DOT ABOVE', +7716: 'LATIN CAPITAL LETTER H WITH DOT BELOW', +7717: 'LATIN SMALL LETTER H WITH DOT BELOW', +7718: 'LATIN CAPITAL LETTER H WITH DIAERESIS', +7719: 'LATIN SMALL LETTER H WITH DIAERESIS', +7720: 'LATIN CAPITAL LETTER H WITH CEDILLA', +7721: 'LATIN SMALL LETTER H WITH CEDILLA', +7722: 'LATIN CAPITAL LETTER H WITH BREVE BELOW', +7723: 'LATIN SMALL LETTER H WITH BREVE BELOW', +7724: 'LATIN CAPITAL LETTER I WITH TILDE BELOW', +7725: 'LATIN SMALL LETTER I WITH TILDE BELOW', +7726: 'LATIN CAPITAL LETTER I WITH DIAERESIS AND ACUTE', +7727: 'LATIN SMALL LETTER I WITH DIAERESIS AND ACUTE', +7728: 'LATIN CAPITAL LETTER K WITH ACUTE', +7729: 'LATIN SMALL LETTER K WITH ACUTE', +7730: 'LATIN CAPITAL LETTER K WITH DOT BELOW', +7731: 'LATIN SMALL LETTER K WITH DOT BELOW', +7732: 'LATIN CAPITAL LETTER K WITH LINE BELOW', +7733: 'LATIN SMALL LETTER K WITH LINE BELOW', +7734: 'LATIN CAPITAL LETTER L WITH DOT BELOW', +7735: 'LATIN SMALL LETTER L WITH DOT BELOW', +7736: 'LATIN CAPITAL LETTER L WITH DOT BELOW AND MACRON', +7737: 'LATIN SMALL LETTER L WITH DOT BELOW AND MACRON', +7738: 'LATIN CAPITAL LETTER L WITH LINE BELOW', +7739: 'LATIN SMALL LETTER L WITH LINE BELOW', +7740: 'LATIN CAPITAL LETTER L WITH CIRCUMFLEX BELOW', +7741: 'LATIN SMALL LETTER L WITH CIRCUMFLEX BELOW', +7742: 'LATIN CAPITAL LETTER M WITH ACUTE', +7743: 'LATIN SMALL LETTER M WITH ACUTE', +7744: 'LATIN CAPITAL LETTER M WITH DOT ABOVE', +7745: 'LATIN SMALL LETTER M WITH DOT ABOVE', +7746: 'LATIN CAPITAL LETTER M WITH DOT BELOW', +7747: 'LATIN SMALL LETTER M WITH DOT BELOW', +7748: 'LATIN CAPITAL LETTER N WITH DOT ABOVE', +7749: 'LATIN SMALL LETTER N WITH DOT ABOVE', +7750: 'LATIN CAPITAL LETTER N WITH DOT BELOW', +7751: 'LATIN SMALL LETTER N WITH DOT BELOW', +7752: 'LATIN CAPITAL LETTER N WITH LINE BELOW', +7753: 'LATIN SMALL LETTER N WITH LINE BELOW', +7754: 'LATIN CAPITAL LETTER N WITH CIRCUMFLEX BELOW', +7755: 'LATIN SMALL LETTER N WITH CIRCUMFLEX BELOW', +7756: 'LATIN CAPITAL LETTER O WITH TILDE AND ACUTE', +7757: 'LATIN SMALL LETTER O WITH TILDE AND ACUTE', +7758: 'LATIN CAPITAL LETTER O WITH TILDE AND DIAERESIS', +7759: 'LATIN SMALL LETTER O WITH TILDE AND DIAERESIS', +7760: 'LATIN CAPITAL LETTER O WITH MACRON AND GRAVE', +7761: 'LATIN SMALL LETTER O WITH MACRON AND GRAVE', +7762: 'LATIN CAPITAL LETTER O WITH MACRON AND ACUTE', +7763: 'LATIN SMALL LETTER O WITH MACRON AND ACUTE', +7764: 'LATIN CAPITAL LETTER P WITH ACUTE', +7765: 'LATIN SMALL LETTER P WITH ACUTE', +7766: 'LATIN CAPITAL LETTER P WITH DOT ABOVE', +7767: 'LATIN SMALL LETTER P WITH DOT ABOVE', +7768: 'LATIN CAPITAL LETTER R WITH DOT ABOVE', +7769: 'LATIN SMALL LETTER R WITH DOT ABOVE', +7770: 'LATIN CAPITAL LETTER R WITH DOT BELOW', +7771: 'LATIN SMALL LETTER R WITH DOT BELOW', +7772: 'LATIN CAPITAL LETTER R WITH DOT BELOW AND MACRON', +7773: 'LATIN SMALL LETTER R WITH DOT BELOW AND MACRON', +7774: 'LATIN CAPITAL LETTER R WITH LINE BELOW', +7775: 'LATIN SMALL LETTER R WITH LINE BELOW', +7776: 'LATIN CAPITAL LETTER S WITH DOT ABOVE', +7777: 'LATIN SMALL LETTER S WITH DOT ABOVE', +7778: 'LATIN CAPITAL LETTER S WITH DOT BELOW', +7779: 'LATIN SMALL LETTER S WITH DOT BELOW', +7780: 'LATIN CAPITAL LETTER S WITH ACUTE AND DOT ABOVE', +7781: 'LATIN SMALL LETTER S WITH ACUTE AND DOT ABOVE', +7782: 'LATIN CAPITAL LETTER S WITH CARON AND DOT ABOVE', +7783: 'LATIN SMALL LETTER S WITH CARON AND DOT ABOVE', +7784: 'LATIN CAPITAL LETTER S WITH DOT BELOW AND DOT ABOVE', +7785: 'LATIN SMALL LETTER S WITH DOT BELOW AND DOT ABOVE', +7786: 'LATIN CAPITAL LETTER T WITH DOT ABOVE', +7787: 'LATIN SMALL LETTER T WITH DOT ABOVE', +7788: 'LATIN CAPITAL LETTER T WITH DOT BELOW', +7789: 'LATIN SMALL LETTER T WITH DOT BELOW', +7790: 'LATIN CAPITAL LETTER T WITH LINE BELOW', +7791: 'LATIN SMALL LETTER T WITH LINE BELOW', +7792: 'LATIN CAPITAL LETTER T WITH CIRCUMFLEX BELOW', +7793: 'LATIN SMALL LETTER T WITH CIRCUMFLEX BELOW', +7794: 'LATIN CAPITAL LETTER U WITH DIAERESIS BELOW', +7795: 'LATIN SMALL LETTER U WITH DIAERESIS BELOW', +7796: 'LATIN CAPITAL LETTER U WITH TILDE BELOW', +7797: 'LATIN SMALL LETTER U WITH TILDE BELOW', +7798: 'LATIN CAPITAL LETTER U WITH CIRCUMFLEX BELOW', +7799: 'LATIN SMALL LETTER U WITH CIRCUMFLEX BELOW', +7800: 'LATIN CAPITAL LETTER U WITH TILDE AND ACUTE', +7801: 'LATIN SMALL LETTER U WITH TILDE AND ACUTE', +7802: 'LATIN CAPITAL LETTER U WITH MACRON AND DIAERESIS', +7803: 'LATIN SMALL LETTER U WITH MACRON AND DIAERESIS', +7804: 'LATIN CAPITAL LETTER V WITH TILDE', +7805: 'LATIN SMALL LETTER V WITH TILDE', +7806: 'LATIN CAPITAL LETTER V WITH DOT BELOW', +7807: 'LATIN SMALL LETTER V WITH DOT BELOW', +7808: 'LATIN CAPITAL LETTER W WITH GRAVE', +7809: 'LATIN SMALL LETTER W WITH GRAVE', +7810: 'LATIN CAPITAL LETTER W WITH ACUTE', +7811: 'LATIN SMALL LETTER W WITH ACUTE', +7812: 'LATIN CAPITAL LETTER W WITH DIAERESIS', +7813: 'LATIN SMALL LETTER W WITH DIAERESIS', +7814: 'LATIN CAPITAL LETTER W WITH DOT ABOVE', +7815: 'LATIN SMALL LETTER W WITH DOT ABOVE', +7816: 'LATIN CAPITAL LETTER W WITH DOT BELOW', +7817: 'LATIN SMALL LETTER W WITH DOT BELOW', +7818: 'LATIN CAPITAL LETTER X WITH DOT ABOVE', +7819: 'LATIN SMALL LETTER X WITH DOT ABOVE', +7820: 'LATIN CAPITAL LETTER X WITH DIAERESIS', +7821: 'LATIN SMALL LETTER X WITH DIAERESIS', +7822: 'LATIN CAPITAL LETTER Y WITH DOT ABOVE', +7823: 'LATIN SMALL LETTER Y WITH DOT ABOVE', +7824: 'LATIN CAPITAL LETTER Z WITH CIRCUMFLEX', +7825: 'LATIN SMALL LETTER Z WITH CIRCUMFLEX', +7826: 'LATIN CAPITAL LETTER Z WITH DOT BELOW', +7827: 'LATIN SMALL LETTER Z WITH DOT BELOW', +7828: 'LATIN CAPITAL LETTER Z WITH LINE BELOW', +7829: 'LATIN SMALL LETTER Z WITH LINE BELOW', +7830: 'LATIN SMALL LETTER H WITH LINE BELOW', +7831: 'LATIN SMALL LETTER T WITH DIAERESIS', +7832: 'LATIN SMALL LETTER W WITH RING ABOVE', +7833: 'LATIN SMALL LETTER Y WITH RING ABOVE', +7834: 'LATIN SMALL LETTER A WITH RIGHT HALF RING', +7835: 'LATIN SMALL LETTER LONG S WITH DOT ABOVE', +7840: 'LATIN CAPITAL LETTER A WITH DOT BELOW', +7841: 'LATIN SMALL LETTER A WITH DOT BELOW', +7842: 'LATIN CAPITAL LETTER A WITH HOOK ABOVE', +7843: 'LATIN SMALL LETTER A WITH HOOK ABOVE', +7844: 'LATIN CAPITAL LETTER A WITH CIRCUMFLEX AND ACUTE', +7845: 'LATIN SMALL LETTER A WITH CIRCUMFLEX AND ACUTE', +7846: 'LATIN CAPITAL LETTER A WITH CIRCUMFLEX AND GRAVE', +7847: 'LATIN SMALL LETTER A WITH CIRCUMFLEX AND GRAVE', +7848: 'LATIN CAPITAL LETTER A WITH CIRCUMFLEX AND HOOK ABOVE', +7849: 'LATIN SMALL LETTER A WITH CIRCUMFLEX AND HOOK ABOVE', +7850: 'LATIN CAPITAL LETTER A WITH CIRCUMFLEX AND TILDE', +7851: 'LATIN SMALL LETTER A WITH CIRCUMFLEX AND TILDE', +7852: 'LATIN CAPITAL LETTER A WITH CIRCUMFLEX AND DOT BELOW', +7853: 'LATIN SMALL LETTER A WITH CIRCUMFLEX AND DOT BELOW', +7854: 'LATIN CAPITAL LETTER A WITH BREVE AND ACUTE', +7855: 'LATIN SMALL LETTER A WITH BREVE AND ACUTE', +7856: 'LATIN CAPITAL LETTER A WITH BREVE AND GRAVE', +7857: 'LATIN SMALL LETTER A WITH BREVE AND GRAVE', +7858: 'LATIN CAPITAL LETTER A WITH BREVE AND HOOK ABOVE', +7859: 'LATIN SMALL LETTER A WITH BREVE AND HOOK ABOVE', +7860: 'LATIN CAPITAL LETTER A WITH BREVE AND TILDE', +7861: 'LATIN SMALL LETTER A WITH BREVE AND TILDE', +7862: 'LATIN CAPITAL LETTER A WITH BREVE AND DOT BELOW', +7863: 'LATIN SMALL LETTER A WITH BREVE AND DOT BELOW', +7864: 'LATIN CAPITAL LETTER E WITH DOT BELOW', +7865: 'LATIN SMALL LETTER E WITH DOT BELOW', +7866: 'LATIN CAPITAL LETTER E WITH HOOK ABOVE', +7867: 'LATIN SMALL LETTER E WITH HOOK ABOVE', +7868: 'LATIN CAPITAL LETTER E WITH TILDE', +7869: 'LATIN SMALL LETTER E WITH TILDE', +7870: 'LATIN CAPITAL LETTER E WITH CIRCUMFLEX AND ACUTE', +7871: 'LATIN SMALL LETTER E WITH CIRCUMFLEX AND ACUTE', +7872: 'LATIN CAPITAL LETTER E WITH CIRCUMFLEX AND GRAVE', +7873: 'LATIN SMALL LETTER E WITH CIRCUMFLEX AND GRAVE', +7874: 'LATIN CAPITAL LETTER E WITH CIRCUMFLEX AND HOOK ABOVE', +7875: 'LATIN SMALL LETTER E WITH CIRCUMFLEX AND HOOK ABOVE', +7876: 'LATIN CAPITAL LETTER E WITH CIRCUMFLEX AND TILDE', +7877: 'LATIN SMALL LETTER E WITH CIRCUMFLEX AND TILDE', +7878: 'LATIN CAPITAL LETTER E WITH CIRCUMFLEX AND DOT BELOW', +7879: 'LATIN SMALL LETTER E WITH CIRCUMFLEX AND DOT BELOW', +7880: 'LATIN CAPITAL LETTER I WITH HOOK ABOVE', +7881: 'LATIN SMALL LETTER I WITH HOOK ABOVE', +7882: 'LATIN CAPITAL LETTER I WITH DOT BELOW', +7883: 'LATIN SMALL LETTER I WITH DOT BELOW', +7884: 'LATIN CAPITAL LETTER O WITH DOT BELOW', +7885: 'LATIN SMALL LETTER O WITH DOT BELOW', +7886: 'LATIN CAPITAL LETTER O WITH HOOK ABOVE', +7887: 'LATIN SMALL LETTER O WITH HOOK ABOVE', +7888: 'LATIN CAPITAL LETTER O WITH CIRCUMFLEX AND ACUTE', +7889: 'LATIN SMALL LETTER O WITH CIRCUMFLEX AND ACUTE', +7890: 'LATIN CAPITAL LETTER O WITH CIRCUMFLEX AND GRAVE', +7891: 'LATIN SMALL LETTER O WITH CIRCUMFLEX AND GRAVE', +7892: 'LATIN CAPITAL LETTER O WITH CIRCUMFLEX AND HOOK ABOVE', +7893: 'LATIN SMALL LETTER O WITH CIRCUMFLEX AND HOOK ABOVE', +7894: 'LATIN CAPITAL LETTER O WITH CIRCUMFLEX AND TILDE', +7895: 'LATIN SMALL LETTER O WITH CIRCUMFLEX AND TILDE', +7896: 'LATIN CAPITAL LETTER O WITH CIRCUMFLEX AND DOT BELOW', +7897: 'LATIN SMALL LETTER O WITH CIRCUMFLEX AND DOT BELOW', +7898: 'LATIN CAPITAL LETTER O WITH HORN AND ACUTE', +7899: 'LATIN SMALL LETTER O WITH HORN AND ACUTE', +7900: 'LATIN CAPITAL LETTER O WITH HORN AND GRAVE', +7901: 'LATIN SMALL LETTER O WITH HORN AND GRAVE', +7902: 'LATIN CAPITAL LETTER O WITH HORN AND HOOK ABOVE', +7903: 'LATIN SMALL LETTER O WITH HORN AND HOOK ABOVE', +7904: 'LATIN CAPITAL LETTER O WITH HORN AND TILDE', +7905: 'LATIN SMALL LETTER O WITH HORN AND TILDE', +7906: 'LATIN CAPITAL LETTER O WITH HORN AND DOT BELOW', +7907: 'LATIN SMALL LETTER O WITH HORN AND DOT BELOW', +7908: 'LATIN CAPITAL LETTER U WITH DOT BELOW', +7909: 'LATIN SMALL LETTER U WITH DOT BELOW', +7910: 'LATIN CAPITAL LETTER U WITH HOOK ABOVE', +7911: 'LATIN SMALL LETTER U WITH HOOK ABOVE', +7912: 'LATIN CAPITAL LETTER U WITH HORN AND ACUTE', +7913: 'LATIN SMALL LETTER U WITH HORN AND ACUTE', +7914: 'LATIN CAPITAL LETTER U WITH HORN AND GRAVE', +7915: 'LATIN SMALL LETTER U WITH HORN AND GRAVE', +7916: 'LATIN CAPITAL LETTER U WITH HORN AND HOOK ABOVE', +7917: 'LATIN SMALL LETTER U WITH HORN AND HOOK ABOVE', +7918: 'LATIN CAPITAL LETTER U WITH HORN AND TILDE', +7919: 'LATIN SMALL LETTER U WITH HORN AND TILDE', +7920: 'LATIN CAPITAL LETTER U WITH HORN AND DOT BELOW', +7921: 'LATIN SMALL LETTER U WITH HORN AND DOT BELOW', +7922: 'LATIN CAPITAL LETTER Y WITH GRAVE', +7923: 'LATIN SMALL LETTER Y WITH GRAVE', +7924: 'LATIN CAPITAL LETTER Y WITH DOT BELOW', +7925: 'LATIN SMALL LETTER Y WITH DOT BELOW', +7926: 'LATIN CAPITAL LETTER Y WITH HOOK ABOVE', +7927: 'LATIN SMALL LETTER Y WITH HOOK ABOVE', +7928: 'LATIN CAPITAL LETTER Y WITH TILDE', +7929: 'LATIN SMALL LETTER Y WITH TILDE', +7936: 'GREEK SMALL LETTER ALPHA WITH PSILI', +7937: 'GREEK SMALL LETTER ALPHA WITH DASIA', +7938: 'GREEK SMALL LETTER ALPHA WITH PSILI AND VARIA', +7939: 'GREEK SMALL LETTER ALPHA WITH DASIA AND VARIA', +7940: 'GREEK SMALL LETTER ALPHA WITH PSILI AND OXIA', +7941: 'GREEK SMALL LETTER ALPHA WITH DASIA AND OXIA', +7942: 'GREEK SMALL LETTER ALPHA WITH PSILI AND PERISPOMENI', +7943: 'GREEK SMALL LETTER ALPHA WITH DASIA AND PERISPOMENI', +7944: 'GREEK CAPITAL LETTER ALPHA WITH PSILI', +7945: 'GREEK CAPITAL LETTER ALPHA WITH DASIA', +7946: 'GREEK CAPITAL LETTER ALPHA WITH PSILI AND VARIA', +7947: 'GREEK CAPITAL LETTER ALPHA WITH DASIA AND VARIA', +7948: 'GREEK CAPITAL LETTER ALPHA WITH PSILI AND OXIA', +7949: 'GREEK CAPITAL LETTER ALPHA WITH DASIA AND OXIA', +7950: 'GREEK CAPITAL LETTER ALPHA WITH PSILI AND PERISPOMENI', +7951: 'GREEK CAPITAL LETTER ALPHA WITH DASIA AND PERISPOMENI', +7952: 'GREEK SMALL LETTER EPSILON WITH PSILI', +7953: 'GREEK SMALL LETTER EPSILON WITH DASIA', +7954: 'GREEK SMALL LETTER EPSILON WITH PSILI AND VARIA', +7955: 'GREEK SMALL LETTER EPSILON WITH DASIA AND VARIA', +7956: 'GREEK SMALL LETTER EPSILON WITH PSILI AND OXIA', +7957: 'GREEK SMALL LETTER EPSILON WITH DASIA AND OXIA', +7960: 'GREEK CAPITAL LETTER EPSILON WITH PSILI', +7961: 'GREEK CAPITAL LETTER EPSILON WITH DASIA', +7962: 'GREEK CAPITAL LETTER EPSILON WITH PSILI AND VARIA', +7963: 'GREEK CAPITAL LETTER EPSILON WITH DASIA AND VARIA', +7964: 'GREEK CAPITAL LETTER EPSILON WITH PSILI AND OXIA', +7965: 'GREEK CAPITAL LETTER EPSILON WITH DASIA AND OXIA', +7968: 'GREEK SMALL LETTER ETA WITH PSILI', +7969: 'GREEK SMALL LETTER ETA WITH DASIA', +7970: 'GREEK SMALL LETTER ETA WITH PSILI AND VARIA', +7971: 'GREEK SMALL LETTER ETA WITH DASIA AND VARIA', +7972: 'GREEK SMALL LETTER ETA WITH PSILI AND OXIA', +7973: 'GREEK SMALL LETTER ETA WITH DASIA AND OXIA', +7974: 'GREEK SMALL LETTER ETA WITH PSILI AND PERISPOMENI', +7975: 'GREEK SMALL LETTER ETA WITH DASIA AND PERISPOMENI', +7976: 'GREEK CAPITAL LETTER ETA WITH PSILI', +7977: 'GREEK CAPITAL LETTER ETA WITH DASIA', +7978: 'GREEK CAPITAL LETTER ETA WITH PSILI AND VARIA', +7979: 'GREEK CAPITAL LETTER ETA WITH DASIA AND VARIA', +7980: 'GREEK CAPITAL LETTER ETA WITH PSILI AND OXIA', +7981: 'GREEK CAPITAL LETTER ETA WITH DASIA AND OXIA', +7982: 'GREEK CAPITAL LETTER ETA WITH PSILI AND PERISPOMENI', +7983: 'GREEK CAPITAL LETTER ETA WITH DASIA AND PERISPOMENI', +7984: 'GREEK SMALL LETTER IOTA WITH PSILI', +7985: 'GREEK SMALL LETTER IOTA WITH DASIA', +7986: 'GREEK SMALL LETTER IOTA WITH PSILI AND VARIA', +7987: 'GREEK SMALL LETTER IOTA WITH DASIA AND VARIA', +7988: 'GREEK SMALL LETTER IOTA WITH PSILI AND OXIA', +7989: 'GREEK SMALL LETTER IOTA WITH DASIA AND OXIA', +7990: 'GREEK SMALL LETTER IOTA WITH PSILI AND PERISPOMENI', +7991: 'GREEK SMALL LETTER IOTA WITH DASIA AND PERISPOMENI', +7992: 'GREEK CAPITAL LETTER IOTA WITH PSILI', +7993: 'GREEK CAPITAL LETTER IOTA WITH DASIA', +7994: 'GREEK CAPITAL LETTER IOTA WITH PSILI AND VARIA', +7995: 'GREEK CAPITAL LETTER IOTA WITH DASIA AND VARIA', +7996: 'GREEK CAPITAL LETTER IOTA WITH PSILI AND OXIA', +7997: 'GREEK CAPITAL LETTER IOTA WITH DASIA AND OXIA', +7998: 'GREEK CAPITAL LETTER IOTA WITH PSILI AND PERISPOMENI', +7999: 'GREEK CAPITAL LETTER IOTA WITH DASIA AND PERISPOMENI', +8000: 'GREEK SMALL LETTER OMICRON WITH PSILI', +8001: 'GREEK SMALL LETTER OMICRON WITH DASIA', +8002: 'GREEK SMALL LETTER OMICRON WITH PSILI AND VARIA', +8003: 'GREEK SMALL LETTER OMICRON WITH DASIA AND VARIA', +8004: 'GREEK SMALL LETTER OMICRON WITH PSILI AND OXIA', +8005: 'GREEK SMALL LETTER OMICRON WITH DASIA AND OXIA', +8008: 'GREEK CAPITAL LETTER OMICRON WITH PSILI', +8009: 'GREEK CAPITAL LETTER OMICRON WITH DASIA', +8010: 'GREEK CAPITAL LETTER OMICRON WITH PSILI AND VARIA', +8011: 'GREEK CAPITAL LETTER OMICRON WITH DASIA AND VARIA', +8012: 'GREEK CAPITAL LETTER OMICRON WITH PSILI AND OXIA', +8013: 'GREEK CAPITAL LETTER OMICRON WITH DASIA AND OXIA', +8016: 'GREEK SMALL LETTER UPSILON WITH PSILI', +8017: 'GREEK SMALL LETTER UPSILON WITH DASIA', +8018: 'GREEK SMALL LETTER UPSILON WITH PSILI AND VARIA', +8019: 'GREEK SMALL LETTER UPSILON WITH DASIA AND VARIA', +8020: 'GREEK SMALL LETTER UPSILON WITH PSILI AND OXIA', +8021: 'GREEK SMALL LETTER UPSILON WITH DASIA AND OXIA', +8022: 'GREEK SMALL LETTER UPSILON WITH PSILI AND PERISPOMENI', +8023: 'GREEK SMALL LETTER UPSILON WITH DASIA AND PERISPOMENI', +8025: 'GREEK CAPITAL LETTER UPSILON WITH DASIA', +8027: 'GREEK CAPITAL LETTER UPSILON WITH DASIA AND VARIA', +8029: 'GREEK CAPITAL LETTER UPSILON WITH DASIA AND OXIA', +8031: 'GREEK CAPITAL LETTER UPSILON WITH DASIA AND PERISPOMENI', +8032: 'GREEK SMALL LETTER OMEGA WITH PSILI', +8033: 'GREEK SMALL LETTER OMEGA WITH DASIA', +8034: 'GREEK SMALL LETTER OMEGA WITH PSILI AND VARIA', +8035: 'GREEK SMALL LETTER OMEGA WITH DASIA AND VARIA', +8036: 'GREEK SMALL LETTER OMEGA WITH PSILI AND OXIA', +8037: 'GREEK SMALL LETTER OMEGA WITH DASIA AND OXIA', +8038: 'GREEK SMALL LETTER OMEGA WITH PSILI AND PERISPOMENI', +8039: 'GREEK SMALL LETTER OMEGA WITH DASIA AND PERISPOMENI', +8040: 'GREEK CAPITAL LETTER OMEGA WITH PSILI', +8041: 'GREEK CAPITAL LETTER OMEGA WITH DASIA', +8042: 'GREEK CAPITAL LETTER OMEGA WITH PSILI AND VARIA', +8043: 'GREEK CAPITAL LETTER OMEGA WITH DASIA AND VARIA', +8044: 'GREEK CAPITAL LETTER OMEGA WITH PSILI AND OXIA', +8045: 'GREEK CAPITAL LETTER OMEGA WITH DASIA AND OXIA', +8046: 'GREEK CAPITAL LETTER OMEGA WITH PSILI AND PERISPOMENI', +8047: 'GREEK CAPITAL LETTER OMEGA WITH DASIA AND PERISPOMENI', +8048: 'GREEK SMALL LETTER ALPHA WITH VARIA', +8049: 'GREEK SMALL LETTER ALPHA WITH OXIA', +8050: 'GREEK SMALL LETTER EPSILON WITH VARIA', +8051: 'GREEK SMALL LETTER EPSILON WITH OXIA', +8052: 'GREEK SMALL LETTER ETA WITH VARIA', +8053: 'GREEK SMALL LETTER ETA WITH OXIA', +8054: 'GREEK SMALL LETTER IOTA WITH VARIA', +8055: 'GREEK SMALL LETTER IOTA WITH OXIA', +8056: 'GREEK SMALL LETTER OMICRON WITH VARIA', +8057: 'GREEK SMALL LETTER OMICRON WITH OXIA', +8058: 'GREEK SMALL LETTER UPSILON WITH VARIA', +8059: 'GREEK SMALL LETTER UPSILON WITH OXIA', +8060: 'GREEK SMALL LETTER OMEGA WITH VARIA', +8061: 'GREEK SMALL LETTER OMEGA WITH OXIA', +8064: 'GREEK SMALL LETTER ALPHA WITH PSILI AND YPOGEGRAMMENI', +8065: 'GREEK SMALL LETTER ALPHA WITH DASIA AND YPOGEGRAMMENI', +8066: 'GREEK SMALL LETTER ALPHA WITH PSILI AND VARIA AND YPOGEGRAMMENI', +8067: 'GREEK SMALL LETTER ALPHA WITH DASIA AND VARIA AND YPOGEGRAMMENI', +8068: 'GREEK SMALL LETTER ALPHA WITH PSILI AND OXIA AND YPOGEGRAMMENI', +8069: 'GREEK SMALL LETTER ALPHA WITH DASIA AND OXIA AND YPOGEGRAMMENI', +8070: 'GREEK SMALL LETTER ALPHA WITH PSILI AND PERISPOMENI AND YPOGEGRAMMENI', +8071: 'GREEK SMALL LETTER ALPHA WITH DASIA AND PERISPOMENI AND YPOGEGRAMMENI', +8072: 'GREEK CAPITAL LETTER ALPHA WITH PSILI AND PROSGEGRAMMENI', +8073: 'GREEK CAPITAL LETTER ALPHA WITH DASIA AND PROSGEGRAMMENI', +8074: 'GREEK CAPITAL LETTER ALPHA WITH PSILI AND VARIA AND PROSGEGRAMMENI', +8075: 'GREEK CAPITAL LETTER ALPHA WITH DASIA AND VARIA AND PROSGEGRAMMENI', +8076: 'GREEK CAPITAL LETTER ALPHA WITH PSILI AND OXIA AND PROSGEGRAMMENI', +8077: 'GREEK CAPITAL LETTER ALPHA WITH DASIA AND OXIA AND PROSGEGRAMMENI', +8078: 'GREEK CAPITAL LETTER ALPHA WITH PSILI AND PERISPOMENI AND PROSGEGRAMMENI', +8079: 'GREEK CAPITAL LETTER ALPHA WITH DASIA AND PERISPOMENI AND PROSGEGRAMMENI', +8080: 'GREEK SMALL LETTER ETA WITH PSILI AND YPOGEGRAMMENI', +8081: 'GREEK SMALL LETTER ETA WITH DASIA AND YPOGEGRAMMENI', +8082: 'GREEK SMALL LETTER ETA WITH PSILI AND VARIA AND YPOGEGRAMMENI', +8083: 'GREEK SMALL LETTER ETA WITH DASIA AND VARIA AND YPOGEGRAMMENI', +8084: 'GREEK SMALL LETTER ETA WITH PSILI AND OXIA AND YPOGEGRAMMENI', +8085: 'GREEK SMALL LETTER ETA WITH DASIA AND OXIA AND YPOGEGRAMMENI', +8086: 'GREEK SMALL LETTER ETA WITH PSILI AND PERISPOMENI AND YPOGEGRAMMENI', +8087: 'GREEK SMALL LETTER ETA WITH DASIA AND PERISPOMENI AND YPOGEGRAMMENI', +8088: 'GREEK CAPITAL LETTER ETA WITH PSILI AND PROSGEGRAMMENI', +8089: 'GREEK CAPITAL LETTER ETA WITH DASIA AND PROSGEGRAMMENI', +8090: 'GREEK CAPITAL LETTER ETA WITH PSILI AND VARIA AND PROSGEGRAMMENI', +8091: 'GREEK CAPITAL LETTER ETA WITH DASIA AND VARIA AND PROSGEGRAMMENI', +8092: 'GREEK CAPITAL LETTER ETA WITH PSILI AND OXIA AND PROSGEGRAMMENI', +8093: 'GREEK CAPITAL LETTER ETA WITH DASIA AND OXIA AND PROSGEGRAMMENI', +8094: 'GREEK CAPITAL LETTER ETA WITH PSILI AND PERISPOMENI AND PROSGEGRAMMENI', +8095: 'GREEK CAPITAL LETTER ETA WITH DASIA AND PERISPOMENI AND PROSGEGRAMMENI', +8096: 'GREEK SMALL LETTER OMEGA WITH PSILI AND YPOGEGRAMMENI', +8097: 'GREEK SMALL LETTER OMEGA WITH DASIA AND YPOGEGRAMMENI', +8098: 'GREEK SMALL LETTER OMEGA WITH PSILI AND VARIA AND YPOGEGRAMMENI', +8099: 'GREEK SMALL LETTER OMEGA WITH DASIA AND VARIA AND YPOGEGRAMMENI', +8100: 'GREEK SMALL LETTER OMEGA WITH PSILI AND OXIA AND YPOGEGRAMMENI', +8101: 'GREEK SMALL LETTER OMEGA WITH DASIA AND OXIA AND YPOGEGRAMMENI', +8102: 'GREEK SMALL LETTER OMEGA WITH PSILI AND PERISPOMENI AND YPOGEGRAMMENI', +8103: 'GREEK SMALL LETTER OMEGA WITH DASIA AND PERISPOMENI AND YPOGEGRAMMENI', +8104: 'GREEK CAPITAL LETTER OMEGA WITH PSILI AND PROSGEGRAMMENI', +8105: 'GREEK CAPITAL LETTER OMEGA WITH DASIA AND PROSGEGRAMMENI', +8106: 'GREEK CAPITAL LETTER OMEGA WITH PSILI AND VARIA AND PROSGEGRAMMENI', +8107: 'GREEK CAPITAL LETTER OMEGA WITH DASIA AND VARIA AND PROSGEGRAMMENI', +8108: 'GREEK CAPITAL LETTER OMEGA WITH PSILI AND OXIA AND PROSGEGRAMMENI', +8109: 'GREEK CAPITAL LETTER OMEGA WITH DASIA AND OXIA AND PROSGEGRAMMENI', +8110: 'GREEK CAPITAL LETTER OMEGA WITH PSILI AND PERISPOMENI AND PROSGEGRAMMENI', +8111: 'GREEK CAPITAL LETTER OMEGA WITH DASIA AND PERISPOMENI AND PROSGEGRAMMENI', +8112: 'GREEK SMALL LETTER ALPHA WITH VRACHY', +8113: 'GREEK SMALL LETTER ALPHA WITH MACRON', +8114: 'GREEK SMALL LETTER ALPHA WITH VARIA AND YPOGEGRAMMENI', +8115: 'GREEK SMALL LETTER ALPHA WITH YPOGEGRAMMENI', +8116: 'GREEK SMALL LETTER ALPHA WITH OXIA AND YPOGEGRAMMENI', +8118: 'GREEK SMALL LETTER ALPHA WITH PERISPOMENI', +8119: 'GREEK SMALL LETTER ALPHA WITH PERISPOMENI AND YPOGEGRAMMENI', +8120: 'GREEK CAPITAL LETTER ALPHA WITH VRACHY', +8121: 'GREEK CAPITAL LETTER ALPHA WITH MACRON', +8122: 'GREEK CAPITAL LETTER ALPHA WITH VARIA', +8123: 'GREEK CAPITAL LETTER ALPHA WITH OXIA', +8124: 'GREEK CAPITAL LETTER ALPHA WITH PROSGEGRAMMENI', +8125: 'GREEK KORONIS', +8126: 'GREEK PROSGEGRAMMENI', +8127: 'GREEK PSILI', +8128: 'GREEK PERISPOMENI', +8129: 'GREEK DIALYTIKA AND PERISPOMENI', +8130: 'GREEK SMALL LETTER ETA WITH VARIA AND YPOGEGRAMMENI', +8131: 'GREEK SMALL LETTER ETA WITH YPOGEGRAMMENI', +8132: 'GREEK SMALL LETTER ETA WITH OXIA AND YPOGEGRAMMENI', +8134: 'GREEK SMALL LETTER ETA WITH PERISPOMENI', +8135: 'GREEK SMALL LETTER ETA WITH PERISPOMENI AND YPOGEGRAMMENI', +8136: 'GREEK CAPITAL LETTER EPSILON WITH VARIA', +8137: 'GREEK CAPITAL LETTER EPSILON WITH OXIA', +8138: 'GREEK CAPITAL LETTER ETA WITH VARIA', +8139: 'GREEK CAPITAL LETTER ETA WITH OXIA', +8140: 'GREEK CAPITAL LETTER ETA WITH PROSGEGRAMMENI', +8141: 'GREEK PSILI AND VARIA', +8142: 'GREEK PSILI AND OXIA', +8143: 'GREEK PSILI AND PERISPOMENI', +8144: 'GREEK SMALL LETTER IOTA WITH VRACHY', +8145: 'GREEK SMALL LETTER IOTA WITH MACRON', +8146: 'GREEK SMALL LETTER IOTA WITH DIALYTIKA AND VARIA', +8147: 'GREEK SMALL LETTER IOTA WITH DIALYTIKA AND OXIA', +8150: 'GREEK SMALL LETTER IOTA WITH PERISPOMENI', +8151: 'GREEK SMALL LETTER IOTA WITH DIALYTIKA AND PERISPOMENI', +8152: 'GREEK CAPITAL LETTER IOTA WITH VRACHY', +8153: 'GREEK CAPITAL LETTER IOTA WITH MACRON', +8154: 'GREEK CAPITAL LETTER IOTA WITH VARIA', +8155: 'GREEK CAPITAL LETTER IOTA WITH OXIA', +8157: 'GREEK DASIA AND VARIA', +8158: 'GREEK DASIA AND OXIA', +8159: 'GREEK DASIA AND PERISPOMENI', +8160: 'GREEK SMALL LETTER UPSILON WITH VRACHY', +8161: 'GREEK SMALL LETTER UPSILON WITH MACRON', +8162: 'GREEK SMALL LETTER UPSILON WITH DIALYTIKA AND VARIA', +8163: 'GREEK SMALL LETTER UPSILON WITH DIALYTIKA AND OXIA', +8164: 'GREEK SMALL LETTER RHO WITH PSILI', +8165: 'GREEK SMALL LETTER RHO WITH DASIA', +8166: 'GREEK SMALL LETTER UPSILON WITH PERISPOMENI', +8167: 'GREEK SMALL LETTER UPSILON WITH DIALYTIKA AND PERISPOMENI', +8168: 'GREEK CAPITAL LETTER UPSILON WITH VRACHY', +8169: 'GREEK CAPITAL LETTER UPSILON WITH MACRON', +8170: 'GREEK CAPITAL LETTER UPSILON WITH VARIA', +8171: 'GREEK CAPITAL LETTER UPSILON WITH OXIA', +8172: 'GREEK CAPITAL LETTER RHO WITH DASIA', +8173: 'GREEK DIALYTIKA AND VARIA', +8174: 'GREEK DIALYTIKA AND OXIA', +8175: 'GREEK VARIA', +8178: 'GREEK SMALL LETTER OMEGA WITH VARIA AND YPOGEGRAMMENI', +8179: 'GREEK SMALL LETTER OMEGA WITH YPOGEGRAMMENI', +8180: 'GREEK SMALL LETTER OMEGA WITH OXIA AND YPOGEGRAMMENI', +8182: 'GREEK SMALL LETTER OMEGA WITH PERISPOMENI', +8183: 'GREEK SMALL LETTER OMEGA WITH PERISPOMENI AND YPOGEGRAMMENI', +8184: 'GREEK CAPITAL LETTER OMICRON WITH VARIA', +8185: 'GREEK CAPITAL LETTER OMICRON WITH OXIA', +8186: 'GREEK CAPITAL LETTER OMEGA WITH VARIA', +8187: 'GREEK CAPITAL LETTER OMEGA WITH OXIA', +8188: 'GREEK CAPITAL LETTER OMEGA WITH PROSGEGRAMMENI', +8189: 'GREEK OXIA', +8190: 'GREEK DASIA', +8192: 'EN QUAD', +8193: 'EM QUAD', +8194: 'EN SPACE', +8195: 'EM SPACE', +8196: 'THREE-PER-EM SPACE', +8197: 'FOUR-PER-EM SPACE', +8198: 'SIX-PER-EM SPACE', +8199: 'FIGURE SPACE', +8200: 'PUNCTUATION SPACE', +8201: 'THIN SPACE', +8202: 'HAIR SPACE', +8203: 'ZERO WIDTH SPACE', +8204: 'ZERO WIDTH NON-JOINER', +8205: 'ZERO WIDTH JOINER', +8206: 'LEFT-TO-RIGHT MARK', +8207: 'RIGHT-TO-LEFT MARK', +8208: 'HYPHEN', +8209: 'NON-BREAKING HYPHEN', +8210: 'FIGURE DASH', +8211: 'EN DASH', +8212: 'EM DASH', +8213: 'HORIZONTAL BAR', +8214: 'DOUBLE VERTICAL LINE', +8215: 'DOUBLE LOW LINE', +8216: 'LEFT SINGLE QUOTATION MARK', +8217: 'RIGHT SINGLE QUOTATION MARK', +8218: 'SINGLE LOW-9 QUOTATION MARK', +8219: 'SINGLE HIGH-REVERSED-9 QUOTATION MARK', +8220: 'LEFT DOUBLE QUOTATION MARK', +8221: 'RIGHT DOUBLE QUOTATION MARK', +8222: 'DOUBLE LOW-9 QUOTATION MARK', +8223: 'DOUBLE HIGH-REVERSED-9 QUOTATION MARK', +8224: 'DAGGER', +8225: 'DOUBLE DAGGER', +8226: 'BULLET', +8227: 'TRIANGULAR BULLET', +8228: 'ONE DOT LEADER', +8229: 'TWO DOT LEADER', +8230: 'HORIZONTAL ELLIPSIS', +8231: 'HYPHENATION POINT', +8232: 'LINE SEPARATOR', +8233: 'PARAGRAPH SEPARATOR', +8234: 'LEFT-TO-RIGHT EMBEDDING', +8235: 'RIGHT-TO-LEFT EMBEDDING', +8236: 'POP DIRECTIONAL FORMATTING', +8237: 'LEFT-TO-RIGHT OVERRIDE', +8238: 'RIGHT-TO-LEFT OVERRIDE', +8239: 'NARROW NO-BREAK SPACE', +8240: 'PER MILLE SIGN', +8241: 'PER TEN THOUSAND SIGN', +8242: 'PRIME', +8243: 'DOUBLE PRIME', +8244: 'TRIPLE PRIME', +8245: 'REVERSED PRIME', +8246: 'REVERSED DOUBLE PRIME', +8247: 'REVERSED TRIPLE PRIME', +8248: 'CARET', +8249: 'SINGLE LEFT-POINTING ANGLE QUOTATION MARK', +8250: 'SINGLE RIGHT-POINTING ANGLE QUOTATION MARK', +8251: 'REFERENCE MARK', +8252: 'DOUBLE EXCLAMATION MARK', +8253: 'INTERROBANG', +8254: 'OVERLINE', +8255: 'UNDERTIE', +8256: 'CHARACTER TIE', +8257: 'CARET INSERTION POINT', +8258: 'ASTERISM', +8259: 'HYPHEN BULLET', +8260: 'FRACTION SLASH', +8261: 'LEFT SQUARE BRACKET WITH QUILL', +8262: 'RIGHT SQUARE BRACKET WITH QUILL', +8263: 'DOUBLE QUESTION MARK', +8264: 'QUESTION EXCLAMATION MARK', +8265: 'EXCLAMATION QUESTION MARK', +8266: 'TIRONIAN SIGN ET', +8267: 'REVERSED PILCROW SIGN', +8268: 'BLACK LEFTWARDS BULLET', +8269: 'BLACK RIGHTWARDS BULLET', +8270: 'LOW ASTERISK', +8271: 'REVERSED SEMICOLON', +8272: 'CLOSE UP', +8273: 'TWO ASTERISKS ALIGNED VERTICALLY', +8274: 'COMMERCIAL MINUS SIGN', +8279: 'QUADRUPLE PRIME', +8287: 'MEDIUM MATHEMATICAL SPACE', +8288: 'WORD JOINER', +8289: 'FUNCTION APPLICATION', +8290: 'INVISIBLE TIMES', +8291: 'INVISIBLE SEPARATOR', +8298: 'INHIBIT SYMMETRIC SWAPPING', +8299: 'ACTIVATE SYMMETRIC SWAPPING', +8300: 'INHIBIT ARABIC FORM SHAPING', +8301: 'ACTIVATE ARABIC FORM SHAPING', +8302: 'NATIONAL DIGIT SHAPES', +8303: 'NOMINAL DIGIT SHAPES', +8304: 'SUPERSCRIPT ZERO', +8305: 'SUPERSCRIPT LATIN SMALL LETTER I', +8308: 'SUPERSCRIPT FOUR', +8309: 'SUPERSCRIPT FIVE', +8310: 'SUPERSCRIPT SIX', +8311: 'SUPERSCRIPT SEVEN', +8312: 'SUPERSCRIPT EIGHT', +8313: 'SUPERSCRIPT NINE', +8314: 'SUPERSCRIPT PLUS SIGN', +8315: 'SUPERSCRIPT MINUS', +8316: 'SUPERSCRIPT EQUALS SIGN', +8317: 'SUPERSCRIPT LEFT PARENTHESIS', +8318: 'SUPERSCRIPT RIGHT PARENTHESIS', +8319: 'SUPERSCRIPT LATIN SMALL LETTER N', +8320: 'SUBSCRIPT ZERO', +8321: 'SUBSCRIPT ONE', +8322: 'SUBSCRIPT TWO', +8323: 'SUBSCRIPT THREE', +8324: 'SUBSCRIPT FOUR', +8325: 'SUBSCRIPT FIVE', +8326: 'SUBSCRIPT SIX', +8327: 'SUBSCRIPT SEVEN', +8328: 'SUBSCRIPT EIGHT', +8329: 'SUBSCRIPT NINE', +8330: 'SUBSCRIPT PLUS SIGN', +8331: 'SUBSCRIPT MINUS', +8332: 'SUBSCRIPT EQUALS SIGN', +8333: 'SUBSCRIPT LEFT PARENTHESIS', +8334: 'SUBSCRIPT RIGHT PARENTHESIS', +8352: 'EURO-CURRENCY SIGN', +8353: 'COLON SIGN', +8354: 'CRUZEIRO SIGN', +8355: 'FRENCH FRANC SIGN', +8356: 'LIRA SIGN', +8357: 'MILL SIGN', +8358: 'NAIRA SIGN', +8359: 'PESETA SIGN', +8360: 'RUPEE SIGN', +8361: 'WON SIGN', +8362: 'NEW SHEQEL SIGN', +8363: 'DONG SIGN', +8364: 'EURO SIGN', +8365: 'KIP SIGN', +8366: 'TUGRIK SIGN', +8367: 'DRACHMA SIGN', +8368: 'GERMAN PENNY SIGN', +8369: 'PESO SIGN', +8400: 'COMBINING LEFT HARPOON ABOVE', +8401: 'COMBINING RIGHT HARPOON ABOVE', +8402: 'COMBINING LONG VERTICAL LINE OVERLAY', +8403: 'COMBINING SHORT VERTICAL LINE OVERLAY', +8404: 'COMBINING ANTICLOCKWISE ARROW ABOVE', +8405: 'COMBINING CLOCKWISE ARROW ABOVE', +8406: 'COMBINING LEFT ARROW ABOVE', +8407: 'COMBINING RIGHT ARROW ABOVE', +8408: 'COMBINING RING OVERLAY', +8409: 'COMBINING CLOCKWISE RING OVERLAY', +8410: 'COMBINING ANTICLOCKWISE RING OVERLAY', +8411: 'COMBINING THREE DOTS ABOVE', +8412: 'COMBINING FOUR DOTS ABOVE', +8413: 'COMBINING ENCLOSING CIRCLE', +8414: 'COMBINING ENCLOSING SQUARE', +8415: 'COMBINING ENCLOSING DIAMOND', +8416: 'COMBINING ENCLOSING CIRCLE BACKSLASH', +8417: 'COMBINING LEFT RIGHT ARROW ABOVE', +8418: 'COMBINING ENCLOSING SCREEN', +8419: 'COMBINING ENCLOSING KEYCAP', +8420: 'COMBINING ENCLOSING UPWARD POINTING TRIANGLE', +8421: 'COMBINING REVERSE SOLIDUS OVERLAY', +8422: 'COMBINING DOUBLE VERTICAL STROKE OVERLAY', +8423: 'COMBINING ANNUITY SYMBOL', +8424: 'COMBINING TRIPLE UNDERDOT', +8425: 'COMBINING WIDE BRIDGE ABOVE', +8426: 'COMBINING LEFTWARDS ARROW OVERLAY', +8448: 'ACCOUNT OF', +8449: 'ADDRESSED TO THE SUBJECT', +8450: 'DOUBLE-STRUCK CAPITAL C', +8451: 'DEGREE CELSIUS', +8452: 'CENTRE LINE SYMBOL', +8453: 'CARE OF', +8454: 'CADA UNA', +8455: 'EULER CONSTANT', +8456: 'SCRUPLE', +8457: 'DEGREE FAHRENHEIT', +8458: 'SCRIPT SMALL G', +8459: 'SCRIPT CAPITAL H', +8460: 'BLACK-LETTER CAPITAL H', +8461: 'DOUBLE-STRUCK CAPITAL H', +8462: 'PLANCK CONSTANT', +8463: 'PLANCK CONSTANT OVER TWO PI', +8464: 'SCRIPT CAPITAL I', +8465: 'BLACK-LETTER CAPITAL I', +8466: 'SCRIPT CAPITAL L', +8467: 'SCRIPT SMALL L', +8468: 'L B BAR SYMBOL', +8469: 'DOUBLE-STRUCK CAPITAL N', +8470: 'NUMERO SIGN', +8471: 'SOUND RECORDING COPYRIGHT', +8472: 'SCRIPT CAPITAL P', +8473: 'DOUBLE-STRUCK CAPITAL P', +8474: 'DOUBLE-STRUCK CAPITAL Q', +8475: 'SCRIPT CAPITAL R', +8476: 'BLACK-LETTER CAPITAL R', +8477: 'DOUBLE-STRUCK CAPITAL R', +8478: 'PRESCRIPTION TAKE', +8479: 'RESPONSE', +8480: 'SERVICE MARK', +8481: 'TELEPHONE SIGN', +8482: 'TRADE MARK SIGN', +8483: 'VERSICLE', +8484: 'DOUBLE-STRUCK CAPITAL Z', +8485: 'OUNCE SIGN', +8486: 'OHM SIGN', +8487: 'INVERTED OHM SIGN', +8488: 'BLACK-LETTER CAPITAL Z', +8489: 'TURNED GREEK SMALL LETTER IOTA', +8490: 'KELVIN SIGN', +8491: 'ANGSTROM SIGN', +8492: 'SCRIPT CAPITAL B', +8493: 'BLACK-LETTER CAPITAL C', +8494: 'ESTIMATED SYMBOL', +8495: 'SCRIPT SMALL E', +8496: 'SCRIPT CAPITAL E', +8497: 'SCRIPT CAPITAL F', +8498: 'TURNED CAPITAL F', +8499: 'SCRIPT CAPITAL M', +8500: 'SCRIPT SMALL O', +8501: 'ALEF SYMBOL', +8502: 'BET SYMBOL', +8503: 'GIMEL SYMBOL', +8504: 'DALET SYMBOL', +8505: 'INFORMATION SOURCE', +8506: 'ROTATED CAPITAL Q', +8509: 'DOUBLE-STRUCK SMALL GAMMA', +8510: 'DOUBLE-STRUCK CAPITAL GAMMA', +8511: 'DOUBLE-STRUCK CAPITAL PI', +8512: 'DOUBLE-STRUCK N-ARY SUMMATION', +8513: 'TURNED SANS-SERIF CAPITAL G', +8514: 'TURNED SANS-SERIF CAPITAL L', +8515: 'REVERSED SANS-SERIF CAPITAL L', +8516: 'TURNED SANS-SERIF CAPITAL Y', +8517: 'DOUBLE-STRUCK ITALIC CAPITAL D', +8518: 'DOUBLE-STRUCK ITALIC SMALL D', +8519: 'DOUBLE-STRUCK ITALIC SMALL E', +8520: 'DOUBLE-STRUCK ITALIC SMALL I', +8521: 'DOUBLE-STRUCK ITALIC SMALL J', +8522: 'PROPERTY LINE', +8523: 'TURNED AMPERSAND', +8531: 'VULGAR FRACTION ONE THIRD', +8532: 'VULGAR FRACTION TWO THIRDS', +8533: 'VULGAR FRACTION ONE FIFTH', +8534: 'VULGAR FRACTION TWO FIFTHS', +8535: 'VULGAR FRACTION THREE FIFTHS', +8536: 'VULGAR FRACTION FOUR FIFTHS', +8537: 'VULGAR FRACTION ONE SIXTH', +8538: 'VULGAR FRACTION FIVE SIXTHS', +8539: 'VULGAR FRACTION ONE EIGHTH', +8540: 'VULGAR FRACTION THREE EIGHTHS', +8541: 'VULGAR FRACTION FIVE EIGHTHS', +8542: 'VULGAR FRACTION SEVEN EIGHTHS', +8543: 'FRACTION NUMERATOR ONE', +8544: 'ROMAN NUMERAL ONE', +8545: 'ROMAN NUMERAL TWO', +8546: 'ROMAN NUMERAL THREE', +8547: 'ROMAN NUMERAL FOUR', +8548: 'ROMAN NUMERAL FIVE', +8549: 'ROMAN NUMERAL SIX', +8550: 'ROMAN NUMERAL SEVEN', +8551: 'ROMAN NUMERAL EIGHT', +8552: 'ROMAN NUMERAL NINE', +8553: 'ROMAN NUMERAL TEN', +8554: 'ROMAN NUMERAL ELEVEN', +8555: 'ROMAN NUMERAL TWELVE', +8556: 'ROMAN NUMERAL FIFTY', +8557: 'ROMAN NUMERAL ONE HUNDRED', +8558: 'ROMAN NUMERAL FIVE HUNDRED', +8559: 'ROMAN NUMERAL ONE THOUSAND', +8560: 'SMALL ROMAN NUMERAL ONE', +8561: 'SMALL ROMAN NUMERAL TWO', +8562: 'SMALL ROMAN NUMERAL THREE', +8563: 'SMALL ROMAN NUMERAL FOUR', +8564: 'SMALL ROMAN NUMERAL FIVE', +8565: 'SMALL ROMAN NUMERAL SIX', +8566: 'SMALL ROMAN NUMERAL SEVEN', +8567: 'SMALL ROMAN NUMERAL EIGHT', +8568: 'SMALL ROMAN NUMERAL NINE', +8569: 'SMALL ROMAN NUMERAL TEN', +8570: 'SMALL ROMAN NUMERAL ELEVEN', +8571: 'SMALL ROMAN NUMERAL TWELVE', +8572: 'SMALL ROMAN NUMERAL FIFTY', +8573: 'SMALL ROMAN NUMERAL ONE HUNDRED', +8574: 'SMALL ROMAN NUMERAL FIVE HUNDRED', +8575: 'SMALL ROMAN NUMERAL ONE THOUSAND', +8576: 'ROMAN NUMERAL ONE THOUSAND C D', +8577: 'ROMAN NUMERAL FIVE THOUSAND', +8578: 'ROMAN NUMERAL TEN THOUSAND', +8579: 'ROMAN NUMERAL REVERSED ONE HUNDRED', +8592: 'LEFTWARDS ARROW', +8593: 'UPWARDS ARROW', +8594: 'RIGHTWARDS ARROW', +8595: 'DOWNWARDS ARROW', +8596: 'LEFT RIGHT ARROW', +8597: 'UP DOWN ARROW', +8598: 'NORTH WEST ARROW', +8599: 'NORTH EAST ARROW', +8600: 'SOUTH EAST ARROW', +8601: 'SOUTH WEST ARROW', +8602: 'LEFTWARDS ARROW WITH STROKE', +8603: 'RIGHTWARDS ARROW WITH STROKE', +8604: 'LEFTWARDS WAVE ARROW', +8605: 'RIGHTWARDS WAVE ARROW', +8606: 'LEFTWARDS TWO HEADED ARROW', +8607: 'UPWARDS TWO HEADED ARROW', +8608: 'RIGHTWARDS TWO HEADED ARROW', +8609: 'DOWNWARDS TWO HEADED ARROW', +8610: 'LEFTWARDS ARROW WITH TAIL', +8611: 'RIGHTWARDS ARROW WITH TAIL', +8612: 'LEFTWARDS ARROW FROM BAR', +8613: 'UPWARDS ARROW FROM BAR', +8614: 'RIGHTWARDS ARROW FROM BAR', +8615: 'DOWNWARDS ARROW FROM BAR', +8616: 'UP DOWN ARROW WITH BASE', +8617: 'LEFTWARDS ARROW WITH HOOK', +8618: 'RIGHTWARDS ARROW WITH HOOK', +8619: 'LEFTWARDS ARROW WITH LOOP', +8620: 'RIGHTWARDS ARROW WITH LOOP', +8621: 'LEFT RIGHT WAVE ARROW', +8622: 'LEFT RIGHT ARROW WITH STROKE', +8623: 'DOWNWARDS ZIGZAG ARROW', +8624: 'UPWARDS ARROW WITH TIP LEFTWARDS', +8625: 'UPWARDS ARROW WITH TIP RIGHTWARDS', +8626: 'DOWNWARDS ARROW WITH TIP LEFTWARDS', +8627: 'DOWNWARDS ARROW WITH TIP RIGHTWARDS', +8628: 'RIGHTWARDS ARROW WITH CORNER DOWNWARDS', +8629: 'DOWNWARDS ARROW WITH CORNER LEFTWARDS', +8630: 'ANTICLOCKWISE TOP SEMICIRCLE ARROW', +8631: 'CLOCKWISE TOP SEMICIRCLE ARROW', +8632: 'NORTH WEST ARROW TO LONG BAR', +8633: 'LEFTWARDS ARROW TO BAR OVER RIGHTWARDS ARROW TO BAR', +8634: 'ANTICLOCKWISE OPEN CIRCLE ARROW', +8635: 'CLOCKWISE OPEN CIRCLE ARROW', +8636: 'LEFTWARDS HARPOON WITH BARB UPWARDS', +8637: 'LEFTWARDS HARPOON WITH BARB DOWNWARDS', +8638: 'UPWARDS HARPOON WITH BARB RIGHTWARDS', +8639: 'UPWARDS HARPOON WITH BARB LEFTWARDS', +8640: 'RIGHTWARDS HARPOON WITH BARB UPWARDS', +8641: 'RIGHTWARDS HARPOON WITH BARB DOWNWARDS', +8642: 'DOWNWARDS HARPOON WITH BARB RIGHTWARDS', +8643: 'DOWNWARDS HARPOON WITH BARB LEFTWARDS', +8644: 'RIGHTWARDS ARROW OVER LEFTWARDS ARROW', +8645: 'UPWARDS ARROW LEFTWARDS OF DOWNWARDS ARROW', +8646: 'LEFTWARDS ARROW OVER RIGHTWARDS ARROW', +8647: 'LEFTWARDS PAIRED ARROWS', +8648: 'UPWARDS PAIRED ARROWS', +8649: 'RIGHTWARDS PAIRED ARROWS', +8650: 'DOWNWARDS PAIRED ARROWS', +8651: 'LEFTWARDS HARPOON OVER RIGHTWARDS HARPOON', +8652: 'RIGHTWARDS HARPOON OVER LEFTWARDS HARPOON', +8653: 'LEFTWARDS DOUBLE ARROW WITH STROKE', +8654: 'LEFT RIGHT DOUBLE ARROW WITH STROKE', +8655: 'RIGHTWARDS DOUBLE ARROW WITH STROKE', +8656: 'LEFTWARDS DOUBLE ARROW', +8657: 'UPWARDS DOUBLE ARROW', +8658: 'RIGHTWARDS DOUBLE ARROW', +8659: 'DOWNWARDS DOUBLE ARROW', +8660: 'LEFT RIGHT DOUBLE ARROW', +8661: 'UP DOWN DOUBLE ARROW', +8662: 'NORTH WEST DOUBLE ARROW', +8663: 'NORTH EAST DOUBLE ARROW', +8664: 'SOUTH EAST DOUBLE ARROW', +8665: 'SOUTH WEST DOUBLE ARROW', +8666: 'LEFTWARDS TRIPLE ARROW', +8667: 'RIGHTWARDS TRIPLE ARROW', +8668: 'LEFTWARDS SQUIGGLE ARROW', +8669: 'RIGHTWARDS SQUIGGLE ARROW', +8670: 'UPWARDS ARROW WITH DOUBLE STROKE', +8671: 'DOWNWARDS ARROW WITH DOUBLE STROKE', +8672: 'LEFTWARDS DASHED ARROW', +8673: 'UPWARDS DASHED ARROW', +8674: 'RIGHTWARDS DASHED ARROW', +8675: 'DOWNWARDS DASHED ARROW', +8676: 'LEFTWARDS ARROW TO BAR', +8677: 'RIGHTWARDS ARROW TO BAR', +8678: 'LEFTWARDS WHITE ARROW', +8679: 'UPWARDS WHITE ARROW', +8680: 'RIGHTWARDS WHITE ARROW', +8681: 'DOWNWARDS WHITE ARROW', +8682: 'UPWARDS WHITE ARROW FROM BAR', +8683: 'UPWARDS WHITE ARROW ON PEDESTAL', +8684: 'UPWARDS WHITE ARROW ON PEDESTAL WITH HORIZONTAL BAR', +8685: 'UPWARDS WHITE ARROW ON PEDESTAL WITH VERTICAL BAR', +8686: 'UPWARDS WHITE DOUBLE ARROW', +8687: 'UPWARDS WHITE DOUBLE ARROW ON PEDESTAL', +8688: 'RIGHTWARDS WHITE ARROW FROM WALL', +8689: 'NORTH WEST ARROW TO CORNER', +8690: 'SOUTH EAST ARROW TO CORNER', +8691: 'UP DOWN WHITE ARROW', +8692: 'RIGHT ARROW WITH SMALL CIRCLE', +8693: 'DOWNWARDS ARROW LEFTWARDS OF UPWARDS ARROW', +8694: 'THREE RIGHTWARDS ARROWS', +8695: 'LEFTWARDS ARROW WITH VERTICAL STROKE', +8696: 'RIGHTWARDS ARROW WITH VERTICAL STROKE', +8697: 'LEFT RIGHT ARROW WITH VERTICAL STROKE', +8698: 'LEFTWARDS ARROW WITH DOUBLE VERTICAL STROKE', +8699: 'RIGHTWARDS ARROW WITH DOUBLE VERTICAL STROKE', +8700: 'LEFT RIGHT ARROW WITH DOUBLE VERTICAL STROKE', +8701: 'LEFTWARDS OPEN-HEADED ARROW', +8702: 'RIGHTWARDS OPEN-HEADED ARROW', +8703: 'LEFT RIGHT OPEN-HEADED ARROW', +8704: 'FOR ALL', +8705: 'COMPLEMENT', +8706: 'PARTIAL DIFFERENTIAL', +8707: 'THERE EXISTS', +8708: 'THERE DOES NOT EXIST', +8709: 'EMPTY SET', +8710: 'INCREMENT', +8711: 'NABLA', +8712: 'ELEMENT OF', +8713: 'NOT AN ELEMENT OF', +8714: 'SMALL ELEMENT OF', +8715: 'CONTAINS AS MEMBER', +8716: 'DOES NOT CONTAIN AS MEMBER', +8717: 'SMALL CONTAINS AS MEMBER', +8718: 'END OF PROOF', +8719: 'N-ARY PRODUCT', +8720: 'N-ARY COPRODUCT', +8721: 'N-ARY SUMMATION', +8722: 'MINUS SIGN', +8723: 'MINUS-OR-PLUS SIGN', +8724: 'DOT PLUS', +8725: 'DIVISION SLASH', +8726: 'SET MINUS', +8727: 'ASTERISK OPERATOR', +8728: 'RING OPERATOR', +8729: 'BULLET OPERATOR', +8730: 'SQUARE ROOT', +8731: 'CUBE ROOT', +8732: 'FOURTH ROOT', +8733: 'PROPORTIONAL TO', +8734: 'INFINITY', +8735: 'RIGHT ANGLE', +8736: 'ANGLE', +8737: 'MEASURED ANGLE', +8738: 'SPHERICAL ANGLE', +8739: 'DIVIDES', +8740: 'DOES NOT DIVIDE', +8741: 'PARALLEL TO', +8742: 'NOT PARALLEL TO', +8743: 'LOGICAL AND', +8744: 'LOGICAL OR', +8745: 'INTERSECTION', +8746: 'UNION', +8747: 'INTEGRAL', +8748: 'DOUBLE INTEGRAL', +8749: 'TRIPLE INTEGRAL', +8750: 'CONTOUR INTEGRAL', +8751: 'SURFACE INTEGRAL', +8752: 'VOLUME INTEGRAL', +8753: 'CLOCKWISE INTEGRAL', +8754: 'CLOCKWISE CONTOUR INTEGRAL', +8755: 'ANTICLOCKWISE CONTOUR INTEGRAL', +8756: 'THEREFORE', +8757: 'BECAUSE', +8758: 'RATIO', +8759: 'PROPORTION', +8760: 'DOT MINUS', +8761: 'EXCESS', +8762: 'GEOMETRIC PROPORTION', +8763: 'HOMOTHETIC', +8764: 'TILDE OPERATOR', +8765: 'REVERSED TILDE', +8766: 'INVERTED LAZY S', +8767: 'SINE WAVE', +8768: 'WREATH PRODUCT', +8769: 'NOT TILDE', +8770: 'MINUS TILDE', +8771: 'ASYMPTOTICALLY EQUAL TO', +8772: 'NOT ASYMPTOTICALLY EQUAL TO', +8773: 'APPROXIMATELY EQUAL TO', +8774: 'APPROXIMATELY BUT NOT ACTUALLY EQUAL TO', +8775: 'NEITHER APPROXIMATELY NOR ACTUALLY EQUAL TO', +8776: 'ALMOST EQUAL TO', +8777: 'NOT ALMOST EQUAL TO', +8778: 'ALMOST EQUAL OR EQUAL TO', +8779: 'TRIPLE TILDE', +8780: 'ALL EQUAL TO', +8781: 'EQUIVALENT TO', +8782: 'GEOMETRICALLY EQUIVALENT TO', +8783: 'DIFFERENCE BETWEEN', +8784: 'APPROACHES THE LIMIT', +8785: 'GEOMETRICALLY EQUAL TO', +8786: 'APPROXIMATELY EQUAL TO OR THE IMAGE OF', +8787: 'IMAGE OF OR APPROXIMATELY EQUAL TO', +8788: 'COLON EQUALS', +8789: 'EQUALS COLON', +8790: 'RING IN EQUAL TO', +8791: 'RING EQUAL TO', +8792: 'CORRESPONDS TO', +8793: 'ESTIMATES', +8794: 'EQUIANGULAR TO', +8795: 'STAR EQUALS', +8796: 'DELTA EQUAL TO', +8797: 'EQUAL TO BY DEFINITION', +8798: 'MEASURED BY', +8799: 'QUESTIONED EQUAL TO', +8800: 'NOT EQUAL TO', +8801: 'IDENTICAL TO', +8802: 'NOT IDENTICAL TO', +8803: 'STRICTLY EQUIVALENT TO', +8804: 'LESS-THAN OR EQUAL TO', +8805: 'GREATER-THAN OR EQUAL TO', +8806: 'LESS-THAN OVER EQUAL TO', +8807: 'GREATER-THAN OVER EQUAL TO', +8808: 'LESS-THAN BUT NOT EQUAL TO', +8809: 'GREATER-THAN BUT NOT EQUAL TO', +8810: 'MUCH LESS-THAN', +8811: 'MUCH GREATER-THAN', +8812: 'BETWEEN', +8813: 'NOT EQUIVALENT TO', +8814: 'NOT LESS-THAN', +8815: 'NOT GREATER-THAN', +8816: 'NEITHER LESS-THAN NOR EQUAL TO', +8817: 'NEITHER GREATER-THAN NOR EQUAL TO', +8818: 'LESS-THAN OR EQUIVALENT TO', +8819: 'GREATER-THAN OR EQUIVALENT TO', +8820: 'NEITHER LESS-THAN NOR EQUIVALENT TO', +8821: 'NEITHER GREATER-THAN NOR EQUIVALENT TO', +8822: 'LESS-THAN OR GREATER-THAN', +8823: 'GREATER-THAN OR LESS-THAN', +8824: 'NEITHER LESS-THAN NOR GREATER-THAN', +8825: 'NEITHER GREATER-THAN NOR LESS-THAN', +8826: 'PRECEDES', +8827: 'SUCCEEDS', +8828: 'PRECEDES OR EQUAL TO', +8829: 'SUCCEEDS OR EQUAL TO', +8830: 'PRECEDES OR EQUIVALENT TO', +8831: 'SUCCEEDS OR EQUIVALENT TO', +8832: 'DOES NOT PRECEDE', +8833: 'DOES NOT SUCCEED', +8834: 'SUBSET OF', +8835: 'SUPERSET OF', +8836: 'NOT A SUBSET OF', +8837: 'NOT A SUPERSET OF', +8838: 'SUBSET OF OR EQUAL TO', +8839: 'SUPERSET OF OR EQUAL TO', +8840: 'NEITHER A SUBSET OF NOR EQUAL TO', +8841: 'NEITHER A SUPERSET OF NOR EQUAL TO', +8842: 'SUBSET OF WITH NOT EQUAL TO', +8843: 'SUPERSET OF WITH NOT EQUAL TO', +8844: 'MULTISET', +8845: 'MULTISET MULTIPLICATION', +8846: 'MULTISET UNION', +8847: 'SQUARE IMAGE OF', +8848: 'SQUARE ORIGINAL OF', +8849: 'SQUARE IMAGE OF OR EQUAL TO', +8850: 'SQUARE ORIGINAL OF OR EQUAL TO', +8851: 'SQUARE CAP', +8852: 'SQUARE CUP', +8853: 'CIRCLED PLUS', +8854: 'CIRCLED MINUS', +8855: 'CIRCLED TIMES', +8856: 'CIRCLED DIVISION SLASH', +8857: 'CIRCLED DOT OPERATOR', +8858: 'CIRCLED RING OPERATOR', +8859: 'CIRCLED ASTERISK OPERATOR', +8860: 'CIRCLED EQUALS', +8861: 'CIRCLED DASH', +8862: 'SQUARED PLUS', +8863: 'SQUARED MINUS', +8864: 'SQUARED TIMES', +8865: 'SQUARED DOT OPERATOR', +8866: 'RIGHT TACK', +8867: 'LEFT TACK', +8868: 'DOWN TACK', +8869: 'UP TACK', +8870: 'ASSERTION', +8871: 'MODELS', +8872: 'TRUE', +8873: 'FORCES', +8874: 'TRIPLE VERTICAL BAR RIGHT TURNSTILE', +8875: 'DOUBLE VERTICAL BAR DOUBLE RIGHT TURNSTILE', +8876: 'DOES NOT PROVE', +8877: 'NOT TRUE', +8878: 'DOES NOT FORCE', +8879: 'NEGATED DOUBLE VERTICAL BAR DOUBLE RIGHT TURNSTILE', +8880: 'PRECEDES UNDER RELATION', +8881: 'SUCCEEDS UNDER RELATION', +8882: 'NORMAL SUBGROUP OF', +8883: 'CONTAINS AS NORMAL SUBGROUP', +8884: 'NORMAL SUBGROUP OF OR EQUAL TO', +8885: 'CONTAINS AS NORMAL SUBGROUP OR EQUAL TO', +8886: 'ORIGINAL OF', +8887: 'IMAGE OF', +8888: 'MULTIMAP', +8889: 'HERMITIAN CONJUGATE MATRIX', +8890: 'INTERCALATE', +8891: 'XOR', +8892: 'NAND', +8893: 'NOR', +8894: 'RIGHT ANGLE WITH ARC', +8895: 'RIGHT TRIANGLE', +8896: 'N-ARY LOGICAL AND', +8897: 'N-ARY LOGICAL OR', +8898: 'N-ARY INTERSECTION', +8899: 'N-ARY UNION', +8900: 'DIAMOND OPERATOR', +8901: 'DOT OPERATOR', +8902: 'STAR OPERATOR', +8903: 'DIVISION TIMES', +8904: 'BOWTIE', +8905: 'LEFT NORMAL FACTOR SEMIDIRECT PRODUCT', +8906: 'RIGHT NORMAL FACTOR SEMIDIRECT PRODUCT', +8907: 'LEFT SEMIDIRECT PRODUCT', +8908: 'RIGHT SEMIDIRECT PRODUCT', +8909: 'REVERSED TILDE EQUALS', +8910: 'CURLY LOGICAL OR', +8911: 'CURLY LOGICAL AND', +8912: 'DOUBLE SUBSET', +8913: 'DOUBLE SUPERSET', +8914: 'DOUBLE INTERSECTION', +8915: 'DOUBLE UNION', +8916: 'PITCHFORK', +8917: 'EQUAL AND PARALLEL TO', +8918: 'LESS-THAN WITH DOT', +8919: 'GREATER-THAN WITH DOT', +8920: 'VERY MUCH LESS-THAN', +8921: 'VERY MUCH GREATER-THAN', +8922: 'LESS-THAN EQUAL TO OR GREATER-THAN', +8923: 'GREATER-THAN EQUAL TO OR LESS-THAN', +8924: 'EQUAL TO OR LESS-THAN', +8925: 'EQUAL TO OR GREATER-THAN', +8926: 'EQUAL TO OR PRECEDES', +8927: 'EQUAL TO OR SUCCEEDS', +8928: 'DOES NOT PRECEDE OR EQUAL', +8929: 'DOES NOT SUCCEED OR EQUAL', +8930: 'NOT SQUARE IMAGE OF OR EQUAL TO', +8931: 'NOT SQUARE ORIGINAL OF OR EQUAL TO', +8932: 'SQUARE IMAGE OF OR NOT EQUAL TO', +8933: 'SQUARE ORIGINAL OF OR NOT EQUAL TO', +8934: 'LESS-THAN BUT NOT EQUIVALENT TO', +8935: 'GREATER-THAN BUT NOT EQUIVALENT TO', +8936: 'PRECEDES BUT NOT EQUIVALENT TO', +8937: 'SUCCEEDS BUT NOT EQUIVALENT TO', +8938: 'NOT NORMAL SUBGROUP OF', +8939: 'DOES NOT CONTAIN AS NORMAL SUBGROUP', +8940: 'NOT NORMAL SUBGROUP OF OR EQUAL TO', +8941: 'DOES NOT CONTAIN AS NORMAL SUBGROUP OR EQUAL', +8942: 'VERTICAL ELLIPSIS', +8943: 'MIDLINE HORIZONTAL ELLIPSIS', +8944: 'UP RIGHT DIAGONAL ELLIPSIS', +8945: 'DOWN RIGHT DIAGONAL ELLIPSIS', +8946: 'ELEMENT OF WITH LONG HORIZONTAL STROKE', +8947: 'ELEMENT OF WITH VERTICAL BAR AT END OF HORIZONTAL STROKE', +8948: 'SMALL ELEMENT OF WITH VERTICAL BAR AT END OF HORIZONTAL STROKE', +8949: 'ELEMENT OF WITH DOT ABOVE', +8950: 'ELEMENT OF WITH OVERBAR', +8951: 'SMALL ELEMENT OF WITH OVERBAR', +8952: 'ELEMENT OF WITH UNDERBAR', +8953: 'ELEMENT OF WITH TWO HORIZONTAL STROKES', +8954: 'CONTAINS WITH LONG HORIZONTAL STROKE', +8955: 'CONTAINS WITH VERTICAL BAR AT END OF HORIZONTAL STROKE', +8956: 'SMALL CONTAINS WITH VERTICAL BAR AT END OF HORIZONTAL STROKE', +8957: 'CONTAINS WITH OVERBAR', +8958: 'SMALL CONTAINS WITH OVERBAR', +8959: 'Z NOTATION BAG MEMBERSHIP', +8960: 'DIAMETER SIGN', +8961: 'ELECTRIC ARROW', +8962: 'HOUSE', +8963: 'UP ARROWHEAD', +8964: 'DOWN ARROWHEAD', +8965: 'PROJECTIVE', +8966: 'PERSPECTIVE', +8967: 'WAVY LINE', +8968: 'LEFT CEILING', +8969: 'RIGHT CEILING', +8970: 'LEFT FLOOR', +8971: 'RIGHT FLOOR', +8972: 'BOTTOM RIGHT CROP', +8973: 'BOTTOM LEFT CROP', +8974: 'TOP RIGHT CROP', +8975: 'TOP LEFT CROP', +8976: 'REVERSED NOT SIGN', +8977: 'SQUARE LOZENGE', +8978: 'ARC', +8979: 'SEGMENT', +8980: 'SECTOR', +8981: 'TELEPHONE RECORDER', +8982: 'POSITION INDICATOR', +8983: 'VIEWDATA SQUARE', +8984: 'PLACE OF INTEREST SIGN', +8985: 'TURNED NOT SIGN', +8986: 'WATCH', +8987: 'HOURGLASS', +8988: 'TOP LEFT CORNER', +8989: 'TOP RIGHT CORNER', +8990: 'BOTTOM LEFT CORNER', +8991: 'BOTTOM RIGHT CORNER', +8992: 'TOP HALF INTEGRAL', +8993: 'BOTTOM HALF INTEGRAL', +8994: 'FROWN', +8995: 'SMILE', +8996: 'UP ARROWHEAD BETWEEN TWO HORIZONTAL BARS', +8997: 'OPTION KEY', +8998: 'ERASE TO THE RIGHT', +8999: 'X IN A RECTANGLE BOX', +9000: 'KEYBOARD', +9001: 'LEFT-POINTING ANGLE BRACKET', +9002: 'RIGHT-POINTING ANGLE BRACKET', +9003: 'ERASE TO THE LEFT', +9004: 'BENZENE RING', +9005: 'CYLINDRICITY', +9006: 'ALL AROUND-PROFILE', +9007: 'SYMMETRY', +9008: 'TOTAL RUNOUT', +9009: 'DIMENSION ORIGIN', +9010: 'CONICAL TAPER', +9011: 'SLOPE', +9012: 'COUNTERBORE', +9013: 'COUNTERSINK', +9014: 'APL FUNCTIONAL SYMBOL I-BEAM', +9015: 'APL FUNCTIONAL SYMBOL SQUISH QUAD', +9016: 'APL FUNCTIONAL SYMBOL QUAD EQUAL', +9017: 'APL FUNCTIONAL SYMBOL QUAD DIVIDE', +9018: 'APL FUNCTIONAL SYMBOL QUAD DIAMOND', +9019: 'APL FUNCTIONAL SYMBOL QUAD JOT', +9020: 'APL FUNCTIONAL SYMBOL QUAD CIRCLE', +9021: 'APL FUNCTIONAL SYMBOL CIRCLE STILE', +9022: 'APL FUNCTIONAL SYMBOL CIRCLE JOT', +9023: 'APL FUNCTIONAL SYMBOL SLASH BAR', +9024: 'APL FUNCTIONAL SYMBOL BACKSLASH BAR', +9025: 'APL FUNCTIONAL SYMBOL QUAD SLASH', +9026: 'APL FUNCTIONAL SYMBOL QUAD BACKSLASH', +9027: 'APL FUNCTIONAL SYMBOL QUAD LESS-THAN', +9028: 'APL FUNCTIONAL SYMBOL QUAD GREATER-THAN', +9029: 'APL FUNCTIONAL SYMBOL LEFTWARDS VANE', +9030: 'APL FUNCTIONAL SYMBOL RIGHTWARDS VANE', +9031: 'APL FUNCTIONAL SYMBOL QUAD LEFTWARDS ARROW', +9032: 'APL FUNCTIONAL SYMBOL QUAD RIGHTWARDS ARROW', +9033: 'APL FUNCTIONAL SYMBOL CIRCLE BACKSLASH', +9034: 'APL FUNCTIONAL SYMBOL DOWN TACK UNDERBAR', +9035: 'APL FUNCTIONAL SYMBOL DELTA STILE', +9036: 'APL FUNCTIONAL SYMBOL QUAD DOWN CARET', +9037: 'APL FUNCTIONAL SYMBOL QUAD DELTA', +9038: 'APL FUNCTIONAL SYMBOL DOWN TACK JOT', +9039: 'APL FUNCTIONAL SYMBOL UPWARDS VANE', +9040: 'APL FUNCTIONAL SYMBOL QUAD UPWARDS ARROW', +9041: 'APL FUNCTIONAL SYMBOL UP TACK OVERBAR', +9042: 'APL FUNCTIONAL SYMBOL DEL STILE', +9043: 'APL FUNCTIONAL SYMBOL QUAD UP CARET', +9044: 'APL FUNCTIONAL SYMBOL QUAD DEL', +9045: 'APL FUNCTIONAL SYMBOL UP TACK JOT', +9046: 'APL FUNCTIONAL SYMBOL DOWNWARDS VANE', +9047: 'APL FUNCTIONAL SYMBOL QUAD DOWNWARDS ARROW', +9048: 'APL FUNCTIONAL SYMBOL QUOTE UNDERBAR', +9049: 'APL FUNCTIONAL SYMBOL DELTA UNDERBAR', +9050: 'APL FUNCTIONAL SYMBOL DIAMOND UNDERBAR', +9051: 'APL FUNCTIONAL SYMBOL JOT UNDERBAR', +9052: 'APL FUNCTIONAL SYMBOL CIRCLE UNDERBAR', +9053: 'APL FUNCTIONAL SYMBOL UP SHOE JOT', +9054: 'APL FUNCTIONAL SYMBOL QUOTE QUAD', +9055: 'APL FUNCTIONAL SYMBOL CIRCLE STAR', +9056: 'APL FUNCTIONAL SYMBOL QUAD COLON', +9057: 'APL FUNCTIONAL SYMBOL UP TACK DIAERESIS', +9058: 'APL FUNCTIONAL SYMBOL DEL DIAERESIS', +9059: 'APL FUNCTIONAL SYMBOL STAR DIAERESIS', +9060: 'APL FUNCTIONAL SYMBOL JOT DIAERESIS', +9061: 'APL FUNCTIONAL SYMBOL CIRCLE DIAERESIS', +9062: 'APL FUNCTIONAL SYMBOL DOWN SHOE STILE', +9063: 'APL FUNCTIONAL SYMBOL LEFT SHOE STILE', +9064: 'APL FUNCTIONAL SYMBOL TILDE DIAERESIS', +9065: 'APL FUNCTIONAL SYMBOL GREATER-THAN DIAERESIS', +9066: 'APL FUNCTIONAL SYMBOL COMMA BAR', +9067: 'APL FUNCTIONAL SYMBOL DEL TILDE', +9068: 'APL FUNCTIONAL SYMBOL ZILDE', +9069: 'APL FUNCTIONAL SYMBOL STILE TILDE', +9070: 'APL FUNCTIONAL SYMBOL SEMICOLON UNDERBAR', +9071: 'APL FUNCTIONAL SYMBOL QUAD NOT EQUAL', +9072: 'APL FUNCTIONAL SYMBOL QUAD QUESTION', +9073: 'APL FUNCTIONAL SYMBOL DOWN CARET TILDE', +9074: 'APL FUNCTIONAL SYMBOL UP CARET TILDE', +9075: 'APL FUNCTIONAL SYMBOL IOTA', +9076: 'APL FUNCTIONAL SYMBOL RHO', +9077: 'APL FUNCTIONAL SYMBOL OMEGA', +9078: 'APL FUNCTIONAL SYMBOL ALPHA UNDERBAR', +9079: 'APL FUNCTIONAL SYMBOL EPSILON UNDERBAR', +9080: 'APL FUNCTIONAL SYMBOL IOTA UNDERBAR', +9081: 'APL FUNCTIONAL SYMBOL OMEGA UNDERBAR', +9082: 'APL FUNCTIONAL SYMBOL ALPHA', +9083: 'NOT CHECK MARK', +9084: 'RIGHT ANGLE WITH DOWNWARDS ZIGZAG ARROW', +9085: 'SHOULDERED OPEN BOX', +9086: 'BELL SYMBOL', +9087: 'VERTICAL LINE WITH MIDDLE DOT', +9088: 'INSERTION SYMBOL', +9089: 'CONTINUOUS UNDERLINE SYMBOL', +9090: 'DISCONTINUOUS UNDERLINE SYMBOL', +9091: 'EMPHASIS SYMBOL', +9092: 'COMPOSITION SYMBOL', +9093: 'WHITE SQUARE WITH CENTRE VERTICAL LINE', +9094: 'ENTER SYMBOL', +9095: 'ALTERNATIVE KEY SYMBOL', +9096: 'HELM SYMBOL', +9097: 'CIRCLED HORIZONTAL BAR WITH NOTCH', +9098: 'CIRCLED TRIANGLE DOWN', +9099: 'BROKEN CIRCLE WITH NORTHWEST ARROW', +9100: 'UNDO SYMBOL', +9101: 'MONOSTABLE SYMBOL', +9102: 'HYSTERESIS SYMBOL', +9103: 'OPEN-CIRCUIT-OUTPUT H-TYPE SYMBOL', +9104: 'OPEN-CIRCUIT-OUTPUT L-TYPE SYMBOL', +9105: 'PASSIVE-PULL-DOWN-OUTPUT SYMBOL', +9106: 'PASSIVE-PULL-UP-OUTPUT SYMBOL', +9107: 'DIRECT CURRENT SYMBOL FORM TWO', +9108: 'SOFTWARE-FUNCTION SYMBOL', +9109: 'APL FUNCTIONAL SYMBOL QUAD', +9110: 'DECIMAL SEPARATOR KEY SYMBOL', +9111: 'PREVIOUS PAGE', +9112: 'NEXT PAGE', +9113: 'PRINT SCREEN SYMBOL', +9114: 'CLEAR SCREEN SYMBOL', +9115: 'LEFT PARENTHESIS UPPER HOOK', +9116: 'LEFT PARENTHESIS EXTENSION', +9117: 'LEFT PARENTHESIS LOWER HOOK', +9118: 'RIGHT PARENTHESIS UPPER HOOK', +9119: 'RIGHT PARENTHESIS EXTENSION', +9120: 'RIGHT PARENTHESIS LOWER HOOK', +9121: 'LEFT SQUARE BRACKET UPPER CORNER', +9122: 'LEFT SQUARE BRACKET EXTENSION', +9123: 'LEFT SQUARE BRACKET LOWER CORNER', +9124: 'RIGHT SQUARE BRACKET UPPER CORNER', +9125: 'RIGHT SQUARE BRACKET EXTENSION', +9126: 'RIGHT SQUARE BRACKET LOWER CORNER', +9127: 'LEFT CURLY BRACKET UPPER HOOK', +9128: 'LEFT CURLY BRACKET MIDDLE PIECE', +9129: 'LEFT CURLY BRACKET LOWER HOOK', +9130: 'CURLY BRACKET EXTENSION', +9131: 'RIGHT CURLY BRACKET UPPER HOOK', +9132: 'RIGHT CURLY BRACKET MIDDLE PIECE', +9133: 'RIGHT CURLY BRACKET LOWER HOOK', +9134: 'INTEGRAL EXTENSION', +9135: 'HORIZONTAL LINE EXTENSION', +9136: 'UPPER LEFT OR LOWER RIGHT CURLY BRACKET SECTION', +9137: 'UPPER RIGHT OR LOWER LEFT CURLY BRACKET SECTION', +9138: 'SUMMATION TOP', +9139: 'SUMMATION BOTTOM', +9140: 'TOP SQUARE BRACKET', +9141: 'BOTTOM SQUARE BRACKET', +9142: 'BOTTOM SQUARE BRACKET OVER TOP SQUARE BRACKET', +9143: 'RADICAL SYMBOL BOTTOM', +9144: 'LEFT VERTICAL BOX LINE', +9145: 'RIGHT VERTICAL BOX LINE', +9146: 'HORIZONTAL SCAN LINE-1', +9147: 'HORIZONTAL SCAN LINE-3', +9148: 'HORIZONTAL SCAN LINE-7', +9149: 'HORIZONTAL SCAN LINE-9', +9150: 'DENTISTRY SYMBOL LIGHT VERTICAL AND TOP RIGHT', +9151: 'DENTISTRY SYMBOL LIGHT VERTICAL AND BOTTOM RIGHT', +9152: 'DENTISTRY SYMBOL LIGHT VERTICAL WITH CIRCLE', +9153: 'DENTISTRY SYMBOL LIGHT DOWN AND HORIZONTAL WITH CIRCLE', +9154: 'DENTISTRY SYMBOL LIGHT UP AND HORIZONTAL WITH CIRCLE', +9155: 'DENTISTRY SYMBOL LIGHT VERTICAL WITH TRIANGLE', +9156: 'DENTISTRY SYMBOL LIGHT DOWN AND HORIZONTAL WITH TRIANGLE', +9157: 'DENTISTRY SYMBOL LIGHT UP AND HORIZONTAL WITH TRIANGLE', +9158: 'DENTISTRY SYMBOL LIGHT VERTICAL AND WAVE', +9159: 'DENTISTRY SYMBOL LIGHT DOWN AND HORIZONTAL WITH WAVE', +9160: 'DENTISTRY SYMBOL LIGHT UP AND HORIZONTAL WITH WAVE', +9161: 'DENTISTRY SYMBOL LIGHT DOWN AND HORIZONTAL', +9162: 'DENTISTRY SYMBOL LIGHT UP AND HORIZONTAL', +9163: 'DENTISTRY SYMBOL LIGHT VERTICAL AND TOP LEFT', +9164: 'DENTISTRY SYMBOL LIGHT VERTICAL AND BOTTOM LEFT', +9165: 'SQUARE FOOT', +9166: 'RETURN SYMBOL', +9216: 'SYMBOL FOR NULL', +9217: 'SYMBOL FOR START OF HEADING', +9218: 'SYMBOL FOR START OF TEXT', +9219: 'SYMBOL FOR END OF TEXT', +9220: 'SYMBOL FOR END OF TRANSMISSION', +9221: 'SYMBOL FOR ENQUIRY', +9222: 'SYMBOL FOR ACKNOWLEDGE', +9223: 'SYMBOL FOR BELL', +9224: 'SYMBOL FOR BACKSPACE', +9225: 'SYMBOL FOR HORIZONTAL TABULATION', +9226: 'SYMBOL FOR LINE FEED', +9227: 'SYMBOL FOR VERTICAL TABULATION', +9228: 'SYMBOL FOR FORM FEED', +9229: 'SYMBOL FOR CARRIAGE RETURN', +9230: 'SYMBOL FOR SHIFT OUT', +9231: 'SYMBOL FOR SHIFT IN', +9232: 'SYMBOL FOR DATA LINK ESCAPE', +9233: 'SYMBOL FOR DEVICE CONTROL ONE', +9234: 'SYMBOL FOR DEVICE CONTROL TWO', +9235: 'SYMBOL FOR DEVICE CONTROL THREE', +9236: 'SYMBOL FOR DEVICE CONTROL FOUR', +9237: 'SYMBOL FOR NEGATIVE ACKNOWLEDGE', +9238: 'SYMBOL FOR SYNCHRONOUS IDLE', +9239: 'SYMBOL FOR END OF TRANSMISSION BLOCK', +9240: 'SYMBOL FOR CANCEL', +9241: 'SYMBOL FOR END OF MEDIUM', +9242: 'SYMBOL FOR SUBSTITUTE', +9243: 'SYMBOL FOR ESCAPE', +9244: 'SYMBOL FOR FILE SEPARATOR', +9245: 'SYMBOL FOR GROUP SEPARATOR', +9246: 'SYMBOL FOR RECORD SEPARATOR', +9247: 'SYMBOL FOR UNIT SEPARATOR', +9248: 'SYMBOL FOR SPACE', +9249: 'SYMBOL FOR DELETE', +9250: 'BLANK SYMBOL', +9251: 'OPEN BOX', +9252: 'SYMBOL FOR NEWLINE', +9253: 'SYMBOL FOR DELETE FORM TWO', +9254: 'SYMBOL FOR SUBSTITUTE FORM TWO', +9280: 'OCR HOOK', +9281: 'OCR CHAIR', +9282: 'OCR FORK', +9283: 'OCR INVERTED FORK', +9284: 'OCR BELT BUCKLE', +9285: 'OCR BOW TIE', +9286: 'OCR BRANCH BANK IDENTIFICATION', +9287: 'OCR AMOUNT OF CHECK', +9288: 'OCR DASH', +9289: 'OCR CUSTOMER ACCOUNT NUMBER', +9290: 'OCR DOUBLE BACKSLASH', +9312: 'CIRCLED DIGIT ONE', +9313: 'CIRCLED DIGIT TWO', +9314: 'CIRCLED DIGIT THREE', +9315: 'CIRCLED DIGIT FOUR', +9316: 'CIRCLED DIGIT FIVE', +9317: 'CIRCLED DIGIT SIX', +9318: 'CIRCLED DIGIT SEVEN', +9319: 'CIRCLED DIGIT EIGHT', +9320: 'CIRCLED DIGIT NINE', +9321: 'CIRCLED NUMBER TEN', +9322: 'CIRCLED NUMBER ELEVEN', +9323: 'CIRCLED NUMBER TWELVE', +9324: 'CIRCLED NUMBER THIRTEEN', +9325: 'CIRCLED NUMBER FOURTEEN', +9326: 'CIRCLED NUMBER FIFTEEN', +9327: 'CIRCLED NUMBER SIXTEEN', +9328: 'CIRCLED NUMBER SEVENTEEN', +9329: 'CIRCLED NUMBER EIGHTEEN', +9330: 'CIRCLED NUMBER NINETEEN', +9331: 'CIRCLED NUMBER TWENTY', +9332: 'PARENTHESIZED DIGIT ONE', +9333: 'PARENTHESIZED DIGIT TWO', +9334: 'PARENTHESIZED DIGIT THREE', +9335: 'PARENTHESIZED DIGIT FOUR', +9336: 'PARENTHESIZED DIGIT FIVE', +9337: 'PARENTHESIZED DIGIT SIX', +9338: 'PARENTHESIZED DIGIT SEVEN', +9339: 'PARENTHESIZED DIGIT EIGHT', +9340: 'PARENTHESIZED DIGIT NINE', +9341: 'PARENTHESIZED NUMBER TEN', +9342: 'PARENTHESIZED NUMBER ELEVEN', +9343: 'PARENTHESIZED NUMBER TWELVE', +9344: 'PARENTHESIZED NUMBER THIRTEEN', +9345: 'PARENTHESIZED NUMBER FOURTEEN', +9346: 'PARENTHESIZED NUMBER FIFTEEN', +9347: 'PARENTHESIZED NUMBER SIXTEEN', +9348: 'PARENTHESIZED NUMBER SEVENTEEN', +9349: 'PARENTHESIZED NUMBER EIGHTEEN', +9350: 'PARENTHESIZED NUMBER NINETEEN', +9351: 'PARENTHESIZED NUMBER TWENTY', +9352: 'DIGIT ONE FULL STOP', +9353: 'DIGIT TWO FULL STOP', +9354: 'DIGIT THREE FULL STOP', +9355: 'DIGIT FOUR FULL STOP', +9356: 'DIGIT FIVE FULL STOP', +9357: 'DIGIT SIX FULL STOP', +9358: 'DIGIT SEVEN FULL STOP', +9359: 'DIGIT EIGHT FULL STOP', +9360: 'DIGIT NINE FULL STOP', +9361: 'NUMBER TEN FULL STOP', +9362: 'NUMBER ELEVEN FULL STOP', +9363: 'NUMBER TWELVE FULL STOP', +9364: 'NUMBER THIRTEEN FULL STOP', +9365: 'NUMBER FOURTEEN FULL STOP', +9366: 'NUMBER FIFTEEN FULL STOP', +9367: 'NUMBER SIXTEEN FULL STOP', +9368: 'NUMBER SEVENTEEN FULL STOP', +9369: 'NUMBER EIGHTEEN FULL STOP', +9370: 'NUMBER NINETEEN FULL STOP', +9371: 'NUMBER TWENTY FULL STOP', +9372: 'PARENTHESIZED LATIN SMALL LETTER A', +9373: 'PARENTHESIZED LATIN SMALL LETTER B', +9374: 'PARENTHESIZED LATIN SMALL LETTER C', +9375: 'PARENTHESIZED LATIN SMALL LETTER D', +9376: 'PARENTHESIZED LATIN SMALL LETTER E', +9377: 'PARENTHESIZED LATIN SMALL LETTER F', +9378: 'PARENTHESIZED LATIN SMALL LETTER G', +9379: 'PARENTHESIZED LATIN SMALL LETTER H', +9380: 'PARENTHESIZED LATIN SMALL LETTER I', +9381: 'PARENTHESIZED LATIN SMALL LETTER J', +9382: 'PARENTHESIZED LATIN SMALL LETTER K', +9383: 'PARENTHESIZED LATIN SMALL LETTER L', +9384: 'PARENTHESIZED LATIN SMALL LETTER M', +9385: 'PARENTHESIZED LATIN SMALL LETTER N', +9386: 'PARENTHESIZED LATIN SMALL LETTER O', +9387: 'PARENTHESIZED LATIN SMALL LETTER P', +9388: 'PARENTHESIZED LATIN SMALL LETTER Q', +9389: 'PARENTHESIZED LATIN SMALL LETTER R', +9390: 'PARENTHESIZED LATIN SMALL LETTER S', +9391: 'PARENTHESIZED LATIN SMALL LETTER T', +9392: 'PARENTHESIZED LATIN SMALL LETTER U', +9393: 'PARENTHESIZED LATIN SMALL LETTER V', +9394: 'PARENTHESIZED LATIN SMALL LETTER W', +9395: 'PARENTHESIZED LATIN SMALL LETTER X', +9396: 'PARENTHESIZED LATIN SMALL LETTER Y', +9397: 'PARENTHESIZED LATIN SMALL LETTER Z', +9398: 'CIRCLED LATIN CAPITAL LETTER A', +9399: 'CIRCLED LATIN CAPITAL LETTER B', +9400: 'CIRCLED LATIN CAPITAL LETTER C', +9401: 'CIRCLED LATIN CAPITAL LETTER D', +9402: 'CIRCLED LATIN CAPITAL LETTER E', +9403: 'CIRCLED LATIN CAPITAL LETTER F', +9404: 'CIRCLED LATIN CAPITAL LETTER G', +9405: 'CIRCLED LATIN CAPITAL LETTER H', +9406: 'CIRCLED LATIN CAPITAL LETTER I', +9407: 'CIRCLED LATIN CAPITAL LETTER J', +9408: 'CIRCLED LATIN CAPITAL LETTER K', +9409: 'CIRCLED LATIN CAPITAL LETTER L', +9410: 'CIRCLED LATIN CAPITAL LETTER M', +9411: 'CIRCLED LATIN CAPITAL LETTER N', +9412: 'CIRCLED LATIN CAPITAL LETTER O', +9413: 'CIRCLED LATIN CAPITAL LETTER P', +9414: 'CIRCLED LATIN CAPITAL LETTER Q', +9415: 'CIRCLED LATIN CAPITAL LETTER R', +9416: 'CIRCLED LATIN CAPITAL LETTER S', +9417: 'CIRCLED LATIN CAPITAL LETTER T', +9418: 'CIRCLED LATIN CAPITAL LETTER U', +9419: 'CIRCLED LATIN CAPITAL LETTER V', +9420: 'CIRCLED LATIN CAPITAL LETTER W', +9421: 'CIRCLED LATIN CAPITAL LETTER X', +9422: 'CIRCLED LATIN CAPITAL LETTER Y', +9423: 'CIRCLED LATIN CAPITAL LETTER Z', +9424: 'CIRCLED LATIN SMALL LETTER A', +9425: 'CIRCLED LATIN SMALL LETTER B', +9426: 'CIRCLED LATIN SMALL LETTER C', +9427: 'CIRCLED LATIN SMALL LETTER D', +9428: 'CIRCLED LATIN SMALL LETTER E', +9429: 'CIRCLED LATIN SMALL LETTER F', +9430: 'CIRCLED LATIN SMALL LETTER G', +9431: 'CIRCLED LATIN SMALL LETTER H', +9432: 'CIRCLED LATIN SMALL LETTER I', +9433: 'CIRCLED LATIN SMALL LETTER J', +9434: 'CIRCLED LATIN SMALL LETTER K', +9435: 'CIRCLED LATIN SMALL LETTER L', +9436: 'CIRCLED LATIN SMALL LETTER M', +9437: 'CIRCLED LATIN SMALL LETTER N', +9438: 'CIRCLED LATIN SMALL LETTER O', +9439: 'CIRCLED LATIN SMALL LETTER P', +9440: 'CIRCLED LATIN SMALL LETTER Q', +9441: 'CIRCLED LATIN SMALL LETTER R', +9442: 'CIRCLED LATIN SMALL LETTER S', +9443: 'CIRCLED LATIN SMALL LETTER T', +9444: 'CIRCLED LATIN SMALL LETTER U', +9445: 'CIRCLED LATIN SMALL LETTER V', +9446: 'CIRCLED LATIN SMALL LETTER W', +9447: 'CIRCLED LATIN SMALL LETTER X', +9448: 'CIRCLED LATIN SMALL LETTER Y', +9449: 'CIRCLED LATIN SMALL LETTER Z', +9450: 'CIRCLED DIGIT ZERO', +9451: 'NEGATIVE CIRCLED NUMBER ELEVEN', +9452: 'NEGATIVE CIRCLED NUMBER TWELVE', +9453: 'NEGATIVE CIRCLED NUMBER THIRTEEN', +9454: 'NEGATIVE CIRCLED NUMBER FOURTEEN', +9455: 'NEGATIVE CIRCLED NUMBER FIFTEEN', +9456: 'NEGATIVE CIRCLED NUMBER SIXTEEN', +9457: 'NEGATIVE CIRCLED NUMBER SEVENTEEN', +9458: 'NEGATIVE CIRCLED NUMBER EIGHTEEN', +9459: 'NEGATIVE CIRCLED NUMBER NINETEEN', +9460: 'NEGATIVE CIRCLED NUMBER TWENTY', +9461: 'DOUBLE CIRCLED DIGIT ONE', +9462: 'DOUBLE CIRCLED DIGIT TWO', +9463: 'DOUBLE CIRCLED DIGIT THREE', +9464: 'DOUBLE CIRCLED DIGIT FOUR', +9465: 'DOUBLE CIRCLED DIGIT FIVE', +9466: 'DOUBLE CIRCLED DIGIT SIX', +9467: 'DOUBLE CIRCLED DIGIT SEVEN', +9468: 'DOUBLE CIRCLED DIGIT EIGHT', +9469: 'DOUBLE CIRCLED DIGIT NINE', +9470: 'DOUBLE CIRCLED NUMBER TEN', +9472: 'BOX DRAWINGS LIGHT HORIZONTAL', +9473: 'BOX DRAWINGS HEAVY HORIZONTAL', +9474: 'BOX DRAWINGS LIGHT VERTICAL', +9475: 'BOX DRAWINGS HEAVY VERTICAL', +9476: 'BOX DRAWINGS LIGHT TRIPLE DASH HORIZONTAL', +9477: 'BOX DRAWINGS HEAVY TRIPLE DASH HORIZONTAL', +9478: 'BOX DRAWINGS LIGHT TRIPLE DASH VERTICAL', +9479: 'BOX DRAWINGS HEAVY TRIPLE DASH VERTICAL', +9480: 'BOX DRAWINGS LIGHT QUADRUPLE DASH HORIZONTAL', +9481: 'BOX DRAWINGS HEAVY QUADRUPLE DASH HORIZONTAL', +9482: 'BOX DRAWINGS LIGHT QUADRUPLE DASH VERTICAL', +9483: 'BOX DRAWINGS HEAVY QUADRUPLE DASH VERTICAL', +9484: 'BOX DRAWINGS LIGHT DOWN AND RIGHT', +9485: 'BOX DRAWINGS DOWN LIGHT AND RIGHT HEAVY', +9486: 'BOX DRAWINGS DOWN HEAVY AND RIGHT LIGHT', +9487: 'BOX DRAWINGS HEAVY DOWN AND RIGHT', +9488: 'BOX DRAWINGS LIGHT DOWN AND LEFT', +9489: 'BOX DRAWINGS DOWN LIGHT AND LEFT HEAVY', +9490: 'BOX DRAWINGS DOWN HEAVY AND LEFT LIGHT', +9491: 'BOX DRAWINGS HEAVY DOWN AND LEFT', +9492: 'BOX DRAWINGS LIGHT UP AND RIGHT', +9493: 'BOX DRAWINGS UP LIGHT AND RIGHT HEAVY', +9494: 'BOX DRAWINGS UP HEAVY AND RIGHT LIGHT', +9495: 'BOX DRAWINGS HEAVY UP AND RIGHT', +9496: 'BOX DRAWINGS LIGHT UP AND LEFT', +9497: 'BOX DRAWINGS UP LIGHT AND LEFT HEAVY', +9498: 'BOX DRAWINGS UP HEAVY AND LEFT LIGHT', +9499: 'BOX DRAWINGS HEAVY UP AND LEFT', +9500: 'BOX DRAWINGS LIGHT VERTICAL AND RIGHT', +9501: 'BOX DRAWINGS VERTICAL LIGHT AND RIGHT HEAVY', +9502: 'BOX DRAWINGS UP HEAVY AND RIGHT DOWN LIGHT', +9503: 'BOX DRAWINGS DOWN HEAVY AND RIGHT UP LIGHT', +9504: 'BOX DRAWINGS VERTICAL HEAVY AND RIGHT LIGHT', +9505: 'BOX DRAWINGS DOWN LIGHT AND RIGHT UP HEAVY', +9506: 'BOX DRAWINGS UP LIGHT AND RIGHT DOWN HEAVY', +9507: 'BOX DRAWINGS HEAVY VERTICAL AND RIGHT', +9508: 'BOX DRAWINGS LIGHT VERTICAL AND LEFT', +9509: 'BOX DRAWINGS VERTICAL LIGHT AND LEFT HEAVY', +9510: 'BOX DRAWINGS UP HEAVY AND LEFT DOWN LIGHT', +9511: 'BOX DRAWINGS DOWN HEAVY AND LEFT UP LIGHT', +9512: 'BOX DRAWINGS VERTICAL HEAVY AND LEFT LIGHT', +9513: 'BOX DRAWINGS DOWN LIGHT AND LEFT UP HEAVY', +9514: 'BOX DRAWINGS UP LIGHT AND LEFT DOWN HEAVY', +9515: 'BOX DRAWINGS HEAVY VERTICAL AND LEFT', +9516: 'BOX DRAWINGS LIGHT DOWN AND HORIZONTAL', +9517: 'BOX DRAWINGS LEFT HEAVY AND RIGHT DOWN LIGHT', +9518: 'BOX DRAWINGS RIGHT HEAVY AND LEFT DOWN LIGHT', +9519: 'BOX DRAWINGS DOWN LIGHT AND HORIZONTAL HEAVY', +9520: 'BOX DRAWINGS DOWN HEAVY AND HORIZONTAL LIGHT', +9521: 'BOX DRAWINGS RIGHT LIGHT AND LEFT DOWN HEAVY', +9522: 'BOX DRAWINGS LEFT LIGHT AND RIGHT DOWN HEAVY', +9523: 'BOX DRAWINGS HEAVY DOWN AND HORIZONTAL', +9524: 'BOX DRAWINGS LIGHT UP AND HORIZONTAL', +9525: 'BOX DRAWINGS LEFT HEAVY AND RIGHT UP LIGHT', +9526: 'BOX DRAWINGS RIGHT HEAVY AND LEFT UP LIGHT', +9527: 'BOX DRAWINGS UP LIGHT AND HORIZONTAL HEAVY', +9528: 'BOX DRAWINGS UP HEAVY AND HORIZONTAL LIGHT', +9529: 'BOX DRAWINGS RIGHT LIGHT AND LEFT UP HEAVY', +9530: 'BOX DRAWINGS LEFT LIGHT AND RIGHT UP HEAVY', +9531: 'BOX DRAWINGS HEAVY UP AND HORIZONTAL', +9532: 'BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL', +9533: 'BOX DRAWINGS LEFT HEAVY AND RIGHT VERTICAL LIGHT', +9534: 'BOX DRAWINGS RIGHT HEAVY AND LEFT VERTICAL LIGHT', +9535: 'BOX DRAWINGS VERTICAL LIGHT AND HORIZONTAL HEAVY', +9536: 'BOX DRAWINGS UP HEAVY AND DOWN HORIZONTAL LIGHT', +9537: 'BOX DRAWINGS DOWN HEAVY AND UP HORIZONTAL LIGHT', +9538: 'BOX DRAWINGS VERTICAL HEAVY AND HORIZONTAL LIGHT', +9539: 'BOX DRAWINGS LEFT UP HEAVY AND RIGHT DOWN LIGHT', +9540: 'BOX DRAWINGS RIGHT UP HEAVY AND LEFT DOWN LIGHT', +9541: 'BOX DRAWINGS LEFT DOWN HEAVY AND RIGHT UP LIGHT', +9542: 'BOX DRAWINGS RIGHT DOWN HEAVY AND LEFT UP LIGHT', +9543: 'BOX DRAWINGS DOWN LIGHT AND UP HORIZONTAL HEAVY', +9544: 'BOX DRAWINGS UP LIGHT AND DOWN HORIZONTAL HEAVY', +9545: 'BOX DRAWINGS RIGHT LIGHT AND LEFT VERTICAL HEAVY', +9546: 'BOX DRAWINGS LEFT LIGHT AND RIGHT VERTICAL HEAVY', +9547: 'BOX DRAWINGS HEAVY VERTICAL AND HORIZONTAL', +9548: 'BOX DRAWINGS LIGHT DOUBLE DASH HORIZONTAL', +9549: 'BOX DRAWINGS HEAVY DOUBLE DASH HORIZONTAL', +9550: 'BOX DRAWINGS LIGHT DOUBLE DASH VERTICAL', +9551: 'BOX DRAWINGS HEAVY DOUBLE DASH VERTICAL', +9552: 'BOX DRAWINGS DOUBLE HORIZONTAL', +9553: 'BOX DRAWINGS DOUBLE VERTICAL', +9554: 'BOX DRAWINGS DOWN SINGLE AND RIGHT DOUBLE', +9555: 'BOX DRAWINGS DOWN DOUBLE AND RIGHT SINGLE', +9556: 'BOX DRAWINGS DOUBLE DOWN AND RIGHT', +9557: 'BOX DRAWINGS DOWN SINGLE AND LEFT DOUBLE', +9558: 'BOX DRAWINGS DOWN DOUBLE AND LEFT SINGLE', +9559: 'BOX DRAWINGS DOUBLE DOWN AND LEFT', +9560: 'BOX DRAWINGS UP SINGLE AND RIGHT DOUBLE', +9561: 'BOX DRAWINGS UP DOUBLE AND RIGHT SINGLE', +9562: 'BOX DRAWINGS DOUBLE UP AND RIGHT', +9563: 'BOX DRAWINGS UP SINGLE AND LEFT DOUBLE', +9564: 'BOX DRAWINGS UP DOUBLE AND LEFT SINGLE', +9565: 'BOX DRAWINGS DOUBLE UP AND LEFT', +9566: 'BOX DRAWINGS VERTICAL SINGLE AND RIGHT DOUBLE', +9567: 'BOX DRAWINGS VERTICAL DOUBLE AND RIGHT SINGLE', +9568: 'BOX DRAWINGS DOUBLE VERTICAL AND RIGHT', +9569: 'BOX DRAWINGS VERTICAL SINGLE AND LEFT DOUBLE', +9570: 'BOX DRAWINGS VERTICAL DOUBLE AND LEFT SINGLE', +9571: 'BOX DRAWINGS DOUBLE VERTICAL AND LEFT', +9572: 'BOX DRAWINGS DOWN SINGLE AND HORIZONTAL DOUBLE', +9573: 'BOX DRAWINGS DOWN DOUBLE AND HORIZONTAL SINGLE', +9574: 'BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL', +9575: 'BOX DRAWINGS UP SINGLE AND HORIZONTAL DOUBLE', +9576: 'BOX DRAWINGS UP DOUBLE AND HORIZONTAL SINGLE', +9577: 'BOX DRAWINGS DOUBLE UP AND HORIZONTAL', +9578: 'BOX DRAWINGS VERTICAL SINGLE AND HORIZONTAL DOUBLE', +9579: 'BOX DRAWINGS VERTICAL DOUBLE AND HORIZONTAL SINGLE', +9580: 'BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL', +9581: 'BOX DRAWINGS LIGHT ARC DOWN AND RIGHT', +9582: 'BOX DRAWINGS LIGHT ARC DOWN AND LEFT', +9583: 'BOX DRAWINGS LIGHT ARC UP AND LEFT', +9584: 'BOX DRAWINGS LIGHT ARC UP AND RIGHT', +9585: 'BOX DRAWINGS LIGHT DIAGONAL UPPER RIGHT TO LOWER LEFT', +9586: 'BOX DRAWINGS LIGHT DIAGONAL UPPER LEFT TO LOWER RIGHT', +9587: 'BOX DRAWINGS LIGHT DIAGONAL CROSS', +9588: 'BOX DRAWINGS LIGHT LEFT', +9589: 'BOX DRAWINGS LIGHT UP', +9590: 'BOX DRAWINGS LIGHT RIGHT', +9591: 'BOX DRAWINGS LIGHT DOWN', +9592: 'BOX DRAWINGS HEAVY LEFT', +9593: 'BOX DRAWINGS HEAVY UP', +9594: 'BOX DRAWINGS HEAVY RIGHT', +9595: 'BOX DRAWINGS HEAVY DOWN', +9596: 'BOX DRAWINGS LIGHT LEFT AND HEAVY RIGHT', +9597: 'BOX DRAWINGS LIGHT UP AND HEAVY DOWN', +9598: 'BOX DRAWINGS HEAVY LEFT AND LIGHT RIGHT', +9599: 'BOX DRAWINGS HEAVY UP AND LIGHT DOWN', +9600: 'UPPER HALF BLOCK', +9601: 'LOWER ONE EIGHTH BLOCK', +9602: 'LOWER ONE QUARTER BLOCK', +9603: 'LOWER THREE EIGHTHS BLOCK', +9604: 'LOWER HALF BLOCK', +9605: 'LOWER FIVE EIGHTHS BLOCK', +9606: 'LOWER THREE QUARTERS BLOCK', +9607: 'LOWER SEVEN EIGHTHS BLOCK', +9608: 'FULL BLOCK', +9609: 'LEFT SEVEN EIGHTHS BLOCK', +9610: 'LEFT THREE QUARTERS BLOCK', +9611: 'LEFT FIVE EIGHTHS BLOCK', +9612: 'LEFT HALF BLOCK', +9613: 'LEFT THREE EIGHTHS BLOCK', +9614: 'LEFT ONE QUARTER BLOCK', +9615: 'LEFT ONE EIGHTH BLOCK', +9616: 'RIGHT HALF BLOCK', +9617: 'LIGHT SHADE', +9618: 'MEDIUM SHADE', +9619: 'DARK SHADE', +9620: 'UPPER ONE EIGHTH BLOCK', +9621: 'RIGHT ONE EIGHTH BLOCK', +9622: 'QUADRANT LOWER LEFT', +9623: 'QUADRANT LOWER RIGHT', +9624: 'QUADRANT UPPER LEFT', +9625: 'QUADRANT UPPER LEFT AND LOWER LEFT AND LOWER RIGHT', +9626: 'QUADRANT UPPER LEFT AND LOWER RIGHT', +9627: 'QUADRANT UPPER LEFT AND UPPER RIGHT AND LOWER LEFT', +9628: 'QUADRANT UPPER LEFT AND UPPER RIGHT AND LOWER RIGHT', +9629: 'QUADRANT UPPER RIGHT', +9630: 'QUADRANT UPPER RIGHT AND LOWER LEFT', +9631: 'QUADRANT UPPER RIGHT AND LOWER LEFT AND LOWER RIGHT', +9632: 'BLACK SQUARE', +9633: 'WHITE SQUARE', +9634: 'WHITE SQUARE WITH ROUNDED CORNERS', +9635: 'WHITE SQUARE CONTAINING BLACK SMALL SQUARE', +9636: 'SQUARE WITH HORIZONTAL FILL', +9637: 'SQUARE WITH VERTICAL FILL', +9638: 'SQUARE WITH ORTHOGONAL CROSSHATCH FILL', +9639: 'SQUARE WITH UPPER LEFT TO LOWER RIGHT FILL', +9640: 'SQUARE WITH UPPER RIGHT TO LOWER LEFT FILL', +9641: 'SQUARE WITH DIAGONAL CROSSHATCH FILL', +9642: 'BLACK SMALL SQUARE', +9643: 'WHITE SMALL SQUARE', +9644: 'BLACK RECTANGLE', +9645: 'WHITE RECTANGLE', +9646: 'BLACK VERTICAL RECTANGLE', +9647: 'WHITE VERTICAL RECTANGLE', +9648: 'BLACK PARALLELOGRAM', +9649: 'WHITE PARALLELOGRAM', +9650: 'BLACK UP-POINTING TRIANGLE', +9651: 'WHITE UP-POINTING TRIANGLE', +9652: 'BLACK UP-POINTING SMALL TRIANGLE', +9653: 'WHITE UP-POINTING SMALL TRIANGLE', +9654: 'BLACK RIGHT-POINTING TRIANGLE', +9655: 'WHITE RIGHT-POINTING TRIANGLE', +9656: 'BLACK RIGHT-POINTING SMALL TRIANGLE', +9657: 'WHITE RIGHT-POINTING SMALL TRIANGLE', +9658: 'BLACK RIGHT-POINTING POINTER', +9659: 'WHITE RIGHT-POINTING POINTER', +9660: 'BLACK DOWN-POINTING TRIANGLE', +9661: 'WHITE DOWN-POINTING TRIANGLE', +9662: 'BLACK DOWN-POINTING SMALL TRIANGLE', +9663: 'WHITE DOWN-POINTING SMALL TRIANGLE', +9664: 'BLACK LEFT-POINTING TRIANGLE', +9665: 'WHITE LEFT-POINTING TRIANGLE', +9666: 'BLACK LEFT-POINTING SMALL TRIANGLE', +9667: 'WHITE LEFT-POINTING SMALL TRIANGLE', +9668: 'BLACK LEFT-POINTING POINTER', +9669: 'WHITE LEFT-POINTING POINTER', +9670: 'BLACK DIAMOND', +9671: 'WHITE DIAMOND', +9672: 'WHITE DIAMOND CONTAINING BLACK SMALL DIAMOND', +9673: 'FISHEYE', +9674: 'LOZENGE', +9675: 'WHITE CIRCLE', +9676: 'DOTTED CIRCLE', +9677: 'CIRCLE WITH VERTICAL FILL', +9678: 'BULLSEYE', +9679: 'BLACK CIRCLE', +9680: 'CIRCLE WITH LEFT HALF BLACK', +9681: 'CIRCLE WITH RIGHT HALF BLACK', +9682: 'CIRCLE WITH LOWER HALF BLACK', +9683: 'CIRCLE WITH UPPER HALF BLACK', +9684: 'CIRCLE WITH UPPER RIGHT QUADRANT BLACK', +9685: 'CIRCLE WITH ALL BUT UPPER LEFT QUADRANT BLACK', +9686: 'LEFT HALF BLACK CIRCLE', +9687: 'RIGHT HALF BLACK CIRCLE', +9688: 'INVERSE BULLET', +9689: 'INVERSE WHITE CIRCLE', +9690: 'UPPER HALF INVERSE WHITE CIRCLE', +9691: 'LOWER HALF INVERSE WHITE CIRCLE', +9692: 'UPPER LEFT QUADRANT CIRCULAR ARC', +9693: 'UPPER RIGHT QUADRANT CIRCULAR ARC', +9694: 'LOWER RIGHT QUADRANT CIRCULAR ARC', +9695: 'LOWER LEFT QUADRANT CIRCULAR ARC', +9696: 'UPPER HALF CIRCLE', +9697: 'LOWER HALF CIRCLE', +9698: 'BLACK LOWER RIGHT TRIANGLE', +9699: 'BLACK LOWER LEFT TRIANGLE', +9700: 'BLACK UPPER LEFT TRIANGLE', +9701: 'BLACK UPPER RIGHT TRIANGLE', +9702: 'WHITE BULLET', +9703: 'SQUARE WITH LEFT HALF BLACK', +9704: 'SQUARE WITH RIGHT HALF BLACK', +9705: 'SQUARE WITH UPPER LEFT DIAGONAL HALF BLACK', +9706: 'SQUARE WITH LOWER RIGHT DIAGONAL HALF BLACK', +9707: 'WHITE SQUARE WITH VERTICAL BISECTING LINE', +9708: 'WHITE UP-POINTING TRIANGLE WITH DOT', +9709: 'UP-POINTING TRIANGLE WITH LEFT HALF BLACK', +9710: 'UP-POINTING TRIANGLE WITH RIGHT HALF BLACK', +9711: 'LARGE CIRCLE', +9712: 'WHITE SQUARE WITH UPPER LEFT QUADRANT', +9713: 'WHITE SQUARE WITH LOWER LEFT QUADRANT', +9714: 'WHITE SQUARE WITH LOWER RIGHT QUADRANT', +9715: 'WHITE SQUARE WITH UPPER RIGHT QUADRANT', +9716: 'WHITE CIRCLE WITH UPPER LEFT QUADRANT', +9717: 'WHITE CIRCLE WITH LOWER LEFT QUADRANT', +9718: 'WHITE CIRCLE WITH LOWER RIGHT QUADRANT', +9719: 'WHITE CIRCLE WITH UPPER RIGHT QUADRANT', +9720: 'UPPER LEFT TRIANGLE', +9721: 'UPPER RIGHT TRIANGLE', +9722: 'LOWER LEFT TRIANGLE', +9723: 'WHITE MEDIUM SQUARE', +9724: 'BLACK MEDIUM SQUARE', +9725: 'WHITE MEDIUM SMALL SQUARE', +9726: 'BLACK MEDIUM SMALL SQUARE', +9727: 'LOWER RIGHT TRIANGLE', +9728: 'BLACK SUN WITH RAYS', +9729: 'CLOUD', +9730: 'UMBRELLA', +9731: 'SNOWMAN', +9732: 'COMET', +9733: 'BLACK STAR', +9734: 'WHITE STAR', +9735: 'LIGHTNING', +9736: 'THUNDERSTORM', +9737: 'SUN', +9738: 'ASCENDING NODE', +9739: 'DESCENDING NODE', +9740: 'CONJUNCTION', +9741: 'OPPOSITION', +9742: 'BLACK TELEPHONE', +9743: 'WHITE TELEPHONE', +9744: 'BALLOT BOX', +9745: 'BALLOT BOX WITH CHECK', +9746: 'BALLOT BOX WITH X', +9747: 'SALTIRE', +9750: 'WHITE SHOGI PIECE', +9751: 'BLACK SHOGI PIECE', +9753: 'REVERSED ROTATED FLORAL HEART BULLET', +9754: 'BLACK LEFT POINTING INDEX', +9755: 'BLACK RIGHT POINTING INDEX', +9756: 'WHITE LEFT POINTING INDEX', +9757: 'WHITE UP POINTING INDEX', +9758: 'WHITE RIGHT POINTING INDEX', +9759: 'WHITE DOWN POINTING INDEX', +9760: 'SKULL AND CROSSBONES', +9761: 'CAUTION SIGN', +9762: 'RADIOACTIVE SIGN', +9763: 'BIOHAZARD SIGN', +9764: 'CADUCEUS', +9765: 'ANKH', +9766: 'ORTHODOX CROSS', +9767: 'CHI RHO', +9768: 'CROSS OF LORRAINE', +9769: 'CROSS OF JERUSALEM', +9770: 'STAR AND CRESCENT', +9771: 'FARSI SYMBOL', +9772: 'ADI SHAKTI', +9773: 'HAMMER AND SICKLE', +9774: 'PEACE SYMBOL', +9775: 'YIN YANG', +9776: 'TRIGRAM FOR HEAVEN', +9777: 'TRIGRAM FOR LAKE', +9778: 'TRIGRAM FOR FIRE', +9779: 'TRIGRAM FOR THUNDER', +9780: 'TRIGRAM FOR WIND', +9781: 'TRIGRAM FOR WATER', +9782: 'TRIGRAM FOR MOUNTAIN', +9783: 'TRIGRAM FOR EARTH', +9784: 'WHEEL OF DHARMA', +9785: 'WHITE FROWNING FACE', +9786: 'WHITE SMILING FACE', +9787: 'BLACK SMILING FACE', +9788: 'WHITE SUN WITH RAYS', +9789: 'FIRST QUARTER MOON', +9790: 'LAST QUARTER MOON', +9791: 'MERCURY', +9792: 'FEMALE SIGN', +9793: 'EARTH', +9794: 'MALE SIGN', +9795: 'JUPITER', +9796: 'SATURN', +9797: 'URANUS', +9798: 'NEPTUNE', +9799: 'PLUTO', +9800: 'ARIES', +9801: 'TAURUS', +9802: 'GEMINI', +9803: 'CANCER', +9804: 'LEO', +9805: 'VIRGO', +9806: 'LIBRA', +9807: 'SCORPIUS', +9808: 'SAGITTARIUS', +9809: 'CAPRICORN', +9810: 'AQUARIUS', +9811: 'PISCES', +9812: 'WHITE CHESS KING', +9813: 'WHITE CHESS QUEEN', +9814: 'WHITE CHESS ROOK', +9815: 'WHITE CHESS BISHOP', +9816: 'WHITE CHESS KNIGHT', +9817: 'WHITE CHESS PAWN', +9818: 'BLACK CHESS KING', +9819: 'BLACK CHESS QUEEN', +9820: 'BLACK CHESS ROOK', +9821: 'BLACK CHESS BISHOP', +9822: 'BLACK CHESS KNIGHT', +9823: 'BLACK CHESS PAWN', +9824: 'BLACK SPADE SUIT', +9825: 'WHITE HEART SUIT', +9826: 'WHITE DIAMOND SUIT', +9827: 'BLACK CLUB SUIT', +9828: 'WHITE SPADE SUIT', +9829: 'BLACK HEART SUIT', +9830: 'BLACK DIAMOND SUIT', +9831: 'WHITE CLUB SUIT', +9832: 'HOT SPRINGS', +9833: 'QUARTER NOTE', +9834: 'EIGHTH NOTE', +9835: 'BEAMED EIGHTH NOTES', +9836: 'BEAMED SIXTEENTH NOTES', +9837: 'MUSIC FLAT SIGN', +9838: 'MUSIC NATURAL SIGN', +9839: 'MUSIC SHARP SIGN', +9840: 'WEST SYRIAC CROSS', +9841: 'EAST SYRIAC CROSS', +9842: 'UNIVERSAL RECYCLING SYMBOL', +9843: 'RECYCLING SYMBOL FOR TYPE-1 PLASTICS', +9844: 'RECYCLING SYMBOL FOR TYPE-2 PLASTICS', +9845: 'RECYCLING SYMBOL FOR TYPE-3 PLASTICS', +9846: 'RECYCLING SYMBOL FOR TYPE-4 PLASTICS', +9847: 'RECYCLING SYMBOL FOR TYPE-5 PLASTICS', +9848: 'RECYCLING SYMBOL FOR TYPE-6 PLASTICS', +9849: 'RECYCLING SYMBOL FOR TYPE-7 PLASTICS', +9850: 'RECYCLING SYMBOL FOR GENERIC MATERIALS', +9851: 'BLACK UNIVERSAL RECYCLING SYMBOL', +9852: 'RECYCLED PAPER SYMBOL', +9853: 'PARTIALLY-RECYCLED PAPER SYMBOL', +9856: 'DIE FACE-1', +9857: 'DIE FACE-2', +9858: 'DIE FACE-3', +9859: 'DIE FACE-4', +9860: 'DIE FACE-5', +9861: 'DIE FACE-6', +9862: 'WHITE CIRCLE WITH DOT RIGHT', +9863: 'WHITE CIRCLE WITH TWO DOTS', +9864: 'BLACK CIRCLE WITH WHITE DOT RIGHT', +9865: 'BLACK CIRCLE WITH TWO WHITE DOTS', +9985: 'UPPER BLADE SCISSORS', +9986: 'BLACK SCISSORS', +9987: 'LOWER BLADE SCISSORS', +9988: 'WHITE SCISSORS', +9990: 'TELEPHONE LOCATION SIGN', +9991: 'TAPE DRIVE', +9992: 'AIRPLANE', +9993: 'ENVELOPE', +9996: 'VICTORY HAND', +9997: 'WRITING HAND', +9998: 'LOWER RIGHT PENCIL', +9999: 'PENCIL', +10000: 'UPPER RIGHT PENCIL', +10001: 'WHITE NIB', +10002: 'BLACK NIB', +10003: 'CHECK MARK', +10004: 'HEAVY CHECK MARK', +10005: 'MULTIPLICATION X', +10006: 'HEAVY MULTIPLICATION X', +10007: 'BALLOT X', +10008: 'HEAVY BALLOT X', +10009: 'OUTLINED GREEK CROSS', +10010: 'HEAVY GREEK CROSS', +10011: 'OPEN CENTRE CROSS', +10012: 'HEAVY OPEN CENTRE CROSS', +10013: 'LATIN CROSS', +10014: 'SHADOWED WHITE LATIN CROSS', +10015: 'OUTLINED LATIN CROSS', +10016: 'MALTESE CROSS', +10017: 'STAR OF DAVID', +10018: 'FOUR TEARDROP-SPOKED ASTERISK', +10019: 'FOUR BALLOON-SPOKED ASTERISK', +10020: 'HEAVY FOUR BALLOON-SPOKED ASTERISK', +10021: 'FOUR CLUB-SPOKED ASTERISK', +10022: 'BLACK FOUR POINTED STAR', +10023: 'WHITE FOUR POINTED STAR', +10025: 'STRESS OUTLINED WHITE STAR', +10026: 'CIRCLED WHITE STAR', +10027: 'OPEN CENTRE BLACK STAR', +10028: 'BLACK CENTRE WHITE STAR', +10029: 'OUTLINED BLACK STAR', +10030: 'HEAVY OUTLINED BLACK STAR', +10031: 'PINWHEEL STAR', +10032: 'SHADOWED WHITE STAR', +10033: 'HEAVY ASTERISK', +10034: 'OPEN CENTRE ASTERISK', +10035: 'EIGHT SPOKED ASTERISK', +10036: 'EIGHT POINTED BLACK STAR', +10037: 'EIGHT POINTED PINWHEEL STAR', +10038: 'SIX POINTED BLACK STAR', +10039: 'EIGHT POINTED RECTILINEAR BLACK STAR', +10040: 'HEAVY EIGHT POINTED RECTILINEAR BLACK STAR', +10041: 'TWELVE POINTED BLACK STAR', +10042: 'SIXTEEN POINTED ASTERISK', +10043: 'TEARDROP-SPOKED ASTERISK', +10044: 'OPEN CENTRE TEARDROP-SPOKED ASTERISK', +10045: 'HEAVY TEARDROP-SPOKED ASTERISK', +10046: 'SIX PETALLED BLACK AND WHITE FLORETTE', +10047: 'BLACK FLORETTE', +10048: 'WHITE FLORETTE', +10049: 'EIGHT PETALLED OUTLINED BLACK FLORETTE', +10050: 'CIRCLED OPEN CENTRE EIGHT POINTED STAR', +10051: 'HEAVY TEARDROP-SPOKED PINWHEEL ASTERISK', +10052: 'SNOWFLAKE', +10053: 'TIGHT TRIFOLIATE SNOWFLAKE', +10054: 'HEAVY CHEVRON SNOWFLAKE', +10055: 'SPARKLE', +10056: 'HEAVY SPARKLE', +10057: 'BALLOON-SPOKED ASTERISK', +10058: 'EIGHT TEARDROP-SPOKED PROPELLER ASTERISK', +10059: 'HEAVY EIGHT TEARDROP-SPOKED PROPELLER ASTERISK', +10061: 'SHADOWED WHITE CIRCLE', +10063: 'LOWER RIGHT DROP-SHADOWED WHITE SQUARE', +10064: 'UPPER RIGHT DROP-SHADOWED WHITE SQUARE', +10065: 'LOWER RIGHT SHADOWED WHITE SQUARE', +10066: 'UPPER RIGHT SHADOWED WHITE SQUARE', +10070: 'BLACK DIAMOND MINUS WHITE X', +10072: 'LIGHT VERTICAL BAR', +10073: 'MEDIUM VERTICAL BAR', +10074: 'HEAVY VERTICAL BAR', +10075: 'HEAVY SINGLE TURNED COMMA QUOTATION MARK ORNAMENT', +10076: 'HEAVY SINGLE COMMA QUOTATION MARK ORNAMENT', +10077: 'HEAVY DOUBLE TURNED COMMA QUOTATION MARK ORNAMENT', +10078: 'HEAVY DOUBLE COMMA QUOTATION MARK ORNAMENT', +10081: 'CURVED STEM PARAGRAPH SIGN ORNAMENT', +10082: 'HEAVY EXCLAMATION MARK ORNAMENT', +10083: 'HEAVY HEART EXCLAMATION MARK ORNAMENT', +10084: 'HEAVY BLACK HEART', +10085: 'ROTATED HEAVY BLACK HEART BULLET', +10086: 'FLORAL HEART', +10087: 'ROTATED FLORAL HEART BULLET', +10088: 'MEDIUM LEFT PARENTHESIS ORNAMENT', +10089: 'MEDIUM RIGHT PARENTHESIS ORNAMENT', +10090: 'MEDIUM FLATTENED LEFT PARENTHESIS ORNAMENT', +10091: 'MEDIUM FLATTENED RIGHT PARENTHESIS ORNAMENT', +10092: 'MEDIUM LEFT-POINTING ANGLE BRACKET ORNAMENT', +10093: 'MEDIUM RIGHT-POINTING ANGLE BRACKET ORNAMENT', +10094: 'HEAVY LEFT-POINTING ANGLE QUOTATION MARK ORNAMENT', +10095: 'HEAVY RIGHT-POINTING ANGLE QUOTATION MARK ORNAMENT', +10096: 'HEAVY LEFT-POINTING ANGLE BRACKET ORNAMENT', +10097: 'HEAVY RIGHT-POINTING ANGLE BRACKET ORNAMENT', +10098: 'LIGHT LEFT TORTOISE SHELL BRACKET ORNAMENT', +10099: 'LIGHT RIGHT TORTOISE SHELL BRACKET ORNAMENT', +10100: 'MEDIUM LEFT CURLY BRACKET ORNAMENT', +10101: 'MEDIUM RIGHT CURLY BRACKET ORNAMENT', +10102: 'DINGBAT NEGATIVE CIRCLED DIGIT ONE', +10103: 'DINGBAT NEGATIVE CIRCLED DIGIT TWO', +10104: 'DINGBAT NEGATIVE CIRCLED DIGIT THREE', +10105: 'DINGBAT NEGATIVE CIRCLED DIGIT FOUR', +10106: 'DINGBAT NEGATIVE CIRCLED DIGIT FIVE', +10107: 'DINGBAT NEGATIVE CIRCLED DIGIT SIX', +10108: 'DINGBAT NEGATIVE CIRCLED DIGIT SEVEN', +10109: 'DINGBAT NEGATIVE CIRCLED DIGIT EIGHT', +10110: 'DINGBAT NEGATIVE CIRCLED DIGIT NINE', +10111: 'DINGBAT NEGATIVE CIRCLED NUMBER TEN', +10112: 'DINGBAT CIRCLED SANS-SERIF DIGIT ONE', +10113: 'DINGBAT CIRCLED SANS-SERIF DIGIT TWO', +10114: 'DINGBAT CIRCLED SANS-SERIF DIGIT THREE', +10115: 'DINGBAT CIRCLED SANS-SERIF DIGIT FOUR', +10116: 'DINGBAT CIRCLED SANS-SERIF DIGIT FIVE', +10117: 'DINGBAT CIRCLED SANS-SERIF DIGIT SIX', +10118: 'DINGBAT CIRCLED SANS-SERIF DIGIT SEVEN', +10119: 'DINGBAT CIRCLED SANS-SERIF DIGIT EIGHT', +10120: 'DINGBAT CIRCLED SANS-SERIF DIGIT NINE', +10121: 'DINGBAT CIRCLED SANS-SERIF NUMBER TEN', +10122: 'DINGBAT NEGATIVE CIRCLED SANS-SERIF DIGIT ONE', +10123: 'DINGBAT NEGATIVE CIRCLED SANS-SERIF DIGIT TWO', +10124: 'DINGBAT NEGATIVE CIRCLED SANS-SERIF DIGIT THREE', +10125: 'DINGBAT NEGATIVE CIRCLED SANS-SERIF DIGIT FOUR', +10126: 'DINGBAT NEGATIVE CIRCLED SANS-SERIF DIGIT FIVE', +10127: 'DINGBAT NEGATIVE CIRCLED SANS-SERIF DIGIT SIX', +10128: 'DINGBAT NEGATIVE CIRCLED SANS-SERIF DIGIT SEVEN', +10129: 'DINGBAT NEGATIVE CIRCLED SANS-SERIF DIGIT EIGHT', +10130: 'DINGBAT NEGATIVE CIRCLED SANS-SERIF DIGIT NINE', +10131: 'DINGBAT NEGATIVE CIRCLED SANS-SERIF NUMBER TEN', +10132: 'HEAVY WIDE-HEADED RIGHTWARDS ARROW', +10136: 'HEAVY SOUTH EAST ARROW', +10137: 'HEAVY RIGHTWARDS ARROW', +10138: 'HEAVY NORTH EAST ARROW', +10139: 'DRAFTING POINT RIGHTWARDS ARROW', +10140: 'HEAVY ROUND-TIPPED RIGHTWARDS ARROW', +10141: 'TRIANGLE-HEADED RIGHTWARDS ARROW', +10142: 'HEAVY TRIANGLE-HEADED RIGHTWARDS ARROW', +10143: 'DASHED TRIANGLE-HEADED RIGHTWARDS ARROW', +10144: 'HEAVY DASHED TRIANGLE-HEADED RIGHTWARDS ARROW', +10145: 'BLACK RIGHTWARDS ARROW', +10146: 'THREE-D TOP-LIGHTED RIGHTWARDS ARROWHEAD', +10147: 'THREE-D BOTTOM-LIGHTED RIGHTWARDS ARROWHEAD', +10148: 'BLACK RIGHTWARDS ARROWHEAD', +10149: 'HEAVY BLACK CURVED DOWNWARDS AND RIGHTWARDS ARROW', +10150: 'HEAVY BLACK CURVED UPWARDS AND RIGHTWARDS ARROW', +10151: 'SQUAT BLACK RIGHTWARDS ARROW', +10152: 'HEAVY CONCAVE-POINTED BLACK RIGHTWARDS ARROW', +10153: 'RIGHT-SHADED WHITE RIGHTWARDS ARROW', +10154: 'LEFT-SHADED WHITE RIGHTWARDS ARROW', +10155: 'BACK-TILTED SHADOWED WHITE RIGHTWARDS ARROW', +10156: 'FRONT-TILTED SHADOWED WHITE RIGHTWARDS ARROW', +10157: 'HEAVY LOWER RIGHT-SHADOWED WHITE RIGHTWARDS ARROW', +10158: 'HEAVY UPPER RIGHT-SHADOWED WHITE RIGHTWARDS ARROW', +10159: 'NOTCHED LOWER RIGHT-SHADOWED WHITE RIGHTWARDS ARROW', +10161: 'NOTCHED UPPER RIGHT-SHADOWED WHITE RIGHTWARDS ARROW', +10162: 'CIRCLED HEAVY WHITE RIGHTWARDS ARROW', +10163: 'WHITE-FEATHERED RIGHTWARDS ARROW', +10164: 'BLACK-FEATHERED SOUTH EAST ARROW', +10165: 'BLACK-FEATHERED RIGHTWARDS ARROW', +10166: 'BLACK-FEATHERED NORTH EAST ARROW', +10167: 'HEAVY BLACK-FEATHERED SOUTH EAST ARROW', +10168: 'HEAVY BLACK-FEATHERED RIGHTWARDS ARROW', +10169: 'HEAVY BLACK-FEATHERED NORTH EAST ARROW', +10170: 'TEARDROP-BARBED RIGHTWARDS ARROW', +10171: 'HEAVY TEARDROP-SHANKED RIGHTWARDS ARROW', +10172: 'WEDGE-TAILED RIGHTWARDS ARROW', +10173: 'HEAVY WEDGE-TAILED RIGHTWARDS ARROW', +10174: 'OPEN-OUTLINED RIGHTWARDS ARROW', +10192: 'WHITE DIAMOND WITH CENTRED DOT', +10193: 'AND WITH DOT', +10194: 'ELEMENT OF OPENING UPWARDS', +10195: 'LOWER RIGHT CORNER WITH DOT', +10196: 'UPPER LEFT CORNER WITH DOT', +10197: 'LEFT OUTER JOIN', +10198: 'RIGHT OUTER JOIN', +10199: 'FULL OUTER JOIN', +10200: 'LARGE UP TACK', +10201: 'LARGE DOWN TACK', +10202: 'LEFT AND RIGHT DOUBLE TURNSTILE', +10203: 'LEFT AND RIGHT TACK', +10204: 'LEFT MULTIMAP', +10205: 'LONG RIGHT TACK', +10206: 'LONG LEFT TACK', +10207: 'UP TACK WITH CIRCLE ABOVE', +10208: 'LOZENGE DIVIDED BY HORIZONTAL RULE', +10209: 'WHITE CONCAVE-SIDED DIAMOND', +10210: 'WHITE CONCAVE-SIDED DIAMOND WITH LEFTWARDS TICK', +10211: 'WHITE CONCAVE-SIDED DIAMOND WITH RIGHTWARDS TICK', +10212: 'WHITE SQUARE WITH LEFTWARDS TICK', +10213: 'WHITE SQUARE WITH RIGHTWARDS TICK', +10214: 'MATHEMATICAL LEFT WHITE SQUARE BRACKET', +10215: 'MATHEMATICAL RIGHT WHITE SQUARE BRACKET', +10216: 'MATHEMATICAL LEFT ANGLE BRACKET', +10217: 'MATHEMATICAL RIGHT ANGLE BRACKET', +10218: 'MATHEMATICAL LEFT DOUBLE ANGLE BRACKET', +10219: 'MATHEMATICAL RIGHT DOUBLE ANGLE BRACKET', +10224: 'UPWARDS QUADRUPLE ARROW', +10225: 'DOWNWARDS QUADRUPLE ARROW', +10226: 'ANTICLOCKWISE GAPPED CIRCLE ARROW', +10227: 'CLOCKWISE GAPPED CIRCLE ARROW', +10228: 'RIGHT ARROW WITH CIRCLED PLUS', +10229: 'LONG LEFTWARDS ARROW', +10230: 'LONG RIGHTWARDS ARROW', +10231: 'LONG LEFT RIGHT ARROW', +10232: 'LONG LEFTWARDS DOUBLE ARROW', +10233: 'LONG RIGHTWARDS DOUBLE ARROW', +10234: 'LONG LEFT RIGHT DOUBLE ARROW', +10235: 'LONG LEFTWARDS ARROW FROM BAR', +10236: 'LONG RIGHTWARDS ARROW FROM BAR', +10237: 'LONG LEFTWARDS DOUBLE ARROW FROM BAR', +10238: 'LONG RIGHTWARDS DOUBLE ARROW FROM BAR', +10239: 'LONG RIGHTWARDS SQUIGGLE ARROW', +10240: 'BRAILLE PATTERN BLANK', +10241: 'BRAILLE PATTERN DOTS-1', +10242: 'BRAILLE PATTERN DOTS-2', +10243: 'BRAILLE PATTERN DOTS-12', +10244: 'BRAILLE PATTERN DOTS-3', +10245: 'BRAILLE PATTERN DOTS-13', +10246: 'BRAILLE PATTERN DOTS-23', +10247: 'BRAILLE PATTERN DOTS-123', +10248: 'BRAILLE PATTERN DOTS-4', +10249: 'BRAILLE PATTERN DOTS-14', +10250: 'BRAILLE PATTERN DOTS-24', +10251: 'BRAILLE PATTERN DOTS-124', +10252: 'BRAILLE PATTERN DOTS-34', +10253: 'BRAILLE PATTERN DOTS-134', +10254: 'BRAILLE PATTERN DOTS-234', +10255: 'BRAILLE PATTERN DOTS-1234', +10256: 'BRAILLE PATTERN DOTS-5', +10257: 'BRAILLE PATTERN DOTS-15', +10258: 'BRAILLE PATTERN DOTS-25', +10259: 'BRAILLE PATTERN DOTS-125', +10260: 'BRAILLE PATTERN DOTS-35', +10261: 'BRAILLE PATTERN DOTS-135', +10262: 'BRAILLE PATTERN DOTS-235', +10263: 'BRAILLE PATTERN DOTS-1235', +10264: 'BRAILLE PATTERN DOTS-45', +10265: 'BRAILLE PATTERN DOTS-145', +10266: 'BRAILLE PATTERN DOTS-245', +10267: 'BRAILLE PATTERN DOTS-1245', +10268: 'BRAILLE PATTERN DOTS-345', +10269: 'BRAILLE PATTERN DOTS-1345', +10270: 'BRAILLE PATTERN DOTS-2345', +10271: 'BRAILLE PATTERN DOTS-12345', +10272: 'BRAILLE PATTERN DOTS-6', +10273: 'BRAILLE PATTERN DOTS-16', +10274: 'BRAILLE PATTERN DOTS-26', +10275: 'BRAILLE PATTERN DOTS-126', +10276: 'BRAILLE PATTERN DOTS-36', +10277: 'BRAILLE PATTERN DOTS-136', +10278: 'BRAILLE PATTERN DOTS-236', +10279: 'BRAILLE PATTERN DOTS-1236', +10280: 'BRAILLE PATTERN DOTS-46', +10281: 'BRAILLE PATTERN DOTS-146', +10282: 'BRAILLE PATTERN DOTS-246', +10283: 'BRAILLE PATTERN DOTS-1246', +10284: 'BRAILLE PATTERN DOTS-346', +10285: 'BRAILLE PATTERN DOTS-1346', +10286: 'BRAILLE PATTERN DOTS-2346', +10287: 'BRAILLE PATTERN DOTS-12346', +10288: 'BRAILLE PATTERN DOTS-56', +10289: 'BRAILLE PATTERN DOTS-156', +10290: 'BRAILLE PATTERN DOTS-256', +10291: 'BRAILLE PATTERN DOTS-1256', +10292: 'BRAILLE PATTERN DOTS-356', +10293: 'BRAILLE PATTERN DOTS-1356', +10294: 'BRAILLE PATTERN DOTS-2356', +10295: 'BRAILLE PATTERN DOTS-12356', +10296: 'BRAILLE PATTERN DOTS-456', +10297: 'BRAILLE PATTERN DOTS-1456', +10298: 'BRAILLE PATTERN DOTS-2456', +10299: 'BRAILLE PATTERN DOTS-12456', +10300: 'BRAILLE PATTERN DOTS-3456', +10301: 'BRAILLE PATTERN DOTS-13456', +10302: 'BRAILLE PATTERN DOTS-23456', +10303: 'BRAILLE PATTERN DOTS-123456', +10304: 'BRAILLE PATTERN DOTS-7', +10305: 'BRAILLE PATTERN DOTS-17', +10306: 'BRAILLE PATTERN DOTS-27', +10307: 'BRAILLE PATTERN DOTS-127', +10308: 'BRAILLE PATTERN DOTS-37', +10309: 'BRAILLE PATTERN DOTS-137', +10310: 'BRAILLE PATTERN DOTS-237', +10311: 'BRAILLE PATTERN DOTS-1237', +10312: 'BRAILLE PATTERN DOTS-47', +10313: 'BRAILLE PATTERN DOTS-147', +10314: 'BRAILLE PATTERN DOTS-247', +10315: 'BRAILLE PATTERN DOTS-1247', +10316: 'BRAILLE PATTERN DOTS-347', +10317: 'BRAILLE PATTERN DOTS-1347', +10318: 'BRAILLE PATTERN DOTS-2347', +10319: 'BRAILLE PATTERN DOTS-12347', +10320: 'BRAILLE PATTERN DOTS-57', +10321: 'BRAILLE PATTERN DOTS-157', +10322: 'BRAILLE PATTERN DOTS-257', +10323: 'BRAILLE PATTERN DOTS-1257', +10324: 'BRAILLE PATTERN DOTS-357', +10325: 'BRAILLE PATTERN DOTS-1357', +10326: 'BRAILLE PATTERN DOTS-2357', +10327: 'BRAILLE PATTERN DOTS-12357', +10328: 'BRAILLE PATTERN DOTS-457', +10329: 'BRAILLE PATTERN DOTS-1457', +10330: 'BRAILLE PATTERN DOTS-2457', +10331: 'BRAILLE PATTERN DOTS-12457', +10332: 'BRAILLE PATTERN DOTS-3457', +10333: 'BRAILLE PATTERN DOTS-13457', +10334: 'BRAILLE PATTERN DOTS-23457', +10335: 'BRAILLE PATTERN DOTS-123457', +10336: 'BRAILLE PATTERN DOTS-67', +10337: 'BRAILLE PATTERN DOTS-167', +10338: 'BRAILLE PATTERN DOTS-267', +10339: 'BRAILLE PATTERN DOTS-1267', +10340: 'BRAILLE PATTERN DOTS-367', +10341: 'BRAILLE PATTERN DOTS-1367', +10342: 'BRAILLE PATTERN DOTS-2367', +10343: 'BRAILLE PATTERN DOTS-12367', +10344: 'BRAILLE PATTERN DOTS-467', +10345: 'BRAILLE PATTERN DOTS-1467', +10346: 'BRAILLE PATTERN DOTS-2467', +10347: 'BRAILLE PATTERN DOTS-12467', +10348: 'BRAILLE PATTERN DOTS-3467', +10349: 'BRAILLE PATTERN DOTS-13467', +10350: 'BRAILLE PATTERN DOTS-23467', +10351: 'BRAILLE PATTERN DOTS-123467', +10352: 'BRAILLE PATTERN DOTS-567', +10353: 'BRAILLE PATTERN DOTS-1567', +10354: 'BRAILLE PATTERN DOTS-2567', +10355: 'BRAILLE PATTERN DOTS-12567', +10356: 'BRAILLE PATTERN DOTS-3567', +10357: 'BRAILLE PATTERN DOTS-13567', +10358: 'BRAILLE PATTERN DOTS-23567', +10359: 'BRAILLE PATTERN DOTS-123567', +10360: 'BRAILLE PATTERN DOTS-4567', +10361: 'BRAILLE PATTERN DOTS-14567', +10362: 'BRAILLE PATTERN DOTS-24567', +10363: 'BRAILLE PATTERN DOTS-124567', +10364: 'BRAILLE PATTERN DOTS-34567', +10365: 'BRAILLE PATTERN DOTS-134567', +10366: 'BRAILLE PATTERN DOTS-234567', +10367: 'BRAILLE PATTERN DOTS-1234567', +10368: 'BRAILLE PATTERN DOTS-8', +10369: 'BRAILLE PATTERN DOTS-18', +10370: 'BRAILLE PATTERN DOTS-28', +10371: 'BRAILLE PATTERN DOTS-128', +10372: 'BRAILLE PATTERN DOTS-38', +10373: 'BRAILLE PATTERN DOTS-138', +10374: 'BRAILLE PATTERN DOTS-238', +10375: 'BRAILLE PATTERN DOTS-1238', +10376: 'BRAILLE PATTERN DOTS-48', +10377: 'BRAILLE PATTERN DOTS-148', +10378: 'BRAILLE PATTERN DOTS-248', +10379: 'BRAILLE PATTERN DOTS-1248', +10380: 'BRAILLE PATTERN DOTS-348', +10381: 'BRAILLE PATTERN DOTS-1348', +10382: 'BRAILLE PATTERN DOTS-2348', +10383: 'BRAILLE PATTERN DOTS-12348', +10384: 'BRAILLE PATTERN DOTS-58', +10385: 'BRAILLE PATTERN DOTS-158', +10386: 'BRAILLE PATTERN DOTS-258', +10387: 'BRAILLE PATTERN DOTS-1258', +10388: 'BRAILLE PATTERN DOTS-358', +10389: 'BRAILLE PATTERN DOTS-1358', +10390: 'BRAILLE PATTERN DOTS-2358', +10391: 'BRAILLE PATTERN DOTS-12358', +10392: 'BRAILLE PATTERN DOTS-458', +10393: 'BRAILLE PATTERN DOTS-1458', +10394: 'BRAILLE PATTERN DOTS-2458', +10395: 'BRAILLE PATTERN DOTS-12458', +10396: 'BRAILLE PATTERN DOTS-3458', +10397: 'BRAILLE PATTERN DOTS-13458', +10398: 'BRAILLE PATTERN DOTS-23458', +10399: 'BRAILLE PATTERN DOTS-123458', +10400: 'BRAILLE PATTERN DOTS-68', +10401: 'BRAILLE PATTERN DOTS-168', +10402: 'BRAILLE PATTERN DOTS-268', +10403: 'BRAILLE PATTERN DOTS-1268', +10404: 'BRAILLE PATTERN DOTS-368', +10405: 'BRAILLE PATTERN DOTS-1368', +10406: 'BRAILLE PATTERN DOTS-2368', +10407: 'BRAILLE PATTERN DOTS-12368', +10408: 'BRAILLE PATTERN DOTS-468', +10409: 'BRAILLE PATTERN DOTS-1468', +10410: 'BRAILLE PATTERN DOTS-2468', +10411: 'BRAILLE PATTERN DOTS-12468', +10412: 'BRAILLE PATTERN DOTS-3468', +10413: 'BRAILLE PATTERN DOTS-13468', +10414: 'BRAILLE PATTERN DOTS-23468', +10415: 'BRAILLE PATTERN DOTS-123468', +10416: 'BRAILLE PATTERN DOTS-568', +10417: 'BRAILLE PATTERN DOTS-1568', +10418: 'BRAILLE PATTERN DOTS-2568', +10419: 'BRAILLE PATTERN DOTS-12568', +10420: 'BRAILLE PATTERN DOTS-3568', +10421: 'BRAILLE PATTERN DOTS-13568', +10422: 'BRAILLE PATTERN DOTS-23568', +10423: 'BRAILLE PATTERN DOTS-123568', +10424: 'BRAILLE PATTERN DOTS-4568', +10425: 'BRAILLE PATTERN DOTS-14568', +10426: 'BRAILLE PATTERN DOTS-24568', +10427: 'BRAILLE PATTERN DOTS-124568', +10428: 'BRAILLE PATTERN DOTS-34568', +10429: 'BRAILLE PATTERN DOTS-134568', +10430: 'BRAILLE PATTERN DOTS-234568', +10431: 'BRAILLE PATTERN DOTS-1234568', +10432: 'BRAILLE PATTERN DOTS-78', +10433: 'BRAILLE PATTERN DOTS-178', +10434: 'BRAILLE PATTERN DOTS-278', +10435: 'BRAILLE PATTERN DOTS-1278', +10436: 'BRAILLE PATTERN DOTS-378', +10437: 'BRAILLE PATTERN DOTS-1378', +10438: 'BRAILLE PATTERN DOTS-2378', +10439: 'BRAILLE PATTERN DOTS-12378', +10440: 'BRAILLE PATTERN DOTS-478', +10441: 'BRAILLE PATTERN DOTS-1478', +10442: 'BRAILLE PATTERN DOTS-2478', +10443: 'BRAILLE PATTERN DOTS-12478', +10444: 'BRAILLE PATTERN DOTS-3478', +10445: 'BRAILLE PATTERN DOTS-13478', +10446: 'BRAILLE PATTERN DOTS-23478', +10447: 'BRAILLE PATTERN DOTS-123478', +10448: 'BRAILLE PATTERN DOTS-578', +10449: 'BRAILLE PATTERN DOTS-1578', +10450: 'BRAILLE PATTERN DOTS-2578', +10451: 'BRAILLE PATTERN DOTS-12578', +10452: 'BRAILLE PATTERN DOTS-3578', +10453: 'BRAILLE PATTERN DOTS-13578', +10454: 'BRAILLE PATTERN DOTS-23578', +10455: 'BRAILLE PATTERN DOTS-123578', +10456: 'BRAILLE PATTERN DOTS-4578', +10457: 'BRAILLE PATTERN DOTS-14578', +10458: 'BRAILLE PATTERN DOTS-24578', +10459: 'BRAILLE PATTERN DOTS-124578', +10460: 'BRAILLE PATTERN DOTS-34578', +10461: 'BRAILLE PATTERN DOTS-134578', +10462: 'BRAILLE PATTERN DOTS-234578', +10463: 'BRAILLE PATTERN DOTS-1234578', +10464: 'BRAILLE PATTERN DOTS-678', +10465: 'BRAILLE PATTERN DOTS-1678', +10466: 'BRAILLE PATTERN DOTS-2678', +10467: 'BRAILLE PATTERN DOTS-12678', +10468: 'BRAILLE PATTERN DOTS-3678', +10469: 'BRAILLE PATTERN DOTS-13678', +10470: 'BRAILLE PATTERN DOTS-23678', +10471: 'BRAILLE PATTERN DOTS-123678', +10472: 'BRAILLE PATTERN DOTS-4678', +10473: 'BRAILLE PATTERN DOTS-14678', +10474: 'BRAILLE PATTERN DOTS-24678', +10475: 'BRAILLE PATTERN DOTS-124678', +10476: 'BRAILLE PATTERN DOTS-34678', +10477: 'BRAILLE PATTERN DOTS-134678', +10478: 'BRAILLE PATTERN DOTS-234678', +10479: 'BRAILLE PATTERN DOTS-1234678', +10480: 'BRAILLE PATTERN DOTS-5678', +10481: 'BRAILLE PATTERN DOTS-15678', +10482: 'BRAILLE PATTERN DOTS-25678', +10483: 'BRAILLE PATTERN DOTS-125678', +10484: 'BRAILLE PATTERN DOTS-35678', +10485: 'BRAILLE PATTERN DOTS-135678', +10486: 'BRAILLE PATTERN DOTS-235678', +10487: 'BRAILLE PATTERN DOTS-1235678', +10488: 'BRAILLE PATTERN DOTS-45678', +10489: 'BRAILLE PATTERN DOTS-145678', +10490: 'BRAILLE PATTERN DOTS-245678', +10491: 'BRAILLE PATTERN DOTS-1245678', +10492: 'BRAILLE PATTERN DOTS-345678', +10493: 'BRAILLE PATTERN DOTS-1345678', +10494: 'BRAILLE PATTERN DOTS-2345678', +10495: 'BRAILLE PATTERN DOTS-12345678', +10496: 'RIGHTWARDS TWO-HEADED ARROW WITH VERTICAL STROKE', +10497: 'RIGHTWARDS TWO-HEADED ARROW WITH DOUBLE VERTICAL STROKE', +10498: 'LEFTWARDS DOUBLE ARROW WITH VERTICAL STROKE', +10499: 'RIGHTWARDS DOUBLE ARROW WITH VERTICAL STROKE', +10500: 'LEFT RIGHT DOUBLE ARROW WITH VERTICAL STROKE', +10501: 'RIGHTWARDS TWO-HEADED ARROW FROM BAR', +10502: 'LEFTWARDS DOUBLE ARROW FROM BAR', +10503: 'RIGHTWARDS DOUBLE ARROW FROM BAR', +10504: 'DOWNWARDS ARROW WITH HORIZONTAL STROKE', +10505: 'UPWARDS ARROW WITH HORIZONTAL STROKE', +10506: 'UPWARDS TRIPLE ARROW', +10507: 'DOWNWARDS TRIPLE ARROW', +10508: 'LEFTWARDS DOUBLE DASH ARROW', +10509: 'RIGHTWARDS DOUBLE DASH ARROW', +10510: 'LEFTWARDS TRIPLE DASH ARROW', +10511: 'RIGHTWARDS TRIPLE DASH ARROW', +10512: 'RIGHTWARDS TWO-HEADED TRIPLE DASH ARROW', +10513: 'RIGHTWARDS ARROW WITH DOTTED STEM', +10514: 'UPWARDS ARROW TO BAR', +10515: 'DOWNWARDS ARROW TO BAR', +10516: 'RIGHTWARDS ARROW WITH TAIL WITH VERTICAL STROKE', +10517: 'RIGHTWARDS ARROW WITH TAIL WITH DOUBLE VERTICAL STROKE', +10518: 'RIGHTWARDS TWO-HEADED ARROW WITH TAIL', +10519: 'RIGHTWARDS TWO-HEADED ARROW WITH TAIL WITH VERTICAL STROKE', +10520: 'RIGHTWARDS TWO-HEADED ARROW WITH TAIL WITH DOUBLE VERTICAL STROKE', +10521: 'LEFTWARDS ARROW-TAIL', +10522: 'RIGHTWARDS ARROW-TAIL', +10523: 'LEFTWARDS DOUBLE ARROW-TAIL', +10524: 'RIGHTWARDS DOUBLE ARROW-TAIL', +10525: 'LEFTWARDS ARROW TO BLACK DIAMOND', +10526: 'RIGHTWARDS ARROW TO BLACK DIAMOND', +10527: 'LEFTWARDS ARROW FROM BAR TO BLACK DIAMOND', +10528: 'RIGHTWARDS ARROW FROM BAR TO BLACK DIAMOND', +10529: 'NORTH WEST AND SOUTH EAST ARROW', +10530: 'NORTH EAST AND SOUTH WEST ARROW', +10531: 'NORTH WEST ARROW WITH HOOK', +10532: 'NORTH EAST ARROW WITH HOOK', +10533: 'SOUTH EAST ARROW WITH HOOK', +10534: 'SOUTH WEST ARROW WITH HOOK', +10535: 'NORTH WEST ARROW AND NORTH EAST ARROW', +10536: 'NORTH EAST ARROW AND SOUTH EAST ARROW', +10537: 'SOUTH EAST ARROW AND SOUTH WEST ARROW', +10538: 'SOUTH WEST ARROW AND NORTH WEST ARROW', +10539: 'RISING DIAGONAL CROSSING FALLING DIAGONAL', +10540: 'FALLING DIAGONAL CROSSING RISING DIAGONAL', +10541: 'SOUTH EAST ARROW CROSSING NORTH EAST ARROW', +10542: 'NORTH EAST ARROW CROSSING SOUTH EAST ARROW', +10543: 'FALLING DIAGONAL CROSSING NORTH EAST ARROW', +10544: 'RISING DIAGONAL CROSSING SOUTH EAST ARROW', +10545: 'NORTH EAST ARROW CROSSING NORTH WEST ARROW', +10546: 'NORTH WEST ARROW CROSSING NORTH EAST ARROW', +10547: 'WAVE ARROW POINTING DIRECTLY RIGHT', +10548: 'ARROW POINTING RIGHTWARDS THEN CURVING UPWARDS', +10549: 'ARROW POINTING RIGHTWARDS THEN CURVING DOWNWARDS', +10550: 'ARROW POINTING DOWNWARDS THEN CURVING LEFTWARDS', +10551: 'ARROW POINTING DOWNWARDS THEN CURVING RIGHTWARDS', +10552: 'RIGHT-SIDE ARC CLOCKWISE ARROW', +10553: 'LEFT-SIDE ARC ANTICLOCKWISE ARROW', +10554: 'TOP ARC ANTICLOCKWISE ARROW', +10555: 'BOTTOM ARC ANTICLOCKWISE ARROW', +10556: 'TOP ARC CLOCKWISE ARROW WITH MINUS', +10557: 'TOP ARC ANTICLOCKWISE ARROW WITH PLUS', +10558: 'LOWER RIGHT SEMICIRCULAR CLOCKWISE ARROW', +10559: 'LOWER LEFT SEMICIRCULAR ANTICLOCKWISE ARROW', +10560: 'ANTICLOCKWISE CLOSED CIRCLE ARROW', +10561: 'CLOCKWISE CLOSED CIRCLE ARROW', +10562: 'RIGHTWARDS ARROW ABOVE SHORT LEFTWARDS ARROW', +10563: 'LEFTWARDS ARROW ABOVE SHORT RIGHTWARDS ARROW', +10564: 'SHORT RIGHTWARDS ARROW ABOVE LEFTWARDS ARROW', +10565: 'RIGHTWARDS ARROW WITH PLUS BELOW', +10566: 'LEFTWARDS ARROW WITH PLUS BELOW', +10567: 'RIGHTWARDS ARROW THROUGH X', +10568: 'LEFT RIGHT ARROW THROUGH SMALL CIRCLE', +10569: 'UPWARDS TWO-HEADED ARROW FROM SMALL CIRCLE', +10570: 'LEFT BARB UP RIGHT BARB DOWN HARPOON', +10571: 'LEFT BARB DOWN RIGHT BARB UP HARPOON', +10572: 'UP BARB RIGHT DOWN BARB LEFT HARPOON', +10573: 'UP BARB LEFT DOWN BARB RIGHT HARPOON', +10574: 'LEFT BARB UP RIGHT BARB UP HARPOON', +10575: 'UP BARB RIGHT DOWN BARB RIGHT HARPOON', +10576: 'LEFT BARB DOWN RIGHT BARB DOWN HARPOON', +10577: 'UP BARB LEFT DOWN BARB LEFT HARPOON', +10578: 'LEFTWARDS HARPOON WITH BARB UP TO BAR', +10579: 'RIGHTWARDS HARPOON WITH BARB UP TO BAR', +10580: 'UPWARDS HARPOON WITH BARB RIGHT TO BAR', +10581: 'DOWNWARDS HARPOON WITH BARB RIGHT TO BAR', +10582: 'LEFTWARDS HARPOON WITH BARB DOWN TO BAR', +10583: 'RIGHTWARDS HARPOON WITH BARB DOWN TO BAR', +10584: 'UPWARDS HARPOON WITH BARB LEFT TO BAR', +10585: 'DOWNWARDS HARPOON WITH BARB LEFT TO BAR', +10586: 'LEFTWARDS HARPOON WITH BARB UP FROM BAR', +10587: 'RIGHTWARDS HARPOON WITH BARB UP FROM BAR', +10588: 'UPWARDS HARPOON WITH BARB RIGHT FROM BAR', +10589: 'DOWNWARDS HARPOON WITH BARB RIGHT FROM BAR', +10590: 'LEFTWARDS HARPOON WITH BARB DOWN FROM BAR', +10591: 'RIGHTWARDS HARPOON WITH BARB DOWN FROM BAR', +10592: 'UPWARDS HARPOON WITH BARB LEFT FROM BAR', +10593: 'DOWNWARDS HARPOON WITH BARB LEFT FROM BAR', +10594: 'LEFTWARDS HARPOON WITH BARB UP ABOVE LEFTWARDS HARPOON WITH BARB DOWN', +10595: 'UPWARDS HARPOON WITH BARB LEFT BESIDE UPWARDS HARPOON WITH BARB RIGHT', +10596: 'RIGHTWARDS HARPOON WITH BARB UP ABOVE RIGHTWARDS HARPOON WITH BARB DOWN', +10597: 'DOWNWARDS HARPOON WITH BARB LEFT BESIDE DOWNWARDS HARPOON WITH BARB RIGHT', +10598: 'LEFTWARDS HARPOON WITH BARB UP ABOVE RIGHTWARDS HARPOON WITH BARB UP', +10599: 'LEFTWARDS HARPOON WITH BARB DOWN ABOVE RIGHTWARDS HARPOON WITH BARB DOWN', +10600: 'RIGHTWARDS HARPOON WITH BARB UP ABOVE LEFTWARDS HARPOON WITH BARB UP', +10601: 'RIGHTWARDS HARPOON WITH BARB DOWN ABOVE LEFTWARDS HARPOON WITH BARB DOWN', +10602: 'LEFTWARDS HARPOON WITH BARB UP ABOVE LONG DASH', +10603: 'LEFTWARDS HARPOON WITH BARB DOWN BELOW LONG DASH', +10604: 'RIGHTWARDS HARPOON WITH BARB UP ABOVE LONG DASH', +10605: 'RIGHTWARDS HARPOON WITH BARB DOWN BELOW LONG DASH', +10606: 'UPWARDS HARPOON WITH BARB LEFT BESIDE DOWNWARDS HARPOON WITH BARB RIGHT', +10607: 'DOWNWARDS HARPOON WITH BARB LEFT BESIDE UPWARDS HARPOON WITH BARB RIGHT', +10608: 'RIGHT DOUBLE ARROW WITH ROUNDED HEAD', +10609: 'EQUALS SIGN ABOVE RIGHTWARDS ARROW', +10610: 'TILDE OPERATOR ABOVE RIGHTWARDS ARROW', +10611: 'LEFTWARDS ARROW ABOVE TILDE OPERATOR', +10612: 'RIGHTWARDS ARROW ABOVE TILDE OPERATOR', +10613: 'RIGHTWARDS ARROW ABOVE ALMOST EQUAL TO', +10614: 'LESS-THAN ABOVE LEFTWARDS ARROW', +10615: 'LEFTWARDS ARROW THROUGH LESS-THAN', +10616: 'GREATER-THAN ABOVE RIGHTWARDS ARROW', +10617: 'SUBSET ABOVE RIGHTWARDS ARROW', +10618: 'LEFTWARDS ARROW THROUGH SUBSET', +10619: 'SUPERSET ABOVE LEFTWARDS ARROW', +10620: 'LEFT FISH TAIL', +10621: 'RIGHT FISH TAIL', +10622: 'UP FISH TAIL', +10623: 'DOWN FISH TAIL', +10624: 'TRIPLE VERTICAL BAR DELIMITER', +10625: 'Z NOTATION SPOT', +10626: 'Z NOTATION TYPE COLON', +10627: 'LEFT WHITE CURLY BRACKET', +10628: 'RIGHT WHITE CURLY BRACKET', +10629: 'LEFT WHITE PARENTHESIS', +10630: 'RIGHT WHITE PARENTHESIS', +10631: 'Z NOTATION LEFT IMAGE BRACKET', +10632: 'Z NOTATION RIGHT IMAGE BRACKET', +10633: 'Z NOTATION LEFT BINDING BRACKET', +10634: 'Z NOTATION RIGHT BINDING BRACKET', +10635: 'LEFT SQUARE BRACKET WITH UNDERBAR', +10636: 'RIGHT SQUARE BRACKET WITH UNDERBAR', +10637: 'LEFT SQUARE BRACKET WITH TICK IN TOP CORNER', +10638: 'RIGHT SQUARE BRACKET WITH TICK IN BOTTOM CORNER', +10639: 'LEFT SQUARE BRACKET WITH TICK IN BOTTOM CORNER', +10640: 'RIGHT SQUARE BRACKET WITH TICK IN TOP CORNER', +10641: 'LEFT ANGLE BRACKET WITH DOT', +10642: 'RIGHT ANGLE BRACKET WITH DOT', +10643: 'LEFT ARC LESS-THAN BRACKET', +10644: 'RIGHT ARC GREATER-THAN BRACKET', +10645: 'DOUBLE LEFT ARC GREATER-THAN BRACKET', +10646: 'DOUBLE RIGHT ARC LESS-THAN BRACKET', +10647: 'LEFT BLACK TORTOISE SHELL BRACKET', +10648: 'RIGHT BLACK TORTOISE SHELL BRACKET', +10649: 'DOTTED FENCE', +10650: 'VERTICAL ZIGZAG LINE', +10651: 'MEASURED ANGLE OPENING LEFT', +10652: 'RIGHT ANGLE VARIANT WITH SQUARE', +10653: 'MEASURED RIGHT ANGLE WITH DOT', +10654: 'ANGLE WITH S INSIDE', +10655: 'ACUTE ANGLE', +10656: 'SPHERICAL ANGLE OPENING LEFT', +10657: 'SPHERICAL ANGLE OPENING UP', +10658: 'TURNED ANGLE', +10659: 'REVERSED ANGLE', +10660: 'ANGLE WITH UNDERBAR', +10661: 'REVERSED ANGLE WITH UNDERBAR', +10662: 'OBLIQUE ANGLE OPENING UP', +10663: 'OBLIQUE ANGLE OPENING DOWN', +10664: 'MEASURED ANGLE WITH OPEN ARM ENDING IN ARROW POINTING UP AND RIGHT', +10665: 'MEASURED ANGLE WITH OPEN ARM ENDING IN ARROW POINTING UP AND LEFT', +10666: 'MEASURED ANGLE WITH OPEN ARM ENDING IN ARROW POINTING DOWN AND RIGHT', +10667: 'MEASURED ANGLE WITH OPEN ARM ENDING IN ARROW POINTING DOWN AND LEFT', +10668: 'MEASURED ANGLE WITH OPEN ARM ENDING IN ARROW POINTING RIGHT AND UP', +10669: 'MEASURED ANGLE WITH OPEN ARM ENDING IN ARROW POINTING LEFT AND UP', +10670: 'MEASURED ANGLE WITH OPEN ARM ENDING IN ARROW POINTING RIGHT AND DOWN', +10671: 'MEASURED ANGLE WITH OPEN ARM ENDING IN ARROW POINTING LEFT AND DOWN', +10672: 'REVERSED EMPTY SET', +10673: 'EMPTY SET WITH OVERBAR', +10674: 'EMPTY SET WITH SMALL CIRCLE ABOVE', +10675: 'EMPTY SET WITH RIGHT ARROW ABOVE', +10676: 'EMPTY SET WITH LEFT ARROW ABOVE', +10677: 'CIRCLE WITH HORIZONTAL BAR', +10678: 'CIRCLED VERTICAL BAR', +10679: 'CIRCLED PARALLEL', +10680: 'CIRCLED REVERSE SOLIDUS', +10681: 'CIRCLED PERPENDICULAR', +10682: 'CIRCLE DIVIDED BY HORIZONTAL BAR AND TOP HALF DIVIDED BY VERTICAL BAR', +10683: 'CIRCLE WITH SUPERIMPOSED X', +10684: 'CIRCLED ANTICLOCKWISE-ROTATED DIVISION SIGN', +10685: 'UP ARROW THROUGH CIRCLE', +10686: 'CIRCLED WHITE BULLET', +10687: 'CIRCLED BULLET', +10688: 'CIRCLED LESS-THAN', +10689: 'CIRCLED GREATER-THAN', +10690: 'CIRCLE WITH SMALL CIRCLE TO THE RIGHT', +10691: 'CIRCLE WITH TWO HORIZONTAL STROKES TO THE RIGHT', +10692: 'SQUARED RISING DIAGONAL SLASH', +10693: 'SQUARED FALLING DIAGONAL SLASH', +10694: 'SQUARED ASTERISK', +10695: 'SQUARED SMALL CIRCLE', +10696: 'SQUARED SQUARE', +10697: 'TWO JOINED SQUARES', +10698: 'TRIANGLE WITH DOT ABOVE', +10699: 'TRIANGLE WITH UNDERBAR', +10700: 'S IN TRIANGLE', +10701: 'TRIANGLE WITH SERIFS AT BOTTOM', +10702: 'RIGHT TRIANGLE ABOVE LEFT TRIANGLE', +10703: 'LEFT TRIANGLE BESIDE VERTICAL BAR', +10704: 'VERTICAL BAR BESIDE RIGHT TRIANGLE', +10705: 'BOWTIE WITH LEFT HALF BLACK', +10706: 'BOWTIE WITH RIGHT HALF BLACK', +10707: 'BLACK BOWTIE', +10708: 'TIMES WITH LEFT HALF BLACK', +10709: 'TIMES WITH RIGHT HALF BLACK', +10710: 'WHITE HOURGLASS', +10711: 'BLACK HOURGLASS', +10712: 'LEFT WIGGLY FENCE', +10713: 'RIGHT WIGGLY FENCE', +10714: 'LEFT DOUBLE WIGGLY FENCE', +10715: 'RIGHT DOUBLE WIGGLY FENCE', +10716: 'INCOMPLETE INFINITY', +10717: 'TIE OVER INFINITY', +10718: 'INFINITY NEGATED WITH VERTICAL BAR', +10719: 'DOUBLE-ENDED MULTIMAP', +10720: 'SQUARE WITH CONTOURED OUTLINE', +10721: 'INCREASES AS', +10722: 'SHUFFLE PRODUCT', +10723: 'EQUALS SIGN AND SLANTED PARALLEL', +10724: 'EQUALS SIGN AND SLANTED PARALLEL WITH TILDE ABOVE', +10725: 'IDENTICAL TO AND SLANTED PARALLEL', +10726: 'GLEICH STARK', +10727: 'THERMODYNAMIC', +10728: 'DOWN-POINTING TRIANGLE WITH LEFT HALF BLACK', +10729: 'DOWN-POINTING TRIANGLE WITH RIGHT HALF BLACK', +10730: 'BLACK DIAMOND WITH DOWN ARROW', +10731: 'BLACK LOZENGE', +10732: 'WHITE CIRCLE WITH DOWN ARROW', +10733: 'BLACK CIRCLE WITH DOWN ARROW', +10734: 'ERROR-BARRED WHITE SQUARE', +10735: 'ERROR-BARRED BLACK SQUARE', +10736: 'ERROR-BARRED WHITE DIAMOND', +10737: 'ERROR-BARRED BLACK DIAMOND', +10738: 'ERROR-BARRED WHITE CIRCLE', +10739: 'ERROR-BARRED BLACK CIRCLE', +10740: 'RULE-DELAYED', +10741: 'REVERSE SOLIDUS OPERATOR', +10742: 'SOLIDUS WITH OVERBAR', +10743: 'REVERSE SOLIDUS WITH HORIZONTAL STROKE', +10744: 'BIG SOLIDUS', +10745: 'BIG REVERSE SOLIDUS', +10746: 'DOUBLE PLUS', +10747: 'TRIPLE PLUS', +10748: 'LEFT-POINTING CURVED ANGLE BRACKET', +10749: 'RIGHT-POINTING CURVED ANGLE BRACKET', +10750: 'TINY', +10751: 'MINY', +10752: 'N-ARY CIRCLED DOT OPERATOR', +10753: 'N-ARY CIRCLED PLUS OPERATOR', +10754: 'N-ARY CIRCLED TIMES OPERATOR', +10755: 'N-ARY UNION OPERATOR WITH DOT', +10756: 'N-ARY UNION OPERATOR WITH PLUS', +10757: 'N-ARY SQUARE INTERSECTION OPERATOR', +10758: 'N-ARY SQUARE UNION OPERATOR', +10759: 'TWO LOGICAL AND OPERATOR', +10760: 'TWO LOGICAL OR OPERATOR', +10761: 'N-ARY TIMES OPERATOR', +10762: 'MODULO TWO SUM', +10763: 'SUMMATION WITH INTEGRAL', +10764: 'QUADRUPLE INTEGRAL OPERATOR', +10765: 'FINITE PART INTEGRAL', +10766: 'INTEGRAL WITH DOUBLE STROKE', +10767: 'INTEGRAL AVERAGE WITH SLASH', +10768: 'CIRCULATION FUNCTION', +10769: 'ANTICLOCKWISE INTEGRATION', +10770: 'LINE INTEGRATION WITH RECTANGULAR PATH AROUND POLE', +10771: 'LINE INTEGRATION WITH SEMICIRCULAR PATH AROUND POLE', +10772: 'LINE INTEGRATION NOT INCLUDING THE POLE', +10773: 'INTEGRAL AROUND A POINT OPERATOR', +10774: 'QUATERNION INTEGRAL OPERATOR', +10775: 'INTEGRAL WITH LEFTWARDS ARROW WITH HOOK', +10776: 'INTEGRAL WITH TIMES SIGN', +10777: 'INTEGRAL WITH INTERSECTION', +10778: 'INTEGRAL WITH UNION', +10779: 'INTEGRAL WITH OVERBAR', +10780: 'INTEGRAL WITH UNDERBAR', +10781: 'JOIN', +10782: 'LARGE LEFT TRIANGLE OPERATOR', +10783: 'Z NOTATION SCHEMA COMPOSITION', +10784: 'Z NOTATION SCHEMA PIPING', +10785: 'Z NOTATION SCHEMA PROJECTION', +10786: 'PLUS SIGN WITH SMALL CIRCLE ABOVE', +10787: 'PLUS SIGN WITH CIRCUMFLEX ACCENT ABOVE', +10788: 'PLUS SIGN WITH TILDE ABOVE', +10789: 'PLUS SIGN WITH DOT BELOW', +10790: 'PLUS SIGN WITH TILDE BELOW', +10791: 'PLUS SIGN WITH SUBSCRIPT TWO', +10792: 'PLUS SIGN WITH BLACK TRIANGLE', +10793: 'MINUS SIGN WITH COMMA ABOVE', +10794: 'MINUS SIGN WITH DOT BELOW', +10795: 'MINUS SIGN WITH FALLING DOTS', +10796: 'MINUS SIGN WITH RISING DOTS', +10797: 'PLUS SIGN IN LEFT HALF CIRCLE', +10798: 'PLUS SIGN IN RIGHT HALF CIRCLE', +10799: 'VECTOR OR CROSS PRODUCT', +10800: 'MULTIPLICATION SIGN WITH DOT ABOVE', +10801: 'MULTIPLICATION SIGN WITH UNDERBAR', +10802: 'SEMIDIRECT PRODUCT WITH BOTTOM CLOSED', +10803: 'SMASH PRODUCT', +10804: 'MULTIPLICATION SIGN IN LEFT HALF CIRCLE', +10805: 'MULTIPLICATION SIGN IN RIGHT HALF CIRCLE', +10806: 'CIRCLED MULTIPLICATION SIGN WITH CIRCUMFLEX ACCENT', +10807: 'MULTIPLICATION SIGN IN DOUBLE CIRCLE', +10808: 'CIRCLED DIVISION SIGN', +10809: 'PLUS SIGN IN TRIANGLE', +10810: 'MINUS SIGN IN TRIANGLE', +10811: 'MULTIPLICATION SIGN IN TRIANGLE', +10812: 'INTERIOR PRODUCT', +10813: 'RIGHTHAND INTERIOR PRODUCT', +10814: 'Z NOTATION RELATIONAL COMPOSITION', +10815: 'AMALGAMATION OR COPRODUCT', +10816: 'INTERSECTION WITH DOT', +10817: 'UNION WITH MINUS SIGN', +10818: 'UNION WITH OVERBAR', +10819: 'INTERSECTION WITH OVERBAR', +10820: 'INTERSECTION WITH LOGICAL AND', +10821: 'UNION WITH LOGICAL OR', +10822: 'UNION ABOVE INTERSECTION', +10823: 'INTERSECTION ABOVE UNION', +10824: 'UNION ABOVE BAR ABOVE INTERSECTION', +10825: 'INTERSECTION ABOVE BAR ABOVE UNION', +10826: 'UNION BESIDE AND JOINED WITH UNION', +10827: 'INTERSECTION BESIDE AND JOINED WITH INTERSECTION', +10828: 'CLOSED UNION WITH SERIFS', +10829: 'CLOSED INTERSECTION WITH SERIFS', +10830: 'DOUBLE SQUARE INTERSECTION', +10831: 'DOUBLE SQUARE UNION', +10832: 'CLOSED UNION WITH SERIFS AND SMASH PRODUCT', +10833: 'LOGICAL AND WITH DOT ABOVE', +10834: 'LOGICAL OR WITH DOT ABOVE', +10835: 'DOUBLE LOGICAL AND', +10836: 'DOUBLE LOGICAL OR', +10837: 'TWO INTERSECTING LOGICAL AND', +10838: 'TWO INTERSECTING LOGICAL OR', +10839: 'SLOPING LARGE OR', +10840: 'SLOPING LARGE AND', +10841: 'LOGICAL OR OVERLAPPING LOGICAL AND', +10842: 'LOGICAL AND WITH MIDDLE STEM', +10843: 'LOGICAL OR WITH MIDDLE STEM', +10844: 'LOGICAL AND WITH HORIZONTAL DASH', +10845: 'LOGICAL OR WITH HORIZONTAL DASH', +10846: 'LOGICAL AND WITH DOUBLE OVERBAR', +10847: 'LOGICAL AND WITH UNDERBAR', +10848: 'LOGICAL AND WITH DOUBLE UNDERBAR', +10849: 'SMALL VEE WITH UNDERBAR', +10850: 'LOGICAL OR WITH DOUBLE OVERBAR', +10851: 'LOGICAL OR WITH DOUBLE UNDERBAR', +10852: 'Z NOTATION DOMAIN ANTIRESTRICTION', +10853: 'Z NOTATION RANGE ANTIRESTRICTION', +10854: 'EQUALS SIGN WITH DOT BELOW', +10855: 'IDENTICAL WITH DOT ABOVE', +10856: 'TRIPLE HORIZONTAL BAR WITH DOUBLE VERTICAL STROKE', +10857: 'TRIPLE HORIZONTAL BAR WITH TRIPLE VERTICAL STROKE', +10858: 'TILDE OPERATOR WITH DOT ABOVE', +10859: 'TILDE OPERATOR WITH RISING DOTS', +10860: 'SIMILAR MINUS SIMILAR', +10861: 'CONGRUENT WITH DOT ABOVE', +10862: 'EQUALS WITH ASTERISK', +10863: 'ALMOST EQUAL TO WITH CIRCUMFLEX ACCENT', +10864: 'APPROXIMATELY EQUAL OR EQUAL TO', +10865: 'EQUALS SIGN ABOVE PLUS SIGN', +10866: 'PLUS SIGN ABOVE EQUALS SIGN', +10867: 'EQUALS SIGN ABOVE TILDE OPERATOR', +10868: 'DOUBLE COLON EQUAL', +10869: 'TWO CONSECUTIVE EQUALS SIGNS', +10870: 'THREE CONSECUTIVE EQUALS SIGNS', +10871: 'EQUALS SIGN WITH TWO DOTS ABOVE AND TWO DOTS BELOW', +10872: 'EQUIVALENT WITH FOUR DOTS ABOVE', +10873: 'LESS-THAN WITH CIRCLE INSIDE', +10874: 'GREATER-THAN WITH CIRCLE INSIDE', +10875: 'LESS-THAN WITH QUESTION MARK ABOVE', +10876: 'GREATER-THAN WITH QUESTION MARK ABOVE', +10877: 'LESS-THAN OR SLANTED EQUAL TO', +10878: 'GREATER-THAN OR SLANTED EQUAL TO', +10879: 'LESS-THAN OR SLANTED EQUAL TO WITH DOT INSIDE', +10880: 'GREATER-THAN OR SLANTED EQUAL TO WITH DOT INSIDE', +10881: 'LESS-THAN OR SLANTED EQUAL TO WITH DOT ABOVE', +10882: 'GREATER-THAN OR SLANTED EQUAL TO WITH DOT ABOVE', +10883: 'LESS-THAN OR SLANTED EQUAL TO WITH DOT ABOVE RIGHT', +10884: 'GREATER-THAN OR SLANTED EQUAL TO WITH DOT ABOVE LEFT', +10885: 'LESS-THAN OR APPROXIMATE', +10886: 'GREATER-THAN OR APPROXIMATE', +10887: 'LESS-THAN AND SINGLE-LINE NOT EQUAL TO', +10888: 'GREATER-THAN AND SINGLE-LINE NOT EQUAL TO', +10889: 'LESS-THAN AND NOT APPROXIMATE', +10890: 'GREATER-THAN AND NOT APPROXIMATE', +10891: 'LESS-THAN ABOVE DOUBLE-LINE EQUAL ABOVE GREATER-THAN', +10892: 'GREATER-THAN ABOVE DOUBLE-LINE EQUAL ABOVE LESS-THAN', +10893: 'LESS-THAN ABOVE SIMILAR OR EQUAL', +10894: 'GREATER-THAN ABOVE SIMILAR OR EQUAL', +10895: 'LESS-THAN ABOVE SIMILAR ABOVE GREATER-THAN', +10896: 'GREATER-THAN ABOVE SIMILAR ABOVE LESS-THAN', +10897: 'LESS-THAN ABOVE GREATER-THAN ABOVE DOUBLE-LINE EQUAL', +10898: 'GREATER-THAN ABOVE LESS-THAN ABOVE DOUBLE-LINE EQUAL', +10899: 'LESS-THAN ABOVE SLANTED EQUAL ABOVE GREATER-THAN ABOVE SLANTED EQUAL', +10900: 'GREATER-THAN ABOVE SLANTED EQUAL ABOVE LESS-THAN ABOVE SLANTED EQUAL', +10901: 'SLANTED EQUAL TO OR LESS-THAN', +10902: 'SLANTED EQUAL TO OR GREATER-THAN', +10903: 'SLANTED EQUAL TO OR LESS-THAN WITH DOT INSIDE', +10904: 'SLANTED EQUAL TO OR GREATER-THAN WITH DOT INSIDE', +10905: 'DOUBLE-LINE EQUAL TO OR LESS-THAN', +10906: 'DOUBLE-LINE EQUAL TO OR GREATER-THAN', +10907: 'DOUBLE-LINE SLANTED EQUAL TO OR LESS-THAN', +10908: 'DOUBLE-LINE SLANTED EQUAL TO OR GREATER-THAN', +10909: 'SIMILAR OR LESS-THAN', +10910: 'SIMILAR OR GREATER-THAN', +10911: 'SIMILAR ABOVE LESS-THAN ABOVE EQUALS SIGN', +10912: 'SIMILAR ABOVE GREATER-THAN ABOVE EQUALS SIGN', +10913: 'DOUBLE NESTED LESS-THAN', +10914: 'DOUBLE NESTED GREATER-THAN', +10915: 'DOUBLE NESTED LESS-THAN WITH UNDERBAR', +10916: 'GREATER-THAN OVERLAPPING LESS-THAN', +10917: 'GREATER-THAN BESIDE LESS-THAN', +10918: 'LESS-THAN CLOSED BY CURVE', +10919: 'GREATER-THAN CLOSED BY CURVE', +10920: 'LESS-THAN CLOSED BY CURVE ABOVE SLANTED EQUAL', +10921: 'GREATER-THAN CLOSED BY CURVE ABOVE SLANTED EQUAL', +10922: 'SMALLER THAN', +10923: 'LARGER THAN', +10924: 'SMALLER THAN OR EQUAL TO', +10925: 'LARGER THAN OR EQUAL TO', +10926: 'EQUALS SIGN WITH BUMPY ABOVE', +10927: 'PRECEDES ABOVE SINGLE-LINE EQUALS SIGN', +10928: 'SUCCEEDS ABOVE SINGLE-LINE EQUALS SIGN', +10929: 'PRECEDES ABOVE SINGLE-LINE NOT EQUAL TO', +10930: 'SUCCEEDS ABOVE SINGLE-LINE NOT EQUAL TO', +10931: 'PRECEDES ABOVE EQUALS SIGN', +10932: 'SUCCEEDS ABOVE EQUALS SIGN', +10933: 'PRECEDES ABOVE NOT EQUAL TO', +10934: 'SUCCEEDS ABOVE NOT EQUAL TO', +10935: 'PRECEDES ABOVE ALMOST EQUAL TO', +10936: 'SUCCEEDS ABOVE ALMOST EQUAL TO', +10937: 'PRECEDES ABOVE NOT ALMOST EQUAL TO', +10938: 'SUCCEEDS ABOVE NOT ALMOST EQUAL TO', +10939: 'DOUBLE PRECEDES', +10940: 'DOUBLE SUCCEEDS', +10941: 'SUBSET WITH DOT', +10942: 'SUPERSET WITH DOT', +10943: 'SUBSET WITH PLUS SIGN BELOW', +10944: 'SUPERSET WITH PLUS SIGN BELOW', +10945: 'SUBSET WITH MULTIPLICATION SIGN BELOW', +10946: 'SUPERSET WITH MULTIPLICATION SIGN BELOW', +10947: 'SUBSET OF OR EQUAL TO WITH DOT ABOVE', +10948: 'SUPERSET OF OR EQUAL TO WITH DOT ABOVE', +10949: 'SUBSET OF ABOVE EQUALS SIGN', +10950: 'SUPERSET OF ABOVE EQUALS SIGN', +10951: 'SUBSET OF ABOVE TILDE OPERATOR', +10952: 'SUPERSET OF ABOVE TILDE OPERATOR', +10953: 'SUBSET OF ABOVE ALMOST EQUAL TO', +10954: 'SUPERSET OF ABOVE ALMOST EQUAL TO', +10955: 'SUBSET OF ABOVE NOT EQUAL TO', +10956: 'SUPERSET OF ABOVE NOT EQUAL TO', +10957: 'SQUARE LEFT OPEN BOX OPERATOR', +10958: 'SQUARE RIGHT OPEN BOX OPERATOR', +10959: 'CLOSED SUBSET', +10960: 'CLOSED SUPERSET', +10961: 'CLOSED SUBSET OR EQUAL TO', +10962: 'CLOSED SUPERSET OR EQUAL TO', +10963: 'SUBSET ABOVE SUPERSET', +10964: 'SUPERSET ABOVE SUBSET', +10965: 'SUBSET ABOVE SUBSET', +10966: 'SUPERSET ABOVE SUPERSET', +10967: 'SUPERSET BESIDE SUBSET', +10968: 'SUPERSET BESIDE AND JOINED BY DASH WITH SUBSET', +10969: 'ELEMENT OF OPENING DOWNWARDS', +10970: 'PITCHFORK WITH TEE TOP', +10971: 'TRANSVERSAL INTERSECTION', +10972: 'FORKING', +10973: 'NONFORKING', +10974: 'SHORT LEFT TACK', +10975: 'SHORT DOWN TACK', +10976: 'SHORT UP TACK', +10977: 'PERPENDICULAR WITH S', +10978: 'VERTICAL BAR TRIPLE RIGHT TURNSTILE', +10979: 'DOUBLE VERTICAL BAR LEFT TURNSTILE', +10980: 'VERTICAL BAR DOUBLE LEFT TURNSTILE', +10981: 'DOUBLE VERTICAL BAR DOUBLE LEFT TURNSTILE', +10982: 'LONG DASH FROM LEFT MEMBER OF DOUBLE VERTICAL', +10983: 'SHORT DOWN TACK WITH OVERBAR', +10984: 'SHORT UP TACK WITH UNDERBAR', +10985: 'SHORT UP TACK ABOVE SHORT DOWN TACK', +10986: 'DOUBLE DOWN TACK', +10987: 'DOUBLE UP TACK', +10988: 'DOUBLE STROKE NOT SIGN', +10989: 'REVERSED DOUBLE STROKE NOT SIGN', +10990: 'DOES NOT DIVIDE WITH REVERSED NEGATION SLASH', +10991: 'VERTICAL LINE WITH CIRCLE ABOVE', +10992: 'VERTICAL LINE WITH CIRCLE BELOW', +10993: 'DOWN TACK WITH CIRCLE BELOW', +10994: 'PARALLEL WITH HORIZONTAL STROKE', +10995: 'PARALLEL WITH TILDE OPERATOR', +10996: 'TRIPLE VERTICAL BAR BINARY RELATION', +10997: 'TRIPLE VERTICAL BAR WITH HORIZONTAL STROKE', +10998: 'TRIPLE COLON OPERATOR', +10999: 'TRIPLE NESTED LESS-THAN', +11000: 'TRIPLE NESTED GREATER-THAN', +11001: 'DOUBLE-LINE SLANTED LESS-THAN OR EQUAL TO', +11002: 'DOUBLE-LINE SLANTED GREATER-THAN OR EQUAL TO', +11003: 'TRIPLE SOLIDUS BINARY RELATION', +11004: 'LARGE TRIPLE VERTICAL BAR OPERATOR', +11005: 'DOUBLE SOLIDUS OPERATOR', +11006: 'WHITE VERTICAL BAR', +11007: 'N-ARY WHITE VERTICAL BAR', +11904: 'CJK RADICAL REPEAT', +11905: 'CJK RADICAL CLIFF', +11906: 'CJK RADICAL SECOND ONE', +11907: 'CJK RADICAL SECOND TWO', +11908: 'CJK RADICAL SECOND THREE', +11909: 'CJK RADICAL PERSON', +11910: 'CJK RADICAL BOX', +11911: 'CJK RADICAL TABLE', +11912: 'CJK RADICAL KNIFE ONE', +11913: 'CJK RADICAL KNIFE TWO', +11914: 'CJK RADICAL DIVINATION', +11915: 'CJK RADICAL SEAL', +11916: 'CJK RADICAL SMALL ONE', +11917: 'CJK RADICAL SMALL TWO', +11918: 'CJK RADICAL LAME ONE', +11919: 'CJK RADICAL LAME TWO', +11920: 'CJK RADICAL LAME THREE', +11921: 'CJK RADICAL LAME FOUR', +11922: 'CJK RADICAL SNAKE', +11923: 'CJK RADICAL THREAD', +11924: 'CJK RADICAL SNOUT ONE', +11925: 'CJK RADICAL SNOUT TWO', +11926: 'CJK RADICAL HEART ONE', +11927: 'CJK RADICAL HEART TWO', +11928: 'CJK RADICAL HAND', +11929: 'CJK RADICAL RAP', +11931: 'CJK RADICAL CHOKE', +11932: 'CJK RADICAL SUN', +11933: 'CJK RADICAL MOON', +11934: 'CJK RADICAL DEATH', +11935: 'CJK RADICAL MOTHER', +11936: 'CJK RADICAL CIVILIAN', +11937: 'CJK RADICAL WATER ONE', +11938: 'CJK RADICAL WATER TWO', +11939: 'CJK RADICAL FIRE', +11940: 'CJK RADICAL PAW ONE', +11941: 'CJK RADICAL PAW TWO', +11942: 'CJK RADICAL SIMPLIFIED HALF TREE TRUNK', +11943: 'CJK RADICAL COW', +11944: 'CJK RADICAL DOG', +11945: 'CJK RADICAL JADE', +11946: 'CJK RADICAL BOLT OF CLOTH', +11947: 'CJK RADICAL EYE', +11948: 'CJK RADICAL SPIRIT ONE', +11949: 'CJK RADICAL SPIRIT TWO', +11950: 'CJK RADICAL BAMBOO', +11951: 'CJK RADICAL SILK', +11952: 'CJK RADICAL C-SIMPLIFIED SILK', +11953: 'CJK RADICAL NET ONE', +11954: 'CJK RADICAL NET TWO', +11955: 'CJK RADICAL NET THREE', +11956: 'CJK RADICAL NET FOUR', +11957: 'CJK RADICAL MESH', +11958: 'CJK RADICAL SHEEP', +11959: 'CJK RADICAL RAM', +11960: 'CJK RADICAL EWE', +11961: 'CJK RADICAL OLD', +11962: 'CJK RADICAL BRUSH ONE', +11963: 'CJK RADICAL BRUSH TWO', +11964: 'CJK RADICAL MEAT', +11965: 'CJK RADICAL MORTAR', +11966: 'CJK RADICAL GRASS ONE', +11967: 'CJK RADICAL GRASS TWO', +11968: 'CJK RADICAL GRASS THREE', +11969: 'CJK RADICAL TIGER', +11970: 'CJK RADICAL CLOTHES', +11971: 'CJK RADICAL WEST ONE', +11972: 'CJK RADICAL WEST TWO', +11973: 'CJK RADICAL C-SIMPLIFIED SEE', +11974: 'CJK RADICAL SIMPLIFIED HORN', +11975: 'CJK RADICAL HORN', +11976: 'CJK RADICAL C-SIMPLIFIED SPEECH', +11977: 'CJK RADICAL C-SIMPLIFIED SHELL', +11978: 'CJK RADICAL FOOT', +11979: 'CJK RADICAL C-SIMPLIFIED CART', +11980: 'CJK RADICAL SIMPLIFIED WALK', +11981: 'CJK RADICAL WALK ONE', +11982: 'CJK RADICAL WALK TWO', +11983: 'CJK RADICAL CITY', +11984: 'CJK RADICAL C-SIMPLIFIED GOLD', +11985: 'CJK RADICAL LONG ONE', +11986: 'CJK RADICAL LONG TWO', +11987: 'CJK RADICAL C-SIMPLIFIED LONG', +11988: 'CJK RADICAL C-SIMPLIFIED GATE', +11989: 'CJK RADICAL MOUND ONE', +11990: 'CJK RADICAL MOUND TWO', +11991: 'CJK RADICAL RAIN', +11992: 'CJK RADICAL BLUE', +11993: 'CJK RADICAL C-SIMPLIFIED TANNED LEATHER', +11994: 'CJK RADICAL C-SIMPLIFIED LEAF', +11995: 'CJK RADICAL C-SIMPLIFIED WIND', +11996: 'CJK RADICAL C-SIMPLIFIED FLY', +11997: 'CJK RADICAL EAT ONE', +11998: 'CJK RADICAL EAT TWO', +11999: 'CJK RADICAL EAT THREE', +12000: 'CJK RADICAL C-SIMPLIFIED EAT', +12001: 'CJK RADICAL HEAD', +12002: 'CJK RADICAL C-SIMPLIFIED HORSE', +12003: 'CJK RADICAL BONE', +12004: 'CJK RADICAL GHOST', +12005: 'CJK RADICAL C-SIMPLIFIED FISH', +12006: 'CJK RADICAL C-SIMPLIFIED BIRD', +12007: 'CJK RADICAL C-SIMPLIFIED SALT', +12008: 'CJK RADICAL SIMPLIFIED WHEAT', +12009: 'CJK RADICAL SIMPLIFIED YELLOW', +12010: 'CJK RADICAL C-SIMPLIFIED FROG', +12011: 'CJK RADICAL J-SIMPLIFIED EVEN', +12012: 'CJK RADICAL C-SIMPLIFIED EVEN', +12013: 'CJK RADICAL J-SIMPLIFIED TOOTH', +12014: 'CJK RADICAL C-SIMPLIFIED TOOTH', +12015: 'CJK RADICAL J-SIMPLIFIED DRAGON', +12016: 'CJK RADICAL C-SIMPLIFIED DRAGON', +12017: 'CJK RADICAL TURTLE', +12018: 'CJK RADICAL J-SIMPLIFIED TURTLE', +12019: 'CJK RADICAL C-SIMPLIFIED TURTLE', +12032: 'KANGXI RADICAL ONE', +12033: 'KANGXI RADICAL LINE', +12034: 'KANGXI RADICAL DOT', +12035: 'KANGXI RADICAL SLASH', +12036: 'KANGXI RADICAL SECOND', +12037: 'KANGXI RADICAL HOOK', +12038: 'KANGXI RADICAL TWO', +12039: 'KANGXI RADICAL LID', +12040: 'KANGXI RADICAL MAN', +12041: 'KANGXI RADICAL LEGS', +12042: 'KANGXI RADICAL ENTER', +12043: 'KANGXI RADICAL EIGHT', +12044: 'KANGXI RADICAL DOWN BOX', +12045: 'KANGXI RADICAL COVER', +12046: 'KANGXI RADICAL ICE', +12047: 'KANGXI RADICAL TABLE', +12048: 'KANGXI RADICAL OPEN BOX', +12049: 'KANGXI RADICAL KNIFE', +12050: 'KANGXI RADICAL POWER', +12051: 'KANGXI RADICAL WRAP', +12052: 'KANGXI RADICAL SPOON', +12053: 'KANGXI RADICAL RIGHT OPEN BOX', +12054: 'KANGXI RADICAL HIDING ENCLOSURE', +12055: 'KANGXI RADICAL TEN', +12056: 'KANGXI RADICAL DIVINATION', +12057: 'KANGXI RADICAL SEAL', +12058: 'KANGXI RADICAL CLIFF', +12059: 'KANGXI RADICAL PRIVATE', +12060: 'KANGXI RADICAL AGAIN', +12061: 'KANGXI RADICAL MOUTH', +12062: 'KANGXI RADICAL ENCLOSURE', +12063: 'KANGXI RADICAL EARTH', +12064: 'KANGXI RADICAL SCHOLAR', +12065: 'KANGXI RADICAL GO', +12066: 'KANGXI RADICAL GO SLOWLY', +12067: 'KANGXI RADICAL EVENING', +12068: 'KANGXI RADICAL BIG', +12069: 'KANGXI RADICAL WOMAN', +12070: 'KANGXI RADICAL CHILD', +12071: 'KANGXI RADICAL ROOF', +12072: 'KANGXI RADICAL INCH', +12073: 'KANGXI RADICAL SMALL', +12074: 'KANGXI RADICAL LAME', +12075: 'KANGXI RADICAL CORPSE', +12076: 'KANGXI RADICAL SPROUT', +12077: 'KANGXI RADICAL MOUNTAIN', +12078: 'KANGXI RADICAL RIVER', +12079: 'KANGXI RADICAL WORK', +12080: 'KANGXI RADICAL ONESELF', +12081: 'KANGXI RADICAL TURBAN', +12082: 'KANGXI RADICAL DRY', +12083: 'KANGXI RADICAL SHORT THREAD', +12084: 'KANGXI RADICAL DOTTED CLIFF', +12085: 'KANGXI RADICAL LONG STRIDE', +12086: 'KANGXI RADICAL TWO HANDS', +12087: 'KANGXI RADICAL SHOOT', +12088: 'KANGXI RADICAL BOW', +12089: 'KANGXI RADICAL SNOUT', +12090: 'KANGXI RADICAL BRISTLE', +12091: 'KANGXI RADICAL STEP', +12092: 'KANGXI RADICAL HEART', +12093: 'KANGXI RADICAL HALBERD', +12094: 'KANGXI RADICAL DOOR', +12095: 'KANGXI RADICAL HAND', +12096: 'KANGXI RADICAL BRANCH', +12097: 'KANGXI RADICAL RAP', +12098: 'KANGXI RADICAL SCRIPT', +12099: 'KANGXI RADICAL DIPPER', +12100: 'KANGXI RADICAL AXE', +12101: 'KANGXI RADICAL SQUARE', +12102: 'KANGXI RADICAL NOT', +12103: 'KANGXI RADICAL SUN', +12104: 'KANGXI RADICAL SAY', +12105: 'KANGXI RADICAL MOON', +12106: 'KANGXI RADICAL TREE', +12107: 'KANGXI RADICAL LACK', +12108: 'KANGXI RADICAL STOP', +12109: 'KANGXI RADICAL DEATH', +12110: 'KANGXI RADICAL WEAPON', +12111: 'KANGXI RADICAL DO NOT', +12112: 'KANGXI RADICAL COMPARE', +12113: 'KANGXI RADICAL FUR', +12114: 'KANGXI RADICAL CLAN', +12115: 'KANGXI RADICAL STEAM', +12116: 'KANGXI RADICAL WATER', +12117: 'KANGXI RADICAL FIRE', +12118: 'KANGXI RADICAL CLAW', +12119: 'KANGXI RADICAL FATHER', +12120: 'KANGXI RADICAL DOUBLE X', +12121: 'KANGXI RADICAL HALF TREE TRUNK', +12122: 'KANGXI RADICAL SLICE', +12123: 'KANGXI RADICAL FANG', +12124: 'KANGXI RADICAL COW', +12125: 'KANGXI RADICAL DOG', +12126: 'KANGXI RADICAL PROFOUND', +12127: 'KANGXI RADICAL JADE', +12128: 'KANGXI RADICAL MELON', +12129: 'KANGXI RADICAL TILE', +12130: 'KANGXI RADICAL SWEET', +12131: 'KANGXI RADICAL LIFE', +12132: 'KANGXI RADICAL USE', +12133: 'KANGXI RADICAL FIELD', +12134: 'KANGXI RADICAL BOLT OF CLOTH', +12135: 'KANGXI RADICAL SICKNESS', +12136: 'KANGXI RADICAL DOTTED TENT', +12137: 'KANGXI RADICAL WHITE', +12138: 'KANGXI RADICAL SKIN', +12139: 'KANGXI RADICAL DISH', +12140: 'KANGXI RADICAL EYE', +12141: 'KANGXI RADICAL SPEAR', +12142: 'KANGXI RADICAL ARROW', +12143: 'KANGXI RADICAL STONE', +12144: 'KANGXI RADICAL SPIRIT', +12145: 'KANGXI RADICAL TRACK', +12146: 'KANGXI RADICAL GRAIN', +12147: 'KANGXI RADICAL CAVE', +12148: 'KANGXI RADICAL STAND', +12149: 'KANGXI RADICAL BAMBOO', +12150: 'KANGXI RADICAL RICE', +12151: 'KANGXI RADICAL SILK', +12152: 'KANGXI RADICAL JAR', +12153: 'KANGXI RADICAL NET', +12154: 'KANGXI RADICAL SHEEP', +12155: 'KANGXI RADICAL FEATHER', +12156: 'KANGXI RADICAL OLD', +12157: 'KANGXI RADICAL AND', +12158: 'KANGXI RADICAL PLOW', +12159: 'KANGXI RADICAL EAR', +12160: 'KANGXI RADICAL BRUSH', +12161: 'KANGXI RADICAL MEAT', +12162: 'KANGXI RADICAL MINISTER', +12163: 'KANGXI RADICAL SELF', +12164: 'KANGXI RADICAL ARRIVE', +12165: 'KANGXI RADICAL MORTAR', +12166: 'KANGXI RADICAL TONGUE', +12167: 'KANGXI RADICAL OPPOSE', +12168: 'KANGXI RADICAL BOAT', +12169: 'KANGXI RADICAL STOPPING', +12170: 'KANGXI RADICAL COLOR', +12171: 'KANGXI RADICAL GRASS', +12172: 'KANGXI RADICAL TIGER', +12173: 'KANGXI RADICAL INSECT', +12174: 'KANGXI RADICAL BLOOD', +12175: 'KANGXI RADICAL WALK ENCLOSURE', +12176: 'KANGXI RADICAL CLOTHES', +12177: 'KANGXI RADICAL WEST', +12178: 'KANGXI RADICAL SEE', +12179: 'KANGXI RADICAL HORN', +12180: 'KANGXI RADICAL SPEECH', +12181: 'KANGXI RADICAL VALLEY', +12182: 'KANGXI RADICAL BEAN', +12183: 'KANGXI RADICAL PIG', +12184: 'KANGXI RADICAL BADGER', +12185: 'KANGXI RADICAL SHELL', +12186: 'KANGXI RADICAL RED', +12187: 'KANGXI RADICAL RUN', +12188: 'KANGXI RADICAL FOOT', +12189: 'KANGXI RADICAL BODY', +12190: 'KANGXI RADICAL CART', +12191: 'KANGXI RADICAL BITTER', +12192: 'KANGXI RADICAL MORNING', +12193: 'KANGXI RADICAL WALK', +12194: 'KANGXI RADICAL CITY', +12195: 'KANGXI RADICAL WINE', +12196: 'KANGXI RADICAL DISTINGUISH', +12197: 'KANGXI RADICAL VILLAGE', +12198: 'KANGXI RADICAL GOLD', +12199: 'KANGXI RADICAL LONG', +12200: 'KANGXI RADICAL GATE', +12201: 'KANGXI RADICAL MOUND', +12202: 'KANGXI RADICAL SLAVE', +12203: 'KANGXI RADICAL SHORT TAILED BIRD', +12204: 'KANGXI RADICAL RAIN', +12205: 'KANGXI RADICAL BLUE', +12206: 'KANGXI RADICAL WRONG', +12207: 'KANGXI RADICAL FACE', +12208: 'KANGXI RADICAL LEATHER', +12209: 'KANGXI RADICAL TANNED LEATHER', +12210: 'KANGXI RADICAL LEEK', +12211: 'KANGXI RADICAL SOUND', +12212: 'KANGXI RADICAL LEAF', +12213: 'KANGXI RADICAL WIND', +12214: 'KANGXI RADICAL FLY', +12215: 'KANGXI RADICAL EAT', +12216: 'KANGXI RADICAL HEAD', +12217: 'KANGXI RADICAL FRAGRANT', +12218: 'KANGXI RADICAL HORSE', +12219: 'KANGXI RADICAL BONE', +12220: 'KANGXI RADICAL TALL', +12221: 'KANGXI RADICAL HAIR', +12222: 'KANGXI RADICAL FIGHT', +12223: 'KANGXI RADICAL SACRIFICIAL WINE', +12224: 'KANGXI RADICAL CAULDRON', +12225: 'KANGXI RADICAL GHOST', +12226: 'KANGXI RADICAL FISH', +12227: 'KANGXI RADICAL BIRD', +12228: 'KANGXI RADICAL SALT', +12229: 'KANGXI RADICAL DEER', +12230: 'KANGXI RADICAL WHEAT', +12231: 'KANGXI RADICAL HEMP', +12232: 'KANGXI RADICAL YELLOW', +12233: 'KANGXI RADICAL MILLET', +12234: 'KANGXI RADICAL BLACK', +12235: 'KANGXI RADICAL EMBROIDERY', +12236: 'KANGXI RADICAL FROG', +12237: 'KANGXI RADICAL TRIPOD', +12238: 'KANGXI RADICAL DRUM', +12239: 'KANGXI RADICAL RAT', +12240: 'KANGXI RADICAL NOSE', +12241: 'KANGXI RADICAL EVEN', +12242: 'KANGXI RADICAL TOOTH', +12243: 'KANGXI RADICAL DRAGON', +12244: 'KANGXI RADICAL TURTLE', +12245: 'KANGXI RADICAL FLUTE', +12272: 'IDEOGRAPHIC DESCRIPTION CHARACTER LEFT TO RIGHT', +12273: 'IDEOGRAPHIC DESCRIPTION CHARACTER ABOVE TO BELOW', +12274: 'IDEOGRAPHIC DESCRIPTION CHARACTER LEFT TO MIDDLE AND RIGHT', +12275: 'IDEOGRAPHIC DESCRIPTION CHARACTER ABOVE TO MIDDLE AND BELOW', +12276: 'IDEOGRAPHIC DESCRIPTION CHARACTER FULL SURROUND', +12277: 'IDEOGRAPHIC DESCRIPTION CHARACTER SURROUND FROM ABOVE', +12278: 'IDEOGRAPHIC DESCRIPTION CHARACTER SURROUND FROM BELOW', +12279: 'IDEOGRAPHIC DESCRIPTION CHARACTER SURROUND FROM LEFT', +12280: 'IDEOGRAPHIC DESCRIPTION CHARACTER SURROUND FROM UPPER LEFT', +12281: 'IDEOGRAPHIC DESCRIPTION CHARACTER SURROUND FROM UPPER RIGHT', +12282: 'IDEOGRAPHIC DESCRIPTION CHARACTER SURROUND FROM LOWER LEFT', +12283: 'IDEOGRAPHIC DESCRIPTION CHARACTER OVERLAID', +12288: 'IDEOGRAPHIC SPACE', +12289: 'IDEOGRAPHIC COMMA', +12290: 'IDEOGRAPHIC FULL STOP', +12291: 'DITTO MARK', +12292: 'JAPANESE INDUSTRIAL STANDARD SYMBOL', +12293: 'IDEOGRAPHIC ITERATION MARK', +12294: 'IDEOGRAPHIC CLOSING MARK', +12295: 'IDEOGRAPHIC NUMBER ZERO', +12296: 'LEFT ANGLE BRACKET', +12297: 'RIGHT ANGLE BRACKET', +12298: 'LEFT DOUBLE ANGLE BRACKET', +12299: 'RIGHT DOUBLE ANGLE BRACKET', +12300: 'LEFT CORNER BRACKET', +12301: 'RIGHT CORNER BRACKET', +12302: 'LEFT WHITE CORNER BRACKET', +12303: 'RIGHT WHITE CORNER BRACKET', +12304: 'LEFT BLACK LENTICULAR BRACKET', +12305: 'RIGHT BLACK LENTICULAR BRACKET', +12306: 'POSTAL MARK', +12307: 'GETA MARK', +12308: 'LEFT TORTOISE SHELL BRACKET', +12309: 'RIGHT TORTOISE SHELL BRACKET', +12310: 'LEFT WHITE LENTICULAR BRACKET', +12311: 'RIGHT WHITE LENTICULAR BRACKET', +12312: 'LEFT WHITE TORTOISE SHELL BRACKET', +12313: 'RIGHT WHITE TORTOISE SHELL BRACKET', +12314: 'LEFT WHITE SQUARE BRACKET', +12315: 'RIGHT WHITE SQUARE BRACKET', +12316: 'WAVE DASH', +12317: 'REVERSED DOUBLE PRIME QUOTATION MARK', +12318: 'DOUBLE PRIME QUOTATION MARK', +12319: 'LOW DOUBLE PRIME QUOTATION MARK', +12320: 'POSTAL MARK FACE', +12321: 'HANGZHOU NUMERAL ONE', +12322: 'HANGZHOU NUMERAL TWO', +12323: 'HANGZHOU NUMERAL THREE', +12324: 'HANGZHOU NUMERAL FOUR', +12325: 'HANGZHOU NUMERAL FIVE', +12326: 'HANGZHOU NUMERAL SIX', +12327: 'HANGZHOU NUMERAL SEVEN', +12328: 'HANGZHOU NUMERAL EIGHT', +12329: 'HANGZHOU NUMERAL NINE', +12330: 'IDEOGRAPHIC LEVEL TONE MARK', +12331: 'IDEOGRAPHIC RISING TONE MARK', +12332: 'IDEOGRAPHIC DEPARTING TONE MARK', +12333: 'IDEOGRAPHIC ENTERING TONE MARK', +12334: 'HANGUL SINGLE DOT TONE MARK', +12335: 'HANGUL DOUBLE DOT TONE MARK', +12336: 'WAVY DASH', +12337: 'VERTICAL KANA REPEAT MARK', +12338: 'VERTICAL KANA REPEAT WITH VOICED SOUND MARK', +12339: 'VERTICAL KANA REPEAT MARK UPPER HALF', +12340: 'VERTICAL KANA REPEAT WITH VOICED SOUND MARK UPPER HALF', +12341: 'VERTICAL KANA REPEAT MARK LOWER HALF', +12342: 'CIRCLED POSTAL MARK', +12343: 'IDEOGRAPHIC TELEGRAPH LINE FEED SEPARATOR SYMBOL', +12344: 'HANGZHOU NUMERAL TEN', +12345: 'HANGZHOU NUMERAL TWENTY', +12346: 'HANGZHOU NUMERAL THIRTY', +12347: 'VERTICAL IDEOGRAPHIC ITERATION MARK', +12348: 'MASU MARK', +12349: 'PART ALTERNATION MARK', +12350: 'IDEOGRAPHIC VARIATION INDICATOR', +12351: 'IDEOGRAPHIC HALF FILL SPACE', +12353: 'HIRAGANA LETTER SMALL A', +12354: 'HIRAGANA LETTER A', +12355: 'HIRAGANA LETTER SMALL I', +12356: 'HIRAGANA LETTER I', +12357: 'HIRAGANA LETTER SMALL U', +12358: 'HIRAGANA LETTER U', +12359: 'HIRAGANA LETTER SMALL E', +12360: 'HIRAGANA LETTER E', +12361: 'HIRAGANA LETTER SMALL O', +12362: 'HIRAGANA LETTER O', +12363: 'HIRAGANA LETTER KA', +12364: 'HIRAGANA LETTER GA', +12365: 'HIRAGANA LETTER KI', +12366: 'HIRAGANA LETTER GI', +12367: 'HIRAGANA LETTER KU', +12368: 'HIRAGANA LETTER GU', +12369: 'HIRAGANA LETTER KE', +12370: 'HIRAGANA LETTER GE', +12371: 'HIRAGANA LETTER KO', +12372: 'HIRAGANA LETTER GO', +12373: 'HIRAGANA LETTER SA', +12374: 'HIRAGANA LETTER ZA', +12375: 'HIRAGANA LETTER SI', +12376: 'HIRAGANA LETTER ZI', +12377: 'HIRAGANA LETTER SU', +12378: 'HIRAGANA LETTER ZU', +12379: 'HIRAGANA LETTER SE', +12380: 'HIRAGANA LETTER ZE', +12381: 'HIRAGANA LETTER SO', +12382: 'HIRAGANA LETTER ZO', +12383: 'HIRAGANA LETTER TA', +12384: 'HIRAGANA LETTER DA', +12385: 'HIRAGANA LETTER TI', +12386: 'HIRAGANA LETTER DI', +12387: 'HIRAGANA LETTER SMALL TU', +12388: 'HIRAGANA LETTER TU', +12389: 'HIRAGANA LETTER DU', +12390: 'HIRAGANA LETTER TE', +12391: 'HIRAGANA LETTER DE', +12392: 'HIRAGANA LETTER TO', +12393: 'HIRAGANA LETTER DO', +12394: 'HIRAGANA LETTER NA', +12395: 'HIRAGANA LETTER NI', +12396: 'HIRAGANA LETTER NU', +12397: 'HIRAGANA LETTER NE', +12398: 'HIRAGANA LETTER NO', +12399: 'HIRAGANA LETTER HA', +12400: 'HIRAGANA LETTER BA', +12401: 'HIRAGANA LETTER PA', +12402: 'HIRAGANA LETTER HI', +12403: 'HIRAGANA LETTER BI', +12404: 'HIRAGANA LETTER PI', +12405: 'HIRAGANA LETTER HU', +12406: 'HIRAGANA LETTER BU', +12407: 'HIRAGANA LETTER PU', +12408: 'HIRAGANA LETTER HE', +12409: 'HIRAGANA LETTER BE', +12410: 'HIRAGANA LETTER PE', +12411: 'HIRAGANA LETTER HO', +12412: 'HIRAGANA LETTER BO', +12413: 'HIRAGANA LETTER PO', +12414: 'HIRAGANA LETTER MA', +12415: 'HIRAGANA LETTER MI', +12416: 'HIRAGANA LETTER MU', +12417: 'HIRAGANA LETTER ME', +12418: 'HIRAGANA LETTER MO', +12419: 'HIRAGANA LETTER SMALL YA', +12420: 'HIRAGANA LETTER YA', +12421: 'HIRAGANA LETTER SMALL YU', +12422: 'HIRAGANA LETTER YU', +12423: 'HIRAGANA LETTER SMALL YO', +12424: 'HIRAGANA LETTER YO', +12425: 'HIRAGANA LETTER RA', +12426: 'HIRAGANA LETTER RI', +12427: 'HIRAGANA LETTER RU', +12428: 'HIRAGANA LETTER RE', +12429: 'HIRAGANA LETTER RO', +12430: 'HIRAGANA LETTER SMALL WA', +12431: 'HIRAGANA LETTER WA', +12432: 'HIRAGANA LETTER WI', +12433: 'HIRAGANA LETTER WE', +12434: 'HIRAGANA LETTER WO', +12435: 'HIRAGANA LETTER N', +12436: 'HIRAGANA LETTER VU', +12437: 'HIRAGANA LETTER SMALL KA', +12438: 'HIRAGANA LETTER SMALL KE', +12441: 'COMBINING KATAKANA-HIRAGANA VOICED SOUND MARK', +12442: 'COMBINING KATAKANA-HIRAGANA SEMI-VOICED SOUND MARK', +12443: 'KATAKANA-HIRAGANA VOICED SOUND MARK', +12444: 'KATAKANA-HIRAGANA SEMI-VOICED SOUND MARK', +12445: 'HIRAGANA ITERATION MARK', +12446: 'HIRAGANA VOICED ITERATION MARK', +12447: 'HIRAGANA DIGRAPH YORI', +12448: 'KATAKANA-HIRAGANA DOUBLE HYPHEN', +12449: 'KATAKANA LETTER SMALL A', +12450: 'KATAKANA LETTER A', +12451: 'KATAKANA LETTER SMALL I', +12452: 'KATAKANA LETTER I', +12453: 'KATAKANA LETTER SMALL U', +12454: 'KATAKANA LETTER U', +12455: 'KATAKANA LETTER SMALL E', +12456: 'KATAKANA LETTER E', +12457: 'KATAKANA LETTER SMALL O', +12458: 'KATAKANA LETTER O', +12459: 'KATAKANA LETTER KA', +12460: 'KATAKANA LETTER GA', +12461: 'KATAKANA LETTER KI', +12462: 'KATAKANA LETTER GI', +12463: 'KATAKANA LETTER KU', +12464: 'KATAKANA LETTER GU', +12465: 'KATAKANA LETTER KE', +12466: 'KATAKANA LETTER GE', +12467: 'KATAKANA LETTER KO', +12468: 'KATAKANA LETTER GO', +12469: 'KATAKANA LETTER SA', +12470: 'KATAKANA LETTER ZA', +12471: 'KATAKANA LETTER SI', +12472: 'KATAKANA LETTER ZI', +12473: 'KATAKANA LETTER SU', +12474: 'KATAKANA LETTER ZU', +12475: 'KATAKANA LETTER SE', +12476: 'KATAKANA LETTER ZE', +12477: 'KATAKANA LETTER SO', +12478: 'KATAKANA LETTER ZO', +12479: 'KATAKANA LETTER TA', +12480: 'KATAKANA LETTER DA', +12481: 'KATAKANA LETTER TI', +12482: 'KATAKANA LETTER DI', +12483: 'KATAKANA LETTER SMALL TU', +12484: 'KATAKANA LETTER TU', +12485: 'KATAKANA LETTER DU', +12486: 'KATAKANA LETTER TE', +12487: 'KATAKANA LETTER DE', +12488: 'KATAKANA LETTER TO', +12489: 'KATAKANA LETTER DO', +12490: 'KATAKANA LETTER NA', +12491: 'KATAKANA LETTER NI', +12492: 'KATAKANA LETTER NU', +12493: 'KATAKANA LETTER NE', +12494: 'KATAKANA LETTER NO', +12495: 'KATAKANA LETTER HA', +12496: 'KATAKANA LETTER BA', +12497: 'KATAKANA LETTER PA', +12498: 'KATAKANA LETTER HI', +12499: 'KATAKANA LETTER BI', +12500: 'KATAKANA LETTER PI', +12501: 'KATAKANA LETTER HU', +12502: 'KATAKANA LETTER BU', +12503: 'KATAKANA LETTER PU', +12504: 'KATAKANA LETTER HE', +12505: 'KATAKANA LETTER BE', +12506: 'KATAKANA LETTER PE', +12507: 'KATAKANA LETTER HO', +12508: 'KATAKANA LETTER BO', +12509: 'KATAKANA LETTER PO', +12510: 'KATAKANA LETTER MA', +12511: 'KATAKANA LETTER MI', +12512: 'KATAKANA LETTER MU', +12513: 'KATAKANA LETTER ME', +12514: 'KATAKANA LETTER MO', +12515: 'KATAKANA LETTER SMALL YA', +12516: 'KATAKANA LETTER YA', +12517: 'KATAKANA LETTER SMALL YU', +12518: 'KATAKANA LETTER YU', +12519: 'KATAKANA LETTER SMALL YO', +12520: 'KATAKANA LETTER YO', +12521: 'KATAKANA LETTER RA', +12522: 'KATAKANA LETTER RI', +12523: 'KATAKANA LETTER RU', +12524: 'KATAKANA LETTER RE', +12525: 'KATAKANA LETTER RO', +12526: 'KATAKANA LETTER SMALL WA', +12527: 'KATAKANA LETTER WA', +12528: 'KATAKANA LETTER WI', +12529: 'KATAKANA LETTER WE', +12530: 'KATAKANA LETTER WO', +12531: 'KATAKANA LETTER N', +12532: 'KATAKANA LETTER VU', +12533: 'KATAKANA LETTER SMALL KA', +12534: 'KATAKANA LETTER SMALL KE', +12535: 'KATAKANA LETTER VA', +12536: 'KATAKANA LETTER VI', +12537: 'KATAKANA LETTER VE', +12538: 'KATAKANA LETTER VO', +12539: 'KATAKANA MIDDLE DOT', +12540: 'KATAKANA-HIRAGANA PROLONGED SOUND MARK', +12541: 'KATAKANA ITERATION MARK', +12542: 'KATAKANA VOICED ITERATION MARK', +12543: 'KATAKANA DIGRAPH KOTO', +12549: 'BOPOMOFO LETTER B', +12550: 'BOPOMOFO LETTER P', +12551: 'BOPOMOFO LETTER M', +12552: 'BOPOMOFO LETTER F', +12553: 'BOPOMOFO LETTER D', +12554: 'BOPOMOFO LETTER T', +12555: 'BOPOMOFO LETTER N', +12556: 'BOPOMOFO LETTER L', +12557: 'BOPOMOFO LETTER G', +12558: 'BOPOMOFO LETTER K', +12559: 'BOPOMOFO LETTER H', +12560: 'BOPOMOFO LETTER J', +12561: 'BOPOMOFO LETTER Q', +12562: 'BOPOMOFO LETTER X', +12563: 'BOPOMOFO LETTER ZH', +12564: 'BOPOMOFO LETTER CH', +12565: 'BOPOMOFO LETTER SH', +12566: 'BOPOMOFO LETTER R', +12567: 'BOPOMOFO LETTER Z', +12568: 'BOPOMOFO LETTER C', +12569: 'BOPOMOFO LETTER S', +12570: 'BOPOMOFO LETTER A', +12571: 'BOPOMOFO LETTER O', +12572: 'BOPOMOFO LETTER E', +12573: 'BOPOMOFO LETTER EH', +12574: 'BOPOMOFO LETTER AI', +12575: 'BOPOMOFO LETTER EI', +12576: 'BOPOMOFO LETTER AU', +12577: 'BOPOMOFO LETTER OU', +12578: 'BOPOMOFO LETTER AN', +12579: 'BOPOMOFO LETTER EN', +12580: 'BOPOMOFO LETTER ANG', +12581: 'BOPOMOFO LETTER ENG', +12582: 'BOPOMOFO LETTER ER', +12583: 'BOPOMOFO LETTER I', +12584: 'BOPOMOFO LETTER U', +12585: 'BOPOMOFO LETTER IU', +12586: 'BOPOMOFO LETTER V', +12587: 'BOPOMOFO LETTER NG', +12588: 'BOPOMOFO LETTER GN', +12593: 'HANGUL LETTER KIYEOK', +12594: 'HANGUL LETTER SSANGKIYEOK', +12595: 'HANGUL LETTER KIYEOK-SIOS', +12596: 'HANGUL LETTER NIEUN', +12597: 'HANGUL LETTER NIEUN-CIEUC', +12598: 'HANGUL LETTER NIEUN-HIEUH', +12599: 'HANGUL LETTER TIKEUT', +12600: 'HANGUL LETTER SSANGTIKEUT', +12601: 'HANGUL LETTER RIEUL', +12602: 'HANGUL LETTER RIEUL-KIYEOK', +12603: 'HANGUL LETTER RIEUL-MIEUM', +12604: 'HANGUL LETTER RIEUL-PIEUP', +12605: 'HANGUL LETTER RIEUL-SIOS', +12606: 'HANGUL LETTER RIEUL-THIEUTH', +12607: 'HANGUL LETTER RIEUL-PHIEUPH', +12608: 'HANGUL LETTER RIEUL-HIEUH', +12609: 'HANGUL LETTER MIEUM', +12610: 'HANGUL LETTER PIEUP', +12611: 'HANGUL LETTER SSANGPIEUP', +12612: 'HANGUL LETTER PIEUP-SIOS', +12613: 'HANGUL LETTER SIOS', +12614: 'HANGUL LETTER SSANGSIOS', +12615: 'HANGUL LETTER IEUNG', +12616: 'HANGUL LETTER CIEUC', +12617: 'HANGUL LETTER SSANGCIEUC', +12618: 'HANGUL LETTER CHIEUCH', +12619: 'HANGUL LETTER KHIEUKH', +12620: 'HANGUL LETTER THIEUTH', +12621: 'HANGUL LETTER PHIEUPH', +12622: 'HANGUL LETTER HIEUH', +12623: 'HANGUL LETTER A', +12624: 'HANGUL LETTER AE', +12625: 'HANGUL LETTER YA', +12626: 'HANGUL LETTER YAE', +12627: 'HANGUL LETTER EO', +12628: 'HANGUL LETTER E', +12629: 'HANGUL LETTER YEO', +12630: 'HANGUL LETTER YE', +12631: 'HANGUL LETTER O', +12632: 'HANGUL LETTER WA', +12633: 'HANGUL LETTER WAE', +12634: 'HANGUL LETTER OE', +12635: 'HANGUL LETTER YO', +12636: 'HANGUL LETTER U', +12637: 'HANGUL LETTER WEO', +12638: 'HANGUL LETTER WE', +12639: 'HANGUL LETTER WI', +12640: 'HANGUL LETTER YU', +12641: 'HANGUL LETTER EU', +12642: 'HANGUL LETTER YI', +12643: 'HANGUL LETTER I', +12644: 'HANGUL FILLER', +12645: 'HANGUL LETTER SSANGNIEUN', +12646: 'HANGUL LETTER NIEUN-TIKEUT', +12647: 'HANGUL LETTER NIEUN-SIOS', +12648: 'HANGUL LETTER NIEUN-PANSIOS', +12649: 'HANGUL LETTER RIEUL-KIYEOK-SIOS', +12650: 'HANGUL LETTER RIEUL-TIKEUT', +12651: 'HANGUL LETTER RIEUL-PIEUP-SIOS', +12652: 'HANGUL LETTER RIEUL-PANSIOS', +12653: 'HANGUL LETTER RIEUL-YEORINHIEUH', +12654: 'HANGUL LETTER MIEUM-PIEUP', +12655: 'HANGUL LETTER MIEUM-SIOS', +12656: 'HANGUL LETTER MIEUM-PANSIOS', +12657: 'HANGUL LETTER KAPYEOUNMIEUM', +12658: 'HANGUL LETTER PIEUP-KIYEOK', +12659: 'HANGUL LETTER PIEUP-TIKEUT', +12660: 'HANGUL LETTER PIEUP-SIOS-KIYEOK', +12661: 'HANGUL LETTER PIEUP-SIOS-TIKEUT', +12662: 'HANGUL LETTER PIEUP-CIEUC', +12663: 'HANGUL LETTER PIEUP-THIEUTH', +12664: 'HANGUL LETTER KAPYEOUNPIEUP', +12665: 'HANGUL LETTER KAPYEOUNSSANGPIEUP', +12666: 'HANGUL LETTER SIOS-KIYEOK', +12667: 'HANGUL LETTER SIOS-NIEUN', +12668: 'HANGUL LETTER SIOS-TIKEUT', +12669: 'HANGUL LETTER SIOS-PIEUP', +12670: 'HANGUL LETTER SIOS-CIEUC', +12671: 'HANGUL LETTER PANSIOS', +12672: 'HANGUL LETTER SSANGIEUNG', +12673: 'HANGUL LETTER YESIEUNG', +12674: 'HANGUL LETTER YESIEUNG-SIOS', +12675: 'HANGUL LETTER YESIEUNG-PANSIOS', +12676: 'HANGUL LETTER KAPYEOUNPHIEUPH', +12677: 'HANGUL LETTER SSANGHIEUH', +12678: 'HANGUL LETTER YEORINHIEUH', +12679: 'HANGUL LETTER YO-YA', +12680: 'HANGUL LETTER YO-YAE', +12681: 'HANGUL LETTER YO-I', +12682: 'HANGUL LETTER YU-YEO', +12683: 'HANGUL LETTER YU-YE', +12684: 'HANGUL LETTER YU-I', +12685: 'HANGUL LETTER ARAEA', +12686: 'HANGUL LETTER ARAEAE', +12688: 'IDEOGRAPHIC ANNOTATION LINKING MARK', +12689: 'IDEOGRAPHIC ANNOTATION REVERSE MARK', +12690: 'IDEOGRAPHIC ANNOTATION ONE MARK', +12691: 'IDEOGRAPHIC ANNOTATION TWO MARK', +12692: 'IDEOGRAPHIC ANNOTATION THREE MARK', +12693: 'IDEOGRAPHIC ANNOTATION FOUR MARK', +12694: 'IDEOGRAPHIC ANNOTATION TOP MARK', +12695: 'IDEOGRAPHIC ANNOTATION MIDDLE MARK', +12696: 'IDEOGRAPHIC ANNOTATION BOTTOM MARK', +12697: 'IDEOGRAPHIC ANNOTATION FIRST MARK', +12698: 'IDEOGRAPHIC ANNOTATION SECOND MARK', +12699: 'IDEOGRAPHIC ANNOTATION THIRD MARK', +12700: 'IDEOGRAPHIC ANNOTATION FOURTH MARK', +12701: 'IDEOGRAPHIC ANNOTATION HEAVEN MARK', +12702: 'IDEOGRAPHIC ANNOTATION EARTH MARK', +12703: 'IDEOGRAPHIC ANNOTATION MAN MARK', +12704: 'BOPOMOFO LETTER BU', +12705: 'BOPOMOFO LETTER ZI', +12706: 'BOPOMOFO LETTER JI', +12707: 'BOPOMOFO LETTER GU', +12708: 'BOPOMOFO LETTER EE', +12709: 'BOPOMOFO LETTER ENN', +12710: 'BOPOMOFO LETTER OO', +12711: 'BOPOMOFO LETTER ONN', +12712: 'BOPOMOFO LETTER IR', +12713: 'BOPOMOFO LETTER ANN', +12714: 'BOPOMOFO LETTER INN', +12715: 'BOPOMOFO LETTER UNN', +12716: 'BOPOMOFO LETTER IM', +12717: 'BOPOMOFO LETTER NGG', +12718: 'BOPOMOFO LETTER AINN', +12719: 'BOPOMOFO LETTER AUNN', +12720: 'BOPOMOFO LETTER AM', +12721: 'BOPOMOFO LETTER OM', +12722: 'BOPOMOFO LETTER ONG', +12723: 'BOPOMOFO LETTER INNN', +12724: 'BOPOMOFO FINAL LETTER P', +12725: 'BOPOMOFO FINAL LETTER T', +12726: 'BOPOMOFO FINAL LETTER K', +12727: 'BOPOMOFO FINAL LETTER H', +12784: 'KATAKANA LETTER SMALL KU', +12785: 'KATAKANA LETTER SMALL SI', +12786: 'KATAKANA LETTER SMALL SU', +12787: 'KATAKANA LETTER SMALL TO', +12788: 'KATAKANA LETTER SMALL NU', +12789: 'KATAKANA LETTER SMALL HA', +12790: 'KATAKANA LETTER SMALL HI', +12791: 'KATAKANA LETTER SMALL HU', +12792: 'KATAKANA LETTER SMALL HE', +12793: 'KATAKANA LETTER SMALL HO', +12794: 'KATAKANA LETTER SMALL MU', +12795: 'KATAKANA LETTER SMALL RA', +12796: 'KATAKANA LETTER SMALL RI', +12797: 'KATAKANA LETTER SMALL RU', +12798: 'KATAKANA LETTER SMALL RE', +12799: 'KATAKANA LETTER SMALL RO', +12800: 'PARENTHESIZED HANGUL KIYEOK', +12801: 'PARENTHESIZED HANGUL NIEUN', +12802: 'PARENTHESIZED HANGUL TIKEUT', +12803: 'PARENTHESIZED HANGUL RIEUL', +12804: 'PARENTHESIZED HANGUL MIEUM', +12805: 'PARENTHESIZED HANGUL PIEUP', +12806: 'PARENTHESIZED HANGUL SIOS', +12807: 'PARENTHESIZED HANGUL IEUNG', +12808: 'PARENTHESIZED HANGUL CIEUC', +12809: 'PARENTHESIZED HANGUL CHIEUCH', +12810: 'PARENTHESIZED HANGUL KHIEUKH', +12811: 'PARENTHESIZED HANGUL THIEUTH', +12812: 'PARENTHESIZED HANGUL PHIEUPH', +12813: 'PARENTHESIZED HANGUL HIEUH', +12814: 'PARENTHESIZED HANGUL KIYEOK A', +12815: 'PARENTHESIZED HANGUL NIEUN A', +12816: 'PARENTHESIZED HANGUL TIKEUT A', +12817: 'PARENTHESIZED HANGUL RIEUL A', +12818: 'PARENTHESIZED HANGUL MIEUM A', +12819: 'PARENTHESIZED HANGUL PIEUP A', +12820: 'PARENTHESIZED HANGUL SIOS A', +12821: 'PARENTHESIZED HANGUL IEUNG A', +12822: 'PARENTHESIZED HANGUL CIEUC A', +12823: 'PARENTHESIZED HANGUL CHIEUCH A', +12824: 'PARENTHESIZED HANGUL KHIEUKH A', +12825: 'PARENTHESIZED HANGUL THIEUTH A', +12826: 'PARENTHESIZED HANGUL PHIEUPH A', +12827: 'PARENTHESIZED HANGUL HIEUH A', +12828: 'PARENTHESIZED HANGUL CIEUC U', +12832: 'PARENTHESIZED IDEOGRAPH ONE', +12833: 'PARENTHESIZED IDEOGRAPH TWO', +12834: 'PARENTHESIZED IDEOGRAPH THREE', +12835: 'PARENTHESIZED IDEOGRAPH FOUR', +12836: 'PARENTHESIZED IDEOGRAPH FIVE', +12837: 'PARENTHESIZED IDEOGRAPH SIX', +12838: 'PARENTHESIZED IDEOGRAPH SEVEN', +12839: 'PARENTHESIZED IDEOGRAPH EIGHT', +12840: 'PARENTHESIZED IDEOGRAPH NINE', +12841: 'PARENTHESIZED IDEOGRAPH TEN', +12842: 'PARENTHESIZED IDEOGRAPH MOON', +12843: 'PARENTHESIZED IDEOGRAPH FIRE', +12844: 'PARENTHESIZED IDEOGRAPH WATER', +12845: 'PARENTHESIZED IDEOGRAPH WOOD', +12846: 'PARENTHESIZED IDEOGRAPH METAL', +12847: 'PARENTHESIZED IDEOGRAPH EARTH', +12848: 'PARENTHESIZED IDEOGRAPH SUN', +12849: 'PARENTHESIZED IDEOGRAPH STOCK', +12850: 'PARENTHESIZED IDEOGRAPH HAVE', +12851: 'PARENTHESIZED IDEOGRAPH SOCIETY', +12852: 'PARENTHESIZED IDEOGRAPH NAME', +12853: 'PARENTHESIZED IDEOGRAPH SPECIAL', +12854: 'PARENTHESIZED IDEOGRAPH FINANCIAL', +12855: 'PARENTHESIZED IDEOGRAPH CONGRATULATION', +12856: 'PARENTHESIZED IDEOGRAPH LABOR', +12857: 'PARENTHESIZED IDEOGRAPH REPRESENT', +12858: 'PARENTHESIZED IDEOGRAPH CALL', +12859: 'PARENTHESIZED IDEOGRAPH STUDY', +12860: 'PARENTHESIZED IDEOGRAPH SUPERVISE', +12861: 'PARENTHESIZED IDEOGRAPH ENTERPRISE', +12862: 'PARENTHESIZED IDEOGRAPH RESOURCE', +12863: 'PARENTHESIZED IDEOGRAPH ALLIANCE', +12864: 'PARENTHESIZED IDEOGRAPH FESTIVAL', +12865: 'PARENTHESIZED IDEOGRAPH REST', +12866: 'PARENTHESIZED IDEOGRAPH SELF', +12867: 'PARENTHESIZED IDEOGRAPH REACH', +12881: 'CIRCLED NUMBER TWENTY ONE', +12882: 'CIRCLED NUMBER TWENTY TWO', +12883: 'CIRCLED NUMBER TWENTY THREE', +12884: 'CIRCLED NUMBER TWENTY FOUR', +12885: 'CIRCLED NUMBER TWENTY FIVE', +12886: 'CIRCLED NUMBER TWENTY SIX', +12887: 'CIRCLED NUMBER TWENTY SEVEN', +12888: 'CIRCLED NUMBER TWENTY EIGHT', +12889: 'CIRCLED NUMBER TWENTY NINE', +12890: 'CIRCLED NUMBER THIRTY', +12891: 'CIRCLED NUMBER THIRTY ONE', +12892: 'CIRCLED NUMBER THIRTY TWO', +12893: 'CIRCLED NUMBER THIRTY THREE', +12894: 'CIRCLED NUMBER THIRTY FOUR', +12895: 'CIRCLED NUMBER THIRTY FIVE', +12896: 'CIRCLED HANGUL KIYEOK', +12897: 'CIRCLED HANGUL NIEUN', +12898: 'CIRCLED HANGUL TIKEUT', +12899: 'CIRCLED HANGUL RIEUL', +12900: 'CIRCLED HANGUL MIEUM', +12901: 'CIRCLED HANGUL PIEUP', +12902: 'CIRCLED HANGUL SIOS', +12903: 'CIRCLED HANGUL IEUNG', +12904: 'CIRCLED HANGUL CIEUC', +12905: 'CIRCLED HANGUL CHIEUCH', +12906: 'CIRCLED HANGUL KHIEUKH', +12907: 'CIRCLED HANGUL THIEUTH', +12908: 'CIRCLED HANGUL PHIEUPH', +12909: 'CIRCLED HANGUL HIEUH', +12910: 'CIRCLED HANGUL KIYEOK A', +12911: 'CIRCLED HANGUL NIEUN A', +12912: 'CIRCLED HANGUL TIKEUT A', +12913: 'CIRCLED HANGUL RIEUL A', +12914: 'CIRCLED HANGUL MIEUM A', +12915: 'CIRCLED HANGUL PIEUP A', +12916: 'CIRCLED HANGUL SIOS A', +12917: 'CIRCLED HANGUL IEUNG A', +12918: 'CIRCLED HANGUL CIEUC A', +12919: 'CIRCLED HANGUL CHIEUCH A', +12920: 'CIRCLED HANGUL KHIEUKH A', +12921: 'CIRCLED HANGUL THIEUTH A', +12922: 'CIRCLED HANGUL PHIEUPH A', +12923: 'CIRCLED HANGUL HIEUH A', +12927: 'KOREAN STANDARD SYMBOL', +12928: 'CIRCLED IDEOGRAPH ONE', +12929: 'CIRCLED IDEOGRAPH TWO', +12930: 'CIRCLED IDEOGRAPH THREE', +12931: 'CIRCLED IDEOGRAPH FOUR', +12932: 'CIRCLED IDEOGRAPH FIVE', +12933: 'CIRCLED IDEOGRAPH SIX', +12934: 'CIRCLED IDEOGRAPH SEVEN', +12935: 'CIRCLED IDEOGRAPH EIGHT', +12936: 'CIRCLED IDEOGRAPH NINE', +12937: 'CIRCLED IDEOGRAPH TEN', +12938: 'CIRCLED IDEOGRAPH MOON', +12939: 'CIRCLED IDEOGRAPH FIRE', +12940: 'CIRCLED IDEOGRAPH WATER', +12941: 'CIRCLED IDEOGRAPH WOOD', +12942: 'CIRCLED IDEOGRAPH METAL', +12943: 'CIRCLED IDEOGRAPH EARTH', +12944: 'CIRCLED IDEOGRAPH SUN', +12945: 'CIRCLED IDEOGRAPH STOCK', +12946: 'CIRCLED IDEOGRAPH HAVE', +12947: 'CIRCLED IDEOGRAPH SOCIETY', +12948: 'CIRCLED IDEOGRAPH NAME', +12949: 'CIRCLED IDEOGRAPH SPECIAL', +12950: 'CIRCLED IDEOGRAPH FINANCIAL', +12951: 'CIRCLED IDEOGRAPH CONGRATULATION', +12952: 'CIRCLED IDEOGRAPH LABOR', +12953: 'CIRCLED IDEOGRAPH SECRET', +12954: 'CIRCLED IDEOGRAPH MALE', +12955: 'CIRCLED IDEOGRAPH FEMALE', +12956: 'CIRCLED IDEOGRAPH SUITABLE', +12957: 'CIRCLED IDEOGRAPH EXCELLENT', +12958: 'CIRCLED IDEOGRAPH PRINT', +12959: 'CIRCLED IDEOGRAPH ATTENTION', +12960: 'CIRCLED IDEOGRAPH ITEM', +12961: 'CIRCLED IDEOGRAPH REST', +12962: 'CIRCLED IDEOGRAPH COPY', +12963: 'CIRCLED IDEOGRAPH CORRECT', +12964: 'CIRCLED IDEOGRAPH HIGH', +12965: 'CIRCLED IDEOGRAPH CENTRE', +12966: 'CIRCLED IDEOGRAPH LOW', +12967: 'CIRCLED IDEOGRAPH LEFT', +12968: 'CIRCLED IDEOGRAPH RIGHT', +12969: 'CIRCLED IDEOGRAPH MEDICINE', +12970: 'CIRCLED IDEOGRAPH RELIGION', +12971: 'CIRCLED IDEOGRAPH STUDY', +12972: 'CIRCLED IDEOGRAPH SUPERVISE', +12973: 'CIRCLED IDEOGRAPH ENTERPRISE', +12974: 'CIRCLED IDEOGRAPH RESOURCE', +12975: 'CIRCLED IDEOGRAPH ALLIANCE', +12976: 'CIRCLED IDEOGRAPH NIGHT', +12977: 'CIRCLED NUMBER THIRTY SIX', +12978: 'CIRCLED NUMBER THIRTY SEVEN', +12979: 'CIRCLED NUMBER THIRTY EIGHT', +12980: 'CIRCLED NUMBER THIRTY NINE', +12981: 'CIRCLED NUMBER FORTY', +12982: 'CIRCLED NUMBER FORTY ONE', +12983: 'CIRCLED NUMBER FORTY TWO', +12984: 'CIRCLED NUMBER FORTY THREE', +12985: 'CIRCLED NUMBER FORTY FOUR', +12986: 'CIRCLED NUMBER FORTY FIVE', +12987: 'CIRCLED NUMBER FORTY SIX', +12988: 'CIRCLED NUMBER FORTY SEVEN', +12989: 'CIRCLED NUMBER FORTY EIGHT', +12990: 'CIRCLED NUMBER FORTY NINE', +12991: 'CIRCLED NUMBER FIFTY', +12992: 'IDEOGRAPHIC TELEGRAPH SYMBOL FOR JANUARY', +12993: 'IDEOGRAPHIC TELEGRAPH SYMBOL FOR FEBRUARY', +12994: 'IDEOGRAPHIC TELEGRAPH SYMBOL FOR MARCH', +12995: 'IDEOGRAPHIC TELEGRAPH SYMBOL FOR APRIL', +12996: 'IDEOGRAPHIC TELEGRAPH SYMBOL FOR MAY', +12997: 'IDEOGRAPHIC TELEGRAPH SYMBOL FOR JUNE', +12998: 'IDEOGRAPHIC TELEGRAPH SYMBOL FOR JULY', +12999: 'IDEOGRAPHIC TELEGRAPH SYMBOL FOR AUGUST', +13000: 'IDEOGRAPHIC TELEGRAPH SYMBOL FOR SEPTEMBER', +13001: 'IDEOGRAPHIC TELEGRAPH SYMBOL FOR OCTOBER', +13002: 'IDEOGRAPHIC TELEGRAPH SYMBOL FOR NOVEMBER', +13003: 'IDEOGRAPHIC TELEGRAPH SYMBOL FOR DECEMBER', +13008: 'CIRCLED KATAKANA A', +13009: 'CIRCLED KATAKANA I', +13010: 'CIRCLED KATAKANA U', +13011: 'CIRCLED KATAKANA E', +13012: 'CIRCLED KATAKANA O', +13013: 'CIRCLED KATAKANA KA', +13014: 'CIRCLED KATAKANA KI', +13015: 'CIRCLED KATAKANA KU', +13016: 'CIRCLED KATAKANA KE', +13017: 'CIRCLED KATAKANA KO', +13018: 'CIRCLED KATAKANA SA', +13019: 'CIRCLED KATAKANA SI', +13020: 'CIRCLED KATAKANA SU', +13021: 'CIRCLED KATAKANA SE', +13022: 'CIRCLED KATAKANA SO', +13023: 'CIRCLED KATAKANA TA', +13024: 'CIRCLED KATAKANA TI', +13025: 'CIRCLED KATAKANA TU', +13026: 'CIRCLED KATAKANA TE', +13027: 'CIRCLED KATAKANA TO', +13028: 'CIRCLED KATAKANA NA', +13029: 'CIRCLED KATAKANA NI', +13030: 'CIRCLED KATAKANA NU', +13031: 'CIRCLED KATAKANA NE', +13032: 'CIRCLED KATAKANA NO', +13033: 'CIRCLED KATAKANA HA', +13034: 'CIRCLED KATAKANA HI', +13035: 'CIRCLED KATAKANA HU', +13036: 'CIRCLED KATAKANA HE', +13037: 'CIRCLED KATAKANA HO', +13038: 'CIRCLED KATAKANA MA', +13039: 'CIRCLED KATAKANA MI', +13040: 'CIRCLED KATAKANA MU', +13041: 'CIRCLED KATAKANA ME', +13042: 'CIRCLED KATAKANA MO', +13043: 'CIRCLED KATAKANA YA', +13044: 'CIRCLED KATAKANA YU', +13045: 'CIRCLED KATAKANA YO', +13046: 'CIRCLED KATAKANA RA', +13047: 'CIRCLED KATAKANA RI', +13048: 'CIRCLED KATAKANA RU', +13049: 'CIRCLED KATAKANA RE', +13050: 'CIRCLED KATAKANA RO', +13051: 'CIRCLED KATAKANA WA', +13052: 'CIRCLED KATAKANA WI', +13053: 'CIRCLED KATAKANA WE', +13054: 'CIRCLED KATAKANA WO', +13056: 'SQUARE APAATO', +13057: 'SQUARE ARUHUA', +13058: 'SQUARE ANPEA', +13059: 'SQUARE AARU', +13060: 'SQUARE ININGU', +13061: 'SQUARE INTI', +13062: 'SQUARE UON', +13063: 'SQUARE ESUKUUDO', +13064: 'SQUARE EEKAA', +13065: 'SQUARE ONSU', +13066: 'SQUARE OOMU', +13067: 'SQUARE KAIRI', +13068: 'SQUARE KARATTO', +13069: 'SQUARE KARORII', +13070: 'SQUARE GARON', +13071: 'SQUARE GANMA', +13072: 'SQUARE GIGA', +13073: 'SQUARE GINII', +13074: 'SQUARE KYURII', +13075: 'SQUARE GIRUDAA', +13076: 'SQUARE KIRO', +13077: 'SQUARE KIROGURAMU', +13078: 'SQUARE KIROMEETORU', +13079: 'SQUARE KIROWATTO', +13080: 'SQUARE GURAMU', +13081: 'SQUARE GURAMUTON', +13082: 'SQUARE KURUZEIRO', +13083: 'SQUARE KUROONE', +13084: 'SQUARE KEESU', +13085: 'SQUARE KORUNA', +13086: 'SQUARE KOOPO', +13087: 'SQUARE SAIKURU', +13088: 'SQUARE SANTIIMU', +13089: 'SQUARE SIRINGU', +13090: 'SQUARE SENTI', +13091: 'SQUARE SENTO', +13092: 'SQUARE DAASU', +13093: 'SQUARE DESI', +13094: 'SQUARE DORU', +13095: 'SQUARE TON', +13096: 'SQUARE NANO', +13097: 'SQUARE NOTTO', +13098: 'SQUARE HAITU', +13099: 'SQUARE PAASENTO', +13100: 'SQUARE PAATU', +13101: 'SQUARE BAARERU', +13102: 'SQUARE PIASUTORU', +13103: 'SQUARE PIKURU', +13104: 'SQUARE PIKO', +13105: 'SQUARE BIRU', +13106: 'SQUARE HUARADDO', +13107: 'SQUARE HUIITO', +13108: 'SQUARE BUSSYERU', +13109: 'SQUARE HURAN', +13110: 'SQUARE HEKUTAARU', +13111: 'SQUARE PESO', +13112: 'SQUARE PENIHI', +13113: 'SQUARE HERUTU', +13114: 'SQUARE PENSU', +13115: 'SQUARE PEEZI', +13116: 'SQUARE BEETA', +13117: 'SQUARE POINTO', +13118: 'SQUARE BORUTO', +13119: 'SQUARE HON', +13120: 'SQUARE PONDO', +13121: 'SQUARE HOORU', +13122: 'SQUARE HOON', +13123: 'SQUARE MAIKURO', +13124: 'SQUARE MAIRU', +13125: 'SQUARE MAHHA', +13126: 'SQUARE MARUKU', +13127: 'SQUARE MANSYON', +13128: 'SQUARE MIKURON', +13129: 'SQUARE MIRI', +13130: 'SQUARE MIRIBAARU', +13131: 'SQUARE MEGA', +13132: 'SQUARE MEGATON', +13133: 'SQUARE MEETORU', +13134: 'SQUARE YAADO', +13135: 'SQUARE YAARU', +13136: 'SQUARE YUAN', +13137: 'SQUARE RITTORU', +13138: 'SQUARE RIRA', +13139: 'SQUARE RUPII', +13140: 'SQUARE RUUBURU', +13141: 'SQUARE REMU', +13142: 'SQUARE RENTOGEN', +13143: 'SQUARE WATTO', +13144: 'IDEOGRAPHIC TELEGRAPH SYMBOL FOR HOUR ZERO', +13145: 'IDEOGRAPHIC TELEGRAPH SYMBOL FOR HOUR ONE', +13146: 'IDEOGRAPHIC TELEGRAPH SYMBOL FOR HOUR TWO', +13147: 'IDEOGRAPHIC TELEGRAPH SYMBOL FOR HOUR THREE', +13148: 'IDEOGRAPHIC TELEGRAPH SYMBOL FOR HOUR FOUR', +13149: 'IDEOGRAPHIC TELEGRAPH SYMBOL FOR HOUR FIVE', +13150: 'IDEOGRAPHIC TELEGRAPH SYMBOL FOR HOUR SIX', +13151: 'IDEOGRAPHIC TELEGRAPH SYMBOL FOR HOUR SEVEN', +13152: 'IDEOGRAPHIC TELEGRAPH SYMBOL FOR HOUR EIGHT', +13153: 'IDEOGRAPHIC TELEGRAPH SYMBOL FOR HOUR NINE', +13154: 'IDEOGRAPHIC TELEGRAPH SYMBOL FOR HOUR TEN', +13155: 'IDEOGRAPHIC TELEGRAPH SYMBOL FOR HOUR ELEVEN', +13156: 'IDEOGRAPHIC TELEGRAPH SYMBOL FOR HOUR TWELVE', +13157: 'IDEOGRAPHIC TELEGRAPH SYMBOL FOR HOUR THIRTEEN', +13158: 'IDEOGRAPHIC TELEGRAPH SYMBOL FOR HOUR FOURTEEN', +13159: 'IDEOGRAPHIC TELEGRAPH SYMBOL FOR HOUR FIFTEEN', +13160: 'IDEOGRAPHIC TELEGRAPH SYMBOL FOR HOUR SIXTEEN', +13161: 'IDEOGRAPHIC TELEGRAPH SYMBOL FOR HOUR SEVENTEEN', +13162: 'IDEOGRAPHIC TELEGRAPH SYMBOL FOR HOUR EIGHTEEN', +13163: 'IDEOGRAPHIC TELEGRAPH SYMBOL FOR HOUR NINETEEN', +13164: 'IDEOGRAPHIC TELEGRAPH SYMBOL FOR HOUR TWENTY', +13165: 'IDEOGRAPHIC TELEGRAPH SYMBOL FOR HOUR TWENTY-ONE', +13166: 'IDEOGRAPHIC TELEGRAPH SYMBOL FOR HOUR TWENTY-TWO', +13167: 'IDEOGRAPHIC TELEGRAPH SYMBOL FOR HOUR TWENTY-THREE', +13168: 'IDEOGRAPHIC TELEGRAPH SYMBOL FOR HOUR TWENTY-FOUR', +13169: 'SQUARE HPA', +13170: 'SQUARE DA', +13171: 'SQUARE AU', +13172: 'SQUARE BAR', +13173: 'SQUARE OV', +13174: 'SQUARE PC', +13179: 'SQUARE ERA NAME HEISEI', +13180: 'SQUARE ERA NAME SYOUWA', +13181: 'SQUARE ERA NAME TAISYOU', +13182: 'SQUARE ERA NAME MEIZI', +13183: 'SQUARE CORPORATION', +13184: 'SQUARE PA AMPS', +13185: 'SQUARE NA', +13186: 'SQUARE MU A', +13187: 'SQUARE MA', +13188: 'SQUARE KA', +13189: 'SQUARE KB', +13190: 'SQUARE MB', +13191: 'SQUARE GB', +13192: 'SQUARE CAL', +13193: 'SQUARE KCAL', +13194: 'SQUARE PF', +13195: 'SQUARE NF', +13196: 'SQUARE MU F', +13197: 'SQUARE MU G', +13198: 'SQUARE MG', +13199: 'SQUARE KG', +13200: 'SQUARE HZ', +13201: 'SQUARE KHZ', +13202: 'SQUARE MHZ', +13203: 'SQUARE GHZ', +13204: 'SQUARE THZ', +13205: 'SQUARE MU L', +13206: 'SQUARE ML', +13207: 'SQUARE DL', +13208: 'SQUARE KL', +13209: 'SQUARE FM', +13210: 'SQUARE NM', +13211: 'SQUARE MU M', +13212: 'SQUARE MM', +13213: 'SQUARE CM', +13214: 'SQUARE KM', +13215: 'SQUARE MM SQUARED', +13216: 'SQUARE CM SQUARED', +13217: 'SQUARE M SQUARED', +13218: 'SQUARE KM SQUARED', +13219: 'SQUARE MM CUBED', +13220: 'SQUARE CM CUBED', +13221: 'SQUARE M CUBED', +13222: 'SQUARE KM CUBED', +13223: 'SQUARE M OVER S', +13224: 'SQUARE M OVER S SQUARED', +13225: 'SQUARE PA', +13226: 'SQUARE KPA', +13227: 'SQUARE MPA', +13228: 'SQUARE GPA', +13229: 'SQUARE RAD', +13230: 'SQUARE RAD OVER S', +13231: 'SQUARE RAD OVER S SQUARED', +13232: 'SQUARE PS', +13233: 'SQUARE NS', +13234: 'SQUARE MU S', +13235: 'SQUARE MS', +13236: 'SQUARE PV', +13237: 'SQUARE NV', +13238: 'SQUARE MU V', +13239: 'SQUARE MV', +13240: 'SQUARE KV', +13241: 'SQUARE MV MEGA', +13242: 'SQUARE PW', +13243: 'SQUARE NW', +13244: 'SQUARE MU W', +13245: 'SQUARE MW', +13246: 'SQUARE KW', +13247: 'SQUARE MW MEGA', +13248: 'SQUARE K OHM', +13249: 'SQUARE M OHM', +13250: 'SQUARE AM', +13251: 'SQUARE BQ', +13252: 'SQUARE CC', +13253: 'SQUARE CD', +13254: 'SQUARE C OVER KG', +13255: 'SQUARE CO', +13256: 'SQUARE DB', +13257: 'SQUARE GY', +13258: 'SQUARE HA', +13259: 'SQUARE HP', +13260: 'SQUARE IN', +13261: 'SQUARE KK', +13262: 'SQUARE KM CAPITAL', +13263: 'SQUARE KT', +13264: 'SQUARE LM', +13265: 'SQUARE LN', +13266: 'SQUARE LOG', +13267: 'SQUARE LX', +13268: 'SQUARE MB SMALL', +13269: 'SQUARE MIL', +13270: 'SQUARE MOL', +13271: 'SQUARE PH', +13272: 'SQUARE PM', +13273: 'SQUARE PPM', +13274: 'SQUARE PR', +13275: 'SQUARE SR', +13276: 'SQUARE SV', +13277: 'SQUARE WB', +13280: 'IDEOGRAPHIC TELEGRAPH SYMBOL FOR DAY ONE', +13281: 'IDEOGRAPHIC TELEGRAPH SYMBOL FOR DAY TWO', +13282: 'IDEOGRAPHIC TELEGRAPH SYMBOL FOR DAY THREE', +13283: 'IDEOGRAPHIC TELEGRAPH SYMBOL FOR DAY FOUR', +13284: 'IDEOGRAPHIC TELEGRAPH SYMBOL FOR DAY FIVE', +13285: 'IDEOGRAPHIC TELEGRAPH SYMBOL FOR DAY SIX', +13286: 'IDEOGRAPHIC TELEGRAPH SYMBOL FOR DAY SEVEN', +13287: 'IDEOGRAPHIC TELEGRAPH SYMBOL FOR DAY EIGHT', +13288: 'IDEOGRAPHIC TELEGRAPH SYMBOL FOR DAY NINE', +13289: 'IDEOGRAPHIC TELEGRAPH SYMBOL FOR DAY TEN', +13290: 'IDEOGRAPHIC TELEGRAPH SYMBOL FOR DAY ELEVEN', +13291: 'IDEOGRAPHIC TELEGRAPH SYMBOL FOR DAY TWELVE', +13292: 'IDEOGRAPHIC TELEGRAPH SYMBOL FOR DAY THIRTEEN', +13293: 'IDEOGRAPHIC TELEGRAPH SYMBOL FOR DAY FOURTEEN', +13294: 'IDEOGRAPHIC TELEGRAPH SYMBOL FOR DAY FIFTEEN', +13295: 'IDEOGRAPHIC TELEGRAPH SYMBOL FOR DAY SIXTEEN', +13296: 'IDEOGRAPHIC TELEGRAPH SYMBOL FOR DAY SEVENTEEN', +13297: 'IDEOGRAPHIC TELEGRAPH SYMBOL FOR DAY EIGHTEEN', +13298: 'IDEOGRAPHIC TELEGRAPH SYMBOL FOR DAY NINETEEN', +13299: 'IDEOGRAPHIC TELEGRAPH SYMBOL FOR DAY TWENTY', +13300: 'IDEOGRAPHIC TELEGRAPH SYMBOL FOR DAY TWENTY-ONE', +13301: 'IDEOGRAPHIC TELEGRAPH SYMBOL FOR DAY TWENTY-TWO', +13302: 'IDEOGRAPHIC TELEGRAPH SYMBOL FOR DAY TWENTY-THREE', +13303: 'IDEOGRAPHIC TELEGRAPH SYMBOL FOR DAY TWENTY-FOUR', +13304: 'IDEOGRAPHIC TELEGRAPH SYMBOL FOR DAY TWENTY-FIVE', +13305: 'IDEOGRAPHIC TELEGRAPH SYMBOL FOR DAY TWENTY-SIX', +13306: 'IDEOGRAPHIC TELEGRAPH SYMBOL FOR DAY TWENTY-SEVEN', +13307: 'IDEOGRAPHIC TELEGRAPH SYMBOL FOR DAY TWENTY-EIGHT', +13308: 'IDEOGRAPHIC TELEGRAPH SYMBOL FOR DAY TWENTY-NINE', +13309: 'IDEOGRAPHIC TELEGRAPH SYMBOL FOR DAY THIRTY', +13310: 'IDEOGRAPHIC TELEGRAPH SYMBOL FOR DAY THIRTY-ONE', +40960: 'YI SYLLABLE IT', +40961: 'YI SYLLABLE IX', +40962: 'YI SYLLABLE I', +40963: 'YI SYLLABLE IP', +40964: 'YI SYLLABLE IET', +40965: 'YI SYLLABLE IEX', +40966: 'YI SYLLABLE IE', +40967: 'YI SYLLABLE IEP', +40968: 'YI SYLLABLE AT', +40969: 'YI SYLLABLE AX', +40970: 'YI SYLLABLE A', +40971: 'YI SYLLABLE AP', +40972: 'YI SYLLABLE UOX', +40973: 'YI SYLLABLE UO', +40974: 'YI SYLLABLE UOP', +40975: 'YI SYLLABLE OT', +40976: 'YI SYLLABLE OX', +40977: 'YI SYLLABLE O', +40978: 'YI SYLLABLE OP', +40979: 'YI SYLLABLE EX', +40980: 'YI SYLLABLE E', +40981: 'YI SYLLABLE WU', +40982: 'YI SYLLABLE BIT', +40983: 'YI SYLLABLE BIX', +40984: 'YI SYLLABLE BI', +40985: 'YI SYLLABLE BIP', +40986: 'YI SYLLABLE BIET', +40987: 'YI SYLLABLE BIEX', +40988: 'YI SYLLABLE BIE', +40989: 'YI SYLLABLE BIEP', +40990: 'YI SYLLABLE BAT', +40991: 'YI SYLLABLE BAX', +40992: 'YI SYLLABLE BA', +40993: 'YI SYLLABLE BAP', +40994: 'YI SYLLABLE BUOX', +40995: 'YI SYLLABLE BUO', +40996: 'YI SYLLABLE BUOP', +40997: 'YI SYLLABLE BOT', +40998: 'YI SYLLABLE BOX', +40999: 'YI SYLLABLE BO', +41000: 'YI SYLLABLE BOP', +41001: 'YI SYLLABLE BEX', +41002: 'YI SYLLABLE BE', +41003: 'YI SYLLABLE BEP', +41004: 'YI SYLLABLE BUT', +41005: 'YI SYLLABLE BUX', +41006: 'YI SYLLABLE BU', +41007: 'YI SYLLABLE BUP', +41008: 'YI SYLLABLE BURX', +41009: 'YI SYLLABLE BUR', +41010: 'YI SYLLABLE BYT', +41011: 'YI SYLLABLE BYX', +41012: 'YI SYLLABLE BY', +41013: 'YI SYLLABLE BYP', +41014: 'YI SYLLABLE BYRX', +41015: 'YI SYLLABLE BYR', +41016: 'YI SYLLABLE PIT', +41017: 'YI SYLLABLE PIX', +41018: 'YI SYLLABLE PI', +41019: 'YI SYLLABLE PIP', +41020: 'YI SYLLABLE PIEX', +41021: 'YI SYLLABLE PIE', +41022: 'YI SYLLABLE PIEP', +41023: 'YI SYLLABLE PAT', +41024: 'YI SYLLABLE PAX', +41025: 'YI SYLLABLE PA', +41026: 'YI SYLLABLE PAP', +41027: 'YI SYLLABLE PUOX', +41028: 'YI SYLLABLE PUO', +41029: 'YI SYLLABLE PUOP', +41030: 'YI SYLLABLE POT', +41031: 'YI SYLLABLE POX', +41032: 'YI SYLLABLE PO', +41033: 'YI SYLLABLE POP', +41034: 'YI SYLLABLE PUT', +41035: 'YI SYLLABLE PUX', +41036: 'YI SYLLABLE PU', +41037: 'YI SYLLABLE PUP', +41038: 'YI SYLLABLE PURX', +41039: 'YI SYLLABLE PUR', +41040: 'YI SYLLABLE PYT', +41041: 'YI SYLLABLE PYX', +41042: 'YI SYLLABLE PY', +41043: 'YI SYLLABLE PYP', +41044: 'YI SYLLABLE PYRX', +41045: 'YI SYLLABLE PYR', +41046: 'YI SYLLABLE BBIT', +41047: 'YI SYLLABLE BBIX', +41048: 'YI SYLLABLE BBI', +41049: 'YI SYLLABLE BBIP', +41050: 'YI SYLLABLE BBIET', +41051: 'YI SYLLABLE BBIEX', +41052: 'YI SYLLABLE BBIE', +41053: 'YI SYLLABLE BBIEP', +41054: 'YI SYLLABLE BBAT', +41055: 'YI SYLLABLE BBAX', +41056: 'YI SYLLABLE BBA', +41057: 'YI SYLLABLE BBAP', +41058: 'YI SYLLABLE BBUOX', +41059: 'YI SYLLABLE BBUO', +41060: 'YI SYLLABLE BBUOP', +41061: 'YI SYLLABLE BBOT', +41062: 'YI SYLLABLE BBOX', +41063: 'YI SYLLABLE BBO', +41064: 'YI SYLLABLE BBOP', +41065: 'YI SYLLABLE BBEX', +41066: 'YI SYLLABLE BBE', +41067: 'YI SYLLABLE BBEP', +41068: 'YI SYLLABLE BBUT', +41069: 'YI SYLLABLE BBUX', +41070: 'YI SYLLABLE BBU', +41071: 'YI SYLLABLE BBUP', +41072: 'YI SYLLABLE BBURX', +41073: 'YI SYLLABLE BBUR', +41074: 'YI SYLLABLE BBYT', +41075: 'YI SYLLABLE BBYX', +41076: 'YI SYLLABLE BBY', +41077: 'YI SYLLABLE BBYP', +41078: 'YI SYLLABLE NBIT', +41079: 'YI SYLLABLE NBIX', +41080: 'YI SYLLABLE NBI', +41081: 'YI SYLLABLE NBIP', +41082: 'YI SYLLABLE NBIEX', +41083: 'YI SYLLABLE NBIE', +41084: 'YI SYLLABLE NBIEP', +41085: 'YI SYLLABLE NBAT', +41086: 'YI SYLLABLE NBAX', +41087: 'YI SYLLABLE NBA', +41088: 'YI SYLLABLE NBAP', +41089: 'YI SYLLABLE NBOT', +41090: 'YI SYLLABLE NBOX', +41091: 'YI SYLLABLE NBO', +41092: 'YI SYLLABLE NBOP', +41093: 'YI SYLLABLE NBUT', +41094: 'YI SYLLABLE NBUX', +41095: 'YI SYLLABLE NBU', +41096: 'YI SYLLABLE NBUP', +41097: 'YI SYLLABLE NBURX', +41098: 'YI SYLLABLE NBUR', +41099: 'YI SYLLABLE NBYT', +41100: 'YI SYLLABLE NBYX', +41101: 'YI SYLLABLE NBY', +41102: 'YI SYLLABLE NBYP', +41103: 'YI SYLLABLE NBYRX', +41104: 'YI SYLLABLE NBYR', +41105: 'YI SYLLABLE HMIT', +41106: 'YI SYLLABLE HMIX', +41107: 'YI SYLLABLE HMI', +41108: 'YI SYLLABLE HMIP', +41109: 'YI SYLLABLE HMIEX', +41110: 'YI SYLLABLE HMIE', +41111: 'YI SYLLABLE HMIEP', +41112: 'YI SYLLABLE HMAT', +41113: 'YI SYLLABLE HMAX', +41114: 'YI SYLLABLE HMA', +41115: 'YI SYLLABLE HMAP', +41116: 'YI SYLLABLE HMUOX', +41117: 'YI SYLLABLE HMUO', +41118: 'YI SYLLABLE HMUOP', +41119: 'YI SYLLABLE HMOT', +41120: 'YI SYLLABLE HMOX', +41121: 'YI SYLLABLE HMO', +41122: 'YI SYLLABLE HMOP', +41123: 'YI SYLLABLE HMUT', +41124: 'YI SYLLABLE HMUX', +41125: 'YI SYLLABLE HMU', +41126: 'YI SYLLABLE HMUP', +41127: 'YI SYLLABLE HMURX', +41128: 'YI SYLLABLE HMUR', +41129: 'YI SYLLABLE HMYX', +41130: 'YI SYLLABLE HMY', +41131: 'YI SYLLABLE HMYP', +41132: 'YI SYLLABLE HMYRX', +41133: 'YI SYLLABLE HMYR', +41134: 'YI SYLLABLE MIT', +41135: 'YI SYLLABLE MIX', +41136: 'YI SYLLABLE MI', +41137: 'YI SYLLABLE MIP', +41138: 'YI SYLLABLE MIEX', +41139: 'YI SYLLABLE MIE', +41140: 'YI SYLLABLE MIEP', +41141: 'YI SYLLABLE MAT', +41142: 'YI SYLLABLE MAX', +41143: 'YI SYLLABLE MA', +41144: 'YI SYLLABLE MAP', +41145: 'YI SYLLABLE MUOT', +41146: 'YI SYLLABLE MUOX', +41147: 'YI SYLLABLE MUO', +41148: 'YI SYLLABLE MUOP', +41149: 'YI SYLLABLE MOT', +41150: 'YI SYLLABLE MOX', +41151: 'YI SYLLABLE MO', +41152: 'YI SYLLABLE MOP', +41153: 'YI SYLLABLE MEX', +41154: 'YI SYLLABLE ME', +41155: 'YI SYLLABLE MUT', +41156: 'YI SYLLABLE MUX', +41157: 'YI SYLLABLE MU', +41158: 'YI SYLLABLE MUP', +41159: 'YI SYLLABLE MURX', +41160: 'YI SYLLABLE MUR', +41161: 'YI SYLLABLE MYT', +41162: 'YI SYLLABLE MYX', +41163: 'YI SYLLABLE MY', +41164: 'YI SYLLABLE MYP', +41165: 'YI SYLLABLE FIT', +41166: 'YI SYLLABLE FIX', +41167: 'YI SYLLABLE FI', +41168: 'YI SYLLABLE FIP', +41169: 'YI SYLLABLE FAT', +41170: 'YI SYLLABLE FAX', +41171: 'YI SYLLABLE FA', +41172: 'YI SYLLABLE FAP', +41173: 'YI SYLLABLE FOX', +41174: 'YI SYLLABLE FO', +41175: 'YI SYLLABLE FOP', +41176: 'YI SYLLABLE FUT', +41177: 'YI SYLLABLE FUX', +41178: 'YI SYLLABLE FU', +41179: 'YI SYLLABLE FUP', +41180: 'YI SYLLABLE FURX', +41181: 'YI SYLLABLE FUR', +41182: 'YI SYLLABLE FYT', +41183: 'YI SYLLABLE FYX', +41184: 'YI SYLLABLE FY', +41185: 'YI SYLLABLE FYP', +41186: 'YI SYLLABLE VIT', +41187: 'YI SYLLABLE VIX', +41188: 'YI SYLLABLE VI', +41189: 'YI SYLLABLE VIP', +41190: 'YI SYLLABLE VIET', +41191: 'YI SYLLABLE VIEX', +41192: 'YI SYLLABLE VIE', +41193: 'YI SYLLABLE VIEP', +41194: 'YI SYLLABLE VAT', +41195: 'YI SYLLABLE VAX', +41196: 'YI SYLLABLE VA', +41197: 'YI SYLLABLE VAP', +41198: 'YI SYLLABLE VOT', +41199: 'YI SYLLABLE VOX', +41200: 'YI SYLLABLE VO', +41201: 'YI SYLLABLE VOP', +41202: 'YI SYLLABLE VEX', +41203: 'YI SYLLABLE VEP', +41204: 'YI SYLLABLE VUT', +41205: 'YI SYLLABLE VUX', +41206: 'YI SYLLABLE VU', +41207: 'YI SYLLABLE VUP', +41208: 'YI SYLLABLE VURX', +41209: 'YI SYLLABLE VUR', +41210: 'YI SYLLABLE VYT', +41211: 'YI SYLLABLE VYX', +41212: 'YI SYLLABLE VY', +41213: 'YI SYLLABLE VYP', +41214: 'YI SYLLABLE VYRX', +41215: 'YI SYLLABLE VYR', +41216: 'YI SYLLABLE DIT', +41217: 'YI SYLLABLE DIX', +41218: 'YI SYLLABLE DI', +41219: 'YI SYLLABLE DIP', +41220: 'YI SYLLABLE DIEX', +41221: 'YI SYLLABLE DIE', +41222: 'YI SYLLABLE DIEP', +41223: 'YI SYLLABLE DAT', +41224: 'YI SYLLABLE DAX', +41225: 'YI SYLLABLE DA', +41226: 'YI SYLLABLE DAP', +41227: 'YI SYLLABLE DUOX', +41228: 'YI SYLLABLE DUO', +41229: 'YI SYLLABLE DOT', +41230: 'YI SYLLABLE DOX', +41231: 'YI SYLLABLE DO', +41232: 'YI SYLLABLE DOP', +41233: 'YI SYLLABLE DEX', +41234: 'YI SYLLABLE DE', +41235: 'YI SYLLABLE DEP', +41236: 'YI SYLLABLE DUT', +41237: 'YI SYLLABLE DUX', +41238: 'YI SYLLABLE DU', +41239: 'YI SYLLABLE DUP', +41240: 'YI SYLLABLE DURX', +41241: 'YI SYLLABLE DUR', +41242: 'YI SYLLABLE TIT', +41243: 'YI SYLLABLE TIX', +41244: 'YI SYLLABLE TI', +41245: 'YI SYLLABLE TIP', +41246: 'YI SYLLABLE TIEX', +41247: 'YI SYLLABLE TIE', +41248: 'YI SYLLABLE TIEP', +41249: 'YI SYLLABLE TAT', +41250: 'YI SYLLABLE TAX', +41251: 'YI SYLLABLE TA', +41252: 'YI SYLLABLE TAP', +41253: 'YI SYLLABLE TUOT', +41254: 'YI SYLLABLE TUOX', +41255: 'YI SYLLABLE TUO', +41256: 'YI SYLLABLE TUOP', +41257: 'YI SYLLABLE TOT', +41258: 'YI SYLLABLE TOX', +41259: 'YI SYLLABLE TO', +41260: 'YI SYLLABLE TOP', +41261: 'YI SYLLABLE TEX', +41262: 'YI SYLLABLE TE', +41263: 'YI SYLLABLE TEP', +41264: 'YI SYLLABLE TUT', +41265: 'YI SYLLABLE TUX', +41266: 'YI SYLLABLE TU', +41267: 'YI SYLLABLE TUP', +41268: 'YI SYLLABLE TURX', +41269: 'YI SYLLABLE TUR', +41270: 'YI SYLLABLE DDIT', +41271: 'YI SYLLABLE DDIX', +41272: 'YI SYLLABLE DDI', +41273: 'YI SYLLABLE DDIP', +41274: 'YI SYLLABLE DDIEX', +41275: 'YI SYLLABLE DDIE', +41276: 'YI SYLLABLE DDIEP', +41277: 'YI SYLLABLE DDAT', +41278: 'YI SYLLABLE DDAX', +41279: 'YI SYLLABLE DDA', +41280: 'YI SYLLABLE DDAP', +41281: 'YI SYLLABLE DDUOX', +41282: 'YI SYLLABLE DDUO', +41283: 'YI SYLLABLE DDUOP', +41284: 'YI SYLLABLE DDOT', +41285: 'YI SYLLABLE DDOX', +41286: 'YI SYLLABLE DDO', +41287: 'YI SYLLABLE DDOP', +41288: 'YI SYLLABLE DDEX', +41289: 'YI SYLLABLE DDE', +41290: 'YI SYLLABLE DDEP', +41291: 'YI SYLLABLE DDUT', +41292: 'YI SYLLABLE DDUX', +41293: 'YI SYLLABLE DDU', +41294: 'YI SYLLABLE DDUP', +41295: 'YI SYLLABLE DDURX', +41296: 'YI SYLLABLE DDUR', +41297: 'YI SYLLABLE NDIT', +41298: 'YI SYLLABLE NDIX', +41299: 'YI SYLLABLE NDI', +41300: 'YI SYLLABLE NDIP', +41301: 'YI SYLLABLE NDIEX', +41302: 'YI SYLLABLE NDIE', +41303: 'YI SYLLABLE NDAT', +41304: 'YI SYLLABLE NDAX', +41305: 'YI SYLLABLE NDA', +41306: 'YI SYLLABLE NDAP', +41307: 'YI SYLLABLE NDOT', +41308: 'YI SYLLABLE NDOX', +41309: 'YI SYLLABLE NDO', +41310: 'YI SYLLABLE NDOP', +41311: 'YI SYLLABLE NDEX', +41312: 'YI SYLLABLE NDE', +41313: 'YI SYLLABLE NDEP', +41314: 'YI SYLLABLE NDUT', +41315: 'YI SYLLABLE NDUX', +41316: 'YI SYLLABLE NDU', +41317: 'YI SYLLABLE NDUP', +41318: 'YI SYLLABLE NDURX', +41319: 'YI SYLLABLE NDUR', +41320: 'YI SYLLABLE HNIT', +41321: 'YI SYLLABLE HNIX', +41322: 'YI SYLLABLE HNI', +41323: 'YI SYLLABLE HNIP', +41324: 'YI SYLLABLE HNIET', +41325: 'YI SYLLABLE HNIEX', +41326: 'YI SYLLABLE HNIE', +41327: 'YI SYLLABLE HNIEP', +41328: 'YI SYLLABLE HNAT', +41329: 'YI SYLLABLE HNAX', +41330: 'YI SYLLABLE HNA', +41331: 'YI SYLLABLE HNAP', +41332: 'YI SYLLABLE HNUOX', +41333: 'YI SYLLABLE HNUO', +41334: 'YI SYLLABLE HNOT', +41335: 'YI SYLLABLE HNOX', +41336: 'YI SYLLABLE HNOP', +41337: 'YI SYLLABLE HNEX', +41338: 'YI SYLLABLE HNE', +41339: 'YI SYLLABLE HNEP', +41340: 'YI SYLLABLE HNUT', +41341: 'YI SYLLABLE NIT', +41342: 'YI SYLLABLE NIX', +41343: 'YI SYLLABLE NI', +41344: 'YI SYLLABLE NIP', +41345: 'YI SYLLABLE NIEX', +41346: 'YI SYLLABLE NIE', +41347: 'YI SYLLABLE NIEP', +41348: 'YI SYLLABLE NAX', +41349: 'YI SYLLABLE NA', +41350: 'YI SYLLABLE NAP', +41351: 'YI SYLLABLE NUOX', +41352: 'YI SYLLABLE NUO', +41353: 'YI SYLLABLE NUOP', +41354: 'YI SYLLABLE NOT', +41355: 'YI SYLLABLE NOX', +41356: 'YI SYLLABLE NO', +41357: 'YI SYLLABLE NOP', +41358: 'YI SYLLABLE NEX', +41359: 'YI SYLLABLE NE', +41360: 'YI SYLLABLE NEP', +41361: 'YI SYLLABLE NUT', +41362: 'YI SYLLABLE NUX', +41363: 'YI SYLLABLE NU', +41364: 'YI SYLLABLE NUP', +41365: 'YI SYLLABLE NURX', +41366: 'YI SYLLABLE NUR', +41367: 'YI SYLLABLE HLIT', +41368: 'YI SYLLABLE HLIX', +41369: 'YI SYLLABLE HLI', +41370: 'YI SYLLABLE HLIP', +41371: 'YI SYLLABLE HLIEX', +41372: 'YI SYLLABLE HLIE', +41373: 'YI SYLLABLE HLIEP', +41374: 'YI SYLLABLE HLAT', +41375: 'YI SYLLABLE HLAX', +41376: 'YI SYLLABLE HLA', +41377: 'YI SYLLABLE HLAP', +41378: 'YI SYLLABLE HLUOX', +41379: 'YI SYLLABLE HLUO', +41380: 'YI SYLLABLE HLUOP', +41381: 'YI SYLLABLE HLOX', +41382: 'YI SYLLABLE HLO', +41383: 'YI SYLLABLE HLOP', +41384: 'YI SYLLABLE HLEX', +41385: 'YI SYLLABLE HLE', +41386: 'YI SYLLABLE HLEP', +41387: 'YI SYLLABLE HLUT', +41388: 'YI SYLLABLE HLUX', +41389: 'YI SYLLABLE HLU', +41390: 'YI SYLLABLE HLUP', +41391: 'YI SYLLABLE HLURX', +41392: 'YI SYLLABLE HLUR', +41393: 'YI SYLLABLE HLYT', +41394: 'YI SYLLABLE HLYX', +41395: 'YI SYLLABLE HLY', +41396: 'YI SYLLABLE HLYP', +41397: 'YI SYLLABLE HLYRX', +41398: 'YI SYLLABLE HLYR', +41399: 'YI SYLLABLE LIT', +41400: 'YI SYLLABLE LIX', +41401: 'YI SYLLABLE LI', +41402: 'YI SYLLABLE LIP', +41403: 'YI SYLLABLE LIET', +41404: 'YI SYLLABLE LIEX', +41405: 'YI SYLLABLE LIE', +41406: 'YI SYLLABLE LIEP', +41407: 'YI SYLLABLE LAT', +41408: 'YI SYLLABLE LAX', +41409: 'YI SYLLABLE LA', +41410: 'YI SYLLABLE LAP', +41411: 'YI SYLLABLE LUOT', +41412: 'YI SYLLABLE LUOX', +41413: 'YI SYLLABLE LUO', +41414: 'YI SYLLABLE LUOP', +41415: 'YI SYLLABLE LOT', +41416: 'YI SYLLABLE LOX', +41417: 'YI SYLLABLE LO', +41418: 'YI SYLLABLE LOP', +41419: 'YI SYLLABLE LEX', +41420: 'YI SYLLABLE LE', +41421: 'YI SYLLABLE LEP', +41422: 'YI SYLLABLE LUT', +41423: 'YI SYLLABLE LUX', +41424: 'YI SYLLABLE LU', +41425: 'YI SYLLABLE LUP', +41426: 'YI SYLLABLE LURX', +41427: 'YI SYLLABLE LUR', +41428: 'YI SYLLABLE LYT', +41429: 'YI SYLLABLE LYX', +41430: 'YI SYLLABLE LY', +41431: 'YI SYLLABLE LYP', +41432: 'YI SYLLABLE LYRX', +41433: 'YI SYLLABLE LYR', +41434: 'YI SYLLABLE GIT', +41435: 'YI SYLLABLE GIX', +41436: 'YI SYLLABLE GI', +41437: 'YI SYLLABLE GIP', +41438: 'YI SYLLABLE GIET', +41439: 'YI SYLLABLE GIEX', +41440: 'YI SYLLABLE GIE', +41441: 'YI SYLLABLE GIEP', +41442: 'YI SYLLABLE GAT', +41443: 'YI SYLLABLE GAX', +41444: 'YI SYLLABLE GA', +41445: 'YI SYLLABLE GAP', +41446: 'YI SYLLABLE GUOT', +41447: 'YI SYLLABLE GUOX', +41448: 'YI SYLLABLE GUO', +41449: 'YI SYLLABLE GUOP', +41450: 'YI SYLLABLE GOT', +41451: 'YI SYLLABLE GOX', +41452: 'YI SYLLABLE GO', +41453: 'YI SYLLABLE GOP', +41454: 'YI SYLLABLE GET', +41455: 'YI SYLLABLE GEX', +41456: 'YI SYLLABLE GE', +41457: 'YI SYLLABLE GEP', +41458: 'YI SYLLABLE GUT', +41459: 'YI SYLLABLE GUX', +41460: 'YI SYLLABLE GU', +41461: 'YI SYLLABLE GUP', +41462: 'YI SYLLABLE GURX', +41463: 'YI SYLLABLE GUR', +41464: 'YI SYLLABLE KIT', +41465: 'YI SYLLABLE KIX', +41466: 'YI SYLLABLE KI', +41467: 'YI SYLLABLE KIP', +41468: 'YI SYLLABLE KIEX', +41469: 'YI SYLLABLE KIE', +41470: 'YI SYLLABLE KIEP', +41471: 'YI SYLLABLE KAT', +41472: 'YI SYLLABLE KAX', +41473: 'YI SYLLABLE KA', +41474: 'YI SYLLABLE KAP', +41475: 'YI SYLLABLE KUOX', +41476: 'YI SYLLABLE KUO', +41477: 'YI SYLLABLE KUOP', +41478: 'YI SYLLABLE KOT', +41479: 'YI SYLLABLE KOX', +41480: 'YI SYLLABLE KO', +41481: 'YI SYLLABLE KOP', +41482: 'YI SYLLABLE KET', +41483: 'YI SYLLABLE KEX', +41484: 'YI SYLLABLE KE', +41485: 'YI SYLLABLE KEP', +41486: 'YI SYLLABLE KUT', +41487: 'YI SYLLABLE KUX', +41488: 'YI SYLLABLE KU', +41489: 'YI SYLLABLE KUP', +41490: 'YI SYLLABLE KURX', +41491: 'YI SYLLABLE KUR', +41492: 'YI SYLLABLE GGIT', +41493: 'YI SYLLABLE GGIX', +41494: 'YI SYLLABLE GGI', +41495: 'YI SYLLABLE GGIEX', +41496: 'YI SYLLABLE GGIE', +41497: 'YI SYLLABLE GGIEP', +41498: 'YI SYLLABLE GGAT', +41499: 'YI SYLLABLE GGAX', +41500: 'YI SYLLABLE GGA', +41501: 'YI SYLLABLE GGAP', +41502: 'YI SYLLABLE GGUOT', +41503: 'YI SYLLABLE GGUOX', +41504: 'YI SYLLABLE GGUO', +41505: 'YI SYLLABLE GGUOP', +41506: 'YI SYLLABLE GGOT', +41507: 'YI SYLLABLE GGOX', +41508: 'YI SYLLABLE GGO', +41509: 'YI SYLLABLE GGOP', +41510: 'YI SYLLABLE GGET', +41511: 'YI SYLLABLE GGEX', +41512: 'YI SYLLABLE GGE', +41513: 'YI SYLLABLE GGEP', +41514: 'YI SYLLABLE GGUT', +41515: 'YI SYLLABLE GGUX', +41516: 'YI SYLLABLE GGU', +41517: 'YI SYLLABLE GGUP', +41518: 'YI SYLLABLE GGURX', +41519: 'YI SYLLABLE GGUR', +41520: 'YI SYLLABLE MGIEX', +41521: 'YI SYLLABLE MGIE', +41522: 'YI SYLLABLE MGAT', +41523: 'YI SYLLABLE MGAX', +41524: 'YI SYLLABLE MGA', +41525: 'YI SYLLABLE MGAP', +41526: 'YI SYLLABLE MGUOX', +41527: 'YI SYLLABLE MGUO', +41528: 'YI SYLLABLE MGUOP', +41529: 'YI SYLLABLE MGOT', +41530: 'YI SYLLABLE MGOX', +41531: 'YI SYLLABLE MGO', +41532: 'YI SYLLABLE MGOP', +41533: 'YI SYLLABLE MGEX', +41534: 'YI SYLLABLE MGE', +41535: 'YI SYLLABLE MGEP', +41536: 'YI SYLLABLE MGUT', +41537: 'YI SYLLABLE MGUX', +41538: 'YI SYLLABLE MGU', +41539: 'YI SYLLABLE MGUP', +41540: 'YI SYLLABLE MGURX', +41541: 'YI SYLLABLE MGUR', +41542: 'YI SYLLABLE HXIT', +41543: 'YI SYLLABLE HXIX', +41544: 'YI SYLLABLE HXI', +41545: 'YI SYLLABLE HXIP', +41546: 'YI SYLLABLE HXIET', +41547: 'YI SYLLABLE HXIEX', +41548: 'YI SYLLABLE HXIE', +41549: 'YI SYLLABLE HXIEP', +41550: 'YI SYLLABLE HXAT', +41551: 'YI SYLLABLE HXAX', +41552: 'YI SYLLABLE HXA', +41553: 'YI SYLLABLE HXAP', +41554: 'YI SYLLABLE HXUOT', +41555: 'YI SYLLABLE HXUOX', +41556: 'YI SYLLABLE HXUO', +41557: 'YI SYLLABLE HXUOP', +41558: 'YI SYLLABLE HXOT', +41559: 'YI SYLLABLE HXOX', +41560: 'YI SYLLABLE HXO', +41561: 'YI SYLLABLE HXOP', +41562: 'YI SYLLABLE HXEX', +41563: 'YI SYLLABLE HXE', +41564: 'YI SYLLABLE HXEP', +41565: 'YI SYLLABLE NGIEX', +41566: 'YI SYLLABLE NGIE', +41567: 'YI SYLLABLE NGIEP', +41568: 'YI SYLLABLE NGAT', +41569: 'YI SYLLABLE NGAX', +41570: 'YI SYLLABLE NGA', +41571: 'YI SYLLABLE NGAP', +41572: 'YI SYLLABLE NGUOT', +41573: 'YI SYLLABLE NGUOX', +41574: 'YI SYLLABLE NGUO', +41575: 'YI SYLLABLE NGOT', +41576: 'YI SYLLABLE NGOX', +41577: 'YI SYLLABLE NGO', +41578: 'YI SYLLABLE NGOP', +41579: 'YI SYLLABLE NGEX', +41580: 'YI SYLLABLE NGE', +41581: 'YI SYLLABLE NGEP', +41582: 'YI SYLLABLE HIT', +41583: 'YI SYLLABLE HIEX', +41584: 'YI SYLLABLE HIE', +41585: 'YI SYLLABLE HAT', +41586: 'YI SYLLABLE HAX', +41587: 'YI SYLLABLE HA', +41588: 'YI SYLLABLE HAP', +41589: 'YI SYLLABLE HUOT', +41590: 'YI SYLLABLE HUOX', +41591: 'YI SYLLABLE HUO', +41592: 'YI SYLLABLE HUOP', +41593: 'YI SYLLABLE HOT', +41594: 'YI SYLLABLE HOX', +41595: 'YI SYLLABLE HO', +41596: 'YI SYLLABLE HOP', +41597: 'YI SYLLABLE HEX', +41598: 'YI SYLLABLE HE', +41599: 'YI SYLLABLE HEP', +41600: 'YI SYLLABLE WAT', +41601: 'YI SYLLABLE WAX', +41602: 'YI SYLLABLE WA', +41603: 'YI SYLLABLE WAP', +41604: 'YI SYLLABLE WUOX', +41605: 'YI SYLLABLE WUO', +41606: 'YI SYLLABLE WUOP', +41607: 'YI SYLLABLE WOX', +41608: 'YI SYLLABLE WO', +41609: 'YI SYLLABLE WOP', +41610: 'YI SYLLABLE WEX', +41611: 'YI SYLLABLE WE', +41612: 'YI SYLLABLE WEP', +41613: 'YI SYLLABLE ZIT', +41614: 'YI SYLLABLE ZIX', +41615: 'YI SYLLABLE ZI', +41616: 'YI SYLLABLE ZIP', +41617: 'YI SYLLABLE ZIEX', +41618: 'YI SYLLABLE ZIE', +41619: 'YI SYLLABLE ZIEP', +41620: 'YI SYLLABLE ZAT', +41621: 'YI SYLLABLE ZAX', +41622: 'YI SYLLABLE ZA', +41623: 'YI SYLLABLE ZAP', +41624: 'YI SYLLABLE ZUOX', +41625: 'YI SYLLABLE ZUO', +41626: 'YI SYLLABLE ZUOP', +41627: 'YI SYLLABLE ZOT', +41628: 'YI SYLLABLE ZOX', +41629: 'YI SYLLABLE ZO', +41630: 'YI SYLLABLE ZOP', +41631: 'YI SYLLABLE ZEX', +41632: 'YI SYLLABLE ZE', +41633: 'YI SYLLABLE ZEP', +41634: 'YI SYLLABLE ZUT', +41635: 'YI SYLLABLE ZUX', +41636: 'YI SYLLABLE ZU', +41637: 'YI SYLLABLE ZUP', +41638: 'YI SYLLABLE ZURX', +41639: 'YI SYLLABLE ZUR', +41640: 'YI SYLLABLE ZYT', +41641: 'YI SYLLABLE ZYX', +41642: 'YI SYLLABLE ZY', +41643: 'YI SYLLABLE ZYP', +41644: 'YI SYLLABLE ZYRX', +41645: 'YI SYLLABLE ZYR', +41646: 'YI SYLLABLE CIT', +41647: 'YI SYLLABLE CIX', +41648: 'YI SYLLABLE CI', +41649: 'YI SYLLABLE CIP', +41650: 'YI SYLLABLE CIET', +41651: 'YI SYLLABLE CIEX', +41652: 'YI SYLLABLE CIE', +41653: 'YI SYLLABLE CIEP', +41654: 'YI SYLLABLE CAT', +41655: 'YI SYLLABLE CAX', +41656: 'YI SYLLABLE CA', +41657: 'YI SYLLABLE CAP', +41658: 'YI SYLLABLE CUOX', +41659: 'YI SYLLABLE CUO', +41660: 'YI SYLLABLE CUOP', +41661: 'YI SYLLABLE COT', +41662: 'YI SYLLABLE COX', +41663: 'YI SYLLABLE CO', +41664: 'YI SYLLABLE COP', +41665: 'YI SYLLABLE CEX', +41666: 'YI SYLLABLE CE', +41667: 'YI SYLLABLE CEP', +41668: 'YI SYLLABLE CUT', +41669: 'YI SYLLABLE CUX', +41670: 'YI SYLLABLE CU', +41671: 'YI SYLLABLE CUP', +41672: 'YI SYLLABLE CURX', +41673: 'YI SYLLABLE CUR', +41674: 'YI SYLLABLE CYT', +41675: 'YI SYLLABLE CYX', +41676: 'YI SYLLABLE CY', +41677: 'YI SYLLABLE CYP', +41678: 'YI SYLLABLE CYRX', +41679: 'YI SYLLABLE CYR', +41680: 'YI SYLLABLE ZZIT', +41681: 'YI SYLLABLE ZZIX', +41682: 'YI SYLLABLE ZZI', +41683: 'YI SYLLABLE ZZIP', +41684: 'YI SYLLABLE ZZIET', +41685: 'YI SYLLABLE ZZIEX', +41686: 'YI SYLLABLE ZZIE', +41687: 'YI SYLLABLE ZZIEP', +41688: 'YI SYLLABLE ZZAT', +41689: 'YI SYLLABLE ZZAX', +41690: 'YI SYLLABLE ZZA', +41691: 'YI SYLLABLE ZZAP', +41692: 'YI SYLLABLE ZZOX', +41693: 'YI SYLLABLE ZZO', +41694: 'YI SYLLABLE ZZOP', +41695: 'YI SYLLABLE ZZEX', +41696: 'YI SYLLABLE ZZE', +41697: 'YI SYLLABLE ZZEP', +41698: 'YI SYLLABLE ZZUX', +41699: 'YI SYLLABLE ZZU', +41700: 'YI SYLLABLE ZZUP', +41701: 'YI SYLLABLE ZZURX', +41702: 'YI SYLLABLE ZZUR', +41703: 'YI SYLLABLE ZZYT', +41704: 'YI SYLLABLE ZZYX', +41705: 'YI SYLLABLE ZZY', +41706: 'YI SYLLABLE ZZYP', +41707: 'YI SYLLABLE ZZYRX', +41708: 'YI SYLLABLE ZZYR', +41709: 'YI SYLLABLE NZIT', +41710: 'YI SYLLABLE NZIX', +41711: 'YI SYLLABLE NZI', +41712: 'YI SYLLABLE NZIP', +41713: 'YI SYLLABLE NZIEX', +41714: 'YI SYLLABLE NZIE', +41715: 'YI SYLLABLE NZIEP', +41716: 'YI SYLLABLE NZAT', +41717: 'YI SYLLABLE NZAX', +41718: 'YI SYLLABLE NZA', +41719: 'YI SYLLABLE NZAP', +41720: 'YI SYLLABLE NZUOX', +41721: 'YI SYLLABLE NZUO', +41722: 'YI SYLLABLE NZOX', +41723: 'YI SYLLABLE NZOP', +41724: 'YI SYLLABLE NZEX', +41725: 'YI SYLLABLE NZE', +41726: 'YI SYLLABLE NZUX', +41727: 'YI SYLLABLE NZU', +41728: 'YI SYLLABLE NZUP', +41729: 'YI SYLLABLE NZURX', +41730: 'YI SYLLABLE NZUR', +41731: 'YI SYLLABLE NZYT', +41732: 'YI SYLLABLE NZYX', +41733: 'YI SYLLABLE NZY', +41734: 'YI SYLLABLE NZYP', +41735: 'YI SYLLABLE NZYRX', +41736: 'YI SYLLABLE NZYR', +41737: 'YI SYLLABLE SIT', +41738: 'YI SYLLABLE SIX', +41739: 'YI SYLLABLE SI', +41740: 'YI SYLLABLE SIP', +41741: 'YI SYLLABLE SIEX', +41742: 'YI SYLLABLE SIE', +41743: 'YI SYLLABLE SIEP', +41744: 'YI SYLLABLE SAT', +41745: 'YI SYLLABLE SAX', +41746: 'YI SYLLABLE SA', +41747: 'YI SYLLABLE SAP', +41748: 'YI SYLLABLE SUOX', +41749: 'YI SYLLABLE SUO', +41750: 'YI SYLLABLE SUOP', +41751: 'YI SYLLABLE SOT', +41752: 'YI SYLLABLE SOX', +41753: 'YI SYLLABLE SO', +41754: 'YI SYLLABLE SOP', +41755: 'YI SYLLABLE SEX', +41756: 'YI SYLLABLE SE', +41757: 'YI SYLLABLE SEP', +41758: 'YI SYLLABLE SUT', +41759: 'YI SYLLABLE SUX', +41760: 'YI SYLLABLE SU', +41761: 'YI SYLLABLE SUP', +41762: 'YI SYLLABLE SURX', +41763: 'YI SYLLABLE SUR', +41764: 'YI SYLLABLE SYT', +41765: 'YI SYLLABLE SYX', +41766: 'YI SYLLABLE SY', +41767: 'YI SYLLABLE SYP', +41768: 'YI SYLLABLE SYRX', +41769: 'YI SYLLABLE SYR', +41770: 'YI SYLLABLE SSIT', +41771: 'YI SYLLABLE SSIX', +41772: 'YI SYLLABLE SSI', +41773: 'YI SYLLABLE SSIP', +41774: 'YI SYLLABLE SSIEX', +41775: 'YI SYLLABLE SSIE', +41776: 'YI SYLLABLE SSIEP', +41777: 'YI SYLLABLE SSAT', +41778: 'YI SYLLABLE SSAX', +41779: 'YI SYLLABLE SSA', +41780: 'YI SYLLABLE SSAP', +41781: 'YI SYLLABLE SSOT', +41782: 'YI SYLLABLE SSOX', +41783: 'YI SYLLABLE SSO', +41784: 'YI SYLLABLE SSOP', +41785: 'YI SYLLABLE SSEX', +41786: 'YI SYLLABLE SSE', +41787: 'YI SYLLABLE SSEP', +41788: 'YI SYLLABLE SSUT', +41789: 'YI SYLLABLE SSUX', +41790: 'YI SYLLABLE SSU', +41791: 'YI SYLLABLE SSUP', +41792: 'YI SYLLABLE SSYT', +41793: 'YI SYLLABLE SSYX', +41794: 'YI SYLLABLE SSY', +41795: 'YI SYLLABLE SSYP', +41796: 'YI SYLLABLE SSYRX', +41797: 'YI SYLLABLE SSYR', +41798: 'YI SYLLABLE ZHAT', +41799: 'YI SYLLABLE ZHAX', +41800: 'YI SYLLABLE ZHA', +41801: 'YI SYLLABLE ZHAP', +41802: 'YI SYLLABLE ZHUOX', +41803: 'YI SYLLABLE ZHUO', +41804: 'YI SYLLABLE ZHUOP', +41805: 'YI SYLLABLE ZHOT', +41806: 'YI SYLLABLE ZHOX', +41807: 'YI SYLLABLE ZHO', +41808: 'YI SYLLABLE ZHOP', +41809: 'YI SYLLABLE ZHET', +41810: 'YI SYLLABLE ZHEX', +41811: 'YI SYLLABLE ZHE', +41812: 'YI SYLLABLE ZHEP', +41813: 'YI SYLLABLE ZHUT', +41814: 'YI SYLLABLE ZHUX', +41815: 'YI SYLLABLE ZHU', +41816: 'YI SYLLABLE ZHUP', +41817: 'YI SYLLABLE ZHURX', +41818: 'YI SYLLABLE ZHUR', +41819: 'YI SYLLABLE ZHYT', +41820: 'YI SYLLABLE ZHYX', +41821: 'YI SYLLABLE ZHY', +41822: 'YI SYLLABLE ZHYP', +41823: 'YI SYLLABLE ZHYRX', +41824: 'YI SYLLABLE ZHYR', +41825: 'YI SYLLABLE CHAT', +41826: 'YI SYLLABLE CHAX', +41827: 'YI SYLLABLE CHA', +41828: 'YI SYLLABLE CHAP', +41829: 'YI SYLLABLE CHUOT', +41830: 'YI SYLLABLE CHUOX', +41831: 'YI SYLLABLE CHUO', +41832: 'YI SYLLABLE CHUOP', +41833: 'YI SYLLABLE CHOT', +41834: 'YI SYLLABLE CHOX', +41835: 'YI SYLLABLE CHO', +41836: 'YI SYLLABLE CHOP', +41837: 'YI SYLLABLE CHET', +41838: 'YI SYLLABLE CHEX', +41839: 'YI SYLLABLE CHE', +41840: 'YI SYLLABLE CHEP', +41841: 'YI SYLLABLE CHUX', +41842: 'YI SYLLABLE CHU', +41843: 'YI SYLLABLE CHUP', +41844: 'YI SYLLABLE CHURX', +41845: 'YI SYLLABLE CHUR', +41846: 'YI SYLLABLE CHYT', +41847: 'YI SYLLABLE CHYX', +41848: 'YI SYLLABLE CHY', +41849: 'YI SYLLABLE CHYP', +41850: 'YI SYLLABLE CHYRX', +41851: 'YI SYLLABLE CHYR', +41852: 'YI SYLLABLE RRAX', +41853: 'YI SYLLABLE RRA', +41854: 'YI SYLLABLE RRUOX', +41855: 'YI SYLLABLE RRUO', +41856: 'YI SYLLABLE RROT', +41857: 'YI SYLLABLE RROX', +41858: 'YI SYLLABLE RRO', +41859: 'YI SYLLABLE RROP', +41860: 'YI SYLLABLE RRET', +41861: 'YI SYLLABLE RREX', +41862: 'YI SYLLABLE RRE', +41863: 'YI SYLLABLE RREP', +41864: 'YI SYLLABLE RRUT', +41865: 'YI SYLLABLE RRUX', +41866: 'YI SYLLABLE RRU', +41867: 'YI SYLLABLE RRUP', +41868: 'YI SYLLABLE RRURX', +41869: 'YI SYLLABLE RRUR', +41870: 'YI SYLLABLE RRYT', +41871: 'YI SYLLABLE RRYX', +41872: 'YI SYLLABLE RRY', +41873: 'YI SYLLABLE RRYP', +41874: 'YI SYLLABLE RRYRX', +41875: 'YI SYLLABLE RRYR', +41876: 'YI SYLLABLE NRAT', +41877: 'YI SYLLABLE NRAX', +41878: 'YI SYLLABLE NRA', +41879: 'YI SYLLABLE NRAP', +41880: 'YI SYLLABLE NROX', +41881: 'YI SYLLABLE NRO', +41882: 'YI SYLLABLE NROP', +41883: 'YI SYLLABLE NRET', +41884: 'YI SYLLABLE NREX', +41885: 'YI SYLLABLE NRE', +41886: 'YI SYLLABLE NREP', +41887: 'YI SYLLABLE NRUT', +41888: 'YI SYLLABLE NRUX', +41889: 'YI SYLLABLE NRU', +41890: 'YI SYLLABLE NRUP', +41891: 'YI SYLLABLE NRURX', +41892: 'YI SYLLABLE NRUR', +41893: 'YI SYLLABLE NRYT', +41894: 'YI SYLLABLE NRYX', +41895: 'YI SYLLABLE NRY', +41896: 'YI SYLLABLE NRYP', +41897: 'YI SYLLABLE NRYRX', +41898: 'YI SYLLABLE NRYR', +41899: 'YI SYLLABLE SHAT', +41900: 'YI SYLLABLE SHAX', +41901: 'YI SYLLABLE SHA', +41902: 'YI SYLLABLE SHAP', +41903: 'YI SYLLABLE SHUOX', +41904: 'YI SYLLABLE SHUO', +41905: 'YI SYLLABLE SHUOP', +41906: 'YI SYLLABLE SHOT', +41907: 'YI SYLLABLE SHOX', +41908: 'YI SYLLABLE SHO', +41909: 'YI SYLLABLE SHOP', +41910: 'YI SYLLABLE SHET', +41911: 'YI SYLLABLE SHEX', +41912: 'YI SYLLABLE SHE', +41913: 'YI SYLLABLE SHEP', +41914: 'YI SYLLABLE SHUT', +41915: 'YI SYLLABLE SHUX', +41916: 'YI SYLLABLE SHU', +41917: 'YI SYLLABLE SHUP', +41918: 'YI SYLLABLE SHURX', +41919: 'YI SYLLABLE SHUR', +41920: 'YI SYLLABLE SHYT', +41921: 'YI SYLLABLE SHYX', +41922: 'YI SYLLABLE SHY', +41923: 'YI SYLLABLE SHYP', +41924: 'YI SYLLABLE SHYRX', +41925: 'YI SYLLABLE SHYR', +41926: 'YI SYLLABLE RAT', +41927: 'YI SYLLABLE RAX', +41928: 'YI SYLLABLE RA', +41929: 'YI SYLLABLE RAP', +41930: 'YI SYLLABLE RUOX', +41931: 'YI SYLLABLE RUO', +41932: 'YI SYLLABLE RUOP', +41933: 'YI SYLLABLE ROT', +41934: 'YI SYLLABLE ROX', +41935: 'YI SYLLABLE RO', +41936: 'YI SYLLABLE ROP', +41937: 'YI SYLLABLE REX', +41938: 'YI SYLLABLE RE', +41939: 'YI SYLLABLE REP', +41940: 'YI SYLLABLE RUT', +41941: 'YI SYLLABLE RUX', +41942: 'YI SYLLABLE RU', +41943: 'YI SYLLABLE RUP', +41944: 'YI SYLLABLE RURX', +41945: 'YI SYLLABLE RUR', +41946: 'YI SYLLABLE RYT', +41947: 'YI SYLLABLE RYX', +41948: 'YI SYLLABLE RY', +41949: 'YI SYLLABLE RYP', +41950: 'YI SYLLABLE RYRX', +41951: 'YI SYLLABLE RYR', +41952: 'YI SYLLABLE JIT', +41953: 'YI SYLLABLE JIX', +41954: 'YI SYLLABLE JI', +41955: 'YI SYLLABLE JIP', +41956: 'YI SYLLABLE JIET', +41957: 'YI SYLLABLE JIEX', +41958: 'YI SYLLABLE JIE', +41959: 'YI SYLLABLE JIEP', +41960: 'YI SYLLABLE JUOT', +41961: 'YI SYLLABLE JUOX', +41962: 'YI SYLLABLE JUO', +41963: 'YI SYLLABLE JUOP', +41964: 'YI SYLLABLE JOT', +41965: 'YI SYLLABLE JOX', +41966: 'YI SYLLABLE JO', +41967: 'YI SYLLABLE JOP', +41968: 'YI SYLLABLE JUT', +41969: 'YI SYLLABLE JUX', +41970: 'YI SYLLABLE JU', +41971: 'YI SYLLABLE JUP', +41972: 'YI SYLLABLE JURX', +41973: 'YI SYLLABLE JUR', +41974: 'YI SYLLABLE JYT', +41975: 'YI SYLLABLE JYX', +41976: 'YI SYLLABLE JY', +41977: 'YI SYLLABLE JYP', +41978: 'YI SYLLABLE JYRX', +41979: 'YI SYLLABLE JYR', +41980: 'YI SYLLABLE QIT', +41981: 'YI SYLLABLE QIX', +41982: 'YI SYLLABLE QI', +41983: 'YI SYLLABLE QIP', +41984: 'YI SYLLABLE QIET', +41985: 'YI SYLLABLE QIEX', +41986: 'YI SYLLABLE QIE', +41987: 'YI SYLLABLE QIEP', +41988: 'YI SYLLABLE QUOT', +41989: 'YI SYLLABLE QUOX', +41990: 'YI SYLLABLE QUO', +41991: 'YI SYLLABLE QUOP', +41992: 'YI SYLLABLE QOT', +41993: 'YI SYLLABLE QOX', +41994: 'YI SYLLABLE QO', +41995: 'YI SYLLABLE QOP', +41996: 'YI SYLLABLE QUT', +41997: 'YI SYLLABLE QUX', +41998: 'YI SYLLABLE QU', +41999: 'YI SYLLABLE QUP', +42000: 'YI SYLLABLE QURX', +42001: 'YI SYLLABLE QUR', +42002: 'YI SYLLABLE QYT', +42003: 'YI SYLLABLE QYX', +42004: 'YI SYLLABLE QY', +42005: 'YI SYLLABLE QYP', +42006: 'YI SYLLABLE QYRX', +42007: 'YI SYLLABLE QYR', +42008: 'YI SYLLABLE JJIT', +42009: 'YI SYLLABLE JJIX', +42010: 'YI SYLLABLE JJI', +42011: 'YI SYLLABLE JJIP', +42012: 'YI SYLLABLE JJIET', +42013: 'YI SYLLABLE JJIEX', +42014: 'YI SYLLABLE JJIE', +42015: 'YI SYLLABLE JJIEP', +42016: 'YI SYLLABLE JJUOX', +42017: 'YI SYLLABLE JJUO', +42018: 'YI SYLLABLE JJUOP', +42019: 'YI SYLLABLE JJOT', +42020: 'YI SYLLABLE JJOX', +42021: 'YI SYLLABLE JJO', +42022: 'YI SYLLABLE JJOP', +42023: 'YI SYLLABLE JJUT', +42024: 'YI SYLLABLE JJUX', +42025: 'YI SYLLABLE JJU', +42026: 'YI SYLLABLE JJUP', +42027: 'YI SYLLABLE JJURX', +42028: 'YI SYLLABLE JJUR', +42029: 'YI SYLLABLE JJYT', +42030: 'YI SYLLABLE JJYX', +42031: 'YI SYLLABLE JJY', +42032: 'YI SYLLABLE JJYP', +42033: 'YI SYLLABLE NJIT', +42034: 'YI SYLLABLE NJIX', +42035: 'YI SYLLABLE NJI', +42036: 'YI SYLLABLE NJIP', +42037: 'YI SYLLABLE NJIET', +42038: 'YI SYLLABLE NJIEX', +42039: 'YI SYLLABLE NJIE', +42040: 'YI SYLLABLE NJIEP', +42041: 'YI SYLLABLE NJUOX', +42042: 'YI SYLLABLE NJUO', +42043: 'YI SYLLABLE NJOT', +42044: 'YI SYLLABLE NJOX', +42045: 'YI SYLLABLE NJO', +42046: 'YI SYLLABLE NJOP', +42047: 'YI SYLLABLE NJUX', +42048: 'YI SYLLABLE NJU', +42049: 'YI SYLLABLE NJUP', +42050: 'YI SYLLABLE NJURX', +42051: 'YI SYLLABLE NJUR', +42052: 'YI SYLLABLE NJYT', +42053: 'YI SYLLABLE NJYX', +42054: 'YI SYLLABLE NJY', +42055: 'YI SYLLABLE NJYP', +42056: 'YI SYLLABLE NJYRX', +42057: 'YI SYLLABLE NJYR', +42058: 'YI SYLLABLE NYIT', +42059: 'YI SYLLABLE NYIX', +42060: 'YI SYLLABLE NYI', +42061: 'YI SYLLABLE NYIP', +42062: 'YI SYLLABLE NYIET', +42063: 'YI SYLLABLE NYIEX', +42064: 'YI SYLLABLE NYIE', +42065: 'YI SYLLABLE NYIEP', +42066: 'YI SYLLABLE NYUOX', +42067: 'YI SYLLABLE NYUO', +42068: 'YI SYLLABLE NYUOP', +42069: 'YI SYLLABLE NYOT', +42070: 'YI SYLLABLE NYOX', +42071: 'YI SYLLABLE NYO', +42072: 'YI SYLLABLE NYOP', +42073: 'YI SYLLABLE NYUT', +42074: 'YI SYLLABLE NYUX', +42075: 'YI SYLLABLE NYU', +42076: 'YI SYLLABLE NYUP', +42077: 'YI SYLLABLE XIT', +42078: 'YI SYLLABLE XIX', +42079: 'YI SYLLABLE XI', +42080: 'YI SYLLABLE XIP', +42081: 'YI SYLLABLE XIET', +42082: 'YI SYLLABLE XIEX', +42083: 'YI SYLLABLE XIE', +42084: 'YI SYLLABLE XIEP', +42085: 'YI SYLLABLE XUOX', +42086: 'YI SYLLABLE XUO', +42087: 'YI SYLLABLE XOT', +42088: 'YI SYLLABLE XOX', +42089: 'YI SYLLABLE XO', +42090: 'YI SYLLABLE XOP', +42091: 'YI SYLLABLE XYT', +42092: 'YI SYLLABLE XYX', +42093: 'YI SYLLABLE XY', +42094: 'YI SYLLABLE XYP', +42095: 'YI SYLLABLE XYRX', +42096: 'YI SYLLABLE XYR', +42097: 'YI SYLLABLE YIT', +42098: 'YI SYLLABLE YIX', +42099: 'YI SYLLABLE YI', +42100: 'YI SYLLABLE YIP', +42101: 'YI SYLLABLE YIET', +42102: 'YI SYLLABLE YIEX', +42103: 'YI SYLLABLE YIE', +42104: 'YI SYLLABLE YIEP', +42105: 'YI SYLLABLE YUOT', +42106: 'YI SYLLABLE YUOX', +42107: 'YI SYLLABLE YUO', +42108: 'YI SYLLABLE YUOP', +42109: 'YI SYLLABLE YOT', +42110: 'YI SYLLABLE YOX', +42111: 'YI SYLLABLE YO', +42112: 'YI SYLLABLE YOP', +42113: 'YI SYLLABLE YUT', +42114: 'YI SYLLABLE YUX', +42115: 'YI SYLLABLE YU', +42116: 'YI SYLLABLE YUP', +42117: 'YI SYLLABLE YURX', +42118: 'YI SYLLABLE YUR', +42119: 'YI SYLLABLE YYT', +42120: 'YI SYLLABLE YYX', +42121: 'YI SYLLABLE YY', +42122: 'YI SYLLABLE YYP', +42123: 'YI SYLLABLE YYRX', +42124: 'YI SYLLABLE YYR', +42128: 'YI RADICAL QOT', +42129: 'YI RADICAL LI', +42130: 'YI RADICAL KIT', +42131: 'YI RADICAL NYIP', +42132: 'YI RADICAL CYP', +42133: 'YI RADICAL SSI', +42134: 'YI RADICAL GGOP', +42135: 'YI RADICAL GEP', +42136: 'YI RADICAL MI', +42137: 'YI RADICAL HXIT', +42138: 'YI RADICAL LYR', +42139: 'YI RADICAL BBUT', +42140: 'YI RADICAL MOP', +42141: 'YI RADICAL YO', +42142: 'YI RADICAL PUT', +42143: 'YI RADICAL HXUO', +42144: 'YI RADICAL TAT', +42145: 'YI RADICAL GA', +42146: 'YI RADICAL ZUP', +42147: 'YI RADICAL CYT', +42148: 'YI RADICAL DDUR', +42149: 'YI RADICAL BUR', +42150: 'YI RADICAL GGUO', +42151: 'YI RADICAL NYOP', +42152: 'YI RADICAL TU', +42153: 'YI RADICAL OP', +42154: 'YI RADICAL JJUT', +42155: 'YI RADICAL ZOT', +42156: 'YI RADICAL PYT', +42157: 'YI RADICAL HMO', +42158: 'YI RADICAL YIT', +42159: 'YI RADICAL VUR', +42160: 'YI RADICAL SHY', +42161: 'YI RADICAL VEP', +42162: 'YI RADICAL ZA', +42163: 'YI RADICAL JO', +42164: 'YI RADICAL NZUP', +42165: 'YI RADICAL JJY', +42166: 'YI RADICAL GOT', +42167: 'YI RADICAL JJIE', +42168: 'YI RADICAL WO', +42169: 'YI RADICAL DU', +42170: 'YI RADICAL SHUR', +42171: 'YI RADICAL LIE', +42172: 'YI RADICAL CY', +42173: 'YI RADICAL CUOP', +42174: 'YI RADICAL CIP', +42175: 'YI RADICAL HXOP', +42176: 'YI RADICAL SHAT', +42177: 'YI RADICAL ZUR', +42178: 'YI RADICAL SHOP', +42179: 'YI RADICAL CHE', +42180: 'YI RADICAL ZZIET', +42181: 'YI RADICAL NBIE', +42182: 'YI RADICAL KE', +63744: 'CJK COMPATIBILITY IDEOGRAPH-F900', +63745: 'CJK COMPATIBILITY IDEOGRAPH-F901', +63746: 'CJK COMPATIBILITY IDEOGRAPH-F902', +63747: 'CJK COMPATIBILITY IDEOGRAPH-F903', +63748: 'CJK COMPATIBILITY IDEOGRAPH-F904', +63749: 'CJK COMPATIBILITY IDEOGRAPH-F905', +63750: 'CJK COMPATIBILITY IDEOGRAPH-F906', +63751: 'CJK COMPATIBILITY IDEOGRAPH-F907', +63752: 'CJK COMPATIBILITY IDEOGRAPH-F908', +63753: 'CJK COMPATIBILITY IDEOGRAPH-F909', +63754: 'CJK COMPATIBILITY IDEOGRAPH-F90A', +63755: 'CJK COMPATIBILITY IDEOGRAPH-F90B', +63756: 'CJK COMPATIBILITY IDEOGRAPH-F90C', +63757: 'CJK COMPATIBILITY IDEOGRAPH-F90D', +63758: 'CJK COMPATIBILITY IDEOGRAPH-F90E', +63759: 'CJK COMPATIBILITY IDEOGRAPH-F90F', +63760: 'CJK COMPATIBILITY IDEOGRAPH-F910', +63761: 'CJK COMPATIBILITY IDEOGRAPH-F911', +63762: 'CJK COMPATIBILITY IDEOGRAPH-F912', +63763: 'CJK COMPATIBILITY IDEOGRAPH-F913', +63764: 'CJK COMPATIBILITY IDEOGRAPH-F914', +63765: 'CJK COMPATIBILITY IDEOGRAPH-F915', +63766: 'CJK COMPATIBILITY IDEOGRAPH-F916', +63767: 'CJK COMPATIBILITY IDEOGRAPH-F917', +63768: 'CJK COMPATIBILITY IDEOGRAPH-F918', +63769: 'CJK COMPATIBILITY IDEOGRAPH-F919', +63770: 'CJK COMPATIBILITY IDEOGRAPH-F91A', +63771: 'CJK COMPATIBILITY IDEOGRAPH-F91B', +63772: 'CJK COMPATIBILITY IDEOGRAPH-F91C', +63773: 'CJK COMPATIBILITY IDEOGRAPH-F91D', +63774: 'CJK COMPATIBILITY IDEOGRAPH-F91E', +63775: 'CJK COMPATIBILITY IDEOGRAPH-F91F', +63776: 'CJK COMPATIBILITY IDEOGRAPH-F920', +63777: 'CJK COMPATIBILITY IDEOGRAPH-F921', +63778: 'CJK COMPATIBILITY IDEOGRAPH-F922', +63779: 'CJK COMPATIBILITY IDEOGRAPH-F923', +63780: 'CJK COMPATIBILITY IDEOGRAPH-F924', +63781: 'CJK COMPATIBILITY IDEOGRAPH-F925', +63782: 'CJK COMPATIBILITY IDEOGRAPH-F926', +63783: 'CJK COMPATIBILITY IDEOGRAPH-F927', +63784: 'CJK COMPATIBILITY IDEOGRAPH-F928', +63785: 'CJK COMPATIBILITY IDEOGRAPH-F929', +63786: 'CJK COMPATIBILITY IDEOGRAPH-F92A', +63787: 'CJK COMPATIBILITY IDEOGRAPH-F92B', +63788: 'CJK COMPATIBILITY IDEOGRAPH-F92C', +63789: 'CJK COMPATIBILITY IDEOGRAPH-F92D', +63790: 'CJK COMPATIBILITY IDEOGRAPH-F92E', +63791: 'CJK COMPATIBILITY IDEOGRAPH-F92F', +63792: 'CJK COMPATIBILITY IDEOGRAPH-F930', +63793: 'CJK COMPATIBILITY IDEOGRAPH-F931', +63794: 'CJK COMPATIBILITY IDEOGRAPH-F932', +63795: 'CJK COMPATIBILITY IDEOGRAPH-F933', +63796: 'CJK COMPATIBILITY IDEOGRAPH-F934', +63797: 'CJK COMPATIBILITY IDEOGRAPH-F935', +63798: 'CJK COMPATIBILITY IDEOGRAPH-F936', +63799: 'CJK COMPATIBILITY IDEOGRAPH-F937', +63800: 'CJK COMPATIBILITY IDEOGRAPH-F938', +63801: 'CJK COMPATIBILITY IDEOGRAPH-F939', +63802: 'CJK COMPATIBILITY IDEOGRAPH-F93A', +63803: 'CJK COMPATIBILITY IDEOGRAPH-F93B', +63804: 'CJK COMPATIBILITY IDEOGRAPH-F93C', +63805: 'CJK COMPATIBILITY IDEOGRAPH-F93D', +63806: 'CJK COMPATIBILITY IDEOGRAPH-F93E', +63807: 'CJK COMPATIBILITY IDEOGRAPH-F93F', +63808: 'CJK COMPATIBILITY IDEOGRAPH-F940', +63809: 'CJK COMPATIBILITY IDEOGRAPH-F941', +63810: 'CJK COMPATIBILITY IDEOGRAPH-F942', +63811: 'CJK COMPATIBILITY IDEOGRAPH-F943', +63812: 'CJK COMPATIBILITY IDEOGRAPH-F944', +63813: 'CJK COMPATIBILITY IDEOGRAPH-F945', +63814: 'CJK COMPATIBILITY IDEOGRAPH-F946', +63815: 'CJK COMPATIBILITY IDEOGRAPH-F947', +63816: 'CJK COMPATIBILITY IDEOGRAPH-F948', +63817: 'CJK COMPATIBILITY IDEOGRAPH-F949', +63818: 'CJK COMPATIBILITY IDEOGRAPH-F94A', +63819: 'CJK COMPATIBILITY IDEOGRAPH-F94B', +63820: 'CJK COMPATIBILITY IDEOGRAPH-F94C', +63821: 'CJK COMPATIBILITY IDEOGRAPH-F94D', +63822: 'CJK COMPATIBILITY IDEOGRAPH-F94E', +63823: 'CJK COMPATIBILITY IDEOGRAPH-F94F', +63824: 'CJK COMPATIBILITY IDEOGRAPH-F950', +63825: 'CJK COMPATIBILITY IDEOGRAPH-F951', +63826: 'CJK COMPATIBILITY IDEOGRAPH-F952', +63827: 'CJK COMPATIBILITY IDEOGRAPH-F953', +63828: 'CJK COMPATIBILITY IDEOGRAPH-F954', +63829: 'CJK COMPATIBILITY IDEOGRAPH-F955', +63830: 'CJK COMPATIBILITY IDEOGRAPH-F956', +63831: 'CJK COMPATIBILITY IDEOGRAPH-F957', +63832: 'CJK COMPATIBILITY IDEOGRAPH-F958', +63833: 'CJK COMPATIBILITY IDEOGRAPH-F959', +63834: 'CJK COMPATIBILITY IDEOGRAPH-F95A', +63835: 'CJK COMPATIBILITY IDEOGRAPH-F95B', +63836: 'CJK COMPATIBILITY IDEOGRAPH-F95C', +63837: 'CJK COMPATIBILITY IDEOGRAPH-F95D', +63838: 'CJK COMPATIBILITY IDEOGRAPH-F95E', +63839: 'CJK COMPATIBILITY IDEOGRAPH-F95F', +63840: 'CJK COMPATIBILITY IDEOGRAPH-F960', +63841: 'CJK COMPATIBILITY IDEOGRAPH-F961', +63842: 'CJK COMPATIBILITY IDEOGRAPH-F962', +63843: 'CJK COMPATIBILITY IDEOGRAPH-F963', +63844: 'CJK COMPATIBILITY IDEOGRAPH-F964', +63845: 'CJK COMPATIBILITY IDEOGRAPH-F965', +63846: 'CJK COMPATIBILITY IDEOGRAPH-F966', +63847: 'CJK COMPATIBILITY IDEOGRAPH-F967', +63848: 'CJK COMPATIBILITY IDEOGRAPH-F968', +63849: 'CJK COMPATIBILITY IDEOGRAPH-F969', +63850: 'CJK COMPATIBILITY IDEOGRAPH-F96A', +63851: 'CJK COMPATIBILITY IDEOGRAPH-F96B', +63852: 'CJK COMPATIBILITY IDEOGRAPH-F96C', +63853: 'CJK COMPATIBILITY IDEOGRAPH-F96D', +63854: 'CJK COMPATIBILITY IDEOGRAPH-F96E', +63855: 'CJK COMPATIBILITY IDEOGRAPH-F96F', +63856: 'CJK COMPATIBILITY IDEOGRAPH-F970', +63857: 'CJK COMPATIBILITY IDEOGRAPH-F971', +63858: 'CJK COMPATIBILITY IDEOGRAPH-F972', +63859: 'CJK COMPATIBILITY IDEOGRAPH-F973', +63860: 'CJK COMPATIBILITY IDEOGRAPH-F974', +63861: 'CJK COMPATIBILITY IDEOGRAPH-F975', +63862: 'CJK COMPATIBILITY IDEOGRAPH-F976', +63863: 'CJK COMPATIBILITY IDEOGRAPH-F977', +63864: 'CJK COMPATIBILITY IDEOGRAPH-F978', +63865: 'CJK COMPATIBILITY IDEOGRAPH-F979', +63866: 'CJK COMPATIBILITY IDEOGRAPH-F97A', +63867: 'CJK COMPATIBILITY IDEOGRAPH-F97B', +63868: 'CJK COMPATIBILITY IDEOGRAPH-F97C', +63869: 'CJK COMPATIBILITY IDEOGRAPH-F97D', +63870: 'CJK COMPATIBILITY IDEOGRAPH-F97E', +63871: 'CJK COMPATIBILITY IDEOGRAPH-F97F', +63872: 'CJK COMPATIBILITY IDEOGRAPH-F980', +63873: 'CJK COMPATIBILITY IDEOGRAPH-F981', +63874: 'CJK COMPATIBILITY IDEOGRAPH-F982', +63875: 'CJK COMPATIBILITY IDEOGRAPH-F983', +63876: 'CJK COMPATIBILITY IDEOGRAPH-F984', +63877: 'CJK COMPATIBILITY IDEOGRAPH-F985', +63878: 'CJK COMPATIBILITY IDEOGRAPH-F986', +63879: 'CJK COMPATIBILITY IDEOGRAPH-F987', +63880: 'CJK COMPATIBILITY IDEOGRAPH-F988', +63881: 'CJK COMPATIBILITY IDEOGRAPH-F989', +63882: 'CJK COMPATIBILITY IDEOGRAPH-F98A', +63883: 'CJK COMPATIBILITY IDEOGRAPH-F98B', +63884: 'CJK COMPATIBILITY IDEOGRAPH-F98C', +63885: 'CJK COMPATIBILITY IDEOGRAPH-F98D', +63886: 'CJK COMPATIBILITY IDEOGRAPH-F98E', +63887: 'CJK COMPATIBILITY IDEOGRAPH-F98F', +63888: 'CJK COMPATIBILITY IDEOGRAPH-F990', +63889: 'CJK COMPATIBILITY IDEOGRAPH-F991', +63890: 'CJK COMPATIBILITY IDEOGRAPH-F992', +63891: 'CJK COMPATIBILITY IDEOGRAPH-F993', +63892: 'CJK COMPATIBILITY IDEOGRAPH-F994', +63893: 'CJK COMPATIBILITY IDEOGRAPH-F995', +63894: 'CJK COMPATIBILITY IDEOGRAPH-F996', +63895: 'CJK COMPATIBILITY IDEOGRAPH-F997', +63896: 'CJK COMPATIBILITY IDEOGRAPH-F998', +63897: 'CJK COMPATIBILITY IDEOGRAPH-F999', +63898: 'CJK COMPATIBILITY IDEOGRAPH-F99A', +63899: 'CJK COMPATIBILITY IDEOGRAPH-F99B', +63900: 'CJK COMPATIBILITY IDEOGRAPH-F99C', +63901: 'CJK COMPATIBILITY IDEOGRAPH-F99D', +63902: 'CJK COMPATIBILITY IDEOGRAPH-F99E', +63903: 'CJK COMPATIBILITY IDEOGRAPH-F99F', +63904: 'CJK COMPATIBILITY IDEOGRAPH-F9A0', +63905: 'CJK COMPATIBILITY IDEOGRAPH-F9A1', +63906: 'CJK COMPATIBILITY IDEOGRAPH-F9A2', +63907: 'CJK COMPATIBILITY IDEOGRAPH-F9A3', +63908: 'CJK COMPATIBILITY IDEOGRAPH-F9A4', +63909: 'CJK COMPATIBILITY IDEOGRAPH-F9A5', +63910: 'CJK COMPATIBILITY IDEOGRAPH-F9A6', +63911: 'CJK COMPATIBILITY IDEOGRAPH-F9A7', +63912: 'CJK COMPATIBILITY IDEOGRAPH-F9A8', +63913: 'CJK COMPATIBILITY IDEOGRAPH-F9A9', +63914: 'CJK COMPATIBILITY IDEOGRAPH-F9AA', +63915: 'CJK COMPATIBILITY IDEOGRAPH-F9AB', +63916: 'CJK COMPATIBILITY IDEOGRAPH-F9AC', +63917: 'CJK COMPATIBILITY IDEOGRAPH-F9AD', +63918: 'CJK COMPATIBILITY IDEOGRAPH-F9AE', +63919: 'CJK COMPATIBILITY IDEOGRAPH-F9AF', +63920: 'CJK COMPATIBILITY IDEOGRAPH-F9B0', +63921: 'CJK COMPATIBILITY IDEOGRAPH-F9B1', +63922: 'CJK COMPATIBILITY IDEOGRAPH-F9B2', +63923: 'CJK COMPATIBILITY IDEOGRAPH-F9B3', +63924: 'CJK COMPATIBILITY IDEOGRAPH-F9B4', +63925: 'CJK COMPATIBILITY IDEOGRAPH-F9B5', +63926: 'CJK COMPATIBILITY IDEOGRAPH-F9B6', +63927: 'CJK COMPATIBILITY IDEOGRAPH-F9B7', +63928: 'CJK COMPATIBILITY IDEOGRAPH-F9B8', +63929: 'CJK COMPATIBILITY IDEOGRAPH-F9B9', +63930: 'CJK COMPATIBILITY IDEOGRAPH-F9BA', +63931: 'CJK COMPATIBILITY IDEOGRAPH-F9BB', +63932: 'CJK COMPATIBILITY IDEOGRAPH-F9BC', +63933: 'CJK COMPATIBILITY IDEOGRAPH-F9BD', +63934: 'CJK COMPATIBILITY IDEOGRAPH-F9BE', +63935: 'CJK COMPATIBILITY IDEOGRAPH-F9BF', +63936: 'CJK COMPATIBILITY IDEOGRAPH-F9C0', +63937: 'CJK COMPATIBILITY IDEOGRAPH-F9C1', +63938: 'CJK COMPATIBILITY IDEOGRAPH-F9C2', +63939: 'CJK COMPATIBILITY IDEOGRAPH-F9C3', +63940: 'CJK COMPATIBILITY IDEOGRAPH-F9C4', +63941: 'CJK COMPATIBILITY IDEOGRAPH-F9C5', +63942: 'CJK COMPATIBILITY IDEOGRAPH-F9C6', +63943: 'CJK COMPATIBILITY IDEOGRAPH-F9C7', +63944: 'CJK COMPATIBILITY IDEOGRAPH-F9C8', +63945: 'CJK COMPATIBILITY IDEOGRAPH-F9C9', +63946: 'CJK COMPATIBILITY IDEOGRAPH-F9CA', +63947: 'CJK COMPATIBILITY IDEOGRAPH-F9CB', +63948: 'CJK COMPATIBILITY IDEOGRAPH-F9CC', +63949: 'CJK COMPATIBILITY IDEOGRAPH-F9CD', +63950: 'CJK COMPATIBILITY IDEOGRAPH-F9CE', +63951: 'CJK COMPATIBILITY IDEOGRAPH-F9CF', +63952: 'CJK COMPATIBILITY IDEOGRAPH-F9D0', +63953: 'CJK COMPATIBILITY IDEOGRAPH-F9D1', +63954: 'CJK COMPATIBILITY IDEOGRAPH-F9D2', +63955: 'CJK COMPATIBILITY IDEOGRAPH-F9D3', +63956: 'CJK COMPATIBILITY IDEOGRAPH-F9D4', +63957: 'CJK COMPATIBILITY IDEOGRAPH-F9D5', +63958: 'CJK COMPATIBILITY IDEOGRAPH-F9D6', +63959: 'CJK COMPATIBILITY IDEOGRAPH-F9D7', +63960: 'CJK COMPATIBILITY IDEOGRAPH-F9D8', +63961: 'CJK COMPATIBILITY IDEOGRAPH-F9D9', +63962: 'CJK COMPATIBILITY IDEOGRAPH-F9DA', +63963: 'CJK COMPATIBILITY IDEOGRAPH-F9DB', +63964: 'CJK COMPATIBILITY IDEOGRAPH-F9DC', +63965: 'CJK COMPATIBILITY IDEOGRAPH-F9DD', +63966: 'CJK COMPATIBILITY IDEOGRAPH-F9DE', +63967: 'CJK COMPATIBILITY IDEOGRAPH-F9DF', +63968: 'CJK COMPATIBILITY IDEOGRAPH-F9E0', +63969: 'CJK COMPATIBILITY IDEOGRAPH-F9E1', +63970: 'CJK COMPATIBILITY IDEOGRAPH-F9E2', +63971: 'CJK COMPATIBILITY IDEOGRAPH-F9E3', +63972: 'CJK COMPATIBILITY IDEOGRAPH-F9E4', +63973: 'CJK COMPATIBILITY IDEOGRAPH-F9E5', +63974: 'CJK COMPATIBILITY IDEOGRAPH-F9E6', +63975: 'CJK COMPATIBILITY IDEOGRAPH-F9E7', +63976: 'CJK COMPATIBILITY IDEOGRAPH-F9E8', +63977: 'CJK COMPATIBILITY IDEOGRAPH-F9E9', +63978: 'CJK COMPATIBILITY IDEOGRAPH-F9EA', +63979: 'CJK COMPATIBILITY IDEOGRAPH-F9EB', +63980: 'CJK COMPATIBILITY IDEOGRAPH-F9EC', +63981: 'CJK COMPATIBILITY IDEOGRAPH-F9ED', +63982: 'CJK COMPATIBILITY IDEOGRAPH-F9EE', +63983: 'CJK COMPATIBILITY IDEOGRAPH-F9EF', +63984: 'CJK COMPATIBILITY IDEOGRAPH-F9F0', +63985: 'CJK COMPATIBILITY IDEOGRAPH-F9F1', +63986: 'CJK COMPATIBILITY IDEOGRAPH-F9F2', +63987: 'CJK COMPATIBILITY IDEOGRAPH-F9F3', +63988: 'CJK COMPATIBILITY IDEOGRAPH-F9F4', +63989: 'CJK COMPATIBILITY IDEOGRAPH-F9F5', +63990: 'CJK COMPATIBILITY IDEOGRAPH-F9F6', +63991: 'CJK COMPATIBILITY IDEOGRAPH-F9F7', +63992: 'CJK COMPATIBILITY IDEOGRAPH-F9F8', +63993: 'CJK COMPATIBILITY IDEOGRAPH-F9F9', +63994: 'CJK COMPATIBILITY IDEOGRAPH-F9FA', +63995: 'CJK COMPATIBILITY IDEOGRAPH-F9FB', +63996: 'CJK COMPATIBILITY IDEOGRAPH-F9FC', +63997: 'CJK COMPATIBILITY IDEOGRAPH-F9FD', +63998: 'CJK COMPATIBILITY IDEOGRAPH-F9FE', +63999: 'CJK COMPATIBILITY IDEOGRAPH-F9FF', +64000: 'CJK COMPATIBILITY IDEOGRAPH-FA00', +64001: 'CJK COMPATIBILITY IDEOGRAPH-FA01', +64002: 'CJK COMPATIBILITY IDEOGRAPH-FA02', +64003: 'CJK COMPATIBILITY IDEOGRAPH-FA03', +64004: 'CJK COMPATIBILITY IDEOGRAPH-FA04', +64005: 'CJK COMPATIBILITY IDEOGRAPH-FA05', +64006: 'CJK COMPATIBILITY IDEOGRAPH-FA06', +64007: 'CJK COMPATIBILITY IDEOGRAPH-FA07', +64008: 'CJK COMPATIBILITY IDEOGRAPH-FA08', +64009: 'CJK COMPATIBILITY IDEOGRAPH-FA09', +64010: 'CJK COMPATIBILITY IDEOGRAPH-FA0A', +64011: 'CJK COMPATIBILITY IDEOGRAPH-FA0B', +64012: 'CJK COMPATIBILITY IDEOGRAPH-FA0C', +64013: 'CJK COMPATIBILITY IDEOGRAPH-FA0D', +64014: 'CJK COMPATIBILITY IDEOGRAPH-FA0E', +64015: 'CJK COMPATIBILITY IDEOGRAPH-FA0F', +64016: 'CJK COMPATIBILITY IDEOGRAPH-FA10', +64017: 'CJK COMPATIBILITY IDEOGRAPH-FA11', +64018: 'CJK COMPATIBILITY IDEOGRAPH-FA12', +64019: 'CJK COMPATIBILITY IDEOGRAPH-FA13', +64020: 'CJK COMPATIBILITY IDEOGRAPH-FA14', +64021: 'CJK COMPATIBILITY IDEOGRAPH-FA15', +64022: 'CJK COMPATIBILITY IDEOGRAPH-FA16', +64023: 'CJK COMPATIBILITY IDEOGRAPH-FA17', +64024: 'CJK COMPATIBILITY IDEOGRAPH-FA18', +64025: 'CJK COMPATIBILITY IDEOGRAPH-FA19', +64026: 'CJK COMPATIBILITY IDEOGRAPH-FA1A', +64027: 'CJK COMPATIBILITY IDEOGRAPH-FA1B', +64028: 'CJK COMPATIBILITY IDEOGRAPH-FA1C', +64029: 'CJK COMPATIBILITY IDEOGRAPH-FA1D', +64030: 'CJK COMPATIBILITY IDEOGRAPH-FA1E', +64031: 'CJK COMPATIBILITY IDEOGRAPH-FA1F', +64032: 'CJK COMPATIBILITY IDEOGRAPH-FA20', +64033: 'CJK COMPATIBILITY IDEOGRAPH-FA21', +64034: 'CJK COMPATIBILITY IDEOGRAPH-FA22', +64035: 'CJK COMPATIBILITY IDEOGRAPH-FA23', +64036: 'CJK COMPATIBILITY IDEOGRAPH-FA24', +64037: 'CJK COMPATIBILITY IDEOGRAPH-FA25', +64038: 'CJK COMPATIBILITY IDEOGRAPH-FA26', +64039: 'CJK COMPATIBILITY IDEOGRAPH-FA27', +64040: 'CJK COMPATIBILITY IDEOGRAPH-FA28', +64041: 'CJK COMPATIBILITY IDEOGRAPH-FA29', +64042: 'CJK COMPATIBILITY IDEOGRAPH-FA2A', +64043: 'CJK COMPATIBILITY IDEOGRAPH-FA2B', +64044: 'CJK COMPATIBILITY IDEOGRAPH-FA2C', +64045: 'CJK COMPATIBILITY IDEOGRAPH-FA2D', +64048: 'CJK COMPATIBILITY IDEOGRAPH-FA30', +64049: 'CJK COMPATIBILITY IDEOGRAPH-FA31', +64050: 'CJK COMPATIBILITY IDEOGRAPH-FA32', +64051: 'CJK COMPATIBILITY IDEOGRAPH-FA33', +64052: 'CJK COMPATIBILITY IDEOGRAPH-FA34', +64053: 'CJK COMPATIBILITY IDEOGRAPH-FA35', +64054: 'CJK COMPATIBILITY IDEOGRAPH-FA36', +64055: 'CJK COMPATIBILITY IDEOGRAPH-FA37', +64056: 'CJK COMPATIBILITY IDEOGRAPH-FA38', +64057: 'CJK COMPATIBILITY IDEOGRAPH-FA39', +64058: 'CJK COMPATIBILITY IDEOGRAPH-FA3A', +64059: 'CJK COMPATIBILITY IDEOGRAPH-FA3B', +64060: 'CJK COMPATIBILITY IDEOGRAPH-FA3C', +64061: 'CJK COMPATIBILITY IDEOGRAPH-FA3D', +64062: 'CJK COMPATIBILITY IDEOGRAPH-FA3E', +64063: 'CJK COMPATIBILITY IDEOGRAPH-FA3F', +64064: 'CJK COMPATIBILITY IDEOGRAPH-FA40', +64065: 'CJK COMPATIBILITY IDEOGRAPH-FA41', +64066: 'CJK COMPATIBILITY IDEOGRAPH-FA42', +64067: 'CJK COMPATIBILITY IDEOGRAPH-FA43', +64068: 'CJK COMPATIBILITY IDEOGRAPH-FA44', +64069: 'CJK COMPATIBILITY IDEOGRAPH-FA45', +64070: 'CJK COMPATIBILITY IDEOGRAPH-FA46', +64071: 'CJK COMPATIBILITY IDEOGRAPH-FA47', +64072: 'CJK COMPATIBILITY IDEOGRAPH-FA48', +64073: 'CJK COMPATIBILITY IDEOGRAPH-FA49', +64074: 'CJK COMPATIBILITY IDEOGRAPH-FA4A', +64075: 'CJK COMPATIBILITY IDEOGRAPH-FA4B', +64076: 'CJK COMPATIBILITY IDEOGRAPH-FA4C', +64077: 'CJK COMPATIBILITY IDEOGRAPH-FA4D', +64078: 'CJK COMPATIBILITY IDEOGRAPH-FA4E', +64079: 'CJK COMPATIBILITY IDEOGRAPH-FA4F', +64080: 'CJK COMPATIBILITY IDEOGRAPH-FA50', +64081: 'CJK COMPATIBILITY IDEOGRAPH-FA51', +64082: 'CJK COMPATIBILITY IDEOGRAPH-FA52', +64083: 'CJK COMPATIBILITY IDEOGRAPH-FA53', +64084: 'CJK COMPATIBILITY IDEOGRAPH-FA54', +64085: 'CJK COMPATIBILITY IDEOGRAPH-FA55', +64086: 'CJK COMPATIBILITY IDEOGRAPH-FA56', +64087: 'CJK COMPATIBILITY IDEOGRAPH-FA57', +64088: 'CJK COMPATIBILITY IDEOGRAPH-FA58', +64089: 'CJK COMPATIBILITY IDEOGRAPH-FA59', +64090: 'CJK COMPATIBILITY IDEOGRAPH-FA5A', +64091: 'CJK COMPATIBILITY IDEOGRAPH-FA5B', +64092: 'CJK COMPATIBILITY IDEOGRAPH-FA5C', +64093: 'CJK COMPATIBILITY IDEOGRAPH-FA5D', +64094: 'CJK COMPATIBILITY IDEOGRAPH-FA5E', +64095: 'CJK COMPATIBILITY IDEOGRAPH-FA5F', +64096: 'CJK COMPATIBILITY IDEOGRAPH-FA60', +64097: 'CJK COMPATIBILITY IDEOGRAPH-FA61', +64098: 'CJK COMPATIBILITY IDEOGRAPH-FA62', +64099: 'CJK COMPATIBILITY IDEOGRAPH-FA63', +64100: 'CJK COMPATIBILITY IDEOGRAPH-FA64', +64101: 'CJK COMPATIBILITY IDEOGRAPH-FA65', +64102: 'CJK COMPATIBILITY IDEOGRAPH-FA66', +64103: 'CJK COMPATIBILITY IDEOGRAPH-FA67', +64104: 'CJK COMPATIBILITY IDEOGRAPH-FA68', +64105: 'CJK COMPATIBILITY IDEOGRAPH-FA69', +64106: 'CJK COMPATIBILITY IDEOGRAPH-FA6A', +64256: 'LATIN SMALL LIGATURE FF', +64257: 'LATIN SMALL LIGATURE FI', +64258: 'LATIN SMALL LIGATURE FL', +64259: 'LATIN SMALL LIGATURE FFI', +64260: 'LATIN SMALL LIGATURE FFL', +64261: 'LATIN SMALL LIGATURE LONG S T', +64262: 'LATIN SMALL LIGATURE ST', +64275: 'ARMENIAN SMALL LIGATURE MEN NOW', +64276: 'ARMENIAN SMALL LIGATURE MEN ECH', +64277: 'ARMENIAN SMALL LIGATURE MEN INI', +64278: 'ARMENIAN SMALL LIGATURE VEW NOW', +64279: 'ARMENIAN SMALL LIGATURE MEN XEH', +64285: 'HEBREW LETTER YOD WITH HIRIQ', +64286: 'HEBREW POINT JUDEO-SPANISH VARIKA', +64287: 'HEBREW LIGATURE YIDDISH YOD YOD PATAH', +64288: 'HEBREW LETTER ALTERNATIVE AYIN', +64289: 'HEBREW LETTER WIDE ALEF', +64290: 'HEBREW LETTER WIDE DALET', +64291: 'HEBREW LETTER WIDE HE', +64292: 'HEBREW LETTER WIDE KAF', +64293: 'HEBREW LETTER WIDE LAMED', +64294: 'HEBREW LETTER WIDE FINAL MEM', +64295: 'HEBREW LETTER WIDE RESH', +64296: 'HEBREW LETTER WIDE TAV', +64297: 'HEBREW LETTER ALTERNATIVE PLUS SIGN', +64298: 'HEBREW LETTER SHIN WITH SHIN DOT', +64299: 'HEBREW LETTER SHIN WITH SIN DOT', +64300: 'HEBREW LETTER SHIN WITH DAGESH AND SHIN DOT', +64301: 'HEBREW LETTER SHIN WITH DAGESH AND SIN DOT', +64302: 'HEBREW LETTER ALEF WITH PATAH', +64303: 'HEBREW LETTER ALEF WITH QAMATS', +64304: 'HEBREW LETTER ALEF WITH MAPIQ', +64305: 'HEBREW LETTER BET WITH DAGESH', +64306: 'HEBREW LETTER GIMEL WITH DAGESH', +64307: 'HEBREW LETTER DALET WITH DAGESH', +64308: 'HEBREW LETTER HE WITH MAPIQ', +64309: 'HEBREW LETTER VAV WITH DAGESH', +64310: 'HEBREW LETTER ZAYIN WITH DAGESH', +64312: 'HEBREW LETTER TET WITH DAGESH', +64313: 'HEBREW LETTER YOD WITH DAGESH', +64314: 'HEBREW LETTER FINAL KAF WITH DAGESH', +64315: 'HEBREW LETTER KAF WITH DAGESH', +64316: 'HEBREW LETTER LAMED WITH DAGESH', +64318: 'HEBREW LETTER MEM WITH DAGESH', +64320: 'HEBREW LETTER NUN WITH DAGESH', +64321: 'HEBREW LETTER SAMEKH WITH DAGESH', +64323: 'HEBREW LETTER FINAL PE WITH DAGESH', +64324: 'HEBREW LETTER PE WITH DAGESH', +64326: 'HEBREW LETTER TSADI WITH DAGESH', +64327: 'HEBREW LETTER QOF WITH DAGESH', +64328: 'HEBREW LETTER RESH WITH DAGESH', +64329: 'HEBREW LETTER SHIN WITH DAGESH', +64330: 'HEBREW LETTER TAV WITH DAGESH', +64331: 'HEBREW LETTER VAV WITH HOLAM', +64332: 'HEBREW LETTER BET WITH RAFE', +64333: 'HEBREW LETTER KAF WITH RAFE', +64334: 'HEBREW LETTER PE WITH RAFE', +64335: 'HEBREW LIGATURE ALEF LAMED', +64336: 'ARABIC LETTER ALEF WASLA ISOLATED FORM', +64337: 'ARABIC LETTER ALEF WASLA FINAL FORM', +64338: 'ARABIC LETTER BEEH ISOLATED FORM', +64339: 'ARABIC LETTER BEEH FINAL FORM', +64340: 'ARABIC LETTER BEEH INITIAL FORM', +64341: 'ARABIC LETTER BEEH MEDIAL FORM', +64342: 'ARABIC LETTER PEH ISOLATED FORM', +64343: 'ARABIC LETTER PEH FINAL FORM', +64344: 'ARABIC LETTER PEH INITIAL FORM', +64345: 'ARABIC LETTER PEH MEDIAL FORM', +64346: 'ARABIC LETTER BEHEH ISOLATED FORM', +64347: 'ARABIC LETTER BEHEH FINAL FORM', +64348: 'ARABIC LETTER BEHEH INITIAL FORM', +64349: 'ARABIC LETTER BEHEH MEDIAL FORM', +64350: 'ARABIC LETTER TTEHEH ISOLATED FORM', +64351: 'ARABIC LETTER TTEHEH FINAL FORM', +64352: 'ARABIC LETTER TTEHEH INITIAL FORM', +64353: 'ARABIC LETTER TTEHEH MEDIAL FORM', +64354: 'ARABIC LETTER TEHEH ISOLATED FORM', +64355: 'ARABIC LETTER TEHEH FINAL FORM', +64356: 'ARABIC LETTER TEHEH INITIAL FORM', +64357: 'ARABIC LETTER TEHEH MEDIAL FORM', +64358: 'ARABIC LETTER TTEH ISOLATED FORM', +64359: 'ARABIC LETTER TTEH FINAL FORM', +64360: 'ARABIC LETTER TTEH INITIAL FORM', +64361: 'ARABIC LETTER TTEH MEDIAL FORM', +64362: 'ARABIC LETTER VEH ISOLATED FORM', +64363: 'ARABIC LETTER VEH FINAL FORM', +64364: 'ARABIC LETTER VEH INITIAL FORM', +64365: 'ARABIC LETTER VEH MEDIAL FORM', +64366: 'ARABIC LETTER PEHEH ISOLATED FORM', +64367: 'ARABIC LETTER PEHEH FINAL FORM', +64368: 'ARABIC LETTER PEHEH INITIAL FORM', +64369: 'ARABIC LETTER PEHEH MEDIAL FORM', +64370: 'ARABIC LETTER DYEH ISOLATED FORM', +64371: 'ARABIC LETTER DYEH FINAL FORM', +64372: 'ARABIC LETTER DYEH INITIAL FORM', +64373: 'ARABIC LETTER DYEH MEDIAL FORM', +64374: 'ARABIC LETTER NYEH ISOLATED FORM', +64375: 'ARABIC LETTER NYEH FINAL FORM', +64376: 'ARABIC LETTER NYEH INITIAL FORM', +64377: 'ARABIC LETTER NYEH MEDIAL FORM', +64378: 'ARABIC LETTER TCHEH ISOLATED FORM', +64379: 'ARABIC LETTER TCHEH FINAL FORM', +64380: 'ARABIC LETTER TCHEH INITIAL FORM', +64381: 'ARABIC LETTER TCHEH MEDIAL FORM', +64382: 'ARABIC LETTER TCHEHEH ISOLATED FORM', +64383: 'ARABIC LETTER TCHEHEH FINAL FORM', +64384: 'ARABIC LETTER TCHEHEH INITIAL FORM', +64385: 'ARABIC LETTER TCHEHEH MEDIAL FORM', +64386: 'ARABIC LETTER DDAHAL ISOLATED FORM', +64387: 'ARABIC LETTER DDAHAL FINAL FORM', +64388: 'ARABIC LETTER DAHAL ISOLATED FORM', +64389: 'ARABIC LETTER DAHAL FINAL FORM', +64390: 'ARABIC LETTER DUL ISOLATED FORM', +64391: 'ARABIC LETTER DUL FINAL FORM', +64392: 'ARABIC LETTER DDAL ISOLATED FORM', +64393: 'ARABIC LETTER DDAL FINAL FORM', +64394: 'ARABIC LETTER JEH ISOLATED FORM', +64395: 'ARABIC LETTER JEH FINAL FORM', +64396: 'ARABIC LETTER RREH ISOLATED FORM', +64397: 'ARABIC LETTER RREH FINAL FORM', +64398: 'ARABIC LETTER KEHEH ISOLATED FORM', +64399: 'ARABIC LETTER KEHEH FINAL FORM', +64400: 'ARABIC LETTER KEHEH INITIAL FORM', +64401: 'ARABIC LETTER KEHEH MEDIAL FORM', +64402: 'ARABIC LETTER GAF ISOLATED FORM', +64403: 'ARABIC LETTER GAF FINAL FORM', +64404: 'ARABIC LETTER GAF INITIAL FORM', +64405: 'ARABIC LETTER GAF MEDIAL FORM', +64406: 'ARABIC LETTER GUEH ISOLATED FORM', +64407: 'ARABIC LETTER GUEH FINAL FORM', +64408: 'ARABIC LETTER GUEH INITIAL FORM', +64409: 'ARABIC LETTER GUEH MEDIAL FORM', +64410: 'ARABIC LETTER NGOEH ISOLATED FORM', +64411: 'ARABIC LETTER NGOEH FINAL FORM', +64412: 'ARABIC LETTER NGOEH INITIAL FORM', +64413: 'ARABIC LETTER NGOEH MEDIAL FORM', +64414: 'ARABIC LETTER NOON GHUNNA ISOLATED FORM', +64415: 'ARABIC LETTER NOON GHUNNA FINAL FORM', +64416: 'ARABIC LETTER RNOON ISOLATED FORM', +64417: 'ARABIC LETTER RNOON FINAL FORM', +64418: 'ARABIC LETTER RNOON INITIAL FORM', +64419: 'ARABIC LETTER RNOON MEDIAL FORM', +64420: 'ARABIC LETTER HEH WITH YEH ABOVE ISOLATED FORM', +64421: 'ARABIC LETTER HEH WITH YEH ABOVE FINAL FORM', +64422: 'ARABIC LETTER HEH GOAL ISOLATED FORM', +64423: 'ARABIC LETTER HEH GOAL FINAL FORM', +64424: 'ARABIC LETTER HEH GOAL INITIAL FORM', +64425: 'ARABIC LETTER HEH GOAL MEDIAL FORM', +64426: 'ARABIC LETTER HEH DOACHASHMEE ISOLATED FORM', +64427: 'ARABIC LETTER HEH DOACHASHMEE FINAL FORM', +64428: 'ARABIC LETTER HEH DOACHASHMEE INITIAL FORM', +64429: 'ARABIC LETTER HEH DOACHASHMEE MEDIAL FORM', +64430: 'ARABIC LETTER YEH BARREE ISOLATED FORM', +64431: 'ARABIC LETTER YEH BARREE FINAL FORM', +64432: 'ARABIC LETTER YEH BARREE WITH HAMZA ABOVE ISOLATED FORM', +64433: 'ARABIC LETTER YEH BARREE WITH HAMZA ABOVE FINAL FORM', +64467: 'ARABIC LETTER NG ISOLATED FORM', +64468: 'ARABIC LETTER NG FINAL FORM', +64469: 'ARABIC LETTER NG INITIAL FORM', +64470: 'ARABIC LETTER NG MEDIAL FORM', +64471: 'ARABIC LETTER U ISOLATED FORM', +64472: 'ARABIC LETTER U FINAL FORM', +64473: 'ARABIC LETTER OE ISOLATED FORM', +64474: 'ARABIC LETTER OE FINAL FORM', +64475: 'ARABIC LETTER YU ISOLATED FORM', +64476: 'ARABIC LETTER YU FINAL FORM', +64477: 'ARABIC LETTER U WITH HAMZA ABOVE ISOLATED FORM', +64478: 'ARABIC LETTER VE ISOLATED FORM', +64479: 'ARABIC LETTER VE FINAL FORM', +64480: 'ARABIC LETTER KIRGHIZ OE ISOLATED FORM', +64481: 'ARABIC LETTER KIRGHIZ OE FINAL FORM', +64482: 'ARABIC LETTER KIRGHIZ YU ISOLATED FORM', +64483: 'ARABIC LETTER KIRGHIZ YU FINAL FORM', +64484: 'ARABIC LETTER E ISOLATED FORM', +64485: 'ARABIC LETTER E FINAL FORM', +64486: 'ARABIC LETTER E INITIAL FORM', +64487: 'ARABIC LETTER E MEDIAL FORM', +64488: 'ARABIC LETTER UIGHUR KAZAKH KIRGHIZ ALEF MAKSURA INITIAL FORM', +64489: 'ARABIC LETTER UIGHUR KAZAKH KIRGHIZ ALEF MAKSURA MEDIAL FORM', +64490: 'ARABIC LIGATURE YEH WITH HAMZA ABOVE WITH ALEF ISOLATED FORM', +64491: 'ARABIC LIGATURE YEH WITH HAMZA ABOVE WITH ALEF FINAL FORM', +64492: 'ARABIC LIGATURE YEH WITH HAMZA ABOVE WITH AE ISOLATED FORM', +64493: 'ARABIC LIGATURE YEH WITH HAMZA ABOVE WITH AE FINAL FORM', +64494: 'ARABIC LIGATURE YEH WITH HAMZA ABOVE WITH WAW ISOLATED FORM', +64495: 'ARABIC LIGATURE YEH WITH HAMZA ABOVE WITH WAW FINAL FORM', +64496: 'ARABIC LIGATURE YEH WITH HAMZA ABOVE WITH U ISOLATED FORM', +64497: 'ARABIC LIGATURE YEH WITH HAMZA ABOVE WITH U FINAL FORM', +64498: 'ARABIC LIGATURE YEH WITH HAMZA ABOVE WITH OE ISOLATED FORM', +64499: 'ARABIC LIGATURE YEH WITH HAMZA ABOVE WITH OE FINAL FORM', +64500: 'ARABIC LIGATURE YEH WITH HAMZA ABOVE WITH YU ISOLATED FORM', +64501: 'ARABIC LIGATURE YEH WITH HAMZA ABOVE WITH YU FINAL FORM', +64502: 'ARABIC LIGATURE YEH WITH HAMZA ABOVE WITH E ISOLATED FORM', +64503: 'ARABIC LIGATURE YEH WITH HAMZA ABOVE WITH E FINAL FORM', +64504: 'ARABIC LIGATURE YEH WITH HAMZA ABOVE WITH E INITIAL FORM', +64505: 'ARABIC LIGATURE UIGHUR KIRGHIZ YEH WITH HAMZA ABOVE WITH ALEF MAKSURA ISOLATED FORM', +64506: 'ARABIC LIGATURE UIGHUR KIRGHIZ YEH WITH HAMZA ABOVE WITH ALEF MAKSURA FINAL FORM', +64507: 'ARABIC LIGATURE UIGHUR KIRGHIZ YEH WITH HAMZA ABOVE WITH ALEF MAKSURA INITIAL FORM', +64508: 'ARABIC LETTER FARSI YEH ISOLATED FORM', +64509: 'ARABIC LETTER FARSI YEH FINAL FORM', +64510: 'ARABIC LETTER FARSI YEH INITIAL FORM', +64511: 'ARABIC LETTER FARSI YEH MEDIAL FORM', +64512: 'ARABIC LIGATURE YEH WITH HAMZA ABOVE WITH JEEM ISOLATED FORM', +64513: 'ARABIC LIGATURE YEH WITH HAMZA ABOVE WITH HAH ISOLATED FORM', +64514: 'ARABIC LIGATURE YEH WITH HAMZA ABOVE WITH MEEM ISOLATED FORM', +64515: 'ARABIC LIGATURE YEH WITH HAMZA ABOVE WITH ALEF MAKSURA ISOLATED FORM', +64516: 'ARABIC LIGATURE YEH WITH HAMZA ABOVE WITH YEH ISOLATED FORM', +64517: 'ARABIC LIGATURE BEH WITH JEEM ISOLATED FORM', +64518: 'ARABIC LIGATURE BEH WITH HAH ISOLATED FORM', +64519: 'ARABIC LIGATURE BEH WITH KHAH ISOLATED FORM', +64520: 'ARABIC LIGATURE BEH WITH MEEM ISOLATED FORM', +64521: 'ARABIC LIGATURE BEH WITH ALEF MAKSURA ISOLATED FORM', +64522: 'ARABIC LIGATURE BEH WITH YEH ISOLATED FORM', +64523: 'ARABIC LIGATURE TEH WITH JEEM ISOLATED FORM', +64524: 'ARABIC LIGATURE TEH WITH HAH ISOLATED FORM', +64525: 'ARABIC LIGATURE TEH WITH KHAH ISOLATED FORM', +64526: 'ARABIC LIGATURE TEH WITH MEEM ISOLATED FORM', +64527: 'ARABIC LIGATURE TEH WITH ALEF MAKSURA ISOLATED FORM', +64528: 'ARABIC LIGATURE TEH WITH YEH ISOLATED FORM', +64529: 'ARABIC LIGATURE THEH WITH JEEM ISOLATED FORM', +64530: 'ARABIC LIGATURE THEH WITH MEEM ISOLATED FORM', +64531: 'ARABIC LIGATURE THEH WITH ALEF MAKSURA ISOLATED FORM', +64532: 'ARABIC LIGATURE THEH WITH YEH ISOLATED FORM', +64533: 'ARABIC LIGATURE JEEM WITH HAH ISOLATED FORM', +64534: 'ARABIC LIGATURE JEEM WITH MEEM ISOLATED FORM', +64535: 'ARABIC LIGATURE HAH WITH JEEM ISOLATED FORM', +64536: 'ARABIC LIGATURE HAH WITH MEEM ISOLATED FORM', +64537: 'ARABIC LIGATURE KHAH WITH JEEM ISOLATED FORM', +64538: 'ARABIC LIGATURE KHAH WITH HAH ISOLATED FORM', +64539: 'ARABIC LIGATURE KHAH WITH MEEM ISOLATED FORM', +64540: 'ARABIC LIGATURE SEEN WITH JEEM ISOLATED FORM', +64541: 'ARABIC LIGATURE SEEN WITH HAH ISOLATED FORM', +64542: 'ARABIC LIGATURE SEEN WITH KHAH ISOLATED FORM', +64543: 'ARABIC LIGATURE SEEN WITH MEEM ISOLATED FORM', +64544: 'ARABIC LIGATURE SAD WITH HAH ISOLATED FORM', +64545: 'ARABIC LIGATURE SAD WITH MEEM ISOLATED FORM', +64546: 'ARABIC LIGATURE DAD WITH JEEM ISOLATED FORM', +64547: 'ARABIC LIGATURE DAD WITH HAH ISOLATED FORM', +64548: 'ARABIC LIGATURE DAD WITH KHAH ISOLATED FORM', +64549: 'ARABIC LIGATURE DAD WITH MEEM ISOLATED FORM', +64550: 'ARABIC LIGATURE TAH WITH HAH ISOLATED FORM', +64551: 'ARABIC LIGATURE TAH WITH MEEM ISOLATED FORM', +64552: 'ARABIC LIGATURE ZAH WITH MEEM ISOLATED FORM', +64553: 'ARABIC LIGATURE AIN WITH JEEM ISOLATED FORM', +64554: 'ARABIC LIGATURE AIN WITH MEEM ISOLATED FORM', +64555: 'ARABIC LIGATURE GHAIN WITH JEEM ISOLATED FORM', +64556: 'ARABIC LIGATURE GHAIN WITH MEEM ISOLATED FORM', +64557: 'ARABIC LIGATURE FEH WITH JEEM ISOLATED FORM', +64558: 'ARABIC LIGATURE FEH WITH HAH ISOLATED FORM', +64559: 'ARABIC LIGATURE FEH WITH KHAH ISOLATED FORM', +64560: 'ARABIC LIGATURE FEH WITH MEEM ISOLATED FORM', +64561: 'ARABIC LIGATURE FEH WITH ALEF MAKSURA ISOLATED FORM', +64562: 'ARABIC LIGATURE FEH WITH YEH ISOLATED FORM', +64563: 'ARABIC LIGATURE QAF WITH HAH ISOLATED FORM', +64564: 'ARABIC LIGATURE QAF WITH MEEM ISOLATED FORM', +64565: 'ARABIC LIGATURE QAF WITH ALEF MAKSURA ISOLATED FORM', +64566: 'ARABIC LIGATURE QAF WITH YEH ISOLATED FORM', +64567: 'ARABIC LIGATURE KAF WITH ALEF ISOLATED FORM', +64568: 'ARABIC LIGATURE KAF WITH JEEM ISOLATED FORM', +64569: 'ARABIC LIGATURE KAF WITH HAH ISOLATED FORM', +64570: 'ARABIC LIGATURE KAF WITH KHAH ISOLATED FORM', +64571: 'ARABIC LIGATURE KAF WITH LAM ISOLATED FORM', +64572: 'ARABIC LIGATURE KAF WITH MEEM ISOLATED FORM', +64573: 'ARABIC LIGATURE KAF WITH ALEF MAKSURA ISOLATED FORM', +64574: 'ARABIC LIGATURE KAF WITH YEH ISOLATED FORM', +64575: 'ARABIC LIGATURE LAM WITH JEEM ISOLATED FORM', +64576: 'ARABIC LIGATURE LAM WITH HAH ISOLATED FORM', +64577: 'ARABIC LIGATURE LAM WITH KHAH ISOLATED FORM', +64578: 'ARABIC LIGATURE LAM WITH MEEM ISOLATED FORM', +64579: 'ARABIC LIGATURE LAM WITH ALEF MAKSURA ISOLATED FORM', +64580: 'ARABIC LIGATURE LAM WITH YEH ISOLATED FORM', +64581: 'ARABIC LIGATURE MEEM WITH JEEM ISOLATED FORM', +64582: 'ARABIC LIGATURE MEEM WITH HAH ISOLATED FORM', +64583: 'ARABIC LIGATURE MEEM WITH KHAH ISOLATED FORM', +64584: 'ARABIC LIGATURE MEEM WITH MEEM ISOLATED FORM', +64585: 'ARABIC LIGATURE MEEM WITH ALEF MAKSURA ISOLATED FORM', +64586: 'ARABIC LIGATURE MEEM WITH YEH ISOLATED FORM', +64587: 'ARABIC LIGATURE NOON WITH JEEM ISOLATED FORM', +64588: 'ARABIC LIGATURE NOON WITH HAH ISOLATED FORM', +64589: 'ARABIC LIGATURE NOON WITH KHAH ISOLATED FORM', +64590: 'ARABIC LIGATURE NOON WITH MEEM ISOLATED FORM', +64591: 'ARABIC LIGATURE NOON WITH ALEF MAKSURA ISOLATED FORM', +64592: 'ARABIC LIGATURE NOON WITH YEH ISOLATED FORM', +64593: 'ARABIC LIGATURE HEH WITH JEEM ISOLATED FORM', +64594: 'ARABIC LIGATURE HEH WITH MEEM ISOLATED FORM', +64595: 'ARABIC LIGATURE HEH WITH ALEF MAKSURA ISOLATED FORM', +64596: 'ARABIC LIGATURE HEH WITH YEH ISOLATED FORM', +64597: 'ARABIC LIGATURE YEH WITH JEEM ISOLATED FORM', +64598: 'ARABIC LIGATURE YEH WITH HAH ISOLATED FORM', +64599: 'ARABIC LIGATURE YEH WITH KHAH ISOLATED FORM', +64600: 'ARABIC LIGATURE YEH WITH MEEM ISOLATED FORM', +64601: 'ARABIC LIGATURE YEH WITH ALEF MAKSURA ISOLATED FORM', +64602: 'ARABIC LIGATURE YEH WITH YEH ISOLATED FORM', +64603: 'ARABIC LIGATURE THAL WITH SUPERSCRIPT ALEF ISOLATED FORM', +64604: 'ARABIC LIGATURE REH WITH SUPERSCRIPT ALEF ISOLATED FORM', +64605: 'ARABIC LIGATURE ALEF MAKSURA WITH SUPERSCRIPT ALEF ISOLATED FORM', +64606: 'ARABIC LIGATURE SHADDA WITH DAMMATAN ISOLATED FORM', +64607: 'ARABIC LIGATURE SHADDA WITH KASRATAN ISOLATED FORM', +64608: 'ARABIC LIGATURE SHADDA WITH FATHA ISOLATED FORM', +64609: 'ARABIC LIGATURE SHADDA WITH DAMMA ISOLATED FORM', +64610: 'ARABIC LIGATURE SHADDA WITH KASRA ISOLATED FORM', +64611: 'ARABIC LIGATURE SHADDA WITH SUPERSCRIPT ALEF ISOLATED FORM', +64612: 'ARABIC LIGATURE YEH WITH HAMZA ABOVE WITH REH FINAL FORM', +64613: 'ARABIC LIGATURE YEH WITH HAMZA ABOVE WITH ZAIN FINAL FORM', +64614: 'ARABIC LIGATURE YEH WITH HAMZA ABOVE WITH MEEM FINAL FORM', +64615: 'ARABIC LIGATURE YEH WITH HAMZA ABOVE WITH NOON FINAL FORM', +64616: 'ARABIC LIGATURE YEH WITH HAMZA ABOVE WITH ALEF MAKSURA FINAL FORM', +64617: 'ARABIC LIGATURE YEH WITH HAMZA ABOVE WITH YEH FINAL FORM', +64618: 'ARABIC LIGATURE BEH WITH REH FINAL FORM', +64619: 'ARABIC LIGATURE BEH WITH ZAIN FINAL FORM', +64620: 'ARABIC LIGATURE BEH WITH MEEM FINAL FORM', +64621: 'ARABIC LIGATURE BEH WITH NOON FINAL FORM', +64622: 'ARABIC LIGATURE BEH WITH ALEF MAKSURA FINAL FORM', +64623: 'ARABIC LIGATURE BEH WITH YEH FINAL FORM', +64624: 'ARABIC LIGATURE TEH WITH REH FINAL FORM', +64625: 'ARABIC LIGATURE TEH WITH ZAIN FINAL FORM', +64626: 'ARABIC LIGATURE TEH WITH MEEM FINAL FORM', +64627: 'ARABIC LIGATURE TEH WITH NOON FINAL FORM', +64628: 'ARABIC LIGATURE TEH WITH ALEF MAKSURA FINAL FORM', +64629: 'ARABIC LIGATURE TEH WITH YEH FINAL FORM', +64630: 'ARABIC LIGATURE THEH WITH REH FINAL FORM', +64631: 'ARABIC LIGATURE THEH WITH ZAIN FINAL FORM', +64632: 'ARABIC LIGATURE THEH WITH MEEM FINAL FORM', +64633: 'ARABIC LIGATURE THEH WITH NOON FINAL FORM', +64634: 'ARABIC LIGATURE THEH WITH ALEF MAKSURA FINAL FORM', +64635: 'ARABIC LIGATURE THEH WITH YEH FINAL FORM', +64636: 'ARABIC LIGATURE FEH WITH ALEF MAKSURA FINAL FORM', +64637: 'ARABIC LIGATURE FEH WITH YEH FINAL FORM', +64638: 'ARABIC LIGATURE QAF WITH ALEF MAKSURA FINAL FORM', +64639: 'ARABIC LIGATURE QAF WITH YEH FINAL FORM', +64640: 'ARABIC LIGATURE KAF WITH ALEF FINAL FORM', +64641: 'ARABIC LIGATURE KAF WITH LAM FINAL FORM', +64642: 'ARABIC LIGATURE KAF WITH MEEM FINAL FORM', +64643: 'ARABIC LIGATURE KAF WITH ALEF MAKSURA FINAL FORM', +64644: 'ARABIC LIGATURE KAF WITH YEH FINAL FORM', +64645: 'ARABIC LIGATURE LAM WITH MEEM FINAL FORM', +64646: 'ARABIC LIGATURE LAM WITH ALEF MAKSURA FINAL FORM', +64647: 'ARABIC LIGATURE LAM WITH YEH FINAL FORM', +64648: 'ARABIC LIGATURE MEEM WITH ALEF FINAL FORM', +64649: 'ARABIC LIGATURE MEEM WITH MEEM FINAL FORM', +64650: 'ARABIC LIGATURE NOON WITH REH FINAL FORM', +64651: 'ARABIC LIGATURE NOON WITH ZAIN FINAL FORM', +64652: 'ARABIC LIGATURE NOON WITH MEEM FINAL FORM', +64653: 'ARABIC LIGATURE NOON WITH NOON FINAL FORM', +64654: 'ARABIC LIGATURE NOON WITH ALEF MAKSURA FINAL FORM', +64655: 'ARABIC LIGATURE NOON WITH YEH FINAL FORM', +64656: 'ARABIC LIGATURE ALEF MAKSURA WITH SUPERSCRIPT ALEF FINAL FORM', +64657: 'ARABIC LIGATURE YEH WITH REH FINAL FORM', +64658: 'ARABIC LIGATURE YEH WITH ZAIN FINAL FORM', +64659: 'ARABIC LIGATURE YEH WITH MEEM FINAL FORM', +64660: 'ARABIC LIGATURE YEH WITH NOON FINAL FORM', +64661: 'ARABIC LIGATURE YEH WITH ALEF MAKSURA FINAL FORM', +64662: 'ARABIC LIGATURE YEH WITH YEH FINAL FORM', +64663: 'ARABIC LIGATURE YEH WITH HAMZA ABOVE WITH JEEM INITIAL FORM', +64664: 'ARABIC LIGATURE YEH WITH HAMZA ABOVE WITH HAH INITIAL FORM', +64665: 'ARABIC LIGATURE YEH WITH HAMZA ABOVE WITH KHAH INITIAL FORM', +64666: 'ARABIC LIGATURE YEH WITH HAMZA ABOVE WITH MEEM INITIAL FORM', +64667: 'ARABIC LIGATURE YEH WITH HAMZA ABOVE WITH HEH INITIAL FORM', +64668: 'ARABIC LIGATURE BEH WITH JEEM INITIAL FORM', +64669: 'ARABIC LIGATURE BEH WITH HAH INITIAL FORM', +64670: 'ARABIC LIGATURE BEH WITH KHAH INITIAL FORM', +64671: 'ARABIC LIGATURE BEH WITH MEEM INITIAL FORM', +64672: 'ARABIC LIGATURE BEH WITH HEH INITIAL FORM', +64673: 'ARABIC LIGATURE TEH WITH JEEM INITIAL FORM', +64674: 'ARABIC LIGATURE TEH WITH HAH INITIAL FORM', +64675: 'ARABIC LIGATURE TEH WITH KHAH INITIAL FORM', +64676: 'ARABIC LIGATURE TEH WITH MEEM INITIAL FORM', +64677: 'ARABIC LIGATURE TEH WITH HEH INITIAL FORM', +64678: 'ARABIC LIGATURE THEH WITH MEEM INITIAL FORM', +64679: 'ARABIC LIGATURE JEEM WITH HAH INITIAL FORM', +64680: 'ARABIC LIGATURE JEEM WITH MEEM INITIAL FORM', +64681: 'ARABIC LIGATURE HAH WITH JEEM INITIAL FORM', +64682: 'ARABIC LIGATURE HAH WITH MEEM INITIAL FORM', +64683: 'ARABIC LIGATURE KHAH WITH JEEM INITIAL FORM', +64684: 'ARABIC LIGATURE KHAH WITH MEEM INITIAL FORM', +64685: 'ARABIC LIGATURE SEEN WITH JEEM INITIAL FORM', +64686: 'ARABIC LIGATURE SEEN WITH HAH INITIAL FORM', +64687: 'ARABIC LIGATURE SEEN WITH KHAH INITIAL FORM', +64688: 'ARABIC LIGATURE SEEN WITH MEEM INITIAL FORM', +64689: 'ARABIC LIGATURE SAD WITH HAH INITIAL FORM', +64690: 'ARABIC LIGATURE SAD WITH KHAH INITIAL FORM', +64691: 'ARABIC LIGATURE SAD WITH MEEM INITIAL FORM', +64692: 'ARABIC LIGATURE DAD WITH JEEM INITIAL FORM', +64693: 'ARABIC LIGATURE DAD WITH HAH INITIAL FORM', +64694: 'ARABIC LIGATURE DAD WITH KHAH INITIAL FORM', +64695: 'ARABIC LIGATURE DAD WITH MEEM INITIAL FORM', +64696: 'ARABIC LIGATURE TAH WITH HAH INITIAL FORM', +64697: 'ARABIC LIGATURE ZAH WITH MEEM INITIAL FORM', +64698: 'ARABIC LIGATURE AIN WITH JEEM INITIAL FORM', +64699: 'ARABIC LIGATURE AIN WITH MEEM INITIAL FORM', +64700: 'ARABIC LIGATURE GHAIN WITH JEEM INITIAL FORM', +64701: 'ARABIC LIGATURE GHAIN WITH MEEM INITIAL FORM', +64702: 'ARABIC LIGATURE FEH WITH JEEM INITIAL FORM', +64703: 'ARABIC LIGATURE FEH WITH HAH INITIAL FORM', +64704: 'ARABIC LIGATURE FEH WITH KHAH INITIAL FORM', +64705: 'ARABIC LIGATURE FEH WITH MEEM INITIAL FORM', +64706: 'ARABIC LIGATURE QAF WITH HAH INITIAL FORM', +64707: 'ARABIC LIGATURE QAF WITH MEEM INITIAL FORM', +64708: 'ARABIC LIGATURE KAF WITH JEEM INITIAL FORM', +64709: 'ARABIC LIGATURE KAF WITH HAH INITIAL FORM', +64710: 'ARABIC LIGATURE KAF WITH KHAH INITIAL FORM', +64711: 'ARABIC LIGATURE KAF WITH LAM INITIAL FORM', +64712: 'ARABIC LIGATURE KAF WITH MEEM INITIAL FORM', +64713: 'ARABIC LIGATURE LAM WITH JEEM INITIAL FORM', +64714: 'ARABIC LIGATURE LAM WITH HAH INITIAL FORM', +64715: 'ARABIC LIGATURE LAM WITH KHAH INITIAL FORM', +64716: 'ARABIC LIGATURE LAM WITH MEEM INITIAL FORM', +64717: 'ARABIC LIGATURE LAM WITH HEH INITIAL FORM', +64718: 'ARABIC LIGATURE MEEM WITH JEEM INITIAL FORM', +64719: 'ARABIC LIGATURE MEEM WITH HAH INITIAL FORM', +64720: 'ARABIC LIGATURE MEEM WITH KHAH INITIAL FORM', +64721: 'ARABIC LIGATURE MEEM WITH MEEM INITIAL FORM', +64722: 'ARABIC LIGATURE NOON WITH JEEM INITIAL FORM', +64723: 'ARABIC LIGATURE NOON WITH HAH INITIAL FORM', +64724: 'ARABIC LIGATURE NOON WITH KHAH INITIAL FORM', +64725: 'ARABIC LIGATURE NOON WITH MEEM INITIAL FORM', +64726: 'ARABIC LIGATURE NOON WITH HEH INITIAL FORM', +64727: 'ARABIC LIGATURE HEH WITH JEEM INITIAL FORM', +64728: 'ARABIC LIGATURE HEH WITH MEEM INITIAL FORM', +64729: 'ARABIC LIGATURE HEH WITH SUPERSCRIPT ALEF INITIAL FORM', +64730: 'ARABIC LIGATURE YEH WITH JEEM INITIAL FORM', +64731: 'ARABIC LIGATURE YEH WITH HAH INITIAL FORM', +64732: 'ARABIC LIGATURE YEH WITH KHAH INITIAL FORM', +64733: 'ARABIC LIGATURE YEH WITH MEEM INITIAL FORM', +64734: 'ARABIC LIGATURE YEH WITH HEH INITIAL FORM', +64735: 'ARABIC LIGATURE YEH WITH HAMZA ABOVE WITH MEEM MEDIAL FORM', +64736: 'ARABIC LIGATURE YEH WITH HAMZA ABOVE WITH HEH MEDIAL FORM', +64737: 'ARABIC LIGATURE BEH WITH MEEM MEDIAL FORM', +64738: 'ARABIC LIGATURE BEH WITH HEH MEDIAL FORM', +64739: 'ARABIC LIGATURE TEH WITH MEEM MEDIAL FORM', +64740: 'ARABIC LIGATURE TEH WITH HEH MEDIAL FORM', +64741: 'ARABIC LIGATURE THEH WITH MEEM MEDIAL FORM', +64742: 'ARABIC LIGATURE THEH WITH HEH MEDIAL FORM', +64743: 'ARABIC LIGATURE SEEN WITH MEEM MEDIAL FORM', +64744: 'ARABIC LIGATURE SEEN WITH HEH MEDIAL FORM', +64745: 'ARABIC LIGATURE SHEEN WITH MEEM MEDIAL FORM', +64746: 'ARABIC LIGATURE SHEEN WITH HEH MEDIAL FORM', +64747: 'ARABIC LIGATURE KAF WITH LAM MEDIAL FORM', +64748: 'ARABIC LIGATURE KAF WITH MEEM MEDIAL FORM', +64749: 'ARABIC LIGATURE LAM WITH MEEM MEDIAL FORM', +64750: 'ARABIC LIGATURE NOON WITH MEEM MEDIAL FORM', +64751: 'ARABIC LIGATURE NOON WITH HEH MEDIAL FORM', +64752: 'ARABIC LIGATURE YEH WITH MEEM MEDIAL FORM', +64753: 'ARABIC LIGATURE YEH WITH HEH MEDIAL FORM', +64754: 'ARABIC LIGATURE SHADDA WITH FATHA MEDIAL FORM', +64755: 'ARABIC LIGATURE SHADDA WITH DAMMA MEDIAL FORM', +64756: 'ARABIC LIGATURE SHADDA WITH KASRA MEDIAL FORM', +64757: 'ARABIC LIGATURE TAH WITH ALEF MAKSURA ISOLATED FORM', +64758: 'ARABIC LIGATURE TAH WITH YEH ISOLATED FORM', +64759: 'ARABIC LIGATURE AIN WITH ALEF MAKSURA ISOLATED FORM', +64760: 'ARABIC LIGATURE AIN WITH YEH ISOLATED FORM', +64761: 'ARABIC LIGATURE GHAIN WITH ALEF MAKSURA ISOLATED FORM', +64762: 'ARABIC LIGATURE GHAIN WITH YEH ISOLATED FORM', +64763: 'ARABIC LIGATURE SEEN WITH ALEF MAKSURA ISOLATED FORM', +64764: 'ARABIC LIGATURE SEEN WITH YEH ISOLATED FORM', +64765: 'ARABIC LIGATURE SHEEN WITH ALEF MAKSURA ISOLATED FORM', +64766: 'ARABIC LIGATURE SHEEN WITH YEH ISOLATED FORM', +64767: 'ARABIC LIGATURE HAH WITH ALEF MAKSURA ISOLATED FORM', +64768: 'ARABIC LIGATURE HAH WITH YEH ISOLATED FORM', +64769: 'ARABIC LIGATURE JEEM WITH ALEF MAKSURA ISOLATED FORM', +64770: 'ARABIC LIGATURE JEEM WITH YEH ISOLATED FORM', +64771: 'ARABIC LIGATURE KHAH WITH ALEF MAKSURA ISOLATED FORM', +64772: 'ARABIC LIGATURE KHAH WITH YEH ISOLATED FORM', +64773: 'ARABIC LIGATURE SAD WITH ALEF MAKSURA ISOLATED FORM', +64774: 'ARABIC LIGATURE SAD WITH YEH ISOLATED FORM', +64775: 'ARABIC LIGATURE DAD WITH ALEF MAKSURA ISOLATED FORM', +64776: 'ARABIC LIGATURE DAD WITH YEH ISOLATED FORM', +64777: 'ARABIC LIGATURE SHEEN WITH JEEM ISOLATED FORM', +64778: 'ARABIC LIGATURE SHEEN WITH HAH ISOLATED FORM', +64779: 'ARABIC LIGATURE SHEEN WITH KHAH ISOLATED FORM', +64780: 'ARABIC LIGATURE SHEEN WITH MEEM ISOLATED FORM', +64781: 'ARABIC LIGATURE SHEEN WITH REH ISOLATED FORM', +64782: 'ARABIC LIGATURE SEEN WITH REH ISOLATED FORM', +64783: 'ARABIC LIGATURE SAD WITH REH ISOLATED FORM', +64784: 'ARABIC LIGATURE DAD WITH REH ISOLATED FORM', +64785: 'ARABIC LIGATURE TAH WITH ALEF MAKSURA FINAL FORM', +64786: 'ARABIC LIGATURE TAH WITH YEH FINAL FORM', +64787: 'ARABIC LIGATURE AIN WITH ALEF MAKSURA FINAL FORM', +64788: 'ARABIC LIGATURE AIN WITH YEH FINAL FORM', +64789: 'ARABIC LIGATURE GHAIN WITH ALEF MAKSURA FINAL FORM', +64790: 'ARABIC LIGATURE GHAIN WITH YEH FINAL FORM', +64791: 'ARABIC LIGATURE SEEN WITH ALEF MAKSURA FINAL FORM', +64792: 'ARABIC LIGATURE SEEN WITH YEH FINAL FORM', +64793: 'ARABIC LIGATURE SHEEN WITH ALEF MAKSURA FINAL FORM', +64794: 'ARABIC LIGATURE SHEEN WITH YEH FINAL FORM', +64795: 'ARABIC LIGATURE HAH WITH ALEF MAKSURA FINAL FORM', +64796: 'ARABIC LIGATURE HAH WITH YEH FINAL FORM', +64797: 'ARABIC LIGATURE JEEM WITH ALEF MAKSURA FINAL FORM', +64798: 'ARABIC LIGATURE JEEM WITH YEH FINAL FORM', +64799: 'ARABIC LIGATURE KHAH WITH ALEF MAKSURA FINAL FORM', +64800: 'ARABIC LIGATURE KHAH WITH YEH FINAL FORM', +64801: 'ARABIC LIGATURE SAD WITH ALEF MAKSURA FINAL FORM', +64802: 'ARABIC LIGATURE SAD WITH YEH FINAL FORM', +64803: 'ARABIC LIGATURE DAD WITH ALEF MAKSURA FINAL FORM', +64804: 'ARABIC LIGATURE DAD WITH YEH FINAL FORM', +64805: 'ARABIC LIGATURE SHEEN WITH JEEM FINAL FORM', +64806: 'ARABIC LIGATURE SHEEN WITH HAH FINAL FORM', +64807: 'ARABIC LIGATURE SHEEN WITH KHAH FINAL FORM', +64808: 'ARABIC LIGATURE SHEEN WITH MEEM FINAL FORM', +64809: 'ARABIC LIGATURE SHEEN WITH REH FINAL FORM', +64810: 'ARABIC LIGATURE SEEN WITH REH FINAL FORM', +64811: 'ARABIC LIGATURE SAD WITH REH FINAL FORM', +64812: 'ARABIC LIGATURE DAD WITH REH FINAL FORM', +64813: 'ARABIC LIGATURE SHEEN WITH JEEM INITIAL FORM', +64814: 'ARABIC LIGATURE SHEEN WITH HAH INITIAL FORM', +64815: 'ARABIC LIGATURE SHEEN WITH KHAH INITIAL FORM', +64816: 'ARABIC LIGATURE SHEEN WITH MEEM INITIAL FORM', +64817: 'ARABIC LIGATURE SEEN WITH HEH INITIAL FORM', +64818: 'ARABIC LIGATURE SHEEN WITH HEH INITIAL FORM', +64819: 'ARABIC LIGATURE TAH WITH MEEM INITIAL FORM', +64820: 'ARABIC LIGATURE SEEN WITH JEEM MEDIAL FORM', +64821: 'ARABIC LIGATURE SEEN WITH HAH MEDIAL FORM', +64822: 'ARABIC LIGATURE SEEN WITH KHAH MEDIAL FORM', +64823: 'ARABIC LIGATURE SHEEN WITH JEEM MEDIAL FORM', +64824: 'ARABIC LIGATURE SHEEN WITH HAH MEDIAL FORM', +64825: 'ARABIC LIGATURE SHEEN WITH KHAH MEDIAL FORM', +64826: 'ARABIC LIGATURE TAH WITH MEEM MEDIAL FORM', +64827: 'ARABIC LIGATURE ZAH WITH MEEM MEDIAL FORM', +64828: 'ARABIC LIGATURE ALEF WITH FATHATAN FINAL FORM', +64829: 'ARABIC LIGATURE ALEF WITH FATHATAN ISOLATED FORM', +64830: 'ORNATE LEFT PARENTHESIS', +64831: 'ORNATE RIGHT PARENTHESIS', +64848: 'ARABIC LIGATURE TEH WITH JEEM WITH MEEM INITIAL FORM', +64849: 'ARABIC LIGATURE TEH WITH HAH WITH JEEM FINAL FORM', +64850: 'ARABIC LIGATURE TEH WITH HAH WITH JEEM INITIAL FORM', +64851: 'ARABIC LIGATURE TEH WITH HAH WITH MEEM INITIAL FORM', +64852: 'ARABIC LIGATURE TEH WITH KHAH WITH MEEM INITIAL FORM', +64853: 'ARABIC LIGATURE TEH WITH MEEM WITH JEEM INITIAL FORM', +64854: 'ARABIC LIGATURE TEH WITH MEEM WITH HAH INITIAL FORM', +64855: 'ARABIC LIGATURE TEH WITH MEEM WITH KHAH INITIAL FORM', +64856: 'ARABIC LIGATURE JEEM WITH MEEM WITH HAH FINAL FORM', +64857: 'ARABIC LIGATURE JEEM WITH MEEM WITH HAH INITIAL FORM', +64858: 'ARABIC LIGATURE HAH WITH MEEM WITH YEH FINAL FORM', +64859: 'ARABIC LIGATURE HAH WITH MEEM WITH ALEF MAKSURA FINAL FORM', +64860: 'ARABIC LIGATURE SEEN WITH HAH WITH JEEM INITIAL FORM', +64861: 'ARABIC LIGATURE SEEN WITH JEEM WITH HAH INITIAL FORM', +64862: 'ARABIC LIGATURE SEEN WITH JEEM WITH ALEF MAKSURA FINAL FORM', +64863: 'ARABIC LIGATURE SEEN WITH MEEM WITH HAH FINAL FORM', +64864: 'ARABIC LIGATURE SEEN WITH MEEM WITH HAH INITIAL FORM', +64865: 'ARABIC LIGATURE SEEN WITH MEEM WITH JEEM INITIAL FORM', +64866: 'ARABIC LIGATURE SEEN WITH MEEM WITH MEEM FINAL FORM', +64867: 'ARABIC LIGATURE SEEN WITH MEEM WITH MEEM INITIAL FORM', +64868: 'ARABIC LIGATURE SAD WITH HAH WITH HAH FINAL FORM', +64869: 'ARABIC LIGATURE SAD WITH HAH WITH HAH INITIAL FORM', +64870: 'ARABIC LIGATURE SAD WITH MEEM WITH MEEM FINAL FORM', +64871: 'ARABIC LIGATURE SHEEN WITH HAH WITH MEEM FINAL FORM', +64872: 'ARABIC LIGATURE SHEEN WITH HAH WITH MEEM INITIAL FORM', +64873: 'ARABIC LIGATURE SHEEN WITH JEEM WITH YEH FINAL FORM', +64874: 'ARABIC LIGATURE SHEEN WITH MEEM WITH KHAH FINAL FORM', +64875: 'ARABIC LIGATURE SHEEN WITH MEEM WITH KHAH INITIAL FORM', +64876: 'ARABIC LIGATURE SHEEN WITH MEEM WITH MEEM FINAL FORM', +64877: 'ARABIC LIGATURE SHEEN WITH MEEM WITH MEEM INITIAL FORM', +64878: 'ARABIC LIGATURE DAD WITH HAH WITH ALEF MAKSURA FINAL FORM', +64879: 'ARABIC LIGATURE DAD WITH KHAH WITH MEEM FINAL FORM', +64880: 'ARABIC LIGATURE DAD WITH KHAH WITH MEEM INITIAL FORM', +64881: 'ARABIC LIGATURE TAH WITH MEEM WITH HAH FINAL FORM', +64882: 'ARABIC LIGATURE TAH WITH MEEM WITH HAH INITIAL FORM', +64883: 'ARABIC LIGATURE TAH WITH MEEM WITH MEEM INITIAL FORM', +64884: 'ARABIC LIGATURE TAH WITH MEEM WITH YEH FINAL FORM', +64885: 'ARABIC LIGATURE AIN WITH JEEM WITH MEEM FINAL FORM', +64886: 'ARABIC LIGATURE AIN WITH MEEM WITH MEEM FINAL FORM', +64887: 'ARABIC LIGATURE AIN WITH MEEM WITH MEEM INITIAL FORM', +64888: 'ARABIC LIGATURE AIN WITH MEEM WITH ALEF MAKSURA FINAL FORM', +64889: 'ARABIC LIGATURE GHAIN WITH MEEM WITH MEEM FINAL FORM', +64890: 'ARABIC LIGATURE GHAIN WITH MEEM WITH YEH FINAL FORM', +64891: 'ARABIC LIGATURE GHAIN WITH MEEM WITH ALEF MAKSURA FINAL FORM', +64892: 'ARABIC LIGATURE FEH WITH KHAH WITH MEEM FINAL FORM', +64893: 'ARABIC LIGATURE FEH WITH KHAH WITH MEEM INITIAL FORM', +64894: 'ARABIC LIGATURE QAF WITH MEEM WITH HAH FINAL FORM', +64895: 'ARABIC LIGATURE QAF WITH MEEM WITH MEEM FINAL FORM', +64896: 'ARABIC LIGATURE LAM WITH HAH WITH MEEM FINAL FORM', +64897: 'ARABIC LIGATURE LAM WITH HAH WITH YEH FINAL FORM', +64898: 'ARABIC LIGATURE LAM WITH HAH WITH ALEF MAKSURA FINAL FORM', +64899: 'ARABIC LIGATURE LAM WITH JEEM WITH JEEM INITIAL FORM', +64900: 'ARABIC LIGATURE LAM WITH JEEM WITH JEEM FINAL FORM', +64901: 'ARABIC LIGATURE LAM WITH KHAH WITH MEEM FINAL FORM', +64902: 'ARABIC LIGATURE LAM WITH KHAH WITH MEEM INITIAL FORM', +64903: 'ARABIC LIGATURE LAM WITH MEEM WITH HAH FINAL FORM', +64904: 'ARABIC LIGATURE LAM WITH MEEM WITH HAH INITIAL FORM', +64905: 'ARABIC LIGATURE MEEM WITH HAH WITH JEEM INITIAL FORM', +64906: 'ARABIC LIGATURE MEEM WITH HAH WITH MEEM INITIAL FORM', +64907: 'ARABIC LIGATURE MEEM WITH HAH WITH YEH FINAL FORM', +64908: 'ARABIC LIGATURE MEEM WITH JEEM WITH HAH INITIAL FORM', +64909: 'ARABIC LIGATURE MEEM WITH JEEM WITH MEEM INITIAL FORM', +64910: 'ARABIC LIGATURE MEEM WITH KHAH WITH JEEM INITIAL FORM', +64911: 'ARABIC LIGATURE MEEM WITH KHAH WITH MEEM INITIAL FORM', +64914: 'ARABIC LIGATURE MEEM WITH JEEM WITH KHAH INITIAL FORM', +64915: 'ARABIC LIGATURE HEH WITH MEEM WITH JEEM INITIAL FORM', +64916: 'ARABIC LIGATURE HEH WITH MEEM WITH MEEM INITIAL FORM', +64917: 'ARABIC LIGATURE NOON WITH HAH WITH MEEM INITIAL FORM', +64918: 'ARABIC LIGATURE NOON WITH HAH WITH ALEF MAKSURA FINAL FORM', +64919: 'ARABIC LIGATURE NOON WITH JEEM WITH MEEM FINAL FORM', +64920: 'ARABIC LIGATURE NOON WITH JEEM WITH MEEM INITIAL FORM', +64921: 'ARABIC LIGATURE NOON WITH JEEM WITH ALEF MAKSURA FINAL FORM', +64922: 'ARABIC LIGATURE NOON WITH MEEM WITH YEH FINAL FORM', +64923: 'ARABIC LIGATURE NOON WITH MEEM WITH ALEF MAKSURA FINAL FORM', +64924: 'ARABIC LIGATURE YEH WITH MEEM WITH MEEM FINAL FORM', +64925: 'ARABIC LIGATURE YEH WITH MEEM WITH MEEM INITIAL FORM', +64926: 'ARABIC LIGATURE BEH WITH KHAH WITH YEH FINAL FORM', +64927: 'ARABIC LIGATURE TEH WITH JEEM WITH YEH FINAL FORM', +64928: 'ARABIC LIGATURE TEH WITH JEEM WITH ALEF MAKSURA FINAL FORM', +64929: 'ARABIC LIGATURE TEH WITH KHAH WITH YEH FINAL FORM', +64930: 'ARABIC LIGATURE TEH WITH KHAH WITH ALEF MAKSURA FINAL FORM', +64931: 'ARABIC LIGATURE TEH WITH MEEM WITH YEH FINAL FORM', +64932: 'ARABIC LIGATURE TEH WITH MEEM WITH ALEF MAKSURA FINAL FORM', +64933: 'ARABIC LIGATURE JEEM WITH MEEM WITH YEH FINAL FORM', +64934: 'ARABIC LIGATURE JEEM WITH HAH WITH ALEF MAKSURA FINAL FORM', +64935: 'ARABIC LIGATURE JEEM WITH MEEM WITH ALEF MAKSURA FINAL FORM', +64936: 'ARABIC LIGATURE SEEN WITH KHAH WITH ALEF MAKSURA FINAL FORM', +64937: 'ARABIC LIGATURE SAD WITH HAH WITH YEH FINAL FORM', +64938: 'ARABIC LIGATURE SHEEN WITH HAH WITH YEH FINAL FORM', +64939: 'ARABIC LIGATURE DAD WITH HAH WITH YEH FINAL FORM', +64940: 'ARABIC LIGATURE LAM WITH JEEM WITH YEH FINAL FORM', +64941: 'ARABIC LIGATURE LAM WITH MEEM WITH YEH FINAL FORM', +64942: 'ARABIC LIGATURE YEH WITH HAH WITH YEH FINAL FORM', +64943: 'ARABIC LIGATURE YEH WITH JEEM WITH YEH FINAL FORM', +64944: 'ARABIC LIGATURE YEH WITH MEEM WITH YEH FINAL FORM', +64945: 'ARABIC LIGATURE MEEM WITH MEEM WITH YEH FINAL FORM', +64946: 'ARABIC LIGATURE QAF WITH MEEM WITH YEH FINAL FORM', +64947: 'ARABIC LIGATURE NOON WITH HAH WITH YEH FINAL FORM', +64948: 'ARABIC LIGATURE QAF WITH MEEM WITH HAH INITIAL FORM', +64949: 'ARABIC LIGATURE LAM WITH HAH WITH MEEM INITIAL FORM', +64950: 'ARABIC LIGATURE AIN WITH MEEM WITH YEH FINAL FORM', +64951: 'ARABIC LIGATURE KAF WITH MEEM WITH YEH FINAL FORM', +64952: 'ARABIC LIGATURE NOON WITH JEEM WITH HAH INITIAL FORM', +64953: 'ARABIC LIGATURE MEEM WITH KHAH WITH YEH FINAL FORM', +64954: 'ARABIC LIGATURE LAM WITH JEEM WITH MEEM INITIAL FORM', +64955: 'ARABIC LIGATURE KAF WITH MEEM WITH MEEM FINAL FORM', +64956: 'ARABIC LIGATURE LAM WITH JEEM WITH MEEM FINAL FORM', +64957: 'ARABIC LIGATURE NOON WITH JEEM WITH HAH FINAL FORM', +64958: 'ARABIC LIGATURE JEEM WITH HAH WITH YEH FINAL FORM', +64959: 'ARABIC LIGATURE HAH WITH JEEM WITH YEH FINAL FORM', +64960: 'ARABIC LIGATURE MEEM WITH JEEM WITH YEH FINAL FORM', +64961: 'ARABIC LIGATURE FEH WITH MEEM WITH YEH FINAL FORM', +64962: 'ARABIC LIGATURE BEH WITH HAH WITH YEH FINAL FORM', +64963: 'ARABIC LIGATURE KAF WITH MEEM WITH MEEM INITIAL FORM', +64964: 'ARABIC LIGATURE AIN WITH JEEM WITH MEEM INITIAL FORM', +64965: 'ARABIC LIGATURE SAD WITH MEEM WITH MEEM INITIAL FORM', +64966: 'ARABIC LIGATURE SEEN WITH KHAH WITH YEH FINAL FORM', +64967: 'ARABIC LIGATURE NOON WITH JEEM WITH YEH FINAL FORM', +65008: 'ARABIC LIGATURE SALLA USED AS KORANIC STOP SIGN ISOLATED FORM', +65009: 'ARABIC LIGATURE QALA USED AS KORANIC STOP SIGN ISOLATED FORM', +65010: 'ARABIC LIGATURE ALLAH ISOLATED FORM', +65011: 'ARABIC LIGATURE AKBAR ISOLATED FORM', +65012: 'ARABIC LIGATURE MOHAMMAD ISOLATED FORM', +65013: 'ARABIC LIGATURE SALAM ISOLATED FORM', +65014: 'ARABIC LIGATURE RASOUL ISOLATED FORM', +65015: 'ARABIC LIGATURE ALAYHE ISOLATED FORM', +65016: 'ARABIC LIGATURE WASALLAM ISOLATED FORM', +65017: 'ARABIC LIGATURE SALLA ISOLATED FORM', +65018: 'ARABIC LIGATURE SALLALLAHOU ALAYHE WASALLAM', +65019: 'ARABIC LIGATURE JALLAJALALOUHOU', +65020: 'RIAL SIGN', +65024: 'VARIATION SELECTOR-1', +65025: 'VARIATION SELECTOR-2', +65026: 'VARIATION SELECTOR-3', +65027: 'VARIATION SELECTOR-4', +65028: 'VARIATION SELECTOR-5', +65029: 'VARIATION SELECTOR-6', +65030: 'VARIATION SELECTOR-7', +65031: 'VARIATION SELECTOR-8', +65032: 'VARIATION SELECTOR-9', +65033: 'VARIATION SELECTOR-10', +65034: 'VARIATION SELECTOR-11', +65035: 'VARIATION SELECTOR-12', +65036: 'VARIATION SELECTOR-13', +65037: 'VARIATION SELECTOR-14', +65038: 'VARIATION SELECTOR-15', +65039: 'VARIATION SELECTOR-16', +65056: 'COMBINING LIGATURE LEFT HALF', +65057: 'COMBINING LIGATURE RIGHT HALF', +65058: 'COMBINING DOUBLE TILDE LEFT HALF', +65059: 'COMBINING DOUBLE TILDE RIGHT HALF', +65072: 'PRESENTATION FORM FOR VERTICAL TWO DOT LEADER', +65073: 'PRESENTATION FORM FOR VERTICAL EM DASH', +65074: 'PRESENTATION FORM FOR VERTICAL EN DASH', +65075: 'PRESENTATION FORM FOR VERTICAL LOW LINE', +65076: 'PRESENTATION FORM FOR VERTICAL WAVY LOW LINE', +65077: 'PRESENTATION FORM FOR VERTICAL LEFT PARENTHESIS', +65078: 'PRESENTATION FORM FOR VERTICAL RIGHT PARENTHESIS', +65079: 'PRESENTATION FORM FOR VERTICAL LEFT CURLY BRACKET', +65080: 'PRESENTATION FORM FOR VERTICAL RIGHT CURLY BRACKET', +65081: 'PRESENTATION FORM FOR VERTICAL LEFT TORTOISE SHELL BRACKET', +65082: 'PRESENTATION FORM FOR VERTICAL RIGHT TORTOISE SHELL BRACKET', +65083: 'PRESENTATION FORM FOR VERTICAL LEFT BLACK LENTICULAR BRACKET', +65084: 'PRESENTATION FORM FOR VERTICAL RIGHT BLACK LENTICULAR BRACKET', +65085: 'PRESENTATION FORM FOR VERTICAL LEFT DOUBLE ANGLE BRACKET', +65086: 'PRESENTATION FORM FOR VERTICAL RIGHT DOUBLE ANGLE BRACKET', +65087: 'PRESENTATION FORM FOR VERTICAL LEFT ANGLE BRACKET', +65088: 'PRESENTATION FORM FOR VERTICAL RIGHT ANGLE BRACKET', +65089: 'PRESENTATION FORM FOR VERTICAL LEFT CORNER BRACKET', +65090: 'PRESENTATION FORM FOR VERTICAL RIGHT CORNER BRACKET', +65091: 'PRESENTATION FORM FOR VERTICAL LEFT WHITE CORNER BRACKET', +65092: 'PRESENTATION FORM FOR VERTICAL RIGHT WHITE CORNER BRACKET', +65093: 'SESAME DOT', +65094: 'WHITE SESAME DOT', +65097: 'DASHED OVERLINE', +65098: 'CENTRELINE OVERLINE', +65099: 'WAVY OVERLINE', +65100: 'DOUBLE WAVY OVERLINE', +65101: 'DASHED LOW LINE', +65102: 'CENTRELINE LOW LINE', +65103: 'WAVY LOW LINE', +65104: 'SMALL COMMA', +65105: 'SMALL IDEOGRAPHIC COMMA', +65106: 'SMALL FULL STOP', +65108: 'SMALL SEMICOLON', +65109: 'SMALL COLON', +65110: 'SMALL QUESTION MARK', +65111: 'SMALL EXCLAMATION MARK', +65112: 'SMALL EM DASH', +65113: 'SMALL LEFT PARENTHESIS', +65114: 'SMALL RIGHT PARENTHESIS', +65115: 'SMALL LEFT CURLY BRACKET', +65116: 'SMALL RIGHT CURLY BRACKET', +65117: 'SMALL LEFT TORTOISE SHELL BRACKET', +65118: 'SMALL RIGHT TORTOISE SHELL BRACKET', +65119: 'SMALL NUMBER SIGN', +65120: 'SMALL AMPERSAND', +65121: 'SMALL ASTERISK', +65122: 'SMALL PLUS SIGN', +65123: 'SMALL HYPHEN-MINUS', +65124: 'SMALL LESS-THAN SIGN', +65125: 'SMALL GREATER-THAN SIGN', +65126: 'SMALL EQUALS SIGN', +65128: 'SMALL REVERSE SOLIDUS', +65129: 'SMALL DOLLAR SIGN', +65130: 'SMALL PERCENT SIGN', +65131: 'SMALL COMMERCIAL AT', +65136: 'ARABIC FATHATAN ISOLATED FORM', +65137: 'ARABIC TATWEEL WITH FATHATAN ABOVE', +65138: 'ARABIC DAMMATAN ISOLATED FORM', +65139: 'ARABIC TAIL FRAGMENT', +65140: 'ARABIC KASRATAN ISOLATED FORM', +65142: 'ARABIC FATHA ISOLATED FORM', +65143: 'ARABIC FATHA MEDIAL FORM', +65144: 'ARABIC DAMMA ISOLATED FORM', +65145: 'ARABIC DAMMA MEDIAL FORM', +65146: 'ARABIC KASRA ISOLATED FORM', +65147: 'ARABIC KASRA MEDIAL FORM', +65148: 'ARABIC SHADDA ISOLATED FORM', +65149: 'ARABIC SHADDA MEDIAL FORM', +65150: 'ARABIC SUKUN ISOLATED FORM', +65151: 'ARABIC SUKUN MEDIAL FORM', +65152: 'ARABIC LETTER HAMZA ISOLATED FORM', +65153: 'ARABIC LETTER ALEF WITH MADDA ABOVE ISOLATED FORM', +65154: 'ARABIC LETTER ALEF WITH MADDA ABOVE FINAL FORM', +65155: 'ARABIC LETTER ALEF WITH HAMZA ABOVE ISOLATED FORM', +65156: 'ARABIC LETTER ALEF WITH HAMZA ABOVE FINAL FORM', +65157: 'ARABIC LETTER WAW WITH HAMZA ABOVE ISOLATED FORM', +65158: 'ARABIC LETTER WAW WITH HAMZA ABOVE FINAL FORM', +65159: 'ARABIC LETTER ALEF WITH HAMZA BELOW ISOLATED FORM', +65160: 'ARABIC LETTER ALEF WITH HAMZA BELOW FINAL FORM', +65161: 'ARABIC LETTER YEH WITH HAMZA ABOVE ISOLATED FORM', +65162: 'ARABIC LETTER YEH WITH HAMZA ABOVE FINAL FORM', +65163: 'ARABIC LETTER YEH WITH HAMZA ABOVE INITIAL FORM', +65164: 'ARABIC LETTER YEH WITH HAMZA ABOVE MEDIAL FORM', +65165: 'ARABIC LETTER ALEF ISOLATED FORM', +65166: 'ARABIC LETTER ALEF FINAL FORM', +65167: 'ARABIC LETTER BEH ISOLATED FORM', +65168: 'ARABIC LETTER BEH FINAL FORM', +65169: 'ARABIC LETTER BEH INITIAL FORM', +65170: 'ARABIC LETTER BEH MEDIAL FORM', +65171: 'ARABIC LETTER TEH MARBUTA ISOLATED FORM', +65172: 'ARABIC LETTER TEH MARBUTA FINAL FORM', +65173: 'ARABIC LETTER TEH ISOLATED FORM', +65174: 'ARABIC LETTER TEH FINAL FORM', +65175: 'ARABIC LETTER TEH INITIAL FORM', +65176: 'ARABIC LETTER TEH MEDIAL FORM', +65177: 'ARABIC LETTER THEH ISOLATED FORM', +65178: 'ARABIC LETTER THEH FINAL FORM', +65179: 'ARABIC LETTER THEH INITIAL FORM', +65180: 'ARABIC LETTER THEH MEDIAL FORM', +65181: 'ARABIC LETTER JEEM ISOLATED FORM', +65182: 'ARABIC LETTER JEEM FINAL FORM', +65183: 'ARABIC LETTER JEEM INITIAL FORM', +65184: 'ARABIC LETTER JEEM MEDIAL FORM', +65185: 'ARABIC LETTER HAH ISOLATED FORM', +65186: 'ARABIC LETTER HAH FINAL FORM', +65187: 'ARABIC LETTER HAH INITIAL FORM', +65188: 'ARABIC LETTER HAH MEDIAL FORM', +65189: 'ARABIC LETTER KHAH ISOLATED FORM', +65190: 'ARABIC LETTER KHAH FINAL FORM', +65191: 'ARABIC LETTER KHAH INITIAL FORM', +65192: 'ARABIC LETTER KHAH MEDIAL FORM', +65193: 'ARABIC LETTER DAL ISOLATED FORM', +65194: 'ARABIC LETTER DAL FINAL FORM', +65195: 'ARABIC LETTER THAL ISOLATED FORM', +65196: 'ARABIC LETTER THAL FINAL FORM', +65197: 'ARABIC LETTER REH ISOLATED FORM', +65198: 'ARABIC LETTER REH FINAL FORM', +65199: 'ARABIC LETTER ZAIN ISOLATED FORM', +65200: 'ARABIC LETTER ZAIN FINAL FORM', +65201: 'ARABIC LETTER SEEN ISOLATED FORM', +65202: 'ARABIC LETTER SEEN FINAL FORM', +65203: 'ARABIC LETTER SEEN INITIAL FORM', +65204: 'ARABIC LETTER SEEN MEDIAL FORM', +65205: 'ARABIC LETTER SHEEN ISOLATED FORM', +65206: 'ARABIC LETTER SHEEN FINAL FORM', +65207: 'ARABIC LETTER SHEEN INITIAL FORM', +65208: 'ARABIC LETTER SHEEN MEDIAL FORM', +65209: 'ARABIC LETTER SAD ISOLATED FORM', +65210: 'ARABIC LETTER SAD FINAL FORM', +65211: 'ARABIC LETTER SAD INITIAL FORM', +65212: 'ARABIC LETTER SAD MEDIAL FORM', +65213: 'ARABIC LETTER DAD ISOLATED FORM', +65214: 'ARABIC LETTER DAD FINAL FORM', +65215: 'ARABIC LETTER DAD INITIAL FORM', +65216: 'ARABIC LETTER DAD MEDIAL FORM', +65217: 'ARABIC LETTER TAH ISOLATED FORM', +65218: 'ARABIC LETTER TAH FINAL FORM', +65219: 'ARABIC LETTER TAH INITIAL FORM', +65220: 'ARABIC LETTER TAH MEDIAL FORM', +65221: 'ARABIC LETTER ZAH ISOLATED FORM', +65222: 'ARABIC LETTER ZAH FINAL FORM', +65223: 'ARABIC LETTER ZAH INITIAL FORM', +65224: 'ARABIC LETTER ZAH MEDIAL FORM', +65225: 'ARABIC LETTER AIN ISOLATED FORM', +65226: 'ARABIC LETTER AIN FINAL FORM', +65227: 'ARABIC LETTER AIN INITIAL FORM', +65228: 'ARABIC LETTER AIN MEDIAL FORM', +65229: 'ARABIC LETTER GHAIN ISOLATED FORM', +65230: 'ARABIC LETTER GHAIN FINAL FORM', +65231: 'ARABIC LETTER GHAIN INITIAL FORM', +65232: 'ARABIC LETTER GHAIN MEDIAL FORM', +65233: 'ARABIC LETTER FEH ISOLATED FORM', +65234: 'ARABIC LETTER FEH FINAL FORM', +65235: 'ARABIC LETTER FEH INITIAL FORM', +65236: 'ARABIC LETTER FEH MEDIAL FORM', +65237: 'ARABIC LETTER QAF ISOLATED FORM', +65238: 'ARABIC LETTER QAF FINAL FORM', +65239: 'ARABIC LETTER QAF INITIAL FORM', +65240: 'ARABIC LETTER QAF MEDIAL FORM', +65241: 'ARABIC LETTER KAF ISOLATED FORM', +65242: 'ARABIC LETTER KAF FINAL FORM', +65243: 'ARABIC LETTER KAF INITIAL FORM', +65244: 'ARABIC LETTER KAF MEDIAL FORM', +65245: 'ARABIC LETTER LAM ISOLATED FORM', +65246: 'ARABIC LETTER LAM FINAL FORM', +65247: 'ARABIC LETTER LAM INITIAL FORM', +65248: 'ARABIC LETTER LAM MEDIAL FORM', +65249: 'ARABIC LETTER MEEM ISOLATED FORM', +65250: 'ARABIC LETTER MEEM FINAL FORM', +65251: 'ARABIC LETTER MEEM INITIAL FORM', +65252: 'ARABIC LETTER MEEM MEDIAL FORM', +65253: 'ARABIC LETTER NOON ISOLATED FORM', +65254: 'ARABIC LETTER NOON FINAL FORM', +65255: 'ARABIC LETTER NOON INITIAL FORM', +65256: 'ARABIC LETTER NOON MEDIAL FORM', +65257: 'ARABIC LETTER HEH ISOLATED FORM', +65258: 'ARABIC LETTER HEH FINAL FORM', +65259: 'ARABIC LETTER HEH INITIAL FORM', +65260: 'ARABIC LETTER HEH MEDIAL FORM', +65261: 'ARABIC LETTER WAW ISOLATED FORM', +65262: 'ARABIC LETTER WAW FINAL FORM', +65263: 'ARABIC LETTER ALEF MAKSURA ISOLATED FORM', +65264: 'ARABIC LETTER ALEF MAKSURA FINAL FORM', +65265: 'ARABIC LETTER YEH ISOLATED FORM', +65266: 'ARABIC LETTER YEH FINAL FORM', +65267: 'ARABIC LETTER YEH INITIAL FORM', +65268: 'ARABIC LETTER YEH MEDIAL FORM', +65269: 'ARABIC LIGATURE LAM WITH ALEF WITH MADDA ABOVE ISOLATED FORM', +65270: 'ARABIC LIGATURE LAM WITH ALEF WITH MADDA ABOVE FINAL FORM', +65271: 'ARABIC LIGATURE LAM WITH ALEF WITH HAMZA ABOVE ISOLATED FORM', +65272: 'ARABIC LIGATURE LAM WITH ALEF WITH HAMZA ABOVE FINAL FORM', +65273: 'ARABIC LIGATURE LAM WITH ALEF WITH HAMZA BELOW ISOLATED FORM', +65274: 'ARABIC LIGATURE LAM WITH ALEF WITH HAMZA BELOW FINAL FORM', +65275: 'ARABIC LIGATURE LAM WITH ALEF ISOLATED FORM', +65276: 'ARABIC LIGATURE LAM WITH ALEF FINAL FORM', +65279: 'ZERO WIDTH NO-BREAK SPACE', +65281: 'FULLWIDTH EXCLAMATION MARK', +65282: 'FULLWIDTH QUOTATION MARK', +65283: 'FULLWIDTH NUMBER SIGN', +65284: 'FULLWIDTH DOLLAR SIGN', +65285: 'FULLWIDTH PERCENT SIGN', +65286: 'FULLWIDTH AMPERSAND', +65287: 'FULLWIDTH APOSTROPHE', +65288: 'FULLWIDTH LEFT PARENTHESIS', +65289: 'FULLWIDTH RIGHT PARENTHESIS', +65290: 'FULLWIDTH ASTERISK', +65291: 'FULLWIDTH PLUS SIGN', +65292: 'FULLWIDTH COMMA', +65293: 'FULLWIDTH HYPHEN-MINUS', +65294: 'FULLWIDTH FULL STOP', +65295: 'FULLWIDTH SOLIDUS', +65296: 'FULLWIDTH DIGIT ZERO', +65297: 'FULLWIDTH DIGIT ONE', +65298: 'FULLWIDTH DIGIT TWO', +65299: 'FULLWIDTH DIGIT THREE', +65300: 'FULLWIDTH DIGIT FOUR', +65301: 'FULLWIDTH DIGIT FIVE', +65302: 'FULLWIDTH DIGIT SIX', +65303: 'FULLWIDTH DIGIT SEVEN', +65304: 'FULLWIDTH DIGIT EIGHT', +65305: 'FULLWIDTH DIGIT NINE', +65306: 'FULLWIDTH COLON', +65307: 'FULLWIDTH SEMICOLON', +65308: 'FULLWIDTH LESS-THAN SIGN', +65309: 'FULLWIDTH EQUALS SIGN', +65310: 'FULLWIDTH GREATER-THAN SIGN', +65311: 'FULLWIDTH QUESTION MARK', +65312: 'FULLWIDTH COMMERCIAL AT', +65313: 'FULLWIDTH LATIN CAPITAL LETTER A', +65314: 'FULLWIDTH LATIN CAPITAL LETTER B', +65315: 'FULLWIDTH LATIN CAPITAL LETTER C', +65316: 'FULLWIDTH LATIN CAPITAL LETTER D', +65317: 'FULLWIDTH LATIN CAPITAL LETTER E', +65318: 'FULLWIDTH LATIN CAPITAL LETTER F', +65319: 'FULLWIDTH LATIN CAPITAL LETTER G', +65320: 'FULLWIDTH LATIN CAPITAL LETTER H', +65321: 'FULLWIDTH LATIN CAPITAL LETTER I', +65322: 'FULLWIDTH LATIN CAPITAL LETTER J', +65323: 'FULLWIDTH LATIN CAPITAL LETTER K', +65324: 'FULLWIDTH LATIN CAPITAL LETTER L', +65325: 'FULLWIDTH LATIN CAPITAL LETTER M', +65326: 'FULLWIDTH LATIN CAPITAL LETTER N', +65327: 'FULLWIDTH LATIN CAPITAL LETTER O', +65328: 'FULLWIDTH LATIN CAPITAL LETTER P', +65329: 'FULLWIDTH LATIN CAPITAL LETTER Q', +65330: 'FULLWIDTH LATIN CAPITAL LETTER R', +65331: 'FULLWIDTH LATIN CAPITAL LETTER S', +65332: 'FULLWIDTH LATIN CAPITAL LETTER T', +65333: 'FULLWIDTH LATIN CAPITAL LETTER U', +65334: 'FULLWIDTH LATIN CAPITAL LETTER V', +65335: 'FULLWIDTH LATIN CAPITAL LETTER W', +65336: 'FULLWIDTH LATIN CAPITAL LETTER X', +65337: 'FULLWIDTH LATIN CAPITAL LETTER Y', +65338: 'FULLWIDTH LATIN CAPITAL LETTER Z', +65339: 'FULLWIDTH LEFT SQUARE BRACKET', +65340: 'FULLWIDTH REVERSE SOLIDUS', +65341: 'FULLWIDTH RIGHT SQUARE BRACKET', +65342: 'FULLWIDTH CIRCUMFLEX ACCENT', +65343: 'FULLWIDTH LOW LINE', +65344: 'FULLWIDTH GRAVE ACCENT', +65345: 'FULLWIDTH LATIN SMALL LETTER A', +65346: 'FULLWIDTH LATIN SMALL LETTER B', +65347: 'FULLWIDTH LATIN SMALL LETTER C', +65348: 'FULLWIDTH LATIN SMALL LETTER D', +65349: 'FULLWIDTH LATIN SMALL LETTER E', +65350: 'FULLWIDTH LATIN SMALL LETTER F', +65351: 'FULLWIDTH LATIN SMALL LETTER G', +65352: 'FULLWIDTH LATIN SMALL LETTER H', +65353: 'FULLWIDTH LATIN SMALL LETTER I', +65354: 'FULLWIDTH LATIN SMALL LETTER J', +65355: 'FULLWIDTH LATIN SMALL LETTER K', +65356: 'FULLWIDTH LATIN SMALL LETTER L', +65357: 'FULLWIDTH LATIN SMALL LETTER M', +65358: 'FULLWIDTH LATIN SMALL LETTER N', +65359: 'FULLWIDTH LATIN SMALL LETTER O', +65360: 'FULLWIDTH LATIN SMALL LETTER P', +65361: 'FULLWIDTH LATIN SMALL LETTER Q', +65362: 'FULLWIDTH LATIN SMALL LETTER R', +65363: 'FULLWIDTH LATIN SMALL LETTER S', +65364: 'FULLWIDTH LATIN SMALL LETTER T', +65365: 'FULLWIDTH LATIN SMALL LETTER U', +65366: 'FULLWIDTH LATIN SMALL LETTER V', +65367: 'FULLWIDTH LATIN SMALL LETTER W', +65368: 'FULLWIDTH LATIN SMALL LETTER X', +65369: 'FULLWIDTH LATIN SMALL LETTER Y', +65370: 'FULLWIDTH LATIN SMALL LETTER Z', +65371: 'FULLWIDTH LEFT CURLY BRACKET', +65372: 'FULLWIDTH VERTICAL LINE', +65373: 'FULLWIDTH RIGHT CURLY BRACKET', +65374: 'FULLWIDTH TILDE', +65375: 'FULLWIDTH LEFT WHITE PARENTHESIS', +65376: 'FULLWIDTH RIGHT WHITE PARENTHESIS', +65377: 'HALFWIDTH IDEOGRAPHIC FULL STOP', +65378: 'HALFWIDTH LEFT CORNER BRACKET', +65379: 'HALFWIDTH RIGHT CORNER BRACKET', +65380: 'HALFWIDTH IDEOGRAPHIC COMMA', +65381: 'HALFWIDTH KATAKANA MIDDLE DOT', +65382: 'HALFWIDTH KATAKANA LETTER WO', +65383: 'HALFWIDTH KATAKANA LETTER SMALL A', +65384: 'HALFWIDTH KATAKANA LETTER SMALL I', +65385: 'HALFWIDTH KATAKANA LETTER SMALL U', +65386: 'HALFWIDTH KATAKANA LETTER SMALL E', +65387: 'HALFWIDTH KATAKANA LETTER SMALL O', +65388: 'HALFWIDTH KATAKANA LETTER SMALL YA', +65389: 'HALFWIDTH KATAKANA LETTER SMALL YU', +65390: 'HALFWIDTH KATAKANA LETTER SMALL YO', +65391: 'HALFWIDTH KATAKANA LETTER SMALL TU', +65392: 'HALFWIDTH KATAKANA-HIRAGANA PROLONGED SOUND MARK', +65393: 'HALFWIDTH KATAKANA LETTER A', +65394: 'HALFWIDTH KATAKANA LETTER I', +65395: 'HALFWIDTH KATAKANA LETTER U', +65396: 'HALFWIDTH KATAKANA LETTER E', +65397: 'HALFWIDTH KATAKANA LETTER O', +65398: 'HALFWIDTH KATAKANA LETTER KA', +65399: 'HALFWIDTH KATAKANA LETTER KI', +65400: 'HALFWIDTH KATAKANA LETTER KU', +65401: 'HALFWIDTH KATAKANA LETTER KE', +65402: 'HALFWIDTH KATAKANA LETTER KO', +65403: 'HALFWIDTH KATAKANA LETTER SA', +65404: 'HALFWIDTH KATAKANA LETTER SI', +65405: 'HALFWIDTH KATAKANA LETTER SU', +65406: 'HALFWIDTH KATAKANA LETTER SE', +65407: 'HALFWIDTH KATAKANA LETTER SO', +65408: 'HALFWIDTH KATAKANA LETTER TA', +65409: 'HALFWIDTH KATAKANA LETTER TI', +65410: 'HALFWIDTH KATAKANA LETTER TU', +65411: 'HALFWIDTH KATAKANA LETTER TE', +65412: 'HALFWIDTH KATAKANA LETTER TO', +65413: 'HALFWIDTH KATAKANA LETTER NA', +65414: 'HALFWIDTH KATAKANA LETTER NI', +65415: 'HALFWIDTH KATAKANA LETTER NU', +65416: 'HALFWIDTH KATAKANA LETTER NE', +65417: 'HALFWIDTH KATAKANA LETTER NO', +65418: 'HALFWIDTH KATAKANA LETTER HA', +65419: 'HALFWIDTH KATAKANA LETTER HI', +65420: 'HALFWIDTH KATAKANA LETTER HU', +65421: 'HALFWIDTH KATAKANA LETTER HE', +65422: 'HALFWIDTH KATAKANA LETTER HO', +65423: 'HALFWIDTH KATAKANA LETTER MA', +65424: 'HALFWIDTH KATAKANA LETTER MI', +65425: 'HALFWIDTH KATAKANA LETTER MU', +65426: 'HALFWIDTH KATAKANA LETTER ME', +65427: 'HALFWIDTH KATAKANA LETTER MO', +65428: 'HALFWIDTH KATAKANA LETTER YA', +65429: 'HALFWIDTH KATAKANA LETTER YU', +65430: 'HALFWIDTH KATAKANA LETTER YO', +65431: 'HALFWIDTH KATAKANA LETTER RA', +65432: 'HALFWIDTH KATAKANA LETTER RI', +65433: 'HALFWIDTH KATAKANA LETTER RU', +65434: 'HALFWIDTH KATAKANA LETTER RE', +65435: 'HALFWIDTH KATAKANA LETTER RO', +65436: 'HALFWIDTH KATAKANA LETTER WA', +65437: 'HALFWIDTH KATAKANA LETTER N', +65438: 'HALFWIDTH KATAKANA VOICED SOUND MARK', +65439: 'HALFWIDTH KATAKANA SEMI-VOICED SOUND MARK', +65440: 'HALFWIDTH HANGUL FILLER', +65441: 'HALFWIDTH HANGUL LETTER KIYEOK', +65442: 'HALFWIDTH HANGUL LETTER SSANGKIYEOK', +65443: 'HALFWIDTH HANGUL LETTER KIYEOK-SIOS', +65444: 'HALFWIDTH HANGUL LETTER NIEUN', +65445: 'HALFWIDTH HANGUL LETTER NIEUN-CIEUC', +65446: 'HALFWIDTH HANGUL LETTER NIEUN-HIEUH', +65447: 'HALFWIDTH HANGUL LETTER TIKEUT', +65448: 'HALFWIDTH HANGUL LETTER SSANGTIKEUT', +65449: 'HALFWIDTH HANGUL LETTER RIEUL', +65450: 'HALFWIDTH HANGUL LETTER RIEUL-KIYEOK', +65451: 'HALFWIDTH HANGUL LETTER RIEUL-MIEUM', +65452: 'HALFWIDTH HANGUL LETTER RIEUL-PIEUP', +65453: 'HALFWIDTH HANGUL LETTER RIEUL-SIOS', +65454: 'HALFWIDTH HANGUL LETTER RIEUL-THIEUTH', +65455: 'HALFWIDTH HANGUL LETTER RIEUL-PHIEUPH', +65456: 'HALFWIDTH HANGUL LETTER RIEUL-HIEUH', +65457: 'HALFWIDTH HANGUL LETTER MIEUM', +65458: 'HALFWIDTH HANGUL LETTER PIEUP', +65459: 'HALFWIDTH HANGUL LETTER SSANGPIEUP', +65460: 'HALFWIDTH HANGUL LETTER PIEUP-SIOS', +65461: 'HALFWIDTH HANGUL LETTER SIOS', +65462: 'HALFWIDTH HANGUL LETTER SSANGSIOS', +65463: 'HALFWIDTH HANGUL LETTER IEUNG', +65464: 'HALFWIDTH HANGUL LETTER CIEUC', +65465: 'HALFWIDTH HANGUL LETTER SSANGCIEUC', +65466: 'HALFWIDTH HANGUL LETTER CHIEUCH', +65467: 'HALFWIDTH HANGUL LETTER KHIEUKH', +65468: 'HALFWIDTH HANGUL LETTER THIEUTH', +65469: 'HALFWIDTH HANGUL LETTER PHIEUPH', +65470: 'HALFWIDTH HANGUL LETTER HIEUH', +65474: 'HALFWIDTH HANGUL LETTER A', +65475: 'HALFWIDTH HANGUL LETTER AE', +65476: 'HALFWIDTH HANGUL LETTER YA', +65477: 'HALFWIDTH HANGUL LETTER YAE', +65478: 'HALFWIDTH HANGUL LETTER EO', +65479: 'HALFWIDTH HANGUL LETTER E', +65482: 'HALFWIDTH HANGUL LETTER YEO', +65483: 'HALFWIDTH HANGUL LETTER YE', +65484: 'HALFWIDTH HANGUL LETTER O', +65485: 'HALFWIDTH HANGUL LETTER WA', +65486: 'HALFWIDTH HANGUL LETTER WAE', +65487: 'HALFWIDTH HANGUL LETTER OE', +65490: 'HALFWIDTH HANGUL LETTER YO', +65491: 'HALFWIDTH HANGUL LETTER U', +65492: 'HALFWIDTH HANGUL LETTER WEO', +65493: 'HALFWIDTH HANGUL LETTER WE', +65494: 'HALFWIDTH HANGUL LETTER WI', +65495: 'HALFWIDTH HANGUL LETTER YU', +65498: 'HALFWIDTH HANGUL LETTER EU', +65499: 'HALFWIDTH HANGUL LETTER YI', +65500: 'HALFWIDTH HANGUL LETTER I', +65504: 'FULLWIDTH CENT SIGN', +65505: 'FULLWIDTH POUND SIGN', +65506: 'FULLWIDTH NOT SIGN', +65507: 'FULLWIDTH MACRON', +65508: 'FULLWIDTH BROKEN BAR', +65509: 'FULLWIDTH YEN SIGN', +65510: 'FULLWIDTH WON SIGN', +65512: 'HALFWIDTH FORMS LIGHT VERTICAL', +65513: 'HALFWIDTH LEFTWARDS ARROW', +65514: 'HALFWIDTH UPWARDS ARROW', +65515: 'HALFWIDTH RIGHTWARDS ARROW', +65516: 'HALFWIDTH DOWNWARDS ARROW', +65517: 'HALFWIDTH BLACK SQUARE', +65518: 'HALFWIDTH WHITE CIRCLE', +65529: 'INTERLINEAR ANNOTATION ANCHOR', +65530: 'INTERLINEAR ANNOTATION SEPARATOR', +65531: 'INTERLINEAR ANNOTATION TERMINATOR', +65532: 'OBJECT REPLACEMENT CHARACTER', +65533: 'REPLACEMENT CHARACTER', +66304: 'OLD ITALIC LETTER A', +66305: 'OLD ITALIC LETTER BE', +66306: 'OLD ITALIC LETTER KE', +66307: 'OLD ITALIC LETTER DE', +66308: 'OLD ITALIC LETTER E', +66309: 'OLD ITALIC LETTER VE', +66310: 'OLD ITALIC LETTER ZE', +66311: 'OLD ITALIC LETTER HE', +66312: 'OLD ITALIC LETTER THE', +66313: 'OLD ITALIC LETTER I', +66314: 'OLD ITALIC LETTER KA', +66315: 'OLD ITALIC LETTER EL', +66316: 'OLD ITALIC LETTER EM', +66317: 'OLD ITALIC LETTER EN', +66318: 'OLD ITALIC LETTER ESH', +66319: 'OLD ITALIC LETTER O', +66320: 'OLD ITALIC LETTER PE', +66321: 'OLD ITALIC LETTER SHE', +66322: 'OLD ITALIC LETTER KU', +66323: 'OLD ITALIC LETTER ER', +66324: 'OLD ITALIC LETTER ES', +66325: 'OLD ITALIC LETTER TE', +66326: 'OLD ITALIC LETTER U', +66327: 'OLD ITALIC LETTER EKS', +66328: 'OLD ITALIC LETTER PHE', +66329: 'OLD ITALIC LETTER KHE', +66330: 'OLD ITALIC LETTER EF', +66331: 'OLD ITALIC LETTER ERS', +66332: 'OLD ITALIC LETTER CHE', +66333: 'OLD ITALIC LETTER II', +66334: 'OLD ITALIC LETTER UU', +66336: 'OLD ITALIC NUMERAL ONE', +66337: 'OLD ITALIC NUMERAL FIVE', +66338: 'OLD ITALIC NUMERAL TEN', +66339: 'OLD ITALIC NUMERAL FIFTY', +66352: 'GOTHIC LETTER AHSA', +66353: 'GOTHIC LETTER BAIRKAN', +66354: 'GOTHIC LETTER GIBA', +66355: 'GOTHIC LETTER DAGS', +66356: 'GOTHIC LETTER AIHVUS', +66357: 'GOTHIC LETTER QAIRTHRA', +66358: 'GOTHIC LETTER IUJA', +66359: 'GOTHIC LETTER HAGL', +66360: 'GOTHIC LETTER THIUTH', +66361: 'GOTHIC LETTER EIS', +66362: 'GOTHIC LETTER KUSMA', +66363: 'GOTHIC LETTER LAGUS', +66364: 'GOTHIC LETTER MANNA', +66365: 'GOTHIC LETTER NAUTHS', +66366: 'GOTHIC LETTER JER', +66367: 'GOTHIC LETTER URUS', +66368: 'GOTHIC LETTER PAIRTHRA', +66369: 'GOTHIC LETTER NINETY', +66370: 'GOTHIC LETTER RAIDA', +66371: 'GOTHIC LETTER SAUIL', +66372: 'GOTHIC LETTER TEIWS', +66373: 'GOTHIC LETTER WINJA', +66374: 'GOTHIC LETTER FAIHU', +66375: 'GOTHIC LETTER IGGWS', +66376: 'GOTHIC LETTER HWAIR', +66377: 'GOTHIC LETTER OTHAL', +66378: 'GOTHIC LETTER NINE HUNDRED', +66560: 'DESERET CAPITAL LETTER LONG I', +66561: 'DESERET CAPITAL LETTER LONG E', +66562: 'DESERET CAPITAL LETTER LONG A', +66563: 'DESERET CAPITAL LETTER LONG AH', +66564: 'DESERET CAPITAL LETTER LONG O', +66565: 'DESERET CAPITAL LETTER LONG OO', +66566: 'DESERET CAPITAL LETTER SHORT I', +66567: 'DESERET CAPITAL LETTER SHORT E', +66568: 'DESERET CAPITAL LETTER SHORT A', +66569: 'DESERET CAPITAL LETTER SHORT AH', +66570: 'DESERET CAPITAL LETTER SHORT O', +66571: 'DESERET CAPITAL LETTER SHORT OO', +66572: 'DESERET CAPITAL LETTER AY', +66573: 'DESERET CAPITAL LETTER OW', +66574: 'DESERET CAPITAL LETTER WU', +66575: 'DESERET CAPITAL LETTER YEE', +66576: 'DESERET CAPITAL LETTER H', +66577: 'DESERET CAPITAL LETTER PEE', +66578: 'DESERET CAPITAL LETTER BEE', +66579: 'DESERET CAPITAL LETTER TEE', +66580: 'DESERET CAPITAL LETTER DEE', +66581: 'DESERET CAPITAL LETTER CHEE', +66582: 'DESERET CAPITAL LETTER JEE', +66583: 'DESERET CAPITAL LETTER KAY', +66584: 'DESERET CAPITAL LETTER GAY', +66585: 'DESERET CAPITAL LETTER EF', +66586: 'DESERET CAPITAL LETTER VEE', +66587: 'DESERET CAPITAL LETTER ETH', +66588: 'DESERET CAPITAL LETTER THEE', +66589: 'DESERET CAPITAL LETTER ES', +66590: 'DESERET CAPITAL LETTER ZEE', +66591: 'DESERET CAPITAL LETTER ESH', +66592: 'DESERET CAPITAL LETTER ZHEE', +66593: 'DESERET CAPITAL LETTER ER', +66594: 'DESERET CAPITAL LETTER EL', +66595: 'DESERET CAPITAL LETTER EM', +66596: 'DESERET CAPITAL LETTER EN', +66597: 'DESERET CAPITAL LETTER ENG', +66600: 'DESERET SMALL LETTER LONG I', +66601: 'DESERET SMALL LETTER LONG E', +66602: 'DESERET SMALL LETTER LONG A', +66603: 'DESERET SMALL LETTER LONG AH', +66604: 'DESERET SMALL LETTER LONG O', +66605: 'DESERET SMALL LETTER LONG OO', +66606: 'DESERET SMALL LETTER SHORT I', +66607: 'DESERET SMALL LETTER SHORT E', +66608: 'DESERET SMALL LETTER SHORT A', +66609: 'DESERET SMALL LETTER SHORT AH', +66610: 'DESERET SMALL LETTER SHORT O', +66611: 'DESERET SMALL LETTER SHORT OO', +66612: 'DESERET SMALL LETTER AY', +66613: 'DESERET SMALL LETTER OW', +66614: 'DESERET SMALL LETTER WU', +66615: 'DESERET SMALL LETTER YEE', +66616: 'DESERET SMALL LETTER H', +66617: 'DESERET SMALL LETTER PEE', +66618: 'DESERET SMALL LETTER BEE', +66619: 'DESERET SMALL LETTER TEE', +66620: 'DESERET SMALL LETTER DEE', +66621: 'DESERET SMALL LETTER CHEE', +66622: 'DESERET SMALL LETTER JEE', +66623: 'DESERET SMALL LETTER KAY', +66624: 'DESERET SMALL LETTER GAY', +66625: 'DESERET SMALL LETTER EF', +66626: 'DESERET SMALL LETTER VEE', +66627: 'DESERET SMALL LETTER ETH', +66628: 'DESERET SMALL LETTER THEE', +66629: 'DESERET SMALL LETTER ES', +66630: 'DESERET SMALL LETTER ZEE', +66631: 'DESERET SMALL LETTER ESH', +66632: 'DESERET SMALL LETTER ZHEE', +66633: 'DESERET SMALL LETTER ER', +66634: 'DESERET SMALL LETTER EL', +66635: 'DESERET SMALL LETTER EM', +66636: 'DESERET SMALL LETTER EN', +66637: 'DESERET SMALL LETTER ENG', +118784: 'BYZANTINE MUSICAL SYMBOL PSILI', +118785: 'BYZANTINE MUSICAL SYMBOL DASEIA', +118786: 'BYZANTINE MUSICAL SYMBOL PERISPOMENI', +118787: 'BYZANTINE MUSICAL SYMBOL OXEIA EKFONITIKON', +118788: 'BYZANTINE MUSICAL SYMBOL OXEIA DIPLI', +118789: 'BYZANTINE MUSICAL SYMBOL VAREIA EKFONITIKON', +118790: 'BYZANTINE MUSICAL SYMBOL VAREIA DIPLI', +118791: 'BYZANTINE MUSICAL SYMBOL KATHISTI', +118792: 'BYZANTINE MUSICAL SYMBOL SYRMATIKI', +118793: 'BYZANTINE MUSICAL SYMBOL PARAKLITIKI', +118794: 'BYZANTINE MUSICAL SYMBOL YPOKRISIS', +118795: 'BYZANTINE MUSICAL SYMBOL YPOKRISIS DIPLI', +118796: 'BYZANTINE MUSICAL SYMBOL KREMASTI', +118797: 'BYZANTINE MUSICAL SYMBOL APESO EKFONITIKON', +118798: 'BYZANTINE MUSICAL SYMBOL EXO EKFONITIKON', +118799: 'BYZANTINE MUSICAL SYMBOL TELEIA', +118800: 'BYZANTINE MUSICAL SYMBOL KENTIMATA', +118801: 'BYZANTINE MUSICAL SYMBOL APOSTROFOS', +118802: 'BYZANTINE MUSICAL SYMBOL APOSTROFOS DIPLI', +118803: 'BYZANTINE MUSICAL SYMBOL SYNEVMA', +118804: 'BYZANTINE MUSICAL SYMBOL THITA', +118805: 'BYZANTINE MUSICAL SYMBOL OLIGON ARCHAION', +118806: 'BYZANTINE MUSICAL SYMBOL GORGON ARCHAION', +118807: 'BYZANTINE MUSICAL SYMBOL PSILON', +118808: 'BYZANTINE MUSICAL SYMBOL CHAMILON', +118809: 'BYZANTINE MUSICAL SYMBOL VATHY', +118810: 'BYZANTINE MUSICAL SYMBOL ISON ARCHAION', +118811: 'BYZANTINE MUSICAL SYMBOL KENTIMA ARCHAION', +118812: 'BYZANTINE MUSICAL SYMBOL KENTIMATA ARCHAION', +118813: 'BYZANTINE MUSICAL SYMBOL SAXIMATA', +118814: 'BYZANTINE MUSICAL SYMBOL PARICHON', +118815: 'BYZANTINE MUSICAL SYMBOL STAVROS APODEXIA', +118816: 'BYZANTINE MUSICAL SYMBOL OXEIAI ARCHAION', +118817: 'BYZANTINE MUSICAL SYMBOL VAREIAI ARCHAION', +118818: 'BYZANTINE MUSICAL SYMBOL APODERMA ARCHAION', +118819: 'BYZANTINE MUSICAL SYMBOL APOTHEMA', +118820: 'BYZANTINE MUSICAL SYMBOL KLASMA', +118821: 'BYZANTINE MUSICAL SYMBOL REVMA', +118822: 'BYZANTINE MUSICAL SYMBOL PIASMA ARCHAION', +118823: 'BYZANTINE MUSICAL SYMBOL TINAGMA', +118824: 'BYZANTINE MUSICAL SYMBOL ANATRICHISMA', +118825: 'BYZANTINE MUSICAL SYMBOL SEISMA', +118826: 'BYZANTINE MUSICAL SYMBOL SYNAGMA ARCHAION', +118827: 'BYZANTINE MUSICAL SYMBOL SYNAGMA META STAVROU', +118828: 'BYZANTINE MUSICAL SYMBOL OYRANISMA ARCHAION', +118829: 'BYZANTINE MUSICAL SYMBOL THEMA', +118830: 'BYZANTINE MUSICAL SYMBOL LEMOI', +118831: 'BYZANTINE MUSICAL SYMBOL DYO', +118832: 'BYZANTINE MUSICAL SYMBOL TRIA', +118833: 'BYZANTINE MUSICAL SYMBOL TESSERA', +118834: 'BYZANTINE MUSICAL SYMBOL KRATIMATA', +118835: 'BYZANTINE MUSICAL SYMBOL APESO EXO NEO', +118836: 'BYZANTINE MUSICAL SYMBOL FTHORA ARCHAION', +118837: 'BYZANTINE MUSICAL SYMBOL IMIFTHORA', +118838: 'BYZANTINE MUSICAL SYMBOL TROMIKON ARCHAION', +118839: 'BYZANTINE MUSICAL SYMBOL KATAVA TROMIKON', +118840: 'BYZANTINE MUSICAL SYMBOL PELASTON', +118841: 'BYZANTINE MUSICAL SYMBOL PSIFISTON', +118842: 'BYZANTINE MUSICAL SYMBOL KONTEVMA', +118843: 'BYZANTINE MUSICAL SYMBOL CHOREVMA ARCHAION', +118844: 'BYZANTINE MUSICAL SYMBOL RAPISMA', +118845: 'BYZANTINE MUSICAL SYMBOL PARAKALESMA ARCHAION', +118846: 'BYZANTINE MUSICAL SYMBOL PARAKLITIKI ARCHAION', +118847: 'BYZANTINE MUSICAL SYMBOL ICHADIN', +118848: 'BYZANTINE MUSICAL SYMBOL NANA', +118849: 'BYZANTINE MUSICAL SYMBOL PETASMA', +118850: 'BYZANTINE MUSICAL SYMBOL KONTEVMA ALLO', +118851: 'BYZANTINE MUSICAL SYMBOL TROMIKON ALLO', +118852: 'BYZANTINE MUSICAL SYMBOL STRAGGISMATA', +118853: 'BYZANTINE MUSICAL SYMBOL GRONTHISMATA', +118854: 'BYZANTINE MUSICAL SYMBOL ISON NEO', +118855: 'BYZANTINE MUSICAL SYMBOL OLIGON NEO', +118856: 'BYZANTINE MUSICAL SYMBOL OXEIA NEO', +118857: 'BYZANTINE MUSICAL SYMBOL PETASTI', +118858: 'BYZANTINE MUSICAL SYMBOL KOUFISMA', +118859: 'BYZANTINE MUSICAL SYMBOL PETASTOKOUFISMA', +118860: 'BYZANTINE MUSICAL SYMBOL KRATIMOKOUFISMA', +118861: 'BYZANTINE MUSICAL SYMBOL PELASTON NEO', +118862: 'BYZANTINE MUSICAL SYMBOL KENTIMATA NEO ANO', +118863: 'BYZANTINE MUSICAL SYMBOL KENTIMA NEO ANO', +118864: 'BYZANTINE MUSICAL SYMBOL YPSILI', +118865: 'BYZANTINE MUSICAL SYMBOL APOSTROFOS NEO', +118866: 'BYZANTINE MUSICAL SYMBOL APOSTROFOI SYNDESMOS NEO', +118867: 'BYZANTINE MUSICAL SYMBOL YPORROI', +118868: 'BYZANTINE MUSICAL SYMBOL KRATIMOYPORROON', +118869: 'BYZANTINE MUSICAL SYMBOL ELAFRON', +118870: 'BYZANTINE MUSICAL SYMBOL CHAMILI', +118871: 'BYZANTINE MUSICAL SYMBOL MIKRON ISON', +118872: 'BYZANTINE MUSICAL SYMBOL VAREIA NEO', +118873: 'BYZANTINE MUSICAL SYMBOL PIASMA NEO', +118874: 'BYZANTINE MUSICAL SYMBOL PSIFISTON NEO', +118875: 'BYZANTINE MUSICAL SYMBOL OMALON', +118876: 'BYZANTINE MUSICAL SYMBOL ANTIKENOMA', +118877: 'BYZANTINE MUSICAL SYMBOL LYGISMA', +118878: 'BYZANTINE MUSICAL SYMBOL PARAKLITIKI NEO', +118879: 'BYZANTINE MUSICAL SYMBOL PARAKALESMA NEO', +118880: 'BYZANTINE MUSICAL SYMBOL ETERON PARAKALESMA', +118881: 'BYZANTINE MUSICAL SYMBOL KYLISMA', +118882: 'BYZANTINE MUSICAL SYMBOL ANTIKENOKYLISMA', +118883: 'BYZANTINE MUSICAL SYMBOL TROMIKON NEO', +118884: 'BYZANTINE MUSICAL SYMBOL EKSTREPTON', +118885: 'BYZANTINE MUSICAL SYMBOL SYNAGMA NEO', +118886: 'BYZANTINE MUSICAL SYMBOL SYRMA', +118887: 'BYZANTINE MUSICAL SYMBOL CHOREVMA NEO', +118888: 'BYZANTINE MUSICAL SYMBOL EPEGERMA', +118889: 'BYZANTINE MUSICAL SYMBOL SEISMA NEO', +118890: 'BYZANTINE MUSICAL SYMBOL XIRON KLASMA', +118891: 'BYZANTINE MUSICAL SYMBOL TROMIKOPSIFISTON', +118892: 'BYZANTINE MUSICAL SYMBOL PSIFISTOLYGISMA', +118893: 'BYZANTINE MUSICAL SYMBOL TROMIKOLYGISMA', +118894: 'BYZANTINE MUSICAL SYMBOL TROMIKOPARAKALESMA', +118895: 'BYZANTINE MUSICAL SYMBOL PSIFISTOPARAKALESMA', +118896: 'BYZANTINE MUSICAL SYMBOL TROMIKOSYNAGMA', +118897: 'BYZANTINE MUSICAL SYMBOL PSIFISTOSYNAGMA', +118898: 'BYZANTINE MUSICAL SYMBOL GORGOSYNTHETON', +118899: 'BYZANTINE MUSICAL SYMBOL ARGOSYNTHETON', +118900: 'BYZANTINE MUSICAL SYMBOL ETERON ARGOSYNTHETON', +118901: 'BYZANTINE MUSICAL SYMBOL OYRANISMA NEO', +118902: 'BYZANTINE MUSICAL SYMBOL THEMATISMOS ESO', +118903: 'BYZANTINE MUSICAL SYMBOL THEMATISMOS EXO', +118904: 'BYZANTINE MUSICAL SYMBOL THEMA APLOUN', +118905: 'BYZANTINE MUSICAL SYMBOL THES KAI APOTHES', +118906: 'BYZANTINE MUSICAL SYMBOL KATAVASMA', +118907: 'BYZANTINE MUSICAL SYMBOL ENDOFONON', +118908: 'BYZANTINE MUSICAL SYMBOL YFEN KATO', +118909: 'BYZANTINE MUSICAL SYMBOL YFEN ANO', +118910: 'BYZANTINE MUSICAL SYMBOL STAVROS', +118911: 'BYZANTINE MUSICAL SYMBOL KLASMA ANO', +118912: 'BYZANTINE MUSICAL SYMBOL DIPLI ARCHAION', +118913: 'BYZANTINE MUSICAL SYMBOL KRATIMA ARCHAION', +118914: 'BYZANTINE MUSICAL SYMBOL KRATIMA ALLO', +118915: 'BYZANTINE MUSICAL SYMBOL KRATIMA NEO', +118916: 'BYZANTINE MUSICAL SYMBOL APODERMA NEO', +118917: 'BYZANTINE MUSICAL SYMBOL APLI', +118918: 'BYZANTINE MUSICAL SYMBOL DIPLI', +118919: 'BYZANTINE MUSICAL SYMBOL TRIPLI', +118920: 'BYZANTINE MUSICAL SYMBOL TETRAPLI', +118921: 'BYZANTINE MUSICAL SYMBOL KORONIS', +118922: 'BYZANTINE MUSICAL SYMBOL LEIMMA ENOS CHRONOU', +118923: 'BYZANTINE MUSICAL SYMBOL LEIMMA DYO CHRONON', +118924: 'BYZANTINE MUSICAL SYMBOL LEIMMA TRION CHRONON', +118925: 'BYZANTINE MUSICAL SYMBOL LEIMMA TESSARON CHRONON', +118926: 'BYZANTINE MUSICAL SYMBOL LEIMMA IMISEOS CHRONOU', +118927: 'BYZANTINE MUSICAL SYMBOL GORGON NEO ANO', +118928: 'BYZANTINE MUSICAL SYMBOL GORGON PARESTIGMENON ARISTERA', +118929: 'BYZANTINE MUSICAL SYMBOL GORGON PARESTIGMENON DEXIA', +118930: 'BYZANTINE MUSICAL SYMBOL DIGORGON', +118931: 'BYZANTINE MUSICAL SYMBOL DIGORGON PARESTIGMENON ARISTERA KATO', +118932: 'BYZANTINE MUSICAL SYMBOL DIGORGON PARESTIGMENON ARISTERA ANO', +118933: 'BYZANTINE MUSICAL SYMBOL DIGORGON PARESTIGMENON DEXIA', +118934: 'BYZANTINE MUSICAL SYMBOL TRIGORGON', +118935: 'BYZANTINE MUSICAL SYMBOL ARGON', +118936: 'BYZANTINE MUSICAL SYMBOL IMIDIARGON', +118937: 'BYZANTINE MUSICAL SYMBOL DIARGON', +118938: 'BYZANTINE MUSICAL SYMBOL AGOGI POLI ARGI', +118939: 'BYZANTINE MUSICAL SYMBOL AGOGI ARGOTERI', +118940: 'BYZANTINE MUSICAL SYMBOL AGOGI ARGI', +118941: 'BYZANTINE MUSICAL SYMBOL AGOGI METRIA', +118942: 'BYZANTINE MUSICAL SYMBOL AGOGI MESI', +118943: 'BYZANTINE MUSICAL SYMBOL AGOGI GORGI', +118944: 'BYZANTINE MUSICAL SYMBOL AGOGI GORGOTERI', +118945: 'BYZANTINE MUSICAL SYMBOL AGOGI POLI GORGI', +118946: 'BYZANTINE MUSICAL SYMBOL MARTYRIA PROTOS ICHOS', +118947: 'BYZANTINE MUSICAL SYMBOL MARTYRIA ALLI PROTOS ICHOS', +118948: 'BYZANTINE MUSICAL SYMBOL MARTYRIA DEYTEROS ICHOS', +118949: 'BYZANTINE MUSICAL SYMBOL MARTYRIA ALLI DEYTEROS ICHOS', +118950: 'BYZANTINE MUSICAL SYMBOL MARTYRIA TRITOS ICHOS', +118951: 'BYZANTINE MUSICAL SYMBOL MARTYRIA TRIFONIAS', +118952: 'BYZANTINE MUSICAL SYMBOL MARTYRIA TETARTOS ICHOS', +118953: 'BYZANTINE MUSICAL SYMBOL MARTYRIA TETARTOS LEGETOS ICHOS', +118954: 'BYZANTINE MUSICAL SYMBOL MARTYRIA LEGETOS ICHOS', +118955: 'BYZANTINE MUSICAL SYMBOL MARTYRIA PLAGIOS ICHOS', +118956: 'BYZANTINE MUSICAL SYMBOL ISAKIA TELOUS ICHIMATOS', +118957: 'BYZANTINE MUSICAL SYMBOL APOSTROFOI TELOUS ICHIMATOS', +118958: 'BYZANTINE MUSICAL SYMBOL FANEROSIS TETRAFONIAS', +118959: 'BYZANTINE MUSICAL SYMBOL FANEROSIS MONOFONIAS', +118960: 'BYZANTINE MUSICAL SYMBOL FANEROSIS DIFONIAS', +118961: 'BYZANTINE MUSICAL SYMBOL MARTYRIA VARYS ICHOS', +118962: 'BYZANTINE MUSICAL SYMBOL MARTYRIA PROTOVARYS ICHOS', +118963: 'BYZANTINE MUSICAL SYMBOL MARTYRIA PLAGIOS TETARTOS ICHOS', +118964: 'BYZANTINE MUSICAL SYMBOL GORTHMIKON N APLOUN', +118965: 'BYZANTINE MUSICAL SYMBOL GORTHMIKON N DIPLOUN', +118966: 'BYZANTINE MUSICAL SYMBOL ENARXIS KAI FTHORA VOU', +118967: 'BYZANTINE MUSICAL SYMBOL IMIFONON', +118968: 'BYZANTINE MUSICAL SYMBOL IMIFTHORON', +118969: 'BYZANTINE MUSICAL SYMBOL FTHORA ARCHAION DEYTEROU ICHOU', +118970: 'BYZANTINE MUSICAL SYMBOL FTHORA DIATONIKI PA', +118971: 'BYZANTINE MUSICAL SYMBOL FTHORA DIATONIKI NANA', +118972: 'BYZANTINE MUSICAL SYMBOL FTHORA NAOS ICHOS', +118973: 'BYZANTINE MUSICAL SYMBOL FTHORA DIATONIKI DI', +118974: 'BYZANTINE MUSICAL SYMBOL FTHORA SKLIRON DIATONON DI', +118975: 'BYZANTINE MUSICAL SYMBOL FTHORA DIATONIKI KE', +118976: 'BYZANTINE MUSICAL SYMBOL FTHORA DIATONIKI ZO', +118977: 'BYZANTINE MUSICAL SYMBOL FTHORA DIATONIKI NI KATO', +118978: 'BYZANTINE MUSICAL SYMBOL FTHORA DIATONIKI NI ANO', +118979: 'BYZANTINE MUSICAL SYMBOL FTHORA MALAKON CHROMA DIFONIAS', +118980: 'BYZANTINE MUSICAL SYMBOL FTHORA MALAKON CHROMA MONOFONIAS', +118981: 'BYZANTINE MUSICAL SYMBOL FHTORA SKLIRON CHROMA VASIS', +118982: 'BYZANTINE MUSICAL SYMBOL FTHORA SKLIRON CHROMA SYNAFI', +118983: 'BYZANTINE MUSICAL SYMBOL FTHORA NENANO', +118984: 'BYZANTINE MUSICAL SYMBOL CHROA ZYGOS', +118985: 'BYZANTINE MUSICAL SYMBOL CHROA KLITON', +118986: 'BYZANTINE MUSICAL SYMBOL CHROA SPATHI', +118987: 'BYZANTINE MUSICAL SYMBOL FTHORA I YFESIS TETARTIMORION', +118988: 'BYZANTINE MUSICAL SYMBOL FTHORA ENARMONIOS ANTIFONIA', +118989: 'BYZANTINE MUSICAL SYMBOL YFESIS TRITIMORION', +118990: 'BYZANTINE MUSICAL SYMBOL DIESIS TRITIMORION', +118991: 'BYZANTINE MUSICAL SYMBOL DIESIS TETARTIMORION', +118992: 'BYZANTINE MUSICAL SYMBOL DIESIS APLI DYO DODEKATA', +118993: 'BYZANTINE MUSICAL SYMBOL DIESIS MONOGRAMMOS TESSERA DODEKATA', +118994: 'BYZANTINE MUSICAL SYMBOL DIESIS DIGRAMMOS EX DODEKATA', +118995: 'BYZANTINE MUSICAL SYMBOL DIESIS TRIGRAMMOS OKTO DODEKATA', +118996: 'BYZANTINE MUSICAL SYMBOL YFESIS APLI DYO DODEKATA', +118997: 'BYZANTINE MUSICAL SYMBOL YFESIS MONOGRAMMOS TESSERA DODEKATA', +118998: 'BYZANTINE MUSICAL SYMBOL YFESIS DIGRAMMOS EX DODEKATA', +118999: 'BYZANTINE MUSICAL SYMBOL YFESIS TRIGRAMMOS OKTO DODEKATA', +119000: 'BYZANTINE MUSICAL SYMBOL GENIKI DIESIS', +119001: 'BYZANTINE MUSICAL SYMBOL GENIKI YFESIS', +119002: 'BYZANTINE MUSICAL SYMBOL DIASTOLI APLI MIKRI', +119003: 'BYZANTINE MUSICAL SYMBOL DIASTOLI APLI MEGALI', +119004: 'BYZANTINE MUSICAL SYMBOL DIASTOLI DIPLI', +119005: 'BYZANTINE MUSICAL SYMBOL DIASTOLI THESEOS', +119006: 'BYZANTINE MUSICAL SYMBOL SIMANSIS THESEOS', +119007: 'BYZANTINE MUSICAL SYMBOL SIMANSIS THESEOS DISIMOU', +119008: 'BYZANTINE MUSICAL SYMBOL SIMANSIS THESEOS TRISIMOU', +119009: 'BYZANTINE MUSICAL SYMBOL SIMANSIS THESEOS TETRASIMOU', +119010: 'BYZANTINE MUSICAL SYMBOL SIMANSIS ARSEOS', +119011: 'BYZANTINE MUSICAL SYMBOL SIMANSIS ARSEOS DISIMOU', +119012: 'BYZANTINE MUSICAL SYMBOL SIMANSIS ARSEOS TRISIMOU', +119013: 'BYZANTINE MUSICAL SYMBOL SIMANSIS ARSEOS TETRASIMOU', +119014: 'BYZANTINE MUSICAL SYMBOL DIGRAMMA GG', +119015: 'BYZANTINE MUSICAL SYMBOL DIFTOGGOS OU', +119016: 'BYZANTINE MUSICAL SYMBOL STIGMA', +119017: 'BYZANTINE MUSICAL SYMBOL ARKTIKO PA', +119018: 'BYZANTINE MUSICAL SYMBOL ARKTIKO VOU', +119019: 'BYZANTINE MUSICAL SYMBOL ARKTIKO GA', +119020: 'BYZANTINE MUSICAL SYMBOL ARKTIKO DI', +119021: 'BYZANTINE MUSICAL SYMBOL ARKTIKO KE', +119022: 'BYZANTINE MUSICAL SYMBOL ARKTIKO ZO', +119023: 'BYZANTINE MUSICAL SYMBOL ARKTIKO NI', +119024: 'BYZANTINE MUSICAL SYMBOL KENTIMATA NEO MESO', +119025: 'BYZANTINE MUSICAL SYMBOL KENTIMA NEO MESO', +119026: 'BYZANTINE MUSICAL SYMBOL KENTIMATA NEO KATO', +119027: 'BYZANTINE MUSICAL SYMBOL KENTIMA NEO KATO', +119028: 'BYZANTINE MUSICAL SYMBOL KLASMA KATO', +119029: 'BYZANTINE MUSICAL SYMBOL GORGON NEO KATO', +119040: 'MUSICAL SYMBOL SINGLE BARLINE', +119041: 'MUSICAL SYMBOL DOUBLE BARLINE', +119042: 'MUSICAL SYMBOL FINAL BARLINE', +119043: 'MUSICAL SYMBOL REVERSE FINAL BARLINE', +119044: 'MUSICAL SYMBOL DASHED BARLINE', +119045: 'MUSICAL SYMBOL SHORT BARLINE', +119046: 'MUSICAL SYMBOL LEFT REPEAT SIGN', +119047: 'MUSICAL SYMBOL RIGHT REPEAT SIGN', +119048: 'MUSICAL SYMBOL REPEAT DOTS', +119049: 'MUSICAL SYMBOL DAL SEGNO', +119050: 'MUSICAL SYMBOL DA CAPO', +119051: 'MUSICAL SYMBOL SEGNO', +119052: 'MUSICAL SYMBOL CODA', +119053: 'MUSICAL SYMBOL REPEATED FIGURE-1', +119054: 'MUSICAL SYMBOL REPEATED FIGURE-2', +119055: 'MUSICAL SYMBOL REPEATED FIGURE-3', +119056: 'MUSICAL SYMBOL FERMATA', +119057: 'MUSICAL SYMBOL FERMATA BELOW', +119058: 'MUSICAL SYMBOL BREATH MARK', +119059: 'MUSICAL SYMBOL CAESURA', +119060: 'MUSICAL SYMBOL BRACE', +119061: 'MUSICAL SYMBOL BRACKET', +119062: 'MUSICAL SYMBOL ONE-LINE STAFF', +119063: 'MUSICAL SYMBOL TWO-LINE STAFF', +119064: 'MUSICAL SYMBOL THREE-LINE STAFF', +119065: 'MUSICAL SYMBOL FOUR-LINE STAFF', +119066: 'MUSICAL SYMBOL FIVE-LINE STAFF', +119067: 'MUSICAL SYMBOL SIX-LINE STAFF', +119068: 'MUSICAL SYMBOL SIX-STRING FRETBOARD', +119069: 'MUSICAL SYMBOL FOUR-STRING FRETBOARD', +119070: 'MUSICAL SYMBOL G CLEF', +119071: 'MUSICAL SYMBOL G CLEF OTTAVA ALTA', +119072: 'MUSICAL SYMBOL G CLEF OTTAVA BASSA', +119073: 'MUSICAL SYMBOL C CLEF', +119074: 'MUSICAL SYMBOL F CLEF', +119075: 'MUSICAL SYMBOL F CLEF OTTAVA ALTA', +119076: 'MUSICAL SYMBOL F CLEF OTTAVA BASSA', +119077: 'MUSICAL SYMBOL DRUM CLEF-1', +119078: 'MUSICAL SYMBOL DRUM CLEF-2', +119082: 'MUSICAL SYMBOL DOUBLE SHARP', +119083: 'MUSICAL SYMBOL DOUBLE FLAT', +119084: 'MUSICAL SYMBOL FLAT UP', +119085: 'MUSICAL SYMBOL FLAT DOWN', +119086: 'MUSICAL SYMBOL NATURAL UP', +119087: 'MUSICAL SYMBOL NATURAL DOWN', +119088: 'MUSICAL SYMBOL SHARP UP', +119089: 'MUSICAL SYMBOL SHARP DOWN', +119090: 'MUSICAL SYMBOL QUARTER TONE SHARP', +119091: 'MUSICAL SYMBOL QUARTER TONE FLAT', +119092: 'MUSICAL SYMBOL COMMON TIME', +119093: 'MUSICAL SYMBOL CUT TIME', +119094: 'MUSICAL SYMBOL OTTAVA ALTA', +119095: 'MUSICAL SYMBOL OTTAVA BASSA', +119096: 'MUSICAL SYMBOL QUINDICESIMA ALTA', +119097: 'MUSICAL SYMBOL QUINDICESIMA BASSA', +119098: 'MUSICAL SYMBOL MULTI REST', +119099: 'MUSICAL SYMBOL WHOLE REST', +119100: 'MUSICAL SYMBOL HALF REST', +119101: 'MUSICAL SYMBOL QUARTER REST', +119102: 'MUSICAL SYMBOL EIGHTH REST', +119103: 'MUSICAL SYMBOL SIXTEENTH REST', +119104: 'MUSICAL SYMBOL THIRTY-SECOND REST', +119105: 'MUSICAL SYMBOL SIXTY-FOURTH REST', +119106: 'MUSICAL SYMBOL ONE HUNDRED TWENTY-EIGHTH REST', +119107: 'MUSICAL SYMBOL X NOTEHEAD', +119108: 'MUSICAL SYMBOL PLUS NOTEHEAD', +119109: 'MUSICAL SYMBOL CIRCLE X NOTEHEAD', +119110: 'MUSICAL SYMBOL SQUARE NOTEHEAD WHITE', +119111: 'MUSICAL SYMBOL SQUARE NOTEHEAD BLACK', +119112: 'MUSICAL SYMBOL TRIANGLE NOTEHEAD UP WHITE', +119113: 'MUSICAL SYMBOL TRIANGLE NOTEHEAD UP BLACK', +119114: 'MUSICAL SYMBOL TRIANGLE NOTEHEAD LEFT WHITE', +119115: 'MUSICAL SYMBOL TRIANGLE NOTEHEAD LEFT BLACK', +119116: 'MUSICAL SYMBOL TRIANGLE NOTEHEAD RIGHT WHITE', +119117: 'MUSICAL SYMBOL TRIANGLE NOTEHEAD RIGHT BLACK', +119118: 'MUSICAL SYMBOL TRIANGLE NOTEHEAD DOWN WHITE', +119119: 'MUSICAL SYMBOL TRIANGLE NOTEHEAD DOWN BLACK', +119120: 'MUSICAL SYMBOL TRIANGLE NOTEHEAD UP RIGHT WHITE', +119121: 'MUSICAL SYMBOL TRIANGLE NOTEHEAD UP RIGHT BLACK', +119122: 'MUSICAL SYMBOL MOON NOTEHEAD WHITE', +119123: 'MUSICAL SYMBOL MOON NOTEHEAD BLACK', +119124: 'MUSICAL SYMBOL TRIANGLE-ROUND NOTEHEAD DOWN WHITE', +119125: 'MUSICAL SYMBOL TRIANGLE-ROUND NOTEHEAD DOWN BLACK', +119126: 'MUSICAL SYMBOL PARENTHESIS NOTEHEAD', +119127: 'MUSICAL SYMBOL VOID NOTEHEAD', +119128: 'MUSICAL SYMBOL NOTEHEAD BLACK', +119129: 'MUSICAL SYMBOL NULL NOTEHEAD', +119130: 'MUSICAL SYMBOL CLUSTER NOTEHEAD WHITE', +119131: 'MUSICAL SYMBOL CLUSTER NOTEHEAD BLACK', +119132: 'MUSICAL SYMBOL BREVE', +119133: 'MUSICAL SYMBOL WHOLE NOTE', +119134: 'MUSICAL SYMBOL HALF NOTE', +119135: 'MUSICAL SYMBOL QUARTER NOTE', +119136: 'MUSICAL SYMBOL EIGHTH NOTE', +119137: 'MUSICAL SYMBOL SIXTEENTH NOTE', +119138: 'MUSICAL SYMBOL THIRTY-SECOND NOTE', +119139: 'MUSICAL SYMBOL SIXTY-FOURTH NOTE', +119140: 'MUSICAL SYMBOL ONE HUNDRED TWENTY-EIGHTH NOTE', +119141: 'MUSICAL SYMBOL COMBINING STEM', +119142: 'MUSICAL SYMBOL COMBINING SPRECHGESANG STEM', +119143: 'MUSICAL SYMBOL COMBINING TREMOLO-1', +119144: 'MUSICAL SYMBOL COMBINING TREMOLO-2', +119145: 'MUSICAL SYMBOL COMBINING TREMOLO-3', +119146: 'MUSICAL SYMBOL FINGERED TREMOLO-1', +119147: 'MUSICAL SYMBOL FINGERED TREMOLO-2', +119148: 'MUSICAL SYMBOL FINGERED TREMOLO-3', +119149: 'MUSICAL SYMBOL COMBINING AUGMENTATION DOT', +119150: 'MUSICAL SYMBOL COMBINING FLAG-1', +119151: 'MUSICAL SYMBOL COMBINING FLAG-2', +119152: 'MUSICAL SYMBOL COMBINING FLAG-3', +119153: 'MUSICAL SYMBOL COMBINING FLAG-4', +119154: 'MUSICAL SYMBOL COMBINING FLAG-5', +119155: 'MUSICAL SYMBOL BEGIN BEAM', +119156: 'MUSICAL SYMBOL END BEAM', +119157: 'MUSICAL SYMBOL BEGIN TIE', +119158: 'MUSICAL SYMBOL END TIE', +119159: 'MUSICAL SYMBOL BEGIN SLUR', +119160: 'MUSICAL SYMBOL END SLUR', +119161: 'MUSICAL SYMBOL BEGIN PHRASE', +119162: 'MUSICAL SYMBOL END PHRASE', +119163: 'MUSICAL SYMBOL COMBINING ACCENT', +119164: 'MUSICAL SYMBOL COMBINING STACCATO', +119165: 'MUSICAL SYMBOL COMBINING TENUTO', +119166: 'MUSICAL SYMBOL COMBINING STACCATISSIMO', +119167: 'MUSICAL SYMBOL COMBINING MARCATO', +119168: 'MUSICAL SYMBOL COMBINING MARCATO-STACCATO', +119169: 'MUSICAL SYMBOL COMBINING ACCENT-STACCATO', +119170: 'MUSICAL SYMBOL COMBINING LOURE', +119171: 'MUSICAL SYMBOL ARPEGGIATO UP', +119172: 'MUSICAL SYMBOL ARPEGGIATO DOWN', +119173: 'MUSICAL SYMBOL COMBINING DOIT', +119174: 'MUSICAL SYMBOL COMBINING RIP', +119175: 'MUSICAL SYMBOL COMBINING FLIP', +119176: 'MUSICAL SYMBOL COMBINING SMEAR', +119177: 'MUSICAL SYMBOL COMBINING BEND', +119178: 'MUSICAL SYMBOL COMBINING DOUBLE TONGUE', +119179: 'MUSICAL SYMBOL COMBINING TRIPLE TONGUE', +119180: 'MUSICAL SYMBOL RINFORZANDO', +119181: 'MUSICAL SYMBOL SUBITO', +119182: 'MUSICAL SYMBOL Z', +119183: 'MUSICAL SYMBOL PIANO', +119184: 'MUSICAL SYMBOL MEZZO', +119185: 'MUSICAL SYMBOL FORTE', +119186: 'MUSICAL SYMBOL CRESCENDO', +119187: 'MUSICAL SYMBOL DECRESCENDO', +119188: 'MUSICAL SYMBOL GRACE NOTE SLASH', +119189: 'MUSICAL SYMBOL GRACE NOTE NO SLASH', +119190: 'MUSICAL SYMBOL TR', +119191: 'MUSICAL SYMBOL TURN', +119192: 'MUSICAL SYMBOL INVERTED TURN', +119193: 'MUSICAL SYMBOL TURN SLASH', +119194: 'MUSICAL SYMBOL TURN UP', +119195: 'MUSICAL SYMBOL ORNAMENT STROKE-1', +119196: 'MUSICAL SYMBOL ORNAMENT STROKE-2', +119197: 'MUSICAL SYMBOL ORNAMENT STROKE-3', +119198: 'MUSICAL SYMBOL ORNAMENT STROKE-4', +119199: 'MUSICAL SYMBOL ORNAMENT STROKE-5', +119200: 'MUSICAL SYMBOL ORNAMENT STROKE-6', +119201: 'MUSICAL SYMBOL ORNAMENT STROKE-7', +119202: 'MUSICAL SYMBOL ORNAMENT STROKE-8', +119203: 'MUSICAL SYMBOL ORNAMENT STROKE-9', +119204: 'MUSICAL SYMBOL ORNAMENT STROKE-10', +119205: 'MUSICAL SYMBOL ORNAMENT STROKE-11', +119206: 'MUSICAL SYMBOL HAUPTSTIMME', +119207: 'MUSICAL SYMBOL NEBENSTIMME', +119208: 'MUSICAL SYMBOL END OF STIMME', +119209: 'MUSICAL SYMBOL DEGREE SLASH', +119210: 'MUSICAL SYMBOL COMBINING DOWN BOW', +119211: 'MUSICAL SYMBOL COMBINING UP BOW', +119212: 'MUSICAL SYMBOL COMBINING HARMONIC', +119213: 'MUSICAL SYMBOL COMBINING SNAP PIZZICATO', +119214: 'MUSICAL SYMBOL PEDAL MARK', +119215: 'MUSICAL SYMBOL PEDAL UP MARK', +119216: 'MUSICAL SYMBOL HALF PEDAL MARK', +119217: 'MUSICAL SYMBOL GLISSANDO UP', +119218: 'MUSICAL SYMBOL GLISSANDO DOWN', +119219: 'MUSICAL SYMBOL WITH FINGERNAILS', +119220: 'MUSICAL SYMBOL DAMP', +119221: 'MUSICAL SYMBOL DAMP ALL', +119222: 'MUSICAL SYMBOL MAXIMA', +119223: 'MUSICAL SYMBOL LONGA', +119224: 'MUSICAL SYMBOL BREVIS', +119225: 'MUSICAL SYMBOL SEMIBREVIS WHITE', +119226: 'MUSICAL SYMBOL SEMIBREVIS BLACK', +119227: 'MUSICAL SYMBOL MINIMA', +119228: 'MUSICAL SYMBOL MINIMA BLACK', +119229: 'MUSICAL SYMBOL SEMIMINIMA WHITE', +119230: 'MUSICAL SYMBOL SEMIMINIMA BLACK', +119231: 'MUSICAL SYMBOL FUSA WHITE', +119232: 'MUSICAL SYMBOL FUSA BLACK', +119233: 'MUSICAL SYMBOL LONGA PERFECTA REST', +119234: 'MUSICAL SYMBOL LONGA IMPERFECTA REST', +119235: 'MUSICAL SYMBOL BREVIS REST', +119236: 'MUSICAL SYMBOL SEMIBREVIS REST', +119237: 'MUSICAL SYMBOL MINIMA REST', +119238: 'MUSICAL SYMBOL SEMIMINIMA REST', +119239: 'MUSICAL SYMBOL TEMPUS PERFECTUM CUM PROLATIONE PERFECTA', +119240: 'MUSICAL SYMBOL TEMPUS PERFECTUM CUM PROLATIONE IMPERFECTA', +119241: 'MUSICAL SYMBOL TEMPUS PERFECTUM CUM PROLATIONE PERFECTA DIMINUTION-1', +119242: 'MUSICAL SYMBOL TEMPUS IMPERFECTUM CUM PROLATIONE PERFECTA', +119243: 'MUSICAL SYMBOL TEMPUS IMPERFECTUM CUM PROLATIONE IMPERFECTA', +119244: 'MUSICAL SYMBOL TEMPUS IMPERFECTUM CUM PROLATIONE IMPERFECTA DIMINUTION-1', +119245: 'MUSICAL SYMBOL TEMPUS IMPERFECTUM CUM PROLATIONE IMPERFECTA DIMINUTION-2', +119246: 'MUSICAL SYMBOL TEMPUS IMPERFECTUM CUM PROLATIONE IMPERFECTA DIMINUTION-3', +119247: 'MUSICAL SYMBOL CROIX', +119248: 'MUSICAL SYMBOL GREGORIAN C CLEF', +119249: 'MUSICAL SYMBOL GREGORIAN F CLEF', +119250: 'MUSICAL SYMBOL SQUARE B', +119251: 'MUSICAL SYMBOL VIRGA', +119252: 'MUSICAL SYMBOL PODATUS', +119253: 'MUSICAL SYMBOL CLIVIS', +119254: 'MUSICAL SYMBOL SCANDICUS', +119255: 'MUSICAL SYMBOL CLIMACUS', +119256: 'MUSICAL SYMBOL TORCULUS', +119257: 'MUSICAL SYMBOL PORRECTUS', +119258: 'MUSICAL SYMBOL PORRECTUS FLEXUS', +119259: 'MUSICAL SYMBOL SCANDICUS FLEXUS', +119260: 'MUSICAL SYMBOL TORCULUS RESUPINUS', +119261: 'MUSICAL SYMBOL PES SUBPUNCTIS', +119808: 'MATHEMATICAL BOLD CAPITAL A', +119809: 'MATHEMATICAL BOLD CAPITAL B', +119810: 'MATHEMATICAL BOLD CAPITAL C', +119811: 'MATHEMATICAL BOLD CAPITAL D', +119812: 'MATHEMATICAL BOLD CAPITAL E', +119813: 'MATHEMATICAL BOLD CAPITAL F', +119814: 'MATHEMATICAL BOLD CAPITAL G', +119815: 'MATHEMATICAL BOLD CAPITAL H', +119816: 'MATHEMATICAL BOLD CAPITAL I', +119817: 'MATHEMATICAL BOLD CAPITAL J', +119818: 'MATHEMATICAL BOLD CAPITAL K', +119819: 'MATHEMATICAL BOLD CAPITAL L', +119820: 'MATHEMATICAL BOLD CAPITAL M', +119821: 'MATHEMATICAL BOLD CAPITAL N', +119822: 'MATHEMATICAL BOLD CAPITAL O', +119823: 'MATHEMATICAL BOLD CAPITAL P', +119824: 'MATHEMATICAL BOLD CAPITAL Q', +119825: 'MATHEMATICAL BOLD CAPITAL R', +119826: 'MATHEMATICAL BOLD CAPITAL S', +119827: 'MATHEMATICAL BOLD CAPITAL T', +119828: 'MATHEMATICAL BOLD CAPITAL U', +119829: 'MATHEMATICAL BOLD CAPITAL V', +119830: 'MATHEMATICAL BOLD CAPITAL W', +119831: 'MATHEMATICAL BOLD CAPITAL X', +119832: 'MATHEMATICAL BOLD CAPITAL Y', +119833: 'MATHEMATICAL BOLD CAPITAL Z', +119834: 'MATHEMATICAL BOLD SMALL A', +119835: 'MATHEMATICAL BOLD SMALL B', +119836: 'MATHEMATICAL BOLD SMALL C', +119837: 'MATHEMATICAL BOLD SMALL D', +119838: 'MATHEMATICAL BOLD SMALL E', +119839: 'MATHEMATICAL BOLD SMALL F', +119840: 'MATHEMATICAL BOLD SMALL G', +119841: 'MATHEMATICAL BOLD SMALL H', +119842: 'MATHEMATICAL BOLD SMALL I', +119843: 'MATHEMATICAL BOLD SMALL J', +119844: 'MATHEMATICAL BOLD SMALL K', +119845: 'MATHEMATICAL BOLD SMALL L', +119846: 'MATHEMATICAL BOLD SMALL M', +119847: 'MATHEMATICAL BOLD SMALL N', +119848: 'MATHEMATICAL BOLD SMALL O', +119849: 'MATHEMATICAL BOLD SMALL P', +119850: 'MATHEMATICAL BOLD SMALL Q', +119851: 'MATHEMATICAL BOLD SMALL R', +119852: 'MATHEMATICAL BOLD SMALL S', +119853: 'MATHEMATICAL BOLD SMALL T', +119854: 'MATHEMATICAL BOLD SMALL U', +119855: 'MATHEMATICAL BOLD SMALL V', +119856: 'MATHEMATICAL BOLD SMALL W', +119857: 'MATHEMATICAL BOLD SMALL X', +119858: 'MATHEMATICAL BOLD SMALL Y', +119859: 'MATHEMATICAL BOLD SMALL Z', +119860: 'MATHEMATICAL ITALIC CAPITAL A', +119861: 'MATHEMATICAL ITALIC CAPITAL B', +119862: 'MATHEMATICAL ITALIC CAPITAL C', +119863: 'MATHEMATICAL ITALIC CAPITAL D', +119864: 'MATHEMATICAL ITALIC CAPITAL E', +119865: 'MATHEMATICAL ITALIC CAPITAL F', +119866: 'MATHEMATICAL ITALIC CAPITAL G', +119867: 'MATHEMATICAL ITALIC CAPITAL H', +119868: 'MATHEMATICAL ITALIC CAPITAL I', +119869: 'MATHEMATICAL ITALIC CAPITAL J', +119870: 'MATHEMATICAL ITALIC CAPITAL K', +119871: 'MATHEMATICAL ITALIC CAPITAL L', +119872: 'MATHEMATICAL ITALIC CAPITAL M', +119873: 'MATHEMATICAL ITALIC CAPITAL N', +119874: 'MATHEMATICAL ITALIC CAPITAL O', +119875: 'MATHEMATICAL ITALIC CAPITAL P', +119876: 'MATHEMATICAL ITALIC CAPITAL Q', +119877: 'MATHEMATICAL ITALIC CAPITAL R', +119878: 'MATHEMATICAL ITALIC CAPITAL S', +119879: 'MATHEMATICAL ITALIC CAPITAL T', +119880: 'MATHEMATICAL ITALIC CAPITAL U', +119881: 'MATHEMATICAL ITALIC CAPITAL V', +119882: 'MATHEMATICAL ITALIC CAPITAL W', +119883: 'MATHEMATICAL ITALIC CAPITAL X', +119884: 'MATHEMATICAL ITALIC CAPITAL Y', +119885: 'MATHEMATICAL ITALIC CAPITAL Z', +119886: 'MATHEMATICAL ITALIC SMALL A', +119887: 'MATHEMATICAL ITALIC SMALL B', +119888: 'MATHEMATICAL ITALIC SMALL C', +119889: 'MATHEMATICAL ITALIC SMALL D', +119890: 'MATHEMATICAL ITALIC SMALL E', +119891: 'MATHEMATICAL ITALIC SMALL F', +119892: 'MATHEMATICAL ITALIC SMALL G', +119894: 'MATHEMATICAL ITALIC SMALL I', +119895: 'MATHEMATICAL ITALIC SMALL J', +119896: 'MATHEMATICAL ITALIC SMALL K', +119897: 'MATHEMATICAL ITALIC SMALL L', +119898: 'MATHEMATICAL ITALIC SMALL M', +119899: 'MATHEMATICAL ITALIC SMALL N', +119900: 'MATHEMATICAL ITALIC SMALL O', +119901: 'MATHEMATICAL ITALIC SMALL P', +119902: 'MATHEMATICAL ITALIC SMALL Q', +119903: 'MATHEMATICAL ITALIC SMALL R', +119904: 'MATHEMATICAL ITALIC SMALL S', +119905: 'MATHEMATICAL ITALIC SMALL T', +119906: 'MATHEMATICAL ITALIC SMALL U', +119907: 'MATHEMATICAL ITALIC SMALL V', +119908: 'MATHEMATICAL ITALIC SMALL W', +119909: 'MATHEMATICAL ITALIC SMALL X', +119910: 'MATHEMATICAL ITALIC SMALL Y', +119911: 'MATHEMATICAL ITALIC SMALL Z', +119912: 'MATHEMATICAL BOLD ITALIC CAPITAL A', +119913: 'MATHEMATICAL BOLD ITALIC CAPITAL B', +119914: 'MATHEMATICAL BOLD ITALIC CAPITAL C', +119915: 'MATHEMATICAL BOLD ITALIC CAPITAL D', +119916: 'MATHEMATICAL BOLD ITALIC CAPITAL E', +119917: 'MATHEMATICAL BOLD ITALIC CAPITAL F', +119918: 'MATHEMATICAL BOLD ITALIC CAPITAL G', +119919: 'MATHEMATICAL BOLD ITALIC CAPITAL H', +119920: 'MATHEMATICAL BOLD ITALIC CAPITAL I', +119921: 'MATHEMATICAL BOLD ITALIC CAPITAL J', +119922: 'MATHEMATICAL BOLD ITALIC CAPITAL K', +119923: 'MATHEMATICAL BOLD ITALIC CAPITAL L', +119924: 'MATHEMATICAL BOLD ITALIC CAPITAL M', +119925: 'MATHEMATICAL BOLD ITALIC CAPITAL N', +119926: 'MATHEMATICAL BOLD ITALIC CAPITAL O', +119927: 'MATHEMATICAL BOLD ITALIC CAPITAL P', +119928: 'MATHEMATICAL BOLD ITALIC CAPITAL Q', +119929: 'MATHEMATICAL BOLD ITALIC CAPITAL R', +119930: 'MATHEMATICAL BOLD ITALIC CAPITAL S', +119931: 'MATHEMATICAL BOLD ITALIC CAPITAL T', +119932: 'MATHEMATICAL BOLD ITALIC CAPITAL U', +119933: 'MATHEMATICAL BOLD ITALIC CAPITAL V', +119934: 'MATHEMATICAL BOLD ITALIC CAPITAL W', +119935: 'MATHEMATICAL BOLD ITALIC CAPITAL X', +119936: 'MATHEMATICAL BOLD ITALIC CAPITAL Y', +119937: 'MATHEMATICAL BOLD ITALIC CAPITAL Z', +119938: 'MATHEMATICAL BOLD ITALIC SMALL A', +119939: 'MATHEMATICAL BOLD ITALIC SMALL B', +119940: 'MATHEMATICAL BOLD ITALIC SMALL C', +119941: 'MATHEMATICAL BOLD ITALIC SMALL D', +119942: 'MATHEMATICAL BOLD ITALIC SMALL E', +119943: 'MATHEMATICAL BOLD ITALIC SMALL F', +119944: 'MATHEMATICAL BOLD ITALIC SMALL G', +119945: 'MATHEMATICAL BOLD ITALIC SMALL H', +119946: 'MATHEMATICAL BOLD ITALIC SMALL I', +119947: 'MATHEMATICAL BOLD ITALIC SMALL J', +119948: 'MATHEMATICAL BOLD ITALIC SMALL K', +119949: 'MATHEMATICAL BOLD ITALIC SMALL L', +119950: 'MATHEMATICAL BOLD ITALIC SMALL M', +119951: 'MATHEMATICAL BOLD ITALIC SMALL N', +119952: 'MATHEMATICAL BOLD ITALIC SMALL O', +119953: 'MATHEMATICAL BOLD ITALIC SMALL P', +119954: 'MATHEMATICAL BOLD ITALIC SMALL Q', +119955: 'MATHEMATICAL BOLD ITALIC SMALL R', +119956: 'MATHEMATICAL BOLD ITALIC SMALL S', +119957: 'MATHEMATICAL BOLD ITALIC SMALL T', +119958: 'MATHEMATICAL BOLD ITALIC SMALL U', +119959: 'MATHEMATICAL BOLD ITALIC SMALL V', +119960: 'MATHEMATICAL BOLD ITALIC SMALL W', +119961: 'MATHEMATICAL BOLD ITALIC SMALL X', +119962: 'MATHEMATICAL BOLD ITALIC SMALL Y', +119963: 'MATHEMATICAL BOLD ITALIC SMALL Z', +119964: 'MATHEMATICAL SCRIPT CAPITAL A', +119966: 'MATHEMATICAL SCRIPT CAPITAL C', +119967: 'MATHEMATICAL SCRIPT CAPITAL D', +119970: 'MATHEMATICAL SCRIPT CAPITAL G', +119973: 'MATHEMATICAL SCRIPT CAPITAL J', +119974: 'MATHEMATICAL SCRIPT CAPITAL K', +119977: 'MATHEMATICAL SCRIPT CAPITAL N', +119978: 'MATHEMATICAL SCRIPT CAPITAL O', +119979: 'MATHEMATICAL SCRIPT CAPITAL P', +119980: 'MATHEMATICAL SCRIPT CAPITAL Q', +119982: 'MATHEMATICAL SCRIPT CAPITAL S', +119983: 'MATHEMATICAL SCRIPT CAPITAL T', +119984: 'MATHEMATICAL SCRIPT CAPITAL U', +119985: 'MATHEMATICAL SCRIPT CAPITAL V', +119986: 'MATHEMATICAL SCRIPT CAPITAL W', +119987: 'MATHEMATICAL SCRIPT CAPITAL X', +119988: 'MATHEMATICAL SCRIPT CAPITAL Y', +119989: 'MATHEMATICAL SCRIPT CAPITAL Z', +119990: 'MATHEMATICAL SCRIPT SMALL A', +119991: 'MATHEMATICAL SCRIPT SMALL B', +119992: 'MATHEMATICAL SCRIPT SMALL C', +119993: 'MATHEMATICAL SCRIPT SMALL D', +119995: 'MATHEMATICAL SCRIPT SMALL F', +119997: 'MATHEMATICAL SCRIPT SMALL H', +119998: 'MATHEMATICAL SCRIPT SMALL I', +119999: 'MATHEMATICAL SCRIPT SMALL J', +120000: 'MATHEMATICAL SCRIPT SMALL K', +120002: 'MATHEMATICAL SCRIPT SMALL M', +120003: 'MATHEMATICAL SCRIPT SMALL N', +120005: 'MATHEMATICAL SCRIPT SMALL P', +120006: 'MATHEMATICAL SCRIPT SMALL Q', +120007: 'MATHEMATICAL SCRIPT SMALL R', +120008: 'MATHEMATICAL SCRIPT SMALL S', +120009: 'MATHEMATICAL SCRIPT SMALL T', +120010: 'MATHEMATICAL SCRIPT SMALL U', +120011: 'MATHEMATICAL SCRIPT SMALL V', +120012: 'MATHEMATICAL SCRIPT SMALL W', +120013: 'MATHEMATICAL SCRIPT SMALL X', +120014: 'MATHEMATICAL SCRIPT SMALL Y', +120015: 'MATHEMATICAL SCRIPT SMALL Z', +120016: 'MATHEMATICAL BOLD SCRIPT CAPITAL A', +120017: 'MATHEMATICAL BOLD SCRIPT CAPITAL B', +120018: 'MATHEMATICAL BOLD SCRIPT CAPITAL C', +120019: 'MATHEMATICAL BOLD SCRIPT CAPITAL D', +120020: 'MATHEMATICAL BOLD SCRIPT CAPITAL E', +120021: 'MATHEMATICAL BOLD SCRIPT CAPITAL F', +120022: 'MATHEMATICAL BOLD SCRIPT CAPITAL G', +120023: 'MATHEMATICAL BOLD SCRIPT CAPITAL H', +120024: 'MATHEMATICAL BOLD SCRIPT CAPITAL I', +120025: 'MATHEMATICAL BOLD SCRIPT CAPITAL J', +120026: 'MATHEMATICAL BOLD SCRIPT CAPITAL K', +120027: 'MATHEMATICAL BOLD SCRIPT CAPITAL L', +120028: 'MATHEMATICAL BOLD SCRIPT CAPITAL M', +120029: 'MATHEMATICAL BOLD SCRIPT CAPITAL N', +120030: 'MATHEMATICAL BOLD SCRIPT CAPITAL O', +120031: 'MATHEMATICAL BOLD SCRIPT CAPITAL P', +120032: 'MATHEMATICAL BOLD SCRIPT CAPITAL Q', +120033: 'MATHEMATICAL BOLD SCRIPT CAPITAL R', +120034: 'MATHEMATICAL BOLD SCRIPT CAPITAL S', +120035: 'MATHEMATICAL BOLD SCRIPT CAPITAL T', +120036: 'MATHEMATICAL BOLD SCRIPT CAPITAL U', +120037: 'MATHEMATICAL BOLD SCRIPT CAPITAL V', +120038: 'MATHEMATICAL BOLD SCRIPT CAPITAL W', +120039: 'MATHEMATICAL BOLD SCRIPT CAPITAL X', +120040: 'MATHEMATICAL BOLD SCRIPT CAPITAL Y', +120041: 'MATHEMATICAL BOLD SCRIPT CAPITAL Z', +120042: 'MATHEMATICAL BOLD SCRIPT SMALL A', +120043: 'MATHEMATICAL BOLD SCRIPT SMALL B', +120044: 'MATHEMATICAL BOLD SCRIPT SMALL C', +120045: 'MATHEMATICAL BOLD SCRIPT SMALL D', +120046: 'MATHEMATICAL BOLD SCRIPT SMALL E', +120047: 'MATHEMATICAL BOLD SCRIPT SMALL F', +120048: 'MATHEMATICAL BOLD SCRIPT SMALL G', +120049: 'MATHEMATICAL BOLD SCRIPT SMALL H', +120050: 'MATHEMATICAL BOLD SCRIPT SMALL I', +120051: 'MATHEMATICAL BOLD SCRIPT SMALL J', +120052: 'MATHEMATICAL BOLD SCRIPT SMALL K', +120053: 'MATHEMATICAL BOLD SCRIPT SMALL L', +120054: 'MATHEMATICAL BOLD SCRIPT SMALL M', +120055: 'MATHEMATICAL BOLD SCRIPT SMALL N', +120056: 'MATHEMATICAL BOLD SCRIPT SMALL O', +120057: 'MATHEMATICAL BOLD SCRIPT SMALL P', +120058: 'MATHEMATICAL BOLD SCRIPT SMALL Q', +120059: 'MATHEMATICAL BOLD SCRIPT SMALL R', +120060: 'MATHEMATICAL BOLD SCRIPT SMALL S', +120061: 'MATHEMATICAL BOLD SCRIPT SMALL T', +120062: 'MATHEMATICAL BOLD SCRIPT SMALL U', +120063: 'MATHEMATICAL BOLD SCRIPT SMALL V', +120064: 'MATHEMATICAL BOLD SCRIPT SMALL W', +120065: 'MATHEMATICAL BOLD SCRIPT SMALL X', +120066: 'MATHEMATICAL BOLD SCRIPT SMALL Y', +120067: 'MATHEMATICAL BOLD SCRIPT SMALL Z', +120068: 'MATHEMATICAL FRAKTUR CAPITAL A', +120069: 'MATHEMATICAL FRAKTUR CAPITAL B', +120071: 'MATHEMATICAL FRAKTUR CAPITAL D', +120072: 'MATHEMATICAL FRAKTUR CAPITAL E', +120073: 'MATHEMATICAL FRAKTUR CAPITAL F', +120074: 'MATHEMATICAL FRAKTUR CAPITAL G', +120077: 'MATHEMATICAL FRAKTUR CAPITAL J', +120078: 'MATHEMATICAL FRAKTUR CAPITAL K', +120079: 'MATHEMATICAL FRAKTUR CAPITAL L', +120080: 'MATHEMATICAL FRAKTUR CAPITAL M', +120081: 'MATHEMATICAL FRAKTUR CAPITAL N', +120082: 'MATHEMATICAL FRAKTUR CAPITAL O', +120083: 'MATHEMATICAL FRAKTUR CAPITAL P', +120084: 'MATHEMATICAL FRAKTUR CAPITAL Q', +120086: 'MATHEMATICAL FRAKTUR CAPITAL S', +120087: 'MATHEMATICAL FRAKTUR CAPITAL T', +120088: 'MATHEMATICAL FRAKTUR CAPITAL U', +120089: 'MATHEMATICAL FRAKTUR CAPITAL V', +120090: 'MATHEMATICAL FRAKTUR CAPITAL W', +120091: 'MATHEMATICAL FRAKTUR CAPITAL X', +120092: 'MATHEMATICAL FRAKTUR CAPITAL Y', +120094: 'MATHEMATICAL FRAKTUR SMALL A', +120095: 'MATHEMATICAL FRAKTUR SMALL B', +120096: 'MATHEMATICAL FRAKTUR SMALL C', +120097: 'MATHEMATICAL FRAKTUR SMALL D', +120098: 'MATHEMATICAL FRAKTUR SMALL E', +120099: 'MATHEMATICAL FRAKTUR SMALL F', +120100: 'MATHEMATICAL FRAKTUR SMALL G', +120101: 'MATHEMATICAL FRAKTUR SMALL H', +120102: 'MATHEMATICAL FRAKTUR SMALL I', +120103: 'MATHEMATICAL FRAKTUR SMALL J', +120104: 'MATHEMATICAL FRAKTUR SMALL K', +120105: 'MATHEMATICAL FRAKTUR SMALL L', +120106: 'MATHEMATICAL FRAKTUR SMALL M', +120107: 'MATHEMATICAL FRAKTUR SMALL N', +120108: 'MATHEMATICAL FRAKTUR SMALL O', +120109: 'MATHEMATICAL FRAKTUR SMALL P', +120110: 'MATHEMATICAL FRAKTUR SMALL Q', +120111: 'MATHEMATICAL FRAKTUR SMALL R', +120112: 'MATHEMATICAL FRAKTUR SMALL S', +120113: 'MATHEMATICAL FRAKTUR SMALL T', +120114: 'MATHEMATICAL FRAKTUR SMALL U', +120115: 'MATHEMATICAL FRAKTUR SMALL V', +120116: 'MATHEMATICAL FRAKTUR SMALL W', +120117: 'MATHEMATICAL FRAKTUR SMALL X', +120118: 'MATHEMATICAL FRAKTUR SMALL Y', +120119: 'MATHEMATICAL FRAKTUR SMALL Z', +120120: 'MATHEMATICAL DOUBLE-STRUCK CAPITAL A', +120121: 'MATHEMATICAL DOUBLE-STRUCK CAPITAL B', +120123: 'MATHEMATICAL DOUBLE-STRUCK CAPITAL D', +120124: 'MATHEMATICAL DOUBLE-STRUCK CAPITAL E', +120125: 'MATHEMATICAL DOUBLE-STRUCK CAPITAL F', +120126: 'MATHEMATICAL DOUBLE-STRUCK CAPITAL G', +120128: 'MATHEMATICAL DOUBLE-STRUCK CAPITAL I', +120129: 'MATHEMATICAL DOUBLE-STRUCK CAPITAL J', +120130: 'MATHEMATICAL DOUBLE-STRUCK CAPITAL K', +120131: 'MATHEMATICAL DOUBLE-STRUCK CAPITAL L', +120132: 'MATHEMATICAL DOUBLE-STRUCK CAPITAL M', +120134: 'MATHEMATICAL DOUBLE-STRUCK CAPITAL O', +120138: 'MATHEMATICAL DOUBLE-STRUCK CAPITAL S', +120139: 'MATHEMATICAL DOUBLE-STRUCK CAPITAL T', +120140: 'MATHEMATICAL DOUBLE-STRUCK CAPITAL U', +120141: 'MATHEMATICAL DOUBLE-STRUCK CAPITAL V', +120142: 'MATHEMATICAL DOUBLE-STRUCK CAPITAL W', +120143: 'MATHEMATICAL DOUBLE-STRUCK CAPITAL X', +120144: 'MATHEMATICAL DOUBLE-STRUCK CAPITAL Y', +120146: 'MATHEMATICAL DOUBLE-STRUCK SMALL A', +120147: 'MATHEMATICAL DOUBLE-STRUCK SMALL B', +120148: 'MATHEMATICAL DOUBLE-STRUCK SMALL C', +120149: 'MATHEMATICAL DOUBLE-STRUCK SMALL D', +120150: 'MATHEMATICAL DOUBLE-STRUCK SMALL E', +120151: 'MATHEMATICAL DOUBLE-STRUCK SMALL F', +120152: 'MATHEMATICAL DOUBLE-STRUCK SMALL G', +120153: 'MATHEMATICAL DOUBLE-STRUCK SMALL H', +120154: 'MATHEMATICAL DOUBLE-STRUCK SMALL I', +120155: 'MATHEMATICAL DOUBLE-STRUCK SMALL J', +120156: 'MATHEMATICAL DOUBLE-STRUCK SMALL K', +120157: 'MATHEMATICAL DOUBLE-STRUCK SMALL L', +120158: 'MATHEMATICAL DOUBLE-STRUCK SMALL M', +120159: 'MATHEMATICAL DOUBLE-STRUCK SMALL N', +120160: 'MATHEMATICAL DOUBLE-STRUCK SMALL O', +120161: 'MATHEMATICAL DOUBLE-STRUCK SMALL P', +120162: 'MATHEMATICAL DOUBLE-STRUCK SMALL Q', +120163: 'MATHEMATICAL DOUBLE-STRUCK SMALL R', +120164: 'MATHEMATICAL DOUBLE-STRUCK SMALL S', +120165: 'MATHEMATICAL DOUBLE-STRUCK SMALL T', +120166: 'MATHEMATICAL DOUBLE-STRUCK SMALL U', +120167: 'MATHEMATICAL DOUBLE-STRUCK SMALL V', +120168: 'MATHEMATICAL DOUBLE-STRUCK SMALL W', +120169: 'MATHEMATICAL DOUBLE-STRUCK SMALL X', +120170: 'MATHEMATICAL DOUBLE-STRUCK SMALL Y', +120171: 'MATHEMATICAL DOUBLE-STRUCK SMALL Z', +120172: 'MATHEMATICAL BOLD FRAKTUR CAPITAL A', +120173: 'MATHEMATICAL BOLD FRAKTUR CAPITAL B', +120174: 'MATHEMATICAL BOLD FRAKTUR CAPITAL C', +120175: 'MATHEMATICAL BOLD FRAKTUR CAPITAL D', +120176: 'MATHEMATICAL BOLD FRAKTUR CAPITAL E', +120177: 'MATHEMATICAL BOLD FRAKTUR CAPITAL F', +120178: 'MATHEMATICAL BOLD FRAKTUR CAPITAL G', +120179: 'MATHEMATICAL BOLD FRAKTUR CAPITAL H', +120180: 'MATHEMATICAL BOLD FRAKTUR CAPITAL I', +120181: 'MATHEMATICAL BOLD FRAKTUR CAPITAL J', +120182: 'MATHEMATICAL BOLD FRAKTUR CAPITAL K', +120183: 'MATHEMATICAL BOLD FRAKTUR CAPITAL L', +120184: 'MATHEMATICAL BOLD FRAKTUR CAPITAL M', +120185: 'MATHEMATICAL BOLD FRAKTUR CAPITAL N', +120186: 'MATHEMATICAL BOLD FRAKTUR CAPITAL O', +120187: 'MATHEMATICAL BOLD FRAKTUR CAPITAL P', +120188: 'MATHEMATICAL BOLD FRAKTUR CAPITAL Q', +120189: 'MATHEMATICAL BOLD FRAKTUR CAPITAL R', +120190: 'MATHEMATICAL BOLD FRAKTUR CAPITAL S', +120191: 'MATHEMATICAL BOLD FRAKTUR CAPITAL T', +120192: 'MATHEMATICAL BOLD FRAKTUR CAPITAL U', +120193: 'MATHEMATICAL BOLD FRAKTUR CAPITAL V', +120194: 'MATHEMATICAL BOLD FRAKTUR CAPITAL W', +120195: 'MATHEMATICAL BOLD FRAKTUR CAPITAL X', +120196: 'MATHEMATICAL BOLD FRAKTUR CAPITAL Y', +120197: 'MATHEMATICAL BOLD FRAKTUR CAPITAL Z', +120198: 'MATHEMATICAL BOLD FRAKTUR SMALL A', +120199: 'MATHEMATICAL BOLD FRAKTUR SMALL B', +120200: 'MATHEMATICAL BOLD FRAKTUR SMALL C', +120201: 'MATHEMATICAL BOLD FRAKTUR SMALL D', +120202: 'MATHEMATICAL BOLD FRAKTUR SMALL E', +120203: 'MATHEMATICAL BOLD FRAKTUR SMALL F', +120204: 'MATHEMATICAL BOLD FRAKTUR SMALL G', +120205: 'MATHEMATICAL BOLD FRAKTUR SMALL H', +120206: 'MATHEMATICAL BOLD FRAKTUR SMALL I', +120207: 'MATHEMATICAL BOLD FRAKTUR SMALL J', +120208: 'MATHEMATICAL BOLD FRAKTUR SMALL K', +120209: 'MATHEMATICAL BOLD FRAKTUR SMALL L', +120210: 'MATHEMATICAL BOLD FRAKTUR SMALL M', +120211: 'MATHEMATICAL BOLD FRAKTUR SMALL N', +120212: 'MATHEMATICAL BOLD FRAKTUR SMALL O', +120213: 'MATHEMATICAL BOLD FRAKTUR SMALL P', +120214: 'MATHEMATICAL BOLD FRAKTUR SMALL Q', +120215: 'MATHEMATICAL BOLD FRAKTUR SMALL R', +120216: 'MATHEMATICAL BOLD FRAKTUR SMALL S', +120217: 'MATHEMATICAL BOLD FRAKTUR SMALL T', +120218: 'MATHEMATICAL BOLD FRAKTUR SMALL U', +120219: 'MATHEMATICAL BOLD FRAKTUR SMALL V', +120220: 'MATHEMATICAL BOLD FRAKTUR SMALL W', +120221: 'MATHEMATICAL BOLD FRAKTUR SMALL X', +120222: 'MATHEMATICAL BOLD FRAKTUR SMALL Y', +120223: 'MATHEMATICAL BOLD FRAKTUR SMALL Z', +120224: 'MATHEMATICAL SANS-SERIF CAPITAL A', +120225: 'MATHEMATICAL SANS-SERIF CAPITAL B', +120226: 'MATHEMATICAL SANS-SERIF CAPITAL C', +120227: 'MATHEMATICAL SANS-SERIF CAPITAL D', +120228: 'MATHEMATICAL SANS-SERIF CAPITAL E', +120229: 'MATHEMATICAL SANS-SERIF CAPITAL F', +120230: 'MATHEMATICAL SANS-SERIF CAPITAL G', +120231: 'MATHEMATICAL SANS-SERIF CAPITAL H', +120232: 'MATHEMATICAL SANS-SERIF CAPITAL I', +120233: 'MATHEMATICAL SANS-SERIF CAPITAL J', +120234: 'MATHEMATICAL SANS-SERIF CAPITAL K', +120235: 'MATHEMATICAL SANS-SERIF CAPITAL L', +120236: 'MATHEMATICAL SANS-SERIF CAPITAL M', +120237: 'MATHEMATICAL SANS-SERIF CAPITAL N', +120238: 'MATHEMATICAL SANS-SERIF CAPITAL O', +120239: 'MATHEMATICAL SANS-SERIF CAPITAL P', +120240: 'MATHEMATICAL SANS-SERIF CAPITAL Q', +120241: 'MATHEMATICAL SANS-SERIF CAPITAL R', +120242: 'MATHEMATICAL SANS-SERIF CAPITAL S', +120243: 'MATHEMATICAL SANS-SERIF CAPITAL T', +120244: 'MATHEMATICAL SANS-SERIF CAPITAL U', +120245: 'MATHEMATICAL SANS-SERIF CAPITAL V', +120246: 'MATHEMATICAL SANS-SERIF CAPITAL W', +120247: 'MATHEMATICAL SANS-SERIF CAPITAL X', +120248: 'MATHEMATICAL SANS-SERIF CAPITAL Y', +120249: 'MATHEMATICAL SANS-SERIF CAPITAL Z', +120250: 'MATHEMATICAL SANS-SERIF SMALL A', +120251: 'MATHEMATICAL SANS-SERIF SMALL B', +120252: 'MATHEMATICAL SANS-SERIF SMALL C', +120253: 'MATHEMATICAL SANS-SERIF SMALL D', +120254: 'MATHEMATICAL SANS-SERIF SMALL E', +120255: 'MATHEMATICAL SANS-SERIF SMALL F', +120256: 'MATHEMATICAL SANS-SERIF SMALL G', +120257: 'MATHEMATICAL SANS-SERIF SMALL H', +120258: 'MATHEMATICAL SANS-SERIF SMALL I', +120259: 'MATHEMATICAL SANS-SERIF SMALL J', +120260: 'MATHEMATICAL SANS-SERIF SMALL K', +120261: 'MATHEMATICAL SANS-SERIF SMALL L', +120262: 'MATHEMATICAL SANS-SERIF SMALL M', +120263: 'MATHEMATICAL SANS-SERIF SMALL N', +120264: 'MATHEMATICAL SANS-SERIF SMALL O', +120265: 'MATHEMATICAL SANS-SERIF SMALL P', +120266: 'MATHEMATICAL SANS-SERIF SMALL Q', +120267: 'MATHEMATICAL SANS-SERIF SMALL R', +120268: 'MATHEMATICAL SANS-SERIF SMALL S', +120269: 'MATHEMATICAL SANS-SERIF SMALL T', +120270: 'MATHEMATICAL SANS-SERIF SMALL U', +120271: 'MATHEMATICAL SANS-SERIF SMALL V', +120272: 'MATHEMATICAL SANS-SERIF SMALL W', +120273: 'MATHEMATICAL SANS-SERIF SMALL X', +120274: 'MATHEMATICAL SANS-SERIF SMALL Y', +120275: 'MATHEMATICAL SANS-SERIF SMALL Z', +120276: 'MATHEMATICAL SANS-SERIF BOLD CAPITAL A', +120277: 'MATHEMATICAL SANS-SERIF BOLD CAPITAL B', +120278: 'MATHEMATICAL SANS-SERIF BOLD CAPITAL C', +120279: 'MATHEMATICAL SANS-SERIF BOLD CAPITAL D', +120280: 'MATHEMATICAL SANS-SERIF BOLD CAPITAL E', +120281: 'MATHEMATICAL SANS-SERIF BOLD CAPITAL F', +120282: 'MATHEMATICAL SANS-SERIF BOLD CAPITAL G', +120283: 'MATHEMATICAL SANS-SERIF BOLD CAPITAL H', +120284: 'MATHEMATICAL SANS-SERIF BOLD CAPITAL I', +120285: 'MATHEMATICAL SANS-SERIF BOLD CAPITAL J', +120286: 'MATHEMATICAL SANS-SERIF BOLD CAPITAL K', +120287: 'MATHEMATICAL SANS-SERIF BOLD CAPITAL L', +120288: 'MATHEMATICAL SANS-SERIF BOLD CAPITAL M', +120289: 'MATHEMATICAL SANS-SERIF BOLD CAPITAL N', +120290: 'MATHEMATICAL SANS-SERIF BOLD CAPITAL O', +120291: 'MATHEMATICAL SANS-SERIF BOLD CAPITAL P', +120292: 'MATHEMATICAL SANS-SERIF BOLD CAPITAL Q', +120293: 'MATHEMATICAL SANS-SERIF BOLD CAPITAL R', +120294: 'MATHEMATICAL SANS-SERIF BOLD CAPITAL S', +120295: 'MATHEMATICAL SANS-SERIF BOLD CAPITAL T', +120296: 'MATHEMATICAL SANS-SERIF BOLD CAPITAL U', +120297: 'MATHEMATICAL SANS-SERIF BOLD CAPITAL V', +120298: 'MATHEMATICAL SANS-SERIF BOLD CAPITAL W', +120299: 'MATHEMATICAL SANS-SERIF BOLD CAPITAL X', +120300: 'MATHEMATICAL SANS-SERIF BOLD CAPITAL Y', +120301: 'MATHEMATICAL SANS-SERIF BOLD CAPITAL Z', +120302: 'MATHEMATICAL SANS-SERIF BOLD SMALL A', +120303: 'MATHEMATICAL SANS-SERIF BOLD SMALL B', +120304: 'MATHEMATICAL SANS-SERIF BOLD SMALL C', +120305: 'MATHEMATICAL SANS-SERIF BOLD SMALL D', +120306: 'MATHEMATICAL SANS-SERIF BOLD SMALL E', +120307: 'MATHEMATICAL SANS-SERIF BOLD SMALL F', +120308: 'MATHEMATICAL SANS-SERIF BOLD SMALL G', +120309: 'MATHEMATICAL SANS-SERIF BOLD SMALL H', +120310: 'MATHEMATICAL SANS-SERIF BOLD SMALL I', +120311: 'MATHEMATICAL SANS-SERIF BOLD SMALL J', +120312: 'MATHEMATICAL SANS-SERIF BOLD SMALL K', +120313: 'MATHEMATICAL SANS-SERIF BOLD SMALL L', +120314: 'MATHEMATICAL SANS-SERIF BOLD SMALL M', +120315: 'MATHEMATICAL SANS-SERIF BOLD SMALL N', +120316: 'MATHEMATICAL SANS-SERIF BOLD SMALL O', +120317: 'MATHEMATICAL SANS-SERIF BOLD SMALL P', +120318: 'MATHEMATICAL SANS-SERIF BOLD SMALL Q', +120319: 'MATHEMATICAL SANS-SERIF BOLD SMALL R', +120320: 'MATHEMATICAL SANS-SERIF BOLD SMALL S', +120321: 'MATHEMATICAL SANS-SERIF BOLD SMALL T', +120322: 'MATHEMATICAL SANS-SERIF BOLD SMALL U', +120323: 'MATHEMATICAL SANS-SERIF BOLD SMALL V', +120324: 'MATHEMATICAL SANS-SERIF BOLD SMALL W', +120325: 'MATHEMATICAL SANS-SERIF BOLD SMALL X', +120326: 'MATHEMATICAL SANS-SERIF BOLD SMALL Y', +120327: 'MATHEMATICAL SANS-SERIF BOLD SMALL Z', +120328: 'MATHEMATICAL SANS-SERIF ITALIC CAPITAL A', +120329: 'MATHEMATICAL SANS-SERIF ITALIC CAPITAL B', +120330: 'MATHEMATICAL SANS-SERIF ITALIC CAPITAL C', +120331: 'MATHEMATICAL SANS-SERIF ITALIC CAPITAL D', +120332: 'MATHEMATICAL SANS-SERIF ITALIC CAPITAL E', +120333: 'MATHEMATICAL SANS-SERIF ITALIC CAPITAL F', +120334: 'MATHEMATICAL SANS-SERIF ITALIC CAPITAL G', +120335: 'MATHEMATICAL SANS-SERIF ITALIC CAPITAL H', +120336: 'MATHEMATICAL SANS-SERIF ITALIC CAPITAL I', +120337: 'MATHEMATICAL SANS-SERIF ITALIC CAPITAL J', +120338: 'MATHEMATICAL SANS-SERIF ITALIC CAPITAL K', +120339: 'MATHEMATICAL SANS-SERIF ITALIC CAPITAL L', +120340: 'MATHEMATICAL SANS-SERIF ITALIC CAPITAL M', +120341: 'MATHEMATICAL SANS-SERIF ITALIC CAPITAL N', +120342: 'MATHEMATICAL SANS-SERIF ITALIC CAPITAL O', +120343: 'MATHEMATICAL SANS-SERIF ITALIC CAPITAL P', +120344: 'MATHEMATICAL SANS-SERIF ITALIC CAPITAL Q', +120345: 'MATHEMATICAL SANS-SERIF ITALIC CAPITAL R', +120346: 'MATHEMATICAL SANS-SERIF ITALIC CAPITAL S', +120347: 'MATHEMATICAL SANS-SERIF ITALIC CAPITAL T', +120348: 'MATHEMATICAL SANS-SERIF ITALIC CAPITAL U', +120349: 'MATHEMATICAL SANS-SERIF ITALIC CAPITAL V', +120350: 'MATHEMATICAL SANS-SERIF ITALIC CAPITAL W', +120351: 'MATHEMATICAL SANS-SERIF ITALIC CAPITAL X', +120352: 'MATHEMATICAL SANS-SERIF ITALIC CAPITAL Y', +120353: 'MATHEMATICAL SANS-SERIF ITALIC CAPITAL Z', +120354: 'MATHEMATICAL SANS-SERIF ITALIC SMALL A', +120355: 'MATHEMATICAL SANS-SERIF ITALIC SMALL B', +120356: 'MATHEMATICAL SANS-SERIF ITALIC SMALL C', +120357: 'MATHEMATICAL SANS-SERIF ITALIC SMALL D', +120358: 'MATHEMATICAL SANS-SERIF ITALIC SMALL E', +120359: 'MATHEMATICAL SANS-SERIF ITALIC SMALL F', +120360: 'MATHEMATICAL SANS-SERIF ITALIC SMALL G', +120361: 'MATHEMATICAL SANS-SERIF ITALIC SMALL H', +120362: 'MATHEMATICAL SANS-SERIF ITALIC SMALL I', +120363: 'MATHEMATICAL SANS-SERIF ITALIC SMALL J', +120364: 'MATHEMATICAL SANS-SERIF ITALIC SMALL K', +120365: 'MATHEMATICAL SANS-SERIF ITALIC SMALL L', +120366: 'MATHEMATICAL SANS-SERIF ITALIC SMALL M', +120367: 'MATHEMATICAL SANS-SERIF ITALIC SMALL N', +120368: 'MATHEMATICAL SANS-SERIF ITALIC SMALL O', +120369: 'MATHEMATICAL SANS-SERIF ITALIC SMALL P', +120370: 'MATHEMATICAL SANS-SERIF ITALIC SMALL Q', +120371: 'MATHEMATICAL SANS-SERIF ITALIC SMALL R', +120372: 'MATHEMATICAL SANS-SERIF ITALIC SMALL S', +120373: 'MATHEMATICAL SANS-SERIF ITALIC SMALL T', +120374: 'MATHEMATICAL SANS-SERIF ITALIC SMALL U', +120375: 'MATHEMATICAL SANS-SERIF ITALIC SMALL V', +120376: 'MATHEMATICAL SANS-SERIF ITALIC SMALL W', +120377: 'MATHEMATICAL SANS-SERIF ITALIC SMALL X', +120378: 'MATHEMATICAL SANS-SERIF ITALIC SMALL Y', +120379: 'MATHEMATICAL SANS-SERIF ITALIC SMALL Z', +120380: 'MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL A', +120381: 'MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL B', +120382: 'MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL C', +120383: 'MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL D', +120384: 'MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL E', +120385: 'MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL F', +120386: 'MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL G', +120387: 'MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL H', +120388: 'MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL I', +120389: 'MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL J', +120390: 'MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL K', +120391: 'MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL L', +120392: 'MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL M', +120393: 'MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL N', +120394: 'MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL O', +120395: 'MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL P', +120396: 'MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL Q', +120397: 'MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL R', +120398: 'MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL S', +120399: 'MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL T', +120400: 'MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL U', +120401: 'MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL V', +120402: 'MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL W', +120403: 'MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL X', +120404: 'MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL Y', +120405: 'MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL Z', +120406: 'MATHEMATICAL SANS-SERIF BOLD ITALIC SMALL A', +120407: 'MATHEMATICAL SANS-SERIF BOLD ITALIC SMALL B', +120408: 'MATHEMATICAL SANS-SERIF BOLD ITALIC SMALL C', +120409: 'MATHEMATICAL SANS-SERIF BOLD ITALIC SMALL D', +120410: 'MATHEMATICAL SANS-SERIF BOLD ITALIC SMALL E', +120411: 'MATHEMATICAL SANS-SERIF BOLD ITALIC SMALL F', +120412: 'MATHEMATICAL SANS-SERIF BOLD ITALIC SMALL G', +120413: 'MATHEMATICAL SANS-SERIF BOLD ITALIC SMALL H', +120414: 'MATHEMATICAL SANS-SERIF BOLD ITALIC SMALL I', +120415: 'MATHEMATICAL SANS-SERIF BOLD ITALIC SMALL J', +120416: 'MATHEMATICAL SANS-SERIF BOLD ITALIC SMALL K', +120417: 'MATHEMATICAL SANS-SERIF BOLD ITALIC SMALL L', +120418: 'MATHEMATICAL SANS-SERIF BOLD ITALIC SMALL M', +120419: 'MATHEMATICAL SANS-SERIF BOLD ITALIC SMALL N', +120420: 'MATHEMATICAL SANS-SERIF BOLD ITALIC SMALL O', +120421: 'MATHEMATICAL SANS-SERIF BOLD ITALIC SMALL P', +120422: 'MATHEMATICAL SANS-SERIF BOLD ITALIC SMALL Q', +120423: 'MATHEMATICAL SANS-SERIF BOLD ITALIC SMALL R', +120424: 'MATHEMATICAL SANS-SERIF BOLD ITALIC SMALL S', +120425: 'MATHEMATICAL SANS-SERIF BOLD ITALIC SMALL T', +120426: 'MATHEMATICAL SANS-SERIF BOLD ITALIC SMALL U', +120427: 'MATHEMATICAL SANS-SERIF BOLD ITALIC SMALL V', +120428: 'MATHEMATICAL SANS-SERIF BOLD ITALIC SMALL W', +120429: 'MATHEMATICAL SANS-SERIF BOLD ITALIC SMALL X', +120430: 'MATHEMATICAL SANS-SERIF BOLD ITALIC SMALL Y', +120431: 'MATHEMATICAL SANS-SERIF BOLD ITALIC SMALL Z', +120432: 'MATHEMATICAL MONOSPACE CAPITAL A', +120433: 'MATHEMATICAL MONOSPACE CAPITAL B', +120434: 'MATHEMATICAL MONOSPACE CAPITAL C', +120435: 'MATHEMATICAL MONOSPACE CAPITAL D', +120436: 'MATHEMATICAL MONOSPACE CAPITAL E', +120437: 'MATHEMATICAL MONOSPACE CAPITAL F', +120438: 'MATHEMATICAL MONOSPACE CAPITAL G', +120439: 'MATHEMATICAL MONOSPACE CAPITAL H', +120440: 'MATHEMATICAL MONOSPACE CAPITAL I', +120441: 'MATHEMATICAL MONOSPACE CAPITAL J', +120442: 'MATHEMATICAL MONOSPACE CAPITAL K', +120443: 'MATHEMATICAL MONOSPACE CAPITAL L', +120444: 'MATHEMATICAL MONOSPACE CAPITAL M', +120445: 'MATHEMATICAL MONOSPACE CAPITAL N', +120446: 'MATHEMATICAL MONOSPACE CAPITAL O', +120447: 'MATHEMATICAL MONOSPACE CAPITAL P', +120448: 'MATHEMATICAL MONOSPACE CAPITAL Q', +120449: 'MATHEMATICAL MONOSPACE CAPITAL R', +120450: 'MATHEMATICAL MONOSPACE CAPITAL S', +120451: 'MATHEMATICAL MONOSPACE CAPITAL T', +120452: 'MATHEMATICAL MONOSPACE CAPITAL U', +120453: 'MATHEMATICAL MONOSPACE CAPITAL V', +120454: 'MATHEMATICAL MONOSPACE CAPITAL W', +120455: 'MATHEMATICAL MONOSPACE CAPITAL X', +120456: 'MATHEMATICAL MONOSPACE CAPITAL Y', +120457: 'MATHEMATICAL MONOSPACE CAPITAL Z', +120458: 'MATHEMATICAL MONOSPACE SMALL A', +120459: 'MATHEMATICAL MONOSPACE SMALL B', +120460: 'MATHEMATICAL MONOSPACE SMALL C', +120461: 'MATHEMATICAL MONOSPACE SMALL D', +120462: 'MATHEMATICAL MONOSPACE SMALL E', +120463: 'MATHEMATICAL MONOSPACE SMALL F', +120464: 'MATHEMATICAL MONOSPACE SMALL G', +120465: 'MATHEMATICAL MONOSPACE SMALL H', +120466: 'MATHEMATICAL MONOSPACE SMALL I', +120467: 'MATHEMATICAL MONOSPACE SMALL J', +120468: 'MATHEMATICAL MONOSPACE SMALL K', +120469: 'MATHEMATICAL MONOSPACE SMALL L', +120470: 'MATHEMATICAL MONOSPACE SMALL M', +120471: 'MATHEMATICAL MONOSPACE SMALL N', +120472: 'MATHEMATICAL MONOSPACE SMALL O', +120473: 'MATHEMATICAL MONOSPACE SMALL P', +120474: 'MATHEMATICAL MONOSPACE SMALL Q', +120475: 'MATHEMATICAL MONOSPACE SMALL R', +120476: 'MATHEMATICAL MONOSPACE SMALL S', +120477: 'MATHEMATICAL MONOSPACE SMALL T', +120478: 'MATHEMATICAL MONOSPACE SMALL U', +120479: 'MATHEMATICAL MONOSPACE SMALL V', +120480: 'MATHEMATICAL MONOSPACE SMALL W', +120481: 'MATHEMATICAL MONOSPACE SMALL X', +120482: 'MATHEMATICAL MONOSPACE SMALL Y', +120483: 'MATHEMATICAL MONOSPACE SMALL Z', +120488: 'MATHEMATICAL BOLD CAPITAL ALPHA', +120489: 'MATHEMATICAL BOLD CAPITAL BETA', +120490: 'MATHEMATICAL BOLD CAPITAL GAMMA', +120491: 'MATHEMATICAL BOLD CAPITAL DELTA', +120492: 'MATHEMATICAL BOLD CAPITAL EPSILON', +120493: 'MATHEMATICAL BOLD CAPITAL ZETA', +120494: 'MATHEMATICAL BOLD CAPITAL ETA', +120495: 'MATHEMATICAL BOLD CAPITAL THETA', +120496: 'MATHEMATICAL BOLD CAPITAL IOTA', +120497: 'MATHEMATICAL BOLD CAPITAL KAPPA', +120498: 'MATHEMATICAL BOLD CAPITAL LAMDA', +120499: 'MATHEMATICAL BOLD CAPITAL MU', +120500: 'MATHEMATICAL BOLD CAPITAL NU', +120501: 'MATHEMATICAL BOLD CAPITAL XI', +120502: 'MATHEMATICAL BOLD CAPITAL OMICRON', +120503: 'MATHEMATICAL BOLD CAPITAL PI', +120504: 'MATHEMATICAL BOLD CAPITAL RHO', +120505: 'MATHEMATICAL BOLD CAPITAL THETA SYMBOL', +120506: 'MATHEMATICAL BOLD CAPITAL SIGMA', +120507: 'MATHEMATICAL BOLD CAPITAL TAU', +120508: 'MATHEMATICAL BOLD CAPITAL UPSILON', +120509: 'MATHEMATICAL BOLD CAPITAL PHI', +120510: 'MATHEMATICAL BOLD CAPITAL CHI', +120511: 'MATHEMATICAL BOLD CAPITAL PSI', +120512: 'MATHEMATICAL BOLD CAPITAL OMEGA', +120513: 'MATHEMATICAL BOLD NABLA', +120514: 'MATHEMATICAL BOLD SMALL ALPHA', +120515: 'MATHEMATICAL BOLD SMALL BETA', +120516: 'MATHEMATICAL BOLD SMALL GAMMA', +120517: 'MATHEMATICAL BOLD SMALL DELTA', +120518: 'MATHEMATICAL BOLD SMALL EPSILON', +120519: 'MATHEMATICAL BOLD SMALL ZETA', +120520: 'MATHEMATICAL BOLD SMALL ETA', +120521: 'MATHEMATICAL BOLD SMALL THETA', +120522: 'MATHEMATICAL BOLD SMALL IOTA', +120523: 'MATHEMATICAL BOLD SMALL KAPPA', +120524: 'MATHEMATICAL BOLD SMALL LAMDA', +120525: 'MATHEMATICAL BOLD SMALL MU', +120526: 'MATHEMATICAL BOLD SMALL NU', +120527: 'MATHEMATICAL BOLD SMALL XI', +120528: 'MATHEMATICAL BOLD SMALL OMICRON', +120529: 'MATHEMATICAL BOLD SMALL PI', +120530: 'MATHEMATICAL BOLD SMALL RHO', +120531: 'MATHEMATICAL BOLD SMALL FINAL SIGMA', +120532: 'MATHEMATICAL BOLD SMALL SIGMA', +120533: 'MATHEMATICAL BOLD SMALL TAU', +120534: 'MATHEMATICAL BOLD SMALL UPSILON', +120535: 'MATHEMATICAL BOLD SMALL PHI', +120536: 'MATHEMATICAL BOLD SMALL CHI', +120537: 'MATHEMATICAL BOLD SMALL PSI', +120538: 'MATHEMATICAL BOLD SMALL OMEGA', +120539: 'MATHEMATICAL BOLD PARTIAL DIFFERENTIAL', +120540: 'MATHEMATICAL BOLD EPSILON SYMBOL', +120541: 'MATHEMATICAL BOLD THETA SYMBOL', +120542: 'MATHEMATICAL BOLD KAPPA SYMBOL', +120543: 'MATHEMATICAL BOLD PHI SYMBOL', +120544: 'MATHEMATICAL BOLD RHO SYMBOL', +120545: 'MATHEMATICAL BOLD PI SYMBOL', +120546: 'MATHEMATICAL ITALIC CAPITAL ALPHA', +120547: 'MATHEMATICAL ITALIC CAPITAL BETA', +120548: 'MATHEMATICAL ITALIC CAPITAL GAMMA', +120549: 'MATHEMATICAL ITALIC CAPITAL DELTA', +120550: 'MATHEMATICAL ITALIC CAPITAL EPSILON', +120551: 'MATHEMATICAL ITALIC CAPITAL ZETA', +120552: 'MATHEMATICAL ITALIC CAPITAL ETA', +120553: 'MATHEMATICAL ITALIC CAPITAL THETA', +120554: 'MATHEMATICAL ITALIC CAPITAL IOTA', +120555: 'MATHEMATICAL ITALIC CAPITAL KAPPA', +120556: 'MATHEMATICAL ITALIC CAPITAL LAMDA', +120557: 'MATHEMATICAL ITALIC CAPITAL MU', +120558: 'MATHEMATICAL ITALIC CAPITAL NU', +120559: 'MATHEMATICAL ITALIC CAPITAL XI', +120560: 'MATHEMATICAL ITALIC CAPITAL OMICRON', +120561: 'MATHEMATICAL ITALIC CAPITAL PI', +120562: 'MATHEMATICAL ITALIC CAPITAL RHO', +120563: 'MATHEMATICAL ITALIC CAPITAL THETA SYMBOL', +120564: 'MATHEMATICAL ITALIC CAPITAL SIGMA', +120565: 'MATHEMATICAL ITALIC CAPITAL TAU', +120566: 'MATHEMATICAL ITALIC CAPITAL UPSILON', +120567: 'MATHEMATICAL ITALIC CAPITAL PHI', +120568: 'MATHEMATICAL ITALIC CAPITAL CHI', +120569: 'MATHEMATICAL ITALIC CAPITAL PSI', +120570: 'MATHEMATICAL ITALIC CAPITAL OMEGA', +120571: 'MATHEMATICAL ITALIC NABLA', +120572: 'MATHEMATICAL ITALIC SMALL ALPHA', +120573: 'MATHEMATICAL ITALIC SMALL BETA', +120574: 'MATHEMATICAL ITALIC SMALL GAMMA', +120575: 'MATHEMATICAL ITALIC SMALL DELTA', +120576: 'MATHEMATICAL ITALIC SMALL EPSILON', +120577: 'MATHEMATICAL ITALIC SMALL ZETA', +120578: 'MATHEMATICAL ITALIC SMALL ETA', +120579: 'MATHEMATICAL ITALIC SMALL THETA', +120580: 'MATHEMATICAL ITALIC SMALL IOTA', +120581: 'MATHEMATICAL ITALIC SMALL KAPPA', +120582: 'MATHEMATICAL ITALIC SMALL LAMDA', +120583: 'MATHEMATICAL ITALIC SMALL MU', +120584: 'MATHEMATICAL ITALIC SMALL NU', +120585: 'MATHEMATICAL ITALIC SMALL XI', +120586: 'MATHEMATICAL ITALIC SMALL OMICRON', +120587: 'MATHEMATICAL ITALIC SMALL PI', +120588: 'MATHEMATICAL ITALIC SMALL RHO', +120589: 'MATHEMATICAL ITALIC SMALL FINAL SIGMA', +120590: 'MATHEMATICAL ITALIC SMALL SIGMA', +120591: 'MATHEMATICAL ITALIC SMALL TAU', +120592: 'MATHEMATICAL ITALIC SMALL UPSILON', +120593: 'MATHEMATICAL ITALIC SMALL PHI', +120594: 'MATHEMATICAL ITALIC SMALL CHI', +120595: 'MATHEMATICAL ITALIC SMALL PSI', +120596: 'MATHEMATICAL ITALIC SMALL OMEGA', +120597: 'MATHEMATICAL ITALIC PARTIAL DIFFERENTIAL', +120598: 'MATHEMATICAL ITALIC EPSILON SYMBOL', +120599: 'MATHEMATICAL ITALIC THETA SYMBOL', +120600: 'MATHEMATICAL ITALIC KAPPA SYMBOL', +120601: 'MATHEMATICAL ITALIC PHI SYMBOL', +120602: 'MATHEMATICAL ITALIC RHO SYMBOL', +120603: 'MATHEMATICAL ITALIC PI SYMBOL', +120604: 'MATHEMATICAL BOLD ITALIC CAPITAL ALPHA', +120605: 'MATHEMATICAL BOLD ITALIC CAPITAL BETA', +120606: 'MATHEMATICAL BOLD ITALIC CAPITAL GAMMA', +120607: 'MATHEMATICAL BOLD ITALIC CAPITAL DELTA', +120608: 'MATHEMATICAL BOLD ITALIC CAPITAL EPSILON', +120609: 'MATHEMATICAL BOLD ITALIC CAPITAL ZETA', +120610: 'MATHEMATICAL BOLD ITALIC CAPITAL ETA', +120611: 'MATHEMATICAL BOLD ITALIC CAPITAL THETA', +120612: 'MATHEMATICAL BOLD ITALIC CAPITAL IOTA', +120613: 'MATHEMATICAL BOLD ITALIC CAPITAL KAPPA', +120614: 'MATHEMATICAL BOLD ITALIC CAPITAL LAMDA', +120615: 'MATHEMATICAL BOLD ITALIC CAPITAL MU', +120616: 'MATHEMATICAL BOLD ITALIC CAPITAL NU', +120617: 'MATHEMATICAL BOLD ITALIC CAPITAL XI', +120618: 'MATHEMATICAL BOLD ITALIC CAPITAL OMICRON', +120619: 'MATHEMATICAL BOLD ITALIC CAPITAL PI', +120620: 'MATHEMATICAL BOLD ITALIC CAPITAL RHO', +120621: 'MATHEMATICAL BOLD ITALIC CAPITAL THETA SYMBOL', +120622: 'MATHEMATICAL BOLD ITALIC CAPITAL SIGMA', +120623: 'MATHEMATICAL BOLD ITALIC CAPITAL TAU', +120624: 'MATHEMATICAL BOLD ITALIC CAPITAL UPSILON', +120625: 'MATHEMATICAL BOLD ITALIC CAPITAL PHI', +120626: 'MATHEMATICAL BOLD ITALIC CAPITAL CHI', +120627: 'MATHEMATICAL BOLD ITALIC CAPITAL PSI', +120628: 'MATHEMATICAL BOLD ITALIC CAPITAL OMEGA', +120629: 'MATHEMATICAL BOLD ITALIC NABLA', +120630: 'MATHEMATICAL BOLD ITALIC SMALL ALPHA', +120631: 'MATHEMATICAL BOLD ITALIC SMALL BETA', +120632: 'MATHEMATICAL BOLD ITALIC SMALL GAMMA', +120633: 'MATHEMATICAL BOLD ITALIC SMALL DELTA', +120634: 'MATHEMATICAL BOLD ITALIC SMALL EPSILON', +120635: 'MATHEMATICAL BOLD ITALIC SMALL ZETA', +120636: 'MATHEMATICAL BOLD ITALIC SMALL ETA', +120637: 'MATHEMATICAL BOLD ITALIC SMALL THETA', +120638: 'MATHEMATICAL BOLD ITALIC SMALL IOTA', +120639: 'MATHEMATICAL BOLD ITALIC SMALL KAPPA', +120640: 'MATHEMATICAL BOLD ITALIC SMALL LAMDA', +120641: 'MATHEMATICAL BOLD ITALIC SMALL MU', +120642: 'MATHEMATICAL BOLD ITALIC SMALL NU', +120643: 'MATHEMATICAL BOLD ITALIC SMALL XI', +120644: 'MATHEMATICAL BOLD ITALIC SMALL OMICRON', +120645: 'MATHEMATICAL BOLD ITALIC SMALL PI', +120646: 'MATHEMATICAL BOLD ITALIC SMALL RHO', +120647: 'MATHEMATICAL BOLD ITALIC SMALL FINAL SIGMA', +120648: 'MATHEMATICAL BOLD ITALIC SMALL SIGMA', +120649: 'MATHEMATICAL BOLD ITALIC SMALL TAU', +120650: 'MATHEMATICAL BOLD ITALIC SMALL UPSILON', +120651: 'MATHEMATICAL BOLD ITALIC SMALL PHI', +120652: 'MATHEMATICAL BOLD ITALIC SMALL CHI', +120653: 'MATHEMATICAL BOLD ITALIC SMALL PSI', +120654: 'MATHEMATICAL BOLD ITALIC SMALL OMEGA', +120655: 'MATHEMATICAL BOLD ITALIC PARTIAL DIFFERENTIAL', +120656: 'MATHEMATICAL BOLD ITALIC EPSILON SYMBOL', +120657: 'MATHEMATICAL BOLD ITALIC THETA SYMBOL', +120658: 'MATHEMATICAL BOLD ITALIC KAPPA SYMBOL', +120659: 'MATHEMATICAL BOLD ITALIC PHI SYMBOL', +120660: 'MATHEMATICAL BOLD ITALIC RHO SYMBOL', +120661: 'MATHEMATICAL BOLD ITALIC PI SYMBOL', +120662: 'MATHEMATICAL SANS-SERIF BOLD CAPITAL ALPHA', +120663: 'MATHEMATICAL SANS-SERIF BOLD CAPITAL BETA', +120664: 'MATHEMATICAL SANS-SERIF BOLD CAPITAL GAMMA', +120665: 'MATHEMATICAL SANS-SERIF BOLD CAPITAL DELTA', +120666: 'MATHEMATICAL SANS-SERIF BOLD CAPITAL EPSILON', +120667: 'MATHEMATICAL SANS-SERIF BOLD CAPITAL ZETA', +120668: 'MATHEMATICAL SANS-SERIF BOLD CAPITAL ETA', +120669: 'MATHEMATICAL SANS-SERIF BOLD CAPITAL THETA', +120670: 'MATHEMATICAL SANS-SERIF BOLD CAPITAL IOTA', +120671: 'MATHEMATICAL SANS-SERIF BOLD CAPITAL KAPPA', +120672: 'MATHEMATICAL SANS-SERIF BOLD CAPITAL LAMDA', +120673: 'MATHEMATICAL SANS-SERIF BOLD CAPITAL MU', +120674: 'MATHEMATICAL SANS-SERIF BOLD CAPITAL NU', +120675: 'MATHEMATICAL SANS-SERIF BOLD CAPITAL XI', +120676: 'MATHEMATICAL SANS-SERIF BOLD CAPITAL OMICRON', +120677: 'MATHEMATICAL SANS-SERIF BOLD CAPITAL PI', +120678: 'MATHEMATICAL SANS-SERIF BOLD CAPITAL RHO', +120679: 'MATHEMATICAL SANS-SERIF BOLD CAPITAL THETA SYMBOL', +120680: 'MATHEMATICAL SANS-SERIF BOLD CAPITAL SIGMA', +120681: 'MATHEMATICAL SANS-SERIF BOLD CAPITAL TAU', +120682: 'MATHEMATICAL SANS-SERIF BOLD CAPITAL UPSILON', +120683: 'MATHEMATICAL SANS-SERIF BOLD CAPITAL PHI', +120684: 'MATHEMATICAL SANS-SERIF BOLD CAPITAL CHI', +120685: 'MATHEMATICAL SANS-SERIF BOLD CAPITAL PSI', +120686: 'MATHEMATICAL SANS-SERIF BOLD CAPITAL OMEGA', +120687: 'MATHEMATICAL SANS-SERIF BOLD NABLA', +120688: 'MATHEMATICAL SANS-SERIF BOLD SMALL ALPHA', +120689: 'MATHEMATICAL SANS-SERIF BOLD SMALL BETA', +120690: 'MATHEMATICAL SANS-SERIF BOLD SMALL GAMMA', +120691: 'MATHEMATICAL SANS-SERIF BOLD SMALL DELTA', +120692: 'MATHEMATICAL SANS-SERIF BOLD SMALL EPSILON', +120693: 'MATHEMATICAL SANS-SERIF BOLD SMALL ZETA', +120694: 'MATHEMATICAL SANS-SERIF BOLD SMALL ETA', +120695: 'MATHEMATICAL SANS-SERIF BOLD SMALL THETA', +120696: 'MATHEMATICAL SANS-SERIF BOLD SMALL IOTA', +120697: 'MATHEMATICAL SANS-SERIF BOLD SMALL KAPPA', +120698: 'MATHEMATICAL SANS-SERIF BOLD SMALL LAMDA', +120699: 'MATHEMATICAL SANS-SERIF BOLD SMALL MU', +120700: 'MATHEMATICAL SANS-SERIF BOLD SMALL NU', +120701: 'MATHEMATICAL SANS-SERIF BOLD SMALL XI', +120702: 'MATHEMATICAL SANS-SERIF BOLD SMALL OMICRON', +120703: 'MATHEMATICAL SANS-SERIF BOLD SMALL PI', +120704: 'MATHEMATICAL SANS-SERIF BOLD SMALL RHO', +120705: 'MATHEMATICAL SANS-SERIF BOLD SMALL FINAL SIGMA', +120706: 'MATHEMATICAL SANS-SERIF BOLD SMALL SIGMA', +120707: 'MATHEMATICAL SANS-SERIF BOLD SMALL TAU', +120708: 'MATHEMATICAL SANS-SERIF BOLD SMALL UPSILON', +120709: 'MATHEMATICAL SANS-SERIF BOLD SMALL PHI', +120710: 'MATHEMATICAL SANS-SERIF BOLD SMALL CHI', +120711: 'MATHEMATICAL SANS-SERIF BOLD SMALL PSI', +120712: 'MATHEMATICAL SANS-SERIF BOLD SMALL OMEGA', +120713: 'MATHEMATICAL SANS-SERIF BOLD PARTIAL DIFFERENTIAL', +120714: 'MATHEMATICAL SANS-SERIF BOLD EPSILON SYMBOL', +120715: 'MATHEMATICAL SANS-SERIF BOLD THETA SYMBOL', +120716: 'MATHEMATICAL SANS-SERIF BOLD KAPPA SYMBOL', +120717: 'MATHEMATICAL SANS-SERIF BOLD PHI SYMBOL', +120718: 'MATHEMATICAL SANS-SERIF BOLD RHO SYMBOL', +120719: 'MATHEMATICAL SANS-SERIF BOLD PI SYMBOL', +120720: 'MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL ALPHA', +120721: 'MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL BETA', +120722: 'MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL GAMMA', +120723: 'MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL DELTA', +120724: 'MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL EPSILON', +120725: 'MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL ZETA', +120726: 'MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL ETA', +120727: 'MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL THETA', +120728: 'MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL IOTA', +120729: 'MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL KAPPA', +120730: 'MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL LAMDA', +120731: 'MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL MU', +120732: 'MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL NU', +120733: 'MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL XI', +120734: 'MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL OMICRON', +120735: 'MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL PI', +120736: 'MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL RHO', +120737: 'MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL THETA SYMBOL', +120738: 'MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL SIGMA', +120739: 'MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL TAU', +120740: 'MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL UPSILON', +120741: 'MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL PHI', +120742: 'MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL CHI', +120743: 'MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL PSI', +120744: 'MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL OMEGA', +120745: 'MATHEMATICAL SANS-SERIF BOLD ITALIC NABLA', +120746: 'MATHEMATICAL SANS-SERIF BOLD ITALIC SMALL ALPHA', +120747: 'MATHEMATICAL SANS-SERIF BOLD ITALIC SMALL BETA', +120748: 'MATHEMATICAL SANS-SERIF BOLD ITALIC SMALL GAMMA', +120749: 'MATHEMATICAL SANS-SERIF BOLD ITALIC SMALL DELTA', +120750: 'MATHEMATICAL SANS-SERIF BOLD ITALIC SMALL EPSILON', +120751: 'MATHEMATICAL SANS-SERIF BOLD ITALIC SMALL ZETA', +120752: 'MATHEMATICAL SANS-SERIF BOLD ITALIC SMALL ETA', +120753: 'MATHEMATICAL SANS-SERIF BOLD ITALIC SMALL THETA', +120754: 'MATHEMATICAL SANS-SERIF BOLD ITALIC SMALL IOTA', +120755: 'MATHEMATICAL SANS-SERIF BOLD ITALIC SMALL KAPPA', +120756: 'MATHEMATICAL SANS-SERIF BOLD ITALIC SMALL LAMDA', +120757: 'MATHEMATICAL SANS-SERIF BOLD ITALIC SMALL MU', +120758: 'MATHEMATICAL SANS-SERIF BOLD ITALIC SMALL NU', +120759: 'MATHEMATICAL SANS-SERIF BOLD ITALIC SMALL XI', +120760: 'MATHEMATICAL SANS-SERIF BOLD ITALIC SMALL OMICRON', +120761: 'MATHEMATICAL SANS-SERIF BOLD ITALIC SMALL PI', +120762: 'MATHEMATICAL SANS-SERIF BOLD ITALIC SMALL RHO', +120763: 'MATHEMATICAL SANS-SERIF BOLD ITALIC SMALL FINAL SIGMA', +120764: 'MATHEMATICAL SANS-SERIF BOLD ITALIC SMALL SIGMA', +120765: 'MATHEMATICAL SANS-SERIF BOLD ITALIC SMALL TAU', +120766: 'MATHEMATICAL SANS-SERIF BOLD ITALIC SMALL UPSILON', +120767: 'MATHEMATICAL SANS-SERIF BOLD ITALIC SMALL PHI', +120768: 'MATHEMATICAL SANS-SERIF BOLD ITALIC SMALL CHI', +120769: 'MATHEMATICAL SANS-SERIF BOLD ITALIC SMALL PSI', +120770: 'MATHEMATICAL SANS-SERIF BOLD ITALIC SMALL OMEGA', +120771: 'MATHEMATICAL SANS-SERIF BOLD ITALIC PARTIAL DIFFERENTIAL', +120772: 'MATHEMATICAL SANS-SERIF BOLD ITALIC EPSILON SYMBOL', +120773: 'MATHEMATICAL SANS-SERIF BOLD ITALIC THETA SYMBOL', +120774: 'MATHEMATICAL SANS-SERIF BOLD ITALIC KAPPA SYMBOL', +120775: 'MATHEMATICAL SANS-SERIF BOLD ITALIC PHI SYMBOL', +120776: 'MATHEMATICAL SANS-SERIF BOLD ITALIC RHO SYMBOL', +120777: 'MATHEMATICAL SANS-SERIF BOLD ITALIC PI SYMBOL', +120782: 'MATHEMATICAL BOLD DIGIT ZERO', +120783: 'MATHEMATICAL BOLD DIGIT ONE', +120784: 'MATHEMATICAL BOLD DIGIT TWO', +120785: 'MATHEMATICAL BOLD DIGIT THREE', +120786: 'MATHEMATICAL BOLD DIGIT FOUR', +120787: 'MATHEMATICAL BOLD DIGIT FIVE', +120788: 'MATHEMATICAL BOLD DIGIT SIX', +120789: 'MATHEMATICAL BOLD DIGIT SEVEN', +120790: 'MATHEMATICAL BOLD DIGIT EIGHT', +120791: 'MATHEMATICAL BOLD DIGIT NINE', +120792: 'MATHEMATICAL DOUBLE-STRUCK DIGIT ZERO', +120793: 'MATHEMATICAL DOUBLE-STRUCK DIGIT ONE', +120794: 'MATHEMATICAL DOUBLE-STRUCK DIGIT TWO', +120795: 'MATHEMATICAL DOUBLE-STRUCK DIGIT THREE', +120796: 'MATHEMATICAL DOUBLE-STRUCK DIGIT FOUR', +120797: 'MATHEMATICAL DOUBLE-STRUCK DIGIT FIVE', +120798: 'MATHEMATICAL DOUBLE-STRUCK DIGIT SIX', +120799: 'MATHEMATICAL DOUBLE-STRUCK DIGIT SEVEN', +120800: 'MATHEMATICAL DOUBLE-STRUCK DIGIT EIGHT', +120801: 'MATHEMATICAL DOUBLE-STRUCK DIGIT NINE', +120802: 'MATHEMATICAL SANS-SERIF DIGIT ZERO', +120803: 'MATHEMATICAL SANS-SERIF DIGIT ONE', +120804: 'MATHEMATICAL SANS-SERIF DIGIT TWO', +120805: 'MATHEMATICAL SANS-SERIF DIGIT THREE', +120806: 'MATHEMATICAL SANS-SERIF DIGIT FOUR', +120807: 'MATHEMATICAL SANS-SERIF DIGIT FIVE', +120808: 'MATHEMATICAL SANS-SERIF DIGIT SIX', +120809: 'MATHEMATICAL SANS-SERIF DIGIT SEVEN', +120810: 'MATHEMATICAL SANS-SERIF DIGIT EIGHT', +120811: 'MATHEMATICAL SANS-SERIF DIGIT NINE', +120812: 'MATHEMATICAL SANS-SERIF BOLD DIGIT ZERO', +120813: 'MATHEMATICAL SANS-SERIF BOLD DIGIT ONE', +120814: 'MATHEMATICAL SANS-SERIF BOLD DIGIT TWO', +120815: 'MATHEMATICAL SANS-SERIF BOLD DIGIT THREE', +120816: 'MATHEMATICAL SANS-SERIF BOLD DIGIT FOUR', +120817: 'MATHEMATICAL SANS-SERIF BOLD DIGIT FIVE', +120818: 'MATHEMATICAL SANS-SERIF BOLD DIGIT SIX', +120819: 'MATHEMATICAL SANS-SERIF BOLD DIGIT SEVEN', +120820: 'MATHEMATICAL SANS-SERIF BOLD DIGIT EIGHT', +120821: 'MATHEMATICAL SANS-SERIF BOLD DIGIT NINE', +120822: 'MATHEMATICAL MONOSPACE DIGIT ZERO', +120823: 'MATHEMATICAL MONOSPACE DIGIT ONE', +120824: 'MATHEMATICAL MONOSPACE DIGIT TWO', +120825: 'MATHEMATICAL MONOSPACE DIGIT THREE', +120826: 'MATHEMATICAL MONOSPACE DIGIT FOUR', +120827: 'MATHEMATICAL MONOSPACE DIGIT FIVE', +120828: 'MATHEMATICAL MONOSPACE DIGIT SIX', +120829: 'MATHEMATICAL MONOSPACE DIGIT SEVEN', +120830: 'MATHEMATICAL MONOSPACE DIGIT EIGHT', +120831: 'MATHEMATICAL MONOSPACE DIGIT NINE', +194560: 'CJK COMPATIBILITY IDEOGRAPH-2F800', +194561: 'CJK COMPATIBILITY IDEOGRAPH-2F801', +194562: 'CJK COMPATIBILITY IDEOGRAPH-2F802', +194563: 'CJK COMPATIBILITY IDEOGRAPH-2F803', +194564: 'CJK COMPATIBILITY IDEOGRAPH-2F804', +194565: 'CJK COMPATIBILITY IDEOGRAPH-2F805', +194566: 'CJK COMPATIBILITY IDEOGRAPH-2F806', +194567: 'CJK COMPATIBILITY IDEOGRAPH-2F807', +194568: 'CJK COMPATIBILITY IDEOGRAPH-2F808', +194569: 'CJK COMPATIBILITY IDEOGRAPH-2F809', +194570: 'CJK COMPATIBILITY IDEOGRAPH-2F80A', +194571: 'CJK COMPATIBILITY IDEOGRAPH-2F80B', +194572: 'CJK COMPATIBILITY IDEOGRAPH-2F80C', +194573: 'CJK COMPATIBILITY IDEOGRAPH-2F80D', +194574: 'CJK COMPATIBILITY IDEOGRAPH-2F80E', +194575: 'CJK COMPATIBILITY IDEOGRAPH-2F80F', +194576: 'CJK COMPATIBILITY IDEOGRAPH-2F810', +194577: 'CJK COMPATIBILITY IDEOGRAPH-2F811', +194578: 'CJK COMPATIBILITY IDEOGRAPH-2F812', +194579: 'CJK COMPATIBILITY IDEOGRAPH-2F813', +194580: 'CJK COMPATIBILITY IDEOGRAPH-2F814', +194581: 'CJK COMPATIBILITY IDEOGRAPH-2F815', +194582: 'CJK COMPATIBILITY IDEOGRAPH-2F816', +194583: 'CJK COMPATIBILITY IDEOGRAPH-2F817', +194584: 'CJK COMPATIBILITY IDEOGRAPH-2F818', +194585: 'CJK COMPATIBILITY IDEOGRAPH-2F819', +194586: 'CJK COMPATIBILITY IDEOGRAPH-2F81A', +194587: 'CJK COMPATIBILITY IDEOGRAPH-2F81B', +194588: 'CJK COMPATIBILITY IDEOGRAPH-2F81C', +194589: 'CJK COMPATIBILITY IDEOGRAPH-2F81D', +194590: 'CJK COMPATIBILITY IDEOGRAPH-2F81E', +194591: 'CJK COMPATIBILITY IDEOGRAPH-2F81F', +194592: 'CJK COMPATIBILITY IDEOGRAPH-2F820', +194593: 'CJK COMPATIBILITY IDEOGRAPH-2F821', +194594: 'CJK COMPATIBILITY IDEOGRAPH-2F822', +194595: 'CJK COMPATIBILITY IDEOGRAPH-2F823', +194596: 'CJK COMPATIBILITY IDEOGRAPH-2F824', +194597: 'CJK COMPATIBILITY IDEOGRAPH-2F825', +194598: 'CJK COMPATIBILITY IDEOGRAPH-2F826', +194599: 'CJK COMPATIBILITY IDEOGRAPH-2F827', +194600: 'CJK COMPATIBILITY IDEOGRAPH-2F828', +194601: 'CJK COMPATIBILITY IDEOGRAPH-2F829', +194602: 'CJK COMPATIBILITY IDEOGRAPH-2F82A', +194603: 'CJK COMPATIBILITY IDEOGRAPH-2F82B', +194604: 'CJK COMPATIBILITY IDEOGRAPH-2F82C', +194605: 'CJK COMPATIBILITY IDEOGRAPH-2F82D', +194606: 'CJK COMPATIBILITY IDEOGRAPH-2F82E', +194607: 'CJK COMPATIBILITY IDEOGRAPH-2F82F', +194608: 'CJK COMPATIBILITY IDEOGRAPH-2F830', +194609: 'CJK COMPATIBILITY IDEOGRAPH-2F831', +194610: 'CJK COMPATIBILITY IDEOGRAPH-2F832', +194611: 'CJK COMPATIBILITY IDEOGRAPH-2F833', +194612: 'CJK COMPATIBILITY IDEOGRAPH-2F834', +194613: 'CJK COMPATIBILITY IDEOGRAPH-2F835', +194614: 'CJK COMPATIBILITY IDEOGRAPH-2F836', +194615: 'CJK COMPATIBILITY IDEOGRAPH-2F837', +194616: 'CJK COMPATIBILITY IDEOGRAPH-2F838', +194617: 'CJK COMPATIBILITY IDEOGRAPH-2F839', +194618: 'CJK COMPATIBILITY IDEOGRAPH-2F83A', +194619: 'CJK COMPATIBILITY IDEOGRAPH-2F83B', +194620: 'CJK COMPATIBILITY IDEOGRAPH-2F83C', +194621: 'CJK COMPATIBILITY IDEOGRAPH-2F83D', +194622: 'CJK COMPATIBILITY IDEOGRAPH-2F83E', +194623: 'CJK COMPATIBILITY IDEOGRAPH-2F83F', +194624: 'CJK COMPATIBILITY IDEOGRAPH-2F840', +194625: 'CJK COMPATIBILITY IDEOGRAPH-2F841', +194626: 'CJK COMPATIBILITY IDEOGRAPH-2F842', +194627: 'CJK COMPATIBILITY IDEOGRAPH-2F843', +194628: 'CJK COMPATIBILITY IDEOGRAPH-2F844', +194629: 'CJK COMPATIBILITY IDEOGRAPH-2F845', +194630: 'CJK COMPATIBILITY IDEOGRAPH-2F846', +194631: 'CJK COMPATIBILITY IDEOGRAPH-2F847', +194632: 'CJK COMPATIBILITY IDEOGRAPH-2F848', +194633: 'CJK COMPATIBILITY IDEOGRAPH-2F849', +194634: 'CJK COMPATIBILITY IDEOGRAPH-2F84A', +194635: 'CJK COMPATIBILITY IDEOGRAPH-2F84B', +194636: 'CJK COMPATIBILITY IDEOGRAPH-2F84C', +194637: 'CJK COMPATIBILITY IDEOGRAPH-2F84D', +194638: 'CJK COMPATIBILITY IDEOGRAPH-2F84E', +194639: 'CJK COMPATIBILITY IDEOGRAPH-2F84F', +194640: 'CJK COMPATIBILITY IDEOGRAPH-2F850', +194641: 'CJK COMPATIBILITY IDEOGRAPH-2F851', +194642: 'CJK COMPATIBILITY IDEOGRAPH-2F852', +194643: 'CJK COMPATIBILITY IDEOGRAPH-2F853', +194644: 'CJK COMPATIBILITY IDEOGRAPH-2F854', +194645: 'CJK COMPATIBILITY IDEOGRAPH-2F855', +194646: 'CJK COMPATIBILITY IDEOGRAPH-2F856', +194647: 'CJK COMPATIBILITY IDEOGRAPH-2F857', +194648: 'CJK COMPATIBILITY IDEOGRAPH-2F858', +194649: 'CJK COMPATIBILITY IDEOGRAPH-2F859', +194650: 'CJK COMPATIBILITY IDEOGRAPH-2F85A', +194651: 'CJK COMPATIBILITY IDEOGRAPH-2F85B', +194652: 'CJK COMPATIBILITY IDEOGRAPH-2F85C', +194653: 'CJK COMPATIBILITY IDEOGRAPH-2F85D', +194654: 'CJK COMPATIBILITY IDEOGRAPH-2F85E', +194655: 'CJK COMPATIBILITY IDEOGRAPH-2F85F', +194656: 'CJK COMPATIBILITY IDEOGRAPH-2F860', +194657: 'CJK COMPATIBILITY IDEOGRAPH-2F861', +194658: 'CJK COMPATIBILITY IDEOGRAPH-2F862', +194659: 'CJK COMPATIBILITY IDEOGRAPH-2F863', +194660: 'CJK COMPATIBILITY IDEOGRAPH-2F864', +194661: 'CJK COMPATIBILITY IDEOGRAPH-2F865', +194662: 'CJK COMPATIBILITY IDEOGRAPH-2F866', +194663: 'CJK COMPATIBILITY IDEOGRAPH-2F867', +194664: 'CJK COMPATIBILITY IDEOGRAPH-2F868', +194665: 'CJK COMPATIBILITY IDEOGRAPH-2F869', +194666: 'CJK COMPATIBILITY IDEOGRAPH-2F86A', +194667: 'CJK COMPATIBILITY IDEOGRAPH-2F86B', +194668: 'CJK COMPATIBILITY IDEOGRAPH-2F86C', +194669: 'CJK COMPATIBILITY IDEOGRAPH-2F86D', +194670: 'CJK COMPATIBILITY IDEOGRAPH-2F86E', +194671: 'CJK COMPATIBILITY IDEOGRAPH-2F86F', +194672: 'CJK COMPATIBILITY IDEOGRAPH-2F870', +194673: 'CJK COMPATIBILITY IDEOGRAPH-2F871', +194674: 'CJK COMPATIBILITY IDEOGRAPH-2F872', +194675: 'CJK COMPATIBILITY IDEOGRAPH-2F873', +194676: 'CJK COMPATIBILITY IDEOGRAPH-2F874', +194677: 'CJK COMPATIBILITY IDEOGRAPH-2F875', +194678: 'CJK COMPATIBILITY IDEOGRAPH-2F876', +194679: 'CJK COMPATIBILITY IDEOGRAPH-2F877', +194680: 'CJK COMPATIBILITY IDEOGRAPH-2F878', +194681: 'CJK COMPATIBILITY IDEOGRAPH-2F879', +194682: 'CJK COMPATIBILITY IDEOGRAPH-2F87A', +194683: 'CJK COMPATIBILITY IDEOGRAPH-2F87B', +194684: 'CJK COMPATIBILITY IDEOGRAPH-2F87C', +194685: 'CJK COMPATIBILITY IDEOGRAPH-2F87D', +194686: 'CJK COMPATIBILITY IDEOGRAPH-2F87E', +194687: 'CJK COMPATIBILITY IDEOGRAPH-2F87F', +194688: 'CJK COMPATIBILITY IDEOGRAPH-2F880', +194689: 'CJK COMPATIBILITY IDEOGRAPH-2F881', +194690: 'CJK COMPATIBILITY IDEOGRAPH-2F882', +194691: 'CJK COMPATIBILITY IDEOGRAPH-2F883', +194692: 'CJK COMPATIBILITY IDEOGRAPH-2F884', +194693: 'CJK COMPATIBILITY IDEOGRAPH-2F885', +194694: 'CJK COMPATIBILITY IDEOGRAPH-2F886', +194695: 'CJK COMPATIBILITY IDEOGRAPH-2F887', +194696: 'CJK COMPATIBILITY IDEOGRAPH-2F888', +194697: 'CJK COMPATIBILITY IDEOGRAPH-2F889', +194698: 'CJK COMPATIBILITY IDEOGRAPH-2F88A', +194699: 'CJK COMPATIBILITY IDEOGRAPH-2F88B', +194700: 'CJK COMPATIBILITY IDEOGRAPH-2F88C', +194701: 'CJK COMPATIBILITY IDEOGRAPH-2F88D', +194702: 'CJK COMPATIBILITY IDEOGRAPH-2F88E', +194703: 'CJK COMPATIBILITY IDEOGRAPH-2F88F', +194704: 'CJK COMPATIBILITY IDEOGRAPH-2F890', +194705: 'CJK COMPATIBILITY IDEOGRAPH-2F891', +194706: 'CJK COMPATIBILITY IDEOGRAPH-2F892', +194707: 'CJK COMPATIBILITY IDEOGRAPH-2F893', +194708: 'CJK COMPATIBILITY IDEOGRAPH-2F894', +194709: 'CJK COMPATIBILITY IDEOGRAPH-2F895', +194710: 'CJK COMPATIBILITY IDEOGRAPH-2F896', +194711: 'CJK COMPATIBILITY IDEOGRAPH-2F897', +194712: 'CJK COMPATIBILITY IDEOGRAPH-2F898', +194713: 'CJK COMPATIBILITY IDEOGRAPH-2F899', +194714: 'CJK COMPATIBILITY IDEOGRAPH-2F89A', +194715: 'CJK COMPATIBILITY IDEOGRAPH-2F89B', +194716: 'CJK COMPATIBILITY IDEOGRAPH-2F89C', +194717: 'CJK COMPATIBILITY IDEOGRAPH-2F89D', +194718: 'CJK COMPATIBILITY IDEOGRAPH-2F89E', +194719: 'CJK COMPATIBILITY IDEOGRAPH-2F89F', +194720: 'CJK COMPATIBILITY IDEOGRAPH-2F8A0', +194721: 'CJK COMPATIBILITY IDEOGRAPH-2F8A1', +194722: 'CJK COMPATIBILITY IDEOGRAPH-2F8A2', +194723: 'CJK COMPATIBILITY IDEOGRAPH-2F8A3', +194724: 'CJK COMPATIBILITY IDEOGRAPH-2F8A4', +194725: 'CJK COMPATIBILITY IDEOGRAPH-2F8A5', +194726: 'CJK COMPATIBILITY IDEOGRAPH-2F8A6', +194727: 'CJK COMPATIBILITY IDEOGRAPH-2F8A7', +194728: 'CJK COMPATIBILITY IDEOGRAPH-2F8A8', +194729: 'CJK COMPATIBILITY IDEOGRAPH-2F8A9', +194730: 'CJK COMPATIBILITY IDEOGRAPH-2F8AA', +194731: 'CJK COMPATIBILITY IDEOGRAPH-2F8AB', +194732: 'CJK COMPATIBILITY IDEOGRAPH-2F8AC', +194733: 'CJK COMPATIBILITY IDEOGRAPH-2F8AD', +194734: 'CJK COMPATIBILITY IDEOGRAPH-2F8AE', +194735: 'CJK COMPATIBILITY IDEOGRAPH-2F8AF', +194736: 'CJK COMPATIBILITY IDEOGRAPH-2F8B0', +194737: 'CJK COMPATIBILITY IDEOGRAPH-2F8B1', +194738: 'CJK COMPATIBILITY IDEOGRAPH-2F8B2', +194739: 'CJK COMPATIBILITY IDEOGRAPH-2F8B3', +194740: 'CJK COMPATIBILITY IDEOGRAPH-2F8B4', +194741: 'CJK COMPATIBILITY IDEOGRAPH-2F8B5', +194742: 'CJK COMPATIBILITY IDEOGRAPH-2F8B6', +194743: 'CJK COMPATIBILITY IDEOGRAPH-2F8B7', +194744: 'CJK COMPATIBILITY IDEOGRAPH-2F8B8', +194745: 'CJK COMPATIBILITY IDEOGRAPH-2F8B9', +194746: 'CJK COMPATIBILITY IDEOGRAPH-2F8BA', +194747: 'CJK COMPATIBILITY IDEOGRAPH-2F8BB', +194748: 'CJK COMPATIBILITY IDEOGRAPH-2F8BC', +194749: 'CJK COMPATIBILITY IDEOGRAPH-2F8BD', +194750: 'CJK COMPATIBILITY IDEOGRAPH-2F8BE', +194751: 'CJK COMPATIBILITY IDEOGRAPH-2F8BF', +194752: 'CJK COMPATIBILITY IDEOGRAPH-2F8C0', +194753: 'CJK COMPATIBILITY IDEOGRAPH-2F8C1', +194754: 'CJK COMPATIBILITY IDEOGRAPH-2F8C2', +194755: 'CJK COMPATIBILITY IDEOGRAPH-2F8C3', +194756: 'CJK COMPATIBILITY IDEOGRAPH-2F8C4', +194757: 'CJK COMPATIBILITY IDEOGRAPH-2F8C5', +194758: 'CJK COMPATIBILITY IDEOGRAPH-2F8C6', +194759: 'CJK COMPATIBILITY IDEOGRAPH-2F8C7', +194760: 'CJK COMPATIBILITY IDEOGRAPH-2F8C8', +194761: 'CJK COMPATIBILITY IDEOGRAPH-2F8C9', +194762: 'CJK COMPATIBILITY IDEOGRAPH-2F8CA', +194763: 'CJK COMPATIBILITY IDEOGRAPH-2F8CB', +194764: 'CJK COMPATIBILITY IDEOGRAPH-2F8CC', +194765: 'CJK COMPATIBILITY IDEOGRAPH-2F8CD', +194766: 'CJK COMPATIBILITY IDEOGRAPH-2F8CE', +194767: 'CJK COMPATIBILITY IDEOGRAPH-2F8CF', +194768: 'CJK COMPATIBILITY IDEOGRAPH-2F8D0', +194769: 'CJK COMPATIBILITY IDEOGRAPH-2F8D1', +194770: 'CJK COMPATIBILITY IDEOGRAPH-2F8D2', +194771: 'CJK COMPATIBILITY IDEOGRAPH-2F8D3', +194772: 'CJK COMPATIBILITY IDEOGRAPH-2F8D4', +194773: 'CJK COMPATIBILITY IDEOGRAPH-2F8D5', +194774: 'CJK COMPATIBILITY IDEOGRAPH-2F8D6', +194775: 'CJK COMPATIBILITY IDEOGRAPH-2F8D7', +194776: 'CJK COMPATIBILITY IDEOGRAPH-2F8D8', +194777: 'CJK COMPATIBILITY IDEOGRAPH-2F8D9', +194778: 'CJK COMPATIBILITY IDEOGRAPH-2F8DA', +194779: 'CJK COMPATIBILITY IDEOGRAPH-2F8DB', +194780: 'CJK COMPATIBILITY IDEOGRAPH-2F8DC', +194781: 'CJK COMPATIBILITY IDEOGRAPH-2F8DD', +194782: 'CJK COMPATIBILITY IDEOGRAPH-2F8DE', +194783: 'CJK COMPATIBILITY IDEOGRAPH-2F8DF', +194784: 'CJK COMPATIBILITY IDEOGRAPH-2F8E0', +194785: 'CJK COMPATIBILITY IDEOGRAPH-2F8E1', +194786: 'CJK COMPATIBILITY IDEOGRAPH-2F8E2', +194787: 'CJK COMPATIBILITY IDEOGRAPH-2F8E3', +194788: 'CJK COMPATIBILITY IDEOGRAPH-2F8E4', +194789: 'CJK COMPATIBILITY IDEOGRAPH-2F8E5', +194790: 'CJK COMPATIBILITY IDEOGRAPH-2F8E6', +194791: 'CJK COMPATIBILITY IDEOGRAPH-2F8E7', +194792: 'CJK COMPATIBILITY IDEOGRAPH-2F8E8', +194793: 'CJK COMPATIBILITY IDEOGRAPH-2F8E9', +194794: 'CJK COMPATIBILITY IDEOGRAPH-2F8EA', +194795: 'CJK COMPATIBILITY IDEOGRAPH-2F8EB', +194796: 'CJK COMPATIBILITY IDEOGRAPH-2F8EC', +194797: 'CJK COMPATIBILITY IDEOGRAPH-2F8ED', +194798: 'CJK COMPATIBILITY IDEOGRAPH-2F8EE', +194799: 'CJK COMPATIBILITY IDEOGRAPH-2F8EF', +194800: 'CJK COMPATIBILITY IDEOGRAPH-2F8F0', +194801: 'CJK COMPATIBILITY IDEOGRAPH-2F8F1', +194802: 'CJK COMPATIBILITY IDEOGRAPH-2F8F2', +194803: 'CJK COMPATIBILITY IDEOGRAPH-2F8F3', +194804: 'CJK COMPATIBILITY IDEOGRAPH-2F8F4', +194805: 'CJK COMPATIBILITY IDEOGRAPH-2F8F5', +194806: 'CJK COMPATIBILITY IDEOGRAPH-2F8F6', +194807: 'CJK COMPATIBILITY IDEOGRAPH-2F8F7', +194808: 'CJK COMPATIBILITY IDEOGRAPH-2F8F8', +194809: 'CJK COMPATIBILITY IDEOGRAPH-2F8F9', +194810: 'CJK COMPATIBILITY IDEOGRAPH-2F8FA', +194811: 'CJK COMPATIBILITY IDEOGRAPH-2F8FB', +194812: 'CJK COMPATIBILITY IDEOGRAPH-2F8FC', +194813: 'CJK COMPATIBILITY IDEOGRAPH-2F8FD', +194814: 'CJK COMPATIBILITY IDEOGRAPH-2F8FE', +194815: 'CJK COMPATIBILITY IDEOGRAPH-2F8FF', +194816: 'CJK COMPATIBILITY IDEOGRAPH-2F900', +194817: 'CJK COMPATIBILITY IDEOGRAPH-2F901', +194818: 'CJK COMPATIBILITY IDEOGRAPH-2F902', +194819: 'CJK COMPATIBILITY IDEOGRAPH-2F903', +194820: 'CJK COMPATIBILITY IDEOGRAPH-2F904', +194821: 'CJK COMPATIBILITY IDEOGRAPH-2F905', +194822: 'CJK COMPATIBILITY IDEOGRAPH-2F906', +194823: 'CJK COMPATIBILITY IDEOGRAPH-2F907', +194824: 'CJK COMPATIBILITY IDEOGRAPH-2F908', +194825: 'CJK COMPATIBILITY IDEOGRAPH-2F909', +194826: 'CJK COMPATIBILITY IDEOGRAPH-2F90A', +194827: 'CJK COMPATIBILITY IDEOGRAPH-2F90B', +194828: 'CJK COMPATIBILITY IDEOGRAPH-2F90C', +194829: 'CJK COMPATIBILITY IDEOGRAPH-2F90D', +194830: 'CJK COMPATIBILITY IDEOGRAPH-2F90E', +194831: 'CJK COMPATIBILITY IDEOGRAPH-2F90F', +194832: 'CJK COMPATIBILITY IDEOGRAPH-2F910', +194833: 'CJK COMPATIBILITY IDEOGRAPH-2F911', +194834: 'CJK COMPATIBILITY IDEOGRAPH-2F912', +194835: 'CJK COMPATIBILITY IDEOGRAPH-2F913', +194836: 'CJK COMPATIBILITY IDEOGRAPH-2F914', +194837: 'CJK COMPATIBILITY IDEOGRAPH-2F915', +194838: 'CJK COMPATIBILITY IDEOGRAPH-2F916', +194839: 'CJK COMPATIBILITY IDEOGRAPH-2F917', +194840: 'CJK COMPATIBILITY IDEOGRAPH-2F918', +194841: 'CJK COMPATIBILITY IDEOGRAPH-2F919', +194842: 'CJK COMPATIBILITY IDEOGRAPH-2F91A', +194843: 'CJK COMPATIBILITY IDEOGRAPH-2F91B', +194844: 'CJK COMPATIBILITY IDEOGRAPH-2F91C', +194845: 'CJK COMPATIBILITY IDEOGRAPH-2F91D', +194846: 'CJK COMPATIBILITY IDEOGRAPH-2F91E', +194847: 'CJK COMPATIBILITY IDEOGRAPH-2F91F', +194848: 'CJK COMPATIBILITY IDEOGRAPH-2F920', +194849: 'CJK COMPATIBILITY IDEOGRAPH-2F921', +194850: 'CJK COMPATIBILITY IDEOGRAPH-2F922', +194851: 'CJK COMPATIBILITY IDEOGRAPH-2F923', +194852: 'CJK COMPATIBILITY IDEOGRAPH-2F924', +194853: 'CJK COMPATIBILITY IDEOGRAPH-2F925', +194854: 'CJK COMPATIBILITY IDEOGRAPH-2F926', +194855: 'CJK COMPATIBILITY IDEOGRAPH-2F927', +194856: 'CJK COMPATIBILITY IDEOGRAPH-2F928', +194857: 'CJK COMPATIBILITY IDEOGRAPH-2F929', +194858: 'CJK COMPATIBILITY IDEOGRAPH-2F92A', +194859: 'CJK COMPATIBILITY IDEOGRAPH-2F92B', +194860: 'CJK COMPATIBILITY IDEOGRAPH-2F92C', +194861: 'CJK COMPATIBILITY IDEOGRAPH-2F92D', +194862: 'CJK COMPATIBILITY IDEOGRAPH-2F92E', +194863: 'CJK COMPATIBILITY IDEOGRAPH-2F92F', +194864: 'CJK COMPATIBILITY IDEOGRAPH-2F930', +194865: 'CJK COMPATIBILITY IDEOGRAPH-2F931', +194866: 'CJK COMPATIBILITY IDEOGRAPH-2F932', +194867: 'CJK COMPATIBILITY IDEOGRAPH-2F933', +194868: 'CJK COMPATIBILITY IDEOGRAPH-2F934', +194869: 'CJK COMPATIBILITY IDEOGRAPH-2F935', +194870: 'CJK COMPATIBILITY IDEOGRAPH-2F936', +194871: 'CJK COMPATIBILITY IDEOGRAPH-2F937', +194872: 'CJK COMPATIBILITY IDEOGRAPH-2F938', +194873: 'CJK COMPATIBILITY IDEOGRAPH-2F939', +194874: 'CJK COMPATIBILITY IDEOGRAPH-2F93A', +194875: 'CJK COMPATIBILITY IDEOGRAPH-2F93B', +194876: 'CJK COMPATIBILITY IDEOGRAPH-2F93C', +194877: 'CJK COMPATIBILITY IDEOGRAPH-2F93D', +194878: 'CJK COMPATIBILITY IDEOGRAPH-2F93E', +194879: 'CJK COMPATIBILITY IDEOGRAPH-2F93F', +194880: 'CJK COMPATIBILITY IDEOGRAPH-2F940', +194881: 'CJK COMPATIBILITY IDEOGRAPH-2F941', +194882: 'CJK COMPATIBILITY IDEOGRAPH-2F942', +194883: 'CJK COMPATIBILITY IDEOGRAPH-2F943', +194884: 'CJK COMPATIBILITY IDEOGRAPH-2F944', +194885: 'CJK COMPATIBILITY IDEOGRAPH-2F945', +194886: 'CJK COMPATIBILITY IDEOGRAPH-2F946', +194887: 'CJK COMPATIBILITY IDEOGRAPH-2F947', +194888: 'CJK COMPATIBILITY IDEOGRAPH-2F948', +194889: 'CJK COMPATIBILITY IDEOGRAPH-2F949', +194890: 'CJK COMPATIBILITY IDEOGRAPH-2F94A', +194891: 'CJK COMPATIBILITY IDEOGRAPH-2F94B', +194892: 'CJK COMPATIBILITY IDEOGRAPH-2F94C', +194893: 'CJK COMPATIBILITY IDEOGRAPH-2F94D', +194894: 'CJK COMPATIBILITY IDEOGRAPH-2F94E', +194895: 'CJK COMPATIBILITY IDEOGRAPH-2F94F', +194896: 'CJK COMPATIBILITY IDEOGRAPH-2F950', +194897: 'CJK COMPATIBILITY IDEOGRAPH-2F951', +194898: 'CJK COMPATIBILITY IDEOGRAPH-2F952', +194899: 'CJK COMPATIBILITY IDEOGRAPH-2F953', +194900: 'CJK COMPATIBILITY IDEOGRAPH-2F954', +194901: 'CJK COMPATIBILITY IDEOGRAPH-2F955', +194902: 'CJK COMPATIBILITY IDEOGRAPH-2F956', +194903: 'CJK COMPATIBILITY IDEOGRAPH-2F957', +194904: 'CJK COMPATIBILITY IDEOGRAPH-2F958', +194905: 'CJK COMPATIBILITY IDEOGRAPH-2F959', +194906: 'CJK COMPATIBILITY IDEOGRAPH-2F95A', +194907: 'CJK COMPATIBILITY IDEOGRAPH-2F95B', +194908: 'CJK COMPATIBILITY IDEOGRAPH-2F95C', +194909: 'CJK COMPATIBILITY IDEOGRAPH-2F95D', +194910: 'CJK COMPATIBILITY IDEOGRAPH-2F95E', +194911: 'CJK COMPATIBILITY IDEOGRAPH-2F95F', +194912: 'CJK COMPATIBILITY IDEOGRAPH-2F960', +194913: 'CJK COMPATIBILITY IDEOGRAPH-2F961', +194914: 'CJK COMPATIBILITY IDEOGRAPH-2F962', +194915: 'CJK COMPATIBILITY IDEOGRAPH-2F963', +194916: 'CJK COMPATIBILITY IDEOGRAPH-2F964', +194917: 'CJK COMPATIBILITY IDEOGRAPH-2F965', +194918: 'CJK COMPATIBILITY IDEOGRAPH-2F966', +194919: 'CJK COMPATIBILITY IDEOGRAPH-2F967', +194920: 'CJK COMPATIBILITY IDEOGRAPH-2F968', +194921: 'CJK COMPATIBILITY IDEOGRAPH-2F969', +194922: 'CJK COMPATIBILITY IDEOGRAPH-2F96A', +194923: 'CJK COMPATIBILITY IDEOGRAPH-2F96B', +194924: 'CJK COMPATIBILITY IDEOGRAPH-2F96C', +194925: 'CJK COMPATIBILITY IDEOGRAPH-2F96D', +194926: 'CJK COMPATIBILITY IDEOGRAPH-2F96E', +194927: 'CJK COMPATIBILITY IDEOGRAPH-2F96F', +194928: 'CJK COMPATIBILITY IDEOGRAPH-2F970', +194929: 'CJK COMPATIBILITY IDEOGRAPH-2F971', +194930: 'CJK COMPATIBILITY IDEOGRAPH-2F972', +194931: 'CJK COMPATIBILITY IDEOGRAPH-2F973', +194932: 'CJK COMPATIBILITY IDEOGRAPH-2F974', +194933: 'CJK COMPATIBILITY IDEOGRAPH-2F975', +194934: 'CJK COMPATIBILITY IDEOGRAPH-2F976', +194935: 'CJK COMPATIBILITY IDEOGRAPH-2F977', +194936: 'CJK COMPATIBILITY IDEOGRAPH-2F978', +194937: 'CJK COMPATIBILITY IDEOGRAPH-2F979', +194938: 'CJK COMPATIBILITY IDEOGRAPH-2F97A', +194939: 'CJK COMPATIBILITY IDEOGRAPH-2F97B', +194940: 'CJK COMPATIBILITY IDEOGRAPH-2F97C', +194941: 'CJK COMPATIBILITY IDEOGRAPH-2F97D', +194942: 'CJK COMPATIBILITY IDEOGRAPH-2F97E', +194943: 'CJK COMPATIBILITY IDEOGRAPH-2F97F', +194944: 'CJK COMPATIBILITY IDEOGRAPH-2F980', +194945: 'CJK COMPATIBILITY IDEOGRAPH-2F981', +194946: 'CJK COMPATIBILITY IDEOGRAPH-2F982', +194947: 'CJK COMPATIBILITY IDEOGRAPH-2F983', +194948: 'CJK COMPATIBILITY IDEOGRAPH-2F984', +194949: 'CJK COMPATIBILITY IDEOGRAPH-2F985', +194950: 'CJK COMPATIBILITY IDEOGRAPH-2F986', +194951: 'CJK COMPATIBILITY IDEOGRAPH-2F987', +194952: 'CJK COMPATIBILITY IDEOGRAPH-2F988', +194953: 'CJK COMPATIBILITY IDEOGRAPH-2F989', +194954: 'CJK COMPATIBILITY IDEOGRAPH-2F98A', +194955: 'CJK COMPATIBILITY IDEOGRAPH-2F98B', +194956: 'CJK COMPATIBILITY IDEOGRAPH-2F98C', +194957: 'CJK COMPATIBILITY IDEOGRAPH-2F98D', +194958: 'CJK COMPATIBILITY IDEOGRAPH-2F98E', +194959: 'CJK COMPATIBILITY IDEOGRAPH-2F98F', +194960: 'CJK COMPATIBILITY IDEOGRAPH-2F990', +194961: 'CJK COMPATIBILITY IDEOGRAPH-2F991', +194962: 'CJK COMPATIBILITY IDEOGRAPH-2F992', +194963: 'CJK COMPATIBILITY IDEOGRAPH-2F993', +194964: 'CJK COMPATIBILITY IDEOGRAPH-2F994', +194965: 'CJK COMPATIBILITY IDEOGRAPH-2F995', +194966: 'CJK COMPATIBILITY IDEOGRAPH-2F996', +194967: 'CJK COMPATIBILITY IDEOGRAPH-2F997', +194968: 'CJK COMPATIBILITY IDEOGRAPH-2F998', +194969: 'CJK COMPATIBILITY IDEOGRAPH-2F999', +194970: 'CJK COMPATIBILITY IDEOGRAPH-2F99A', +194971: 'CJK COMPATIBILITY IDEOGRAPH-2F99B', +194972: 'CJK COMPATIBILITY IDEOGRAPH-2F99C', +194973: 'CJK COMPATIBILITY IDEOGRAPH-2F99D', +194974: 'CJK COMPATIBILITY IDEOGRAPH-2F99E', +194975: 'CJK COMPATIBILITY IDEOGRAPH-2F99F', +194976: 'CJK COMPATIBILITY IDEOGRAPH-2F9A0', +194977: 'CJK COMPATIBILITY IDEOGRAPH-2F9A1', +194978: 'CJK COMPATIBILITY IDEOGRAPH-2F9A2', +194979: 'CJK COMPATIBILITY IDEOGRAPH-2F9A3', +194980: 'CJK COMPATIBILITY IDEOGRAPH-2F9A4', +194981: 'CJK COMPATIBILITY IDEOGRAPH-2F9A5', +194982: 'CJK COMPATIBILITY IDEOGRAPH-2F9A6', +194983: 'CJK COMPATIBILITY IDEOGRAPH-2F9A7', +194984: 'CJK COMPATIBILITY IDEOGRAPH-2F9A8', +194985: 'CJK COMPATIBILITY IDEOGRAPH-2F9A9', +194986: 'CJK COMPATIBILITY IDEOGRAPH-2F9AA', +194987: 'CJK COMPATIBILITY IDEOGRAPH-2F9AB', +194988: 'CJK COMPATIBILITY IDEOGRAPH-2F9AC', +194989: 'CJK COMPATIBILITY IDEOGRAPH-2F9AD', +194990: 'CJK COMPATIBILITY IDEOGRAPH-2F9AE', +194991: 'CJK COMPATIBILITY IDEOGRAPH-2F9AF', +194992: 'CJK COMPATIBILITY IDEOGRAPH-2F9B0', +194993: 'CJK COMPATIBILITY IDEOGRAPH-2F9B1', +194994: 'CJK COMPATIBILITY IDEOGRAPH-2F9B2', +194995: 'CJK COMPATIBILITY IDEOGRAPH-2F9B3', +194996: 'CJK COMPATIBILITY IDEOGRAPH-2F9B4', +194997: 'CJK COMPATIBILITY IDEOGRAPH-2F9B5', +194998: 'CJK COMPATIBILITY IDEOGRAPH-2F9B6', +194999: 'CJK COMPATIBILITY IDEOGRAPH-2F9B7', +195000: 'CJK COMPATIBILITY IDEOGRAPH-2F9B8', +195001: 'CJK COMPATIBILITY IDEOGRAPH-2F9B9', +195002: 'CJK COMPATIBILITY IDEOGRAPH-2F9BA', +195003: 'CJK COMPATIBILITY IDEOGRAPH-2F9BB', +195004: 'CJK COMPATIBILITY IDEOGRAPH-2F9BC', +195005: 'CJK COMPATIBILITY IDEOGRAPH-2F9BD', +195006: 'CJK COMPATIBILITY IDEOGRAPH-2F9BE', +195007: 'CJK COMPATIBILITY IDEOGRAPH-2F9BF', +195008: 'CJK COMPATIBILITY IDEOGRAPH-2F9C0', +195009: 'CJK COMPATIBILITY IDEOGRAPH-2F9C1', +195010: 'CJK COMPATIBILITY IDEOGRAPH-2F9C2', +195011: 'CJK COMPATIBILITY IDEOGRAPH-2F9C3', +195012: 'CJK COMPATIBILITY IDEOGRAPH-2F9C4', +195013: 'CJK COMPATIBILITY IDEOGRAPH-2F9C5', +195014: 'CJK COMPATIBILITY IDEOGRAPH-2F9C6', +195015: 'CJK COMPATIBILITY IDEOGRAPH-2F9C7', +195016: 'CJK COMPATIBILITY IDEOGRAPH-2F9C8', +195017: 'CJK COMPATIBILITY IDEOGRAPH-2F9C9', +195018: 'CJK COMPATIBILITY IDEOGRAPH-2F9CA', +195019: 'CJK COMPATIBILITY IDEOGRAPH-2F9CB', +195020: 'CJK COMPATIBILITY IDEOGRAPH-2F9CC', +195021: 'CJK COMPATIBILITY IDEOGRAPH-2F9CD', +195022: 'CJK COMPATIBILITY IDEOGRAPH-2F9CE', +195023: 'CJK COMPATIBILITY IDEOGRAPH-2F9CF', +195024: 'CJK COMPATIBILITY IDEOGRAPH-2F9D0', +195025: 'CJK COMPATIBILITY IDEOGRAPH-2F9D1', +195026: 'CJK COMPATIBILITY IDEOGRAPH-2F9D2', +195027: 'CJK COMPATIBILITY IDEOGRAPH-2F9D3', +195028: 'CJK COMPATIBILITY IDEOGRAPH-2F9D4', +195029: 'CJK COMPATIBILITY IDEOGRAPH-2F9D5', +195030: 'CJK COMPATIBILITY IDEOGRAPH-2F9D6', +195031: 'CJK COMPATIBILITY IDEOGRAPH-2F9D7', +195032: 'CJK COMPATIBILITY IDEOGRAPH-2F9D8', +195033: 'CJK COMPATIBILITY IDEOGRAPH-2F9D9', +195034: 'CJK COMPATIBILITY IDEOGRAPH-2F9DA', +195035: 'CJK COMPATIBILITY IDEOGRAPH-2F9DB', +195036: 'CJK COMPATIBILITY IDEOGRAPH-2F9DC', +195037: 'CJK COMPATIBILITY IDEOGRAPH-2F9DD', +195038: 'CJK COMPATIBILITY IDEOGRAPH-2F9DE', +195039: 'CJK COMPATIBILITY IDEOGRAPH-2F9DF', +195040: 'CJK COMPATIBILITY IDEOGRAPH-2F9E0', +195041: 'CJK COMPATIBILITY IDEOGRAPH-2F9E1', +195042: 'CJK COMPATIBILITY IDEOGRAPH-2F9E2', +195043: 'CJK COMPATIBILITY IDEOGRAPH-2F9E3', +195044: 'CJK COMPATIBILITY IDEOGRAPH-2F9E4', +195045: 'CJK COMPATIBILITY IDEOGRAPH-2F9E5', +195046: 'CJK COMPATIBILITY IDEOGRAPH-2F9E6', +195047: 'CJK COMPATIBILITY IDEOGRAPH-2F9E7', +195048: 'CJK COMPATIBILITY IDEOGRAPH-2F9E8', +195049: 'CJK COMPATIBILITY IDEOGRAPH-2F9E9', +195050: 'CJK COMPATIBILITY IDEOGRAPH-2F9EA', +195051: 'CJK COMPATIBILITY IDEOGRAPH-2F9EB', +195052: 'CJK COMPATIBILITY IDEOGRAPH-2F9EC', +195053: 'CJK COMPATIBILITY IDEOGRAPH-2F9ED', +195054: 'CJK COMPATIBILITY IDEOGRAPH-2F9EE', +195055: 'CJK COMPATIBILITY IDEOGRAPH-2F9EF', +195056: 'CJK COMPATIBILITY IDEOGRAPH-2F9F0', +195057: 'CJK COMPATIBILITY IDEOGRAPH-2F9F1', +195058: 'CJK COMPATIBILITY IDEOGRAPH-2F9F2', +195059: 'CJK COMPATIBILITY IDEOGRAPH-2F9F3', +195060: 'CJK COMPATIBILITY IDEOGRAPH-2F9F4', +195061: 'CJK COMPATIBILITY IDEOGRAPH-2F9F5', +195062: 'CJK COMPATIBILITY IDEOGRAPH-2F9F6', +195063: 'CJK COMPATIBILITY IDEOGRAPH-2F9F7', +195064: 'CJK COMPATIBILITY IDEOGRAPH-2F9F8', +195065: 'CJK COMPATIBILITY IDEOGRAPH-2F9F9', +195066: 'CJK COMPATIBILITY IDEOGRAPH-2F9FA', +195067: 'CJK COMPATIBILITY IDEOGRAPH-2F9FB', +195068: 'CJK COMPATIBILITY IDEOGRAPH-2F9FC', +195069: 'CJK COMPATIBILITY IDEOGRAPH-2F9FD', +195070: 'CJK COMPATIBILITY IDEOGRAPH-2F9FE', +195071: 'CJK COMPATIBILITY IDEOGRAPH-2F9FF', +195072: 'CJK COMPATIBILITY IDEOGRAPH-2FA00', +195073: 'CJK COMPATIBILITY IDEOGRAPH-2FA01', +195074: 'CJK COMPATIBILITY IDEOGRAPH-2FA02', +195075: 'CJK COMPATIBILITY IDEOGRAPH-2FA03', +195076: 'CJK COMPATIBILITY IDEOGRAPH-2FA04', +195077: 'CJK COMPATIBILITY IDEOGRAPH-2FA05', +195078: 'CJK COMPATIBILITY IDEOGRAPH-2FA06', +195079: 'CJK COMPATIBILITY IDEOGRAPH-2FA07', +195080: 'CJK COMPATIBILITY IDEOGRAPH-2FA08', +195081: 'CJK COMPATIBILITY IDEOGRAPH-2FA09', +195082: 'CJK COMPATIBILITY IDEOGRAPH-2FA0A', +195083: 'CJK COMPATIBILITY IDEOGRAPH-2FA0B', +195084: 'CJK COMPATIBILITY IDEOGRAPH-2FA0C', +195085: 'CJK COMPATIBILITY IDEOGRAPH-2FA0D', +195086: 'CJK COMPATIBILITY IDEOGRAPH-2FA0E', +195087: 'CJK COMPATIBILITY IDEOGRAPH-2FA0F', +195088: 'CJK COMPATIBILITY IDEOGRAPH-2FA10', +195089: 'CJK COMPATIBILITY IDEOGRAPH-2FA11', +195090: 'CJK COMPATIBILITY IDEOGRAPH-2FA12', +195091: 'CJK COMPATIBILITY IDEOGRAPH-2FA13', +195092: 'CJK COMPATIBILITY IDEOGRAPH-2FA14', +195093: 'CJK COMPATIBILITY IDEOGRAPH-2FA15', +195094: 'CJK COMPATIBILITY IDEOGRAPH-2FA16', +195095: 'CJK COMPATIBILITY IDEOGRAPH-2FA17', +195096: 'CJK COMPATIBILITY IDEOGRAPH-2FA18', +195097: 'CJK COMPATIBILITY IDEOGRAPH-2FA19', +195098: 'CJK COMPATIBILITY IDEOGRAPH-2FA1A', +195099: 'CJK COMPATIBILITY IDEOGRAPH-2FA1B', +195100: 'CJK COMPATIBILITY IDEOGRAPH-2FA1C', +195101: 'CJK COMPATIBILITY IDEOGRAPH-2FA1D', +917505: 'LANGUAGE TAG', +917536: 'TAG SPACE', +917537: 'TAG EXCLAMATION MARK', +917538: 'TAG QUOTATION MARK', +917539: 'TAG NUMBER SIGN', +917540: 'TAG DOLLAR SIGN', +917541: 'TAG PERCENT SIGN', +917542: 'TAG AMPERSAND', +917543: 'TAG APOSTROPHE', +917544: 'TAG LEFT PARENTHESIS', +917545: 'TAG RIGHT PARENTHESIS', +917546: 'TAG ASTERISK', +917547: 'TAG PLUS SIGN', +917548: 'TAG COMMA', +917549: 'TAG HYPHEN-MINUS', +917550: 'TAG FULL STOP', +917551: 'TAG SOLIDUS', +917552: 'TAG DIGIT ZERO', +917553: 'TAG DIGIT ONE', +917554: 'TAG DIGIT TWO', +917555: 'TAG DIGIT THREE', +917556: 'TAG DIGIT FOUR', +917557: 'TAG DIGIT FIVE', +917558: 'TAG DIGIT SIX', +917559: 'TAG DIGIT SEVEN', +917560: 'TAG DIGIT EIGHT', +917561: 'TAG DIGIT NINE', +917562: 'TAG COLON', +917563: 'TAG SEMICOLON', +917564: 'TAG LESS-THAN SIGN', +917565: 'TAG EQUALS SIGN', +917566: 'TAG GREATER-THAN SIGN', +917567: 'TAG QUESTION MARK', +917568: 'TAG COMMERCIAL AT', +917569: 'TAG LATIN CAPITAL LETTER A', +917570: 'TAG LATIN CAPITAL LETTER B', +917571: 'TAG LATIN CAPITAL LETTER C', +917572: 'TAG LATIN CAPITAL LETTER D', +917573: 'TAG LATIN CAPITAL LETTER E', +917574: 'TAG LATIN CAPITAL LETTER F', +917575: 'TAG LATIN CAPITAL LETTER G', +917576: 'TAG LATIN CAPITAL LETTER H', +917577: 'TAG LATIN CAPITAL LETTER I', +917578: 'TAG LATIN CAPITAL LETTER J', +917579: 'TAG LATIN CAPITAL LETTER K', +917580: 'TAG LATIN CAPITAL LETTER L', +917581: 'TAG LATIN CAPITAL LETTER M', +917582: 'TAG LATIN CAPITAL LETTER N', +917583: 'TAG LATIN CAPITAL LETTER O', +917584: 'TAG LATIN CAPITAL LETTER P', +917585: 'TAG LATIN CAPITAL LETTER Q', +917586: 'TAG LATIN CAPITAL LETTER R', +917587: 'TAG LATIN CAPITAL LETTER S', +917588: 'TAG LATIN CAPITAL LETTER T', +917589: 'TAG LATIN CAPITAL LETTER U', +917590: 'TAG LATIN CAPITAL LETTER V', +917591: 'TAG LATIN CAPITAL LETTER W', +917592: 'TAG LATIN CAPITAL LETTER X', +917593: 'TAG LATIN CAPITAL LETTER Y', +917594: 'TAG LATIN CAPITAL LETTER Z', +917595: 'TAG LEFT SQUARE BRACKET', +917596: 'TAG REVERSE SOLIDUS', +917597: 'TAG RIGHT SQUARE BRACKET', +917598: 'TAG CIRCUMFLEX ACCENT', +917599: 'TAG LOW LINE', +917600: 'TAG GRAVE ACCENT', +917601: 'TAG LATIN SMALL LETTER A', +917602: 'TAG LATIN SMALL LETTER B', +917603: 'TAG LATIN SMALL LETTER C', +917604: 'TAG LATIN SMALL LETTER D', +917605: 'TAG LATIN SMALL LETTER E', +917606: 'TAG LATIN SMALL LETTER F', +917607: 'TAG LATIN SMALL LETTER G', +917608: 'TAG LATIN SMALL LETTER H', +917609: 'TAG LATIN SMALL LETTER I', +917610: 'TAG LATIN SMALL LETTER J', +917611: 'TAG LATIN SMALL LETTER K', +917612: 'TAG LATIN SMALL LETTER L', +917613: 'TAG LATIN SMALL LETTER M', +917614: 'TAG LATIN SMALL LETTER N', +917615: 'TAG LATIN SMALL LETTER O', +917616: 'TAG LATIN SMALL LETTER P', +917617: 'TAG LATIN SMALL LETTER Q', +917618: 'TAG LATIN SMALL LETTER R', +917619: 'TAG LATIN SMALL LETTER S', +917620: 'TAG LATIN SMALL LETTER T', +917621: 'TAG LATIN SMALL LETTER U', +917622: 'TAG LATIN SMALL LETTER V', +917623: 'TAG LATIN SMALL LETTER W', +917624: 'TAG LATIN SMALL LETTER X', +917625: 'TAG LATIN SMALL LETTER Y', +917626: 'TAG LATIN SMALL LETTER Z', +917627: 'TAG LEFT CURLY BRACKET', +917628: 'TAG VERTICAL LINE', +917629: 'TAG RIGHT CURLY BRACKET', +917630: 'TAG TILDE', +917631: 'CANCEL TAG', +} + +_code_by_name = dict(zip(_charnames.itervalues(), _charnames.iterkeys())) + +def lookup(name): + return _code_by_name[name] + +def name(code): + return _charnames[code] + +_category_names = ['Cc', 'Cf', 'Cn', 'Co', 'Cs', 'Ll', 'Lm', 'Lo', 'Lt', 'Lu', 'Mc', 'Me', 'Mn', 'Nd', 'Nl', 'No', 'Pc', 'Pd', 'Pe', 'Pf', 'Pi', 'Po', 'Ps', 'Sc', 'Sk', 'Sm', 'So', 'Zl', 'Zp', 'Zs'] +_category_pgtbl = "".join([ +'\x00\x01\x02\x03\x04\x05\x06\x07\x08\t\n\x0b\x0c\r\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x08\x08\x08\x08\x08\x19\x1a\x1b\x1c\x1d\x1e\x1f !"#$\x1d\x08\x08\x08%&\'()*\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15' +'\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15+\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15' +'\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15,\x15\x15\x15\x15-\x08\x08\x08\x08\x08\x08\x08\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15' +'\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15.////////0000000000000000000000000\x1512\x15345' +'\x08\x08\x0867\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08' +'\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08' +'\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08' +'\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x0889\x08\x08:;<=\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08' +'\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15' +'\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15' +'\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15>\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08' +'\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x15\x15?\x08\x08\x08\x08\x08' +'\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08' +'\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08' +'\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08' +'\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08' +'\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08' +'\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08' +'\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08' +'\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08' +'\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08' +'\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08' +'\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08' +'\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08' +'\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08' +'\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08' +'\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08' +'\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08' +'\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08' +'\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08' +'\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08' +'\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08' +'\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08' +'\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08' +'\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08' +'\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08' +'\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08' +'\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08' +'\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08' +'\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08' +'\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08' +'\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08' +'\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08' +'\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08' +'\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08' +'\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08' +'\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08' +'\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08' +'\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08' +'\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08' +'\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08' +'\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08' +'\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08' +'\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08' +'\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08' +'\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08' +'@\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08' +'\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08' +'\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08' +'\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08' +'0000000000000000000000000000000000000000000000000000000000000000' +'0000000000000000000000000000000000000000000000000000000000000000' +'0000000000000000000000000000000000000000000000000000000000000000' +'000000000000000000000000000000000000000000000000000000000000000A' +'0000000000000000000000000000000000000000000000000000000000000000' +'0000000000000000000000000000000000000000000000000000000000000000' +'0000000000000000000000000000000000000000000000000000000000000000' +'000000000000000000000000000000000000000000000000000000000000000A' +]) +_category = ( +"".join([ +'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x1d\x15\x15\x15\x17\x15\x15\x15\x16\x12\x15\x19\x15\x11\x15\x15\r\r\r\r\r\r\r\r\r\r\x15\x15\x19\x19\x19\x15' +'\x15\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\x16\x15\x12\x18\x10\x18\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x16\x19\x12\x19\x00' +'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x1d\x15\x17\x17\x17\x17\x1a\x1a\x18\x1a\x05\x14\x19\x11\x1a\x18\x1a\x19\x0f\x0f\x18\x05\x1a\x15\x18\x0f\x05\x13\x0f\x0f\x0f\x15' +'\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\x19\t\t\t\t\t\t\t\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x19\x05\x05\x05\x05\x05\x05\x05\x05' +]), +"".join([ +'\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\x05\t\x05\t\x05\t\x05\t' +'\x05\t\x05\t\x05\t\x05\t\x05\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\t\x05\t\x05\t\x05\x05' +'\x05\t\t\x05\t\x05\t\t\x05\t\t\t\x05\x05\t\t\t\t\x05\t\t\x05\t\t\t\x05\x05\x05\t\t\x05\t\t\x05\t\x05\t\x05\t\t\x05\t\x05\x05\t\x05\t\t\x05\t\t\t\x05\t\x05\t\t\x05\x05\x07\t\x05\x05\x05' +'\x07\x07\x07\x07\t\x08\x05\t\x08\x05\t\x08\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\x05\t\x08\x05\t\x05\t\t\t\x05\t\x05\t\x05\t\x05' +]), +"".join([ +'\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x02\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02' +'\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05' +'\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x02\x02\x06\x06\x06\x06\x06\x06\x06\x06\x06\x18\x18\x06\x06\x06\x06\x06' +'\x06\x06\x18\x18\x18\x18\x18\x18\x18\x18\x18\x18\x18\x18\x18\x18\x06\x06\x18\x18\x18\x18\x18\x18\x18\x18\x18\x18\x18\x18\x18\x18\x06\x06\x06\x06\x06\x18\x18\x18\x18\x18\x18\x18\x18\x18\x06\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02' +]), +"".join([ +'\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c' +'\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x02\x02\x02\x02\x18\x18\x02\x02\x02\x02\x06\x02\x02\x02\x15\x02' +'\x02\x02\x02\x02\x18\x18\t\x15\t\t\t\x02\t\x02\t\t\x05\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\x02\t\t\t\t\t\t\t\t\t\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05' +'\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x02\x05\x05\t\t\t\x05\x05\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\x05\x05\x05\x05\t\x05\x19\x02\x02\x02\x02\x02\x02\x02\x02\x02' +]), +"".join([ +'\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05' +'\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05' +'\t\x05\x1a\x0c\x0c\x0c\x0c\x02\x0b\x0b\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05' +'\t\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\x02\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\x02\x02\t\x05\x02\x02\x02\x02\x02\x02' +]), +"".join([ +'\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t' +'\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\x02\x02\x06\x15\x15\x15\x15\x15\x15\x02\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05' +'\x05\x05\x05\x05\x05\x05\x05\x05\x02\x15\x11\x02\x02\x02\x02\x02\x02\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x02\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x02\x0c\x0c\x0c\x15\x0c' +'\x15\x0c\x0c\x15\x0c\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x02\x02\x02\x02\x02\x07\x07\x07\x15\x15\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02' +]), +"".join([ +'\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x15\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x15\x02\x02\x02\x15\x02\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x02\x02\x02\x02\x02' +'\x06\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\r\r\r\r\r\r\r\r\r\r\x15\x15\x15\x15\x07\x07\x0c\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07' +'\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07' +'\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x15\x07\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x01\x0b\x0c\x0c\x0c\x0c\x0c\x0c\x06\x06\x0c\x0c\x1a\x0c\x0c\x0c\x0c\x02\x02\r\r\r\r\r\r\r\r\r\r\x07\x07\x07\x1a\x1a\x02' +]), +"".join([ +'\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x02\x01\x07\x0c\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x02\x02\x02\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c' +'\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02' +'\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x07\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02' +'\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02' +]), +"".join([ +'\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02' +'\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02' +'\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02' +'\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02' +]), +"".join([ +'\x02\x0c\x0c\n\x02\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x02\x02\x0c\x07\n\n' +'\n\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\n\n\n\n\x0c\x02\x02\x07\x0c\x0c\x0c\x0c\x02\x02\x02\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x0c\x0c\x15\x15\r\r\r\r\r\r\r\r\r\r\x15\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02' +'\x02\x0c\n\n\x02\x07\x07\x07\x07\x07\x07\x07\x07\x02\x02\x07\x07\x02\x02\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x02\x07\x07\x07\x07\x07\x07\x07\x02\x07\x02\x02\x02\x07\x07\x07\x07\x02\x02\x0c\x02\n\n' +'\n\x0c\x0c\x0c\x0c\x02\x02\n\n\x02\x02\n\n\x0c\x02\x02\x02\x02\x02\x02\x02\x02\x02\n\x02\x02\x02\x02\x07\x07\x02\x07\x07\x07\x0c\x0c\x02\x02\r\r\r\r\r\r\r\r\r\r\x07\x07\x17\x17\x0f\x0f\x0f\x0f\x0f\x0f\x1a\x02\x02\x02\x02\x02' +]), +"".join([ +'\x02\x02\x0c\x02\x02\x07\x07\x07\x07\x07\x07\x02\x02\x02\x02\x07\x07\x02\x02\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x02\x07\x07\x07\x07\x07\x07\x07\x02\x07\x07\x02\x07\x07\x02\x07\x07\x02\x02\x0c\x02\n\n' +'\n\x0c\x0c\x02\x02\x02\x02\x0c\x0c\x02\x02\x0c\x0c\x0c\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x07\x07\x07\x07\x02\x07\x02\x02\x02\x02\x02\x02\x02\r\r\r\r\r\r\r\r\r\r\x0c\x0c\x07\x07\x07\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02' +'\x02\x0c\x0c\n\x02\x07\x07\x07\x07\x07\x07\x07\x02\x07\x02\x07\x07\x07\x02\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x02\x07\x07\x07\x07\x07\x07\x07\x02\x07\x07\x02\x07\x07\x07\x07\x07\x02\x02\x0c\x07\n\n' +'\n\x0c\x0c\x0c\x0c\x0c\x02\x0c\x0c\n\x02\n\n\x0c\x02\x02\x07\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x07\x02\x02\x02\x02\x02\r\r\r\r\r\r\r\r\r\r\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02' +]), +"".join([ +'\x02\x0c\n\n\x02\x07\x07\x07\x07\x07\x07\x07\x07\x02\x02\x07\x07\x02\x02\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x02\x07\x07\x07\x07\x07\x07\x07\x02\x07\x07\x02\x02\x07\x07\x07\x07\x02\x02\x0c\x07\n\x0c' +'\n\x0c\x0c\x0c\x02\x02\x02\n\n\x02\x02\n\n\x0c\x02\x02\x02\x02\x02\x02\x02\x02\x0c\n\x02\x02\x02\x02\x07\x07\x02\x07\x07\x07\x02\x02\x02\x02\r\r\r\r\r\r\r\r\r\r\x1a\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02' +'\x02\x02\x0c\x07\x02\x07\x07\x07\x07\x07\x07\x02\x02\x02\x07\x07\x07\x02\x07\x07\x07\x07\x02\x02\x02\x07\x07\x02\x07\x02\x07\x07\x02\x02\x02\x07\x07\x02\x02\x02\x07\x07\x07\x02\x02\x02\x07\x07\x07\x07\x07\x07\x07\x07\x02\x07\x07\x07\x02\x02\x02\x02\n\n' +'\x0c\n\n\x02\x02\x02\n\n\n\x02\n\n\n\x0c\x02\x02\x02\x02\x02\x02\x02\x02\x02\n\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\r\r\r\r\r\r\r\r\r\x0f\x0f\x0f\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02' +]), +"".join([ +'\x02\n\n\n\x02\x07\x07\x07\x07\x07\x07\x07\x07\x02\x07\x07\x07\x02\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x02\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x02\x07\x07\x07\x07\x07\x02\x02\x02\x02\x0c\x0c' +'\x0c\n\n\n\n\x02\x0c\x0c\x0c\x02\x0c\x0c\x0c\x0c\x02\x02\x02\x02\x02\x02\x02\x0c\x0c\x02\x02\x02\x02\x02\x02\x02\x02\x02\x07\x07\x02\x02\x02\x02\r\r\r\r\r\r\r\r\r\r\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02' +'\x02\x02\n\n\x02\x07\x07\x07\x07\x07\x07\x07\x07\x02\x07\x07\x07\x02\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x02\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x02\x07\x07\x07\x07\x07\x02\x02\x02\x02\n\x0c' +'\n\n\n\n\n\x02\x0c\n\n\x02\n\n\x0c\x0c\x02\x02\x02\x02\x02\x02\x02\n\n\x02\x02\x02\x02\x02\x02\x02\x07\x02\x07\x07\x02\x02\x02\x02\r\r\r\r\r\r\r\r\r\r\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02' +]), +"".join([ +'\x02\x02\n\n\x02\x07\x07\x07\x07\x07\x07\x07\x07\x02\x07\x07\x07\x02\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x02\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x02\x02\x02\x02\n\n' +'\n\x0c\x0c\x0c\x02\x02\n\n\n\x02\n\n\n\x0c\x02\x02\x02\x02\x02\x02\x02\x02\x02\n\x02\x02\x02\x02\x02\x02\x02\x02\x07\x07\x02\x02\x02\x02\r\r\r\r\r\r\r\r\r\r\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02' +'\x02\x02\n\n\x02\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x02\x02\x02\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x02\x07\x07\x07\x07\x07\x07\x07\x07\x07\x02\x07\x02\x02' +'\x07\x07\x07\x07\x07\x07\x07\x02\x02\x02\x0c\x02\x02\x02\x02\n\n\n\x0c\x0c\x0c\x02\x0c\x02\n\n\n\n\n\n\n\n\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\n\n\x15\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02' +]), +"".join([ +'\x02\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x0c\x07\x07\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x02\x02\x02\x02\x17' +'\x07\x07\x07\x07\x07\x07\x06\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x15\r\r\r\r\r\r\r\r\r\r\x15\x15\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02' +'\x02\x07\x07\x02\x07\x02\x02\x07\x07\x02\x07\x02\x02\x07\x02\x02\x02\x02\x02\x02\x07\x07\x07\x07\x02\x07\x07\x07\x07\x07\x07\x07\x02\x07\x07\x07\x02\x07\x02\x07\x02\x02\x07\x07\x02\x07\x07\x07\x07\x0c\x07\x07\x0c\x0c\x0c\x0c\x0c\x0c\x02\x0c\x0c\x07\x02\x02' +'\x07\x07\x07\x07\x07\x02\x06\x02\x0c\x0c\x0c\x0c\x0c\x0c\x02\x02\r\r\r\r\r\r\r\r\r\r\x02\x02\x07\x07\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02' +]), +"".join([ +'\x07\x1a\x1a\x1a\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x1a\x1a\x1a\x1a\x1a\x0c\x0c\x1a\x1a\x1a\x1a\x1a\x1a\r\r\r\r\r\r\r\r\r\r\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x1a\x0c\x1a\x0c\x1a\x0c\x16\x12\x16\x12\n\n' +'\x07\x07\x07\x07\x07\x07\x07\x07\x02\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x02\x02\x02\x02\x02\x02\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\n' +'\x0c\x0c\x0c\x0c\x0c\x15\x0c\x0c\x07\x07\x07\x07\x02\x02\x02\x02\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x02\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x02\x1a\x1a' +'\x1a\x1a\x1a\x1a\x1a\x1a\x0c\x1a\x1a\x1a\x1a\x1a\x1a\x02\x02\x1a\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02' +]), +"".join([ +'\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x02\x07\x07\x07\x07\x07\x02\x07\x07\x02\n\x0c\x0c\x0c\x0c\n\x0c\x02\x02\x02\x0c\x0c\n\x0c\x02\x02\x02\x02\x02\x02' +'\r\r\r\r\r\r\r\r\r\r\x15\x15\x15\x15\x15\x15\x07\x07\x07\x07\x07\x07\n\n\x0c\x0c\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02' +'\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t' +'\t\t\t\t\t\t\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x02\x02\x15\x02\x02\x02\x02' +]), +"".join([ +'\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07' +'\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x02\x02\x02\x02\x02\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07' +'\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x02\x02\x02\x02\x02\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07' +'\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x02\x02\x02\x02\x02\x02' +]), +"".join([ +'\x07\x07\x07\x07\x07\x07\x07\x02\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07' +'\x07\x07\x07\x07\x07\x07\x07\x02\x07\x02\x07\x07\x07\x07\x02\x02\x07\x07\x07\x07\x07\x07\x07\x02\x07\x02\x07\x07\x07\x07\x02\x02\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07' +'\x07\x07\x07\x07\x07\x07\x07\x02\x07\x02\x07\x07\x07\x07\x02\x02\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x02\x07\x02\x07\x07\x07\x07\x02\x02\x07\x07\x07\x07\x07\x07\x07\x02' +'\x07\x02\x07\x07\x07\x07\x02\x02\x07\x07\x07\x07\x07\x07\x07\x02\x07\x07\x07\x07\x07\x07\x07\x02\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x02\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07' +]), +"".join([ +'\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x02\x07\x02\x07\x07\x07\x07\x02\x02\x07\x07\x07\x07\x07\x07\x07\x02\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07' +'\x07\x07\x07\x07\x07\x07\x07\x02\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x02\x02\x02\x02\x02\x02\x15\x15\x15\x15\x15\x15\x15\x15\r\r\r\r\r\r\r\r\r\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x02\x02\x02' +'\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07' +'\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02' +]), +"".join([ +'\x02\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07' +'\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07' +'\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07' +'\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07' +]), +"".join([ +'\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07' +'\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07' +'\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07' +'\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07' +]), +"".join([ +'\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07' +'\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x15\x15\x07\x07\x07\x07\x07\x07\x07\x07\x02\x02\x02\x02\x02\x02\x02\x02\x02' +'\x1d\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x16\x12\x02\x02\x02\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07' +'\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x15\x15\x15\x0e\x0e\x0e\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02' +]), +"".join([ +'\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x02\x07\x07\x07\x07\x0c\x0c\x0c\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x0c\x0c\x0c\x15\x15\x02\x02\x02\x02\x02\x02\x02\x02\x02' +'\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x0c\x0c\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x02\x07\x07\x07\x02\x0c\x0c\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02' +'\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\n\n\n\x0c\x0c\x0c\x0c\x0c\x0c\x0c\n\n' +'\n\n\n\n\n\n\x0c\n\n\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x15\x15\x15\x06\x15\x15\x15\x17\x07\x02\x02\x02\r\r\r\r\r\r\r\r\r\r\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02' +]), +"".join([ +'\x15\x15\x15\x15\x15\x15\x11\x15\x15\x15\x15\x0c\x0c\x0c\x01\x02\r\r\r\r\r\r\r\r\r\r\x02\x02\x02\x02\x02\x02\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07' +'\x07\x07\x07\x06\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x02\x02\x02\x02\x02\x02\x02\x02' +'\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x0c\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02' +'\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02' +]), +"".join([ +'\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05' +'\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05' +'\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\x05\x05\x05\x05\x05\x05\x02\x02\x02\x02\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05' +'\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\t\x05\x02\x02\x02\x02\x02\x02' +]), +"".join([ +'\x05\x05\x05\x05\x05\x05\x05\x05\t\t\t\t\t\t\t\t\x05\x05\x05\x05\x05\x05\x02\x02\t\t\t\t\t\t\x02\x02\x05\x05\x05\x05\x05\x05\x05\x05\t\t\t\t\t\t\t\t\x05\x05\x05\x05\x05\x05\x05\x05\t\t\t\t\t\t\t\t' +'\x05\x05\x05\x05\x05\x05\x02\x02\t\t\t\t\t\t\x02\x02\x05\x05\x05\x05\x05\x05\x05\x05\x02\t\x02\t\x02\t\x02\t\x05\x05\x05\x05\x05\x05\x05\x05\t\t\t\t\t\t\t\t\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x02\x02' +'\x05\x05\x05\x05\x05\x05\x05\x05\x08\x08\x08\x08\x08\x08\x08\x08\x05\x05\x05\x05\x05\x05\x05\x05\x08\x08\x08\x08\x08\x08\x08\x08\x05\x05\x05\x05\x05\x05\x05\x05\x08\x08\x08\x08\x08\x08\x08\x08\x05\x05\x05\x05\x05\x02\x05\x05\t\t\t\t\x08\x18\x05\x18' +'\x18\x18\x05\x05\x05\x02\x05\x05\t\t\t\t\x08\x18\x18\x18\x05\x05\x05\x05\x02\x02\x05\x05\t\t\t\t\x02\x18\x18\x18\x05\x05\x05\x05\x05\x05\x05\x05\t\t\t\t\t\x18\x18\x18\x02\x02\x05\x05\x05\x02\x05\x05\t\t\t\t\x08\x18\x18\x02' +]), +"".join([ +'\x1d\x1d\x1d\x1d\x1d\x1d\x1d\x1d\x1d\x1d\x1d\x1d\x01\x01\x01\x01\x11\x11\x11\x11\x11\x11\x15\x15\x14\x13\x16\x14\x14\x13\x16\x14\x15\x15\x15\x15\x15\x15\x15\x15\x1b\x1c\x01\x01\x01\x01\x01\x1d\x15\x15\x15\x15\x15\x15\x15\x15\x15\x14\x13\x15\x15\x15\x15\x10' +'\x10\x15\x15\x15\x19\x16\x12\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x15\x19\x02\x02\x02\x02\x15\x02\x02\x02\x02\x02\x02\x02\x1d\x01\x01\x01\x01\x02\x02\x02\x02\x02\x02\x01\x01\x01\x01\x01\x01\x0f\x05\x02\x02\x0f\x0f\x0f\x0f\x0f\x0f\x19\x19\x19\x16\x12\x05' +'\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x19\x19\x19\x16\x12\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x17\x17\x17\x17\x17\x17\x17\x17\x17\x17\x17\x17\x17\x17\x17\x17\x17\x17\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02' +'\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0b\x0b\x0b\x0b\x0c\x0b\x0b\x0b\x0c\x0c\x0c\x0c\x0c\x0c\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02' +]), +"".join([ +'\x1a\x1a\t\x1a\x1a\x1a\x1a\t\x1a\x1a\x05\t\t\t\x05\x05\t\t\t\x05\x1a\t\x1a\x1a\x1a\t\t\t\t\t\x1a\x1a\x1a\x1a\x1a\x1a\t\x1a\t\x1a\t\x1a\t\t\t\t\x1a\x05\t\t\x1a\t\x05\x07\x07\x07\x07\x05\x1a\x02\x02\x05\t\t' +'\x19\x19\x19\x19\x19\t\x05\x05\x05\x05\x1a\x19\x02\x02\x02\x02\x02\x02\x02\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0e\x0e\x0e\x0e\x0e\x0e\x0e\x0e\x0e\x0e\x0e\x0e\x0e\x0e\x0e\x0e\x0e\x0e\x0e\x0e\x0e\x0e\x0e\x0e\x0e\x0e\x0e\x0e\x0e\x0e\x0e\x0e' +'\x0e\x0e\x0e\x0e\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x19\x19\x19\x19\x19\x1a\x1a\x1a\x1a\x1a\x19\x19\x1a\x1a\x1a\x1a\x19\x1a\x1a\x19\x1a\x1a\x19\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x19\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a' +'\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x19\x19\x1a\x1a\x19\x1a\x19\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19' +]), +"".join([ +'\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19' +'\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19' +'\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19' +'\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19' +]), +"".join([ +'\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x19\x19\x19\x19\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x19\x19\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x16\x12\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a' +'\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x19\x1a\x1a\x1a' +'\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x16\x12\x15\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a' +'\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02' +]), +"".join([ +'\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02' +'\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f' +'\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a' +'\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x02' +]), +"".join([ +'\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a' +'\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a' +'\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x19\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a' +'\x1a\x19\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x19\x19\x19\x19\x19\x19\x19\x19' +]), +"".join([ +'\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x02\x02\x1a\x1a\x02\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a' +'\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x19\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x02\x02' +'\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02' +'\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02' +]), +"".join([ +'\x02\x1a\x1a\x1a\x1a\x02\x1a\x1a\x1a\x1a\x02\x02\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x02\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a' +'\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x02\x1a\x02\x1a\x1a\x1a\x1a\x02\x02\x02\x1a\x02\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x02\x02\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x16\x12\x16\x12\x16\x12\x16\x12\x16\x12\x16\x12\x16\x12\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f' +'\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x1a\x02\x02\x02\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x02\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x02' +'\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x16\x12\x16\x12\x16\x12\x02\x02\x02\x02\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19' +]), +"".join([ +'\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a' +'\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a' +'\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a' +'\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a' +]), +"".join([ +'\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19' +'\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19' +'\x19\x19\x19\x16\x12\x16\x12\x16\x12\x16\x12\x16\x12\x16\x12\x16\x12\x16\x12\x16\x12\x16\x12\x16\x12\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19' +'\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x16\x12\x16\x12\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x19\x16\x12\x19\x19' +]), +"".join([ +'\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02' +'\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02' +'\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x02\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a' +'\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02' +]), +"".join([ +'\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a' +'\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a' +'\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a' +'\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x02\x02\x02\x02' +]), +"".join([ +'\x1d\x15\x15\x15\x1a\x06\x07\x0e\x16\x12\x16\x12\x16\x12\x16\x12\x16\x12\x1a\x1a\x16\x12\x16\x12\x16\x12\x16\x12\x11\x16\x12\x12\x1a\x0e\x0e\x0e\x0e\x0e\x0e\x0e\x0e\x0e\x0c\x0c\x0c\x0c\x0c\x0c\x11\x06\x06\x06\x06\x06\x1a\x1a\x0e\x0e\x0e\x06\x07\x15\x1a\x1a' +'\x02\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07' +'\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x02\x02\x0c\x0c\x18\x18\x06\x06\x07\x11\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07' +'\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x10\x06\x06\x06\x07' +]), +"".join([ +'\x02\x02\x02\x02\x02\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x02\x02\x02\x02\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07' +'\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07' +'\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x02\x1a\x1a\x0f\x0f\x0f\x0f\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x02\x02\x02\x02\x02\x02\x02\x02' +'\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07' +]), +"".join([ +'\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x02\x02\x02\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a' +'\x1a\x1a\x1a\x1a\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x02\x02\x02\x1a' +'\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f' +'\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x02\x02\x02\x02\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x02' +]), +"".join([ +'\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a' +'\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x02\x02\x02\x02\x1a\x1a\x1a\x1a\x1a' +'\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a' +'\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x02\x02\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x02' +]), +"".join([ +'\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07' +'\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07' +'\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02' +'\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02' +]), +"".join([ +'\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07' +'\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07' +'\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02' +'\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02' +]), +"".join([ +'\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07' +'\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07' +'\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x02\x02\x02\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a' +'\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02' +]), +"".join([ +'\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07' +'\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07' +'\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02' +'\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02' +]), +"".join([ +'\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04' +'\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04' +'\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04' +'\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04' +]), +"".join([ +'\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03' +'\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03' +'\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03' +'\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03' +]), +"".join([ +'\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x02\x02\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07' +'\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02' +'\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02' +'\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02' +]), +"".join([ +'\x05\x05\x05\x05\x05\x05\x05\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x05\x05\x05\x05\x05\x02\x02\x02\x02\x02\x07\x0c\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x19\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x02\x07\x07\x07\x07\x07\x02\x07\x02' +'\x07\x07\x02\x07\x07\x02\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07' +'\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02' +'\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07' +]), +"".join([ +'\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x16\x12' +'\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07' +'\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x02\x02\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07' +'\x07\x07\x07\x07\x07\x07\x07\x07\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x17\x02\x02\x02' +]), +"".join([ +'\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x0c\x0c\x0c\x0c\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x15\x11\x11\x10\x10\x16\x12\x16\x12\x16\x12\x16\x12\x16\x12\x16' +'\x12\x16\x12\x16\x12\x15\x15\x02\x02\x15\x15\x15\x15\x10\x10\x10\x15\x15\x15\x02\x15\x15\x15\x15\x11\x16\x12\x16\x12\x16\x12\x15\x15\x15\x19\x11\x19\x19\x19\x02\x15\x17\x15\x15\x02\x02\x02\x02\x07\x07\x07\x07\x07\x02\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07' +'\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07' +'\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x02\x02\x01' +]), +"".join([ +'\x02\x15\x15\x15\x17\x15\x15\x15\x16\x12\x15\x19\x15\x11\x15\x15\r\r\r\r\r\r\r\r\r\r\x15\x15\x19\x19\x19\x15\x15\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\x16\x15\x12\x18\x10' +'\x18\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x16\x19\x12\x19\x16\x12\x15\x16\x12\x15\x10\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x06\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07' +'\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x06\x06\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x02' +'\x02\x02\x07\x07\x07\x07\x07\x07\x02\x02\x07\x07\x07\x07\x07\x07\x02\x02\x07\x07\x07\x07\x07\x07\x02\x02\x07\x07\x07\x02\x02\x02\x17\x17\x19\x18\x1a\x17\x17\x02\x1a\x19\x19\x19\x19\x1a\x1a\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x01\x01\x01\x1a\x1a\x02\x02' +]), +"".join([ +'\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x02\x0f\x0f\x0f\x0f\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07' +'\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x0e\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02' +'\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02' +'\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02' +]), +"".join([ +'\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\x02\x02\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05' +'\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02' +'\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02' +'\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02' +]), +"".join([ +'\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a' +'\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a' +'\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a' +'\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02' +]), +"".join([ +'\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x02\x02\x02\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a' +'\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\n\n\x0c\x0c\x0c\x1a\x1a\x1a\n\n\n\n\n\n\x01\x01\x01\x01\x01\x01\x01\x01\x0c\x0c\x0c\x0c\x0c' +'\x0c\x0c\x0c\x1a\x1a\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x0c\x0c\x0c\x0c\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a' +'\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x1a\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02' +]), +"".join([ +'\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\t\t\t\t\t\t\t\t\t\t\t\t' +'\t\t\t\t\t\t\t\t\t\t\t\t\t\t\x05\x05\x05\x05\x05\x05\x05\x02\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t' +'\t\t\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\t\x02\t\t\x02\x02\t\x02\x02\t\t\x02\x02\t\t\t\t\x02\t\t\t\t\t\t\t\t\x05\x05\x05\x05\x02\x05\x02\x05\x05\x05' +'\x05\x02\x05\x05\x02\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05' +]), +"".join([ +'\x05\x05\x05\x05\t\t\x02\t\t\t\t\x02\x02\t\t\t\t\t\t\t\t\x02\t\t\t\t\t\t\t\x02\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\t\t\x02\t\t\t\t\x02' +'\t\t\t\t\t\x02\t\x02\x02\x02\t\t\t\t\t\t\t\x02\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t' +'\t\t\t\t\t\t\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\x05\x05\x05\x05\x05\x05' +'\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05' +]), +"".join([ +'\x05\x05\x05\x05\x05\x05\x05\x05\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\t\t\t\t' +'\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t' +'\t\t\t\t\t\t\t\t\t\t\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x02\x02\x02\x02\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t' +'\t\x19\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x19\x05\x05\x05\x05\x05\x05\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\x19\x05\x05\x05\x05' +]), +"".join([ +'\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x19\x05\x05\x05\x05\x05\x05\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\x19\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05' +'\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x19\x05\x05\x05\x05\x05\x05\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\x19\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05' +'\x05\x05\x05\x05\x05\x05\x05\x05\x05\x19\x05\x05\x05\x05\x05\x05\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\x19\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05' +'\x05\x05\x05\x19\x05\x05\x05\x05\x05\x05\x02\x02\x02\x02\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r' +]), +"".join([ +'\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07' +'\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07' +'\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07' +'\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02' +]), +"".join([ +'\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02' +'\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02' +'\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02' +'\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02' +]), +"".join([ +'\x02\x01\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01' +'\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01' +'\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02' +'\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02' +]), +"".join([ +'\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03' +'\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03' +'\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03' +'\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x02\x02' +]), +) + +def category(code): + return _category_names[ord(_category[ord(_category_pgtbl[code >> 8])][code & 255])] + +_bidirectional_names = ['', 'AL', 'AN', 'B', 'BN', 'CS', 'EN', 'ES', 'ET', 'L', 'LRE', 'LRO', 'NSM', 'ON', 'PDF', 'R', 'RLE', 'RLO', 'S', 'WS'] +_bidirectional_pgtbl = "".join([ +'\x00\x01\x02\x03\x04\x05\x06\x07\x08\t\n\x0b\x0c\r\x0e\x0f\x10\x11\x12\x13\x14\x01\x15\x16\x17\x08\x08\x08\x08\x08\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f !\x1f\x1f\x1f\x08\x08\x08"#$%&\'\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01' +'\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01(\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01' +'\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01)\x01\x01\x01\x01*\x08\x08\x08\x08\x08\x08\x08\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01' +'\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01+\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01,-./01' +'\x08\x08\x0823\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08' +'\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08' +'\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08' +'\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x0845\x08\x086789\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08' +'\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01' +'\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01' +'\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01:\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08' +'\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x01\x01;\x08\x08\x08\x08\x08' +'\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08' +'\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08' +'\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08' +'\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08' +'\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08' +'\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08' +'\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08' +'\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08' +'\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08' +'\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08' +'\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08' +'\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08' +'\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08' +'\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08' +'\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08' +'\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08' +'\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08' +'\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08' +'\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08' +'\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08' +'\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08' +'\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08' +'\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08' +'\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08' +'\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08' +'\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08' +'\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08' +'\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08' +'\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08' +'\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08' +'\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08' +'\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08' +'\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08' +'\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08' +'\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08' +'\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08' +'\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08' +'\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08' +'\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08' +'\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08' +'\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08' +'\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08' +'\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08' +'\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08' +'<\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08' +'\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08' +'\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08' +'\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08' +'\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01' +'\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01' +'\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01' +'\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01=' +'\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01' +'\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01' +'\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01' +'\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01=' +]) +_bidirectional = ( +"".join([ +'\x04\x04\x04\x04\x04\x04\x04\x04\x04\x12\x03\x12\x13\x03\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x03\x03\x03\x12\x13\r\r\x08\x08\x08\r\r\r\r\r\x08\x05\x08\x05\x07\x06\x06\x06\x06\x06\x06\x06\x06\x06\x06\x05\r\r\r\r\r' +'\r\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\r\r\r\r\r\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\r\r\r\x04' +'\x04\x04\x04\x04\x04\x03\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x05\r\x08\x08\x08\x08\r\r\r\r\t\r\r\r\r\r\x08\x08\x06\x06\r\t\r\r\r\x06\t\r\r\r\r\r' +'\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\t\t\t\t\t\t\t\t' +]), +"".join([ +'\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t' +'\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t' +'\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t' +'\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t' +]), +"".join([ +'\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\x00\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t' +'\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\x00\x00\t\t\t\t\t\t\t\t\t\r\r\t\t\t\t\t' +'\t\t\r\r\r\r\r\r\r\r\r\r\r\r\r\r\t\t\r\r\r\r\r\r\r\r\r\r\r\r\r\r\t\t\t\t\t\r\r\r\r\r\r\r\r\r\t\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +]), +"".join([ +'\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c' +'\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x00\x00\x00\x00\r\r\x00\x00\x00\x00\t\x00\x00\x00\r\x00' +'\x00\x00\x00\x00\r\r\t\r\t\t\t\x00\t\x00\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\x00\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t' +'\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\x00\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\x00\x00\x00\x00\x00\x00\x00\x00\x00' +]), +"".join([ +'\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t' +'\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t' +'\t\t\t\x0c\x0c\x0c\x0c\x00\x0c\x0c\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t' +'\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\x00\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\x00\x00\t\t\x00\x00\x00\x00\x00\x00' +]), +"".join([ +'\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t' +'\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\x00\x00\t\t\t\t\t\t\t\x00\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t' +'\t\t\t\t\t\t\t\t\x00\t\r\x00\x00\x00\x00\x00\x00\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x00\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x00\x0c\x0c\x0c\x0f\x0c' +'\x0f\x0c\x0c\x0f\x0c\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x00\x00\x00\x00\x00\x0f\x0f\x0f\x0f\x0f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +]), +"".join([ +'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x05\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x01\x00\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x00\x00\x00\x00\x00' +'\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x08\x02\x02\x01\x01\x01\x0c\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01' +'\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01' +'\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x01\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x01\x01\x0c\x0c\r\x0c\x0c\x0c\x0c\x00\x00\x06\x06\x06\x06\x06\x06\x06\x06\x06\x06\x01\x01\x01\x01\x01\x00' +]), +"".join([ +'\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x00\x04\x01\x0c\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x00\x00\x00\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c' +'\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +'\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +]), +"".join([ +'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +]), +"".join([ +'\x00\x0c\x0c\t\x00\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\x00\x00\x0c\t\t\t' +'\t\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\t\t\t\t\x0c\x00\x00\t\x0c\x0c\x0c\x0c\x00\x00\x00\t\t\t\t\t\t\t\t\t\t\x0c\x0c\t\t\t\t\t\t\t\t\t\t\t\t\t\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +'\x00\x0c\t\t\x00\t\t\t\t\t\t\t\t\x00\x00\t\t\x00\x00\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\x00\t\t\t\t\t\t\t\x00\t\x00\x00\x00\t\t\t\t\x00\x00\x0c\x00\t\t' +'\t\x0c\x0c\x0c\x0c\x00\x00\t\t\x00\x00\t\t\x0c\x00\x00\x00\x00\x00\x00\x00\x00\x00\t\x00\x00\x00\x00\t\t\x00\t\t\t\x0c\x0c\x00\x00\t\t\t\t\t\t\t\t\t\t\t\t\x08\x08\t\t\t\t\t\t\t\x00\x00\x00\x00\x00' +]), +"".join([ +'\x00\x00\x0c\x00\x00\t\t\t\t\t\t\x00\x00\x00\x00\t\t\x00\x00\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\x00\t\t\t\t\t\t\t\x00\t\t\x00\t\t\x00\t\t\x00\x00\x0c\x00\t\t' +'\t\x0c\x0c\x00\x00\x00\x00\x0c\x0c\x00\x00\x0c\x0c\x0c\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\t\t\t\t\x00\t\x00\x00\x00\x00\x00\x00\x00\t\t\t\t\t\t\t\t\t\t\x0c\x0c\t\t\t\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +'\x00\x0c\x0c\t\x00\t\t\t\t\t\t\t\x00\t\x00\t\t\t\x00\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\x00\t\t\t\t\t\t\t\x00\t\t\x00\t\t\t\t\t\x00\x00\x0c\t\t\t' +'\t\x0c\x0c\x0c\x0c\x0c\x00\x0c\x0c\t\x00\t\t\x0c\x00\x00\t\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\t\x00\x00\x00\x00\x00\t\t\t\t\t\t\t\t\t\t\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +]), +"".join([ +'\x00\x0c\t\t\x00\t\t\t\t\t\t\t\t\x00\x00\t\t\x00\x00\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\x00\t\t\t\t\t\t\t\x00\t\t\x00\x00\t\t\t\t\x00\x00\x0c\t\t\x0c' +'\t\x0c\x0c\x0c\x00\x00\x00\t\t\x00\x00\t\t\x0c\x00\x00\x00\x00\x00\x00\x00\x00\x0c\t\x00\x00\x00\x00\t\t\x00\t\t\t\x00\x00\x00\x00\t\t\t\t\t\t\t\t\t\t\t\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +'\x00\x00\x0c\t\x00\t\t\t\t\t\t\x00\x00\x00\t\t\t\x00\t\t\t\t\x00\x00\x00\t\t\x00\t\x00\t\t\x00\x00\x00\t\t\x00\x00\x00\t\t\t\x00\x00\x00\t\t\t\t\t\t\t\t\x00\t\t\t\x00\x00\x00\x00\t\t' +'\x0c\t\t\x00\x00\x00\t\t\t\x00\t\t\t\x0c\x00\x00\x00\x00\x00\x00\x00\x00\x00\t\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\t\t\t\t\t\t\t\t\t\t\t\t\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +]), +"".join([ +'\x00\t\t\t\x00\t\t\t\t\t\t\t\t\x00\t\t\t\x00\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\x00\t\t\t\t\t\t\t\t\t\t\x00\t\t\t\t\t\x00\x00\x00\x00\x0c\x0c' +'\x0c\t\t\t\t\x00\x0c\x0c\x0c\x00\x0c\x0c\x0c\x0c\x00\x00\x00\x00\x00\x00\x00\x0c\x0c\x00\x00\x00\x00\x00\x00\x00\x00\x00\t\t\x00\x00\x00\x00\t\t\t\t\t\t\t\t\t\t\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +'\x00\x00\t\t\x00\t\t\t\t\t\t\t\t\x00\t\t\t\x00\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\x00\t\t\t\t\t\t\t\t\t\t\x00\t\t\t\t\t\x00\x00\x00\x00\t\x0c' +'\t\t\t\t\t\x00\x0c\t\t\x00\t\t\x0c\x0c\x00\x00\x00\x00\x00\x00\x00\t\t\x00\x00\x00\x00\x00\x00\x00\t\x00\t\t\x00\x00\x00\x00\t\t\t\t\t\t\t\t\t\t\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +]), +"".join([ +'\x00\x00\t\t\x00\t\t\t\t\t\t\t\t\x00\t\t\t\x00\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\x00\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\x00\x00\x00\x00\t\t' +'\t\x0c\x0c\x0c\x00\x00\t\t\t\x00\t\t\t\x0c\x00\x00\x00\x00\x00\x00\x00\x00\x00\t\x00\x00\x00\x00\x00\x00\x00\x00\t\t\x00\x00\x00\x00\t\t\t\t\t\t\t\t\t\t\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +'\x00\x00\t\t\x00\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\x00\x00\x00\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\x00\t\t\t\t\t\t\t\t\t\x00\t\x00\x00' +'\t\t\t\t\t\t\t\x00\x00\x00\x0c\x00\x00\x00\x00\t\t\t\x0c\x0c\x0c\x00\x0c\x00\t\t\t\t\t\t\t\t\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\t\t\t\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +]), +"".join([ +'\x00\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\x0c\t\t\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x00\x00\x00\x00\x08' +'\t\t\t\t\t\t\t\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\t\t\t\t\t\t\t\t\t\t\t\t\t\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +'\x00\t\t\x00\t\x00\x00\t\t\x00\t\x00\x00\t\x00\x00\x00\x00\x00\x00\t\t\t\t\x00\t\t\t\t\t\t\t\x00\t\t\t\x00\t\x00\t\x00\x00\t\t\x00\t\t\t\t\x0c\t\t\x0c\x0c\x0c\x0c\x0c\x0c\x00\x0c\x0c\t\x00\x00' +'\t\t\t\t\t\x00\t\x00\x0c\x0c\x0c\x0c\x0c\x0c\x00\x00\t\t\t\t\t\t\t\t\t\t\x00\x00\t\t\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +]), +"".join([ +'\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\x0c\x0c\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\x0c\t\x0c\t\x0c\r\r\r\r\t\t' +'\t\t\t\t\t\t\t\t\x00\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\x00\x00\x00\x00\x00\x00\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\t' +'\x0c\x0c\x0c\x0c\x0c\t\x0c\x0c\t\t\t\t\x00\x00\x00\x00\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x00\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x00\t\t' +'\t\t\t\t\t\t\x0c\t\t\t\t\t\t\x00\x00\t\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +]), +"".join([ +'\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\x00\t\t\t\t\t\x00\t\t\x00\t\x0c\x0c\x0c\x0c\t\x0c\x00\x00\x00\x0c\x0c\t\x0c\x00\x00\x00\x00\x00\x00' +'\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\x0c\x0c\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t' +'\t\t\t\t\t\t\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\x00\x00\t\x00\x00\x00\x00' +]), +"".join([ +'\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t' +'\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\x00\x00\x00\x00\x00\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t' +'\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\x00\x00\x00\x00\x00\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t' +'\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\x00\x00\x00\x00\x00\x00' +]), +"".join([ +'\t\t\t\t\t\t\t\x00\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t' +'\t\t\t\t\t\t\t\x00\t\x00\t\t\t\t\x00\x00\t\t\t\t\t\t\t\x00\t\x00\t\t\t\t\x00\x00\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t' +'\t\t\t\t\t\t\t\x00\t\x00\t\t\t\t\x00\x00\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\x00\t\x00\t\t\t\t\x00\x00\t\t\t\t\t\t\t\x00' +'\t\x00\t\t\t\t\x00\x00\t\t\t\t\t\t\t\x00\t\t\t\t\t\t\t\x00\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\x00\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t' +]), +"".join([ +'\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\x00\t\x00\t\t\t\t\x00\x00\t\t\t\t\t\t\t\x00\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t' +'\t\t\t\t\t\t\t\x00\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\x00\x00\x00\x00\x00\x00\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\x00\x00\x00' +'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t' +'\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +]), +"".join([ +'\x00\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t' +'\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t' +'\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t' +'\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t' +]), +"".join([ +'\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t' +'\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\x00\x00\x00\x00\x00\x00\x00\x00\x00' +'\x13\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\r\x00\x00\x00\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t' +'\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +]), +"".join([ +'\t\t\t\t\t\t\t\t\t\t\t\t\t\x00\t\t\t\t\x0c\x0c\x0c\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\x0c\x0c\x0c\t\t\x00\x00\x00\x00\x00\x00\x00\x00\x00' +'\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\x0c\x0c\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\t\t\t\t\t\t\t\t\t\t\t\t\t\x00\t\t\t\x00\x0c\x0c\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +'\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\x0c\x0c\x0c\x0c\x0c\x0c\x0c\t\t' +'\t\t\t\t\t\t\x0c\t\t\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\t\t\t\t\t\t\t\x08\t\x00\x00\x00\t\t\t\t\t\t\t\t\t\t\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +]), +"".join([ +'\r\r\r\r\r\r\r\r\r\r\r\x0c\x0c\x0c\x04\x00\t\t\t\t\t\t\t\t\t\t\x00\x00\x00\x00\x00\x00\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t' +'\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\x00\x00\x00\x00\x00\x00\x00\x00' +'\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\x0c\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +]), +"".join([ +'\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t' +'\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t' +'\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\x00\x00\x00\x00\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t' +'\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\x00\x00\x00\x00\x00\x00' +]), +"".join([ +'\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\x00\x00\t\t\t\t\t\t\x00\x00\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t' +'\t\t\t\t\t\t\x00\x00\t\t\t\t\t\t\x00\x00\t\t\t\t\t\t\t\t\x00\t\x00\t\x00\t\x00\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\x00\x00' +'\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\x00\t\t\t\t\t\t\t\r\t\r' +'\r\r\t\t\t\x00\t\t\t\t\t\t\t\r\r\r\t\t\t\t\x00\x00\t\t\t\t\t\t\x00\r\r\r\t\t\t\t\t\t\t\t\t\t\t\t\t\r\r\r\x00\x00\t\t\t\x00\t\t\t\t\t\t\t\r\r\x00' +]), +"".join([ +'\x13\x13\x13\x13\x13\x13\x13\x13\x13\x13\x13\x04\x04\x04\t\x0f\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\x13\x03\n\x10\x0e\x0b\x11\x13\x08\x08\x08\x08\x08\r\r\r\r\r\r\r\r\r\r\r' +'\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\x00\x00\x00\x00\r\x00\x00\x00\x00\x00\x00\x00\x13\x04\x04\x04\x04\x00\x00\x00\x00\x00\x00\x04\x04\x04\x04\x04\x04\x06\t\x00\x00\x06\x06\x06\x06\x06\x06\x08\x08\r\r\r\t' +'\x06\x06\x06\x06\x06\x06\x06\x06\x06\x06\x08\x08\r\r\r\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +]), +"".join([ +'\r\r\t\r\r\r\r\t\r\r\t\t\t\t\t\t\t\t\t\t\r\t\r\r\r\t\t\t\t\t\r\r\r\r\r\r\t\r\t\r\t\r\t\t\t\t\x08\t\t\t\r\t\t\t\t\t\t\t\r\x00\x00\t\t\t' +'\r\r\r\r\r\t\t\t\t\t\r\r\x00\x00\x00\x00\x00\x00\x00\r\r\r\r\r\r\r\r\r\r\r\r\r\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t' +'\t\t\t\t\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r' +'\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r' +]), +"".join([ +'\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\x08\x08\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r' +'\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r' +'\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r' +'\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r' +]), +"".join([ +'\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\t\t\t\t\t\t\t\t\t\t' +'\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\r\r\r\r' +'\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\t\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r' +'\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +]), +"".join([ +'\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +'\r\r\r\r\r\r\r\r\r\r\r\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x06\x06\x06\x06\x06\x06\x06\x06\x06\x06\x06\x06\x06\x06\x06\x06\x06\x06\x06\x06\x06\x06\x06\x06\x06\x06\x06\x06\x06\x06\x06\x06' +'\x06\x06\x06\x06\x06\x06\x06\x06\x06\x06\x06\x06\x06\x06\x06\x06\x06\x06\x06\x06\x06\x06\x06\x06\x06\x06\x06\x06\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t' +'\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\x06\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\x00' +]), +"".join([ +'\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r' +'\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r' +'\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r' +'\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r' +]), +"".join([ +'\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\x00\x00\r\r\x00\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r' +'\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\x00\x00' +'\r\r\r\r\r\r\r\r\r\r\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +]), +"".join([ +'\x00\r\r\r\r\x00\r\r\r\r\x00\x00\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\x00\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r' +'\r\r\r\r\r\r\r\r\r\r\r\r\x00\r\x00\r\r\r\r\x00\x00\x00\r\x00\r\r\r\r\r\r\r\x00\x00\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r' +'\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\x00\x00\x00\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\x00\r\r\r\r\r\r\r\r\r\r\r\r\r\r\x00' +'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\x00\x00\x00\x00\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r' +]), +"".join([ +'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +'\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\x00\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r' +'\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +]), +"".join([ +'\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r' +'\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r' +'\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r' +'\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\r\r\r\r\r\r\r\r\r\r\r\r\x00\x00\x00\x00' +]), +"".join([ +'\x13\r\r\r\r\t\t\t\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\t\t\t\t\t\t\t\t\t\x0c\x0c\x0c\x0c\x0c\x0c\r\t\t\t\t\t\r\r\t\t\t\t\t\r\r\r' +'\x00\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t' +'\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\x00\x00\x0c\x0c\r\r\t\t\t\r\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t' +'\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\t\t\t\t' +]), +"".join([ +'\x00\x00\x00\x00\x00\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\x00\x00\x00\x00\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t' +'\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t' +'\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\x00\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\x00\x00\x00\x00\x00\x00\x00\x00' +'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t' +]), +"".join([ +'\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\x00\x00\x00\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t' +'\t\t\t\t\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\x00\x00\x00\t' +'\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r' +'\t\t\t\t\t\t\t\t\t\t\t\t\x00\x00\x00\x00\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\x00' +]), +"".join([ +'\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t' +'\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\x00\x00\x00\x00\t\t\t\t\t' +'\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t' +'\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\x00\x00\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\x00' +]), +"".join([ +'\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t' +'\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t' +'\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +]), +"".join([ +'\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t' +'\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t' +'\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +]), +"".join([ +'\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t' +'\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t' +'\t\t\t\t\t\t\t\t\t\t\t\t\t\x00\x00\x00\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r' +'\r\r\r\r\r\r\r\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +]), +"".join([ +'\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t' +'\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t' +'\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +]), +"".join([ +'\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\x00\x00\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t' +'\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +]), +"".join([ +'\t\t\t\t\t\t\t\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\t\t\t\t\t\x00\x00\x00\x00\x00\x0f\x0c\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x08\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x00\x0f\x0f\x0f\x0f\x0f\x00\x0f\x00' +'\x0f\x0f\x00\x0f\x0f\x00\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01' +'\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01' +]), +"".join([ +'\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01' +'\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01' +'\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01' +'\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01' +]), +"".join([ +'\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\r\r' +'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01' +'\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x00\x00\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01' +'\x01\x01\x01\x01\x01\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x00\x00\x00' +]), +"".join([ +'\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0c\x0c\x0c\x0c\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r' +'\r\r\r\r\r\r\r\x00\x00\r\r\r\r\r\r\r\x05\r\x05\x00\r\x05\r\r\r\r\r\r\r\r\r\x08\r\r\x08\x08\r\r\r\x00\r\x08\x08\r\x00\x00\x00\x00\x01\x01\x01\x01\x01\x00\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01' +'\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01' +'\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x00\x00\x04' +]), +"".join([ +'\x00\r\r\x08\x08\x08\r\r\r\r\r\x08\x05\x08\x05\x07\x06\x06\x06\x06\x06\x06\x06\x06\x06\x06\x05\r\r\r\r\r\r\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\r\r\r\r' +'\r\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\r\r\r\r\r\r\r\r\r\r\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t' +'\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\x00' +'\x00\x00\t\t\t\t\t\t\x00\x00\t\t\t\t\t\t\x00\x00\t\t\t\t\t\t\x00\x00\t\t\t\x00\x00\x00\x08\x08\r\r\r\x08\x08\x00\r\r\r\r\r\r\r\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04\x04\x04\r\r\x00\x00' +]), +"".join([ +'\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\x00\t\t\t\t\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t' +'\t\t\t\t\t\t\t\t\t\t\t\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +]), +"".join([ +'\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\x00\x00\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t' +'\t\t\t\t\t\t\t\t\t\t\t\t\t\t\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +]), +"".join([ +'\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t' +'\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t' +'\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t' +'\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +]), +"".join([ +'\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\x00\x00\x00\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t' +'\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\x0c\x0c\x0c\t\t\t\t\t\t\t\t\t\x04\x04\x04\x04\x04\x04\x04\x04\x0c\x0c\x0c\x0c\x0c' +'\x0c\x0c\x0c\t\t\x0c\x0c\x0c\x0c\x0c\x0c\x0c\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\x0c\x0c\x0c\x0c\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t' +'\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +]), +"".join([ +'\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t' +'\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\x00\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t' +'\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\x00\t\t\x00\x00\t\x00\x00\t\t\x00\x00\t\t\t\t\x00\t\t\t\t\t\t\t\t\t\t\t\t\x00\t\x00\t\t\t' +'\t\x00\t\t\x00\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t' +]), +"".join([ +'\t\t\t\t\t\t\x00\t\t\t\t\x00\x00\t\t\t\t\t\t\t\t\x00\t\t\t\t\t\t\t\x00\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\x00\t\t\t\t\x00' +'\t\t\t\t\t\x00\t\x00\x00\x00\t\t\t\t\t\t\t\x00\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t' +'\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t' +'\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t' +]), +"".join([ +'\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t' +'\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t' +'\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\x00\x00\x00\x00\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t' +'\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t' +]), +"".join([ +'\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t' +'\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t' +'\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t' +'\t\t\t\t\t\t\t\t\t\t\x00\x00\x00\x00\x06\x06\x06\x06\x06\x06\x06\x06\x06\x06\x06\x06\x06\x06\x06\x06\x06\x06\x06\x06\x06\x06\x06\x06\x06\x06\x06\x06\x06\x06\x06\x06\x06\x06\x06\x06\x06\x06\x06\x06\x06\x06\x06\x06\x06\x06\x06\x06\x06\x06' +]), +"".join([ +'\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t' +'\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t' +'\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t' +'\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +]), +"".join([ +'\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +]), +"".join([ +'\x00\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04' +'\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04' +'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +]), +"".join([ +'\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t' +'\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t' +'\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t' +'\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\x00\x00' +]), +) + +def bidirectional(code): + return _bidirectional_names[ord(_bidirectional[ord(_bidirectional_pgtbl[code >> 8])][code & 255])] + + +def isspace(code): + return category(code) == "Zs" or bidirectional(code) in ("WS", "B", "S") +def islower(code): + return category(code) == "Ll" +def isupper(code): + return category(code) == "Lu" +def istitle(code): + return category(code) == "Lt" +def iscased(code): + return category(code) in ("Ll", "Lu", "Lt") +def isalpha(code): + return category(code) in ("Lm", "Lt", "Lu", "Ll", "Lo") +def islinebreak(code): + return category(code) == "Zl" or bidirectional(code) == "B" + +_decimal = { +48: 0, +49: 1, +50: 2, +51: 3, +52: 4, +53: 5, +54: 6, +55: 7, +56: 8, +57: 9, +178: 2, +179: 3, +185: 1, +1632: 0, +1633: 1, +1634: 2, +1635: 3, +1636: 4, +1637: 5, +1638: 6, +1639: 7, +1640: 8, +1641: 9, +1776: 0, +1777: 1, +1778: 2, +1779: 3, +1780: 4, +1781: 5, +1782: 6, +1783: 7, +1784: 8, +1785: 9, +2406: 0, +2407: 1, +2408: 2, +2409: 3, +2410: 4, +2411: 5, +2412: 6, +2413: 7, +2414: 8, +2415: 9, +2534: 0, +2535: 1, +2536: 2, +2537: 3, +2538: 4, +2539: 5, +2540: 6, +2541: 7, +2542: 8, +2543: 9, +2662: 0, +2663: 1, +2664: 2, +2665: 3, +2666: 4, +2667: 5, +2668: 6, +2669: 7, +2670: 8, +2671: 9, +2790: 0, +2791: 1, +2792: 2, +2793: 3, +2794: 4, +2795: 5, +2796: 6, +2797: 7, +2798: 8, +2799: 9, +2918: 0, +2919: 1, +2920: 2, +2921: 3, +2922: 4, +2923: 5, +2924: 6, +2925: 7, +2926: 8, +2927: 9, +3047: 1, +3048: 2, +3049: 3, +3050: 4, +3051: 5, +3052: 6, +3053: 7, +3054: 8, +3055: 9, +3174: 0, +3175: 1, +3176: 2, +3177: 3, +3178: 4, +3179: 5, +3180: 6, +3181: 7, +3182: 8, +3183: 9, +3302: 0, +3303: 1, +3304: 2, +3305: 3, +3306: 4, +3307: 5, +3308: 6, +3309: 7, +3310: 8, +3311: 9, +3430: 0, +3431: 1, +3432: 2, +3433: 3, +3434: 4, +3435: 5, +3436: 6, +3437: 7, +3438: 8, +3439: 9, +3664: 0, +3665: 1, +3666: 2, +3667: 3, +3668: 4, +3669: 5, +3670: 6, +3671: 7, +3672: 8, +3673: 9, +3792: 0, +3793: 1, +3794: 2, +3795: 3, +3796: 4, +3797: 5, +3798: 6, +3799: 7, +3800: 8, +3801: 9, +3872: 0, +3873: 1, +3874: 2, +3875: 3, +3876: 4, +3877: 5, +3878: 6, +3879: 7, +3880: 8, +3881: 9, +4160: 0, +4161: 1, +4162: 2, +4163: 3, +4164: 4, +4165: 5, +4166: 6, +4167: 7, +4168: 8, +4169: 9, +4969: 1, +4970: 2, +4971: 3, +4972: 4, +4973: 5, +4974: 6, +4975: 7, +4976: 8, +4977: 9, +6112: 0, +6113: 1, +6114: 2, +6115: 3, +6116: 4, +6117: 5, +6118: 6, +6119: 7, +6120: 8, +6121: 9, +6160: 0, +6161: 1, +6162: 2, +6163: 3, +6164: 4, +6165: 5, +6166: 6, +6167: 7, +6168: 8, +6169: 9, +8304: 0, +8308: 4, +8309: 5, +8310: 6, +8311: 7, +8312: 8, +8313: 9, +8320: 0, +8321: 1, +8322: 2, +8323: 3, +8324: 4, +8325: 5, +8326: 6, +8327: 7, +8328: 8, +8329: 9, +65296: 0, +65297: 1, +65298: 2, +65299: 3, +65300: 4, +65301: 5, +65302: 6, +65303: 7, +65304: 8, +65305: 9, +120782: 0, +120783: 1, +120784: 2, +120785: 3, +120786: 4, +120787: 5, +120788: 6, +120789: 7, +120790: 8, +120791: 9, +120792: 0, +120793: 1, +120794: 2, +120795: 3, +120796: 4, +120797: 5, +120798: 6, +120799: 7, +120800: 8, +120801: 9, +120802: 0, +120803: 1, +120804: 2, +120805: 3, +120806: 4, +120807: 5, +120808: 6, +120809: 7, +120810: 8, +120811: 9, +120812: 0, +120813: 1, +120814: 2, +120815: 3, +120816: 4, +120817: 5, +120818: 6, +120819: 7, +120820: 8, +120821: 9, +120822: 0, +120823: 1, +120824: 2, +120825: 3, +120826: 4, +120827: 5, +120828: 6, +120829: 7, +120830: 8, +120831: 9, +} + +_digit = { +48: 0, +49: 1, +50: 2, +51: 3, +52: 4, +53: 5, +54: 6, +55: 7, +56: 8, +57: 9, +178: 2, +179: 3, +185: 1, +1632: 0, +1633: 1, +1634: 2, +1635: 3, +1636: 4, +1637: 5, +1638: 6, +1639: 7, +1640: 8, +1641: 9, +1776: 0, +1777: 1, +1778: 2, +1779: 3, +1780: 4, +1781: 5, +1782: 6, +1783: 7, +1784: 8, +1785: 9, +2406: 0, +2407: 1, +2408: 2, +2409: 3, +2410: 4, +2411: 5, +2412: 6, +2413: 7, +2414: 8, +2415: 9, +2534: 0, +2535: 1, +2536: 2, +2537: 3, +2538: 4, +2539: 5, +2540: 6, +2541: 7, +2542: 8, +2543: 9, +2662: 0, +2663: 1, +2664: 2, +2665: 3, +2666: 4, +2667: 5, +2668: 6, +2669: 7, +2670: 8, +2671: 9, +2790: 0, +2791: 1, +2792: 2, +2793: 3, +2794: 4, +2795: 5, +2796: 6, +2797: 7, +2798: 8, +2799: 9, +2918: 0, +2919: 1, +2920: 2, +2921: 3, +2922: 4, +2923: 5, +2924: 6, +2925: 7, +2926: 8, +2927: 9, +3047: 1, +3048: 2, +3049: 3, +3050: 4, +3051: 5, +3052: 6, +3053: 7, +3054: 8, +3055: 9, +3174: 0, +3175: 1, +3176: 2, +3177: 3, +3178: 4, +3179: 5, +3180: 6, +3181: 7, +3182: 8, +3183: 9, +3302: 0, +3303: 1, +3304: 2, +3305: 3, +3306: 4, +3307: 5, +3308: 6, +3309: 7, +3310: 8, +3311: 9, +3430: 0, +3431: 1, +3432: 2, +3433: 3, +3434: 4, +3435: 5, +3436: 6, +3437: 7, +3438: 8, +3439: 9, +3664: 0, +3665: 1, +3666: 2, +3667: 3, +3668: 4, +3669: 5, +3670: 6, +3671: 7, +3672: 8, +3673: 9, +3792: 0, +3793: 1, +3794: 2, +3795: 3, +3796: 4, +3797: 5, +3798: 6, +3799: 7, +3800: 8, +3801: 9, +3872: 0, +3873: 1, +3874: 2, +3875: 3, +3876: 4, +3877: 5, +3878: 6, +3879: 7, +3880: 8, +3881: 9, +4160: 0, +4161: 1, +4162: 2, +4163: 3, +4164: 4, +4165: 5, +4166: 6, +4167: 7, +4168: 8, +4169: 9, +4969: 1, +4970: 2, +4971: 3, +4972: 4, +4973: 5, +4974: 6, +4975: 7, +4976: 8, +4977: 9, +6112: 0, +6113: 1, +6114: 2, +6115: 3, +6116: 4, +6117: 5, +6118: 6, +6119: 7, +6120: 8, +6121: 9, +6160: 0, +6161: 1, +6162: 2, +6163: 3, +6164: 4, +6165: 5, +6166: 6, +6167: 7, +6168: 8, +6169: 9, +8304: 0, +8308: 4, +8309: 5, +8310: 6, +8311: 7, +8312: 8, +8313: 9, +8320: 0, +8321: 1, +8322: 2, +8323: 3, +8324: 4, +8325: 5, +8326: 6, +8327: 7, +8328: 8, +8329: 9, +9312: 1, +9313: 2, +9314: 3, +9315: 4, +9316: 5, +9317: 6, +9318: 7, +9319: 8, +9320: 9, +9332: 1, +9333: 2, +9334: 3, +9335: 4, +9336: 5, +9337: 6, +9338: 7, +9339: 8, +9340: 9, +9352: 1, +9353: 2, +9354: 3, +9355: 4, +9356: 5, +9357: 6, +9358: 7, +9359: 8, +9360: 9, +9450: 0, +9461: 1, +9462: 2, +9463: 3, +9464: 4, +9465: 5, +9466: 6, +9467: 7, +9468: 8, +9469: 9, +10102: 1, +10103: 2, +10104: 3, +10105: 4, +10106: 5, +10107: 6, +10108: 7, +10109: 8, +10110: 9, +10112: 1, +10113: 2, +10114: 3, +10115: 4, +10116: 5, +10117: 6, +10118: 7, +10119: 8, +10120: 9, +10122: 1, +10123: 2, +10124: 3, +10125: 4, +10126: 5, +10127: 6, +10128: 7, +10129: 8, +10130: 9, +65296: 0, +65297: 1, +65298: 2, +65299: 3, +65300: 4, +65301: 5, +65302: 6, +65303: 7, +65304: 8, +65305: 9, +120782: 0, +120783: 1, +120784: 2, +120785: 3, +120786: 4, +120787: 5, +120788: 6, +120789: 7, +120790: 8, +120791: 9, +120792: 0, +120793: 1, +120794: 2, +120795: 3, +120796: 4, +120797: 5, +120798: 6, +120799: 7, +120800: 8, +120801: 9, +120802: 0, +120803: 1, +120804: 2, +120805: 3, +120806: 4, +120807: 5, +120808: 6, +120809: 7, +120810: 8, +120811: 9, +120812: 0, +120813: 1, +120814: 2, +120815: 3, +120816: 4, +120817: 5, +120818: 6, +120819: 7, +120820: 8, +120821: 9, +120822: 0, +120823: 1, +120824: 2, +120825: 3, +120826: 4, +120827: 5, +120828: 6, +120829: 7, +120830: 8, +120831: 9, +} + +_numeric = { +48: 0.0, +49: 1.0, +50: 2.0, +51: 3.0, +52: 4.0, +53: 5.0, +54: 6.0, +55: 7.0, +56: 8.0, +57: 9.0, +178: 2.0, +179: 3.0, +185: 1.0, +188: 0.25, +189: 0.5, +190: 0.75, +1632: 0.0, +1633: 1.0, +1634: 2.0, +1635: 3.0, +1636: 4.0, +1637: 5.0, +1638: 6.0, +1639: 7.0, +1640: 8.0, +1641: 9.0, +1776: 0.0, +1777: 1.0, +1778: 2.0, +1779: 3.0, +1780: 4.0, +1781: 5.0, +1782: 6.0, +1783: 7.0, +1784: 8.0, +1785: 9.0, +2406: 0.0, +2407: 1.0, +2408: 2.0, +2409: 3.0, +2410: 4.0, +2411: 5.0, +2412: 6.0, +2413: 7.0, +2414: 8.0, +2415: 9.0, +2534: 0.0, +2535: 1.0, +2536: 2.0, +2537: 3.0, +2538: 4.0, +2539: 5.0, +2540: 6.0, +2541: 7.0, +2542: 8.0, +2543: 9.0, +2548: 1.0, +2549: 2.0, +2550: 3.0, +2551: 4.0, +2553: 16.0, +2662: 0.0, +2663: 1.0, +2664: 2.0, +2665: 3.0, +2666: 4.0, +2667: 5.0, +2668: 6.0, +2669: 7.0, +2670: 8.0, +2671: 9.0, +2790: 0.0, +2791: 1.0, +2792: 2.0, +2793: 3.0, +2794: 4.0, +2795: 5.0, +2796: 6.0, +2797: 7.0, +2798: 8.0, +2799: 9.0, +2918: 0.0, +2919: 1.0, +2920: 2.0, +2921: 3.0, +2922: 4.0, +2923: 5.0, +2924: 6.0, +2925: 7.0, +2926: 8.0, +2927: 9.0, +3047: 1.0, +3048: 2.0, +3049: 3.0, +3050: 4.0, +3051: 5.0, +3052: 6.0, +3053: 7.0, +3054: 8.0, +3055: 9.0, +3056: 10.0, +3057: 100.0, +3058: 1000.0, +3174: 0.0, +3175: 1.0, +3176: 2.0, +3177: 3.0, +3178: 4.0, +3179: 5.0, +3180: 6.0, +3181: 7.0, +3182: 8.0, +3183: 9.0, +3302: 0.0, +3303: 1.0, +3304: 2.0, +3305: 3.0, +3306: 4.0, +3307: 5.0, +3308: 6.0, +3309: 7.0, +3310: 8.0, +3311: 9.0, +3430: 0.0, +3431: 1.0, +3432: 2.0, +3433: 3.0, +3434: 4.0, +3435: 5.0, +3436: 6.0, +3437: 7.0, +3438: 8.0, +3439: 9.0, +3664: 0.0, +3665: 1.0, +3666: 2.0, +3667: 3.0, +3668: 4.0, +3669: 5.0, +3670: 6.0, +3671: 7.0, +3672: 8.0, +3673: 9.0, +3792: 0.0, +3793: 1.0, +3794: 2.0, +3795: 3.0, +3796: 4.0, +3797: 5.0, +3798: 6.0, +3799: 7.0, +3800: 8.0, +3801: 9.0, +3872: 0.0, +3873: 1.0, +3874: 2.0, +3875: 3.0, +3876: 4.0, +3877: 5.0, +3878: 6.0, +3879: 7.0, +3880: 8.0, +3881: 9.0, +3882: 0.5, +3883: 1.5, +3884: 2.5, +3885: 3.5, +3886: 4.5, +3887: 5.5, +3888: 6.5, +3889: 7.5, +3890: 8.5, +3891: -0.5, +4160: 0.0, +4161: 1.0, +4162: 2.0, +4163: 3.0, +4164: 4.0, +4165: 5.0, +4166: 6.0, +4167: 7.0, +4168: 8.0, +4169: 9.0, +4969: 1.0, +4970: 2.0, +4971: 3.0, +4972: 4.0, +4973: 5.0, +4974: 6.0, +4975: 7.0, +4976: 8.0, +4977: 9.0, +4978: 10.0, +4979: 20.0, +4980: 30.0, +4981: 40.0, +4982: 50.0, +4983: 60.0, +4984: 70.0, +4985: 80.0, +4986: 90.0, +4987: 100.0, +4988: 10000.0, +5870: 17.0, +5871: 18.0, +5872: 19.0, +6112: 0.0, +6113: 1.0, +6114: 2.0, +6115: 3.0, +6116: 4.0, +6117: 5.0, +6118: 6.0, +6119: 7.0, +6120: 8.0, +6121: 9.0, +6160: 0.0, +6161: 1.0, +6162: 2.0, +6163: 3.0, +6164: 4.0, +6165: 5.0, +6166: 6.0, +6167: 7.0, +6168: 8.0, +6169: 9.0, +8304: 0.0, +8308: 4.0, +8309: 5.0, +8310: 6.0, +8311: 7.0, +8312: 8.0, +8313: 9.0, +8320: 0.0, +8321: 1.0, +8322: 2.0, +8323: 3.0, +8324: 4.0, +8325: 5.0, +8326: 6.0, +8327: 7.0, +8328: 8.0, +8329: 9.0, +8531: 0.33333333333333331, +8532: 0.66666666666666663, +8533: 0.20000000000000001, +8534: 0.40000000000000002, +8535: 0.59999999999999998, +8536: 0.80000000000000004, +8537: 0.16666666666666666, +8538: 0.83333333333333337, +8539: 0.125, +8540: 0.375, +8541: 0.625, +8542: 0.875, +8543: 1.0, +8544: 1.0, +8545: 2.0, +8546: 3.0, +8547: 4.0, +8548: 5.0, +8549: 6.0, +8550: 7.0, +8551: 8.0, +8552: 9.0, +8553: 10.0, +8554: 11.0, +8555: 12.0, +8556: 50.0, +8557: 100.0, +8558: 500.0, +8559: 1000.0, +8560: 1.0, +8561: 2.0, +8562: 3.0, +8563: 4.0, +8564: 5.0, +8565: 6.0, +8566: 7.0, +8567: 8.0, +8568: 9.0, +8569: 10.0, +8570: 11.0, +8571: 12.0, +8572: 50.0, +8573: 100.0, +8574: 500.0, +8575: 1000.0, +8576: 1000.0, +8577: 5000.0, +8578: 10000.0, +9312: 1.0, +9313: 2.0, +9314: 3.0, +9315: 4.0, +9316: 5.0, +9317: 6.0, +9318: 7.0, +9319: 8.0, +9320: 9.0, +9321: 10.0, +9322: 11.0, +9323: 12.0, +9324: 13.0, +9325: 14.0, +9326: 15.0, +9327: 16.0, +9328: 17.0, +9329: 18.0, +9330: 19.0, +9331: 20.0, +9332: 1.0, +9333: 2.0, +9334: 3.0, +9335: 4.0, +9336: 5.0, +9337: 6.0, +9338: 7.0, +9339: 8.0, +9340: 9.0, +9341: 10.0, +9342: 11.0, +9343: 12.0, +9344: 13.0, +9345: 14.0, +9346: 15.0, +9347: 16.0, +9348: 17.0, +9349: 18.0, +9350: 19.0, +9351: 20.0, +9352: 1.0, +9353: 2.0, +9354: 3.0, +9355: 4.0, +9356: 5.0, +9357: 6.0, +9358: 7.0, +9359: 8.0, +9360: 9.0, +9361: 10.0, +9362: 11.0, +9363: 12.0, +9364: 13.0, +9365: 14.0, +9366: 15.0, +9367: 16.0, +9368: 17.0, +9369: 18.0, +9370: 19.0, +9371: 20.0, +9450: 0.0, +9451: 11.0, +9452: 12.0, +9453: 13.0, +9454: 14.0, +9455: 15.0, +9456: 16.0, +9457: 17.0, +9458: 18.0, +9459: 19.0, +9460: 20.0, +9461: 1.0, +9462: 2.0, +9463: 3.0, +9464: 4.0, +9465: 5.0, +9466: 6.0, +9467: 7.0, +9468: 8.0, +9469: 9.0, +9470: 10.0, +10102: 1.0, +10103: 2.0, +10104: 3.0, +10105: 4.0, +10106: 5.0, +10107: 6.0, +10108: 7.0, +10109: 8.0, +10110: 9.0, +10111: 10.0, +10112: 1.0, +10113: 2.0, +10114: 3.0, +10115: 4.0, +10116: 5.0, +10117: 6.0, +10118: 7.0, +10119: 8.0, +10120: 9.0, +10121: 10.0, +10122: 1.0, +10123: 2.0, +10124: 3.0, +10125: 4.0, +10126: 5.0, +10127: 6.0, +10128: 7.0, +10129: 8.0, +10130: 9.0, +10131: 10.0, +12295: 0.0, +12321: 1.0, +12322: 2.0, +12323: 3.0, +12324: 4.0, +12325: 5.0, +12326: 6.0, +12327: 7.0, +12328: 8.0, +12329: 9.0, +12344: 10.0, +12345: 20.0, +12346: 30.0, +12690: 1.0, +12691: 2.0, +12692: 3.0, +12693: 4.0, +12832: 1.0, +12833: 2.0, +12834: 3.0, +12835: 4.0, +12836: 5.0, +12837: 6.0, +12838: 7.0, +12839: 8.0, +12840: 9.0, +12841: 10.0, +12881: 21.0, +12882: 22.0, +12883: 23.0, +12884: 24.0, +12885: 25.0, +12886: 26.0, +12887: 27.0, +12888: 28.0, +12889: 29.0, +12890: 30.0, +12891: 31.0, +12892: 32.0, +12893: 33.0, +12894: 34.0, +12895: 35.0, +12928: 1.0, +12929: 2.0, +12930: 3.0, +12931: 4.0, +12932: 5.0, +12933: 6.0, +12934: 7.0, +12935: 8.0, +12936: 9.0, +12937: 10.0, +12977: 36.0, +12978: 37.0, +12979: 38.0, +12980: 39.0, +12981: 40.0, +12982: 41.0, +12983: 42.0, +12984: 43.0, +12985: 44.0, +12986: 45.0, +12987: 46.0, +12988: 47.0, +12989: 48.0, +12990: 49.0, +12991: 50.0, +65296: 0.0, +65297: 1.0, +65298: 2.0, +65299: 3.0, +65300: 4.0, +65301: 5.0, +65302: 6.0, +65303: 7.0, +65304: 8.0, +65305: 9.0, +66336: 1.0, +66337: 5.0, +66338: 10.0, +66339: 50.0, +120782: 0.0, +120783: 1.0, +120784: 2.0, +120785: 3.0, +120786: 4.0, +120787: 5.0, +120788: 6.0, +120789: 7.0, +120790: 8.0, +120791: 9.0, +120792: 0.0, +120793: 1.0, +120794: 2.0, +120795: 3.0, +120796: 4.0, +120797: 5.0, +120798: 6.0, +120799: 7.0, +120800: 8.0, +120801: 9.0, +120802: 0.0, +120803: 1.0, +120804: 2.0, +120805: 3.0, +120806: 4.0, +120807: 5.0, +120808: 6.0, +120809: 7.0, +120810: 8.0, +120811: 9.0, +120812: 0.0, +120813: 1.0, +120814: 2.0, +120815: 3.0, +120816: 4.0, +120817: 5.0, +120818: 6.0, +120819: 7.0, +120820: 8.0, +120821: 9.0, +120822: 0.0, +120823: 1.0, +120824: 2.0, +120825: 3.0, +120826: 4.0, +120827: 5.0, +120828: 6.0, +120829: 7.0, +120830: 8.0, +120831: 9.0, +} + + +def decimal(code): + return _decimal[code] + +def isdecimal(code): + return _decimal.has_key(code) + +def digit(code): + return _digit[code] + +def isdigit(code): + return _digit.has_key(code) + +def numeric(code): + return _numeric[code] + +def isnumeric(code): + return _numeric.has_key(code) + + +_combining = { +768: 230, +769: 230, +770: 230, +771: 230, +772: 230, +773: 230, +774: 230, +775: 230, +776: 230, +777: 230, +778: 230, +779: 230, +780: 230, +781: 230, +782: 230, +783: 230, +784: 230, +785: 230, +786: 230, +787: 230, +788: 230, +789: 232, +790: 220, +791: 220, +792: 220, +793: 220, +794: 232, +795: 216, +796: 220, +797: 220, +798: 220, +799: 220, +800: 220, +801: 202, +802: 202, +803: 220, +804: 220, +805: 220, +806: 220, +807: 202, +808: 202, +809: 220, +810: 220, +811: 220, +812: 220, +813: 220, +814: 220, +815: 220, +816: 220, +817: 220, +818: 220, +819: 220, +820: 1, +821: 1, +822: 1, +823: 1, +824: 1, +825: 220, +826: 220, +827: 220, +828: 220, +829: 230, +830: 230, +831: 230, +832: 230, +833: 230, +834: 230, +835: 230, +836: 230, +837: 240, +838: 230, +839: 220, +840: 220, +841: 220, +842: 230, +843: 230, +844: 230, +845: 220, +846: 220, +864: 234, +865: 234, +866: 233, +867: 230, +868: 230, +869: 230, +870: 230, +871: 230, +872: 230, +873: 230, +874: 230, +875: 230, +876: 230, +877: 230, +878: 230, +879: 230, +1155: 230, +1156: 230, +1157: 230, +1158: 230, +1425: 220, +1426: 230, +1427: 230, +1428: 230, +1429: 230, +1430: 220, +1431: 230, +1432: 230, +1433: 230, +1434: 222, +1435: 220, +1436: 230, +1437: 230, +1438: 230, +1439: 230, +1440: 230, +1441: 230, +1443: 220, +1444: 220, +1445: 220, +1446: 220, +1447: 220, +1448: 230, +1449: 230, +1450: 220, +1451: 230, +1452: 230, +1453: 222, +1454: 228, +1455: 230, +1456: 10, +1457: 11, +1458: 12, +1459: 13, +1460: 14, +1461: 15, +1462: 16, +1463: 17, +1464: 18, +1465: 19, +1467: 20, +1468: 21, +1469: 22, +1471: 23, +1473: 24, +1474: 25, +1476: 230, +1611: 27, +1612: 28, +1613: 29, +1614: 30, +1615: 31, +1616: 32, +1617: 33, +1618: 34, +1619: 230, +1620: 230, +1621: 220, +1648: 35, +1750: 230, +1751: 230, +1752: 230, +1753: 230, +1754: 230, +1755: 230, +1756: 230, +1759: 230, +1760: 230, +1761: 230, +1762: 230, +1763: 220, +1764: 230, +1767: 230, +1768: 230, +1770: 220, +1771: 230, +1772: 230, +1773: 220, +1809: 36, +1840: 230, +1841: 220, +1842: 230, +1843: 230, +1844: 220, +1845: 230, +1846: 230, +1847: 220, +1848: 220, +1849: 220, +1850: 230, +1851: 220, +1852: 220, +1853: 230, +1854: 220, +1855: 230, +1856: 230, +1857: 230, +1858: 220, +1859: 230, +1860: 220, +1861: 230, +1862: 220, +1863: 230, +1864: 220, +1865: 230, +1866: 230, +2364: 7, +2381: 9, +2385: 230, +2386: 220, +2387: 230, +2388: 230, +2492: 7, +2509: 9, +2620: 7, +2637: 9, +2748: 7, +2765: 9, +2876: 7, +2893: 9, +3021: 9, +3149: 9, +3157: 84, +3158: 91, +3277: 9, +3405: 9, +3530: 9, +3640: 103, +3641: 103, +3642: 9, +3656: 107, +3657: 107, +3658: 107, +3659: 107, +3768: 118, +3769: 118, +3784: 122, +3785: 122, +3786: 122, +3787: 122, +3864: 220, +3865: 220, +3893: 220, +3895: 220, +3897: 216, +3953: 129, +3954: 130, +3956: 132, +3962: 130, +3963: 130, +3964: 130, +3965: 130, +3968: 130, +3970: 230, +3971: 230, +3972: 9, +3974: 230, +3975: 230, +4038: 220, +4151: 7, +4153: 9, +5908: 9, +5940: 9, +6098: 9, +6313: 228, +8400: 230, +8401: 230, +8402: 1, +8403: 1, +8404: 230, +8405: 230, +8406: 230, +8407: 230, +8408: 1, +8409: 1, +8410: 1, +8411: 230, +8412: 230, +8417: 230, +8421: 1, +8422: 1, +8423: 230, +8424: 220, +8425: 230, +8426: 1, +12330: 218, +12331: 228, +12332: 232, +12333: 222, +12334: 224, +12335: 224, +12441: 8, +12442: 8, +64286: 26, +65056: 230, +65057: 230, +65058: 230, +65059: 230, +119141: 216, +119142: 216, +119143: 1, +119144: 1, +119145: 1, +119149: 226, +119150: 216, +119151: 216, +119152: 216, +119153: 216, +119154: 216, +119163: 220, +119164: 220, +119165: 220, +119166: 220, +119167: 220, +119168: 220, +119169: 220, +119170: 220, +119173: 230, +119174: 230, +119175: 230, +119176: 230, +119177: 230, +119178: 220, +119179: 220, +119210: 230, +119211: 230, +119212: 230, +119213: 230, +} + + +def combining(code): + return _combining.get(code, 0) + + +_mirrored = { +40: 1, +41: 1, +60: 1, +62: 1, +91: 1, +93: 1, +123: 1, +125: 1, +171: 1, +187: 1, +8249: 1, +8250: 1, +8261: 1, +8262: 1, +8317: 1, +8318: 1, +8333: 1, +8334: 1, +8512: 1, +8705: 1, +8706: 1, +8707: 1, +8708: 1, +8712: 1, +8713: 1, +8714: 1, +8715: 1, +8716: 1, +8717: 1, +8721: 1, +8725: 1, +8726: 1, +8730: 1, +8731: 1, +8732: 1, +8733: 1, +8735: 1, +8736: 1, +8737: 1, +8738: 1, +8740: 1, +8742: 1, +8747: 1, +8748: 1, +8749: 1, +8750: 1, +8751: 1, +8752: 1, +8753: 1, +8754: 1, +8755: 1, +8761: 1, +8763: 1, +8764: 1, +8765: 1, +8766: 1, +8767: 1, +8768: 1, +8769: 1, +8770: 1, +8771: 1, +8772: 1, +8773: 1, +8774: 1, +8775: 1, +8776: 1, +8777: 1, +8778: 1, +8779: 1, +8780: 1, +8786: 1, +8787: 1, +8788: 1, +8789: 1, +8799: 1, +8800: 1, +8802: 1, +8804: 1, +8805: 1, +8806: 1, +8807: 1, +8808: 1, +8809: 1, +8810: 1, +8811: 1, +8814: 1, +8815: 1, +8816: 1, +8817: 1, +8818: 1, +8819: 1, +8820: 1, +8821: 1, +8822: 1, +8823: 1, +8824: 1, +8825: 1, +8826: 1, +8827: 1, +8828: 1, +8829: 1, +8830: 1, +8831: 1, +8832: 1, +8833: 1, +8834: 1, +8835: 1, +8836: 1, +8837: 1, +8838: 1, +8839: 1, +8840: 1, +8841: 1, +8842: 1, +8843: 1, +8844: 1, +8847: 1, +8848: 1, +8849: 1, +8850: 1, +8856: 1, +8866: 1, +8867: 1, +8870: 1, +8871: 1, +8872: 1, +8873: 1, +8874: 1, +8875: 1, +8876: 1, +8877: 1, +8878: 1, +8879: 1, +8880: 1, +8881: 1, +8882: 1, +8883: 1, +8884: 1, +8885: 1, +8886: 1, +8887: 1, +8888: 1, +8894: 1, +8895: 1, +8905: 1, +8906: 1, +8907: 1, +8908: 1, +8909: 1, +8912: 1, +8913: 1, +8918: 1, +8919: 1, +8920: 1, +8921: 1, +8922: 1, +8923: 1, +8924: 1, +8925: 1, +8926: 1, +8927: 1, +8928: 1, +8929: 1, +8930: 1, +8931: 1, +8932: 1, +8933: 1, +8934: 1, +8935: 1, +8936: 1, +8937: 1, +8938: 1, +8939: 1, +8940: 1, +8941: 1, +8944: 1, +8945: 1, +8946: 1, +8947: 1, +8948: 1, +8949: 1, +8950: 1, +8951: 1, +8952: 1, +8953: 1, +8954: 1, +8955: 1, +8956: 1, +8957: 1, +8958: 1, +8959: 1, +8968: 1, +8969: 1, +8970: 1, +8971: 1, +8992: 1, +8993: 1, +9001: 1, +9002: 1, +10088: 1, +10089: 1, +10090: 1, +10091: 1, +10092: 1, +10093: 1, +10094: 1, +10095: 1, +10096: 1, +10097: 1, +10098: 1, +10099: 1, +10100: 1, +10101: 1, +10195: 1, +10196: 1, +10197: 1, +10198: 1, +10204: 1, +10205: 1, +10206: 1, +10210: 1, +10211: 1, +10212: 1, +10213: 1, +10214: 1, +10215: 1, +10216: 1, +10217: 1, +10218: 1, +10219: 1, +10627: 1, +10628: 1, +10629: 1, +10630: 1, +10631: 1, +10632: 1, +10633: 1, +10634: 1, +10635: 1, +10636: 1, +10637: 1, +10638: 1, +10639: 1, +10640: 1, +10641: 1, +10642: 1, +10643: 1, +10644: 1, +10645: 1, +10646: 1, +10647: 1, +10648: 1, +10651: 1, +10652: 1, +10653: 1, +10654: 1, +10655: 1, +10656: 1, +10657: 1, +10658: 1, +10659: 1, +10660: 1, +10661: 1, +10662: 1, +10663: 1, +10664: 1, +10665: 1, +10666: 1, +10667: 1, +10668: 1, +10669: 1, +10670: 1, +10671: 1, +10680: 1, +10688: 1, +10689: 1, +10690: 1, +10691: 1, +10692: 1, +10693: 1, +10697: 1, +10702: 1, +10703: 1, +10704: 1, +10705: 1, +10706: 1, +10708: 1, +10709: 1, +10712: 1, +10713: 1, +10714: 1, +10715: 1, +10716: 1, +10721: 1, +10723: 1, +10724: 1, +10725: 1, +10728: 1, +10729: 1, +10740: 1, +10741: 1, +10742: 1, +10743: 1, +10744: 1, +10745: 1, +10748: 1, +10749: 1, +10762: 1, +10763: 1, +10764: 1, +10765: 1, +10766: 1, +10767: 1, +10768: 1, +10769: 1, +10770: 1, +10771: 1, +10772: 1, +10773: 1, +10774: 1, +10775: 1, +10776: 1, +10777: 1, +10778: 1, +10779: 1, +10780: 1, +10782: 1, +10783: 1, +10784: 1, +10785: 1, +10788: 1, +10790: 1, +10793: 1, +10795: 1, +10796: 1, +10797: 1, +10798: 1, +10804: 1, +10805: 1, +10812: 1, +10813: 1, +10814: 1, +10839: 1, +10840: 1, +10852: 1, +10853: 1, +10858: 1, +10859: 1, +10860: 1, +10861: 1, +10863: 1, +10864: 1, +10867: 1, +10868: 1, +10873: 1, +10874: 1, +10875: 1, +10876: 1, +10877: 1, +10878: 1, +10879: 1, +10880: 1, +10881: 1, +10882: 1, +10883: 1, +10884: 1, +10885: 1, +10886: 1, +10887: 1, +10888: 1, +10889: 1, +10890: 1, +10891: 1, +10892: 1, +10893: 1, +10894: 1, +10895: 1, +10896: 1, +10897: 1, +10898: 1, +10899: 1, +10900: 1, +10901: 1, +10902: 1, +10903: 1, +10904: 1, +10905: 1, +10906: 1, +10907: 1, +10908: 1, +10909: 1, +10910: 1, +10911: 1, +10912: 1, +10913: 1, +10914: 1, +10915: 1, +10918: 1, +10919: 1, +10920: 1, +10921: 1, +10922: 1, +10923: 1, +10924: 1, +10925: 1, +10927: 1, +10928: 1, +10929: 1, +10930: 1, +10931: 1, +10932: 1, +10933: 1, +10934: 1, +10935: 1, +10936: 1, +10937: 1, +10938: 1, +10939: 1, +10940: 1, +10941: 1, +10942: 1, +10943: 1, +10944: 1, +10945: 1, +10946: 1, +10947: 1, +10948: 1, +10949: 1, +10950: 1, +10951: 1, +10952: 1, +10953: 1, +10954: 1, +10955: 1, +10956: 1, +10957: 1, +10958: 1, +10959: 1, +10960: 1, +10961: 1, +10962: 1, +10963: 1, +10964: 1, +10965: 1, +10966: 1, +10972: 1, +10974: 1, +10978: 1, +10979: 1, +10980: 1, +10981: 1, +10982: 1, +10988: 1, +10989: 1, +10990: 1, +10995: 1, +10999: 1, +11000: 1, +11001: 1, +11002: 1, +11003: 1, +11005: 1, +12296: 1, +12297: 1, +12298: 1, +12299: 1, +12300: 1, +12301: 1, +12302: 1, +12303: 1, +12304: 1, +12305: 1, +12308: 1, +12309: 1, +12310: 1, +12311: 1, +12312: 1, +12313: 1, +12314: 1, +12315: 1, +65288: 1, +65289: 1, +65308: 1, +65310: 1, +65339: 1, +65341: 1, +65371: 1, +65373: 1, +65375: 1, +65376: 1, +65378: 1, +65379: 1, +} + + +def mirrored(code): + return _mirrored.get(code, 0) + + +_toupper = { +97: 65, +98: 66, +99: 67, +100: 68, +101: 69, +102: 70, +103: 71, +104: 72, +105: 73, +106: 74, +107: 75, +108: 76, +109: 77, +110: 78, +111: 79, +112: 80, +113: 81, +114: 82, +115: 83, +116: 84, +117: 85, +118: 86, +119: 87, +120: 88, +121: 89, +122: 90, +181: 924, +224: 192, +225: 193, +226: 194, +227: 195, +228: 196, +229: 197, +230: 198, +231: 199, +232: 200, +233: 201, +234: 202, +235: 203, +236: 204, +237: 205, +238: 206, +239: 207, +240: 208, +241: 209, +242: 210, +243: 211, +244: 212, +245: 213, +246: 214, +248: 216, +249: 217, +250: 218, +251: 219, +252: 220, +253: 221, +254: 222, +255: 376, +257: 256, +259: 258, +261: 260, +263: 262, +265: 264, +267: 266, +269: 268, +271: 270, +273: 272, +275: 274, +277: 276, +279: 278, +281: 280, +283: 282, +285: 284, +287: 286, +289: 288, +291: 290, +293: 292, +295: 294, +297: 296, +299: 298, +301: 300, +303: 302, +305: 73, +307: 306, +309: 308, +311: 310, +314: 313, +316: 315, +318: 317, +320: 319, +322: 321, +324: 323, +326: 325, +328: 327, +331: 330, +333: 332, +335: 334, +337: 336, +339: 338, +341: 340, +343: 342, +345: 344, +347: 346, +349: 348, +351: 350, +353: 352, +355: 354, +357: 356, +359: 358, +361: 360, +363: 362, +365: 364, +367: 366, +369: 368, +371: 370, +373: 372, +375: 374, +378: 377, +380: 379, +382: 381, +383: 83, +387: 386, +389: 388, +392: 391, +396: 395, +402: 401, +405: 502, +409: 408, +414: 544, +417: 416, +419: 418, +421: 420, +424: 423, +429: 428, +432: 431, +436: 435, +438: 437, +441: 440, +445: 444, +447: 503, +453: 452, +454: 452, +456: 455, +457: 455, +459: 458, +460: 458, +462: 461, +464: 463, +466: 465, +468: 467, +470: 469, +472: 471, +474: 473, +476: 475, +477: 398, +479: 478, +481: 480, +483: 482, +485: 484, +487: 486, +489: 488, +491: 490, +493: 492, +495: 494, +498: 497, +499: 497, +501: 500, +505: 504, +507: 506, +509: 508, +511: 510, +513: 512, +515: 514, +517: 516, +519: 518, +521: 520, +523: 522, +525: 524, +527: 526, +529: 528, +531: 530, +533: 532, +535: 534, +537: 536, +539: 538, +541: 540, +543: 542, +547: 546, +549: 548, +551: 550, +553: 552, +555: 554, +557: 556, +559: 558, +561: 560, +563: 562, +595: 385, +596: 390, +598: 393, +599: 394, +601: 399, +603: 400, +608: 403, +611: 404, +616: 407, +617: 406, +623: 412, +626: 413, +629: 415, +640: 422, +643: 425, +648: 430, +650: 433, +651: 434, +658: 439, +837: 921, +940: 902, +941: 904, +942: 905, +943: 906, +945: 913, +946: 914, +947: 915, +948: 916, +949: 917, +950: 918, +951: 919, +952: 920, +953: 921, +954: 922, +955: 923, +956: 924, +957: 925, +958: 926, +959: 927, +960: 928, +961: 929, +962: 931, +963: 931, +964: 932, +965: 933, +966: 934, +967: 935, +968: 936, +969: 937, +970: 938, +971: 939, +972: 908, +973: 910, +974: 911, +976: 914, +977: 920, +981: 934, +982: 928, +985: 984, +987: 986, +989: 988, +991: 990, +993: 992, +995: 994, +997: 996, +999: 998, +1001: 1000, +1003: 1002, +1005: 1004, +1007: 1006, +1008: 922, +1009: 929, +1010: 931, +1013: 917, +1072: 1040, +1073: 1041, +1074: 1042, +1075: 1043, +1076: 1044, +1077: 1045, +1078: 1046, +1079: 1047, +1080: 1048, +1081: 1049, +1082: 1050, +1083: 1051, +1084: 1052, +1085: 1053, +1086: 1054, +1087: 1055, +1088: 1056, +1089: 1057, +1090: 1058, +1091: 1059, +1092: 1060, +1093: 1061, +1094: 1062, +1095: 1063, +1096: 1064, +1097: 1065, +1098: 1066, +1099: 1067, +1100: 1068, +1101: 1069, +1102: 1070, +1103: 1071, +1104: 1024, +1105: 1025, +1106: 1026, +1107: 1027, +1108: 1028, +1109: 1029, +1110: 1030, +1111: 1031, +1112: 1032, +1113: 1033, +1114: 1034, +1115: 1035, +1116: 1036, +1117: 1037, +1118: 1038, +1119: 1039, +1121: 1120, +1123: 1122, +1125: 1124, +1127: 1126, +1129: 1128, +1131: 1130, +1133: 1132, +1135: 1134, +1137: 1136, +1139: 1138, +1141: 1140, +1143: 1142, +1145: 1144, +1147: 1146, +1149: 1148, +1151: 1150, +1153: 1152, +1163: 1162, +1165: 1164, +1167: 1166, +1169: 1168, +1171: 1170, +1173: 1172, +1175: 1174, +1177: 1176, +1179: 1178, +1181: 1180, +1183: 1182, +1185: 1184, +1187: 1186, +1189: 1188, +1191: 1190, +1193: 1192, +1195: 1194, +1197: 1196, +1199: 1198, +1201: 1200, +1203: 1202, +1205: 1204, +1207: 1206, +1209: 1208, +1211: 1210, +1213: 1212, +1215: 1214, +1218: 1217, +1220: 1219, +1222: 1221, +1224: 1223, +1226: 1225, +1228: 1227, +1230: 1229, +1233: 1232, +1235: 1234, +1237: 1236, +1239: 1238, +1241: 1240, +1243: 1242, +1245: 1244, +1247: 1246, +1249: 1248, +1251: 1250, +1253: 1252, +1255: 1254, +1257: 1256, +1259: 1258, +1261: 1260, +1263: 1262, +1265: 1264, +1267: 1266, +1269: 1268, +1273: 1272, +1281: 1280, +1283: 1282, +1285: 1284, +1287: 1286, +1289: 1288, +1291: 1290, +1293: 1292, +1295: 1294, +1377: 1329, +1378: 1330, +1379: 1331, +1380: 1332, +1381: 1333, +1382: 1334, +1383: 1335, +1384: 1336, +1385: 1337, +1386: 1338, +1387: 1339, +1388: 1340, +1389: 1341, +1390: 1342, +1391: 1343, +1392: 1344, +1393: 1345, +1394: 1346, +1395: 1347, +1396: 1348, +1397: 1349, +1398: 1350, +1399: 1351, +1400: 1352, +1401: 1353, +1402: 1354, +1403: 1355, +1404: 1356, +1405: 1357, +1406: 1358, +1407: 1359, +1408: 1360, +1409: 1361, +1410: 1362, +1411: 1363, +1412: 1364, +1413: 1365, +1414: 1366, +7681: 7680, +7683: 7682, +7685: 7684, +7687: 7686, +7689: 7688, +7691: 7690, +7693: 7692, +7695: 7694, +7697: 7696, +7699: 7698, +7701: 7700, +7703: 7702, +7705: 7704, +7707: 7706, +7709: 7708, +7711: 7710, +7713: 7712, +7715: 7714, +7717: 7716, +7719: 7718, +7721: 7720, +7723: 7722, +7725: 7724, +7727: 7726, +7729: 7728, +7731: 7730, +7733: 7732, +7735: 7734, +7737: 7736, +7739: 7738, +7741: 7740, +7743: 7742, +7745: 7744, +7747: 7746, +7749: 7748, +7751: 7750, +7753: 7752, +7755: 7754, +7757: 7756, +7759: 7758, +7761: 7760, +7763: 7762, +7765: 7764, +7767: 7766, +7769: 7768, +7771: 7770, +7773: 7772, +7775: 7774, +7777: 7776, +7779: 7778, +7781: 7780, +7783: 7782, +7785: 7784, +7787: 7786, +7789: 7788, +7791: 7790, +7793: 7792, +7795: 7794, +7797: 7796, +7799: 7798, +7801: 7800, +7803: 7802, +7805: 7804, +7807: 7806, +7809: 7808, +7811: 7810, +7813: 7812, +7815: 7814, +7817: 7816, +7819: 7818, +7821: 7820, +7823: 7822, +7825: 7824, +7827: 7826, +7829: 7828, +7835: 7776, +7841: 7840, +7843: 7842, +7845: 7844, +7847: 7846, +7849: 7848, +7851: 7850, +7853: 7852, +7855: 7854, +7857: 7856, +7859: 7858, +7861: 7860, +7863: 7862, +7865: 7864, +7867: 7866, +7869: 7868, +7871: 7870, +7873: 7872, +7875: 7874, +7877: 7876, +7879: 7878, +7881: 7880, +7883: 7882, +7885: 7884, +7887: 7886, +7889: 7888, +7891: 7890, +7893: 7892, +7895: 7894, +7897: 7896, +7899: 7898, +7901: 7900, +7903: 7902, +7905: 7904, +7907: 7906, +7909: 7908, +7911: 7910, +7913: 7912, +7915: 7914, +7917: 7916, +7919: 7918, +7921: 7920, +7923: 7922, +7925: 7924, +7927: 7926, +7929: 7928, +7936: 7944, +7937: 7945, +7938: 7946, +7939: 7947, +7940: 7948, +7941: 7949, +7942: 7950, +7943: 7951, +7952: 7960, +7953: 7961, +7954: 7962, +7955: 7963, +7956: 7964, +7957: 7965, +7968: 7976, +7969: 7977, +7970: 7978, +7971: 7979, +7972: 7980, +7973: 7981, +7974: 7982, +7975: 7983, +7984: 7992, +7985: 7993, +7986: 7994, +7987: 7995, +7988: 7996, +7989: 7997, +7990: 7998, +7991: 7999, +8000: 8008, +8001: 8009, +8002: 8010, +8003: 8011, +8004: 8012, +8005: 8013, +8017: 8025, +8019: 8027, +8021: 8029, +8023: 8031, +8032: 8040, +8033: 8041, +8034: 8042, +8035: 8043, +8036: 8044, +8037: 8045, +8038: 8046, +8039: 8047, +8048: 8122, +8049: 8123, +8050: 8136, +8051: 8137, +8052: 8138, +8053: 8139, +8054: 8154, +8055: 8155, +8056: 8184, +8057: 8185, +8058: 8170, +8059: 8171, +8060: 8186, +8061: 8187, +8064: 8072, +8065: 8073, +8066: 8074, +8067: 8075, +8068: 8076, +8069: 8077, +8070: 8078, +8071: 8079, +8080: 8088, +8081: 8089, +8082: 8090, +8083: 8091, +8084: 8092, +8085: 8093, +8086: 8094, +8087: 8095, +8096: 8104, +8097: 8105, +8098: 8106, +8099: 8107, +8100: 8108, +8101: 8109, +8102: 8110, +8103: 8111, +8112: 8120, +8113: 8121, +8115: 8124, +8126: 921, +8131: 8140, +8144: 8152, +8145: 8153, +8160: 8168, +8161: 8169, +8165: 8172, +8179: 8188, +8560: 8544, +8561: 8545, +8562: 8546, +8563: 8547, +8564: 8548, +8565: 8549, +8566: 8550, +8567: 8551, +8568: 8552, +8569: 8553, +8570: 8554, +8571: 8555, +8572: 8556, +8573: 8557, +8574: 8558, +8575: 8559, +9424: 9398, +9425: 9399, +9426: 9400, +9427: 9401, +9428: 9402, +9429: 9403, +9430: 9404, +9431: 9405, +9432: 9406, +9433: 9407, +9434: 9408, +9435: 9409, +9436: 9410, +9437: 9411, +9438: 9412, +9439: 9413, +9440: 9414, +9441: 9415, +9442: 9416, +9443: 9417, +9444: 9418, +9445: 9419, +9446: 9420, +9447: 9421, +9448: 9422, +9449: 9423, +65345: 65313, +65346: 65314, +65347: 65315, +65348: 65316, +65349: 65317, +65350: 65318, +65351: 65319, +65352: 65320, +65353: 65321, +65354: 65322, +65355: 65323, +65356: 65324, +65357: 65325, +65358: 65326, +65359: 65327, +65360: 65328, +65361: 65329, +65362: 65330, +65363: 65331, +65364: 65332, +65365: 65333, +65366: 65334, +65367: 65335, +65368: 65336, +65369: 65337, +65370: 65338, +66600: 66560, +66601: 66561, +66602: 66562, +66603: 66563, +66604: 66564, +66605: 66565, +66606: 66566, +66607: 66567, +66608: 66568, +66609: 66569, +66610: 66570, +66611: 66571, +66612: 66572, +66613: 66573, +66614: 66574, +66615: 66575, +66616: 66576, +66617: 66577, +66618: 66578, +66619: 66579, +66620: 66580, +66621: 66581, +66622: 66582, +66623: 66583, +66624: 66584, +66625: 66585, +66626: 66586, +66627: 66587, +66628: 66588, +66629: 66589, +66630: 66590, +66631: 66591, +66632: 66592, +66633: 66593, +66634: 66594, +66635: 66595, +66636: 66596, +66637: 66597, +} + +_tolower = { +65: 97, +66: 98, +67: 99, +68: 100, +69: 101, +70: 102, +71: 103, +72: 104, +73: 105, +74: 106, +75: 107, +76: 108, +77: 109, +78: 110, +79: 111, +80: 112, +81: 113, +82: 114, +83: 115, +84: 116, +85: 117, +86: 118, +87: 119, +88: 120, +89: 121, +90: 122, +192: 224, +193: 225, +194: 226, +195: 227, +196: 228, +197: 229, +198: 230, +199: 231, +200: 232, +201: 233, +202: 234, +203: 235, +204: 236, +205: 237, +206: 238, +207: 239, +208: 240, +209: 241, +210: 242, +211: 243, +212: 244, +213: 245, +214: 246, +216: 248, +217: 249, +218: 250, +219: 251, +220: 252, +221: 253, +222: 254, +256: 257, +258: 259, +260: 261, +262: 263, +264: 265, +266: 267, +268: 269, +270: 271, +272: 273, +274: 275, +276: 277, +278: 279, +280: 281, +282: 283, +284: 285, +286: 287, +288: 289, +290: 291, +292: 293, +294: 295, +296: 297, +298: 299, +300: 301, +302: 303, +304: 105, +306: 307, +308: 309, +310: 311, +313: 314, +315: 316, +317: 318, +319: 320, +321: 322, +323: 324, +325: 326, +327: 328, +330: 331, +332: 333, +334: 335, +336: 337, +338: 339, +340: 341, +342: 343, +344: 345, +346: 347, +348: 349, +350: 351, +352: 353, +354: 355, +356: 357, +358: 359, +360: 361, +362: 363, +364: 365, +366: 367, +368: 369, +370: 371, +372: 373, +374: 375, +376: 255, +377: 378, +379: 380, +381: 382, +385: 595, +386: 387, +388: 389, +390: 596, +391: 392, +393: 598, +394: 599, +395: 396, +398: 477, +399: 601, +400: 603, +401: 402, +403: 608, +404: 611, +406: 617, +407: 616, +408: 409, +412: 623, +413: 626, +415: 629, +416: 417, +418: 419, +420: 421, +422: 640, +423: 424, +425: 643, +428: 429, +430: 648, +431: 432, +433: 650, +434: 651, +435: 436, +437: 438, +439: 658, +440: 441, +444: 445, +452: 454, +453: 454, +455: 457, +456: 457, +458: 460, +459: 460, +461: 462, +463: 464, +465: 466, +467: 468, +469: 470, +471: 472, +473: 474, +475: 476, +478: 479, +480: 481, +482: 483, +484: 485, +486: 487, +488: 489, +490: 491, +492: 493, +494: 495, +497: 499, +498: 499, +500: 501, +502: 405, +503: 447, +504: 505, +506: 507, +508: 509, +510: 511, +512: 513, +514: 515, +516: 517, +518: 519, +520: 521, +522: 523, +524: 525, +526: 527, +528: 529, +530: 531, +532: 533, +534: 535, +536: 537, +538: 539, +540: 541, +542: 543, +544: 414, +546: 547, +548: 549, +550: 551, +552: 553, +554: 555, +556: 557, +558: 559, +560: 561, +562: 563, +902: 940, +904: 941, +905: 942, +906: 943, +908: 972, +910: 973, +911: 974, +913: 945, +914: 946, +915: 947, +916: 948, +917: 949, +918: 950, +919: 951, +920: 952, +921: 953, +922: 954, +923: 955, +924: 956, +925: 957, +926: 958, +927: 959, +928: 960, +929: 961, +931: 963, +932: 964, +933: 965, +934: 966, +935: 967, +936: 968, +937: 969, +938: 970, +939: 971, +984: 985, +986: 987, +988: 989, +990: 991, +992: 993, +994: 995, +996: 997, +998: 999, +1000: 1001, +1002: 1003, +1004: 1005, +1006: 1007, +1012: 952, +1024: 1104, +1025: 1105, +1026: 1106, +1027: 1107, +1028: 1108, +1029: 1109, +1030: 1110, +1031: 1111, +1032: 1112, +1033: 1113, +1034: 1114, +1035: 1115, +1036: 1116, +1037: 1117, +1038: 1118, +1039: 1119, +1040: 1072, +1041: 1073, +1042: 1074, +1043: 1075, +1044: 1076, +1045: 1077, +1046: 1078, +1047: 1079, +1048: 1080, +1049: 1081, +1050: 1082, +1051: 1083, +1052: 1084, +1053: 1085, +1054: 1086, +1055: 1087, +1056: 1088, +1057: 1089, +1058: 1090, +1059: 1091, +1060: 1092, +1061: 1093, +1062: 1094, +1063: 1095, +1064: 1096, +1065: 1097, +1066: 1098, +1067: 1099, +1068: 1100, +1069: 1101, +1070: 1102, +1071: 1103, +1120: 1121, +1122: 1123, +1124: 1125, +1126: 1127, +1128: 1129, +1130: 1131, +1132: 1133, +1134: 1135, +1136: 1137, +1138: 1139, +1140: 1141, +1142: 1143, +1144: 1145, +1146: 1147, +1148: 1149, +1150: 1151, +1152: 1153, +1162: 1163, +1164: 1165, +1166: 1167, +1168: 1169, +1170: 1171, +1172: 1173, +1174: 1175, +1176: 1177, +1178: 1179, +1180: 1181, +1182: 1183, +1184: 1185, +1186: 1187, +1188: 1189, +1190: 1191, +1192: 1193, +1194: 1195, +1196: 1197, +1198: 1199, +1200: 1201, +1202: 1203, +1204: 1205, +1206: 1207, +1208: 1209, +1210: 1211, +1212: 1213, +1214: 1215, +1217: 1218, +1219: 1220, +1221: 1222, +1223: 1224, +1225: 1226, +1227: 1228, +1229: 1230, +1232: 1233, +1234: 1235, +1236: 1237, +1238: 1239, +1240: 1241, +1242: 1243, +1244: 1245, +1246: 1247, +1248: 1249, +1250: 1251, +1252: 1253, +1254: 1255, +1256: 1257, +1258: 1259, +1260: 1261, +1262: 1263, +1264: 1265, +1266: 1267, +1268: 1269, +1272: 1273, +1280: 1281, +1282: 1283, +1284: 1285, +1286: 1287, +1288: 1289, +1290: 1291, +1292: 1293, +1294: 1295, +1329: 1377, +1330: 1378, +1331: 1379, +1332: 1380, +1333: 1381, +1334: 1382, +1335: 1383, +1336: 1384, +1337: 1385, +1338: 1386, +1339: 1387, +1340: 1388, +1341: 1389, +1342: 1390, +1343: 1391, +1344: 1392, +1345: 1393, +1346: 1394, +1347: 1395, +1348: 1396, +1349: 1397, +1350: 1398, +1351: 1399, +1352: 1400, +1353: 1401, +1354: 1402, +1355: 1403, +1356: 1404, +1357: 1405, +1358: 1406, +1359: 1407, +1360: 1408, +1361: 1409, +1362: 1410, +1363: 1411, +1364: 1412, +1365: 1413, +1366: 1414, +7680: 7681, +7682: 7683, +7684: 7685, +7686: 7687, +7688: 7689, +7690: 7691, +7692: 7693, +7694: 7695, +7696: 7697, +7698: 7699, +7700: 7701, +7702: 7703, +7704: 7705, +7706: 7707, +7708: 7709, +7710: 7711, +7712: 7713, +7714: 7715, +7716: 7717, +7718: 7719, +7720: 7721, +7722: 7723, +7724: 7725, +7726: 7727, +7728: 7729, +7730: 7731, +7732: 7733, +7734: 7735, +7736: 7737, +7738: 7739, +7740: 7741, +7742: 7743, +7744: 7745, +7746: 7747, +7748: 7749, +7750: 7751, +7752: 7753, +7754: 7755, +7756: 7757, +7758: 7759, +7760: 7761, +7762: 7763, +7764: 7765, +7766: 7767, +7768: 7769, +7770: 7771, +7772: 7773, +7774: 7775, +7776: 7777, +7778: 7779, +7780: 7781, +7782: 7783, +7784: 7785, +7786: 7787, +7788: 7789, +7790: 7791, +7792: 7793, +7794: 7795, +7796: 7797, +7798: 7799, +7800: 7801, +7802: 7803, +7804: 7805, +7806: 7807, +7808: 7809, +7810: 7811, +7812: 7813, +7814: 7815, +7816: 7817, +7818: 7819, +7820: 7821, +7822: 7823, +7824: 7825, +7826: 7827, +7828: 7829, +7840: 7841, +7842: 7843, +7844: 7845, +7846: 7847, +7848: 7849, +7850: 7851, +7852: 7853, +7854: 7855, +7856: 7857, +7858: 7859, +7860: 7861, +7862: 7863, +7864: 7865, +7866: 7867, +7868: 7869, +7870: 7871, +7872: 7873, +7874: 7875, +7876: 7877, +7878: 7879, +7880: 7881, +7882: 7883, +7884: 7885, +7886: 7887, +7888: 7889, +7890: 7891, +7892: 7893, +7894: 7895, +7896: 7897, +7898: 7899, +7900: 7901, +7902: 7903, +7904: 7905, +7906: 7907, +7908: 7909, +7910: 7911, +7912: 7913, +7914: 7915, +7916: 7917, +7918: 7919, +7920: 7921, +7922: 7923, +7924: 7925, +7926: 7927, +7928: 7929, +7944: 7936, +7945: 7937, +7946: 7938, +7947: 7939, +7948: 7940, +7949: 7941, +7950: 7942, +7951: 7943, +7960: 7952, +7961: 7953, +7962: 7954, +7963: 7955, +7964: 7956, +7965: 7957, +7976: 7968, +7977: 7969, +7978: 7970, +7979: 7971, +7980: 7972, +7981: 7973, +7982: 7974, +7983: 7975, +7992: 7984, +7993: 7985, +7994: 7986, +7995: 7987, +7996: 7988, +7997: 7989, +7998: 7990, +7999: 7991, +8008: 8000, +8009: 8001, +8010: 8002, +8011: 8003, +8012: 8004, +8013: 8005, +8025: 8017, +8027: 8019, +8029: 8021, +8031: 8023, +8040: 8032, +8041: 8033, +8042: 8034, +8043: 8035, +8044: 8036, +8045: 8037, +8046: 8038, +8047: 8039, +8072: 8064, +8073: 8065, +8074: 8066, +8075: 8067, +8076: 8068, +8077: 8069, +8078: 8070, +8079: 8071, +8088: 8080, +8089: 8081, +8090: 8082, +8091: 8083, +8092: 8084, +8093: 8085, +8094: 8086, +8095: 8087, +8104: 8096, +8105: 8097, +8106: 8098, +8107: 8099, +8108: 8100, +8109: 8101, +8110: 8102, +8111: 8103, +8120: 8112, +8121: 8113, +8122: 8048, +8123: 8049, +8124: 8115, +8136: 8050, +8137: 8051, +8138: 8052, +8139: 8053, +8140: 8131, +8152: 8144, +8153: 8145, +8154: 8054, +8155: 8055, +8168: 8160, +8169: 8161, +8170: 8058, +8171: 8059, +8172: 8165, +8184: 8056, +8185: 8057, +8186: 8060, +8187: 8061, +8188: 8179, +8486: 969, +8490: 107, +8491: 229, +8544: 8560, +8545: 8561, +8546: 8562, +8547: 8563, +8548: 8564, +8549: 8565, +8550: 8566, +8551: 8567, +8552: 8568, +8553: 8569, +8554: 8570, +8555: 8571, +8556: 8572, +8557: 8573, +8558: 8574, +8559: 8575, +9398: 9424, +9399: 9425, +9400: 9426, +9401: 9427, +9402: 9428, +9403: 9429, +9404: 9430, +9405: 9431, +9406: 9432, +9407: 9433, +9408: 9434, +9409: 9435, +9410: 9436, +9411: 9437, +9412: 9438, +9413: 9439, +9414: 9440, +9415: 9441, +9416: 9442, +9417: 9443, +9418: 9444, +9419: 9445, +9420: 9446, +9421: 9447, +9422: 9448, +9423: 9449, +65313: 65345, +65314: 65346, +65315: 65347, +65316: 65348, +65317: 65349, +65318: 65350, +65319: 65351, +65320: 65352, +65321: 65353, +65322: 65354, +65323: 65355, +65324: 65356, +65325: 65357, +65326: 65358, +65327: 65359, +65328: 65360, +65329: 65361, +65330: 65362, +65331: 65363, +65332: 65364, +65333: 65365, +65334: 65366, +65335: 65367, +65336: 65368, +65337: 65369, +65338: 65370, +66560: 66600, +66561: 66601, +66562: 66602, +66563: 66603, +66564: 66604, +66565: 66605, +66566: 66606, +66567: 66607, +66568: 66608, +66569: 66609, +66570: 66610, +66571: 66611, +66572: 66612, +66573: 66613, +66574: 66614, +66575: 66615, +66576: 66616, +66577: 66617, +66578: 66618, +66579: 66619, +66580: 66620, +66581: 66621, +66582: 66622, +66583: 66623, +66584: 66624, +66585: 66625, +66586: 66626, +66587: 66627, +66588: 66628, +66589: 66629, +66590: 66630, +66591: 66631, +66592: 66632, +66593: 66633, +66594: 66634, +66595: 66635, +66596: 66636, +66597: 66637, +} + +_totitle = { +97: 65, +98: 66, +99: 67, +100: 68, +101: 69, +102: 70, +103: 71, +104: 72, +105: 73, +106: 74, +107: 75, +108: 76, +109: 77, +110: 78, +111: 79, +112: 80, +113: 81, +114: 82, +115: 83, +116: 84, +117: 85, +118: 86, +119: 87, +120: 88, +121: 89, +122: 90, +181: 924, +224: 192, +225: 193, +226: 194, +227: 195, +228: 196, +229: 197, +230: 198, +231: 199, +232: 200, +233: 201, +234: 202, +235: 203, +236: 204, +237: 205, +238: 206, +239: 207, +240: 208, +241: 209, +242: 210, +243: 211, +244: 212, +245: 213, +246: 214, +248: 216, +249: 217, +250: 218, +251: 219, +252: 220, +253: 221, +254: 222, +255: 376, +257: 256, +259: 258, +261: 260, +263: 262, +265: 264, +267: 266, +269: 268, +271: 270, +273: 272, +275: 274, +277: 276, +279: 278, +281: 280, +283: 282, +285: 284, +287: 286, +289: 288, +291: 290, +293: 292, +295: 294, +297: 296, +299: 298, +301: 300, +303: 302, +305: 73, +307: 306, +309: 308, +311: 310, +314: 313, +316: 315, +318: 317, +320: 319, +322: 321, +324: 323, +326: 325, +328: 327, +331: 330, +333: 332, +335: 334, +337: 336, +339: 338, +341: 340, +343: 342, +345: 344, +347: 346, +349: 348, +351: 350, +353: 352, +355: 354, +357: 356, +359: 358, +361: 360, +363: 362, +365: 364, +367: 366, +369: 368, +371: 370, +373: 372, +375: 374, +378: 377, +380: 379, +382: 381, +383: 83, +387: 386, +389: 388, +392: 391, +396: 395, +402: 401, +405: 502, +409: 408, +414: 544, +417: 416, +419: 418, +421: 420, +424: 423, +429: 428, +432: 431, +436: 435, +438: 437, +441: 440, +445: 444, +447: 503, +452: 453, +454: 453, +455: 456, +457: 456, +458: 459, +460: 459, +462: 461, +464: 463, +466: 465, +468: 467, +470: 469, +472: 471, +474: 473, +476: 475, +477: 398, +479: 478, +481: 480, +483: 482, +485: 484, +487: 486, +489: 488, +491: 490, +493: 492, +495: 494, +497: 498, +499: 498, +501: 500, +505: 504, +507: 506, +509: 508, +511: 510, +513: 512, +515: 514, +517: 516, +519: 518, +521: 520, +523: 522, +525: 524, +527: 526, +529: 528, +531: 530, +533: 532, +535: 534, +537: 536, +539: 538, +541: 540, +543: 542, +547: 546, +549: 548, +551: 550, +553: 552, +555: 554, +557: 556, +559: 558, +561: 560, +563: 562, +595: 385, +596: 390, +598: 393, +599: 394, +601: 399, +603: 400, +608: 403, +611: 404, +616: 407, +617: 406, +623: 412, +626: 413, +629: 415, +640: 422, +643: 425, +648: 430, +650: 433, +651: 434, +658: 439, +837: 921, +940: 902, +941: 904, +942: 905, +943: 906, +945: 913, +946: 914, +947: 915, +948: 916, +949: 917, +950: 918, +951: 919, +952: 920, +953: 921, +954: 922, +955: 923, +956: 924, +957: 925, +958: 926, +959: 927, +960: 928, +961: 929, +962: 931, +963: 931, +964: 932, +965: 933, +966: 934, +967: 935, +968: 936, +969: 937, +970: 938, +971: 939, +972: 908, +973: 910, +974: 911, +976: 914, +977: 920, +981: 934, +982: 928, +985: 984, +987: 986, +989: 988, +991: 990, +993: 992, +995: 994, +997: 996, +999: 998, +1001: 1000, +1003: 1002, +1005: 1004, +1007: 1006, +1008: 922, +1009: 929, +1010: 931, +1013: 917, +1072: 1040, +1073: 1041, +1074: 1042, +1075: 1043, +1076: 1044, +1077: 1045, +1078: 1046, +1079: 1047, +1080: 1048, +1081: 1049, +1082: 1050, +1083: 1051, +1084: 1052, +1085: 1053, +1086: 1054, +1087: 1055, +1088: 1056, +1089: 1057, +1090: 1058, +1091: 1059, +1092: 1060, +1093: 1061, +1094: 1062, +1095: 1063, +1096: 1064, +1097: 1065, +1098: 1066, +1099: 1067, +1100: 1068, +1101: 1069, +1102: 1070, +1103: 1071, +1104: 1024, +1105: 1025, +1106: 1026, +1107: 1027, +1108: 1028, +1109: 1029, +1110: 1030, +1111: 1031, +1112: 1032, +1113: 1033, +1114: 1034, +1115: 1035, +1116: 1036, +1117: 1037, +1118: 1038, +1119: 1039, +1121: 1120, +1123: 1122, +1125: 1124, +1127: 1126, +1129: 1128, +1131: 1130, +1133: 1132, +1135: 1134, +1137: 1136, +1139: 1138, +1141: 1140, +1143: 1142, +1145: 1144, +1147: 1146, +1149: 1148, +1151: 1150, +1153: 1152, +1163: 1162, +1165: 1164, +1167: 1166, +1169: 1168, +1171: 1170, +1173: 1172, +1175: 1174, +1177: 1176, +1179: 1178, +1181: 1180, +1183: 1182, +1185: 1184, +1187: 1186, +1189: 1188, +1191: 1190, +1193: 1192, +1195: 1194, +1197: 1196, +1199: 1198, +1201: 1200, +1203: 1202, +1205: 1204, +1207: 1206, +1209: 1208, +1211: 1210, +1213: 1212, +1215: 1214, +1218: 1217, +1220: 1219, +1222: 1221, +1224: 1223, +1226: 1225, +1228: 1227, +1230: 1229, +1233: 1232, +1235: 1234, +1237: 1236, +1239: 1238, +1241: 1240, +1243: 1242, +1245: 1244, +1247: 1246, +1249: 1248, +1251: 1250, +1253: 1252, +1255: 1254, +1257: 1256, +1259: 1258, +1261: 1260, +1263: 1262, +1265: 1264, +1267: 1266, +1269: 1268, +1273: 1272, +1281: 1280, +1283: 1282, +1285: 1284, +1287: 1286, +1289: 1288, +1291: 1290, +1293: 1292, +1295: 1294, +1377: 1329, +1378: 1330, +1379: 1331, +1380: 1332, +1381: 1333, +1382: 1334, +1383: 1335, +1384: 1336, +1385: 1337, +1386: 1338, +1387: 1339, +1388: 1340, +1389: 1341, +1390: 1342, +1391: 1343, +1392: 1344, +1393: 1345, +1394: 1346, +1395: 1347, +1396: 1348, +1397: 1349, +1398: 1350, +1399: 1351, +1400: 1352, +1401: 1353, +1402: 1354, +1403: 1355, +1404: 1356, +1405: 1357, +1406: 1358, +1407: 1359, +1408: 1360, +1409: 1361, +1410: 1362, +1411: 1363, +1412: 1364, +1413: 1365, +1414: 1366, +7681: 7680, +7683: 7682, +7685: 7684, +7687: 7686, +7689: 7688, +7691: 7690, +7693: 7692, +7695: 7694, +7697: 7696, +7699: 7698, +7701: 7700, +7703: 7702, +7705: 7704, +7707: 7706, +7709: 7708, +7711: 7710, +7713: 7712, +7715: 7714, +7717: 7716, +7719: 7718, +7721: 7720, +7723: 7722, +7725: 7724, +7727: 7726, +7729: 7728, +7731: 7730, +7733: 7732, +7735: 7734, +7737: 7736, +7739: 7738, +7741: 7740, +7743: 7742, +7745: 7744, +7747: 7746, +7749: 7748, +7751: 7750, +7753: 7752, +7755: 7754, +7757: 7756, +7759: 7758, +7761: 7760, +7763: 7762, +7765: 7764, +7767: 7766, +7769: 7768, +7771: 7770, +7773: 7772, +7775: 7774, +7777: 7776, +7779: 7778, +7781: 7780, +7783: 7782, +7785: 7784, +7787: 7786, +7789: 7788, +7791: 7790, +7793: 7792, +7795: 7794, +7797: 7796, +7799: 7798, +7801: 7800, +7803: 7802, +7805: 7804, +7807: 7806, +7809: 7808, +7811: 7810, +7813: 7812, +7815: 7814, +7817: 7816, +7819: 7818, +7821: 7820, +7823: 7822, +7825: 7824, +7827: 7826, +7829: 7828, +7835: 7776, +7841: 7840, +7843: 7842, +7845: 7844, +7847: 7846, +7849: 7848, +7851: 7850, +7853: 7852, +7855: 7854, +7857: 7856, +7859: 7858, +7861: 7860, +7863: 7862, +7865: 7864, +7867: 7866, +7869: 7868, +7871: 7870, +7873: 7872, +7875: 7874, +7877: 7876, +7879: 7878, +7881: 7880, +7883: 7882, +7885: 7884, +7887: 7886, +7889: 7888, +7891: 7890, +7893: 7892, +7895: 7894, +7897: 7896, +7899: 7898, +7901: 7900, +7903: 7902, +7905: 7904, +7907: 7906, +7909: 7908, +7911: 7910, +7913: 7912, +7915: 7914, +7917: 7916, +7919: 7918, +7921: 7920, +7923: 7922, +7925: 7924, +7927: 7926, +7929: 7928, +7936: 7944, +7937: 7945, +7938: 7946, +7939: 7947, +7940: 7948, +7941: 7949, +7942: 7950, +7943: 7951, +7952: 7960, +7953: 7961, +7954: 7962, +7955: 7963, +7956: 7964, +7957: 7965, +7968: 7976, +7969: 7977, +7970: 7978, +7971: 7979, +7972: 7980, +7973: 7981, +7974: 7982, +7975: 7983, +7984: 7992, +7985: 7993, +7986: 7994, +7987: 7995, +7988: 7996, +7989: 7997, +7990: 7998, +7991: 7999, +8000: 8008, +8001: 8009, +8002: 8010, +8003: 8011, +8004: 8012, +8005: 8013, +8017: 8025, +8019: 8027, +8021: 8029, +8023: 8031, +8032: 8040, +8033: 8041, +8034: 8042, +8035: 8043, +8036: 8044, +8037: 8045, +8038: 8046, +8039: 8047, +8048: 8122, +8049: 8123, +8050: 8136, +8051: 8137, +8052: 8138, +8053: 8139, +8054: 8154, +8055: 8155, +8056: 8184, +8057: 8185, +8058: 8170, +8059: 8171, +8060: 8186, +8061: 8187, +8064: 8072, +8065: 8073, +8066: 8074, +8067: 8075, +8068: 8076, +8069: 8077, +8070: 8078, +8071: 8079, +8080: 8088, +8081: 8089, +8082: 8090, +8083: 8091, +8084: 8092, +8085: 8093, +8086: 8094, +8087: 8095, +8096: 8104, +8097: 8105, +8098: 8106, +8099: 8107, +8100: 8108, +8101: 8109, +8102: 8110, +8103: 8111, +8112: 8120, +8113: 8121, +8115: 8124, +8126: 921, +8131: 8140, +8144: 8152, +8145: 8153, +8160: 8168, +8161: 8169, +8165: 8172, +8179: 8188, +8560: 8544, +8561: 8545, +8562: 8546, +8563: 8547, +8564: 8548, +8565: 8549, +8566: 8550, +8567: 8551, +8568: 8552, +8569: 8553, +8570: 8554, +8571: 8555, +8572: 8556, +8573: 8557, +8574: 8558, +8575: 8559, +9424: 9398, +9425: 9399, +9426: 9400, +9427: 9401, +9428: 9402, +9429: 9403, +9430: 9404, +9431: 9405, +9432: 9406, +9433: 9407, +9434: 9408, +9435: 9409, +9436: 9410, +9437: 9411, +9438: 9412, +9439: 9413, +9440: 9414, +9441: 9415, +9442: 9416, +9443: 9417, +9444: 9418, +9445: 9419, +9446: 9420, +9447: 9421, +9448: 9422, +9449: 9423, +65345: 65313, +65346: 65314, +65347: 65315, +65348: 65316, +65349: 65317, +65350: 65318, +65351: 65319, +65352: 65320, +65353: 65321, +65354: 65322, +65355: 65323, +65356: 65324, +65357: 65325, +65358: 65326, +65359: 65327, +65360: 65328, +65361: 65329, +65362: 65330, +65363: 65331, +65364: 65332, +65365: 65333, +65366: 65334, +65367: 65335, +65368: 65336, +65369: 65337, +65370: 65338, +66600: 66560, +66601: 66561, +66602: 66562, +66603: 66563, +66604: 66564, +66605: 66565, +66606: 66566, +66607: 66567, +66608: 66568, +66609: 66569, +66610: 66570, +66611: 66571, +66612: 66572, +66613: 66573, +66614: 66574, +66615: 66575, +66616: 66576, +66617: 66577, +66618: 66578, +66619: 66579, +66620: 66580, +66621: 66581, +66622: 66582, +66623: 66583, +66624: 66584, +66625: 66585, +66626: 66586, +66627: 66587, +66628: 66588, +66629: 66589, +66630: 66590, +66631: 66591, +66632: 66592, +66633: 66593, +66634: 66594, +66635: 66595, +66636: 66596, +66637: 66597, +} + + +def toupper(code): + return _toupper.get(code, code) +def tolower(code): + return _tolower.get(code, code) +def totitle(code): + return _totitle.get(code, code) + + +_mirrored = { +40: 1, +41: 1, +60: 1, +62: 1, +91: 1, +93: 1, +123: 1, +125: 1, +171: 1, +187: 1, +8249: 1, +8250: 1, +8261: 1, +8262: 1, +8317: 1, +8318: 1, +8333: 1, +8334: 1, +8512: 1, +8705: 1, +8706: 1, +8707: 1, +8708: 1, +8712: 1, +8713: 1, +8714: 1, +8715: 1, +8716: 1, +8717: 1, +8721: 1, +8725: 1, +8726: 1, +8730: 1, +8731: 1, +8732: 1, +8733: 1, +8735: 1, +8736: 1, +8737: 1, +8738: 1, +8740: 1, +8742: 1, +8747: 1, +8748: 1, +8749: 1, +8750: 1, +8751: 1, +8752: 1, +8753: 1, +8754: 1, +8755: 1, +8761: 1, +8763: 1, +8764: 1, +8765: 1, +8766: 1, +8767: 1, +8768: 1, +8769: 1, +8770: 1, +8771: 1, +8772: 1, +8773: 1, +8774: 1, +8775: 1, +8776: 1, +8777: 1, +8778: 1, +8779: 1, +8780: 1, +8786: 1, +8787: 1, +8788: 1, +8789: 1, +8799: 1, +8800: 1, +8802: 1, +8804: 1, +8805: 1, +8806: 1, +8807: 1, +8808: 1, +8809: 1, +8810: 1, +8811: 1, +8814: 1, +8815: 1, +8816: 1, +8817: 1, +8818: 1, +8819: 1, +8820: 1, +8821: 1, +8822: 1, +8823: 1, +8824: 1, +8825: 1, +8826: 1, +8827: 1, +8828: 1, +8829: 1, +8830: 1, +8831: 1, +8832: 1, +8833: 1, +8834: 1, +8835: 1, +8836: 1, +8837: 1, +8838: 1, +8839: 1, +8840: 1, +8841: 1, +8842: 1, +8843: 1, +8844: 1, +8847: 1, +8848: 1, +8849: 1, +8850: 1, +8856: 1, +8866: 1, +8867: 1, +8870: 1, +8871: 1, +8872: 1, +8873: 1, +8874: 1, +8875: 1, +8876: 1, +8877: 1, +8878: 1, +8879: 1, +8880: 1, +8881: 1, +8882: 1, +8883: 1, +8884: 1, +8885: 1, +8886: 1, +8887: 1, +8888: 1, +8894: 1, +8895: 1, +8905: 1, +8906: 1, +8907: 1, +8908: 1, +8909: 1, +8912: 1, +8913: 1, +8918: 1, +8919: 1, +8920: 1, +8921: 1, +8922: 1, +8923: 1, +8924: 1, +8925: 1, +8926: 1, +8927: 1, +8928: 1, +8929: 1, +8930: 1, +8931: 1, +8932: 1, +8933: 1, +8934: 1, +8935: 1, +8936: 1, +8937: 1, +8938: 1, +8939: 1, +8940: 1, +8941: 1, +8944: 1, +8945: 1, +8946: 1, +8947: 1, +8948: 1, +8949: 1, +8950: 1, +8951: 1, +8952: 1, +8953: 1, +8954: 1, +8955: 1, +8956: 1, +8957: 1, +8958: 1, +8959: 1, +8968: 1, +8969: 1, +8970: 1, +8971: 1, +8992: 1, +8993: 1, +9001: 1, +9002: 1, +10088: 1, +10089: 1, +10090: 1, +10091: 1, +10092: 1, +10093: 1, +10094: 1, +10095: 1, +10096: 1, +10097: 1, +10098: 1, +10099: 1, +10100: 1, +10101: 1, +10195: 1, +10196: 1, +10197: 1, +10198: 1, +10204: 1, +10205: 1, +10206: 1, +10210: 1, +10211: 1, +10212: 1, +10213: 1, +10214: 1, +10215: 1, +10216: 1, +10217: 1, +10218: 1, +10219: 1, +10627: 1, +10628: 1, +10629: 1, +10630: 1, +10631: 1, +10632: 1, +10633: 1, +10634: 1, +10635: 1, +10636: 1, +10637: 1, +10638: 1, +10639: 1, +10640: 1, +10641: 1, +10642: 1, +10643: 1, +10644: 1, +10645: 1, +10646: 1, +10647: 1, +10648: 1, +10651: 1, +10652: 1, +10653: 1, +10654: 1, +10655: 1, +10656: 1, +10657: 1, +10658: 1, +10659: 1, +10660: 1, +10661: 1, +10662: 1, +10663: 1, +10664: 1, +10665: 1, +10666: 1, +10667: 1, +10668: 1, +10669: 1, +10670: 1, +10671: 1, +10680: 1, +10688: 1, +10689: 1, +10690: 1, +10691: 1, +10692: 1, +10693: 1, +10697: 1, +10702: 1, +10703: 1, +10704: 1, +10705: 1, +10706: 1, +10708: 1, +10709: 1, +10712: 1, +10713: 1, +10714: 1, +10715: 1, +10716: 1, +10721: 1, +10723: 1, +10724: 1, +10725: 1, +10728: 1, +10729: 1, +10740: 1, +10741: 1, +10742: 1, +10743: 1, +10744: 1, +10745: 1, +10748: 1, +10749: 1, +10762: 1, +10763: 1, +10764: 1, +10765: 1, +10766: 1, +10767: 1, +10768: 1, +10769: 1, +10770: 1, +10771: 1, +10772: 1, +10773: 1, +10774: 1, +10775: 1, +10776: 1, +10777: 1, +10778: 1, +10779: 1, +10780: 1, +10782: 1, +10783: 1, +10784: 1, +10785: 1, +10788: 1, +10790: 1, +10793: 1, +10795: 1, +10796: 1, +10797: 1, +10798: 1, +10804: 1, +10805: 1, +10812: 1, +10813: 1, +10814: 1, +10839: 1, +10840: 1, +10852: 1, +10853: 1, +10858: 1, +10859: 1, +10860: 1, +10861: 1, +10863: 1, +10864: 1, +10867: 1, +10868: 1, +10873: 1, +10874: 1, +10875: 1, +10876: 1, +10877: 1, +10878: 1, +10879: 1, +10880: 1, +10881: 1, +10882: 1, +10883: 1, +10884: 1, +10885: 1, +10886: 1, +10887: 1, +10888: 1, +10889: 1, +10890: 1, +10891: 1, +10892: 1, +10893: 1, +10894: 1, +10895: 1, +10896: 1, +10897: 1, +10898: 1, +10899: 1, +10900: 1, +10901: 1, +10902: 1, +10903: 1, +10904: 1, +10905: 1, +10906: 1, +10907: 1, +10908: 1, +10909: 1, +10910: 1, +10911: 1, +10912: 1, +10913: 1, +10914: 1, +10915: 1, +10918: 1, +10919: 1, +10920: 1, +10921: 1, +10922: 1, +10923: 1, +10924: 1, +10925: 1, +10927: 1, +10928: 1, +10929: 1, +10930: 1, +10931: 1, +10932: 1, +10933: 1, +10934: 1, +10935: 1, +10936: 1, +10937: 1, +10938: 1, +10939: 1, +10940: 1, +10941: 1, +10942: 1, +10943: 1, +10944: 1, +10945: 1, +10946: 1, +10947: 1, +10948: 1, +10949: 1, +10950: 1, +10951: 1, +10952: 1, +10953: 1, +10954: 1, +10955: 1, +10956: 1, +10957: 1, +10958: 1, +10959: 1, +10960: 1, +10961: 1, +10962: 1, +10963: 1, +10964: 1, +10965: 1, +10966: 1, +10972: 1, +10974: 1, +10978: 1, +10979: 1, +10980: 1, +10981: 1, +10982: 1, +10988: 1, +10989: 1, +10990: 1, +10995: 1, +10999: 1, +11000: 1, +11001: 1, +11002: 1, +11003: 1, +11005: 1, +12296: 1, +12297: 1, +12298: 1, +12299: 1, +12300: 1, +12301: 1, +12302: 1, +12303: 1, +12304: 1, +12305: 1, +12308: 1, +12309: 1, +12310: 1, +12311: 1, +12312: 1, +12313: 1, +12314: 1, +12315: 1, +65288: 1, +65289: 1, +65308: 1, +65310: 1, +65339: 1, +65341: 1, +65371: 1, +65373: 1, +65375: 1, +65376: 1, +65378: 1, +65379: 1, +} + + +def mirrored(code): + return _mirrored.get(code, 0) + + +_mirrored = { +40: 1, +41: 1, +60: 1, +62: 1, +91: 1, +93: 1, +123: 1, +125: 1, +171: 1, +187: 1, +8249: 1, +8250: 1, +8261: 1, +8262: 1, +8317: 1, +8318: 1, +8333: 1, +8334: 1, +8512: 1, +8705: 1, +8706: 1, +8707: 1, +8708: 1, +8712: 1, +8713: 1, +8714: 1, +8715: 1, +8716: 1, +8717: 1, +8721: 1, +8725: 1, +8726: 1, +8730: 1, +8731: 1, +8732: 1, +8733: 1, +8735: 1, +8736: 1, +8737: 1, +8738: 1, +8740: 1, +8742: 1, +8747: 1, +8748: 1, +8749: 1, +8750: 1, +8751: 1, +8752: 1, +8753: 1, +8754: 1, +8755: 1, +8761: 1, +8763: 1, +8764: 1, +8765: 1, +8766: 1, +8767: 1, +8768: 1, +8769: 1, +8770: 1, +8771: 1, +8772: 1, +8773: 1, +8774: 1, +8775: 1, +8776: 1, +8777: 1, +8778: 1, +8779: 1, +8780: 1, +8786: 1, +8787: 1, +8788: 1, +8789: 1, +8799: 1, +8800: 1, +8802: 1, +8804: 1, +8805: 1, +8806: 1, +8807: 1, +8808: 1, +8809: 1, +8810: 1, +8811: 1, +8814: 1, +8815: 1, +8816: 1, +8817: 1, +8818: 1, +8819: 1, +8820: 1, +8821: 1, +8822: 1, +8823: 1, +8824: 1, +8825: 1, +8826: 1, +8827: 1, +8828: 1, +8829: 1, +8830: 1, +8831: 1, +8832: 1, +8833: 1, +8834: 1, +8835: 1, +8836: 1, +8837: 1, +8838: 1, +8839: 1, +8840: 1, +8841: 1, +8842: 1, +8843: 1, +8844: 1, +8847: 1, +8848: 1, +8849: 1, +8850: 1, +8856: 1, +8866: 1, +8867: 1, +8870: 1, +8871: 1, +8872: 1, +8873: 1, +8874: 1, +8875: 1, +8876: 1, +8877: 1, +8878: 1, +8879: 1, +8880: 1, +8881: 1, +8882: 1, +8883: 1, +8884: 1, +8885: 1, +8886: 1, +8887: 1, +8888: 1, +8894: 1, +8895: 1, +8905: 1, +8906: 1, +8907: 1, +8908: 1, +8909: 1, +8912: 1, +8913: 1, +8918: 1, +8919: 1, +8920: 1, +8921: 1, +8922: 1, +8923: 1, +8924: 1, +8925: 1, +8926: 1, +8927: 1, +8928: 1, +8929: 1, +8930: 1, +8931: 1, +8932: 1, +8933: 1, +8934: 1, +8935: 1, +8936: 1, +8937: 1, +8938: 1, +8939: 1, +8940: 1, +8941: 1, +8944: 1, +8945: 1, +8946: 1, +8947: 1, +8948: 1, +8949: 1, +8950: 1, +8951: 1, +8952: 1, +8953: 1, +8954: 1, +8955: 1, +8956: 1, +8957: 1, +8958: 1, +8959: 1, +8968: 1, +8969: 1, +8970: 1, +8971: 1, +8992: 1, +8993: 1, +9001: 1, +9002: 1, +10088: 1, +10089: 1, +10090: 1, +10091: 1, +10092: 1, +10093: 1, +10094: 1, +10095: 1, +10096: 1, +10097: 1, +10098: 1, +10099: 1, +10100: 1, +10101: 1, +10195: 1, +10196: 1, +10197: 1, +10198: 1, +10204: 1, +10205: 1, +10206: 1, +10210: 1, +10211: 1, +10212: 1, +10213: 1, +10214: 1, +10215: 1, +10216: 1, +10217: 1, +10218: 1, +10219: 1, +10627: 1, +10628: 1, +10629: 1, +10630: 1, +10631: 1, +10632: 1, +10633: 1, +10634: 1, +10635: 1, +10636: 1, +10637: 1, +10638: 1, +10639: 1, +10640: 1, +10641: 1, +10642: 1, +10643: 1, +10644: 1, +10645: 1, +10646: 1, +10647: 1, +10648: 1, +10651: 1, +10652: 1, +10653: 1, +10654: 1, +10655: 1, +10656: 1, +10657: 1, +10658: 1, +10659: 1, +10660: 1, +10661: 1, +10662: 1, +10663: 1, +10664: 1, +10665: 1, +10666: 1, +10667: 1, +10668: 1, +10669: 1, +10670: 1, +10671: 1, +10680: 1, +10688: 1, +10689: 1, +10690: 1, +10691: 1, +10692: 1, +10693: 1, +10697: 1, +10702: 1, +10703: 1, +10704: 1, +10705: 1, +10706: 1, +10708: 1, +10709: 1, +10712: 1, +10713: 1, +10714: 1, +10715: 1, +10716: 1, +10721: 1, +10723: 1, +10724: 1, +10725: 1, +10728: 1, +10729: 1, +10740: 1, +10741: 1, +10742: 1, +10743: 1, +10744: 1, +10745: 1, +10748: 1, +10749: 1, +10762: 1, +10763: 1, +10764: 1, +10765: 1, +10766: 1, +10767: 1, +10768: 1, +10769: 1, +10770: 1, +10771: 1, +10772: 1, +10773: 1, +10774: 1, +10775: 1, +10776: 1, +10777: 1, +10778: 1, +10779: 1, +10780: 1, +10782: 1, +10783: 1, +10784: 1, +10785: 1, +10788: 1, +10790: 1, +10793: 1, +10795: 1, +10796: 1, +10797: 1, +10798: 1, +10804: 1, +10805: 1, +10812: 1, +10813: 1, +10814: 1, +10839: 1, +10840: 1, +10852: 1, +10853: 1, +10858: 1, +10859: 1, +10860: 1, +10861: 1, +10863: 1, +10864: 1, +10867: 1, +10868: 1, +10873: 1, +10874: 1, +10875: 1, +10876: 1, +10877: 1, +10878: 1, +10879: 1, +10880: 1, +10881: 1, +10882: 1, +10883: 1, +10884: 1, +10885: 1, +10886: 1, +10887: 1, +10888: 1, +10889: 1, +10890: 1, +10891: 1, +10892: 1, +10893: 1, +10894: 1, +10895: 1, +10896: 1, +10897: 1, +10898: 1, +10899: 1, +10900: 1, +10901: 1, +10902: 1, +10903: 1, +10904: 1, +10905: 1, +10906: 1, +10907: 1, +10908: 1, +10909: 1, +10910: 1, +10911: 1, +10912: 1, +10913: 1, +10914: 1, +10915: 1, +10918: 1, +10919: 1, +10920: 1, +10921: 1, +10922: 1, +10923: 1, +10924: 1, +10925: 1, +10927: 1, +10928: 1, +10929: 1, +10930: 1, +10931: 1, +10932: 1, +10933: 1, +10934: 1, +10935: 1, +10936: 1, +10937: 1, +10938: 1, +10939: 1, +10940: 1, +10941: 1, +10942: 1, +10943: 1, +10944: 1, +10945: 1, +10946: 1, +10947: 1, +10948: 1, +10949: 1, +10950: 1, +10951: 1, +10952: 1, +10953: 1, +10954: 1, +10955: 1, +10956: 1, +10957: 1, +10958: 1, +10959: 1, +10960: 1, +10961: 1, +10962: 1, +10963: 1, +10964: 1, +10965: 1, +10966: 1, +10972: 1, +10974: 1, +10978: 1, +10979: 1, +10980: 1, +10981: 1, +10982: 1, +10988: 1, +10989: 1, +10990: 1, +10995: 1, +10999: 1, +11000: 1, +11001: 1, +11002: 1, +11003: 1, +11005: 1, +12296: 1, +12297: 1, +12298: 1, +12299: 1, +12300: 1, +12301: 1, +12302: 1, +12303: 1, +12304: 1, +12305: 1, +12308: 1, +12309: 1, +12310: 1, +12311: 1, +12312: 1, +12313: 1, +12314: 1, +12315: 1, +65288: 1, +65289: 1, +65308: 1, +65310: 1, +65339: 1, +65341: 1, +65371: 1, +65373: 1, +65375: 1, +65376: 1, +65378: 1, +65379: 1, +} + + +def mirrored(code): + return _mirrored.get(code, 0) + + From arigo at codespeak.net Tue May 17 17:29:06 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Tue, 17 May 2005 17:29:06 +0200 (CEST) Subject: [pypy-svn] r12417 - pypy/dist/pypy/objspace/std/test Message-ID: <20050517152906.1EF1B27BDF@code1.codespeak.net> Author: arigo Date: Tue May 17 17:29:05 2005 New Revision: 12417 Modified: pypy/dist/pypy/objspace/std/test/test_stringformat.py Log: A string formatting float rounding test, disabled for now, as a reminder. Modified: pypy/dist/pypy/objspace/std/test/test_stringformat.py ============================================================================== --- pypy/dist/pypy/objspace/std/test/test_stringformat.py (original) +++ pypy/dist/pypy/objspace/std/test/test_stringformat.py Tue May 17 17:29:05 2005 @@ -64,6 +64,7 @@ assert '23.456' == '%s' % 23.456 # for 'r' use a float that has an exact decimal rep: assert '23.125' == '%r' % 23.125 + # XXX rounding: assert '0.028' == '%.3f' % 0.0276 def test_format_int(self): assert '23' == '%d' % 23 From pedronis at codespeak.net Tue May 17 17:53:55 2005 From: pedronis at codespeak.net (pedronis at codespeak.net) Date: Tue, 17 May 2005 17:53:55 +0200 (CEST) Subject: [pypy-svn] r12418 - pypy/dist/pypy/documentation Message-ID: <20050517155355.AD38227C0A@code1.codespeak.net> Author: pedronis Date: Tue May 17 17:53:55 2005 New Revision: 12418 Added: pypy/dist/pypy/documentation/release-0.6.txt (contents, props changed) Log: start of announcement draft: outline Added: pypy/dist/pypy/documentation/release-0.6.txt ============================================================================== --- (empty file) +++ pypy/dist/pypy/documentation/release-0.6.txt Tue May 17 17:53:55 2005 @@ -0,0 +1,16 @@ + +* intro... + +* what it is + +* what's working/ caveats (speed...) + +* links to download etc + +* audience, + +* interesting bits + +* on-going work, near future goals + +* Team acks... \ No newline at end of file From ac at codespeak.net Tue May 17 17:56:58 2005 From: ac at codespeak.net (ac at codespeak.net) Date: Tue, 17 May 2005 17:56:58 +0200 (CEST) Subject: [pypy-svn] r12419 - in pypy/branch/non-fake-unicode/pypy/objspace/std: . test Message-ID: <20050517155658.9EE4227C0A@code1.codespeak.net> Author: ac Date: Tue May 17 17:56:58 2005 New Revision: 12419 Modified: pypy/branch/non-fake-unicode/pypy/objspace/std/test/test_unicodestring.py pypy/branch/non-fake-unicode/pypy/objspace/std/unicodeobject.py pypy/branch/non-fake-unicode/pypy/objspace/std/unicodetype.py Log: Add methods to unicode. Only __mod__ missing now. Modified: pypy/branch/non-fake-unicode/pypy/objspace/std/test/test_unicodestring.py ============================================================================== --- pypy/branch/non-fake-unicode/pypy/objspace/std/test/test_unicodestring.py (original) +++ pypy/branch/non-fake-unicode/pypy/objspace/std/test/test_unicodestring.py Tue May 17 17:56:58 2005 @@ -38,3 +38,29 @@ def test_contains(self): assert u'a' in 'abc' assert 'a' in u'abc' + + def test_splitlines(self): + assert u''.splitlines() == [] + assert u''.splitlines(1) == [] + assert u'\n'.splitlines() == [u''] + assert u'a'.splitlines() == [u'a'] + assert u'one\ntwo'.splitlines() == [u'one', u'two'] + assert u'\ntwo\nthree'.splitlines() == [u'', u'two', u'three'] + assert u'\n\n'.splitlines() == [u'', u''] + assert u'a\nb\nc'.splitlines(1) == [u'a\n', u'b\n', u'c'] + assert u'\na\nb\n'.splitlines(1) == [u'\n', u'a\n', u'b\n'] + + def test_zfill(self): + assert u'123'.zfill(6) == u'000123' + assert u'123'.zfill(2) == u'123' + assert u'123'.zfill(6) == u'000123' + assert u'+123'.zfill(2) == u'+123' + assert u'+123'.zfill(4) == u'+123' + assert u'+123'.zfill(6) == u'+00123' + + def test_split(self): + assert (u'this is the split function'.split() == + [u'this', u'is', u'the', u'split', u'function']) + assert (u'this!is!the!split!function'.split('!') == + [u'this', u'is', u'the', u'split', u'function']) + Modified: pypy/branch/non-fake-unicode/pypy/objspace/std/unicodeobject.py ============================================================================== --- pypy/branch/non-fake-unicode/pypy/objspace/std/unicodeobject.py (original) +++ pypy/branch/non-fake-unicode/pypy/objspace/std/unicodeobject.py Tue May 17 17:56:58 2005 @@ -1,4 +1,5 @@ from pypy.objspace.std.objspace import * +from pypy.interpreter import gateway from pypy.objspace.std.fake import wrap_exception from pypy.objspace.std.stringobject import W_StringObject from pypy.objspace.std.noneobject import W_NoneObject @@ -25,26 +26,23 @@ registerimplementation(W_UnicodeObject) # Helper for converting int/long -import unicodedata def unicode_to_decimal_w(space, w_unistr): unistr = w_unistr._value result = ['\0'] * len(unistr) digits = [ '0', '1', '2', '3', '4', '5', '6', '7', '8', '9'] for i in xrange(len(unistr)): - uchr = unistr[i] - if _isspace(uchr): + uchr = ord(unistr[i]) + if unicodedb.isspace(uchr): result[i] = ' ' continue try: - result[i] = digits[unicodedata.decimal(uchr)] - continue - except ValueError: - ch = ord(uchr) - if 0 < ch < 256: - result[i] = chr(ch) - continue - raise OperationError(space.w_UnicodeEncodeError, space.wrap('invalid decimal Unicode string')) + result[i] = digits[unicodedb.decimal(uchr)] + except KeyError: + if 0 < uchr < 256: + result[i] = chr(uchr) + else: + raise OperationError(space.w_UnicodeEncodeError, space.wrap('invalid decimal Unicode string')) return ''.join(result) # string-to-unicode delegation @@ -77,7 +75,14 @@ if test > 0: return space.wrap(1) return space.wrap(0) - + +def cmp__Unicode_ANY(space, w_left, w_right): + try: + w_right = space.call_function(space.w_unicode, w_right) + except: + return space.wrap(1) + return space.cmp(w_left, w_right) + def ord__Unicode(space, w_uni): if len(w_uni._value) != 1: raise OperationError(space.w_TypeError, space.wrap('ord() expected a character')) @@ -104,18 +109,36 @@ def contains__String_Unicode(space, w_container, w_item): return space.contains(space.call_function(space.w_unicode, w_container), w_item ) +def _find(self, sub, start, end): + if len(sub) == 0: + return start + if start >= end: + return -1 + for i in range(start, end - len(sub) + 1): + for j in range(len(sub)): + if self[i + j] != sub[j]: + break + else: + return i + return -1 + +def _rfind(self, sub, start, end): + if len(sub) == 0: + return end + if end - start < len(sub): + return -1 + for i in range(end - len(sub), start - 1, -1): + for j in range(len(sub)): + if self[i + j] != sub[j]: + break + else: + return i + return -1 + def contains__Unicode_Unicode(space, w_container, w_item): item = w_item._value container = w_container._value - if len(item) == 0: - return space.w_True - for i in range(len(container) - len(item) + 1): - for j in range(len(item)): - if container[i + j] != item[j]: - break - else: - return space.w_True - return space.w_False + return space.newbool(_find(container, item, 0, len(container)) >= 0) def unicode_join__Unicode_ANY(space, w_self, w_list): list = space.unpackiterable(w_list) @@ -123,12 +146,20 @@ totlen = 0 if len(list) == 0: return W_UnicodeObject(space, []) - if len(list) == 1: - return space.call_function(space.w_unicode, list[0]) for i in range(len(list)): - list[i] = space.call_function(space.w_unicode, list[i])._value + item = list[i] + if space.is_true(space.isinstance(item, space.w_unicode)): + list[i] = item._value + elif space.is_true(space.isinstance(item, space.w_str)): + list[i] = space.call_function(space.w_unicode, item)._value + else: + w_msg = space.mod(space.wrap('sequence item %d: expected string or Unicode'), + space.wrap(i)) + raise OperationError(space.w_TypeError, w_msg) totlen += len(list[i]) totlen += len(delim) * (len(list) - 1) + if len(list) == 1: + return W_UnicodeObject(space, list[0]) # Allocate result result = [u'\0'] * totlen first = list[0] @@ -152,6 +183,7 @@ return space.wrap(u''.join(w_self._value).encode(space.str_w(w_encoding), space.str_w(w_errors))) except: wrap_exception(space) + def unicode_encode__Unicode_String_None(space, w_self, w_encoding, w_none): try: return space.wrap(u''.join(w_self._value).encode(space.str_w(w_encoding))) @@ -198,6 +230,12 @@ r = [uni[start + i*step] for i in range(sl)] return W_UnicodeObject(space, r) +def unicode_getslice__Unicode_ANY_ANY(space, w_uni, w_start, w_end): + w_slice = space.call_function(space.w_slice, w_start, w_end) + uni = w_uni._value + length = len(uni) + start, stop, step, sl = slicetype.indices4(space, w_slice, length) + return W_UnicodeObject(space, uni[start:stop]) def mul__Unicode_ANY(space, w_uni, w_times): chars = w_uni._value @@ -206,11 +244,14 @@ if times <= 0 or charlen == 0: return W_UnicodeObject(space, []) if times == 1: - return w_uni + return space.call_function(space.w_unicode, w_uni) if charlen == 1: return W_UnicodeObject(space, [w_uni._value[0]] * times) - result = [u'\0'] * (charlen * times) + try: + result = [u'\0'] * (charlen * times) + except OverflowError: + raise OperationError(space.w_OverflowError, space.wrap('repeated string is too long')) for i in range(times): offset = i * charlen for j in range(charlen): @@ -221,11 +262,93 @@ return space.mul(w_uni, w_times) def _isspace(uchar): - code = ord(uchar) - try: - return unicodedb.category[code] == 'Zs' or unicodedb.bidirectional[code] in ("WS", "B", "S") - except: - return False + return unicodedb.isspace(ord(uchar)) + +def unicode_isspace__Unicode(space, w_unicode): + if len(w_unicode._value) == 0: + return space.w_False + for uchar in w_unicode._value: + if not unicodedb.isspace(ord(uchar)): + return space.w_False + return space.w_True + +def unicode_isalpha__Unicode(space, w_unicode): + if len(w_unicode._value) == 0: + return space.w_False + for uchar in w_unicode._value: + if not unicodedb.isalpha(ord(uchar)): + return space.w_False + return space.w_True + +def unicode_isalnum__Unicode(space, w_unicode): + if len(w_unicode._value) == 0: + return space.w_False + for uchar in w_unicode._value: + if not (unicodedb.isalpha(ord(uchar)) or + unicodedb.isnumeric(ord(uchar))): + return space.w_False + return space.w_True + +def unicode_isdecimal__Unicode(space, w_unicode): + if len(w_unicode._value) == 0: + return space.w_False + for uchar in w_unicode._value: + if not unicodedb.isdecimal(ord(uchar)): + return space.w_False + return space.w_True + +def unicode_isdigit__Unicode(space, w_unicode): + if len(w_unicode._value) == 0: + return space.w_False + for uchar in w_unicode._value: + if not unicodedb.isdigit(ord(uchar)): + return space.w_False + return space.w_True + +def unicode_isnumeric__Unicode(space, w_unicode): + if len(w_unicode._value) == 0: + return space.w_False + for uchar in w_unicode._value: + if not unicodedb.isnumeric(ord(uchar)): + return space.w_False + return space.w_True + +def unicode_islower__Unicode(space, w_unicode): + cased = False + for uchar in w_unicode._value: + if (unicodedb.isupper(ord(uchar)) or + unicodedb.istitle(ord(uchar))): + return space.w_False + if not cased and unicodedb.islower(ord(uchar)): + cased = True + return space.newbool(cased) + +def unicode_isupper__Unicode(space, w_unicode): + cased = False + for uchar in w_unicode._value: + if (unicodedb.islower(ord(uchar)) or + unicodedb.istitle(ord(uchar))): + return space.w_False + if not cased and unicodedb.isupper(ord(uchar)): + cased = True + return space.newbool(cased) + +def unicode_istitle__Unicode(space, w_unicode): + cased = False + previous_is_cased = False + for uchar in w_unicode._value: + if (unicodedb.isupper(ord(uchar)) or + unicodedb.istitle(ord(uchar))): + if previous_is_cased: + return space.w_False + previous_is_cased = cased = True + elif unicodedb.islower(ord(uchar)): + if not previous_is_cased: + return space.w_False + previous_is_cased = cased = True + else: + previous_is_cased = False + return space.newbool(cased) def _strip(space, w_self, w_chars, left, right): "internal function called by str_xstrip methods" @@ -292,6 +415,361 @@ return space.call_method(w_self, 'rstrip', space.call_function(space.w_unicode, w_chars)) +def unicode_capitalize__Unicode(space, w_self): + input = w_self._value + if len(input) == 0: + return W_UnicodeObject(space, []) + result = [u'\0'] * len(input) + result[0] = unichr(unicodedb.toupper(ord(input[0]))) + for i in range(1, len(input)): + result[i] = unichr(unicodedb.tolower(ord(input[i]))) + return W_UnicodeObject(space, result) + +def unicode_title__Unicode(space, w_self): + input = w_self._value + if len(input) == 0: + return w_self + result = [u'\0'] * len(input) + + previous_is_cased = 0 + for i in range(len(input)): + unichar = ord(input[i]) + if previous_is_cased: + result[i] = unichr(unicodedb.tolower(unichar)) + else: + result[i] = unichr(unicodedb.totitle(unichar)) + previous_is_cased = unicodedb.iscased(unichar) + return W_UnicodeObject(space, result) + +def unicode_lower__Unicode(space, w_self): + input = w_self._value + result = [u'\0'] * len(input) + for i in range(len(input)): + result[i] = unichr(unicodedb.tolower(ord(input[i]))) + return W_UnicodeObject(space, result) + +def unicode_upper__Unicode(space, w_self): + input = w_self._value + result = [u'\0'] * len(input) + for i in range(len(input)): + result[i] = unichr(unicodedb.toupper(ord(input[i]))) + return W_UnicodeObject(space, result) + +def unicode_swapcase__Unicode(space, w_self): + input = w_self._value + result = [u'\0'] * len(input) + for i in range(len(input)): + unichar = ord(input[i]) + if unicodedb.islower(unichar): + result[i] = unichr(unicodedb.toupper(unichar)) + elif unicodedb.isupper(unichar): + result[i] = unichr(unicodedb.tolower(unichar)) + else: + result[i] = input[i] + return W_UnicodeObject(space, result) + +def _normalize_index(length, index): + if index < 0: + index += length + if index < 0: + index = 0 + elif index > length: + index = length + return index + +def unicode_endswith__Unicode_Unicode_ANY_ANY(space, w_self, w_substr, w_start, w_end): + self = w_self._value + start = _normalize_index(len(self), space.int_w(w_start)) + end = _normalize_index(len(self), space.int_w(w_end)) + + substr = w_substr._value + substr_len = len(substr) + + if end - start < substr_len: + return space.w_False # substring is too long + start = end - substr_len + for i in range(substr_len): + if self[start + i] != substr[i]: + return space.w_False + return space.w_True + +def unicode_startswith__Unicode_Unicode_ANY_ANY(space, w_self, w_substr, w_start, w_end): + self = w_self._value + start = _normalize_index(len(self), space.int_w(w_start)) + end = _normalize_index(len(self), space.int_w(w_end)) + + substr = w_substr._value + substr_len = len(substr) + + if end - start < substr_len: + return space.w_False # substring is too long + + for i in range(substr_len): + if self[start + i] != substr[i]: + return space.w_False + return space.w_True + +def unicode_center__Unicode_ANY(space, w_self, w_width): + self = w_self._value + width = space.int_w(w_width) + padding = width - len(self) + if padding < 0: + return space.call_function(space.w_unicode, w_self) + leftpad = padding // 2 + (padding & width & 1) + result = [u' '] * width + for i in range(len(self)): + result[leftpad + i] = self[i] + return W_UnicodeObject(space, result) + + +def unicode_ljust__Unicode_ANY(space, w_self, w_width): + self = w_self._value + width = space.int_w(w_width) + padding = width - len(self) + if padding < 0: + return space.call_function(space.w_unicode, w_self) + result = [u' '] * width + for i in range(len(self)): + result[i] = self[i] + return W_UnicodeObject(space, result) + +def unicode_rjust__Unicode_ANY(space, w_self, w_width): + self = w_self._value + width = space.int_w(w_width) + padding = width - len(self) + if padding < 0: + return space.call_function(space.w_unicode, w_self) + result = [u' '] * width + for i in range(len(self)): + result[padding + i] = self[i] + return W_UnicodeObject(space, result) + +def unicode_zfill__Unicode_ANY(space, w_self, w_width): + self = w_self._value + width = space.int_w(w_width) + if len(self) == 0: + return W_UnicodeObject(space, [u'0'] * width) + padding = width - len(self) + if padding <= 0: + return space.call_function(space.w_unicode, w_self) + result = [u'0'] * width + for i in range(len(self)): + result[padding + i] = self[i] + # Move sign to first position + if self[0] in (u'+', u'-'): + result[0] = self[0] + result[padding] = u'0' + return W_UnicodeObject(space, result) + +def unicode_splitlines__Unicode_ANY(space, w_self, w_keepends): + self = w_self._value + keepends = 0 + if space.int_w(w_keepends): + keepends = 1 + if len(self) == 0: + return space.newlist([]) + + start = 0 + end = len(self) + pos = 0 + lines = [] + while pos < end: + if unicodedb.islinebreak(ord(self[pos])): + if (self[pos] == u'\r' and pos + 1 < end and + self[pos + 1] == u'\n'): + # Count CRLF as one linebreak + lines.append(W_UnicodeObject(space, + self[start:pos + keepends * 2])) + pos += 1 + else: + lines.append(W_UnicodeObject(space, + self[start:pos + keepends])) + pos += 1 + start = pos + else: + pos += 1 + if not unicodedb.islinebreak(ord(self[end - 1])): + lines.append(W_UnicodeObject(space, self[start:])) + return space.newlist(lines) + +def unicode_find__Unicode_Unicode_ANY_ANY(space, w_self, w_substr, w_start, w_end): + self = w_self._value + start = _normalize_index(len(self), space.int_w(w_start)) + end = _normalize_index(len(self), space.int_w(w_end)) + substr = w_substr._value + return space.wrap(_find(self, substr, start, end)) + +def unicode_rfind__Unicode_Unicode_ANY_ANY(space, w_self, w_substr, w_start, w_end): + self = w_self._value + start = _normalize_index(len(self), space.int_w(w_start)) + end = _normalize_index(len(self), space.int_w(w_end)) + substr = w_substr._value + return space.wrap(_rfind(self, substr, start, end)) + +def unicode_index__Unicode_Unicode_ANY_ANY(space, w_self, w_substr, w_start, w_end): + self = w_self._value + start = _normalize_index(len(self), space.int_w(w_start)) + end = _normalize_index(len(self), space.int_w(w_end)) + substr = w_substr._value + index = _find(self, substr, start, end) + if index < 0: + raise OperationError(space.w_ValueError, + space.wrap('substring not found')) + return space.wrap(index) + +def unicode_rindex__Unicode_Unicode_ANY_ANY(space, w_self, w_substr, w_start, w_end): + self = w_self._value + start = _normalize_index(len(self), space.int_w(w_start)) + end = _normalize_index(len(self), space.int_w(w_end)) + substr = w_substr._value + index = _rfind(self, substr, start, end) + if index < 0: + raise OperationError(space.w_ValueError, + space.wrap('substring not found')) + return space.wrap(index) + +def unicode_count__Unicode_Unicode_ANY_ANY(space, w_self, w_substr, w_start, w_end): + self = w_self._value + start = _normalize_index(len(self), space.int_w(w_start)) + end = _normalize_index(len(self), space.int_w(w_end)) + substr = w_substr._value + count = 0 + while start <= end: + index = _find(self, substr, start, end) + if index < 0: + break + start = index + 1 + count += 1 + return space.wrap(count) + + +def unicode_split__Unicode_None_ANY(space, w_self, w_none, w_maxsplit): + self = w_self._value + maxsplit = space.int_w(w_maxsplit) + parts = [] + if len(self) == 0: + return space.newlist([]) + start = 0 + end = len(self) + while maxsplit != 0 and start < end: + index = start + for index in range(start, end): + if _isspace(self[index]): + break + else: + break + parts.append(W_UnicodeObject(space, self[start:index])) + maxsplit -= 1 + # Eat whitespace + for start in range(index + 1, end): + if not _isspace(self[start]): + break + else: + return space.newlist(parts) + parts.append(W_UnicodeObject(space, self[start:])) + return space.newlist(parts) + + +def unicode_split__Unicode_Unicode_ANY(space, w_self, w_delim, w_maxsplit): + self = w_self._value + delim = w_delim._value + maxsplit = space.int_w(w_maxsplit) + delim_len = len(delim) + if delim_len == 0: + raise OperationError(space.w_ValueError, + space.wrap('empty separator')) + parts = [] + if len(self) == 0: + return space.newlist([]) + start = 0 + end = len(self) + while maxsplit != 0: + index = _find(self, delim, start, end) + if index < 0: + break + parts.append(W_UnicodeObject(space, self[start:index])) + start = index + delim_len + maxsplit -= 1 + parts.append(W_UnicodeObject(space, self[start:])) + return space.newlist(parts) + +def _split(space, self, maxsplit): + if len(self) == 0: + return [] + if maxsplit == 0: + return [W_UnicodeObject(space, self)] + index = 0 + end = len(self) + parts = [W_UnicodeObject(space, [])] + maxsplit -= 1 + while maxsplit != 0: + if index >= end: + break + parts.append(W_UnicodeObject(space, [self[index]])) + index += 1 + maxsplit -= 1 + parts.append(W_UnicodeObject(space, self[index:])) + return parts + +def unicode_replace__Unicode_Unicode_Unicode_ANY(space, w_self, w_old, + w_new, w_maxsplit): + if len(w_old._value): + w_parts = space.call_method(w_self, 'split', w_old, w_maxsplit) + else: + self = w_self._value + maxsplit = space.int_w(w_maxsplit) + w_parts = space.newlist(_split(space, self, maxsplit)) + return space.call_method(w_new, 'join', w_parts) + + +'translate' +app = gateway.applevel(r''' +import sys + +def unicode_expandtabs__Unicode_ANY(self, tabsize): + parts = self.split(u'\t') + result = [ parts[0] ] + prevsize = 0 + for ch in parts[0]: + prevsize += 1 + if ch in (u"\n", u"\r"): + prevsize = 0 + for i in range(1, len(parts)): + pad = tabsize - prevsize % tabsize + result.append(u' ' * pad) + nextpart = parts[i] + result.append(nextpart) + prevsize = 0 + for ch in nextpart: + prevsize += 1 + if ch in (u"\n", u"\r"): + prevsize = 0 + return u''.join(result) + +def unicode_translate__Unicode_ANY(self, table): + result = [] + for unichar in self: + try: + newval = table[ord(unichar)] + except KeyError: + result.append(unichar) + else: + if newval is None: + continue + elif isinstance(newval, int): + if newval < 0 or newval > sys.maxunicode: + raise TypeError("character mapping must be in range(0x%x)"%(sys.maxunicode + 1,)) + result.append(unichr(newval)) + elif isinstance(newval, unicode): + result.append(newval) + else: + raise TypeError("character mapping must return integer, None or unicode") + return ''.join(result) + +''') +unicode_expandtabs__Unicode_ANY = app.interphook('unicode_expandtabs__Unicode_ANY') +unicode_translate__Unicode_ANY = app.interphook('unicode_translate__Unicode_ANY') + import unicodetype register_all(vars(), unicodetype) @@ -301,15 +779,38 @@ import stringtype W_UnicodeObject = W_UnicodeObject from pypy.objspace.std.stringobject import W_StringObject - def str_strip__String_Unicode(space, w_self, w_chars ): + def str_strip__String_Unicode(space, w_self, w_chars): return space.call_method(space.call_function(space.w_unicode, w_self), 'strip', w_chars) - def str_lstrip__String_Unicode(space, w_self, w_chars ): + def str_lstrip__String_Unicode(space, w_self, w_chars): return space.call_method(space.call_function(space.w_unicode, w_self), 'lstrip', w_chars) self = w_self._value - def str_rstrip__String_Unicode(space, w_self, w_chars ): + def str_rstrip__String_Unicode(space, w_self, w_chars): return space.call_method(space.call_function(space.w_unicode, w_self), 'rstrip', w_chars) + def str_count__String_Unicode_ANY_ANY(space, w_self, w_substr, w_start, w_end): + return space.call_method(space.call_function(space.w_unicode, w_self), + 'count', w_substr, w_start, w_end) + def str_find__String_Unicode_ANY_ANY(space, w_self, w_substr, w_start, w_end): + return space.call_method(space.call_function(space.w_unicode, w_self), + 'find', w_substr, w_start, w_end) + def str_rfind__String_Unicode_ANY_ANY(space, w_self, w_substr, w_start, w_end): + return space.call_method(space.call_function(space.w_unicode, w_self), + 'rfind', w_substr, w_start, w_end) + def str_index__String_Unicode_ANY_ANY(space, w_self, w_substr, w_start, w_end): + return space.call_method(space.call_function(space.w_unicode, w_self), + 'index', w_substr, w_start, w_end) + def str_rindex__String_Unicode_ANY_ANY(space, w_self, w_substr, w_start, w_end): + return space.call_method(space.call_function(space.w_unicode, w_self), + 'rindex', w_substr, w_start, w_end) + def str_replace__String_Unicode_Unicode_ANY(space, w_self, w_old, w_new, w_maxsplit): + return space.call_method(space.call_function(space.w_unicode, w_self), + 'replace', w_old, w_new, w_maxsplit) + + def str_split__String_Unicode_ANY(space, w_self, w_delim, w_maxsplit): + return space.call_method(space.call_function(space.w_unicode, w_self), + 'split', w_delim, w_maxsplit) + register_all(vars(), stringtype) Modified: pypy/branch/non-fake-unicode/pypy/objspace/std/unicodetype.py ============================================================================== --- pypy/branch/non-fake-unicode/pypy/objspace/std/unicodetype.py (original) +++ pypy/branch/non-fake-unicode/pypy/objspace/std/unicodetype.py Tue May 17 17:56:58 2005 @@ -8,7 +8,7 @@ unicode_center = MultiMethod('center', 2, ) unicode_count = MultiMethod('count', 4, defaults=(0, maxint)) unicode_encode = MultiMethod('encode', 3, defaults=(None, None)) -unicode_endswith = MultiMethod('endswith', 2) #[optional arguments not supported now] +unicode_endswith = MultiMethod('endswith', 4, defaults=(0,maxint)) unicode_expandtabs = MultiMethod('expandtabs', 2, defaults=(8,)) unicode_find = MultiMethod('find', 4, defaults=(0, maxint)) unicode_index = MultiMethod('index', 4, defaults=(0, maxint)) @@ -32,47 +32,78 @@ unicode_rstrip = MultiMethod('rstrip', 2, defaults=(None,)) unicode_split = MultiMethod('split', 3, defaults=(None,-1)) unicode_splitlines = MultiMethod('splitlines', 2, defaults=(0,)) -unicode_startswith = MultiMethod('startswith', 3, defaults=(0,)) +unicode_startswith = MultiMethod('startswith', 4, defaults=(0,maxint)) unicode_strip = MultiMethod('strip', 2, defaults=(None,)) unicode_swapcase = MultiMethod('swapcase', 1) unicode_title = MultiMethod('title', 1) -unicode_translate = MultiMethod('translate', 3, defaults=('',)) +unicode_translate = MultiMethod('translate', 2) unicode_upper = MultiMethod('upper', 1) unicode_zfill = MultiMethod('zfill', 2) - +unicode_getslice = MultiMethod('__getslice__', 3) # ____________________________________________________________ + +app = gateway.applevel(''' +import codecs, sys + +def unicode_from_encoded_object(obj, encoding, errors): + # Fix later for buffer + if type(obj).__name__ == 'buffer': + obj = obj.buf + if encoding is None: + encoding = sys.getdefaultencoding() + decoder = codecs.getdecoder(encoding) + if errors is None: + retval, lenght = decoder(obj) + else: + retval, length = decoder(obj, errors) + if not isinstance(retval, unicode): + raise TypeError("decoder did not return an unicode object (type=%s)" % + type(retval).__name__) + return retval + +def unicode_from_object(obj): + if isinstance(obj, str): + res = obj + else: + try: + unicode_method = obj.__unicode__ + except AttributeError: + res = str(obj) + else: + res = unicode_method() + if isinstance(res, unicode): + return res + return unicode_from_encoded_object(res, None, "strict") + +''') +unicode_from_object = app.interphook('unicode_from_object') +unicode_from_encoded_object = app.interphook('unicode_from_encoded_object') + + def descr__new__(space, w_unicodetype, w_obj=None, w_encoding=None, w_errors=None): from pypy.objspace.std.unicodeobject import W_UnicodeObject w_obj_type = space.type(w_obj) if space.is_w(w_obj_type, space.w_unicode): + if (not space.is_w(w_encoding, space.w_None) or + not space.is_w(w_errors, space.w_None)): + raise OperationError(space.w_TypeError, + space.wrap('decoding Unicode is not supported')) if space.is_w(w_unicodetype, space.w_unicode): return w_obj - value = w_obj._value + w_value = w_obj elif space.is_w(w_obj, space.w_None): - value = [] - elif space.is_true(space.isinstance(w_obj, space.w_unicode)): - value = w_obj._value - elif space.is_w(w_obj_type, space.w_str): - try: - if space.is_w(w_encoding, space.w_None): - value = [ u for u in unicode(space.str_w(w_obj)) ] - elif space.is_w(w_errors, space.w_None): - value = [ u for u in unicode(space.str_w(w_obj), - space.str_w(w_encoding)) ] - else: - value = [u for u in unicode(space.str_w(w_obj), - space.str_w(w_encoding), - space.str_w(w_errors)) ] - except UnicodeDecodeError, e: - raise OperationError(space.w_UnicodeDecodeError, - space.wrap(e.reason)) + w_value = W_UnicodeObject(space, []) + elif (space.is_w(w_encoding, space.w_None) and + space.is_w(w_errors, space.w_None)): + if space.is_true(space.isinstance(w_obj, space.w_unicode)): + w_value = w_obj + else: + w_value = unicode_from_object(space, w_obj) else: - # try with __unicode__ - raise OperationError(space.w_ValueError, - space.wrap('Can not create unicode from other than strings'%w_obj_type)) + w_value = unicode_from_encoded_object(space, w_obj, w_encoding, w_errors) w_newobj = space.allocate_instance(W_UnicodeObject, w_unicodetype) - w_newobj.__init__(space, value) + w_newobj.__init__(space, w_value._value) return w_newobj # ____________________________________________________________ From hpk at codespeak.net Tue May 17 22:32:38 2005 From: hpk at codespeak.net (hpk at codespeak.net) Date: Tue, 17 May 2005 22:32:38 +0200 (CEST) Subject: [pypy-svn] r12421 - in pypy/dist: . Pyrex pypy/module/builtin Message-ID: <20050517203238.DF00727C0A@code1.codespeak.net> Author: hpk Date: Tue May 17 22:32:38 2005 New Revision: 12421 Added: pypy/dist/LICENSE pypy/dist/Pyrex/LICENSE Modified: pypy/dist/pypy/module/builtin/app_help.py Log: issue52 testing Added a first draft for a top-level LICENSE files, where the copyrights got computed by examining all committers (via svn log) on the pypy and py directories. The list is currently ordered by number of commits. If desired i could extend the script and let it try to run "svn blame". It probably would give a somewhat more appropriate picture. Additionally i put a pseudo-LICENSE into the Pyrex directory (it was the only notice i could find from the Pyrex author). So the questions are (apart from the minor ordering issue): - do we want to reduce the list of PyPy copyright holders somehow? - are there any no included sub-projects that miss copyright statements or a LICENSE file? Added: pypy/dist/LICENSE ============================================================================== --- (empty file) +++ pypy/dist/LICENSE Tue May 17 22:32:38 2005 @@ -0,0 +1,96 @@ +License for files in the pypy and py directory +============================================== + +Except when otherwise stated (look for LICENSE files in directories or +information at the beginning of each file) all software and +documentation in the 'pypy' and 'py' directories is licensed as follows: + + The MIT License + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without + restriction, including without limitation the rights to use, + copy, modify, merge, publish, distribute, sublicense, and/or + sell copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. + + +PyPy Copyright holders 2003-2005 +==================================================== + +Except when otherwise stated (look for LICENSE files or information at +the beginning of each file) the files in the 'pypy' directory are each +copyrighted by one or more of the following people and organizations: + + Armin Rigo + Samuele Pedroni + Holger Krekel + Michael Hudson + Christian Tismer + Seo Sanghyeon + Alex Martelli + Stefan Schwarzer + Patrick Maupin + Carl Friedrich Bolz + Bob Ippolito + Anders Chrigstrom + Jacob Hallen + Marius Gedminas + Laura Creighton + Guido Van Rossum + Richard Emslie + Ludovic Aubry + Adrien Di Mascio + Stephan Diehl <> + Dinu Gherman + Guenter Jantzen + Anders Lehmann + Rocco Moretti + Olivier Dormond + Brian Dorsey + Jonathan David Riehl + Andreas Friedge + Jens-Uwe Mager + Alan McIntyre + Lutz Paelike + Jacek Generowicz + Ben Young + Michael Chermside + + Heinrich-Heine University, Germany + AB Strakt, Sweden + merlinux GmbH, Germany + tismerysoft GmbH, Germany + Logilab Paris, France + DFKI GmbH, Germany + + +py lib Copyright holders, 2003-2005 +========================================== + +Except when otherwise stated (look for LICENSE files or information at +the beginning of each file) the files in the 'py' directory are +copyrighted by one or more of the following people and organizations: + + Holger Krekel + merlinux GmbH, Germany + Armin Rigo + Jan Balster + +Contributors include:: + + Ian Bicking + Grig Gheorghiu + Bob Ippolito Added: pypy/dist/Pyrex/LICENSE ============================================================================== --- (empty file) +++ pypy/dist/Pyrex/LICENSE Tue May 17 22:32:38 2005 @@ -0,0 +1,13 @@ +Copyright stuff: Pyrex is free of restrictions. You +may use, redistribute, modify and distribute modified +versions. + +The latest version of Pyrex can be found here: + +http://www.cosc.canterbury.ac.nz/~greg/python/Pyrex/ + +Greg Ewing, Computer Science Dept, +--------------------------------------+ +University of Canterbury, | A citizen of NewZealandCorp, a | +Christchurch, New Zealand | wholly-owned subsidiary of USA Inc. | +greg at cosc.canterbury.ac.nz + Modified: pypy/dist/pypy/module/builtin/app_help.py ============================================================================== --- pypy/dist/pypy/module/builtin/app_help.py (original) +++ pypy/dist/pypy/module/builtin/app_help.py Tue May 17 22:32:38 2005 @@ -17,7 +17,7 @@ def license(): print \ """ -Copyright (c) <2003-2004> +Copyright (c) <2003-2005> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: From pedronis at codespeak.net Tue May 17 23:44:04 2005 From: pedronis at codespeak.net (pedronis at codespeak.net) Date: Tue, 17 May 2005 23:44:04 +0200 (CEST) Subject: [pypy-svn] r12422 - pypy/dist/pypy/translator/tool/pygame Message-ID: <20050517214404.70AB627BFE@code1.codespeak.net> Author: pedronis Date: Tue May 17 23:44:04 2005 New Revision: 12422 Modified: pypy/dist/pypy/translator/tool/pygame/drawgraph.py pypy/dist/pypy/translator/tool/pygame/graphdisplay.py Log: less work by sethighlight Modified: pypy/dist/pypy/translator/tool/pygame/drawgraph.py ============================================================================== --- pypy/dist/pypy/translator/tool/pygame/drawgraph.py (original) +++ pypy/dist/pypy/translator/tool/pygame/drawgraph.py Tue May 17 23:44:04 2005 @@ -207,7 +207,14 @@ self.setoffset(0, 0) self.screen = screen self.textzones = [] - self.highlightwords = {} + self.highlightwords = graphlayout.links + self.highlight_word = None + + def wordcolor(self, word): + if word == self.highlight_word: + return ((255,255,80), (128,0,0)) + else: + return ((128,0,0), None) def setscale(self, scale): scale = max(min(scale, self.SCALEMAX), self.SCALEMIN) @@ -507,7 +514,7 @@ if not word: continue if word in renderer.highlightwords: - fg, bg = renderer.highlightwords[word] + fg, bg = renderer.wordcolor(word) bg = bg or bgcolor else: fg, bg = fgcolor, bgcolor Modified: pypy/dist/pypy/translator/tool/pygame/graphdisplay.py ============================================================================== --- pypy/dist/pypy/translator/tool/pygame/graphdisplay.py (original) +++ pypy/dist/pypy/translator/tool/pygame/graphdisplay.py Tue May 17 23:44:04 2005 @@ -481,17 +481,10 @@ self.look_at_node(edge.tail) def sethighlight(self, word=None, obj=None): - # The initialization of self.viewer.highlightwords should probably be - # moved to setlayout() - self.viewer.highlightwords = {} - for name in self.layout.links: - self.viewer.highlightwords[name] = ((128,0,0), None) - if word: - self.viewer.highlightwords[word] = ((255,255,80), (128,0,0)) - - if word == self.highlight_obj and obj is self.highlight_obj: + if word == self.highlight_word and obj is self.highlight_obj: return # Nothing has changed, so there's no need to redraw + self.viewer.highlight_word = word if self.highlight_obj is not None: self.highlight_obj.sethighlight(False) if obj is not None: From hpk at codespeak.net Wed May 18 00:11:24 2005 From: hpk at codespeak.net (hpk at codespeak.net) Date: Wed, 18 May 2005 00:11:24 +0200 (CEST) Subject: [pypy-svn] r12423 - pypy/dist Message-ID: <20050517221124.3943B27C00@code1.codespeak.net> Author: hpk Date: Wed May 18 00:11:24 2005 New Revision: 12423 Modified: pypy/dist/LICENSE Log: add a license section for lib-python/2.3.4-* .... Modified: pypy/dist/LICENSE ============================================================================== --- pypy/dist/LICENSE (original) +++ pypy/dist/LICENSE Wed May 18 00:11:24 2005 @@ -28,7 +28,7 @@ PyPy Copyright holders 2003-2005 -==================================================== +----------------------------------- Except when otherwise stated (look for LICENSE files or information at the beginning of each file) the files in the 'pypy' directory are each @@ -78,7 +78,7 @@ py lib Copyright holders, 2003-2005 -========================================== +----------------------------------- Except when otherwise stated (look for LICENSE files or information at the beginning of each file) the files in the 'py' directory are @@ -94,3 +94,14 @@ Ian Bicking Grig Gheorghiu Bob Ippolito + + +License for 'lib-python/2.3.4' and 'lib-python/2.3.4-modified' +============================================================== + +Except when otherwise stated (look for LICENSE files or information at +the beginning of each file) the files in the 'lib-python/2.3.4' +and 'lib-python/2.3.4-modified' directories are all copyrighted +by the Python Software Foundation and licensed under the Python +Software License of which you can find a copy here: +http://www.python.org/doc/Copyright.html From cfbolz at codespeak.net Wed May 18 00:51:20 2005 From: cfbolz at codespeak.net (cfbolz at codespeak.net) Date: Wed, 18 May 2005 00:51:20 +0200 (CEST) Subject: [pypy-svn] r12424 - pypy/dist/pypy/documentation Message-ID: <20050517225120.3515227BF7@code1.codespeak.net> Author: cfbolz Date: Wed May 18 00:51:20 2005 New Revision: 12424 Modified: pypy/dist/pypy/documentation/getting_started.txt Log: issue37 in-progress * Removed the Pyrex examples from getting_started * Added some documentation about the interpreter-level console * Added a paragraph about how to use tracing -- should be improved, especially if the output of tracing changes * added some hints on how to install LLVM Modified: pypy/dist/pypy/documentation/getting_started.txt ============================================================================== --- pypy/dist/pypy/documentation/getting_started.txt (original) +++ pypy/dist/pypy/documentation/getting_started.txt Wed May 18 00:51:20 2005 @@ -129,7 +129,44 @@ on the current PyPy implementation. -3. To list the PyPy interpreter command line options, type:: +3. There are a few useful tricks for the PyPy console: If you press on + the console you enter the interpreter-level console, a CPython + console. There you can access internal objects of PyPy (e.g. the object + space) and the PyPy variables if you affix ``w_``:: + + >>>> a = 123 + >>>> + *** Entering interpreter-level console *** + >>> dir() + ['__builtins__', 'buffer', 'compile', 'ec', 'filename', 'locals', 'space', 'tracelevel', 'verbose', 'w___builtins__', 'w___name__', 'w___pytrace__', 'w_a', 'w_globals'] + >>> w_a + W_IntObject(123) + + Note that the prompt of the interpreter-level console is only '>>>' since + it runs on CPython level. To return to PyPy, press . + +4. You can also use the trace object space to trace the the work of the + interpreter. To enable it, do (on the PyPy console):: + + >>>> __pytrace__ = 1 + Tracing enabled + >>>> a = 1 + 2 + |-<<<<a = 1 + 2 @ 1>>>>>>> + |- 0 LOAD_CONST 0 (W_IntObject(1)) + |- 3 LOAD_CONST 1 (W_IntObject(2)) + |- 6 BINARY_ADD + |- >> add(W_IntObject(1), W_IntObject(2)) + |- add =: W_IntObject(3) + |- 7 STORE_NAME 0 (a) + |- >> setitem(globals(), W_StringObject('a'), W_IntObject(3)) + |- setitem =: + |-10 LOAD_CONST 2 () + |-13 RETURN_VALUE + |-<<<<a = 1 + 2 @ 1>>>>>>> + + + +5. To list the PyPy interpreter command line options, type:: cd pypy/interpreter python py.py --help @@ -143,7 +180,7 @@ python py.py ../../lib-python/modified-2.3.4/test/pystone.py 10 -4. The PyPy project uses test-driven-development. Right now, there are +6. The PyPy project uses test-driven-development. Right now, there are a couple of different categories of tests which you can run. To run all the unit tests:: @@ -211,28 +248,16 @@ >>> a.simplify() -5. The graph can be turned into Pyrex code, with types if ``annotate()`` was - called:: - - >>> print t.pyrex() - >>> f = t.compile() - >>> f(28) - 1 - - Note how the strange-looking Pyrex code is unrelated to the original - Python source code. This is because the Pyrex code is generated from the - graph only, without reference to the original source. - -6. In the same manner the graph can be compiled to C code:: +5. The graph can be turned into C code:: >>> a.specialize() >>> f = t.ccompile() The first command replaces operations with variables of types that are - avaiable in C (e.g. int) with low level version. This can be ommited if no + avaiable in C (e.g. int) with low level versions. This can be ommited if no annotation (step 4) has been performed. -7. If you feel adventureous (and have LLVM installed and on your path) you can +6. If you feel adventureous (and have LLVM installed and on your path) you can also try to compile the graph with LLVM. This is still quite experimental and only works with some functions: One of the most visible restriction is that return type of the entry function has to be and int, float or bool. To @@ -326,14 +351,24 @@ One of our backends uses the `low level virtual machine`_ to generate processor independant machine level code. + LLVM can be quite annoying to install: you need a fairly recent version of + GCC to compile it and there can be severe problems under windows. There are + detailed instructions on `how to install LLVM`_. To use the LLVM backend + you don't need the GCC front end of LLVM, only LLVM itself. If you run + into problems with the installation the `LLVM mailing list`_ is very + helpful and friendly. + *CLISP* (used for the optional Lisp translation backend) http://clisp.cons.org/_ +------------------------------------------------------------------------------ + .. _`low level virtual machine`: http://llvm.cs.uiuc.edu/ +.. _`how to install LLVM`: http://llvm.cs.uiuc.edu/docs/GettingStarted.html +.. _`LLVM mailing list`: http://mail.cs.uiuc.edu/mailman/listinfo/llvmdev --------------------------------------------------------------------------------- .. _Dot Graphviz: http://www.research.att.com/sw/tools/graphviz/ .. _Pygame: http://www.pygame.org/ From pedronis at codespeak.net Wed May 18 01:31:05 2005 From: pedronis at codespeak.net (pedronis at codespeak.net) Date: Wed, 18 May 2005 01:31:05 +0200 (CEST) Subject: [pypy-svn] r12425 - pypy/dist/pypy/translator Message-ID: <20050517233105.581D627BF5@code1.codespeak.net> Author: pedronis Date: Wed May 18 01:31:05 2005 New Revision: 12425 Modified: pypy/dist/pypy/translator/simplify.py Log: fixes for examples that will become tests today (later) Modified: pypy/dist/pypy/translator/simplify.py ============================================================================== --- pypy/dist/pypy/translator/simplify.py (original) +++ pypy/dist/pypy/translator/simplify.py Wed May 18 01:31:05 2005 @@ -177,19 +177,24 @@ return seen = [] norm, exc = block.exits + last_exception = exc.last_exception + last_exc_value = exc.last_exc_value query = exc.target switches = [ (None, norm) ] # collect the targets while len(query.exits) == 2: + newrenaming = {} for lprev, ltarg in zip(exc.args, query.inputargs): - renaming[ltarg] = rename(lprev) + newrenaming[ltarg] = rename(lprev) op = query.operations[0] if not (op.opname in ("is_", "issubtype") and - rename(op.args[0]) == clastexc): + newrenaming.get(op.args[0]) == last_exception): break + renaming.update(newrenaming) case = query.operations[0].args[-1].value assert issubclass(case, Exception) lno, lyes = query.exits + assert lno.exitcase == False and lyes.exitcase == True if case not in seen: switches.append( (case, lyes) ) seen.append(case) @@ -201,6 +206,9 @@ exits = [] for case, oldlink in switches: link = oldlink.copy(rename) + if case is not None: + link.last_exception = last_exception + link.last_exc_value = last_exc_value link.exitcase = case link.prevblock = block exits.append(link) From cfbolz at codespeak.net Wed May 18 02:35:27 2005 From: cfbolz at codespeak.net (cfbolz at codespeak.net) Date: Wed, 18 May 2005 02:35:27 +0200 (CEST) Subject: [pypy-svn] r12426 - pypy/dist/pypy/translator Message-ID: <20050518003527.5F36F27BF7@code1.codespeak.net> Author: cfbolz Date: Wed May 18 02:35:27 2005 New Revision: 12426 Modified: pypy/dist/pypy/translator/translator.py Log: issue50 resolved Added llvm and llvmcompile methods to the translator. Updated the documentation string to mention genllvm and genc. Removed the t.pyrex from the docstring. Modified: pypy/dist/pypy/translator/translator.py ============================================================================== --- pypy/dist/pypy/translator/translator.py (original) +++ pypy/dist/pypy/translator/translator.py Wed May 18 02:35:27 2005 @@ -11,8 +11,9 @@ t.view() # control flow graph print t.source() # original source - print t.pyrex() # pyrex translation + print t.c() # C translation print t.cl() # common lisp translation + print t.llvm() # LLVM translation t.simplify() # flow graph simplification a = t.annotate([int]) # pass the list of args types @@ -22,7 +23,9 @@ t.call(arg) # call original function t.dis() # bytecode disassemble - f = t.compile() # pyrex compilation + t.specialize() # use low level operations (for C only) + f = t.ccompile() # C compilation + f = t.llvmcompile() # LLVM compilation assert f(arg) == t.call(arg) # sanity check Some functions are provided for the benefit of interactive testing. @@ -192,6 +195,17 @@ out = StringIO() genc = GenC(out, self) return out.getvalue() + + def llvm(self): + """llvm(self) -> LLVM translation + + Returns LLVM translation. + """ + from pypy.translator.llvm import genllvm + if self.annotator is None: + raise genllvm.CompileError, "function has to be annotated." + gen = genllvm.LLVMGenerator(self) + return str(gen) def generatecode(self, gencls, input_arg_types, func): if input_arg_types is None: @@ -258,6 +272,17 @@ include_dirs=[os.path.join(autopath.this_dir, 'genc')]) return getattr(mod, self.entrypoint.func_name) + def llvmcompile(self, optimize=True): + """llvmcompile(self, optimize=True) -> LLVM translation + + Returns LLVM translation with or without optimization. + """ + from pypy.translator.llvm import genllvm + if self.annotator is None: + raise genllvm.CompileError, "function has to be annotated." + gen = genllvm.LLVMGenerator(self) + return gen.compile(optimize) + def call(self, *args): """Calls underlying Python function.""" return self.entrypoint(*args) From cfbolz at codespeak.net Wed May 18 02:36:30 2005 From: cfbolz at codespeak.net (cfbolz at codespeak.net) Date: Wed, 18 May 2005 02:36:30 +0200 (CEST) Subject: [pypy-svn] r12427 - pypy/dist/pypy/documentation Message-ID: <20050518003630.7A59A27BF7@code1.codespeak.net> Author: cfbolz Date: Wed May 18 02:36:30 2005 New Revision: 12427 Modified: pypy/dist/pypy/documentation/getting_started.txt Log: changed to keep up with changes of translator. Modified: pypy/dist/pypy/documentation/getting_started.txt ============================================================================== --- pypy/dist/pypy/documentation/getting_started.txt (original) +++ pypy/dist/pypy/documentation/getting_started.txt Wed May 18 02:36:30 2005 @@ -263,8 +263,8 @@ that return type of the entry function has to be and int, float or bool. To try it do:: - >>> from pypy.translator.llvm.genllvm import llvmcompile - >>> f = llvmcompile(t, optimize=True) + >>> print t.llvm() + >>> f = t.llvmcompile(optimize=True) >>> f(28) 1 From cfbolz at codespeak.net Wed May 18 02:41:50 2005 From: cfbolz at codespeak.net (cfbolz at codespeak.net) Date: Wed, 18 May 2005 02:41:50 +0200 (CEST) Subject: [pypy-svn] r12428 - pypy/dist/pypy/translator/llvm Message-ID: <20050518004150.99C1F27BF7@code1.codespeak.net> Author: cfbolz Date: Wed May 18 02:41:50 2005 New Revision: 12428 Modified: pypy/dist/pypy/translator/llvm/genllvm.py Log: Make t.llvm() not print all the space operations (several thousand lines). t.llvm() is still very big if lists and such are used. Modified: pypy/dist/pypy/translator/llvm/genllvm.py ============================================================================== --- pypy/dist/pypy/translator/llvm/genllvm.py (original) +++ pypy/dist/pypy/translator/llvm/genllvm.py Wed May 18 02:41:50 2005 @@ -1,20 +1,11 @@ """ -This is the entry point of genllvm. This file can also be used with python -i -to interactively test genllvm. - -The class LLVMGenerator coordinates the creation of LLVM representations and -drives the creation of the .ll file and the compilation: -The methods get_repr loops over all Repr classes and calls there static get -method. If this method returns None, it continues searching, else it returns -the object. It caches representations so that only one is generated for a given -object. - +Generate a llvm .ll file from an annotated flowgraph. """ import autopath import sets, StringIO -from pypy.objspace.flow.model import Constant +from pypy.objspace.flow.model import Constant from pypy.annotation import model as annmodel from pypy.translator import transform from pypy.translator.translator import Translator @@ -142,7 +133,7 @@ return g raise CompileError, "Can't get repr of %s, %s" % (obj, obj.__class__) - def write(self, f): + def write(self, f, include=True): self.unlazyify() seen_reprs = sets.Set() remove_loops(self.l_entrypoint, seen_reprs) @@ -150,7 +141,10 @@ init_block = self.l_entrypoint.init_block for l_repr in traverse_dependencies(self.l_entrypoint, seen_reprs): l_repr.collect_init_code(init_block, self.l_entrypoint) - include_files = ["operations.ll", "class.ll"] + if include == True: + include_files = ["operations.ll", "class.ll"] + else: + include_files = [] for i, fn in enumerate(include_files): f1 = file(autopath.this_dir + "/" + fn) s = f1.read() @@ -189,7 +183,7 @@ def __str__(self): f = StringIO.StringIO() - self.write(f) + self.write(f, False) return f.getvalue() #traverse dependency-tree starting from the leafes upward From cfbolz at codespeak.net Wed May 18 02:43:33 2005 From: cfbolz at codespeak.net (cfbolz at codespeak.net) Date: Wed, 18 May 2005 02:43:33 +0200 (CEST) Subject: [pypy-svn] r12429 - pypy/dist/pypy/translator/llvm Message-ID: <20050518004333.BECA827BF7@code1.codespeak.net> Author: cfbolz Date: Wed May 18 02:43:33 2005 New Revision: 12429 Modified: pypy/dist/pypy/translator/llvm/genllvm.py Log: restore accidentally deleted module docstring. Modified: pypy/dist/pypy/translator/llvm/genllvm.py ============================================================================== --- pypy/dist/pypy/translator/llvm/genllvm.py (original) +++ pypy/dist/pypy/translator/llvm/genllvm.py Wed May 18 02:43:33 2005 @@ -1,5 +1,13 @@ """ -Generate a llvm .ll file from an annotated flowgraph. +This is the entry point of genllvm. This file can also be used with python -i +to interactively test genllvm. + +The class LLVMGenerator coordinates the creation of LLVM representations and +drives the creation of the .ll file and the compilation: +The methods get_repr loops over all Repr classes and calls there static get +method. If this method returns None, it continues searching, else it returns +the object. It caches representations so that only one is generated for a given +object. """ import autopath From pedronis at codespeak.net Wed May 18 03:04:51 2005 From: pedronis at codespeak.net (pedronis at codespeak.net) Date: Wed, 18 May 2005 03:04:51 +0200 (CEST) Subject: [pypy-svn] r12430 - pypy/dist/pypy/annotation Message-ID: <20050518010451.5A61E27BF2@code1.codespeak.net> Author: pedronis Date: Wed May 18 03:04:51 2005 New Revision: 12430 Modified: pypy/dist/pypy/annotation/binaryop.py Log: oops Modified: pypy/dist/pypy/annotation/binaryop.py ============================================================================== --- pypy/dist/pypy/annotation/binaryop.py (original) +++ pypy/dist/pypy/annotation/binaryop.py Wed May 18 03:04:51 2005 @@ -63,7 +63,7 @@ for v in is_type_of2: is_type_of[v] = True if is_type_of: - result.is_type_of = is_type_of + result.is_type_of = is_type_of.keys() else: if is_type_of1 and is_type_of1 == is_type_of2: result.is_type_of = is_type_of1 From hpk at codespeak.net Wed May 18 12:28:33 2005 From: hpk at codespeak.net (hpk at codespeak.net) Date: Wed, 18 May 2005 12:28:33 +0200 (CEST) Subject: [pypy-svn] r12432 - in pypy/dist/pypy/interpreter: . test Message-ID: <20050518102833.2D26127BDF@code1.codespeak.net> Author: hpk Date: Wed May 18 12:28:33 2005 New Revision: 12432 Modified: pypy/dist/pypy/interpreter/lazymodule.py pypy/dist/pypy/interpreter/test/test_module.py Log: issue51: in-progress sneaking in a change that helps explaining things in the documentation (and also makes PyPy more introspectable): mixed modules now have a __file__ attribute that points to the underlying __init__.py file that contains the name -> file/object mappings. I actually also intend to rename LazyModule -> MixedModule because the lazyness is just an implementation detail (currently, it may be possible to get it RPythonic enough to translate it but currently it just gets completely unlazified for translation). Modified: pypy/dist/pypy/interpreter/lazymodule.py ============================================================================== --- pypy/dist/pypy/interpreter/lazymodule.py (original) +++ pypy/dist/pypy/interpreter/lazymodule.py Wed May 18 12:28:33 2005 @@ -3,6 +3,7 @@ from pypy.interpreter import gateway from pypy.interpreter.error import OperationError from pypy.interpreter.baseobjspace import W_Root +import os import inspect @@ -82,8 +83,31 @@ loaders[name] = getinterpevalloader(pkgroot, spec) for name, spec in cls.appleveldefs.items(): loaders[name] = getappfileloader(pkgroot, spec) + assert '__file__' not in loaders + loaders['__file__'] = cls.get__file__ + buildloaders = classmethod(buildloaders) + def get__file__(cls, space): + """ NOT_RPYTHON. + return the __file__ attribute of a LazyModule + which is the root-directory for the various + applevel and interplevel snippets that make + up the module. + """ + try: + fname = cls._fname + except AttributeError: + pkgroot = cls.__module__ + mod = __import__(pkgroot, None, None, ['__doc__']) + fname = mod.__file__ + assert os.path.basename(fname).startswith('__init__.py') + cls._fname = fname + return space.wrap(fname) + + get__file__ = classmethod(get__file__) + + def getinterpevalloader(pkgroot, spec): """ NOT_RPYTHON """ def ifileloader(space): Modified: pypy/dist/pypy/interpreter/test/test_module.py ============================================================================== --- pypy/dist/pypy/interpreter/test/test_module.py (original) +++ pypy/dist/pypy/interpreter/test/test_module.py Wed May 18 12:28:33 2005 @@ -46,3 +46,9 @@ assert foo.__doc__ is None bar = type(sys)('bar','docstring') assert bar.__doc__ == 'docstring' + + def test___file__(self): + import sys, os + assert sys.__file__ + assert os.path.basename(sys.__file__).startswith('__init__.py') + From hpk at codespeak.net Wed May 18 12:32:19 2005 From: hpk at codespeak.net (hpk at codespeak.net) Date: Wed, 18 May 2005 12:32:19 +0200 (CEST) Subject: [pypy-svn] r12433 - in pypy/dist/pypy: documentation interpreter interpreter/test/mixedmodule module/_sre_pypy module/builtin module/parser module/recparser module/sys2 Message-ID: <20050518103219.3A80F27BDF@code1.codespeak.net> Author: hpk Date: Wed May 18 12:32:18 2005 New Revision: 12433 Added: pypy/dist/pypy/interpreter/mixedmodule.py - copied, changed from r12432, pypy/dist/pypy/interpreter/lazymodule.py Removed: pypy/dist/pypy/interpreter/lazymodule.py Modified: pypy/dist/pypy/documentation/getting_started.txt pypy/dist/pypy/interpreter/test/mixedmodule/__init__.py pypy/dist/pypy/module/_sre_pypy/__init__.py pypy/dist/pypy/module/builtin/__init__.py pypy/dist/pypy/module/parser/__init__.py pypy/dist/pypy/module/recparser/__init__.py pypy/dist/pypy/module/sys2/__init__.py Log: renaming LazyModule to MixedModule Modified: pypy/dist/pypy/documentation/getting_started.txt ============================================================================== --- pypy/dist/pypy/documentation/getting_started.txt (original) +++ pypy/dist/pypy/documentation/getting_started.txt Wed May 18 12:32:18 2005 @@ -284,7 +284,7 @@ in pyopcode.py_, frame and code objects in eval.py_ and pyframe.py_, function objects and argument passing in function.py_ and argument.py_, the object space interface definition in baseobjspace.py_, modules in - module.py_ and lazymodule.py_. Core types supporting the interpreter are + module.py_ and mixedmodule.py_. Core types supporting the interpreter are defined in typedef.py_. * `pypy/objspace/std`_ contains the `Standard object space`_. The main file @@ -380,7 +380,7 @@ .. _argument.py: http://codespeak.net/svn/pypy/dist/pypy/interpreter/argument.py .. _baseobjspace.py: http://codespeak.net/svn/pypy/dist/pypy/interpreter/baseobjspace.py .. _module.py: http://codespeak.net/svn/pypy/dist/pypy/interpreter/module.py -.. _lazymodule.py: http://codespeak.net/svn/pypy/dist/pypy/interpreter/lazymodule.py +.. _mixedmodule.py: http://codespeak.net/svn/pypy/dist/pypy/interpreter/mixedmodule.py .. _typedef.py: http://codespeak.net/svn/pypy/dist/pypy/interpreter/typedef.py .. _pypy/objspace/std: http://codespeak.net/svn/pypy/dist/pypy/objspace/std/ .. _Standard object space: http://codespeak.net/pypy/index.cgi?doc/stdobjspace.html Deleted: /pypy/dist/pypy/interpreter/lazymodule.py ============================================================================== --- /pypy/dist/pypy/interpreter/lazymodule.py Wed May 18 12:32:18 2005 +++ (empty file) @@ -1,164 +0,0 @@ -from pypy.interpreter.module import Module -from pypy.interpreter.function import Function, BuiltinFunction -from pypy.interpreter import gateway -from pypy.interpreter.error import OperationError -from pypy.interpreter.baseobjspace import W_Root -import os - -import inspect - -class LazyModule(Module): - - NOT_RPYTHON_ATTRIBUTES = ['loaders'] - - def __init__(self, space, w_name): - """ NOT_RPYTHON """ - Module.__init__(self, space, w_name) - self.lazy = True - self.__class__.buildloaders() - - def get(self, name): - space = self.space - w_value = self.getdictvalue(space, name) - if w_value is None: - raise OperationError(space.w_AttributeError, space.wrap(name)) - return w_value - - def call(self, name, *args_w): - w_builtin = self.get(name) - return self.space.call_function(w_builtin, *args_w) - - def getdictvalue(self, space, name): - try: - return space.getitem(self.w_dict, space.wrap(name)) - except OperationError, e: - if not e.match(space, space.w_KeyError): - raise - if not self.lazy: - return None - try: - loader = self.loaders[name] - except KeyError: - return None - else: - #print "trying to load", name - w_value = loader(space) - #print "loaded", w_value - # obscure - func = space.interpclass_w(w_value) - if type(func) is Function: - try: - bltin = func._builtinversion_ - except AttributeError: - bltin = BuiltinFunction(func) - bltin.w_module = self.w_name - func._builtinversion_ = bltin - w_value = space.wrap(bltin) - space.setitem(self.w_dict, space.wrap(name), w_value) - return w_value - - def getdict(self): - if self.lazy: - space = self.space - for name in self.loaders: - w_value = self.get(name) - space.setitem(self.w_dict, space.wrap(name), w_value) - self.lazy = False - return self.w_dict - - def _freeze_(self): - self.getdict() - # hint for the annotator: Modules can hold state, so they are - # not constant - return False - - def buildloaders(cls): - """ NOT_RPYTHON """ - if not hasattr(cls, 'loaders'): - # build a constant dictionary out of - # applevel/interplevel definitions - cls.loaders = loaders = {} - pkgroot = cls.__module__ - for name, spec in cls.interpleveldefs.items(): - loaders[name] = getinterpevalloader(pkgroot, spec) - for name, spec in cls.appleveldefs.items(): - loaders[name] = getappfileloader(pkgroot, spec) - assert '__file__' not in loaders - loaders['__file__'] = cls.get__file__ - - buildloaders = classmethod(buildloaders) - - def get__file__(cls, space): - """ NOT_RPYTHON. - return the __file__ attribute of a LazyModule - which is the root-directory for the various - applevel and interplevel snippets that make - up the module. - """ - try: - fname = cls._fname - except AttributeError: - pkgroot = cls.__module__ - mod = __import__(pkgroot, None, None, ['__doc__']) - fname = mod.__file__ - assert os.path.basename(fname).startswith('__init__.py') - cls._fname = fname - return space.wrap(fname) - - get__file__ = classmethod(get__file__) - - -def getinterpevalloader(pkgroot, spec): - """ NOT_RPYTHON """ - def ifileloader(space): - d = {'space' : space} - # EVIL HACK (but it works, and this is not RPython :-) - while 1: - try: - value = eval(spec, d) - except NameError, ex: - #assert name not in d, "huh, am i looping?" - name = ex.args[0].split("'")[1] # super-Evil - try: - d[name] = __import__(pkgroot+'.'+name, None, None, [name]) - except ImportError: - d[name] = __import__(name, None, None, [name]) - else: - #print spec, "->", value - if hasattr(value, 'func_code'): # semi-evil - return space.wrap(gateway.interp2app(value)) - - try: - is_type = issubclass(value, W_Root) # pseudo-evil - except TypeError: - is_type = False - if is_type: - return space.gettypeobject(value.typedef) - - assert isinstance(value, W_Root), ( - "interpleveldef %s.%s must return a wrapped object " - "(got %r instead)" % (pkgroot, spec, value)) - return value - return ifileloader - -applevelcache = {} -def getappfileloader(pkgroot, spec): - """ NOT_RPYTHON """ - # hum, it's a bit more involved, because we usually - # want the import at applevel - modname, attrname = spec.split('.') - impbase = pkgroot + '.' + modname - mod = __import__(impbase, None, None, ['attrname']) - try: - app = applevelcache[mod] - except KeyError: - source = inspect.getsource(mod) - fn = mod.__file__ - if fn.endswith('.pyc') or fn.endswith('.pyo'): - fn = fn[:-1] - app = gateway.applevel(source, filename=fn) - applevelcache[mod] = app - - def afileloader(space): - return app.wget(space, attrname) - return afileloader Copied: pypy/dist/pypy/interpreter/mixedmodule.py (from r12432, pypy/dist/pypy/interpreter/lazymodule.py) ============================================================================== --- pypy/dist/pypy/interpreter/lazymodule.py (original) +++ pypy/dist/pypy/interpreter/mixedmodule.py Wed May 18 12:32:18 2005 @@ -7,7 +7,7 @@ import inspect -class LazyModule(Module): +class MixedModule(Module): NOT_RPYTHON_ATTRIBUTES = ['loaders'] @@ -90,7 +90,7 @@ def get__file__(cls, space): """ NOT_RPYTHON. - return the __file__ attribute of a LazyModule + return the __file__ attribute of a MixedModule which is the root-directory for the various applevel and interplevel snippets that make up the module. Modified: pypy/dist/pypy/interpreter/test/mixedmodule/__init__.py ============================================================================== --- pypy/dist/pypy/interpreter/test/mixedmodule/__init__.py (original) +++ pypy/dist/pypy/interpreter/test/mixedmodule/__init__.py Wed May 18 12:32:18 2005 @@ -1,6 +1,6 @@ -from pypy.interpreter.lazymodule import LazyModule +from pypy.interpreter.mixedmodule import MixedModule -class Module(LazyModule): +class Module(MixedModule): interpleveldefs = { '__name__' : '(space.wrap("mixedmodule"))', '__doc__' : '(space.wrap("mixedmodule doc"))', Modified: pypy/dist/pypy/module/_sre_pypy/__init__.py ============================================================================== --- pypy/dist/pypy/module/_sre_pypy/__init__.py (original) +++ pypy/dist/pypy/module/_sre_pypy/__init__.py Wed May 18 12:32:18 2005 @@ -9,10 +9,10 @@ allows us to do so one piece at a time. """ -from pypy.interpreter.lazymodule import LazyModule +from pypy.interpreter.mixedmodule import MixedModule -class Module(LazyModule): +class Module(MixedModule): """_sre_pypy module""" appleveldefs = { Modified: pypy/dist/pypy/module/builtin/__init__.py ============================================================================== --- pypy/dist/pypy/module/builtin/__init__.py (original) +++ pypy/dist/pypy/module/builtin/__init__.py Wed May 18 12:32:18 2005 @@ -1,8 +1,8 @@ from pypy.interpreter.error import OperationError from pypy.interpreter import module -from pypy.interpreter.lazymodule import LazyModule +from pypy.interpreter.mixedmodule import MixedModule -class Module(LazyModule): +class Module(MixedModule): """Built-in functions, exceptions, and other objects.""" appleveldefs = { Modified: pypy/dist/pypy/module/parser/__init__.py ============================================================================== --- pypy/dist/pypy/module/parser/__init__.py (original) +++ pypy/dist/pypy/module/parser/__init__.py Wed May 18 12:32:18 2005 @@ -1,8 +1,8 @@ from pypy.interpreter.error import OperationError from pypy.interpreter import module -from pypy.interpreter.lazymodule import LazyModule +from pypy.interpreter.mixedmodule import MixedModule -class Module(LazyModule): +class Module(MixedModule): """The builtin parser module. """ appleveldefs = { Modified: pypy/dist/pypy/module/recparser/__init__.py ============================================================================== --- pypy/dist/pypy/module/recparser/__init__.py (original) +++ pypy/dist/pypy/module/recparser/__init__.py Wed May 18 12:32:18 2005 @@ -1,6 +1,6 @@ from pypy.interpreter.error import OperationError, debug_print from pypy.interpreter import module -from pypy.interpreter.lazymodule import LazyModule +from pypy.interpreter.mixedmodule import MixedModule import pythonutil @@ -8,7 +8,7 @@ debug_print( "Loading grammar %s" % pythonutil.PYTHON_GRAMMAR ) PYTHON_PARSER = pythonutil.python_grammar() -class Module(LazyModule): +class Module(MixedModule): """The builtin parser module. """ Modified: pypy/dist/pypy/module/sys2/__init__.py ============================================================================== --- pypy/dist/pypy/module/sys2/__init__.py (original) +++ pypy/dist/pypy/module/sys2/__init__.py Wed May 18 12:32:18 2005 @@ -1,7 +1,7 @@ -from pypy.interpreter.lazymodule import LazyModule +from pypy.interpreter.mixedmodule import MixedModule from pypy.interpreter.error import OperationError -class Module(LazyModule): +class Module(MixedModule): """Sys Builtin Module. """ def __init__(self, space, w_name): """NOT_RPYTHON""" # because parent __init__ isn't @@ -93,7 +93,7 @@ def getdictvalue(self, space, attr): """ specialize access to dynamic exc_* attributes. """ - value = LazyModule.getdictvalue(self, space, attr) + value = MixedModule.getdictvalue(self, space, attr) if value is not None: return value if attr == 'exc_type': From hpk at codespeak.net Wed May 18 14:12:26 2005 From: hpk at codespeak.net (hpk at codespeak.net) Date: Wed, 18 May 2005 14:12:26 +0200 (CEST) Subject: [pypy-svn] r12434 - pypy/dist/pypy/documentation Message-ID: <20050518121226.1BA1827BB9@code1.codespeak.net> Author: hpk Date: Wed May 18 14:12:25 2005 New Revision: 12434 Modified: pypy/dist/pypy/documentation/coding-guide.txt Log: issue51 in-progress A whole new chapter with subchapters dealing with "Modules in PyPy". Missing is how PyPy interacts with CPython's sys.path etc.pp. I am not sure that i am sure about this myself. Modified: pypy/dist/pypy/documentation/coding-guide.txt ============================================================================== --- pypy/dist/pypy/documentation/coding-guide.txt (original) +++ pypy/dist/pypy/documentation/coding-guide.txt Wed May 18 14:12:25 2005 @@ -403,20 +403,63 @@ We are thinking about replacing ``OperationError`` with a family of common exception classes (e.g. ``AppKeyError``, ``AppIndexError``...) so that we can more easily catch them. The generic ``AppError`` would stand for all other application-level classes. +Modules in PyPy +=============== -Naming and directory layout -=========================== +Modules visible from application programs are imported from +interpreter or application level files. PyPy reuses almost all python +modules of CPython's standard library, currently from version 2.3.4. We +sometimes need to `modify modules`_ and - more often - regression tests +because they rely on implementation details of CPython. + +If we don't just modify an original CPython module but need to rewrite +it from scratch we put it into `pypy/lib`_ as a pure application level +module. + +When we need access to interpreter-level objects we put the module into +`pypy/module`_. Such modules use a `mixed module mechanism`_ +which makes it convenient to use both interpreter- and applicationlevel +parts for the implementation. Note that there is no extra facility for +pure-interpreter level modules because we haven't needed it so far. + +.. _`lib-python`: http://codespeak.net/svn/pypy/dist/lib-python/ +.. _`pypy/module`: http://codespeak.net/svn/pypy/dist/pypy/module/ +.. _`pypy/lib`: http://codespeak.net/svn/pypy/dist/pypy/lib/ + +Determining the location of a module implementation +--------------------------------------------------- + +You can interactively find out where a module comes from, +here are examples for the possible locations:: + + >>>> import sys + >>>> sys.__file__ + '/home/hpk/pypy-dist/pypy/module/sys2/__init__.pyc' + + >>>> import operator + >>>> operator.__file__ + '/home/hpk/pypy-dist/pypy/lib/operator.py' + + >>>> import types + t>>>> types.__file__ + '/home/hpk/pypy-dist/lib-python/modified-2.3.4/types.py' + + >>>> import os + faking + faking + >>>> os.__file__ + '/home/hpk/pypy-dist/lib-python/2.3.4/os.py' + >>>> + +Module directories / Import order +--------------------------------- -Modifying/Hacking PyPy's standard library --------------------------------------------- +Here is the order in which PyPy looks up Python modules: -PyPy reuses the Python implementations of CPython's standard -library, currently from version 2.3.4. Sometimes -we need to modify modules and - more often - -regression tests because they rely on implementation -details of CPython. Therefore we have a strict scheme on -how to deal with these issues. Here is the order -in which PyPy looks up Python modules: +*pypy/modules* + + mixed interpreter/app-level builtin modules, such as + the sys and builtin module. *pypy/lib/* @@ -432,14 +475,126 @@ *lib-python/2.3.4/* - The unmodified CPython library. **Never checkin anything here**. + The unmodified CPython library. **Never ever checkin anything here**. + +.. _`modify modules`: + +Modifying a CPython library module or regression test +------------------------------------------------------- + +Although PyPy is very compatible to CPython we sometimes need +to change modules contained in our copy of the standard library, +often due to the fact that PyPy works with all new-style classes +by default and CPython has a number of places where it relies +on some classes being old-style. + +If you want to change a module or test contained in `lib-python/2.3.4` +then make sure that you copy the file to our `lib-python/modified-2.3.4` +directory first. In subversion commandline terms this reads: + + svn cp lib-python/2.3.4/somemodule.py lib-python/modified-2.3.4/ + +and subsequently you edit and commit ``lib-python/modified-2.3.4/somemodule.py``. +These copying operation is important because it keeps the original +CPython tree clean and makes it obvious what we had to change. + +.. _`mixed module mechanism`: + +Implementing a mixed interpreter/application level Module +--------------------------------------------------------- + +If a module needs to access PyPy's interpreter level +then it is implemented as a mixed module. + +Mixed modules are directories in `pypy/module`_ with an `__init__.py` +file containing specifications where each name in a module comes from. +Only specified names will be exported to a Mixed Module's applevel +namespace. + +application level definitions +............................. + +Application level specifiations are found in the `appleveldefs` +dictionary found in `__init__.py` files of directories in `pypy/module`. +For example, in `pypy/module/builtin/__init__.py`_ you find the following +entry specifying where `__builtin__.locals` comes from:: + + ... + 'locals' : 'app_inspect.locals', + ... + +The `app_` prefix indicates that the submodule `app_inspect` is +interpreted at application level and the function value for `locals` +will be extracted accordingly. + +.. _`pypy/module/builtin/__init__.py`: http://codespeak.net/svn/pypy/dist/pypy/module/builtin/__init__.py -If you e.g. need to change a standard module or package then -you would issue:: +interpreter level definitions +............................. - svn cp lib-python/2.3.4/standardmodule.py lib-python/modified-2.3.4 +Interpreter level specifiations are found in the `interpleveldefs` +dictionary found in `__init__.py` files of directories in `pypy/module`. +For example, in `pypy/module/builtin/__init__.py`_ the following +entry specifies where `__builtin__.len` comes from:: -and subsequently edit and commit ``lib-python/modified-2.3.4/somemodule.py``. + ... + 'len' : 'operation.len', + ... + +The `operation` submodule lives at interpreter level and `len` +is expected to be exposable to application level. Here is +the definition for `operation.len()`:: + + def len(space, w_obj): + "len(object) -> integer\n\nReturn the number of items of a sequence or mapping." + return space.len(w_obj) + +Exposed interpreter level functions usually take a `space` argument +and some wrapped values (see `wrapping rules`_) . + +You can also use a convenient shortcut in `interpleveldefs` dictionaries: +namely an expression in parentheses to specify an interpreter level +expression directly (instead of pulling it indirectly from a file):: + + ... + 'None' : '(space.w_None)', + 'False' : '(space.w_False)', + ... + +The interpreter level expression has a `space` binding when +it is executed. + + +Testing modules in `pypy/lib` +----------------------------- + +You can go to the `pypy/lib/test2`_ directory and invoke the testing tool +("py.test" or "python ../../test_all.py") to run tests against the +pypy/lib hierarchy. Note, that tests in `pypy/lib/test2`_ are allowed +and encouraged to let their tests run at interpreter level although +`pypy/lib` modules eventually live at PyPy's application level. +This allows us to quickly test our python-coded reimplementations +against CPython. + +.. _`pypy/lib/test2`: http://codespeak.net/svn/pypy/dist/pypy/lib/test2 + +Testing modules in `pypy/module` +---------------------------------- + +Simply change to `pypy/module` and run the tests as usual. + + +Testing modules in `lib-python` +----------------------------------- + +In order to let CPython's regression tests run against PyPy +you can switch to the `lib-python`_ directory and run +the testing tool in order to start compliance tests. +(XXX ensure windows compatibility for producing test +reports). + +Naming and directory layout +=========================== Directory and File Naming ------------------------- From hpk at codespeak.net Wed May 18 14:21:18 2005 From: hpk at codespeak.net (hpk at codespeak.net) Date: Wed, 18 May 2005 14:21:18 +0200 (CEST) Subject: [pypy-svn] r12435 - pypy/dist/pypy/documentation Message-ID: <20050518122118.CF05127BB9@code1.codespeak.net> Author: hpk Date: Wed May 18 14:21:18 2005 New Revision: 12435 Modified: pypy/dist/pypy/documentation/index.txt Log: issue15 done-cbb refactoring the index page to have a nicely verticallly readable list of links. Also scraped and moved some references which don't make much sense currently or any more. Modified: pypy/dist/pypy/documentation/index.txt ============================================================================== --- pypy/dist/pypy/documentation/index.txt (original) +++ pypy/dist/pypy/documentation/index.txt Wed May 18 14:21:18 2005 @@ -12,16 +12,19 @@ * `getting started`_ provides hands-on instructions including a two-liner to run PyPy on your computer. - * objspace_ and coding-guide_ provide more in-depth - implementation level information. + * coding-guide_ helps you to write code for PyPy. + + * objspace_ discusses the object space interface + and several implementations. * translation_ offers the beginnings of documentation about our low level code generator backends. * recently-modified_ shows a list of recently modified - documentation while `revision report`_ and the automated - `compliance test report`_ shows status - information about ongoing pypy development. + documentation + + * `compliance test report`_ shows status information + about recent runs of CPython's regression tests against PyPy. .. _`compliance test report`: http://codespeak.net/~hpk/pypy-testresult/ .. _`objspace`: objspace.html @@ -32,18 +35,12 @@ .. _`getting started`: getting_started.html .. _`theory`: theory.html -Before doing pypy coding, you might also take a look at these -developer-specific instructions: - - * oscon2003-paper_ is a paper we presented at Oscon 2003 describing - what the pypy project is about and why you should care - - * testdesign_ describes a bit of PyPy's testing approaches - - Further reading / related projects ---------------------------------- +* oscon2003-paper_ is a paper we presented at Oscon 2003 describing + what the pypy project is about and why you should care + * An interesting thread on an HP tech report that may be proof the pypy is feasible_ . (We already knew that...) * An interesting thread on why VHLL rock_ . (We already knew that too.) From hpk at codespeak.net Wed May 18 15:28:57 2005 From: hpk at codespeak.net (hpk at codespeak.net) Date: Wed, 18 May 2005 15:28:57 +0200 (CEST) Subject: [pypy-svn] r12438 - in pypy/dist/pypy: documentation interpreter/test module/sys2 module/test Message-ID: <20050518132857.2B5D327BB9@code1.codespeak.net> Author: hpk Date: Wed May 18 15:28:56 2005 New Revision: 12438 Modified: pypy/dist/pypy/documentation/coding-guide.txt pypy/dist/pypy/interpreter/test/test_py.py pypy/dist/pypy/module/sys2/state.py pypy/dist/pypy/module/test/test_import.py Log: issue51 testing finalizing the module documentation for M0.5 and fixing a wart for it: we used to include the contents of intepreter level sys.path. Now the implementation correctly uses PYTHONPATH contents to look up app-level modules. The exact import order is now reflected in the documentation. Please read/cross-check the new "Modules in PyPy" chapter in the coding guide. Putting this issue to testing to indicate this request. Note that i introduced a public query "M0.5-testing" which you can use to see which issues are currently being tested and how you can help. Modified: pypy/dist/pypy/documentation/coding-guide.txt ============================================================================== --- pypy/dist/pypy/documentation/coding-guide.txt (original) +++ pypy/dist/pypy/documentation/coding-guide.txt Wed May 18 15:28:56 2005 @@ -461,13 +461,15 @@ mixed interpreter/app-level builtin modules, such as the sys and builtin module. +*contents of PYTHONPATH* + + lookup application level modules in each of the ``:`` separated + list of directories, specified in the ``PYTHONPATH`` environment + variable. + *pypy/lib/* - Used ONLY for complete pure Python reimplementation of modules. - The test2 subdirectory contains regular tests for these. - These tests run on top of CPython, i.e. at PyPy interpreter - level and are meant to *quickly* check that the reimplementations - are correct, independently of PyPy. + contains pure Python reimplementation of modules. *lib-python/modified-2.3.4/* Modified: pypy/dist/pypy/interpreter/test/test_py.py ============================================================================== --- pypy/dist/pypy/interpreter/test/test_py.py (original) +++ pypy/dist/pypy/interpreter/test/test_py.py Wed May 18 15:28:56 2005 @@ -4,39 +4,39 @@ import py import sys -pypath = str(py.path.local(pypy.interpreter.py.__file__).new(basename='py.py')) +pypypath = str(py.path.local(pypy.interpreter.py.__file__).new(basename='py.py')) def test_executable(): """Ensures sys.executable points to the py.py script""" - # TODO : watch out for spaces/special chars in pypath + # TODO : watch out for spaces/special chars in pypypath output = py.process.cmdexec( '''"%s" "%s" -c "import sys;print sys.executable" ''' % - (sys.executable, pypath) ) - assert output.splitlines()[-1] == pypath + (sys.executable, pypypath) ) + assert output.splitlines()[-1] == pypypath def test_prefix(): """Make sure py.py sys.prefix and exec_prefix are the same as C Python's""" output = py.process.cmdexec( '''"%s" "%s" -c "import sys;print sys.prefix" ''' % - (sys.executable, pypath) ) + (sys.executable, pypypath) ) assert output.splitlines()[-1] == sys.prefix output = py.process.cmdexec( '''"%s" "%s" -c "import sys;print sys.exec_prefix" ''' % - (sys.executable, pypath) ) + (sys.executable, pypypath) ) assert output.splitlines()[-1] == sys.exec_prefix def test_argv_command(): """Some tests on argv""" # test 1 : no arguments output = py.process.cmdexec( '''"%s" "%s" -c "import sys;print sys.argv" ''' % - (sys.executable, pypath) ) + (sys.executable, pypypath) ) assert output.splitlines()[-1] == str(['-c']) # test 2 : some arguments after output = py.process.cmdexec( '''"%s" "%s" -c "import sys;print sys.argv" hello''' % - (sys.executable, pypath) ) + (sys.executable, pypypath) ) assert output.splitlines()[-1] == str(['-c','hello']) # test 3 : additionnal pypy parameters output = py.process.cmdexec( '''"%s" "%s" -O -c "import sys;print sys.argv" hello''' % - (sys.executable, pypath) ) + (sys.executable, pypypath) ) assert output.splitlines()[-1] == str(['-c','hello']) SCRIPT_1 = """ @@ -51,17 +51,17 @@ # test 1 : no arguments output = py.process.cmdexec( '''"%s" "%s" "%s" ''' % - (sys.executable, pypath, tmpfilepath) ) + (sys.executable, pypypath, tmpfilepath) ) assert output.splitlines()[-1] == str([tmpfilepath]) # test 2 : some arguments after output = py.process.cmdexec( '''"%s" "%s" "%s" hello''' % - (sys.executable, pypath, tmpfilepath) ) + (sys.executable, pypypath, tmpfilepath) ) assert output.splitlines()[-1] == str([tmpfilepath,'hello']) # test 3 : additionnal pypy parameters output = py.process.cmdexec( '''"%s" "%s" -O "%s" hello''' % - (sys.executable, pypath, tmpfilepath) ) + (sys.executable, pypypath, tmpfilepath) ) assert output.splitlines()[-1] == str([tmpfilepath,'hello']) @@ -84,7 +84,7 @@ e = None try: output = py.process.cmdexec( '''"%s" "%s" "%s" ''' % - (sys.executable, pypath, tmpfilepath) ) + (sys.executable, pypypath, tmpfilepath) ) except py.process.cmdexec.Error, e: pass assert e," expected failure" Modified: pypy/dist/pypy/module/sys2/state.py ============================================================================== --- pypy/dist/pypy/module/sys2/state.py (original) +++ pypy/dist/pypy/module/sys2/state.py Wed May 18 15:28:56 2005 @@ -66,12 +66,12 @@ pypy_lib = os.path.join(autopath.pypydir, 'lib') assert os.path.exists(python_std_lib) assert os.path.exists(python_std_lib_modified) - self.w_path = space.newlist([space.wrap(''), - space.wrap(pypy_lib), - space.wrap(python_std_lib_modified), - space.wrap(python_std_lib), - ] + - [space.wrap(p) for p in sys.path if p!= srcdir]) + importlist = [''] + for p in os.environ.get('PYTHONPATH', '').split(':'): + if p: + importlist.append(p) + importlist.extend([pypy_lib, python_std_lib_modified, python_std_lib]) + self.w_path = space.newlist([space.wrap(x) for x in importlist]) def get(space): return space.fromcache(State) Modified: pypy/dist/pypy/module/test/test_import.py ============================================================================== --- pypy/dist/pypy/module/test/test_import.py (original) +++ pypy/dist/pypy/module/test/test_import.py Wed May 18 15:28:56 2005 @@ -1,6 +1,7 @@ -import autopath +import py from pypy.interpreter import gateway -import os +from pypy.tool.udir import udir +import sys, os def _setup(space): dn=os.path.abspath(os.path.join(os.path.dirname(__file__), 'impsubdir')) @@ -151,4 +152,17 @@ def imp_b(): import pkg.pkg2.b raises(ImportError,imp_b) - + +def test_PYTHONPATH_takes_precedence(space): + from pypy.interpreter.test.test_py import pypypath + extrapath = udir.ensure("pythonpath", dir=1) + extrapath.join("urllib.py").write("print 42\n") + old = os.environ.get('PYTHONPATH', None) + try: + os.environ['PYTHONPATH'] = str(extrapath) + output = py.process.cmdexec('''"%s" "%s" -c "import urllib"''' % + (sys.executable, pypypath) ) + assert output.strip() == '42' + finally: + if old: + os.environ['PYTHONPATH'] = old From hpk at codespeak.net Wed May 18 15:38:57 2005 From: hpk at codespeak.net (hpk at codespeak.net) Date: Wed, 18 May 2005 15:38:57 +0200 (CEST) Subject: [pypy-svn] r12439 - pypy/dist/pypy/documentation Message-ID: <20050518133857.6939027BBD@code1.codespeak.net> Author: hpk Date: Wed May 18 15:38:57 2005 New Revision: 12439 Modified: pypy/dist/pypy/documentation/coding-guide.txt Log: ReST fixes Modified: pypy/dist/pypy/documentation/coding-guide.txt ============================================================================== --- pypy/dist/pypy/documentation/coding-guide.txt (original) +++ pypy/dist/pypy/documentation/coding-guide.txt Wed May 18 15:38:57 2005 @@ -490,9 +490,9 @@ by default and CPython has a number of places where it relies on some classes being old-style. -If you want to change a module or test contained in `lib-python/2.3.4` -then make sure that you copy the file to our `lib-python/modified-2.3.4` -directory first. In subversion commandline terms this reads: +If you want to change a module or test contained in ``lib-python/2.3.4`` +then make sure that you copy the file to our ``lib-python/modified-2.3.4`` +directory first. In subversion commandline terms this reads:: svn cp lib-python/2.3.4/somemodule.py lib-python/modified-2.3.4/ @@ -517,16 +517,16 @@ ............................. Application level specifiations are found in the `appleveldefs` -dictionary found in `__init__.py` files of directories in `pypy/module`. -For example, in `pypy/module/builtin/__init__.py`_ you find the following -entry specifying where `__builtin__.locals` comes from:: +dictionary found in ``__init__.py`` files of directories in ``pypy/module``. +For example, in ``pypy/module/builtin/__init__.py``_ you find the following +entry specifying where ``__builtin__.locals`` comes from:: ... 'locals' : 'app_inspect.locals', ... -The `app_` prefix indicates that the submodule `app_inspect` is -interpreted at application level and the function value for `locals` +The ``app_`` prefix indicates that the submodule ``app_inspect`` is +interpreted at application level and the function value for ``locals`` will be extracted accordingly. .. _`pypy/module/builtin/__init__.py`: http://codespeak.net/svn/pypy/dist/pypy/module/builtin/__init__.py @@ -534,27 +534,27 @@ interpreter level definitions ............................. -Interpreter level specifiations are found in the `interpleveldefs` -dictionary found in `__init__.py` files of directories in `pypy/module`. -For example, in `pypy/module/builtin/__init__.py`_ the following -entry specifies where `__builtin__.len` comes from:: +Interpreter level specifiations are found in the ``interpleveldefs`` +dictionary found in ``__init__.py`` files of directories in ``pypy/module``. +For example, in ``pypy/module/builtin/__init__.py``_ the following +entry specifies where ``__builtin__.len`` comes from:: ... 'len' : 'operation.len', ... -The `operation` submodule lives at interpreter level and `len` +The ``operation`` submodule lives at interpreter level and ``len`` is expected to be exposable to application level. Here is -the definition for `operation.len()`:: +the definition for ``operation.len()``:: def len(space, w_obj): "len(object) -> integer\n\nReturn the number of items of a sequence or mapping." return space.len(w_obj) -Exposed interpreter level functions usually take a `space` argument +Exposed interpreter level functions usually take a ``space`` argument and some wrapped values (see `wrapping rules`_) . -You can also use a convenient shortcut in `interpleveldefs` dictionaries: +You can also use a convenient shortcut in ``interpleveldefs`` dictionaries: namely an expression in parentheses to specify an interpreter level expression directly (instead of pulling it indirectly from a file):: @@ -563,18 +563,18 @@ 'False' : '(space.w_False)', ... -The interpreter level expression has a `space` binding when +The interpreter level expression has a ``space`` binding when it is executed. -Testing modules in `pypy/lib` ------------------------------ +Testing modules in ``pypy/lib`` +-------------------------------- You can go to the `pypy/lib/test2`_ directory and invoke the testing tool ("py.test" or "python ../../test_all.py") to run tests against the pypy/lib hierarchy. Note, that tests in `pypy/lib/test2`_ are allowed and encouraged to let their tests run at interpreter level although -`pypy/lib` modules eventually live at PyPy's application level. +``pypy/lib`` modules eventually live at PyPy's application level. This allows us to quickly test our python-coded reimplementations against CPython. @@ -583,10 +583,10 @@ Testing modules in `pypy/module` ---------------------------------- -Simply change to `pypy/module` and run the tests as usual. +Simply change to ``pypy/module`` and run the tests as usual. -Testing modules in `lib-python` +Testing modules in ``lib-python`` ----------------------------------- In order to let CPython's regression tests run against PyPy From hpk at codespeak.net Wed May 18 15:41:04 2005 From: hpk at codespeak.net (hpk at codespeak.net) Date: Wed, 18 May 2005 15:41:04 +0200 (CEST) Subject: [pypy-svn] r12440 - pypy/dist/pypy/documentation Message-ID: <20050518134104.A917A27BB9@code1.codespeak.net> Author: hpk Date: Wed May 18 15:41:04 2005 New Revision: 12440 Modified: pypy/dist/pypy/documentation/coding-guide.txt Log: fixing some of the ReST fixes Modified: pypy/dist/pypy/documentation/coding-guide.txt ============================================================================== --- pypy/dist/pypy/documentation/coding-guide.txt (original) +++ pypy/dist/pypy/documentation/coding-guide.txt Wed May 18 15:41:04 2005 @@ -518,7 +518,7 @@ Application level specifiations are found in the `appleveldefs` dictionary found in ``__init__.py`` files of directories in ``pypy/module``. -For example, in ``pypy/module/builtin/__init__.py``_ you find the following +For example, in `pypy/module/builtin/__init__.py`_ you find the following entry specifying where ``__builtin__.locals`` comes from:: ... @@ -536,7 +536,7 @@ Interpreter level specifiations are found in the ``interpleveldefs`` dictionary found in ``__init__.py`` files of directories in ``pypy/module``. -For example, in ``pypy/module/builtin/__init__.py``_ the following +For example, in `pypy/module/builtin/__init__.py`_ the following entry specifies where ``__builtin__.len`` comes from:: ... From hpk at codespeak.net Wed May 18 15:44:54 2005 From: hpk at codespeak.net (hpk at codespeak.net) Date: Wed, 18 May 2005 15:44:54 +0200 (CEST) Subject: [pypy-svn] r12441 - pypy/dist/pypy/documentation Message-ID: <20050518134454.0DD8527BB9@code1.codespeak.net> Author: hpk Date: Wed May 18 15:44:53 2005 New Revision: 12441 Modified: pypy/dist/pypy/documentation/coding-guide.txt Log: improving fixing of ReST still (btw, i am slightly unsure how to markup filenames, do we really have a consistent way of doing this? i am doing it with ``filename`` double quotes most of the time. Modified: pypy/dist/pypy/documentation/coding-guide.txt ============================================================================== --- pypy/dist/pypy/documentation/coding-guide.txt (original) +++ pypy/dist/pypy/documentation/coding-guide.txt Wed May 18 15:44:53 2005 @@ -526,7 +526,7 @@ ... The ``app_`` prefix indicates that the submodule ``app_inspect`` is -interpreted at application level and the function value for ``locals`` +interpreted at application level and the wrapped function value for ``locals`` will be extracted accordingly. .. _`pypy/module/builtin/__init__.py`: http://codespeak.net/svn/pypy/dist/pypy/module/builtin/__init__.py @@ -580,7 +580,7 @@ .. _`pypy/lib/test2`: http://codespeak.net/svn/pypy/dist/pypy/lib/test2 -Testing modules in `pypy/module` +Testing modules in ``pypy/module`` ---------------------------------- Simply change to ``pypy/module`` and run the tests as usual. From hpk at codespeak.net Wed May 18 15:47:44 2005 From: hpk at codespeak.net (hpk at codespeak.net) Date: Wed, 18 May 2005 15:47:44 +0200 (CEST) Subject: [pypy-svn] r12442 - pypy/dist/pypy/documentation Message-ID: <20050518134744.5EEE427BB9@code1.codespeak.net> Author: hpk Date: Wed May 18 15:47:44 2005 New Revision: 12442 Modified: pypy/dist/pypy/documentation/coding-guide.txt Log: add a reference for "testing as usual" Modified: pypy/dist/pypy/documentation/coding-guide.txt ============================================================================== --- pypy/dist/pypy/documentation/coding-guide.txt (original) +++ pypy/dist/pypy/documentation/coding-guide.txt Wed May 18 15:47:44 2005 @@ -583,7 +583,7 @@ Testing modules in ``pypy/module`` ---------------------------------- -Simply change to ``pypy/module`` and run the tests as usual. +Simply change to ``pypy/module`` and `run the tests as usual`_. Testing modules in ``lib-python`` @@ -761,6 +761,8 @@ runs at application level. If you need to use modules you have to import them within the test function. +.. _`run the tests as usual`: + Command line tool test_all -------------------------- @@ -768,8 +770,9 @@ python test_all.py -which is a synonym for the general `py.test`_ utility. -For switches to modify test execution invoke "python test_all.py -h". +which is a synonym for the general `py.test`_ utility +located in the ``pypy`` directory. For switches to +modify test execution pass the ``-h`` option. Test conventions ---------------- From tismer at codespeak.net Wed May 18 16:38:37 2005 From: tismer at codespeak.net (tismer at codespeak.net) Date: Wed, 18 May 2005 16:38:37 +0200 (CEST) Subject: [pypy-svn] r12443 - pypy/dist/pypy/documentation Message-ID: <20050518143837.33B6D27BB9@code1.codespeak.net> Author: tismer Date: Wed May 18 16:38:37 2005 New Revision: 12443 Modified: pypy/dist/pypy/documentation/coding-guide.txt Log: typo Modified: pypy/dist/pypy/documentation/coding-guide.txt ============================================================================== --- pypy/dist/pypy/documentation/coding-guide.txt (original) +++ pypy/dist/pypy/documentation/coding-guide.txt Wed May 18 16:38:37 2005 @@ -757,7 +757,7 @@ These application level test functions will run on top of PyPy, i.e. they have no access to interpreter details. You cannot use imported modules from global level because -they are imported at intepreter-level while you test code +they are imported at interpreter-level while you test code runs at application level. If you need to use modules you have to import them within the test function. From arigo at codespeak.net Wed May 18 17:17:49 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Wed, 18 May 2005 17:17:49 +0200 (CEST) Subject: [pypy-svn] r12447 - pypy/dist/pypy/translator/c Message-ID: <20050518151749.E5F2D27BB9@code1.codespeak.net> Author: arigo Date: Wed May 18 17:17:49 2005 New Revision: 12447 Removed: pypy/dist/pypy/translator/c/ Log: The 'c' subdirectory was a quick-n-dirty check-in of extremely preliminary and not useful considerations about how to rewrite genc in the context of the rpython typer. While we're working on and packaging the release I'll move it out of the way to http://codespeak.net/svn/user/arigo/hack/pypy-hack/c From arigo at codespeak.net Wed May 18 17:23:06 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Wed, 18 May 2005 17:23:06 +0200 (CEST) Subject: [pypy-svn] r12448 - pypy/dist/pypy/translator Message-ID: <20050518152306.97EE227BB9@code1.codespeak.net> Author: arigo Date: Wed May 18 17:23:06 2005 New Revision: 12448 Modified: pypy/dist/pypy/translator/translator.py Log: Quick hack to make calling ccompile() several times work. Modified: pypy/dist/pypy/translator/translator.py ============================================================================== --- pypy/dist/pypy/translator/translator.py (original) +++ pypy/dist/pypy/translator/translator.py Wed May 18 17:23:06 2005 @@ -270,6 +270,7 @@ return cfile mod = make_module_from_c(cfile, include_dirs=[os.path.join(autopath.this_dir, 'genc')]) + self.concretetypes.clear() return getattr(mod, self.entrypoint.func_name) def llvmcompile(self, optimize=True): From arigo at codespeak.net Wed May 18 17:42:48 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Wed, 18 May 2005 17:42:48 +0200 (CEST) Subject: [pypy-svn] r12451 - pypy/dist/pypy/translator Message-ID: <20050518154248.8CE7627BB9@code1.codespeak.net> Author: arigo Date: Wed May 18 17:42:48 2005 New Revision: 12451 Modified: pypy/dist/pypy/translator/translator.py Log: This line should have been 'a.specialize()', but it's probably better left hidden for now, as it will probably change soon. Modified: pypy/dist/pypy/translator/translator.py ============================================================================== --- pypy/dist/pypy/translator/translator.py (original) +++ pypy/dist/pypy/translator/translator.py Wed May 18 17:42:48 2005 @@ -23,7 +23,6 @@ t.call(arg) # call original function t.dis() # bytecode disassemble - t.specialize() # use low level operations (for C only) f = t.ccompile() # C compilation f = t.llvmcompile() # LLVM compilation assert f(arg) == t.call(arg) # sanity check From hpk at codespeak.net Wed May 18 17:44:16 2005 From: hpk at codespeak.net (hpk at codespeak.net) Date: Wed, 18 May 2005 17:44:16 +0200 (CEST) Subject: [pypy-svn] r12452 - pypy/dist/pypy/documentation Message-ID: <20050518154416.E0CB627BB9@code1.codespeak.net> Author: hpk Date: Wed May 18 17:44:16 2005 New Revision: 12452 Modified: pypy/dist/pypy/documentation/getting_started.txt Log: issue37 testing fixing some typos and making the first part of the "interesting starting points" its own chapter. I am wondering, though, if the invocation of the tests and the py.py commandline options shouldn't be moved somewhere else. Or maybe just add another heading? Modified: pypy/dist/pypy/documentation/getting_started.txt ============================================================================== --- pypy/dist/pypy/documentation/getting_started.txt (original) +++ pypy/dist/pypy/documentation/getting_started.txt Wed May 18 17:44:16 2005 @@ -107,17 +107,23 @@ got a release) or pypy-dist (if you checked out the most recent version using subversion). +Main entry point / special PyPy features +------------------------------------------ + 1. To start interpreting Python with PyPy, use Python 2.3 or greater:: cd pypy/interpreter python py.py - After a few seconds, you should be at the PyPy prompt, which is - the same as the Python prompt, but with an extra ">". - -2. Now you are ready to start running Python code. Some real Python - modules will not run yet, and others will run too slowly to be - worth waiting for, but a few are fun to run:: + After a few seconds (remember: this is running on top of CPython), + you should be at the PyPy prompt, which is the same as the Python + prompt, but with an extra ">". + +2. Now you are ready to start running Python code. Most Python + modules should run if they don't involve CPython extension + modules. They will run relatively slow because the PyPy + is still running on top of CPython at this point. Here is an + example of determining PyPy's performance in pystones:: >>>> from test import pystone >>>> pystone.main(10) @@ -129,24 +135,23 @@ on the current PyPy implementation. -3. There are a few useful tricks for the PyPy console: If you press on - the console you enter the interpreter-level console, a CPython - console. There you can access internal objects of PyPy (e.g. the object - space) and the PyPy variables if you affix ``w_``:: +3. There are a few extra features of the PyPy console: If you press + on the console you enter the interpreter-level console, a + usual CPython console. You can then access internal objects of PyPy + (e.g. the object space) and any variables you have created on the PyPy + prompt with the affix ``w_``:: >>>> a = 123 >>>> *** Entering interpreter-level console *** - >>> dir() - ['__builtins__', 'buffer', 'compile', 'ec', 'filename', 'locals', 'space', 'tracelevel', 'verbose', 'w___builtins__', 'w___name__', 'w___pytrace__', 'w_a', 'w_globals'] >>> w_a W_IntObject(123) Note that the prompt of the interpreter-level console is only '>>>' since it runs on CPython level. To return to PyPy, press . -4. You can also use the trace object space to trace the the work of the - interpreter. To enable it, do (on the PyPy console):: +4. You can also use the trace object space to trace the work of the + interpreter. To enable it, do on the PyPy console:: >>>> __pytrace__ = 1 Tracing enabled @@ -165,7 +170,6 @@ |-<<<<a = 1 + 2 @ 1>>>>>>> - 5. To list the PyPy interpreter command line options, type:: cd pypy/interpreter From hpk at codespeak.net Wed May 18 17:47:33 2005 From: hpk at codespeak.net (hpk at codespeak.net) Date: Wed, 18 May 2005 17:47:33 +0200 (CEST) Subject: [pypy-svn] r12453 - pypy/dist/pypy/documentation Message-ID: <20050518154733.CA16627BB9@code1.codespeak.net> Author: hpk Date: Wed May 18 17:47:33 2005 New Revision: 12453 Modified: pypy/dist/pypy/documentation/getting_started.txt Log: remove duplication Modified: pypy/dist/pypy/documentation/getting_started.txt ============================================================================== --- pypy/dist/pypy/documentation/getting_started.txt (original) +++ pypy/dist/pypy/documentation/getting_started.txt Wed May 18 17:47:33 2005 @@ -120,10 +120,9 @@ prompt, but with an extra ">". 2. Now you are ready to start running Python code. Most Python - modules should run if they don't involve CPython extension - modules. They will run relatively slow because the PyPy - is still running on top of CPython at this point. Here is an - example of determining PyPy's performance in pystones:: + modules should work if they don't involve CPython extension + modules. Here is an example of determining PyPy's performance + in pystones:: >>>> from test import pystone >>>> pystone.main(10) From pedronis at codespeak.net Wed May 18 17:50:05 2005 From: pedronis at codespeak.net (pedronis at codespeak.net) Date: Wed, 18 May 2005 17:50:05 +0200 (CEST) Subject: [pypy-svn] r12454 - pypy/dist/pypy/documentation Message-ID: <20050518155005.2039827BB9@code1.codespeak.net> Author: pedronis Date: Wed May 18 17:50:04 2005 New Revision: 12454 Modified: pypy/dist/pypy/documentation/release-0.6.txt Log: draft of the release announcement, to be reviewed and details completed Modified: pypy/dist/pypy/documentation/release-0.6.txt ============================================================================== --- pypy/dist/pypy/documentation/release-0.6.txt (original) +++ pypy/dist/pypy/documentation/release-0.6.txt Wed May 18 17:50:04 2005 @@ -1,16 +1,81 @@ -* intro... -* what it is +The PyPy Development Team is happy to announce the release 0.6 of PyPy +interpreter and technology. This is the first public release and is +eminently a preview release. -* what's working/ caveats (speed...) +PyPy is a reimplementation of Python written in Python itself. -* links to download etc +The long term goals are an implementation that is flexible and easy to +experiment with and retarget to different platforms (also non-C ones) +and such that high performance can be achieved through high-level +implementations of especially dynamic optimisation techniques. -* audience, +The interpreter and object model implementations shipped with 0.6 can +be run on top of CPython and implement the core language features of +Python as of CPython 2.3. They pass a substantial part (~90%) of +CPython test-suite tests not depending on C extension modules. Some of +that functionality is still made available by PyPy piggy-backing on +the host CPython interpreter. Double interpretation and abstractions +in the code-base make it so that PyPy running on CPython is quite slow +(around 2000x slower than CPython ), this is to be expected. -* interesting bits +This release is intended for people that want to look and get a feel +into what we are doing, playing with interpreter and perusing the +codebase. Possibly to join in the fun and efforts. -* on-going work, near future goals +For download links and further information see +(most of PyPy is realeased under the MIT license): -* Team acks... \ No newline at end of file +**xxx LINKS to codespeak/pypy, getting started and the download** + + +The release is also a snap-shot of our ongoing efforts, interesting +things and highlights included, related to the interpreter and beyond: + +* In PyPy bytecode interpretation and the implementation of objects + semantics (as a library of objects) are separated, apart the + standard implementation of those (what we call the standard object + space) PyPy comes with experimental object spaces augmenting the + standard one through delegation: + + - an experimental object space that does extensive tracing of + object operations; + + - an object space that implements lazy values and a 'become' + operation that can exchange object identities. + +* The core of PyPy only implements new-style classes, old-style + classes are basically implemented, apart some hooks, as what is in + principle user-level code (what we call app-level), and then + integrated with rest (there's an interpreter option --old-style to + make them the default metaclass). + +* PyPy is intended to be translated to low-level languages to regain + speed, for that we have developed what we call the annotator, which + is capable of reconstructing type information for our code-base, + which is written respecting some restrictions, and similarly written + code. The annotator right now is already capable of type annotating + basically *all* of PyPy code-base, and is included with 0.6. + +* From type annotated code low-level code needs to be generated, + backends for various targets (C, LLVM,...) are included, they are + all somehow incomplete and have been and are quite in flux. What is + shipped with 0.6 is able to deal with more or less small example + functions. + +Generating low-level target code is the main area we are working right +now, our near term efforts aiming August/September of this year are +focused on producing a stand-alone and low-level translated version of +PyPy with speed much nearer to CPython range. + + +The PyPy Development Team + +**xxx all contributor names in some order (?)** + + +PyPy development and activities happens as open source source project under the codespeak +(xxx link) umbrella and through a consortium funded by a EU IST research grant: + +**(xxx consortium partners?? )** \ No newline at end of file From pedronis at codespeak.net Wed May 18 18:57:28 2005 From: pedronis at codespeak.net (pedronis at codespeak.net) Date: Wed, 18 May 2005 18:57:28 +0200 (CEST) Subject: [pypy-svn] r12458 - pypy/dist/pypy/documentation Message-ID: <20050518165728.64DC727B57@code1.codespeak.net> Author: pedronis Date: Wed May 18 18:57:28 2005 New Revision: 12458 Modified: pypy/dist/pypy/documentation/release-0.6.txt Log: added subheaders Modified: pypy/dist/pypy/documentation/release-0.6.txt ============================================================================== --- pypy/dist/pypy/documentation/release-0.6.txt (original) +++ pypy/dist/pypy/documentation/release-0.6.txt Wed May 18 18:57:28 2005 @@ -1,8 +1,11 @@ -The PyPy Development Team is happy to announce the release 0.6 of PyPy +*The PyPy Development Team is happy to announce the release 0.6 of PyPy interpreter and technology. This is the first public release and is -eminently a preview release. +eminently a preview release.* + +What is is, download and links +------------------------------- PyPy is a reimplementation of Python written in Python itself. @@ -30,6 +33,9 @@ **xxx LINKS to codespeak/pypy, getting started and the download** +Interesting bits and highlights +--------------------------------- + The release is also a snap-shot of our ongoing efforts, interesting things and highlights included, related to the interpreter and beyond: @@ -44,6 +50,8 @@ - an object space that implements lazy values and a 'become' operation that can exchange object identities. + + *These spaces already give a glimpse in the flexibility potential of PyPy*. * The core of PyPy only implements new-style classes, old-style classes are basically implemented, apart some hooks, as what is in @@ -64,6 +72,9 @@ shipped with 0.6 is able to deal with more or less small example functions. +Ongoing work and near term goals +--------------------------------- + Generating low-level target code is the main area we are working right now, our near term efforts aiming August/September of this year are focused on producing a stand-alone and low-level translated version of From pedronis at codespeak.net Wed May 18 19:10:35 2005 From: pedronis at codespeak.net (pedronis at codespeak.net) Date: Wed, 18 May 2005 19:10:35 +0200 (CEST) Subject: [pypy-svn] r12459 - pypy/dist/pypy/documentation Message-ID: <20050518171035.6BFFE27BBD@code1.codespeak.net> Author: pedronis Date: Wed May 18 19:10:35 2005 New Revision: 12459 Modified: pypy/dist/pypy/documentation/release-0.6.txt Log: doc too Modified: pypy/dist/pypy/documentation/release-0.6.txt ============================================================================== --- pypy/dist/pypy/documentation/release-0.6.txt (original) +++ pypy/dist/pypy/documentation/release-0.6.txt Wed May 18 19:10:35 2005 @@ -27,7 +27,7 @@ into what we are doing, playing with interpreter and perusing the codebase. Possibly to join in the fun and efforts. -For download links and further information see +For download links and further information and documentation see (most of PyPy is realeased under the MIT license): **xxx LINKS to codespeak/pypy, getting started and the download** From arigo at codespeak.net Wed May 18 19:15:26 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Wed, 18 May 2005 19:15:26 +0200 (CEST) Subject: [pypy-svn] r12460 - in pypy/dist: demo goal pypy/bin pypy/documentation pypy/interpreter pypy/interpreter/test pypy/objspace pypy/translator pypy/translator/goal Message-ID: <20050518171526.B186827BB2@code1.codespeak.net> Author: arigo Date: Wed May 18 19:15:26 2005 New Revision: 12460 Added: pypy/dist/demo/ (props changed) - copied from r12444, pypy/dist/goal/ pypy/dist/demo/bpnn.py (contents, props changed) pypy/dist/demo/fibonacci.py (contents, props changed) pypy/dist/demo/sharedref.py - copied, changed from r12455, user/arigo/hack/pypy-hack/sharedref.py pypy/dist/pypy/bin/ (props changed) pypy/dist/pypy/bin/autopath.py - copied unchanged from r12444, pypy/dist/pypy/interpreter/autopath.py pypy/dist/pypy/bin/py.py - copied, changed from r12444, pypy/dist/pypy/interpreter/py.py pypy/dist/pypy/bin/translator.py (contents, props changed) - copied, changed from r12451, pypy/dist/pypy/translator/translator.py pypy/dist/pypy/translator/goal/ - copied from r12444, pypy/dist/goal/ Removed: pypy/dist/demo/app_example.py pypy/dist/demo/app_main.py pypy/dist/demo/buildcache.py pypy/dist/demo/buildcache2.py pypy/dist/demo/compiler-hack.py pypy/dist/demo/dis-pregoal.py pypy/dist/demo/gadfly-demo.py pypy/dist/demo/hello_world.py pypy/dist/demo/objectspace-reconstruct.py pypy/dist/demo/pydoc-goal.py pypy/dist/demo/pydoc-pregoal.py pypy/dist/demo/stringcomp.py pypy/dist/demo/targetpypy.py pypy/dist/demo/targetpypy0.py pypy/dist/demo/targetpypy1.py pypy/dist/demo/targetpypymain.py pypy/dist/demo/targetrpystone.py pypy/dist/demo/targetrpystone2.py pypy/dist/demo/translate_pypy.py pypy/dist/goal/ pypy/dist/pypy/interpreter/py.py pypy/dist/pypy/translator/goal/buildcache.py pypy/dist/pypy/translator/goal/compiler-hack.py pypy/dist/pypy/translator/goal/dis-goal.py pypy/dist/pypy/translator/goal/dis-pregoal.py pypy/dist/pypy/translator/goal/foodbill.py pypy/dist/pypy/translator/goal/gadfly-demo.py pypy/dist/pypy/translator/goal/hello_world.py pypy/dist/pypy/translator/goal/http-and-html.py pypy/dist/pypy/translator/goal/objectspace-reconstruct.py pypy/dist/pypy/translator/goal/pydoc-goal.py pypy/dist/pypy/translator/goal/pydoc-pregoal.py pypy/dist/pypy/translator/goal/stringcomp.py Modified: pypy/dist/demo/dis-goal.py pypy/dist/demo/foodbill.py pypy/dist/demo/http-and-html.py pypy/dist/pypy/documentation/objspace.txt pypy/dist/pypy/interpreter/test/test_py.py pypy/dist/pypy/objspace/thunk.py pypy/dist/pypy/translator/goal/translate_pypy.py (contents, props changed) pypy/dist/pypy/translator/translator.py Log: issue47 in-progress New official entry points into PyPy: A dist/pypy/bin/py.py A dist/pypy/bin/translator.py D pypy/interpreter/py.py translate_pypy and associated files have been moved: A dist/pypy/translator/goal D dist/goal There is a new directory for demo material, where I kept some of the examples of the old goal directory and commented them: RM dist/demo M dist/demo/foodbill.py M dist/demo/dis-goal.py M dist/demo/http-and-html.py There are three new demos too. Two about the thunk object space and one showing a nicely annotated and translated piece of code (from the Psyco tests, originally by Neil Schemenauer): AM demo/bpnn.py A demo/sharedref.py AM demo/fibonacci.py Deleted: /pypy/dist/goal/app_example.py ============================================================================== --- /pypy/dist/goal/app_example.py Wed May 18 19:15:26 2005 +++ (empty file) @@ -1,3 +0,0 @@ -print '--- beginning of app_example.py ---' -print 6*7 -print '--- end of app_example.py ---' Deleted: /pypy/dist/goal/app_main.py ============================================================================== --- /pypy/dist/goal/app_main.py Wed May 18 19:15:26 2005 +++ (empty file) @@ -1,24 +0,0 @@ -# App-level version of py.py. -# XXX very incomplete! Blindly runs the file named as first argument. -# No option checking, no interactive console, no fancy hooks. - -def entry_point(argv): - import sys - sys.executable = argv[0] - sys.argv = argv[1:] - - mainmodule = type(sys)('__main__') - sys.modules['__main__'] = mainmodule - - try: - execfile(sys.argv[0], mainmodule.__dict__) - except: - sys.excepthook(*sys.exc_info()) - return 1 - else: - return 0 - -if __name__ == '__main__': - # debugging only - import sys - sys.exit(entry_point(sys.argv)) Added: pypy/dist/demo/bpnn.py ============================================================================== --- (empty file) +++ pypy/dist/demo/bpnn.py Wed May 18 19:15:26 2005 @@ -0,0 +1,200 @@ +#!/usr/bin/python +""" + Translator Demo + + Run this file -- over regular Python! -- to analyse and type-annotate + the functions and class defined in this module, starting from the + entry point function demo(). + + Requires Pygame. +""" +# Back-Propagation Neural Networks +# +# Written in Python. See http://www.python.org/ +# +# Neil Schemenauer +# +# Modifications to the original (Armin Rigo): +# * import random from PyPy's lib, which is Python 2.2's plain +# Python implementation +# * use sys.stdout.write() instead of print statements for now +# * starts the Translator instead of the demo by default. + +import sys +import math + +# XXX the Translator needs the plain Python version of random.py: +import autopath; from pypy.lib import random + + +random.seed(0) + +# calculate a random number where: a <= rand < b +def rand(a, b): + return (b-a)*random.random() + a + +# Make a matrix (we could use NumPy to speed this up) +def makeMatrix(I, J, fill=0.0): + m = [] + for i in range(I): + m.append([fill]*J) + return m + +class NN: + + def __init__(self, ni, nh, no): + # number of input, hidden, and output nodes + self.ni = ni + 1 # +1 for bias node + self.nh = nh + self.no = no + + # activations for nodes + self.ai = [1.0]*self.ni + self.ah = [1.0]*self.nh + self.ao = [1.0]*self.no + + # create weights + self.wi = makeMatrix(self.ni, self.nh) + self.wo = makeMatrix(self.nh, self.no) + # set them to random vaules + for i in range(self.ni): + for j in range(self.nh): + self.wi[i][j] = rand(-2.0, 2.0) + for j in range(self.nh): + for k in range(self.no): + self.wo[j][k] = rand(-2.0, 2.0) + + # last change in weights for momentum + self.ci = makeMatrix(self.ni, self.nh) + self.co = makeMatrix(self.nh, self.no) + + def update(self, inputs): + if len(inputs) != self.ni-1: + raise ValueError, 'wrong number of inputs' + + # input activations + for i in range(self.ni-1): + #self.ai[i] = 1.0/(1.0+math.exp(-inputs[i])) + self.ai[i] = inputs[i] + + # hidden activations + for j in range(self.nh): + sum = 0.0 + for i in range(self.ni): + sum = sum + self.ai[i] * self.wi[i][j] + self.ah[j] = 1.0/(1.0+math.exp(-sum)) + + # output activations + for k in range(self.no): + sum = 0.0 + for j in range(self.nh): + sum = sum + self.ah[j] * self.wo[j][k] + self.ao[k] = 1.0/(1.0+math.exp(-sum)) + + return self.ao[:] + + + def backPropagate(self, targets, N, M): + if len(targets) != self.no: + raise ValueError, 'wrong number of target values' + + # calculate error terms for output + output_deltas = [0.0] * self.no + for k in range(self.no): + ao = self.ao[k] + output_deltas[k] = ao*(1-ao)*(targets[k]-ao) + + # calculate error terms for hidden + hidden_deltas = [0.0] * self.nh + for j in range(self.nh): + sum = 0.0 + for k in range(self.no): + sum = sum + output_deltas[k]*self.wo[j][k] + hidden_deltas[j] = self.ah[j]*(1-self.ah[j])*sum + + # update output weights + for j in range(self.nh): + for k in range(self.no): + change = output_deltas[k]*self.ah[j] + self.wo[j][k] = self.wo[j][k] + N*change + M*self.co[j][k] + self.co[j][k] = change + #print N*change, M*self.co[j][k] + + # update input weights + for i in range(self.ni): + for j in range(self.nh): + change = hidden_deltas[j]*self.ai[i] + self.wi[i][j] = self.wi[i][j] + N*change + M*self.ci[i][j] + self.ci[i][j] = change + + # calculate error + error = 0.0 + for k in range(len(targets)): + error = error + 0.5*(targets[k]-self.ao[k])**2 + return error + + + def test(self, patterns): + for p in patterns: + print_('%s -> %s' % (p[0], self.update(p[0]))) + + def weights(self): + print_('Input weights:') + for i in range(self.ni): + print_(self.wi[i]) + print_() + print_('Output weights:') + for j in range(self.nh): + print_(self.wo[j]) + + def train(self, patterns, iterations=2000, N=0.5, M=0.1): + # N: learning rate + # M: momentum factor + for i in xrange(iterations): + error = 0.0 + for p in patterns: + inputs = p[0] + targets = p[1] + self.update(inputs) + error = error + self.backPropagate(targets, N, M) + if i % 100 == 0: + print_('error %-14f' % error) + +def print_(s): + sys.stdout.write(s+'\n') + + +def demo(): + # Teach network XOR function + pat = [ + [[0,0], [0]], + [[0,1], [1]], + [[1,0], [1]], + [[1,1], [0]] + ] + + # create a network with two input, two hidden, and two output nodes + n = NN(2, 3, 1) + # train it with some patterns + n.train(pat, 2000) + # test it + n.test(pat) + + + +if __name__ == '__main__': + #demo() + + print 'Loading...' + from pypy.translator.translator import Translator + t = Translator(demo) + print 'Annotating...' + a = t.annotate([]) + a.simplify() + #a.specialize() + print 'Displaying the call graph and the class hierarchy.' + t.viewcg() + print 'Compiling...' + f = t.ccompile() + print 'Running...' + f() Deleted: /pypy/dist/goal/buildcache.py ============================================================================== --- /pypy/dist/goal/buildcache.py Wed May 18 19:15:26 2005 +++ (empty file) @@ -1,56 +0,0 @@ -from pypy.tool import option, autopath, testit -from pypy.interpreter import gateway -import os - -####################################################### -def app_triggerall(): - import sys, types # , exceptions - k = 42 - def gen(): - yield k - #yield (k, 1.0, 4L, [''], {}, unicode, Ellipsis) - try: - raise ValueError - except ValueError: - x = sys.exc_info() - try: - raise x[0], x[1], x[2] - except ValueError: - pass - - #gen.func_code.co_name - str({'co_name': ('f',)}), str(object.__init__.im_func.func_code) - #"for %r" % ({'x': gen}) - "%02d %04f %05g %05s <%s> %r" % (1, 2.25, 2.25, 2.25, [1,2], {'x': gen}) - for x in gen(): - pass - -def app_triggerexec(): - exec "i=3" - -gateway.importall(globals()) # app_xxx() -> xxx() - -####################################################### -from pypy.objspace.std import stdtypedef - -def buildcache(space): - print "triggering cache build for %r" % space - triggerall(space) - triggerexec(space) - #testit.main(os.path.join(autopath.pypydir, 'objspace', 'std')) - #Cache.freeze() - #space._typecache = frozendict(space._typecache) - #space._faketypecache = frozendict(space._faketypecache) - #space._gatewaycache = frozendict(space._gatewaycache) - #space = option.objspace('std') - #buildcache(space) - #for x in stdtypedef._temp: - # x.cache_table = frozendict(x.cache_table) - print "cache build finished, caches are 'frozen' now" - -if __name__ == '__main__': - space = option.objspace('std') - buildcache(space) - #testit.main(autopath.pypydir) - - testit.main(os.path.join(autopath.pypydir)) # , 'objspace', 'std')) Deleted: /pypy/dist/goal/buildcache2.py ============================================================================== --- /pypy/dist/goal/buildcache2.py Wed May 18 19:15:26 2005 +++ (empty file) @@ -1,54 +0,0 @@ - -def buildcache(space): - from pypy.interpreter.typedef import interptypes - - space.builtin.getdict() - print "*builtin*" - w_dic = space.builtin.w_dict - #print space.unwrap(space.call_method(w_dic,"keys")) - - - space.sys.getdict() - print "*sys*" - w_dic = space.sys.w_dict - #print space.unwrap(space.call_method(w_dic,"keys")) - - # others - w_modules = space.sys.get('modules') - def getmodule(name): - return space.getitem(w_modules, space.wrap(name)) - - getmodule('parser').getdict() - print "*parser*" - - for typedef in interptypes: - w_typ = space.gettypeobject(typedef) - w_typ.getdict() - print "*%s*" % typedef.name - - for typedef in space.model.pythontypes: - w_typ = getattr(space, 'w_' + typedef.name) - w_typ.getdict() - - print "*%s*" % typedef.name - #print w_typ.dict_w.keys() - - space.builtin.get('file').getdict() - - space.appexec([],"""(): - try: - raise ValueError - except ValueError: - pass - exec 'pass' -""") - # freeze caches? - print "cache build finished" - -if __name__ == '__main__': - import autopath - from pypy.objspace.std.objspace import StdObjSpace - - space = StdObjSpace() - - buildcache(space) Deleted: /pypy/dist/goal/compiler-hack.py ============================================================================== --- /pypy/dist/goal/compiler-hack.py Wed May 18 19:15:26 2005 +++ (empty file) @@ -1,6 +0,0 @@ -import compiler -c = compiler.compile('a=1', '', 'exec') -import dis -dis.dis(c) -exec c -print a Modified: pypy/dist/demo/dis-goal.py ============================================================================== --- pypy/dist/goal/dis-goal.py (original) +++ pypy/dist/demo/dis-goal.py Wed May 18 19:15:26 2005 @@ -1,2 +1,7 @@ +""" +An old-time classical example, and one of our first goals. +To run on top of PyPy. +""" + import dis dis.dis(dis.dis) Deleted: /pypy/dist/goal/dis-pregoal.py ============================================================================== --- /pypy/dist/goal/dis-pregoal.py Wed May 18 19:15:26 2005 +++ (empty file) @@ -1,2 +0,0 @@ -import dis -dis.disassemble(dis.dis.func_code) Added: pypy/dist/demo/fibonacci.py ============================================================================== --- (empty file) +++ pypy/dist/demo/fibonacci.py Wed May 18 19:15:26 2005 @@ -0,0 +1,43 @@ +""" +Thunk (a.k.a. lazy objects) in PyPy. +To run on top of the thunk object space with the following command-line: + + py.py -o thunk thunk-demo.py + +This is a typical Functional Programming Languages demo, computing the +Fibonacci sequence by using an infinite lazy linked list. +""" + +try: + thunk # only available in 'py.py -o thunk' +except NameError: + print __doc__ + raise SystemExit(2) + +# ____________________________________________________________ + + +class ListNode: + def __init__(self, head, tail): + self.head = head # the first element of the list + self.tail = tail # the sublist of all remaining elements + + +def add_lists(list1, list2): + """Compute the linked-list equivalent of the Python expression + [a+b for (a,b) in zip(list1,list2)] + """ + return ListNode(list1.head + list2.head, + thunk(add_lists, list1.tail, list2.tail)) + + +# 1, 1, 2, 3, 5, 8, 13, 21, 34, ... +Fibonacci = ListNode(1, ListNode(1, None)) +Fibonacci.tail.tail = thunk(add_lists, Fibonacci, Fibonacci.tail) + + +if __name__ == '__main__': + node = Fibonacci + while True: + print node.head + node = node.tail Modified: pypy/dist/demo/foodbill.py ============================================================================== --- pypy/dist/goal/foodbill.py (original) +++ pypy/dist/demo/foodbill.py Wed May 18 19:15:26 2005 @@ -1,3 +1,8 @@ +""" +Of historical interest: we computed the food bill of our first Gothenburg +sprint with PyPy :-) +""" + slips=[(1, 'Kals MatMarkn', 6150, 'Chutney for Curry', 'dinner Saturday'), (2, 'Kals MatMarkn', 32000, 'Spaghetti, Beer', 'dinner Monday'), (2, 'Kals MatMarkn', -810, 'Deposit on Beer Bottles', 'various'), Deleted: /pypy/dist/goal/gadfly-demo.py ============================================================================== --- /pypy/dist/goal/gadfly-demo.py Wed May 18 19:15:26 2005 +++ (empty file) @@ -1,23 +0,0 @@ -import os -os.mkdir('db') - -import gadfly -connection = gadfly.gadfly() -connection.startup('test', 'db') -cursor = connection.cursor() - -def print_and_execute(cursor, operation): - print operation - cursor.execute(operation) - -print_and_execute(cursor, "CREATE TABLE pypy(py varchar)") -print_and_execute(cursor, "INSERT INTO pypy(py) VALUES ('py')") -print_and_execute(cursor, "SELECT * FROM pypy") -for row in cursor.fetchall(): - print row - -connection.commit() -connection.close() - -import shutil -shutil.rmtree('db') Deleted: /pypy/dist/goal/hello_world.py ============================================================================== --- /pypy/dist/goal/hello_world.py Wed May 18 19:15:26 2005 +++ (empty file) @@ -1,2 +0,0 @@ -aStr = 'hello world' -print len(aStr) Modified: pypy/dist/demo/http-and-html.py ============================================================================== --- pypy/dist/goal/http-and-html.py (original) +++ pypy/dist/demo/http-and-html.py Wed May 18 19:15:26 2005 @@ -1,3 +1,11 @@ +""" + Standard Library usage demo. + Uses urllib and htmllib to download and parse a web page. + + The purpose of this demo is to remind and show that almost all + pure-Python modules of the Standard Library work just fine. +""" + url = 'http://www.python.org/' html = 'python.html' import urllib Deleted: /pypy/dist/goal/objectspace-reconstruct.py ============================================================================== --- /pypy/dist/goal/objectspace-reconstruct.py Wed May 18 19:15:26 2005 +++ (empty file) @@ -1,163 +0,0 @@ - -def __getattribute__(w_obj,w_name): - name = space.unwrap(w_name) - w_descr = space.lookup(w_obj, name) - if w_descr is not None: - if space.is_data_descr(w_descr): - return space.get(w_descr,w_obj,space.type(w_obj)) - w_dict = space.getdict(w_obj) - if w_dict is not None: - try: - return space.getitem(w_dict,w_name) - except OperationError, e: - if not e.match(space,space.w_KeyError): - raise - if w_descr is not None: - return space.get(w_descr,w_obj,space.wrap(type)) - raise OperationError(space.w_AttributeError,w_name) - -def space.getattr(w_obj,w_name): - w_descr = space.lookup(w_obj, '__getattribute__') - try: - return space.get_and_call_function(w_descr, w_obj, w_name) - except: # AttributeError - w_descr = space.lookup(w_obj, '__getattr__') - if w_descr is None: - raise - return space.get_and_call_function(w_descr, w_obj, w_name) - -def space.get(w_obj,w_name): - w_descr = space.lookup(w_obj, '__get__') - if w_descr is not None: - return space.get_and_call(w_descr, w_obj, space.newtuple([w_name])) - else: - return w_obj - -def space.call(w_obj, w_args, w_kwargs): - w_descr = space.lookup(w_obj, '__call__') - if w_descr is None: - raise OperationError(space.w_TypeError, space.wrap('...')) - return space.get_and_call(w_descr, w_obj, w_args, w_kwargs) - - -class BaseObjSpace: - def get_and_call(self, w_descr, w_obj, w_args, w_kwargs): - if isinstance(w_descr, W_Function): - args_w = space.unpacktuple(w_args) - return w_descr.func.call(space.newtuple([w_obj]+args_w),w_kwargs) - else: - w_bound = space.get(w_descr,w_obj,space.gettype(w_obj)) - return space.call(w_bound, w_args, w_kwargs) - -class Wrappable: - def __wrap__(self, space): - return self - -class Function(Wrappable): - TypeDef = Type("function", [], { - '__call__' : app_descr_function_call, - 'func_code' : Property(func_code_getter) - }) - -class BuiltinType: - def __init__(self, name, bases, rawdict): - self.name = name - self.bases = bases - self.rawdict = rawdict - self.mro = [] - -class W_Function: - def __init__(self, space, func): - self.func = func - self.space = space - - def gettype(self): - space = self.space - try: - return space.FunctionType - except AttributeError: - space.FunctionType = f = Type(space, [space.ObjectType]) - f.dict_w['__call__'] = space.wrap(app_descr_function_call) - func_code_property = Property(func_code_getter) - f.dict_w['func_code'] = space.wrap(func_code_property) - return f - -class StdObjectSpace: - def lookup(space, w_obj, name): - typ = space._gettype(w_obj) - return space.wrap(typ.lookup(name)) - - def type(space,w_obj): - return space.wrap(space._gettype(w_obj)) - - def _gettype - try: - return space._types[w_obj.__class__] - except KeyError: - typ = space.buildtype(w_obj.TypeDef) - space._types[w_obj.__class__] = typ - return typ - - def buildtype(space, typedef): - typ = Type(w_ - for name, value - - def wrap(space, obj): - - assert self.space == space - return W_Type(space, self) - -def trivspace.lookup(space, w_obj, name): - if isinstance(w_obj, Wrappable): - for basedef in w_obj.TypeDef.mro(): - if name in basedef.rawdict: - return space.wrap(basedef.rawdict[name]) - return None - else: - for cls in w_obj.__class__.__mro__: - if name in cls.__dict__: - return cls.__dict__[name] - return None - - -def func_code_getter(space,w_func): - return space.wrap(w_func.func.code) - -def object___class__(space,w_obj): - return space.type(w_obj) - -def descr_function_call(space, w_func, w_args, w_kwds): - return w_func.func.call(w_args, w_kwds) -app_descr_function_call = gateway.interp2app(descr_function_call) - - - - -class Property: - def __init__(self, fget, fset=None, fdel=None, doc=None): - self.fget = fget - self.fset = fset - self.fdel = fdel - self.doc = doc - def __wrap__(self, space): - return W_Property(space, self) - -class W_Property(...Wrapped): - def __init__(self, space, property): - self.space = space - self.property = property - def gettype(self): - space = self.space - try: - return space.PropertyType - except AttributeError: - space.PropertyType = t = Type(space, "builtin-property", []) - t.dict_w["__get__"] = space.wrap(app_descr_property_get) - return t - -def descr_property_get(space, w_property, w_obj, w_ignored): - return w_property.property.fget(space, w_obj) - -app_descr_property_get = gateway.interp2app(descr_property_get) - - Deleted: /pypy/dist/goal/pydoc-goal.py ============================================================================== --- /pypy/dist/goal/pydoc-goal.py Wed May 18 19:15:26 2005 +++ (empty file) @@ -1,2 +0,0 @@ -import pydoc -pydoc.help(pydoc) Deleted: /pypy/dist/goal/pydoc-pregoal.py ============================================================================== --- /pypy/dist/goal/pydoc-pregoal.py Wed May 18 19:15:26 2005 +++ (empty file) @@ -1 +0,0 @@ -import pydoc Copied: pypy/dist/demo/sharedref.py (from r12455, user/arigo/hack/pypy-hack/sharedref.py) ============================================================================== --- user/arigo/hack/pypy-hack/sharedref.py (original) +++ pypy/dist/demo/sharedref.py Wed May 18 19:15:26 2005 @@ -156,7 +156,14 @@ print 'Ok' return Channel(s, False) + if __name__ == '__main__': + try: + thunk, become # only available in 'py.py -o thunk' + except NameError: + print __doc__ + raise SystemExit(2) + channels = [] for a in sys.argv[1:]: try: Deleted: /pypy/dist/goal/stringcomp.py ============================================================================== --- /pypy/dist/goal/stringcomp.py Wed May 18 19:15:26 2005 +++ (empty file) @@ -1,17 +0,0 @@ - -### a trivial program to test strings, lists, functions and methods ### - -def addstr(s1,s2): - return s1 + s2 - -str = "an interesting string" -str2 = 'another::string::xxx::y:aa' -str3 = addstr(str,str2) -arr = [] -for word in str.split(): - if word in str2.split('::'): - arr.append(word) -print ''.join(arr) -print "str + str2 = ", str3 - - Deleted: /pypy/dist/goal/targetpypy.py ============================================================================== --- /pypy/dist/goal/targetpypy.py Wed May 18 19:15:26 2005 +++ (empty file) @@ -1,32 +0,0 @@ -import buildcache2 -from pypy.objspace.std.objspace import StdObjSpace, W_Object -from pypy.objspace.std.intobject import W_IntObject - -# __________ Entry point __________ - -def entry_point(): - w_a = W_IntObject(space, -6) - w_b = W_IntObject(space, -7) - return space.mul(w_a, w_b) - -# _____ Define and setup target ___ - -def target(): - global space - # disable translation of the whole of classobjinterp.py - StdObjSpace.setup_old_style_classes = lambda self: None - space = StdObjSpace() - # call cache filling code - buildcache2.buildcache(space) - # further call the entry_point once to trigger building remaining - # caches (as far as analyzing the entry_point is concerned) - entry_point() - - return entry_point, [] - -# _____ Run translated _____ -def run(c_entry_point): - w_result = c_entry_point() - print w_result - print w_result.intval - assert w_result.intval == 42 Deleted: /pypy/dist/goal/targetpypy0.py ============================================================================== --- /pypy/dist/goal/targetpypy0.py Wed May 18 19:15:26 2005 +++ (empty file) @@ -1,33 +0,0 @@ -from pypy.objspace import dummy -from pypy.interpreter.pycode import PyCode - -# __________ Entry point __________ - -def entry_point(code, w_loc): - code2 = PyCode(space) - code2 = code2._from_code(code) - code2.exec_code(space, space.wrap({}), w_loc) - -# _____ Define and setup target _____ - -def target(): - global space - space = dummy.DummyObjSpace() - - from pypy.interpreter import pycode - - pycode.setup_frame_classes() - - from pypy.interpreter import pyopcode - - # cheat - space._gatewaycache.content[pyopcode.app] = space.newdict([]) - - return entry_point,[object, dummy.W_Obj] - -# _____ Run translated _____ - -def run(c_entry_point): - w_result = c_entry_point(compile("a+b","","eval"),dummy.W_Obj()) - print w_result - Deleted: /pypy/dist/goal/targetpypy1.py ============================================================================== --- /pypy/dist/goal/targetpypy1.py Wed May 18 19:15:26 2005 +++ (empty file) @@ -1,75 +0,0 @@ -from pypy.objspace.std.objspace import StdObjSpace, W_Object -from pypy.objspace.std.intobject import W_IntObject -from pypy.objspace.std import stdtypedef - -# __________ Entry point __________ - -operations = "mul add sub div mod lshift rshift floordiv truediv ".split() - -def entry_point(): - w_a = W_IntObject(space, -7) - w_b = W_IntObject(space, 6) - results_w = [mmentrypoints[op](space, w_a, w_b) for op in operations] - return [space.unwrap(each) for each in resuls_w] - -# flatten the above code, to get a nicer look -def make_flat_code(): - g = globals() - # make globals constants from the operations - code = """def entry_point(): - import sys - w_a = W_IntObject(space, -7) - # -sys.maxint-1 crashes: genc problem with OP_SUB and int constant - # when implementing lshift_Long_Long and rshift__Long_Long - w_b = W_IntObject(space, 6) - results_w = [] - append = results_w.append -""" - for op in operations: - g["op_%s" % op] = mmentrypoints[op] - line = " append(op_%s(space, w_a, w_b))" % op - code += line + '\n' - code += " return [space.unwrap(each) for each in results_w]\n" - print code - exec code in g - -# _____ Define and setup target _____ -def target(): - global space, mmentrypoints - # disable translation of the whole of classobjinterp.py - StdObjSpace.setup_old_style_classes = lambda self: None - space = StdObjSpace() - # call cache filling code *not* needed here - - # ------------------------------------------------------------ - mmentrypoints = {} - for name in operations: - mm = getattr(space.MM, name) - exprargs, expr, miniglobals, fallback = ( - mm.install_not_sliced(space.model.typeorder, baked_perform_call=False)) - func = stdtypedef.make_perform_trampoline('__mm_'+name, - exprargs, expr, miniglobals, - mm) - mmentrypoints[name] = func - # ------------------------------------------------------------ - - # further call the entry_point once to trigger building remaining - # caches (as far as analyzing the entry_point is concerned) - make_flat_code() - entry_point() - - return entry_point, [] - -# _____ Run translated _____ - -def run(c_entry_point): - res = c_entry_point() - print res - import operator - assert res == [getattr(operator, name)(-7, 6) for name in operations] - -if __name__ == "__main__": - # just run it without translation - target() - run(entry_point) - \ No newline at end of file Deleted: /pypy/dist/goal/targetpypymain.py ============================================================================== --- /pypy/dist/goal/targetpypymain.py Wed May 18 19:15:26 2005 +++ (empty file) @@ -1,45 +0,0 @@ -import os, sys -from pypy.objspace.std.objspace import StdObjSpace -from pypy.annotation.model import * -from pypy.annotation.listdef import ListDef -from pypy.interpreter import gateway - -# WARNING: this requires the annotator. -# There is no easy way to build all caches manually, -# but the annotator can do it for us for free. - -this_dir = os.path.dirname(sys.argv[0]) - -# __________ Entry point __________ - -def entry_point(argv): - w_argv = space.newlist([space.wrap(s) for s in argv]) - w_exitcode = space.call(w_entry_point, w_argv) - return space.int_w(w_exitcode) - -# _____ Define and setup target ___ - -def target(): - global space, w_entry_point - # disable translation of the whole of classobjinterp.py - StdObjSpace.setup_old_style_classes = lambda self: None - # disable geninterp for now -- we have faaar toooo much interp-level code - # for the poor translator already - gateway.ApplevelClass.use_geninterp = False - - space = StdObjSpace() - - # manually imports app_main.py - filename = os.path.join(this_dir, 'app_main.py') - w_dict = space.newdict([]) - space.exec_(open(filename).read(), w_dict, w_dict) - w_entry_point = space.getitem(w_dict, space.wrap('entry_point')) - - s_list_of_strings = SomeList(ListDef(None, SomeString())) - return entry_point, [s_list_of_strings] - -# _____ Run translated _____ -def run(c_entry_point): - argv = [os.path.join(this_dir, 'app_example.py')] - exitcode = c_entry_point(argv) - assert exitcode == 0 Deleted: /pypy/dist/goal/targetrpystone.py ============================================================================== --- /pypy/dist/goal/targetrpystone.py Wed May 18 19:15:26 2005 +++ (empty file) @@ -1,36 +0,0 @@ -import buildcache2 -from pypy.objspace.std.objspace import StdObjSpace -from pypy.translator.test import rpystone - -# __________ Entry point __________ - -LOOPS = 150000 - -# rpystone.setslow(False) - -def entry_point(): - rpystone.entrypoint(LOOPS) - -# _____ Define and setup target _____ -def target(): - global space, mmentrypoints - space = StdObjSpace() - - # ------------------------------------------------------------ - - return entry_point, [] - -# _____ Run translated _____ - -def run(c_entry_point): - res_w = c_entry_point() - print res_w - print "CPython:" - rpystone.entrypoint(50000) - -if __name__ == "__main__": - # just run it without translation - LOOPS = 50000 - target() - run(entry_point) - \ No newline at end of file Deleted: /pypy/dist/goal/targetrpystone2.py ============================================================================== --- /pypy/dist/goal/targetrpystone2.py Wed May 18 19:15:26 2005 +++ (empty file) @@ -1,36 +0,0 @@ -import buildcache2 -from pypy.objspace.std.objspace import StdObjSpace -from pypy.translator.test import rpystone - -# __________ Entry point __________ - -LOOPS = 1000000 - -rpystone.setslow(False) - -def entry_point(): - rpystone.entrypoint(LOOPS) - -# _____ Define and setup target _____ -def target(): - global space, mmentrypoints - space = StdObjSpace() - - # ------------------------------------------------------------ - - return entry_point, [] - -# _____ Run translated _____ - -def run(c_entry_point): - res_w = c_entry_point() - print res_w - print "CPython:" - rpystone.entrypoint(50000) - -if __name__ == "__main__": - # just run it without translation - LOOPS = 50000 - target() - run(entry_point) - \ No newline at end of file Deleted: /pypy/dist/goal/translate_pypy.py ============================================================================== --- /pypy/dist/goal/translate_pypy.py Wed May 18 19:15:26 2005 +++ (empty file) @@ -1,434 +0,0 @@ -# -# -# -""" -Command-line options for translate_pypy: - - port Listen on the given port number for connexions - (see pypy/translator/tool/pygame/graphclient.py) - targetspec - targetspec.py is a python file defining - what is the translation target and setting things up for it, - it should have a target function returning an entry_point ...; - defaults to targetpypy. The .py suffix is optional. - -text Don't start the Pygame viewer - -no-a Don't infer annotations, just translate everything - -no-s Don't simplify the graph after annotation - -no-t Don't type-specialize the graph operations with the C typer - -no-c Don't generate the C code - -c Generate the C code, but don't compile it - -o Generate and compile the C code, but don't run it - -no-mark-some-objects - Do not mark functions that have SomeObject in their signature. - -tcc Equivalent to the envvar PYPY_CC='tcc -shared -o "%s.so" "%s.c"' - -- http://fabrice.bellard.free.fr/tcc/ - -no-d Disable recording of debugging information - -huge=% Threshold in the number of functions after which only a local call - graph and not a full one is displayed -""" -import autopath, sys, threading, pdb, os - -from pypy.translator.translator import Translator -from pypy.translator.ann_override import pypy_overrides -from pypy.annotation import model as annmodel -from pypy.tool.cache import Cache -from pypy.annotation.model import SomeObject -from pypy.tool.udir import udir -from pypy.tool.ansi_print import ansi_print - - -# XXX this tries to make compiling faster -from pypy.translator.tool import buildpyxmodule -buildpyxmodule.enable_fast_compilation() - - - - -# __________ Main __________ - -def analyse(target): - global t, entry_point - - entry_point, inputtypes = target() - - t = Translator(entry_point, verbose=True, simplifying=True) - if listen_port: - run_async_server() - if not options['-no-a']: - try: - a = t.annotate(inputtypes, overrides=pypy_overrides) - finally: - worstblocks_topten(t.annotator) - if not options['-no-s']: - a.simplify() - if not options['-no-t']: - a.specialize() - t.frozen = True # cannot freeze if we don't have annotations - if not options['-no-mark-some-objects']: - options['-no-mark-some-objects'] = True # Do not do this again - find_someobjects(t) - - -def find_someobjects(translator, quiet=False): - """Find all functions in that have SomeObject in their signature.""" - annotator = translator.annotator - if not annotator: - return # no annotations available - - translator.highlight_functions = {} - - def is_someobject(var): - try: - return annotator.binding(var).__class__ == SomeObject - except KeyError: - return False - - def short_binding(var): - try: - binding = annotator.binding(var) - except KeyError: - return "?" - if binding.is_constant(): - return 'const %s' % binding.__class__.__name__ - else: - return binding.__class__.__name__ - - header = True - items = [(graph.name, func, graph) - for func, graph in translator.flowgraphs.items()] - items.sort() - num = someobjnum = 0 - for graphname, func, graph in items: - unknown_input_args = len(filter(is_someobject, graph.getargs())) - unknown_return_value = is_someobject(graph.getreturnvar()) - if unknown_input_args or unknown_return_value: - someobjnum += 1 - translator.highlight_functions[func] = True - if not quiet: - if header: - header = False - print "=" * 70 - print "Functions that have SomeObject in their signature" - print "=" * 70 - print ("%(name)s(%(args)s) -> %(result)s\n" - "%(filename)s:%(lineno)s\n" - % {'name': graph.name, - 'filename': func.func_globals.get('__name__', '?'), - 'lineno': func.func_code.co_firstlineno, - 'args': ', '.join(map(short_binding, - graph.getargs())), - 'result': short_binding(graph.getreturnvar())}) - num += 1 - if not quiet: - print "=" * 70 - percent = int(num and (100.0*someobjnum / num) or 0) - print "someobjectness: %2d percent" % (percent) - print "(%d out of %d functions get or return SomeObjects" % ( - someobjnum, num) - print "=" * 70 - - -def update_usession_dir(stabledir = udir.dirpath('usession')): - from py import path - try: - if stabledir.check(dir=1): - for x in udir.visit(path.checker(file=1)): - target = stabledir.join(x.relto(udir)) - if target.check(): - target.remove() - else: - target.dirpath().ensure(dir=1) - try: - target.mklinkto(x) - except path.Invalid: - x.copy(target) - except path.Invalid: - print "ignored: couldn't link or copy to %s" % stabledir - -def run_in_thread(fn, args, cleanup=None, cleanup_args=()): - def _run_in_thread(): - fn(*args) - if cleanup is not None: - cleanup(*cleanup_args) - return threading.Thread(target=_run_in_thread, args=()) - -def run_async_server(): - from pypy.translator.tool import graphpage, graphserver - homepage = graphpage.TranslatorPage(t) - graphserver.run_server(homepage, port=listen_port, background=True) - options['-text'] = True - -def worstblocks_topten(ann, n=10): - h = [(count, block) for block, count in ann.reflowcounter.iteritems()] - h.sort() - print - ansi_print(',----------------------- Top %d Most Reflown Blocks -----------------------.' % n, 36) - for i in range(n): - if not h: - break - count, block = h.pop() - ansi_print(' #%3d: reflown %d times |' % (i+1, count), 36) - about(block) - ansi_print("`----------------------------------------------------------------------------'", 36) - print - - -if __name__ == '__main__': - - targetspec = 'targetpypy' - huge = 100 - - options = {'-text': False, - '-no-c': False, - '-c': False, - '-o': False, - '-no-mark-some-objects': False, - '-no-a': False, - '-no-s': False, - '-no-t': False, - '-tcc': False, - '-no-d': False, - } - listen_port = None - for arg in sys.argv[1:]: - if arg in ('-h', '--help'): - print __doc__.strip() - sys.exit() - try: - listen_port = int(arg) - except ValueError: - if os.path.isfile(arg+'.py'): - assert not os.path.isfile(arg), ( - "ambiguous file naming, please rename %s" % arg) - targetspec = arg - elif os.path.isfile(arg) and arg.endswith('.py'): - targetspec = arg[:-3] - elif arg.startswith('-huge='): - huge = int(arg[6:]) - else: - assert arg in options, "unknown option %r" % (arg,) - options[arg] = True - if options['-tcc']: - os.environ['PYPY_CC'] = 'tcc -shared -o "%s.so" "%s.c"' - if options['-no-d']: - annmodel.DEBUG = False - - def about(x): - """ interactive debugging helper """ - from pypy.objspace.flow.model import Block, flatten - if isinstance(x, Block): - for func, graph in t.flowgraphs.items(): - if x in flatten(graph): - funcname = func.func_name - cls = getattr(func, 'class_', None) - if cls: - funcname = '%s.%s' % (cls.__name__, funcname) - print '%s is a %s in the graph of %s' % (x, - x.__class__.__name__, funcname) - print 'at %s:%d' % (func.func_globals.get('__name__', '?'), - func.func_code.co_firstlineno) - break - else: - print '%s is a %s at some unknown location' % (x, - x.__class__.__name__) - print 'containing the following operations:' - for op in x.operations: - print op - print '--end--' - return - print "don't know about", x - - def run_server(): - from pypy.translator.tool import graphpage - from pypy.translator.tool.pygame.graphclient import get_layout - from pypy.translator.tool.pygame.graphdisplay import GraphDisplay - import pygame - - if not options['-no-mark-some-objects']: - find_someobjects(t, quiet=True) - - if len(t.functions) <= huge: - page = graphpage.TranslatorPage(t) - else: - page = graphpage.LocalizedCallGraphPage(t, entry_point) - - display = GraphDisplay(get_layout(page)) - async_quit = display.async_quit - def show(page): - display.async_cmd(layout=get_layout(page)) - return display.run, show, async_quit, pygame.quit - - class PdbPlusShow(pdb.Pdb): - - def post_mortem(self, t): - self.reset() - while t.tb_next is not None: - t = t.tb_next - self.interaction(t.tb_frame, t) - - show = None - - def _show(self, page): - if not self.show: - print "*** No display" - return - self.show(page) - - def _importobj(self, fullname): - obj = None - name = '' - for comp in fullname.split('.'): - name += comp - obj = getattr(obj, comp, None) - if obj is None: - try: - obj = __import__(name, {}, {}, ['*']) - except ImportError: - raise NameError - name += '.' - return obj - - TRYPREFIXES = ['','pypy.','pypy.objspace.','pypy.interpreter.', 'pypy.objspace.std.' ] - - def _getobj(self, name): - if '.' in name: - for pfx in self.TRYPREFIXES: - try: - return self._importobj(pfx+name) - except NameError: - pass - try: - return self._getval(name) - except (NameError, AttributeError, LookupError): - print "*** Not found:", name - return None - - def do_showg(self, arg): - """showg obj -show graph for obj, obj can be an expression or a dotted name -(in which case prefixing with some packages in pypy is tried (see help pypyprefixes)). -if obj is a function or method, the localized call graph is shown; -if obj is a class or ClassDef the class definition graph is shown""" - from pypy.annotation.classdef import ClassDef - from pypy.translator.tool import graphpage - obj = self._getobj(arg) - if obj is None: - return - if hasattr(obj, 'im_func'): - obj = obj.im_func - if obj in t.flowgraphs: - page = graphpage.LocalizedCallGraphPage(t, obj) - elif obj in getattr(t.annotator, 'getuserclasses', lambda: {})(): - page = graphpage.ClassDefPage(t, t.annotator.getuserclasses()[obj]) - elif isinstance(obj, ClassDef): - page = graphpage.ClassDefPage(t, obj) - else: - print "*** Nothing to do" - return - self._show(page) - - def do_flowg(self, arg): - """callg obj -show flow graph for function obj, obj can be an expression or a dotted name -(in which case prefixing with some packages in pypy is tried (see help pypyprefixes))""" - import types - from pypy.translator.tool import graphpage - obj = self._getobj(arg) - if obj is None: - return - if hasattr(obj, 'im_func'): - obj = obj.im_func - if not isinstance(obj, types.FunctionType): - print "*** Not a function" - return - self._show(graphpage.FlowGraphPage(t, [obj])) - - def do_callg(self, arg): - """callg obj -show localized call-graph for function obj, obj can be an expression or a dotted name -(in which case prefixing with some packages in pypy is tried (see help pypyprefixes))""" - import types - from pypy.translator.tool import graphpage - obj = self._getobj(arg) - if obj is None: - return - if hasattr(obj, 'im_func'): - obj = obj.im_func - if not isinstance(obj, types.FunctionType): - print "*** Not a function" - return - self._show(graphpage.LocalizedCallGraphPage(t, obj)) - - def do_classhier(self, arg): - """classhier -show class hierarchy graph""" - from pypy.translator.tool import graphpage - self._show(graphpage.ClassHierarchyPage(t)) - - def help_graphs(self): - print "graph commands are: showg, flowg, callg, classhier" - - def help_pypyprefixes(self): - print "these prefixes are tried for dotted names in graph commands:" - print self.TRYPREFIXES - - def debug(got_error): - pdb_plus_show = PdbPlusShow() - - if got_error: - import traceback - exc, val, tb = sys.exc_info() - print >> sys.stderr - traceback.print_exception(exc, val, tb) - print >> sys.stderr - - block = getattr(val, '__annotator_block', None) - if block: - print '-'*60 - about(block) - print '-'*60 - - print >> sys.stderr - func, args = pdb_plus_show.post_mortem, (tb,) - else: - print '-'*60 - print 'Done.' - print - func, args = pdb_plus_show.set_trace, () - if options['-text']: - func(*args) - else: - start, show, stop, cleanup = run_server() - pdb_plus_show.show = show - debugger = run_in_thread(func, args, stop) - debugger.start() - start() - debugger.join() - cleanup() - - try: - targetspec_dic = {} - sys.path.insert(0, os.path.dirname(targetspec)) - execfile(targetspec+'.py',targetspec_dic) - print "Analysing target as defined by %s" % targetspec - analyse(targetspec_dic['target']) - print '-'*60 - if options['-no-c']: - print 'Not generating C code.' - elif options['-c']: - print 'Generating C code without compiling it...' - filename = t.ccompile(really_compile=False) - update_usession_dir() - print 'Written %s.' % (filename,) - else: - print 'Generating and compiling C code...' - c_entry_point = t.ccompile() - update_usession_dir() - if not options['-o']: - print 'Running!' - targetspec_dic['run'](c_entry_point) - except: - debug(True) - else: - debug(False) - Copied: pypy/dist/pypy/bin/py.py (from r12444, pypy/dist/pypy/interpreter/py.py) ============================================================================== --- pypy/dist/pypy/interpreter/py.py (original) +++ pypy/dist/pypy/bin/py.py Wed May 18 19:15:26 2005 @@ -1,5 +1,11 @@ #!/usr/bin/env python +"""Main entry point into the PyPy interpreter. For a list of options, type + + py.py --help + +""" + try: import autopath except ImportError: Copied: pypy/dist/pypy/bin/translator.py (from r12451, pypy/dist/pypy/translator/translator.py) ============================================================================== --- pypy/dist/pypy/translator/translator.py (original) +++ pypy/dist/pypy/bin/translator.py Wed May 18 19:15:26 2005 @@ -1,9 +1,9 @@ +#!/usr/bin/env python + """PyPy Translator Frontend Glue script putting together the various pieces of the translator. -Can be used for interactive testing of the translator. Run as: - - python -i translator.py +Can be used for interactive testing of the translator. Example: @@ -32,294 +32,11 @@ """ import autopath, os, sys - -from pypy.objspace.flow.model import * -from pypy.annotation.model import * -from pypy.translator.annrpython import RPythonAnnotator -from pypy.translator.simplify import simplify_graph -from pypy.translator.genpyrex import GenPyrex -from pypy.translator.gencl import GenCL -from pypy.translator.genc.genc import GenC -from pypy.translator.gensupp import uniquemodulename -from pypy.translator.tool.buildpyxmodule import make_module_from_pyxstring -from pypy.translator.tool.buildpyxmodule import make_module_from_c -from pypy.objspace.flow import FlowObjSpace - - -class Translator: - - def __init__(self, func=None, verbose=False, simplifying=True, - builtins_can_raise_exceptions=False, - do_imports_immediately=True): - self.entrypoint = func - self.verbose = verbose - self.simplifying = simplifying - self.builtins_can_raise_exceptions = builtins_can_raise_exceptions - self.do_imports_immediately = do_imports_immediately - self.clear() - - def clear(self): - """Clear all annotations and all flow graphs.""" - self.annotator = None - self.flowgraphs = {} # {function: graph} - self.functions = [] # the keys of self.flowgraphs, in creation order - self.callgraph = {} # {opaque_tag: (caller, callee)} - self.frozen = False # when frozen, no more flowgraphs can be generated - self.concretetypes = {} # see getconcretetype() - self.ctlist = [] # " - if self.entrypoint: - self.getflowgraph() - - def getflowgraph(self, func=None, called_by=None, call_tag=None): - """Get the flow graph for a function (default: the entry point).""" - func = func or self.entrypoint - try: - graph = self.flowgraphs[func] - except KeyError: - if self.verbose: - print 'getflowgraph (%s:%d) %s' % ( - func.func_globals.get('__name__', '?'), - func.func_code.co_firstlineno, - func.__name__), - sys.stdout.flush() - assert not self.frozen - space = FlowObjSpace() - space.builtins_can_raise_exceptions = self.builtins_can_raise_exceptions - space.do_imports_immediately = self.do_imports_immediately - graph = space.build_flow(func) - if self.simplifying: - simplify_graph(graph, self.simplifying) - if self.verbose: - print - self.flowgraphs[func] = graph - self.functions.append(func) - try: - import inspect - graph.func = func - graph.source = inspect.getsource(func) - except IOError: - pass # e.g. when func is defined interactively - if called_by: - self.callgraph[called_by, func, call_tag] = called_by, func - return graph - - def gv(self, func=None): - """Shows the control flow graph for a function (default: all) - -- requires 'dot' and 'gv'.""" - import os - from pypy.translator.tool.make_dot import make_dot, make_dot_graphs - if func is None: - # show the graph of *all* functions at the same time - graphs = [] - for func in self.functions: - graph = self.getflowgraph(func) - graphs.append((graph.name, graph)) - dest = make_dot_graphs(self.entrypoint.__name__, graphs) - else: - graph = self.getflowgraph(func) - dest = make_dot(graph.name, graph) - os.system('gv %s' % str(dest)) - - def view(self, *functions): - """Shows the control flow graph with annotations if computed. - Requires 'dot' and pygame.""" - from pypy.translator.tool.graphpage import FlowGraphPage - FlowGraphPage(self).display() - - def viewcg(self): - """Shows the whole call graph and the class hierarchy, based on - the computed annotations.""" - from pypy.translator.tool.graphpage import TranslatorPage - TranslatorPage(self).display() - - def simplify(self, func=None, passes=True): - """Simplifies the control flow graph (default: for all functions).""" - if func is None: - for func in self.flowgraphs.keys(): - self.simplify(func) - else: - graph = self.getflowgraph(func) - simplify_graph(graph, passes) - - def annotate(self, input_args_types, func=None, overrides={}): - """annotate(self, input_arg_types[, func]) -> Annotator - - Provides type information of arguments. Returns annotator. - """ - func = func or self.entrypoint - if self.annotator is None: - self.annotator = RPythonAnnotator(self, overrides=overrides) - graph = self.getflowgraph(func) - self.annotator.build_types(graph, input_args_types, func) - return self.annotator - - def checkgraphs(self): - for graph in self.flowgraphs.itervalues(): - checkgraph(graph) - - def source(self, func=None): - """Returns original Python source. - - Returns for functions written while the - interactive session. - """ - func = func or self.entrypoint - graph = self.getflowgraph(func) - return getattr(graph, 'source', '') - - def pyrex(self, input_arg_types=None, func=None): - """pyrex(self[, input_arg_types][, func]) -> Pyrex translation - - Returns Pyrex translation. If input_arg_types is provided, - returns type annotated translation. Subsequent calls are - not affected by this. - """ - return self.generatecode(GenPyrex, input_arg_types, func) - - def cl(self, input_arg_types=None, func=None): - """cl(self[, input_arg_types][, func]) -> Common Lisp translation - - Returns Common Lisp translation. If input_arg_types is provided, - returns type annotated translation. Subsequent calls are - not affected by this. - """ - return self.generatecode(GenCL, input_arg_types, func) - - def c(self): - """c(self) -> C (CPython) translation - - Returns C (CPython) translation. - """ - from StringIO import StringIO - out = StringIO() - genc = GenC(out, self) - return out.getvalue() - - def llvm(self): - """llvm(self) -> LLVM translation - - Returns LLVM translation. - """ - from pypy.translator.llvm import genllvm - if self.annotator is None: - raise genllvm.CompileError, "function has to be annotated." - gen = genllvm.LLVMGenerator(self) - return str(gen) - - def generatecode(self, gencls, input_arg_types, func): - if input_arg_types is None: - ann = self.annotator - else: - ann = RPythonAnnotator(self) - if func is None: - codes = [self.generatecode1(gencls, input_arg_types, - self.entrypoint, ann)] - for func in self.functions: - if func is not self.entrypoint: - code = self.generatecode1(gencls, None, func, ann, - public=False) - codes.append(code) - else: - codes = [self.generatecode1(gencls, input_arg_types, func, ann)] - code = self.generateglobaldecl(gencls, func, ann) - if code: - codes.insert(0, code) - return '\n\n#_________________\n\n'.join(codes) - - def generatecode1(self, gencls, input_arg_types, func, ann, public=True): - graph = self.getflowgraph(func) - g = gencls(graph) - g.by_the_way_the_function_was = func # XXX - if input_arg_types is not None: - ann.build_types(graph, input_arg_types, func) - if ann is not None: - g.setannotator(ann) - return g.emitcode(public) - - def generateglobaldecl(self, gencls, func, ann): - graph = self.getflowgraph(func) - g = gencls(graph) - if ann is not None: - g.setannotator(ann) - return g.globaldeclarations() - - def compile(self): - """Returns compiled function, compiled using Pyrex. - """ - from pypy.tool.udir import udir - name = self.entrypoint.func_name - pyxcode = self.pyrex() - mod = make_module_from_pyxstring(name, udir, pyxcode) - return getattr(mod, name) - - def ccompile(self, really_compile=True): - """Returns compiled function, compiled using the C generator. - """ - from pypy.tool.udir import udir - if self.annotator is not None: - self.frozen = True - name = uniquemodulename(self.entrypoint.func_name) - cfile = udir.join('%s.c' % name) - f = cfile.open('w') - f2 = udir.join('%s-init.py' % name).open('w+') - GenC(f, self, name, f2=f2) - f2.close() - f.close() - if not really_compile: - return cfile - mod = make_module_from_c(cfile, - include_dirs=[os.path.join(autopath.this_dir, 'genc')]) - self.concretetypes.clear() - return getattr(mod, self.entrypoint.func_name) - - def llvmcompile(self, optimize=True): - """llvmcompile(self, optimize=True) -> LLVM translation - - Returns LLVM translation with or without optimization. - """ - from pypy.translator.llvm import genllvm - if self.annotator is None: - raise genllvm.CompileError, "function has to be annotated." - gen = genllvm.LLVMGenerator(self) - return gen.compile(optimize) - - def call(self, *args): - """Calls underlying Python function.""" - return self.entrypoint(*args) - - def dis(self, func=None): - """Disassembles underlying Python function to bytecodes.""" - from dis import dis - dis(func or self.entrypoint) - -## def consider_call(self, ann, func, args): -## graph = self.getflowgraph(func) -## ann.addpendingblock(graph.startblock, args) -## result_var = graph.getreturnvar() -## try: -## return ann.binding(result_var) -## except KeyError: -## # typical case for the 1st call, because addpendingblock() did -## # not actually start the analysis of the called function yet. -## return impossiblevalue - - def getconcretetype(self, cls, *args): - "DEPRECATED. To be removed" - # Return a (cached) 'concrete type' object attached to this translator. - # Concrete types are what is put in the 'concretetype' attribute of - # the Variables and Constants of the flow graphs by typer.py to guide - # the code generators. - try: - return self.concretetypes[cls, args] - except KeyError: - result = self.concretetypes[cls, args] = cls(self, *args) - self.ctlist.append(result) - return result +from pypy.translator.translator import Translator if __name__ == '__main__': from pypy.translator.test import snippet as test - import sys if (os.getcwd() not in sys.path and os.path.curdir not in sys.path): sys.path.insert(0, os.getcwd()) Modified: pypy/dist/pypy/documentation/objspace.txt ============================================================================== --- pypy/dist/pypy/documentation/objspace.txt (original) +++ pypy/dist/pypy/documentation/objspace.txt Wed May 18 19:15:26 2005 @@ -213,7 +213,7 @@ Example usage:: - $ python interpreter/py.py -o thunk + $ py.py -o thunk >>>> def f(): ... print 'computing...' ... return 6*7 Deleted: /pypy/dist/pypy/interpreter/py.py ============================================================================== --- /pypy/dist/pypy/interpreter/py.py Wed May 18 19:15:26 2005 +++ (empty file) @@ -1,183 +0,0 @@ -#!/usr/bin/env python - -try: - import autopath -except ImportError: - pass - -from pypy.tool.getpy import py -#py.magic.invoke(compile=1) - -from pypy.tool import option -from pypy.tool.optik import make_option -from pypy.interpreter import main, interactive, error -import os, sys -import time - -class Options(option.Options): - verbose = os.getenv('PYPY_TB') - interactive = 0 - command = [] - completer = False - -def get_main_options(): - options = option.get_standard_options() - - options.append(make_option( - '-v', action='store_true', dest='verbose', - help='show verbose interpreter-level traceback')) - - options.append(make_option( - '-C', action='store_true', dest='completer', - help='use readline commandline completer')) - - options.append(make_option( - '-i', action="store_true", dest="interactive", - help="inspect interactively after running script")) - - options.append(make_option( - '-O', action="store_true", dest="optimize", - help="dummy optimization flag for compatibility with C Python")) - - def command_callback(option, opt, value, parser): - parser.values.command = parser.rargs[:] - parser.rargs[:] = [] - - options.append(make_option( - '-c', action="callback", - callback=command_callback, - help="program passed in as CMD (terminates option list)")) - - return options - -def main_(argv=None): - starttime = time.time() - args = option.process_options(get_main_options(), Options, argv[1:]) - if Options.verbose: - error.RECORD_INTERPLEVEL_TRACEBACK = True - - # create the object space - space = option.objspace() - space._starttime = starttime - assert 'pypy.tool.udir' not in sys.modules, ( - "running py.py should not import pypy.tool.udir, which is\n" - "only for testing or translating purposes.") - space.setitem(space.sys.w_dict,space.wrap('executable'),space.wrap(argv[0])) - - # store the command-line arguments into sys.argv - go_interactive = Options.interactive - banner = '' - exit_status = 0 - if Options.command: - args = ['-c'] + Options.command[1:] - for arg in args: - space.call_method(space.sys.get('argv'), 'append', space.wrap(arg)) - - # load the source of the program given as command-line argument - if Options.command: - def doit(): - main.run_string(Options.command[0], space=space) - elif args: - def doit(): - main.run_file(args[0], space=space) - else: - def doit(): - pass - space.call_method(space.sys.get('argv'), 'append', space.wrap('')) - go_interactive = 1 - banner = None - - try: - # compile and run it - if not main.run_toplevel(space, doit, verbose=Options.verbose): - exit_status = 1 - - # start the interactive console - if go_interactive: - con = interactive.PyPyConsole(space, verbose=Options.verbose, - completer=Options.completer) - if banner == '': - banner = '%s / %s'%(con.__class__.__name__, - repr(space)) - con.interact(banner) - exit_status = 0 - finally: - # call the sys.exitfunc() - w_exitfunc = space.sys.getdictvalue(space, 'exitfunc') - if w_exitfunc is not None: - def doit(): - space.call_function(w_exitfunc) - main.run_toplevel(space, doit, verbose=Options.verbose) - - return exit_status - -##def main_(argv=None): -## starttime = time.time() -## from pypy.tool import tb_server -## args = option.process_options(get_main_options(), Options, argv[1:]) -## space = None -## exit_status = 1 # until proven otherwise -## # XXX should review what CPython's policy is for -## # the exit status code -## try: -## space = option.objspace() -## space._starttime = starttime -## assert 'pypy.tool.udir' not in sys.modules, ( -## "running py.py should not import pypy.tool.udir, which is\n" -## "only for testing or translating purposes.") -## go_interactive = Options.interactive -## if Options.verbose: -## error.RECORD_INTERPLEVEL_TRACEBACK = True -## banner = '' -## space.setitem(space.sys.w_dict,space.wrap('executable'),space.wrap(argv[0])) -## if Options.command: -## args = ['-c'] + Options.command[1:] -## for arg in args: -## space.call_method(space.sys.get('argv'), 'append', space.wrap(arg)) -## try: -## if Options.command: -## main.run_string(Options.command[0], '', space) -## elif args: -## main.run_file(args[0], space) -## else: -## space.call_method(space.sys.get('argv'), 'append', space.wrap('')) -## go_interactive = 1 -## banner = None -## exit_status = 0 -## except error.OperationError, operationerr: -## if Options.verbose: -## operationerr.print_detailed_traceback(space) -## else: -## operationerr.print_application_traceback(space) -## if go_interactive: -## con = interactive.PyPyConsole(space, verbose=Options.verbose, completer=Options.completer) -## if banner == '': -## banner = '%s / %s'%(con.__class__.__name__, -## repr(space)) -## con.interact(banner) -## except: -## exc_type, value, tb = sys.exc_info() -## sys.last_type = exc_type -## sys.last_value = value -## sys.last_traceback = tb -## if issubclass(exc_type, SystemExit): -## pass # don't print tracebacks for SystemExit -## elif isinstance(value, error.OperationError): -## value.print_detailed_traceback(space=space) -## else: -## sys.excepthook(exc_type, value, tb) -## tb_server.wait_until_interrupt() -## exit_status = 1 - -## tb_server.stop() -## return exit_status - -if __name__ == '__main__': - try: - import readline - except: - pass - if hasattr(sys, 'setrecursionlimit'): - # for running "python -i py.py -Si -- py.py -Si" - sys.setrecursionlimit(3000) - sys.exit(main_(sys.argv)) Modified: pypy/dist/pypy/interpreter/test/test_py.py ============================================================================== --- pypy/dist/pypy/interpreter/test/test_py.py (original) +++ pypy/dist/pypy/interpreter/test/test_py.py Wed May 18 19:15:26 2005 @@ -1,10 +1,10 @@ -import pypy.interpreter.py +import autopath from pypy.tool.udir import udir import py import sys -pypypath = str(py.path.local(pypy.interpreter.py.__file__).new(basename='py.py')) +pypypath = str(py.path.local(autopath.pypydir).join('bin', 'py.py')) def test_executable(): """Ensures sys.executable points to the py.py script""" Modified: pypy/dist/pypy/objspace/thunk.py ============================================================================== --- pypy/dist/pypy/objspace/thunk.py (original) +++ pypy/dist/pypy/objspace/thunk.py Wed May 18 19:15:26 2005 @@ -1,6 +1,6 @@ """Example usage: - $ python interpreter/py.py -o thunk + $ py.py -o thunk >>> def f(): ... print 'computing...' ... return 6*7 Deleted: /pypy/dist/goal/buildcache.py ============================================================================== --- /pypy/dist/goal/buildcache.py Wed May 18 19:15:26 2005 +++ (empty file) @@ -1,56 +0,0 @@ -from pypy.tool import option, autopath, testit -from pypy.interpreter import gateway -import os - -####################################################### -def app_triggerall(): - import sys, types # , exceptions - k = 42 - def gen(): - yield k - #yield (k, 1.0, 4L, [''], {}, unicode, Ellipsis) - try: - raise ValueError - except ValueError: - x = sys.exc_info() - try: - raise x[0], x[1], x[2] - except ValueError: - pass - - #gen.func_code.co_name - str({'co_name': ('f',)}), str(object.__init__.im_func.func_code) - #"for %r" % ({'x': gen}) - "%02d %04f %05g %05s <%s> %r" % (1, 2.25, 2.25, 2.25, [1,2], {'x': gen}) - for x in gen(): - pass - -def app_triggerexec(): - exec "i=3" - -gateway.importall(globals()) # app_xxx() -> xxx() - -####################################################### -from pypy.objspace.std import stdtypedef - -def buildcache(space): - print "triggering cache build for %r" % space - triggerall(space) - triggerexec(space) - #testit.main(os.path.join(autopath.pypydir, 'objspace', 'std')) - #Cache.freeze() - #space._typecache = frozendict(space._typecache) - #space._faketypecache = frozendict(space._faketypecache) - #space._gatewaycache = frozendict(space._gatewaycache) - #space = option.objspace('std') - #buildcache(space) - #for x in stdtypedef._temp: - # x.cache_table = frozendict(x.cache_table) - print "cache build finished, caches are 'frozen' now" - -if __name__ == '__main__': - space = option.objspace('std') - buildcache(space) - #testit.main(autopath.pypydir) - - testit.main(os.path.join(autopath.pypydir)) # , 'objspace', 'std')) Deleted: /pypy/dist/goal/compiler-hack.py ============================================================================== --- /pypy/dist/goal/compiler-hack.py Wed May 18 19:15:26 2005 +++ (empty file) @@ -1,6 +0,0 @@ -import compiler -c = compiler.compile('a=1', '', 'exec') -import dis -dis.dis(c) -exec c -print a Deleted: /pypy/dist/goal/dis-goal.py ============================================================================== --- /pypy/dist/goal/dis-goal.py Wed May 18 19:15:26 2005 +++ (empty file) @@ -1,2 +0,0 @@ -import dis -dis.dis(dis.dis) Deleted: /pypy/dist/goal/dis-pregoal.py ============================================================================== --- /pypy/dist/goal/dis-pregoal.py Wed May 18 19:15:26 2005 +++ (empty file) @@ -1,2 +0,0 @@ -import dis -dis.disassemble(dis.dis.func_code) Deleted: /pypy/dist/goal/foodbill.py ============================================================================== --- /pypy/dist/goal/foodbill.py Wed May 18 19:15:26 2005 +++ (empty file) @@ -1,54 +0,0 @@ -slips=[(1, 'Kals MatMarkn', 6150, 'Chutney for Curry', 'dinner Saturday'), - (2, 'Kals MatMarkn', 32000, 'Spaghetti, Beer', 'dinner Monday'), - (2, 'Kals MatMarkn', -810, 'Deposit on Beer Bottles', 'various'), - (3, 'Fram', 7700, 'Rice and Curry Spice', 'dinner Saturday'), - (4, 'Kals MatMarkn', 25000, 'Alcohol-Free Beer, sundries', 'various'), - (4, 'Kals MatMarkn', -1570, "Michael's toothpaste", 'none'), - (4, 'Kals MatMarkn', -1690, "Laura's toothpaste", 'none'), - (4, 'Kals MatMarkn', -720, 'Deposit on Beer Bottles', 'various'), - (4, 'Kals MatMarkn', -60, 'Deposit on another Beer Bottle', 'various'), - (5, 'Kals MatMarkn', 26750, 'lunch bread meat cheese', 'lunch Monday'), - (6, 'Kals MatMarkn', 15950, 'various', 'dinner Tuesday and Thursday'), - (7, 'Kals MatMarkn', 3650, 'Drottningsylt, etc.', 'dinner Thursday'), - (8, 'Kals MatMarkn', 26150, 'Chicken and Mushroom Sauce', 'dinner Wed'), - (8, 'Kals MatMarkn', -2490, 'Jacob and Laura -- juice', 'dinner Wed'), - (8, 'Kals MatMarkn', -2990, "Chicken we didn't cook", 'dinner Wednesday'), - (9, 'Kals MatMarkn', 1380, 'fruit for Curry', 'dinner Saturday'), - (9, 'Kals MatMarkn', 1380, 'fruit for Curry', 'dinner Saturday'), - (10, 'Kals MatMarkn', 26900, 'Jansons Frestelse', 'dinner Sunday'), - (10, 'Kals MatMarkn', -540, 'Deposit on Beer Bottles', 'dinner Sunday'), - (11, 'Kals MatMarkn', 22650, 'lunch bread meat cheese', 'lunch Thursday'), - (11, 'Kals MatMarkn', -2190, 'Jacob and Laura -- juice', 'lunch Thursday'), - (11, 'Kals MatMarkn', -2790, 'Jacob and Laura -- cereal', 'lunch Thurs'), - (11, 'Kals MatMarkn', -760, 'Jacob and Laura -- milk', 'lunch Thursday'), - (12, 'Kals MatMarkn', 18850, 'lunch bread meat cheese', 'lunch Friday'), - (13, 'Kals MatMarkn', 18850, 'lunch bread meat cheese', 'guestimate Sun'), - (14, 'Kals MatMarkn', 18850, 'lunch bread meat cheese', 'guestimate Tues'), - (15, 'Kals MatMarkn', 20000, 'lunch bread meat cheese', 'guestimate Wed'), - (16, 'Kals MatMarkn', 42050, 'grillfest', 'dinner Friday'), - (16, 'Kals MatMarkn', -1350, 'Deposit on Beer Bottles', 'dinner Friday'), - (17, 'System Bolaget', 15500, 'Cederlunds Caloric', 'dinner Thursday'), - (17, 'System Bolaget', 22400, '4 x Farnese Sangiovese 56SEK', 'various'), - (17, 'System Bolaget', 22400, '4 x Farnese Sangiovese 56SEK', 'various'), - (17, 'System Bolaget', 13800, '2 x Jacobs Creek 69SEK', 'various'), - (18, 'J and Ls winecabinet', 10800, '2 x Parrotes 54SEK', 'various'), - (18, 'J and Ls winecabinet', 14700, '3 x Saint Paulin 49SEK', 'various'), - (18, 'J and Ls winecabinet', 10400, '2 x Farnese Sangioves 52SEK', - 'cheaper when we bought it'), - (18, 'J and Ls winecabinet', 17800, '2 x Le Poiane 89SEK', 'various'), - (18, 'J and Ls winecabinet', 9800, '2 x Something Else 49SEK', 'various'), - (19, 'Konsum', 26000, 'Saturday Bread and Fruit', 'Slip MISSING'), - (20, 'Konsum', 15245, 'Mooseburgers', 'found slip'), - (21, 'Kals MatMarkn', 20650, 'Grilling', 'Friday dinner'), - (22, 'J and Ls freezer', 21000, 'Meat for Curry, grilling', ''), - (22, 'J and Ls cupboard', 3000, 'Rice', ''), - (22, 'J and Ls cupboard', 4000, 'Charcoal', ''), - (23, 'Fram', 2975, 'Potatoes', '3.5 kg @ 8.50SEK'), - (23, 'Fram', 1421, 'Peas', 'Thursday dinner'), - (24, 'Kals MatMarkn', 20650, 'Grilling', 'Friday dinner'), - (24, 'Kals MatMarkn', -2990, 'TP', 'None'), - (24, 'Kals MatMarkn', -2320, 'T-Gul', 'None') - ] - -print [t[2] for t in slips] -print (reduce(lambda x, y: x+y, [t[2] for t in slips], 0))/900 Deleted: /pypy/dist/goal/gadfly-demo.py ============================================================================== --- /pypy/dist/goal/gadfly-demo.py Wed May 18 19:15:26 2005 +++ (empty file) @@ -1,23 +0,0 @@ -import os -os.mkdir('db') - -import gadfly -connection = gadfly.gadfly() -connection.startup('test', 'db') -cursor = connection.cursor() - -def print_and_execute(cursor, operation): - print operation - cursor.execute(operation) - -print_and_execute(cursor, "CREATE TABLE pypy(py varchar)") -print_and_execute(cursor, "INSERT INTO pypy(py) VALUES ('py')") -print_and_execute(cursor, "SELECT * FROM pypy") -for row in cursor.fetchall(): - print row - -connection.commit() -connection.close() - -import shutil -shutil.rmtree('db') Deleted: /pypy/dist/goal/hello_world.py ============================================================================== --- /pypy/dist/goal/hello_world.py Wed May 18 19:15:26 2005 +++ (empty file) @@ -1,2 +0,0 @@ -aStr = 'hello world' -print len(aStr) Deleted: /pypy/dist/goal/http-and-html.py ============================================================================== --- /pypy/dist/goal/http-and-html.py Wed May 18 19:15:26 2005 +++ (empty file) @@ -1,9 +0,0 @@ -url = 'http://www.python.org/' -html = 'python.html' -import urllib -content = urllib.urlopen(url).read() -file(html, 'w').write(content) -import htmllib -htmllib.test([html]) -import os -os.remove(html) Deleted: /pypy/dist/goal/objectspace-reconstruct.py ============================================================================== --- /pypy/dist/goal/objectspace-reconstruct.py Wed May 18 19:15:26 2005 +++ (empty file) @@ -1,163 +0,0 @@ - -def __getattribute__(w_obj,w_name): - name = space.unwrap(w_name) - w_descr = space.lookup(w_obj, name) - if w_descr is not None: - if space.is_data_descr(w_descr): - return space.get(w_descr,w_obj,space.type(w_obj)) - w_dict = space.getdict(w_obj) - if w_dict is not None: - try: - return space.getitem(w_dict,w_name) - except OperationError, e: - if not e.match(space,space.w_KeyError): - raise - if w_descr is not None: - return space.get(w_descr,w_obj,space.wrap(type)) - raise OperationError(space.w_AttributeError,w_name) - -def space.getattr(w_obj,w_name): - w_descr = space.lookup(w_obj, '__getattribute__') - try: - return space.get_and_call_function(w_descr, w_obj, w_name) - except: # AttributeError - w_descr = space.lookup(w_obj, '__getattr__') - if w_descr is None: - raise - return space.get_and_call_function(w_descr, w_obj, w_name) - -def space.get(w_obj,w_name): - w_descr = space.lookup(w_obj, '__get__') - if w_descr is not None: - return space.get_and_call(w_descr, w_obj, space.newtuple([w_name])) - else: - return w_obj - -def space.call(w_obj, w_args, w_kwargs): - w_descr = space.lookup(w_obj, '__call__') - if w_descr is None: - raise OperationError(space.w_TypeError, space.wrap('...')) - return space.get_and_call(w_descr, w_obj, w_args, w_kwargs) - - -class BaseObjSpace: - def get_and_call(self, w_descr, w_obj, w_args, w_kwargs): - if isinstance(w_descr, W_Function): - args_w = space.unpacktuple(w_args) - return w_descr.func.call(space.newtuple([w_obj]+args_w),w_kwargs) - else: - w_bound = space.get(w_descr,w_obj,space.gettype(w_obj)) - return space.call(w_bound, w_args, w_kwargs) - -class Wrappable: - def __wrap__(self, space): - return self - -class Function(Wrappable): - TypeDef = Type("function", [], { - '__call__' : app_descr_function_call, - 'func_code' : Property(func_code_getter) - }) - -class BuiltinType: - def __init__(self, name, bases, rawdict): - self.name = name - self.bases = bases - self.rawdict = rawdict - self.mro = [] - -class W_Function: - def __init__(self, space, func): - self.func = func - self.space = space - - def gettype(self): - space = self.space - try: - return space.FunctionType - except AttributeError: - space.FunctionType = f = Type(space, [space.ObjectType]) - f.dict_w['__call__'] = space.wrap(app_descr_function_call) - func_code_property = Property(func_code_getter) - f.dict_w['func_code'] = space.wrap(func_code_property) - return f - -class StdObjectSpace: - def lookup(space, w_obj, name): - typ = space._gettype(w_obj) - return space.wrap(typ.lookup(name)) - - def type(space,w_obj): - return space.wrap(space._gettype(w_obj)) - - def _gettype - try: - return space._types[w_obj.__class__] - except KeyError: - typ = space.buildtype(w_obj.TypeDef) - space._types[w_obj.__class__] = typ - return typ - - def buildtype(space, typedef): - typ = Type(w_ - for name, value - - def wrap(space, obj): - - assert self.space == space - return W_Type(space, self) - -def trivspace.lookup(space, w_obj, name): - if isinstance(w_obj, Wrappable): - for basedef in w_obj.TypeDef.mro(): - if name in basedef.rawdict: - return space.wrap(basedef.rawdict[name]) - return None - else: - for cls in w_obj.__class__.__mro__: - if name in cls.__dict__: - return cls.__dict__[name] - return None - - -def func_code_getter(space,w_func): - return space.wrap(w_func.func.code) - -def object___class__(space,w_obj): - return space.type(w_obj) - -def descr_function_call(space, w_func, w_args, w_kwds): - return w_func.func.call(w_args, w_kwds) -app_descr_function_call = gateway.interp2app(descr_function_call) - - - - -class Property: - def __init__(self, fget, fset=None, fdel=None, doc=None): - self.fget = fget - self.fset = fset - self.fdel = fdel - self.doc = doc - def __wrap__(self, space): - return W_Property(space, self) - -class W_Property(...Wrapped): - def __init__(self, space, property): - self.space = space - self.property = property - def gettype(self): - space = self.space - try: - return space.PropertyType - except AttributeError: - space.PropertyType = t = Type(space, "builtin-property", []) - t.dict_w["__get__"] = space.wrap(app_descr_property_get) - return t - -def descr_property_get(space, w_property, w_obj, w_ignored): - return w_property.property.fget(space, w_obj) - -app_descr_property_get = gateway.interp2app(descr_property_get) - - Deleted: /pypy/dist/goal/pydoc-goal.py ============================================================================== --- /pypy/dist/goal/pydoc-goal.py Wed May 18 19:15:26 2005 +++ (empty file) @@ -1,2 +0,0 @@ -import pydoc -pydoc.help(pydoc) Deleted: /pypy/dist/goal/pydoc-pregoal.py ============================================================================== --- /pypy/dist/goal/pydoc-pregoal.py Wed May 18 19:15:26 2005 +++ (empty file) @@ -1 +0,0 @@ -import pydoc Deleted: /pypy/dist/goal/stringcomp.py ============================================================================== --- /pypy/dist/goal/stringcomp.py Wed May 18 19:15:26 2005 +++ (empty file) @@ -1,17 +0,0 @@ - -### a trivial program to test strings, lists, functions and methods ### - -def addstr(s1,s2): - return s1 + s2 - -str = "an interesting string" -str2 = 'another::string::xxx::y:aa' -str3 = addstr(str,str2) -arr = [] -for word in str.split(): - if word in str2.split('::'): - arr.append(word) -print ''.join(arr) -print "str + str2 = ", str3 - - Modified: pypy/dist/pypy/translator/goal/translate_pypy.py ============================================================================== --- pypy/dist/goal/translate_pypy.py (original) +++ pypy/dist/pypy/translator/goal/translate_pypy.py Wed May 18 19:15:26 2005 @@ -1,4 +1,4 @@ -# +#! /usr/bin/env python # # """ @@ -10,7 +10,7 @@ targetspec.py is a python file defining what is the translation target and setting things up for it, it should have a target function returning an entry_point ...; - defaults to targetpypy. The .py suffix is optional. + defaults to targetpypymain. The .py suffix is optional. -text Don't start the Pygame viewer -no-a Don't infer annotations, just translate everything -no-s Don't simplify the graph after annotation @@ -175,7 +175,7 @@ if __name__ == '__main__': - targetspec = 'targetpypy' + targetspec = 'targetpypymain' huge = 100 options = {'-text': False, Modified: pypy/dist/pypy/translator/translator.py ============================================================================== --- pypy/dist/pypy/translator/translator.py (original) +++ pypy/dist/pypy/translator/translator.py Wed May 18 19:15:26 2005 @@ -1,36 +1,9 @@ """PyPy Translator Frontend -Glue script putting together the various pieces of the translator. -Can be used for interactive testing of the translator. Run as: - - python -i translator.py - -Example: - - t = Translator(func) - t.view() # control flow graph - - print t.source() # original source - print t.c() # C translation - print t.cl() # common lisp translation - print t.llvm() # LLVM translation - - t.simplify() # flow graph simplification - a = t.annotate([int]) # pass the list of args types - a.simplify() # simplification by annotator - t.view() # graph + annotations under the mouse - - t.call(arg) # call original function - t.dis() # bytecode disassemble - - f = t.ccompile() # C compilation - f = t.llvmcompile() # LLVM compilation - assert f(arg) == t.call(arg) # sanity check - -Some functions are provided for the benefit of interactive testing. -Try dir(test) for list of current snippets. +The Translator is a glue class putting together the various pieces of the +translation-related code. It can be used for interactive testing of the +translator; see pypy/bin/translator.py. """ - import autopath, os, sys from pypy.objspace.flow.model import * @@ -315,16 +288,3 @@ result = self.concretetypes[cls, args] = cls(self, *args) self.ctlist.append(result) return result - - -if __name__ == '__main__': - from pypy.translator.test import snippet as test - import sys - if (os.getcwd() not in sys.path and - os.path.curdir not in sys.path): - sys.path.insert(0, os.getcwd()) - print __doc__ - - # 2.3 specific -- sanxiyn - import os - os.putenv("PYTHONINSPECT", "1") From arigo at codespeak.net Wed May 18 19:19:48 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Wed, 18 May 2005 19:19:48 +0200 (CEST) Subject: [pypy-svn] r12461 - pypy/dist/pypy/documentation Message-ID: <20050518171948.423C627BB2@code1.codespeak.net> Author: arigo Date: Wed May 18 19:19:48 2005 New Revision: 12461 Modified: pypy/dist/pypy/documentation/getting_started.txt Log: py.py is now in the bin/ subdirectory. Modified: pypy/dist/pypy/documentation/getting_started.txt ============================================================================== --- pypy/dist/pypy/documentation/getting_started.txt (original) +++ pypy/dist/pypy/documentation/getting_started.txt Wed May 18 19:19:48 2005 @@ -24,7 +24,7 @@ then change to the ``pypy-0.6`` directory and execute the following command line:: - python pypy/interpreter/py.py + python pypy/bin/py.py This will give you a PyPy prompt, i.e. a very compliant Python interpreter implemented in Python. Because this version @@ -54,7 +54,7 @@ After checkout you can get a PyPy interpreter via:: - python pypy-dist/pypy/interpreter/py.py + python pypy-dist/pypy/bin/py.py have fun :-) @@ -112,7 +112,7 @@ 1. To start interpreting Python with PyPy, use Python 2.3 or greater:: - cd pypy/interpreter + cd pypy/bin python py.py After a few seconds (remember: this is running on top of CPython), @@ -171,7 +171,7 @@ 5. To list the PyPy interpreter command line options, type:: - cd pypy/interpreter + cd pypy/bin python py.py --help As an example of using PyPy from the command line, you could type:: From arigo at codespeak.net Wed May 18 19:25:17 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Wed, 18 May 2005 19:25:17 +0200 (CEST) Subject: [pypy-svn] r12462 - pypy/dist/lib-python Message-ID: <20050518172517.5D61A27BB2@code1.codespeak.net> Author: arigo Date: Wed May 18 19:25:17 2005 New Revision: 12462 Modified: pypy/dist/lib-python/conftest.py Log: Fixed the path to py.py. Modified: pypy/dist/lib-python/conftest.py ============================================================================== --- pypy/dist/lib-python/conftest.py (original) +++ pypy/dist/lib-python/conftest.py Wed May 18 19:25:17 2005 @@ -811,7 +811,7 @@ def getinvocation(self, regrtest): fspath = regrtest.getfspath() python = sys.executable - pypy_script = pypydir.join('interpreter', 'py.py') + pypy_script = pypydir.join('bin', 'py.py') alarm_script = pypydir.join('tool', 'alarm.py') regr_script = pypydir.join('tool', 'pytest', 'regrverbose.py') pypy_options = [] From arigo at codespeak.net Wed May 18 19:33:44 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Wed, 18 May 2005 19:33:44 +0200 (CEST) Subject: [pypy-svn] r12465 - in pypy/dist: demo pypy/bin Message-ID: <20050518173344.DE5E727BB2@code1.codespeak.net> Author: arigo Date: Wed May 18 19:33:44 2005 New Revision: 12465 Modified: pypy/dist/demo/bpnn.py pypy/dist/pypy/bin/translator.py Log: Mention a.specialize() again. Modified: pypy/dist/demo/bpnn.py ============================================================================== --- pypy/dist/demo/bpnn.py (original) +++ pypy/dist/demo/bpnn.py Wed May 18 19:33:44 2005 @@ -191,7 +191,7 @@ print 'Annotating...' a = t.annotate([]) a.simplify() - #a.specialize() + #a.specialize() # enable this to see (some) lower-level Cish operations print 'Displaying the call graph and the class hierarchy.' t.viewcg() print 'Compiling...' Modified: pypy/dist/pypy/bin/translator.py ============================================================================== --- pypy/dist/pypy/bin/translator.py (original) +++ pypy/dist/pypy/bin/translator.py Wed May 18 19:33:44 2005 @@ -23,6 +23,7 @@ t.call(arg) # call original function t.dis() # bytecode disassemble + a.specialize() # use low level operations (for C only) f = t.ccompile() # C compilation f = t.llvmcompile() # LLVM compilation assert f(arg) == t.call(arg) # sanity check From arigo at codespeak.net Wed May 18 19:54:10 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Wed, 18 May 2005 19:54:10 +0200 (CEST) Subject: [pypy-svn] r12466 - in pypy/dist/pypy: bin interpreter tool Message-ID: <20050518175410.9A59B27BAE@code1.codespeak.net> Author: arigo Date: Wed May 18 19:54:10 2005 New Revision: 12466 Removed: pypy/dist/pypy/tool/getpy.py Modified: pypy/dist/pypy/bin/py.py pypy/dist/pypy/interpreter/baseobjspace.py pypy/dist/pypy/interpreter/gateway.py Log: Can remove tool/getpy.py now. Modified: pypy/dist/pypy/bin/py.py ============================================================================== --- pypy/dist/pypy/bin/py.py (original) +++ pypy/dist/pypy/bin/py.py Wed May 18 19:54:10 2005 @@ -11,9 +11,6 @@ except ImportError: pass -from pypy.tool.getpy import py -#py.magic.invoke(compile=1) - from pypy.tool import option from pypy.tool.optik import make_option from pypy.interpreter import main, interactive, error Modified: pypy/dist/pypy/interpreter/baseobjspace.py ============================================================================== --- pypy/dist/pypy/interpreter/baseobjspace.py (original) +++ pypy/dist/pypy/interpreter/baseobjspace.py Wed May 18 19:54:10 2005 @@ -387,7 +387,7 @@ space = cache.space # XXX will change once we have our own compiler from pypy.interpreter.pycode import PyCode - from pypy.tool.getpy import py # aehem + import py source = source.lstrip() assert source.startswith('('), "incorrect header in:\n%s" % (source,) source = py.code.Source("def anonymous%s\n" % source) Modified: pypy/dist/pypy/interpreter/gateway.py ============================================================================== --- pypy/dist/pypy/interpreter/gateway.py (original) +++ pypy/dist/pypy/interpreter/gateway.py Wed May 18 19:54:10 2005 @@ -22,7 +22,7 @@ from pypy.tool.sourcetools import NiceCompile # internal non-translatable parts: -from pypy.tool.getpy import py # XXX from interpreter/ we get py.py +import py class Signature: "NOT_RPYTHON" @@ -639,7 +639,6 @@ def _setup(cls): """NOT_RPYTHON""" - from pypy.tool.getpy import py lp = py.path.local import pypy, os p = lp(pypy.__file__).new(basename='_cache').ensure(dir=1) @@ -679,7 +678,7 @@ # self-destruct on double-click: def harakiri(): import pypy._cache as _c - from pypy.tool.getpy import py + import py lp = py.path.local for pth in lp(_c.__file__).dirpath().listdir(): try: Deleted: /pypy/dist/pypy/tool/getpy.py ============================================================================== --- /pypy/dist/pypy/tool/getpy.py Wed May 18 19:54:10 2005 +++ (empty file) @@ -1 +0,0 @@ -import py From arigo at codespeak.net Wed May 18 19:55:03 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Wed, 18 May 2005 19:55:03 +0200 (CEST) Subject: [pypy-svn] r12467 - pypy/dist/pypy/documentation Message-ID: <20050518175503.49BC227BAE@code1.codespeak.net> Author: arigo Date: Wed May 18 19:55:03 2005 New Revision: 12467 Modified: pypy/dist/pypy/documentation/getting_started.txt Log: Mention the thunk object space and point to the demo directory from getting_started.txt. Modified: pypy/dist/pypy/documentation/getting_started.txt ============================================================================== --- pypy/dist/pypy/documentation/getting_started.txt (original) +++ pypy/dist/pypy/documentation/getting_started.txt Wed May 18 19:55:03 2005 @@ -86,7 +86,6 @@ testing tool that we are using and enhancing for PyPy. .. _`py.test`: http://codespeak.net/py/current/doc/test.html -.. _`interesting starting points`: Filing bugs or feature requests ------------------------------- @@ -98,6 +97,8 @@ .. _`using the development tracker`: coding-guide.html#using-development-tracker +.. _`interesting starting points`: + Interesting Starting Points in PyPy =================================== @@ -183,7 +184,35 @@ python py.py ../../lib-python/modified-2.3.4/test/pystone.py 10 -6. The PyPy project uses test-driven-development. Right now, there are + +6. One of the original features provided by the py.py interpreter that are + without equivalent in CPython is the "thunk" object space, providing + lazily-computed objects:: + + cd pypy/bin + python py.py -o thunk + + >>>> def longcomputation(lst): + .... print "computing..." + .... return sum(lst) + .... + >>>> x = thunk(longcomputation, range(5)) + >>>> y = thunk(longcomputation, range(10)) + >>>> d = {5: x, 10: y} + >>>> result = d[5] + >>>> result + computing... + 10 + >>>> type(d[10]) + computing... + + >>>> d[10] + 45 + + You will find more examples in the directory ``demo``. + + +7. The PyPy project uses test-driven-development. Right now, there are a couple of different categories of tests which you can run. To run all the unit tests:: From arigo at codespeak.net Wed May 18 20:15:16 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Wed, 18 May 2005 20:15:16 +0200 (CEST) Subject: [pypy-svn] r12468 - pypy/dist/pypy/translator/goal Message-ID: <20050518181516.13DC327B58@code1.codespeak.net> Author: arigo Date: Wed May 18 20:15:15 2005 New Revision: 12468 Added: pypy/dist/pypy/translator/goal/__init__.py Removed: pypy/dist/pypy/translator/goal/autopath.py Log: Oups, wrong autopath and missing __init__.py. Removing the bad autopath... Added: pypy/dist/pypy/translator/goal/__init__.py ============================================================================== Deleted: /pypy/dist/pypy/translator/goal/autopath.py ============================================================================== --- /pypy/dist/pypy/translator/goal/autopath.py Wed May 18 20:15:15 2005 +++ (empty file) @@ -1,2 +0,0 @@ -import sys, os -sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) From arigo at codespeak.net Wed May 18 20:15:36 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Wed, 18 May 2005 20:15:36 +0200 (CEST) Subject: [pypy-svn] r12469 - pypy/dist/pypy/translator/goal Message-ID: <20050518181536.BF74527B58@code1.codespeak.net> Author: arigo Date: Wed May 18 20:15:36 2005 New Revision: 12469 Added: pypy/dist/pypy/translator/goal/autopath.py - copied unchanged from r12467, pypy/dist/pypy/translator/autopath.py Log: ...and adding the correct one again. From arigo at codespeak.net Wed May 18 20:29:24 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Wed, 18 May 2005 20:29:24 +0200 (CEST) Subject: [pypy-svn] r12470 - pypy/dist/pypy/documentation Message-ID: <20050518182924.2151A27BB9@code1.codespeak.net> Author: arigo Date: Wed May 18 20:29:23 2005 New Revision: 12470 Modified: pypy/dist/pypy/documentation/getting_started.txt Log: Added subsections in the "Main entry point" section. For the translator part, mention demo/bpnn.py and translate_pypy.py. Modified: pypy/dist/pypy/documentation/getting_started.txt ============================================================================== --- pypy/dist/pypy/documentation/getting_started.txt (original) +++ pypy/dist/pypy/documentation/getting_started.txt Wed May 18 20:29:23 2005 @@ -111,7 +111,10 @@ Main entry point / special PyPy features ------------------------------------------ -1. To start interpreting Python with PyPy, use Python 2.3 or greater:: +The py.py interpreter ++++++++++++++++++++++ + + To start interpreting Python with PyPy, use Python 2.3 or greater:: cd pypy/bin python py.py @@ -120,7 +123,7 @@ you should be at the PyPy prompt, which is the same as the Python prompt, but with an extra ">". -2. Now you are ready to start running Python code. Most Python + Now you are ready to start running Python code. Most Python modules should work if they don't involve CPython extension modules. Here is an example of determining PyPy's performance in pystones:: @@ -134,8 +137,27 @@ default is 50000, which is far too many to run in a reasonable time on the current PyPy implementation. +py.py options ++++++++++++++ + + To list the PyPy interpreter command line options, type:: + + cd pypy/bin + python py.py --help + + As an example of using PyPy from the command line, you could type:: + + python py.py -c "from test import pystone; pystone.main(10)" + + Alternatively, as with regular Python, you can simply give a + script name on the command line:: -3. There are a few extra features of the PyPy console: If you press + python py.py ../../lib-python/modified-2.3.4/test/pystone.py 10 + +Interpreter-level console ++++++++++++++++++++++++++ + + There are a few extra features of the PyPy console: If you press on the console you enter the interpreter-level console, a usual CPython console. You can then access internal objects of PyPy (e.g. the object space) and any variables you have created on the PyPy @@ -150,7 +172,10 @@ Note that the prompt of the interpreter-level console is only '>>>' since it runs on CPython level. To return to PyPy, press . -4. You can also use the trace object space to trace the work of the +Tracing ++++++++ + + You can also use the trace object space to trace the work of the interpreter. To enable it, do on the PyPy console:: >>>> __pytrace__ = 1 @@ -169,23 +194,10 @@ |-13 RETURN_VALUE |-<<<<a = 1 + 2 @ 1>>>>>>> +Thunk object space (lazy objects) ++++++++++++++++++++++++++++++++++ -5. To list the PyPy interpreter command line options, type:: - - cd pypy/bin - python py.py --help - - As an example of using PyPy from the command line, you could type:: - - python py.py -c "from test import pystone; pystone.main(10)" - - Alternatively, as with regular Python, you can simply give a - script name on the command line:: - - python py.py ../../lib-python/modified-2.3.4/test/pystone.py 10 - - -6. One of the original features provided by the py.py interpreter that are + One of the original features provided by the py.py interpreter that are without equivalent in CPython is the "thunk" object space, providing lazily-computed objects:: @@ -209,10 +221,10 @@ >>>> d[10] 45 - You will find more examples in the directory ``demo``. - +Running the tests ++++++++++++++++++ -7. The PyPy project uses test-driven-development. Right now, there are + The PyPy project uses test-driven-development. Right now, there are a couple of different categories of tests which you can run. To run all the unit tests:: @@ -244,6 +256,16 @@ .. _`installed py.test`: http://codespeak.net/py/current/doc/getting_started.html +Demos ++++++ + + The directory ``demo`` contains examples of various aspects of PyPy, + from regular Python programs that we used as goals while developing + the interpreter to applications of the thunk object space to an + example allowing you to `try out the translator`_. + + +.. _`try out the translator`: Trying out the translator ------------------------- @@ -257,11 +279,12 @@ 3. Type:: - cd pypy/translator - python -i translator.py + cd pypy/bin + python translator.py Test snippets of translatable code are provided in the file - ``test/snippet.py``. For example:: + ``pypy/translator/test/snippet.py``, which is imported under the name + ``test``. For example:: >>> t = Translator(test.is_perfect_number) >>> t.view() @@ -270,7 +293,7 @@ .. >>> from pypy.translator.test import snippet as test 4. We have a type annotator that can completely infer types for functions like - ``is_perfect_number``:: + ``is_perfect_number`` (as well as for much larger examples):: >>> a = t.annotate([int]) >>> t.view() @@ -302,6 +325,41 @@ This works only with fully annotated graphs. +7. There is a small-to-medium demo showing the translator and the annotator:: + + cd demo + python bpnn.py + + This causes ``bpnn.py`` to display itself as a call graph and class + hierarchy. Clicking on functions shows the flow graph of the particular + function. Clicking on a class shows the attributes of its instances. All + this information (call graph, local variables' types, attributes of + instances) is computed by the annotator. + +8. Not for the faint of heart nor the owner of a very old machine: you can + run the annotator over the whole PyPy interpreter itself. This is the + largest and ultimate example of source that our annotator can (very + successfully!) process:: + + cd pypy/translator/goal + python translate_pypy.py -no-t -no-c + + Moving around is difficult because of the sheer size of the result. + For this reason, the debugger prompt you get at the end has been + enhanced with commands to facilitate locating functions and classes. + Type ``help graphs`` for a list of the new commands. Help is also + available on each of these new commands. + + The ``translate_pypy`` script itself takes a number of options controlling + what to translate and how. See ``translate_pypy.py -h``. Try out:: + + cd pypy/translator/goal + python translate_pypy.py targetrpystone + + or a simplified, scaled-down version:: + + python translate_pypy.py targetrpystone2 + .. _`start reading sources`: From hpk at codespeak.net Wed May 18 20:50:36 2005 From: hpk at codespeak.net (hpk at codespeak.net) Date: Wed, 18 May 2005 20:50:36 +0200 (CEST) Subject: [pypy-svn] r12472 - in pypy/dist/pypy/documentation: . tool Message-ID: <20050518185036.7374C27BB9@code1.codespeak.net> Author: hpk Date: Wed May 18 20:50:36 2005 New Revision: 12472 Added: pypy/dist/pypy/documentation/_ref.txt pypy/dist/pypy/documentation/tool/ pypy/dist/pypy/documentation/tool/__init__.py pypy/dist/pypy/documentation/tool/regenref.py Log: issue53: in-progress a first stab at having common file and directory references (not integrated yet with include:: directives into all the documentation files). pypy/documentation/tool/regenref.py regenerates the set of files from the actual pypy directory layout. Added: pypy/dist/pypy/documentation/_ref.txt ============================================================================== --- (empty file) +++ pypy/dist/pypy/documentation/_ref.txt Wed May 18 20:50:36 2005 @@ -0,0 +1,345 @@ +.. _`annotation/`: http://codespeak.net/svn/pypy/dist/pypy/annotation/ +.. _`annotation/__init__.py`: http://codespeak.net/svn/pypy/dist/pypy/annotation/__init__.py +.. _`annotation/binaryop.py`: http://codespeak.net/svn/pypy/dist/pypy/annotation/binaryop.py +.. _`annotation/bookkeeper.py`: http://codespeak.net/svn/pypy/dist/pypy/annotation/bookkeeper.py +.. _`annotation/builtin.py`: http://codespeak.net/svn/pypy/dist/pypy/annotation/builtin.py +.. _`annotation/classdef.py`: http://codespeak.net/svn/pypy/dist/pypy/annotation/classdef.py +.. _`annotation/dictdef.py`: http://codespeak.net/svn/pypy/dist/pypy/annotation/dictdef.py +.. _`annotation/listdef.py`: http://codespeak.net/svn/pypy/dist/pypy/annotation/listdef.py +.. _`annotation/model.py`: http://codespeak.net/svn/pypy/dist/pypy/annotation/model.py +.. _`annotation/pairtype.py`: http://codespeak.net/svn/pypy/dist/pypy/annotation/pairtype.py +.. _`annotation/unaryop.py`: http://codespeak.net/svn/pypy/dist/pypy/annotation/unaryop.py +.. _`bin/`: http://codespeak.net/svn/pypy/dist/pypy/bin/ +.. _`bin/autopath.py`: http://codespeak.net/svn/pypy/dist/pypy/bin/autopath.py +.. _`bin/py.py`: http://codespeak.net/svn/pypy/dist/pypy/bin/py.py +.. _`bin/translator.py`: http://codespeak.net/svn/pypy/dist/pypy/bin/translator.py +.. _`documentation/`: http://codespeak.net/svn/pypy/dist/pypy/documentation/ +.. _`documentation/__init__.py`: http://codespeak.net/svn/pypy/dist/pypy/documentation/__init__.py +.. _`documentation/conftest.py`: http://codespeak.net/svn/pypy/dist/pypy/documentation/conftest.py +.. _`documentation/revreport/`: http://codespeak.net/svn/pypy/dist/pypy/documentation/revreport/ +.. _`documentation/revreport/__init__.py`: http://codespeak.net/svn/pypy/dist/pypy/documentation/revreport/__init__.py +.. _`documentation/revreport/autopath.py`: http://codespeak.net/svn/pypy/dist/pypy/documentation/revreport/autopath.py +.. _`documentation/revreport/delta.py`: http://codespeak.net/svn/pypy/dist/pypy/documentation/revreport/delta.py +.. _`documentation/revreport/revreport.py`: http://codespeak.net/svn/pypy/dist/pypy/documentation/revreport/revreport.py +.. _`documentation/test_redirections.py`: http://codespeak.net/svn/pypy/dist/pypy/documentation/test_redirections.py +.. _`documentation/tool/`: http://codespeak.net/svn/pypy/dist/pypy/documentation/tool/ +.. _`documentation/tool/__init__.py`: http://codespeak.net/svn/pypy/dist/pypy/documentation/tool/__init__.py +.. _`documentation/tool/regenref.py`: http://codespeak.net/svn/pypy/dist/pypy/documentation/tool/regenref.py +.. _`documentation/website/`: http://codespeak.net/svn/pypy/dist/pypy/documentation/website/ +.. _`documentation/x.py`: http://codespeak.net/svn/pypy/dist/pypy/documentation/x.py +.. _`interpreter/`: http://codespeak.net/svn/pypy/dist/pypy/interpreter/ +.. _`interpreter/__init__.py`: http://codespeak.net/svn/pypy/dist/pypy/interpreter/__init__.py +.. _`interpreter/argument.py`: http://codespeak.net/svn/pypy/dist/pypy/interpreter/argument.py +.. _`interpreter/autopath.py`: http://codespeak.net/svn/pypy/dist/pypy/interpreter/autopath.py +.. _`interpreter/baseobjspace.py`: http://codespeak.net/svn/pypy/dist/pypy/interpreter/baseobjspace.py +.. _`interpreter/compiler.py`: http://codespeak.net/svn/pypy/dist/pypy/interpreter/compiler.py +.. _`interpreter/debug.py`: http://codespeak.net/svn/pypy/dist/pypy/interpreter/debug.py +.. _`interpreter/error.py`: http://codespeak.net/svn/pypy/dist/pypy/interpreter/error.py +.. _`interpreter/eval.py`: http://codespeak.net/svn/pypy/dist/pypy/interpreter/eval.py +.. _`interpreter/executioncontext.py`: http://codespeak.net/svn/pypy/dist/pypy/interpreter/executioncontext.py +.. _`interpreter/function.py`: http://codespeak.net/svn/pypy/dist/pypy/interpreter/function.py +.. _`interpreter/gateway.py`: http://codespeak.net/svn/pypy/dist/pypy/interpreter/gateway.py +.. _`interpreter/generator.py`: http://codespeak.net/svn/pypy/dist/pypy/interpreter/generator.py +.. _`interpreter/interactive.py`: http://codespeak.net/svn/pypy/dist/pypy/interpreter/interactive.py +.. _`interpreter/main.py`: http://codespeak.net/svn/pypy/dist/pypy/interpreter/main.py +.. _`interpreter/miscutils.py`: http://codespeak.net/svn/pypy/dist/pypy/interpreter/miscutils.py +.. _`interpreter/mixedmodule.py`: http://codespeak.net/svn/pypy/dist/pypy/interpreter/mixedmodule.py +.. _`interpreter/module.py`: http://codespeak.net/svn/pypy/dist/pypy/interpreter/module.py +.. _`interpreter/nestedscope.py`: http://codespeak.net/svn/pypy/dist/pypy/interpreter/nestedscope.py +.. _`interpreter/pycode.py`: http://codespeak.net/svn/pypy/dist/pypy/interpreter/pycode.py +.. _`interpreter/pyframe.py`: http://codespeak.net/svn/pypy/dist/pypy/interpreter/pyframe.py +.. _`interpreter/pyopcode.py`: http://codespeak.net/svn/pypy/dist/pypy/interpreter/pyopcode.py +.. _`interpreter/pytraceback.py`: http://codespeak.net/svn/pypy/dist/pypy/interpreter/pytraceback.py +.. _`interpreter/special.py`: http://codespeak.net/svn/pypy/dist/pypy/interpreter/special.py +.. _`interpreter/typedef.py`: http://codespeak.net/svn/pypy/dist/pypy/interpreter/typedef.py +.. _`interpreter/x.py`: http://codespeak.net/svn/pypy/dist/pypy/interpreter/x.py +.. _`lib/`: http://codespeak.net/svn/pypy/dist/pypy/lib/ +.. _`lib/__init__.py`: http://codespeak.net/svn/pypy/dist/pypy/lib/__init__.py +.. _`lib/_classobj.py`: http://codespeak.net/svn/pypy/dist/pypy/lib/_classobj.py +.. _`lib/_exceptions.py`: http://codespeak.net/svn/pypy/dist/pypy/lib/_exceptions.py +.. _`lib/_file.py`: http://codespeak.net/svn/pypy/dist/pypy/lib/_file.py +.. _`lib/_float_formatting.py`: http://codespeak.net/svn/pypy/dist/pypy/lib/_float_formatting.py +.. _`lib/_formatting.py`: http://codespeak.net/svn/pypy/dist/pypy/lib/_formatting.py +.. _`lib/_sio.py`: http://codespeak.net/svn/pypy/dist/pypy/lib/_sio.py +.. _`lib/cPickle.py`: http://codespeak.net/svn/pypy/dist/pypy/lib/cPickle.py +.. _`lib/cStringIO.py`: http://codespeak.net/svn/pypy/dist/pypy/lib/cStringIO.py +.. _`lib/cmath.py`: http://codespeak.net/svn/pypy/dist/pypy/lib/cmath.py +.. _`lib/datetime.py`: http://codespeak.net/svn/pypy/dist/pypy/lib/datetime.py +.. _`lib/decimal.py`: http://codespeak.net/svn/pypy/dist/pypy/lib/decimal.py +.. _`lib/gc.py`: http://codespeak.net/svn/pypy/dist/pypy/lib/gc.py +.. _`lib/imp.py`: http://codespeak.net/svn/pypy/dist/pypy/lib/imp.py +.. _`lib/inprogress__codecs.py`: http://codespeak.net/svn/pypy/dist/pypy/lib/inprogress__codecs.py +.. _`lib/inprogress_binascii.py`: http://codespeak.net/svn/pypy/dist/pypy/lib/inprogress_binascii.py +.. _`lib/itertools.py`: http://codespeak.net/svn/pypy/dist/pypy/lib/itertools.py +.. _`lib/marshal.py`: http://codespeak.net/svn/pypy/dist/pypy/lib/marshal.py +.. _`lib/md5.py`: http://codespeak.net/svn/pypy/dist/pypy/lib/md5.py +.. _`lib/operator.py`: http://codespeak.net/svn/pypy/dist/pypy/lib/operator.py +.. _`lib/random.py`: http://codespeak.net/svn/pypy/dist/pypy/lib/random.py +.. _`lib/sha.py`: http://codespeak.net/svn/pypy/dist/pypy/lib/sha.py +.. _`lib/struct.py`: http://codespeak.net/svn/pypy/dist/pypy/lib/struct.py +.. _`lib/test2/`: http://codespeak.net/svn/pypy/dist/pypy/lib/test2/ +.. _`lib/test2/FIXME_test_sio.py`: http://codespeak.net/svn/pypy/dist/pypy/lib/test2/FIXME_test_sio.py +.. _`lib/test2/__init__.py`: http://codespeak.net/svn/pypy/dist/pypy/lib/test2/__init__.py +.. _`lib/test2/no_test_pickle_extra.py`: http://codespeak.net/svn/pypy/dist/pypy/lib/test2/no_test_pickle_extra.py +.. _`lib/test2/test_binascii_extra.py`: http://codespeak.net/svn/pypy/dist/pypy/lib/test2/test_binascii_extra.py +.. _`lib/test2/test_codeccallbacks.py`: http://codespeak.net/svn/pypy/dist/pypy/lib/test2/test_codeccallbacks.py +.. _`lib/test2/test_exception_extra.py`: http://codespeak.net/svn/pypy/dist/pypy/lib/test2/test_exception_extra.py +.. _`lib/test2/test_exceptions_extra.py`: http://codespeak.net/svn/pypy/dist/pypy/lib/test2/test_exceptions_extra.py +.. _`lib/test2/test_file_extra.py`: http://codespeak.net/svn/pypy/dist/pypy/lib/test2/test_file_extra.py +.. _`lib/test2/test_imp_extra.py`: http://codespeak.net/svn/pypy/dist/pypy/lib/test2/test_imp_extra.py +.. _`lib/test2/test_md5_extra.py`: http://codespeak.net/svn/pypy/dist/pypy/lib/test2/test_md5_extra.py +.. _`lib/test2/test_sha_extra.py`: http://codespeak.net/svn/pypy/dist/pypy/lib/test2/test_sha_extra.py +.. _`lib/test2/test_string_extra.py`: http://codespeak.net/svn/pypy/dist/pypy/lib/test2/test_string_extra.py +.. _`lib/test2/test_struct_extra.py`: http://codespeak.net/svn/pypy/dist/pypy/lib/test2/test_struct_extra.py +.. _`lib/unicodecodec.py`: http://codespeak.net/svn/pypy/dist/pypy/lib/unicodecodec.py +.. _`module/`: http://codespeak.net/svn/pypy/dist/pypy/module/ +.. _`module/__init__.py`: http://codespeak.net/svn/pypy/dist/pypy/module/__init__.py +.. _`module/_sre_pypy/`: http://codespeak.net/svn/pypy/dist/pypy/module/_sre_pypy/ +.. _`module/_sre_pypy/__init__.py`: http://codespeak.net/svn/pypy/dist/pypy/module/_sre_pypy/__init__.py +.. _`module/_sre_pypy/application_code.py`: http://codespeak.net/svn/pypy/dist/pypy/module/_sre_pypy/application_code.py +.. _`module/_sre_pypy/interpreter_code.py`: http://codespeak.net/svn/pypy/dist/pypy/module/_sre_pypy/interpreter_code.py +.. _`module/_sre_pypy/test.py`: http://codespeak.net/svn/pypy/dist/pypy/module/_sre_pypy/test.py +.. _`module/builtin/`: http://codespeak.net/svn/pypy/dist/pypy/module/builtin/ +.. _`module/builtin/__init__.py`: http://codespeak.net/svn/pypy/dist/pypy/module/builtin/__init__.py +.. _`module/builtin/app_buffer.py`: http://codespeak.net/svn/pypy/dist/pypy/module/builtin/app_buffer.py +.. _`module/builtin/app_complex.py`: http://codespeak.net/svn/pypy/dist/pypy/module/builtin/app_complex.py +.. _`module/builtin/app_descriptor.py`: http://codespeak.net/svn/pypy/dist/pypy/module/builtin/app_descriptor.py +.. _`module/builtin/app_functional.py`: http://codespeak.net/svn/pypy/dist/pypy/module/builtin/app_functional.py +.. _`module/builtin/app_help.py`: http://codespeak.net/svn/pypy/dist/pypy/module/builtin/app_help.py +.. _`module/builtin/app_inspect.py`: http://codespeak.net/svn/pypy/dist/pypy/module/builtin/app_inspect.py +.. _`module/builtin/app_io.py`: http://codespeak.net/svn/pypy/dist/pypy/module/builtin/app_io.py +.. _`module/builtin/app_misc.py`: http://codespeak.net/svn/pypy/dist/pypy/module/builtin/app_misc.py +.. _`module/builtin/compiling.py`: http://codespeak.net/svn/pypy/dist/pypy/module/builtin/compiling.py +.. _`module/builtin/importing.py`: http://codespeak.net/svn/pypy/dist/pypy/module/builtin/importing.py +.. _`module/builtin/operation.py`: http://codespeak.net/svn/pypy/dist/pypy/module/builtin/operation.py +.. _`module/classobjinterp.py`: http://codespeak.net/svn/pypy/dist/pypy/module/classobjinterp.py +.. _`module/exceptionsinterp.py`: http://codespeak.net/svn/pypy/dist/pypy/module/exceptionsinterp.py +.. _`module/parser/`: http://codespeak.net/svn/pypy/dist/pypy/module/parser/ +.. _`module/parser/DFAParser.py`: http://codespeak.net/svn/pypy/dist/pypy/module/parser/DFAParser.py +.. _`module/parser/PgenParser.py`: http://codespeak.net/svn/pypy/dist/pypy/module/parser/PgenParser.py +.. _`module/parser/PyGrammar.py`: http://codespeak.net/svn/pypy/dist/pypy/module/parser/PyGrammar.py +.. _`module/parser/PyPgen.py`: http://codespeak.net/svn/pypy/dist/pypy/module/parser/PyPgen.py +.. _`module/parser/PyTokenizer.py`: http://codespeak.net/svn/pypy/dist/pypy/module/parser/PyTokenizer.py +.. _`module/parser/StdTokenizer.py`: http://codespeak.net/svn/pypy/dist/pypy/module/parser/StdTokenizer.py +.. _`module/parser/TokenUtils.py`: http://codespeak.net/svn/pypy/dist/pypy/module/parser/TokenUtils.py +.. _`module/parser/__init__.py`: http://codespeak.net/svn/pypy/dist/pypy/module/parser/__init__.py +.. _`module/parser/app_class.py`: http://codespeak.net/svn/pypy/dist/pypy/module/parser/app_class.py +.. _`module/parser/automata.py`: http://codespeak.net/svn/pypy/dist/pypy/module/parser/automata.py +.. _`module/parser/genPytokenize.py`: http://codespeak.net/svn/pypy/dist/pypy/module/parser/genPytokenize.py +.. _`module/parser/pyparser.py`: http://codespeak.net/svn/pypy/dist/pypy/module/parser/pyparser.py +.. _`module/parser/pytokenize.py`: http://codespeak.net/svn/pypy/dist/pypy/module/parser/pytokenize.py +.. _`module/recparser/`: http://codespeak.net/svn/pypy/dist/pypy/module/recparser/ +.. _`module/recparser/__init__.py`: http://codespeak.net/svn/pypy/dist/pypy/module/recparser/__init__.py +.. _`module/recparser/compat.py`: http://codespeak.net/svn/pypy/dist/pypy/module/recparser/compat.py +.. _`module/recparser/ebnflexer.py`: http://codespeak.net/svn/pypy/dist/pypy/module/recparser/ebnflexer.py +.. _`module/recparser/ebnfparse.py`: http://codespeak.net/svn/pypy/dist/pypy/module/recparser/ebnfparse.py +.. _`module/recparser/grammar.py`: http://codespeak.net/svn/pypy/dist/pypy/module/recparser/grammar.py +.. _`module/recparser/pyparser.py`: http://codespeak.net/svn/pypy/dist/pypy/module/recparser/pyparser.py +.. _`module/recparser/pythonlexer.py`: http://codespeak.net/svn/pypy/dist/pypy/module/recparser/pythonlexer.py +.. _`module/recparser/pythonparse.py`: http://codespeak.net/svn/pypy/dist/pypy/module/recparser/pythonparse.py +.. _`module/recparser/pythonutil.py`: http://codespeak.net/svn/pypy/dist/pypy/module/recparser/pythonutil.py +.. _`module/recparser/syntaxtree.py`: http://codespeak.net/svn/pypy/dist/pypy/module/recparser/syntaxtree.py +.. _`module/sys2/`: http://codespeak.net/svn/pypy/dist/pypy/module/sys2/ +.. _`module/sys2/__init__.py`: http://codespeak.net/svn/pypy/dist/pypy/module/sys2/__init__.py +.. _`module/sys2/app.py`: http://codespeak.net/svn/pypy/dist/pypy/module/sys2/app.py +.. _`module/sys2/hook.py`: http://codespeak.net/svn/pypy/dist/pypy/module/sys2/hook.py +.. _`module/sys2/state.py`: http://codespeak.net/svn/pypy/dist/pypy/module/sys2/state.py +.. _`module/sys2/vm.py`: http://codespeak.net/svn/pypy/dist/pypy/module/sys2/vm.py +.. _`objspace/`: http://codespeak.net/svn/pypy/dist/pypy/objspace/ +.. _`objspace/__init__.py`: http://codespeak.net/svn/pypy/dist/pypy/objspace/__init__.py +.. _`objspace/descroperation.py`: http://codespeak.net/svn/pypy/dist/pypy/objspace/descroperation.py +.. _`objspace/dummy.py`: http://codespeak.net/svn/pypy/dist/pypy/objspace/dummy.py +.. _`objspace/flow/`: http://codespeak.net/svn/pypy/dist/pypy/objspace/flow/ +.. _`objspace/flow/__init__.py`: http://codespeak.net/svn/pypy/dist/pypy/objspace/flow/__init__.py +.. _`objspace/flow/flowcontext.py`: http://codespeak.net/svn/pypy/dist/pypy/objspace/flow/flowcontext.py +.. _`objspace/flow/framestate.py`: http://codespeak.net/svn/pypy/dist/pypy/objspace/flow/framestate.py +.. _`objspace/flow/model.py`: http://codespeak.net/svn/pypy/dist/pypy/objspace/flow/model.py +.. _`objspace/flow/objspace.py`: http://codespeak.net/svn/pypy/dist/pypy/objspace/flow/objspace.py +.. _`objspace/flow/operation.py`: http://codespeak.net/svn/pypy/dist/pypy/objspace/flow/operation.py +.. _`objspace/flow/specialcase.py`: http://codespeak.net/svn/pypy/dist/pypy/objspace/flow/specialcase.py +.. _`objspace/proxy.py`: http://codespeak.net/svn/pypy/dist/pypy/objspace/proxy.py +.. _`objspace/std/`: http://codespeak.net/svn/pypy/dist/pypy/objspace/std/ +.. _`objspace/std/__init__.py`: http://codespeak.net/svn/pypy/dist/pypy/objspace/std/__init__.py +.. _`objspace/std/autopath.py`: http://codespeak.net/svn/pypy/dist/pypy/objspace/std/autopath.py +.. _`objspace/std/basestringtype.py`: http://codespeak.net/svn/pypy/dist/pypy/objspace/std/basestringtype.py +.. _`objspace/std/boolobject.py`: http://codespeak.net/svn/pypy/dist/pypy/objspace/std/boolobject.py +.. _`objspace/std/booltype.py`: http://codespeak.net/svn/pypy/dist/pypy/objspace/std/booltype.py +.. _`objspace/std/default.py`: http://codespeak.net/svn/pypy/dist/pypy/objspace/std/default.py +.. _`objspace/std/dictobject.py`: http://codespeak.net/svn/pypy/dist/pypy/objspace/std/dictobject.py +.. _`objspace/std/dictproxyobject.py`: http://codespeak.net/svn/pypy/dist/pypy/objspace/std/dictproxyobject.py +.. _`objspace/std/dictproxytype.py`: http://codespeak.net/svn/pypy/dist/pypy/objspace/std/dictproxytype.py +.. _`objspace/std/dicttype.py`: http://codespeak.net/svn/pypy/dist/pypy/objspace/std/dicttype.py +.. _`objspace/std/dump_multimethod.py`: http://codespeak.net/svn/pypy/dist/pypy/objspace/std/dump_multimethod.py +.. _`objspace/std/fake.py`: http://codespeak.net/svn/pypy/dist/pypy/objspace/std/fake.py +.. _`objspace/std/floatobject.py`: http://codespeak.net/svn/pypy/dist/pypy/objspace/std/floatobject.py +.. _`objspace/std/floattype.py`: http://codespeak.net/svn/pypy/dist/pypy/objspace/std/floattype.py +.. _`objspace/std/intobject.py`: http://codespeak.net/svn/pypy/dist/pypy/objspace/std/intobject.py +.. _`objspace/std/inttype.py`: http://codespeak.net/svn/pypy/dist/pypy/objspace/std/inttype.py +.. _`objspace/std/iterobject.py`: http://codespeak.net/svn/pypy/dist/pypy/objspace/std/iterobject.py +.. _`objspace/std/itertype.py`: http://codespeak.net/svn/pypy/dist/pypy/objspace/std/itertype.py +.. _`objspace/std/listobject.py`: http://codespeak.net/svn/pypy/dist/pypy/objspace/std/listobject.py +.. _`objspace/std/listsort.py`: http://codespeak.net/svn/pypy/dist/pypy/objspace/std/listsort.py +.. _`objspace/std/listtype.py`: http://codespeak.net/svn/pypy/dist/pypy/objspace/std/listtype.py +.. _`objspace/std/longobject.py`: http://codespeak.net/svn/pypy/dist/pypy/objspace/std/longobject.py +.. _`objspace/std/longtype.py`: http://codespeak.net/svn/pypy/dist/pypy/objspace/std/longtype.py +.. _`objspace/std/model.py`: http://codespeak.net/svn/pypy/dist/pypy/objspace/std/model.py +.. _`objspace/std/mro.py`: http://codespeak.net/svn/pypy/dist/pypy/objspace/std/mro.py +.. _`objspace/std/multimethod.py`: http://codespeak.net/svn/pypy/dist/pypy/objspace/std/multimethod.py +.. _`objspace/std/noneobject.py`: http://codespeak.net/svn/pypy/dist/pypy/objspace/std/noneobject.py +.. _`objspace/std/nonetype.py`: http://codespeak.net/svn/pypy/dist/pypy/objspace/std/nonetype.py +.. _`objspace/std/objectobject.py`: http://codespeak.net/svn/pypy/dist/pypy/objspace/std/objectobject.py +.. _`objspace/std/objecttype.py`: http://codespeak.net/svn/pypy/dist/pypy/objspace/std/objecttype.py +.. _`objspace/std/objspace.py`: http://codespeak.net/svn/pypy/dist/pypy/objspace/std/objspace.py +.. _`objspace/std/register_all.py`: http://codespeak.net/svn/pypy/dist/pypy/objspace/std/register_all.py +.. _`objspace/std/sliceobject.py`: http://codespeak.net/svn/pypy/dist/pypy/objspace/std/sliceobject.py +.. _`objspace/std/slicetype.py`: http://codespeak.net/svn/pypy/dist/pypy/objspace/std/slicetype.py +.. _`objspace/std/stdtypedef.py`: http://codespeak.net/svn/pypy/dist/pypy/objspace/std/stdtypedef.py +.. _`objspace/std/stringobject.py`: http://codespeak.net/svn/pypy/dist/pypy/objspace/std/stringobject.py +.. _`objspace/std/stringtype.py`: http://codespeak.net/svn/pypy/dist/pypy/objspace/std/stringtype.py +.. _`objspace/std/strutil.py`: http://codespeak.net/svn/pypy/dist/pypy/objspace/std/strutil.py +.. _`objspace/std/tupleobject.py`: http://codespeak.net/svn/pypy/dist/pypy/objspace/std/tupleobject.py +.. _`objspace/std/tupletype.py`: http://codespeak.net/svn/pypy/dist/pypy/objspace/std/tupletype.py +.. _`objspace/std/typeobject.py`: http://codespeak.net/svn/pypy/dist/pypy/objspace/std/typeobject.py +.. _`objspace/std/typetype.py`: http://codespeak.net/svn/pypy/dist/pypy/objspace/std/typetype.py +.. _`objspace/std/unicodeobject.py`: http://codespeak.net/svn/pypy/dist/pypy/objspace/std/unicodeobject.py +.. _`objspace/std/unicodetype.py`: http://codespeak.net/svn/pypy/dist/pypy/objspace/std/unicodetype.py +.. _`objspace/thunk.py`: http://codespeak.net/svn/pypy/dist/pypy/objspace/thunk.py +.. _`objspace/trace.py`: http://codespeak.net/svn/pypy/dist/pypy/objspace/trace.py +.. _`rpython/`: http://codespeak.net/svn/pypy/dist/pypy/rpython/ +.. _`rpython/__init__.py`: http://codespeak.net/svn/pypy/dist/pypy/rpython/__init__.py +.. _`rpython/lltypes.py`: http://codespeak.net/svn/pypy/dist/pypy/rpython/lltypes.py +.. _`rpython/rarithmetic.py`: http://codespeak.net/svn/pypy/dist/pypy/rpython/rarithmetic.py +.. _`rpython/rlist.py`: http://codespeak.net/svn/pypy/dist/pypy/rpython/rlist.py +.. _`rpython/typer.py`: http://codespeak.net/svn/pypy/dist/pypy/rpython/typer.py +.. _`tool/`: http://codespeak.net/svn/pypy/dist/pypy/tool/ +.. _`tool/__init__.py`: http://codespeak.net/svn/pypy/dist/pypy/tool/__init__.py +.. _`tool/_enum_exceptions.py`: http://codespeak.net/svn/pypy/dist/pypy/tool/_enum_exceptions.py +.. _`tool/alarm.py`: http://codespeak.net/svn/pypy/dist/pypy/tool/alarm.py +.. _`tool/ansi_print.py`: http://codespeak.net/svn/pypy/dist/pypy/tool/ansi_print.py +.. _`tool/autopath.py`: http://codespeak.net/svn/pypy/dist/pypy/tool/autopath.py +.. _`tool/cache.py`: http://codespeak.net/svn/pypy/dist/pypy/tool/cache.py +.. _`tool/compile.py`: http://codespeak.net/svn/pypy/dist/pypy/tool/compile.py +.. _`tool/dotypes.py`: http://codespeak.net/svn/pypy/dist/pypy/tool/dotypes.py +.. _`tool/example_pytest.py`: http://codespeak.net/svn/pypy/dist/pypy/tool/example_pytest.py +.. _`tool/fiximport.py`: http://codespeak.net/svn/pypy/dist/pypy/tool/fiximport.py +.. _`tool/hack.py`: http://codespeak.net/svn/pypy/dist/pypy/tool/hack.py +.. _`tool/methodChecker.py`: http://codespeak.net/svn/pypy/dist/pypy/tool/methodChecker.py +.. _`tool/opcode.py`: http://codespeak.net/svn/pypy/dist/pypy/tool/opcode.py +.. _`tool/optik.py`: http://codespeak.net/svn/pypy/dist/pypy/tool/optik.py +.. _`tool/option.py`: http://codespeak.net/svn/pypy/dist/pypy/tool/option.py +.. _`tool/ppdb.py`: http://codespeak.net/svn/pypy/dist/pypy/tool/ppdb.py +.. _`tool/pydis.py`: http://codespeak.net/svn/pypy/dist/pypy/tool/pydis.py +.. _`tool/pypyrev.py`: http://codespeak.net/svn/pypy/dist/pypy/tool/pypyrev.py +.. _`tool/pytest/`: http://codespeak.net/svn/pypy/dist/pypy/tool/pytest/ +.. _`tool/pytest/__init__.py`: http://codespeak.net/svn/pypy/dist/pypy/tool/pytest/__init__.py +.. _`tool/pytest/appsupport.py`: http://codespeak.net/svn/pypy/dist/pypy/tool/pytest/appsupport.py +.. _`tool/pytest/autopath.py`: http://codespeak.net/svn/pypy/dist/pypy/tool/pytest/autopath.py +.. _`tool/pytest/confpath.py`: http://codespeak.net/svn/pypy/dist/pypy/tool/pytest/confpath.py +.. _`tool/pytest/genreportdata.py`: http://codespeak.net/svn/pypy/dist/pypy/tool/pytest/genreportdata.py +.. _`tool/pytest/htmlreport.py`: http://codespeak.net/svn/pypy/dist/pypy/tool/pytest/htmlreport.py +.. _`tool/pytest/overview.py`: http://codespeak.net/svn/pypy/dist/pypy/tool/pytest/overview.py +.. _`tool/pytest/regrverbose.py`: http://codespeak.net/svn/pypy/dist/pypy/tool/pytest/regrverbose.py +.. _`tool/pytest/result.py`: http://codespeak.net/svn/pypy/dist/pypy/tool/pytest/result.py +.. _`tool/sourcetools.py`: http://codespeak.net/svn/pypy/dist/pypy/tool/sourcetools.py +.. _`tool/stdprofile.py`: http://codespeak.net/svn/pypy/dist/pypy/tool/stdprofile.py +.. _`tool/tb_server/`: http://codespeak.net/svn/pypy/dist/pypy/tool/tb_server/ +.. _`tool/tb_server/__init__.py`: http://codespeak.net/svn/pypy/dist/pypy/tool/tb_server/__init__.py +.. _`tool/tb_server/render.py`: http://codespeak.net/svn/pypy/dist/pypy/tool/tb_server/render.py +.. _`tool/tb_server/server.py`: http://codespeak.net/svn/pypy/dist/pypy/tool/tb_server/server.py +.. _`tool/template.py`: http://codespeak.net/svn/pypy/dist/pypy/tool/template.py +.. _`tool/testpm.py`: http://codespeak.net/svn/pypy/dist/pypy/tool/testpm.py +.. _`tool/tls.py`: http://codespeak.net/svn/pypy/dist/pypy/tool/tls.py +.. _`tool/traceop.py`: http://codespeak.net/svn/pypy/dist/pypy/tool/traceop.py +.. _`tool/udir.py`: http://codespeak.net/svn/pypy/dist/pypy/tool/udir.py +.. _`tool/uid.py`: http://codespeak.net/svn/pypy/dist/pypy/tool/uid.py +.. _`tool/unionfind.py`: http://codespeak.net/svn/pypy/dist/pypy/tool/unionfind.py +.. _`tool/utestconvert.py`: http://codespeak.net/svn/pypy/dist/pypy/tool/utestconvert.py +.. _`translator/`: http://codespeak.net/svn/pypy/dist/pypy/translator/ +.. _`translator/__init__.py`: http://codespeak.net/svn/pypy/dist/pypy/translator/__init__.py +.. _`translator/ann_override.py`: http://codespeak.net/svn/pypy/dist/pypy/translator/ann_override.py +.. _`translator/annrpython.py`: http://codespeak.net/svn/pypy/dist/pypy/translator/annrpython.py +.. _`translator/autopath.py`: http://codespeak.net/svn/pypy/dist/pypy/translator/autopath.py +.. _`translator/c/`: http://codespeak.net/svn/pypy/dist/pypy/translator/c/ +.. _`translator/genc/`: http://codespeak.net/svn/pypy/dist/pypy/translator/genc/ +.. _`translator/genc/__init__.py`: http://codespeak.net/svn/pypy/dist/pypy/translator/genc/__init__.py +.. _`translator/genc/autopath.py`: http://codespeak.net/svn/pypy/dist/pypy/translator/genc/autopath.py +.. _`translator/genc/basetype.py`: http://codespeak.net/svn/pypy/dist/pypy/translator/genc/basetype.py +.. _`translator/genc/classtype.py`: http://codespeak.net/svn/pypy/dist/pypy/translator/genc/classtype.py +.. _`translator/genc/ctyper.py`: http://codespeak.net/svn/pypy/dist/pypy/translator/genc/ctyper.py +.. _`translator/genc/funcdef.py`: http://codespeak.net/svn/pypy/dist/pypy/translator/genc/funcdef.py +.. _`translator/genc/functype.py`: http://codespeak.net/svn/pypy/dist/pypy/translator/genc/functype.py +.. _`translator/genc/genc.py`: http://codespeak.net/svn/pypy/dist/pypy/translator/genc/genc.py +.. _`translator/genc/heapobjecttype.py`: http://codespeak.net/svn/pypy/dist/pypy/translator/genc/heapobjecttype.py +.. _`translator/genc/instancetype.py`: http://codespeak.net/svn/pypy/dist/pypy/translator/genc/instancetype.py +.. _`translator/genc/inttype.py`: http://codespeak.net/svn/pypy/dist/pypy/translator/genc/inttype.py +.. _`translator/genc/listtype.py`: http://codespeak.net/svn/pypy/dist/pypy/translator/genc/listtype.py +.. _`translator/genc/lltype.py`: http://codespeak.net/svn/pypy/dist/pypy/translator/genc/lltype.py +.. _`translator/genc/nonetype.py`: http://codespeak.net/svn/pypy/dist/pypy/translator/genc/nonetype.py +.. _`translator/genc/pyobjtype.py`: http://codespeak.net/svn/pypy/dist/pypy/translator/genc/pyobjtype.py +.. _`translator/genc/tupletype.py`: http://codespeak.net/svn/pypy/dist/pypy/translator/genc/tupletype.py +.. _`translator/gencl.py`: http://codespeak.net/svn/pypy/dist/pypy/translator/gencl.py +.. _`translator/geninterplevel.py`: http://codespeak.net/svn/pypy/dist/pypy/translator/geninterplevel.py +.. _`translator/genpyrex.py`: http://codespeak.net/svn/pypy/dist/pypy/translator/genpyrex.py +.. _`translator/gensupp.py`: http://codespeak.net/svn/pypy/dist/pypy/translator/gensupp.py +.. _`translator/goal/`: http://codespeak.net/svn/pypy/dist/pypy/translator/goal/ +.. _`translator/goal/__init__.py`: http://codespeak.net/svn/pypy/dist/pypy/translator/goal/__init__.py +.. _`translator/goal/app_example.py`: http://codespeak.net/svn/pypy/dist/pypy/translator/goal/app_example.py +.. _`translator/goal/app_main.py`: http://codespeak.net/svn/pypy/dist/pypy/translator/goal/app_main.py +.. _`translator/goal/autopath.py`: http://codespeak.net/svn/pypy/dist/pypy/translator/goal/autopath.py +.. _`translator/goal/buildcache2.py`: http://codespeak.net/svn/pypy/dist/pypy/translator/goal/buildcache2.py +.. _`translator/goal/targetpypy.py`: http://codespeak.net/svn/pypy/dist/pypy/translator/goal/targetpypy.py +.. _`translator/goal/targetpypy0.py`: http://codespeak.net/svn/pypy/dist/pypy/translator/goal/targetpypy0.py +.. _`translator/goal/targetpypy1.py`: http://codespeak.net/svn/pypy/dist/pypy/translator/goal/targetpypy1.py +.. _`translator/goal/targetpypymain.py`: http://codespeak.net/svn/pypy/dist/pypy/translator/goal/targetpypymain.py +.. _`translator/goal/targetrpystone.py`: http://codespeak.net/svn/pypy/dist/pypy/translator/goal/targetrpystone.py +.. _`translator/goal/targetrpystone2.py`: http://codespeak.net/svn/pypy/dist/pypy/translator/goal/targetrpystone2.py +.. _`translator/goal/translate_pypy.py`: http://codespeak.net/svn/pypy/dist/pypy/translator/goal/translate_pypy.py +.. _`translator/java/`: http://codespeak.net/svn/pypy/dist/pypy/translator/java/ +.. _`translator/java/__init__.py`: http://codespeak.net/svn/pypy/dist/pypy/translator/java/__init__.py +.. _`translator/java/autopath.py`: http://codespeak.net/svn/pypy/dist/pypy/translator/java/autopath.py +.. _`translator/java/genjava.py`: http://codespeak.net/svn/pypy/dist/pypy/translator/java/genjava.py +.. _`translator/llvm/`: http://codespeak.net/svn/pypy/dist/pypy/translator/llvm/ +.. _`translator/llvm/__init__.py`: http://codespeak.net/svn/pypy/dist/pypy/translator/llvm/__init__.py +.. _`translator/llvm/autopath.py`: http://codespeak.net/svn/pypy/dist/pypy/translator/llvm/autopath.py +.. _`translator/llvm/build_llvm_module.py`: http://codespeak.net/svn/pypy/dist/pypy/translator/llvm/build_llvm_module.py +.. _`translator/llvm/classrepr.py`: http://codespeak.net/svn/pypy/dist/pypy/translator/llvm/classrepr.py +.. _`translator/llvm/funcrepr.py`: http://codespeak.net/svn/pypy/dist/pypy/translator/llvm/funcrepr.py +.. _`translator/llvm/genllvm.py`: http://codespeak.net/svn/pypy/dist/pypy/translator/llvm/genllvm.py +.. _`translator/llvm/lazyattribute.py`: http://codespeak.net/svn/pypy/dist/pypy/translator/llvm/lazyattribute.py +.. _`translator/llvm/llvmbc.py`: http://codespeak.net/svn/pypy/dist/pypy/translator/llvm/llvmbc.py +.. _`translator/llvm/make_runtime.py`: http://codespeak.net/svn/pypy/dist/pypy/translator/llvm/make_runtime.py +.. _`translator/llvm/memorylayout.py`: http://codespeak.net/svn/pypy/dist/pypy/translator/llvm/memorylayout.py +.. _`translator/llvm/pbcrepr.py`: http://codespeak.net/svn/pypy/dist/pypy/translator/llvm/pbcrepr.py +.. _`translator/llvm/representation.py`: http://codespeak.net/svn/pypy/dist/pypy/translator/llvm/representation.py +.. _`translator/llvm/seqrepr.py`: http://codespeak.net/svn/pypy/dist/pypy/translator/llvm/seqrepr.py +.. _`translator/llvm/typerepr.py`: http://codespeak.net/svn/pypy/dist/pypy/translator/llvm/typerepr.py +.. _`translator/simplify.py`: http://codespeak.net/svn/pypy/dist/pypy/translator/simplify.py +.. _`translator/tool/`: http://codespeak.net/svn/pypy/dist/pypy/translator/tool/ +.. _`translator/tool/__init__.py`: http://codespeak.net/svn/pypy/dist/pypy/translator/tool/__init__.py +.. _`translator/tool/autopath.py`: http://codespeak.net/svn/pypy/dist/pypy/translator/tool/autopath.py +.. _`translator/tool/benchmark.py`: http://codespeak.net/svn/pypy/dist/pypy/translator/tool/benchmark.py +.. _`translator/tool/buildcl.py`: http://codespeak.net/svn/pypy/dist/pypy/translator/tool/buildcl.py +.. _`translator/tool/buildpyxmodule.py`: http://codespeak.net/svn/pypy/dist/pypy/translator/tool/buildpyxmodule.py +.. _`translator/tool/flowtrace.py`: http://codespeak.net/svn/pypy/dist/pypy/translator/tool/flowtrace.py +.. _`translator/tool/graphpage.py`: http://codespeak.net/svn/pypy/dist/pypy/translator/tool/graphpage.py +.. _`translator/tool/graphserver.py`: http://codespeak.net/svn/pypy/dist/pypy/translator/tool/graphserver.py +.. _`translator/tool/make_dot.py`: http://codespeak.net/svn/pypy/dist/pypy/translator/tool/make_dot.py +.. _`translator/tool/stdoutcapture.py`: http://codespeak.net/svn/pypy/dist/pypy/translator/tool/stdoutcapture.py +.. _`translator/tool/tointerplevel.py`: http://codespeak.net/svn/pypy/dist/pypy/translator/tool/tointerplevel.py +.. _`translator/tool/traceann.py`: http://codespeak.net/svn/pypy/dist/pypy/translator/tool/traceann.py +.. _`translator/tool/tracer.py`: http://codespeak.net/svn/pypy/dist/pypy/translator/tool/tracer.py +.. _`translator/transform.py`: http://codespeak.net/svn/pypy/dist/pypy/translator/transform.py +.. _`translator/translator.py`: http://codespeak.net/svn/pypy/dist/pypy/translator/translator.py +.. _`translator/typer.py`: http://codespeak.net/svn/pypy/dist/pypy/translator/typer.py +.. _`translator/unsimplify.py`: http://codespeak.net/svn/pypy/dist/pypy/translator/unsimplify.py + +.. _`pypy/module/`: http://codespeak.net/svn/pypy/dist/pypy/module +.. _`pypy/interpreter/`: http://codespeak.net/svn/pypy/dist/pypy/interpreter +.. _`pypy/objspace/`: http://codespeak.net/svn/pypy/dist/pypy/objspace +.. _`pypy/translator/`: http://codespeak.net/svn/pypy/dist/pypy/translator +.. _`pypy/annotation/`: http://codespeak.net/svn/pypy/dist/pypy/annotation +.. _`pypy/tool/`: http://codespeak.net/svn/pypy/dist/pypy/tool +.. _`pypy/documentation/`: http://codespeak.net/svn/pypy/dist/pypy/documentation +.. _`pypy/lib/`: http://codespeak.net/svn/pypy/dist/pypy/lib +.. _`pypy/rpython/`: http://codespeak.net/svn/pypy/dist/pypy/rpython +.. _`pypy/bin/`: http://codespeak.net/svn/pypy/dist/pypy/bin \ No newline at end of file Added: pypy/dist/pypy/documentation/tool/__init__.py ============================================================================== --- (empty file) +++ pypy/dist/pypy/documentation/tool/__init__.py Wed May 18 20:50:36 2005 @@ -0,0 +1 @@ +# Added: pypy/dist/pypy/documentation/tool/regenref.py ============================================================================== --- (empty file) +++ pypy/dist/pypy/documentation/tool/regenref.py Wed May 18 20:50:36 2005 @@ -0,0 +1,32 @@ + +import py +py.magic.autopath() +import pypy +base = py.path.local(pypy.__file__).dirpath() +target = base.join('documentation', '_ref.txt') + +def match(p): + return p.relto(base).count(p.sep) < 2 \ + and p.check(dir=1, dotfile=0) \ + and p.basename not in ('test', '_cache') + +items = [] +for dir in base.visit(match, lambda x: x.check(dotfile=0) and x.basename != '_cache'): + assert dir.basename != '_cache' + items.append(dir.relto(base)+dir.sep) + for fn in dir.listdir(lambda x: x.check(file=1, ext='.py')): + assert fn.basename != '_cache' + items.append(fn.relto(base)) + +items.sort() + +lines = [] +for x in items: + lines.append(".. _`%s`: http://codespeak.net/svn/pypy/dist/pypy/%s" %(x,x,)) + +lines.append("") +for x in base.listdir(match): + x = x.relto(base) + lines.append(".. _`pypy/%s/`: http://codespeak.net/svn/pypy/dist/pypy/%s" %(x,x)) + +target.write("\n".join(lines)) From hpk at codespeak.net Wed May 18 20:51:15 2005 From: hpk at codespeak.net (hpk at codespeak.net) Date: Wed, 18 May 2005 20:51:15 +0200 (CEST) Subject: [pypy-svn] r12473 - pypy/dist/pypy/documentation Message-ID: <20050518185115.D97D127BBD@code1.codespeak.net> Author: hpk Date: Wed May 18 20:51:15 2005 New Revision: 12473 Modified: pypy/dist/pypy/documentation/coding-guide.txt pypy/dist/pypy/documentation/translation.txt Log: fixing lost link and adding a ref-alias Modified: pypy/dist/pypy/documentation/coding-guide.txt ============================================================================== --- pypy/dist/pypy/documentation/coding-guide.txt (original) +++ pypy/dist/pypy/documentation/coding-guide.txt Wed May 18 20:51:15 2005 @@ -5,10 +5,13 @@ .. contents:: .. sectnum:: + This document describes coding requirements and conventions for working with the PyPy code base. Please read it carefully and ask back any questions you might have. +.. _`RPython`: + Restricted Python ================== @@ -403,6 +406,9 @@ We are thinking about replacing ``OperationError`` with a family of common exception classes (e.g. ``AppKeyError``, ``AppIndexError``...) so that we can more easily catch them. The generic ``AppError`` would stand for all other application-level classes. + +.. _`modules`: + Modules in PyPy =============== @@ -413,7 +419,7 @@ because they rely on implementation details of CPython. If we don't just modify an original CPython module but need to rewrite -it from scratch we put it into `pypy/lib`_ as a pure application level +it from scratch we put it into `pypy/lib/`_ as a pure application level module. When we need access to interpreter-level objects we put the module into @@ -501,6 +507,7 @@ CPython tree clean and makes it obvious what we had to change. .. _`mixed module mechanism`: +.. _`mixed modules`: Implementing a mixed interpreter/application level Module --------------------------------------------------------- @@ -566,7 +573,6 @@ The interpreter level expression has a ``space`` binding when it is executed. - Testing modules in ``pypy/lib`` -------------------------------- @@ -574,7 +580,7 @@ ("py.test" or "python ../../test_all.py") to run tests against the pypy/lib hierarchy. Note, that tests in `pypy/lib/test2`_ are allowed and encouraged to let their tests run at interpreter level although -``pypy/lib`` modules eventually live at PyPy's application level. +`pypy/lib/`_ modules eventually live at PyPy's application level. This allows us to quickly test our python-coded reimplementations against CPython. @@ -595,8 +601,8 @@ (XXX ensure windows compatibility for producing test reports). -Naming and directory layout -=========================== +Naming conventions and directory layout +=========================================== Directory and File Naming ------------------------- @@ -612,7 +618,6 @@ - keep filenames concise and completion-friendly. - Naming of python objects ------------------------ @@ -646,6 +651,98 @@ .. _`this document`: svn-help.html +Annotated directory structure of PyPy +------------------------------------- + +Here is a fully annotated alphabetical two-level deep +directory verview of PyPy: + +============================ =========================================== +Directory explanation/links +============================ =========================================== +`annotation/`_ type inferencing code for `RPython`_ programs + +`documentation/`_ text versions of PyPy `documentation`_ files shown on the website + +`documentation/revreport/`_ the source code for the `revision report`_ + +`documentation/website/`_ text versions of the navigation webpages + +`interpreter/`_ bytecode interpreter and related objects (frames, functions, modules,...) + +`lib/`_ PyPy's wholesale reimplementations of CPython modules_ + +`lib/test2/`_ tests running at interp-level against the reimplementations + +`module/`_ contains `mixed modules`_ implementing core modules with + both application and interpreter level code + +`module/_sre_pypy/`_ an experimental approach wrapping CPython's ``_sre`` module + without using faking + +`module/builtin/`_ full implementation of CPython's ``__builtin__`` module. + +`module/parser/`_ parser package from Jonathan David Riehl's `basil`_ package + +`module/recparser/`_ parser package from Logilab + +`module/sys2/`_ implementation of CPython's ``sys`` module. + +`objspace/`_ `object space`_ implementations + +`objspace/trace.py`_ the `trace object space`_ monitoring bytecode and space operations + +`objspace/thunk.py`_ the `thunk object space`_, providing unique object features + +`objspace/flow/`_ the FlowObjSpace_ implementing `abstract interpretation` + +`objspace/std/`_ the StdObjSpace_ implementing CPython's objects and types + +`rpython/`_ the `RPython Typer`_ + +`tool/`_ various utilities and hacks used from various places + +`tool/pytest/`_ support code for our `testing methods`_ + +`tool/tb_server/`_ a somewhat outdated http-server for presenting + tracebacks in a helpful manner + +`translator/`_ translation_ backends and support code + +`translator/genc/`_ the `GenC backend`_ producing a CPython C-extension + module from a given RPython program. + +`translator/java/`_ experimental code to utilize Java for annotation + +`translator/llvm/`_ contains the `LLVM backend`_ producing LLVM assembler + from fully annotated RPython programs + +`translator/tool/`_ helper tools for translation + +``*/test/`` many directories have a test subdirectory containing test + modules (see `Testing in PyPy`_) + +``_cache/`` holds cache files from internally translating application + level to interpreterlevel code. (XXXM0.5 insert link here + when geninterp documentation is there). + +============================ =========================================== + +.. _`basil`: http://people.cs.uchicago.edu/~jriehl/BasilTalk.pdf +.. _`object space`: objspace.html +.. _`documentation`: index.html +.. _FlowObjSpace: objspace.html#the-flow-object-space +.. _`trace object space`: objspace.html#the-trace-object-space +.. _`thunk object space`: objspace.html#the-thunk-object-space +.. _StdObjSpace: objspace.html#the-standard-object-space +.. _`abstract interpretation`: theory.html#abstract-interpretation +.. _`RPython Typer`: translation.html#rpython-typer +.. _`testing methods`: coding-guide.html#testing-in-pypy +.. _`translation`: translation.html +.. _`GenC backend`: translation.html#genc +.. _`LLVM backend`: translation.html#llvm +.. _`revision report`: http://codespeak.net/pypy/rev/current + .. _`using development tracker`: Using the development bug/feature tracker @@ -831,3 +928,4 @@ which will check that remote URLs are reachable. +.. include:: _ref.txt Modified: pypy/dist/pypy/documentation/translation.txt ============================================================================== --- pypy/dist/pypy/documentation/translation.txt (original) +++ pypy/dist/pypy/documentation/translation.txt Wed May 18 20:51:15 2005 @@ -429,7 +429,7 @@ Overview -------- -The RPython Typer is the bridge between the _Annotator and the low-level code generators. The annotator computes types (or "annotations") that are high-level, in the sense that they describe RPython types like lists or instances of user-defined classes. In general, though, to emit code we need to represent these high-level annotations into the low-level model of the target language; for C, this means structures and pointers and arrays. The Typer both determines the appropriate low-level type for each annotation, and tries to replace *all* operations in the control flow graphs with one or a few low-level operations. Just like low-level types, there is only a fairly restricted set of low-level operations, along the lines of reading or writing from or to a field of a structure. +The RPython Typer is the bridge between the Annotator_ and the low-level code generators. The annotator computes types (or "annotations") that are high-level, in the sense that they describe RPython types like lists or instances of user-defined classes. In general, though, to emit code we need to represent these high-level annotations into the low-level model of the target language; for C, this means structures and pointers and arrays. The Typer both determines the appropriate low-level type for each annotation, and tries to replace *all* operations in the control flow graphs with one or a few low-level operations. Just like low-level types, there is only a fairly restricted set of low-level operations, along the lines of reading or writing from or to a field of a structure. In theory, this step is optional; some code generators might be able to read directly the high-level types. However, we expect that case to be the exception. "Compiling" high-level types into low-level ones is rather more messy than one would expect. This was the motivation for making this step explicit and isolated in a single place. After Typing, the graphs can only contain very few operations, which makes the job of the code generators much simpler. @@ -569,6 +569,7 @@ .. _C: +.. _GenC: The C Back-End ============== From pedronis at codespeak.net Wed May 18 20:52:56 2005 From: pedronis at codespeak.net (pedronis at codespeak.net) Date: Wed, 18 May 2005 20:52:56 +0200 (CEST) Subject: [pypy-svn] r12474 - pypy/dist/pypy/documentation Message-ID: <20050518185256.6B3EE27BBD@code1.codespeak.net> Author: pedronis Date: Wed May 18 20:52:56 2005 New Revision: 12474 Modified: pypy/dist/pypy/documentation/release-0.6.txt Log: some edits/additions Modified: pypy/dist/pypy/documentation/release-0.6.txt ============================================================================== --- pypy/dist/pypy/documentation/release-0.6.txt (original) +++ pypy/dist/pypy/documentation/release-0.6.txt Wed May 18 20:52:56 2005 @@ -48,10 +48,12 @@ - an experimental object space that does extensive tracing of object operations; - - an object space that implements lazy values and a 'become' + - the 'thunk' object space that implements lazy values and a 'become' operation that can exchange object identities. *These spaces already give a glimpse in the flexibility potential of PyPy*. + (see demo/fibonacci.py and demo/sharedref.py for examples about the 'thunk' + object space) * The core of PyPy only implements new-style classes, old-style classes are basically implemented, apart some hooks, as what is in @@ -63,14 +65,19 @@ speed, for that we have developed what we call the annotator, which is capable of reconstructing type information for our code-base, which is written respecting some restrictions, and similarly written - code. The annotator right now is already capable of type annotating - basically *all* of PyPy code-base, and is included with 0.6. + code. The annotator right now is already capable of successfully + type annotating basically *all* of PyPy code-base, and is included + with 0.6. * From type annotated code low-level code needs to be generated, backends for various targets (C, LLVM,...) are included, they are all somehow incomplete and have been and are quite in flux. What is - shipped with 0.6 is able to deal with more or less small example - functions. + shipped with 0.6 is able to deal with more or less small/medium examples. + +`Getting started`_ has more information about how to try out these features +and tools. + +.. _`Getting started`: getting_started.html Ongoing work and near term goals --------------------------------- From hpk at codespeak.net Wed May 18 20:54:03 2005 From: hpk at codespeak.net (hpk at codespeak.net) Date: Wed, 18 May 2005 20:54:03 +0200 (CEST) Subject: [pypy-svn] r12475 - pypy/dist/pypy/documentation Message-ID: <20050518185403.8A96727BBD@code1.codespeak.net> Author: hpk Date: Wed May 18 20:54:03 2005 New Revision: 12475 Modified: pypy/dist/pypy/documentation/coding-guide.txt Log: issue48 testing here is the real commit log regarding the issue48 (describe all directories). I played around with ReST and now the list of directories is a table with an explanation column. directory references are taken from the common _ref.txt with an include directive at the end of coding-guide.txt. The directory-thingie took me at least two hours longer than i though but i think it's now good enough to be considered for a prominent location like getting-started. Modified: pypy/dist/pypy/documentation/coding-guide.txt ============================================================================== --- pypy/dist/pypy/documentation/coding-guide.txt (original) +++ pypy/dist/pypy/documentation/coding-guide.txt Wed May 18 20:54:03 2005 @@ -725,7 +725,6 @@ ``_cache/`` holds cache files from internally translating application level to interpreterlevel code. (XXXM0.5 insert link here when geninterp documentation is there). - ============================ =========================================== .. _`basil`: http://people.cs.uchicago.edu/~jriehl/BasilTalk.pdf From pedronis at codespeak.net Wed May 18 20:55:11 2005 From: pedronis at codespeak.net (pedronis at codespeak.net) Date: Wed, 18 May 2005 20:55:11 +0200 (CEST) Subject: [pypy-svn] r12476 - pypy/dist/pypy/documentation Message-ID: <20050518185511.6716F27BBD@code1.codespeak.net> Author: pedronis Date: Wed May 18 20:55:10 2005 New Revision: 12476 Modified: pypy/dist/pypy/documentation/release-0.6.txt Log: minor edit Modified: pypy/dist/pypy/documentation/release-0.6.txt ============================================================================== --- pypy/dist/pypy/documentation/release-0.6.txt (original) +++ pypy/dist/pypy/documentation/release-0.6.txt Wed May 18 20:55:10 2005 @@ -51,9 +51,9 @@ - the 'thunk' object space that implements lazy values and a 'become' operation that can exchange object identities. - *These spaces already give a glimpse in the flexibility potential of PyPy*. - (see demo/fibonacci.py and demo/sharedref.py for examples about the 'thunk' - object space) + *These spaces already give a glimpse in the flexibility potential of + PyPy*. (See demo/fibonacci.py and demo/sharedref.py for examples + about the 'thunk' object space.) * The core of PyPy only implements new-style classes, old-style classes are basically implemented, apart some hooks, as what is in From hpk at codespeak.net Wed May 18 21:20:17 2005 From: hpk at codespeak.net (hpk at codespeak.net) Date: Wed, 18 May 2005 21:20:17 +0200 (CEST) Subject: [pypy-svn] r12479 - pypy/dist/pypy/documentation Message-ID: <20050518192017.BD1CA27BC2@code1.codespeak.net> Author: hpk Date: Wed May 18 21:20:17 2005 New Revision: 12479 Modified: pypy/dist/pypy/documentation/coding-guide.txt pypy/dist/pypy/documentation/getting_started.txt Log: issue48 testing Move the annotated directory structure to the getting-started page because armin and me think it's pretty helpful. I consider the directory-structure final now except that it might make sense to add some more links. Modified: pypy/dist/pypy/documentation/coding-guide.txt ============================================================================== --- pypy/dist/pypy/documentation/coding-guide.txt (original) +++ pypy/dist/pypy/documentation/coding-guide.txt Wed May 18 21:20:17 2005 @@ -651,96 +651,6 @@ .. _`this document`: svn-help.html -Annotated directory structure of PyPy -------------------------------------- - -Here is a fully annotated alphabetical two-level deep -directory verview of PyPy: - -============================ =========================================== -Directory explanation/links -============================ =========================================== -`annotation/`_ type inferencing code for `RPython`_ programs - -`documentation/`_ text versions of PyPy `documentation`_ files shown on the website - -`documentation/revreport/`_ the source code for the `revision report`_ - -`documentation/website/`_ text versions of the navigation webpages - -`interpreter/`_ bytecode interpreter and related objects (frames, functions, modules,...) - -`lib/`_ PyPy's wholesale reimplementations of CPython modules_ - -`lib/test2/`_ tests running at interp-level against the reimplementations - -`module/`_ contains `mixed modules`_ implementing core modules with - both application and interpreter level code - -`module/_sre_pypy/`_ an experimental approach wrapping CPython's ``_sre`` module - without using faking - -`module/builtin/`_ full implementation of CPython's ``__builtin__`` module. - -`module/parser/`_ parser package from Jonathan David Riehl's `basil`_ package - -`module/recparser/`_ parser package from Logilab - -`module/sys2/`_ implementation of CPython's ``sys`` module. - -`objspace/`_ `object space`_ implementations - -`objspace/trace.py`_ the `trace object space`_ monitoring bytecode and space operations - -`objspace/thunk.py`_ the `thunk object space`_, providing unique object features - -`objspace/flow/`_ the FlowObjSpace_ implementing `abstract interpretation` - -`objspace/std/`_ the StdObjSpace_ implementing CPython's objects and types - -`rpython/`_ the `RPython Typer`_ - -`tool/`_ various utilities and hacks used from various places - -`tool/pytest/`_ support code for our `testing methods`_ - -`tool/tb_server/`_ a somewhat outdated http-server for presenting - tracebacks in a helpful manner - -`translator/`_ translation_ backends and support code - -`translator/genc/`_ the `GenC backend`_ producing a CPython C-extension - module from a given RPython program. - -`translator/java/`_ experimental code to utilize Java for annotation - -`translator/llvm/`_ contains the `LLVM backend`_ producing LLVM assembler - from fully annotated RPython programs - -`translator/tool/`_ helper tools for translation - -``*/test/`` many directories have a test subdirectory containing test - modules (see `Testing in PyPy`_) - -``_cache/`` holds cache files from internally translating application - level to interpreterlevel code. (XXXM0.5 insert link here - when geninterp documentation is there). -============================ =========================================== - -.. _`basil`: http://people.cs.uchicago.edu/~jriehl/BasilTalk.pdf -.. _`object space`: objspace.html -.. _`documentation`: index.html -.. _FlowObjSpace: objspace.html#the-flow-object-space -.. _`trace object space`: objspace.html#the-trace-object-space -.. _`thunk object space`: objspace.html#the-thunk-object-space -.. _StdObjSpace: objspace.html#the-standard-object-space -.. _`abstract interpretation`: theory.html#abstract-interpretation -.. _`RPython Typer`: translation.html#rpython-typer -.. _`testing methods`: coding-guide.html#testing-in-pypy -.. _`translation`: translation.html -.. _`GenC backend`: translation.html#genc -.. _`LLVM backend`: translation.html#llvm -.. _`revision report`: http://codespeak.net/pypy/rev/current .. _`using development tracker`: Modified: pypy/dist/pypy/documentation/getting_started.txt ============================================================================== --- pypy/dist/pypy/documentation/getting_started.txt (original) +++ pypy/dist/pypy/documentation/getting_started.txt Wed May 18 21:20:17 2005 @@ -484,12 +484,107 @@ .. _pypy/annotation: http://codespeak.net/svn/pypy/dist/pypy/annotation/ .. _pypy/translator/annrpython.py: http://codespeak.net/svn/pypy/dist/pypy/translator/annrpython.py .. _mailing lists: http://codespeak.net/pypy/index.cgi?lists -.. _documentation: http://codespeak.net/pypy/index.cgi?doc +.. _documentation: index.html .. _wiki: http://codespeak.net/moin/pypy/moin.cgi/FrontPage?action=show .. _unit tests: http://codespeak.net/pypy/index.cgi?doc/testdesign.html .. _bug reports: https://codespeak.net/issue/pypy-dev/ +Annotated PyPy directory structure of PyPy +======================================================== +Here is a fully annotated alphabetical two-level deep +directory verview of PyPy: + +============================ =========================================== +Directory explanation/links +============================ =========================================== +`annotation/`_ `type inferencing code`_ for `RPython`_ programs + +`documentation/`_ text versions of PyPy `documentation`_ files shown on the website + +`documentation/revreport/`_ the source code for the `revision report`_ + +`documentation/website/`_ text versions of the navigation webpages + +`interpreter/`_ bytecode interpreter and related objects (frames, functions, modules,...) + +`lib/`_ PyPy's wholesale reimplementations of CPython modules_ + +`lib/test2/`_ tests running at interp-level against the reimplementations + +`module/`_ contains `mixed modules`_ implementing core modules with + both application and interpreter level code + +`module/_sre_pypy/`_ an experimental approach wrapping CPython's ``_sre`` module + without using faking + +`module/builtin/`_ full implementation of CPython's ``__builtin__`` module. + +`module/parser/`_ parser package from Jonathan David Riehl's `basil`_ package + +`module/recparser/`_ parser package from Logilab + +`module/sys2/`_ implementation of CPython's ``sys`` module. + +`objspace/`_ `object space`_ implementations + +`objspace/trace.py`_ the `trace object space`_ monitoring bytecode and space operations + +`objspace/thunk.py`_ the `thunk object space`_, providing unique object features + +`objspace/flow/`_ the FlowObjSpace_ implementing `abstract interpretation` + +`objspace/std/`_ the StdObjSpace_ implementing CPython's objects and types + +`rpython/`_ the `RPython Typer`_ + +`tool/`_ various utilities and hacks used from various places + +`tool/pytest/`_ support code for our `testing methods`_ + +`tool/tb_server/`_ a somewhat outdated http-server for presenting + tracebacks in a helpful manner + +`translator/`_ translation_ backends and support code + +`translator/genc/`_ the `GenC backend`_ producing a CPython C-extension + module from a given RPython program. + +`translator/java/`_ experimental code to utilize Java for annotation + +`translator/llvm/`_ contains the `LLVM backend`_ producing LLVM assembler + from fully annotated RPython programs + +`translator/tool/`_ helper tools for translation + +``*/test/`` many directories have a test subdirectory containing test + modules (see `Testing in PyPy`_) + +``_cache/`` holds cache files from internally translating application + level to interpreterlevel code. (XXXM0.5 insert link here + when geninterp documentation is there). +============================ =========================================== + +.. _`Testing in PyPy`: coding-guide.html#testing-in-pypy +.. _`mixed modules`: coding-guide.html#mixed-modules +.. _`modules`: coding-guide.html#modules +.. _`basil`: http://people.cs.uchicago.edu/~jriehl/BasilTalk.pdf +.. _`object space`: objspace.html +.. _FlowObjSpace: objspace.html#the-flow-object-space +.. _`trace object space`: objspace.html#the-trace-object-space +.. _`thunk object space`: objspace.html#the-thunk-object-space +.. _StdObjSpace: objspace.html#the-standard-object-space +.. _`abstract interpretation`: theory.html#abstract-interpretation +.. _`rpython`: coding-guide#rpython +.. _`type inferencing code`: translation#the-annotation-pass +.. _`RPython Typer`: translation.html#rpython-typer +.. _`testing methods`: coding-guide.html#testing-in-pypy +.. _`translation`: translation.html +.. _`GenC backend`: translation.html#genc +.. _`LLVM backend`: translation.html#llvm +.. _`revision report`: http://codespeak.net/pypy/rev/current .. _subversion: svn-help.html + +.. include:: _ref.txt From pedronis at codespeak.net Wed May 18 21:23:17 2005 From: pedronis at codespeak.net (pedronis at codespeak.net) Date: Wed, 18 May 2005 21:23:17 +0200 (CEST) Subject: [pypy-svn] r12480 - pypy/dist/pypy/documentation Message-ID: <20050518192317.A4D9327BB2@code1.codespeak.net> Author: pedronis Date: Wed May 18 21:23:17 2005 New Revision: 12480 Modified: pypy/dist/pypy/documentation/release-0.6.txt Log: added links Modified: pypy/dist/pypy/documentation/release-0.6.txt ============================================================================== --- pypy/dist/pypy/documentation/release-0.6.txt (original) +++ pypy/dist/pypy/documentation/release-0.6.txt Wed May 18 21:23:17 2005 @@ -30,7 +30,15 @@ For download links and further information and documentation see (most of PyPy is realeased under the MIT license): -**xxx LINKS to codespeak/pypy, getting started and the download** +- `Download PyPy 0.6`: _ +- `Getting started`_ +- `PyPy Documentation` +- `PyPy Homepage`_ + +.. _`Download PyPy 0.6`: xxx +.. _`Getting started`: http://codespeak.net/pypy/index.cgi?doc/getting_started.html +.. _`PyPy Documentation`: http://codespeak.net/pypy/index.cgi?doc +.. _`PyPy Homepage`: http://codespeak.net/pypy/ Interesting bits and highlights @@ -77,7 +85,7 @@ `Getting started`_ has more information about how to try out these features and tools. -.. _`Getting started`: getting_started.html +.. _`Getting started`: http://codespeak.net/pypy/index.cgi?doc/getting_started.html Ongoing work and near term goals --------------------------------- @@ -93,7 +101,8 @@ **xxx all contributor names in some order (?)** -PyPy development and activities happens as open source source project under the codespeak -(xxx link) umbrella and through a consortium funded by a EU IST research grant: +PyPy development and activities happens as open source source project under the codespeak_ umbrella and through a consortium funded by a EU IST research grant: -**(xxx consortium partners?? )** \ No newline at end of file +**(xxx consortium partners?? )** + +.. _codespeak: http://codespeak.net/ \ No newline at end of file From hpk at codespeak.net Wed May 18 21:30:05 2005 From: hpk at codespeak.net (hpk at codespeak.net) Date: Wed, 18 May 2005 21:30:05 +0200 (CEST) Subject: [pypy-svn] r12482 - pypy/dist/pypy/documentation Message-ID: <20050518193005.5A7E527BB2@code1.codespeak.net> Author: hpk Date: Wed May 18 21:30:05 2005 New Revision: 12482 Modified: pypy/dist/pypy/documentation/getting_started.txt Log: ok ok. Modified: pypy/dist/pypy/documentation/getting_started.txt ============================================================================== --- pypy/dist/pypy/documentation/getting_started.txt (original) +++ pypy/dist/pypy/documentation/getting_started.txt Wed May 18 21:30:05 2005 @@ -494,7 +494,7 @@ ======================================================== Here is a fully annotated alphabetical two-level deep -directory verview of PyPy: +directory overview of PyPy: ============================ =========================================== Directory explanation/links From arigo at codespeak.net Wed May 18 21:34:07 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Wed, 18 May 2005 21:34:07 +0200 (CEST) Subject: [pypy-svn] r12483 - in pypy/dist/pypy: annotation interpreter objspace objspace/flow objspace/std rpython tool tool/test translator/genc Message-ID: <20050518193407.A3C2627BB2@code1.codespeak.net> Author: arigo Date: Wed May 18 21:34:06 2005 New Revision: 12483 Removed: pypy/dist/pypy/tool/compile.py pypy/dist/pypy/tool/dotypes.py pypy/dist/pypy/tool/example_pytest.py pypy/dist/pypy/tool/fiximport.py pypy/dist/pypy/tool/hack.py pypy/dist/pypy/tool/methodChecker.py pypy/dist/pypy/tool/ppdb.py pypy/dist/pypy/tool/stdprofile.py pypy/dist/pypy/tool/template.py pypy/dist/pypy/tool/test/test_utestconvert.py pypy/dist/pypy/tool/test/test_utestconvert2.py pypy/dist/pypy/tool/testpm.py pypy/dist/pypy/tool/utestconvert.py Modified: pypy/dist/pypy/annotation/bookkeeper.py pypy/dist/pypy/interpreter/gateway.py pypy/dist/pypy/interpreter/pycode.py pypy/dist/pypy/interpreter/pyopcode.py pypy/dist/pypy/interpreter/typedef.py pypy/dist/pypy/objspace/descroperation.py pypy/dist/pypy/objspace/flow/operation.py pypy/dist/pypy/objspace/std/multimethod.py pypy/dist/pypy/objspace/std/stdtypedef.py pypy/dist/pypy/rpython/rlist.py pypy/dist/pypy/tool/alarm.py pypy/dist/pypy/tool/ansi_print.py pypy/dist/pypy/tool/fixeol pypy/dist/pypy/tool/opcode.py pypy/dist/pypy/tool/option.py pypy/dist/pypy/tool/sourcetools.py pypy/dist/pypy/tool/test/test_template.py pypy/dist/pypy/tool/traceop.py pypy/dist/pypy/tool/udir.py pypy/dist/pypy/tool/unionfind.py pypy/dist/pypy/translator/genc/funcdef.py Log: issue47 testing First phase of clean-up of the 'tool' directory. Includes a merge of compile.py, hack.py and template.py into sourcetools.py, which triggers a host of import fixes all over the place. Files that have been fully deleted: D pypy/tool/example_pytest.py D pypy/tool/methodChecker.py D pypy/tool/stdprofile.py D pypy/tool/testpm.py D pypy/tool/fiximport.py D pypy/tool/ppdb.py D pypy/tool/dotypes.py The content of the other removed files was moved somewhere else. Modified: pypy/dist/pypy/annotation/bookkeeper.py ============================================================================== --- pypy/dist/pypy/annotation/bookkeeper.py (original) +++ pypy/dist/pypy/annotation/bookkeeper.py Wed May 18 21:34:06 2005 @@ -10,7 +10,7 @@ from pypy.annotation.classdef import ClassDef from pypy.annotation.listdef import ListDef, MOST_GENERAL_LISTDEF from pypy.annotation.dictdef import DictDef, MOST_GENERAL_DICTDEF -from pypy.tool.hack import func_with_new_name +from pypy.tool.sourcetools import func_with_new_name from pypy.interpreter.pycode import CO_VARARGS from pypy.interpreter.pycode import cpython_code_signature from pypy.interpreter.argument import ArgErr Modified: pypy/dist/pypy/interpreter/gateway.py ============================================================================== --- pypy/dist/pypy/interpreter/gateway.py (original) +++ pypy/dist/pypy/interpreter/gateway.py Wed May 18 21:34:06 2005 @@ -11,15 +11,14 @@ NoneNotWrapped = object() -from pypy.tool import hack +from pypy.tool.sourcetools import func_with_new_name from pypy.interpreter.error import OperationError from pypy.interpreter import eval from pypy.interpreter.function import Function, Method from pypy.interpreter.baseobjspace import W_Root, ObjSpace, BaseWrappable from pypy.interpreter.baseobjspace import Wrappable, SpaceCache from pypy.interpreter.argument import Arguments -from pypy.tool.compile import compile2 -from pypy.tool.sourcetools import NiceCompile +from pypy.tool.sourcetools import NiceCompile, compile2 # internal non-translatable parts: import py @@ -542,7 +541,7 @@ def get_function(space): w_func = self.wget(space, name) return space.unwrap(w_func) - appcaller = hack.func_with_new_name(appcaller, name) + appcaller = func_with_new_name(appcaller, name) appcaller.get_function = get_function return appcaller Modified: pypy/dist/pypy/interpreter/pycode.py ============================================================================== --- pypy/dist/pypy/interpreter/pycode.py (original) +++ pypy/dist/pypy/interpreter/pycode.py Wed May 18 21:34:06 2005 @@ -58,7 +58,7 @@ def fresh_GeneratorFrame_methods(): import types - from pypy.tool.hack import func_with_new_name + from pypy.tool.sourcetools import func_with_new_name dic = GeneratorFrame.__dict__.copy() for n in dic: x = dic[n] Modified: pypy/dist/pypy/interpreter/pyopcode.py ============================================================================== --- pypy/dist/pypy/interpreter/pyopcode.py (original) +++ pypy/dist/pypy/interpreter/pyopcode.py Wed May 18 21:34:06 2005 @@ -10,7 +10,7 @@ from pypy.interpreter.miscutils import InitializedClass from pypy.interpreter.argument import Arguments from pypy.interpreter.pycode import PyCode -from pypy.tool import hack +from pypy.tool.sourcetools import func_with_new_name def unaryoperation(operationname): """NOT_RPYTHON""" @@ -20,7 +20,7 @@ w_result = operation(w_1) f.valuestack.push(w_result) - return hack.func_with_new_name(opimpl, "opcode_impl_for_%s" % operationname) + return func_with_new_name(opimpl, "opcode_impl_for_%s" % operationname) def binaryoperation(operationname): """NOT_RPYTHON""" @@ -31,7 +31,7 @@ w_result = operation(w_1, w_2) f.valuestack.push(w_result) - return hack.func_with_new_name(opimpl, "opcode_impl_for_%s" % operationname) + return func_with_new_name(opimpl, "opcode_impl_for_%s" % operationname) class PyInterpFrame(pyframe.PyFrame): Modified: pypy/dist/pypy/interpreter/typedef.py ============================================================================== --- pypy/dist/pypy/interpreter/typedef.py (original) +++ pypy/dist/pypy/interpreter/typedef.py Wed May 18 21:34:06 2005 @@ -6,7 +6,7 @@ from pypy.interpreter.baseobjspace import BaseWrappable, Wrappable from pypy.interpreter.error import OperationError from pypy.tool.cache import Cache -from pypy.tool.compile import compile2 +from pypy.tool.sourcetools import compile2 import new class TypeDef: Modified: pypy/dist/pypy/objspace/descroperation.py ============================================================================== --- pypy/dist/pypy/objspace/descroperation.py (original) +++ pypy/dist/pypy/objspace/descroperation.py Wed May 18 21:34:06 2005 @@ -4,7 +4,7 @@ from pypy.interpreter.function import Function from pypy.interpreter.gateway import BuiltinCode from pypy.interpreter.argument import Arguments -from pypy.tool.compile import compile2 +from pypy.tool.sourcetools import compile2, func_with_new_name def raiseattrerror(space, w_obj, name, w_descr=None): w_type = space.type(w_obj) @@ -444,8 +444,6 @@ # regular methods def helpers -from pypy.tool.hack import func_with_new_name - def _make_binop_impl(symbol, specialnames): left, right = specialnames def binop_impl(space, w_obj1, w_obj2): Modified: pypy/dist/pypy/objspace/flow/operation.py ============================================================================== --- pypy/dist/pypy/objspace/flow/operation.py (original) +++ pypy/dist/pypy/objspace/flow/operation.py Wed May 18 21:34:06 2005 @@ -4,7 +4,7 @@ """ from pypy.interpreter.baseobjspace import ObjSpace import operator, types, __future__ -from pypy.tool.compile import compile2 +from pypy.tool.sourcetools import compile2 FunctionByName = {} # dict {"operation_name": } OperationName = {} # dict {: "operation_name"} Modified: pypy/dist/pypy/objspace/std/multimethod.py ============================================================================== --- pypy/dist/pypy/objspace/std/multimethod.py (original) +++ pypy/dist/pypy/objspace/std/multimethod.py Wed May 18 21:34:06 2005 @@ -1,5 +1,5 @@ -from pypy.tool.compile import compile2 +from pypy.tool.sourcetools import compile2 class FailedToImplement(Exception): def __init__(self, w_type=None, w_value=None): Modified: pypy/dist/pypy/objspace/std/stdtypedef.py ============================================================================== --- pypy/dist/pypy/objspace/std/stdtypedef.py (original) +++ pypy/dist/pypy/objspace/std/stdtypedef.py Wed May 18 21:34:06 2005 @@ -4,7 +4,7 @@ from pypy.interpreter.typedef import descr_get_dict, descr_set_dict from pypy.interpreter.baseobjspace import SpaceCache from pypy.objspace.std.model import MultiMethod, FailedToImplement -from pypy.tool.compile import compile2 +from pypy.tool.sourcetools import compile2 __all__ = ['StdTypeDef', 'newmethod', 'gateway', 'GetSetProperty', 'Member', Modified: pypy/dist/pypy/rpython/rlist.py ============================================================================== --- pypy/dist/pypy/rpython/rlist.py (original) +++ pypy/dist/pypy/rpython/rlist.py Wed May 18 21:34:06 2005 @@ -1,7 +1,7 @@ import py from pypy.annotation.model import * from pypy.rpython.lltypes import * -from pypy.tool.template import compile_template +from pypy.tool.sourcetools import compile_template class ListType: Modified: pypy/dist/pypy/tool/alarm.py ============================================================================== --- pypy/dist/pypy/tool/alarm.py (original) +++ pypy/dist/pypy/tool/alarm.py Wed May 18 21:34:06 2005 @@ -1,3 +1,11 @@ +""" +Usage: + + python alarm.py + +Run the given script. If the timeout elapses, trying interrupting it by +sending KeyboardInterrupts. +""" import traceback Modified: pypy/dist/pypy/tool/ansi_print.py ============================================================================== --- pypy/dist/pypy/tool/ansi_print.py (original) +++ pypy/dist/pypy/tool/ansi_print.py Wed May 18 21:34:06 2005 @@ -1,3 +1,7 @@ +""" +A color print. +""" + import sys def ansi_print(text, esc, file=None): Deleted: /pypy/dist/pypy/tool/compile.py ============================================================================== --- /pypy/dist/pypy/tool/compile.py Wed May 18 21:34:06 2005 +++ (empty file) @@ -1,23 +0,0 @@ -from __future__ import generators -cache = {} - -import py -DEBUG = 1 - -def compile2(source, filename='', mode='exec', flags= - generators.compiler_flag, dont_inherit=0): - """ central compile hook for pypy initialization - purposes. - """ - key = (source, filename, mode, flags) - try: - co = cache[key] - #print "***** duplicate code ******* " - #print source - except KeyError: - if DEBUG: - co = py.code.compile(source, filename, mode, flags) - else: - co = compile(source, filename, mode, flags) - cache[key] = co - return co Deleted: /pypy/dist/pypy/tool/dotypes.py ============================================================================== --- /pypy/dist/pypy/tool/dotypes.py Wed May 18 21:34:06 2005 +++ (empty file) @@ -1,57 +0,0 @@ -#! /usr/bin/env python - -import types -import __builtin__ -builtinitems = vars(__builtin__).iteritems -import sys - -typesdone = {} -exports = [] - -def dotype(synonym): - typeobject = getattr(types, synonym) - if type(typeobject) is not type: return - exports.append(synonym) - if typeobject in typesdone: - print 'setattr(_types, %r, %s)' % (synonym, typeobject.__name__) - print - return - typesdone[typeobject] = 1 - - typename = typeobject.__name__ - typetitle = typename.title() - print 'class %s(object):' % typename - print - print ''' def __new__(cls, *args): - if cls is %s: - return pypy.%sObjectFactory(args) - else: - return pypy.UserObjectFactory(cls, pypy.%sObjectFactory, args) - - def __repr__(self): - return str(self) -''' % (typename, typetitle, typetitle) - - sys.stdout.write('_register(pypy.%sObjectFactory, %s'%(typetitle, typename)) - - for n, v in builtinitems(): - if v is typeobject: - if n != typename: - sys.stdout.write(', in_builtin=%r' % n) - break - else: - sys.stdout.write(', in_builtin=False') - - default_synonym = typetitle + 'Type' - if synonym != default_synonym: - sys.stdout.write(', synonym=%r' % synonym) - sys.stdout.write(')\n') - - print - print - -for synonym in dir(types): - dotype(synonym) -print -print '__all__ = %r' % exports - Deleted: /pypy/dist/pypy/tool/example_pytest.py ============================================================================== --- /pypy/dist/pypy/tool/example_pytest.py Wed May 18 21:34:06 2005 +++ (empty file) @@ -1,26 +0,0 @@ -class AppTestTest: - def test_app_method(self): - assert 42 == 41 - -def app_test_app_func(): - assert 41 == 42 - -def test_interp_func(space): - assert space.is_true(space.w_None) - -class TestInterpTest: - def test_interp_method(self): - assert self.space.is_true(self.space.w_False) - -def app_test_raises_something(): - int("hallo") - -def app_test_raises_wrong1(): - raises(SyntaxError, 'int("hello")') - -def app_test_raises_wrong2(): - raises(SyntaxError, int, "hello") - -def app_test_raises_doesnt(): - raises(ValueError, int, 3) - Modified: pypy/dist/pypy/tool/fixeol ============================================================================== --- pypy/dist/pypy/tool/fixeol (original) +++ pypy/dist/pypy/tool/fixeol Wed May 18 21:34:06 2005 @@ -1,4 +1,12 @@ #! /usr/bin/env python +""" +This script walks over the files and subdirs of the specified directories +('.' by default), and changes the svn properties to match the PyPy guidelines: + + svn:ignore includes '*.pyc' and '*.pyo' for all directories + svn:eol-style is 'native' for *.py and *.txt files + +""" import sys, os import autopath Deleted: /pypy/dist/pypy/tool/fiximport.py ============================================================================== --- /pypy/dist/pypy/tool/fiximport.py Wed May 18 21:34:06 2005 +++ (empty file) @@ -1,188 +0,0 @@ -import sys -import re -import parser - -blank_re=re.compile(r"\s*(#.*)?") - -def get_indent(line): - indent = re.match(blank_re,line).group() - return indent, indent==line - -def read_whole_suite(intro_line): - base_indent, dummy = get_indent(intro_line) - lines = [] - cont = [] - parsing_prefix = "" - if len(base_indent) > 0: - parsing_prefix = "if 0:\n" - while True: - line = f.readline() - if not line: - break - indent, isblank = get_indent(line) - if isblank: - pass - elif cont: - cont.append(line) - try: - parser.suite(parsing_prefix+''.join(cont)) - except SyntaxError: - pass - else: - cont = [] - else: - if len(indent) <= len(base_indent): - pushback.append(line) - break - try: - parser.suite(parsing_prefix+line) - except SyntaxError: - cont = [line] - lines.append(line) - - return base_indent,lines - -pass_re = re.compile(r"^\s*pass\s*$") -getobjspace_re = re.compile(r"testit\.objspace\((.*)\)") -setspace_re = re.compile(r"self\.space\s*=\s*") - -def up_down_port(lines): - npass = 0 - nblank = 0 - objspace = None - n = -1 - for line in lines: - n += 1 - dummy, isblank = get_indent(line) - if isblank: - nblank += 1 - continue - if re.match(pass_re, line): - npass += 1 - continue - m = re.search(getobjspace_re, line) - if m: - objspace = m.group(1) - line = line[:m.start()]+"self.space"+line[m.end():] - line = re.sub(setspace_re,"",line) - if line.strip() == "self.space": - line = "" - nblank += 1 - lines[n] = line - - skip = npass+nblank == len(lines) - - return objspace,skip - - -# option -o let you pick a default objspace which will be enforced -# trough a module global objspacename = - -default_objspace = None - -if sys.argv[1].startswith('-o'): - default_objspace = sys.argv[1][2:] - files = sys.argv[2:] -else: - files = sys.argv[1:] - -print "-- default-objspace: %s" % default_objspace - -for fn in files: - print fn - lines = [] - pushback = [] - kind = None - f = file(fn, 'r') - - global_objspacename = False - confused = False - - import_autopath_lineno = -1 - - while True: - if pushback: - line = pushback.pop() - else: - line = f.readline() - if not line: - break - rline = line.rstrip() - if rline == 'from pypy.tool import testit': - continue - if (rline == "if __name__ == '__main__':" or - rline == 'if __name__ == "__main__":'): - tail = f.read() - if tail.strip() != 'testit.main()': - print ' * uncommon __main__ lines at the end' - confused = True - break - if default_objspace and not global_objspacename and (line.startswith('def ') or line.startswith('class ')): - lines.extend(["objspacename = %r\n" % default_objspace,"\n"]) - global_objspacename = True - - if line.strip() == 'def setUp(self):': - base_indent,suite = read_whole_suite(line) - objspace,skip = up_down_port(suite) - #print suite - if objspace: - if default_objspace: - if eval(objspace) != default_objspace: - print "* default objspace mismatch: %s" % objspace - confused = True - continue - else: - lines.append(base_indent+"objspacename = %s\n" % objspace) - lines.append("\n") - if not skip: - lines.append(base_indent+"def setup_method(self,method):\n") - lines.extend(suite) - continue - if line.strip() == 'def tearDown(self):': - base_indent, suite = read_whole_suite(line) - unexpected,skip = up_down_port(suite) - if unexpected is not None: - print "* testit.objspace() in tearDown" - confused = True - #print suite - if not skip: - lines.append(base_indent+"def teardown_method(self,method):\n") - lines.extend(suite) - continue - if line.startswith('class '): - rest = line[6:].strip() - if rest.endswith('(testit.AppTestCase):'): - rest = rest[:-21].strip() + ':' - if not rest.startswith('AppTest'): - if not rest.startswith('Test'): - rest = 'Test'+rest - rest = 'App'+rest - kind = 'app-test' - elif rest.endswith('(testit.IntTestCase):'): - rest = rest[:-21].strip() + ':' - if not rest.startswith('Test'): - rest = 'Test'+rest - kind = 'test' - elif rest.endswith('(testit.TestCase):'): - rest = rest[:-18].strip() + ':' - if not rest.startswith('Test'): - rest = 'Test'+rest - kind = 'test' - else: - print ' * ignored class', rest - line = 'class ' + rest + '\n' - if line.rstrip() == "import autopath": - import_autopath_lineno = len(lines) - lines.append(line) - f.close() - - while lines and not lines[-1].strip(): - del lines[-1] - - if confused: - print "** confused: file not changed" - else: - #sys.stdout.writelines(lines) - f = file(fn, 'w') - f.writelines(lines) - f.close() Deleted: /pypy/dist/pypy/tool/hack.py ============================================================================== --- /pypy/dist/pypy/tool/hack.py Wed May 18 21:34:06 2005 +++ (empty file) @@ -1,21 +0,0 @@ -import autopath -import new, sys - -if (sys.version_info >= (2, 3) and - not hasattr(sys, 'pypy_objspaceclass')): - def func_with_new_name(func, newname): - f = new.function(func.func_code, func.func_globals, - newname, func.func_defaults, - func.func_closure) - if func.func_dict: - f.func_dict = {} - f.func_dict.update(func.func_dict) - return f -else: - def func_with_new_name(func, newname): - return func - -if __name__ == '__main__': - def f(): pass - g = func_with_new_name(f, 'g') - print g.__name__ Deleted: /pypy/dist/pypy/tool/methodChecker.py ============================================================================== --- /pypy/dist/pypy/tool/methodChecker.py Wed May 18 21:34:06 2005 +++ (empty file) @@ -1,47 +0,0 @@ -import autopath -from pypy.objspace.std import Space -from pypy.interpreter.main import eval_string - -class MethodChecker(object): - """ Checks which methods are available on builtin types.""" - - def __init__(self, types=(1, 1.0, "'a'", [], {}, (), None)): - - space = Space() - str = ['-', 'Implemented'] - - totalImplemented = 0 - totalNotImplemented = 0 - - for oneType in types: - subImplemented = 0 - subNotImplemented = 0 - - attribArr = dir(type(oneType)) - for attrib in attribArr: - x = space.unwrap(eval_string( - 'hasattr(%s,"%s")\n' % (oneType, attrib), - '', space)) - print '%-16s%-18s%s' % (type(oneType), attrib, str[x]) - if x: - subImplemented += 1 - totalImplemented += 1 - else: - subNotImplemented += 1 - totalNotImplemented += 1 - print - print ' %-16s Implemented: %3d' % (type(oneType), - subImplemented) - print ' %-16s Not implemented: %3d' % (type(oneType), - subNotImplemented) - print ' %-16s TOTAL: %3d' % ( - type(oneType), subNotImplemented + subImplemented) - print - - print 'TOTAL Implemented: %3d' % totalImplemented - print 'TOTAL Not implemented: %3d' % totalNotImplemented - print 'GRAND TOTAL: %3d' % ( - totalNotImplemented + totalImplemented) - -if __name__ == '__main__': - MethodChecker() Modified: pypy/dist/pypy/tool/opcode.py ============================================================================== --- pypy/dist/pypy/tool/opcode.py (original) +++ pypy/dist/pypy/tool/opcode.py Wed May 18 21:34:06 2005 @@ -1,3 +1,5 @@ +# XXX this is a (hopefully temporary) copy of the 2.3 module of CPython. +# See pydis.py. """ opcode module - potentially shared between dis and other modules which Modified: pypy/dist/pypy/tool/option.py ============================================================================== --- pypy/dist/pypy/tool/option.py (original) +++ pypy/dist/pypy/tool/option.py Wed May 18 21:34:06 2005 @@ -1,3 +1,6 @@ +# This is where the options for py.py are defined. +# XXX needs clean-up and reorganization. + import os from pypy.tool import optik make_option = optik.make_option Deleted: /pypy/dist/pypy/tool/ppdb.py ============================================================================== --- /pypy/dist/pypy/tool/ppdb.py Wed May 18 21:34:06 2005 +++ (empty file) @@ -1,22 +0,0 @@ -# it had to happen: a customized version of pdb for pypy; Py Py -# DeBugger, if you please. - -# i only plan to support post morterm debugging! my head hurts if my -# thoughts even go near any alternative! - -import pdb, sys - -class PPdb(pdb.Pdb): - def do_bta(self, line): - self.operr.print_application_traceback(self.space, sys.stdout) - -def post_mortem(space, t, operr): - # need app-level tb too? - p = PPdb() - p.reset() - p.space = space - p.operr = operr - while t.tb_next is not None: - t = t.tb_next - p.interaction(t.tb_frame, t) - Modified: pypy/dist/pypy/tool/sourcetools.py ============================================================================== --- pypy/dist/pypy/tool/sourcetools.py (original) +++ pypy/dist/pypy/tool/sourcetools.py Wed May 18 21:34:06 2005 @@ -1,7 +1,13 @@ # a couple of support functions which # help with generating Python source. -import sys, os, inspect +# XXX This module provides a similar, but subtly different, functionality +# XXX several times over, which used to be scattered over four modules. +# XXX We should try to generalize and single out one approach to dynamic +# XXX code compilation. + +import sys, os, inspect, new +import autopath, py def render_docstr(func, indent_str='', closing_str=''): """ Render a docstring as a string of lines. @@ -143,3 +149,77 @@ return newcode(co, co_consts = tuple(newconstlist), co_filename = co_filename) +# ____________________________________________________________ + +import __future__ + +def compile2(source, filename='', mode='exec', flags= + __future__.generators.compiler_flag, dont_inherit=0): + """ + A version of compile() that caches the code objects it returns. + It uses py.code.compile() to allow the source to be displayed in tracebacks. + """ + key = (source, filename, mode, flags) + try: + co = compile2_cache[key] + #print "***** duplicate code ******* " + #print source + except KeyError: + #if DEBUG: + co = py.code.compile(source, filename, mode, flags) + #else: + # co = compile(source, filename, mode, flags) + compile2_cache[key] = co + return co + +compile2_cache = {} + +# ____________________________________________________________ + +def compile_template(source, resultname): + """Compiles the source code (a string or a list/generator of lines) + which should be a definition for a function named 'resultname'. + The caller's global dict and local variable bindings are captured. + """ + if not isinstance(source, py.code.Source): + if isinstance(source, str): + lines = [source] + else: + lines = list(source) + lines.append('') + source = py.code.Source('\n'.join(lines)) + + caller = sys._getframe(1) + locals = caller.f_locals + if locals is caller.f_globals: + localnames = [] + else: + localnames = locals.keys() + localnames.sort() + values = [locals[key] for key in localnames] + + source = source.putaround( + before = "def container(%s):" % (', '.join(localnames),), + after = "# no unindent\n return %s" % resultname) + + d = {} + exec source.compile() in caller.f_globals, d + container = d['container'] + return container(*values) + +# ____________________________________________________________ + +if (sys.version_info >= (2, 3) and + not hasattr(sys, 'pypy_objspaceclass')): + def func_with_new_name(func, newname): + """Make a renamed copy of a function.""" + f = new.function(func.func_code, func.func_globals, + newname, func.func_defaults, + func.func_closure) + if func.func_dict: + f.func_dict = {} + f.func_dict.update(func.func_dict) + return f +else: + def func_with_new_name(func, newname): + return func Deleted: /pypy/dist/pypy/tool/stdprofile.py ============================================================================== --- /pypy/dist/pypy/tool/stdprofile.py Wed May 18 21:34:06 2005 +++ (empty file) @@ -1,23 +0,0 @@ -#! /usr/bin/env python - -import autopath -import hotshot, os -from pypy.objspace.std import StdObjSpace - -try: - os.unlink('profile.log') -except: - pass - -p = hotshot.Profile('profile.log') -p.run('StdObjSpace()') -p.close() - -print 'loading...' - -import hotshot.stats -p = hotshot.stats.load('profile.log') -p.strip_dirs() -p.sort_stats('time', 'calls') -p.print_stats(20) - Deleted: /pypy/dist/pypy/tool/template.py ============================================================================== --- /pypy/dist/pypy/tool/template.py Wed May 18 21:34:06 2005 +++ (empty file) @@ -1,35 +0,0 @@ -import autopath -import sys -import py - - -def compile_template(source, resultname): - """Compiles the source code (a string or a list/generator of lines) - which should be a definition for a function named 'resultname'. - The caller's global dict and local variable bindings are captured. - """ - if not isinstance(source, py.code.Source): - if isinstance(source, str): - lines = [source] - else: - lines = list(source) - lines.append('') - source = py.code.Source('\n'.join(lines)) - - caller = sys._getframe(1) - locals = caller.f_locals - if locals is caller.f_globals: - localnames = [] - else: - localnames = locals.keys() - localnames.sort() - values = [locals[key] for key in localnames] - - source = source.putaround( - before = "def container(%s):" % (', '.join(localnames),), - after = "# no unindent\n return %s" % resultname) - - d = {} - exec source.compile() in caller.f_globals, d - container = d['container'] - return container(*values) Modified: pypy/dist/pypy/tool/test/test_template.py ============================================================================== --- pypy/dist/pypy/tool/test/test_template.py (original) +++ pypy/dist/pypy/tool/test/test_template.py Wed May 18 21:34:06 2005 @@ -1,5 +1,5 @@ import autopath -from pypy.tool.template import compile_template +from pypy.tool.sourcetools import compile_template some_global = 5 Deleted: /pypy/dist/pypy/tool/test/test_utestconvert.py ============================================================================== --- /pypy/dist/pypy/tool/test/test_utestconvert.py Wed May 18 21:34:06 2005 +++ (empty file) @@ -1,414 +0,0 @@ -import autopath -from pypy.tool.utestconvert import rewrite_utest -import unittest - -class NonpyTest(unittest.TestCase): - def test(self): - assert rewrite_utest("badger badger badger") == ( - "badger badger badger") - - assert rewrite_utest( - "self.assertRaises(excClass, callableObj, *args, **kwargs)" - ) == ( - "raises(excClass, callableObj, *args, **kwargs)" - ) - - assert rewrite_utest( - """ - self.failUnlessRaises(TypeError, func, 42, **{'arg1': 23}) - """ - ) == ( - """ - raises(TypeError, func, 42, **{'arg1': 23}) - """ - ) - assert rewrite_utest( - """ - self.assertRaises(TypeError, - func, - mushroom) - """ - ) == ( - """ - raises(TypeError, - func, - mushroom) - """ - ) - assert rewrite_utest("self.fail()") == "raise AssertionError" - assert rewrite_utest("self.fail('mushroom, mushroom')") == ( - "raise AssertionError, 'mushroom, mushroom'") - assert rewrite_utest("self.assert_(x)") == "assert x" - assert rewrite_utest("self.failUnless(func(x)) # XXX") == ( - "assert func(x) # XXX") - - assert rewrite_utest( - """ - self.assert_(1 + f(y) - + z) # multiline, keep parentheses - """ - ) == ( - """ - assert (1 + f(y) - + z) # multiline, keep parentheses - """ - ) - - assert rewrite_utest("self.assert_(0, 'badger badger')") == ( - "assert 0, 'badger badger'") - - assert rewrite_utest("self.assert_(0, '''badger badger''')") == ( - "assert 0, '''badger badger'''") - - assert rewrite_utest( - r""" - self.assert_(0, - 'Meet the badger.\n') - """ - ) == ( - r""" - assert 0, ( - 'Meet the badger.\n') - """ - ) - - assert rewrite_utest( - r""" - self.failIf(0 + 0 - + len('badger\n') - + 0, '''badger badger badger badger - mushroom mushroom - Snake! Ooh a snake! - ''') # multiline, must move the parens - """ - ) == ( - r""" - assert not (0 + 0 - + len('badger\n') - + 0), '''badger badger badger badger - mushroom mushroom - Snake! Ooh a snake! - ''' # multiline, must move the parens - """ - ) - - assert rewrite_utest("self.assertEquals(0, 0)") == ( - "assert 0 == 0") - - assert rewrite_utest( - r""" - self.assertEquals(0, - 'Run away from the snake.\n') - """ - ) == ( - r""" - assert 0 == ( - 'Run away from the snake.\n') - """ - ) - - assert rewrite_utest( - """ - self.assertEquals(badger + 0 - + mushroom - + snake, 0) - """ - ) == ( - """ - assert (badger + 0 - + mushroom - + snake) == 0 - """ - ) - - assert rewrite_utest( - """ - self.assertNotEquals(badger + 0 - + mushroom - + snake, - mushroom - - badger) - """ - ) == ( - """ - assert (badger + 0 - + mushroom - + snake) != ( - mushroom - - badger) - """ - ) - - assert rewrite_utest( - """ - self.assertEquals(badger(), - mushroom() - + snake(mushroom) - - badger()) - """ - ) == ( - """ - assert badger() == ( - mushroom() - + snake(mushroom) - - badger()) - """ - ) - assert rewrite_utest("self.failIfEqual(0, 0)") == ( - "assert not 0 == 0") - - assert rewrite_utest("self.failUnlessEqual(0, 0)") == ( - "assert 0 == 0") - - assert rewrite_utest( - """ - self.failUnlessEqual(mushroom() - + mushroom() - + mushroom(), '''badger badger badger - badger badger badger badger - badger badger badger badger - ''') # multiline, must move the parens - """ - ) == ( - """ - assert (mushroom() - + mushroom() - + mushroom()) == '''badger badger badger - badger badger badger badger - badger badger badger badger - ''' # multiline, must move the parens - """ - ) - - - assert rewrite_utest( - """ - self.assertEquals('''snake snake snake - snake snake snake''', mushroom) - """ - ) == ( - """ - assert '''snake snake snake - snake snake snake''' == mushroom - """ - ) - - assert rewrite_utest( - """ - self.assertEquals(badger(), - snake(), 'BAD BADGER') - """ - ) == ( - """ - assert badger() == ( - snake()), 'BAD BADGER' - """ - ) - - assert rewrite_utest( - """ - self.assertNotEquals(badger(), - snake()+ - snake(), 'POISONOUS MUSHROOM!\ - Ai! I ate a POISONOUS MUSHROOM!!') - """ - ) == ( - """ - assert badger() != ( - snake()+ - snake()), 'POISONOUS MUSHROOM!\ - Ai! I ate a POISONOUS MUSHROOM!!' - """ - ) - - assert rewrite_utest( - """ - self.assertEquals(badger(), - snake(), '''BAD BADGER - BAD BADGER - BAD BADGER''' - ) - """ - ) == ( - """ - assert badger() == ( - snake()), ( '''BAD BADGER - BAD BADGER - BAD BADGER''' - ) - """ - ) - - assert rewrite_utest( - """ - self.assertEquals('''BAD BADGER - BAD BADGER - BAD BADGER''', '''BAD BADGER - BAD BADGER - BAD BADGER''') - """ - ) == ( - """ - assert '''BAD BADGER - BAD BADGER - BAD BADGER''' == '''BAD BADGER - BAD BADGER - BAD BADGER''' - """ - ) - - assert rewrite_utest( - """ - self.assertEquals('''GOOD MUSHROOM - GOOD MUSHROOM - GOOD MUSHROOM''', - '''GOOD MUSHROOM - GOOD MUSHROOM - GOOD MUSHROOM''', - ''' FAILURE - FAILURE - FAILURE''') - """ - ) == ( - """ - assert '''GOOD MUSHROOM - GOOD MUSHROOM - GOOD MUSHROOM''' == ( - '''GOOD MUSHROOM - GOOD MUSHROOM - GOOD MUSHROOM'''), ( - ''' FAILURE - FAILURE - FAILURE''') - """ - ) - - assert rewrite_utest( - """ - self.assertAlmostEquals(first, second, 5, 'A Snake!') - """ - ) == ( - """ - assert round(first - second, 5) == 0, 'A Snake!' - """ - ) - - assert rewrite_utest( - """ - self.assertAlmostEquals(first, second, 120) - """ - ) == ( - """ - assert round(first - second, 120) == 0 - """ - ) - - assert rewrite_utest( - """ - self.assertAlmostEquals(first, second) - """ - ) == ( - """ - assert round(first - second, 7) == 0 - """ - ) - - assert rewrite_utest( - """ - self.assertAlmostEqual(first, second, 5, '''A Snake! - Ohh A Snake! A Snake!! - ''') - """ - ) == ( - """ - assert round(first - second, 5) == 0, '''A Snake! - Ohh A Snake! A Snake!! - ''' - """ - ) - - assert rewrite_utest( - """ - self.assertNotAlmostEqual(first, second, 5, 'A Snake!') - """ - ) == ( - """ - assert round(first - second, 5) != 0, 'A Snake!' - """ - ) - - assert rewrite_utest( - """ - self.failIfAlmostEqual(first, second, 5, 'A Snake!') - """ - ) == ( - """ - assert not round(first - second, 5) == 0, 'A Snake!' - """ - ) - - self.assertEquals(rewrite_utest( - """ - self.failIfAlmostEqual(first, second, 5, 6, 7, 'Too Many Args') - """ - ), - """ - self.failIfAlmostEqual(first, second, 5, 6, 7, 'Too Many Args') - """ - ) - - assert rewrite_utest( - """ - self.failUnlessAlmostEquals(first, second, 5, 'A Snake!') - """ - ) == ( - """ - assert round(first - second, 5) == 0, 'A Snake!' - """ - ) - - assert rewrite_utest( - """ - self.assertAlmostEquals(now do something reasonable ..() - oops, I am inside a comment as a ''' string, and the fname was - mentioned in passing, leaving us with something that isn't an - expression ... will this blow up? - """ - ) == ( - """ - self.assertAlmostEquals(now do something reasonable ..() - oops, I am inside a comment as a ''' string, and the fname was - mentioned in passing, leaving us with something that isn't an - expression ... will this blow up? - """ - ) - - assert rewrite_utest( - """ - self.failUnless('__builtin__' in modules, "An entry for __builtin__ " - "is not in sys.modules.") - """ - ) == ( - """ - assert '__builtin__' in modules, ( "An entry for __builtin__ " - "is not in sys.modules.") - """ - ) - - # two unittests on the same line separated by a semi-colon is - # only half-converted. Just so you know. - assert rewrite_utest( - """ - self.assertEquals(0, 0); self.assertEquals(1, 1) #not 2 per line! - """ - ) == ( - """ - assert 0 == 0; self.assertEquals(1, 1) #not 2 per line! - """ - ) - - -if __name__ == '__main__': - unittest.main() - - Deleted: /pypy/dist/pypy/tool/test/test_utestconvert2.py ============================================================================== --- /pypy/dist/pypy/tool/test/test_utestconvert2.py Wed May 18 21:34:06 2005 +++ (empty file) @@ -1,424 +0,0 @@ -import autopath -from pypy.tool.utestconvert import rewrite_utest -import unittest - -class NonPyTest(unittest.TestCase): - def test(self): - self.assertEquals(rewrite_utest("badger badger badger"), - "badger badger badger") - - self.assertEquals(rewrite_utest( - "self.assertRaises(excClass, callableObj, *args, **kwargs)" - ), - "raises(excClass, callableObj, *args, **kwargs)" - ) - - self.assertEquals(rewrite_utest( - """ - self.failUnlessRaises(TypeError, func, 42, **{'arg1': 23}) - """ - ), - """ - raises(TypeError, func, 42, **{'arg1': 23}) - """ - ) - self.assertEquals(rewrite_utest( - """ - self.assertRaises(TypeError, - func, - mushroom) - """ - ), - """ - raises(TypeError, - func, - mushroom) - """ - ) - self.assertEquals(rewrite_utest("self.fail()"), "raise AssertionError") - self.assertEquals(rewrite_utest("self.fail('mushroom, mushroom')"), - "raise AssertionError, 'mushroom, mushroom'") - self.assertEquals(rewrite_utest("self.assert_(x)"), "assert x") - self.assertEquals(rewrite_utest("self.failUnless(func(x)) # XXX"), - "assert func(x) # XXX") - - self.assertEquals(rewrite_utest( - """ - self.assert_(1 + f(y) - + z) # multiline, keep parentheses - """ - ), - """ - assert (1 + f(y) - + z) # multiline, keep parentheses - """ - ) - - self.assertEquals(rewrite_utest("self.assert_(0, 'badger badger')"), - "assert 0, 'badger badger'") - - self.assertEquals(rewrite_utest("self.assert_(0, '''badger badger''')"), - "assert 0, '''badger badger'''") - - self.assertEquals(rewrite_utest( - r""" - self.assert_(0, - 'Meet the badger.\n') - """ - ), - r""" - assert 0, ( - 'Meet the badger.\n') - """ - ) - - self.assertEquals(rewrite_utest( - r""" - self.failIf(0 + 0 - + len('badger\n') - + 0, '''badger badger badger badger - mushroom mushroom - Snake! Ooh a snake! - ''') # multiline, must move the parens - """ - ), - r""" - assert not (0 + 0 - + len('badger\n') - + 0), '''badger badger badger badger - mushroom mushroom - Snake! Ooh a snake! - ''' # multiline, must move the parens - """ - ) - - self.assertEquals(rewrite_utest("self.assertEquals(0, 0)"), - "assert 0 == 0") - - self.assertEquals(rewrite_utest( - r""" - self.assertEquals(0, - 'Run away from the snake.\n') - """ - ), - r""" - assert 0 == ( - 'Run away from the snake.\n') - """ - ) - - self.assertEquals(rewrite_utest( - """ - self.assertEquals(badger + 0 - + mushroom - + snake, 0) - """ - ), - """ - assert (badger + 0 - + mushroom - + snake) == 0 - """ - ) - - self.assertEquals(rewrite_utest( - """ - self.assertNotEquals(badger + 0 - + mushroom - + snake, - mushroom - - badger) - """ - ), - """ - assert (badger + 0 - + mushroom - + snake) != ( - mushroom - - badger) - """ - ) - - self.assertEqual(rewrite_utest( - """ - self.assertEquals(badger(), - mushroom() - + snake(mushroom) - - badger()) - """ - ), - """ - assert badger() == ( - mushroom() - + snake(mushroom) - - badger()) - """ - ) - self.assertEquals(rewrite_utest("self.failIfEqual(0, 0)"), - "assert not 0 == 0") - - self.assertEquals(rewrite_utest("self.failUnlessEqual(0, 0)"), - "assert 0 == 0") - - self.assertEquals(rewrite_utest( - """ - self.failUnlessEqual(mushroom() - + mushroom() - + mushroom(), '''badger badger badger - badger badger badger badger - badger badger badger badger - ''') # multiline, must move the parens - """ - ), - """ - assert (mushroom() - + mushroom() - + mushroom()) == '''badger badger badger - badger badger badger badger - badger badger badger badger - ''' # multiline, must move the parens - """ - ) - - - self.assertEquals(rewrite_utest( - """ - self.assertEquals('''snake snake snake - snake snake snake''', mushroom) - """ - ), - """ - assert '''snake snake snake - snake snake snake''' == mushroom - """ - ) - - self.assertEquals(rewrite_utest( - """ - self.assertEquals(badger(), - snake(), 'BAD BADGER') - """ - ), - """ - assert badger() == ( - snake()), 'BAD BADGER' - """ - ) - - self.assertEquals(rewrite_utest( - """ - self.assertNotEquals(badger(), - snake()+ - snake(), 'POISONOUS MUSHROOM!\ - Ai! I ate a POISONOUS MUSHROOM!!') - """ - ), - """ - assert badger() != ( - snake()+ - snake()), 'POISONOUS MUSHROOM!\ - Ai! I ate a POISONOUS MUSHROOM!!' - """ - ) - - self.assertEquals(rewrite_utest( - """ - self.assertEquals(badger(), - snake(), '''BAD BADGER - BAD BADGER - BAD BADGER''' - ) - """ - ), - """ - assert badger() == ( - snake()), ( '''BAD BADGER - BAD BADGER - BAD BADGER''' - ) - """ - ) - - self.assertEquals(rewrite_utest( - """ - self.assertEquals('''BAD BADGER - BAD BADGER - BAD BADGER''', '''BAD BADGER - BAD BADGER - BAD BADGER''') - """ - ), - """ - assert '''BAD BADGER - BAD BADGER - BAD BADGER''' == '''BAD BADGER - BAD BADGER - BAD BADGER''' - """ - ) - - self.assertEquals(rewrite_utest( - """ - self.assertEquals('''GOOD MUSHROOM - GOOD MUSHROOM - GOOD MUSHROOM''', - '''GOOD MUSHROOM - GOOD MUSHROOM - GOOD MUSHROOM''', - ''' FAILURE - FAILURE - FAILURE''') - """ - ), - """ - assert '''GOOD MUSHROOM - GOOD MUSHROOM - GOOD MUSHROOM''' == ( - '''GOOD MUSHROOM - GOOD MUSHROOM - GOOD MUSHROOM'''), ( - ''' FAILURE - FAILURE - FAILURE''') - """ - ) - - self.assertEquals(rewrite_utest( - """ - self.assertAlmostEquals(first, second, 5, 'A Snake!') - """ - ), - """ - assert round(first - second, 5) == 0, 'A Snake!' - """ - ) - - self.assertEquals(rewrite_utest( - """ - self.assertAlmostEquals(first, second, 120) - """ - ), - """ - assert round(first - second, 120) == 0 - """ - ) - - self.assertEquals(rewrite_utest( - """ - self.assertAlmostEquals(first, second) - """ - ), - """ - assert round(first - second, 7) == 0 - """ - ) - - self.assertEquals(rewrite_utest( - """ - self.assertAlmostEqual(first, second, 5, '''A Snake! - Ohh A Snake! A Snake!! - ''') - """ - ), - """ - assert round(first - second, 5) == 0, '''A Snake! - Ohh A Snake! A Snake!! - ''' - """ - ) - - self.assertEquals(rewrite_utest( - """ - self.assertNotAlmostEqual(first, second, 5, 'A Snake!') - """ - ), - """ - assert round(first - second, 5) != 0, 'A Snake!' - """ - ) - - self.assertEquals(rewrite_utest( - """ - self.failIfAlmostEqual(first, second, 5, 'A Snake!') - """ - ), - """ - assert not round(first - second, 5) == 0, 'A Snake!' - """ - ) - - self.assertEquals(rewrite_utest( - """ - self.failIfAlmostEqual(first, second, 5, 6, 7, 'Too Many Args') - """ - ), - """ - self.failIfAlmostEqual(first, second, 5, 6, 7, 'Too Many Args') - """ - ) - - self.assertEquals(rewrite_utest( - """ - self.failUnlessAlmostEquals(first, second, 5, 'A Snake!') - """ - ), - """ - assert round(first - second, 5) == 0, 'A Snake!' - """ - ) - - self.assertEquals(rewrite_utest( - """ - self.assertAlmostEquals(now do something reasonable ..() - oops, I am inside a comment as a ''' string, and the fname was - mentioned in passing, leaving us with something that isn't an - expression ... will this blow up? - """ - ), - """ - self.assertAlmostEquals(now do something reasonable ..() - oops, I am inside a comment as a ''' string, and the fname was - mentioned in passing, leaving us with something that isn't an - expression ... will this blow up? - """ - ) - - self.assertEquals(rewrite_utest( - """ - happily inside a comment I write self.assertEquals(0, badger) - now will this one get rewritten? - """ - ), - """ - happily inside a comment I write self.assertEquals(0, badger) - now will this one get rewritten? - """ - ) - - self.assertEquals(rewrite_utest( - """ - self.failUnless('__builtin__' in modules, "An entry for __builtin__ " - "is not in sys.modules.") - """ - ), - """ - assert '__builtin__' in modules, ( "An entry for __builtin__ " - "is not in sys.modules.") - """ - ) - - # two unittests on the same line separated by a semi-colon is - # only half-converted. Just so you know. - self.assertEquals(rewrite_utest( - """ - self.assertEquals(0, 0); self.assertEquals(1, 1) #not 2 per line! - """ - ), - """ - assert 0 == 0; self.assertEquals(1, 1) #not 2 per line! - """ - ) - - -if __name__ == '__main__': - unittest.main() Deleted: /pypy/dist/pypy/tool/testpm.py ============================================================================== --- /pypy/dist/pypy/tool/testpm.py Wed May 18 21:34:06 2005 +++ (empty file) @@ -1,79 +0,0 @@ -# this file implements a little interactive loop that can be -# optionally entered at the end of a test run to allow inspection (and -# pdb-ing) of failures and/or errors. - -import autopath -from pypy.tool import ppdb -import cmd, traceback - -class TestPM(cmd.Cmd): - def __init__(self, efs): - cmd.Cmd.__init__(self) - self.efs = efs - self.prompt = 'tbi> ' - def emptyline(self): - return 1 - - def do_EOF(self, line): - return 1 - do_q = do_EOF - - def print_tb(self, ef): - from pypy.interpreter.baseobjspace import OperationError - err = ef[1] - print ''.join(traceback.format_exception(*err)) - if isinstance(err[1], OperationError): - print 'and at app-level:' - print - err[1].print_application_traceback(ef[0].space) - - def do_l(self, line): - i = 0 - for t, e in self.efs: - print i, t.__class__.__module__, t.__class__.__name__, t.methodName - i += 1 - - def do_tb(self, arg): - args = arg.split() - if len(args) == 0: - for x in self.efs: - t = x[0] - print t.__class__.__module__, t.__class__.__name__, t.methodName - print - self.print_tb(x) - print - elif len(args) == 1: - try: - tbi = int(args[0]) - except ValueError: - print "error2" - else: - if 0 <= tbi < len(self.efs): - self.print_tb(self.efs[tbi]) - else: - print "error3" - else: - print "error" - - def do_d(self, arg): - args = arg.split() - if len(args) == 1: - try: - efi = int(args[0]) - except ValueError: - print "error2" - else: - if 0 <= efi < len(self.efs): - s, (t, v, tb) = self.efs[efi] - ppdb.post_mortem(s.space, tb, v) - else: - print "error3" - else: - print "error" - - -if __name__ == '__main__': - # just for testing - c = TestPM([]) - c.cmdloop() - Modified: pypy/dist/pypy/tool/traceop.py ============================================================================== --- pypy/dist/pypy/tool/traceop.py (original) +++ pypy/dist/pypy/tool/traceop.py Wed May 18 21:34:06 2005 @@ -1,3 +1,6 @@ +# +# support code for the trace object space +# from __future__ import generators import autopath Modified: pypy/dist/pypy/tool/udir.py ============================================================================== --- pypy/dist/pypy/tool/udir.py (original) +++ pypy/dist/pypy/tool/udir.py Wed May 18 21:34:06 2005 @@ -1,3 +1,9 @@ +# +# Common entry point to access a temporary directory (for testing, etc.) +# This uses the py lib's logic to create numbered directories. The last +# three temporary directories are kept. +# + import autopath from py.path import local Modified: pypy/dist/pypy/tool/unionfind.py ============================================================================== --- pypy/dist/pypy/tool/unionfind.py (original) +++ pypy/dist/pypy/tool/unionfind.py Wed May 18 21:34:06 2005 @@ -1,3 +1,4 @@ +# This is a general algorithm used by the annotator. # union-find impl, a info object is attached to the roots Deleted: /pypy/dist/pypy/tool/utestconvert.py ============================================================================== --- /pypy/dist/pypy/tool/utestconvert.py Wed May 18 21:34:06 2005 +++ (empty file) @@ -1,251 +0,0 @@ -import re -import sys -import parser - -d={} -# d is the dictionary of unittest changes, keyed to the old name -# used by unittest. -# d[old][0] is the new replacement function. -# d[old][1] is the operator you will substitute, or '' if there is none. -# d[old][2] is the possible number of arguments to the unittest -# function. - -# Old Unittest Name new name operator # of args -d['assertRaises'] = ('raises', '', ['Any']) -d['fail'] = ('raise AssertionError', '', [0,1]) -d['assert_'] = ('assert', '', [1,2]) -d['failIf'] = ('assert not', '', [1,2]) -d['assertEqual'] = ('assert', ' ==', [2,3]) -d['failIfEqual'] = ('assert not', ' ==', [2,3]) -d['assertNotEqual'] = ('assert', ' !=', [2,3]) -d['failUnlessEqual'] = ('assert', ' ==', [2,3]) -d['assertAlmostEqual'] = ('assert round', ' ==', [2,3,4]) -d['failIfAlmostEqual'] = ('assert not round', ' ==', [2,3,4]) -d['assertNotAlmostEqual'] = ('assert round', ' !=', [2,3,4]) -d['failUnlessAlmostEquals'] = ('assert round', ' ==', [2,3,4]) -# PyPy specific -d['assertRaises_w'] = ('self.space.raises_w', '', ['Any']) -d['assertEqual_w'] = ('assert self.space.eq_w','',['Any']) -d['assertNotEqual_w'] = ('assert not self.space.eq_w','',['Any']) -d['failUnless_w'] = ('assert self.space.is_true','',['Any']) -d['failIf_w'] = ('assert not self.space.is_true','',['Any']) - -# the list of synonyms -d['failUnlessRaises'] = d['assertRaises'] -d['failUnless'] = d['assert_'] -d['assertEquals'] = d['assertEqual'] -d['assertNotEquals'] = d['assertNotEqual'] -d['assertAlmostEquals'] = d['assertAlmostEqual'] -d['assertNotAlmostEquals'] = d['assertNotAlmostEqual'] - -# set up the regular expressions we will need -leading_spaces = re.compile(r'^(\s*)') # this never fails - -pat = '' -for k in d.keys(): # this complicated pattern to match all unittests - pat += '|' + r'^(\s*)' + 'self.' + k + r'\(' # \tself.whatever( - -old_names = re.compile(pat[1:]) -linesep='\n' # nobody will really try to convert files not read - # in text mode, will they? - - -def blocksplitter(fp): - '''split a file into blocks that are headed by functions to rename''' - - blocklist = [] - blockstring = '' - - for line in fp: - interesting = old_names.match(line) - if interesting : - if blockstring: - blocklist.append(blockstring) - blockstring = line # reset the block - else: - blockstring += line - - blocklist.append(blockstring) - return blocklist - -def rewrite_utest(block): - '''rewrite every block to use the new utest functions''' - - '''returns the rewritten unittest, unless it ran into problems, - in which case it just returns the block unchanged. - ''' - utest = old_names.match(block) - - if not utest: - return block - - old = utest.group(0).lstrip()[5:-1] # the name we want to replace - new = d[old][0] # the name of the replacement function - op = d[old][1] # the operator you will use , or '' if there is none. - possible_args = d[old][2] # a list of the number of arguments the - # unittest function could possibly take. - - if possible_args == ['Any']: # just rename assertRaises & friends - return re.sub('self.'+old, new, block) - - message_pos = possible_args[-1] - # the remaining unittests can have an optional message to print - # when they fail. It is always the last argument to the function. - - try: - indent, argl, trailer = decompose_unittest(old, block) - - except SyntaxError: # but we couldn't parse it! - return block - - argnum = len(argl) - if argnum not in possible_args: - # sanity check - this one isn't real either - return block - - elif argnum == message_pos: - message = argl[-1] - argl = argl[:-1] - else: - message = None - - if argnum is 0 or (argnum is 1 and argnum is message_pos): #unittest fail() - string = '' - if message: - message = ' ' + message - - elif message_pos is 4: # assertAlmostEqual & friends - try: - pos = argl[2].lstrip() - except IndexError: - pos = '7' # default if none is specified - string = '(%s -%s, %s)%s 0' % (argl[0], argl[1], pos, op ) - - else: # assert_, assertEquals and all the rest - string = ' ' + op.join(argl) - - if message: - string = string + ',' + message - - return indent + new + string + trailer - -def decompose_unittest(old, block): - '''decompose the block into its component parts''' - - ''' returns indent, arglist, trailer - indent -- the indentation - arglist -- the arguments to the unittest function - trailer -- any extra junk after the closing paren, such as #commment - ''' - - indent = re.match(r'(\s*)', block).group() - pat = re.search('self.' + old + r'\(', block) - - args, trailer = get_expr(block[pat.end():], ')') - arglist = break_args(args, []) - - if arglist == ['']: # there weren't any - return indent, [], trailer - - for i in range(len(arglist)): - try: - parser.expr(arglist[i].lstrip('\t ')) - except SyntaxError: - if i == 0: - arglist[i] = '(' + arglist[i] + ')' - else: - arglist[i] = ' (' + arglist[i] + ')' - - return indent, arglist, trailer - -def break_args(args, arglist): - '''recursively break a string into a list of arguments''' - try: - first, rest = get_expr(args, ',') - if not rest: - return arglist + [first] - else: - return [first] + break_args(rest, arglist) - except SyntaxError: - return arglist + [args] - -def get_expr(s, char): - '''split a string into an expression, and the rest of the string''' - - pos=[] - for i in range(len(s)): - if s[i] == char: - pos.append(i) - if pos == []: - raise SyntaxError # we didn't find the expected char. Ick. - - for p in pos: - # make the python parser do the hard work of deciding which comma - # splits the string into two expressions - try: - parser.expr('(' + s[:p] + ')') - return s[:p], s[p+1:] - except SyntaxError: # It's not an expression yet - pass - raise SyntaxError # We never found anything that worked. - -if __name__ == '__main__': - - from optparse import OptionParser - import sys - - usage = "usage: %prog [-s [filename ...] | [-i | -c filename ...]]" - optparser = OptionParser(usage) - - def select_output (option, opt, value, optparser, **kw): - if hasattr(optparser, 'output'): - optparser.error( - 'Cannot combine -s -i and -c options. Use one only.') - else: - optparser.output = kw['output'] - - optparser.add_option("-s", "--stdout", action="callback", - callback=select_output, - callback_kwargs={'output':'stdout'}, - help="send your output to stdout") - - optparser.add_option("-i", "--inplace", action="callback", - callback=select_output, - callback_kwargs={'output':'inplace'}, - help="overwrite files in place") - - optparser.add_option("-c", "--copy", action="callback", - callback=select_output, - callback_kwargs={'output':'copy'}, - help="copy files ... fn.py --> fn_cp.py") - - options, args = optparser.parse_args() - - output = getattr(optparser, 'output', 'stdout') - - if output in ['inplace', 'copy'] and not args: - optparser.error( - '-i and -c option require at least one filename') - - if not args: - s = '' - for block in blocksplitter(sys.stdin.read()): - s += rewrite_utest(block) - sys.stdout.write(s) - - else: - for infilename in args: # no error checking to see if we can open, etc. - infile = file(infilename) - s = '' - for block in blocksplitter(infile): - s += rewrite_utest(block) - if output == 'inplace': - outfile = file(infilename, 'w+') - elif output == 'copy': # yes, just go clobber any existing .cp - outfile = file (infilename[:-3]+ '_cp.py', 'w+') - else: - outfile = sys.stdout - - outfile.write(s) - - Modified: pypy/dist/pypy/translator/genc/funcdef.py ============================================================================== --- pypy/dist/pypy/translator/genc/funcdef.py (original) +++ pypy/dist/pypy/translator/genc/funcdef.py Wed May 18 21:34:06 2005 @@ -11,7 +11,7 @@ from pypy.translator.genc.functype import CFuncPtrType from pypy.translator.genc.pyobjtype import CBorrowedPyObjectType from pypy.interpreter.pycode import CO_VARARGS -from pypy.tool.compile import compile2 +from pypy.tool.sourcetools import compile2 from types import FunctionType from pypy.translator.gensupp import c_string From hpk at codespeak.net Wed May 18 21:40:58 2005 From: hpk at codespeak.net (hpk at codespeak.net) Date: Wed, 18 May 2005 21:40:58 +0200 (CEST) Subject: [pypy-svn] r12484 - pypy/dist/pypy/documentation Message-ID: <20050518194058.7352527BB2@code1.codespeak.net> Author: hpk Date: Wed May 18 21:40:58 2005 New Revision: 12484 Modified: pypy/dist/pypy/documentation/getting_started.txt Log: fiddling around a bit still with getting_started (to avoid the word 'annotate' which Armin declared a reserved keyword for PyPy, getting off-issue: actually i think that we might want to think about our general naming of concepts a bit. Names like 'space' and 'annotation' contribute to the perception of PyPy being too abstract. Calling it "typeinference" would better connect to VM hackers being unfamiliar with PyPy). Modified: pypy/dist/pypy/documentation/getting_started.txt ============================================================================== --- pypy/dist/pypy/documentation/getting_started.txt (original) +++ pypy/dist/pypy/documentation/getting_started.txt Wed May 18 21:40:58 2005 @@ -490,10 +490,12 @@ .. _bug reports: https://codespeak.net/issue/pypy-dev/ -Annotated PyPy directory structure of PyPy -======================================================== +.. _`directory reference`: -Here is a fully annotated alphabetical two-level deep +PyPy directory reference +====================================================== + +Here is a fully referenced alphabetical two-level deep directory overview of PyPy: ============================ =========================================== From arigo at codespeak.net Wed May 18 21:44:05 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Wed, 18 May 2005 21:44:05 +0200 (CEST) Subject: [pypy-svn] r12485 - pypy/dist/pypy/lib/test2 Message-ID: <20050518194405.77DA627BB2@code1.codespeak.net> Author: arigo Date: Wed May 18 21:44:05 2005 New Revision: 12485 Added: pypy/dist/pypy/lib/test2/inprogress_test_binascii_extra.py - copied unchanged from r12483, pypy/dist/pypy/lib/test2/test_binascii_extra.py Removed: pypy/dist/pypy/lib/test2/test_binascii_extra.py Log: Disabled this test for now. Deleted: /pypy/dist/pypy/lib/test2/test_binascii_extra.py ============================================================================== --- /pypy/dist/pypy/lib/test2/test_binascii_extra.py Wed May 18 21:44:05 2005 +++ (empty file) @@ -1,19 +0,0 @@ - -from pypy.lib import binascii - -def test_uu(): - assert binascii.b2a_uu('1234567') == "',3(S-#4V-P \n" - assert binascii.b2a_uu('123456789012345678901234567890123456789012345') == 'M,3(S-#4V-S at Y,#$R,S0U-C Author: arigo Date: Wed May 18 21:45:21 2005 New Revision: 12486 Added: pypy/dist/pypy/tool/pytest/pypy_test_failure_demo.py - copied unchanged from r12482, pypy/dist/pypy/tool/example_pytest.py Log: Resurrecing this under a new name. From pedronis at codespeak.net Wed May 18 21:51:36 2005 From: pedronis at codespeak.net (pedronis at codespeak.net) Date: Wed, 18 May 2005 21:51:36 +0200 (CEST) Subject: [pypy-svn] r12487 - pypy/dist/pypy/documentation Message-ID: <20050518195136.C1BBA27BB2@code1.codespeak.net> Author: pedronis Date: Wed May 18 21:51:36 2005 New Revision: 12487 Modified: pypy/dist/pypy/documentation/release-0.6.txt Log: don't use ReST links Modified: pypy/dist/pypy/documentation/release-0.6.txt ============================================================================== --- pypy/dist/pypy/documentation/release-0.6.txt (original) +++ pypy/dist/pypy/documentation/release-0.6.txt Wed May 18 21:51:36 2005 @@ -30,16 +30,11 @@ For download links and further information and documentation see (most of PyPy is realeased under the MIT license): -- `Download PyPy 0.6`: _ -- `Getting started`_ -- `PyPy Documentation` -- `PyPy Homepage`_ - -.. _`Download PyPy 0.6`: xxx -.. _`Getting started`: http://codespeak.net/pypy/index.cgi?doc/getting_started.html -.. _`PyPy Documentation`: http://codespeak.net/pypy/index.cgi?doc -.. _`PyPy Homepage`: http://codespeak.net/pypy/ - +- Download PyPy 0.6: http://xxx +- Getting started: http://codespeak.net/pypy/index.cgi?doc/getting_started.html +- PyPy Documentation: http://codespeak.net/pypy/index.cgi?doc +- PyPy Homepage: http://codespeak.net/pypy/ +- PyPy 0.6 License: http://xxx Interesting bits and highlights --------------------------------- @@ -82,10 +77,9 @@ all somehow incomplete and have been and are quite in flux. What is shipped with 0.6 is able to deal with more or less small/medium examples. -`Getting started`_ has more information about how to try out these features +Getting started has more information about how to try out these features and tools. -.. _`Getting started`: http://codespeak.net/pypy/index.cgi?doc/getting_started.html Ongoing work and near term goals --------------------------------- @@ -101,8 +95,6 @@ **xxx all contributor names in some order (?)** -PyPy development and activities happens as open source source project under the codespeak_ umbrella and through a consortium funded by a EU IST research grant: +PyPy development and activities happens as open source source project under the http://codespeak.net/ umbrella and through a consortium funded by a EU IST research grant: **(xxx consortium partners?? )** - -.. _codespeak: http://codespeak.net/ \ No newline at end of file From arigo at codespeak.net Wed May 18 22:10:56 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Wed, 18 May 2005 22:10:56 +0200 (CEST) Subject: [pypy-svn] r12489 - in pypy/dist: Pyrex pypy/tool pypy/translator pypy/translator/llvm pypy/translator/pyrex pypy/translator/pyrex/Pyrex pypy/translator/pyrex/test pypy/translator/test pypy/translator/tool Message-ID: <20050518201056.0CE9A27BB9@code1.codespeak.net> Author: arigo Date: Wed May 18 22:10:55 2005 New Revision: 12489 Added: pypy/dist/pypy/translator/pyrex/ pypy/dist/pypy/translator/pyrex/Pyrex/ - copied from r12466, pypy/dist/Pyrex/ pypy/dist/pypy/translator/pyrex/__init__.py (contents, props changed) pypy/dist/pypy/translator/pyrex/autopath.py - copied unchanged from r12466, pypy/dist/pypy/translator/autopath.py pypy/dist/pypy/translator/pyrex/genpyrex.py - copied unchanged from r12466, pypy/dist/pypy/translator/genpyrex.py pypy/dist/pypy/translator/pyrex/pyrexc - copied, changed from r12466, pypy/dist/pypy/tool/pyrexc pypy/dist/pypy/translator/pyrex/test/ pypy/dist/pypy/translator/pyrex/test/__init__.py (contents, props changed) pypy/dist/pypy/translator/pyrex/test/autopath.py - copied unchanged from r12466, pypy/dist/pypy/translator/autopath.py pypy/dist/pypy/translator/pyrex/test/test_pyrextrans.py - copied, changed from r12466, pypy/dist/pypy/translator/test/test_pyrextrans.py pypy/dist/pypy/translator/pyrex/test/test_sourcegen.py - copied, changed from r12466, pypy/dist/pypy/translator/test/test_sourcegen.py Removed: pypy/dist/Pyrex/ pypy/dist/pypy/tool/pyrexc pypy/dist/pypy/translator/genpyrex.py pypy/dist/pypy/translator/test/run_snippet.py pypy/dist/pypy/translator/test/test_pyrextrans.py pypy/dist/pypy/translator/test/test_sourcegen.py pypy/dist/pypy/translator/tool/traceann.py Modified: pypy/dist/pypy/translator/llvm/build_llvm_module.py pypy/dist/pypy/translator/pyrex/Pyrex/conftest.py pypy/dist/pypy/translator/tool/buildpyxmodule.py pypy/dist/pypy/translator/translator.py Log: issue49 testing Moved the top-level Pyrex directory into a new, well-hidden pypy/translator/pyrex/, which also receives genpyrex.py and its tests as well as the command-line utility pypy/tool/pyrexc. Removed a couple of strange old test files. The Translator.compile() method is renamed to pyrexcompile(), which apparently wasn't directly tested at all. Deleted: /pypy/dist/pypy/tool/pyrexc ============================================================================== --- /pypy/dist/pypy/tool/pyrexc Wed May 18 22:10:55 2005 +++ (empty file) @@ -1,9 +0,0 @@ -#!/usr/bin/env python - -# -# Pyrex -- Main Program, Unix -# - -import autopath -from Pyrex.Compiler.Main import main -main(command_line = 1) Deleted: /pypy/dist/pypy/translator/genpyrex.py ============================================================================== --- /pypy/dist/pypy/translator/genpyrex.py Wed May 18 22:10:55 2005 +++ (empty file) @@ -1,472 +0,0 @@ -""" -generate Pyrex files from the flowmodel. - -""" -from pypy.interpreter.baseobjspace import ObjSpace -from pypy.interpreter.argument import Arguments -from pypy.objspace.flow.model import Variable, Constant -from pypy.objspace.flow.model import mkentrymap, last_exception -from pypy.translator.annrpython import RPythonAnnotator -from pypy.annotation.model import SomePBC -from pypy.annotation.classdef import isclassdef -from pypy.tool.uid import uid -import inspect - -class Op: - def __init__(self, operation, gen, block): - self._str = gen._str - self.gen = gen - self.argnames = [self._str(arg, block) for arg in operation.args] - self.resultname = self._str(operation.result, block) - self.op = operation - #op.opname - - def __call__(self): - operator = self.gen.ops.get(self.op.opname, self.op.opname) - args = self.argnames - if not (operator[0] >= "a" and operator[0] <= "z"): - if len(args) == 1: - return "%s = %s %s" % (self.resultname, operator) + args - elif len(args) == 2: - #Inplace operators - inp=['+=','-=','*=','/=','%=','&=','|=','^=','//=', - '<<=','>>=','**='] - if operator in inp: - return "%s = %s; %s %s %s" % (self.resultname, args[0], - self.resultname, operator, args[1]) - else: - return "%s = %s %s %s" % (self.resultname, args[0], operator, args[1]) - elif len(args) == 3 and operator == "**": #special case, have to handle it manually - return "%s = pow(%s, %s, %s)" % (self.resultname,) + args - else: - raise NotImplementedError, "I don't know to handle the operator %s (arity %s)" \ - % (operator, len(args)) - else: - method = getattr(self, "op_%s" % operator, self.generic_op) - return method() - - def ispythonident(self, s): - if s[0] not in "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_": - return False - for c in s[1:]: - if (c not in "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_" - "0123456789"): - return False - return True - - - def generic_op(self): - """Generic handler for all operators, which I don't handle explicitly""" - - return "%s = %s(%s)" % (self.resultname, self.op.opname, ", ".join(self.argnames)) - - def op_next(self): - args = self.argnames - return "%s = %s.next()" % (self.resultname, args[0]) - - def op_contains(self): - args = self.argnames - return "%s = %s in %s" % (self.resultname, args[1], args[0]) - - def op_getitem(self): - direct = "%s = %s[%s]" % ((self.resultname,) + tuple(self.argnames)) - w_sequence, w_index = self.op.args - tp = self.gen.get_type(w_index) - if tp is int: - return direct - else: - # the index could be a slice - indexname = self.argnames[1] - lines = [] - if tp is slice: # XXX do this better - lines.append('if 1:') - else: - lines.append('from types import SliceType') - lines.append('if isinstance(%s, SliceType):' % indexname) - lines.append(' assert %s.step is None' % indexname) - lines.append(' %s = %s[%s.start:%s.stop]' % (self.resultname, - self.argnames[0], - indexname, - indexname)) - lines.append('else:') - lines.append(' ' + direct) - return "\n".join(lines) - - def op_newtuple(self): - if self.argnames: - return "%s = (%s,)" % (self.resultname, ", ".join(self.argnames)) - else: - return "%s = ()" % self.resultname - - def op_newlist(self): - if self.argnames: - return "%s = [%s,]" % (self.resultname, ", ".join(self.argnames)) - else: - return "%s = []" % self.resultname - - def op_newdict(self): - pairs = [] - for i in range(0, len(self.argnames), 2): - pairs.append("%s: %s, " % (self.argnames[i], self.argnames[i+1])) - return "%s = {%s}" % (self.resultname, "".join(pairs)) - - def op_newslice(self): - a = self.argnames - return "%s = slice(%s, %s, %s)" % (self.resultname, a[0], a[1], a[2]) - - def op_call_args(self): - a = self.argnames - shape = self.op.args[1].value - args = Arguments.fromshape(None, shape, a[2:]) - lst = args.arguments_w[:] - for key, value in args.kwds_w.items(): - lst.append("%s=%s" % (key, value)) - if args.w_stararg is not None: - lst.append("*%s" % args.w_stararg) - if args.w_starstararg is not None: - lst.append("**%s" % args.w_starstararg) - return "%s = %s(%s)" % (self.resultname, a[0], ", ".join(lst)) - - def op_simple_call(self): - a = self.argnames - return "%s = %s(%s)" % (self.resultname, a[0], ", ".join(a[1:])) - - def op_setitem(self): - a = self.argnames - return "%s[%s] = %s" % (a[0], a[1], a[2]) - - def op_getattr(self): - args = self.argnames - attr = self.op.args[1] - if isinstance(attr, Constant) and self.ispythonident(attr.value): - return "%s = %s.%s" % (self.resultname, args[0], attr.value) - else: - return "%s = getattr(%s)" % (self.resultname, ", ".join(args)) - - def op_setattr(self): - args = self.argnames - attr = self.op.args[1] - if isinstance(attr, Constant) and self.ispythonident(attr.value): - return "%s.%s = %s" % (args[0], attr.value, args[2]) - else: - return "setattr(%s, %s, %s)" % args - - def op_not(self): - return "%s = not %s" % (self.resultname, self.argnames[0]) - - def op_is_true(self): - return "%s = not not %s" % (self.resultname, self.argnames[0]) - -class GenPyrex: - def __init__(self, functiongraph): - self.functiongraph = functiongraph - ops = {} - oparity = {} - for (opname, opsymbol, arity, _) in ObjSpace.MethodTable: - ops[opname] = opsymbol - oparity[opname] = arity - self.ops = ops - self.oparity = oparity - self.annotator = None - self.namecache = {} - - def annotate(self, input_arg_types): - a = RPythonAnnotator() - a.build_types(self.functiongraph, input_arg_types) - self.setannotator(a) - - def setannotator(self, annotator): - self.annotator = annotator - - def emitcode(self, public=True): - self.blockids = {} - #self.variablelocations = {} - self.lines = [] - self.indent = 0 - self.gen_graph(public) - return "\n".join(self.lines) - - def putline(self, line): - for l in line.split('\n'): - self.lines.append(" " * self.indent + l) - - def gen_graph(self, public=True): - fun = self.functiongraph - self.entrymap = mkentrymap(fun) - currentlines = self.lines - self.lines = [] - self.indent += 1 - self.gen_block(fun.startblock) - self.indent -= 1 - # emit the header after the body - functionbodylines = self.lines - self.lines = currentlines - inputargnames = [ " ".join(self._paramvardecl(var)) for var in fun.getargs() ] - params = ", ".join(inputargnames) - returntype = self.get_type(fun.getreturnvar()) - returntypename = self._gettypename(returntype) - try: - function_object = self.by_the_way_the_function_was # XXX! - except AttributeError: - def function_object(): pass # XXX!!! - if public: - # make the function visible from the outside - # under its original name - args = ', '.join([var.name for var in fun.getargs()]) - self.putline("def %s(%s):" % (fun.name, args)) - self.indent += 1 - self.putline("return %s(%s)" % ( - self.getfunctionname(function_object), args)) - self.indent -= 1 - # go ahead with the mandled header and body of the function - self.putline("cdef %s %s(%s):" % ( - returntypename, - self.getfunctionname(function_object), - params)) - self.indent += 1 - #self.putline("# %r" % self.annotations) - decllines = [] - missing_decl = [] - funargs = fun.getargs() - for block in self.blockids: - for var in block.getvariables(): - if var not in funargs: - decl = self._vardecl(var) - if decl: - decllines.append(decl) - else: - missing_decl.append(self.get_varname(var)) - if missing_decl: - missing_decl.sort() - decllines.append('# untyped variables: ' + ' '.join(missing_decl)) - decllines.sort() - for decl in decllines: - self.putline(decl) - self.indent -= 1 - self.lines.extend(functionbodylines) - - def get_type(self, var): - if isinstance(var, Constant): - return type(var.value) - elif self.annotator: - return self.annotator.gettype(var) - else: - return None - - def get_varname(self, var): - vartype = self.get_type(var) - if vartype in (int, bool): - prefix = "i_" - elif self.annotator and vartype in self.annotator.getuserclasses(): - prefix = "p_" - else: - prefix = "" - return prefix + var.name - - def _paramvardecl(self, var): - vartype = self.get_type(var) - ctype=self._gettypename(vartype) - return (ctype, self.get_varname(var)) - - def _gettypename(self, vartype): - if vartype in (int, bool): - ctype = "int" - elif (self.annotator and vartype in self.annotator.getuserclasses() - and vartype.__module__ != '__builtin__'): - ctype = self.getclassname(vartype) - else: - ctype = "object" - return ctype - - def _vardecl(self, var): - vartype, varname = self._paramvardecl(var) - if vartype != "object": - return "cdef %s %s" % (vartype, varname) - else: - return "" - - def getclassname(self,cls): - assert inspect.isclass(cls) - name = cls.__name__ - if issubclass(cls,Exception): - return name - return '%s__%x' % (name, uid(cls))#self._hackname(cls) - - def getfunctionname(self,func): - # NB. the purpose of the cache is not performance, but to ensure that - # two methods that compare equal get the same name. - if inspect.ismethod(func) and func.im_self is None: - func = func.im_func # consider unbound methods as plain functions - try: - return self.namecache[func] - except KeyError: - assert inspect.isfunction(func) or inspect.ismethod(func) - name = '%s__%x' % (func.__name__, uid(func))#self._hackname(func) - self.namecache[func] = name - return name - - def getvarname(self,var): - assert inspect.isclass(var) - return self._hackname(var) - - def _str(self, obj, block): - if isinstance(obj, Variable): - #self.variablelocations[obj] = block - return self.get_varname(obj) - elif isinstance(obj, Constant): - import types - if isinstance(obj.value,(types.ClassType,type)): - fff=self.getclassname(obj.value) - elif isinstance(obj.value,(types.FunctionType, - types.MethodType, - type)): - fff=self.getfunctionname(obj.value) - elif isinstance(obj.value, types.BuiltinFunctionType): - fff=str(obj.value.__name__) - else: - #fff=self._hackname(obj.value) - fff=repr(obj.value) - if isinstance(obj.value,( int,long)): - fff = repr(int(obj.value)) - return fff - else: - raise TypeError("Unknown class: %s" % obj.__class__) - - def gen_block(self, block): - if self.blockids.has_key(block): - self.putline('cinline "goto Label%s;"' % self.blockids[block]) - return - - blockids = self.blockids - blockids.setdefault(block, len(blockids)) - - #the label is only written if there are multiple refs to the block - if len(self.entrymap[block]) > 1: - self.putline('cinline "Label%s:"' % blockids[block]) - - if block.exitswitch == Constant(last_exception): - catch_exc = len(block.operations)-1 - else: - catch_exc = None - - for i, op in zip(range(len(block.operations)), block.operations): - if i == catch_exc: - self.putline("try:") - self.indent += 1 - opg = Op(op, self, block) - self.putline(opg()) - if i == catch_exc: - # generate all exception handlers - self.indent -= 1 - exits = block.exits - for exit in exits[1:]: - self.putline("except %s, last_exc_value:" % - exit.exitcase.__name__) - self.indent += 1 - self.putline("last_exception = last_exc_value.__class__") - self.gen_link(block, exit) - self.indent -= 1 - self.putline("else:") # no-exception case - self.indent += 1 - assert exits[0].exitcase is None - self.gen_link(block, exits[0]) - self.indent -= 1 - break - - else: - exits = block.exits - if len(exits) == 1: - self.gen_link(block, exits[0]) - elif len(exits) > 1: - varname = self._str(block.exitswitch, block) - for i in range(len(exits)): - exit = exits[-i-1] # reverse order - cond = self._str(Constant(exit.exitcase), block) - if i == 0: - self.putline("if %s == %s:" % (varname, cond)) - elif i < len(exits) - 1: - self.putline("elif %s == %s:" % (varname, cond)) - else: - self.putline("else: # %s == %s" % (varname, cond)) - self.indent += 1 - self.gen_link(block, exit) - self.indent -= 1 - elif len(block.inputargs) == 2: # exc_cls, exc_value - exc_cls = self._str(block.inputargs[0], block) - exc_value = self._str(block.inputargs[1], block) - self.putline("raise %s, %s" % (exc_cls, exc_value)) - else: - self.putline("return %s" % self._str(block.inputargs[0], block)) - - def gen_link(self, prevblock, link): - _str = self._str - block = link.target - sourceargs = link.args - targetargs = block.inputargs - assert len(sourceargs) == len(targetargs) - # get rid of identity-assignments and assignments of undefined_value - sargs, targs = [], [] - for s,t in zip(sourceargs, targetargs): - if s != t: # and s != Constant(undefined_value): - sargs.append(s) - targs.append(t) - if sargs: - sargs = [_str(arg, prevblock) for arg in sargs] - targs = [_str(arg, block) for arg in targs] - self.putline("%s = %s" % (", ".join(targs), ", ".join(sargs))) - - self.gen_block(block) - - def globaldeclarations(self,): - """Generate the global class declaration for a group of functions.""" - if self.annotator: - self.lines = [] - self.indent = 0 - delay_methods={} - for cls in self.annotator.getuserclassdefinitions(): - if cls.basedef: - bdef="(%s)" % (self.getclassname(cls.basedef.cls)) - else: - bdef="" - self.putline("cdef class %s%s:" % (self.getclassname(cls.cls),bdef)) - self.indent += 1 - empty = True - for attr, attrdef in cls.attrs.items(): - s_value = attrdef.s_value - if isinstance(s_value, SomePBC): - for py_fun,fun_class in s_value.prebuiltinstances.items(): - assert isclassdef(fun_class), ("don't support " - "prebuilt constants like %r" % py_fun) - delay_methods.setdefault(fun_class,[]).append(py_fun) - else: - vartype=self._gettypename(s_value.knowntype) - self.putline("cdef public %s %s" % (vartype, attr)) - empty = False - list_methods=delay_methods.get(cls,[]) - for py_fun in list_methods: - # XXX! - try: - fun = self.annotator.translator.flowgraphs[py_fun] - except KeyError: - continue # method present in class but never called - hackedargs = ', '.join([var.name for var in fun.getargs()]) - self.putline("def %s(%s):" % (py_fun.__name__, hackedargs)) - self.indent += 1 - # XXX special case hack: cannot use 'return' in __init__ - if py_fun.__name__ == "__init__": - statement = "" - else: - statement = "return " - self.putline("%s%s(%s)" % (statement, - self.getfunctionname(py_fun), - hackedargs)) - self.indent -= 1 - empty = False - if empty: - self.putline("pass") - self.indent -= 1 - self.putline("") - return '\n'.join(self.lines) - else: - return '' - Modified: pypy/dist/pypy/translator/llvm/build_llvm_module.py ============================================================================== --- pypy/dist/pypy/translator/llvm/build_llvm_module.py (original) +++ pypy/dist/pypy/translator/llvm/build_llvm_module.py Wed May 18 22:10:55 2005 @@ -10,7 +10,7 @@ from py import path from pypy.tool.udir import udir -from pypy.translator.genpyrex import GenPyrex +from pypy.translator.pyrex.genpyrex import GenPyrex from pypy.translator.tool.buildpyxmodule import make_c_from_pyxfile from pypy.translator.tool import stdoutcapture Modified: pypy/dist/pypy/translator/pyrex/Pyrex/conftest.py ============================================================================== --- pypy/dist/Pyrex/conftest.py (original) +++ pypy/dist/pypy/translator/pyrex/Pyrex/conftest.py Wed May 18 22:10:55 2005 @@ -1,6 +1,4 @@ import py class Directory(py.test.collect.Directory): - def __iter__(self): - return self - def next(self): - raise StopIteration + def run(self): + return [] Added: pypy/dist/pypy/translator/pyrex/__init__.py ============================================================================== Copied: pypy/dist/pypy/translator/pyrex/pyrexc (from r12466, pypy/dist/pypy/tool/pyrexc) ============================================================================== --- pypy/dist/pypy/tool/pyrexc (original) +++ pypy/dist/pypy/translator/pyrex/pyrexc Wed May 18 22:10:55 2005 @@ -4,6 +4,5 @@ # Pyrex -- Main Program, Unix # -import autopath from Pyrex.Compiler.Main import main main(command_line = 1) Added: pypy/dist/pypy/translator/pyrex/test/__init__.py ============================================================================== Copied: pypy/dist/pypy/translator/pyrex/test/test_pyrextrans.py (from r12466, pypy/dist/pypy/translator/test/test_pyrextrans.py) ============================================================================== --- pypy/dist/pypy/translator/test/test_pyrextrans.py (original) +++ pypy/dist/pypy/translator/pyrex/test/test_pyrextrans.py Wed May 18 22:10:55 2005 @@ -1,7 +1,7 @@ import autopath import py from pypy.tool.udir import udir -from pypy.translator.genpyrex import GenPyrex +from pypy.translator.pyrex.genpyrex import GenPyrex from pypy.objspace.flow.model import * from pypy.translator.tool.buildpyxmodule import build_cfunc from pypy.translator.tool.buildpyxmodule import skip_missing_compiler Copied: pypy/dist/pypy/translator/pyrex/test/test_sourcegen.py (from r12466, pypy/dist/pypy/translator/test/test_sourcegen.py) ============================================================================== --- pypy/dist/pypy/translator/test/test_sourcegen.py (original) +++ pypy/dist/pypy/translator/pyrex/test/test_sourcegen.py Wed May 18 22:10:55 2005 @@ -3,7 +3,7 @@ import py from pypy.tool.udir import udir -from pypy.translator.genpyrex import GenPyrex +from pypy.translator.pyrex.genpyrex import GenPyrex from pypy.objspace.flow.model import * from pypy.translator.tool.buildpyxmodule import make_module_from_pyxstring Deleted: /pypy/dist/pypy/translator/test/run_snippet.py ============================================================================== --- /pypy/dist/pypy/translator/test/run_snippet.py Wed May 18 22:10:55 2005 +++ (empty file) @@ -1,106 +0,0 @@ -""" - - Use all functions in snippet to test translation to pyrex - -""" -import autopath -import traceback -import sys -from pypy.translator.translator import Translator - -from pypy.translator.test import snippet - -class Result: - def __init__(self, func, argtypes): - self.func = func - self.argtypes = argtypes - self.r_flow = self.r_annotate = self.r_compile = None - for name in 'flow', 'annotate', 'compile': - method = getattr(self, name) - resname = 'r_' + name - try: - method() - except (KeyboardInterrupt, SystemExit): - raise - except: - self.excinfo = sys.exc_info() - setattr(self, resname, False) - else: - setattr(self, resname, True) - - def flow(self): - self.translator = Translator(func) - self.translator.simplify() - - def annotate(self): - self.translator.annotate(self.argtypes) - - def compile(self): - compiled_function = self.translator.compile() - return compiled_function - -def collect_functions(module, specnamelist): - l = [] - for funcname, value in vars(module).items(): - if not hasattr(value, 'func_code'): - continue - for specname in specnamelist: - if funcname.startswith(specname): - l.append(value) - break - if not specnamelist: - l.append(value) - return l - - -def combine(lists): - if not lists: - yield [] - else: - head = lists[0] - if not isinstance(head, tuple): - head = (head,) - tail = lists[1:] - for item in head: - for com in combine(tail): - yield [item] + com - -def get_arg_types(func): - # func_defaults e.g.: ([int, float], [str, int], int) - if func.func_defaults: - for argtypeslist in combine(func.func_defaults): - yield argtypeslist - else: - yield [] - -# format string for result-lines -format_str = "%-30s %10s %10s %10s" - -def repr_result(res): - name = res.func.func_name - argtypes = res.argtypes - funccall = "%s(%s)" % (name, ", ".join([x.__name__ for x in argtypes])) - flow = res.r_flow and 'ok' or 'fail' - ann = res.r_annotate and 'ok' or 'fail' - comp = res.r_compile and 'ok' or 'fail' - return format_str %(funccall, flow, ann, comp) - -if __name__=='__main__': - specnamelist = sys.argv[1:] - funcs = collect_functions(snippet, specnamelist) - results = [] - print format_str %("functioncall", "flowed", "annotated", "compiled") - for func in funcs: - for argtypeslist in get_arg_types(func): - #print "trying %s %s" %(func, argtypeslist) - result = Result(func, argtypeslist) - results.append(result) - print repr_result(result) - if specnamelist and getattr(result, 'excinfo', None): - traceback.print_exception(*result.excinfo) - raise SystemExit, 1 - - #for res in results: - # print repr_result(res) - - Deleted: /pypy/dist/pypy/translator/test/test_pyrextrans.py ============================================================================== --- /pypy/dist/pypy/translator/test/test_pyrextrans.py Wed May 18 22:10:55 2005 +++ (empty file) @@ -1,155 +0,0 @@ -import autopath -import py -from pypy.tool.udir import udir -from pypy.translator.genpyrex import GenPyrex -from pypy.objspace.flow.model import * -from pypy.translator.tool.buildpyxmodule import build_cfunc -from pypy.translator.tool.buildpyxmodule import skip_missing_compiler -from pypy.translator.translator import Translator - -from pypy import conftest -#from pypy.conftest import option - -from pypy.translator.test import snippet - -# XXX this tries to make compiling faster for full-scale testing -from pypy.translator.tool import buildpyxmodule -buildpyxmodule.enable_fast_compilation() - - -class TestNoTypePyrexGenTestCase: - objspacename = 'flow' - - def build_cfunc(self, func): - try: func = func.im_func - except AttributeError: pass - - dot = conftest.option.verbose > 0 and 1 or 0 - options = { - 'simplify' : 1, - 'dot' : dot, - } - return skip_missing_compiler(build_cfunc, func, **options) - - def test_simple_func(self): - cfunc = self.build_cfunc(snippet.simple_func) - assert cfunc(1) == 2 - - def test_while_func(self): - while_func = self.build_cfunc(snippet.while_func) - assert while_func(10) == 55 - - def test_nested_whiles(self): - nested_whiles = self.build_cfunc(snippet.nested_whiles) - assert nested_whiles(111, 114) == ( - '...!...!...!...!...!') - - def test_my_contains(self): - my_contains = self.build_cfunc(snippet.my_contains) - assert my_contains([1, 2, 3], 1) - - def test_poor_man_range(self): - poor_man_range = self.build_cfunc(snippet.poor_man_range) - assert poor_man_range(10) == range(10) - - def poor_man_rev_range(self): - poor_man_rev_range = self.build_cfunc(snippet.poor_man_rev_range) - assert poor_man_rev_range(10) == range(9,-1,-1) - - def test_simple_id(self): - #we just want to see, if renaming of parameter works correctly - #if the first branch is the end branch - simple_id = self.build_cfunc(snippet.simple_id) - assert simple_id(9) == 9 - - def test_branch_id(self): - branch_id = self.build_cfunc(snippet.branch_id) - assert branch_id(1, 2, 3) == 2 - assert branch_id(0, 2, 3) == 3 - - def test_int_id(self): - int_id = self.build_cfunc(snippet.int_id) - assert int_id(3) == 3 - - def dont_test_attrs(self): - attrs = self.build_cfunc(snippet.attrs) - assert attrs() == 9 - - def test_builtinusage(self): - fun = self.build_cfunc(snippet.builtinusage) - assert fun() == 4 - - def test_sieve(self): - sieve = self.build_cfunc(snippet.sieve_of_eratosthenes) - assert sieve() == 1028 - - def test_slice(self): - half = self.build_cfunc(snippet.half_of_n) - assert half(10) == 5 - - def test_poly_branch(self): - poly_branch = self.build_cfunc(snippet.poly_branch) - assert poly_branch(10) == [1,2,3]*2 - assert poly_branch(0) == ['a','b','c']*2 - - def test_and(self): - sand = self.build_cfunc(snippet.s_and) - assert sand(5, 6) == "yes" - assert sand(5, 0) == "no" - assert sand(0, 6) == "no" - assert sand(0, 0) == "no" - -# -- the following test doesn't really work right now -- -## def test_call_very_complex(self): -## call_very_complex = self.build_cfunc(snippet.call_very_complex, -## snippet.default_args) -## assert call_very_complex(5, (3,), {}) == -12 -## assert call_very_complex(5, (), {'y': 3}) == -12 -## py.test.raises("call_very_complex(5, (3,), {'y': 4})") - - -class TestTypedTestCase: - - def getcompiled(self, func): - t = Translator(func, simplifying=True) - # builds starting-types from func_defs - argstypelist = [] - if func.func_defaults: - for spec in func.func_defaults: - if isinstance(spec, tuple): - spec = spec[0] # use the first type only for the tests - argstypelist.append(spec) - t.annotate(argstypelist) - return skip_missing_compiler(t.compile) - - def test_set_attr(self): - set_attr = self.getcompiled(snippet.set_attr) - assert set_attr() == 2 - - def test_inheritance2(self): - inheritance2 = self.getcompiled(snippet.inheritance2) - assert inheritance2() == ((-12, -12), (3, "world")) - - def test_factorial2(self): - factorial2 = self.getcompiled(snippet.factorial2) - assert factorial2(5) == 120 - - def test_factorial(self): - factorial = self.getcompiled(snippet.factorial) - assert factorial(5) == 120 - - def test_simple_method(self): - simple_method = self.getcompiled(snippet.simple_method) - assert simple_method(55) == 55 - - def test_sieve_of_eratosthenes(self): - sieve_of_eratosthenes = self.getcompiled(snippet.sieve_of_eratosthenes) - assert sieve_of_eratosthenes() == 1028 - - def test_nested_whiles(self): - nested_whiles = self.getcompiled(snippet.nested_whiles) - assert nested_whiles(5,3) == '!!!!!' - - def test_call_five(self): - call_five = self.getcompiled(snippet.call_five) - assert call_five() == [5] Deleted: /pypy/dist/pypy/translator/test/test_sourcegen.py ============================================================================== --- /pypy/dist/pypy/translator/test/test_sourcegen.py Wed May 18 22:10:55 2005 +++ (empty file) @@ -1,98 +0,0 @@ - -import autopath -import py -from pypy.tool.udir import udir - -from pypy.translator.genpyrex import GenPyrex -from pypy.objspace.flow.model import * - -from pypy.translator.tool.buildpyxmodule import make_module_from_pyxstring -#from pypy.translator.test.make_dot import make_ps - -# XXX this tries to make compiling faster for full-scale testing -from pypy.translator.tool import buildpyxmodule -buildpyxmodule.enable_fast_compilation() - - -class TestSourceGenTestCase: - def test_simple_func(self): - """ - one test source: - def f(x): - return x+1 - """ - x = Variable("x") - result = Variable("result") - op = SpaceOperation("add", [x, Constant(1)], result) - block = Block([x]) - fun = FunctionGraph("f", block) - block.operations.append(op) - block.closeblock(Link([result], fun.returnblock)) - result = GenPyrex(fun).emitcode() - mod = py.test.skip_on_error( - make_module_from_pyxstring, 'test_source1', udir, result) - assert mod.f(1) == 2 - - def test_if(self): - """ - one test source: - def f(i, j): - if i < 0: - i = j - return i - """ - i = Variable("i") - j = Variable("j") - - conditionres = Variable("conditionres") - conditionop = SpaceOperation("lt", [i, Constant(0)], conditionres) - startblock = Block([i, j]) - - fun = FunctionGraph("f", startblock) - startblock.operations.append(conditionop) - startblock.exitswitch = conditionres - startblock.closeblock(Link([i], fun.returnblock, False), - Link([j], fun.returnblock, True)) - - result = GenPyrex(fun).emitcode() - mod = py.test.skip_on_error( - make_module_from_pyxstring, 'test_source2', udir, result) - assert mod.f(-1, 42) == 42 - assert mod.f(3, 5) == 3 - - def test_while_sum(self): - """ - one test source: - def f(i): - sum = 0 - while i > 0: - sum = sum + i - i = i - 1 - return sum - """ - i = Variable("i") - sum = Variable("sum") - - conditionres = Variable("conditionres") - conditionop = SpaceOperation("gt", [i, Constant(0)], conditionres) - decop = SpaceOperation("add", [i, Constant(-1)], i) - addop = SpaceOperation("add", [i, sum], sum) - startblock = Block([i]) - headerblock = Block([i, sum]) - whileblock = Block([i, sum]) - - fun = FunctionGraph("f", startblock) - startblock.closeblock(Link([i, Constant(0)], headerblock)) - headerblock.operations.append(conditionop) - headerblock.exitswitch = conditionres - headerblock.closeblock(Link([sum], fun.returnblock, False), - Link([i, sum], whileblock, True)) - whileblock.operations.append(addop) - whileblock.operations.append(decop) - whileblock.closeblock(Link([i, sum], headerblock)) - - result = GenPyrex(fun).emitcode() - mod = py.test.skip_on_error( - make_module_from_pyxstring, 'test_source4', udir, result) - assert mod.f(3) == 6 - assert mod.f(-3) == 0 Modified: pypy/dist/pypy/translator/tool/buildpyxmodule.py ============================================================================== --- pypy/dist/pypy/translator/tool/buildpyxmodule.py (original) +++ pypy/dist/pypy/translator/tool/buildpyxmodule.py Wed May 18 22:10:55 2005 @@ -1,7 +1,6 @@ import autopath import py -from pypy.translator.genpyrex import GenPyrex import os, sys, inspect, re from pypy.translator.tool import stdoutcapture @@ -122,6 +121,10 @@ return testmodule def make_c_from_pyxfile(pyxfile): + from pypy.translator.pyrex import genpyrex + pyrexdir = os.path.dirname(genpyrex.__file__) + if pyrexdir not in sys.path: + sys.path.append(pyrexdir) from Pyrex.Compiler.Main import CompilationOptions, Context, PyrexError try: options = CompilationOptions(show_version = 0, @@ -180,6 +183,7 @@ name += '_s' # get the pyrex generator + from pypy.translator.pyrex.genpyrex import GenPyrex genpyrex = GenPyrex(funcgraph) # generate pyrex (without type inference) Deleted: /pypy/dist/pypy/translator/tool/traceann.py ============================================================================== --- /pypy/dist/pypy/translator/tool/traceann.py Wed May 18 22:10:55 2005 +++ (empty file) @@ -1,55 +0,0 @@ -""" - -- annotate and translate snippet producing tracing of calls -to AnnotationSet and RPythonAnnotator -- print bindings and final annotation set -and pyrex - -- display flow graph - -call it like: - -traceann >result.txt 2>trace.txt - -""" - -import sys - -import autopath - -from pypy.translator.translator import * -from pypy.translator.test import snippet as test - -#from pypy.translator.tool import tracer -#tracer.trace(AnnotationSet) -#tracer.trace(RPythonAnnotator) - -try: - snippet_name = sys.argv[1] -except IndexError: - snippet_name = "call_five" - -argtypes = [] - -for argtype in sys.argv[2:]: - argtypes.append(eval(argtype)) - -t = Translator(getattr(test,snippet_name)) -t.simplify() -a = t.annotate(argtypes) -lines = [] -for key, value in a.bindings.items(): - lines.append('%r: %r' % (key, value)) -#for cl, attrdict in a.classes.items(): -# lines.append('%s: %r' % (cl.__name__,attrdict)) -lines.sort() -for line in lines: - print line -print '-'*50 -print a.heap -sys.stdout.flush() - -print '-'*50 -print t.pyrex() - -t.gv() Modified: pypy/dist/pypy/translator/translator.py ============================================================================== --- pypy/dist/pypy/translator/translator.py (original) +++ pypy/dist/pypy/translator/translator.py Wed May 18 22:10:55 2005 @@ -10,7 +10,7 @@ from pypy.annotation.model import * from pypy.translator.annrpython import RPythonAnnotator from pypy.translator.simplify import simplify_graph -from pypy.translator.genpyrex import GenPyrex +from pypy.translator.pyrex.genpyrex import GenPyrex from pypy.translator.gencl import GenCL from pypy.translator.genc.genc import GenC from pypy.translator.gensupp import uniquemodulename @@ -216,7 +216,7 @@ g.setannotator(ann) return g.globaldeclarations() - def compile(self): + def pyrexcompile(self): """Returns compiled function, compiled using Pyrex. """ from pypy.tool.udir import udir From hpk at codespeak.net Wed May 18 22:21:03 2005 From: hpk at codespeak.net (hpk at codespeak.net) Date: Wed, 18 May 2005 22:21:03 +0200 (CEST) Subject: [pypy-svn] r12490 - pypy/dist/pypy/documentation Message-ID: <20050518202103.6B45427BB9@code1.codespeak.net> Author: hpk Date: Wed May 18 22:21:03 2005 New Revision: 12490 Modified: pypy/dist/pypy/documentation/getting_started.txt Log: issue37 testing fixing some ReST issues (removed one indentation level for chapter2 which got me all italics in my browser). Modified: pypy/dist/pypy/documentation/getting_started.txt ============================================================================== --- pypy/dist/pypy/documentation/getting_started.txt (original) +++ pypy/dist/pypy/documentation/getting_started.txt Wed May 18 22:21:03 2005 @@ -114,145 +114,146 @@ The py.py interpreter +++++++++++++++++++++ - To start interpreting Python with PyPy, use Python 2.3 or greater:: +To start interpreting Python with PyPy, use Python 2.3 or greater:: - cd pypy/bin - python py.py - - After a few seconds (remember: this is running on top of CPython), - you should be at the PyPy prompt, which is the same as the Python - prompt, but with an extra ">". - - Now you are ready to start running Python code. Most Python - modules should work if they don't involve CPython extension - modules. Here is an example of determining PyPy's performance - in pystones:: - - >>>> from test import pystone - >>>> pystone.main(10) + cd pypy/bin + python py.py - Note that this is a slightly modified version of pystone -- the - original version does not accept the parameter to main(). The - parameter is the number of loops to run through the test, and the - default is 50000, which is far too many to run in a reasonable time - on the current PyPy implementation. +After a few seconds (remember: this is running on top of CPython), +you should be at the PyPy prompt, which is the same as the Python +prompt, but with an extra ">". + +Now you are ready to start running Python code. Most Python +modules should work if they don't involve CPython extension +modules. Here is an example of determining PyPy's performance +in pystones:: + + >>>> from test import pystone + >>>> pystone.main(10) + +Note that this is a slightly modified version of pystone -- the +original version does not accept the parameter to main(). The +parameter is the number of loops to run through the test, and the +default is 50000, which is far too many to run in a reasonable time +on the current PyPy implementation. py.py options +++++++++++++ - To list the PyPy interpreter command line options, type:: +To list the PyPy interpreter command line options, type:: - cd pypy/bin - python py.py --help + cd pypy/bin + python py.py --help - As an example of using PyPy from the command line, you could type:: +As an example of using PyPy from the command line, you could type:: - python py.py -c "from test import pystone; pystone.main(10)" + python py.py -c "from test import pystone; pystone.main(10)" - Alternatively, as with regular Python, you can simply give a - script name on the command line:: +Alternatively, as with regular Python, you can simply give a +script name on the command line:: - python py.py ../../lib-python/modified-2.3.4/test/pystone.py 10 + python py.py ../../lib-python/modified-2.3.4/test/pystone.py 10 Interpreter-level console +++++++++++++++++++++++++ - There are a few extra features of the PyPy console: If you press - on the console you enter the interpreter-level console, a - usual CPython console. You can then access internal objects of PyPy - (e.g. the object space) and any variables you have created on the PyPy - prompt with the affix ``w_``:: - - >>>> a = 123 - >>>> - *** Entering interpreter-level console *** - >>> w_a - W_IntObject(123) +There are a few extra features of the PyPy console: If you press + on the console you enter the interpreter-level console, a +usual CPython console. You can then access internal objects of PyPy +(e.g. the object space) and any variables you have created on the PyPy +prompt with the affix ``w_``:: + + >>>> a = 123 + >>>> + *** Entering interpreter-level console *** + >>> w_a + W_IntObject(123) - Note that the prompt of the interpreter-level console is only '>>>' since - it runs on CPython level. To return to PyPy, press . +Note that the prompt of the interpreter-level console is only '>>>' since +it runs on CPython level. To return to PyPy, press . Tracing +++++++ - You can also use the trace object space to trace the work of the - interpreter. To enable it, do on the PyPy console:: - - >>>> __pytrace__ = 1 - Tracing enabled - >>>> a = 1 + 2 - |-<<<<a = 1 + 2 @ 1>>>>>>> - |- 0 LOAD_CONST 0 (W_IntObject(1)) - |- 3 LOAD_CONST 1 (W_IntObject(2)) - |- 6 BINARY_ADD - |- >> add(W_IntObject(1), W_IntObject(2)) - |- add =: W_IntObject(3) - |- 7 STORE_NAME 0 (a) - |- >> setitem(globals(), W_StringObject('a'), W_IntObject(3)) - |- setitem =: - |-10 LOAD_CONST 2 () - |-13 RETURN_VALUE - |-<<<<a = 1 + 2 @ 1>>>>>>> +You can use the trace object space to monitor the interpretation +of bytecodes in connection with object space operations. To enable +it, set ``__pytrace__=1`` on the interactive PyPy console:: + + >>>> __pytrace__ = 1 + Tracing enabled + >>>> a = 1 + 2 + |-<<<<a = 1 + 2 @ 1>>>>>>> + |- 0 LOAD_CONST 0 (W_IntObject(1)) + |- 3 LOAD_CONST 1 (W_IntObject(2)) + |- 6 BINARY_ADD + |- >> add(W_IntObject(1), W_IntObject(2)) + |- add =: W_IntObject(3) + |- 7 STORE_NAME 0 (a) + |- >> setitem(globals(), W_StringObject('a'), W_IntObject(3)) + |- setitem =: + |-10 LOAD_CONST 2 () + |-13 RETURN_VALUE + |-<<<<a = 1 + 2 @ 1>>>>>>> Thunk object space (lazy objects) +++++++++++++++++++++++++++++++++ - One of the original features provided by the py.py interpreter that are - without equivalent in CPython is the "thunk" object space, providing - lazily-computed objects:: - - cd pypy/bin - python py.py -o thunk - - >>>> def longcomputation(lst): - .... print "computing..." - .... return sum(lst) - .... - >>>> x = thunk(longcomputation, range(5)) - >>>> y = thunk(longcomputation, range(10)) - >>>> d = {5: x, 10: y} - >>>> result = d[5] - >>>> result - computing... - 10 - >>>> type(d[10]) - computing... - - >>>> d[10] - 45 +One of the original features provided by the py.py interpreter that are +without equivalent in CPython is the "thunk" object space, providing +lazily-computed objects:: + + cd pypy/bin + python py.py -o thunk + + >>>> def longcomputation(lst): + .... print "computing..." + .... return sum(lst) + .... + >>>> x = thunk(longcomputation, range(5)) + >>>> y = thunk(longcomputation, range(10)) + >>>> d = {5: x, 10: y} + >>>> result = d[5] + >>>> result + computing... + 10 + >>>> type(d[10]) + computing... + + >>>> d[10] + 45 Running the tests +++++++++++++++++ - The PyPy project uses test-driven-development. Right now, there are - a couple of different categories of tests which you can run. - To run all the unit tests:: +The PyPy project uses test-driven-development. Right now, there are +a couple of different categories of tests which you can run. +To run all the unit tests:: - cd pypy - python test_all.py + cd pypy + python test_all.py - Alternatively, you may run subtests by going to the correct subdirectory - and running them individually:: +Alternatively, you may run subtests by going to the correct subdirectory +and running them individually:: - python test_all.py module/test/test_builtin.py + python test_all.py module/test/test_builtin.py - ``test_all.py`` is actually just a synonym for `py.test`_ which is - our external testing tool. If you have installed that then you - can as well just issue ``py.test DIRECTORY_OR_FILE`` in order - to perform test runs or simply start it without arguments to - run all tests below the current directory. +``test_all.py`` is actually just a synonym for `py.test`_ which is +our external testing tool. If you have installed that then you +can as well just issue ``py.test DIRECTORY_OR_FILE`` in order +to perform test runs or simply start it without arguments to +run all tests below the current directory. - Finally, there are standard regression tests which you can - run like this:: +Finally, there are standard regression tests which you can +run like this:: - cd lib-python-2.3.4/test - python ../../pypy/test_all.py -E + cd lib-python-2.3.4/test + python ../../pypy/test_all.py -E - or if you have `installed py.test`_ then you simply say:: +or if you have `installed py.test`_ then you simply say:: - py.test -E + py.test -E - from the lib-python-2.3.4/test directory. +from the lib-python-2.3.4/test directory. .. _`installed py.test`: http://codespeak.net/py/current/doc/getting_started.html @@ -453,7 +454,6 @@ (used for the optional Lisp translation backend) http://clisp.cons.org/_ ------------------------------------------------------------------------------- .. _`low level virtual machine`: http://llvm.cs.uiuc.edu/ .. _`how to install LLVM`: http://llvm.cs.uiuc.edu/docs/GettingStarted.html From arigo at codespeak.net Wed May 18 22:23:01 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Wed, 18 May 2005 22:23:01 +0200 (CEST) Subject: [pypy-svn] r12491 - pypy/dist/pypy/translator/pyrex/test Message-ID: <20050518202301.68F5527BC2@code1.codespeak.net> Author: arigo Date: Wed May 18 22:23:01 2005 New Revision: 12491 Modified: pypy/dist/pypy/translator/pyrex/test/test_pyrextrans.py Log: Oups! Modified: pypy/dist/pypy/translator/pyrex/test/test_pyrextrans.py ============================================================================== --- pypy/dist/pypy/translator/pyrex/test/test_pyrextrans.py (original) +++ pypy/dist/pypy/translator/pyrex/test/test_pyrextrans.py Wed May 18 22:23:01 2005 @@ -120,7 +120,7 @@ spec = spec[0] # use the first type only for the tests argstypelist.append(spec) t.annotate(argstypelist) - return skip_missing_compiler(t.compile) + return skip_missing_compiler(t.pyrexcompile) def test_set_attr(self): set_attr = self.getcompiled(snippet.set_attr) From arigo at codespeak.net Wed May 18 22:42:05 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Wed, 18 May 2005 22:42:05 +0200 (CEST) Subject: [pypy-svn] r12492 - in pypy/dist/pypy/module: builtin/test builtin/test/impsubdir sys2/test test Message-ID: <20050518204205.DA37527B97@code1.codespeak.net> Author: arigo Date: Wed May 18 22:42:05 2005 New Revision: 12492 Added: pypy/dist/pypy/module/builtin/test/ pypy/dist/pypy/module/builtin/test/__init__.py (contents, props changed) pypy/dist/pypy/module/builtin/test/autopath.py - copied unchanged from r12466, pypy/dist/pypy/module/test/autopath.py pypy/dist/pypy/module/builtin/test/impsubdir/ - copied from r12466, pypy/dist/pypy/module/test/impsubdir/ pypy/dist/pypy/module/builtin/test/test_apply.py - copied unchanged from r12466, pypy/dist/pypy/module/test/test_apply.py pypy/dist/pypy/module/builtin/test/test_builtin.py - copied unchanged from r12466, pypy/dist/pypy/module/test/test_builtin.py pypy/dist/pypy/module/builtin/test/test_complexobject.py - copied, changed from r12466, pypy/dist/pypy/module/test/test_complexobject.py pypy/dist/pypy/module/builtin/test/test_descriptor.py - copied unchanged from r12466, pypy/dist/pypy/module/test/test_newstyleclasses.py pypy/dist/pypy/module/builtin/test/test_filter.py - copied unchanged from r12466, pypy/dist/pypy/module/test/test_filter.py pypy/dist/pypy/module/builtin/test/test_functional.py - copied unchanged from r12466, pypy/dist/pypy/module/test/test_functional.py pypy/dist/pypy/module/builtin/test/test_import.py - copied unchanged from r12466, pypy/dist/pypy/module/test/test_import.py pypy/dist/pypy/module/builtin/test/test_minmax.py - copied unchanged from r12466, pypy/dist/pypy/module/test/test_minmax.py pypy/dist/pypy/module/builtin/test/test_range.py - copied unchanged from r12466, pypy/dist/pypy/module/test/test_range.py pypy/dist/pypy/module/builtin/test/test_reduce.py - copied unchanged from r12466, pypy/dist/pypy/module/test/test_reduce.py pypy/dist/pypy/module/builtin/test/test_vars.py - copied unchanged from r12466, pypy/dist/pypy/module/test/test_vars.py pypy/dist/pypy/module/builtin/test/test_zip.py - copied unchanged from r12466, pypy/dist/pypy/module/test/test_zip.py pypy/dist/pypy/module/sys2/test/ pypy/dist/pypy/module/sys2/test/__init__.py (contents, props changed) pypy/dist/pypy/module/sys2/test/autopath.py - copied unchanged from r12466, pypy/dist/pypy/module/test/autopath.py pypy/dist/pypy/module/sys2/test/test_sysmodule.py - copied unchanged from r12466, pypy/dist/pypy/module/test/test_sysmodule.py Removed: pypy/dist/pypy/module/test/ Log: issue56 Distributed the tests from pypy/module/test into new builtin/test and sys2/test subdirectories. Some tests could benefit from being split into files that match the files they are testing. Added: pypy/dist/pypy/module/builtin/test/__init__.py ============================================================================== Copied: pypy/dist/pypy/module/builtin/test/test_complexobject.py (from r12466, pypy/dist/pypy/module/test/test_complexobject.py) ============================================================================== --- pypy/dist/pypy/module/test/test_complexobject.py (original) +++ pypy/dist/pypy/module/builtin/test/test_complexobject.py Wed May 18 22:42:05 2005 @@ -24,15 +24,7 @@ import cmath import sys import types -#import unittest -#from pypy.tool import testit -#from pypy.appspace.complexobject import complex as pycomplex - -#from pypy.module.test.applevel_in_cpython import applevel_in_cpython -#our_own_builtin = applevel_in_cpython('__builtin__') -#pycomplex = our_own_builtin.complex - from pypy.module.builtin.app_complex import complex as pycomplex try: Added: pypy/dist/pypy/module/sys2/test/__init__.py ============================================================================== From hpk at codespeak.net Wed May 18 22:46:33 2005 From: hpk at codespeak.net (hpk at codespeak.net) Date: Wed, 18 May 2005 22:46:33 +0200 (CEST) Subject: [pypy-svn] r12493 - pypy/dist/pypy/documentation Message-ID: <20050518204633.40E9927B90@code1.codespeak.net> Author: hpk Date: Wed May 18 22:46:33 2005 New Revision: 12493 Modified: pypy/dist/pypy/documentation/getting_started.txt Log: issue37 testing beefing up the thunk space description and fixing some ReST Modified: pypy/dist/pypy/documentation/getting_started.txt ============================================================================== --- pypy/dist/pypy/documentation/getting_started.txt (original) +++ pypy/dist/pypy/documentation/getting_started.txt Wed May 18 22:46:33 2005 @@ -172,8 +172,8 @@ Note that the prompt of the interpreter-level console is only '>>>' since it runs on CPython level. To return to PyPy, press . -Tracing -+++++++ +Tracing bytecode and operations on objects +++++++++++++++++++++++++++++++++++++++++++ You can use the trace object space to monitor the interpretation of bytecodes in connection with object space operations. To enable @@ -195,12 +195,12 @@ |-13 RETURN_VALUE |-<<<<a = 1 + 2 @ 1>>>>>>> -Thunk object space (lazy objects) -+++++++++++++++++++++++++++++++++ +lazily computed objects ++++++++++++++++++++++++ One of the original features provided by the py.py interpreter that are without equivalent in CPython is the "thunk" object space, providing -lazily-computed objects:: +lazily-computed objects in a transparent manner:: cd pypy/bin python py.py -o thunk @@ -211,6 +211,12 @@ .... >>>> x = thunk(longcomputation, range(5)) >>>> y = thunk(longcomputation, range(10)) + +from the application perspective, ``x`` and ``y`` represent +exactly the objects being returned by the ``longcomputation()`` +invocations. You can put these objects into a dictionary +without triggering the computation:: + >>>> d = {5: x, 10: y} >>>> result = d[5] >>>> result @@ -222,6 +228,10 @@ >>>> d[10] 45 +It is interesting to note that this lazy-computing Python extension +is solely implemented in a small `objspace/thunk.py` file consisting +of around 100 lines of code. + Running the tests +++++++++++++++++ From hpk at codespeak.net Wed May 18 22:49:39 2005 From: hpk at codespeak.net (hpk at codespeak.net) Date: Wed, 18 May 2005 22:49:39 +0200 (CEST) Subject: [pypy-svn] r12494 - pypy/dist/pypy/documentation Message-ID: <20050518204939.C771427B90@code1.codespeak.net> Author: hpk Date: Wed May 18 22:49:39 2005 New Revision: 12494 Modified: pypy/dist/pypy/documentation/getting_started.txt Log: typo Modified: pypy/dist/pypy/documentation/getting_started.txt ============================================================================== --- pypy/dist/pypy/documentation/getting_started.txt (original) +++ pypy/dist/pypy/documentation/getting_started.txt Wed May 18 22:49:39 2005 @@ -229,7 +229,7 @@ 45 It is interesting to note that this lazy-computing Python extension -is solely implemented in a small `objspace/thunk.py` file consisting +is solely implemented in a small `objspace/thunk.py`_ file consisting of around 100 lines of code. Running the tests From hpk at codespeak.net Wed May 18 22:57:23 2005 From: hpk at codespeak.net (hpk at codespeak.net) Date: Wed, 18 May 2005 22:57:23 +0200 (CEST) Subject: [pypy-svn] r12495 - pypy/dist/pypy/documentation/website Message-ID: <20050518205723.8C22227B90@code1.codespeak.net> Author: hpk Date: Wed May 18 22:57:23 2005 New Revision: 12495 Modified: pypy/dist/pypy/documentation/website/news.txt Log: add some links the EP sprint news items Modified: pypy/dist/pypy/documentation/website/news.txt ============================================================================== --- pypy/dist/pypy/documentation/website/news.txt (original) +++ pypy/dist/pypy/documentation/website/news.txt Wed May 18 22:57:23 2005 @@ -16,14 +16,17 @@ Next Sprint after EuroPython 2005 1st-7th July ====================================================== -The next sprint is scheduled right after EuroPython 2005 in G?teborg, Sweden. +The next sprint is scheduled right after EuroPython_ 2005 in G?teborg, Sweden. We take a day of break after the conference and start sprinting from 1st-7th of July 2005. The sprint theme is likely to be related strongly to -translation and working towards getting a first self-contained PyPy +`translation`_ and working towards getting a first self-contained PyPy version. Additionally there will be a four day Pre-EuroPython sprint for people who already are familiar with the PyPy code base. *(05/04/2005)* +.. _EuroPython: http://europython.org +.. _`translation`: ../translation.html + Pycon 2005 Sprint in Washington finished ========================================================== From hpk at codespeak.net Wed May 18 23:03:48 2005 From: hpk at codespeak.net (hpk at codespeak.net) Date: Wed, 18 May 2005 23:03:48 +0200 (CEST) Subject: [pypy-svn] r12496 - pypy/dist/pypy/documentation Message-ID: <20050518210348.BCB6227B97@code1.codespeak.net> Author: hpk Date: Wed May 18 23:03:48 2005 New Revision: 12496 Modified: pypy/dist/pypy/documentation/coding-guide.txt Log: account a bit for the shifted tests Modified: pypy/dist/pypy/documentation/coding-guide.txt ============================================================================== --- pypy/dist/pypy/documentation/coding-guide.txt (original) +++ pypy/dist/pypy/documentation/coding-guide.txt Wed May 18 23:03:48 2005 @@ -589,7 +589,8 @@ Testing modules in ``pypy/module`` ---------------------------------- -Simply change to ``pypy/module`` and `run the tests as usual`_. +Simply change to ``pypy/module`` or to a subdirectory and `run the +tests as usual`_. Testing modules in ``lib-python`` @@ -598,8 +599,7 @@ In order to let CPython's regression tests run against PyPy you can switch to the `lib-python`_ directory and run the testing tool in order to start compliance tests. -(XXX ensure windows compatibility for producing test -reports). +(XXX check windows compatibility for producing test reports). Naming conventions and directory layout =========================================== From pedronis at codespeak.net Thu May 19 00:24:41 2005 From: pedronis at codespeak.net (pedronis at codespeak.net) Date: Thu, 19 May 2005 00:24:41 +0200 (CEST) Subject: [pypy-svn] r12497 - pypy/dist/pypy/translator/tool Message-ID: <20050518222441.33FBD27B96@code1.codespeak.net> Author: pedronis Date: Thu May 19 00:24:41 2005 New Revision: 12497 Modified: pypy/dist/pypy/translator/tool/buildpyxmodule.py Log: put pyrex dir in front of sys.path, there could be a local Pyrex installation (Armin's fix) Modified: pypy/dist/pypy/translator/tool/buildpyxmodule.py ============================================================================== --- pypy/dist/pypy/translator/tool/buildpyxmodule.py (original) +++ pypy/dist/pypy/translator/tool/buildpyxmodule.py Thu May 19 00:24:41 2005 @@ -124,7 +124,7 @@ from pypy.translator.pyrex import genpyrex pyrexdir = os.path.dirname(genpyrex.__file__) if pyrexdir not in sys.path: - sys.path.append(pyrexdir) + sys.path.insert(0, pyrexdir) from Pyrex.Compiler.Main import CompilationOptions, Context, PyrexError try: options = CompilationOptions(show_version = 0, From pedronis at codespeak.net Thu May 19 01:04:29 2005 From: pedronis at codespeak.net (pedronis at codespeak.net) Date: Thu, 19 May 2005 01:04:29 +0200 (CEST) Subject: [pypy-svn] r12498 - pypy/dist/pypy/translator/test Message-ID: <20050518230429.13B5E27B99@code1.codespeak.net> Author: pedronis Date: Thu May 19 01:04:28 2005 New Revision: 12498 Modified: pypy/dist/pypy/translator/test/test_annrpython.py Log: tests related to the changes in rev 12425 Modified: pypy/dist/pypy/translator/test/test_annrpython.py ============================================================================== --- pypy/dist/pypy/translator/test/test_annrpython.py (original) +++ pypy/dist/pypy/translator/test/test_annrpython.py Thu May 19 01:04:28 2005 @@ -1002,6 +1002,28 @@ assert a.binding(et) == t assert isinstance(a.binding(ev), annmodel.SomeInstance) and a.binding(ev).classdef.cls == Exception + def test_try_except_raise_finally1(self): + def h(): pass + def g(): pass + class X(Exception): pass + def f(): + try: + try: + g() + except X: + h() + raise + finally: + h() + a = self.RPythonAnnotator() + a.build_types(f, []) + fg = a.translator.getflowgraph(f) + et, ev = fg.exceptblock.inputargs + t = annmodel.SomeObject() + t.knowntype = type + t.is_type_of = [ev] + assert a.binding(et) == t + assert isinstance(a.binding(ev), annmodel.SomeInstance) and a.binding(ev).classdef.cls == Exception def g(n): From pedronis at codespeak.net Thu May 19 01:14:19 2005 From: pedronis at codespeak.net (pedronis at codespeak.net) Date: Thu, 19 May 2005 01:14:19 +0200 (CEST) Subject: [pypy-svn] r12499 - in pypy/dist/pypy/module: builtin/test sys2/test Message-ID: <20050518231419.3E53F27B92@code1.codespeak.net> Author: pedronis Date: Thu May 19 01:14:19 2005 New Revision: 12499 Modified: pypy/dist/pypy/module/builtin/test/ (props changed) pypy/dist/pypy/module/sys2/test/ (props changed) Log: set svn:ignore From pedronis at codespeak.net Thu May 19 01:15:48 2005 From: pedronis at codespeak.net (pedronis at codespeak.net) Date: Thu, 19 May 2005 01:15:48 +0200 (CEST) Subject: [pypy-svn] r12500 - in pypy/dist/pypy/translator/pyrex: . test Message-ID: <20050518231548.DE5F727B99@code1.codespeak.net> Author: pedronis Date: Thu May 19 01:15:48 2005 New Revision: 12500 Modified: pypy/dist/pypy/translator/pyrex/ (props changed) pypy/dist/pypy/translator/pyrex/test/ (props changed) Log: set svn:ignore From hpk at codespeak.net Thu May 19 08:58:26 2005 From: hpk at codespeak.net (hpk at codespeak.net) Date: Thu, 19 May 2005 08:58:26 +0200 (CEST) Subject: [pypy-svn] r12501 - pypy/dist Message-ID: <20050519065826.97CB027B8D@code1.codespeak.net> Author: hpk Date: Thu May 19 08:58:26 2005 New Revision: 12501 Added: pypy/dist/README Log: issue5 testing a draft for a small README file at toplevel. It points as discussed just to a few good entry points. Added: pypy/dist/README ============================================================================== --- (empty file) +++ pypy/dist/README Thu May 19 08:58:26 2005 @@ -0,0 +1,29 @@ +PyPy: Python in Python implementation Version 0.6 +================================================= + +Welcome to PyPy! PyPy-0.6 is the first public release +after two years of spare-time and half a year of European Union +funded development from a multitude of people and organizations. + +We invested a lot of time in improving the documentation and +website and thus invite you to head over to our getting-started +document + + http://codespeak.net/pypy/index.cgi?getting-started + +which gives you many good starting and entry points into +using and playing with PyPy. + +Our release announcement has more in-depth information +about this release. + + http://codespeak.net/pypy/index.cgi?doc/release-0.6.html + +Please freel free to contact or join us in one of the ways +listed in our contact page: + + http://codespeak.net/pypy/index.cgi?contact + +Enjoy and send us feedback! + + the pypy-dev team From hpk at codespeak.net Thu May 19 09:09:23 2005 From: hpk at codespeak.net (hpk at codespeak.net) Date: Thu, 19 May 2005 09:09:23 +0200 (CEST) Subject: [pypy-svn] r12502 - pypy/dist/pypy/documentation Message-ID: <20050519070923.6ADF527B8D@code1.codespeak.net> Author: hpk Date: Thu May 19 09:09:23 2005 New Revision: 12502 Modified: pypy/dist/pypy/documentation/index.txt Log: issue65 chatting - get rid of 'recently-modified' link which is not helpful anymore to determine which documentation is up to date (now we have pretty well organized & controled documentation IMO). - inserted a link to LICENSE. - i know that Armin/Samuele intended this issue to be more related to the huge "links and references" section and i agree that we want to clean it up Modified: pypy/dist/pypy/documentation/index.txt ============================================================================== --- pypy/dist/pypy/documentation/index.txt (original) +++ pypy/dist/pypy/documentation/index.txt Thu May 19 09:09:23 2005 @@ -20,12 +20,13 @@ * translation_ offers the beginnings of documentation about our low level code generator backends. - * recently-modified_ shows a list of recently modified - documentation - * `compliance test report`_ shows status information about recent runs of CPython's regression tests against PyPy. + * `license`_ tells you that basically all of PyPy is licensed + under the OSI-approved very liberal MIT-license + +.. _`license`: http://codespeak.net/svn/pypy/dist/LICENSE .. _`compliance test report`: http://codespeak.net/~hpk/pypy-testresult/ .. _`objspace`: objspace.html .. _`translation`: translation.html From ac at codespeak.net Thu May 19 10:04:31 2005 From: ac at codespeak.net (ac at codespeak.net) Date: Thu, 19 May 2005 10:04:31 +0200 (CEST) Subject: [pypy-svn] r12503 - pypy/branch/non-fake-unicode/pypy/objspace/std Message-ID: <20050519080431.5A7D727B8A@code1.codespeak.net> Author: ac Date: Thu May 19 10:04:31 2005 New Revision: 12503 Modified: pypy/branch/non-fake-unicode/pypy/objspace/std/unicodeobject.py Log: Add a primitive stringformatting to unicode. Modified: pypy/branch/non-fake-unicode/pypy/objspace/std/unicodeobject.py ============================================================================== --- pypy/branch/non-fake-unicode/pypy/objspace/std/unicodeobject.py (original) +++ pypy/branch/non-fake-unicode/pypy/objspace/std/unicodeobject.py Thu May 19 10:04:31 2005 @@ -765,10 +765,14 @@ else: raise TypeError("character mapping must return integer, None or unicode") return ''.join(result) - + +def mod__Unicode_ANY(format, values): + return unicode(format.encode("utf-8") % values, "utf-8") + ''') unicode_expandtabs__Unicode_ANY = app.interphook('unicode_expandtabs__Unicode_ANY') unicode_translate__Unicode_ANY = app.interphook('unicode_translate__Unicode_ANY') +mod__Unicode_ANY = app.interphook('mod__Unicode_ANY') import unicodetype register_all(vars(), unicodetype) From hpk at codespeak.net Thu May 19 10:21:35 2005 From: hpk at codespeak.net (hpk at codespeak.net) Date: Thu, 19 May 2005 10:21:35 +0200 (CEST) Subject: [pypy-svn] r12504 - in pypy/dist/pypy/documentation: . tool Message-ID: <20050519082135.102A227B8A@code1.codespeak.net> Author: hpk Date: Thu May 19 10:21:34 2005 New Revision: 12504 Added: pypy/dist/pypy/documentation/tool/makeref.py Removed: pypy/dist/pypy/documentation/tool/regenref.py Modified: pypy/dist/pypy/documentation/_ref.txt pypy/dist/pypy/documentation/coding-guide.txt pypy/dist/pypy/documentation/getting_started.txt pypy/dist/pypy/documentation/objspace.txt Log: issue53 testing removed the need to manually add SVN/file references as long as: - you specify them relative to 'dist' or to 'pypy' - linknames contain a slash To avoid having to generate thousands of links without them being used (docutils parsing is slow) the logic for generating references is now reversed: it starts off from the .txt files and generates all neccessary links. This means that if you add file references that previously didn't exist (py.test fails then), you have to run python documentation/tool/makeref.py Not sure yet, if this run should be integrated into py.test because it really modifies files (_ref.txt) and that is uncommon to do for testing. Modified: pypy/dist/pypy/documentation/_ref.txt ============================================================================== --- pypy/dist/pypy/documentation/_ref.txt (original) +++ pypy/dist/pypy/documentation/_ref.txt Thu May 19 10:21:34 2005 @@ -1,345 +1,39 @@ -.. _`annotation/`: http://codespeak.net/svn/pypy/dist/pypy/annotation/ -.. _`annotation/__init__.py`: http://codespeak.net/svn/pypy/dist/pypy/annotation/__init__.py -.. _`annotation/binaryop.py`: http://codespeak.net/svn/pypy/dist/pypy/annotation/binaryop.py -.. _`annotation/bookkeeper.py`: http://codespeak.net/svn/pypy/dist/pypy/annotation/bookkeeper.py -.. _`annotation/builtin.py`: http://codespeak.net/svn/pypy/dist/pypy/annotation/builtin.py -.. _`annotation/classdef.py`: http://codespeak.net/svn/pypy/dist/pypy/annotation/classdef.py -.. _`annotation/dictdef.py`: http://codespeak.net/svn/pypy/dist/pypy/annotation/dictdef.py -.. _`annotation/listdef.py`: http://codespeak.net/svn/pypy/dist/pypy/annotation/listdef.py -.. _`annotation/model.py`: http://codespeak.net/svn/pypy/dist/pypy/annotation/model.py -.. _`annotation/pairtype.py`: http://codespeak.net/svn/pypy/dist/pypy/annotation/pairtype.py -.. _`annotation/unaryop.py`: http://codespeak.net/svn/pypy/dist/pypy/annotation/unaryop.py -.. _`bin/`: http://codespeak.net/svn/pypy/dist/pypy/bin/ -.. _`bin/autopath.py`: http://codespeak.net/svn/pypy/dist/pypy/bin/autopath.py -.. _`bin/py.py`: http://codespeak.net/svn/pypy/dist/pypy/bin/py.py -.. _`bin/translator.py`: http://codespeak.net/svn/pypy/dist/pypy/bin/translator.py -.. _`documentation/`: http://codespeak.net/svn/pypy/dist/pypy/documentation/ -.. _`documentation/__init__.py`: http://codespeak.net/svn/pypy/dist/pypy/documentation/__init__.py -.. _`documentation/conftest.py`: http://codespeak.net/svn/pypy/dist/pypy/documentation/conftest.py -.. _`documentation/revreport/`: http://codespeak.net/svn/pypy/dist/pypy/documentation/revreport/ -.. _`documentation/revreport/__init__.py`: http://codespeak.net/svn/pypy/dist/pypy/documentation/revreport/__init__.py -.. _`documentation/revreport/autopath.py`: http://codespeak.net/svn/pypy/dist/pypy/documentation/revreport/autopath.py -.. _`documentation/revreport/delta.py`: http://codespeak.net/svn/pypy/dist/pypy/documentation/revreport/delta.py -.. _`documentation/revreport/revreport.py`: http://codespeak.net/svn/pypy/dist/pypy/documentation/revreport/revreport.py -.. _`documentation/test_redirections.py`: http://codespeak.net/svn/pypy/dist/pypy/documentation/test_redirections.py -.. _`documentation/tool/`: http://codespeak.net/svn/pypy/dist/pypy/documentation/tool/ -.. _`documentation/tool/__init__.py`: http://codespeak.net/svn/pypy/dist/pypy/documentation/tool/__init__.py -.. _`documentation/tool/regenref.py`: http://codespeak.net/svn/pypy/dist/pypy/documentation/tool/regenref.py -.. _`documentation/website/`: http://codespeak.net/svn/pypy/dist/pypy/documentation/website/ -.. _`documentation/x.py`: http://codespeak.net/svn/pypy/dist/pypy/documentation/x.py -.. _`interpreter/`: http://codespeak.net/svn/pypy/dist/pypy/interpreter/ -.. _`interpreter/__init__.py`: http://codespeak.net/svn/pypy/dist/pypy/interpreter/__init__.py -.. _`interpreter/argument.py`: http://codespeak.net/svn/pypy/dist/pypy/interpreter/argument.py -.. _`interpreter/autopath.py`: http://codespeak.net/svn/pypy/dist/pypy/interpreter/autopath.py -.. _`interpreter/baseobjspace.py`: http://codespeak.net/svn/pypy/dist/pypy/interpreter/baseobjspace.py -.. _`interpreter/compiler.py`: http://codespeak.net/svn/pypy/dist/pypy/interpreter/compiler.py -.. _`interpreter/debug.py`: http://codespeak.net/svn/pypy/dist/pypy/interpreter/debug.py -.. _`interpreter/error.py`: http://codespeak.net/svn/pypy/dist/pypy/interpreter/error.py -.. _`interpreter/eval.py`: http://codespeak.net/svn/pypy/dist/pypy/interpreter/eval.py -.. _`interpreter/executioncontext.py`: http://codespeak.net/svn/pypy/dist/pypy/interpreter/executioncontext.py -.. _`interpreter/function.py`: http://codespeak.net/svn/pypy/dist/pypy/interpreter/function.py -.. _`interpreter/gateway.py`: http://codespeak.net/svn/pypy/dist/pypy/interpreter/gateway.py -.. _`interpreter/generator.py`: http://codespeak.net/svn/pypy/dist/pypy/interpreter/generator.py -.. _`interpreter/interactive.py`: http://codespeak.net/svn/pypy/dist/pypy/interpreter/interactive.py -.. _`interpreter/main.py`: http://codespeak.net/svn/pypy/dist/pypy/interpreter/main.py -.. _`interpreter/miscutils.py`: http://codespeak.net/svn/pypy/dist/pypy/interpreter/miscutils.py -.. _`interpreter/mixedmodule.py`: http://codespeak.net/svn/pypy/dist/pypy/interpreter/mixedmodule.py -.. _`interpreter/module.py`: http://codespeak.net/svn/pypy/dist/pypy/interpreter/module.py -.. _`interpreter/nestedscope.py`: http://codespeak.net/svn/pypy/dist/pypy/interpreter/nestedscope.py -.. _`interpreter/pycode.py`: http://codespeak.net/svn/pypy/dist/pypy/interpreter/pycode.py -.. _`interpreter/pyframe.py`: http://codespeak.net/svn/pypy/dist/pypy/interpreter/pyframe.py -.. _`interpreter/pyopcode.py`: http://codespeak.net/svn/pypy/dist/pypy/interpreter/pyopcode.py -.. _`interpreter/pytraceback.py`: http://codespeak.net/svn/pypy/dist/pypy/interpreter/pytraceback.py -.. _`interpreter/special.py`: http://codespeak.net/svn/pypy/dist/pypy/interpreter/special.py -.. _`interpreter/typedef.py`: http://codespeak.net/svn/pypy/dist/pypy/interpreter/typedef.py -.. _`interpreter/x.py`: http://codespeak.net/svn/pypy/dist/pypy/interpreter/x.py -.. _`lib/`: http://codespeak.net/svn/pypy/dist/pypy/lib/ -.. _`lib/__init__.py`: http://codespeak.net/svn/pypy/dist/pypy/lib/__init__.py -.. _`lib/_classobj.py`: http://codespeak.net/svn/pypy/dist/pypy/lib/_classobj.py -.. _`lib/_exceptions.py`: http://codespeak.net/svn/pypy/dist/pypy/lib/_exceptions.py -.. _`lib/_file.py`: http://codespeak.net/svn/pypy/dist/pypy/lib/_file.py -.. _`lib/_float_formatting.py`: http://codespeak.net/svn/pypy/dist/pypy/lib/_float_formatting.py -.. _`lib/_formatting.py`: http://codespeak.net/svn/pypy/dist/pypy/lib/_formatting.py -.. _`lib/_sio.py`: http://codespeak.net/svn/pypy/dist/pypy/lib/_sio.py -.. _`lib/cPickle.py`: http://codespeak.net/svn/pypy/dist/pypy/lib/cPickle.py -.. _`lib/cStringIO.py`: http://codespeak.net/svn/pypy/dist/pypy/lib/cStringIO.py -.. _`lib/cmath.py`: http://codespeak.net/svn/pypy/dist/pypy/lib/cmath.py -.. _`lib/datetime.py`: http://codespeak.net/svn/pypy/dist/pypy/lib/datetime.py -.. _`lib/decimal.py`: http://codespeak.net/svn/pypy/dist/pypy/lib/decimal.py -.. _`lib/gc.py`: http://codespeak.net/svn/pypy/dist/pypy/lib/gc.py -.. _`lib/imp.py`: http://codespeak.net/svn/pypy/dist/pypy/lib/imp.py -.. _`lib/inprogress__codecs.py`: http://codespeak.net/svn/pypy/dist/pypy/lib/inprogress__codecs.py -.. _`lib/inprogress_binascii.py`: http://codespeak.net/svn/pypy/dist/pypy/lib/inprogress_binascii.py -.. _`lib/itertools.py`: http://codespeak.net/svn/pypy/dist/pypy/lib/itertools.py -.. _`lib/marshal.py`: http://codespeak.net/svn/pypy/dist/pypy/lib/marshal.py -.. _`lib/md5.py`: http://codespeak.net/svn/pypy/dist/pypy/lib/md5.py -.. _`lib/operator.py`: http://codespeak.net/svn/pypy/dist/pypy/lib/operator.py -.. _`lib/random.py`: http://codespeak.net/svn/pypy/dist/pypy/lib/random.py -.. _`lib/sha.py`: http://codespeak.net/svn/pypy/dist/pypy/lib/sha.py -.. _`lib/struct.py`: http://codespeak.net/svn/pypy/dist/pypy/lib/struct.py -.. _`lib/test2/`: http://codespeak.net/svn/pypy/dist/pypy/lib/test2/ -.. _`lib/test2/FIXME_test_sio.py`: http://codespeak.net/svn/pypy/dist/pypy/lib/test2/FIXME_test_sio.py -.. _`lib/test2/__init__.py`: http://codespeak.net/svn/pypy/dist/pypy/lib/test2/__init__.py -.. _`lib/test2/no_test_pickle_extra.py`: http://codespeak.net/svn/pypy/dist/pypy/lib/test2/no_test_pickle_extra.py -.. _`lib/test2/test_binascii_extra.py`: http://codespeak.net/svn/pypy/dist/pypy/lib/test2/test_binascii_extra.py -.. _`lib/test2/test_codeccallbacks.py`: http://codespeak.net/svn/pypy/dist/pypy/lib/test2/test_codeccallbacks.py -.. _`lib/test2/test_exception_extra.py`: http://codespeak.net/svn/pypy/dist/pypy/lib/test2/test_exception_extra.py -.. _`lib/test2/test_exceptions_extra.py`: http://codespeak.net/svn/pypy/dist/pypy/lib/test2/test_exceptions_extra.py -.. _`lib/test2/test_file_extra.py`: http://codespeak.net/svn/pypy/dist/pypy/lib/test2/test_file_extra.py -.. _`lib/test2/test_imp_extra.py`: http://codespeak.net/svn/pypy/dist/pypy/lib/test2/test_imp_extra.py -.. _`lib/test2/test_md5_extra.py`: http://codespeak.net/svn/pypy/dist/pypy/lib/test2/test_md5_extra.py -.. _`lib/test2/test_sha_extra.py`: http://codespeak.net/svn/pypy/dist/pypy/lib/test2/test_sha_extra.py -.. _`lib/test2/test_string_extra.py`: http://codespeak.net/svn/pypy/dist/pypy/lib/test2/test_string_extra.py -.. _`lib/test2/test_struct_extra.py`: http://codespeak.net/svn/pypy/dist/pypy/lib/test2/test_struct_extra.py -.. _`lib/unicodecodec.py`: http://codespeak.net/svn/pypy/dist/pypy/lib/unicodecodec.py -.. _`module/`: http://codespeak.net/svn/pypy/dist/pypy/module/ -.. _`module/__init__.py`: http://codespeak.net/svn/pypy/dist/pypy/module/__init__.py -.. _`module/_sre_pypy/`: http://codespeak.net/svn/pypy/dist/pypy/module/_sre_pypy/ -.. _`module/_sre_pypy/__init__.py`: http://codespeak.net/svn/pypy/dist/pypy/module/_sre_pypy/__init__.py -.. _`module/_sre_pypy/application_code.py`: http://codespeak.net/svn/pypy/dist/pypy/module/_sre_pypy/application_code.py -.. _`module/_sre_pypy/interpreter_code.py`: http://codespeak.net/svn/pypy/dist/pypy/module/_sre_pypy/interpreter_code.py -.. _`module/_sre_pypy/test.py`: http://codespeak.net/svn/pypy/dist/pypy/module/_sre_pypy/test.py -.. _`module/builtin/`: http://codespeak.net/svn/pypy/dist/pypy/module/builtin/ -.. _`module/builtin/__init__.py`: http://codespeak.net/svn/pypy/dist/pypy/module/builtin/__init__.py -.. _`module/builtin/app_buffer.py`: http://codespeak.net/svn/pypy/dist/pypy/module/builtin/app_buffer.py -.. _`module/builtin/app_complex.py`: http://codespeak.net/svn/pypy/dist/pypy/module/builtin/app_complex.py -.. _`module/builtin/app_descriptor.py`: http://codespeak.net/svn/pypy/dist/pypy/module/builtin/app_descriptor.py -.. _`module/builtin/app_functional.py`: http://codespeak.net/svn/pypy/dist/pypy/module/builtin/app_functional.py -.. _`module/builtin/app_help.py`: http://codespeak.net/svn/pypy/dist/pypy/module/builtin/app_help.py -.. _`module/builtin/app_inspect.py`: http://codespeak.net/svn/pypy/dist/pypy/module/builtin/app_inspect.py -.. _`module/builtin/app_io.py`: http://codespeak.net/svn/pypy/dist/pypy/module/builtin/app_io.py -.. _`module/builtin/app_misc.py`: http://codespeak.net/svn/pypy/dist/pypy/module/builtin/app_misc.py -.. _`module/builtin/compiling.py`: http://codespeak.net/svn/pypy/dist/pypy/module/builtin/compiling.py -.. _`module/builtin/importing.py`: http://codespeak.net/svn/pypy/dist/pypy/module/builtin/importing.py -.. _`module/builtin/operation.py`: http://codespeak.net/svn/pypy/dist/pypy/module/builtin/operation.py -.. _`module/classobjinterp.py`: http://codespeak.net/svn/pypy/dist/pypy/module/classobjinterp.py -.. _`module/exceptionsinterp.py`: http://codespeak.net/svn/pypy/dist/pypy/module/exceptionsinterp.py -.. _`module/parser/`: http://codespeak.net/svn/pypy/dist/pypy/module/parser/ -.. _`module/parser/DFAParser.py`: http://codespeak.net/svn/pypy/dist/pypy/module/parser/DFAParser.py -.. _`module/parser/PgenParser.py`: http://codespeak.net/svn/pypy/dist/pypy/module/parser/PgenParser.py -.. _`module/parser/PyGrammar.py`: http://codespeak.net/svn/pypy/dist/pypy/module/parser/PyGrammar.py -.. _`module/parser/PyPgen.py`: http://codespeak.net/svn/pypy/dist/pypy/module/parser/PyPgen.py -.. _`module/parser/PyTokenizer.py`: http://codespeak.net/svn/pypy/dist/pypy/module/parser/PyTokenizer.py -.. _`module/parser/StdTokenizer.py`: http://codespeak.net/svn/pypy/dist/pypy/module/parser/StdTokenizer.py -.. _`module/parser/TokenUtils.py`: http://codespeak.net/svn/pypy/dist/pypy/module/parser/TokenUtils.py -.. _`module/parser/__init__.py`: http://codespeak.net/svn/pypy/dist/pypy/module/parser/__init__.py -.. _`module/parser/app_class.py`: http://codespeak.net/svn/pypy/dist/pypy/module/parser/app_class.py -.. _`module/parser/automata.py`: http://codespeak.net/svn/pypy/dist/pypy/module/parser/automata.py -.. _`module/parser/genPytokenize.py`: http://codespeak.net/svn/pypy/dist/pypy/module/parser/genPytokenize.py -.. _`module/parser/pyparser.py`: http://codespeak.net/svn/pypy/dist/pypy/module/parser/pyparser.py -.. _`module/parser/pytokenize.py`: http://codespeak.net/svn/pypy/dist/pypy/module/parser/pytokenize.py -.. _`module/recparser/`: http://codespeak.net/svn/pypy/dist/pypy/module/recparser/ -.. _`module/recparser/__init__.py`: http://codespeak.net/svn/pypy/dist/pypy/module/recparser/__init__.py -.. _`module/recparser/compat.py`: http://codespeak.net/svn/pypy/dist/pypy/module/recparser/compat.py -.. _`module/recparser/ebnflexer.py`: http://codespeak.net/svn/pypy/dist/pypy/module/recparser/ebnflexer.py -.. _`module/recparser/ebnfparse.py`: http://codespeak.net/svn/pypy/dist/pypy/module/recparser/ebnfparse.py -.. _`module/recparser/grammar.py`: http://codespeak.net/svn/pypy/dist/pypy/module/recparser/grammar.py -.. _`module/recparser/pyparser.py`: http://codespeak.net/svn/pypy/dist/pypy/module/recparser/pyparser.py -.. _`module/recparser/pythonlexer.py`: http://codespeak.net/svn/pypy/dist/pypy/module/recparser/pythonlexer.py -.. _`module/recparser/pythonparse.py`: http://codespeak.net/svn/pypy/dist/pypy/module/recparser/pythonparse.py -.. _`module/recparser/pythonutil.py`: http://codespeak.net/svn/pypy/dist/pypy/module/recparser/pythonutil.py -.. _`module/recparser/syntaxtree.py`: http://codespeak.net/svn/pypy/dist/pypy/module/recparser/syntaxtree.py -.. _`module/sys2/`: http://codespeak.net/svn/pypy/dist/pypy/module/sys2/ -.. _`module/sys2/__init__.py`: http://codespeak.net/svn/pypy/dist/pypy/module/sys2/__init__.py -.. _`module/sys2/app.py`: http://codespeak.net/svn/pypy/dist/pypy/module/sys2/app.py -.. _`module/sys2/hook.py`: http://codespeak.net/svn/pypy/dist/pypy/module/sys2/hook.py -.. _`module/sys2/state.py`: http://codespeak.net/svn/pypy/dist/pypy/module/sys2/state.py -.. _`module/sys2/vm.py`: http://codespeak.net/svn/pypy/dist/pypy/module/sys2/vm.py -.. _`objspace/`: http://codespeak.net/svn/pypy/dist/pypy/objspace/ -.. _`objspace/__init__.py`: http://codespeak.net/svn/pypy/dist/pypy/objspace/__init__.py -.. _`objspace/descroperation.py`: http://codespeak.net/svn/pypy/dist/pypy/objspace/descroperation.py -.. _`objspace/dummy.py`: http://codespeak.net/svn/pypy/dist/pypy/objspace/dummy.py -.. _`objspace/flow/`: http://codespeak.net/svn/pypy/dist/pypy/objspace/flow/ -.. _`objspace/flow/__init__.py`: http://codespeak.net/svn/pypy/dist/pypy/objspace/flow/__init__.py -.. _`objspace/flow/flowcontext.py`: http://codespeak.net/svn/pypy/dist/pypy/objspace/flow/flowcontext.py -.. _`objspace/flow/framestate.py`: http://codespeak.net/svn/pypy/dist/pypy/objspace/flow/framestate.py -.. _`objspace/flow/model.py`: http://codespeak.net/svn/pypy/dist/pypy/objspace/flow/model.py -.. _`objspace/flow/objspace.py`: http://codespeak.net/svn/pypy/dist/pypy/objspace/flow/objspace.py -.. _`objspace/flow/operation.py`: http://codespeak.net/svn/pypy/dist/pypy/objspace/flow/operation.py -.. _`objspace/flow/specialcase.py`: http://codespeak.net/svn/pypy/dist/pypy/objspace/flow/specialcase.py -.. _`objspace/proxy.py`: http://codespeak.net/svn/pypy/dist/pypy/objspace/proxy.py -.. _`objspace/std/`: http://codespeak.net/svn/pypy/dist/pypy/objspace/std/ -.. _`objspace/std/__init__.py`: http://codespeak.net/svn/pypy/dist/pypy/objspace/std/__init__.py -.. _`objspace/std/autopath.py`: http://codespeak.net/svn/pypy/dist/pypy/objspace/std/autopath.py -.. _`objspace/std/basestringtype.py`: http://codespeak.net/svn/pypy/dist/pypy/objspace/std/basestringtype.py -.. _`objspace/std/boolobject.py`: http://codespeak.net/svn/pypy/dist/pypy/objspace/std/boolobject.py -.. _`objspace/std/booltype.py`: http://codespeak.net/svn/pypy/dist/pypy/objspace/std/booltype.py -.. _`objspace/std/default.py`: http://codespeak.net/svn/pypy/dist/pypy/objspace/std/default.py -.. _`objspace/std/dictobject.py`: http://codespeak.net/svn/pypy/dist/pypy/objspace/std/dictobject.py -.. _`objspace/std/dictproxyobject.py`: http://codespeak.net/svn/pypy/dist/pypy/objspace/std/dictproxyobject.py -.. _`objspace/std/dictproxytype.py`: http://codespeak.net/svn/pypy/dist/pypy/objspace/std/dictproxytype.py -.. _`objspace/std/dicttype.py`: http://codespeak.net/svn/pypy/dist/pypy/objspace/std/dicttype.py -.. _`objspace/std/dump_multimethod.py`: http://codespeak.net/svn/pypy/dist/pypy/objspace/std/dump_multimethod.py -.. _`objspace/std/fake.py`: http://codespeak.net/svn/pypy/dist/pypy/objspace/std/fake.py -.. _`objspace/std/floatobject.py`: http://codespeak.net/svn/pypy/dist/pypy/objspace/std/floatobject.py -.. _`objspace/std/floattype.py`: http://codespeak.net/svn/pypy/dist/pypy/objspace/std/floattype.py -.. _`objspace/std/intobject.py`: http://codespeak.net/svn/pypy/dist/pypy/objspace/std/intobject.py -.. _`objspace/std/inttype.py`: http://codespeak.net/svn/pypy/dist/pypy/objspace/std/inttype.py -.. _`objspace/std/iterobject.py`: http://codespeak.net/svn/pypy/dist/pypy/objspace/std/iterobject.py -.. _`objspace/std/itertype.py`: http://codespeak.net/svn/pypy/dist/pypy/objspace/std/itertype.py -.. _`objspace/std/listobject.py`: http://codespeak.net/svn/pypy/dist/pypy/objspace/std/listobject.py -.. _`objspace/std/listsort.py`: http://codespeak.net/svn/pypy/dist/pypy/objspace/std/listsort.py -.. _`objspace/std/listtype.py`: http://codespeak.net/svn/pypy/dist/pypy/objspace/std/listtype.py -.. _`objspace/std/longobject.py`: http://codespeak.net/svn/pypy/dist/pypy/objspace/std/longobject.py -.. _`objspace/std/longtype.py`: http://codespeak.net/svn/pypy/dist/pypy/objspace/std/longtype.py -.. _`objspace/std/model.py`: http://codespeak.net/svn/pypy/dist/pypy/objspace/std/model.py -.. _`objspace/std/mro.py`: http://codespeak.net/svn/pypy/dist/pypy/objspace/std/mro.py -.. _`objspace/std/multimethod.py`: http://codespeak.net/svn/pypy/dist/pypy/objspace/std/multimethod.py -.. _`objspace/std/noneobject.py`: http://codespeak.net/svn/pypy/dist/pypy/objspace/std/noneobject.py -.. _`objspace/std/nonetype.py`: http://codespeak.net/svn/pypy/dist/pypy/objspace/std/nonetype.py -.. _`objspace/std/objectobject.py`: http://codespeak.net/svn/pypy/dist/pypy/objspace/std/objectobject.py -.. _`objspace/std/objecttype.py`: http://codespeak.net/svn/pypy/dist/pypy/objspace/std/objecttype.py -.. _`objspace/std/objspace.py`: http://codespeak.net/svn/pypy/dist/pypy/objspace/std/objspace.py -.. _`objspace/std/register_all.py`: http://codespeak.net/svn/pypy/dist/pypy/objspace/std/register_all.py -.. _`objspace/std/sliceobject.py`: http://codespeak.net/svn/pypy/dist/pypy/objspace/std/sliceobject.py -.. _`objspace/std/slicetype.py`: http://codespeak.net/svn/pypy/dist/pypy/objspace/std/slicetype.py -.. _`objspace/std/stdtypedef.py`: http://codespeak.net/svn/pypy/dist/pypy/objspace/std/stdtypedef.py -.. _`objspace/std/stringobject.py`: http://codespeak.net/svn/pypy/dist/pypy/objspace/std/stringobject.py -.. _`objspace/std/stringtype.py`: http://codespeak.net/svn/pypy/dist/pypy/objspace/std/stringtype.py -.. _`objspace/std/strutil.py`: http://codespeak.net/svn/pypy/dist/pypy/objspace/std/strutil.py -.. _`objspace/std/tupleobject.py`: http://codespeak.net/svn/pypy/dist/pypy/objspace/std/tupleobject.py -.. _`objspace/std/tupletype.py`: http://codespeak.net/svn/pypy/dist/pypy/objspace/std/tupletype.py -.. _`objspace/std/typeobject.py`: http://codespeak.net/svn/pypy/dist/pypy/objspace/std/typeobject.py -.. _`objspace/std/typetype.py`: http://codespeak.net/svn/pypy/dist/pypy/objspace/std/typetype.py -.. _`objspace/std/unicodeobject.py`: http://codespeak.net/svn/pypy/dist/pypy/objspace/std/unicodeobject.py -.. _`objspace/std/unicodetype.py`: http://codespeak.net/svn/pypy/dist/pypy/objspace/std/unicodetype.py +.. _`demo/`: http://codespeak.net/svn/pypy/dist/demo +.. _`lib-python/`: http://codespeak.net/svn/pypy/dist/lib-python +.. _`pypy/annotation`: +.. _`annotation/`: http://codespeak.net/svn/pypy/dist/pypy/annotation +.. _`documentation/`: http://codespeak.net/svn/pypy/dist/pypy/documentation +.. _`documentation/revreport/`: http://codespeak.net/svn/pypy/dist/pypy/documentation/revreport +.. _`documentation/website/`: http://codespeak.net/svn/pypy/dist/pypy/documentation/website +.. _`pypy/interpreter`: +.. _`interpreter/`: http://codespeak.net/svn/pypy/dist/pypy/interpreter +.. _`lib/`: +.. _`pypy/lib/`: http://codespeak.net/svn/pypy/dist/pypy/lib +.. _`lib/test2/`: +.. _`pypy/lib/test2`: http://codespeak.net/svn/pypy/dist/pypy/lib/test2 +.. _`module/`: +.. _`pypy/module`: http://codespeak.net/svn/pypy/dist/pypy/module +.. _`module/_sre_pypy/`: http://codespeak.net/svn/pypy/dist/pypy/module/_sre_pypy +.. _`module/builtin/`: http://codespeak.net/svn/pypy/dist/pypy/module/builtin +.. _`pypy/module/builtin/__init__.py`: http://codespeak.net/svn/pypy/dist/pypy/module/builtin/__init__.py +.. _`module/parser/`: http://codespeak.net/svn/pypy/dist/pypy/module/parser +.. _`module/recparser/`: http://codespeak.net/svn/pypy/dist/pypy/module/recparser +.. _`module/sys2/`: http://codespeak.net/svn/pypy/dist/pypy/module/sys2 +.. _`pypy/objspace`: +.. _`objspace/`: http://codespeak.net/svn/pypy/dist/pypy/objspace +.. _`objspace/flow/`: http://codespeak.net/svn/pypy/dist/pypy/objspace/flow +.. _`pypy/objspace/std`: +.. _`objspace/std/`: http://codespeak.net/svn/pypy/dist/pypy/objspace/std .. _`objspace/thunk.py`: http://codespeak.net/svn/pypy/dist/pypy/objspace/thunk.py .. _`objspace/trace.py`: http://codespeak.net/svn/pypy/dist/pypy/objspace/trace.py -.. _`rpython/`: http://codespeak.net/svn/pypy/dist/pypy/rpython/ -.. _`rpython/__init__.py`: http://codespeak.net/svn/pypy/dist/pypy/rpython/__init__.py -.. _`rpython/lltypes.py`: http://codespeak.net/svn/pypy/dist/pypy/rpython/lltypes.py -.. _`rpython/rarithmetic.py`: http://codespeak.net/svn/pypy/dist/pypy/rpython/rarithmetic.py -.. _`rpython/rlist.py`: http://codespeak.net/svn/pypy/dist/pypy/rpython/rlist.py -.. _`rpython/typer.py`: http://codespeak.net/svn/pypy/dist/pypy/rpython/typer.py -.. _`tool/`: http://codespeak.net/svn/pypy/dist/pypy/tool/ -.. _`tool/__init__.py`: http://codespeak.net/svn/pypy/dist/pypy/tool/__init__.py -.. _`tool/_enum_exceptions.py`: http://codespeak.net/svn/pypy/dist/pypy/tool/_enum_exceptions.py -.. _`tool/alarm.py`: http://codespeak.net/svn/pypy/dist/pypy/tool/alarm.py -.. _`tool/ansi_print.py`: http://codespeak.net/svn/pypy/dist/pypy/tool/ansi_print.py -.. _`tool/autopath.py`: http://codespeak.net/svn/pypy/dist/pypy/tool/autopath.py -.. _`tool/cache.py`: http://codespeak.net/svn/pypy/dist/pypy/tool/cache.py -.. _`tool/compile.py`: http://codespeak.net/svn/pypy/dist/pypy/tool/compile.py -.. _`tool/dotypes.py`: http://codespeak.net/svn/pypy/dist/pypy/tool/dotypes.py -.. _`tool/example_pytest.py`: http://codespeak.net/svn/pypy/dist/pypy/tool/example_pytest.py -.. _`tool/fiximport.py`: http://codespeak.net/svn/pypy/dist/pypy/tool/fiximport.py -.. _`tool/hack.py`: http://codespeak.net/svn/pypy/dist/pypy/tool/hack.py -.. _`tool/methodChecker.py`: http://codespeak.net/svn/pypy/dist/pypy/tool/methodChecker.py -.. _`tool/opcode.py`: http://codespeak.net/svn/pypy/dist/pypy/tool/opcode.py -.. _`tool/optik.py`: http://codespeak.net/svn/pypy/dist/pypy/tool/optik.py -.. _`tool/option.py`: http://codespeak.net/svn/pypy/dist/pypy/tool/option.py -.. _`tool/ppdb.py`: http://codespeak.net/svn/pypy/dist/pypy/tool/ppdb.py -.. _`tool/pydis.py`: http://codespeak.net/svn/pypy/dist/pypy/tool/pydis.py -.. _`tool/pypyrev.py`: http://codespeak.net/svn/pypy/dist/pypy/tool/pypyrev.py -.. _`tool/pytest/`: http://codespeak.net/svn/pypy/dist/pypy/tool/pytest/ -.. _`tool/pytest/__init__.py`: http://codespeak.net/svn/pypy/dist/pypy/tool/pytest/__init__.py -.. _`tool/pytest/appsupport.py`: http://codespeak.net/svn/pypy/dist/pypy/tool/pytest/appsupport.py -.. _`tool/pytest/autopath.py`: http://codespeak.net/svn/pypy/dist/pypy/tool/pytest/autopath.py -.. _`tool/pytest/confpath.py`: http://codespeak.net/svn/pypy/dist/pypy/tool/pytest/confpath.py -.. _`tool/pytest/genreportdata.py`: http://codespeak.net/svn/pypy/dist/pypy/tool/pytest/genreportdata.py -.. _`tool/pytest/htmlreport.py`: http://codespeak.net/svn/pypy/dist/pypy/tool/pytest/htmlreport.py -.. _`tool/pytest/overview.py`: http://codespeak.net/svn/pypy/dist/pypy/tool/pytest/overview.py -.. _`tool/pytest/regrverbose.py`: http://codespeak.net/svn/pypy/dist/pypy/tool/pytest/regrverbose.py -.. _`tool/pytest/result.py`: http://codespeak.net/svn/pypy/dist/pypy/tool/pytest/result.py -.. _`tool/sourcetools.py`: http://codespeak.net/svn/pypy/dist/pypy/tool/sourcetools.py -.. _`tool/stdprofile.py`: http://codespeak.net/svn/pypy/dist/pypy/tool/stdprofile.py -.. _`tool/tb_server/`: http://codespeak.net/svn/pypy/dist/pypy/tool/tb_server/ -.. _`tool/tb_server/__init__.py`: http://codespeak.net/svn/pypy/dist/pypy/tool/tb_server/__init__.py -.. _`tool/tb_server/render.py`: http://codespeak.net/svn/pypy/dist/pypy/tool/tb_server/render.py -.. _`tool/tb_server/server.py`: http://codespeak.net/svn/pypy/dist/pypy/tool/tb_server/server.py -.. _`tool/template.py`: http://codespeak.net/svn/pypy/dist/pypy/tool/template.py -.. _`tool/testpm.py`: http://codespeak.net/svn/pypy/dist/pypy/tool/testpm.py -.. _`tool/tls.py`: http://codespeak.net/svn/pypy/dist/pypy/tool/tls.py -.. _`tool/traceop.py`: http://codespeak.net/svn/pypy/dist/pypy/tool/traceop.py -.. _`tool/udir.py`: http://codespeak.net/svn/pypy/dist/pypy/tool/udir.py -.. _`tool/uid.py`: http://codespeak.net/svn/pypy/dist/pypy/tool/uid.py -.. _`tool/unionfind.py`: http://codespeak.net/svn/pypy/dist/pypy/tool/unionfind.py -.. _`tool/utestconvert.py`: http://codespeak.net/svn/pypy/dist/pypy/tool/utestconvert.py -.. _`translator/`: http://codespeak.net/svn/pypy/dist/pypy/translator/ -.. _`translator/__init__.py`: http://codespeak.net/svn/pypy/dist/pypy/translator/__init__.py -.. _`translator/ann_override.py`: http://codespeak.net/svn/pypy/dist/pypy/translator/ann_override.py -.. _`translator/annrpython.py`: http://codespeak.net/svn/pypy/dist/pypy/translator/annrpython.py -.. _`translator/autopath.py`: http://codespeak.net/svn/pypy/dist/pypy/translator/autopath.py -.. _`translator/c/`: http://codespeak.net/svn/pypy/dist/pypy/translator/c/ -.. _`translator/genc/`: http://codespeak.net/svn/pypy/dist/pypy/translator/genc/ -.. _`translator/genc/__init__.py`: http://codespeak.net/svn/pypy/dist/pypy/translator/genc/__init__.py -.. _`translator/genc/autopath.py`: http://codespeak.net/svn/pypy/dist/pypy/translator/genc/autopath.py -.. _`translator/genc/basetype.py`: http://codespeak.net/svn/pypy/dist/pypy/translator/genc/basetype.py -.. _`translator/genc/classtype.py`: http://codespeak.net/svn/pypy/dist/pypy/translator/genc/classtype.py -.. _`translator/genc/ctyper.py`: http://codespeak.net/svn/pypy/dist/pypy/translator/genc/ctyper.py -.. _`translator/genc/funcdef.py`: http://codespeak.net/svn/pypy/dist/pypy/translator/genc/funcdef.py -.. _`translator/genc/functype.py`: http://codespeak.net/svn/pypy/dist/pypy/translator/genc/functype.py -.. _`translator/genc/genc.py`: http://codespeak.net/svn/pypy/dist/pypy/translator/genc/genc.py -.. _`translator/genc/heapobjecttype.py`: http://codespeak.net/svn/pypy/dist/pypy/translator/genc/heapobjecttype.py -.. _`translator/genc/instancetype.py`: http://codespeak.net/svn/pypy/dist/pypy/translator/genc/instancetype.py -.. _`translator/genc/inttype.py`: http://codespeak.net/svn/pypy/dist/pypy/translator/genc/inttype.py -.. _`translator/genc/listtype.py`: http://codespeak.net/svn/pypy/dist/pypy/translator/genc/listtype.py -.. _`translator/genc/lltype.py`: http://codespeak.net/svn/pypy/dist/pypy/translator/genc/lltype.py -.. _`translator/genc/nonetype.py`: http://codespeak.net/svn/pypy/dist/pypy/translator/genc/nonetype.py -.. _`translator/genc/pyobjtype.py`: http://codespeak.net/svn/pypy/dist/pypy/translator/genc/pyobjtype.py -.. _`translator/genc/tupletype.py`: http://codespeak.net/svn/pypy/dist/pypy/translator/genc/tupletype.py -.. _`translator/gencl.py`: http://codespeak.net/svn/pypy/dist/pypy/translator/gencl.py -.. _`translator/geninterplevel.py`: http://codespeak.net/svn/pypy/dist/pypy/translator/geninterplevel.py -.. _`translator/genpyrex.py`: http://codespeak.net/svn/pypy/dist/pypy/translator/genpyrex.py -.. _`translator/gensupp.py`: http://codespeak.net/svn/pypy/dist/pypy/translator/gensupp.py -.. _`translator/goal/`: http://codespeak.net/svn/pypy/dist/pypy/translator/goal/ -.. _`translator/goal/__init__.py`: http://codespeak.net/svn/pypy/dist/pypy/translator/goal/__init__.py -.. _`translator/goal/app_example.py`: http://codespeak.net/svn/pypy/dist/pypy/translator/goal/app_example.py -.. _`translator/goal/app_main.py`: http://codespeak.net/svn/pypy/dist/pypy/translator/goal/app_main.py -.. _`translator/goal/autopath.py`: http://codespeak.net/svn/pypy/dist/pypy/translator/goal/autopath.py -.. _`translator/goal/buildcache2.py`: http://codespeak.net/svn/pypy/dist/pypy/translator/goal/buildcache2.py -.. _`translator/goal/targetpypy.py`: http://codespeak.net/svn/pypy/dist/pypy/translator/goal/targetpypy.py -.. _`translator/goal/targetpypy0.py`: http://codespeak.net/svn/pypy/dist/pypy/translator/goal/targetpypy0.py -.. _`translator/goal/targetpypy1.py`: http://codespeak.net/svn/pypy/dist/pypy/translator/goal/targetpypy1.py -.. _`translator/goal/targetpypymain.py`: http://codespeak.net/svn/pypy/dist/pypy/translator/goal/targetpypymain.py -.. _`translator/goal/targetrpystone.py`: http://codespeak.net/svn/pypy/dist/pypy/translator/goal/targetrpystone.py -.. _`translator/goal/targetrpystone2.py`: http://codespeak.net/svn/pypy/dist/pypy/translator/goal/targetrpystone2.py -.. _`translator/goal/translate_pypy.py`: http://codespeak.net/svn/pypy/dist/pypy/translator/goal/translate_pypy.py -.. _`translator/java/`: http://codespeak.net/svn/pypy/dist/pypy/translator/java/ -.. _`translator/java/__init__.py`: http://codespeak.net/svn/pypy/dist/pypy/translator/java/__init__.py -.. _`translator/java/autopath.py`: http://codespeak.net/svn/pypy/dist/pypy/translator/java/autopath.py -.. _`translator/java/genjava.py`: http://codespeak.net/svn/pypy/dist/pypy/translator/java/genjava.py -.. _`translator/llvm/`: http://codespeak.net/svn/pypy/dist/pypy/translator/llvm/ -.. _`translator/llvm/__init__.py`: http://codespeak.net/svn/pypy/dist/pypy/translator/llvm/__init__.py -.. _`translator/llvm/autopath.py`: http://codespeak.net/svn/pypy/dist/pypy/translator/llvm/autopath.py -.. _`translator/llvm/build_llvm_module.py`: http://codespeak.net/svn/pypy/dist/pypy/translator/llvm/build_llvm_module.py -.. _`translator/llvm/classrepr.py`: http://codespeak.net/svn/pypy/dist/pypy/translator/llvm/classrepr.py -.. _`translator/llvm/funcrepr.py`: http://codespeak.net/svn/pypy/dist/pypy/translator/llvm/funcrepr.py -.. _`translator/llvm/genllvm.py`: http://codespeak.net/svn/pypy/dist/pypy/translator/llvm/genllvm.py -.. _`translator/llvm/lazyattribute.py`: http://codespeak.net/svn/pypy/dist/pypy/translator/llvm/lazyattribute.py -.. _`translator/llvm/llvmbc.py`: http://codespeak.net/svn/pypy/dist/pypy/translator/llvm/llvmbc.py -.. _`translator/llvm/make_runtime.py`: http://codespeak.net/svn/pypy/dist/pypy/translator/llvm/make_runtime.py -.. _`translator/llvm/memorylayout.py`: http://codespeak.net/svn/pypy/dist/pypy/translator/llvm/memorylayout.py -.. _`translator/llvm/pbcrepr.py`: http://codespeak.net/svn/pypy/dist/pypy/translator/llvm/pbcrepr.py -.. _`translator/llvm/representation.py`: http://codespeak.net/svn/pypy/dist/pypy/translator/llvm/representation.py -.. _`translator/llvm/seqrepr.py`: http://codespeak.net/svn/pypy/dist/pypy/translator/llvm/seqrepr.py -.. _`translator/llvm/typerepr.py`: http://codespeak.net/svn/pypy/dist/pypy/translator/llvm/typerepr.py -.. _`translator/simplify.py`: http://codespeak.net/svn/pypy/dist/pypy/translator/simplify.py -.. _`translator/tool/`: http://codespeak.net/svn/pypy/dist/pypy/translator/tool/ -.. _`translator/tool/__init__.py`: http://codespeak.net/svn/pypy/dist/pypy/translator/tool/__init__.py -.. _`translator/tool/autopath.py`: http://codespeak.net/svn/pypy/dist/pypy/translator/tool/autopath.py -.. _`translator/tool/benchmark.py`: http://codespeak.net/svn/pypy/dist/pypy/translator/tool/benchmark.py -.. _`translator/tool/buildcl.py`: http://codespeak.net/svn/pypy/dist/pypy/translator/tool/buildcl.py -.. _`translator/tool/buildpyxmodule.py`: http://codespeak.net/svn/pypy/dist/pypy/translator/tool/buildpyxmodule.py -.. _`translator/tool/flowtrace.py`: http://codespeak.net/svn/pypy/dist/pypy/translator/tool/flowtrace.py -.. _`translator/tool/graphpage.py`: http://codespeak.net/svn/pypy/dist/pypy/translator/tool/graphpage.py -.. _`translator/tool/graphserver.py`: http://codespeak.net/svn/pypy/dist/pypy/translator/tool/graphserver.py -.. _`translator/tool/make_dot.py`: http://codespeak.net/svn/pypy/dist/pypy/translator/tool/make_dot.py -.. _`translator/tool/stdoutcapture.py`: http://codespeak.net/svn/pypy/dist/pypy/translator/tool/stdoutcapture.py -.. _`translator/tool/tointerplevel.py`: http://codespeak.net/svn/pypy/dist/pypy/translator/tool/tointerplevel.py -.. _`translator/tool/traceann.py`: http://codespeak.net/svn/pypy/dist/pypy/translator/tool/traceann.py -.. _`translator/tool/tracer.py`: http://codespeak.net/svn/pypy/dist/pypy/translator/tool/tracer.py -.. _`translator/transform.py`: http://codespeak.net/svn/pypy/dist/pypy/translator/transform.py -.. _`translator/translator.py`: http://codespeak.net/svn/pypy/dist/pypy/translator/translator.py -.. _`translator/typer.py`: http://codespeak.net/svn/pypy/dist/pypy/translator/typer.py -.. _`translator/unsimplify.py`: http://codespeak.net/svn/pypy/dist/pypy/translator/unsimplify.py - -.. _`pypy/module/`: http://codespeak.net/svn/pypy/dist/pypy/module -.. _`pypy/interpreter/`: http://codespeak.net/svn/pypy/dist/pypy/interpreter -.. _`pypy/objspace/`: http://codespeak.net/svn/pypy/dist/pypy/objspace -.. _`pypy/translator/`: http://codespeak.net/svn/pypy/dist/pypy/translator -.. _`pypy/annotation/`: http://codespeak.net/svn/pypy/dist/pypy/annotation -.. _`pypy/tool/`: http://codespeak.net/svn/pypy/dist/pypy/tool -.. _`pypy/documentation/`: http://codespeak.net/svn/pypy/dist/pypy/documentation -.. _`pypy/lib/`: http://codespeak.net/svn/pypy/dist/pypy/lib -.. _`pypy/rpython/`: http://codespeak.net/svn/pypy/dist/pypy/rpython -.. _`pypy/bin/`: http://codespeak.net/svn/pypy/dist/pypy/bin \ No newline at end of file +.. _`rpython/`: http://codespeak.net/svn/pypy/dist/pypy/rpython +.. _`tool/`: http://codespeak.net/svn/pypy/dist/pypy/tool +.. _`tool/pytest/`: http://codespeak.net/svn/pypy/dist/pypy/tool/pytest +.. _`tool/tb_server/`: http://codespeak.net/svn/pypy/dist/pypy/tool/tb_server +.. _`pypy/translator`: +.. _`translator/`: http://codespeak.net/svn/pypy/dist/pypy/translator +.. _`pypy/translator/annrpython.py`: http://codespeak.net/svn/pypy/dist/pypy/translator/annrpython.py +.. _`translator/genc/`: http://codespeak.net/svn/pypy/dist/pypy/translator/genc +.. _`translator/java/`: http://codespeak.net/svn/pypy/dist/pypy/translator/java +.. _`translator/llvm/`: http://codespeak.net/svn/pypy/dist/pypy/translator/llvm +.. _`translator/tool/`: http://codespeak.net/svn/pypy/dist/pypy/translator/tool \ No newline at end of file Modified: pypy/dist/pypy/documentation/coding-guide.txt ============================================================================== --- pypy/dist/pypy/documentation/coding-guide.txt (original) +++ pypy/dist/pypy/documentation/coding-guide.txt Thu May 19 10:21:34 2005 @@ -428,10 +428,6 @@ parts for the implementation. Note that there is no extra facility for pure-interpreter level modules because we haven't needed it so far. -.. _`lib-python`: http://codespeak.net/svn/pypy/dist/lib-python/ -.. _`pypy/module`: http://codespeak.net/svn/pypy/dist/pypy/module/ -.. _`pypy/lib`: http://codespeak.net/svn/pypy/dist/pypy/lib/ - Determining the location of a module implementation --------------------------------------------------- @@ -597,7 +593,7 @@ ----------------------------------- In order to let CPython's regression tests run against PyPy -you can switch to the `lib-python`_ directory and run +you can switch to the `lib-python/`_ directory and run the testing tool in order to start compliance tests. (XXX check windows compatibility for producing test reports). Modified: pypy/dist/pypy/documentation/getting_started.txt ============================================================================== --- pypy/dist/pypy/documentation/getting_started.txt (original) +++ pypy/dist/pypy/documentation/getting_started.txt Thu May 19 10:21:34 2005 @@ -270,11 +270,10 @@ Demos +++++ - The directory ``demo`` contains examples of various aspects of PyPy, - from regular Python programs that we used as goals while developing - the interpreter to applications of the thunk object space to an - example allowing you to `try out the translator`_. - +The `demo/`_ directory contains examples of various aspects of PyPy, +ranging from running regular Python programs (that we used as compliance goals) +over experimental distribution mechanisms to examples translating +sufficiently static programs into low level code. .. _`try out the translator`: @@ -472,7 +471,6 @@ .. _Dot Graphviz: http://www.research.att.com/sw/tools/graphviz/ .. _Pygame: http://www.pygame.org/ -.. _pypy/interpreter: http://codespeak.net/svn/pypy/dist/pypy/interpreter/ .. _pyopcode.py: http://codespeak.net/svn/pypy/dist/pypy/interpreter/pyopcode.py .. _eval.py: http://codespeak.net/svn/pypy/dist/pypy/interpreter/eval.py .. _pyframe.py: http://codespeak.net/svn/pypy/dist/pypy/interpreter/pyframe.py @@ -482,17 +480,12 @@ .. _module.py: http://codespeak.net/svn/pypy/dist/pypy/interpreter/module.py .. _mixedmodule.py: http://codespeak.net/svn/pypy/dist/pypy/interpreter/mixedmodule.py .. _typedef.py: http://codespeak.net/svn/pypy/dist/pypy/interpreter/typedef.py -.. _pypy/objspace/std: http://codespeak.net/svn/pypy/dist/pypy/objspace/std/ .. _Standard object space: http://codespeak.net/pypy/index.cgi?doc/stdobjspace.html .. _objspace.py: http://codespeak.net/svn/pypy/dist/pypy/objspace/std/objspace.py -.. _pypy/objspace: http://codespeak.net/svn/pypy/dist/pypy/objspace/ .. _thunk: http://codespeak.net/svn/pypy/dist/pypy/objspace/thunk.py .. _trace: http://codespeak.net/svn/pypy/dist/pypy/objspace/trace.py .. _flow: http://codespeak.net/svn/pypy/dist/pypy/objspace/flow/ -.. _pypy/translator: http://codespeak.net/svn/pypy/dist/pypy/translator/ .. _translator.py: http://codespeak.net/svn/pypy/dist/pypy/translator/translator.py -.. _pypy/annotation: http://codespeak.net/svn/pypy/dist/pypy/annotation/ -.. _pypy/translator/annrpython.py: http://codespeak.net/svn/pypy/dist/pypy/translator/annrpython.py .. _mailing lists: http://codespeak.net/pypy/index.cgi?lists .. _documentation: index.html .. _wiki: http://codespeak.net/moin/pypy/moin.cgi/FrontPage?action=show Modified: pypy/dist/pypy/documentation/objspace.txt ============================================================================== --- pypy/dist/pypy/documentation/objspace.txt (original) +++ pypy/dist/pypy/documentation/objspace.txt Thu May 19 10:21:34 2005 @@ -341,3 +341,5 @@ * If the interpreter calls ``is_true()``, the FlowObjSpace doesn't generally know if the answer should be True or False, so it puts a conditional jump and generates two successor blocks for the current basic block. There is some trickery involved so that the interpreter is fooled into thinking that ``is_true()`` first returns False (and the subsequent operations are recorded in the first successor block), and later the *same* call to ``is_true()`` also returns True (and the subsequent operations go this time to the other successor block). (This section to be extended...) + +.. include:: _ref.txt Added: pypy/dist/pypy/documentation/tool/makeref.py ============================================================================== --- (empty file) +++ pypy/dist/pypy/documentation/tool/makeref.py Thu May 19 10:21:34 2005 @@ -0,0 +1,44 @@ + +import py +py.magic.autopath() +import pypy +pypydir = py.path.local(pypy.__file__).dirpath() +distdir = pypydir.dirpath() +dist_url = 'http://codespeak.net/svn/pypy/dist/' + +docdir = pypydir.join('documentation') +reffile = pypydir.join('documentation', '_ref.txt') + +linkrex = py.std.re.compile('`(\S+)`_') + +name2target = {} +def addlink(linkname, linktarget): + assert linkname and linkname != '/' + if linktarget in name2target: + if linkname in name2target[linktarget]: + return + name2target.setdefault(linktarget, []).append(linkname) + +for textfile in docdir.visit(lambda x: x.ext == '.txt', + lambda x: x.check(dotfile=0)): + for linkname in linkrex.findall(textfile.read()): + if '/' not in linkname: + continue + for startloc in ('', 'pypy'): + cand = distdir.join(startloc, linkname) + if cand.check(): + target = dist_url + cand.relto(distdir) + addlink(linkname, target) + +items = name2target.items() +items.sort() + +lines = [] +for linktarget, linknamelist in items: + for linkname in linknamelist[:-1]: + lines.append(".. _`%s`:" % linkname) + lines.append(".. _`%s`: %s" %(linknamelist[-1], linktarget)) + +reffile.write("\n".join(lines)) +print "last ten lines" +for x in lines[-10:]: print x Deleted: /pypy/dist/pypy/documentation/tool/regenref.py ============================================================================== --- /pypy/dist/pypy/documentation/tool/regenref.py Thu May 19 10:21:34 2005 +++ (empty file) @@ -1,32 +0,0 @@ - -import py -py.magic.autopath() -import pypy -base = py.path.local(pypy.__file__).dirpath() -target = base.join('documentation', '_ref.txt') - -def match(p): - return p.relto(base).count(p.sep) < 2 \ - and p.check(dir=1, dotfile=0) \ - and p.basename not in ('test', '_cache') - -items = [] -for dir in base.visit(match, lambda x: x.check(dotfile=0) and x.basename != '_cache'): - assert dir.basename != '_cache' - items.append(dir.relto(base)+dir.sep) - for fn in dir.listdir(lambda x: x.check(file=1, ext='.py')): - assert fn.basename != '_cache' - items.append(fn.relto(base)) - -items.sort() - -lines = [] -for x in items: - lines.append(".. _`%s`: http://codespeak.net/svn/pypy/dist/pypy/%s" %(x,x,)) - -lines.append("") -for x in base.listdir(match): - x = x.relto(base) - lines.append(".. _`pypy/%s/`: http://codespeak.net/svn/pypy/dist/pypy/%s" %(x,x)) - -target.write("\n".join(lines)) From hpk at codespeak.net Thu May 19 12:21:40 2005 From: hpk at codespeak.net (hpk at codespeak.net) Date: Thu, 19 May 2005 12:21:40 +0200 (CEST) Subject: [pypy-svn] r12506 - pypy/dist/pypy/documentation Message-ID: <20050519102140.A6E5827B95@code1.codespeak.net> Author: hpk Date: Thu May 19 12:21:40 2005 New Revision: 12506 Modified: pypy/dist/pypy/documentation/getting_started.txt Log: shorten the thunk-sentence a bit Modified: pypy/dist/pypy/documentation/getting_started.txt ============================================================================== --- pypy/dist/pypy/documentation/getting_started.txt (original) +++ pypy/dist/pypy/documentation/getting_started.txt Thu May 19 12:21:40 2005 @@ -198,9 +198,9 @@ lazily computed objects +++++++++++++++++++++++ -One of the original features provided by the py.py interpreter that are -without equivalent in CPython is the "thunk" object space, providing -lazily-computed objects in a transparent manner:: +One of the original features provided by PyPy is the "thunk" +object space, providing lazily-computed objects in a fully +transparent manner:: cd pypy/bin python py.py -o thunk From hpk at codespeak.net Thu May 19 12:56:35 2005 From: hpk at codespeak.net (hpk at codespeak.net) Date: Thu, 19 May 2005 12:56:35 +0200 (CEST) Subject: [pypy-svn] r12508 - pypy/dist/pypy/documentation Message-ID: <20050519105635.EFDBC27B95@code1.codespeak.net> Author: hpk Date: Thu May 19 12:56:35 2005 New Revision: 12508 Modified: pypy/dist/pypy/documentation/release-0.6.txt Log: issue16 in-progress refactoring, streamlining and slightly-reformatting the release announcement. One open question is how to present the core team/contributors and organizations. Do we want to append all names at the end or just put a link to some page listing all of them? Modified: pypy/dist/pypy/documentation/release-0.6.txt ============================================================================== --- pypy/dist/pypy/documentation/release-0.6.txt (original) +++ pypy/dist/pypy/documentation/release-0.6.txt Thu May 19 12:56:35 2005 @@ -1,55 +1,58 @@ +The PyPy 0.6 release +-------------------- +*The PyPy Development Team is happy to announce the first +public release of PyPy after two years of spare-time and +half a year of EU funded development. The 0.6 release +is eminently a preview release.* -*The PyPy Development Team is happy to announce the release 0.6 of PyPy -interpreter and technology. This is the first public release and is -eminently a preview release.* - -What is is, download and links -------------------------------- - -PyPy is a reimplementation of Python written in Python itself. - -The long term goals are an implementation that is flexible and easy to -experiment with and retarget to different platforms (also non-C ones) -and such that high performance can be achieved through high-level -implementations of especially dynamic optimisation techniques. +What it is and where to start +----------------------------- + + Getting started: http://codespeak.net/pypy/index.cgi?doc/getting_started.html + + PyPy Documentation: http://codespeak.net/pypy/index.cgi?doc + + PyPy Homepage: http://codespeak.net/pypy/ + +PyPy is a MIT-licensed reimplementation of Python written in +Python itself. The long term goals are an implementation that +is flexible and easy to experiment with and retarget to +different platforms (also non-C ones) and such that high +performance can be achieved through high-level implementations +of dynamic optimisation techniques. The interpreter and object model implementations shipped with 0.6 can be run on top of CPython and implement the core language features of -Python as of CPython 2.3. They pass a substantial part (~90%) of -CPython test-suite tests not depending on C extension modules. Some of +Python as of CPython 2.3. PyPy passes around 90% of the Python language +regression tests that do not depend deeply on C-extensions. Some of that functionality is still made available by PyPy piggy-backing on the host CPython interpreter. Double interpretation and abstractions in the code-base make it so that PyPy running on CPython is quite slow -(around 2000x slower than CPython ), this is to be expected. +(around 2000x slower than CPython ), this is expected. This release is intended for people that want to look and get a feel into what we are doing, playing with interpreter and perusing the codebase. Possibly to join in the fun and efforts. -For download links and further information and documentation see -(most of PyPy is realeased under the MIT license): - -- Download PyPy 0.6: http://xxx -- Getting started: http://codespeak.net/pypy/index.cgi?doc/getting_started.html -- PyPy Documentation: http://codespeak.net/pypy/index.cgi?doc -- PyPy Homepage: http://codespeak.net/pypy/ -- PyPy 0.6 License: http://xxx - Interesting bits and highlights --------------------------------- -The release is also a snap-shot of our ongoing efforts, interesting -things and highlights included, related to the interpreter and beyond: +The release is also a snap-shot of our ongoing efforts towards +low-level translation and experimenting with unique features. -* In PyPy bytecode interpretation and the implementation of objects - semantics (as a library of objects) are separated, apart the - standard implementation of those (what we call the standard object - space) PyPy comes with experimental object spaces augmenting the +* By default, PyPy is a Python version that works completely + with new-style-classes semantics. However, there is some support + for old-style classes through a custom metaclass. + +* In PyPy, bytecode interpretation and object manipulations + are well separated between a bytecode interpreter and an + object space which implements operations on objects. + PyPy comes with experimental object spaces augmenting the standard one through delegation: - an experimental object space that does extensive tracing of - object operations; + bytecode and object operations; - the 'thunk' object space that implements lazy values and a 'become' operation that can exchange object identities. @@ -58,43 +61,44 @@ PyPy*. (See demo/fibonacci.py and demo/sharedref.py for examples about the 'thunk' object space.) -* The core of PyPy only implements new-style classes, old-style - classes are basically implemented, apart some hooks, as what is in - principle user-level code (what we call app-level), and then - integrated with rest (there's an interpreter option --old-style to - make them the default metaclass). - -* PyPy is intended to be translated to low-level languages to regain - speed, for that we have developed what we call the annotator, which - is capable of reconstructing type information for our code-base, - which is written respecting some restrictions, and similarly written - code. The annotator right now is already capable of successfully - type annotating basically *all* of PyPy code-base, and is included - with 0.6. +* The 0.6 release also contains a snapshot of our translation-efforts + to lower level languages. For that we have developed an + annotator which is capable of infering type information + across our code base. The annotator right now is already + capable of successfully type annotating basically *all* of + PyPy code-base, and is included with 0.6. * From type annotated code low-level code needs to be generated, backends for various targets (C, LLVM,...) are included, they are all somehow incomplete and have been and are quite in flux. What is shipped with 0.6 is able to deal with more or less small/medium examples. -Getting started has more information about how to try out these features -and tools. - Ongoing work and near term goals --------------------------------- -Generating low-level target code is the main area we are working right -now, our near term efforts aiming August/September of this year are -focused on producing a stand-alone and low-level translated version of -PyPy with speed much nearer to CPython range. +Generating low-level code is the main area we are hammering on in the +next months, our plan is to produce a PyPy version in August/September +that does not need to be interpreted by CPython anymore and will +thus run considerably faster than the 0.6 preview release. + +Please feel free to give feedback and raise questions. Here is +how you can contact or join us: + + http://codespeak.net/pypy/index.cgi?contact +PyPy has been a community effort from the start and it would +not have got that far without the coding and feedback support +from numerous people. (XXX insert some link here?) -The PyPy Development Team +have fun, -**xxx all contributor names in some order (?)** + the PyPy Development Team +Disclaimer: -PyPy development and activities happens as open source source project under the http://codespeak.net/ umbrella and through a consortium funded by a EU IST research grant: +PyPy development and activities happens as open source source +project under the http://codespeak.net/ umbrella and with +the support of a consortium funded by a EU IST research grant: **(xxx consortium partners?? )** From pedronis at codespeak.net Thu May 19 13:23:57 2005 From: pedronis at codespeak.net (pedronis at codespeak.net) Date: Thu, 19 May 2005 13:23:57 +0200 (CEST) Subject: [pypy-svn] r12509 - pypy/dist/pypy/documentation Message-ID: <20050519112357.0812D27B95@code1.codespeak.net> Author: pedronis Date: Thu May 19 13:23:56 2005 New Revision: 12509 Modified: pypy/dist/pypy/documentation/release-0.6.txt Log: issues16 in-progress changes make sense. changed the wording again a bit about old-style classes, custom metaclass seemed to imply even more magic that there is. Old style classes have of course their metaclass and we simply implemented it as user-code (that it is geninterped is an impl detail). Olny question: why call the last section "Disclaimer"??? Modified: pypy/dist/pypy/documentation/release-0.6.txt ============================================================================== --- pypy/dist/pypy/documentation/release-0.6.txt (original) +++ pypy/dist/pypy/documentation/release-0.6.txt Thu May 19 13:23:56 2005 @@ -41,9 +41,11 @@ The release is also a snap-shot of our ongoing efforts towards low-level translation and experimenting with unique features. -* By default, PyPy is a Python version that works completely - with new-style-classes semantics. However, there is some support - for old-style classes through a custom metaclass. +* By default, PyPy is a Python version that works completely with + new-style-classes semantics. However, support for old-style classes + is still available, Implementations, mostly as user-level code, of + their metaclass and instance object are included and can be re-made + the default with an option. * In PyPy, bytecode interpretation and object manipulations are well separated between a bytecode interpreter and an From ac at codespeak.net Thu May 19 13:45:40 2005 From: ac at codespeak.net (ac at codespeak.net) Date: Thu, 19 May 2005 13:45:40 +0200 (CEST) Subject: [pypy-svn] r12510 - in pypy/branch/non-fake-unicode/pypy: documentation interpreter module/builtin objspace/std Message-ID: <20050519114540.BBD8B27B96@code1.codespeak.net> Author: ac Date: Thu May 19 13:45:40 2005 New Revision: 12510 Modified: pypy/branch/non-fake-unicode/pypy/documentation/objspace.txt pypy/branch/non-fake-unicode/pypy/interpreter/baseobjspace.py pypy/branch/non-fake-unicode/pypy/module/builtin/__init__.py pypy/branch/non-fake-unicode/pypy/module/builtin/app_misc.py pypy/branch/non-fake-unicode/pypy/module/builtin/operation.py pypy/branch/non-fake-unicode/pypy/objspace/std/objspace.py Log: Added a method 'newunicode' to the objectspace. Changed builtin unichr to use the method ad thereby getting 30 times faster. Modified: pypy/branch/non-fake-unicode/pypy/documentation/objspace.txt ============================================================================== --- pypy/branch/non-fake-unicode/pypy/documentation/objspace.txt (original) +++ pypy/branch/non-fake-unicode/pypy/documentation/objspace.txt Thu May 19 13:45:40 2005 @@ -195,6 +195,9 @@ **newstring(asciilist):** Creates a string from a list of wrapped integers. +**newunicode(codelist):** + Creates a unicode string from a list of wrapped integers. + Conversions from Application Level to Interpreter Level ---------------------------------------------------------- Modified: pypy/branch/non-fake-unicode/pypy/interpreter/baseobjspace.py ============================================================================== --- pypy/branch/non-fake-unicode/pypy/interpreter/baseobjspace.py (original) +++ pypy/branch/non-fake-unicode/pypy/interpreter/baseobjspace.py Thu May 19 13:45:40 2005 @@ -465,6 +465,7 @@ # newtuple([w_1, w_2,...]) -> w_tuple # newlist([w_1, w_2,...]) -> w_list # newstring([w_1, w_2,...]) -> w_string from ascii numbers (bytes) +# newunicode([w_1, w_2,...]) -> w_unicode from numbers # newdict([(w_key,w_value),...]) -> w_dict # newslice(w_start,w_stop,w_step) -> w_slice (any argument may be a real None) # call_args(w_obj,Arguments()) -> w_result @@ -481,6 +482,7 @@ 'newtuple', 'newlist', 'newstring', + 'newunicode', 'newdict', 'newslice', 'call_args' Modified: pypy/branch/non-fake-unicode/pypy/module/builtin/__init__.py ============================================================================== --- pypy/branch/non-fake-unicode/pypy/module/builtin/__init__.py (original) +++ pypy/branch/non-fake-unicode/pypy/module/builtin/__init__.py Thu May 19 13:45:40 2005 @@ -50,7 +50,6 @@ 'complex' : 'app_complex.complex', 'intern' : 'app_misc.intern', - 'unichr' : 'app_misc.unichr', 'buffer' : 'app_buffer.buffer', 'reload' : 'app_misc.reload', } @@ -79,6 +78,7 @@ # interp-level function definitions 'abs' : 'operation.abs', 'chr' : 'operation.chr', + 'unichr' : 'operation.unichr', 'len' : 'operation.len', 'ord' : 'operation.ord', 'pow' : 'operation.pow', Modified: pypy/branch/non-fake-unicode/pypy/module/builtin/app_misc.py ============================================================================== --- pypy/branch/non-fake-unicode/pypy/module/builtin/app_misc.py (original) +++ pypy/branch/non-fake-unicode/pypy/module/builtin/app_misc.py Thu May 19 13:45:40 2005 @@ -11,13 +11,6 @@ return _stringtable.setdefault(s,s) -def unichr(code): - import sys - if (code < 0 or code > sys.maxunicode): - raise ValueError('unichr() arg not in range(%#x)'%(sys.maxunicode + 1)) - return unicode('\\U%08x' %(code), 'unicode-escape') - - def reload(module): import imp, sys, errno Modified: pypy/branch/non-fake-unicode/pypy/module/builtin/operation.py ============================================================================== --- pypy/branch/non-fake-unicode/pypy/module/builtin/operation.py (original) +++ pypy/branch/non-fake-unicode/pypy/module/builtin/operation.py Thu May 19 13:45:40 2005 @@ -15,6 +15,9 @@ w_character = space.newstring([w_ascii]) return w_character +def unichr(space, w_code): + return space.newunicode([w_code]) + def len(space, w_obj): "len(object) -> integer\n\nReturn the number of items of a sequence or mapping." return space.len(w_obj) Modified: pypy/branch/non-fake-unicode/pypy/objspace/std/objspace.py ============================================================================== --- pypy/branch/non-fake-unicode/pypy/objspace/std/objspace.py (original) +++ pypy/branch/non-fake-unicode/pypy/objspace/std/objspace.py Thu May 19 13:45:40 2005 @@ -268,6 +268,14 @@ self.wrap("character code not in range(256)")) return W_StringObject(self, ''.join(chars)) + def newunicode(self, chars_w): + try: + chars = [unichr(self.int_w(w_c)) for w_c in chars_w] + except ValueError, e: # unichr(out-of-range) + raise OperationError(self.w_ValueError, + self.wrap("character code not in range(0x110000)")) + return W_UnicodeObject(self, chars) + def newseqiter(self, w_obj): return W_SeqIterObject(self, w_obj) From ale at codespeak.net Thu May 19 14:11:30 2005 From: ale at codespeak.net (ale at codespeak.net) Date: Thu, 19 May 2005 14:11:30 +0200 (CEST) Subject: [pypy-svn] r12516 - pypy/dist/lib-python/2.3.4/test Message-ID: <20050519121130.A69D727B9C@code1.codespeak.net> Author: ale Date: Thu May 19 14:11:30 2005 New Revision: 12516 Modified: pypy/dist/lib-python/2.3.4/test/test___all__.py Log: on Windows only test modules that exists on windows: pty.py and tty.py are examples of modules that cant be tested on windows. Modified: pypy/dist/lib-python/2.3.4/test/test___all__.py ============================================================================== --- pypy/dist/lib-python/2.3.4/test/test___all__.py (original) +++ pypy/dist/lib-python/2.3.4/test/test___all__.py Thu May 19 14:11:30 2005 @@ -136,7 +136,7 @@ self.check_all("pre") # deprecated self.check_all("profile") self.check_all("pstats") - self.check_all("pty") + self.check_all("py_compile") self.check_all("pyclbr") self.check_all("quopri") @@ -173,7 +173,6 @@ self.check_all("toaiff") self.check_all("tokenize") self.check_all("traceback") - self.check_all("tty") self.check_all("unittest") self.check_all("urllib") self.check_all("urlparse") @@ -185,6 +184,9 @@ self.check_all("xdrlib") self.check_all("zipfile") + if not sys.platform == 'win32': + self.check_all("pty") + self.check_all("tty") # rlcompleter needs special consideration; it import readline which # initializes GNU readline which calls setlocale(LC_CTYPE, "")... :-( try: From pedronis at codespeak.net Thu May 19 14:20:34 2005 From: pedronis at codespeak.net (pedronis at codespeak.net) Date: Thu, 19 May 2005 14:20:34 +0200 (CEST) Subject: [pypy-svn] r12517 - pypy/dist/lib-python/2.3.4/test Message-ID: <20050519122034.4C5BF27B9C@code1.codespeak.net> Author: pedronis Date: Thu May 19 14:20:34 2005 New Revision: 12517 Removed: pypy/dist/lib-python/2.3.4/test/test___all__.py Log: removal prior to reverting Deleted: /pypy/dist/lib-python/2.3.4/test/test___all__.py ============================================================================== --- /pypy/dist/lib-python/2.3.4/test/test___all__.py Thu May 19 14:20:34 2005 +++ (empty file) @@ -1,207 +0,0 @@ -import unittest -from test import test_support - -from test.test_support import verify, verbose -from sets import Set -import sys -import warnings - -warnings.filterwarnings("ignore", ".* 'pre' .*", DeprecationWarning, - r'pre$') -warnings.filterwarnings("ignore", ".* regsub .*", DeprecationWarning, - r'^regsub$') -warnings.filterwarnings("ignore", ".* statcache .*", DeprecationWarning, - r'statcache$') - -class AllTest(unittest.TestCase): - - def check_all(self, modname): - names = {} - try: - exec "import %s" % modname in names - except ImportError: - # Silent fail here seems the best route since some modules - # may not be available in all environments. - # Since an ImportError may leave a partial module object in - # sys.modules, get rid of that first. Here's what happens if - # you don't: importing pty fails on Windows because pty tries to - # import FCNTL, which doesn't exist. That raises an ImportError, - # caught here. It also leaves a partial pty module in sys.modules. - # So when test_pty is called later, the import of pty succeeds, - # but shouldn't. As a result, test_pty crashes with an - # AttributeError instead of an ImportError, and regrtest interprets - # the latter as a test failure (ImportError is treated as "test - # skipped" -- which is what test_pty should say on Windows). - try: - del sys.modules[modname] - except KeyError: - pass - return - verify(hasattr(sys.modules[modname], "__all__"), - "%s has no __all__ attribute" % modname) - names = {} - exec "from %s import *" % modname in names - if names.has_key("__builtins__"): - del names["__builtins__"] - keys = Set(names) - all = Set(sys.modules[modname].__all__) - verify(keys==all, "%s != %s" % (keys, all)) - - def test_all(self): - if not sys.platform.startswith('java'): - # In case _socket fails to build, make this test fail more gracefully - # than an AttributeError somewhere deep in CGIHTTPServer. - import _socket - - self.check_all("BaseHTTPServer") - self.check_all("Bastion") - self.check_all("CGIHTTPServer") - self.check_all("ConfigParser") - self.check_all("Cookie") - self.check_all("MimeWriter") - self.check_all("Queue") - self.check_all("SimpleHTTPServer") - self.check_all("SocketServer") - self.check_all("StringIO") - self.check_all("UserString") - self.check_all("aifc") - self.check_all("atexit") - self.check_all("audiodev") - self.check_all("base64") - self.check_all("bdb") - self.check_all("binhex") - self.check_all("calendar") - self.check_all("cgi") - self.check_all("cmd") - self.check_all("code") - self.check_all("codecs") - self.check_all("codeop") - self.check_all("colorsys") - self.check_all("commands") - self.check_all("compileall") - self.check_all("copy") - self.check_all("copy_reg") - self.check_all("csv") - self.check_all("dbhash") - self.check_all("difflib") - self.check_all("dircache") - self.check_all("dis") - self.check_all("doctest") - self.check_all("dummy_thread") - self.check_all("dummy_threading") - self.check_all("filecmp") - self.check_all("fileinput") - self.check_all("fnmatch") - self.check_all("fpformat") - self.check_all("ftplib") - self.check_all("getopt") - self.check_all("getpass") - self.check_all("gettext") - self.check_all("glob") - self.check_all("gopherlib") - self.check_all("gzip") - self.check_all("heapq") - self.check_all("htmllib") - self.check_all("httplib") - self.check_all("ihooks") - self.check_all("imaplib") - self.check_all("imghdr") - self.check_all("imputil") - self.check_all("keyword") - self.check_all("linecache") - self.check_all("locale") - self.check_all("macpath") - self.check_all("macurl2path") - self.check_all("mailbox") - self.check_all("mailcap") - self.check_all("mhlib") - self.check_all("mimetools") - self.check_all("mimetypes") - self.check_all("mimify") - self.check_all("multifile") - self.check_all("netrc") - self.check_all("nntplib") - self.check_all("ntpath") - self.check_all("opcode") - self.check_all("optparse") - self.check_all("os") - self.check_all("os2emxpath") - self.check_all("pdb") - self.check_all("pickle") - self.check_all("pipes") - self.check_all("popen2") - self.check_all("poplib") - self.check_all("posixpath") - self.check_all("pprint") - self.check_all("pre") # deprecated - self.check_all("profile") - self.check_all("pstats") - - self.check_all("py_compile") - self.check_all("pyclbr") - self.check_all("quopri") - self.check_all("random") - self.check_all("re") - self.check_all("reconvert") - self.check_all("regsub") - self.check_all("repr") - self.check_all("rexec") - self.check_all("rfc822") - self.check_all("rlcompleter") - self.check_all("robotparser") - self.check_all("sched") - self.check_all("sets") - self.check_all("sgmllib") - self.check_all("shelve") - self.check_all("shlex") - self.check_all("shutil") - self.check_all("smtpd") - self.check_all("smtplib") - self.check_all("sndhdr") - self.check_all("socket") - self.check_all("sre") - self.check_all("_strptime") - self.check_all("statcache") - self.check_all("symtable") - self.check_all("tabnanny") - self.check_all("tarfile") - self.check_all("telnetlib") - self.check_all("tempfile") - self.check_all("textwrap") - self.check_all("threading") - self.check_all("timeit") - self.check_all("toaiff") - self.check_all("tokenize") - self.check_all("traceback") - self.check_all("unittest") - self.check_all("urllib") - self.check_all("urlparse") - self.check_all("uu") - self.check_all("warnings") - self.check_all("wave") - self.check_all("weakref") - self.check_all("webbrowser") - self.check_all("xdrlib") - self.check_all("zipfile") - - if not sys.platform == 'win32': - self.check_all("pty") - self.check_all("tty") - # rlcompleter needs special consideration; it import readline which - # initializes GNU readline which calls setlocale(LC_CTYPE, "")... :-( - try: - self.check_all("rlcompleter") - finally: - try: - import locale - except ImportError: - pass - else: - locale.setlocale(locale.LC_CTYPE, 'C') - - -def test_main(): - test_support.run_unittest(AllTest) - -if __name__ == "__main__": - test_main() From pedronis at codespeak.net Thu May 19 14:21:23 2005 From: pedronis at codespeak.net (pedronis at codespeak.net) Date: Thu, 19 May 2005 14:21:23 +0200 (CEST) Subject: [pypy-svn] r12518 - pypy/dist/lib-python/2.3.4/test Message-ID: <20050519122123.9F1C527B9C@code1.codespeak.net> Author: pedronis Date: Thu May 19 14:21:23 2005 New Revision: 12518 Added: pypy/dist/lib-python/2.3.4/test/test___all__.py - copied unchanged from r12514, pypy/dist/lib-python/2.3.4/test/test___all__.py Log: reverting From hpk at codespeak.net Thu May 19 14:30:54 2005 From: hpk at codespeak.net (hpk at codespeak.net) Date: Thu, 19 May 2005 14:30:54 +0200 (CEST) Subject: [pypy-svn] r12520 - pypy/dist Message-ID: <20050519123054.7157227B9C@code1.codespeak.net> Author: hpk Date: Thu May 19 14:30:54 2005 New Revision: 12520 Modified: pypy/dist/README Log: issue5 testing followed Carl's suggestion of mentioning the documentation section. Modified: pypy/dist/README ============================================================================== --- pypy/dist/README (original) +++ pypy/dist/README Thu May 19 14:30:54 2005 @@ -11,11 +11,14 @@ http://codespeak.net/pypy/index.cgi?getting-started -which gives you many good starting and entry points into -using and playing with PyPy. +which gives you many good starting and entry points into +playing with PyPy. It will also point you to our +documentation section which you can also directly enter here: -Our release announcement has more in-depth information -about this release. + http://codespeak.net/pypy/index.cgi?doc + +Our online release announcement has some more +information about the specific 0.6 release: http://codespeak.net/pypy/index.cgi?doc/release-0.6.html From pedronis at codespeak.net Thu May 19 14:45:51 2005 From: pedronis at codespeak.net (pedronis at codespeak.net) Date: Thu, 19 May 2005 14:45:51 +0200 (CEST) Subject: [pypy-svn] r12523 - pypy/dist/pypy Message-ID: <20050519124551.9837327B9C@code1.codespeak.net> Author: pedronis Date: Thu May 19 14:45:51 2005 New Revision: 12523 Modified: pypy/dist/pypy/TODO Log: removed things that are obsolete, have their issue in the tracker or are solved Modified: pypy/dist/pypy/TODO ============================================================================== --- pypy/dist/pypy/TODO (original) +++ pypy/dist/pypy/TODO Thu May 19 14:45:51 2005 @@ -1,10 +1,6 @@ General ======= -* missing pieces currently borrowed from CPython: the bytecode - compiler, a number of C modules, and some types -- as printed - when running py.py: "faking ". - * mark debugging variables to make our code more readable * extend the testing mechanisms to specifically allow: @@ -18,19 +14,6 @@ * not all of CPython's exceptions use the same __init__! -* refactor the cmdline-entrypoints to PyPy aka py.py main.py - interactive.py and traceinteractive.py towards a unified - cmdline tool (py.py) possibly including translator-related - things too. - -* cleanup the contents of the tool directory - -* an oldie: move interpreter/unittest_w.py somewhere more appropriate - and give it a better name. - -* (documentation) remove/retire all web-pages referencing e.g. - AnnSpace or other deprecated stuff - * review whatever you like * sys.last_type/last_value are not normalized -- bug @@ -38,55 +21,7 @@ StdObjSpace =========== -* allow CPython's "output-checking" tests to run in a convenient - way over StdObjSpace - * String formatting is agonizingly slow. -* Provide an importer that can import packages. (we have a - limited __import__ builtin defined) <---- done now? - - Consider PEP 302, new import hooks. - Try to write as much as possible in app-level. - How would PyPy import CPython extensions? - * (documentation) generate a nice dot-graph from the structure of PyPy -* port pypy's testing framework to py.test (probably a sprint topic, - as some discussion how to do it is required) - -* clear out and do a clean implementation of multimethod delegation. - The idea is to give 'kinds' to arguments according to their use, - e.g. 'numeric argument' or 'object whose identity is preserved'. - A 'kind' encapsulates a set of delegation functions. Armin has - already written documentation for the envisioned new multimethod - implementation: - - http://codespeak.net/pypy/index.cgi?doc/objspace/multimethod - - (now irrelevant? not sure... (nowadays, we have the descriptor - mechanism implemented right before EuroPython 2004 for both the - trivial and the stdobjspace)) - -Translator -========== - -* enhance the translator components to accept more of PyPy ... - -Tools -===== - -* add web server thread (!) that allows inspection of e.g. - interpreter-level tracebacks (and stop clogging the user's terminal - with them). --> there is some preliminary working code in - tool/tb_server - -* Interpreter level tracebacks are spectacular in their uselessness, - especially since the advent of descroperation. It should be - possible to construct something like an app-level traceback even - when there's no OperationError. - -* improve traceobjectspace! currently it only catches - calls from outside the space into the space but not - the ones where space operations involve calling more space - operations (the latter are not traced)! (fixed?) From pedronis at codespeak.net Thu May 19 14:58:27 2005 From: pedronis at codespeak.net (pedronis at codespeak.net) Date: Thu, 19 May 2005 14:58:27 +0200 (CEST) Subject: [pypy-svn] r12527 - pypy/dist/pypy Message-ID: <20050519125827.A685527B9C@code1.codespeak.net> Author: pedronis Date: Thu May 19 14:58:27 2005 New Revision: 12527 Modified: pypy/dist/pypy/TODO Log: this one solved judging from the code Modified: pypy/dist/pypy/TODO ============================================================================== --- pypy/dist/pypy/TODO (original) +++ pypy/dist/pypy/TODO Thu May 19 14:58:27 2005 @@ -16,8 +16,6 @@ * review whatever you like -* sys.last_type/last_value are not normalized -- bug - StdObjSpace =========== From pedronis at codespeak.net Thu May 19 15:00:14 2005 From: pedronis at codespeak.net (pedronis at codespeak.net) Date: Thu, 19 May 2005 15:00:14 +0200 (CEST) Subject: [pypy-svn] r12528 - pypy/dist/pypy Message-ID: <20050519130014.0385E27B9E@code1.codespeak.net> Author: pedronis Date: Thu May 19 15:00:13 2005 New Revision: 12528 Modified: pypy/dist/pypy/TODO Log: this one seems fixed too Modified: pypy/dist/pypy/TODO ============================================================================== --- pypy/dist/pypy/TODO (original) +++ pypy/dist/pypy/TODO Thu May 19 15:00:13 2005 @@ -12,8 +12,6 @@ - running interp-level py-test style regrtests - running doctests with py.test modules -* not all of CPython's exceptions use the same __init__! - * review whatever you like StdObjSpace From ale at codespeak.net Thu May 19 15:09:21 2005 From: ale at codespeak.net (ale at codespeak.net) Date: Thu, 19 May 2005 15:09:21 +0200 (CEST) Subject: [pypy-svn] r12530 - pypy/dist/pypy/documentation Message-ID: <20050519130921.A13D727B92@code1.codespeak.net> Author: ale Date: Thu May 19 15:09:21 2005 New Revision: 12530 Modified: pypy/dist/pypy/documentation/getting_started.txt Log: typo Modified: pypy/dist/pypy/documentation/getting_started.txt ============================================================================== --- pypy/dist/pypy/documentation/getting_started.txt (original) +++ pypy/dist/pypy/documentation/getting_started.txt Thu May 19 15:09:21 2005 @@ -102,7 +102,7 @@ Interesting Starting Points in PyPy =================================== -The following assumes that you have successfully downloaded and exctracted the +The following assumes that you have successfully downloaded and extracted the PyPy release or have checked out PyPy using svn. It assumes that you are in the top level directory of the PyPy source tree, e.g. pypy-x.x (if you got a release) or pypy-dist (if you checked out the most recent version using From pedronis at codespeak.net Thu May 19 15:10:06 2005 From: pedronis at codespeak.net (pedronis at codespeak.net) Date: Thu, 19 May 2005 15:10:06 +0200 (CEST) Subject: [pypy-svn] r12531 - pypy/dist/pypy Message-ID: <20050519131006.D89A727B9E@code1.codespeak.net> Author: pedronis Date: Thu May 19 15:10:06 2005 New Revision: 12531 Modified: pypy/dist/pypy/TODO Log: lets forget this one Modified: pypy/dist/pypy/TODO ============================================================================== --- pypy/dist/pypy/TODO (original) +++ pypy/dist/pypy/TODO Thu May 19 15:10:06 2005 @@ -1,8 +1,6 @@ General ======= -* mark debugging variables to make our code more readable - * extend the testing mechanisms to specifically allow: - running plain CPython regrtests (including outputtests, unittests, doctests, ...) From pedronis at codespeak.net Thu May 19 15:20:49 2005 From: pedronis at codespeak.net (pedronis at codespeak.net) Date: Thu, 19 May 2005 15:20:49 +0200 (CEST) Subject: [pypy-svn] r12532 - pypy/dist/pypy Message-ID: <20050519132049.AFEA427B92@code1.codespeak.net> Author: pedronis Date: Thu May 19 15:20:49 2005 New Revision: 12532 Modified: pypy/dist/pypy/TODO Log: created issues, attached info to issues for these Modified: pypy/dist/pypy/TODO ============================================================================== --- pypy/dist/pypy/TODO (original) +++ pypy/dist/pypy/TODO Thu May 19 15:20:49 2005 @@ -1,21 +1,5 @@ General ======= -* extend the testing mechanisms to specifically allow: - - running plain CPython regrtests (including outputtests, - unittests, doctests, ...) - - running modified CPython regrtests againat CPython - as well as against PyPy - - running pure app-level py-test style regrtests - - running interp-level py-test style regrtests - - running doctests with py.test modules - * review whatever you like -StdObjSpace -=========== - -* String formatting is agonizingly slow. - -* (documentation) generate a nice dot-graph from the structure of PyPy - From pedronis at codespeak.net Thu May 19 15:23:12 2005 From: pedronis at codespeak.net (pedronis at codespeak.net) Date: Thu, 19 May 2005 15:23:12 +0200 (CEST) Subject: [pypy-svn] r12533 - pypy/dist/pypy Message-ID: <20050519132312.9DBE427B92@code1.codespeak.net> Author: pedronis Date: Thu May 19 15:23:12 2005 New Revision: 12533 Removed: pypy/dist/pypy/TODO Log: created generic issues for the last entry too. Removing TODO file Deleted: /pypy/dist/pypy/TODO ============================================================================== --- /pypy/dist/pypy/TODO Thu May 19 15:23:12 2005 +++ (empty file) @@ -1,5 +0,0 @@ -General -======= - -* review whatever you like - From pedronis at codespeak.net Thu May 19 15:49:16 2005 From: pedronis at codespeak.net (pedronis at codespeak.net) Date: Thu, 19 May 2005 15:49:16 +0200 (CEST) Subject: [pypy-svn] r12537 - pypy/dist/pypy/documentation Message-ID: <20050519134916.C4B2F27B96@code1.codespeak.net> Author: pedronis Date: Thu May 19 15:49:16 2005 New Revision: 12537 Modified: pypy/dist/pypy/documentation/release-0.6.txt Log: issue16 in-progress removed a word repetition Disclaimer -> Project setup and acknowledgments Modified: pypy/dist/pypy/documentation/release-0.6.txt ============================================================================== --- pypy/dist/pypy/documentation/release-0.6.txt (original) +++ pypy/dist/pypy/documentation/release-0.6.txt Thu May 19 15:49:16 2005 @@ -97,10 +97,11 @@ the PyPy Development Team -Disclaimer: -PyPy development and activities happens as open source source -project under the http://codespeak.net/ umbrella and with -the support of a consortium funded by a EU IST research grant: +Project Setup and Acknowledgements: + +PyPy development and activities happens as open source project under +the http://codespeak.net/ umbrella and with the support of a +consortium funded by a EU IST research grant: **(xxx consortium partners?? )** From cfbolz at codespeak.net Thu May 19 15:52:56 2005 From: cfbolz at codespeak.net (cfbolz at codespeak.net) Date: Thu, 19 May 2005 15:52:56 +0200 (CEST) Subject: [pypy-svn] r12538 - pypy/dist/pypy/documentation Message-ID: <20050519135256.C971327B96@code1.codespeak.net> Author: cfbolz Date: Thu May 19 15:52:56 2005 New Revision: 12538 Modified: pypy/dist/pypy/documentation/getting_started.txt Log: issue 68 testing Fix getting_started to contain the LLVM version that genllvm was developed with. Modified: pypy/dist/pypy/documentation/getting_started.txt ============================================================================== --- pypy/dist/pypy/documentation/getting_started.txt (original) +++ pypy/dist/pypy/documentation/getting_started.txt Thu May 19 15:52:56 2005 @@ -454,10 +454,13 @@ LLVM can be quite annoying to install: you need a fairly recent version of GCC to compile it and there can be severe problems under windows. There are detailed instructions on `how to install LLVM`_. To use the LLVM backend - you don't need the GCC front end of LLVM, only LLVM itself. If you run - into problems with the installation the `LLVM mailing list`_ is very + of PyPy you don't need the GCC front end of LLVM, only LLVM itself. If you + run into problems with the installation the `LLVM mailing list`_ is very helpful and friendly. + Note that the PyPy LLVM backend was developed using LLVM 1.4. The + newest version (LLVM 1.5) will probably work, too. + *CLISP* (used for the optional Lisp translation backend) From cfbolz at codespeak.net Thu May 19 16:19:08 2005 From: cfbolz at codespeak.net (cfbolz at codespeak.net) Date: Thu, 19 May 2005 16:19:08 +0200 (CEST) Subject: [pypy-svn] r12543 - pypy/dist Message-ID: <20050519141908.068D027B99@code1.codespeak.net> Author: cfbolz Date: Thu May 19 16:19:07 2005 New Revision: 12543 Modified: pypy/dist/README Log: issue5 in-progress Added pointer to the docs in pypy/documentation Modified: pypy/dist/README ============================================================================== --- pypy/dist/README (original) +++ pypy/dist/README Thu May 19 16:19:07 2005 @@ -17,6 +17,11 @@ http://codespeak.net/pypy/index.cgi?doc +All the documentation files (in ReST format) can also be found +in the following directory of the PyPy source tree: + + pypy/documentation + Our online release announcement has some more information about the specific 0.6 release: From hpk at codespeak.net Thu May 19 16:25:23 2005 From: hpk at codespeak.net (hpk at codespeak.net) Date: Thu, 19 May 2005 16:25:23 +0200 (CEST) Subject: [pypy-svn] r12545 - pypy/dist Message-ID: <20050519142523.7A71A27B99@code1.codespeak.net> Author: hpk Date: Thu May 19 16:25:23 2005 New Revision: 12545 Modified: pypy/dist/README Log: remove the http documentation url, it's all crosslinked anyway. Modified: pypy/dist/README ============================================================================== --- pypy/dist/README (original) +++ pypy/dist/README Thu May 19 16:25:23 2005 @@ -13,17 +13,13 @@ which gives you many good starting and entry points into playing with PyPy. It will also point you to our -documentation section which you can also directly enter here: - - http://codespeak.net/pypy/index.cgi?doc - -All the documentation files (in ReST format) can also be found -in the following directory of the PyPy source tree: +documentation section of which you can find the source ReST +files in the following directory: pypy/documentation Our online release announcement has some more -information about the specific 0.6 release: +information about the specific PyPy-0.6 release: http://codespeak.net/pypy/index.cgi?doc/release-0.6.html From cfbolz at codespeak.net Thu May 19 16:38:35 2005 From: cfbolz at codespeak.net (cfbolz at codespeak.net) Date: Thu, 19 May 2005 16:38:35 +0200 (CEST) Subject: [pypy-svn] r12546 - pypy/dist/pypy/translator/llvm/test Message-ID: <20050519143835.DCA9B27B9E@code1.codespeak.net> Author: cfbolz Date: Thu May 19 16:38:35 2005 New Revision: 12546 Modified: pypy/dist/pypy/translator/llvm/test/test_genllvm.py pypy/dist/pypy/translator/llvm/test/test_snippet.py Log: issue 57 in-progress Disbled failing tests of genllvm for now. Modified: pypy/dist/pypy/translator/llvm/test/test_genllvm.py ============================================================================== --- pypy/dist/pypy/translator/llvm/test/test_genllvm.py (original) +++ pypy/dist/pypy/translator/llvm/test/test_genllvm.py Thu May 19 16:38:35 2005 @@ -147,7 +147,7 @@ for i in range(10, 20): assert f(i) == 2 - def test_catch_instance(self): + def DONOT_test_catch_instance(self): f = compile_function(llvmsnippet.catches, [int]) assert f(1) == 1 assert f(2) == 1 Modified: pypy/dist/pypy/translator/llvm/test/test_snippet.py ============================================================================== --- pypy/dist/pypy/translator/llvm/test/test_snippet.py (original) +++ pypy/dist/pypy/translator/llvm/test/test_snippet.py Thu May 19 16:38:35 2005 @@ -78,7 +78,7 @@ set_attr = compile_function(test.set_attr, []) assert set_attr() == 2 - def test_try_raise_choose(self): + def DONOT_test_try_raise_choose(self): try_raise_choose = compile_function(test.try_raise_choose, [int]) for i in [-1, 0, 1, 2]: assert try_raise_choose(i) == i From ac at codespeak.net Thu May 19 16:42:37 2005 From: ac at codespeak.net (ac at codespeak.net) Date: Thu, 19 May 2005 16:42:37 +0200 (CEST) Subject: [pypy-svn] r12547 - pypy/branch/non-fake-unicode/pypy/module/unicodedata Message-ID: <20050519144237.1BDE127B9E@code1.codespeak.net> Author: ac Date: Thu May 19 16:42:35 2005 New Revision: 12547 Modified: pypy/branch/non-fake-unicode/pypy/module/unicodedata/generate_unicodedb.py pypy/branch/non-fake-unicode/pypy/module/unicodedata/unicodedb.py Log: Add decomposition(). Modified: pypy/branch/non-fake-unicode/pypy/module/unicodedata/generate_unicodedb.py ============================================================================== --- pypy/branch/non-fake-unicode/pypy/module/unicodedata/generate_unicodedb.py (original) +++ pypy/branch/non-fake-unicode/pypy/module/unicodedata/generate_unicodedb.py Thu May 19 16:42:35 2005 @@ -13,16 +13,8 @@ self.combining = int(data[3]) self.bidirectional = data[4] self.decomposition = None - self.decomposition_tag = None if data[5]: - if data[5][0] == '<': - tag, value = data[5].split(None, 1) - else: - tag = '' - value = data[5] - self.decomposition_tag = tag[1:-1] - self.decomposition = [int(v, 16) for v in value.split()] - + self.decomposition = data[5] self.decimal = None if data[6]: self.decimal = int(data[6]) @@ -99,22 +91,6 @@ self._cache[string] = index self._strings.append(string) return index - -def writeCategory(_outfile, table, name, categoryNames): - cache = Cache() - print >> outfile, '_%s_names = %r' % (name, categoryNames) - print >> outfile, '_%s = "".join([' % name - for i in range(0, len(table), 64): - result = [] - for char in table[i:i + 64]: - result.append(chr(categoryNames.index(getattr(char, name)) + 0x20)) - print >> outfile, ' %r,' % ''.join(result) - print >> outfile, '])' - print >> outfile, ''' -def %s(code): - return _%s_names[ord(_%s[code]) & 0x1f] - -'''%(name, name, name) def writeCategory(outfile, table, name, categoryNames): pgbits = 8 @@ -292,30 +268,15 @@ return _totitle.get(code, code) ''' - # Mirrored - mirrored = dict([(code, 1) for char in table - if char.mirrored]) - mirrored = {} - for code in range(len(table)): - if table[code].mirrored: - mirrored[code] = 1 - writeDict(outfile, '_mirrored', mirrored) - print >> outfile, ''' -def mirrored(code): - return _mirrored.get(code, 0) - -''' - # Mirrored - mirrored = dict([(code, 1) for char in table - if char.mirrored]) - mirrored = {} + # Decomposition + decomposition = {} for code in range(len(table)): - if table[code].mirrored: - mirrored[code] = 1 - writeDict(outfile, '_mirrored', mirrored) + if table[code].decomposition: + decomposition[code] = table[code].decomposition + writeDict(outfile, '_decomposition', decomposition) print >> outfile, ''' -def mirrored(code): - return _mirrored.get(code, 0) +def decompisition(code): + return _decomposition.get(code,'') ''' Modified: pypy/branch/non-fake-unicode/pypy/module/unicodedata/unicodedb.py ============================================================================== --- pypy/branch/non-fake-unicode/pypy/module/unicodedata/unicodedb.py (original) +++ pypy/branch/non-fake-unicode/pypy/module/unicodedata/unicodedb.py Thu May 19 16:42:35 2005 @@ -19024,1003 +19024,5154 @@ return _totitle.get(code, code) -_mirrored = { -40: 1, -41: 1, -60: 1, -62: 1, -91: 1, -93: 1, -123: 1, -125: 1, -171: 1, -187: 1, -8249: 1, -8250: 1, -8261: 1, -8262: 1, -8317: 1, -8318: 1, -8333: 1, -8334: 1, -8512: 1, -8705: 1, -8706: 1, -8707: 1, -8708: 1, -8712: 1, -8713: 1, -8714: 1, -8715: 1, -8716: 1, -8717: 1, -8721: 1, -8725: 1, -8726: 1, -8730: 1, -8731: 1, -8732: 1, -8733: 1, -8735: 1, -8736: 1, -8737: 1, -8738: 1, -8740: 1, -8742: 1, -8747: 1, -8748: 1, -8749: 1, -8750: 1, -8751: 1, -8752: 1, -8753: 1, -8754: 1, -8755: 1, -8761: 1, -8763: 1, -8764: 1, -8765: 1, -8766: 1, -8767: 1, -8768: 1, -8769: 1, -8770: 1, -8771: 1, -8772: 1, -8773: 1, -8774: 1, -8775: 1, -8776: 1, -8777: 1, -8778: 1, -8779: 1, -8780: 1, -8786: 1, -8787: 1, -8788: 1, -8789: 1, -8799: 1, -8800: 1, -8802: 1, -8804: 1, -8805: 1, -8806: 1, -8807: 1, -8808: 1, -8809: 1, -8810: 1, -8811: 1, -8814: 1, -8815: 1, -8816: 1, -8817: 1, -8818: 1, -8819: 1, -8820: 1, -8821: 1, -8822: 1, -8823: 1, -8824: 1, -8825: 1, -8826: 1, -8827: 1, -8828: 1, -8829: 1, -8830: 1, -8831: 1, -8832: 1, -8833: 1, -8834: 1, -8835: 1, -8836: 1, -8837: 1, -8838: 1, -8839: 1, -8840: 1, -8841: 1, -8842: 1, -8843: 1, -8844: 1, -8847: 1, -8848: 1, -8849: 1, -8850: 1, -8856: 1, -8866: 1, -8867: 1, -8870: 1, -8871: 1, -8872: 1, -8873: 1, -8874: 1, -8875: 1, -8876: 1, -8877: 1, -8878: 1, -8879: 1, -8880: 1, -8881: 1, -8882: 1, -8883: 1, -8884: 1, -8885: 1, -8886: 1, -8887: 1, -8888: 1, -8894: 1, -8895: 1, -8905: 1, -8906: 1, -8907: 1, -8908: 1, -8909: 1, -8912: 1, -8913: 1, -8918: 1, -8919: 1, -8920: 1, -8921: 1, -8922: 1, -8923: 1, -8924: 1, -8925: 1, -8926: 1, -8927: 1, -8928: 1, -8929: 1, -8930: 1, -8931: 1, -8932: 1, -8933: 1, -8934: 1, -8935: 1, -8936: 1, -8937: 1, -8938: 1, -8939: 1, -8940: 1, -8941: 1, -8944: 1, -8945: 1, -8946: 1, -8947: 1, -8948: 1, -8949: 1, -8950: 1, -8951: 1, -8952: 1, -8953: 1, -8954: 1, -8955: 1, -8956: 1, -8957: 1, -8958: 1, -8959: 1, -8968: 1, -8969: 1, -8970: 1, -8971: 1, -8992: 1, -8993: 1, -9001: 1, -9002: 1, -10088: 1, -10089: 1, -10090: 1, -10091: 1, -10092: 1, -10093: 1, -10094: 1, -10095: 1, -10096: 1, -10097: 1, -10098: 1, -10099: 1, -10100: 1, -10101: 1, -10195: 1, -10196: 1, -10197: 1, -10198: 1, -10204: 1, -10205: 1, -10206: 1, -10210: 1, -10211: 1, -10212: 1, -10213: 1, -10214: 1, -10215: 1, -10216: 1, -10217: 1, -10218: 1, -10219: 1, -10627: 1, -10628: 1, -10629: 1, -10630: 1, -10631: 1, -10632: 1, -10633: 1, -10634: 1, -10635: 1, -10636: 1, -10637: 1, -10638: 1, -10639: 1, -10640: 1, -10641: 1, -10642: 1, -10643: 1, -10644: 1, -10645: 1, -10646: 1, -10647: 1, -10648: 1, -10651: 1, -10652: 1, -10653: 1, -10654: 1, -10655: 1, -10656: 1, -10657: 1, -10658: 1, -10659: 1, -10660: 1, -10661: 1, -10662: 1, -10663: 1, -10664: 1, -10665: 1, -10666: 1, -10667: 1, -10668: 1, -10669: 1, -10670: 1, -10671: 1, -10680: 1, -10688: 1, -10689: 1, -10690: 1, -10691: 1, -10692: 1, -10693: 1, -10697: 1, -10702: 1, -10703: 1, -10704: 1, -10705: 1, -10706: 1, -10708: 1, -10709: 1, -10712: 1, -10713: 1, -10714: 1, -10715: 1, -10716: 1, -10721: 1, -10723: 1, -10724: 1, -10725: 1, -10728: 1, -10729: 1, -10740: 1, -10741: 1, -10742: 1, -10743: 1, -10744: 1, -10745: 1, -10748: 1, -10749: 1, -10762: 1, -10763: 1, -10764: 1, -10765: 1, -10766: 1, -10767: 1, -10768: 1, -10769: 1, -10770: 1, -10771: 1, -10772: 1, -10773: 1, -10774: 1, -10775: 1, -10776: 1, -10777: 1, -10778: 1, -10779: 1, -10780: 1, -10782: 1, -10783: 1, -10784: 1, -10785: 1, -10788: 1, -10790: 1, -10793: 1, -10795: 1, -10796: 1, -10797: 1, -10798: 1, -10804: 1, -10805: 1, -10812: 1, -10813: 1, -10814: 1, -10839: 1, -10840: 1, -10852: 1, -10853: 1, -10858: 1, -10859: 1, -10860: 1, -10861: 1, -10863: 1, -10864: 1, -10867: 1, -10868: 1, -10873: 1, -10874: 1, -10875: 1, -10876: 1, -10877: 1, -10878: 1, -10879: 1, -10880: 1, -10881: 1, -10882: 1, -10883: 1, -10884: 1, -10885: 1, -10886: 1, -10887: 1, -10888: 1, -10889: 1, -10890: 1, -10891: 1, -10892: 1, -10893: 1, -10894: 1, -10895: 1, -10896: 1, -10897: 1, -10898: 1, -10899: 1, -10900: 1, -10901: 1, -10902: 1, -10903: 1, -10904: 1, -10905: 1, -10906: 1, -10907: 1, -10908: 1, -10909: 1, -10910: 1, -10911: 1, -10912: 1, -10913: 1, -10914: 1, -10915: 1, -10918: 1, -10919: 1, -10920: 1, -10921: 1, -10922: 1, -10923: 1, -10924: 1, -10925: 1, -10927: 1, -10928: 1, -10929: 1, -10930: 1, -10931: 1, -10932: 1, -10933: 1, -10934: 1, -10935: 1, -10936: 1, -10937: 1, -10938: 1, -10939: 1, -10940: 1, -10941: 1, -10942: 1, -10943: 1, -10944: 1, -10945: 1, -10946: 1, -10947: 1, -10948: 1, -10949: 1, -10950: 1, -10951: 1, -10952: 1, -10953: 1, -10954: 1, -10955: 1, -10956: 1, -10957: 1, -10958: 1, -10959: 1, -10960: 1, -10961: 1, -10962: 1, -10963: 1, -10964: 1, -10965: 1, -10966: 1, -10972: 1, -10974: 1, -10978: 1, -10979: 1, -10980: 1, -10981: 1, -10982: 1, -10988: 1, -10989: 1, -10990: 1, -10995: 1, -10999: 1, -11000: 1, -11001: 1, -11002: 1, -11003: 1, -11005: 1, -12296: 1, -12297: 1, -12298: 1, -12299: 1, -12300: 1, -12301: 1, -12302: 1, -12303: 1, -12304: 1, -12305: 1, -12308: 1, -12309: 1, -12310: 1, -12311: 1, -12312: 1, -12313: 1, -12314: 1, -12315: 1, -65288: 1, -65289: 1, -65308: 1, -65310: 1, -65339: 1, -65341: 1, -65371: 1, -65373: 1, -65375: 1, -65376: 1, -65378: 1, -65379: 1, +_decomposition = { +160: ' 0020', +168: ' 0020 0308', +170: ' 0061', +175: ' 0020 0304', +178: ' 0032', +179: ' 0033', +180: ' 0020 0301', +181: ' 03BC', +184: ' 0020 0327', +185: ' 0031', +186: ' 006F', +188: ' 0031 2044 0034', +189: ' 0031 2044 0032', +190: ' 0033 2044 0034', +192: '0041 0300', +193: '0041 0301', +194: '0041 0302', +195: '0041 0303', +196: '0041 0308', +197: '0041 030A', +199: '0043 0327', +200: '0045 0300', +201: '0045 0301', +202: '0045 0302', +203: '0045 0308', +204: '0049 0300', +205: '0049 0301', +206: '0049 0302', +207: '0049 0308', +209: '004E 0303', +210: '004F 0300', +211: '004F 0301', +212: '004F 0302', +213: '004F 0303', +214: '004F 0308', +217: '0055 0300', +218: '0055 0301', +219: '0055 0302', +220: '0055 0308', +221: '0059 0301', +224: '0061 0300', +225: '0061 0301', +226: '0061 0302', +227: '0061 0303', +228: '0061 0308', +229: '0061 030A', +231: '0063 0327', +232: '0065 0300', +233: '0065 0301', +234: '0065 0302', +235: '0065 0308', +236: '0069 0300', +237: '0069 0301', +238: '0069 0302', +239: '0069 0308', +241: '006E 0303', +242: '006F 0300', +243: '006F 0301', +244: '006F 0302', +245: '006F 0303', +246: '006F 0308', +249: '0075 0300', +250: '0075 0301', +251: '0075 0302', +252: '0075 0308', +253: '0079 0301', +255: '0079 0308', +256: '0041 0304', +257: '0061 0304', +258: '0041 0306', +259: '0061 0306', +260: '0041 0328', +261: '0061 0328', +262: '0043 0301', +263: '0063 0301', +264: '0043 0302', +265: '0063 0302', +266: '0043 0307', +267: '0063 0307', +268: '0043 030C', +269: '0063 030C', +270: '0044 030C', +271: '0064 030C', +274: '0045 0304', +275: '0065 0304', +276: '0045 0306', +277: '0065 0306', +278: '0045 0307', +279: '0065 0307', +280: '0045 0328', +281: '0065 0328', +282: '0045 030C', +283: '0065 030C', +284: '0047 0302', +285: '0067 0302', +286: '0047 0306', +287: '0067 0306', +288: '0047 0307', +289: '0067 0307', +290: '0047 0327', +291: '0067 0327', +292: '0048 0302', +293: '0068 0302', +296: '0049 0303', +297: '0069 0303', +298: '0049 0304', +299: '0069 0304', +300: '0049 0306', +301: '0069 0306', +302: '0049 0328', +303: '0069 0328', +304: '0049 0307', +306: ' 0049 004A', +307: ' 0069 006A', +308: '004A 0302', +309: '006A 0302', +310: '004B 0327', +311: '006B 0327', +313: '004C 0301', +314: '006C 0301', +315: '004C 0327', +316: '006C 0327', +317: '004C 030C', +318: '006C 030C', +319: ' 004C 00B7', +320: ' 006C 00B7', +323: '004E 0301', +324: '006E 0301', +325: '004E 0327', +326: '006E 0327', +327: '004E 030C', +328: '006E 030C', +329: ' 02BC 006E', +332: '004F 0304', +333: '006F 0304', +334: '004F 0306', +335: '006F 0306', +336: '004F 030B', +337: '006F 030B', +340: '0052 0301', +341: '0072 0301', +342: '0052 0327', +343: '0072 0327', +344: '0052 030C', +345: '0072 030C', +346: '0053 0301', +347: '0073 0301', +348: '0053 0302', +349: '0073 0302', +350: '0053 0327', +351: '0073 0327', +352: '0053 030C', +353: '0073 030C', +354: '0054 0327', +355: '0074 0327', +356: '0054 030C', +357: '0074 030C', +360: '0055 0303', +361: '0075 0303', +362: '0055 0304', +363: '0075 0304', +364: '0055 0306', +365: '0075 0306', +366: '0055 030A', +367: '0075 030A', +368: '0055 030B', +369: '0075 030B', +370: '0055 0328', +371: '0075 0328', +372: '0057 0302', +373: '0077 0302', +374: '0059 0302', +375: '0079 0302', +376: '0059 0308', +377: '005A 0301', +378: '007A 0301', +379: '005A 0307', +380: '007A 0307', +381: '005A 030C', +382: '007A 030C', +383: ' 0073', +416: '004F 031B', +417: '006F 031B', +431: '0055 031B', +432: '0075 031B', +452: ' 0044 017D', +453: ' 0044 017E', +454: ' 0064 017E', +455: ' 004C 004A', +456: ' 004C 006A', +457: ' 006C 006A', +458: ' 004E 004A', +459: ' 004E 006A', +460: ' 006E 006A', +461: '0041 030C', +462: '0061 030C', +463: '0049 030C', +464: '0069 030C', +465: '004F 030C', +466: '006F 030C', +467: '0055 030C', +468: '0075 030C', +469: '00DC 0304', +470: '00FC 0304', +471: '00DC 0301', +472: '00FC 0301', +473: '00DC 030C', +474: '00FC 030C', +475: '00DC 0300', +476: '00FC 0300', +478: '00C4 0304', +479: '00E4 0304', +480: '0226 0304', +481: '0227 0304', +482: '00C6 0304', +483: '00E6 0304', +486: '0047 030C', +487: '0067 030C', +488: '004B 030C', +489: '006B 030C', +490: '004F 0328', +491: '006F 0328', +492: '01EA 0304', +493: '01EB 0304', +494: '01B7 030C', +495: '0292 030C', +496: '006A 030C', +497: ' 0044 005A', +498: ' 0044 007A', +499: ' 0064 007A', +500: '0047 0301', +501: '0067 0301', +504: '004E 0300', +505: '006E 0300', +506: '00C5 0301', +507: '00E5 0301', +508: '00C6 0301', +509: '00E6 0301', +510: '00D8 0301', +511: '00F8 0301', +512: '0041 030F', +513: '0061 030F', +514: '0041 0311', +515: '0061 0311', +516: '0045 030F', +517: '0065 030F', +518: '0045 0311', +519: '0065 0311', +520: '0049 030F', +521: '0069 030F', +522: '0049 0311', +523: '0069 0311', +524: '004F 030F', +525: '006F 030F', +526: '004F 0311', +527: '006F 0311', +528: '0052 030F', +529: '0072 030F', +530: '0052 0311', +531: '0072 0311', +532: '0055 030F', +533: '0075 030F', +534: '0055 0311', +535: '0075 0311', +536: '0053 0326', +537: '0073 0326', +538: '0054 0326', +539: '0074 0326', +542: '0048 030C', +543: '0068 030C', +550: '0041 0307', +551: '0061 0307', +552: '0045 0327', +553: '0065 0327', +554: '00D6 0304', +555: '00F6 0304', +556: '00D5 0304', +557: '00F5 0304', +558: '004F 0307', +559: '006F 0307', +560: '022E 0304', +561: '022F 0304', +562: '0059 0304', +563: '0079 0304', +688: ' 0068', +689: ' 0266', +690: ' 006A', +691: ' 0072', +692: ' 0279', +693: ' 027B', +694: ' 0281', +695: ' 0077', +696: ' 0079', +728: ' 0020 0306', +729: ' 0020 0307', +730: ' 0020 030A', +731: ' 0020 0328', +732: ' 0020 0303', +733: ' 0020 030B', +736: ' 0263', +737: ' 006C', +738: ' 0073', +739: ' 0078', +740: ' 0295', +832: '0300', +833: '0301', +835: '0313', +836: '0308 0301', +884: '02B9', +890: ' 0020 0345', +894: '003B', +900: ' 0020 0301', +901: '00A8 0301', +902: '0391 0301', +903: '00B7', +904: '0395 0301', +905: '0397 0301', +906: '0399 0301', +908: '039F 0301', +910: '03A5 0301', +911: '03A9 0301', +912: '03CA 0301', +938: '0399 0308', +939: '03A5 0308', +940: '03B1 0301', +941: '03B5 0301', +942: '03B7 0301', +943: '03B9 0301', +944: '03CB 0301', +970: '03B9 0308', +971: '03C5 0308', +972: '03BF 0301', +973: '03C5 0301', +974: '03C9 0301', +976: ' 03B2', +977: ' 03B8', +978: ' 03A5', +979: '03D2 0301', +980: '03D2 0308', +981: ' 03C6', +982: ' 03C0', +1008: ' 03BA', +1009: ' 03C1', +1010: ' 03C2', +1012: ' 0398', +1013: ' 03B5', +1024: '0415 0300', +1025: '0415 0308', +1027: '0413 0301', +1031: '0406 0308', +1036: '041A 0301', +1037: '0418 0300', +1038: '0423 0306', +1049: '0418 0306', +1081: '0438 0306', +1104: '0435 0300', +1105: '0435 0308', +1107: '0433 0301', +1111: '0456 0308', +1116: '043A 0301', +1117: '0438 0300', +1118: '0443 0306', +1142: '0474 030F', +1143: '0475 030F', +1217: '0416 0306', +1218: '0436 0306', +1232: '0410 0306', +1233: '0430 0306', +1234: '0410 0308', +1235: '0430 0308', +1238: '0415 0306', +1239: '0435 0306', +1242: '04D8 0308', +1243: '04D9 0308', +1244: '0416 0308', +1245: '0436 0308', +1246: '0417 0308', +1247: '0437 0308', +1250: '0418 0304', +1251: '0438 0304', +1252: '0418 0308', +1253: '0438 0308', +1254: '041E 0308', +1255: '043E 0308', +1258: '04E8 0308', +1259: '04E9 0308', +1260: '042D 0308', +1261: '044D 0308', +1262: '0423 0304', +1263: '0443 0304', +1264: '0423 0308', +1265: '0443 0308', +1266: '0423 030B', +1267: '0443 030B', +1268: '0427 0308', +1269: '0447 0308', +1272: '042B 0308', +1273: '044B 0308', +1415: ' 0565 0582', +1570: '0627 0653', +1571: '0627 0654', +1572: '0648 0654', +1573: '0627 0655', +1574: '064A 0654', +1653: ' 0627 0674', +1654: ' 0648 0674', +1655: ' 06C7 0674', +1656: ' 064A 0674', +1728: '06D5 0654', +1730: '06C1 0654', +1747: '06D2 0654', +2345: '0928 093C', +2353: '0930 093C', +2356: '0933 093C', +2392: '0915 093C', +2393: '0916 093C', +2394: '0917 093C', +2395: '091C 093C', +2396: '0921 093C', +2397: '0922 093C', +2398: '092B 093C', +2399: '092F 093C', +2507: '09C7 09BE', +2508: '09C7 09D7', +2524: '09A1 09BC', +2525: '09A2 09BC', +2527: '09AF 09BC', +2611: '0A32 0A3C', +2614: '0A38 0A3C', +2649: '0A16 0A3C', +2650: '0A17 0A3C', +2651: '0A1C 0A3C', +2654: '0A2B 0A3C', +2888: '0B47 0B56', +2891: '0B47 0B3E', +2892: '0B47 0B57', +2908: '0B21 0B3C', +2909: '0B22 0B3C', +2964: '0B92 0BD7', +3018: '0BC6 0BBE', +3019: '0BC7 0BBE', +3020: '0BC6 0BD7', +3144: '0C46 0C56', +3264: '0CBF 0CD5', +3271: '0CC6 0CD5', +3272: '0CC6 0CD6', +3274: '0CC6 0CC2', +3275: '0CCA 0CD5', +3402: '0D46 0D3E', +3403: '0D47 0D3E', +3404: '0D46 0D57', +3546: '0DD9 0DCA', +3548: '0DD9 0DCF', +3549: '0DDC 0DCA', +3550: '0DD9 0DDF', +3635: ' 0E4D 0E32', +3763: ' 0ECD 0EB2', +3804: ' 0EAB 0E99', +3805: ' 0EAB 0EA1', +3852: ' 0F0B', +3907: '0F42 0FB7', +3917: '0F4C 0FB7', +3922: '0F51 0FB7', +3927: '0F56 0FB7', +3932: '0F5B 0FB7', +3945: '0F40 0FB5', +3955: '0F71 0F72', +3957: '0F71 0F74', +3958: '0FB2 0F80', +3959: ' 0FB2 0F81', +3960: '0FB3 0F80', +3961: ' 0FB3 0F81', +3969: '0F71 0F80', +3987: '0F92 0FB7', +3997: '0F9C 0FB7', +4002: '0FA1 0FB7', +4007: '0FA6 0FB7', +4012: '0FAB 0FB7', +4025: '0F90 0FB5', +4134: '1025 102E', +7680: '0041 0325', +7681: '0061 0325', +7682: '0042 0307', +7683: '0062 0307', +7684: '0042 0323', +7685: '0062 0323', +7686: '0042 0331', +7687: '0062 0331', +7688: '00C7 0301', +7689: '00E7 0301', +7690: '0044 0307', +7691: '0064 0307', +7692: '0044 0323', +7693: '0064 0323', +7694: '0044 0331', +7695: '0064 0331', +7696: '0044 0327', +7697: '0064 0327', +7698: '0044 032D', +7699: '0064 032D', +7700: '0112 0300', +7701: '0113 0300', +7702: '0112 0301', +7703: '0113 0301', +7704: '0045 032D', +7705: '0065 032D', +7706: '0045 0330', +7707: '0065 0330', +7708: '0228 0306', +7709: '0229 0306', +7710: '0046 0307', +7711: '0066 0307', +7712: '0047 0304', +7713: '0067 0304', +7714: '0048 0307', +7715: '0068 0307', +7716: '0048 0323', +7717: '0068 0323', +7718: '0048 0308', +7719: '0068 0308', +7720: '0048 0327', +7721: '0068 0327', +7722: '0048 032E', +7723: '0068 032E', +7724: '0049 0330', +7725: '0069 0330', +7726: '00CF 0301', +7727: '00EF 0301', +7728: '004B 0301', +7729: '006B 0301', +7730: '004B 0323', +7731: '006B 0323', +7732: '004B 0331', +7733: '006B 0331', +7734: '004C 0323', +7735: '006C 0323', +7736: '1E36 0304', +7737: '1E37 0304', +7738: '004C 0331', +7739: '006C 0331', +7740: '004C 032D', +7741: '006C 032D', +7742: '004D 0301', +7743: '006D 0301', +7744: '004D 0307', +7745: '006D 0307', +7746: '004D 0323', +7747: '006D 0323', +7748: '004E 0307', +7749: '006E 0307', +7750: '004E 0323', +7751: '006E 0323', +7752: '004E 0331', +7753: '006E 0331', +7754: '004E 032D', +7755: '006E 032D', +7756: '00D5 0301', +7757: '00F5 0301', +7758: '00D5 0308', +7759: '00F5 0308', +7760: '014C 0300', +7761: '014D 0300', +7762: '014C 0301', +7763: '014D 0301', +7764: '0050 0301', +7765: '0070 0301', +7766: '0050 0307', +7767: '0070 0307', +7768: '0052 0307', +7769: '0072 0307', +7770: '0052 0323', +7771: '0072 0323', +7772: '1E5A 0304', +7773: '1E5B 0304', +7774: '0052 0331', +7775: '0072 0331', +7776: '0053 0307', +7777: '0073 0307', +7778: '0053 0323', +7779: '0073 0323', +7780: '015A 0307', +7781: '015B 0307', +7782: '0160 0307', +7783: '0161 0307', +7784: '1E62 0307', +7785: '1E63 0307', +7786: '0054 0307', +7787: '0074 0307', +7788: '0054 0323', +7789: '0074 0323', +7790: '0054 0331', +7791: '0074 0331', +7792: '0054 032D', +7793: '0074 032D', +7794: '0055 0324', +7795: '0075 0324', +7796: '0055 0330', +7797: '0075 0330', +7798: '0055 032D', +7799: '0075 032D', +7800: '0168 0301', +7801: '0169 0301', +7802: '016A 0308', +7803: '016B 0308', +7804: '0056 0303', +7805: '0076 0303', +7806: '0056 0323', +7807: '0076 0323', +7808: '0057 0300', +7809: '0077 0300', +7810: '0057 0301', +7811: '0077 0301', +7812: '0057 0308', +7813: '0077 0308', +7814: '0057 0307', +7815: '0077 0307', +7816: '0057 0323', +7817: '0077 0323', +7818: '0058 0307', +7819: '0078 0307', +7820: '0058 0308', +7821: '0078 0308', +7822: '0059 0307', +7823: '0079 0307', +7824: '005A 0302', +7825: '007A 0302', +7826: '005A 0323', +7827: '007A 0323', +7828: '005A 0331', +7829: '007A 0331', +7830: '0068 0331', +7831: '0074 0308', +7832: '0077 030A', +7833: '0079 030A', +7834: ' 0061 02BE', +7835: '017F 0307', +7840: '0041 0323', +7841: '0061 0323', +7842: '0041 0309', +7843: '0061 0309', +7844: '00C2 0301', +7845: '00E2 0301', +7846: '00C2 0300', +7847: '00E2 0300', +7848: '00C2 0309', +7849: '00E2 0309', +7850: '00C2 0303', +7851: '00E2 0303', +7852: '1EA0 0302', +7853: '1EA1 0302', +7854: '0102 0301', +7855: '0103 0301', +7856: '0102 0300', +7857: '0103 0300', +7858: '0102 0309', +7859: '0103 0309', +7860: '0102 0303', +7861: '0103 0303', +7862: '1EA0 0306', +7863: '1EA1 0306', +7864: '0045 0323', +7865: '0065 0323', +7866: '0045 0309', +7867: '0065 0309', +7868: '0045 0303', +7869: '0065 0303', +7870: '00CA 0301', +7871: '00EA 0301', +7872: '00CA 0300', +7873: '00EA 0300', +7874: '00CA 0309', +7875: '00EA 0309', +7876: '00CA 0303', +7877: '00EA 0303', +7878: '1EB8 0302', +7879: '1EB9 0302', +7880: '0049 0309', +7881: '0069 0309', +7882: '0049 0323', +7883: '0069 0323', +7884: '004F 0323', +7885: '006F 0323', +7886: '004F 0309', +7887: '006F 0309', +7888: '00D4 0301', +7889: '00F4 0301', +7890: '00D4 0300', +7891: '00F4 0300', +7892: '00D4 0309', +7893: '00F4 0309', +7894: '00D4 0303', +7895: '00F4 0303', +7896: '1ECC 0302', +7897: '1ECD 0302', +7898: '01A0 0301', +7899: '01A1 0301', +7900: '01A0 0300', +7901: '01A1 0300', +7902: '01A0 0309', +7903: '01A1 0309', +7904: '01A0 0303', +7905: '01A1 0303', +7906: '01A0 0323', +7907: '01A1 0323', +7908: '0055 0323', +7909: '0075 0323', +7910: '0055 0309', +7911: '0075 0309', +7912: '01AF 0301', +7913: '01B0 0301', +7914: '01AF 0300', +7915: '01B0 0300', +7916: '01AF 0309', +7917: '01B0 0309', +7918: '01AF 0303', +7919: '01B0 0303', +7920: '01AF 0323', +7921: '01B0 0323', +7922: '0059 0300', +7923: '0079 0300', +7924: '0059 0323', +7925: '0079 0323', +7926: '0059 0309', +7927: '0079 0309', +7928: '0059 0303', +7929: '0079 0303', +7936: '03B1 0313', +7937: '03B1 0314', +7938: '1F00 0300', +7939: '1F01 0300', +7940: '1F00 0301', +7941: '1F01 0301', +7942: '1F00 0342', +7943: '1F01 0342', +7944: '0391 0313', +7945: '0391 0314', +7946: '1F08 0300', +7947: '1F09 0300', +7948: '1F08 0301', +7949: '1F09 0301', +7950: '1F08 0342', +7951: '1F09 0342', +7952: '03B5 0313', +7953: '03B5 0314', +7954: '1F10 0300', +7955: '1F11 0300', +7956: '1F10 0301', +7957: '1F11 0301', +7960: '0395 0313', +7961: '0395 0314', +7962: '1F18 0300', +7963: '1F19 0300', +7964: '1F18 0301', +7965: '1F19 0301', +7968: '03B7 0313', +7969: '03B7 0314', +7970: '1F20 0300', +7971: '1F21 0300', +7972: '1F20 0301', +7973: '1F21 0301', +7974: '1F20 0342', +7975: '1F21 0342', +7976: '0397 0313', +7977: '0397 0314', +7978: '1F28 0300', +7979: '1F29 0300', +7980: '1F28 0301', +7981: '1F29 0301', +7982: '1F28 0342', +7983: '1F29 0342', +7984: '03B9 0313', +7985: '03B9 0314', +7986: '1F30 0300', +7987: '1F31 0300', +7988: '1F30 0301', +7989: '1F31 0301', +7990: '1F30 0342', +7991: '1F31 0342', +7992: '0399 0313', +7993: '0399 0314', +7994: '1F38 0300', +7995: '1F39 0300', +7996: '1F38 0301', +7997: '1F39 0301', +7998: '1F38 0342', +7999: '1F39 0342', +8000: '03BF 0313', +8001: '03BF 0314', +8002: '1F40 0300', +8003: '1F41 0300', +8004: '1F40 0301', +8005: '1F41 0301', +8008: '039F 0313', +8009: '039F 0314', +8010: '1F48 0300', +8011: '1F49 0300', +8012: '1F48 0301', +8013: '1F49 0301', +8016: '03C5 0313', +8017: '03C5 0314', +8018: '1F50 0300', +8019: '1F51 0300', +8020: '1F50 0301', +8021: '1F51 0301', +8022: '1F50 0342', +8023: '1F51 0342', +8025: '03A5 0314', +8027: '1F59 0300', +8029: '1F59 0301', +8031: '1F59 0342', +8032: '03C9 0313', +8033: '03C9 0314', +8034: '1F60 0300', +8035: '1F61 0300', +8036: '1F60 0301', +8037: '1F61 0301', +8038: '1F60 0342', +8039: '1F61 0342', +8040: '03A9 0313', +8041: '03A9 0314', +8042: '1F68 0300', +8043: '1F69 0300', +8044: '1F68 0301', +8045: '1F69 0301', +8046: '1F68 0342', +8047: '1F69 0342', +8048: '03B1 0300', +8049: '03AC', +8050: '03B5 0300', +8051: '03AD', +8052: '03B7 0300', +8053: '03AE', +8054: '03B9 0300', +8055: '03AF', +8056: '03BF 0300', +8057: '03CC', +8058: '03C5 0300', +8059: '03CD', +8060: '03C9 0300', +8061: '03CE', +8064: '1F00 0345', +8065: '1F01 0345', +8066: '1F02 0345', +8067: '1F03 0345', +8068: '1F04 0345', +8069: '1F05 0345', +8070: '1F06 0345', +8071: '1F07 0345', +8072: '1F08 0345', +8073: '1F09 0345', +8074: '1F0A 0345', +8075: '1F0B 0345', +8076: '1F0C 0345', +8077: '1F0D 0345', +8078: '1F0E 0345', +8079: '1F0F 0345', +8080: '1F20 0345', +8081: '1F21 0345', +8082: '1F22 0345', +8083: '1F23 0345', +8084: '1F24 0345', +8085: '1F25 0345', +8086: '1F26 0345', +8087: '1F27 0345', +8088: '1F28 0345', +8089: '1F29 0345', +8090: '1F2A 0345', +8091: '1F2B 0345', +8092: '1F2C 0345', +8093: '1F2D 0345', +8094: '1F2E 0345', +8095: '1F2F 0345', +8096: '1F60 0345', +8097: '1F61 0345', +8098: '1F62 0345', +8099: '1F63 0345', +8100: '1F64 0345', +8101: '1F65 0345', +8102: '1F66 0345', +8103: '1F67 0345', +8104: '1F68 0345', +8105: '1F69 0345', +8106: '1F6A 0345', +8107: '1F6B 0345', +8108: '1F6C 0345', +8109: '1F6D 0345', +8110: '1F6E 0345', +8111: '1F6F 0345', +8112: '03B1 0306', +8113: '03B1 0304', +8114: '1F70 0345', +8115: '03B1 0345', +8116: '03AC 0345', +8118: '03B1 0342', +8119: '1FB6 0345', +8120: '0391 0306', +8121: '0391 0304', +8122: '0391 0300', +8123: '0386', +8124: '0391 0345', +8125: ' 0020 0313', +8126: '03B9', +8127: ' 0020 0313', +8128: ' 0020 0342', +8129: '00A8 0342', +8130: '1F74 0345', +8131: '03B7 0345', +8132: '03AE 0345', +8134: '03B7 0342', +8135: '1FC6 0345', +8136: '0395 0300', +8137: '0388', +8138: '0397 0300', +8139: '0389', +8140: '0397 0345', +8141: '1FBF 0300', +8142: '1FBF 0301', +8143: '1FBF 0342', +8144: '03B9 0306', +8145: '03B9 0304', +8146: '03CA 0300', +8147: '0390', +8150: '03B9 0342', +8151: '03CA 0342', +8152: '0399 0306', +8153: '0399 0304', +8154: '0399 0300', +8155: '038A', +8157: '1FFE 0300', +8158: '1FFE 0301', +8159: '1FFE 0342', +8160: '03C5 0306', +8161: '03C5 0304', +8162: '03CB 0300', +8163: '03B0', +8164: '03C1 0313', +8165: '03C1 0314', +8166: '03C5 0342', +8167: '03CB 0342', +8168: '03A5 0306', +8169: '03A5 0304', +8170: '03A5 0300', +8171: '038E', +8172: '03A1 0314', +8173: '00A8 0300', +8174: '0385', +8175: '0060', +8178: '1F7C 0345', +8179: '03C9 0345', +8180: '03CE 0345', +8182: '03C9 0342', +8183: '1FF6 0345', +8184: '039F 0300', +8185: '038C', +8186: '03A9 0300', +8187: '038F', +8188: '03A9 0345', +8189: '00B4', +8190: ' 0020 0314', +8192: '2002', +8193: '2003', +8194: ' 0020', +8195: ' 0020', +8196: ' 0020', +8197: ' 0020', +8198: ' 0020', +8199: ' 0020', +8200: ' 0020', +8201: ' 0020', +8202: ' 0020', +8209: ' 2010', +8215: ' 0020 0333', +8228: ' 002E', +8229: ' 002E 002E', +8230: ' 002E 002E 002E', +8239: ' 0020', +8243: ' 2032 2032', +8244: ' 2032 2032 2032', +8246: ' 2035 2035', +8247: ' 2035 2035 2035', +8252: ' 0021 0021', +8254: ' 0020 0305', +8263: ' 003F 003F', +8264: ' 003F 0021', +8265: ' 0021 003F', +8279: ' 2032 2032 2032 2032', +8287: ' 0020', +8304: ' 0030', +8305: ' 0069', +8308: ' 0034', +8309: ' 0035', +8310: ' 0036', +8311: ' 0037', +8312: ' 0038', +8313: ' 0039', +8314: ' 002B', +8315: ' 2212', +8316: ' 003D', +8317: ' 0028', +8318: ' 0029', +8319: ' 006E', +8320: ' 0030', +8321: ' 0031', +8322: ' 0032', +8323: ' 0033', +8324: ' 0034', +8325: ' 0035', +8326: ' 0036', +8327: ' 0037', +8328: ' 0038', +8329: ' 0039', +8330: ' 002B', +8331: ' 2212', +8332: ' 003D', +8333: ' 0028', +8334: ' 0029', +8360: ' 0052 0073', +8448: ' 0061 002F 0063', +8449: ' 0061 002F 0073', +8450: ' 0043', +8451: ' 00B0 0043', +8453: ' 0063 002F 006F', +8454: ' 0063 002F 0075', +8455: ' 0190', +8457: ' 00B0 0046', +8458: ' 0067', +8459: ' 0048', +8460: ' 0048', +8461: ' 0048', +8462: ' 0068', +8463: ' 0127', +8464: ' 0049', +8465: ' 0049', +8466: ' 004C', +8467: ' 006C', +8469: ' 004E', +8470: ' 004E 006F', +8473: ' 0050', +8474: ' 0051', +8475: ' 0052', +8476: ' 0052', +8477: ' 0052', +8480: ' 0053 004D', +8481: ' 0054 0045 004C', +8482: ' 0054 004D', +8484: ' 005A', +8486: '03A9', +8488: ' 005A', +8490: '004B', +8491: '00C5', +8492: ' 0042', +8493: ' 0043', +8495: ' 0065', +8496: ' 0045', +8497: ' 0046', +8499: ' 004D', +8500: ' 006F', +8501: ' 05D0', +8502: ' 05D1', +8503: ' 05D2', +8504: ' 05D3', +8505: ' 0069', +8509: ' 03B3', +8510: ' 0393', +8511: ' 03A0', +8512: ' 2211', +8517: ' 0044', +8518: ' 0064', +8519: ' 0065', +8520: ' 0069', +8521: ' 006A', +8531: ' 0031 2044 0033', +8532: ' 0032 2044 0033', +8533: ' 0031 2044 0035', +8534: ' 0032 2044 0035', +8535: ' 0033 2044 0035', +8536: ' 0034 2044 0035', +8537: ' 0031 2044 0036', +8538: ' 0035 2044 0036', +8539: ' 0031 2044 0038', +8540: ' 0033 2044 0038', +8541: ' 0035 2044 0038', +8542: ' 0037 2044 0038', +8543: ' 0031 2044', +8544: ' 0049', +8545: ' 0049 0049', +8546: ' 0049 0049 0049', +8547: ' 0049 0056', +8548: ' 0056', +8549: ' 0056 0049', +8550: ' 0056 0049 0049', +8551: ' 0056 0049 0049 0049', +8552: ' 0049 0058', +8553: ' 0058', +8554: ' 0058 0049', +8555: ' 0058 0049 0049', +8556: ' 004C', +8557: ' 0043', +8558: ' 0044', +8559: ' 004D', +8560: ' 0069', +8561: ' 0069 0069', +8562: ' 0069 0069 0069', +8563: ' 0069 0076', +8564: ' 0076', +8565: ' 0076 0069', +8566: ' 0076 0069 0069', +8567: ' 0076 0069 0069 0069', +8568: ' 0069 0078', +8569: ' 0078', +8570: ' 0078 0069', +8571: ' 0078 0069 0069', +8572: ' 006C', +8573: ' 0063', +8574: ' 0064', +8575: ' 006D', +8602: '2190 0338', +8603: '2192 0338', +8622: '2194 0338', +8653: '21D0 0338', +8654: '21D4 0338', +8655: '21D2 0338', +8708: '2203 0338', +8713: '2208 0338', +8716: '220B 0338', +8740: '2223 0338', +8742: '2225 0338', +8748: ' 222B 222B', +8749: ' 222B 222B 222B', +8751: ' 222E 222E', +8752: ' 222E 222E 222E', +8769: '223C 0338', +8772: '2243 0338', +8775: '2245 0338', +8777: '2248 0338', +8800: '003D 0338', +8802: '2261 0338', +8813: '224D 0338', +8814: '003C 0338', +8815: '003E 0338', +8816: '2264 0338', +8817: '2265 0338', +8820: '2272 0338', +8821: '2273 0338', +8824: '2276 0338', +8825: '2277 0338', +8832: '227A 0338', +8833: '227B 0338', +8836: '2282 0338', +8837: '2283 0338', +8840: '2286 0338', +8841: '2287 0338', +8876: '22A2 0338', +8877: '22A8 0338', +8878: '22A9 0338', +8879: '22AB 0338', +8928: '227C 0338', +8929: '227D 0338', +8930: '2291 0338', +8931: '2292 0338', +8938: '22B2 0338', +8939: '22B3 0338', +8940: '22B4 0338', +8941: '22B5 0338', +9001: '3008', +9002: '3009', +9312: ' 0031', +9313: ' 0032', +9314: ' 0033', +9315: ' 0034', +9316: ' 0035', +9317: ' 0036', +9318: ' 0037', +9319: ' 0038', +9320: ' 0039', +9321: ' 0031 0030', +9322: ' 0031 0031', +9323: ' 0031 0032', +9324: ' 0031 0033', +9325: ' 0031 0034', +9326: ' 0031 0035', +9327: ' 0031 0036', +9328: ' 0031 0037', +9329: ' 0031 0038', +9330: ' 0031 0039', +9331: ' 0032 0030', +9332: ' 0028 0031 0029', +9333: ' 0028 0032 0029', +9334: ' 0028 0033 0029', +9335: ' 0028 0034 0029', +9336: ' 0028 0035 0029', +9337: ' 0028 0036 0029', +9338: ' 0028 0037 0029', +9339: ' 0028 0038 0029', +9340: ' 0028 0039 0029', +9341: ' 0028 0031 0030 0029', +9342: ' 0028 0031 0031 0029', +9343: ' 0028 0031 0032 0029', +9344: ' 0028 0031 0033 0029', +9345: ' 0028 0031 0034 0029', +9346: ' 0028 0031 0035 0029', +9347: ' 0028 0031 0036 0029', +9348: ' 0028 0031 0037 0029', +9349: ' 0028 0031 0038 0029', +9350: ' 0028 0031 0039 0029', +9351: ' 0028 0032 0030 0029', +9352: ' 0031 002E', +9353: ' 0032 002E', +9354: ' 0033 002E', +9355: ' 0034 002E', +9356: ' 0035 002E', +9357: ' 0036 002E', +9358: ' 0037 002E', +9359: ' 0038 002E', +9360: ' 0039 002E', +9361: ' 0031 0030 002E', +9362: ' 0031 0031 002E', +9363: ' 0031 0032 002E', +9364: ' 0031 0033 002E', +9365: ' 0031 0034 002E', +9366: ' 0031 0035 002E', +9367: ' 0031 0036 002E', +9368: ' 0031 0037 002E', +9369: ' 0031 0038 002E', +9370: ' 0031 0039 002E', +9371: ' 0032 0030 002E', +9372: ' 0028 0061 0029', +9373: ' 0028 0062 0029', +9374: ' 0028 0063 0029', +9375: ' 0028 0064 0029', +9376: ' 0028 0065 0029', +9377: ' 0028 0066 0029', +9378: ' 0028 0067 0029', +9379: ' 0028 0068 0029', +9380: ' 0028 0069 0029', +9381: ' 0028 006A 0029', +9382: ' 0028 006B 0029', +9383: ' 0028 006C 0029', +9384: ' 0028 006D 0029', +9385: ' 0028 006E 0029', +9386: ' 0028 006F 0029', +9387: ' 0028 0070 0029', +9388: ' 0028 0071 0029', +9389: ' 0028 0072 0029', +9390: ' 0028 0073 0029', +9391: ' 0028 0074 0029', +9392: ' 0028 0075 0029', +9393: ' 0028 0076 0029', +9394: ' 0028 0077 0029', +9395: ' 0028 0078 0029', +9396: ' 0028 0079 0029', +9397: ' 0028 007A 0029', +9398: ' 0041', +9399: ' 0042', +9400: ' 0043', +9401: ' 0044', +9402: ' 0045', +9403: ' 0046', +9404: ' 0047', +9405: ' 0048', +9406: ' 0049', +9407: ' 004A', +9408: ' 004B', +9409: ' 004C', +9410: ' 004D', +9411: ' 004E', +9412: ' 004F', +9413: ' 0050', +9414: ' 0051', +9415: ' 0052', +9416: ' 0053', +9417: ' 0054', +9418: ' 0055', +9419: ' 0056', +9420: ' 0057', +9421: ' 0058', +9422: ' 0059', +9423: ' 005A', +9424: ' 0061', +9425: ' 0062', +9426: ' 0063', +9427: ' 0064', +9428: ' 0065', +9429: ' 0066', +9430: ' 0067', +9431: ' 0068', +9432: ' 0069', +9433: ' 006A', +9434: ' 006B', +9435: ' 006C', +9436: ' 006D', +9437: ' 006E', +9438: ' 006F', +9439: ' 0070', +9440: ' 0071', +9441: ' 0072', +9442: ' 0073', +9443: ' 0074', +9444: ' 0075', +9445: ' 0076', +9446: ' 0077', +9447: ' 0078', +9448: ' 0079', +9449: ' 007A', +9450: ' 0030', +10764: ' 222B 222B 222B 222B', +10868: ' 003A 003A 003D', +10869: ' 003D 003D', +10870: ' 003D 003D 003D', +10972: '2ADD 0338', +11935: ' 6BCD', +12019: ' 9F9F', +12032: ' 4E00', +12033: ' 4E28', +12034: ' 4E36', +12035: ' 4E3F', +12036: ' 4E59', +12037: ' 4E85', +12038: ' 4E8C', +12039: ' 4EA0', +12040: ' 4EBA', +12041: ' 513F', +12042: ' 5165', +12043: ' 516B', +12044: ' 5182', +12045: ' 5196', +12046: ' 51AB', +12047: ' 51E0', +12048: ' 51F5', +12049: ' 5200', +12050: ' 529B', +12051: ' 52F9', +12052: ' 5315', +12053: ' 531A', +12054: ' 5338', +12055: ' 5341', +12056: ' 535C', +12057: ' 5369', +12058: ' 5382', +12059: ' 53B6', +12060: ' 53C8', +12061: ' 53E3', +12062: ' 56D7', +12063: ' 571F', +12064: ' 58EB', +12065: ' 5902', +12066: ' 590A', +12067: ' 5915', +12068: ' 5927', +12069: ' 5973', +12070: ' 5B50', +12071: ' 5B80', +12072: ' 5BF8', +12073: ' 5C0F', +12074: ' 5C22', +12075: ' 5C38', +12076: ' 5C6E', +12077: ' 5C71', +12078: ' 5DDB', +12079: ' 5DE5', +12080: ' 5DF1', +12081: ' 5DFE', +12082: ' 5E72', +12083: ' 5E7A', +12084: ' 5E7F', +12085: ' 5EF4', +12086: ' 5EFE', +12087: ' 5F0B', +12088: ' 5F13', +12089: ' 5F50', +12090: ' 5F61', +12091: ' 5F73', +12092: ' 5FC3', +12093: ' 6208', +12094: ' 6236', +12095: ' 624B', +12096: ' 652F', +12097: ' 6534', +12098: ' 6587', +12099: ' 6597', +12100: ' 65A4', +12101: ' 65B9', +12102: ' 65E0', +12103: ' 65E5', +12104: ' 66F0', +12105: ' 6708', +12106: ' 6728', +12107: ' 6B20', +12108: ' 6B62', +12109: ' 6B79', +12110: ' 6BB3', +12111: ' 6BCB', +12112: ' 6BD4', +12113: ' 6BDB', +12114: ' 6C0F', +12115: ' 6C14', +12116: ' 6C34', +12117: ' 706B', +12118: ' 722A', +12119: ' 7236', +12120: ' 723B', +12121: ' 723F', +12122: ' 7247', +12123: ' 7259', +12124: ' 725B', +12125: ' 72AC', +12126: ' 7384', +12127: ' 7389', +12128: ' 74DC', +12129: ' 74E6', +12130: ' 7518', +12131: ' 751F', +12132: ' 7528', +12133: ' 7530', +12134: ' 758B', +12135: ' 7592', +12136: ' 7676', +12137: ' 767D', +12138: ' 76AE', +12139: ' 76BF', +12140: ' 76EE', +12141: ' 77DB', +12142: ' 77E2', +12143: ' 77F3', +12144: ' 793A', +12145: ' 79B8', +12146: ' 79BE', +12147: ' 7A74', +12148: ' 7ACB', +12149: ' 7AF9', +12150: ' 7C73', +12151: ' 7CF8', +12152: ' 7F36', +12153: ' 7F51', +12154: ' 7F8A', +12155: ' 7FBD', +12156: ' 8001', +12157: ' 800C', +12158: ' 8012', +12159: ' 8033', +12160: ' 807F', +12161: ' 8089', +12162: ' 81E3', +12163: ' 81EA', +12164: ' 81F3', +12165: ' 81FC', +12166: ' 820C', +12167: ' 821B', +12168: ' 821F', +12169: ' 826E', +12170: ' 8272', +12171: ' 8278', +12172: ' 864D', +12173: ' 866B', +12174: ' 8840', +12175: ' 884C', +12176: ' 8863', +12177: ' 897E', +12178: ' 898B', +12179: ' 89D2', +12180: ' 8A00', +12181: ' 8C37', +12182: ' 8C46', +12183: ' 8C55', +12184: ' 8C78', +12185: ' 8C9D', +12186: ' 8D64', +12187: ' 8D70', +12188: ' 8DB3', +12189: ' 8EAB', +12190: ' 8ECA', +12191: ' 8F9B', +12192: ' 8FB0', +12193: ' 8FB5', +12194: ' 9091', +12195: ' 9149', +12196: ' 91C6', +12197: ' 91CC', +12198: ' 91D1', +12199: ' 9577', +12200: ' 9580', +12201: ' 961C', +12202: ' 96B6', +12203: ' 96B9', +12204: ' 96E8', +12205: ' 9751', +12206: ' 975E', +12207: ' 9762', +12208: ' 9769', +12209: ' 97CB', +12210: ' 97ED', +12211: ' 97F3', +12212: ' 9801', +12213: ' 98A8', +12214: ' 98DB', +12215: ' 98DF', +12216: ' 9996', +12217: ' 9999', +12218: ' 99AC', +12219: ' 9AA8', +12220: ' 9AD8', +12221: ' 9ADF', +12222: ' 9B25', +12223: ' 9B2F', +12224: ' 9B32', +12225: ' 9B3C', +12226: ' 9B5A', +12227: ' 9CE5', +12228: ' 9E75', +12229: ' 9E7F', +12230: ' 9EA5', +12231: ' 9EBB', +12232: ' 9EC3', +12233: ' 9ECD', +12234: ' 9ED1', +12235: ' 9EF9', +12236: ' 9EFD', +12237: ' 9F0E', +12238: ' 9F13', +12239: ' 9F20', +12240: ' 9F3B', +12241: ' 9F4A', +12242: ' 9F52', +12243: ' 9F8D', +12244: ' 9F9C', +12245: ' 9FA0', +12288: ' 0020', +12342: ' 3012', +12344: ' 5341', +12345: ' 5344', +12346: ' 5345', +12364: '304B 3099', +12366: '304D 3099', +12368: '304F 3099', +12370: '3051 3099', +12372: '3053 3099', +12374: '3055 3099', +12376: '3057 3099', +12378: '3059 3099', +12380: '305B 3099', +12382: '305D 3099', +12384: '305F 3099', +12386: '3061 3099', +12389: '3064 3099', +12391: '3066 3099', +12393: '3068 3099', +12400: '306F 3099', +12401: '306F 309A', +12403: '3072 3099', +12404: '3072 309A', +12406: '3075 3099', +12407: '3075 309A', +12409: '3078 3099', +12410: '3078 309A', +12412: '307B 3099', +12413: '307B 309A', +12436: '3046 3099', +12443: ' 0020 3099', +12444: ' 0020 309A', +12446: '309D 3099', +12447: ' 3088 308A', +12460: '30AB 3099', +12462: '30AD 3099', +12464: '30AF 3099', +12466: '30B1 3099', +12468: '30B3 3099', +12470: '30B5 3099', +12472: '30B7 3099', +12474: '30B9 3099', +12476: '30BB 3099', +12478: '30BD 3099', +12480: '30BF 3099', +12482: '30C1 3099', +12485: '30C4 3099', +12487: '30C6 3099', +12489: '30C8 3099', +12496: '30CF 3099', +12497: '30CF 309A', +12499: '30D2 3099', +12500: '30D2 309A', +12502: '30D5 3099', +12503: '30D5 309A', +12505: '30D8 3099', +12506: '30D8 309A', +12508: '30DB 3099', +12509: '30DB 309A', +12532: '30A6 3099', +12535: '30EF 3099', +12536: '30F0 3099', +12537: '30F1 3099', +12538: '30F2 3099', +12542: '30FD 3099', +12543: ' 30B3 30C8', +12593: ' 1100', +12594: ' 1101', +12595: ' 11AA', +12596: ' 1102', +12597: ' 11AC', +12598: ' 11AD', +12599: ' 1103', +12600: ' 1104', +12601: ' 1105', +12602: ' 11B0', +12603: ' 11B1', +12604: ' 11B2', +12605: ' 11B3', +12606: ' 11B4', +12607: ' 11B5', +12608: ' 111A', +12609: ' 1106', +12610: ' 1107', +12611: ' 1108', +12612: ' 1121', +12613: ' 1109', +12614: ' 110A', +12615: ' 110B', +12616: ' 110C', +12617: ' 110D', +12618: ' 110E', +12619: ' 110F', +12620: ' 1110', +12621: ' 1111', +12622: ' 1112', +12623: ' 1161', +12624: ' 1162', +12625: ' 1163', +12626: ' 1164', +12627: ' 1165', +12628: ' 1166', +12629: ' 1167', +12630: ' 1168', +12631: ' 1169', +12632: ' 116A', +12633: ' 116B', +12634: ' 116C', +12635: ' 116D', +12636: ' 116E', +12637: ' 116F', +12638: ' 1170', +12639: ' 1171', +12640: ' 1172', +12641: ' 1173', +12642: ' 1174', +12643: ' 1175', +12644: ' 1160', +12645: ' 1114', +12646: ' 1115', +12647: ' 11C7', +12648: ' 11C8', +12649: ' 11CC', +12650: ' 11CE', +12651: ' 11D3', +12652: ' 11D7', +12653: ' 11D9', +12654: ' 111C', +12655: ' 11DD', +12656: ' 11DF', +12657: ' 111D', +12658: ' 111E', +12659: ' 1120', +12660: ' 1122', +12661: ' 1123', +12662: ' 1127', +12663: ' 1129', +12664: ' 112B', +12665: ' 112C', +12666: ' 112D', +12667: ' 112E', +12668: ' 112F', +12669: ' 1132', +12670: ' 1136', +12671: ' 1140', +12672: ' 1147', +12673: ' 114C', +12674: ' 11F1', +12675: ' 11F2', +12676: ' 1157', +12677: ' 1158', +12678: ' 1159', +12679: ' 1184', +12680: ' 1185', +12681: ' 1188', +12682: ' 1191', +12683: ' 1192', +12684: ' 1194', +12685: ' 119E', +12686: ' 11A1', +12690: ' 4E00', +12691: ' 4E8C', +12692: ' 4E09', +12693: ' 56DB', +12694: ' 4E0A', +12695: ' 4E2D', +12696: ' 4E0B', +12697: ' 7532', +12698: ' 4E59', +12699: ' 4E19', +12700: ' 4E01', +12701: ' 5929', +12702: ' 5730', +12703: ' 4EBA', +12800: ' 0028 1100 0029', +12801: ' 0028 1102 0029', +12802: ' 0028 1103 0029', +12803: ' 0028 1105 0029', +12804: ' 0028 1106 0029', +12805: ' 0028 1107 0029', +12806: ' 0028 1109 0029', +12807: ' 0028 110B 0029', +12808: ' 0028 110C 0029', +12809: ' 0028 110E 0029', +12810: ' 0028 110F 0029', +12811: ' 0028 1110 0029', +12812: ' 0028 1111 0029', +12813: ' 0028 1112 0029', +12814: ' 0028 1100 1161 0029', +12815: ' 0028 1102 1161 0029', +12816: ' 0028 1103 1161 0029', +12817: ' 0028 1105 1161 0029', +12818: ' 0028 1106 1161 0029', +12819: ' 0028 1107 1161 0029', +12820: ' 0028 1109 1161 0029', +12821: ' 0028 110B 1161 0029', +12822: ' 0028 110C 1161 0029', +12823: ' 0028 110E 1161 0029', +12824: ' 0028 110F 1161 0029', +12825: ' 0028 1110 1161 0029', +12826: ' 0028 1111 1161 0029', +12827: ' 0028 1112 1161 0029', +12828: ' 0028 110C 116E 0029', +12832: ' 0028 4E00 0029', +12833: ' 0028 4E8C 0029', +12834: ' 0028 4E09 0029', +12835: ' 0028 56DB 0029', +12836: ' 0028 4E94 0029', +12837: ' 0028 516D 0029', +12838: ' 0028 4E03 0029', +12839: ' 0028 516B 0029', +12840: ' 0028 4E5D 0029', +12841: ' 0028 5341 0029', +12842: ' 0028 6708 0029', +12843: ' 0028 706B 0029', +12844: ' 0028 6C34 0029', +12845: ' 0028 6728 0029', +12846: ' 0028 91D1 0029', +12847: ' 0028 571F 0029', +12848: ' 0028 65E5 0029', +12849: ' 0028 682A 0029', +12850: ' 0028 6709 0029', +12851: ' 0028 793E 0029', +12852: ' 0028 540D 0029', +12853: ' 0028 7279 0029', +12854: ' 0028 8CA1 0029', +12855: ' 0028 795D 0029', +12856: ' 0028 52B4 0029', +12857: ' 0028 4EE3 0029', +12858: ' 0028 547C 0029', +12859: ' 0028 5B66 0029', +12860: ' 0028 76E3 0029', +12861: ' 0028 4F01 0029', +12862: ' 0028 8CC7 0029', +12863: ' 0028 5354 0029', +12864: ' 0028 796D 0029', +12865: ' 0028 4F11 0029', +12866: ' 0028 81EA 0029', +12867: ' 0028 81F3 0029', +12881: ' 0032 0031', +12882: ' 0032 0032', +12883: ' 0032 0033', +12884: ' 0032 0034', +12885: ' 0032 0035', +12886: ' 0032 0036', +12887: ' 0032 0037', +12888: ' 0032 0038', +12889: ' 0032 0039', +12890: ' 0033 0030', +12891: ' 0033 0031', +12892: ' 0033 0032', +12893: ' 0033 0033', +12894: ' 0033 0034', +12895: ' 0033 0035', +12896: ' 1100', +12897: ' 1102', +12898: ' 1103', +12899: ' 1105', +12900: ' 1106', +12901: ' 1107', +12902: ' 1109', +12903: ' 110B', +12904: ' 110C', +12905: ' 110E', +12906: ' 110F', +12907: ' 1110', +12908: ' 1111', +12909: ' 1112', +12910: ' 1100 1161', +12911: ' 1102 1161', +12912: ' 1103 1161', +12913: ' 1105 1161', +12914: ' 1106 1161', +12915: ' 1107 1161', +12916: ' 1109 1161', +12917: ' 110B 1161', +12918: ' 110C 1161', +12919: ' 110E 1161', +12920: ' 110F 1161', +12921: ' 1110 1161', +12922: ' 1111 1161', +12923: ' 1112 1161', +12928: ' 4E00', +12929: ' 4E8C', +12930: ' 4E09', +12931: ' 56DB', +12932: ' 4E94', +12933: ' 516D', +12934: ' 4E03', +12935: ' 516B', +12936: ' 4E5D', +12937: ' 5341', +12938: ' 6708', +12939: ' 706B', +12940: ' 6C34', +12941: ' 6728', +12942: ' 91D1', +12943: ' 571F', +12944: ' 65E5', +12945: ' 682A', +12946: ' 6709', +12947: ' 793E', +12948: ' 540D', +12949: ' 7279', +12950: ' 8CA1', +12951: ' 795D', +12952: ' 52B4', +12953: ' 79D8', +12954: ' 7537', +12955: ' 5973', +12956: ' 9069', +12957: ' 512A', +12958: ' 5370', +12959: ' 6CE8', +12960: ' 9805', +12961: ' 4F11', +12962: ' 5199', +12963: ' 6B63', +12964: ' 4E0A', +12965: ' 4E2D', +12966: ' 4E0B', +12967: ' 5DE6', +12968: ' 53F3', +12969: ' 533B', +12970: ' 5B97', +12971: ' 5B66', +12972: ' 76E3', +12973: ' 4F01', +12974: ' 8CC7', +12975: ' 5354', +12976: ' 591C', +12977: ' 0033 0036', +12978: ' 0033 0037', +12979: ' 0033 0038', +12980: ' 0033 0039', +12981: ' 0034 0030', +12982: ' 0034 0031', +12983: ' 0034 0032', +12984: ' 0034 0033', +12985: ' 0034 0034', +12986: ' 0034 0035', +12987: ' 0034 0036', +12988: ' 0034 0037', +12989: ' 0034 0038', +12990: ' 0034 0039', +12991: ' 0035 0030', +12992: ' 0031 6708', +12993: ' 0032 6708', +12994: ' 0033 6708', +12995: ' 0034 6708', +12996: ' 0035 6708', +12997: ' 0036 6708', +12998: ' 0037 6708', +12999: ' 0038 6708', +13000: ' 0039 6708', +13001: ' 0031 0030 6708', +13002: ' 0031 0031 6708', +13003: ' 0031 0032 6708', +13008: ' 30A2', +13009: ' 30A4', +13010: ' 30A6', +13011: ' 30A8', +13012: ' 30AA', +13013: ' 30AB', +13014: ' 30AD', +13015: ' 30AF', +13016: ' 30B1', +13017: ' 30B3', +13018: ' 30B5', +13019: ' 30B7', +13020: ' 30B9', +13021: ' 30BB', +13022: ' 30BD', +13023: ' 30BF', +13024: ' 30C1', +13025: ' 30C4', +13026: ' 30C6', +13027: ' 30C8', +13028: ' 30CA', +13029: ' 30CB', +13030: ' 30CC', +13031: ' 30CD', +13032: ' 30CE', +13033: ' 30CF', +13034: ' 30D2', +13035: ' 30D5', +13036: ' 30D8', +13037: ' 30DB', +13038: ' 30DE', +13039: ' 30DF', +13040: ' 30E0', +13041: ' 30E1', +13042: ' 30E2', +13043: ' 30E4', +13044: ' 30E6', +13045: ' 30E8', +13046: ' 30E9', +13047: ' 30EA', +13048: ' 30EB', +13049: ' 30EC', +13050: ' 30ED', +13051: ' 30EF', +13052: ' 30F0', +13053: ' 30F1', +13054: ' 30F2', +13056: ' 30A2 30D1 30FC 30C8', +13057: ' 30A2 30EB 30D5 30A1', +13058: ' 30A2 30F3 30DA 30A2', +13059: ' 30A2 30FC 30EB', +13060: ' 30A4 30CB 30F3 30B0', +13061: ' 30A4 30F3 30C1', +13062: ' 30A6 30A9 30F3', +13063: ' 30A8 30B9 30AF 30FC 30C9', +13064: ' 30A8 30FC 30AB 30FC', +13065: ' 30AA 30F3 30B9', +13066: ' 30AA 30FC 30E0', +13067: ' 30AB 30A4 30EA', +13068: ' 30AB 30E9 30C3 30C8', +13069: ' 30AB 30ED 30EA 30FC', +13070: ' 30AC 30ED 30F3', +13071: ' 30AC 30F3 30DE', +13072: ' 30AE 30AC', +13073: ' 30AE 30CB 30FC', +13074: ' 30AD 30E5 30EA 30FC', +13075: ' 30AE 30EB 30C0 30FC', +13076: ' 30AD 30ED', +13077: ' 30AD 30ED 30B0 30E9 30E0', +13078: ' 30AD 30ED 30E1 30FC 30C8 30EB', +13079: ' 30AD 30ED 30EF 30C3 30C8', +13080: ' 30B0 30E9 30E0', +13081: ' 30B0 30E9 30E0 30C8 30F3', +13082: ' 30AF 30EB 30BC 30A4 30ED', +13083: ' 30AF 30ED 30FC 30CD', +13084: ' 30B1 30FC 30B9', +13085: ' 30B3 30EB 30CA', +13086: ' 30B3 30FC 30DD', +13087: ' 30B5 30A4 30AF 30EB', +13088: ' 30B5 30F3 30C1 30FC 30E0', +13089: ' 30B7 30EA 30F3 30B0', +13090: ' 30BB 30F3 30C1', +13091: ' 30BB 30F3 30C8', +13092: ' 30C0 30FC 30B9', +13093: ' 30C7 30B7', +13094: ' 30C9 30EB', +13095: ' 30C8 30F3', +13096: ' 30CA 30CE', +13097: ' 30CE 30C3 30C8', +13098: ' 30CF 30A4 30C4', +13099: ' 30D1 30FC 30BB 30F3 30C8', +13100: ' 30D1 30FC 30C4', +13101: ' 30D0 30FC 30EC 30EB', +13102: ' 30D4 30A2 30B9 30C8 30EB', +13103: ' 30D4 30AF 30EB', +13104: ' 30D4 30B3', +13105: ' 30D3 30EB', +13106: ' 30D5 30A1 30E9 30C3 30C9', +13107: ' 30D5 30A3 30FC 30C8', +13108: ' 30D6 30C3 30B7 30A7 30EB', +13109: ' 30D5 30E9 30F3', +13110: ' 30D8 30AF 30BF 30FC 30EB', +13111: ' 30DA 30BD', +13112: ' 30DA 30CB 30D2', +13113: ' 30D8 30EB 30C4', +13114: ' 30DA 30F3 30B9', +13115: ' 30DA 30FC 30B8', +13116: ' 30D9 30FC 30BF', +13117: ' 30DD 30A4 30F3 30C8', +13118: ' 30DC 30EB 30C8', +13119: ' 30DB 30F3', +13120: ' 30DD 30F3 30C9', +13121: ' 30DB 30FC 30EB', +13122: ' 30DB 30FC 30F3', +13123: ' 30DE 30A4 30AF 30ED', +13124: ' 30DE 30A4 30EB', +13125: ' 30DE 30C3 30CF', +13126: ' 30DE 30EB 30AF', +13127: ' 30DE 30F3 30B7 30E7 30F3', +13128: ' 30DF 30AF 30ED 30F3', +13129: ' 30DF 30EA', +13130: ' 30DF 30EA 30D0 30FC 30EB', +13131: ' 30E1 30AC', +13132: ' 30E1 30AC 30C8 30F3', +13133: ' 30E1 30FC 30C8 30EB', +13134: ' 30E4 30FC 30C9', +13135: ' 30E4 30FC 30EB', +13136: ' 30E6 30A2 30F3', +13137: ' 30EA 30C3 30C8 30EB', +13138: ' 30EA 30E9', +13139: ' 30EB 30D4 30FC', +13140: ' 30EB 30FC 30D6 30EB', +13141: ' 30EC 30E0', +13142: ' 30EC 30F3 30C8 30B2 30F3', +13143: ' 30EF 30C3 30C8', +13144: ' 0030 70B9', +13145: ' 0031 70B9', +13146: ' 0032 70B9', +13147: ' 0033 70B9', +13148: ' 0034 70B9', +13149: ' 0035 70B9', +13150: ' 0036 70B9', +13151: ' 0037 70B9', +13152: ' 0038 70B9', +13153: ' 0039 70B9', +13154: ' 0031 0030 70B9', +13155: ' 0031 0031 70B9', +13156: ' 0031 0032 70B9', +13157: ' 0031 0033 70B9', +13158: ' 0031 0034 70B9', +13159: ' 0031 0035 70B9', +13160: ' 0031 0036 70B9', +13161: ' 0031 0037 70B9', +13162: ' 0031 0038 70B9', +13163: ' 0031 0039 70B9', +13164: ' 0032 0030 70B9', +13165: ' 0032 0031 70B9', +13166: ' 0032 0032 70B9', +13167: ' 0032 0033 70B9', +13168: ' 0032 0034 70B9', +13169: ' 0068 0050 0061', +13170: ' 0064 0061', +13171: ' 0041 0055', +13172: ' 0062 0061 0072', +13173: ' 006F 0056', +13174: ' 0070 0063', +13179: ' 5E73 6210', +13180: ' 662D 548C', +13181: ' 5927 6B63', +13182: ' 660E 6CBB', +13183: ' 682A 5F0F 4F1A 793E', +13184: ' 0070 0041', +13185: ' 006E 0041', +13186: ' 03BC 0041', +13187: ' 006D 0041', +13188: ' 006B 0041', +13189: ' 004B 0042', +13190: ' 004D 0042', +13191: ' 0047 0042', +13192: ' 0063 0061 006C', +13193: ' 006B 0063 0061 006C', +13194: ' 0070 0046', +13195: ' 006E 0046', +13196: ' 03BC 0046', +13197: ' 03BC 0067', +13198: ' 006D 0067', +13199: ' 006B 0067', +13200: ' 0048 007A', +13201: ' 006B 0048 007A', +13202: ' 004D 0048 007A', +13203: ' 0047 0048 007A', +13204: ' 0054 0048 007A', +13205: ' 03BC 2113', +13206: ' 006D 2113', +13207: ' 0064 2113', +13208: ' 006B 2113', +13209: ' 0066 006D', +13210: ' 006E 006D', +13211: ' 03BC 006D', +13212: ' 006D 006D', +13213: ' 0063 006D', +13214: ' 006B 006D', +13215: ' 006D 006D 00B2', +13216: ' 0063 006D 00B2', +13217: ' 006D 00B2', +13218: ' 006B 006D 00B2', +13219: ' 006D 006D 00B3', +13220: ' 0063 006D 00B3', +13221: ' 006D 00B3', +13222: ' 006B 006D 00B3', +13223: ' 006D 2215 0073', +13224: ' 006D 2215 0073 00B2', +13225: ' 0050 0061', +13226: ' 006B 0050 0061', +13227: ' 004D 0050 0061', +13228: ' 0047 0050 0061', +13229: ' 0072 0061 0064', +13230: ' 0072 0061 0064 2215 0073', +13231: ' 0072 0061 0064 2215 0073 00B2', +13232: ' 0070 0073', +13233: ' 006E 0073', +13234: ' 03BC 0073', +13235: ' 006D 0073', +13236: ' 0070 0056', +13237: ' 006E 0056', +13238: ' 03BC 0056', +13239: ' 006D 0056', +13240: ' 006B 0056', +13241: ' 004D 0056', +13242: ' 0070 0057', +13243: ' 006E 0057', +13244: ' 03BC 0057', +13245: ' 006D 0057', +13246: ' 006B 0057', +13247: ' 004D 0057', +13248: ' 006B 03A9', +13249: ' 004D 03A9', +13250: ' 0061 002E 006D 002E', +13251: ' 0042 0071', +13252: ' 0063 0063', +13253: ' 0063 0064', +13254: ' 0043 2215 006B 0067', +13255: ' 0043 006F 002E', +13256: ' 0064 0042', +13257: ' 0047 0079', +13258: ' 0068 0061', +13259: ' 0048 0050', +13260: ' 0069 006E', +13261: ' 004B 004B', +13262: ' 004B 004D', +13263: ' 006B 0074', +13264: ' 006C 006D', +13265: ' 006C 006E', +13266: ' 006C 006F 0067', +13267: ' 006C 0078', +13268: ' 006D 0062', +13269: ' 006D 0069 006C', +13270: ' 006D 006F 006C', +13271: ' 0050 0048', +13272: ' 0070 002E 006D 002E', +13273: ' 0050 0050 004D', +13274: ' 0050 0052', +13275: ' 0073 0072', +13276: ' 0053 0076', +13277: ' 0057 0062', +13280: ' 0031 65E5', +13281: ' 0032 65E5', +13282: ' 0033 65E5', +13283: ' 0034 65E5', +13284: ' 0035 65E5', +13285: ' 0036 65E5', +13286: ' 0037 65E5', +13287: ' 0038 65E5', +13288: ' 0039 65E5', +13289: ' 0031 0030 65E5', +13290: ' 0031 0031 65E5', +13291: ' 0031 0032 65E5', +13292: ' 0031 0033 65E5', +13293: ' 0031 0034 65E5', +13294: ' 0031 0035 65E5', +13295: ' 0031 0036 65E5', +13296: ' 0031 0037 65E5', +13297: ' 0031 0038 65E5', +13298: ' 0031 0039 65E5', +13299: ' 0032 0030 65E5', +13300: ' 0032 0031 65E5', +13301: ' 0032 0032 65E5', +13302: ' 0032 0033 65E5', +13303: ' 0032 0034 65E5', +13304: ' 0032 0035 65E5', +13305: ' 0032 0036 65E5', +13306: ' 0032 0037 65E5', +13307: ' 0032 0038 65E5', +13308: ' 0032 0039 65E5', +13309: ' 0033 0030 65E5', +13310: ' 0033 0031 65E5', +63744: '8C48', +63745: '66F4', +63746: '8ECA', +63747: '8CC8', +63748: '6ED1', +63749: '4E32', +63750: '53E5', +63751: '9F9C', +63752: '9F9C', +63753: '5951', +63754: '91D1', +63755: '5587', +63756: '5948', +63757: '61F6', +63758: '7669', +63759: '7F85', +63760: '863F', +63761: '87BA', +63762: '88F8', +63763: '908F', +63764: '6A02', +63765: '6D1B', +63766: '70D9', +63767: '73DE', +63768: '843D', +63769: '916A', +63770: '99F1', +63771: '4E82', +63772: '5375', +63773: '6B04', +63774: '721B', +63775: '862D', +63776: '9E1E', +63777: '5D50', +63778: '6FEB', +63779: '85CD', +63780: '8964', +63781: '62C9', +63782: '81D8', +63783: '881F', +63784: '5ECA', +63785: '6717', +63786: '6D6A', +63787: '72FC', +63788: '90CE', +63789: '4F86', +63790: '51B7', +63791: '52DE', +63792: '64C4', +63793: '6AD3', +63794: '7210', +63795: '76E7', +63796: '8001', +63797: '8606', +63798: '865C', +63799: '8DEF', +63800: '9732', +63801: '9B6F', +63802: '9DFA', +63803: '788C', +63804: '797F', +63805: '7DA0', +63806: '83C9', +63807: '9304', +63808: '9E7F', +63809: '8AD6', +63810: '58DF', +63811: '5F04', +63812: '7C60', +63813: '807E', +63814: '7262', +63815: '78CA', +63816: '8CC2', +63817: '96F7', +63818: '58D8', +63819: '5C62', +63820: '6A13', +63821: '6DDA', +63822: '6F0F', +63823: '7D2F', +63824: '7E37', +63825: '964B', +63826: '52D2', +63827: '808B', +63828: '51DC', +63829: '51CC', +63830: '7A1C', +63831: '7DBE', +63832: '83F1', +63833: '9675', +63834: '8B80', +63835: '62CF', +63836: '6A02', +63837: '8AFE', +63838: '4E39', +63839: '5BE7', +63840: '6012', +63841: '7387', +63842: '7570', +63843: '5317', +63844: '78FB', +63845: '4FBF', +63846: '5FA9', +63847: '4E0D', +63848: '6CCC', +63849: '6578', +63850: '7D22', +63851: '53C3', +63852: '585E', +63853: '7701', +63854: '8449', +63855: '8AAA', +63856: '6BBA', +63857: '8FB0', +63858: '6C88', +63859: '62FE', +63860: '82E5', +63861: '63A0', +63862: '7565', +63863: '4EAE', +63864: '5169', +63865: '51C9', +63866: '6881', +63867: '7CE7', +63868: '826F', +63869: '8AD2', +63870: '91CF', +63871: '52F5', +63872: '5442', +63873: '5973', +63874: '5EEC', +63875: '65C5', +63876: '6FFE', +63877: '792A', +63878: '95AD', +63879: '9A6A', +63880: '9E97', +63881: '9ECE', +63882: '529B', +63883: '66C6', +63884: '6B77', +63885: '8F62', +63886: '5E74', +63887: '6190', +63888: '6200', +63889: '649A', +63890: '6F23', +63891: '7149', +63892: '7489', +63893: '79CA', +63894: '7DF4', +63895: '806F', +63896: '8F26', +63897: '84EE', +63898: '9023', +63899: '934A', +63900: '5217', +63901: '52A3', +63902: '54BD', +63903: '70C8', +63904: '88C2', +63905: '8AAA', +63906: '5EC9', +63907: '5FF5', +63908: '637B', +63909: '6BAE', +63910: '7C3E', +63911: '7375', +63912: '4EE4', +63913: '56F9', +63914: '5BE7', +63915: '5DBA', +63916: '601C', +63917: '73B2', +63918: '7469', +63919: '7F9A', +63920: '8046', +63921: '9234', +63922: '96F6', +63923: '9748', +63924: '9818', +63925: '4F8B', +63926: '79AE', +63927: '91B4', +63928: '96B8', +63929: '60E1', +63930: '4E86', +63931: '50DA', +63932: '5BEE', +63933: '5C3F', +63934: '6599', +63935: '6A02', +63936: '71CE', +63937: '7642', +63938: '84FC', +63939: '907C', +63940: '9F8D', +63941: '6688', +63942: '962E', +63943: '5289', +63944: '677B', +63945: '67F3', +63946: '6D41', +63947: '6E9C', +63948: '7409', +63949: '7559', +63950: '786B', +63951: '7D10', +63952: '985E', +63953: '516D', +63954: '622E', +63955: '9678', +63956: '502B', +63957: '5D19', +63958: '6DEA', +63959: '8F2A', +63960: '5F8B', +63961: '6144', +63962: '6817', +63963: '7387', +63964: '9686', +63965: '5229', +63966: '540F', +63967: '5C65', +63968: '6613', +63969: '674E', +63970: '68A8', +63971: '6CE5', +63972: '7406', +63973: '75E2', +63974: '7F79', +63975: '88CF', +63976: '88E1', +63977: '91CC', +63978: '96E2', +63979: '533F', +63980: '6EBA', +63981: '541D', +63982: '71D0', +63983: '7498', +63984: '85FA', +63985: '96A3', +63986: '9C57', +63987: '9E9F', +63988: '6797', +63989: '6DCB', +63990: '81E8', +63991: '7ACB', +63992: '7B20', +63993: '7C92', +63994: '72C0', +63995: '7099', +63996: '8B58', +63997: '4EC0', +63998: '8336', +63999: '523A', +64000: '5207', +64001: '5EA6', +64002: '62D3', +64003: '7CD6', +64004: '5B85', +64005: '6D1E', +64006: '66B4', +64007: '8F3B', +64008: '884C', +64009: '964D', +64010: '898B', +64011: '5ED3', +64012: '5140', +64013: '55C0', +64016: '585A', +64018: '6674', +64021: '51DE', +64022: '732A', +64023: '76CA', +64024: '793C', +64025: '795E', +64026: '7965', +64027: '798F', +64028: '9756', +64029: '7CBE', +64030: '7FBD', +64032: '8612', +64034: '8AF8', +64037: '9038', +64038: '90FD', +64042: '98EF', +64043: '98FC', +64044: '9928', +64045: '9DB4', +64048: '4FAE', +64049: '50E7', +64050: '514D', +64051: '52C9', +64052: '52E4', +64053: '5351', +64054: '559D', +64055: '5606', +64056: '5668', +64057: '5840', +64058: '58A8', +64059: '5C64', +64060: '5C6E', +64061: '6094', +64062: '6168', +64063: '618E', +64064: '61F2', +64065: '654F', +64066: '65E2', +64067: '6691', +64068: '6885', +64069: '6D77', +64070: '6E1A', +64071: '6F22', +64072: '716E', +64073: '722B', +64074: '7422', +64075: '7891', +64076: '793E', +64077: '7949', +64078: '7948', +64079: '7950', +64080: '7956', +64081: '795D', +64082: '798D', +64083: '798E', +64084: '7A40', +64085: '7A81', +64086: '7BC0', +64087: '7DF4', +64088: '7E09', +64089: '7E41', +64090: '7F72', +64091: '8005', +64092: '81ED', +64093: '8279', +64094: '8279', +64095: '8457', +64096: '8910', +64097: '8996', +64098: '8B01', +64099: '8B39', +64100: '8CD3', +64101: '8D08', +64102: '8FB6', +64103: '9038', +64104: '96E3', +64105: '97FF', +64106: '983B', +64256: ' 0066 0066', +64257: ' 0066 0069', +64258: ' 0066 006C', +64259: ' 0066 0066 0069', +64260: ' 0066 0066 006C', +64261: ' 017F 0074', +64262: ' 0073 0074', +64275: ' 0574 0576', +64276: ' 0574 0565', +64277: ' 0574 056B', +64278: ' 057E 0576', +64279: ' 0574 056D', +64285: '05D9 05B4', +64287: '05F2 05B7', +64288: ' 05E2', +64289: ' 05D0', +64290: ' 05D3', +64291: ' 05D4', +64292: ' 05DB', +64293: ' 05DC', +64294: ' 05DD', +64295: ' 05E8', +64296: ' 05EA', +64297: ' 002B', +64298: '05E9 05C1', +64299: '05E9 05C2', +64300: 'FB49 05C1', +64301: 'FB49 05C2', +64302: '05D0 05B7', +64303: '05D0 05B8', +64304: '05D0 05BC', +64305: '05D1 05BC', +64306: '05D2 05BC', +64307: '05D3 05BC', +64308: '05D4 05BC', +64309: '05D5 05BC', +64310: '05D6 05BC', +64312: '05D8 05BC', +64313: '05D9 05BC', +64314: '05DA 05BC', +64315: '05DB 05BC', +64316: '05DC 05BC', +64318: '05DE 05BC', +64320: '05E0 05BC', +64321: '05E1 05BC', +64323: '05E3 05BC', +64324: '05E4 05BC', +64326: '05E6 05BC', +64327: '05E7 05BC', +64328: '05E8 05BC', +64329: '05E9 05BC', +64330: '05EA 05BC', +64331: '05D5 05B9', +64332: '05D1 05BF', +64333: '05DB 05BF', +64334: '05E4 05BF', +64335: ' 05D0 05DC', +64336: ' 0671', +64337: ' 0671', +64338: ' 067B', +64339: ' 067B', +64340: ' 067B', +64341: ' 067B', +64342: ' 067E', +64343: ' 067E', +64344: ' 067E', +64345: ' 067E', +64346: ' 0680', +64347: ' 0680', +64348: ' 0680', +64349: ' 0680', +64350: ' 067A', +64351: ' 067A', +64352: ' 067A', +64353: ' 067A', +64354: ' 067F', +64355: ' 067F', +64356: ' 067F', +64357: ' 067F', +64358: ' 0679', +64359: ' 0679', +64360: ' 0679', +64361: ' 0679', +64362: ' 06A4', +64363: ' 06A4', +64364: ' 06A4', +64365: ' 06A4', +64366: ' 06A6', +64367: ' 06A6', +64368: ' 06A6', +64369: ' 06A6', +64370: ' 0684', +64371: ' 0684', +64372: ' 0684', +64373: ' 0684', +64374: ' 0683', +64375: ' 0683', +64376: ' 0683', +64377: ' 0683', +64378: ' 0686', +64379: ' 0686', +64380: ' 0686', +64381: ' 0686', +64382: ' 0687', +64383: ' 0687', +64384: ' 0687', +64385: ' 0687', +64386: ' 068D', +64387: ' 068D', +64388: ' 068C', +64389: ' 068C', +64390: ' 068E', +64391: ' 068E', +64392: ' 0688', +64393: ' 0688', +64394: ' 0698', +64395: ' 0698', +64396: ' 0691', +64397: ' 0691', +64398: ' 06A9', +64399: ' 06A9', +64400: ' 06A9', +64401: ' 06A9', +64402: ' 06AF', +64403: ' 06AF', +64404: ' 06AF', +64405: ' 06AF', +64406: ' 06B3', +64407: ' 06B3', +64408: ' 06B3', +64409: ' 06B3', +64410: ' 06B1', +64411: ' 06B1', +64412: ' 06B1', +64413: ' 06B1', +64414: ' 06BA', +64415: ' 06BA', +64416: ' 06BB', +64417: ' 06BB', +64418: ' 06BB', +64419: ' 06BB', +64420: ' 06C0', +64421: ' 06C0', +64422: ' 06C1', +64423: ' 06C1', +64424: ' 06C1', +64425: ' 06C1', +64426: ' 06BE', +64427: ' 06BE', +64428: ' 06BE', +64429: ' 06BE', +64430: ' 06D2', +64431: ' 06D2', +64432: ' 06D3', +64433: ' 06D3', +64467: ' 06AD', +64468: ' 06AD', +64469: ' 06AD', +64470: ' 06AD', +64471: ' 06C7', +64472: ' 06C7', +64473: ' 06C6', +64474: ' 06C6', +64475: ' 06C8', +64476: ' 06C8', +64477: ' 0677', +64478: ' 06CB', +64479: ' 06CB', +64480: ' 06C5', +64481: ' 06C5', +64482: ' 06C9', +64483: ' 06C9', +64484: ' 06D0', +64485: ' 06D0', +64486: ' 06D0', +64487: ' 06D0', +64488: ' 0649', +64489: ' 0649', +64490: ' 0626 0627', +64491: ' 0626 0627', +64492: ' 0626 06D5', +64493: ' 0626 06D5', +64494: ' 0626 0648', +64495: ' 0626 0648', +64496: ' 0626 06C7', +64497: ' 0626 06C7', +64498: ' 0626 06C6', +64499: ' 0626 06C6', +64500: ' 0626 06C8', +64501: ' 0626 06C8', +64502: ' 0626 06D0', +64503: ' 0626 06D0', +64504: ' 0626 06D0', +64505: ' 0626 0649', +64506: ' 0626 0649', +64507: ' 0626 0649', +64508: ' 06CC', +64509: ' 06CC', +64510: ' 06CC', +64511: ' 06CC', +64512: ' 0626 062C', +64513: ' 0626 062D', +64514: ' 0626 0645', +64515: ' 0626 0649', +64516: ' 0626 064A', +64517: ' 0628 062C', +64518: ' 0628 062D', +64519: ' 0628 062E', +64520: ' 0628 0645', +64521: ' 0628 0649', +64522: ' 0628 064A', +64523: ' 062A 062C', +64524: ' 062A 062D', +64525: ' 062A 062E', +64526: ' 062A 0645', +64527: ' 062A 0649', +64528: ' 062A 064A', +64529: ' 062B 062C', +64530: ' 062B 0645', +64531: ' 062B 0649', +64532: ' 062B 064A', +64533: ' 062C 062D', +64534: ' 062C 0645', +64535: ' 062D 062C', +64536: ' 062D 0645', +64537: ' 062E 062C', +64538: ' 062E 062D', +64539: ' 062E 0645', +64540: ' 0633 062C', +64541: ' 0633 062D', +64542: ' 0633 062E', +64543: ' 0633 0645', +64544: ' 0635 062D', +64545: ' 0635 0645', +64546: ' 0636 062C', +64547: ' 0636 062D', +64548: ' 0636 062E', +64549: ' 0636 0645', +64550: ' 0637 062D', +64551: ' 0637 0645', +64552: ' 0638 0645', +64553: ' 0639 062C', +64554: ' 0639 0645', +64555: ' 063A 062C', +64556: ' 063A 0645', +64557: ' 0641 062C', +64558: ' 0641 062D', +64559: ' 0641 062E', +64560: ' 0641 0645', +64561: ' 0641 0649', +64562: ' 0641 064A', +64563: ' 0642 062D', +64564: ' 0642 0645', +64565: ' 0642 0649', +64566: ' 0642 064A', +64567: ' 0643 0627', +64568: ' 0643 062C', +64569: ' 0643 062D', +64570: ' 0643 062E', +64571: ' 0643 0644', +64572: ' 0643 0645', +64573: ' 0643 0649', +64574: ' 0643 064A', +64575: ' 0644 062C', +64576: ' 0644 062D', +64577: ' 0644 062E', +64578: ' 0644 0645', +64579: ' 0644 0649', +64580: ' 0644 064A', +64581: ' 0645 062C', +64582: ' 0645 062D', +64583: ' 0645 062E', +64584: ' 0645 0645', +64585: ' 0645 0649', +64586: ' 0645 064A', +64587: ' 0646 062C', +64588: ' 0646 062D', +64589: ' 0646 062E', +64590: ' 0646 0645', +64591: ' 0646 0649', +64592: ' 0646 064A', +64593: ' 0647 062C', +64594: ' 0647 0645', +64595: ' 0647 0649', +64596: ' 0647 064A', +64597: ' 064A 062C', +64598: ' 064A 062D', +64599: ' 064A 062E', +64600: ' 064A 0645', +64601: ' 064A 0649', +64602: ' 064A 064A', +64603: ' 0630 0670', +64604: ' 0631 0670', +64605: ' 0649 0670', +64606: ' 0020 064C 0651', +64607: ' 0020 064D 0651', +64608: ' 0020 064E 0651', +64609: ' 0020 064F 0651', +64610: ' 0020 0650 0651', +64611: ' 0020 0651 0670', +64612: ' 0626 0631', +64613: ' 0626 0632', +64614: ' 0626 0645', +64615: ' 0626 0646', +64616: ' 0626 0649', +64617: ' 0626 064A', +64618: ' 0628 0631', +64619: ' 0628 0632', +64620: ' 0628 0645', +64621: ' 0628 0646', +64622: ' 0628 0649', +64623: ' 0628 064A', +64624: ' 062A 0631', +64625: ' 062A 0632', +64626: ' 062A 0645', +64627: ' 062A 0646', +64628: ' 062A 0649', +64629: ' 062A 064A', +64630: ' 062B 0631', +64631: ' 062B 0632', +64632: ' 062B 0645', +64633: ' 062B 0646', +64634: ' 062B 0649', +64635: ' 062B 064A', +64636: ' 0641 0649', +64637: ' 0641 064A', +64638: ' 0642 0649', +64639: ' 0642 064A', +64640: ' 0643 0627', +64641: ' 0643 0644', +64642: ' 0643 0645', +64643: ' 0643 0649', +64644: ' 0643 064A', +64645: ' 0644 0645', +64646: ' 0644 0649', +64647: ' 0644 064A', +64648: ' 0645 0627', +64649: ' 0645 0645', +64650: ' 0646 0631', +64651: ' 0646 0632', +64652: ' 0646 0645', +64653: ' 0646 0646', +64654: ' 0646 0649', +64655: ' 0646 064A', +64656: ' 0649 0670', +64657: ' 064A 0631', +64658: ' 064A 0632', +64659: ' 064A 0645', +64660: ' 064A 0646', +64661: ' 064A 0649', +64662: ' 064A 064A', +64663: ' 0626 062C', +64664: ' 0626 062D', +64665: ' 0626 062E', +64666: ' 0626 0645', +64667: ' 0626 0647', +64668: ' 0628 062C', +64669: ' 0628 062D', +64670: ' 0628 062E', +64671: ' 0628 0645', +64672: ' 0628 0647', +64673: ' 062A 062C', +64674: ' 062A 062D', +64675: ' 062A 062E', +64676: ' 062A 0645', +64677: ' 062A 0647', +64678: ' 062B 0645', +64679: ' 062C 062D', +64680: ' 062C 0645', +64681: ' 062D 062C', +64682: ' 062D 0645', +64683: ' 062E 062C', +64684: ' 062E 0645', +64685: ' 0633 062C', +64686: ' 0633 062D', +64687: ' 0633 062E', +64688: ' 0633 0645', +64689: ' 0635 062D', +64690: ' 0635 062E', +64691: ' 0635 0645', +64692: ' 0636 062C', +64693: ' 0636 062D', +64694: ' 0636 062E', +64695: ' 0636 0645', +64696: ' 0637 062D', +64697: ' 0638 0645', +64698: ' 0639 062C', +64699: ' 0639 0645', +64700: ' 063A 062C', +64701: ' 063A 0645', +64702: ' 0641 062C', +64703: ' 0641 062D', +64704: ' 0641 062E', +64705: ' 0641 0645', +64706: ' 0642 062D', +64707: ' 0642 0645', +64708: ' 0643 062C', +64709: ' 0643 062D', +64710: ' 0643 062E', +64711: ' 0643 0644', +64712: ' 0643 0645', +64713: ' 0644 062C', +64714: ' 0644 062D', +64715: ' 0644 062E', +64716: ' 0644 0645', +64717: ' 0644 0647', +64718: ' 0645 062C', +64719: ' 0645 062D', +64720: ' 0645 062E', +64721: ' 0645 0645', +64722: ' 0646 062C', +64723: ' 0646 062D', +64724: ' 0646 062E', +64725: ' 0646 0645', +64726: ' 0646 0647', +64727: ' 0647 062C', +64728: ' 0647 0645', +64729: ' 0647 0670', +64730: ' 064A 062C', +64731: ' 064A 062D', +64732: ' 064A 062E', +64733: ' 064A 0645', +64734: ' 064A 0647', +64735: ' 0626 0645', +64736: ' 0626 0647', +64737: ' 0628 0645', +64738: ' 0628 0647', +64739: ' 062A 0645', +64740: ' 062A 0647', +64741: ' 062B 0645', +64742: ' 062B 0647', +64743: ' 0633 0645', +64744: ' 0633 0647', +64745: ' 0634 0645', +64746: ' 0634 0647', +64747: ' 0643 0644', +64748: ' 0643 0645', +64749: ' 0644 0645', +64750: ' 0646 0645', +64751: ' 0646 0647', +64752: ' 064A 0645', +64753: ' 064A 0647', +64754: ' 0640 064E 0651', +64755: ' 0640 064F 0651', +64756: ' 0640 0650 0651', +64757: ' 0637 0649', +64758: ' 0637 064A', +64759: ' 0639 0649', +64760: ' 0639 064A', +64761: ' 063A 0649', +64762: ' 063A 064A', +64763: ' 0633 0649', +64764: ' 0633 064A', +64765: ' 0634 0649', +64766: ' 0634 064A', +64767: ' 062D 0649', +64768: ' 062D 064A', +64769: ' 062C 0649', +64770: ' 062C 064A', +64771: ' 062E 0649', +64772: ' 062E 064A', +64773: ' 0635 0649', +64774: ' 0635 064A', +64775: ' 0636 0649', +64776: ' 0636 064A', +64777: ' 0634 062C', +64778: ' 0634 062D', +64779: ' 0634 062E', +64780: ' 0634 0645', +64781: ' 0634 0631', +64782: ' 0633 0631', +64783: ' 0635 0631', +64784: ' 0636 0631', +64785: ' 0637 0649', +64786: ' 0637 064A', +64787: ' 0639 0649', +64788: ' 0639 064A', +64789: ' 063A 0649', +64790: ' 063A 064A', +64791: ' 0633 0649', +64792: ' 0633 064A', +64793: ' 0634 0649', +64794: ' 0634 064A', +64795: ' 062D 0649', +64796: ' 062D 064A', +64797: ' 062C 0649', +64798: ' 062C 064A', +64799: ' 062E 0649', +64800: ' 062E 064A', +64801: ' 0635 0649', +64802: ' 0635 064A', +64803: ' 0636 0649', +64804: ' 0636 064A', +64805: ' 0634 062C', +64806: ' 0634 062D', +64807: ' 0634 062E', +64808: ' 0634 0645', +64809: ' 0634 0631', +64810: ' 0633 0631', +64811: ' 0635 0631', +64812: ' 0636 0631', +64813: ' 0634 062C', +64814: ' 0634 062D', +64815: ' 0634 062E', +64816: ' 0634 0645', +64817: ' 0633 0647', +64818: ' 0634 0647', +64819: ' 0637 0645', +64820: ' 0633 062C', +64821: ' 0633 062D', +64822: ' 0633 062E', +64823: ' 0634 062C', +64824: ' 0634 062D', +64825: ' 0634 062E', +64826: ' 0637 0645', +64827: ' 0638 0645', +64828: ' 0627 064B', +64829: ' 0627 064B', +64848: ' 062A 062C 0645', +64849: ' 062A 062D 062C', +64850: ' 062A 062D 062C', +64851: ' 062A 062D 0645', +64852: ' 062A 062E 0645', +64853: ' 062A 0645 062C', +64854: ' 062A 0645 062D', +64855: ' 062A 0645 062E', +64856: ' 062C 0645 062D', +64857: ' 062C 0645 062D', +64858: ' 062D 0645 064A', +64859: ' 062D 0645 0649', +64860: ' 0633 062D 062C', +64861: ' 0633 062C 062D', +64862: ' 0633 062C 0649', +64863: ' 0633 0645 062D', +64864: ' 0633 0645 062D', +64865: ' 0633 0645 062C', +64866: ' 0633 0645 0645', +64867: ' 0633 0645 0645', +64868: ' 0635 062D 062D', +64869: ' 0635 062D 062D', +64870: ' 0635 0645 0645', +64871: ' 0634 062D 0645', +64872: ' 0634 062D 0645', +64873: ' 0634 062C 064A', +64874: ' 0634 0645 062E', +64875: ' 0634 0645 062E', +64876: ' 0634 0645 0645', +64877: ' 0634 0645 0645', +64878: ' 0636 062D 0649', +64879: ' 0636 062E 0645', +64880: ' 0636 062E 0645', +64881: ' 0637 0645 062D', +64882: ' 0637 0645 062D', +64883: ' 0637 0645 0645', +64884: ' 0637 0645 064A', +64885: ' 0639 062C 0645', +64886: ' 0639 0645 0645', +64887: ' 0639 0645 0645', +64888: ' 0639 0645 0649', +64889: ' 063A 0645 0645', +64890: ' 063A 0645 064A', +64891: ' 063A 0645 0649', +64892: ' 0641 062E 0645', +64893: ' 0641 062E 0645', +64894: ' 0642 0645 062D', +64895: ' 0642 0645 0645', +64896: ' 0644 062D 0645', +64897: ' 0644 062D 064A', +64898: ' 0644 062D 0649', +64899: ' 0644 062C 062C', +64900: ' 0644 062C 062C', +64901: ' 0644 062E 0645', +64902: ' 0644 062E 0645', +64903: ' 0644 0645 062D', +64904: ' 0644 0645 062D', +64905: ' 0645 062D 062C', +64906: ' 0645 062D 0645', +64907: ' 0645 062D 064A', +64908: ' 0645 062C 062D', +64909: ' 0645 062C 0645', +64910: ' 0645 062E 062C', +64911: ' 0645 062E 0645', +64914: ' 0645 062C 062E', +64915: ' 0647 0645 062C', +64916: ' 0647 0645 0645', +64917: ' 0646 062D 0645', +64918: ' 0646 062D 0649', +64919: ' 0646 062C 0645', +64920: ' 0646 062C 0645', +64921: ' 0646 062C 0649', +64922: ' 0646 0645 064A', +64923: ' 0646 0645 0649', +64924: ' 064A 0645 0645', +64925: ' 064A 0645 0645', +64926: ' 0628 062E 064A', +64927: ' 062A 062C 064A', +64928: ' 062A 062C 0649', +64929: ' 062A 062E 064A', +64930: ' 062A 062E 0649', +64931: ' 062A 0645 064A', +64932: ' 062A 0645 0649', +64933: ' 062C 0645 064A', +64934: ' 062C 062D 0649', +64935: ' 062C 0645 0649', +64936: ' 0633 062E 0649', +64937: ' 0635 062D 064A', +64938: ' 0634 062D 064A', +64939: ' 0636 062D 064A', +64940: ' 0644 062C 064A', +64941: ' 0644 0645 064A', +64942: ' 064A 062D 064A', +64943: ' 064A 062C 064A', +64944: ' 064A 0645 064A', +64945: ' 0645 0645 064A', +64946: ' 0642 0645 064A', +64947: ' 0646 062D 064A', +64948: ' 0642 0645 062D', +64949: ' 0644 062D 0645', +64950: ' 0639 0645 064A', +64951: ' 0643 0645 064A', +64952: ' 0646 062C 062D', +64953: ' 0645 062E 064A', +64954: ' 0644 062C 0645', +64955: ' 0643 0645 0645', +64956: ' 0644 062C 0645', +64957: ' 0646 062C 062D', +64958: ' 062C 062D 064A', +64959: ' 062D 062C 064A', +64960: ' 0645 062C 064A', +64961: ' 0641 0645 064A', +64962: ' 0628 062D 064A', +64963: ' 0643 0645 0645', +64964: ' 0639 062C 0645', +64965: ' 0635 0645 0645', +64966: ' 0633 062E 064A', +64967: ' 0646 062C 064A', +65008: ' 0635 0644 06D2', +65009: ' 0642 0644 06D2', +65010: ' 0627 0644 0644 0647', +65011: ' 0627 0643 0628 0631', +65012: ' 0645 062D 0645 062F', +65013: ' 0635 0644 0639 0645', +65014: ' 0631 0633 0648 0644', +65015: ' 0639 0644 064A 0647', +65016: ' 0648 0633 0644 0645', +65017: ' 0635 0644 0649', +65018: ' 0635 0644 0649 0020 0627 0644 0644 0647 0020 0639 0644 064A 0647 0020 0648 0633 0644 0645', +65019: ' 062C 0644 0020 062C 0644 0627 0644 0647', +65020: ' 0631 06CC 0627 0644', +65072: ' 2025', +65073: ' 2014', +65074: ' 2013', +65075: ' 005F', +65076: ' 005F', +65077: ' 0028', +65078: ' 0029', +65079: ' 007B', +65080: ' 007D', +65081: ' 3014', +65082: ' 3015', +65083: ' 3010', +65084: ' 3011', +65085: ' 300A', +65086: ' 300B', +65087: ' 3008', +65088: ' 3009', +65089: ' 300C', +65090: ' 300D', +65091: ' 300E', +65092: ' 300F', +65097: ' 203E', +65098: ' 203E', +65099: ' 203E', +65100: ' 203E', +65101: ' 005F', +65102: ' 005F', +65103: ' 005F', +65104: ' 002C', +65105: ' 3001', +65106: ' 002E', +65108: ' 003B', +65109: ' 003A', +65110: ' 003F', +65111: ' 0021', +65112: ' 2014', +65113: ' 0028', +65114: ' 0029', +65115: ' 007B', +65116: ' 007D', +65117: ' 3014', +65118: ' 3015', +65119: ' 0023', +65120: ' 0026', +65121: ' 002A', +65122: ' 002B', +65123: ' 002D', +65124: ' 003C', +65125: ' 003E', +65126: ' 003D', +65128: ' 005C', +65129: ' 0024', +65130: ' 0025', +65131: ' 0040', +65136: ' 0020 064B', +65137: ' 0640 064B', +65138: ' 0020 064C', +65140: ' 0020 064D', +65142: ' 0020 064E', +65143: ' 0640 064E', +65144: ' 0020 064F', +65145: ' 0640 064F', +65146: ' 0020 0650', +65147: ' 0640 0650', +65148: ' 0020 0651', +65149: ' 0640 0651', +65150: ' 0020 0652', +65151: ' 0640 0652', +65152: ' 0621', +65153: ' 0622', +65154: ' 0622', +65155: ' 0623', +65156: ' 0623', +65157: ' 0624', +65158: ' 0624', +65159: ' 0625', +65160: ' 0625', +65161: ' 0626', +65162: ' 0626', +65163: ' 0626', +65164: ' 0626', +65165: ' 0627', +65166: ' 0627', +65167: ' 0628', +65168: ' 0628', +65169: ' 0628', +65170: ' 0628', +65171: ' 0629', +65172: ' 0629', +65173: ' 062A', +65174: ' 062A', +65175: ' 062A', +65176: ' 062A', +65177: ' 062B', +65178: ' 062B', +65179: ' 062B', +65180: ' 062B', +65181: ' 062C', +65182: ' 062C', +65183: ' 062C', +65184: ' 062C', +65185: ' 062D', +65186: ' 062D', +65187: ' 062D', +65188: ' 062D', +65189: ' 062E', +65190: ' 062E', +65191: ' 062E', +65192: ' 062E', +65193: ' 062F', +65194: ' 062F', +65195: ' 0630', +65196: ' 0630', +65197: ' 0631', +65198: ' 0631', +65199: ' 0632', +65200: ' 0632', +65201: ' 0633', +65202: ' 0633', +65203: ' 0633', +65204: ' 0633', +65205: ' 0634', +65206: ' 0634', +65207: ' 0634', +65208: ' 0634', +65209: ' 0635', +65210: ' 0635', +65211: ' 0635', +65212: ' 0635', +65213: ' 0636', +65214: ' 0636', +65215: ' 0636', +65216: ' 0636', +65217: ' 0637', +65218: ' 0637', +65219: ' 0637', +65220: ' 0637', +65221: ' 0638', +65222: ' 0638', +65223: ' 0638', +65224: ' 0638', +65225: ' 0639', +65226: ' 0639', +65227: ' 0639', +65228: ' 0639', +65229: ' 063A', +65230: ' 063A', +65231: ' 063A', +65232: ' 063A', +65233: ' 0641', +65234: ' 0641', +65235: ' 0641', +65236: ' 0641', +65237: ' 0642', +65238: ' 0642', +65239: ' 0642', +65240: ' 0642', +65241: ' 0643', +65242: ' 0643', +65243: ' 0643', +65244: ' 0643', +65245: ' 0644', +65246: ' 0644', +65247: ' 0644', +65248: ' 0644', +65249: ' 0645', +65250: ' 0645', +65251: ' 0645', +65252: ' 0645', +65253: ' 0646', +65254: ' 0646', +65255: ' 0646', +65256: ' 0646', +65257: ' 0647', +65258: ' 0647', +65259: ' 0647', +65260: ' 0647', +65261: ' 0648', +65262: ' 0648', +65263: ' 0649', +65264: ' 0649', +65265: ' 064A', +65266: ' 064A', +65267: ' 064A', +65268: ' 064A', +65269: ' 0644 0622', +65270: ' 0644 0622', +65271: ' 0644 0623', +65272: ' 0644 0623', +65273: ' 0644 0625', +65274: ' 0644 0625', +65275: ' 0644 0627', +65276: ' 0644 0627', +65281: ' 0021', +65282: ' 0022', +65283: ' 0023', +65284: ' 0024', +65285: ' 0025', +65286: ' 0026', +65287: ' 0027', +65288: ' 0028', +65289: ' 0029', +65290: ' 002A', +65291: ' 002B', +65292: ' 002C', +65293: ' 002D', +65294: ' 002E', +65295: ' 002F', +65296: ' 0030', +65297: ' 0031', +65298: ' 0032', +65299: ' 0033', +65300: ' 0034', +65301: ' 0035', +65302: ' 0036', +65303: ' 0037', +65304: ' 0038', +65305: ' 0039', +65306: ' 003A', +65307: ' 003B', +65308: ' 003C', +65309: ' 003D', +65310: ' 003E', +65311: ' 003F', +65312: ' 0040', +65313: ' 0041', +65314: ' 0042', +65315: ' 0043', +65316: ' 0044', +65317: ' 0045', +65318: ' 0046', +65319: ' 0047', +65320: ' 0048', +65321: ' 0049', +65322: ' 004A', +65323: ' 004B', +65324: ' 004C', +65325: ' 004D', +65326: ' 004E', +65327: ' 004F', +65328: ' 0050', +65329: ' 0051', +65330: ' 0052', +65331: ' 0053', +65332: ' 0054', +65333: ' 0055', +65334: ' 0056', +65335: ' 0057', +65336: ' 0058', +65337: ' 0059', +65338: ' 005A', +65339: ' 005B', +65340: ' 005C', +65341: ' 005D', +65342: ' 005E', +65343: ' 005F', +65344: ' 0060', +65345: ' 0061', +65346: ' 0062', +65347: ' 0063', +65348: ' 0064', +65349: ' 0065', +65350: ' 0066', +65351: ' 0067', +65352: ' 0068', +65353: ' 0069', +65354: ' 006A', +65355: ' 006B', +65356: ' 006C', +65357: ' 006D', +65358: ' 006E', +65359: ' 006F', +65360: ' 0070', +65361: ' 0071', +65362: ' 0072', +65363: ' 0073', +65364: ' 0074', +65365: ' 0075', +65366: ' 0076', +65367: ' 0077', +65368: ' 0078', +65369: ' 0079', +65370: ' 007A', +65371: ' 007B', +65372: ' 007C', +65373: ' 007D', +65374: ' 007E', +65375: ' 2985', +65376: ' 2986', +65377: ' 3002', +65378: ' 300C', +65379: ' 300D', +65380: ' 3001', +65381: ' 30FB', +65382: ' 30F2', +65383: ' 30A1', +65384: ' 30A3', +65385: ' 30A5', +65386: ' 30A7', +65387: ' 30A9', +65388: ' 30E3', +65389: ' 30E5', +65390: ' 30E7', +65391: ' 30C3', +65392: ' 30FC', +65393: ' 30A2', +65394: ' 30A4', +65395: ' 30A6', +65396: ' 30A8', +65397: ' 30AA', +65398: ' 30AB', +65399: ' 30AD', +65400: ' 30AF', +65401: ' 30B1', +65402: ' 30B3', +65403: ' 30B5', +65404: ' 30B7', +65405: ' 30B9', +65406: ' 30BB', +65407: ' 30BD', +65408: ' 30BF', +65409: ' 30C1', +65410: ' 30C4', +65411: ' 30C6', +65412: ' 30C8', +65413: ' 30CA', +65414: ' 30CB', +65415: ' 30CC', +65416: ' 30CD', +65417: ' 30CE', +65418: ' 30CF', +65419: ' 30D2', +65420: ' 30D5', +65421: ' 30D8', +65422: ' 30DB', +65423: ' 30DE', +65424: ' 30DF', +65425: ' 30E0', +65426: ' 30E1', +65427: ' 30E2', +65428: ' 30E4', +65429: ' 30E6', +65430: ' 30E8', +65431: ' 30E9', +65432: ' 30EA', +65433: ' 30EB', +65434: ' 30EC', +65435: ' 30ED', +65436: ' 30EF', +65437: ' 30F3', +65438: ' 3099', +65439: ' 309A', +65440: ' 3164', +65441: ' 3131', +65442: ' 3132', +65443: ' 3133', +65444: ' 3134', +65445: ' 3135', +65446: ' 3136', +65447: ' 3137', +65448: ' 3138', +65449: ' 3139', +65450: ' 313A', +65451: ' 313B', +65452: ' 313C', +65453: ' 313D', +65454: ' 313E', +65455: ' 313F', +65456: ' 3140', +65457: ' 3141', +65458: ' 3142', +65459: ' 3143', +65460: ' 3144', +65461: ' 3145', +65462: ' 3146', +65463: ' 3147', +65464: ' 3148', +65465: ' 3149', +65466: ' 314A', +65467: ' 314B', +65468: ' 314C', +65469: ' 314D', +65470: ' 314E', +65474: ' 314F', +65475: ' 3150', +65476: ' 3151', +65477: ' 3152', +65478: ' 3153', +65479: ' 3154', +65482: ' 3155', +65483: ' 3156', +65484: ' 3157', +65485: ' 3158', +65486: ' 3159', +65487: ' 315A', +65490: ' 315B', +65491: ' 315C', +65492: ' 315D', +65493: ' 315E', +65494: ' 315F', +65495: ' 3160', +65498: ' 3161', +65499: ' 3162', +65500: ' 3163', +65504: ' 00A2', +65505: ' 00A3', +65506: ' 00AC', +65507: ' 00AF', +65508: ' 00A6', +65509: ' 00A5', +65510: ' 20A9', +65512: ' 2502', +65513: ' 2190', +65514: ' 2191', +65515: ' 2192', +65516: ' 2193', +65517: ' 25A0', +65518: ' 25CB', +119134: '1D157 1D165', +119135: '1D158 1D165', +119136: '1D15F 1D16E', +119137: '1D15F 1D16F', +119138: '1D15F 1D170', +119139: '1D15F 1D171', +119140: '1D15F 1D172', +119227: '1D1B9 1D165', +119228: '1D1BA 1D165', +119229: '1D1BB 1D16E', +119230: '1D1BC 1D16E', +119231: '1D1BB 1D16F', +119232: '1D1BC 1D16F', +119808: ' 0041', +119809: ' 0042', +119810: ' 0043', +119811: ' 0044', +119812: ' 0045', +119813: ' 0046', +119814: ' 0047', +119815: ' 0048', +119816: ' 0049', +119817: ' 004A', +119818: ' 004B', +119819: ' 004C', +119820: ' 004D', +119821: ' 004E', +119822: ' 004F', +119823: ' 0050', +119824: ' 0051', +119825: ' 0052', +119826: ' 0053', +119827: ' 0054', +119828: ' 0055', +119829: ' 0056', +119830: ' 0057', +119831: ' 0058', +119832: ' 0059', +119833: ' 005A', +119834: ' 0061', +119835: ' 0062', +119836: ' 0063', +119837: ' 0064', +119838: ' 0065', +119839: ' 0066', +119840: ' 0067', +119841: ' 0068', +119842: ' 0069', +119843: ' 006A', +119844: ' 006B', +119845: ' 006C', +119846: ' 006D', +119847: ' 006E', +119848: ' 006F', +119849: ' 0070', +119850: ' 0071', +119851: ' 0072', +119852: ' 0073', +119853: ' 0074', +119854: ' 0075', +119855: ' 0076', +119856: ' 0077', +119857: ' 0078', +119858: ' 0079', +119859: ' 007A', +119860: ' 0041', +119861: ' 0042', +119862: ' 0043', +119863: ' 0044', +119864: ' 0045', +119865: ' 0046', +119866: ' 0047', +119867: ' 0048', +119868: ' 0049', +119869: ' 004A', +119870: ' 004B', +119871: ' 004C', +119872: ' 004D', +119873: ' 004E', +119874: ' 004F', +119875: ' 0050', +119876: ' 0051', +119877: ' 0052', +119878: ' 0053', +119879: ' 0054', +119880: ' 0055', +119881: ' 0056', +119882: ' 0057', +119883: ' 0058', +119884: ' 0059', +119885: ' 005A', +119886: ' 0061', +119887: ' 0062', +119888: ' 0063', +119889: ' 0064', +119890: ' 0065', +119891: ' 0066', +119892: ' 0067', +119894: ' 0069', +119895: ' 006A', +119896: ' 006B', +119897: ' 006C', +119898: ' 006D', +119899: ' 006E', +119900: ' 006F', +119901: ' 0070', +119902: ' 0071', +119903: ' 0072', +119904: ' 0073', +119905: ' 0074', +119906: ' 0075', +119907: ' 0076', +119908: ' 0077', +119909: ' 0078', +119910: ' 0079', +119911: ' 007A', +119912: ' 0041', +119913: ' 0042', +119914: ' 0043', +119915: ' 0044', +119916: ' 0045', +119917: ' 0046', +119918: ' 0047', +119919: ' 0048', +119920: ' 0049', +119921: ' 004A', +119922: ' 004B', +119923: ' 004C', +119924: ' 004D', +119925: ' 004E', +119926: ' 004F', +119927: ' 0050', +119928: ' 0051', +119929: ' 0052', +119930: ' 0053', +119931: ' 0054', +119932: ' 0055', +119933: ' 0056', +119934: ' 0057', +119935: ' 0058', +119936: ' 0059', +119937: ' 005A', +119938: ' 0061', +119939: ' 0062', +119940: ' 0063', +119941: ' 0064', +119942: ' 0065', +119943: ' 0066', +119944: ' 0067', +119945: ' 0068', +119946: ' 0069', +119947: ' 006A', +119948: ' 006B', +119949: ' 006C', +119950: ' 006D', +119951: ' 006E', +119952: ' 006F', +119953: ' 0070', +119954: ' 0071', +119955: ' 0072', +119956: ' 0073', +119957: ' 0074', +119958: ' 0075', +119959: ' 0076', +119960: ' 0077', +119961: ' 0078', +119962: ' 0079', +119963: ' 007A', +119964: ' 0041', +119966: ' 0043', +119967: ' 0044', +119970: ' 0047', +119973: ' 004A', +119974: ' 004B', +119977: ' 004E', +119978: ' 004F', +119979: ' 0050', +119980: ' 0051', +119982: ' 0053', +119983: ' 0054', +119984: ' 0055', +119985: ' 0056', +119986: ' 0057', +119987: ' 0058', +119988: ' 0059', +119989: ' 005A', +119990: ' 0061', +119991: ' 0062', +119992: ' 0063', +119993: ' 0064', +119995: ' 0066', +119997: ' 0068', +119998: ' 0069', +119999: ' 006A', +120000: ' 006B', +120002: ' 006D', +120003: ' 006E', +120005: ' 0070', +120006: ' 0071', +120007: ' 0072', +120008: ' 0073', +120009: ' 0074', +120010: ' 0075', +120011: ' 0076', +120012: ' 0077', +120013: ' 0078', +120014: ' 0079', +120015: ' 007A', +120016: ' 0041', +120017: ' 0042', +120018: ' 0043', +120019: ' 0044', +120020: ' 0045', +120021: ' 0046', +120022: ' 0047', +120023: ' 0048', +120024: ' 0049', +120025: ' 004A', +120026: ' 004B', +120027: ' 004C', +120028: ' 004D', +120029: ' 004E', +120030: ' 004F', +120031: ' 0050', +120032: ' 0051', +120033: ' 0052', +120034: ' 0053', +120035: ' 0054', +120036: ' 0055', +120037: ' 0056', +120038: ' 0057', +120039: ' 0058', +120040: ' 0059', +120041: ' 005A', +120042: ' 0061', +120043: ' 0062', +120044: ' 0063', +120045: ' 0064', +120046: ' 0065', +120047: ' 0066', +120048: ' 0067', +120049: ' 0068', +120050: ' 0069', +120051: ' 006A', +120052: ' 006B', +120053: ' 006C', +120054: ' 006D', +120055: ' 006E', +120056: ' 006F', +120057: ' 0070', +120058: ' 0071', +120059: ' 0072', +120060: ' 0073', +120061: ' 0074', +120062: ' 0075', +120063: ' 0076', +120064: ' 0077', +120065: ' 0078', +120066: ' 0079', +120067: ' 007A', +120068: ' 0041', +120069: ' 0042', +120071: ' 0044', +120072: ' 0045', +120073: ' 0046', +120074: ' 0047', +120077: ' 004A', +120078: ' 004B', +120079: ' 004C', +120080: ' 004D', +120081: ' 004E', +120082: ' 004F', +120083: ' 0050', +120084: ' 0051', +120086: ' 0053', +120087: ' 0054', +120088: ' 0055', +120089: ' 0056', +120090: ' 0057', +120091: ' 0058', +120092: ' 0059', +120094: ' 0061', +120095: ' 0062', +120096: ' 0063', +120097: ' 0064', +120098: ' 0065', +120099: ' 0066', +120100: ' 0067', +120101: ' 0068', +120102: ' 0069', +120103: ' 006A', +120104: ' 006B', +120105: ' 006C', +120106: ' 006D', +120107: ' 006E', +120108: ' 006F', +120109: ' 0070', +120110: ' 0071', +120111: ' 0072', +120112: ' 0073', +120113: ' 0074', +120114: ' 0075', +120115: ' 0076', +120116: ' 0077', +120117: ' 0078', +120118: ' 0079', +120119: ' 007A', +120120: ' 0041', +120121: ' 0042', +120123: ' 0044', +120124: ' 0045', +120125: ' 0046', +120126: ' 0047', +120128: ' 0049', +120129: ' 004A', +120130: ' 004B', +120131: ' 004C', +120132: ' 004D', +120134: ' 004F', +120138: ' 0053', +120139: ' 0054', +120140: ' 0055', +120141: ' 0056', +120142: ' 0057', +120143: ' 0058', +120144: ' 0059', +120146: ' 0061', +120147: ' 0062', +120148: ' 0063', +120149: ' 0064', +120150: ' 0065', +120151: ' 0066', +120152: ' 0067', +120153: ' 0068', +120154: ' 0069', +120155: ' 006A', +120156: ' 006B', +120157: ' 006C', +120158: ' 006D', +120159: ' 006E', +120160: ' 006F', +120161: ' 0070', +120162: ' 0071', +120163: ' 0072', +120164: ' 0073', +120165: ' 0074', +120166: ' 0075', +120167: ' 0076', +120168: ' 0077', +120169: ' 0078', +120170: ' 0079', +120171: ' 007A', +120172: ' 0041', +120173: ' 0042', +120174: ' 0043', +120175: ' 0044', +120176: ' 0045', +120177: ' 0046', +120178: ' 0047', +120179: ' 0048', +120180: ' 0049', +120181: ' 004A', +120182: ' 004B', +120183: ' 004C', +120184: ' 004D', +120185: ' 004E', +120186: ' 004F', +120187: ' 0050', +120188: ' 0051', +120189: ' 0052', +120190: ' 0053', +120191: ' 0054', +120192: ' 0055', +120193: ' 0056', +120194: ' 0057', +120195: ' 0058', +120196: ' 0059', +120197: ' 005A', +120198: ' 0061', +120199: ' 0062', +120200: ' 0063', +120201: ' 0064', +120202: ' 0065', +120203: ' 0066', +120204: ' 0067', +120205: ' 0068', +120206: ' 0069', +120207: ' 006A', +120208: ' 006B', +120209: ' 006C', +120210: ' 006D', +120211: ' 006E', +120212: ' 006F', +120213: ' 0070', +120214: ' 0071', +120215: ' 0072', +120216: ' 0073', +120217: ' 0074', +120218: ' 0075', +120219: ' 0076', +120220: ' 0077', +120221: ' 0078', +120222: ' 0079', +120223: ' 007A', +120224: ' 0041', +120225: ' 0042', +120226: ' 0043', +120227: ' 0044', +120228: ' 0045', +120229: ' 0046', +120230: ' 0047', +120231: ' 0048', +120232: ' 0049', +120233: ' 004A', +120234: ' 004B', +120235: ' 004C', +120236: ' 004D', +120237: ' 004E', +120238: ' 004F', +120239: ' 0050', +120240: ' 0051', +120241: ' 0052', +120242: ' 0053', +120243: ' 0054', +120244: ' 0055', +120245: ' 0056', +120246: ' 0057', +120247: ' 0058', +120248: ' 0059', +120249: ' 005A', +120250: ' 0061', +120251: ' 0062', +120252: ' 0063', +120253: ' 0064', +120254: ' 0065', +120255: ' 0066', +120256: ' 0067', +120257: ' 0068', +120258: ' 0069', +120259: ' 006A', +120260: ' 006B', +120261: ' 006C', +120262: ' 006D', +120263: ' 006E', +120264: ' 006F', +120265: ' 0070', +120266: ' 0071', +120267: ' 0072', +120268: ' 0073', +120269: ' 0074', +120270: ' 0075', +120271: ' 0076', +120272: ' 0077', +120273: ' 0078', +120274: ' 0079', +120275: ' 007A', +120276: ' 0041', +120277: ' 0042', +120278: ' 0043', +120279: ' 0044', +120280: ' 0045', +120281: ' 0046', +120282: ' 0047', +120283: ' 0048', +120284: ' 0049', +120285: ' 004A', +120286: ' 004B', +120287: ' 004C', +120288: ' 004D', +120289: ' 004E', +120290: ' 004F', +120291: ' 0050', +120292: ' 0051', +120293: ' 0052', +120294: ' 0053', +120295: ' 0054', +120296: ' 0055', +120297: ' 0056', +120298: ' 0057', +120299: ' 0058', +120300: ' 0059', +120301: ' 005A', +120302: ' 0061', +120303: ' 0062', +120304: ' 0063', +120305: ' 0064', +120306: ' 0065', +120307: ' 0066', +120308: ' 0067', +120309: ' 0068', +120310: ' 0069', +120311: ' 006A', +120312: ' 006B', +120313: ' 006C', +120314: ' 006D', +120315: ' 006E', +120316: ' 006F', +120317: ' 0070', +120318: ' 0071', +120319: ' 0072', +120320: ' 0073', +120321: ' 0074', +120322: ' 0075', +120323: ' 0076', +120324: ' 0077', +120325: ' 0078', +120326: ' 0079', +120327: ' 007A', +120328: ' 0041', +120329: ' 0042', +120330: ' 0043', +120331: ' 0044', +120332: ' 0045', +120333: ' 0046', +120334: ' 0047', +120335: ' 0048', +120336: ' 0049', +120337: ' 004A', +120338: ' 004B', +120339: ' 004C', +120340: ' 004D', +120341: ' 004E', +120342: ' 004F', +120343: ' 0050', +120344: ' 0051', +120345: ' 0052', +120346: ' 0053', +120347: ' 0054', +120348: ' 0055', +120349: ' 0056', +120350: ' 0057', +120351: ' 0058', +120352: ' 0059', +120353: ' 005A', +120354: ' 0061', +120355: ' 0062', +120356: ' 0063', +120357: ' 0064', +120358: ' 0065', +120359: ' 0066', +120360: ' 0067', +120361: ' 0068', +120362: ' 0069', +120363: ' 006A', +120364: ' 006B', +120365: ' 006C', +120366: ' 006D', +120367: ' 006E', +120368: ' 006F', +120369: ' 0070', +120370: ' 0071', +120371: ' 0072', +120372: ' 0073', +120373: ' 0074', +120374: ' 0075', +120375: ' 0076', +120376: ' 0077', +120377: ' 0078', +120378: ' 0079', +120379: ' 007A', +120380: ' 0041', +120381: ' 0042', +120382: ' 0043', +120383: ' 0044', +120384: ' 0045', +120385: ' 0046', +120386: ' 0047', +120387: ' 0048', +120388: ' 0049', +120389: ' 004A', +120390: ' 004B', +120391: ' 004C', +120392: ' 004D', +120393: ' 004E', +120394: ' 004F', +120395: ' 0050', +120396: ' 0051', +120397: ' 0052', +120398: ' 0053', +120399: ' 0054', +120400: ' 0055', +120401: ' 0056', +120402: ' 0057', +120403: ' 0058', +120404: ' 0059', +120405: ' 005A', +120406: ' 0061', +120407: ' 0062', +120408: ' 0063', +120409: ' 0064', +120410: ' 0065', +120411: ' 0066', +120412: ' 0067', +120413: ' 0068', +120414: ' 0069', +120415: ' 006A', +120416: ' 006B', +120417: ' 006C', +120418: ' 006D', +120419: ' 006E', +120420: ' 006F', +120421: ' 0070', +120422: ' 0071', +120423: ' 0072', +120424: ' 0073', +120425: ' 0074', +120426: ' 0075', +120427: ' 0076', +120428: ' 0077', +120429: ' 0078', +120430: ' 0079', +120431: ' 007A', +120432: ' 0041', +120433: ' 0042', +120434: ' 0043', +120435: ' 0044', +120436: ' 0045', +120437: ' 0046', +120438: ' 0047', +120439: ' 0048', +120440: ' 0049', +120441: ' 004A', +120442: ' 004B', +120443: ' 004C', +120444: ' 004D', +120445: ' 004E', +120446: ' 004F', +120447: ' 0050', +120448: ' 0051', +120449: ' 0052', +120450: ' 0053', +120451: ' 0054', +120452: ' 0055', +120453: ' 0056', +120454: ' 0057', +120455: ' 0058', +120456: ' 0059', +120457: ' 005A', +120458: ' 0061', +120459: ' 0062', +120460: ' 0063', +120461: ' 0064', +120462: ' 0065', +120463: ' 0066', +120464: ' 0067', +120465: ' 0068', +120466: ' 0069', +120467: ' 006A', +120468: ' 006B', +120469: ' 006C', +120470: ' 006D', +120471: ' 006E', +120472: ' 006F', +120473: ' 0070', +120474: ' 0071', +120475: ' 0072', +120476: ' 0073', +120477: ' 0074', +120478: ' 0075', +120479: ' 0076', +120480: ' 0077', +120481: ' 0078', +120482: ' 0079', +120483: ' 007A', +120488: ' 0391', +120489: ' 0392', +120490: ' 0393', +120491: ' 0394', +120492: ' 0395', +120493: ' 0396', +120494: ' 0397', +120495: ' 0398', +120496: ' 0399', +120497: ' 039A', +120498: ' 039B', +120499: ' 039C', +120500: ' 039D', +120501: ' 039E', +120502: ' 039F', +120503: ' 03A0', +120504: ' 03A1', +120505: ' 03F4', +120506: ' 03A3', +120507: ' 03A4', +120508: ' 03A5', +120509: ' 03A6', +120510: ' 03A7', +120511: ' 03A8', +120512: ' 03A9', +120513: ' 2207', +120514: ' 03B1', +120515: ' 03B2', +120516: ' 03B3', +120517: ' 03B4', +120518: ' 03B5', +120519: ' 03B6', +120520: ' 03B7', +120521: ' 03B8', +120522: ' 03B9', +120523: ' 03BA', +120524: ' 03BB', +120525: ' 03BC', +120526: ' 03BD', +120527: ' 03BE', +120528: ' 03BF', +120529: ' 03C0', +120530: ' 03C1', +120531: ' 03C2', +120532: ' 03C3', +120533: ' 03C4', +120534: ' 03C5', +120535: ' 03C6', +120536: ' 03C7', +120537: ' 03C8', +120538: ' 03C9', +120539: ' 2202', +120540: ' 03F5', +120541: ' 03D1', +120542: ' 03F0', +120543: ' 03D5', +120544: ' 03F1', +120545: ' 03D6', +120546: ' 0391', +120547: ' 0392', +120548: ' 0393', +120549: ' 0394', +120550: ' 0395', +120551: ' 0396', +120552: ' 0397', +120553: ' 0398', +120554: ' 0399', +120555: ' 039A', +120556: ' 039B', +120557: ' 039C', +120558: ' 039D', +120559: ' 039E', +120560: ' 039F', +120561: ' 03A0', +120562: ' 03A1', +120563: ' 03F4', +120564: ' 03A3', +120565: ' 03A4', +120566: ' 03A5', +120567: ' 03A6', +120568: ' 03A7', +120569: ' 03A8', +120570: ' 03A9', +120571: ' 2207', +120572: ' 03B1', +120573: ' 03B2', +120574: ' 03B3', +120575: ' 03B4', +120576: ' 03B5', +120577: ' 03B6', +120578: ' 03B7', +120579: ' 03B8', +120580: ' 03B9', +120581: ' 03BA', +120582: ' 03BB', +120583: ' 03BC', +120584: ' 03BD', +120585: ' 03BE', +120586: ' 03BF', +120587: ' 03C0', +120588: ' 03C1', +120589: ' 03C2', +120590: ' 03C3', +120591: ' 03C4', +120592: ' 03C5', +120593: ' 03C6', +120594: ' 03C7', +120595: ' 03C8', +120596: ' 03C9', +120597: ' 2202', +120598: ' 03F5', +120599: ' 03D1', +120600: ' 03F0', +120601: ' 03D5', +120602: ' 03F1', +120603: ' 03D6', +120604: ' 0391', +120605: ' 0392', +120606: ' 0393', +120607: ' 0394', +120608: ' 0395', +120609: ' 0396', +120610: ' 0397', +120611: ' 0398', +120612: ' 0399', +120613: ' 039A', +120614: ' 039B', +120615: ' 039C', +120616: ' 039D', +120617: ' 039E', +120618: ' 039F', +120619: ' 03A0', +120620: ' 03A1', +120621: ' 03F4', +120622: ' 03A3', +120623: ' 03A4', +120624: ' 03A5', +120625: ' 03A6', +120626: ' 03A7', +120627: ' 03A8', +120628: ' 03A9', +120629: ' 2207', +120630: ' 03B1', +120631: ' 03B2', +120632: ' 03B3', +120633: ' 03B4', +120634: ' 03B5', +120635: ' 03B6', +120636: ' 03B7', +120637: ' 03B8', +120638: ' 03B9', +120639: ' 03BA', +120640: ' 03BB', +120641: ' 03BC', +120642: ' 03BD', +120643: ' 03BE', +120644: ' 03BF', +120645: ' 03C0', +120646: ' 03C1', +120647: ' 03C2', +120648: ' 03C3', +120649: ' 03C4', +120650: ' 03C5', +120651: ' 03C6', +120652: ' 03C7', +120653: ' 03C8', +120654: ' 03C9', +120655: ' 2202', +120656: ' 03F5', +120657: ' 03D1', +120658: ' 03F0', +120659: ' 03D5', +120660: ' 03F1', +120661: ' 03D6', +120662: ' 0391', +120663: ' 0392', +120664: ' 0393', +120665: ' 0394', +120666: ' 0395', +120667: ' 0396', +120668: ' 0397', +120669: ' 0398', +120670: ' 0399', +120671: ' 039A', +120672: ' 039B', +120673: ' 039C', +120674: ' 039D', +120675: ' 039E', +120676: ' 039F', +120677: ' 03A0', +120678: ' 03A1', +120679: ' 03F4', +120680: ' 03A3', +120681: ' 03A4', +120682: ' 03A5', +120683: ' 03A6', +120684: ' 03A7', +120685: ' 03A8', +120686: ' 03A9', +120687: ' 2207', +120688: ' 03B1', +120689: ' 03B2', +120690: ' 03B3', +120691: ' 03B4', +120692: ' 03B5', +120693: ' 03B6', +120694: ' 03B7', +120695: ' 03B8', +120696: ' 03B9', +120697: ' 03BA', +120698: ' 03BB', +120699: ' 03BC', +120700: ' 03BD', +120701: ' 03BE', +120702: ' 03BF', +120703: ' 03C0', +120704: ' 03C1', +120705: ' 03C2', +120706: ' 03C3', +120707: ' 03C4', +120708: ' 03C5', +120709: ' 03C6', +120710: ' 03C7', +120711: ' 03C8', +120712: ' 03C9', +120713: ' 2202', +120714: ' 03F5', +120715: ' 03D1', +120716: ' 03F0', +120717: ' 03D5', +120718: ' 03F1', +120719: ' 03D6', +120720: ' 0391', +120721: ' 0392', +120722: ' 0393', +120723: ' 0394', +120724: ' 0395', +120725: ' 0396', +120726: ' 0397', +120727: ' 0398', +120728: ' 0399', +120729: ' 039A', +120730: ' 039B', +120731: ' 039C', +120732: ' 039D', +120733: ' 039E', +120734: ' 039F', +120735: ' 03A0', +120736: ' 03A1', +120737: ' 03F4', +120738: ' 03A3', +120739: ' 03A4', +120740: ' 03A5', +120741: ' 03A6', +120742: ' 03A7', +120743: ' 03A8', +120744: ' 03A9', +120745: ' 2207', +120746: ' 03B1', +120747: ' 03B2', +120748: ' 03B3', +120749: ' 03B4', +120750: ' 03B5', +120751: ' 03B6', +120752: ' 03B7', +120753: ' 03B8', +120754: ' 03B9', +120755: ' 03BA', +120756: ' 03BB', +120757: ' 03BC', +120758: ' 03BD', +120759: ' 03BE', +120760: ' 03BF', +120761: ' 03C0', +120762: ' 03C1', +120763: ' 03C2', +120764: ' 03C3', +120765: ' 03C4', +120766: ' 03C5', +120767: ' 03C6', +120768: ' 03C7', +120769: ' 03C8', +120770: ' 03C9', +120771: ' 2202', +120772: ' 03F5', +120773: ' 03D1', +120774: ' 03F0', +120775: ' 03D5', +120776: ' 03F1', +120777: ' 03D6', +120782: ' 0030', +120783: ' 0031', +120784: ' 0032', +120785: ' 0033', +120786: ' 0034', +120787: ' 0035', +120788: ' 0036', +120789: ' 0037', +120790: ' 0038', +120791: ' 0039', +120792: ' 0030', +120793: ' 0031', +120794: ' 0032', +120795: ' 0033', +120796: ' 0034', +120797: ' 0035', +120798: ' 0036', +120799: ' 0037', +120800: ' 0038', +120801: ' 0039', +120802: ' 0030', +120803: ' 0031', +120804: ' 0032', +120805: ' 0033', +120806: ' 0034', +120807: ' 0035', +120808: ' 0036', +120809: ' 0037', +120810: ' 0038', +120811: ' 0039', +120812: ' 0030', +120813: ' 0031', +120814: ' 0032', +120815: ' 0033', +120816: ' 0034', +120817: ' 0035', +120818: ' 0036', +120819: ' 0037', +120820: ' 0038', +120821: ' 0039', +120822: ' 0030', +120823: ' 0031', +120824: ' 0032', +120825: ' 0033', +120826: ' 0034', +120827: ' 0035', +120828: ' 0036', +120829: ' 0037', +120830: ' 0038', +120831: ' 0039', +194560: '4E3D', +194561: '4E38', +194562: '4E41', +194563: '20122', +194564: '4F60', +194565: '4FAE', +194566: '4FBB', +194567: '5002', +194568: '507A', +194569: '5099', +194570: '50E7', +194571: '50CF', +194572: '349E', +194573: '2063A', +194574: '514D', +194575: '5154', +194576: '5164', +194577: '5177', +194578: '2051C', +194579: '34B9', +194580: '5167', +194581: '518D', +194582: '2054B', +194583: '5197', +194584: '51A4', +194585: '4ECC', +194586: '51AC', +194587: '51B5', +194588: '291DF', +194589: '51F5', +194590: '5203', +194591: '34DF', +194592: '523B', +194593: '5246', +194594: '5272', +194595: '5277', +194596: '3515', +194597: '52C7', +194598: '52C9', +194599: '52E4', +194600: '52FA', +194601: '5305', +194602: '5306', +194603: '5317', +194604: '5349', +194605: '5351', +194606: '535A', +194607: '5373', +194608: '537D', +194609: '537F', +194610: '537F', +194611: '537F', +194612: '20A2C', +194613: '7070', +194614: '53CA', +194615: '53DF', +194616: '20B63', +194617: '53EB', +194618: '53F1', +194619: '5406', +194620: '549E', +194621: '5438', +194622: '5448', +194623: '5468', +194624: '54A2', +194625: '54F6', +194626: '5510', +194627: '5553', +194628: '5563', +194629: '5584', +194630: '5584', +194631: '5599', +194632: '55AB', +194633: '55B3', +194634: '55C2', +194635: '5716', +194636: '5606', +194637: '5717', +194638: '5651', +194639: '5674', +194640: '5207', +194641: '58EE', +194642: '57CE', +194643: '57F4', +194644: '580D', +194645: '578B', +194646: '5832', +194647: '5831', +194648: '58AC', +194649: '214E4', +194650: '58F2', +194651: '58F7', +194652: '5906', +194653: '591A', +194654: '5922', +194655: '5962', +194656: '216A8', +194657: '216EA', +194658: '59EC', +194659: '5A1B', +194660: '5A27', +194661: '59D8', +194662: '5A66', +194663: '36EE', +194664: '2136A', +194665: '5B08', +194666: '5B3E', +194667: '5B3E', +194668: '219C8', +194669: '5BC3', +194670: '5BD8', +194671: '5BE7', +194672: '5BF3', +194673: '21B18', +194674: '5BFF', +194675: '5C06', +194676: '5F33', +194677: '5C22', +194678: '3781', +194679: '5C60', +194680: '5C6E', +194681: '5CC0', +194682: '5C8D', +194683: '21DE4', +194684: '5D43', +194685: '21DE6', +194686: '5D6E', +194687: '5D6B', +194688: '5D7C', +194689: '5DE1', +194690: '5DE2', +194691: '382F', +194692: '5DFD', +194693: '5E28', +194694: '5E3D', +194695: '5E69', +194696: '3862', +194697: '22183', +194698: '387C', +194699: '5EB0', +194700: '5EB3', +194701: '5EB6', +194702: '5ECA', +194703: '2A392', +194704: '5EFE', +194705: '22331', +194706: '22331', +194707: '8201', +194708: '5F22', +194709: '5F22', +194710: '38C7', +194711: '232B8', +194712: '261DA', +194713: '5F62', +194714: '5F6B', +194715: '38E3', +194716: '5F9A', +194717: '5FCD', +194718: '5FD7', +194719: '5FF9', +194720: '6081', +194721: '393A', +194722: '391C', +194723: '6094', +194724: '226D4', +194725: '60C7', +194726: '6148', +194727: '614C', +194728: '614E', +194729: '614C', +194730: '617A', +194731: '618E', +194732: '61B2', +194733: '61A4', +194734: '61AF', +194735: '61DE', +194736: '61F2', +194737: '61F6', +194738: '6210', +194739: '621B', +194740: '625D', +194741: '62B1', +194742: '62D4', +194743: '6350', +194744: '22B0C', +194745: '633D', +194746: '62FC', +194747: '6368', +194748: '6383', +194749: '63E4', +194750: '22BF1', +194751: '6422', +194752: '63C5', +194753: '63A9', +194754: '3A2E', +194755: '6469', +194756: '647E', +194757: '649D', +194758: '6477', +194759: '3A6C', +194760: '654F', +194761: '656C', +194762: '2300A', +194763: '65E3', +194764: '66F8', +194765: '6649', +194766: '3B19', +194767: '6691', +194768: '3B08', +194769: '3AE4', +194770: '5192', +194771: '5195', +194772: '6700', +194773: '669C', +194774: '80AD', +194775: '43D9', +194776: '6717', +194777: '671B', +194778: '6721', +194779: '675E', +194780: '6753', +194781: '233C3', +194782: '3B49', +194783: '67FA', +194784: '6785', +194785: '6852', +194786: '6885', +194787: '2346D', +194788: '688E', +194789: '681F', +194790: '6914', +194791: '3B9D', +194792: '6942', +194793: '69A3', +194794: '69EA', +194795: '6AA8', +194796: '236A3', +194797: '6ADB', +194798: '3C18', +194799: '6B21', +194800: '238A7', +194801: '6B54', +194802: '3C4E', +194803: '6B72', +194804: '6B9F', +194805: '6BBA', +194806: '6BBB', +194807: '23A8D', +194808: '21D0B', +194809: '23AFA', +194810: '6C4E', +194811: '23CBC', +194812: '6CBF', +194813: '6CCD', +194814: '6C67', +194815: '6D16', +194816: '6D3E', +194817: '6D77', +194818: '6D41', +194819: '6D69', +194820: '6D78', +194821: '6D85', +194822: '23D1E', +194823: '6D34', +194824: '6E2F', +194825: '6E6E', +194826: '3D33', +194827: '6ECB', +194828: '6EC7', +194829: '23ED1', +194830: '6DF9', +194831: '6F6E', +194832: '23F5E', +194833: '23F8E', +194834: '6FC6', +194835: '7039', +194836: '701E', +194837: '701B', +194838: '3D96', +194839: '704A', +194840: '707D', +194841: '7077', +194842: '70AD', +194843: '20525', +194844: '7145', +194845: '24263', +194846: '719C', +194847: '43AB', +194848: '7228', +194849: '7235', +194850: '7250', +194851: '24608', +194852: '7280', +194853: '7295', +194854: '24735', +194855: '24814', +194856: '737A', +194857: '738B', +194858: '3EAC', +194859: '73A5', +194860: '3EB8', +194861: '3EB8', +194862: '7447', +194863: '745C', +194864: '7471', +194865: '7485', +194866: '74CA', +194867: '3F1B', +194868: '7524', +194869: '24C36', +194870: '753E', +194871: '24C92', +194872: '7570', +194873: '2219F', +194874: '7610', +194875: '24FA1', +194876: '24FB8', +194877: '25044', +194878: '3FFC', +194879: '4008', +194880: '76F4', +194881: '250F3', +194882: '250F2', +194883: '25119', +194884: '25133', +194885: '771E', +194886: '771F', +194887: '771F', +194888: '774A', +194889: '4039', +194890: '778B', +194891: '4046', +194892: '4096', +194893: '2541D', +194894: '784E', +194895: '788C', +194896: '78CC', +194897: '40E3', +194898: '25626', +194899: '7956', +194900: '2569A', +194901: '256C5', +194902: '798F', +194903: '79EB', +194904: '412F', +194905: '7A40', +194906: '7A4A', +194907: '7A4F', +194908: '2597C', +194909: '25AA7', +194910: '25AA7', +194911: '7AAE', +194912: '4202', +194913: '25BAB', +194914: '7BC6', +194915: '7BC9', +194916: '4227', +194917: '25C80', +194918: '7CD2', +194919: '42A0', +194920: '7CE8', +194921: '7CE3', +194922: '7D00', +194923: '25F86', +194924: '7D63', +194925: '4301', +194926: '7DC7', +194927: '7E02', +194928: '7E45', +194929: '4334', +194930: '26228', +194931: '26247', +194932: '4359', +194933: '262D9', +194934: '7F7A', +194935: '2633E', +194936: '7F95', +194937: '7FFA', +194938: '8005', +194939: '264DA', +194940: '26523', +194941: '8060', +194942: '265A8', +194943: '8070', +194944: '2335F', +194945: '43D5', +194946: '80B2', +194947: '8103', +194948: '440B', +194949: '813E', +194950: '5AB5', +194951: '267A7', +194952: '267B5', +194953: '23393', +194954: '2339C', +194955: '8201', +194956: '8204', +194957: '8F9E', +194958: '446B', +194959: '8291', +194960: '828B', +194961: '829D', +194962: '52B3', +194963: '82B1', +194964: '82B3', +194965: '82BD', +194966: '82E6', +194967: '26B3C', +194968: '82E5', +194969: '831D', +194970: '8363', +194971: '83AD', +194972: '8323', +194973: '83BD', +194974: '83E7', +194975: '8457', +194976: '8353', +194977: '83CA', +194978: '83CC', +194979: '83DC', +194980: '26C36', +194981: '26D6B', +194982: '26CD5', +194983: '452B', +194984: '84F1', +194985: '84F3', +194986: '8516', +194987: '273CA', +194988: '8564', +194989: '26F2C', +194990: '455D', +194991: '4561', +194992: '26FB1', +194993: '270D2', +194994: '456B', +194995: '8650', +194996: '865C', +194997: '8667', +194998: '8669', +194999: '86A9', +195000: '8688', +195001: '870E', +195002: '86E2', +195003: '8779', +195004: '8728', +195005: '876B', +195006: '8786', +195007: '4D57', +195008: '87E1', +195009: '8801', +195010: '45F9', +195011: '8860', +195012: '8863', +195013: '27667', +195014: '88D7', +195015: '88DE', +195016: '4635', +195017: '88FA', +195018: '34BB', +195019: '278AE', +195020: '27966', +195021: '46BE', +195022: '46C7', +195023: '8AA0', +195024: '8AED', +195025: '8B8A', +195026: '8C55', +195027: '27CA8', +195028: '8CAB', +195029: '8CC1', +195030: '8D1B', +195031: '8D77', +195032: '27F2F', +195033: '20804', +195034: '8DCB', +195035: '8DBC', +195036: '8DF0', +195037: '208DE', +195038: '8ED4', +195039: '8F38', +195040: '285D2', +195041: '285ED', +195042: '9094', +195043: '90F1', +195044: '9111', +195045: '2872E', +195046: '911B', +195047: '9238', +195048: '92D7', +195049: '92D8', +195050: '927C', +195051: '93F9', +195052: '9415', +195053: '28BFA', +195054: '958B', +195055: '4995', +195056: '95B7', +195057: '28D77', +195058: '49E6', +195059: '96C3', +195060: '5DB2', +195061: '9723', +195062: '29145', +195063: '2921A', +195064: '4A6E', +195065: '4A76', +195066: '97E0', +195067: '2940A', +195068: '4AB2', +195069: '29496', +195070: '980B', +195071: '980B', +195072: '9829', +195073: '295B6', +195074: '98E2', +195075: '4B33', +195076: '9929', +195077: '99A7', +195078: '99C2', +195079: '99FE', +195080: '4BCE', +195081: '29B30', +195082: '9B12', +195083: '9C40', +195084: '9CFD', +195085: '4CCE', +195086: '4CED', +195087: '9D67', +195088: '2A0CE', +195089: '4CF8', +195090: '2A105', +195091: '2A20E', +195092: '2A291', +195093: '9EBB', +195094: '4D56', +195095: '9EF9', +195096: '9EFE', +195097: '9F05', +195098: '9F0F', +195099: '9F16', +195100: '9F3B', +195101: '2A600', } -def mirrored(code): - return _mirrored.get(code, 0) - - -_mirrored = { -40: 1, -41: 1, -60: 1, -62: 1, -91: 1, -93: 1, -123: 1, -125: 1, -171: 1, -187: 1, -8249: 1, -8250: 1, -8261: 1, -8262: 1, -8317: 1, -8318: 1, -8333: 1, -8334: 1, -8512: 1, -8705: 1, -8706: 1, -8707: 1, -8708: 1, -8712: 1, -8713: 1, -8714: 1, -8715: 1, -8716: 1, -8717: 1, -8721: 1, -8725: 1, -8726: 1, -8730: 1, -8731: 1, -8732: 1, -8733: 1, -8735: 1, -8736: 1, -8737: 1, -8738: 1, -8740: 1, -8742: 1, -8747: 1, -8748: 1, -8749: 1, -8750: 1, -8751: 1, -8752: 1, -8753: 1, -8754: 1, -8755: 1, -8761: 1, -8763: 1, -8764: 1, -8765: 1, -8766: 1, -8767: 1, -8768: 1, -8769: 1, -8770: 1, -8771: 1, -8772: 1, -8773: 1, -8774: 1, -8775: 1, -8776: 1, -8777: 1, -8778: 1, -8779: 1, -8780: 1, -8786: 1, -8787: 1, -8788: 1, -8789: 1, -8799: 1, -8800: 1, -8802: 1, -8804: 1, -8805: 1, -8806: 1, -8807: 1, -8808: 1, -8809: 1, -8810: 1, -8811: 1, -8814: 1, -8815: 1, -8816: 1, -8817: 1, -8818: 1, -8819: 1, -8820: 1, -8821: 1, -8822: 1, -8823: 1, -8824: 1, -8825: 1, -8826: 1, -8827: 1, -8828: 1, -8829: 1, -8830: 1, -8831: 1, -8832: 1, -8833: 1, -8834: 1, -8835: 1, -8836: 1, -8837: 1, -8838: 1, -8839: 1, -8840: 1, -8841: 1, -8842: 1, -8843: 1, -8844: 1, -8847: 1, -8848: 1, -8849: 1, -8850: 1, -8856: 1, -8866: 1, -8867: 1, -8870: 1, -8871: 1, -8872: 1, -8873: 1, -8874: 1, -8875: 1, -8876: 1, -8877: 1, -8878: 1, -8879: 1, -8880: 1, -8881: 1, -8882: 1, -8883: 1, -8884: 1, -8885: 1, -8886: 1, -8887: 1, -8888: 1, -8894: 1, -8895: 1, -8905: 1, -8906: 1, -8907: 1, -8908: 1, -8909: 1, -8912: 1, -8913: 1, -8918: 1, -8919: 1, -8920: 1, -8921: 1, -8922: 1, -8923: 1, -8924: 1, -8925: 1, -8926: 1, -8927: 1, -8928: 1, -8929: 1, -8930: 1, -8931: 1, -8932: 1, -8933: 1, -8934: 1, -8935: 1, -8936: 1, -8937: 1, -8938: 1, -8939: 1, -8940: 1, -8941: 1, -8944: 1, -8945: 1, -8946: 1, -8947: 1, -8948: 1, -8949: 1, -8950: 1, -8951: 1, -8952: 1, -8953: 1, -8954: 1, -8955: 1, -8956: 1, -8957: 1, -8958: 1, -8959: 1, -8968: 1, -8969: 1, -8970: 1, -8971: 1, -8992: 1, -8993: 1, -9001: 1, -9002: 1, -10088: 1, -10089: 1, -10090: 1, -10091: 1, -10092: 1, -10093: 1, -10094: 1, -10095: 1, -10096: 1, -10097: 1, -10098: 1, -10099: 1, -10100: 1, -10101: 1, -10195: 1, -10196: 1, -10197: 1, -10198: 1, -10204: 1, -10205: 1, -10206: 1, -10210: 1, -10211: 1, -10212: 1, -10213: 1, -10214: 1, -10215: 1, -10216: 1, -10217: 1, -10218: 1, -10219: 1, -10627: 1, -10628: 1, -10629: 1, -10630: 1, -10631: 1, -10632: 1, -10633: 1, -10634: 1, -10635: 1, -10636: 1, -10637: 1, -10638: 1, -10639: 1, -10640: 1, -10641: 1, -10642: 1, -10643: 1, -10644: 1, -10645: 1, -10646: 1, -10647: 1, -10648: 1, -10651: 1, -10652: 1, -10653: 1, -10654: 1, -10655: 1, -10656: 1, -10657: 1, -10658: 1, -10659: 1, -10660: 1, -10661: 1, -10662: 1, -10663: 1, -10664: 1, -10665: 1, -10666: 1, -10667: 1, -10668: 1, -10669: 1, -10670: 1, -10671: 1, -10680: 1, -10688: 1, -10689: 1, -10690: 1, -10691: 1, -10692: 1, -10693: 1, -10697: 1, -10702: 1, -10703: 1, -10704: 1, -10705: 1, -10706: 1, -10708: 1, -10709: 1, -10712: 1, -10713: 1, -10714: 1, -10715: 1, -10716: 1, -10721: 1, -10723: 1, -10724: 1, -10725: 1, -10728: 1, -10729: 1, -10740: 1, -10741: 1, -10742: 1, -10743: 1, -10744: 1, -10745: 1, -10748: 1, -10749: 1, -10762: 1, -10763: 1, -10764: 1, -10765: 1, -10766: 1, -10767: 1, -10768: 1, -10769: 1, -10770: 1, -10771: 1, -10772: 1, -10773: 1, -10774: 1, -10775: 1, -10776: 1, -10777: 1, -10778: 1, -10779: 1, -10780: 1, -10782: 1, -10783: 1, -10784: 1, -10785: 1, -10788: 1, -10790: 1, -10793: 1, -10795: 1, -10796: 1, -10797: 1, -10798: 1, -10804: 1, -10805: 1, -10812: 1, -10813: 1, -10814: 1, -10839: 1, -10840: 1, -10852: 1, -10853: 1, -10858: 1, -10859: 1, -10860: 1, -10861: 1, -10863: 1, -10864: 1, -10867: 1, -10868: 1, -10873: 1, -10874: 1, -10875: 1, -10876: 1, -10877: 1, -10878: 1, -10879: 1, -10880: 1, -10881: 1, -10882: 1, -10883: 1, -10884: 1, -10885: 1, -10886: 1, -10887: 1, -10888: 1, -10889: 1, -10890: 1, -10891: 1, -10892: 1, -10893: 1, -10894: 1, -10895: 1, -10896: 1, -10897: 1, -10898: 1, -10899: 1, -10900: 1, -10901: 1, -10902: 1, -10903: 1, -10904: 1, -10905: 1, -10906: 1, -10907: 1, -10908: 1, -10909: 1, -10910: 1, -10911: 1, -10912: 1, -10913: 1, -10914: 1, -10915: 1, -10918: 1, -10919: 1, -10920: 1, -10921: 1, -10922: 1, -10923: 1, -10924: 1, -10925: 1, -10927: 1, -10928: 1, -10929: 1, -10930: 1, -10931: 1, -10932: 1, -10933: 1, -10934: 1, -10935: 1, -10936: 1, -10937: 1, -10938: 1, -10939: 1, -10940: 1, -10941: 1, -10942: 1, -10943: 1, -10944: 1, -10945: 1, -10946: 1, -10947: 1, -10948: 1, -10949: 1, -10950: 1, -10951: 1, -10952: 1, -10953: 1, -10954: 1, -10955: 1, -10956: 1, -10957: 1, -10958: 1, -10959: 1, -10960: 1, -10961: 1, -10962: 1, -10963: 1, -10964: 1, -10965: 1, -10966: 1, -10972: 1, -10974: 1, -10978: 1, -10979: 1, -10980: 1, -10981: 1, -10982: 1, -10988: 1, -10989: 1, -10990: 1, -10995: 1, -10999: 1, -11000: 1, -11001: 1, -11002: 1, -11003: 1, -11005: 1, -12296: 1, -12297: 1, -12298: 1, -12299: 1, -12300: 1, -12301: 1, -12302: 1, -12303: 1, -12304: 1, -12305: 1, -12308: 1, -12309: 1, -12310: 1, -12311: 1, -12312: 1, -12313: 1, -12314: 1, -12315: 1, -65288: 1, -65289: 1, -65308: 1, -65310: 1, -65339: 1, -65341: 1, -65371: 1, -65373: 1, -65375: 1, -65376: 1, -65378: 1, -65379: 1, -} - - -def mirrored(code): - return _mirrored.get(code, 0) +def decompisition(code): + return _decomposition.get(code,'') From pedronis at codespeak.net Thu May 19 17:42:44 2005 From: pedronis at codespeak.net (pedronis at codespeak.net) Date: Thu, 19 May 2005 17:42:44 +0200 (CEST) Subject: [pypy-svn] r12549 - pypy/dist/pypy/documentation Message-ID: <20050519154244.4E9F727BA4@code1.codespeak.net> Author: pedronis Date: Thu May 19 17:42:44 2005 New Revision: 12549 Modified: pypy/dist/pypy/documentation/coding-guide.txt Log: include is_w, eq_w in the discussion Modified: pypy/dist/pypy/documentation/coding-guide.txt ============================================================================== --- pypy/dist/pypy/documentation/coding-guide.txt (original) +++ pypy/dist/pypy/documentation/coding-guide.txt Thu May 19 17:42:44 2005 @@ -367,7 +367,7 @@ * ``space.is_true(w_x)``: checks if the given wrapped object is considered to be ``True`` or ``False``. You must never use the truth-value of ``w_x`` directly; doing so (e.g. writing ``if w_x:``) will give you an error reminding you of the problem. -* ``w_x == w_y`` or ``w_x is w_y``: DON'T DO THAT. The only half-official exception is to check if ``w_x`` contains a wrapped ``None``: you can write ``w_x == space.w_None``. Follow this rule; the case of ``None`` is easy to fix globally later if we find out that we need to. The rationale for this rule is that there is no reason that two wrappers are related in any way even if they contain what looks like the same object at application-level. To check for equality, use ``space.is_true(space.eq(w_x, w_y))``. To check for identity, use ``space.is_true(space.is_(w_x, w_y))``. +* ``w_x == w_y`` or ``w_x is w_y``: DON'T DO THAT. The only half-official exception is to check if ``w_x`` contains a wrapped ``None``: you can write ``w_x == space.w_None``. Follow this rule; the case of ``None`` is easy to fix globally later if we find out that we need to. The rationale for this rule is that there is no reason that two wrappers are related in any way even if they contain what looks like the same object at application-level. To check for equality, use ``space.is_true(space.eq(w_x, w_y))`` or even better the short-cut ``space.eq_w(w_x, w_y)`` returning directly a interpreter-level bool. To check for identity, use ``space.is_true(space.is_(w_x, w_y))`` or better ``space.is_w(w_x, w_y)``. * ``space.unpackiterable(w_x)``: this helper iterates ``w_x`` (using ``space.iter()`` and ``space.next()``) and collects the resulting wrapped objects in a list. Of course, in cases where iterating directly is better than collecting the elements in a list first, you should use ``space.iter()`` and ``space.next()`` directly. From arigo at codespeak.net Thu May 19 18:04:08 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Thu, 19 May 2005 18:04:08 +0200 (CEST) Subject: [pypy-svn] r12551 - pypy/dist/pypy/translator/genc/test Message-ID: <20050519160408.E352E27B9E@code1.codespeak.net> Author: arigo Date: Thu May 19 18:04:08 2005 New Revision: 12551 Modified: pypy/dist/pypy/translator/genc/test/test_typed.py Log: issue57 testing These were the last failing tests on AMD64. Skip them for now on non-32-bit platforms. Modified: pypy/dist/pypy/translator/genc/test/test_typed.py ============================================================================== --- pypy/dist/pypy/translator/genc/test/test_typed.py (original) +++ pypy/dist/pypy/translator/genc/test/test_typed.py Thu May 19 18:04:08 2005 @@ -28,16 +28,16 @@ def test_int_overflow(self): fn = self.getcompiled(snippet.add_func) - raises(OverflowError, fn, sys.maxint) + raises(OverflowError, fn, sys_maxint()) def test_int_div_ovf_zer(self): # - py.test.skip("right now aborting python wiht Floating Point Error!") + py.test.skip("right now aborting python with Floating Point Error!") fn = self.getcompiled(snippet.div_func) raises(OverflowError, fn, -1) raises(ZeroDivisionError, fn, 0) def test_int_mod_ovf_zer(self): - py.test.skip("right now aborting python wiht Floating Point Error!") + py.test.skip("right now aborting python with Floating Point Error!") fn = self.getcompiled(snippet.mod_func) raises(OverflowError, fn, -1) raises(ZeroDivisionError, fn, 0) @@ -55,5 +55,10 @@ fn = self.getcompiled(snippet.unary_func) for i in range(-3,3): assert fn(i) == (-(i), abs(i-1)) - raises (OverflowError, fn, -sys.maxint-1) - raises (OverflowError, fn, -sys.maxint) + raises (OverflowError, fn, -sys_maxint()-1) + raises (OverflowError, fn, -sys_maxint()) + +def sys_maxint(): + if sys.maxint != 2147483647: + py.test.skip("genc ovf incomplete: int might differ from long") + return sys.maxint From pedronis at codespeak.net Thu May 19 18:11:55 2005 From: pedronis at codespeak.net (pedronis at codespeak.net) Date: Thu, 19 May 2005 18:11:55 +0200 (CEST) Subject: [pypy-svn] r12552 - pypy/dist/pypy/documentation Message-ID: <20050519161155.12AD727B9E@code1.codespeak.net> Author: pedronis Date: Thu May 19 18:11:54 2005 New Revision: 12552 Modified: pypy/dist/pypy/documentation/coding-guide.txt Log: issue64 testing reworked a bit the sections Object restrictions and a new Flow restrictions to approximate better current reality (annotator ...) Modified: pypy/dist/pypy/documentation/coding-guide.txt ============================================================================== --- pypy/dist/pypy/documentation/coding-guide.txt (original) +++ pypy/dist/pypy/documentation/coding-guide.txt Thu May 19 18:11:54 2005 @@ -90,23 +90,48 @@ .. _`wrapped object`: coding-guide.html#wrapping-rules -Object restrictions +Flow restrictions ------------------------- -We are using - **variables** - the same variable in the same context can receive values of different types, - at a possible overhead cost. For example, a variable that can contain a - `wrapped object`_ or None is efficiently implemented as a PyObject* pointer that - can be NULL, but a variable that can contain either an integer or a float must - be implemented as a union with a type tag in C. + variables should contain values of at most one type as described in `Object restrictions`_ + at each control flow point, that means that joining control paths using the same variable + to contain both a float and a int should be avoided. Mixing None (basically with the role of + a null pointer) and `wrapped objects` and class instances is allowed. **constants** all module globals are considered constants. +**control structures** + + all allowed + +**range** + + does not create an array. It is only allowed in for loops. The step argument + must be a constant. + +**definitions** + + run-time definition of classes or functions is not allowed. + +**generators** + + generators are not supported. + +**exceptions** + ++ fully supported ++ see below `Exception rules`_ for restrictions on exceptions raised by built-in operations + + +Object restrictions +------------------------- + +We are using + **integer, float, string, boolean** avoid string methods and complex operations like slicing with a step @@ -114,7 +139,8 @@ **tuples** no variable-length tuples; use them to store or return pairs or n-tuples of - values + values. Each combination of types for elements and length constitute a separate + and not mixable type. **lists** @@ -129,9 +155,6 @@ interned in CPython, i.e. short strings that look like identifiers). The implementation could safely decide that all dict keys should be interned. -**control structures** - - all allowed **list comprehensions** @@ -153,11 +176,6 @@ A few builtin functions will be used, while this set is not defined completely, yet. Some builtin functions are special forms: -**range** - - does not create an array. It is only allowed in for loops. The step argument - must be a constant. - **len** + may be used with basic types that have a length. But len is a special form @@ -176,11 +194,6 @@ + inheritance is supported + classes are first-class objects too -**exceptions** - -+ fully supported -+ see below for restrictions on exceptions raised by built-in operations - **objects** wrapped objects are borrowed from the object space. Just like in CPython, code From arigo at codespeak.net Thu May 19 18:13:01 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Thu, 19 May 2005 18:13:01 +0200 (CEST) Subject: [pypy-svn] r12553 - in pypy/dist/pypy: documentation documentation/tool translator/goal translator/pyrex/Pyrex Message-ID: <20050519161301.E49B527B9E@code1.codespeak.net> Author: arigo Date: Thu May 19 18:13:01 2005 New Revision: 12553 Modified: pypy/dist/pypy/documentation/_ref.txt (props changed) pypy/dist/pypy/documentation/svn-help.txt (props changed) pypy/dist/pypy/documentation/tool/ (props changed) pypy/dist/pypy/documentation/tool/__init__.py (props changed) pypy/dist/pypy/documentation/tool/makeref.py (props changed) pypy/dist/pypy/translator/goal/__init__.py (props changed) pypy/dist/pypy/translator/pyrex/Pyrex/conftest.py (props changed) Log: fixeol. From pedronis at codespeak.net Thu May 19 18:15:43 2005 From: pedronis at codespeak.net (pedronis at codespeak.net) Date: Thu, 19 May 2005 18:15:43 +0200 (CEST) Subject: [pypy-svn] r12554 - pypy/dist/pypy/documentation Message-ID: <20050519161543.188B127B9E@code1.codespeak.net> Author: pedronis Date: Thu May 19 18:15:42 2005 New Revision: 12554 Modified: pypy/dist/pypy/documentation/coding-guide.txt Log: added "for example" Modified: pypy/dist/pypy/documentation/coding-guide.txt ============================================================================== --- pypy/dist/pypy/documentation/coding-guide.txt (original) +++ pypy/dist/pypy/documentation/coding-guide.txt Thu May 19 18:15:42 2005 @@ -95,10 +95,12 @@ **variables** - variables should contain values of at most one type as described in `Object restrictions`_ - at each control flow point, that means that joining control paths using the same variable - to contain both a float and a int should be avoided. Mixing None (basically with the role of - a null pointer) and `wrapped objects` and class instances is allowed. + variables should contain values of at most one type as described in + `Object restrictions`_ at each control flow point, that means for + example that joining control paths using the same variable to + contain both a float and a int should be avoided. Mixing None + (basically with the role of a null pointer) and `wrapped objects` + and class instances is allowed. **constants** From hpk at codespeak.net Thu May 19 19:28:00 2005 From: hpk at codespeak.net (hpk at codespeak.net) Date: Thu, 19 May 2005 19:28:00 +0200 (CEST) Subject: [pypy-svn] r12557 - in pypy/dist/pypy/documentation: . tool Message-ID: <20050519172800.7416527B9C@code1.codespeak.net> Author: hpk Date: Thu May 19 19:28:00 2005 New Revision: 12557 Added: pypy/dist/pypy/documentation/contributor.txt pypy/dist/pypy/documentation/tool/makecontributor.py Modified: pypy/dist/pypy/documentation/release-0.6.txt Log: issue16 testing as discussed with Samuele there is now a contributor-list and finalizing touches to the release-0.6 announcement. Added: pypy/dist/pypy/documentation/contributor.txt ============================================================================== --- (empty file) +++ pypy/dist/pypy/documentation/contributor.txt Thu May 19 19:28:00 2005 @@ -0,0 +1,43 @@ + +Contributors to PyPy +==================== + +Here is a list of developers who have committed to the PyPy source +code base, ordered by number of commits (which is certainly not a very +appropriate measure but it's something):: + + Armin Rigo + Samuele Pedroni + Holger Krekel + Michael Hudson + Christian Tismer + Seo Sanghyeon + Alex Martelli + Stefan Schwarzer + Tomek Meka + Patrick Maupin + Carl Friedrich Bolz + Bob Ippolito + Anders Chrigstrom + Jacob Hallen + Marius Gedminas + Laura Creighton + Guido Van Rossum + Richard Emslie + Ludovic Aubry + Adrien Di Mascio + Stephan Diehl + Dinu Gherman + Guenter Jantzen + Anders Lehmann + Rocco Moretti + Olivier Dormond + Brian Dorsey + Jonathan David Riehl + Andreas Friedge + Jens-Uwe Mager + Alan McIntyre + Lutz Paelike + Jacek Generowicz + Ben Young + Michael Chermside Modified: pypy/dist/pypy/documentation/release-0.6.txt ============================================================================== --- pypy/dist/pypy/documentation/release-0.6.txt (original) +++ pypy/dist/pypy/documentation/release-0.6.txt Thu May 19 19:28:00 2005 @@ -84,24 +84,31 @@ that does not need to be interpreted by CPython anymore and will thus run considerably faster than the 0.6 preview release. -Please feel free to give feedback and raise questions. Here is -how you can contact or join us: - - http://codespeak.net/pypy/index.cgi?contact - PyPy has been a community effort from the start and it would not have got that far without the coding and feedback support -from numerous people. (XXX insert some link here?) +from numerous people. Please feel free to give feedback and +raise questions. + + contact points: http://codespeak.net/pypy/index.cgi?contact + contributor list: http://codespeak.net/pypy/index.cgi?doc/contributor.html have fun, - the PyPy Development Team + Armin Rigo, Samuele Pedronis, + + Holger Krekel, Christian Tismer, + + Carl Friedrich Bolz -Project Setup and Acknowledgements: + PyPy development and activities happen as an open source project under + the http://codespeak.net/ umbrella and with the support of a + consortium funded by a EU IST research grant. Here is a list of + partners of the EU project: + + Heinrich-Heine University (Germany), AB Strakt (Sweden) -PyPy development and activities happens as open source project under -the http://codespeak.net/ umbrella and with the support of a -consortium funded by a EU IST research grant: + merlinux GmbH (Germany), tismerysoft GmbH(Germany) -**(xxx consortium partners?? )** + Logilab Paris (France), DFKI GmbH (Germany) + Added: pypy/dist/pypy/documentation/tool/makecontributor.py ============================================================================== --- (empty file) +++ pypy/dist/pypy/documentation/tool/makecontributor.py Thu May 19 19:28:00 2005 @@ -0,0 +1,31 @@ +""" + +generates a contributor list + +""" +import py + +try: + path = py.std.sys.argv[1] +except IndexError: + print "usage: %s PATH" %(py.std.sys.argv[0]) + raise SystemExit, 1 + +d = {} + +for logentry in py.path.svnwc(py.std.sys.argv[1]).log(): + a = logentry.author + if a in d: + d[a] += 1 + else: + d[a] = 1 + +items = d.items() +items.sort(lambda x,y: -cmp(x[1], y[1])) + +import uconf # http://codespeak.net/svn/uconf/dist/uconf + +for author, count in items: + realname = uconf.system.User(author).realname # only works on codespeak + print " ", realname + From tismer at codespeak.net Thu May 19 19:29:22 2005 From: tismer at codespeak.net (tismer at codespeak.net) Date: Thu, 19 May 2005 19:29:22 +0200 (CEST) Subject: [pypy-svn] r12558 - in pypy/dist/pypy: annotation interpreter module/builtin module/recparser objspace/flow objspace/std translator translator/test Message-ID: <20050519172922.BB67727B9C@code1.codespeak.net> Author: tismer Date: Thu May 19 19:29:22 2005 New Revision: 12558 Modified: pypy/dist/pypy/annotation/builtin.py pypy/dist/pypy/interpreter/gateway.py pypy/dist/pypy/interpreter/pyopcode.py pypy/dist/pypy/module/builtin/app_inspect.py pypy/dist/pypy/module/recparser/pyparser.py pypy/dist/pypy/objspace/flow/objspace.py pypy/dist/pypy/objspace/flow/specialcase.py pypy/dist/pypy/objspace/std/stringobject.py pypy/dist/pypy/translator/geninterplevel.py pypy/dist/pypy/translator/test/rpystone.py pypy/dist/pypy/translator/translator.py Log: issue46 resolved issue10 resulved - sys import works and behaves as expected - print works in flow space, and probably many other things - do_imports flag has vanished. The is no more any difference between flowing geninterp or anything else Modified: pypy/dist/pypy/annotation/builtin.py ============================================================================== --- pypy/dist/pypy/annotation/builtin.py (original) +++ pypy/dist/pypy/annotation/builtin.py Thu May 19 19:29:22 2005 @@ -195,9 +195,6 @@ def time_func(): return SomeFloat() -def write_func(*args): - return SomeBool() - # XXX I would like to use SomeNone here. How? # collect all functions import __builtin__ @@ -236,9 +233,6 @@ BUILTIN_ANALYZERS[time.time] = time_func BUILTIN_ANALYZERS[time.clock] = time_func -# sys.stdout -BUILTIN_ANALYZERS[sys.stdout.write] = write_func - # annotation of low-level types from pypy.annotation.model import SomePtr from pypy.rpython import lltypes Modified: pypy/dist/pypy/interpreter/gateway.py ============================================================================== --- pypy/dist/pypy/interpreter/gateway.py (original) +++ pypy/dist/pypy/interpreter/gateway.py Thu May 19 19:29:22 2005 @@ -508,11 +508,10 @@ hidden_applevel = True use_geninterp = True # change this to disable geninterp globally - def __init__(self, source, filename = None, modname = '__builtin__', do_imports=False): + def __init__(self, source, filename = None, modname = '__builtin__'): self.filename = filename self.source = source self.modname = modname - self.do_imports = do_imports # look at the first three lines for a NOT_RPYTHON tag first = source.split("\n", 3)[:3] for line in first: @@ -535,6 +534,13 @@ def appcaller(space, *args_w): if not isinstance(space, ObjSpace): raise TypeError("first argument must be a space instance.") + # redirect if the space handles this specially + if hasattr(space, 'specialcases'): + sc = space.specialcases + if ApplevelClass in sc: + ret_w = sc[ApplevelClass](space, self, name, args_w) + if ret_w is not None: # it was RPython + return ret_w args = Arguments(space, list(args_w)) w_func = self.wget(space, name) return space.call_args(w_func, args) @@ -612,7 +618,7 @@ if not initfunc: # build it and put it into a file initfunc, newsrc = translate_as_module( - self.source, self.filename, self.modname, self.do_imports) + self.source, self.filename, self.modname) fname = cls.cache_path.join(name+".py").strpath f = file(fname, "w") print >> f, """\ Modified: pypy/dist/pypy/interpreter/pyopcode.py ============================================================================== --- pypy/dist/pypy/interpreter/pyopcode.py (original) +++ pypy/dist/pypy/interpreter/pyopcode.py Thu May 19 19:29:22 2005 @@ -742,20 +742,15 @@ app = gateway.applevel(r''' """ applevel implementation of certain system properties, imports and other helpers""" - # import sys - # note that sys must be imported inside of - # the functions, or attributes will be - # bound too early by flow space! + import sys def sys_stdout(): - import sys try: return sys.stdout except AttributeError: raise RuntimeError("lost sys.stdout") def print_expr(obj): - import sys try: displayhook = sys.displayhook except AttributeError: Modified: pypy/dist/pypy/module/builtin/app_inspect.py ============================================================================== --- pypy/dist/pypy/module/builtin/app_inspect.py (original) +++ pypy/dist/pypy/module/builtin/app_inspect.py Thu May 19 19:29:22 2005 @@ -1,4 +1,5 @@ """ +NOT_RPYTHON Plain Python definition of the builtin functions related to run-time program introspection. """ @@ -82,7 +83,10 @@ import __builtin__ for c in type(ob).__mro__: if '__call__' in c.__dict__: - if isinstance(ob, __builtin__._instance): # old style instance! + # after do_imports_immediately is always true, + # this is no longer RPython, because _instance + # does not exist at compile time. + if isinstance(ob, __builtin__._instance): # old style instance! return getattr(ob, '__call__', None) is not None return True else: Modified: pypy/dist/pypy/module/recparser/pyparser.py ============================================================================== --- pypy/dist/pypy/module/recparser/pyparser.py (original) +++ pypy/dist/pypy/module/recparser/pyparser.py Thu May 19 19:29:22 2005 @@ -88,7 +88,7 @@ import compiler gen = compiler.pycodegen.ModuleCodeGenerator(compileAST) return gen.getCode() -""", filename=__file__, do_imports=False) +""", filename=__file__) mycompile = app.interphook("mycompile") exprcompile = app.interphook("exprcompile") Modified: pypy/dist/pypy/objspace/flow/objspace.py ============================================================================== --- pypy/dist/pypy/objspace/flow/objspace.py (original) +++ pypy/dist/pypy/objspace/flow/objspace.py Thu May 19 19:29:22 2005 @@ -32,8 +32,6 @@ builtins_can_raise_exceptions = False - do_imports_immediately = True # overridden in geninterplevel - def initialize(self): import __builtin__ self.concrete_mode = 1 @@ -62,6 +60,19 @@ self.specialcases = {} #self.make_builtins() #self.make_sys() + # objects which should keep their SomeObjectness + self.not_really_const = { + Constant(sys): { + Constant('maxint'): True, + Constant('maxunicode'): True, + Constant('api_version'): True, + Constant('exit'): True, + Constant('exc_info'): True, + # this is an incomplete list of true constants. + # if we add much more, a dedicated class + # might be considered for special objects. + } + } def enter_cache_building_mode(self): # when populating the caches, the flow space switches to @@ -330,7 +341,6 @@ except UnwrapException: pass return self.do_operation('setitem', w_obj, w_key, w_val) - def call_args(self, w_callable, args): try: @@ -541,5 +551,27 @@ for line in ObjSpace.MethodTable: make_op(*line) +# override getattr for not really const objects + +def unspecialize(obj): + # turn a constant into SomeObject + # XXX this may become harder when the annotator gets smarter + # maybe we need to add a special treatment like for ovfcheck. + if id(0) != id(None): + return obj + +def override(): + def getattr(self, w_obj, w_name): + if w_obj in self.not_really_const: + const_w = self.not_really_const[w_obj] + if w_name not in const_w: + w_obj = self.do_operation('simple_call', + Constant(unspecialize), w_obj) + return self.regular_getattr(w_obj, w_name) + FlowObjSpace.regular_getattr = FlowObjSpace.getattr + FlowObjSpace.getattr = getattr + +override() + # ______________________________________________________________________ # End of objspace.py Modified: pypy/dist/pypy/objspace/flow/specialcase.py ============================================================================== --- pypy/dist/pypy/objspace/flow/specialcase.py (original) +++ pypy/dist/pypy/objspace/flow/specialcase.py Thu May 19 19:29:22 2005 @@ -2,32 +2,23 @@ from pypy.interpreter import pyframe, baseobjspace from pypy.interpreter.error import OperationError from pypy.objspace.flow.objspace import UnwrapException -from pypy.objspace.flow.model import Constant +from pypy.objspace.flow.model import Constant, Variable from pypy.objspace.flow.operation import OperationName, Arity - -def unspecialize(obj): - # turn a constant into SomeObject - # XXX this may become harder when the annotator gets smarter - # maybe we need to add a special function like ovfcheck. - if id(0) != id(None): - return obj +from pypy.interpreter import pyopcode +from pypy.interpreter.gateway import ApplevelClass +from pypy.tool.cache import Cache +from pypy.tool.sourcetools import NiceCompile, compile2 def sc_import(space, fn, args): w_name, w_glob, w_loc, w_frm = args.fixedunpack(4) - mod = __import__(space.unwrap(w_name), space.unwrap(w_glob), - space.unwrap(w_loc), space.unwrap(w_frm)) - if mod is sys: - return space.do_operation('simple_call', Constant(unspecialize), - Constant(sys)) - else: - return space.wrap(mod) - -def sc_write(space, fn, args): - args_w, kwds_w = args.unpack() - assert kwds_w == {}, "should not call %r with keyword arguments" % (fn,) - # make sure that we write to the basic sys.__stdout__ - syswrite = sys.__stdout__.write - return space.do_operation('simple_call', Constant(syswrite), *args_w) + try: + mod = __import__(space.unwrap(w_name), space.unwrap(w_glob), + space.unwrap(w_loc), space.unwrap(w_frm)) + except UnwrapException: + # import * in a function gives us the locals as Variable + # we forbid it as a SyntaxError + raise SyntaxError, "RPython: import * is not allowed in functions" + return space.wrap(mod) def sc_operator(space, fn, args): args_w, kwds_w = args.unpack() @@ -52,15 +43,45 @@ return getattr(space, opname)(*args_w) +# This is not a space cache. +# It is just collecting the compiled functions from all the source snippets. + +class FunctionCache(Cache): + """A cache mapping applevel instances to dicts with simple functions""" + + def _build(app): + """NOT_RPYTHON. + Called indirectly by ApplevelClass.interphook().appcaller().""" + dic = {} + first = "\n".join(app.source.split("\n", 3)[:3]) + if "NOT_RPYTHON" in first: + return None + if app.filename is None: + code = py.code.Source(app.source).compile() + else: + code = NiceCompile(app.filename)(app.source) + dic['__file__'] = app.filename + dic['__name__'] = app.modname + exec code in dic + return dic + _build = staticmethod(_build) + +compiled_funcs = FunctionCache() + +def sc_applevel(space, app, name, args_w): + dic = compiled_funcs.getorbuild(app) + if not dic: + return None # signal that this is not RPython + func = dic[name] + return space.do_operation('simple_call', Constant(func), *args_w) + def setup(space): # fn = pyframe.normalize_exception.get_function(space) # this is now routed through the objspace, directly. # space.specialcases[fn] = sc_normalize_exception - if space.do_imports_immediately: - space.specialcases[__import__] = sc_import - # support sys.stdout - space.specialcases[sys.stdout.write] = sc_write - space.specialcases[sys.__stdout__.write] = sc_write + space.specialcases[__import__] = sc_import + # redirect ApplevelClass for print et al. + space.specialcases[ApplevelClass] = sc_applevel # turn calls to built-in functions to the corresponding operation, # if possible for fn in OperationName: Modified: pypy/dist/pypy/objspace/std/stringobject.py ============================================================================== --- pypy/dist/pypy/objspace/std/stringobject.py (original) +++ pypy/dist/pypy/objspace/std/stringobject.py Thu May 19 19:29:22 2005 @@ -1019,7 +1019,7 @@ return _formatting.format(format, (values,), values) else: return _formatting.format(format, (values,), None) -''', filename=__file__, do_imports=True) +''', filename=__file__) str_translate__String_ANY_ANY = app.interphook('str_translate__String_ANY_ANY') str_decode__String_ANY_ANY = app.interphook('str_decode__String_ANY_ANY') Modified: pypy/dist/pypy/translator/geninterplevel.py ============================================================================== --- pypy/dist/pypy/translator/geninterplevel.py (original) +++ pypy/dist/pypy/translator/geninterplevel.py Thu May 19 19:29:22 2005 @@ -50,7 +50,7 @@ import pypy # __path__ import py.path -GI_VERSION = '1.0.6' # bump this for substantial changes +GI_VERSION = '1.0.7' # bump this for substantial changes # ____________________________________________________________ def eval_helper(self, typename, expr): @@ -772,9 +772,6 @@ def nameof_dict(self, dic): assert dic is not __builtins__ - if dic is not self.entrypoint: - assert '__builtins__' not in dic, 'Seems to be the globals of %s' %( - dic.get('__name__', '?'),) name = self.uniquename('g%ddict' % len(dic)) self.register_early(dic, name) self.initcode.append('%s = space.newdict([])' % (name,)) @@ -1087,7 +1084,8 @@ if not self.translator.frozen: # this is only to keep the RAM consumption under control - del self.translator.flowgraphs[func] + pass # del self.translator.flowgraphs[func] + # got duplicate flowgraphs when doing this! def rpyfunction_body(self, func, localscope): try: @@ -1441,8 +1439,7 @@ # and put this into tools/compile_exceptions, maybe??? dic, entrypoint = exceptions_helper() t = Translator(None, verbose=False, simplifying=needed_passes, - builtins_can_raise_exceptions=True, - do_imports_immediately=False) + builtins_can_raise_exceptions=True) gen = GenRpy(t, entrypoint) gen.moddict = dic gen.gen_source('/tmp/look.py') @@ -1480,8 +1477,7 @@ entrypoint() t = Translator(test, verbose=False, simplifying=needed_passes, - builtins_can_raise_exceptions=True, - do_imports_immediately=False) + builtins_can_raise_exceptions=True) gen2 = GenRpy(t) gen2.gen_source("/tmp/look2.py") @@ -1509,7 +1505,7 @@ pass def translate_as_module(sourcetext, filename=None, modname="app2interpexec", - do_imports=False, tmpname=None): + tmpname=None): """ compile sourcetext as a module, translating to interp level. The result is the init function that creates the wrapped module dict, together with the generated source text. @@ -1531,13 +1527,9 @@ code = NiceCompile(filename)(sourcetext) dic = {'__name__': modname} exec code in dic - #del dic['__builtins__'] entrypoint = dic t = Translator(None, verbose=False, simplifying=needed_passes, - builtins_can_raise_exceptions=True, - do_imports_immediately=do_imports) - hold = sys.path - libdir = os.path.join(pypy.__path__[0], "lib") + builtins_can_raise_exceptions=True) gen = GenRpy(t, entrypoint, modname, dic) if tmpname: _file = file @@ -1546,6 +1538,7 @@ tmpname = 'nada' out = _file(tmpname, 'w') gen.f = out + libdir = os.path.join(pypy.__path__[0], "lib") hold = sys.path[:] sys.path.insert(0, libdir) gen.gen_source(tmpname, file=_file) Modified: pypy/dist/pypy/translator/test/rpystone.py ============================================================================== --- pypy/dist/pypy/translator/test/rpystone.py (original) +++ pypy/dist/pypy/translator/test/rpystone.py Thu May 19 19:29:22 2005 @@ -54,9 +54,7 @@ class G:pass g = G() -# import sys -# we cannot import sys here -# because flow space must produce a late lookup +import sys from time import clock @@ -84,10 +82,9 @@ def main(loops=LOOPS): benchtime, stones = pystones(abs(loops)) if loops >= 0: - import sys - sys.stdout.write("Pystone(%s) time for %d passes = %g\n" % \ - (__version__, loops, benchtime) ) - sys.stdout.write("This machine benchmarks at %g pystones/second\n" % stones) + print "Pystone(%s) time for %d passes = %g" % \ + (__version__, loops, benchtime) + print "This machine benchmarks at %g pystones/second" % stones def pystones(loops=LOOPS): @@ -277,13 +274,11 @@ return FALSE def error(msg): - import sys - sys.stderr.write(msg+" ") - sys.stderr.write("usage: %s [number_of_loops]\n" % sys.argv[0]) + print >> sys.stderr, msg, + print >> sys.stderr, "usage: %s [number_of_loops]" % sys.argv[0] sys.exit(100) def entrypoint(loops=None): - import sys if loops is None: loops = LOOPS # initialize early, for slow space nargs = len(sys.argv) - 1 Modified: pypy/dist/pypy/translator/translator.py ============================================================================== --- pypy/dist/pypy/translator/translator.py (original) +++ pypy/dist/pypy/translator/translator.py Thu May 19 19:29:22 2005 @@ -22,13 +22,11 @@ class Translator: def __init__(self, func=None, verbose=False, simplifying=True, - builtins_can_raise_exceptions=False, - do_imports_immediately=True): + builtins_can_raise_exceptions=False): self.entrypoint = func self.verbose = verbose self.simplifying = simplifying self.builtins_can_raise_exceptions = builtins_can_raise_exceptions - self.do_imports_immediately = do_imports_immediately self.clear() def clear(self): @@ -58,7 +56,6 @@ assert not self.frozen space = FlowObjSpace() space.builtins_can_raise_exceptions = self.builtins_can_raise_exceptions - space.do_imports_immediately = self.do_imports_immediately graph = space.build_flow(func) if self.simplifying: simplify_graph(graph, self.simplifying) From hpk at codespeak.net Thu May 19 19:35:54 2005 From: hpk at codespeak.net (hpk at codespeak.net) Date: Thu, 19 May 2005 19:35:54 +0200 (CEST) Subject: [pypy-svn] r12559 - pypy/dist/pypy/documentation Message-ID: <20050519173554.3BB8627B9C@code1.codespeak.net> Author: hpk Date: Thu May 19 19:35:54 2005 New Revision: 12559 Modified: pypy/dist/pypy/documentation/release-0.6.txt Log: ReST fixes Modified: pypy/dist/pypy/documentation/release-0.6.txt ============================================================================== --- pypy/dist/pypy/documentation/release-0.6.txt (original) +++ pypy/dist/pypy/documentation/release-0.6.txt Thu May 19 19:35:54 2005 @@ -9,11 +9,11 @@ What it is and where to start ----------------------------- - Getting started: http://codespeak.net/pypy/index.cgi?doc/getting_started.html +Getting started: http://codespeak.net/pypy/index.cgi?doc/getting_started.html - PyPy Documentation: http://codespeak.net/pypy/index.cgi?doc +PyPy Documentation: http://codespeak.net/pypy/index.cgi?doc - PyPy Homepage: http://codespeak.net/pypy/ +PyPy Homepage: http://codespeak.net/pypy/ PyPy is a MIT-licensed reimplementation of Python written in Python itself. The long term goals are an implementation that From pedronis at codespeak.net Thu May 19 19:38:13 2005 From: pedronis at codespeak.net (pedronis at codespeak.net) Date: Thu, 19 May 2005 19:38:13 +0200 (CEST) Subject: [pypy-svn] r12560 - pypy/dist/pypy/documentation Message-ID: <20050519173813.D686027B9C@code1.codespeak.net> Author: pedronis Date: Thu May 19 19:38:13 2005 New Revision: 12560 Modified: pypy/dist/pypy/documentation/release-0.6.txt Log: issues16 testing fixed my last name Modified: pypy/dist/pypy/documentation/release-0.6.txt ============================================================================== --- pypy/dist/pypy/documentation/release-0.6.txt (original) +++ pypy/dist/pypy/documentation/release-0.6.txt Thu May 19 19:38:13 2005 @@ -94,7 +94,7 @@ have fun, - Armin Rigo, Samuele Pedronis, + Armin Rigo, Samuele Pedroni, Holger Krekel, Christian Tismer, From hpk at codespeak.net Thu May 19 19:41:15 2005 From: hpk at codespeak.net (hpk at codespeak.net) Date: Thu, 19 May 2005 19:41:15 +0200 (CEST) Subject: [pypy-svn] r12561 - pypy/dist/pypy/documentation Message-ID: <20050519174115.A5C4727B9C@code1.codespeak.net> Author: hpk Date: Thu May 19 19:41:15 2005 New Revision: 12561 Modified: pypy/dist/pypy/documentation/release-0.6.txt Log: some more ReST fixes (although i am not entirely sure how successful) Modified: pypy/dist/pypy/documentation/release-0.6.txt ============================================================================== --- pypy/dist/pypy/documentation/release-0.6.txt (original) +++ pypy/dist/pypy/documentation/release-0.6.txt Thu May 19 19:41:15 2005 @@ -53,15 +53,15 @@ PyPy comes with experimental object spaces augmenting the standard one through delegation: - - an experimental object space that does extensive tracing of - bytecode and object operations; + * an experimental object space that does extensive tracing of + bytecode and object operations; - - the 'thunk' object space that implements lazy values and a 'become' - operation that can exchange object identities. + * the 'thunk' object space that implements lazy values and a 'become' + operation that can exchange object identities. - *These spaces already give a glimpse in the flexibility potential of - PyPy*. (See demo/fibonacci.py and demo/sharedref.py for examples - about the 'thunk' object space.) + These spaces already give a glimpse in the flexibility potential of + PyPy. See demo/fibonacci.py and demo/sharedref.py for examples + about the 'thunk' object space. * The 0.6 release also contains a snapshot of our translation-efforts to lower level languages. For that we have developed an From hpk at codespeak.net Thu May 19 19:43:48 2005 From: hpk at codespeak.net (hpk at codespeak.net) Date: Thu, 19 May 2005 19:43:48 +0200 (CEST) Subject: [pypy-svn] r12562 - pypy/dist/pypy/documentation Message-ID: <20050519174348.0B2D927B9C@code1.codespeak.net> Author: hpk Date: Thu May 19 19:43:47 2005 New Revision: 12562 Modified: pypy/dist/pypy/documentation/getting_started.txt Log: fix lisp link Modified: pypy/dist/pypy/documentation/getting_started.txt ============================================================================== --- pypy/dist/pypy/documentation/getting_started.txt (original) +++ pypy/dist/pypy/documentation/getting_started.txt Thu May 19 19:43:47 2005 @@ -463,8 +463,8 @@ *CLISP* - (used for the optional Lisp translation backend) - http://clisp.cons.org/_ + (used for the optional Lisp translation backend) + http://clisp.cons.org/ .. _`low level virtual machine`: http://llvm.cs.uiuc.edu/ From tismer at codespeak.net Thu May 19 20:01:36 2005 From: tismer at codespeak.net (tismer at codespeak.net) Date: Thu, 19 May 2005 20:01:36 +0200 (CEST) Subject: [pypy-svn] r12564 - pypy/dist/pypy/interpreter Message-ID: <20050519180136.F0D7727B9C@code1.codespeak.net> Author: tismer Date: Thu May 19 20:01:36 2005 New Revision: 12564 Modified: pypy/dist/pypy/interpreter/gateway.py Log: small cleanup Modified: pypy/dist/pypy/interpreter/gateway.py ============================================================================== --- pypy/dist/pypy/interpreter/gateway.py (original) +++ pypy/dist/pypy/interpreter/gateway.py Thu May 19 20:01:36 2005 @@ -513,10 +513,8 @@ self.source = source self.modname = modname # look at the first three lines for a NOT_RPYTHON tag - first = source.split("\n", 3)[:3] - for line in first: - if "NOT_RPYTHON" in line: - self.use_geninterp = False + first = "\n".join(source.split("\n", 3)[:3]) + self.use_geninterp = "NOT_RPYTHON" not in first def getwdict(self, space): return space.fromcache(ApplevelCache).getorbuild(self) From arigo at codespeak.net Thu May 19 20:03:39 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Thu, 19 May 2005 20:03:39 +0200 (CEST) Subject: [pypy-svn] r12565 - pypy/dist/pypy/documentation Message-ID: <20050519180339.0B37027B9C@code1.codespeak.net> Author: arigo Date: Thu May 19 20:03:39 2005 New Revision: 12565 Modified: pypy/dist/pypy/documentation/translation.txt Log: Link fix. Modified: pypy/dist/pypy/documentation/translation.txt ============================================================================== --- pypy/dist/pypy/documentation/translation.txt (original) +++ pypy/dist/pypy/documentation/translation.txt Thu May 19 20:03:39 2005 @@ -40,7 +40,7 @@ .. _`Flow Object Space`: objspace.html#the-flow-object-space .. _`control flow graph`: objspace.html#the-flow-model .. _`Common Lisp`: http://codespeak.net/svn/pypy/dist/pypy/translator/gencl.py -.. _Pyrex: http://codespeak.net/svn/pypy/dist/pypy/translator/genpyrex.py +.. _Pyrex: http://codespeak.net/svn/pypy/dist/pypy/translator/pyrex/genpyrex.py .. _Java: http://codespeak.net/svn/pypy/dist/pypy/translator/java/ .. _`Python again`: http://codespeak.net/svn/pypy/dist/pypy/translator/geninterplevel.py From arigo at codespeak.net Thu May 19 20:05:34 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Thu, 19 May 2005 20:05:34 +0200 (CEST) Subject: [pypy-svn] r12566 - pypy/dist/pypy/documentation Message-ID: <20050519180534.823BE27B9C@code1.codespeak.net> Author: arigo Date: Thu May 19 20:05:34 2005 New Revision: 12566 Modified: pypy/dist/pypy/documentation/architecture.txt pypy/dist/pypy/documentation/objspace.txt Log: issue18 testing Up-to-dated architecture.txt, and added links for further reading to the relevant documents at the end of each section. We no longer talk in any detail about the standard object space or the trace object space in architecture.txt now; this has been moved to objspace.txt (with links). Added a table of contents and a better section/subsection organization. Modified: pypy/dist/pypy/documentation/architecture.txt ============================================================================== --- pypy/dist/pypy/documentation/architecture.txt (original) +++ pypy/dist/pypy/documentation/architecture.txt Thu May 19 20:05:34 2005 @@ -1,9 +1,18 @@ -Overview on PyPy's current architecture (Mar. 2005) -=================================================== +================================================== +Overview of PyPy's current architecture (May 2005) +================================================== + +.. contents:: +.. sectnum:: + +This document gives an overview of the goals and architecture of PyPy. +See also `getting started`_ for a practical introduction. + +.. _`getting started`: getting_started.html PyPy - an implementation of Python in Python --------------------------------------------- +============================================ It has become a tradition in the development of computer languages to implement each language in itself. This serves many purposes. By doing so, @@ -12,20 +21,22 @@ ever gets. The PyPy project aims to do this for Python and has made some significant -progress. In a number of one week sprints, each attracting approximately +progress. In a number of one week sprints, attracting approximately 10 developers each, we made an almost complete implementation of Python in Python. Currently it is rather slow, benchmarking at a factor 4000 times slower than regular Python (henceforth referred to as CPython). -In the next step of the project, we will generate C code from the source -of PyPy, thereby reducing the speed penalty. +For some time now the bleeding edge PyPy work has been focused on generating +reasonably efficient C code from the source of PyPy, thereby reducing the +speed penalty. This goal is no longer far away. -Later in the project, we will introduce optimisation (following the ideas +Later in the project, we will introduce optimisations (following the ideas of Psyco) that should make PyPy run faster than CPython. An important aspect of implementing Python in Python is the high level of abstraction and compactness of the language. This yields an implementation -that is easier to understand than the one done in C. +that is, in some respects, easier to understand and play with than the one +done in C. Another carrying idea in PyPy is to build the implementation in the form of a number of independent modules with clearly defined API's. This eases @@ -33,65 +44,85 @@ features. Our rather complete and 2.3-compliant interpreter is about 22000 lines of -code, with another 7000 lines of unit tests (we also pass a number of -CPython's own tests). If we include the tools, the parts related to code -analysis and generation, and the standard library modules ported from C, -PyPy is now 55000 lines of code and 20000 lines of tests. +code, with another 7000 lines of unit tests. If we include the tools, the +parts related to code analysis and generation, and the standard library +modules ported from C, PyPy is now 55000 lines of code and 20000 lines of +tests. + +We also pass a number of CPython's own tests, including 90% of the "core" +tests not depending on C extension modules (most of the remaining 10% are +arguably dependant on very obscure implementation details of CPython). Higher level picture -------------------------------------- +==================== The various parts of PyPy have always been under more or less heavy refactoring since its inception. However, the higher level architecture remains rather simple and unchanged. There are two independent basic subsystems: -- the *standard interpreter* which implements the Python language - and is composed out of two components: +The Standard Interpreter +------------------------ - - the *plain interpreter* which is responsible for interpreting - code objects and implementing bytecodes, +The *standard interpreter* is the subsystem implementing the Python language. +It is divided in two components: - - the *standard object space* which implements creation, access and - modification of application level objects, +- the `plain interpreter`_ which is responsible for interpreting + code objects and implementing bytecodes, - Note that the *standard interpreter* can run fine on top of CPython - (the C Implementation of Python led by Guido van Rossum) but of course - the double-interpretation penalty lets us interpret python programs - rather slowly. +- the `standard object space`_ which implements creation, access and + modification of application level objects, -- the *translation process* which aims at producing a different (low-level) - representation of our standard interpreter. The *translation process* - is done in three steps: - - - producing a *flow graph* representation of the standard interpreter. - A combination of a *plain interpreter* and a *flow object space* - performs "abstract interpretation" to record the flow of objects - and execution throughout a python program into such a *flow graph*. - - - the *annotator* which performs type inference on the flow graph - - - the *translator* which translates the (annotated) flow graph into - another language, currently Pyrex/C and LISP. +Note that the *standard interpreter* can run fine on top of CPython +(the C Implementation of Python led by Guido van Rossum), if one is +willing to pay for the double-interpretation performance penalty. Please note that we are using the term *interpreter* most often in reference to the *plain interpreter* which just knows enough to read, dispatch and implement *bytecodes* thus shuffling objects around on the stack and between namespaces. The (plain) interpreter is completly ignorant of how to access, modify or construct objects and their -structure and thus delegates such operations to a so called "Object Space". +structure and thus delegates such operations to a so called `Object Space`_. + +In addition, the standard interpreter requires a parser and bytecode compiler +to turn the user's Python source code into a form amenable to +interpretation. This is currently still borrowed from CPython, but we +have two experimental parser modules in the source tree which are in the +process of being integrated. + +The Translation Process +----------------------- + +The *translation process* aims at producing a different (low-level) +representation of our standard interpreter. The *translation process* +is done in four steps: + +- producing a *flow graph* representation of the standard interpreter. + A combination of a `plain interpreter`_ and a *flow object space* + performs *abstract interpretation* to record the flow of objects + and execution throughout a python program into such a *flow graph*. + +- the *annotator* which performs type inference on the flow graph + +- the *typer* which, based on the type annotations, turns the flow graph + into one using only low-level, C-like operations + +- the *code generator* which translates the resulting flow graph into + another language, currently C or LLVM. + +See below for the `translation process in more details`_. -XXX mention Parser and compiler (we have a parser module from the PyCon 2005 -sprint, but it's not used by the rest of the core) + +.. _`plain interpreter`: The Interpreter =============== -The interpreter handles python code objects. The interpreter can build +The *plain interpreter* handles python code objects. The interpreter can build code objects from Python sources, when needed, by invoking Python's builtin compiler (we also have a way of constructing those code objects -from python code only, but we have not integrated it yet). Code objects +from python source only, but we have not integrated it yet). Code objects are a nicely preprocessed, structured representation of source code, and their main content is *bytecode*. In addition, code objects also know how to create a *frame* object which has the responsibility to @@ -99,7 +130,17 @@ python function, which, in turn, delegates operations on application-level objects to an object space. +This part is implemented in the `interpreter/`_ directory. People familiar +with the CPython implementation of the above concepts will easily recognize +them there. The major differences are the overall usage of the `Object Space`_ +indirection to perform operations on objects, and the organization of the +built-in modules (described `here`_). + +.. _`here`: coding-guide.html#modules + + .. _`objectspace`: +.. _`Object Space`: The Object Space ================ @@ -112,10 +153,11 @@ for performing numeric addition when add works on numbers, concatenation when add works on built-in sequences. -All object-space operations take and return "application level" objects. -There is only one, very simple, object-space operation which allows the +All object-space operations take and return `application-level`_ objects. +There are only a few, very simple, object-space operation which allows the interpreter to gain some knowledge about the value of an -application-level object: ``is_true()``, which returns a boolean +application-level object. +The most important one is ``is_true()``, which returns a boolean interpreter-level value. This is necessary to implement, for example, if-statements (or rather, to be pedantic, to implement the conditional-branching bytecodes into which if-statements get compiled). @@ -123,86 +165,58 @@ We currently have four working object spaces which can be plugged into the interpreter: -- The Standard Object Space, which is an almost complete implementation - of the various Python objects. This is the main focus of this - document, since the Standard Object Space, together with the - interpreter, is the foundation of our Python implementation. - -- the Flow Object Space, which transforms a python program into a - flow-graph representation. The Flow Object Space performs this - transformation task through "abstract interpretation", which we will - explain later in this document. +.. _`standard object space`: -- the Trace Object Space, which wraps e.g. the standard +- The *Standard Object Space* is a complete implementation + of the various built-in types and objects of Python. The Standard Object + Space, together with the interpreter, is the foundation of our Python + implementation. Internally, it is a set of `interpreter-level`_ classes + implementing the various `application-level`_ objects -- integers, strings, + lists, types, etc. To draw a comparison with CPython, the Standard Object + Space provides the equivalent of the C structures ``PyIntObject``, + ``PyListObject``, etc. + +- the *Trace Object Space* wraps e.g. the standard object space in order to trace the execution of bytecodes, frames and object space operations. -- the Thunk Object Space, which wraps another object space (e.g. the standard +- the *Thunk Object Space* wraps another object space (e.g. the standard one) and adds two capabilities: lazily computed objects (computed only when an operation is performed on them), and "become", which completely and globally replaces an object with another. -The Standard Object Space -========================= +- the *Flow Object Space* transforms a Python program into a + flow-graph representation, by recording all operations that the interpreter + would like to perform when it is shown the given Python program. This + technique is explained `later in this document`_. + +For a complete description of the object spaces, please see the +`objspace document`_. The sources of PyPy contain the various object spaces +in the directory `objspace/`_. + +.. _`objspace document`: objspace.html -The Standard Object Space implements python objects and types, and all -operations on them. It is thus an essential component in order to reach -CPython compatibility. - -The implementations of ints, floats, strings, dicts, lists, etc, all -live in separate files, and are bound together by a "multimethod" -mechanism. Multimethods allow a caller - most notably the interpreter - -to stay free from knowing anything about objects' implementations. Thus -multimethods implement a way of delegating to the right implementation -based on the passed in objects (objects previously created by the same -subsystem). We examine how the multimethod mechanism works through an -example. - -We consider the add-operation of ``int`` and ``float`` objects, and -disregard all other object types for the moment. There is one -multimethod ``add``, and both relevant implementations, ``add(intimpl, -intimpl)`` and ``add(floatimpl, floatimpl)``, *register* with that one -``add`` multimethod. - -When we have the expression ``2+3`` in our application program, the -interpreter creates an application-level object containing ("wrapping") -the value ``2`` and another one containing the value ``3``. We talk -about them as ``W_Int(2)`` and ``W_Int(3)`` respectively. The -interpreter then calls the Standard Object Space with ``add(W_Int(2), -W_Int(3))``. - -The Object Space then examines the objects passed in, and delegates -directly to the ``add(intimpl, intimpl)`` function: since this is a -"direct hit", the multimethod immediately dispatches the operation to -the correct implementation, i.e., the one registered as the -implementation for this signature. - -If the multimethod doesn't have any registered functions for the exact -given signature, as would be the case for example for the expression -``2+3.0``, the multimethod tests if it can use coercion to find a -function with a signature that works. In this case we would coerce -``W_Int(2)`` to ``W_Float(2.0)`` in order to find a function in the -multimethod that has a correct signature. Note that the multimethod -mechanism is still considered a major refactoring target, since it is -not easy to get it completly right, fast and accurate. + +.. _`application-level`: +.. _`interpreter-level`: Application-level and interpreter-level execution and objects ============================================================= Since Python is used for implementing all of our code base, there is a crucial distinction to be aware of: *interpreter-level* objects versus -*application level* objects. The latter are the ones that you deal with +*application-level* objects. The latter are the ones that you deal with when you write normal python programs. Interpreter-level code, however, cannot invoke operations nor access attributes from application-level objects. You will immediately recognize any interpreter level code in -PyPy, because all variable and object names start with a ``w_``, which -indicates that they are "wrapped" application-level values. +PyPy, because half the variable and object names start with a ``w_``, which +indicates that they are `wrapped`_ application-level values. Let's show the difference with a simple example. To sum the contents of two variables ``a`` and ``b``, typical application-level code is ``a+b`` -- in sharp contrast, typical interpreter-level code is ``space.add(w_a, w_b)``, where ``space`` is an instance of an object space, and ``w_a`` -and ``w_b`` are typical names for the *wrapped* versions of the two +and ``w_b`` are typical names for the `wrapped`_ versions of the two variables. It helps to remember how CPython deals with the same issue: interpreter @@ -214,8 +228,8 @@ Moreover, in PyPy we have to make a sharp distinction between interpreter- and application-level *exceptions*: application exceptions are always contained inside an instance of ``OperationError``. This -makes it easy to distinguish failures in our interpreter-level code from -failures appearing in a python application level program that we are +makes it easy to distinguish failures (or bugs) in our interpreter-level code +from failures appearing in a python application level program that we are interpreting. @@ -240,8 +254,12 @@ w_keys = space.call_method(w_other, 'keys') w_iter = space.iter(w_keys) while True: - try: w_key = space.next(w_iter) - except NoValue: break + try: + w_key = space.next(w_iter) + except OperationError, e: + if not e.match(space, space.w_StopIteration): + raise # re-raise other app-level exceptions + break w_value = space.getitem(w_other, w_key) space.setitem(w_self, w_key, w_value) @@ -260,6 +278,9 @@ whether a particular function is implemented at application or interpreter level. + +.. _`wrapped`: + Wrapping ======== @@ -273,7 +294,8 @@ with suitable interpreter-level classes with some amount of internal structure. -For example, an application-level Python ``list`` is implemented as an +For example, an application-level Python ``list`` +is implemented by the standard object space`_ as an instance of ``W_ListObject``, which has an instance attribute ``ob_item`` (an interpreter-level list which contains the application-level list's items as wrapped objects) and another attribute @@ -284,13 +306,18 @@ application-level list -- it is for this reason that the length in question has to be explicitly recorded in ``ob_size``). -See ``wrapping.txt`` for more details. +The rules are described in more details `in the coding guide`_. + +.. _`in the coding guide`: coding-guide.html#wrapping-rules +.. _`translation process in more details`: +.. _`later in this document`: + RPython, the Flow Object Space and translation ============================================== -One of PyPy's -term objectives is to enable translation of our +One of PyPy's now-short-term objectives is to enable translation of our interpreter and standard object space into a lower-level language. In order for our translation and type inference mechanisms to work effectively, we need to restrict the dynamism of our interpreter-level @@ -299,8 +326,8 @@ metaclasses and execution of dynamically constructed strings. However, when the initialization phase (mainly, the function ``objspace.initialize()``) finishes, all code objects involved need to -adhere to a (non-formally defined) more static subset of Python: -Restricted Python, also known as 'RPython'. +adhere to a more static subset of Python: +Restricted Python, also known as `RPython`_. The Flow Object Space then, with the help of our plain interpreter, works through those initialized "RPython" code objects. The result of @@ -313,42 +340,36 @@ The flow graphs are fed as input into the Annotator. The Annotator, given entry point types, infers the types of values that flow through -the program variables. Here, one of the informal definitions of RPython -comes into play: RPython code is restricted in such a way that the -translator is able to compile low-level **typed** code. How much +the program variables. Here, the definition of `RPython`_ comes +again into play: RPython code is restricted in such a way that the +Annotator is able to infer consistent types. In total, how much dynamism we allow in RPython depends, and is restricted by, the Flow Object Space and the Annotator implementation. The more we can improve this translation phase, the more dynamism we can allow. In some cases, however, it will probably be more feasible and practical to just get rid of some of the dynamism we use in our interpreter level code. It is -mainly because of this trade-off situation that we don't currently try -to formally define 'RPython'. +mainly because of this trade-off situation that the definition of +`RPython`_ has been shifting quite a bit. Although the Annotator is +pretty stable now, and able to process the whole of PyPy, the `RPython`_ +definition will probably continue to shift marginally as we improve it. The actual low-level code (and, in fact, also other high-level code) is emitted by "visiting" the type-annotated flow graph. Currently, we have -a Pyrex-producing backend, and a Lisp-producing backend. We use (a -slightly hacked version of) Pyrex to generate C libraries. Since Pyrex -also accepts plain non-typed python code, we can test translation even -though type annotation is not complete. +a C-producing backend, and an LLVM-producing backend. The former also +accept non-annotated or partially-annotated graphs, which allow us to +test it on a larger class of programs than what the Annotator can (or +ever will) fully process. + +A new piece of this puzzle, still being integrated (May 2005), is the +*Typer*, which inputs the high-level types inferred by the Annotator and +uses them to modify the flow graph in-place to replace its operations with +low-level ones, directly manipulating C-like values and data structures. -.. _`abstract interpretation`: theory.html#abstract-interpretation +The complete translation process is described in more details in the +`translation document`_. -Trace Object Space -================== +.. _`RPython`: coding-guide.html#rpython +.. _`abstract interpretation`: theory.html#abstract-interpretation +.. _`translation document`: translation.html -A recent addition is the Trace Object space, which wraps a standard -object space in order to trace all object space operations, -frame creation, deletion and bytecode execution. The ease with which -the Trace Object Space was implemented at the Amsterdam Sprint -underlines the power of the Object Space abstraction. (Of course, the -previously-implemented Flow Object Space producing the flow graph -already was proof enough). - -There are certainly many more possibly useful Object Space ideas, such -as a ProxySpace that connects to a remote machine where the actual -operations are performed. At the other end, we wouldn't need to change -object spaces at all in order to extend or modify the interpreter, e.g. -by adding or removing some bytecodes. Thus, the interpreter and -object-space cooperation nicely splits the python runtime into two -reasonably-independent halves, cooperating along a reasonably narrow -interface, and suitable for multiple separate implementations. +.. include:: _ref.txt Modified: pypy/dist/pypy/documentation/objspace.txt ============================================================================== --- pypy/dist/pypy/documentation/objspace.txt (original) +++ pypy/dist/pypy/documentation/objspace.txt Thu May 19 20:05:34 2005 @@ -201,9 +201,15 @@ The Trace Object Space ====================== -XXX see `this overview`_. +The Trace Object space is a proxy object space, delegating most operations to +another one -- usually a standard object space -- while tracing them. It also +traces frame creation, deletion and bytecode execution. The ease with which +the Trace Object Space was implemented at the Amsterdam Sprint +underlines the power of the Object Space abstraction. (Of course, the +previously-implemented Flow Object Space producing the flow graph +already was proof enough). -.. _`this overview`: architecture.html#trace-object-space +In an interactive PyPy prompt, type ``__pytrace__ = 1`` to enable it. The Thunk Object Space From arigo at codespeak.net Thu May 19 20:06:36 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Thu, 19 May 2005 20:06:36 +0200 (CEST) Subject: [pypy-svn] r12567 - pypy/dist/demo Message-ID: <20050519180636.A3BA727B9C@code1.codespeak.net> Author: arigo Date: Thu May 19 20:06:36 2005 New Revision: 12567 Modified: pypy/dist/demo/bpnn.py Log: Woha. print statements really work in genc now. Thanks Christian! Modified: pypy/dist/demo/bpnn.py ============================================================================== --- pypy/dist/demo/bpnn.py (original) +++ pypy/dist/demo/bpnn.py Thu May 19 20:06:36 2005 @@ -17,7 +17,6 @@ # Modifications to the original (Armin Rigo): # * import random from PyPy's lib, which is Python 2.2's plain # Python implementation -# * use sys.stdout.write() instead of print statements for now # * starts the Translator instead of the demo by default. import sys @@ -136,16 +135,16 @@ def test(self, patterns): for p in patterns: - print_('%s -> %s' % (p[0], self.update(p[0]))) + print p[0], '->', self.update(p[0]) def weights(self): - print_('Input weights:') + print 'Input weights:' for i in range(self.ni): - print_(self.wi[i]) - print_() - print_('Output weights:') + print self.wi[i] + print + print 'Output weights:' for j in range(self.nh): - print_(self.wo[j]) + print self.wo[j] def train(self, patterns, iterations=2000, N=0.5, M=0.1): # N: learning rate @@ -158,10 +157,7 @@ self.update(inputs) error = error + self.backPropagate(targets, N, M) if i % 100 == 0: - print_('error %-14f' % error) - -def print_(s): - sys.stdout.write(s+'\n') + print 'error %-14f' % error def demo(): From cfbolz at codespeak.net Thu May 19 20:47:37 2005 From: cfbolz at codespeak.net (cfbolz at codespeak.net) Date: Thu, 19 May 2005 20:47:37 +0200 (CEST) Subject: [pypy-svn] r12569 - pypy/dist/pypy/documentation Message-ID: <20050519184737.F1D1C27B9E@code1.codespeak.net> Author: cfbolz Date: Thu May 19 20:47:37 2005 New Revision: 12569 Modified: pypy/dist/pypy/documentation/getting_started.txt Log: issue68 testing genllvm _is_ tested with LLVM 1.5 now -- thanks Eric. Modified: pypy/dist/pypy/documentation/getting_started.txt ============================================================================== --- pypy/dist/pypy/documentation/getting_started.txt (original) +++ pypy/dist/pypy/documentation/getting_started.txt Thu May 19 20:47:37 2005 @@ -458,8 +458,8 @@ run into problems with the installation the `LLVM mailing list`_ is very helpful and friendly. - Note that the PyPy LLVM backend was developed using LLVM 1.4. The - newest version (LLVM 1.5) will probably work, too. + Note that the PyPy LLVM backend was developed using LLVM 1.4 and is known + to work with LLVM 1.5. Nobody ever tried an older version. *CLISP* From hpk at codespeak.net Thu May 19 20:57:07 2005 From: hpk at codespeak.net (hpk at codespeak.net) Date: Thu, 19 May 2005 20:57:07 +0200 (CEST) Subject: [pypy-svn] r12570 - pypy/dist/pypy/documentation Message-ID: <20050519185707.593F927B9C@code1.codespeak.net> Author: hpk Date: Thu May 19 20:57:07 2005 New Revision: 12570 Modified: pypy/dist/pypy/documentation/architecture.txt Log: issue68 testing - chapter 6 (wrapping) is now 5.2 - added a link to the Python language reference (which starts off to explain what Python is, which is good) - removed references when they occured repeatedly within on paragraph (i think that's a good rule to avoid spamming the reader with links) - a few minor fixes and clarifications Modified: pypy/dist/pypy/documentation/architecture.txt ============================================================================== --- pypy/dist/pypy/documentation/architecture.txt (original) +++ pypy/dist/pypy/documentation/architecture.txt Thu May 19 20:57:07 2005 @@ -20,10 +20,10 @@ large projects. A compiler/interpreter is close to as complex as software ever gets. -The PyPy project aims to do this for Python and has made some significant +The PyPy project aims to do this for Python_ and has made some significant progress. In a number of one week sprints, attracting approximately 10 developers each, we made an almost complete implementation of Python in -Python. Currently it is rather slow, benchmarking at a factor 4000 times +Python. Currently it is rather slow, benchmarking at a factor 2000 times slower than regular Python (henceforth referred to as CPython). For some time now the bleeding edge PyPy work has been focused on generating @@ -39,9 +39,9 @@ done in C. Another carrying idea in PyPy is to build the implementation in the form -of a number of independent modules with clearly defined API's. This eases -reuse and allows experimenting with multiple implementations of specific -features. +of a number of independent modules with clearly defined and well tested API's. +This eases reuse and allows experimenting with multiple implementations +of specific features. Our rather complete and 2.3-compliant interpreter is about 22000 lines of code, with another 7000 lines of unit tests. If we include the tools, the @@ -53,6 +53,7 @@ tests not depending on C extension modules (most of the remaining 10% are arguably dependant on very obscure implementation details of CPython). +.. _Python: http://www.python.org/doc/2.4.1/ref/ref.html Higher level picture ==================== @@ -190,7 +191,7 @@ would like to perform when it is shown the given Python program. This technique is explained `later in this document`_. -For a complete description of the object spaces, please see the +For a description of the object spaces, please see the `objspace document`_. The sources of PyPy contain the various object spaces in the directory `objspace/`_. @@ -216,7 +217,7 @@ two variables ``a`` and ``b``, typical application-level code is ``a+b`` -- in sharp contrast, typical interpreter-level code is ``space.add(w_a, w_b)``, where ``space`` is an instance of an object space, and ``w_a`` -and ``w_b`` are typical names for the `wrapped`_ versions of the two +and ``w_b`` are typical names for the wrapped versions of the two variables. It helps to remember how CPython deals with the same issue: interpreter @@ -264,9 +265,12 @@ space.setitem(w_self, w_key, w_value) This interpreter-level implementation looks much more similar to the C -source code, although it is probably still more readable. In any case, -it should be obvious that the application-level implementation is -definitely more readable, more elegant and more maintainable than the +source code. It is still more readable than it's C counterpart because +it doesn't contain memory management details and can use Python's native +exception mechanism. + +In any case, it should be obvious that the application-level implementation +is definitely more readable, more elegant and more maintainable than the interpreter-level one. In fact, in almost all parts of PyPy, you find application level code in @@ -282,7 +286,7 @@ .. _`wrapped`: Wrapping -======== +--------- The ``w_`` prefixes so lavishly used in the previous example indicate, by PyPy coding convention, that we are dealing with *wrapped* objects, @@ -295,7 +299,7 @@ structure. For example, an application-level Python ``list`` -is implemented by the standard object space`_ as an +is implemented by the `standard object space`_ as an instance of ``W_ListObject``, which has an instance attribute ``ob_item`` (an interpreter-level list which contains the application-level list's items as wrapped objects) and another attribute @@ -330,7 +334,7 @@ Restricted Python, also known as `RPython`_. The Flow Object Space then, with the help of our plain interpreter, -works through those initialized "RPython" code objects. The result of +works through those initialized RPython code objects. The result of this `abstract interpretation`_ is a flow graph: yet another representation of a python program, but one which is suitable for applying translation and type inference techniques. The nodes of the @@ -349,14 +353,14 @@ however, it will probably be more feasible and practical to just get rid of some of the dynamism we use in our interpreter level code. It is mainly because of this trade-off situation that the definition of -`RPython`_ has been shifting quite a bit. Although the Annotator is -pretty stable now, and able to process the whole of PyPy, the `RPython`_ +RPython has been shifting quite a bit. Although the Annotator is +pretty stable now, and able to process the whole of PyPy, the RPython definition will probably continue to shift marginally as we improve it. The actual low-level code (and, in fact, also other high-level code) is emitted by "visiting" the type-annotated flow graph. Currently, we have a C-producing backend, and an LLVM-producing backend. The former also -accept non-annotated or partially-annotated graphs, which allow us to +accepts non-annotated or partially-annotated graphs, which allow us to test it on a larger class of programs than what the Annotator can (or ever will) fully process. From pedronis at codespeak.net Thu May 19 21:10:19 2005 From: pedronis at codespeak.net (pedronis at codespeak.net) Date: Thu, 19 May 2005 21:10:19 +0200 (CEST) Subject: [pypy-svn] r12571 - in pypy/dist/pypy: objspace/flow translator Message-ID: <20050519191019.16A0827B9C@code1.codespeak.net> Author: pedronis Date: Thu May 19 21:10:18 2005 New Revision: 12571 Modified: pypy/dist/pypy/objspace/flow/objspace.py pypy/dist/pypy/translator/geninterplevel.py Log: we don't need unspecializa in itself Modified: pypy/dist/pypy/objspace/flow/objspace.py ============================================================================== --- pypy/dist/pypy/objspace/flow/objspace.py (original) +++ pypy/dist/pypy/objspace/flow/objspace.py Thu May 19 21:10:18 2005 @@ -309,7 +309,12 @@ spaceop.offset = self.executioncontext.crnt_offset self.executioncontext.recorder.append(spaceop) return spaceop.result - + + def do_operation_with_implicit_exceptions(self, name, *args_w): + w_result = self.do_operation(name, *args_w) + self.handle_implicit_exceptions(implicit_exceptions.get(name)) + return w_result + def is_true(self, w_obj): try: obj = self.unwrap_for_computation(w_obj) @@ -509,8 +514,6 @@ else: if debug: print "Can constant-fold operation: %s" % name - exceptions = implicit_exceptions.get(name) - def generic_operator(self, *args_w): assert len(args_w) == arity, name+" got the wrong number of arguments" if op: @@ -542,8 +545,7 @@ pass #print >> sys.stderr, 'Variable operation', name, args_w - w_result = self.do_operation(name, *args_w) - self.handle_implicit_exceptions(exceptions) + w_result = self.do_operation_with_implicit_exceptions(name, *args_w) return w_result setattr(FlowObjSpace, name, generic_operator) @@ -553,20 +555,12 @@ # override getattr for not really const objects -def unspecialize(obj): - # turn a constant into SomeObject - # XXX this may become harder when the annotator gets smarter - # maybe we need to add a special treatment like for ovfcheck. - if id(0) != id(None): - return obj - def override(): def getattr(self, w_obj, w_name): if w_obj in self.not_really_const: const_w = self.not_really_const[w_obj] if w_name not in const_w: - w_obj = self.do_operation('simple_call', - Constant(unspecialize), w_obj) + return self.do_operation_with_implicit_exceptions('getattr', w_obj, w_name) return self.regular_getattr(w_obj, w_name) FlowObjSpace.regular_getattr = FlowObjSpace.getattr FlowObjSpace.getattr = getattr Modified: pypy/dist/pypy/translator/geninterplevel.py ============================================================================== --- pypy/dist/pypy/translator/geninterplevel.py (original) +++ pypy/dist/pypy/translator/geninterplevel.py Thu May 19 21:10:18 2005 @@ -50,7 +50,7 @@ import pypy # __path__ import py.path -GI_VERSION = '1.0.7' # bump this for substantial changes +GI_VERSION = '1.0.8' # bump this for substantial changes # ____________________________________________________________ def eval_helper(self, typename, expr): From arigo at codespeak.net Thu May 19 21:34:28 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Thu, 19 May 2005 21:34:28 +0200 (CEST) Subject: [pypy-svn] r12574 - pypy/dist/pypy/objspace/flow Message-ID: <20050519193428.3A92327BB2@code1.codespeak.net> Author: arigo Date: Thu May 19 21:34:28 2005 New Revision: 12574 Modified: pypy/dist/pypy/objspace/flow/flowcontext.py Log: Quick fix for the Pygame viewer... Modified: pypy/dist/pypy/objspace/flow/flowcontext.py ============================================================================== --- pypy/dist/pypy/objspace/flow/flowcontext.py (original) +++ pypy/dist/pypy/objspace/flow/flowcontext.py Thu May 19 21:34:28 2005 @@ -21,7 +21,7 @@ class SpamBlock(Block): - __slots__ = "dead framestate".split() + __slots__ = "dead framestate fillcolor".split() def __init__(self, framestate): Block.__init__(self, framestate.getvariables()) @@ -37,7 +37,7 @@ class EggBlock(Block): - __slots__ = "prevblock booloutcome last_exception".split() + __slots__ = "prevblock booloutcome last_exception fillcolor".split() def __init__(self, inputargs, prevblock, booloutcome): Block.__init__(self, inputargs) From tismer at codespeak.net Thu May 19 21:36:46 2005 From: tismer at codespeak.net (tismer at codespeak.net) Date: Thu, 19 May 2005 21:36:46 +0200 (CEST) Subject: [pypy-svn] r12575 - pypy/dist/pypy/annotation Message-ID: <20050519193646.D741427BB2@code1.codespeak.net> Author: tismer Date: Thu May 19 21:36:46 2005 New Revision: 12575 Modified: pypy/dist/pypy/annotation/model.py Log: some commentary about compressen updated Modified: pypy/dist/pypy/annotation/model.py ============================================================================== --- pypy/dist/pypy/annotation/model.py (original) +++ pypy/dist/pypy/annotation/model.py Thu May 19 21:36:46 2005 @@ -44,7 +44,7 @@ As a first approach to break this thing down, I slottified all of these objects. The result was not overwhelming: -A savingof 5MB,but four percent of slowdown, since object +A savingof 5MB, but four percent of slowdown, since object comparison got much more expensive, by lacking a __dict__. So I trashed 8 hours of work, without a check-in. (Just @@ -52,8 +52,9 @@ Then I tried to make allinstances unique and wrote a lot of attribute tracking code here, locked write access -outside of __init__, and patched manz modules and serveral +outside of __init__, and patched many modules and several hundred lines of code. +Finally I came up with a better concept, which is postponed. """ From pedronis at codespeak.net Thu May 19 21:37:08 2005 From: pedronis at codespeak.net (pedronis at codespeak.net) Date: Thu, 19 May 2005 21:37:08 +0200 (CEST) Subject: [pypy-svn] r12576 - pypy/dist/pypy/annotation Message-ID: <20050519193708.D6E5827BB9@code1.codespeak.net> Author: pedronis Date: Thu May 19 21:37:08 2005 New Revision: 12576 Modified: pypy/dist/pypy/annotation/bookkeeper.py Log: special-case sys constants Modified: pypy/dist/pypy/annotation/bookkeeper.py ============================================================================== --- pypy/dist/pypy/annotation/bookkeeper.py (original) +++ pypy/dist/pypy/annotation/bookkeeper.py Thu May 19 21:37:08 2005 @@ -3,6 +3,7 @@ """ from __future__ import generators +import sys from types import FunctionType, ClassType, MethodType from types import BuiltinMethodType from pypy.tool.ansi_print import ansi_print @@ -125,6 +126,8 @@ def immutablevalue(self, x): """The most precise SomeValue instance that contains the immutable value x.""" + if x is sys: # special case constant sys to someobject + return SomeObject() tp = type(x) if tp is bool: result = SomeBool() From cfbolz at codespeak.net Thu May 19 21:56:21 2005 From: cfbolz at codespeak.net (cfbolz at codespeak.net) Date: Thu, 19 May 2005 21:56:21 +0200 (CEST) Subject: [pypy-svn] r12577 - pypy/dist/pypy/documentation Message-ID: <20050519195621.4A96B27BB2@code1.codespeak.net> Author: cfbolz Date: Thu May 19 21:56:21 2005 New Revision: 12577 Modified: pypy/dist/pypy/documentation/getting_started.txt Log: issue68 testing Make the LLVM 1.5 compliancy claim less strong -- thanks Holger. Modified: pypy/dist/pypy/documentation/getting_started.txt ============================================================================== --- pypy/dist/pypy/documentation/getting_started.txt (original) +++ pypy/dist/pypy/documentation/getting_started.txt Thu May 19 21:56:21 2005 @@ -458,7 +458,7 @@ run into problems with the installation the `LLVM mailing list`_ is very helpful and friendly. - Note that the PyPy LLVM backend was developed using LLVM 1.4 and is known + Note that the PyPy LLVM backend was developed using LLVM 1.4 and it seems to work with LLVM 1.5. Nobody ever tried an older version. *CLISP* From hpk at codespeak.net Thu May 19 21:57:38 2005 From: hpk at codespeak.net (hpk at codespeak.net) Date: Thu, 19 May 2005 21:57:38 +0200 (CEST) Subject: [pypy-svn] r12578 - pypy/dist/pypy/documentation Message-ID: <20050519195738.5D72527BB9@code1.codespeak.net> Author: hpk Date: Thu May 19 21:57:38 2005 New Revision: 12578 Modified: pypy/dist/pypy/documentation/index.txt Log: issue65 in-progress reviewed the list of references and found a lot of them not really fitting anymore or not very helpful. I thus reduced the list which is basically now a better start of a 'related projects' sections. We should probably invest some more effort and make a real 'papers and talk' section on the index page, referencing our so-far presentations (including the OSCON one). Before removing references i would have liked to talk this over with someone but no one was available and release time is coming close. Modified: pypy/dist/pypy/documentation/index.txt ============================================================================== --- pypy/dist/pypy/documentation/index.txt (original) +++ pypy/dist/pypy/documentation/index.txt Thu May 19 21:57:38 2005 @@ -39,47 +39,36 @@ Further reading / related projects ---------------------------------- -* oscon2003-paper_ is a paper we presented at Oscon 2003 describing +* oscon2003-paper_ is a early paper presented at Oscon 2003 describing what the pypy project is about and why you should care -* An interesting thread on an HP tech report that may be proof the pypy is feasible_ . (We already knew that...) +* Dynamo_ showcased `transparent dynamic optimization`_ + generating translating a binary program into an optimizied version at runtime. -* An interesting thread on why VHLL rock_ . (We already knew that too.) - -* A thread on Python in Scheme_ . +* spyweb_ translates Python programs to Scheme. -* An intriguting project, FlashMob_ - creating an adhoc supercomputer. +* `GNU lightning`_ generates assembly language at runtime. -* A discussion on Python and lisp_ support +* `LLVM`_ the low level virtual machine project. -* An interesting repository_ of papers by Xerox Parc members, with quite a few issues more or less relevant to PyPy. - -* A thread on the gnu lightning_ project."GNU lightning is a library that generates assembly language code at run-time; it is very fast, making it ideal for Just-In-Time compilers, and it abstracts over the target CPU, as it exposes to the clients a standardized RISC instruction set inspired by the MIPS and SPARC chips." - -* A project to create a Low Level Virtual Machine (LLVM_) and a PyPy-LLVM_ discussion, and conversation_ between PyPy and LLVM. - -* A thread discussing the xhelix_ python C extension implementing Helix encryption and authentication, which may be interesting to use as a pypy performance test at some point. - -* A paper for PyCon 2004: "IronPython_ is a new implementation of the Python language targeting the Common Language Runtime (CLR). It compiles python programs into bytecode (IL) that will run on either Microsoft's .NET or the Open Source Mono platform. IronPython includes an interactive interpreter and transparent on-the-fly compilation of source files just like standard Python. In addition, IronPython supports static compilation of Python code to produce static executables (.exe's) that can be run directly or static libraries (.dll's) that can be called from other CLR languages." - -* A comparison of Python and Pliant_ , an OS written in a python-like language. +* `Iron Python`_ a new Python implementation compiling Python into + Microsofts Common Language Runtime (CLR) Intermediate Language (IL). +* `Squeak`_ is a Smalltalk-80 implementation written in + Smalltalk, being used in `Croquet`_, an experimental + distributed multi-user/multi-programmer virtual world. +.. _`Squeak`: http://www.squeak.org/ +.. _`Croquet`: http://www.opencroquet.org/ +.. _`Iron Python`: http://www.gotdotnet.com/workspaces/workspace.aspx?id=ad7acff7-ab1e-4bcb-99c0-57ac5a3a9742 +.. _`transparent dynamic optimization`: http://www.hpl.hp.com/techreports/1999/HPL-1999-77.pdf +.. _Dynamo: http://www.hpl.hp.com/techreports/1999/HPL-1999-78.pdf .. _oscon2003-paper: http://codespeak.net/pypy/index.cgi?extradoc/talk/oscon2003-paper.html -.. _howtosvn: http://codespeak.net/pypy/index.cgi?doc/howtosvn.html .. _optionaltool: http://codespeak.net/pypy/index.cgi?doc/optionaltool.html .. _testdesign: http://codespeak.net/pypy/index.cgi?doc/testdesign.html .. _feasible: http://codespeak.net/pipermail/pypy-dev/2004q2/001289.html .. _rock: http://codespeak.net/pipermail/pypy-dev/2004q1/001255.html -.. _Scheme: http://codespeak.net/pipermail/pypy-dev/2004q1/001256.html -.. _FlashMob: http://www.flashmobcomputing.org/ -.. _lisp: http://codespeak.net/pipermail/pypy-dev/2003q4/001048.html -.. _repository: http://www2.parc.com/csl/groups/sda/publications.shtml -.. _lightning: http://codespeak.net/pipermail/pypy-dev/2003q4/001051.html +.. _spyweb: http://spyweb.hopto.org/ +.. _`GNU lightning`: http://www.gnu.org/software/lightning/lightning.html .. _LLVM: http://llvm.cs.uiuc.edu/ -.. _PyPy-LLVM: http://codespeak.net/pipermail/pypy-dev/2003q4/001115.html -.. _conversation: http://codespeak.net/pipermail/pypy-dev/2003q4/001119.html -.. _xhelix: http://codespeak.net/pipermail/pypy-dev/2003q4/001129.html .. _IronPython: http://www.python.org/pycon/dc2004/papers/9/ -.. _pliant: http://pliant.cx -.. _recently-modified: http://codespeak.net/pypy/index.cgi?doc/recent From hpk at codespeak.net Thu May 19 22:10:20 2005 From: hpk at codespeak.net (hpk at codespeak.net) Date: Thu, 19 May 2005 22:10:20 +0200 (CEST) Subject: [pypy-svn] r12579 - pypy/dist/pypy/documentation Message-ID: <20050519201020.9C54527B61@code1.codespeak.net> Author: hpk Date: Thu May 19 22:10:20 2005 New Revision: 12579 Modified: pypy/dist/pypy/documentation/index.txt Log: i think the indentation & itemization of our main documentation links is silly. Modified: pypy/dist/pypy/documentation/index.txt ============================================================================== --- pypy/dist/pypy/documentation/index.txt (original) +++ pypy/dist/pypy/documentation/index.txt Thu May 19 22:10:20 2005 @@ -7,24 +7,24 @@ Here are some good entry points into PyPy's world: - * architecture_ gives a complete view of PyPy's basic design. +architecture_ gives a complete view of PyPy's basic design. - * `getting started`_ provides hands-on instructions - including a two-liner to run PyPy on your computer. +`getting started`_ provides hands-on instructions +including a two-liner to run PyPy on your computer. - * coding-guide_ helps you to write code for PyPy. +coding-guide_ helps you to write code for PyPy. - * objspace_ discusses the object space interface - and several implementations. +objspace_ discusses the object space interface +and several implementations. - * translation_ offers the beginnings of documentation - about our low level code generator backends. +translation_ offers the beginnings of documentation +about our low level code generator backends. - * `compliance test report`_ shows status information - about recent runs of CPython's regression tests against PyPy. +`compliance test report`_ shows status information +about recent runs of CPython's regression tests against PyPy. - * `license`_ tells you that basically all of PyPy is licensed - under the OSI-approved very liberal MIT-license +`license`_ tells you that basically all of PyPy is licensed +under the OSI-approved very liberal MIT-license .. _`license`: http://codespeak.net/svn/pypy/dist/LICENSE .. _`compliance test report`: http://codespeak.net/~hpk/pypy-testresult/ From hpk at codespeak.net Thu May 19 22:13:32 2005 From: hpk at codespeak.net (hpk at codespeak.net) Date: Thu, 19 May 2005 22:13:32 +0200 (CEST) Subject: [pypy-svn] r12581 - pypy/dist/pypy/documentation Message-ID: <20050519201332.4409B27B61@code1.codespeak.net> Author: hpk Date: Thu May 19 22:13:32 2005 New Revision: 12581 Modified: pypy/dist/pypy/documentation/index.txt pypy/dist/pypy/documentation/navlist Log: streamlining ndex and navigation list Modified: pypy/dist/pypy/documentation/index.txt ============================================================================== --- pypy/dist/pypy/documentation/index.txt (original) +++ pypy/dist/pypy/documentation/index.txt Thu May 19 22:13:32 2005 @@ -2,15 +2,12 @@ PyPy - a Python_ implementation written in Python ================================================= - .. _Python: http://www.python.org/dev/doc/maint24/ref/ref.html -Here are some good entry points into PyPy's world: - architecture_ gives a complete view of PyPy's basic design. `getting started`_ provides hands-on instructions -including a two-liner to run PyPy on your computer. +including a two-liner to run PyPy on your system. coding-guide_ helps you to write code for PyPy. Modified: pypy/dist/pypy/documentation/navlist ============================================================================== --- pypy/dist/pypy/documentation/navlist (original) +++ pypy/dist/pypy/documentation/navlist Thu May 19 22:13:32 2005 @@ -1,9 +1,9 @@ [ - 'getting_started.html', 'architecture.html', + 'getting_started.html', 'coding-guide.html', 'objspace.html', 'translation.html', - 'misc.html', +# 'misc.html', 'theory.html', ] From pedronis at codespeak.net Thu May 19 22:26:44 2005 From: pedronis at codespeak.net (pedronis at codespeak.net) Date: Thu, 19 May 2005 22:26:44 +0200 (CEST) Subject: [pypy-svn] r12582 - pypy/dist/pypy/translator/test Message-ID: <20050519202644.7460727B75@code1.codespeak.net> Author: pedronis Date: Thu May 19 22:26:44 2005 New Revision: 12582 Modified: pypy/dist/pypy/translator/test/test_annrpython.py Log: test for sys attrs access Modified: pypy/dist/pypy/translator/test/test_annrpython.py ============================================================================== --- pypy/dist/pypy/translator/test/test_annrpython.py (original) +++ pypy/dist/pypy/translator/test/test_annrpython.py Thu May 19 22:26:44 2005 @@ -1025,6 +1025,20 @@ assert a.binding(et) == t assert isinstance(a.binding(ev), annmodel.SomeInstance) and a.binding(ev).classdef.cls == Exception + def test_sys_attrs(self): + import sys + def f(): + return sys.argv[0] + a = self.RPythonAnnotator() + try: + oldvalue = sys.argv + sys.argv = [] + s = a.build_types(f, []) + finally: + sys.argv = oldvalue + assert s is not None + + def g(n): return [0,1,2,n] From tismer at codespeak.net Thu May 19 22:27:21 2005 From: tismer at codespeak.net (tismer at codespeak.net) Date: Thu, 19 May 2005 22:27:21 +0200 (CEST) Subject: [pypy-svn] r12583 - in pypy/dist/pypy: module objspace/std Message-ID: <20050519202721.0A49727B82@code1.codespeak.net> Author: tismer Date: Thu May 19 22:27:20 2005 New Revision: 12583 Removed: pypy/dist/pypy/module/exceptionsinterp.py Modified: pypy/dist/pypy/objspace/std/objspace.py Log: [issue14] testing this was much easier than I thought. Deleted: /pypy/dist/pypy/module/exceptionsinterp.py ============================================================================== --- /pypy/dist/pypy/module/exceptionsinterp.py Thu May 19 22:27:20 2005 +++ (empty file) @@ -1,1813 +0,0 @@ -#!/bin/env python -# -*- coding: LATIN-1 -*- - -#************************************************************* - -def initexceptions(space): - """NOT_RPYTHON""" - - __doc__ = \ -"""Python's standard exception class hierarchy. - -Before Python 1.5, the standard exceptions were all simple string objects. -In Python 1.5, the standard exceptions were converted to classes organized -into a relatively flat hierarchy. String-based standard exceptions were -optional, or used as a fallback if some problem occurred while importing -the exception module. With Python 1.6, optional string-based standard -exceptions were removed (along with the -X command line flag). - -The class exceptions were implemented in such a way as to be almost -completely backward compatible. Some tricky uses of IOError could -potentially have broken, but by Python 1.6, all of these should have -been fixed. As of Python 1.6, the class-based standard exceptions are -now implemented in C, and are guaranteed to exist in the Python -interpreter. - -Here is a rundown of the class hierarchy. The classes found here are -inserted into both the exceptions module and the `built-in' module. It is -recommended that user defined class based exceptions be derived from the -`Exception' class, although this is currently not enforced. - -Exception - | - +-- SystemExit - +-- StopIteration - +-- StandardError - | | - | +-- KeyboardInterrupt - | +-- ImportError - | +-- EnvironmentError - | | | - | | +-- IOError - | | +-- OSError - | | | - | | +-- WindowsError - | | +-- VMSError - | | - | +-- EOFError - | +-- RuntimeError - | | | - | | +-- NotImplementedError - | | - | +-- NameError - | | | - | | +-- UnboundLocalError - | | - | +-- AttributeError - | +-- SyntaxError - | | | - | | +-- IndentationError - | | | - | | +-- TabError - | | - | +-- TypeError - | +-- AssertionError - | +-- LookupError - | | | - | | +-- IndexError - | | +-- KeyError - | | - | +-- ArithmeticError - | | | - | | +-- OverflowError - | | +-- ZeroDivisionError - | | +-- FloatingPointError - | | - | +-- ValueError - | | | - | | +-- UnicodeError - | | | - | | +-- UnicodeEncodeError - | | +-- UnicodeDecodeError - | | +-- UnicodeTranslateError - | | - | +-- ReferenceError - | +-- SystemError - | +-- MemoryError - | - +---Warning - | - +-- UserWarning - +-- DeprecationWarning - +-- PendingDeprecationWarning - +-- SyntaxWarning - +-- OverflowWarning - +-- RuntimeWarning - +-- FutureWarning""" - -# global declarations -# global object g46dict -# global object gs_MemoryError -# global object gcls_MemoryError -# global object gcls_StandardError -# global object gcls_Exception -# global object gs___module__ -# global object gs__exceptions -# global object gs___doc__ -# global object gs_Exception -# global object gs_StandardError -# global object gs_ImportError -# global object gcls_ImportError -# global object gs_RuntimeError -# global object gcls_RuntimeError -# global object gs_UnicodeTranslateError -# global object gcls_UnicodeTranslateError -# global object gcls_UnicodeError -# global object gcls_ValueError -# global object gs_ValueError -# global object gs_UnicodeError -# global object gs_KeyError -# global object gcls_KeyError -# global object gcls_LookupError -# global object gs_LookupError -# global object gs_SyntaxWarning -# global object gcls_SyntaxWarning -# global object gcls_Warning -# global object gs_Warning -# global object gs_StopIteration -# global object gcls_StopIteration -# global object gs_PendingDeprecationWarning -# global object gcls_PendingDeprecationWarning -# global object gs_EnvironmentError -# global object gcls_EnvironmentError -# global object gs_OSError -# global object gcls_OSError -# global object gs_DeprecationWarning -# global object gcls_DeprecationWarning -# global object gs_FloatingPointError -# global object gcls_FloatingPointError -# global object gcls_ArithmeticError -# global object gs_ArithmeticError -# global object gs_AttributeError -# global object gcls_AttributeError -# global object gs_IndentationError -# global object gcls_IndentationError -# global object gcls_SyntaxError -# global object gs_SyntaxError -# global object gs_NameError -# global object gcls_NameError -# global object gs_OverflowWarning -# global object gcls_OverflowWarning -# global object gs_IOError -# global object gcls_IOError -# global object gs_FutureWarning -# global object gcls_FutureWarning -# global object gs_SystemExit -# global object gcls_SystemExit -# global object gs_EOFError -# global object gcls_EOFError -# global object gs___file__ -# global object gs__home_hpk_pypy_dist_pypy_lib__ex -# global object gs_TabError -# global object gcls_TabError -# global object gs_UnicodeEncodeError -# global object gcls_UnicodeEncodeError -# global object gs_UnboundLocalError -# global object gcls_UnboundLocalError -# global object gs___name__ -# global object gs_ReferenceError -# global object gcls_ReferenceError -# global object gs_AssertionError -# global object gcls_AssertionError -# global object gs_UnicodeDecodeError -# global object gcls_UnicodeDecodeError -# global object gs_TypeError -# global object gcls_TypeError -# global object gs_IndexError -# global object gcls_IndexError -# global object gs_RuntimeWarning -# global object gcls_RuntimeWarning -# global object gs_KeyboardInterrupt -# global object gcls_KeyboardInterrupt -# global object gs_UserWarning -# global object gcls_UserWarning -# global object gs_ZeroDivisionError -# global object gcls_ZeroDivisionError -# global object gs_NotImplementedError -# global object gcls_NotImplementedError -# global object gs_SystemError -# global object gcls_SystemError -# global object gs_OverflowError -# global object gcls_OverflowError -# global object gs___init__ -# global object gfunc_UnicodeDecodeError___init__ -# global object gs___str__ -# global object gfunc_UnicodeDecodeError___str__ -# global object gfunc_UnicodeEncodeError___init__ -# global object gfunc_UnicodeEncodeError___str__ -# global object gfunc_SystemExit___init__ -# global object gfunc_SyntaxError___init__ -# global object gfunc_SyntaxError___str__ -# global object gs_filename -# global object gs_lineno -# global object gs_msg -# global object gs__emptystr_ -# global object gs_offset -# global object gs_print_file_and_line -# global object gs_text -# global object gfunc_EnvironmentError___init__ -# global object gfunc_EnvironmentError___str__ -# global object gfunc_KeyError___str__ -# global object gfunc_UnicodeTranslateError___init__ -# global object gfunc_UnicodeTranslateError___str__ -# global object gs___getitem__ -# global object gfunc_Exception___getitem__ -# global object gfunc_Exception___init__ -# global object gfunc_Exception___str__ - -##SECTION## -## filename '/usr/lib/python2.3/posixpath.py' -## function 'split' -## firstlineno 74 -##SECTION## -# global declarations -# global object gs_rfind -# global object gs___1 -# global object gcls_ValueError_1 -# global object gs_rstrip - - def split(space, __args__): - '''Split a pathname. Returns tuple "(head, tail)" where "tail" is - everything after the final slash. Either part may be empty.''' - - funcname = "split" - signature = ['p'], None, None - defaults_w = [] - w_p, = __args__.parse(funcname, signature, defaults_w) - return fastf_split(space, w_p) - - f_split = split - - def split(space, w_p): - '''Split a pathname. Returns tuple "(head, tail)" where "tail" is - everything after the final slash. Either part may be empty.''' - goto = 1 # startblock - while True: - - if goto == 1: - w_0 = space.getattr(w_p, gs_rfind) - w_1 = space.call_function(w_0, gs___1) - w_2 = space.add(w_1, gi_1) - w_3 = space.newslice(space.w_None, w_2, space.w_None) - w_4 = space.getitem(w_p, w_3) - w_5 = space.newslice(w_2, space.w_None, space.w_None) - w_6 = space.getitem(w_p, w_5) - w_7 = space.newtuple([w_4, w_6]) - w_8 = space.len(w_7) - w_9 = space.eq(w_8, gi_2) - v0 = space.is_true(w_9) - if v0 == True: - w_10 = w_7 - goto = 2 - else: - assert v0 == False - w_etype, w_evalue = space.w_ValueError, space.w_None - goto = 7 - - if goto == 2: - w_11 = space.getitem(w_10, gi_0) - w_12 = space.getitem(w_10, gi_1) - v1 = space.is_true(w_11) - if v1 == True: - w_head, w_tail = w_11, w_12 - goto = 3 - else: - assert v1 == False - w_head_1, w_tail_1, w_13 = w_11, w_12, w_11 - goto = 4 - - if goto == 3: - w_14 = space.len(w_head) - w_15 = space.mul(gs___1, w_14) - w_16 = space.ne(w_head, w_15) - w_head_1, w_tail_1, w_13 = w_head, w_tail, w_16 - goto = 4 - - if goto == 4: - v2 = space.is_true(w_13) - if v2 == True: - w_tail_2, w_17 = w_tail_1, w_head_1 - goto = 5 - else: - assert v2 == False - w_18, w_19 = w_head_1, w_tail_1 - goto = 6 - - if goto == 5: - w_20 = space.getattr(w_17, gs_rstrip) - w_21 = space.call_function(w_20, gs___1) - w_18, w_19 = w_21, w_tail_2 - goto = 6 - - if goto == 6: - w_22 = space.newtuple([w_18, w_19]) - w_23 = w_22 - goto = 8 - - if goto == 7: - raise gOperationError(w_etype, w_evalue) - - if goto == 8: - return w_23 - - fastf_split = split - -##SECTION## -## filename '/usr/lib/python2.3/posixpath.py' -## function 'basename' -## firstlineno 110 -##SECTION## -# global declaration -# global object gfunc_split - - def basename(space, __args__): - """Returns the final component of a pathname""" - - funcname = "basename" - signature = ['p'], None, None - defaults_w = [] - w_p, = __args__.parse(funcname, signature, defaults_w) - return fastf_basename(space, w_p) - - f_basename = basename - - def basename(space, w_p): - """Returns the final component of a pathname""" - goto = 1 # startblock - while True: - - if goto == 1: - w_0 = fastf_split(space, w_p) - w_1 = space.getitem(w_0, gi_1) - w_2 = w_1 - goto = 2 - - if goto == 2: - return w_2 - - fastf_basename = basename - -##SECTION## -## filename 'lib/_exceptions.py' -## function '__getitem__' -## firstlineno 93 -##SECTION## - def __getitem__(space, __args__): - funcname = "__getitem__" - signature = ['self', 'idx'], None, None - defaults_w = [] - w_self, w_idx = __args__.parse(funcname, signature, defaults_w) - return fastf_Exception___getitem__(space, w_self, w_idx) - - f_Exception___getitem__ = __getitem__ - - def __getitem__(space, w_self, w_idx): - goto = 1 # startblock - while True: - - if goto == 1: - w_0 = space.getattr(w_self, gs_args) - w_1 = space.getitem(w_0, w_idx) - w_2 = w_1 - goto = 2 - - if goto == 2: - return w_2 - - fastf_Exception___getitem__ = __getitem__ - -##SECTION## -## filename 'lib/_exceptions.py' -## function '__init__' -## firstlineno 97 -##SECTION## - def __init__(space, __args__): - funcname = "__init__" - signature = ['self'], 'args', None - defaults_w = [] - w_self, w_args = __args__.parse(funcname, signature, defaults_w) - return fastf_Exception___init__(space, w_self, w_args) - - f_Exception___init__ = __init__ - - def __init__(space, w_self, w_args): - goto = 1 # startblock - while True: - - if goto == 1: - w_0 = space.setattr(w_self, gs_args, w_args) - w_1 = space.w_None - goto = 2 - - if goto == 2: - return w_1 - - fastf_Exception___init__ = __init__ - -##SECTION## -## filename 'lib/_exceptions.py' -## function '__str__' -## firstlineno 101 -##SECTION## -# global declarations -# global object gs_args -# global object gi_0 -# global object gi_1 - - def __str__(space, __args__): - funcname = "__str__" - signature = ['self'], None, None - defaults_w = [] - w_self, = __args__.parse(funcname, signature, defaults_w) - return fastf_Exception___str__(space, w_self) - - f_Exception___str__ = __str__ - - def __str__(space, w_self): - goto = 1 # startblock - while True: - - if goto == 1: - w_0 = space.getattr(w_self, gs_args) - w_1 = space.len(w_0) - w_2 = space.eq(w_1, gi_0) - v0 = space.is_true(w_2) - if v0 == True: - w_3 = gs__emptystr_ - goto = 5 - else: - assert v0 == False - w_args, w_4 = w_0, w_1 - goto = 2 - - if goto == 2: - w_5 = space.eq(w_4, gi_1) - v1 = space.is_true(w_5) - if v1 == True: - w_6 = w_args - goto = 3 - else: - assert v1 == False - w_7 = w_args - goto = 4 - - if goto == 3: - w_8 = space.getitem(w_6, gi_0) - w_9 = space.str(w_8) - w_3 = w_9 - goto = 5 - - if goto == 4: - w_10 = space.str(w_7) - w_3 = w_10 - goto = 5 - - if goto == 5: - return w_3 - - fastf_Exception___str__ = __str__ - -##SECTION## -## filename 'lib/_exceptions.py' -## function '__init__' -## firstlineno 130 -##SECTION## -# global declarations -# global object gi_4 -# global object gi_2 -# global object gi_3 - - def __init__(space, __args__): - funcname = "__init__" - signature = ['self'], 'args', None - defaults_w = [] - w_self, w_args = __args__.parse(funcname, signature, defaults_w) - return fastf_UnicodeTranslateError___init__(space, w_self, w_args) - - f_UnicodeTranslateError___init__ = __init__ - - def __init__(space, w_self, w_args): - goto = 1 # startblock - while True: - - if goto == 1: - w_0 = space.len(w_args) - w_1 = space.setattr(w_self, gs_args, w_args) - w_2 = space.eq(w_0, gi_4) - v0 = space.is_true(w_2) - if v0 == True: - w_self_1, w_args_1 = w_self, w_args - goto = 2 - else: - assert v0 == False - w_3 = space.w_None - goto = 3 - - if goto == 2: - w_4 = space.getitem(w_args_1, gi_0) - w_5 = space.setattr(w_self_1, gs_object, w_4) - w_6 = space.getitem(w_args_1, gi_1) - w_7 = space.setattr(w_self_1, gs_start, w_6) - w_8 = space.getitem(w_args_1, gi_2) - w_9 = space.setattr(w_self_1, gs_end, w_8) - w_10 = space.getitem(w_args_1, gi_3) - w_11 = space.setattr(w_self_1, gs_reason, w_10) - w_3 = space.w_None - goto = 3 - - if goto == 3: - return w_3 - - fastf_UnicodeTranslateError___init__ = __init__ - -##SECTION## -## filename 'lib/_exceptions.py' -## function '__str__' -## firstlineno 140 -##SECTION## -# global declarations -# global object gs_getattr -# global object gs_start -# global object gs_start_ -# global object gs_reason -# global object gs_reason_ -# global object gs_args_ -# global object gs_end -# global object gs_end_ -# global object gs_object -# global object gs_object_ -# global object gbltinmethod_join -# global object gs__ -# global object gs_join - - def __str__(space, __args__): - funcname = "__str__" - signature = ['self'], None, None - defaults_w = [] - w_self, = __args__.parse(funcname, signature, defaults_w) - return fastf_UnicodeTranslateError___str__(space, w_self) - - f_UnicodeTranslateError___str__ = __str__ - - def __str__(space, w_self): - goto = 1 # startblock - while True: - - if goto == 1: - w_0 = space.call_function((space.builtin.get(space.str_w(gs_getattr))), w_self, gs_start, space.w_None) - w_1 = space.str(w_0) - w_2 = space.add(gs_start_, w_1) - w_3 = space.call_function((space.builtin.get(space.str_w(gs_getattr))), w_self, gs_reason, space.w_None) - w_4 = space.str(w_3) - w_5 = space.add(gs_reason_, w_4) - w_6 = space.call_function((space.builtin.get(space.str_w(gs_getattr))), w_self, gs_args, space.w_None) - w_7 = space.str(w_6) - w_8 = space.add(gs_args_, w_7) - w_9 = space.call_function((space.builtin.get(space.str_w(gs_getattr))), w_self, gs_end, space.w_None) - w_10 = space.str(w_9) - w_11 = space.add(gs_end_, w_10) - w_12 = space.call_function((space.builtin.get(space.str_w(gs_getattr))), w_self, gs_object, space.w_None) - w_13 = space.str(w_12) - w_14 = space.add(gs_object_, w_13) - w_15 = space.newlist([w_2, w_5, w_8, w_11, w_14]) - w_16 = space.call_function(gbltinmethod_join, w_15) - w_17 = w_16 - goto = 2 - - if goto == 2: - return w_17 - - fastf_UnicodeTranslateError___str__ = __str__ - -##SECTION## -## filename 'lib/_exceptions.py' -## function '__str__' -## firstlineno 158 -##SECTION## - def __str__(space, __args__): - funcname = "__str__" - signature = ['self'], None, None - defaults_w = [] - w_self, = __args__.parse(funcname, signature, defaults_w) - return fastf_KeyError___str__(space, w_self) - - f_KeyError___str__ = __str__ - - def __str__(space, w_self): - goto = 1 # startblock - while True: - - if goto == 1: - w_0 = space.getattr(w_self, gs_args) - w_1 = space.len(w_0) - w_2 = space.eq(w_1, gi_0) - v0 = space.is_true(w_2) - if v0 == True: - w_3 = gs__emptystr_ - goto = 5 - else: - assert v0 == False - w_args, w_4 = w_0, w_1 - goto = 2 - - if goto == 2: - w_5 = space.eq(w_4, gi_1) - v1 = space.is_true(w_5) - if v1 == True: - w_6 = w_args - goto = 3 - else: - assert v1 == False - w_7 = w_args - goto = 4 - - if goto == 3: - w_8 = space.getitem(w_6, gi_0) - w_9 = space.repr(w_8) - w_3 = w_9 - goto = 5 - - if goto == 4: - w_10 = space.str(w_7) - w_3 = w_10 - goto = 5 - - if goto == 5: - return w_3 - - fastf_KeyError___str__ = __str__ - -##SECTION## -## filename 'lib/_exceptions.py' -## function '__init__' -## firstlineno 181 -##SECTION## - def __init__(space, __args__): - funcname = "__init__" - signature = ['self'], 'args', None - defaults_w = [] - w_self, w_args = __args__.parse(funcname, signature, defaults_w) - return fastf_EnvironmentError___init__(space, w_self, w_args) - - f_EnvironmentError___init__ = __init__ - - def __init__(space, w_self, w_args): - goto = 1 # startblock - while True: - - if goto == 1: - w_0 = space.len(w_args) - w_1 = space.setattr(w_self, gs_args, w_args) - w_2 = space.setattr(w_self, gs_errno, space.w_None) - w_3 = space.setattr(w_self, gs_strerror, space.w_None) - w_4 = space.setattr(w_self, gs_filename, space.w_None) - w_5 = space.le(gi_2, w_0) - v0 = space.is_true(w_5) - if v0 == True: - w_self_1, w_args_1, w_argc = w_self, w_args, w_0 - goto = 2 - else: - assert v0 == False - w_self_2, w_args_2, w_argc_1, w_6 = w_self, w_args, w_0, w_5 - goto = 3 - - if goto == 2: - w_7 = space.le(w_argc, gi_3) - (w_self_2, w_args_2, w_argc_1, w_6) = (w_self_1, w_args_1, w_argc, - w_7) - goto = 3 - - if goto == 3: - v1 = space.is_true(w_6) - if v1 == True: - w_self_3, w_args_3, w_argc_2 = w_self_2, w_args_2, w_argc_1 - goto = 4 - else: - assert v1 == False - w_self_4, w_args_4, w_8 = w_self_2, w_args_2, w_argc_1 - goto = 5 - - if goto == 4: - w_9 = space.getitem(w_args_3, gi_0) - w_10 = space.setattr(w_self_3, gs_errno, w_9) - w_11 = space.getitem(w_args_3, gi_1) - w_12 = space.setattr(w_self_3, gs_strerror, w_11) - w_self_4, w_args_4, w_8 = w_self_3, w_args_3, w_argc_2 - goto = 5 - - if goto == 5: - w_13 = space.eq(w_8, gi_3) - v2 = space.is_true(w_13) - if v2 == True: - w_self_5, w_args_5 = w_self_4, w_args_4 - goto = 6 - else: - assert v2 == False - w_14 = space.w_None - goto = 7 - - if goto == 6: - w_15 = space.getitem(w_args_5, gi_2) - w_16 = space.setattr(w_self_5, gs_filename, w_15) - w_17 = space.getitem(w_args_5, gi_0) - w_18 = space.getitem(w_args_5, gi_1) - w_19 = space.newtuple([w_17, w_18]) - w_20 = space.setattr(w_self_5, gs_args, w_19) - w_14 = space.w_None - goto = 7 - - if goto == 7: - return w_14 - - fastf_EnvironmentError___init__ = __init__ - -##SECTION## -## filename 'lib/_exceptions.py' -## function '__str__' -## firstlineno 194 -##SECTION## -# global declarations -# global object gs_errno -# global object gs_strerror -# global object gs__Errno__s___s___s -# global object gs__Errno__s___s - - def __str__(space, __args__): - funcname = "__str__" - signature = ['self'], None, None - defaults_w = [] - w_self, = __args__.parse(funcname, signature, defaults_w) - return fastf_EnvironmentError___str__(space, w_self) - - f_EnvironmentError___str__ = __str__ - - def __str__(space, w_self): - goto = 1 # startblock - while True: - - if goto == 1: - w_0 = space.getattr(w_self, gs_filename) - w_1 = space.is_(w_0, space.w_None) - v0 = space.is_true(w_1) - if v0 == True: - w_self_1 = w_self - goto = 3 - else: - assert v0 == False - w_self_2 = w_self - goto = 2 - - if goto == 2: - w_2 = space.getattr(w_self_2, gs_errno) - w_3 = space.getattr(w_self_2, gs_strerror) - w_4 = space.getattr(w_self_2, gs_filename) - w_5 = space.newtuple([w_2, w_3, w_4]) - w_6 = space.mod(gs__Errno__s___s___s, w_5) - w_7 = w_6 - goto = 8 - - if goto == 3: - w_8 = space.getattr(w_self_1, gs_errno) - v1 = space.is_true(w_8) - if v1 == True: - w_self_3 = w_self_1 - goto = 4 - else: - assert v1 == False - w_self_4, w_9 = w_self_1, w_8 - goto = 5 - - if goto == 4: - w_10 = space.getattr(w_self_3, gs_strerror) - w_self_4, w_9 = w_self_3, w_10 - goto = 5 - - if goto == 5: - v2 = space.is_true(w_9) - if v2 == True: - w_self_5 = w_self_4 - goto = 6 - else: - assert v2 == False - w_11 = w_self_4 - goto = 7 - - if goto == 6: - w_12 = space.getattr(w_self_5, gs_errno) - w_13 = space.getattr(w_self_5, gs_strerror) - w_14 = space.newtuple([w_12, w_13]) - w_15 = space.mod(gs__Errno__s___s, w_14) - w_7 = w_15 - goto = 8 - - if goto == 7: - w_16 = fastf_Exception___str__(space, w_11) - w_7 = w_16 - goto = 8 - - if goto == 8: - return w_7 - - fastf_EnvironmentError___str__ = __str__ - -##SECTION## -## filename 'lib/_exceptions.py' -## function '__init__' -## firstlineno 238 -##SECTION## - def __init__(space, __args__): - funcname = "__init__" - signature = ['self'], 'args', None - defaults_w = [] - w_self, w_args = __args__.parse(funcname, signature, defaults_w) - return fastf_SyntaxError___init__(space, w_self, w_args) - - f_SyntaxError___init__ = __init__ - - def __init__(space, w_self, w_args): - goto = 1 # startblock - while True: - - if goto == 1: - w_0 = space.len(w_args) - w_1 = space.setattr(w_self, gs_args, w_args) - w_2 = space.ge(w_0, gi_1) - v0 = space.is_true(w_2) - if v0 == True: - w_self_1, w_args_1, w_argc = w_self, w_args, w_0 - goto = 2 - else: - assert v0 == False - w_self_2, w_args_2, w_3 = w_self, w_args, w_0 - goto = 3 - - if goto == 2: - w_4 = space.getitem(w_args_1, gi_0) - w_5 = space.setattr(w_self_1, gs_msg, w_4) - w_self_2, w_args_2, w_3 = w_self_1, w_args_1, w_argc - goto = 3 - - if goto == 3: - w_6 = space.eq(w_3, gi_2) - v1 = space.is_true(w_6) - if v1 == True: - w_self_3, w_args_3 = w_self_2, w_args_2 - goto = 4 - else: - assert v1 == False - w_7 = space.w_None - goto = 5 - - if goto == 4: - w_8 = space.getitem(w_args_3, gi_1) - w_9 = space.getitem(w_8, gi_0) - w_10 = space.setattr(w_self_3, gs_filename, w_9) - w_11 = space.getitem(w_args_3, gi_1) - w_12 = space.getitem(w_11, gi_1) - w_13 = space.setattr(w_self_3, gs_lineno, w_12) - w_14 = space.getitem(w_args_3, gi_1) - w_15 = space.getitem(w_14, gi_2) - w_16 = space.setattr(w_self_3, gs_offset, w_15) - w_17 = space.getitem(w_args_3, gi_1) - w_18 = space.getitem(w_17, gi_3) - w_19 = space.setattr(w_self_3, gs_text, w_18) - w_7 = space.w_None - goto = 5 - - if goto == 5: - return w_7 - - fastf_SyntaxError___init__ = __init__ - -##SECTION## -## filename 'lib/_exceptions.py' -## function '__str__' -## firstlineno 249 -##SECTION## -# global declarations -# global object gs____ -# global object gfunc_basename -# global object gs__s___s__line__ld_ -# global object gs__s___s_ -# global object gs__s__line__ld_ - - def __str__(space, __args__): - funcname = "__str__" - signature = ['self'], None, None - defaults_w = [] - w_self, = __args__.parse(funcname, signature, defaults_w) - return fastf_SyntaxError___str__(space, w_self) - - f_SyntaxError___str__ = __str__ - - def __str__(space, w_self): - goto = 1 # startblock - while True: - - if goto == 1: - w_0 = space.getattr(w_self, gs_msg) - w_1 = space.type(w_0) - w_2 = space.is_(w_1, space.w_str) - v0 = space.is_true(w_2) - if v0 == True: - w_self_1 = w_self - goto = 3 - else: - assert v0 == False - w_3 = w_self - goto = 2 - - if goto == 2: - w_4 = space.getattr(w_3, gs_msg) - w_5 = w_4 - goto = 13 - - if goto == 3: - w_6 = space.getattr(w_self_1, gs_msg) - w_7 = space.getattr(w_self_1, gs_filename) - w_8 = space.type(w_7) - w_9 = space.is_(w_8, space.w_str) - w_10 = space.getattr(w_self_1, gs_lineno) - w_11 = space.type(w_10) - w_12 = space.is_(w_11, space.w_int) - v1 = space.is_true(w_9) - if v1 == True: - (w_self_2, w_buffer, w_have_lineno, w_have_filename, - w_13) = (w_self_1, w_6, w_12, w_9, w_9) - goto = 4 - else: - assert v1 == False - (w_self_2, w_buffer, w_have_lineno, w_have_filename, - w_13) = (w_self_1, w_6, w_12, w_9, w_12) - goto = 4 - - if goto == 4: - v2 = space.is_true(w_13) - if v2 == True: - (w_self_3, w_buffer_1, w_have_lineno_1, - w_have_filename_1) = (w_self_2, w_buffer, w_have_lineno, - w_have_filename) - goto = 5 - else: - assert v2 == False - w_5 = w_buffer - goto = 13 - - if goto == 5: - w_14 = space.getattr(w_self_3, gs_filename) - v3 = space.is_true(w_14) - if v3 == True: - (w_self_4, w_buffer_2, w_have_lineno_2, w_have_filename_2, - w_15) = (w_self_3, w_buffer_1, w_have_lineno_1, - w_have_filename_1, w_14) - goto = 6 - else: - assert v3 == False - (w_self_4, w_buffer_2, w_have_lineno_2, w_have_filename_2, - w_15) = (w_self_3, w_buffer_1, w_have_lineno_1, - w_have_filename_1, gs____) - goto = 6 - - if goto == 6: - w_16 = fastf_basename(space, w_15) - v4 = space.is_true(w_have_filename_2) - if v4 == True: - (w_self_5, w_fname, w_buffer_3, w_have_lineno_3, - w_have_filename_3, w_17) = (w_self_4, w_16, w_buffer_2, - w_have_lineno_2, w_have_filename_2, w_have_lineno_2) - goto = 7 - else: - assert v4 == False - (w_self_5, w_fname, w_buffer_3, w_have_lineno_3, - w_have_filename_3, w_17) = (w_self_4, w_16, w_buffer_2, - w_have_lineno_2, w_have_filename_2, w_have_filename_2) - goto = 7 - - if goto == 7: - v5 = space.is_true(w_17) - if v5 == True: - w_self_6, w_fname_1 = w_self_5, w_fname - goto = 8 - else: - assert v5 == False - (w_self_7, w_fname_2, w_buffer_4, w_have_lineno_4, - w_18) = (w_self_5, w_fname, w_buffer_3, w_have_lineno_3, - w_have_filename_3) - goto = 9 - - if goto == 8: - w_19 = space.getattr(w_self_6, gs_msg) - w_20 = space.getattr(w_self_6, gs_lineno) - w_21 = space.newtuple([w_19, w_fname_1, w_20]) - w_22 = space.mod(gs__s___s__line__ld_, w_21) - w_5 = w_22 - goto = 13 - - if goto == 9: - v6 = space.is_true(w_18) - if v6 == True: - w_fname_3, w_23 = w_fname_2, w_self_7 - goto = 10 - else: - assert v6 == False - (w_self_8, w_buffer_5, w_24) = (w_self_7, w_buffer_4, - w_have_lineno_4) - goto = 11 - - if goto == 10: - w_25 = space.getattr(w_23, gs_msg) - w_26 = space.newtuple([w_25, w_fname_3]) - w_27 = space.mod(gs__s___s_, w_26) - w_5 = w_27 - goto = 13 - - if goto == 11: - v7 = space.is_true(w_24) - if v7 == True: - w_self_9 = w_self_8 - goto = 12 - else: - assert v7 == False - w_5 = w_buffer_5 - goto = 13 - - if goto == 12: - w_28 = space.getattr(w_self_9, gs_msg) - w_29 = space.getattr(w_self_9, gs_lineno) - w_30 = space.newtuple([w_28, w_29]) - w_31 = space.mod(gs__s__line__ld_, w_30) - w_5 = w_31 - goto = 13 - - if goto == 13: - return w_5 - - fastf_SyntaxError___str__ = __str__ - -##SECTION## -## filename 'lib/_exceptions.py' -## function '__init__' -## firstlineno 275 -##SECTION## -# global declaration -# global object gs_code - - def __init__(space, __args__): - funcname = "__init__" - signature = ['self'], 'args', None - defaults_w = [] - w_self, w_args = __args__.parse(funcname, signature, defaults_w) - return fastf_SystemExit___init__(space, w_self, w_args) - - f_SystemExit___init__ = __init__ - - def __init__(space, w_self, w_args): - goto = 1 # startblock - while True: - - if goto == 1: - w_0 = space.len(w_args) - w_1 = space.eq(w_0, gi_0) - v0 = space.is_true(w_1) - if v0 == True: - w_self_1, w_args_1, w_argc = w_self, w_args, w_0 - goto = 2 - else: - assert v0 == False - w_self_2, w_args_2, w_argc_1 = w_self, w_args, w_0 - goto = 3 - - if goto == 2: - w_2 = space.setattr(w_self_1, gs_code, space.w_None) - w_self_2, w_args_2, w_argc_1 = w_self_1, w_args_1, w_argc - goto = 3 - - if goto == 3: - w_3 = space.setattr(w_self_2, gs_args, w_args_2) - w_4 = space.eq(w_argc_1, gi_1) - v1 = space.is_true(w_4) - if v1 == True: - w_self_3, w_args_3, w_argc_2 = w_self_2, w_args_2, w_argc_1 - goto = 4 - else: - assert v1 == False - w_self_4, w_args_4, w_5 = w_self_2, w_args_2, w_argc_1 - goto = 5 - - if goto == 4: - w_6 = space.getitem(w_args_3, gi_0) - w_7 = space.setattr(w_self_3, gs_code, w_6) - w_self_4, w_args_4, w_5 = w_self_3, w_args_3, w_argc_2 - goto = 5 - - if goto == 5: - w_8 = space.ge(w_5, gi_2) - v2 = space.is_true(w_8) - if v2 == True: - w_9, w_10 = w_args_4, w_self_4 - goto = 6 - else: - assert v2 == False - w_11 = space.w_None - goto = 7 - - if goto == 6: - w_12 = space.setattr(w_10, gs_code, w_9) - w_11 = space.w_None - goto = 7 - - if goto == 7: - return w_11 - - fastf_SystemExit___init__ = __init__ - -##SECTION## -## filename 'lib/_exceptions.py' -## function '__init__' -## firstlineno 310 -##SECTION## - def __init__(space, __args__): - funcname = "__init__" - signature = ['self'], 'args', None - defaults_w = [] - w_self, w_args = __args__.parse(funcname, signature, defaults_w) - return fastf_UnicodeDecodeError___init__(space, w_self, w_args) - - f_UnicodeDecodeError___init__ = __init__ - - def __init__(space, w_self, w_args): - goto = 1 # startblock - while True: - - if goto == 1: - w_0 = space.len(w_args) - w_1 = space.setattr(w_self, gs_args, w_args) - w_2 = space.eq(w_0, gi_5) - v0 = space.is_true(w_2) - if v0 == True: - w_self_1, w_args_1 = w_self, w_args - goto = 2 - else: - assert v0 == False - w_3 = space.w_None - goto = 3 - - if goto == 2: - w_4 = space.getitem(w_args_1, gi_0) - w_5 = space.setattr(w_self_1, gs_encoding, w_4) - w_6 = space.getitem(w_args_1, gi_1) - w_7 = space.setattr(w_self_1, gs_object, w_6) - w_8 = space.getitem(w_args_1, gi_2) - w_9 = space.setattr(w_self_1, gs_start, w_8) - w_10 = space.getitem(w_args_1, gi_3) - w_11 = space.setattr(w_self_1, gs_end, w_10) - w_12 = space.getitem(w_args_1, gi_4) - w_13 = space.setattr(w_self_1, gs_reason, w_12) - w_3 = space.w_None - goto = 3 - - if goto == 3: - return w_3 - - fastf_UnicodeDecodeError___init__ = __init__ - -##SECTION## -## filename 'lib/_exceptions.py' -## function '__str__' -## firstlineno 321 -##SECTION## - def __str__(space, __args__): - funcname = "__str__" - signature = ['self'], None, None - defaults_w = [] - w_self, = __args__.parse(funcname, signature, defaults_w) - return fastf_UnicodeDecodeError___str__(space, w_self) - - f_UnicodeDecodeError___str__ = __str__ - - def __str__(space, w_self): - goto = 1 # startblock - while True: - - if goto == 1: - w_0 = space.call_function((space.builtin.get(space.str_w(gs_getattr))), w_self, gs_object, space.w_None) - w_1 = space.str(w_0) - w_2 = space.add(gs_object_, w_1) - w_3 = space.call_function((space.builtin.get(space.str_w(gs_getattr))), w_self, gs_end, space.w_None) - w_4 = space.str(w_3) - w_5 = space.add(gs_end_, w_4) - w_6 = space.call_function((space.builtin.get(space.str_w(gs_getattr))), w_self, gs_encoding, space.w_None) - w_7 = space.str(w_6) - w_8 = space.add(gs_encoding_, w_7) - w_9 = space.call_function((space.builtin.get(space.str_w(gs_getattr))), w_self, gs_args, space.w_None) - w_10 = space.str(w_9) - w_11 = space.add(gs_args_, w_10) - w_12 = space.call_function((space.builtin.get(space.str_w(gs_getattr))), w_self, gs_start, space.w_None) - w_13 = space.str(w_12) - w_14 = space.add(gs_start_, w_13) - w_15 = space.call_function((space.builtin.get(space.str_w(gs_getattr))), w_self, gs_reason, space.w_None) - w_16 = space.str(w_15) - w_17 = space.add(gs_reason_, w_16) - w_18 = space.newlist([w_2, w_5, w_8, w_11, w_14, w_17]) - w_19 = space.call_function(gbltinmethod_join, w_18) - w_20 = w_19 - goto = 2 - - if goto == 2: - return w_20 - - fastf_UnicodeDecodeError___str__ = __str__ - -##SECTION## -## filename 'lib/_exceptions.py' -## function '__init__' -## firstlineno 370 -##SECTION## -# global declaration -# global object gi_5 - - def __init__(space, __args__): - funcname = "__init__" - signature = ['self'], 'args', None - defaults_w = [] - w_self, w_args = __args__.parse(funcname, signature, defaults_w) - return fastf_UnicodeEncodeError___init__(space, w_self, w_args) - - f_UnicodeEncodeError___init__ = __init__ - - def __init__(space, w_self, w_args): - goto = 1 # startblock - while True: - - if goto == 1: - w_0 = space.len(w_args) - w_1 = space.setattr(w_self, gs_args, w_args) - w_2 = space.eq(w_0, gi_5) - v0 = space.is_true(w_2) - if v0 == True: - w_self_1, w_args_1 = w_self, w_args - goto = 2 - else: - assert v0 == False - w_3 = space.w_None - goto = 3 - - if goto == 2: - w_4 = space.getitem(w_args_1, gi_0) - w_5 = space.setattr(w_self_1, gs_encoding, w_4) - w_6 = space.getitem(w_args_1, gi_1) - w_7 = space.setattr(w_self_1, gs_object, w_6) - w_8 = space.getitem(w_args_1, gi_2) - w_9 = space.setattr(w_self_1, gs_start, w_8) - w_10 = space.getitem(w_args_1, gi_3) - w_11 = space.setattr(w_self_1, gs_end, w_10) - w_12 = space.getitem(w_args_1, gi_4) - w_13 = space.setattr(w_self_1, gs_reason, w_12) - w_3 = space.w_None - goto = 3 - - if goto == 3: - return w_3 - - fastf_UnicodeEncodeError___init__ = __init__ - -##SECTION## -## filename 'lib/_exceptions.py' -## function '__str__' -## firstlineno 381 -##SECTION## -# global declarations -# global object gs_encoding -# global object gs_encoding_ - - def __str__(space, __args__): - funcname = "__str__" - signature = ['self'], None, None - defaults_w = [] - w_self, = __args__.parse(funcname, signature, defaults_w) - return fastf_UnicodeEncodeError___str__(space, w_self) - - f_UnicodeEncodeError___str__ = __str__ - - def __str__(space, w_self): - goto = 1 # startblock - while True: - - if goto == 1: - w_0 = space.call_function((space.builtin.get(space.str_w(gs_getattr))), w_self, gs_object, space.w_None) - w_1 = space.str(w_0) - w_2 = space.add(gs_object_, w_1) - w_3 = space.call_function((space.builtin.get(space.str_w(gs_getattr))), w_self, gs_end, space.w_None) - w_4 = space.str(w_3) - w_5 = space.add(gs_end_, w_4) - w_6 = space.call_function((space.builtin.get(space.str_w(gs_getattr))), w_self, gs_encoding, space.w_None) - w_7 = space.str(w_6) - w_8 = space.add(gs_encoding_, w_7) - w_9 = space.call_function((space.builtin.get(space.str_w(gs_getattr))), w_self, gs_args, space.w_None) - w_10 = space.str(w_9) - w_11 = space.add(gs_args_, w_10) - w_12 = space.call_function((space.builtin.get(space.str_w(gs_getattr))), w_self, gs_start, space.w_None) - w_13 = space.str(w_12) - w_14 = space.add(gs_start_, w_13) - w_15 = space.call_function((space.builtin.get(space.str_w(gs_getattr))), w_self, gs_reason, space.w_None) - w_16 = space.str(w_15) - w_17 = space.add(gs_reason_, w_16) - w_18 = space.newlist([w_2, w_5, w_8, w_11, w_14, w_17]) - w_19 = space.call_function(gbltinmethod_join, w_18) - w_20 = w_19 - goto = 2 - - if goto == 2: - return w_20 - - fastf_UnicodeEncodeError___str__ = __str__ - -##SECTION## - w__doc__ = space.wrap(__doc__) - g46dict = space.newdict([]) - gs_MemoryError = space.wrap('MemoryError') - _dic = space.newdict([]) - gs___module__ = space.wrap('__module__') - gs__exceptions = space.wrap('_exceptions') - space.setitem(_dic, gs___module__, gs__exceptions) - gs___doc__ = space.wrap('__doc__') - _doc = space.wrap("""Common base class for all exceptions.""") - space.setitem(_dic, gs___doc__, _doc) - gs_Exception = space.wrap('Exception') - _bases = space.newtuple([]) - _args = space.newtuple([gs_Exception, _bases, _dic]) - gcls_Exception = space.call(space.w_type, _args) - _dic = space.newdict([]) - space.setitem(_dic, gs___module__, gs__exceptions) - _doc = space.wrap("""Base class for all standard Python exceptions.""") - space.setitem(_dic, gs___doc__, _doc) - gs_StandardError = space.wrap('StandardError') - _bases = space.newtuple([gcls_Exception]) - _args = space.newtuple([gs_StandardError, _bases, _dic]) - gcls_StandardError = space.call(space.w_type, _args) - _dic = space.newdict([]) - space.setitem(_dic, gs___module__, gs__exceptions) - _doc = space.wrap("""Out of memory.""") - space.setitem(_dic, gs___doc__, _doc) - _bases = space.newtuple([gcls_StandardError]) - _args = space.newtuple([gs_MemoryError, _bases, _dic]) - gcls_MemoryError = space.call(space.w_type, _args) - space.setitem(g46dict, gs_MemoryError, gcls_MemoryError) - gs_ImportError = space.wrap('ImportError') - _dic = space.newdict([]) - space.setitem(_dic, gs___module__, gs__exceptions) - _doc = space.wrap("""Import can't find module, or can't find name in module.""") - space.setitem(_dic, gs___doc__, _doc) - _bases = space.newtuple([gcls_StandardError]) - _args = space.newtuple([gs_ImportError, _bases, _dic]) - gcls_ImportError = space.call(space.w_type, _args) - space.setitem(g46dict, gs_ImportError, gcls_ImportError) - gs_RuntimeError = space.wrap('RuntimeError') - _dic = space.newdict([]) - space.setitem(_dic, gs___module__, gs__exceptions) - _doc = space.wrap("""Unspecified run-time error.""") - space.setitem(_dic, gs___doc__, _doc) - _bases = space.newtuple([gcls_StandardError]) - _args = space.newtuple([gs_RuntimeError, _bases, _dic]) - gcls_RuntimeError = space.call(space.w_type, _args) - space.setitem(g46dict, gs_RuntimeError, gcls_RuntimeError) - gs_UnicodeTranslateError = space.wrap('UnicodeTranslateError') - _dic = space.newdict([]) - space.setitem(_dic, gs___module__, gs__exceptions) - _doc = space.wrap("""Inappropriate argument value (of correct type).""") - space.setitem(_dic, gs___doc__, _doc) - gs_ValueError = space.wrap('ValueError') - _bases = space.newtuple([gcls_StandardError]) - _args = space.newtuple([gs_ValueError, _bases, _dic]) - gcls_ValueError = space.call(space.w_type, _args) - _dic = space.newdict([]) - space.setitem(_dic, gs___module__, gs__exceptions) - _doc = space.wrap("""Unicode related error.""") - space.setitem(_dic, gs___doc__, _doc) - gs_UnicodeError = space.wrap('UnicodeError') - _bases = space.newtuple([gcls_ValueError]) - _args = space.newtuple([gs_UnicodeError, _bases, _dic]) - gcls_UnicodeError = space.call(space.w_type, _args) - _dic = space.newdict([]) - space.setitem(_dic, gs___module__, gs__exceptions) - _doc = space.wrap("""Unicode translation error.""") - space.setitem(_dic, gs___doc__, _doc) - _bases = space.newtuple([gcls_UnicodeError]) - _args = space.newtuple([gs_UnicodeTranslateError, _bases, _dic]) - gcls_UnicodeTranslateError = space.call(space.w_type, _args) - space.setitem(g46dict, gs_UnicodeTranslateError, gcls_UnicodeTranslateError) - gs_KeyError = space.wrap('KeyError') - _dic = space.newdict([]) - space.setitem(_dic, gs___module__, gs__exceptions) - _doc = space.wrap("""Base class for lookup errors.""") - space.setitem(_dic, gs___doc__, _doc) - gs_LookupError = space.wrap('LookupError') - _bases = space.newtuple([gcls_StandardError]) - _args = space.newtuple([gs_LookupError, _bases, _dic]) - gcls_LookupError = space.call(space.w_type, _args) - _dic = space.newdict([]) - space.setitem(_dic, gs___module__, gs__exceptions) - _doc = space.wrap("""Mapping key not found.""") - space.setitem(_dic, gs___doc__, _doc) - _bases = space.newtuple([gcls_LookupError]) - _args = space.newtuple([gs_KeyError, _bases, _dic]) - gcls_KeyError = space.call(space.w_type, _args) - space.setitem(g46dict, gs_KeyError, gcls_KeyError) - gs_SyntaxWarning = space.wrap('SyntaxWarning') - _dic = space.newdict([]) - space.setitem(_dic, gs___module__, gs__exceptions) - _doc = space.wrap("""Base class for warning categories.""") - space.setitem(_dic, gs___doc__, _doc) - gs_Warning = space.wrap('Warning') - _bases = space.newtuple([gcls_Exception]) - _args = space.newtuple([gs_Warning, _bases, _dic]) - gcls_Warning = space.call(space.w_type, _args) - _dic = space.newdict([]) - space.setitem(_dic, gs___module__, gs__exceptions) - _doc = space.wrap("""Base class for warnings about dubious syntax.""") - space.setitem(_dic, gs___doc__, _doc) - _bases = space.newtuple([gcls_Warning]) - _args = space.newtuple([gs_SyntaxWarning, _bases, _dic]) - gcls_SyntaxWarning = space.call(space.w_type, _args) - space.setitem(g46dict, gs_SyntaxWarning, gcls_SyntaxWarning) - gs_StopIteration = space.wrap('StopIteration') - _dic = space.newdict([]) - space.setitem(_dic, gs___module__, gs__exceptions) - _doc = space.wrap("""Signal the end from iterator.next().""") - space.setitem(_dic, gs___doc__, _doc) - _bases = space.newtuple([gcls_Exception]) - _args = space.newtuple([gs_StopIteration, _bases, _dic]) - gcls_StopIteration = space.call(space.w_type, _args) - space.setitem(g46dict, gs_StopIteration, gcls_StopIteration) - gs_PendingDeprecationWarning = space.wrap('PendingDeprecationWarning') - _dic = space.newdict([]) - space.setitem(_dic, gs___module__, gs__exceptions) - _doc = space.wrap("""Base class for warnings about features which will be deprecated in the future.""") - space.setitem(_dic, gs___doc__, _doc) - _bases = space.newtuple([gcls_Warning]) - _args = space.newtuple([gs_PendingDeprecationWarning, _bases, _dic]) - gcls_PendingDeprecationWarning = space.call(space.w_type, _args) - space.setitem(g46dict, gs_PendingDeprecationWarning, gcls_PendingDeprecationWarning) - gs_EnvironmentError = space.wrap('EnvironmentError') - _dic = space.newdict([]) - space.setitem(_dic, gs___module__, gs__exceptions) - _doc = space.wrap("""Base class for I/O related errors.""") - space.setitem(_dic, gs___doc__, _doc) - _bases = space.newtuple([gcls_StandardError]) - _args = space.newtuple([gs_EnvironmentError, _bases, _dic]) - gcls_EnvironmentError = space.call(space.w_type, _args) - space.setitem(g46dict, gs_EnvironmentError, gcls_EnvironmentError) - space.setitem(g46dict, gs_LookupError, gcls_LookupError) - gs_OSError = space.wrap('OSError') - _dic = space.newdict([]) - space.setitem(_dic, gs___module__, gs__exceptions) - _doc = space.wrap("""OS system call failed.""") - space.setitem(_dic, gs___doc__, _doc) - _bases = space.newtuple([gcls_EnvironmentError]) - _args = space.newtuple([gs_OSError, _bases, _dic]) - gcls_OSError = space.call(space.w_type, _args) - space.setitem(g46dict, gs_OSError, gcls_OSError) - gs_DeprecationWarning = space.wrap('DeprecationWarning') - _dic = space.newdict([]) - space.setitem(_dic, gs___module__, gs__exceptions) - _doc = space.wrap("""Base class for warnings about deprecated features.""") - space.setitem(_dic, gs___doc__, _doc) - _bases = space.newtuple([gcls_Warning]) - _args = space.newtuple([gs_DeprecationWarning, _bases, _dic]) - gcls_DeprecationWarning = space.call(space.w_type, _args) - space.setitem(g46dict, gs_DeprecationWarning, gcls_DeprecationWarning) - space.setitem(g46dict, gs_UnicodeError, gcls_UnicodeError) - gs_FloatingPointError = space.wrap('FloatingPointError') - _dic = space.newdict([]) - space.setitem(_dic, gs___module__, gs__exceptions) - _doc = space.wrap("""Base class for arithmetic errors.""") - space.setitem(_dic, gs___doc__, _doc) - gs_ArithmeticError = space.wrap('ArithmeticError') - _bases = space.newtuple([gcls_StandardError]) - _args = space.newtuple([gs_ArithmeticError, _bases, _dic]) - gcls_ArithmeticError = space.call(space.w_type, _args) - _dic = space.newdict([]) - space.setitem(_dic, gs___module__, gs__exceptions) - _doc = space.wrap("""Floating point operation failed.""") - space.setitem(_dic, gs___doc__, _doc) - _bases = space.newtuple([gcls_ArithmeticError]) - _args = space.newtuple([gs_FloatingPointError, _bases, _dic]) - gcls_FloatingPointError = space.call(space.w_type, _args) - space.setitem(g46dict, gs_FloatingPointError, gcls_FloatingPointError) - gs_AttributeError = space.wrap('AttributeError') - _dic = space.newdict([]) - space.setitem(_dic, gs___module__, gs__exceptions) - _doc = space.wrap("""Attribute not found.""") - space.setitem(_dic, gs___doc__, _doc) - _bases = space.newtuple([gcls_StandardError]) - _args = space.newtuple([gs_AttributeError, _bases, _dic]) - gcls_AttributeError = space.call(space.w_type, _args) - space.setitem(g46dict, gs_AttributeError, gcls_AttributeError) - gs_IndentationError = space.wrap('IndentationError') - _dic = space.newdict([]) - space.setitem(_dic, gs___module__, gs__exceptions) - _doc = space.wrap("""Invalid syntax.""") - space.setitem(_dic, gs___doc__, _doc) - gs_SyntaxError = space.wrap('SyntaxError') - _bases = space.newtuple([gcls_StandardError]) - _args = space.newtuple([gs_SyntaxError, _bases, _dic]) - gcls_SyntaxError = space.call(space.w_type, _args) - _dic = space.newdict([]) - space.setitem(_dic, gs___module__, gs__exceptions) - _doc = space.wrap("""Improper indentation.""") - space.setitem(_dic, gs___doc__, _doc) - _bases = space.newtuple([gcls_SyntaxError]) - _args = space.newtuple([gs_IndentationError, _bases, _dic]) - gcls_IndentationError = space.call(space.w_type, _args) - space.setitem(g46dict, gs_IndentationError, gcls_IndentationError) - gs_NameError = space.wrap('NameError') - _dic = space.newdict([]) - space.setitem(_dic, gs___module__, gs__exceptions) - _doc = space.wrap("""Name not found globally.""") - space.setitem(_dic, gs___doc__, _doc) - _bases = space.newtuple([gcls_StandardError]) - _args = space.newtuple([gs_NameError, _bases, _dic]) - gcls_NameError = space.call(space.w_type, _args) - space.setitem(g46dict, gs_NameError, gcls_NameError) - gs_OverflowWarning = space.wrap('OverflowWarning') - _dic = space.newdict([]) - space.setitem(_dic, gs___module__, gs__exceptions) - _doc = space.wrap("""Base class for warnings about numeric overflow.""") - space.setitem(_dic, gs___doc__, _doc) - _bases = space.newtuple([gcls_Warning]) - _args = space.newtuple([gs_OverflowWarning, _bases, _dic]) - gcls_OverflowWarning = space.call(space.w_type, _args) - space.setitem(g46dict, gs_OverflowWarning, gcls_OverflowWarning) - gs_IOError = space.wrap('IOError') - _dic = space.newdict([]) - space.setitem(_dic, gs___module__, gs__exceptions) - _doc = space.wrap("""I/O operation failed.""") - space.setitem(_dic, gs___doc__, _doc) - _bases = space.newtuple([gcls_EnvironmentError]) - _args = space.newtuple([gs_IOError, _bases, _dic]) - gcls_IOError = space.call(space.w_type, _args) - space.setitem(g46dict, gs_IOError, gcls_IOError) - space.setitem(g46dict, gs_ValueError, gcls_ValueError) - gs_FutureWarning = space.wrap('FutureWarning') - _dic = space.newdict([]) - space.setitem(_dic, gs___module__, gs__exceptions) - _doc = space.wrap("""Base class for warnings about constructs that will change semantically in the future.""") - space.setitem(_dic, gs___doc__, _doc) - _bases = space.newtuple([gcls_Warning]) - _args = space.newtuple([gs_FutureWarning, _bases, _dic]) - gcls_FutureWarning = space.call(space.w_type, _args) - space.setitem(g46dict, gs_FutureWarning, gcls_FutureWarning) - gs_SystemExit = space.wrap('SystemExit') - _dic = space.newdict([]) - space.setitem(_dic, gs___module__, gs__exceptions) - _doc = space.wrap("""Request to exit from the interpreter.""") - space.setitem(_dic, gs___doc__, _doc) - _bases = space.newtuple([gcls_Exception]) - _args = space.newtuple([gs_SystemExit, _bases, _dic]) - gcls_SystemExit = space.call(space.w_type, _args) - space.setitem(g46dict, gs_SystemExit, gcls_SystemExit) - space.setitem(g46dict, gs_Exception, gcls_Exception) - gs_EOFError = space.wrap('EOFError') - _dic = space.newdict([]) - space.setitem(_dic, gs___module__, gs__exceptions) - _doc = space.wrap("""Read beyond end of file.""") - space.setitem(_dic, gs___doc__, _doc) - _bases = space.newtuple([gcls_StandardError]) - _args = space.newtuple([gs_EOFError, _bases, _dic]) - gcls_EOFError = space.call(space.w_type, _args) - space.setitem(g46dict, gs_EOFError, gcls_EOFError) - space.setitem(g46dict, gs_StandardError, gcls_StandardError) - gs___file__ = space.wrap('__file__') - gs__home_hpk_pypy_dist_pypy_lib__ex = space.wrap( -"""/home/hpk/pypy-dist/pypy/lib/_exceptions.py""") - space.setitem(g46dict, gs___file__, gs__home_hpk_pypy_dist_pypy_lib__ex) - gs_TabError = space.wrap('TabError') - _dic = space.newdict([]) - space.setitem(_dic, gs___module__, gs__exceptions) - _doc = space.wrap("""Improper mixture of spaces and tabs.""") - space.setitem(_dic, gs___doc__, _doc) - _bases = space.newtuple([gcls_IndentationError]) - _args = space.newtuple([gs_TabError, _bases, _dic]) - gcls_TabError = space.call(space.w_type, _args) - space.setitem(g46dict, gs_TabError, gcls_TabError) - space.setitem(g46dict, gs_SyntaxError, gcls_SyntaxError) - gs_UnicodeEncodeError = space.wrap('UnicodeEncodeError') - _dic = space.newdict([]) - space.setitem(_dic, gs___module__, gs__exceptions) - _doc = space.wrap("""Unicode encoding error.""") - space.setitem(_dic, gs___doc__, _doc) - _bases = space.newtuple([gcls_UnicodeError]) - _args = space.newtuple([gs_UnicodeEncodeError, _bases, _dic]) - gcls_UnicodeEncodeError = space.call(space.w_type, _args) - space.setitem(g46dict, gs_UnicodeEncodeError, gcls_UnicodeEncodeError) - gs_UnboundLocalError = space.wrap('UnboundLocalError') - _dic = space.newdict([]) - space.setitem(_dic, gs___module__, gs__exceptions) - _doc = space.wrap("""Local name referenced but not bound to a value.""") - space.setitem(_dic, gs___doc__, _doc) - _bases = space.newtuple([gcls_NameError]) - _args = space.newtuple([gs_UnboundLocalError, _bases, _dic]) - gcls_UnboundLocalError = space.call(space.w_type, _args) - space.setitem(g46dict, gs_UnboundLocalError, gcls_UnboundLocalError) - gs___name__ = space.wrap('__name__') - space.setitem(g46dict, gs___name__, gs__exceptions) - gs_ReferenceError = space.wrap('ReferenceError') - _dic = space.newdict([]) - space.setitem(_dic, gs___module__, gs__exceptions) - _doc = space.wrap("""Weak ref proxy used after referent went away.""") - space.setitem(_dic, gs___doc__, _doc) - _bases = space.newtuple([gcls_StandardError]) - _args = space.newtuple([gs_ReferenceError, _bases, _dic]) - gcls_ReferenceError = space.call(space.w_type, _args) - space.setitem(g46dict, gs_ReferenceError, gcls_ReferenceError) - gs_AssertionError = space.wrap('AssertionError') - _dic = space.newdict([]) - space.setitem(_dic, gs___module__, gs__exceptions) - _doc = space.wrap("""Assertion failed.""") - space.setitem(_dic, gs___doc__, _doc) - _bases = space.newtuple([gcls_StandardError]) - _args = space.newtuple([gs_AssertionError, _bases, _dic]) - gcls_AssertionError = space.call(space.w_type, _args) - space.setitem(g46dict, gs_AssertionError, gcls_AssertionError) - gs_UnicodeDecodeError = space.wrap('UnicodeDecodeError') - _dic = space.newdict([]) - space.setitem(_dic, gs___module__, gs__exceptions) - _doc = space.wrap("""Unicode decoding error.""") - space.setitem(_dic, gs___doc__, _doc) - _bases = space.newtuple([gcls_UnicodeError]) - _args = space.newtuple([gs_UnicodeDecodeError, _bases, _dic]) - gcls_UnicodeDecodeError = space.call(space.w_type, _args) - space.setitem(g46dict, gs_UnicodeDecodeError, gcls_UnicodeDecodeError) - gs_TypeError = space.wrap('TypeError') - _dic = space.newdict([]) - space.setitem(_dic, gs___module__, gs__exceptions) - _doc = space.wrap("""Inappropriate argument type.""") - space.setitem(_dic, gs___doc__, _doc) - _bases = space.newtuple([gcls_StandardError]) - _args = space.newtuple([gs_TypeError, _bases, _dic]) - gcls_TypeError = space.call(space.w_type, _args) - space.setitem(g46dict, gs_TypeError, gcls_TypeError) - gs_IndexError = space.wrap('IndexError') - _dic = space.newdict([]) - space.setitem(_dic, gs___module__, gs__exceptions) - _doc = space.wrap("""Sequence index out of range.""") - space.setitem(_dic, gs___doc__, _doc) - _bases = space.newtuple([gcls_LookupError]) - _args = space.newtuple([gs_IndexError, _bases, _dic]) - gcls_IndexError = space.call(space.w_type, _args) - space.setitem(g46dict, gs_IndexError, gcls_IndexError) - gs_RuntimeWarning = space.wrap('RuntimeWarning') - _dic = space.newdict([]) - space.setitem(_dic, gs___module__, gs__exceptions) - _doc = space.wrap("""Base class for warnings about dubious runtime behavior.""") - space.setitem(_dic, gs___doc__, _doc) - _bases = space.newtuple([gcls_Warning]) - _args = space.newtuple([gs_RuntimeWarning, _bases, _dic]) - gcls_RuntimeWarning = space.call(space.w_type, _args) - space.setitem(g46dict, gs_RuntimeWarning, gcls_RuntimeWarning) - gs_KeyboardInterrupt = space.wrap('KeyboardInterrupt') - _dic = space.newdict([]) - space.setitem(_dic, gs___module__, gs__exceptions) - _doc = space.wrap("""Program interrupted by user.""") - space.setitem(_dic, gs___doc__, _doc) - _bases = space.newtuple([gcls_StandardError]) - _args = space.newtuple([gs_KeyboardInterrupt, _bases, _dic]) - gcls_KeyboardInterrupt = space.call(space.w_type, _args) - space.setitem(g46dict, gs_KeyboardInterrupt, gcls_KeyboardInterrupt) - gs_UserWarning = space.wrap('UserWarning') - _dic = space.newdict([]) - space.setitem(_dic, gs___module__, gs__exceptions) - _doc = space.wrap("""Base class for warnings generated by user code.""") - space.setitem(_dic, gs___doc__, _doc) - _bases = space.newtuple([gcls_Warning]) - _args = space.newtuple([gs_UserWarning, _bases, _dic]) - gcls_UserWarning = space.call(space.w_type, _args) - space.setitem(g46dict, gs_UserWarning, gcls_UserWarning) - gs_ZeroDivisionError = space.wrap('ZeroDivisionError') - _dic = space.newdict([]) - space.setitem(_dic, gs___module__, gs__exceptions) - _doc = space.wrap("""Second argument to a division or modulo operation was zero.""") - space.setitem(_dic, gs___doc__, _doc) - _bases = space.newtuple([gcls_ArithmeticError]) - _args = space.newtuple([gs_ZeroDivisionError, _bases, _dic]) - gcls_ZeroDivisionError = space.call(space.w_type, _args) - space.setitem(g46dict, gs_ZeroDivisionError, gcls_ZeroDivisionError) - space.setitem(g46dict, gs___doc__, w__doc__) - space.setitem(g46dict, gs_ArithmeticError, gcls_ArithmeticError) - space.setitem(g46dict, gs_Warning, gcls_Warning) - gs_NotImplementedError = space.wrap('NotImplementedError') - _dic = space.newdict([]) - space.setitem(_dic, gs___module__, gs__exceptions) - _doc = space.wrap("""Method or function hasn't been implemented yet.""") - space.setitem(_dic, gs___doc__, _doc) - _bases = space.newtuple([gcls_RuntimeError]) - _args = space.newtuple([gs_NotImplementedError, _bases, _dic]) - gcls_NotImplementedError = space.call(space.w_type, _args) - space.setitem(g46dict, gs_NotImplementedError, gcls_NotImplementedError) - gs_SystemError = space.wrap('SystemError') - _dic = space.newdict([]) - space.setitem(_dic, gs___module__, gs__exceptions) - _doc = space.wrap("""Internal error in the Python interpreter. - -Please report this to the Python maintainer, along with the traceback, -the Python version, and the hardware/OS platform and version.""") - space.setitem(_dic, gs___doc__, _doc) - _bases = space.newtuple([gcls_StandardError]) - _args = space.newtuple([gs_SystemError, _bases, _dic]) - gcls_SystemError = space.call(space.w_type, _args) - space.setitem(g46dict, gs_SystemError, gcls_SystemError) - gs_OverflowError = space.wrap('OverflowError') - _dic = space.newdict([]) - space.setitem(_dic, gs___module__, gs__exceptions) - _doc = space.wrap("""Result too large to be represented.""") - space.setitem(_dic, gs___doc__, _doc) - _bases = space.newtuple([gcls_ArithmeticError]) - _args = space.newtuple([gs_OverflowError, _bases, _dic]) - gcls_OverflowError = space.call(space.w_type, _args) - space.setitem(g46dict, gs_OverflowError, gcls_OverflowError) - gs___init__ = space.wrap('__init__') - from pypy.interpreter import gateway - gfunc_UnicodeDecodeError___init__ = space.wrap(gateway.interp2app(f_UnicodeDecodeError___init__, unwrap_spec=[gateway.ObjSpace, gateway.Arguments])) - space.setattr(gcls_UnicodeDecodeError, gs___init__, gfunc_UnicodeDecodeError___init__) - gs___str__ = space.wrap('__str__') - gfunc_UnicodeDecodeError___str__ = space.wrap(gateway.interp2app(f_UnicodeDecodeError___str__, unwrap_spec=[gateway.ObjSpace, gateway.Arguments])) - space.setattr(gcls_UnicodeDecodeError, gs___str__, gfunc_UnicodeDecodeError___str__) - gfunc_UnicodeEncodeError___init__ = space.wrap(gateway.interp2app(f_UnicodeEncodeError___init__, unwrap_spec=[gateway.ObjSpace, gateway.Arguments])) - space.setattr(gcls_UnicodeEncodeError, gs___init__, gfunc_UnicodeEncodeError___init__) - gfunc_UnicodeEncodeError___str__ = space.wrap(gateway.interp2app(f_UnicodeEncodeError___str__, unwrap_spec=[gateway.ObjSpace, gateway.Arguments])) - space.setattr(gcls_UnicodeEncodeError, gs___str__, gfunc_UnicodeEncodeError___str__) - gfunc_SystemExit___init__ = space.wrap(gateway.interp2app(f_SystemExit___init__, unwrap_spec=[gateway.ObjSpace, gateway.Arguments])) - space.setattr(gcls_SystemExit, gs___init__, gfunc_SystemExit___init__) - gfunc_SyntaxError___init__ = space.wrap(gateway.interp2app(f_SyntaxError___init__, unwrap_spec=[gateway.ObjSpace, gateway.Arguments])) - space.setattr(gcls_SyntaxError, gs___init__, gfunc_SyntaxError___init__) - gfunc_SyntaxError___str__ = space.wrap(gateway.interp2app(f_SyntaxError___str__, unwrap_spec=[gateway.ObjSpace, gateway.Arguments])) - space.setattr(gcls_SyntaxError, gs___str__, gfunc_SyntaxError___str__) - gs_filename = space.wrap('filename') - space.setattr(gcls_SyntaxError, gs_filename, space.w_None) - gs_lineno = space.wrap('lineno') - space.setattr(gcls_SyntaxError, gs_lineno, space.w_None) - gs_msg = space.wrap('msg') - gs__emptystr_ = space.wrap('') - space.setattr(gcls_SyntaxError, gs_msg, gs__emptystr_) - gs_offset = space.wrap('offset') - space.setattr(gcls_SyntaxError, gs_offset, space.w_None) - gs_print_file_and_line = space.wrap('print_file_and_line') - space.setattr(gcls_SyntaxError, gs_print_file_and_line, space.w_None) - gs_text = space.wrap('text') - space.setattr(gcls_SyntaxError, gs_text, space.w_None) - gfunc_EnvironmentError___init__ = space.wrap(gateway.interp2app(f_EnvironmentError___init__, unwrap_spec=[gateway.ObjSpace, gateway.Arguments])) - space.setattr(gcls_EnvironmentError, gs___init__, gfunc_EnvironmentError___init__) - gfunc_EnvironmentError___str__ = space.wrap(gateway.interp2app(f_EnvironmentError___str__, unwrap_spec=[gateway.ObjSpace, gateway.Arguments])) - space.setattr(gcls_EnvironmentError, gs___str__, gfunc_EnvironmentError___str__) - gfunc_KeyError___str__ = space.wrap(gateway.interp2app(f_KeyError___str__, unwrap_spec=[gateway.ObjSpace, gateway.Arguments])) - space.setattr(gcls_KeyError, gs___str__, gfunc_KeyError___str__) - gfunc_UnicodeTranslateError___init__ = space.wrap(gateway.interp2app(f_UnicodeTranslateError___init__, unwrap_spec=[gateway.ObjSpace, gateway.Arguments])) - space.setattr(gcls_UnicodeTranslateError, gs___init__, gfunc_UnicodeTranslateError___init__) - gfunc_UnicodeTranslateError___str__ = space.wrap(gateway.interp2app(f_UnicodeTranslateError___str__, unwrap_spec=[gateway.ObjSpace, gateway.Arguments])) - space.setattr(gcls_UnicodeTranslateError, gs___str__, gfunc_UnicodeTranslateError___str__) - gs___getitem__ = space.wrap('__getitem__') - gfunc_Exception___getitem__ = space.wrap(gateway.interp2app(f_Exception___getitem__, unwrap_spec=[gateway.ObjSpace, gateway.Arguments])) - space.setattr(gcls_Exception, gs___getitem__, gfunc_Exception___getitem__) - gfunc_Exception___init__ = space.wrap(gateway.interp2app(f_Exception___init__, unwrap_spec=[gateway.ObjSpace, gateway.Arguments])) - space.setattr(gcls_Exception, gs___init__, gfunc_Exception___init__) - gfunc_Exception___str__ = space.wrap(gateway.interp2app(f_Exception___str__, unwrap_spec=[gateway.ObjSpace, gateway.Arguments])) - space.setattr(gcls_Exception, gs___str__, gfunc_Exception___str__) - gs_args = space.wrap('args') - gi_0 = space.wrap(0) - gi_1 = space.wrap(1) - gs_getattr = space.wrap('getattr') - gs_start = space.wrap('start') - gs_start_ = space.wrap('start=') - gs_reason = space.wrap('reason') - gs_reason_ = space.wrap('reason=') - gs_args_ = space.wrap('args=') - gs_end = space.wrap('end') - gs_end_ = space.wrap('end=') - gs_object = space.wrap('object') - gs_object_ = space.wrap('object=') - gs__ = space.wrap(' ') - gs_join = space.wrap('join') - gbltinmethod_join = space.getattr(gs__, gs_join) - gi_4 = space.wrap(4) - gi_2 = space.wrap(2) - gi_3 = space.wrap(3) - gs_errno = space.wrap('errno') - gs_strerror = space.wrap('strerror') - gs__Errno__s___s___s = space.wrap('[Errno %s] %s: %s') - gs__Errno__s___s = space.wrap('[Errno %s] %s') - gs____ = space.wrap('???') - gfunc_basename = space.wrap(gateway.interp2app(f_basename, unwrap_spec=[gateway.ObjSpace, gateway.Arguments])) - gs__s___s__line__ld_ = space.wrap('%s (%s, line %ld)') - gs__s___s_ = space.wrap('%s (%s)') - gs__s__line__ld_ = space.wrap('%s (line %ld)') - gfunc_split = space.wrap(gateway.interp2app(f_split, unwrap_spec=[gateway.ObjSpace, gateway.Arguments])) - gs_rfind = space.wrap('rfind') - gs___1 = space.wrap('/') - gs_rstrip = space.wrap('rstrip') - from pypy.interpreter.error import OperationError as gOperationError - gs_code = space.wrap('code') - gs_encoding = space.wrap('encoding') - gs_encoding_ = space.wrap('encoding=') - gi_5 = space.wrap(5) - return g46dict - Modified: pypy/dist/pypy/objspace/std/objspace.py ============================================================================== --- pypy/dist/pypy/objspace/std/objspace.py (original) +++ pypy/dist/pypy/objspace/std/objspace.py Thu May 19 22:27:20 2005 @@ -3,6 +3,7 @@ from pypy.interpreter.error import OperationError from pypy.interpreter.typedef import get_unique_interplevel_subclass from pypy.interpreter.typedef import instantiate +from pypy.interpreter.gateway import PyPyCacheDir from pypy.tool.cache import Cache from pypy.objspace.std.model import W_Object, UnwrapError from pypy.objspace.std.model import W_ANY, MultiMethod, StdTypeModel @@ -11,7 +12,7 @@ from pypy.objspace.std import stdtypedef import types import sys - +import os def registerimplementation(implcls): # this function should ultimately register the implementation class somewhere @@ -118,7 +119,13 @@ def setup_exceptions(self): """NOT_RPYTHON""" ## hacking things in - from pypy.module import exceptionsinterp as ex + class Fake: pass + fake = Fake() + import pypy.lib as lib + fname = os.path.join(os.path.split(lib.__file__)[0], '_exceptions.py') + fake.filename = fname + fake.source = file(fname).read() + fake.modname = 'exceptions' def call(w_type, w_args): space = self # too early for unpackiterable as well :-( @@ -134,7 +141,7 @@ try: # note that we hide the real call method by an instance variable! self.call = call - w_dic = ex.initexceptions(self) + w_dic = PyPyCacheDir.build_applevelinterp_dict(fake, self) self.w_IndexError = self.getitem(w_dic, self.wrap("IndexError")) self.w_StopIteration = self.getitem(w_dic, self.wrap("StopIteration")) From hpk at codespeak.net Thu May 19 22:35:09 2005 From: hpk at codespeak.net (hpk at codespeak.net) Date: Thu, 19 May 2005 22:35:09 +0200 (CEST) Subject: [pypy-svn] r12584 - pypy/dist/pypy/documentation Message-ID: <20050519203509.4423727B75@code1.codespeak.net> Author: hpk Date: Thu May 19 22:35:09 2005 New Revision: 12584 Modified: pypy/dist/pypy/documentation/index.txt Log: fix typo Modified: pypy/dist/pypy/documentation/index.txt ============================================================================== --- pypy/dist/pypy/documentation/index.txt (original) +++ pypy/dist/pypy/documentation/index.txt Thu May 19 22:35:09 2005 @@ -21,7 +21,7 @@ about recent runs of CPython's regression tests against PyPy. `license`_ tells you that basically all of PyPy is licensed -under the OSI-approved very liberal MIT-license +under the OSI-approved very liberal MIT-license. .. _`license`: http://codespeak.net/svn/pypy/dist/LICENSE .. _`compliance test report`: http://codespeak.net/~hpk/pypy-testresult/ From hpk at codespeak.net Thu May 19 22:37:37 2005 From: hpk at codespeak.net (hpk at codespeak.net) Date: Thu, 19 May 2005 22:37:37 +0200 (CEST) Subject: [pypy-svn] r12585 - pypy/dist Message-ID: <20050519203737.2858827B82@code1.codespeak.net> Author: hpk Date: Thu May 19 22:37:36 2005 New Revision: 12585 Modified: pypy/dist/README Log: issue5 testing adding local links to all the HTTP links to satisfy the use case of reading the README offline. Modified: pypy/dist/README ============================================================================== --- pypy/dist/README (original) +++ pypy/dist/README Thu May 19 22:37:36 2005 @@ -9,6 +9,7 @@ website and thus invite you to head over to our getting-started document + pypy/documentation/getting_started.txt or http://codespeak.net/pypy/index.cgi?getting-started which gives you many good starting and entry points into @@ -16,16 +17,19 @@ documentation section of which you can find the source ReST files in the following directory: - pypy/documentation + pypy/documentation/index.txt or + http://codespeak.net/pypy/index.cgi?doc Our online release announcement has some more information about the specific PyPy-0.6 release: + pypy/documentation/release-0.6.txt or http://codespeak.net/pypy/index.cgi?doc/release-0.6.html Please freel free to contact or join us in one of the ways listed in our contact page: + pypy/documentation/website/contact.txt or http://codespeak.net/pypy/index.cgi?contact Enjoy and send us feedback! From arigo at codespeak.net Thu May 19 22:41:57 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Thu, 19 May 2005 22:41:57 +0200 (CEST) Subject: [pypy-svn] r12586 - pypy/dist/pypy/documentation Message-ID: <20050519204157.E93F127B82@code1.codespeak.net> Author: arigo Date: Thu May 19 22:41:57 2005 New Revision: 12586 Modified: pypy/dist/pypy/documentation/release-0.6.txt Log: - Oups, forgot ChangeMaker. - Typographic details, more semicolons. Modified: pypy/dist/pypy/documentation/release-0.6.txt ============================================================================== --- pypy/dist/pypy/documentation/release-0.6.txt (original) +++ pypy/dist/pypy/documentation/release-0.6.txt Thu May 19 22:41:57 2005 @@ -43,13 +43,13 @@ * By default, PyPy is a Python version that works completely with new-style-classes semantics. However, support for old-style classes - is still available, Implementations, mostly as user-level code, of + is still available. Implementations, mostly as user-level code, of their metaclass and instance object are included and can be re-made - the default with an option. + the default with the ``--oldstyle`` option. * In PyPy, bytecode interpretation and object manipulations are well separated between a bytecode interpreter and an - object space which implements operations on objects. + *object space* which implements operations on objects. PyPy comes with experimental object spaces augmenting the standard one through delegation: @@ -70,8 +70,8 @@ capable of successfully type annotating basically *all* of PyPy code-base, and is included with 0.6. -* From type annotated code low-level code needs to be generated, - backends for various targets (C, LLVM,...) are included, they are +* From type annotated code, low-level code needs to be generated. + Backends for various targets (C, LLVM,...) are included; they are all somehow incomplete and have been and are quite in flux. What is shipped with 0.6 is able to deal with more or less small/medium examples. @@ -80,7 +80,7 @@ --------------------------------- Generating low-level code is the main area we are hammering on in the -next months, our plan is to produce a PyPy version in August/September +next months; our plan is to produce a PyPy version in August/September that does not need to be interpreted by CPython anymore and will thus run considerably faster than the 0.6 preview release. @@ -90,6 +90,7 @@ raise questions. contact points: http://codespeak.net/pypy/index.cgi?contact + contributor list: http://codespeak.net/pypy/index.cgi?doc/contributor.html have fun, @@ -111,4 +112,6 @@ merlinux GmbH (Germany), tismerysoft GmbH(Germany) Logilab Paris (France), DFKI GmbH (Germany) - + + ChangeMaker (Sweden) + From hpk at codespeak.net Thu May 19 22:53:26 2005 From: hpk at codespeak.net (hpk at codespeak.net) Date: Thu, 19 May 2005 22:53:26 +0200 (CEST) Subject: [pypy-svn] r12587 - pypy/dist/pypy/documentation Message-ID: <20050519205326.09FC227B82@code1.codespeak.net> Author: hpk Date: Thu May 19 22:53:25 2005 New Revision: 12587 Modified: pypy/dist/pypy/documentation/index.txt pypy/dist/pypy/documentation/translation.txt Log: some more streamlining of the index file (nicer readable links). and unifying the title style for our main chapters. Modified: pypy/dist/pypy/documentation/index.txt ============================================================================== --- pypy/dist/pypy/documentation/index.txt (original) +++ pypy/dist/pypy/documentation/index.txt Thu May 19 22:53:25 2005 @@ -9,25 +9,25 @@ `getting started`_ provides hands-on instructions including a two-liner to run PyPy on your system. -coding-guide_ helps you to write code for PyPy. +`coding guide`_ helps you to write code for PyPy. -objspace_ discusses the object space interface +`object spaces`_ discusses the object space interface and several implementations. -translation_ offers the beginnings of documentation +`translation`_ offers the beginnings of documentation about our low level code generator backends. -`compliance test report`_ shows status information +`compliance test status`_ shows outcome information about recent runs of CPython's regression tests against PyPy. `license`_ tells you that basically all of PyPy is licensed under the OSI-approved very liberal MIT-license. .. _`license`: http://codespeak.net/svn/pypy/dist/LICENSE -.. _`compliance test report`: http://codespeak.net/~hpk/pypy-testresult/ -.. _`objspace`: objspace.html +.. _`compliance test status`: http://codespeak.net/~hpk/pypy-testresult/ +.. _`object spaces`: objspace.html .. _`translation`: translation.html -.. _`coding-guide`: coding-guide.html +.. _`coding guide`: coding-guide.html .. _`architecture`: architecture.html .. _`revision report`: http://codespeak.net/pypy/rev/current .. _`getting started`: getting_started.html Modified: pypy/dist/pypy/documentation/translation.txt ============================================================================== --- pypy/dist/pypy/documentation/translation.txt (original) +++ pypy/dist/pypy/documentation/translation.txt Thu May 19 22:53:25 2005 @@ -1,5 +1,5 @@ ===================== - Translation + PyPy Translation ===================== .. contents:: From tismer at codespeak.net Thu May 19 23:32:08 2005 From: tismer at codespeak.net (tismer at codespeak.net) Date: Thu, 19 May 2005 23:32:08 +0200 (CEST) Subject: [pypy-svn] r12588 - in pypy/dist/pypy: module objspace/std translator Message-ID: <20050519213208.47FBB27B7B@code1.codespeak.net> Author: tismer Date: Thu May 19 23:32:08 2005 New Revision: 12588 Removed: pypy/dist/pypy/module/classobjinterp.py Modified: pypy/dist/pypy/objspace/std/objspace.py pypy/dist/pypy/translator/geninterplevel.py Log: say bye bye, classobjinterp. Now I also can trash the script that called this, and throw out old stuff from geninterplevel.py geninterp need a small change to pass the filename over. well... Deleted: /pypy/dist/pypy/module/classobjinterp.py ============================================================================== --- /pypy/dist/pypy/module/classobjinterp.py Thu May 19 23:32:08 2005 +++ (empty file) @@ -1,7479 +0,0 @@ -#!/bin/env python -# -*- coding: LATIN-1 -*- - -#************************************************************* - -def initclassobj(space): - """NOT_RPYTHON""" - -##SECTION## -## filename 'lib/_classobj.py' -## function '_coerce' -## firstlineno 11 -##SECTION## - def _coerce(space, __args__): - funcname = "_coerce" - signature = ['left', 'right'], None, None - defaults_w = [] - w_left, w_right = __args__.parse(funcname, signature, defaults_w) - return fastf__coerce(space, w_left, w_right) - - f__coerce = _coerce - - def _coerce(space, w_left, w_right): - goto = 1 # startblock - while True: - - if goto == 1: - try: - w_0 = space.coerce(w_left, w_right) - w_1 = w_0 - goto = 5 - except gOperationError, e: - e.normalize_exception(space) - if space.is_true(space.issubtype(e.w_type, space.w_Exception)): - w_2, w_3 = e.w_type, e.w_value - goto = 2 - else:raise # unhandled case, should not happen - - if goto == 2: - w_4 = space.is_(w_2, space.w_TypeError) - v0 = space.is_true(w_4) - if v0 == True: - w_1 = space.w_None - goto = 5 - else: - assert v0 == False - w_5, w_6 = w_2, w_3 - goto = 3 - - if goto == 3: - w_7 = space.issubtype(w_5, space.w_TypeError) - v1 = space.is_true(w_7) - if v1 == True: - w_1 = space.w_None - goto = 5 - else: - assert v1 == False - w_etype, w_evalue = w_5, w_6 - goto = 4 - - if goto == 4: - raise gOperationError(w_etype, w_evalue) - - if goto == 5: - return w_1 - - fastf__coerce = _coerce - -##SECTION## -## filename 'lib/_classobj.py' -## function 'uid' -## firstlineno 22 -##SECTION## -# global declarations -# global object gi_0 -# global object glong_0x7fffffffL -# global object gi_2 - - def uid(space, __args__): - funcname = "uid" - signature = ['o'], None, None - defaults_w = [] - w_o, = __args__.parse(funcname, signature, defaults_w) - return fastf_uid(space, w_o) - - f_uid = uid - - def uid(space, w_o): - goto = 1 # startblock - while True: - - if goto == 1: - w_0 = space.id(w_o) - w_1 = space.lt(w_0, gi_0) - v0 = space.is_true(w_1) - if v0 == True: - w_2 = w_0 - goto = 2 - else: - assert v0 == False - w_3 = w_0 - goto = 3 - - if goto == 2: - w_4 = space.inplace_add(w_2, glong_0x7fffffffL) - w_5 = space.inplace_add(w_4, glong_0x7fffffffL) - w_6 = space.inplace_add(w_5, gi_2) - w_3 = w_6 - goto = 3 - - if goto == 3: - return w_3 - - fastf_uid = uid - -##SECTION## -## filename 'lib/_classobj.py' -## function 'type_err' -## firstlineno 39 -##SECTION## -# global declaration -# global object gs_argument__s_must_be__s__not__s - - def type_err(space, __args__): - funcname = "type_err" - signature = ['arg', 'expected', 'v'], None, None - defaults_w = [] - w_arg, w_expected, w_v = __args__.parse(funcname, signature, defaults_w) - return fastf_type_err(space, w_arg, w_expected, w_v) - - f_type_err = type_err - - def type_err(space, w_arg, w_expected, w_v): - goto = 1 # startblock - while True: - - if goto == 1: - w_0 = space.type(w_v) - w_1 = space.getattr(w_0, gs___name__) - w_2 = space.newtuple([w_arg, w_expected, w_1]) - w_3 = space.mod(gs_argument__s_must_be__s__not__s, w_2) - w_4 = space.call_function(space.w_TypeError, w_3) - w_5 = w_4 - goto = 2 - - if goto == 2: - return w_5 - - fastf_type_err = type_err - -##SECTION## -## filename 'lib/_classobj.py' -## function 'set_name' -## firstlineno 42 -##SECTION## -# global declarations -# global object gs___name___must_be_a_string_object -# global object gdescriptor_classobj__name - - def set_name(space, __args__): - funcname = "set_name" - signature = ['cls', 'name'], None, None - defaults_w = [] - w_cls, w_name = __args__.parse(funcname, signature, defaults_w) - return fastf_set_name(space, w_cls, w_name) - - f_set_name = set_name - - def set_name(space, w_cls, w_name): - goto = 1 # startblock - while True: - - if goto == 1: - w_0 = space.isinstance(w_name, space.w_str) - v0 = space.is_true(w_0) - if v0 == True: - w_cls_1, w_name_1 = w_cls, w_name - goto = 3 - else: - assert v0 == False - goto = 2 - - if goto == 2: - w_1 = space.call_function(space.w_TypeError, gs___name___must_be_a_string_object) - w_2 = space.type(w_1) - w_etype, w_evalue = w_2, w_1 - goto = 4 - - if goto == 3: - w_3 = space.getattr(gdescriptor_classobj__name, gs___set__) - w_4 = space.call_function(w_3, w_cls_1, w_name_1) - w_5 = space.w_None - goto = 5 - - if goto == 4: - raise gOperationError(w_etype, w_evalue) - - if goto == 5: - return w_5 - - fastf_set_name = set_name - -##SECTION## -## filename 'lib/_classobj.py' -## function 'set_bases' -## firstlineno 47 -##SECTION## -# global declarations -# global object gs___bases___must_be_a_tuple_object -# global object gcls_StopIteration -# global object gs___bases___items_must_be_classes -# global object gdescriptor_classobj__bases -# global object gs___set__ - - def set_bases(space, __args__): - funcname = "set_bases" - signature = ['cls', 'bases'], None, None - defaults_w = [] - w_cls, w_bases = __args__.parse(funcname, signature, defaults_w) - return fastf_set_bases(space, w_cls, w_bases) - - f_set_bases = set_bases - - def set_bases(space, w_cls, w_bases): - goto = 1 # startblock - while True: - - if goto == 1: - w_0 = space.isinstance(w_bases, space.w_tuple) - v0 = space.is_true(w_0) - if v0 == True: - w_cls_1, w_bases_1 = w_cls, w_bases - goto = 3 - else: - assert v0 == False - goto = 2 - - if goto == 2: - w_1 = space.call_function(space.w_TypeError, gs___bases___must_be_a_tuple_object) - w_2 = space.type(w_1) - w_etype, w_evalue = w_2, w_1 - goto = 8 - - if goto == 3: - w_3 = space.iter(w_bases_1) - w_cls_2, w_bases_2, w_4 = w_cls_1, w_bases_1, w_3 - goto = 4 - - if goto == 4: - try: - w_5 = space.next(w_4) - w_cls_3, w_bases_3, w_6, w_7 = w_cls_2, w_bases_2, w_4, w_5 - goto = 5 - except gOperationError, e: - e.normalize_exception(space) - if space.is_true(space.issubtype(e.w_type, space.w_StopIteration)): - w_cls_4, w_bases_4 = w_cls_2, w_bases_2 - goto = 7 - else:raise # unhandled case, should not happen - - if goto == 5: - w_8 = space.isinstance(w_7, gcls_classobj) - v1 = space.is_true(w_8) - if v1 == True: - w_cls_2, w_bases_2, w_4 = w_cls_3, w_bases_3, w_6 - goto = 4 - continue - else: - assert v1 == False - goto = 6 - - if goto == 6: - w_9 = space.call_function(space.w_TypeError, gs___bases___items_must_be_classes) - w_10 = space.type(w_9) - w_etype, w_evalue = w_10, w_9 - goto = 8 - - if goto == 7: - w_11 = space.getattr(gdescriptor_classobj__bases, gs___set__) - w_12 = space.call_function(w_11, w_cls_4, w_bases_4) - w_13 = space.w_None - goto = 9 - - if goto == 8: - raise gOperationError(w_etype, w_evalue) - - if goto == 9: - return w_13 - - fastf_set_bases = set_bases - -##SECTION## -## filename 'lib/_classobj.py' -## function 'set_dict' -## firstlineno 55 -##SECTION## -# global declarations -# global object gcls_TypeError -# global object gs___dict___must_be_a_dictionary_ob - - def set_dict(space, __args__): - funcname = "set_dict" - signature = ['cls', 'dic'], None, None - defaults_w = [] - w_cls, w_dic = __args__.parse(funcname, signature, defaults_w) - return fastf_set_dict(space, w_cls, w_dic) - - f_set_dict = set_dict - - def set_dict(space, w_cls, w_dic): - goto = 1 # startblock - while True: - - if goto == 1: - w_0 = space.isinstance(w_dic, space.w_dict) - v0 = space.is_true(w_0) - if v0 == True: - w_1, w_2 = w_cls, w_dic - goto = 3 - else: - assert v0 == False - goto = 2 - - if goto == 2: - w_3 = space.call_function(space.w_TypeError, gs___dict___must_be_a_dictionary_ob) - w_4 = space.type(w_3) - w_etype, w_evalue = w_4, w_3 - goto = 4 - - if goto == 3: - w_5 = space.call_function(gdescriptor_object___setattr__, w_1, gs___dict__, w_2) - w_6 = space.w_None - goto = 5 - - if goto == 4: - raise gOperationError(w_etype, w_evalue) - - if goto == 5: - return w_6 - - fastf_set_dict = set_dict - -##SECTION## -## filename 'lib/_classobj.py' -## function 'retrieve' -## firstlineno 60 -##SECTION## -# global declarations -# global object gdescriptor_object___getattribute__ -# global object gcls_KeyError - - def retrieve(space, __args__): - funcname = "retrieve" - signature = ['obj', 'attr'], None, None - defaults_w = [] - w_obj, w_attr = __args__.parse(funcname, signature, defaults_w) - return fastf_retrieve(space, w_obj, w_attr) - - f_retrieve = retrieve - - def retrieve(space, w_obj, w_attr): - goto = 1 # startblock - while True: - - if goto == 1: - w_0 = space.call_function(gdescriptor_object___getattribute__, w_obj, gs___dict__) - try: - w_1 = space.getitem(w_0, w_attr) - w_2 = w_1 - goto = 7 - except gOperationError, e: - e.normalize_exception(space) - if space.is_true(space.issubtype(e.w_type, space.w_KeyError)): - w_3 = w_attr - goto = 3 - else:raise # unhandled case, should not happen - - if goto == 2: - w_4 = space.call_function(space.w_AttributeError, ) - w_5 = space.type(w_4) - w_etype, w_evalue = w_5, w_4 - goto = 6 - - if goto == 3: - w_6 = space.is_(w_3, space.w_None) - v0 = space.is_true(w_6) - if v0 == True: - goto = 2 - continue - else: - assert v0 == False - w_7 = w_3 - goto = 4 - - if goto == 4: - w_8 = space.type(w_7) - w_9 = space.issubtype(w_8, space.w_AttributeError) - v1 = space.is_true(w_9) - if v1 == True: - w_etype, w_evalue = w_8, w_7 - goto = 6 - else: - assert v1 == False - w_10 = w_7 - goto = 5 - - if goto == 5: - w_11 = space.call_function(space.w_AttributeError, w_10) - w_12 = space.type(w_11) - w_etype, w_evalue = w_12, w_11 - goto = 6 - - if goto == 6: - raise gOperationError(w_etype, w_evalue) - - if goto == 7: - return w_2 - - fastf_retrieve = retrieve - -##SECTION## -## filename 'lib/_classobj.py' -## function 'lookup' -## firstlineno 67 -##SECTION## -# global declaration -# global object g2tuple_1 - - def lookup(space, __args__): - funcname = "lookup" - signature = ['cls', 'attr'], None, None - defaults_w = [] - w_cls, w_attr = __args__.parse(funcname, signature, defaults_w) - return fastf_lookup(space, w_cls, w_attr) - - f_lookup = lookup - - def lookup(space, w_cls, w_attr): - goto = 1 # startblock - while True: - - if goto == 1: - try: - w_0 = fastf_retrieve(space, w_cls, w_attr) - w_1, w_2 = w_0, w_cls - goto = 2 - except gOperationError, e: - e.normalize_exception(space) - if space.is_true(space.issubtype(e.w_type, space.w_Exception)): - w_cls_1, w_attr_1, w_3, w_4 = w_cls, w_attr, e.w_type, e.w_value - goto = 3 - else:raise # unhandled case, should not happen - - if goto == 2: - w_5 = space.newtuple([w_1, w_2]) - w_6 = w_5 - goto = 11 - - if goto == 3: - w_7 = space.is_(w_3, space.w_AttributeError) - v0 = space.is_true(w_7) - if v0 == True: - w_cls_2, w_attr_2 = w_cls_1, w_attr_1 - goto = 5 - else: - assert v0 == False - w_cls_3, w_attr_3, w_8, w_9 = w_cls_1, w_attr_1, w_3, w_4 - goto = 4 - - if goto == 4: - w_10 = space.issubtype(w_8, space.w_AttributeError) - v1 = space.is_true(w_10) - if v1 == True: - w_cls_2, w_attr_2 = w_cls_3, w_attr_3 - goto = 5 - else: - assert v1 == False - w_etype, w_evalue = w_8, w_9 - goto = 10 - - if goto == 5: - w_11 = space.getattr(gdescriptor_classobj__bases, gs___get__) - w_12 = space.call_function(w_11, w_cls_2) - w_13 = space.iter(w_12) - w_attr_4, w_14 = w_attr_2, w_13 - goto = 6 - - if goto == 6: - try: - w_15 = space.next(w_14) - w_attr_5, w_16, w_17 = w_attr_4, w_14, w_15 - goto = 7 - except gOperationError, e: - e.normalize_exception(space) - if space.is_true(space.issubtype(e.w_type, space.w_StopIteration)): - w_6 = g2tuple_1 - goto = 11 - else:raise # unhandled case, should not happen - - if goto == 7: - w_18 = fastf_lookup(space, w_17, w_attr_5) - w_19 = space.len(w_18) - w_20 = space.eq(w_19, gi_2) - v2 = space.is_true(w_20) - if v2 == True: - w_attr_6, w_21, w_22 = w_attr_5, w_16, w_18 - goto = 8 - else: - assert v2 == False - w_etype, w_evalue = space.w_ValueError, space.w_None - goto = 10 - - if goto == 8: - w_23 = space.getitem(w_22, gi_0) - w_24 = space.getitem(w_22, gi_1) - v3 = space.is_true(w_24) - if v3 == True: - w_25, w_26 = w_23, w_24 - goto = 9 - else: - assert v3 == False - w_attr_4, w_14 = w_attr_6, w_21 - goto = 6 - continue - - if goto == 9: - w_27 = space.newtuple([w_25, w_26]) - w_6 = w_27 - goto = 11 - - if goto == 10: - raise gOperationError(w_etype, w_evalue) - - if goto == 11: - return w_6 - - fastf_lookup = lookup - -##SECTION## -## filename 'lib/_classobj.py' -## function 'get_class_module' -## firstlineno 79 -##SECTION## -# global declarations -# global object gfunc_retrieve -# global object gcls_Exception -# global object gcls_AttributeError - - def get_class_module(space, __args__): - funcname = "get_class_module" - signature = ['cls'], None, None - defaults_w = [] - w_cls, = __args__.parse(funcname, signature, defaults_w) - return fastf_get_class_module(space, w_cls) - - f_get_class_module = get_class_module - - def get_class_module(space, w_cls): - goto = 1 # startblock - while True: - - if goto == 1: - try: - w_0 = fastf_retrieve(space, w_cls, gs___module__) - w_mod = w_0 - goto = 3 - except gOperationError, e: - e.normalize_exception(space) - if space.is_true(space.issubtype(e.w_type, space.w_Exception)): - w_1, w_2 = e.w_type, e.w_value - goto = 2 - else:raise # unhandled case, should not happen - - if goto == 2: - w_3 = space.is_(w_1, space.w_AttributeError) - v0 = space.is_true(w_3) - if v0 == True: - w_mod = space.w_None - goto = 3 - else: - assert v0 == False - w_4, w_5 = w_1, w_2 - goto = 4 - - if goto == 3: - w_6 = space.isinstance(w_mod, space.w_str) - v1 = space.is_true(w_6) - if v1 == True: - w_7 = w_mod - goto = 6 - else: - assert v1 == False - w_7 = gs__ - goto = 6 - - if goto == 4: - w_8 = space.issubtype(w_4, space.w_AttributeError) - v2 = space.is_true(w_8) - if v2 == True: - w_mod = space.w_None - goto = 3 - continue - else: - assert v2 == False - w_etype, w_evalue = w_4, w_5 - goto = 5 - - if goto == 5: - raise gOperationError(w_etype, w_evalue) - - if goto == 6: - return w_7 - - fastf_get_class_module = get_class_module - -##SECTION## -## filename 'lib/_classobj.py' -## function 'mro_lookup' -## firstlineno 88 -##SECTION## -# global declaration -# global object gs___mro__ - - def mro_lookup(space, __args__): - funcname = "mro_lookup" - signature = ['v', 'name'], None, None - defaults_w = [] - w_v, w_name = __args__.parse(funcname, signature, defaults_w) - return fastf_mro_lookup(space, w_v, w_name) - - f_mro_lookup = mro_lookup - - def mro_lookup(space, w_v, w_name): - goto = 1 # startblock - while True: - - if goto == 1: - try: - w_0 = space.type(w_v) - w_name_1, w_1 = w_name, w_0 - goto = 2 - except gOperationError, e: - e.normalize_exception(space) - if space.is_true(space.issubtype(e.w_type, space.w_Exception)): - w_2, w_3 = e.w_type, e.w_value - goto = 3 - else:raise # unhandled case, should not happen - - if goto == 2: - try: - w_4 = space.getattr(w_1, gs___mro__) - w_name_2, w_5 = w_name_1, w_4 - goto = 5 - except gOperationError, e: - e.normalize_exception(space) - if space.is_true(space.issubtype(e.w_type, space.w_AttributeError)): - w_6 = space.w_None - goto = 10 - else:raise # unhandled case, should not happen - - if goto == 3: - w_7 = space.is_(w_2, space.w_AttributeError) - v0 = space.is_true(w_7) - if v0 == True: - w_6 = space.w_None - goto = 10 - else: - assert v0 == False - w_8, w_9 = w_2, w_3 - goto = 4 - - if goto == 4: - w_10 = space.issubtype(w_8, space.w_AttributeError) - v1 = space.is_true(w_10) - if v1 == True: - w_6 = space.w_None - goto = 10 - else: - assert v1 == False - w_etype, w_evalue = w_8, w_9 - goto = 9 - - if goto == 5: - w_11 = space.iter(w_5) - w_name_3, w_12 = w_name_2, w_11 - goto = 6 - - if goto == 6: - try: - w_13 = space.next(w_12) - w_name_4, w_x, w_14 = w_name_3, w_13, w_12 - goto = 7 - except gOperationError, e: - e.normalize_exception(space) - if space.is_true(space.issubtype(e.w_type, space.w_StopIteration)): - w_6 = space.w_None - goto = 10 - else:raise # unhandled case, should not happen - - if goto == 7: - w_15 = space.getattr(w_x, gs___dict__) - w_16 = space.contains(w_15, w_name_4) - v2 = space.is_true(w_16) - if v2 == True: - w_name_5, w_17 = w_name_4, w_x - goto = 8 - else: - assert v2 == False - w_name_3, w_12 = w_name_4, w_14 - goto = 6 - continue - - if goto == 8: - w_18 = space.getattr(w_17, gs___dict__) - w_19 = space.getitem(w_18, w_name_5) - w_6 = w_19 - goto = 10 - - if goto == 9: - raise gOperationError(w_etype, w_evalue) - - if goto == 10: - return w_6 - - fastf_mro_lookup = mro_lookup - -##SECTION## -## filename 'lib/_classobj.py' -## function '__new__' -## firstlineno 116 -##SECTION## -# global declarations -# global object gfunc_type_err -# global object gs_name -# global object gs_string -# global object g0tuple -# global object gs_bases -# global object gs_tuple -# global object gs_dict -# global object gs___doc__ -# global object gs__getframe -# global object gs_f_globals -# global object gs_get -# global object gs_OLD_STYLE_CLASSES_IMPL -# global object g_object -# global object gs_callable -# global object gs_base_must_be_class - - def __new__(space, __args__): - funcname = "__new__" - signature = ['subtype', 'name', 'bases', 'dic'], None, None - defaults_w = [] - w_subtype, w_name, w_bases, w_dic = __args__.parse(funcname, signature, defaults_w) - return fastf___new__(space, w_subtype, w_name, w_bases, w_dic) - - f___new__ = __new__ - - def __new__(space, w_subtype, w_name, w_bases, w_dic): - goto = 1 # startblock - while True: - - if goto == 1: - w_0 = space.isinstance(w_name, space.w_str) - v0 = space.is_true(w_0) - if v0 == True: - w_name_1, w_bases_1, w_dic_1 = w_name, w_bases, w_dic - goto = 3 - else: - assert v0 == False - w_1 = w_name - goto = 2 - - if goto == 2: - w_2 = fastf_type_err(space, gs_name, gs_string, w_1) - w_3 = space.type(w_2) - w_4 = space.issubtype(w_3, space.w_type) - v1 = space.is_true(w_4) - if v1 == True: - w_5 = w_2 - goto = 6 - else: - assert v1 == False - w_6 = w_2 - goto = 5 - - if goto == 3: - w_7 = space.is_(w_bases_1, space.w_None) - v2 = space.is_true(w_7) - if v2 == True: - w_name_2, w_bases_2, w_dic_2 = w_name_1, g0tuple, w_dic_1 - goto = 4 - else: - assert v2 == False - w_name_2, w_bases_2, w_dic_2 = w_name_1, w_bases_1, w_dic_1 - goto = 4 - - if goto == 4: - w_8 = space.isinstance(w_bases_2, space.w_tuple) - v3 = space.is_true(w_8) - if v3 == True: - w_name_3, w_bases_3, w_dic_3 = w_name_2, w_bases_2, w_dic_2 - goto = 8 - else: - assert v3 == False - w_9 = w_bases_2 - goto = 7 - - if goto == 5: - w_10 = space.type(w_6) - w_etype, w_evalue = w_10, w_6 - goto = 32 - - if goto == 6: - w_11 = space.call_function(w_5, ) - w_12 = space.type(w_11) - w_etype, w_evalue = w_12, w_11 - goto = 32 - - if goto == 7: - w_13 = fastf_type_err(space, gs_bases, gs_tuple, w_9) - w_14 = space.type(w_13) - w_15 = space.issubtype(w_14, space.w_type) - v4 = space.is_true(w_15) - if v4 == True: - w_16 = w_13 - goto = 10 - else: - assert v4 == False - w_17 = w_13 - goto = 9 - - if goto == 8: - w_18 = space.isinstance(w_dic_3, space.w_dict) - v5 = space.is_true(w_18) - if v5 == True: - w_name_4, w_bases_4, w_dic_4 = w_name_3, w_bases_3, w_dic_3 - goto = 12 - else: - assert v5 == False - w_19 = w_dic_3 - goto = 11 - - if goto == 9: - w_20 = space.type(w_17) - w_etype, w_evalue = w_20, w_17 - goto = 32 - - if goto == 10: - w_21 = space.call_function(w_16, ) - w_22 = space.type(w_21) - w_etype, w_evalue = w_22, w_21 - goto = 32 - - if goto == 11: - w_23 = fastf_type_err(space, gs_dict, gs_dict, w_19) - w_24 = space.type(w_23) - w_25 = space.issubtype(w_24, space.w_type) - v6 = space.is_true(w_25) - if v6 == True: - w_26 = w_23 - goto = 16 - else: - assert v6 == False - w_27 = w_23 - goto = 15 - - if goto == 12: - try: - w_28 = space.getitem(w_dic_4, gs___doc__) - w_name_5, w_bases_5, w_dic_5 = w_name_4, w_bases_4, w_dic_4 - goto = 14 - except gOperationError, e: - e.normalize_exception(space) - if space.is_true(space.issubtype(e.w_type, space.w_KeyError)): - w_name_6, w_bases_6, w_dic_6 = w_name_4, w_bases_4, w_dic_4 - goto = 13 - else:raise # unhandled case, should not happen - - if goto == 13: - w_29 = space.setitem(w_dic_6, gs___doc__, space.w_None) - w_name_5, w_bases_5, w_dic_5 = w_name_6, w_bases_6, w_dic_6 - goto = 14 - - if goto == 14: - try: - w_30 = space.getitem(w_dic_5, gs___module__) - w_name_7, w_bases_7, w_dic_7 = w_name_5, w_bases_5, w_dic_5 - goto = 25 - except gOperationError, e: - e.normalize_exception(space) - if space.is_true(space.issubtype(e.w_type, space.w_KeyError)): - (w_name_8, w_bases_8, w_dic_8, w_i) = (w_name_5, w_bases_5, - w_dic_5, gi_0) - goto = 17 - else:raise # unhandled case, should not happen - - if goto == 15: - w_31 = space.type(w_27) - w_etype, w_evalue = w_31, w_27 - goto = 32 - - if goto == 16: - w_32 = space.call_function(w_26, ) - w_33 = space.type(w_32) - w_etype, w_evalue = w_33, w_32 - goto = 32 - - if goto == 17: - try: - w_34 = space.call_function((space.sys.get(space.str_w(gs__getframe))), w_i) - (w_name_9, w_bases_9, w_dic_9, w_i_1, w_35) = (w_name_8, - w_bases_8, w_dic_8, w_i, w_34) - goto = 18 - except gOperationError, e: - e.normalize_exception(space) - if space.is_true(space.issubtype(e.w_type, space.w_Exception)): - (w_name_10, w_bases_10, w_dic_10, w_36, w_37) = (w_name_8, - w_bases_8, w_dic_8, e.w_type, e.w_value) - goto = 21 - else:raise # unhandled case, should not happen - - if goto == 18: - w_38 = space.getattr(w_35, gs_f_globals) - w_39 = space.getattr(w_38, gs_get) - try: - w_40 = space.call_function(w_39, gs_OLD_STYLE_CLASSES_IMPL, space.w_None) - (w_name_11, w_bases_11, w_dic_11, w_g, w_i_2, w_41) = (w_name_9, - w_bases_9, w_dic_9, w_38, w_i_1, w_40) - goto = 19 - except gOperationError, e: - e.normalize_exception(space) - if space.is_true(space.issubtype(e.w_type, space.w_Exception)): - (w_name_10, w_bases_10, w_dic_10, w_36, w_37) = (w_name_9, - w_bases_9, w_dic_9, e.w_type, e.w_value) - goto = 21 - else:raise # unhandled case, should not happen - - if goto == 19: - w_42 = space.is_(w_41, g_object) - v7 = space.is_true(w_42) - if v7 == True: - (w_name_12, w_bases_12, w_dic_12, w_43) = (w_name_11, w_bases_11, - w_dic_11, w_i_2) - goto = 20 - else: - assert v7 == False - (w_name_13, w_bases_13, w_dic_13, w_44) = (w_name_11, w_bases_11, - w_dic_11, w_g) - goto = 23 - - if goto == 20: - w_45 = space.inplace_add(w_43, gi_1) - (w_name_8, w_bases_8, w_dic_8, w_i) = (w_name_12, w_bases_12, - w_dic_12, w_45) - goto = 17 - continue - - if goto == 21: - w_46 = space.is_(w_36, space.w_ValueError) - v8 = space.is_true(w_46) - if v8 == True: - w_name_7, w_bases_7, w_dic_7 = w_name_10, w_bases_10, w_dic_10 - goto = 25 - else: - assert v8 == False - (w_name_14, w_bases_14, w_dic_14, w_47, w_48) = (w_name_10, - w_bases_10, w_dic_10, w_36, w_37) - goto = 22 - - if goto == 22: - w_49 = space.issubtype(w_47, space.w_ValueError) - v9 = space.is_true(w_49) - if v9 == True: - w_name_7, w_bases_7, w_dic_7 = w_name_14, w_bases_14, w_dic_14 - goto = 25 - else: - assert v9 == False - w_etype, w_evalue = w_47, w_48 - goto = 32 - - if goto == 23: - w_50 = space.getattr(w_44, gs_get) - w_51 = space.call_function(w_50, gs___name__, space.w_None) - w_52 = space.is_(w_51, space.w_None) - v10 = space.is_true(w_52) - if v10 == True: - w_name_7, w_bases_7, w_dic_7 = w_name_13, w_bases_13, w_dic_13 - goto = 25 - else: - assert v10 == False - (w_name_15, w_bases_15, w_dic_15, w_53) = (w_name_13, w_bases_13, - w_dic_13, w_51) - goto = 24 - - if goto == 24: - w_54 = space.setitem(w_dic_15, gs___module__, w_53) - w_name_7, w_bases_7, w_dic_7 = w_name_15, w_bases_15, w_dic_15 - goto = 25 - - if goto == 25: - w_55 = space.iter(w_bases_7) - (w_name_16, w_bases_16, w_dic_16, w_56) = (w_name_7, w_bases_7, - w_dic_7, w_55) - goto = 26 - - if goto == 26: - try: - w_57 = space.next(w_56) - (w_name_17, w_bases_17, w_dic_17, w_b, w_58) = (w_name_16, - w_bases_16, w_dic_16, w_57, w_56) - goto = 27 - except gOperationError, e: - e.normalize_exception(space) - if space.is_true(space.issubtype(e.w_type, space.w_StopIteration)): - w_name_18, w_bases_18, w_dic_18 = w_name_16, w_bases_16, w_dic_16 - goto = 31 - else:raise # unhandled case, should not happen - - if goto == 27: - w_59 = space.isinstance(w_b, gcls_classobj) - v11 = space.is_true(w_59) - if v11 == True: - (w_name_16, w_bases_16, w_dic_16, w_56) = (w_name_17, w_bases_17, - w_dic_17, w_58) - goto = 26 - continue - else: - assert v11 == False - (w_name_19, w_bases_19, w_dic_19, w_b_1) = (w_name_17, w_bases_17, - w_dic_17, w_b) - goto = 28 - - if goto == 28: - w_60 = space.type(w_b_1) - w_61 = space.call_function((space.builtin.get(space.str_w(gs_callable))), w_60) - v12 = space.is_true(w_61) - if v12 == True: - (w_name_20, w_bases_20, w_dic_20, w_62) = (w_name_19, w_bases_19, - w_dic_19, w_b_1) - goto = 29 - else: - assert v12 == False - goto = 30 - - if goto == 29: - w_63 = space.type(w_62) - w_64 = space.call_function(w_63, w_name_20, w_bases_20, w_dic_20) - w_65 = w_64 - goto = 33 - - if goto == 30: - w_66 = space.call_function(space.w_TypeError, gs_base_must_be_class) - w_67 = space.type(w_66) - w_etype, w_evalue = w_67, w_66 - goto = 32 - - if goto == 31: - w_68 = space.call_function(gbltinmethod___new__, gcls_classobj) - w_69 = space.call_function(gdescriptor_object___setattr__, w_68, gs___dict__, w_dic_18) - w_70 = space.getattr(gdescriptor_classobj__name, gs___set__) - w_71 = space.call_function(w_70, w_68, w_name_18) - w_72 = space.getattr(gdescriptor_classobj__bases, gs___set__) - w_73 = space.call_function(w_72, w_68, w_bases_18) - w_65 = w_68 - goto = 33 - - if goto == 32: - raise gOperationError(w_etype, w_evalue) - - if goto == 33: - return w_65 - - fastf___new__ = __new__ - -##SECTION## -## filename 'lib/_classobj.py' -## function '__setattr__' -## firstlineno 166 -##SECTION## -# global declarations -# global object gfunc_set_name -# global object gs___bases__ -# global object gfunc_set_bases -# global object gfunc_set_dict -# global object gdescriptor_object___setattr__ - - def __setattr__(space, __args__): - funcname = "__setattr__" - signature = ['self', 'attr', 'value'], None, None - defaults_w = [] - w_self, w_attr, w_value = __args__.parse(funcname, signature, defaults_w) - return fastf_classobj___setattr__(space, w_self, w_attr, w_value) - - f_classobj___setattr__ = __setattr__ - - def __setattr__(space, w_self, w_attr, w_value): - goto = 1 # startblock - while True: - - if goto == 1: - w_0 = space.eq(w_attr, gs___name__) - v0 = space.is_true(w_0) - if v0 == True: - w_1, w_2 = w_self, w_value - goto = 2 - else: - assert v0 == False - w_self_1, w_attr_1, w_value_1 = w_self, w_attr, w_value - goto = 3 - - if goto == 2: - w_3 = fastf_set_name(space, w_1, w_2) - w_4 = space.w_None - goto = 8 - - if goto == 3: - w_5 = space.eq(w_attr_1, gs___bases__) - v1 = space.is_true(w_5) - if v1 == True: - w_6, w_7 = w_self_1, w_value_1 - goto = 4 - else: - assert v1 == False - w_self_2, w_attr_2, w_value_2 = w_self_1, w_attr_1, w_value_1 - goto = 5 - - if goto == 4: - w_8 = fastf_set_bases(space, w_6, w_7) - w_4 = space.w_None - goto = 8 - - if goto == 5: - w_9 = space.eq(w_attr_2, gs___dict__) - v2 = space.is_true(w_9) - if v2 == True: - w_10, w_11 = w_self_2, w_value_2 - goto = 6 - else: - assert v2 == False - w_12, w_13, w_14 = w_self_2, w_attr_2, w_value_2 - goto = 7 - - if goto == 6: - w_15 = fastf_set_dict(space, w_10, w_11) - w_4 = space.w_None - goto = 8 - - if goto == 7: - w_16 = space.call_function(gdescriptor_object___setattr__, w_12, w_13, w_14) - w_4 = space.w_None - goto = 8 - - if goto == 8: - return w_4 - - fastf_classobj___setattr__ = __setattr__ - -##SECTION## -## filename 'lib/_classobj.py' -## function '__delattr__' -## firstlineno 176 -##SECTION## -# global declarations -# global object g3tuple_2 -# global object gdescriptor_object___delattr__ - - def __delattr__(space, __args__): - funcname = "__delattr__" - signature = ['self', 'attr'], None, None - defaults_w = [] - w_self, w_attr = __args__.parse(funcname, signature, defaults_w) - return fastf_classobj___delattr__(space, w_self, w_attr) - - f_classobj___delattr__ = __delattr__ - - def __delattr__(space, w_self, w_attr): - goto = 1 # startblock - while True: - - if goto == 1: - w_0 = space.contains(g3tuple_2, w_attr) - v0 = space.is_true(w_0) - if v0 == True: - w_1, w_2 = w_self, w_attr - goto = 2 - else: - assert v0 == False - w_3, w_4 = w_self, w_attr - goto = 3 - - if goto == 2: - w_5 = fastf_classobj___setattr__(space, w_1, w_2, space.w_None) - w_6 = space.w_None - goto = 4 - - if goto == 3: - w_7 = space.call_function(gdescriptor_object___delattr__, w_3, w_4) - w_6 = space.w_None - goto = 4 - - if goto == 4: - return w_6 - - fastf_classobj___delattr__ = __delattr__ - -##SECTION## -## filename 'lib/_classobj.py' -## function '__getattribute__' -## firstlineno 183 -##SECTION## -# global declarations -# global object gs___get__ -# global object gi_1 -# global object gfunc_lookup -# global object gcls_ValueError -# global object gs_class__s_has_no_attribute__s -# global object gfunc_mro_lookup - - def __getattribute__(space, __args__): - funcname = "__getattribute__" - signature = ['self', 'attr'], None, None - defaults_w = [] - w_self, w_attr = __args__.parse(funcname, signature, defaults_w) - return fastf_classobj___getattribute__(space, w_self, w_attr) - - f_classobj___getattribute__ = __getattribute__ - - def __getattribute__(space, w_self, w_attr): - goto = 1 # startblock - while True: - - if goto == 1: - w_0 = space.eq(w_attr, gs___dict__) - v0 = space.is_true(w_0) - if v0 == True: - w_1 = w_self - goto = 2 - else: - assert v0 == False - w_self_1, w_attr_1 = w_self, w_attr - goto = 3 - - if goto == 2: - w_2 = space.call_function(gdescriptor_object___getattribute__, w_1, gs___dict__) - w_3 = w_2 - goto = 16 - - if goto == 3: - w_4 = space.eq(w_attr_1, gs___name__) - v1 = space.is_true(w_4) - if v1 == True: - w_self_2 = w_self_1 - goto = 4 - else: - assert v1 == False - w_self_3, w_attr_2 = w_self_1, w_attr_1 - goto = 5 - - if goto == 4: - w_5 = space.getattr(gdescriptor_classobj__name, gs___get__) - w_6 = space.call_function(w_5, w_self_2) - w_3 = w_6 - goto = 16 - - if goto == 5: - w_7 = space.eq(w_attr_2, gs___bases__) - v2 = space.is_true(w_7) - if v2 == True: - w_self_4 = w_self_3 - goto = 6 - else: - assert v2 == False - w_self_5, w_attr_3 = w_self_3, w_attr_2 - goto = 8 - - if goto == 6: - w_8 = space.getattr(gdescriptor_classobj__bases, gs___get__) - w_9 = space.call_function(w_8, w_self_4) - w_3 = w_9 - goto = 16 - - if goto == 7: - w_10 = space.getitem(w_11, gi_0) - w_12 = space.getitem(w_11, gi_1) - v3 = space.is_true(w_12) - if v3 == True: - w_self_7, w_v = w_self_6, w_10 - goto = 10 - else: - assert v3 == False - w_attr_5, w_13 = w_attr_4, w_self_6 - goto = 9 - - if goto == 8: - w_14 = fastf_lookup(space, w_self_5, w_attr_3) - w_15 = space.len(w_14) - w_16 = space.eq(w_15, gi_2) - v4 = space.is_true(w_16) - if v4 == True: - w_self_6, w_attr_4, w_11 = w_self_5, w_attr_3, w_14 - goto = 7 - continue - else: - assert v4 == False - w_etype, w_evalue = space.w_ValueError, space.w_None - goto = 15 - - if goto == 9: - w_17 = space.getattr(w_13, gs___name__) - w_18 = space.newtuple([w_17, w_attr_5]) - w_19 = space.mod(gs_class__s_has_no_attribute__s, w_18) - w_20 = space.is_(w_19, space.w_None) - v5 = space.is_true(w_20) - if v5 == True: - goto = 11 - else: - assert v5 == False - w_21 = w_19 - goto = 13 - - if goto == 10: - w_22 = fastf_mro_lookup(space, w_v, gs___get__) - w_23 = space.is_(w_22, space.w_None) - v6 = space.is_true(w_23) - if v6 == True: - w_3 = w_v - goto = 16 - else: - assert v6 == False - w_24, w_25, w_26 = w_22, w_v, w_self_7 - goto = 12 - - if goto == 11: - w_27 = space.call_function(space.w_AttributeError, ) - w_28 = space.type(w_27) - w_etype, w_evalue = w_28, w_27 - goto = 15 - - if goto == 12: - w_29 = space.call_function(w_24, w_25, space.w_None, w_26) - w_3 = w_29 - goto = 16 - - if goto == 13: - w_30 = space.type(w_21) - w_31 = space.issubtype(w_30, space.w_AttributeError) - v7 = space.is_true(w_31) - if v7 == True: - w_etype, w_evalue = w_30, w_21 - goto = 15 - else: - assert v7 == False - w_32 = w_21 - goto = 14 - - if goto == 14: - w_33 = space.call_function(space.w_AttributeError, w_32) - w_34 = space.type(w_33) - w_etype, w_evalue = w_34, w_33 - goto = 15 - - if goto == 15: - raise gOperationError(w_etype, w_evalue) - - if goto == 16: - return w_3 - - fastf_classobj___getattribute__ = __getattribute__ - -##SECTION## -## filename 'lib/_classobj.py' -## function '__repr__' -## firstlineno 200 -##SECTION## -# global declarations -# global object gfunc_uid -# global object gs__class__s__s_at_0x_x_ - - def __repr__(space, __args__): - funcname = "__repr__" - signature = ['self'], None, None - defaults_w = [] - w_self, = __args__.parse(funcname, signature, defaults_w) - return fastf_classobj___repr__(space, w_self) - - f_classobj___repr__ = __repr__ - - def __repr__(space, w_self): - goto = 1 # startblock - while True: - - if goto == 1: - w_0 = fastf_get_class_module(space, w_self) - w_1 = space.getattr(w_self, gs___name__) - w_2 = fastf_uid(space, w_self) - w_3 = space.newtuple([w_0, w_1, w_2]) - w_4 = space.mod(gs__class__s__s_at_0x_x_, w_3) - w_5 = w_4 - goto = 2 - - if goto == 2: - return w_5 - - fastf_classobj___repr__ = __repr__ - -##SECTION## -## filename 'lib/_classobj.py' -## function '__str__' -## firstlineno 204 -##SECTION## -# global declarations -# global object gfunc_get_class_module -# global object gs__ -# global object gs___name__ -# global object gs__s__s - - def __str__(space, __args__): - funcname = "__str__" - signature = ['self'], None, None - defaults_w = [] - w_self, = __args__.parse(funcname, signature, defaults_w) - return fastf_classobj___str__(space, w_self) - - f_classobj___str__ = __str__ - - def __str__(space, w_self): - goto = 1 # startblock - while True: - - if goto == 1: - w_0 = fastf_get_class_module(space, w_self) - w_1 = space.eq(w_0, gs__) - v0 = space.is_true(w_1) - if v0 == True: - w_2 = w_self - goto = 2 - else: - assert v0 == False - w_3, w_4 = w_0, w_self - goto = 3 - - if goto == 2: - w_5 = space.getattr(w_2, gs___name__) - w_6 = w_5 - goto = 4 - - if goto == 3: - w_7 = space.getattr(w_4, gs___name__) - w_8 = space.newtuple([w_3, w_7]) - w_9 = space.mod(gs__s__s, w_8) - w_6 = w_9 - goto = 4 - - if goto == 4: - return w_6 - - fastf_classobj___str__ = __str__ - -##SECTION## -## filename 'lib/_classobj.py' -## function '__call__' -## firstlineno 211 -##SECTION## -# global declarations -# global object gbltinmethod___new__ -# global object gdescriptor_instance__class -# global object gfunc_instance_getattr1 -# global object gs___init__ -# global object gs___init_____should_return_None - - def __call__(space, __args__): - funcname = "__call__" - signature = ['self'], 'args', 'kwds' - defaults_w = [] - w_self, w_args, w_kwds = __args__.parse(funcname, signature, defaults_w) - return fastf_classobj___call__(space, w_self, w_args, w_kwds) - - f_classobj___call__ = __call__ - - def __call__(space, w_self, w_args, w_kwds): - goto = 1 # startblock - while True: - - if goto == 1: - w_0 = space.call_function(gbltinmethod___new__, gcls_instance) - w_1 = space.getattr(gdescriptor_instance__class, gs___set__) - w_2 = space.call_function(w_1, w_0, w_self) - w_3 = space.call_function(gfunc_instance_getattr1, w_0, gs___init__, space.w_False) - v0 = space.is_true(w_3) - if v0 == True: - w_inst, w_4, w_5, w_6 = w_0, w_3, w_args, w_kwds - goto = 2 - else: - assert v0 == False - w_7 = w_0 - goto = 7 - - if goto == 2: - _args = gateway.Arguments.fromshape(space, (0, (), True, True), [w_5, w_6]) - w_8 = space.call_args(w_4, _args) - w_9 = space.is_(w_8, space.w_None) - v1 = space.is_true(w_9) - if v1 == True: - w_7 = w_inst - goto = 7 - else: - assert v1 == False - goto = 3 - - if goto == 3: - w_10 = space.call_function(space.w_TypeError, gs___init_____should_return_None) - w_11 = space.type(w_10) - w_12 = space.issubtype(w_11, space.w_type) - v2 = space.is_true(w_12) - if v2 == True: - w_13 = w_10 - goto = 5 - else: - assert v2 == False - w_14 = w_10 - goto = 4 - - if goto == 4: - w_15 = space.type(w_14) - w_etype, w_evalue = w_15, w_14 - goto = 6 - - if goto == 5: - w_16 = space.call_function(w_13, ) - w_17 = space.type(w_16) - w_etype, w_evalue = w_17, w_16 - goto = 6 - - if goto == 6: - raise gOperationError(w_etype, w_evalue) - - if goto == 7: - return w_7 - - fastf_classobj___call__ = __call__ - -##SECTION## -## filename 'lib/_classobj.py' -## function 'instance_getattr1' -## firstlineno 232 -##SECTION## -# global declarations -# global object gs___class__ -# global object gs__s_instance_has_no_attribute__s - - def instance_getattr1(space, __args__): - funcname = "instance_getattr1" - signature = ['inst', 'name', 'exc'], None, None - defaults_w = [space.w_True] - w_inst, w_name, w_exc = __args__.parse(funcname, signature, defaults_w) - return fastf_instance_getattr1(space, w_inst, w_name, w_exc) - - f_instance_getattr1 = instance_getattr1 - - def instance_getattr1(space, w_inst, w_name, w_exc): - goto = 1 # startblock - while True: - - if goto == 1: - w_0 = space.eq(w_name, gs___dict__) - v0 = space.is_true(w_0) - if v0 == True: - w_1, w_2 = w_inst, w_name - goto = 2 - else: - assert v0 == False - w_inst_1, w_name_1, w_exc_1 = w_inst, w_name, w_exc - goto = 3 - - if goto == 2: - w_3 = space.call_function(gdescriptor_object___getattribute__, w_1, w_2) - w_4 = w_3 - goto = 18 - - if goto == 3: - w_5 = space.eq(w_name_1, gs___class__) - v1 = space.is_true(w_5) - if v1 == True: - w_inst_2 = w_inst_1 - goto = 4 - else: - assert v1 == False - w_inst_3, w_name_2, w_exc_2 = w_inst_1, w_name_1, w_exc_1 - goto = 6 - - if goto == 4: - w_6 = space.getattr(gdescriptor_instance__class, gs___get__) - w_7 = space.call_function(w_6, w_inst_2) - w_4 = w_7 - goto = 18 - - if goto == 5: - w_8 = space.issubtype(w_9, space.w_AttributeError) - v2 = space.is_true(w_8) - if v2 == True: - w_inst_5, w_name_4, w_exc_4 = w_inst_4, w_name_3, w_exc_3 - goto = 8 - else: - assert v2 == False - w_etype, w_evalue = w_9, w_10 - goto = 17 - - if goto == 6: - try: - w_11 = fastf_retrieve(space, w_inst_3, w_name_2) - w_4 = w_11 - goto = 18 - except gOperationError, e: - e.normalize_exception(space) - if space.is_true(space.issubtype(e.w_type, space.w_Exception)): - (w_inst_6, w_name_5, w_exc_5, w_12, w_13) = (w_inst_3, w_name_2, - w_exc_2, e.w_type, e.w_value) - goto = 7 - else:raise # unhandled case, should not happen - - if goto == 7: - w_14 = space.is_(w_12, space.w_AttributeError) - v3 = space.is_true(w_14) - if v3 == True: - w_inst_5, w_name_4, w_exc_4 = w_inst_6, w_name_5, w_exc_5 - goto = 8 - else: - assert v3 == False - (w_inst_4, w_name_3, w_exc_3, w_9, w_10) = (w_inst_6, w_name_5, - w_exc_5, w_12, w_13) - goto = 5 - continue - - if goto == 8: - w_15 = space.getattr(gdescriptor_instance__class, gs___get__) - w_16 = space.call_function(w_15, w_inst_5) - w_17 = fastf_lookup(space, w_16, w_name_4) - w_18 = space.len(w_17) - w_19 = space.eq(w_18, gi_2) - v4 = space.is_true(w_19) - if v4 == True: - (w_inst_7, w_name_6, w_exc_6, w_cls, w_20) = (w_inst_5, w_name_4, - w_exc_4, w_16, w_17) - goto = 9 - else: - assert v4 == False - w_etype, w_evalue = space.w_ValueError, space.w_None - goto = 17 - - if goto == 9: - w_21 = space.getitem(w_20, gi_0) - w_22 = space.getitem(w_20, gi_1) - v5 = space.is_true(w_22) - if v5 == True: - w_inst_8, w_v, w_cls_1 = w_inst_7, w_21, w_cls - goto = 15 - else: - assert v5 == False - w_name_7, w_cls_2, w_23 = w_name_6, w_cls, w_exc_6 - goto = 10 - - if goto == 10: - v6 = space.is_true(w_23) - if v6 == True: - w_name_8, w_24 = w_name_7, w_cls_2 - goto = 11 - else: - assert v6 == False - w_4 = space.w_None - goto = 18 - - if goto == 11: - w_25 = space.getattr(w_24, gs___name__) - w_26 = space.newtuple([w_25, w_name_8]) - w_27 = space.mod(gs__s_instance_has_no_attribute__s, w_26) - w_28 = space.is_(w_27, space.w_None) - v7 = space.is_true(w_28) - if v7 == True: - goto = 12 - else: - assert v7 == False - w_29 = w_27 - goto = 13 - - if goto == 12: - w_30 = space.call_function(space.w_AttributeError, ) - w_31 = space.type(w_30) - w_etype, w_evalue = w_31, w_30 - goto = 17 - - if goto == 13: - w_32 = space.type(w_29) - w_33 = space.issubtype(w_32, space.w_AttributeError) - v8 = space.is_true(w_33) - if v8 == True: - w_etype, w_evalue = w_32, w_29 - goto = 17 - else: - assert v8 == False - w_34 = w_29 - goto = 14 - - if goto == 14: - w_35 = space.call_function(space.w_AttributeError, w_34) - w_36 = space.type(w_35) - w_etype, w_evalue = w_36, w_35 - goto = 17 - - if goto == 15: - w_37 = fastf_mro_lookup(space, w_v, gs___get__) - w_38 = space.is_(w_37, space.w_None) - v9 = space.is_true(w_38) - if v9 == True: - w_4 = w_v - goto = 18 - else: - assert v9 == False - w_39, w_40, w_41, w_42 = w_37, w_v, w_inst_8, w_cls_1 - goto = 16 - - if goto == 16: - w_43 = space.call_function(w_39, w_40, w_41, w_42) - w_4 = w_43 - goto = 18 - - if goto == 17: - raise gOperationError(w_etype, w_evalue) - - if goto == 18: - return w_4 - - fastf_instance_getattr1 = instance_getattr1 - -##SECTION## -## filename 'lib/_classobj.py' -## function '__getattribute__' -## firstlineno 256 -##SECTION## -# global declaration -# global object gs___getattr__ - - def __getattribute__(space, __args__): - funcname = "__getattribute__" - signature = ['self', 'name'], None, None - defaults_w = [] - w_self, w_name = __args__.parse(funcname, signature, defaults_w) - return fastf_instance___getattribute__(space, w_self, w_name) - - f_instance___getattribute__ = __getattribute__ - - def __getattribute__(space, w_self, w_name): - goto = 1 # startblock - while True: - - if goto == 1: - try: - w_0 = space.call_function(gfunc_instance_getattr1, w_self, w_name) - w_1 = w_0 - goto = 7 - except gOperationError, e: - e.normalize_exception(space) - if space.is_true(space.issubtype(e.w_type, space.w_Exception)): - (w_self_1, w_name_1, w_2, w_3) = (w_self, w_name, e.w_type, - e.w_value) - goto = 2 - else:raise # unhandled case, should not happen - - if goto == 2: - w_4 = space.is_(w_2, space.w_AttributeError) - v0 = space.is_true(w_4) - if v0 == True: - w_name_2, w_5, w_6, w_7 = w_name_1, w_self_1, w_2, w_3 - goto = 4 - else: - assert v0 == False - w_self_2, w_name_3, w_8, w_9 = w_self_1, w_name_1, w_2, w_3 - goto = 3 - - if goto == 3: - w_10 = space.issubtype(w_8, space.w_AttributeError) - v1 = space.is_true(w_10) - if v1 == True: - w_name_2, w_5, w_6, w_7 = w_name_3, w_self_2, w_8, w_9 - goto = 4 - else: - assert v1 == False - w_etype, w_evalue = w_8, w_9 - goto = 6 - - if goto == 4: - _args = gateway.Arguments.fromshape(space, (2, ('exc',), False, False), [w_5, gs___getattr__, space.w_False]) - w_11 = space.call_args(gfunc_instance_getattr1, _args) - w_12 = space.is_(w_11, space.w_None) - v2 = space.is_true(w_12) - if v2 == True: - w_etype, w_evalue = w_6, w_7 - goto = 6 - else: - assert v2 == False - w_13, w_14 = w_11, w_name_2 - goto = 5 - - if goto == 5: - w_15 = space.call_function(w_13, w_14) - w_1 = w_15 - goto = 7 - - if goto == 6: - raise gOperationError(w_etype, w_evalue) - - if goto == 7: - return w_1 - - fastf_instance___getattribute__ = __getattribute__ - -##SECTION## -## filename 'lib/_classobj.py' -## function '__new__' -## firstlineno 265 -##SECTION## -# global declarations -# global object gs_instance___first_arg_must_be_cla -# global object gs_instance___second_arg_must_be_di - - def __new__(space, __args__): - funcname = "__new__" - signature = ['typ', 'klass', 'dic'], None, None - defaults_w = [space.w_None] - w_typ, w_klass, w_dic = __args__.parse(funcname, signature, defaults_w) - return fastf___new___1(space, w_typ, w_klass, w_dic) - - f___new___1 = __new__ - - def __new__(space, w_typ, w_klass, w_dic): - goto = 1 # startblock - while True: - - if goto == 1: - w_0 = space.isinstance(w_klass, gcls_classobj) - v0 = space.is_true(w_0) - if v0 == True: - w_klass_1, w_dic_1 = w_klass, w_dic - goto = 3 - else: - assert v0 == False - goto = 2 - - if goto == 2: - w_1 = space.call_function(space.w_TypeError, gs_instance___first_arg_must_be_cla) - w_2 = space.type(w_1) - w_3 = space.issubtype(w_2, space.w_type) - v1 = space.is_true(w_3) - if v1 == True: - w_4 = w_1 - goto = 6 - else: - assert v1 == False - w_5 = w_1 - goto = 5 - - if goto == 3: - w_6 = space.is_(w_dic_1, space.w_None) - v2 = space.is_true(w_6) - if v2 == True: - w_klass_2 = w_klass_1 - goto = 4 - else: - assert v2 == False - w_klass_3, w_dic_2 = w_klass_1, w_dic_1 - goto = 7 - - if goto == 4: - w_7 = space.newdict([]) - w_klass_4, w_dic_3 = w_klass_2, w_7 - goto = 9 - - if goto == 5: - w_8 = space.type(w_5) - w_etype, w_evalue = w_8, w_5 - goto = 12 - - if goto == 6: - w_9 = space.call_function(w_4, ) - w_10 = space.type(w_9) - w_etype, w_evalue = w_10, w_9 - goto = 12 - - if goto == 7: - w_11 = space.isinstance(w_dic_2, space.w_dict) - v3 = space.is_true(w_11) - if v3 == True: - w_klass_4, w_dic_3 = w_klass_3, w_dic_2 - goto = 9 - else: - assert v3 == False - goto = 8 - - if goto == 8: - w_12 = space.call_function(space.w_TypeError, gs_instance___second_arg_must_be_di) - w_13 = space.type(w_12) - w_14 = space.issubtype(w_13, space.w_type) - v4 = space.is_true(w_14) - if v4 == True: - w_15 = w_12 - goto = 11 - else: - assert v4 == False - w_16 = w_12 - goto = 10 - - if goto == 9: - w_17 = space.call_function(gbltinmethod___new__, gcls_instance) - w_18 = space.getattr(gdescriptor_instance__class, gs___set__) - w_19 = space.call_function(w_18, w_17, w_klass_4) - w_20 = space.call_function(gdescriptor_object___setattr__, w_17, gs___dict__, w_dic_3) - w_21 = w_17 - goto = 13 - - if goto == 10: - w_22 = space.type(w_16) - w_etype, w_evalue = w_22, w_16 - goto = 12 - - if goto == 11: - w_23 = space.call_function(w_15, ) - w_24 = space.type(w_23) - w_etype, w_evalue = w_24, w_23 - goto = 12 - - if goto == 12: - raise gOperationError(w_etype, w_evalue) - - if goto == 13: - return w_21 - - fastf___new___1 = __new__ - -##SECTION## -## filename 'lib/_classobj.py' -## function '__del__' -## firstlineno 278 -##SECTION## - def __del__(space, __args__): - funcname = "__del__" - signature = ['self'], None, None - defaults_w = [] - w_self, = __args__.parse(funcname, signature, defaults_w) - return fastf_instance___del__(space, w_self) - - f_instance___del__ = __del__ - - def __del__(space, w_self): - goto = 1 # startblock - while True: - - if goto == 1: - _args = gateway.Arguments.fromshape(space, (2, ('exc',), False, False), [w_self, gs___del__, space.w_False]) - w_0 = space.call_args(gfunc_instance_getattr1, _args) - w_1 = space.is_(w_0, space.w_None) - v0 = space.is_true(w_1) - if v0 == True: - w_2 = space.w_None - goto = 3 - else: - assert v0 == False - w_3 = w_0 - goto = 2 - - if goto == 2: - w_4 = space.call_function(w_3, ) - w_2 = space.w_None - goto = 3 - - if goto == 3: - return w_2 - - fastf_instance___del__ = __del__ - -##SECTION## -## filename 'lib/_classobj.py' -## function '__setattr__' -## firstlineno 283 -##SECTION## -# global declarations -# global object gs___dict___must_be_set_to_a_dictio -# global object gs___class___must_be_set_to_a_class - - def __setattr__(space, __args__): - funcname = "__setattr__" - signature = ['self', 'name', 'value'], None, None - defaults_w = [] - w_self, w_name, w_value = __args__.parse(funcname, signature, defaults_w) - return fastf_instance___setattr__(space, w_self, w_name, w_value) - - f_instance___setattr__ = __setattr__ - - def __setattr__(space, w_self, w_name, w_value): - goto = 1 # startblock - while True: - - if goto == 1: - w_0 = space.eq(w_name, gs___dict__) - v0 = space.is_true(w_0) - if v0 == True: - w_self_1, w_value_1 = w_self, w_value - goto = 2 - else: - assert v0 == False - w_self_2, w_name_1, w_value_2 = w_self, w_name, w_value - goto = 5 - - if goto == 2: - w_1 = space.isinstance(w_value_1, space.w_dict) - v1 = space.is_true(w_1) - if v1 == True: - w_2, w_3 = w_self_1, w_value_1 - goto = 4 - else: - assert v1 == False - goto = 3 - - if goto == 3: - w_4 = space.call_function(space.w_TypeError, gs___dict___must_be_set_to_a_dictio) - w_5 = space.type(w_4) - w_6 = space.issubtype(w_5, space.w_type) - v2 = space.is_true(w_6) - if v2 == True: - w_7 = w_4 - goto = 10 - else: - assert v2 == False - w_8 = w_4 - goto = 9 - - if goto == 4: - w_9 = space.call_function(gdescriptor_object___setattr__, w_2, gs___dict__, w_3) - w_10 = space.w_None - goto = 17 - - if goto == 5: - w_11 = space.eq(w_name_1, gs___class__) - v3 = space.is_true(w_11) - if v3 == True: - w_self_3, w_value_3 = w_self_2, w_value_2 - goto = 6 - else: - assert v3 == False - w_self_4, w_name_2, w_value_4 = w_self_2, w_name_1, w_value_2 - goto = 13 - - if goto == 6: - w_12 = space.isinstance(w_value_3, gcls_classobj) - v4 = space.is_true(w_12) - if v4 == True: - w_self_5, w_value_5 = w_self_3, w_value_3 - goto = 8 - else: - assert v4 == False - goto = 7 - - if goto == 7: - w_13 = space.call_function(space.w_TypeError, gs___class___must_be_set_to_a_class) - w_14 = space.type(w_13) - w_15 = space.issubtype(w_14, space.w_type) - v5 = space.is_true(w_15) - if v5 == True: - w_16 = w_13 - goto = 12 - else: - assert v5 == False - w_17 = w_13 - goto = 11 - - if goto == 8: - w_18 = space.getattr(gdescriptor_instance__class, gs___set__) - w_19 = space.call_function(w_18, w_self_5, w_value_5) - w_10 = space.w_None - goto = 17 - - if goto == 9: - w_20 = space.type(w_8) - w_etype, w_evalue = w_20, w_8 - goto = 16 - - if goto == 10: - w_21 = space.call_function(w_7, ) - w_22 = space.type(w_21) - w_etype, w_evalue = w_22, w_21 - goto = 16 - - if goto == 11: - w_23 = space.type(w_17) - w_etype, w_evalue = w_23, w_17 - goto = 16 - - if goto == 12: - w_24 = space.call_function(w_16, ) - w_25 = space.type(w_24) - w_etype, w_evalue = w_25, w_24 - goto = 16 - - if goto == 13: - _args = gateway.Arguments.fromshape(space, (2, ('exc',), False, False), [w_self_4, gs___setattr__, space.w_False]) - w_26 = space.call_args(gfunc_instance_getattr1, _args) - w_27 = space.is_(w_26, space.w_None) - v6 = space.is_true(w_27) - if v6 == True: - w_name_3, w_28, w_29 = w_name_2, w_value_4, w_self_4 - goto = 15 - else: - assert v6 == False - w_30, w_31, w_32 = w_26, w_name_2, w_value_4 - goto = 14 - - if goto == 14: - w_33 = space.call_function(w_30, w_31, w_32) - w_10 = space.w_None - goto = 17 - - if goto == 15: - w_34 = space.getattr(w_29, gs___dict__) - w_35 = space.setitem(w_34, w_name_3, w_28) - w_10 = space.w_None - goto = 17 - - if goto == 16: - raise gOperationError(w_etype, w_evalue) - - if goto == 17: - return w_10 - - fastf_instance___setattr__ = __setattr__ - -##SECTION## -## filename 'lib/_classobj.py' -## function '__delattr__' -## firstlineno 299 -##SECTION## -# global declarations -# global object g2tuple_2 -# global object gs__s_instance_has_no_attribute___s - - def __delattr__(space, __args__): - funcname = "__delattr__" - signature = ['self', 'name'], None, None - defaults_w = [] - w_self, w_name = __args__.parse(funcname, signature, defaults_w) - return fastf_instance___delattr__(space, w_self, w_name) - - f_instance___delattr__ = __delattr__ - - def __delattr__(space, w_self, w_name): - goto = 1 # startblock - while True: - - if goto == 1: - w_0 = space.contains(g2tuple_2, w_name) - v0 = space.is_true(w_0) - if v0 == True: - w_1, w_2 = w_self, w_name - goto = 2 - else: - assert v0 == False - w_self_1, w_name_1 = w_self, w_name - goto = 3 - - if goto == 2: - w_3 = fastf_instance___setattr__(space, w_1, w_2, space.w_None) - w_4 = space.w_None - goto = 10 - - if goto == 3: - _args = gateway.Arguments.fromshape(space, (2, ('exc',), False, False), [w_self_1, gs___delattr__, space.w_False]) - w_5 = space.call_args(gfunc_instance_getattr1, _args) - w_6 = space.is_(w_5, space.w_None) - v1 = space.is_true(w_6) - if v1 == True: - w_self_2, w_name_2 = w_self_1, w_name_1 - goto = 5 - else: - assert v1 == False - w_7, w_8 = w_5, w_name_1 - goto = 4 - - if goto == 4: - w_9 = space.call_function(w_7, w_8) - w_4 = space.w_None - goto = 10 - - if goto == 5: - w_10 = space.getattr(w_self_2, gs___dict__) - try: - w_11 = space.delitem(w_10, w_name_2) - w_4 = space.w_None - goto = 10 - except gOperationError, e: - e.normalize_exception(space) - if space.is_true(space.issubtype(e.w_type, space.w_KeyError)): - w_name_3, w_12 = w_name_2, w_self_2 - goto = 6 - else:raise # unhandled case, should not happen - - if goto == 6: - w_13 = space.getattr(w_12, gs___class__) - w_14 = space.getattr(w_13, gs___name__) - w_15 = space.newtuple([w_14, w_name_3]) - w_16 = space.mod(gs__s_instance_has_no_attribute___s, w_15) - w_17 = space.call_function(space.w_AttributeError, w_16) - w_18 = space.type(w_17) - w_19 = space.issubtype(w_18, space.w_type) - v2 = space.is_true(w_19) - if v2 == True: - w_20 = w_17 - goto = 8 - else: - assert v2 == False - w_21 = w_17 - goto = 7 - - if goto == 7: - w_22 = space.type(w_21) - w_etype, w_evalue = w_22, w_21 - goto = 9 - - if goto == 8: - w_23 = space.call_function(w_20, ) - w_24 = space.type(w_23) - w_etype, w_evalue = w_24, w_23 - goto = 9 - - if goto == 9: - raise gOperationError(w_etype, w_evalue) - - if goto == 10: - return w_4 - - fastf_instance___delattr__ = __delattr__ - -##SECTION## -## filename 'lib/_classobj.py' -## function '__repr__' -## firstlineno 315 -##SECTION## -# global declaration -# global object gs___s__s_instance_at_0x_x_ - - def __repr__(space, __args__): - funcname = "__repr__" - signature = ['self'], None, None - defaults_w = [] - w_self, = __args__.parse(funcname, signature, defaults_w) - return fastf_instance___repr__(space, w_self) - - f_instance___repr__ = __repr__ - - def __repr__(space, w_self): - goto = 1 # startblock - while True: - - if goto == 1: - try: - w_0 = space.call_function(gfunc_instance_getattr1, w_self, gs___repr__) - w_1 = w_0 - goto = 4 - except gOperationError, e: - e.normalize_exception(space) - if space.is_true(space.issubtype(e.w_type, space.w_Exception)): - w_self_1, w_2, w_3 = w_self, e.w_type, e.w_value - goto = 2 - else:raise # unhandled case, should not happen - - if goto == 2: - w_4 = space.is_(w_2, space.w_AttributeError) - v0 = space.is_true(w_4) - if v0 == True: - w_self_2 = w_self_1 - goto = 3 - else: - assert v0 == False - w_self_3, w_5, w_6 = w_self_1, w_2, w_3 - goto = 5 - - if goto == 3: - w_7 = space.getattr(w_self_2, gs___class__) - w_8 = fastf_get_class_module(space, w_7) - w_9 = space.getattr(w_7, gs___name__) - w_10 = fastf_uid(space, w_self_2) - w_11 = space.newtuple([w_8, w_9, w_10]) - w_12 = space.mod(gs___s__s_instance_at_0x_x_, w_11) - w_13 = w_12 - goto = 7 - - if goto == 4: - w_14 = space.call_function(w_1, ) - w_13 = w_14 - goto = 7 - - if goto == 5: - w_15 = space.issubtype(w_5, space.w_AttributeError) - v1 = space.is_true(w_15) - if v1 == True: - w_self_2 = w_self_3 - goto = 3 - continue - else: - assert v1 == False - w_etype, w_evalue = w_5, w_6 - goto = 6 - - if goto == 6: - raise gOperationError(w_etype, w_evalue) - - if goto == 7: - return w_13 - - fastf_instance___repr__ = __repr__ - -##SECTION## -## filename 'lib/_classobj.py' -## function '__str__' -## firstlineno 324 -##SECTION## - def __str__(space, __args__): - funcname = "__str__" - signature = ['self'], None, None - defaults_w = [] - w_self, = __args__.parse(funcname, signature, defaults_w) - return fastf_instance___str__(space, w_self) - - f_instance___str__ = __str__ - - def __str__(space, w_self): - goto = 1 # startblock - while True: - - if goto == 1: - try: - w_0 = space.call_function(gfunc_instance_getattr1, w_self, gs___str__) - w_1 = w_0 - goto = 4 - except gOperationError, e: - e.normalize_exception(space) - if space.is_true(space.issubtype(e.w_type, space.w_Exception)): - w_self_1, w_2, w_3 = w_self, e.w_type, e.w_value - goto = 2 - else:raise # unhandled case, should not happen - - if goto == 2: - w_4 = space.is_(w_2, space.w_AttributeError) - v0 = space.is_true(w_4) - if v0 == True: - w_5 = w_self_1 - goto = 3 - else: - assert v0 == False - w_self_2, w_6, w_7 = w_self_1, w_2, w_3 - goto = 5 - - if goto == 3: - w_8 = fastf_instance___repr__(space, w_5) - w_9 = w_8 - goto = 7 - - if goto == 4: - w_10 = space.call_function(w_1, ) - w_9 = w_10 - goto = 7 - - if goto == 5: - w_11 = space.issubtype(w_6, space.w_AttributeError) - v1 = space.is_true(w_11) - if v1 == True: - w_5 = w_self_2 - goto = 3 - continue - else: - assert v1 == False - w_etype, w_evalue = w_6, w_7 - goto = 6 - - if goto == 6: - raise gOperationError(w_etype, w_evalue) - - if goto == 7: - return w_9 - - fastf_instance___str__ = __str__ - -##SECTION## -## filename 'lib/_classobj.py' -## function '__hash__' -## firstlineno 331 -##SECTION## -# global declarations -# global object gs_unhashable_instance -# global object gs___hash_____should_return_an_int - - def __hash__(space, __args__): - funcname = "__hash__" - signature = ['self'], None, None - defaults_w = [] - w_self, = __args__.parse(funcname, signature, defaults_w) - return fastf_instance___hash__(space, w_self) - - f_instance___hash__ = __hash__ - - def __hash__(space, w_self): - goto = 1 # startblock - while True: - - if goto == 1: - w_0 = space.call_function(gfunc_instance_getattr1, w_self, gs___eq__, space.w_False) - w_1 = space.call_function(gfunc_instance_getattr1, w_self, gs___cmp__, space.w_False) - w_2 = space.call_function(gfunc_instance_getattr1, w_self, gs___hash__, space.w_False) - v0 = space.is_true(w_0) - if v0 == True: - w_self_1, w__hash, w_3 = w_self, w_2, w_0 - goto = 2 - else: - assert v0 == False - w_self_1, w__hash, w_3 = w_self, w_2, w_1 - goto = 2 - - if goto == 2: - v1 = space.is_true(w_3) - if v1 == True: - w_self_2, w__hash_1 = w_self_1, w__hash - goto = 3 - else: - assert v1 == False - w_self_3, w__hash_2, w_4 = w_self_1, w__hash, w_3 - goto = 4 - - if goto == 3: - v2 = space.is_true(w__hash_1) - if v2 == True: - w_self_4, w__hash_3 = w_self_2, w__hash_1 - goto = 6 - else: - assert v2 == False - goto = 5 - - if goto == 4: - v3 = space.is_true(w_4) - if v3 == True: - goto = 5 - else: - assert v3 == False - w_self_4, w__hash_3 = w_self_3, w__hash_2 - goto = 6 - - if goto == 5: - w_5 = space.call_function(space.w_TypeError, gs_unhashable_instance) - w_6 = space.type(w_5) - w_7 = space.issubtype(w_6, space.w_type) - v4 = space.is_true(w_7) - if v4 == True: - w_8 = w_5 - goto = 9 - else: - assert v4 == False - w_9 = w_5 - goto = 8 - - if goto == 6: - v5 = space.is_true(w__hash_3) - if v5 == True: - w_10 = w__hash_3 - goto = 7 - else: - assert v5 == False - w_11 = w_self_4 - goto = 13 - - if goto == 7: - w_12 = space.call_function(w_10, ) - w_13 = space.isinstance(w_12, space.w_int) - v6 = space.is_true(w_13) - if v6 == True: - w_14 = w_12 - goto = 15 - else: - assert v6 == False - goto = 10 - - if goto == 8: - w_15 = space.type(w_9) - w_etype, w_evalue = w_15, w_9 - goto = 14 - - if goto == 9: - w_16 = space.call_function(w_8, ) - w_17 = space.type(w_16) - w_etype, w_evalue = w_17, w_16 - goto = 14 - - if goto == 10: - w_18 = space.call_function(space.w_TypeError, gs___hash_____should_return_an_int) - w_19 = space.type(w_18) - w_20 = space.issubtype(w_19, space.w_type) - v7 = space.is_true(w_20) - if v7 == True: - w_21 = w_18 - goto = 12 - else: - assert v7 == False - w_22 = w_18 - goto = 11 - - if goto == 11: - w_23 = space.type(w_22) - w_etype, w_evalue = w_23, w_22 - goto = 14 - - if goto == 12: - w_24 = space.call_function(w_21, ) - w_25 = space.type(w_24) - w_etype, w_evalue = w_25, w_24 - goto = 14 - - if goto == 13: - w_26 = space.id(w_11) - w_14 = w_26 - goto = 15 - - if goto == 14: - raise gOperationError(w_etype, w_evalue) - - if goto == 15: - return w_14 - - fastf_instance___hash__ = __hash__ - -##SECTION## -## filename 'lib/_classobj.py' -## function '__len__' -## firstlineno 345 -##SECTION## -# global declarations -# global object gs___len_____should_return____0 -# global object gs___len_____should_return_an_int - - def __len__(space, __args__): - funcname = "__len__" - signature = ['self'], None, None - defaults_w = [] - w_self, = __args__.parse(funcname, signature, defaults_w) - return fastf_instance___len__(space, w_self) - - f_instance___len__ = __len__ - - def __len__(space, w_self): - goto = 1 # startblock - while True: - - if goto == 1: - w_0 = space.call_function(gfunc_instance_getattr1, w_self, gs___len__) - w_1 = space.call_function(w_0, ) - w_2 = space.isinstance(w_1, space.w_int) - v0 = space.is_true(w_2) - if v0 == True: - w_ret = w_1 - goto = 2 - else: - assert v0 == False - goto = 8 - - if goto == 2: - w_3 = space.lt(w_ret, gi_0) - v1 = space.is_true(w_3) - if v1 == True: - goto = 3 - else: - assert v1 == False - w_4 = w_ret - goto = 10 - - if goto == 3: - w_5 = space.call_function(space.w_ValueError, gs___len_____should_return____0) - w_6 = space.type(w_5) - w_7 = space.issubtype(w_6, space.w_type) - v2 = space.is_true(w_7) - if v2 == True: - w_8 = w_5 - goto = 7 - else: - assert v2 == False - w_9 = w_5 - goto = 6 - - if goto == 4: - w_10 = space.type(w_11) - w_etype, w_evalue = w_10, w_11 - goto = 9 - - if goto == 5: - w_13 = space.call_function(w_12, ) - w_14 = space.type(w_13) - w_etype, w_evalue = w_14, w_13 - goto = 9 - - if goto == 6: - w_15 = space.type(w_9) - w_etype, w_evalue = w_15, w_9 - goto = 9 - - if goto == 7: - w_16 = space.call_function(w_8, ) - w_17 = space.type(w_16) - w_etype, w_evalue = w_17, w_16 - goto = 9 - - if goto == 8: - w_18 = space.call_function(space.w_TypeError, gs___len_____should_return_an_int) - w_19 = space.type(w_18) - w_20 = space.issubtype(w_19, space.w_type) - v3 = space.is_true(w_20) - if v3 == True: - w_12 = w_18 - goto = 5 - continue - else: - assert v3 == False - w_11 = w_18 - goto = 4 - continue - - if goto == 9: - raise gOperationError(w_etype, w_evalue) - - if goto == 10: - return w_4 - - fastf_instance___len__ = __len__ - -##SECTION## -## filename 'lib/_classobj.py' -## function '__getitem__' -## firstlineno 354 -##SECTION## - def __getitem__(space, __args__): - funcname = "__getitem__" - signature = ['self', 'key'], None, None - defaults_w = [] - w_self, w_key = __args__.parse(funcname, signature, defaults_w) - return fastf_instance___getitem__(space, w_self, w_key) - - f_instance___getitem__ = __getitem__ - - def __getitem__(space, w_self, w_key): - goto = 1 # startblock - while True: - - if goto == 1: - w_0 = space.call_function(gfunc_instance_getattr1, w_self, gs___getitem__) - w_1 = space.call_function(w_0, w_key) - w_2 = w_1 - goto = 2 - - if goto == 2: - return w_2 - - fastf_instance___getitem__ = __getitem__ - -##SECTION## -## filename 'lib/_classobj.py' -## function '__setitem__' -## firstlineno 357 -##SECTION## - def __setitem__(space, __args__): - funcname = "__setitem__" - signature = ['self', 'key', 'value'], None, None - defaults_w = [] - w_self, w_key, w_value = __args__.parse(funcname, signature, defaults_w) - return fastf_instance___setitem__(space, w_self, w_key, w_value) - - f_instance___setitem__ = __setitem__ - - def __setitem__(space, w_self, w_key, w_value): - goto = 1 # startblock - while True: - - if goto == 1: - w_0 = space.call_function(gfunc_instance_getattr1, w_self, gs___setitem__) - w_1 = space.call_function(w_0, w_key, w_value) - w_2 = space.w_None - goto = 2 - - if goto == 2: - return w_2 - - fastf_instance___setitem__ = __setitem__ - -##SECTION## -## filename 'lib/_classobj.py' -## function '__delitem__' -## firstlineno 360 -##SECTION## - def __delitem__(space, __args__): - funcname = "__delitem__" - signature = ['self', 'key'], None, None - defaults_w = [] - w_self, w_key = __args__.parse(funcname, signature, defaults_w) - return fastf_instance___delitem__(space, w_self, w_key) - - f_instance___delitem__ = __delitem__ - - def __delitem__(space, w_self, w_key): - goto = 1 # startblock - while True: - - if goto == 1: - w_0 = space.call_function(gfunc_instance_getattr1, w_self, gs___delitem__) - w_1 = space.call_function(w_0, w_key) - w_2 = space.w_None - goto = 2 - - if goto == 2: - return w_2 - - fastf_instance___delitem__ = __delitem__ - -##SECTION## -## filename 'lib/_classobj.py' -## function '__getslice__' -## firstlineno 363 -##SECTION## - def __getslice__(space, __args__): - funcname = "__getslice__" - signature = ['self', 'i', 'j'], None, None - defaults_w = [] - w_self, w_i, w_j = __args__.parse(funcname, signature, defaults_w) - return fastf_instance___getslice__(space, w_self, w_i, w_j) - - f_instance___getslice__ = __getslice__ - - def __getslice__(space, w_self, w_i, w_j): - goto = 1 # startblock - while True: - - if goto == 1: - w_0 = space.call_function(gfunc_instance_getattr1, w_self, gs___getslice__, space.w_False) - v0 = space.is_true(w_0) - if v0 == True: - w_1, w_2, w_3 = w_0, w_i, w_j - goto = 2 - else: - assert v0 == False - w_4, w_5, w_6 = w_self, w_i, w_j - goto = 3 - - if goto == 2: - w_7 = space.call_function(w_1, w_2, w_3) - w_8 = w_7 - goto = 4 - - if goto == 3: - w_9 = space.newslice(w_5, w_6, space.w_None) - w_10 = space.getitem(w_4, w_9) - w_8 = w_10 - goto = 4 - - if goto == 4: - return w_8 - - fastf_instance___getslice__ = __getslice__ - -##SECTION## -## filename 'lib/_classobj.py' -## function '__setslice__' -## firstlineno 370 -##SECTION## - def __setslice__(space, __args__): - funcname = "__setslice__" - signature = ['self', 'i', 'j', 'sequence'], None, None - defaults_w = [] - w_self, w_i, w_j, w_sequence = __args__.parse(funcname, signature, defaults_w) - return fastf_instance___setslice__(space, w_self, w_i, w_j, w_sequence) - - f_instance___setslice__ = __setslice__ - - def __setslice__(space, w_self, w_i, w_j, w_sequence): - goto = 1 # startblock - while True: - - if goto == 1: - w_0 = space.call_function(gfunc_instance_getattr1, w_self, gs___setslice__, space.w_False) - v0 = space.is_true(w_0) - if v0 == True: - w_1, w_2, w_3, w_4 = w_0, w_i, w_j, w_sequence - goto = 2 - else: - assert v0 == False - w_5, w_6, w_7, w_8 = w_sequence, w_self, w_i, w_j - goto = 3 - - if goto == 2: - w_9 = space.call_function(w_1, w_2, w_3, w_4) - w_10 = space.w_None - goto = 4 - - if goto == 3: - w_11 = space.newslice(w_7, w_8, space.w_None) - w_12 = space.setitem(w_6, w_11, w_5) - w_10 = space.w_None - goto = 4 - - if goto == 4: - return w_10 - - fastf_instance___setslice__ = __setslice__ - -##SECTION## -## filename 'lib/_classobj.py' -## function '__delslice__' -## firstlineno 377 -##SECTION## - def __delslice__(space, __args__): - funcname = "__delslice__" - signature = ['self', 'i', 'j'], None, None - defaults_w = [] - w_self, w_i, w_j = __args__.parse(funcname, signature, defaults_w) - return fastf_instance___delslice__(space, w_self, w_i, w_j) - - f_instance___delslice__ = __delslice__ - - def __delslice__(space, w_self, w_i, w_j): - goto = 1 # startblock - while True: - - if goto == 1: - w_0 = space.call_function(gfunc_instance_getattr1, w_self, gs___delslice__, space.w_False) - v0 = space.is_true(w_0) - if v0 == True: - w_1, w_2, w_3 = w_0, w_i, w_j - goto = 2 - else: - assert v0 == False - w_4, w_5, w_6 = w_self, w_i, w_j - goto = 3 - - if goto == 2: - w_7 = space.call_function(w_1, w_2, w_3) - w_8 = space.w_None - goto = 4 - - if goto == 3: - w_9 = space.newslice(w_5, w_6, space.w_None) - w_10 = space.delitem(w_4, w_9) - w_8 = space.w_None - goto = 4 - - if goto == 4: - return w_8 - - fastf_instance___delslice__ = __delslice__ - -##SECTION## -## filename 'lib/_classobj.py' -## function '__contains__' -## firstlineno 384 -##SECTION## - def __contains__(space, __args__): - funcname = "__contains__" - signature = ['self', 'obj'], None, None - defaults_w = [] - w_self, w_obj = __args__.parse(funcname, signature, defaults_w) - return fastf_instance___contains__(space, w_self, w_obj) - - f_instance___contains__ = __contains__ - - def __contains__(space, w_self, w_obj): - goto = 1 # startblock - while True: - - if goto == 1: - w_0 = space.call_function(gfunc_instance_getattr1, w_self, gs___contains__, space.w_False) - v0 = space.is_true(w_0) - if v0 == True: - w_1, w_2 = w_0, w_obj - goto = 2 - else: - assert v0 == False - w_obj_1, w_3 = w_obj, w_self - goto = 3 - - if goto == 2: - w_4 = space.call_function(w_1, w_2) - w_5 = space.nonzero(w_4) - w_6 = w_5 - goto = 6 - - if goto == 3: - w_7 = space.iter(w_3) - w_obj_2, w_8 = w_obj_1, w_7 - goto = 4 - - if goto == 4: - try: - w_9 = space.next(w_8) - w_obj_3, w_10, w_11 = w_obj_2, w_8, w_9 - goto = 5 - except gOperationError, e: - e.normalize_exception(space) - if space.is_true(space.issubtype(e.w_type, space.w_StopIteration)): - w_6 = space.w_False - goto = 6 - else:raise # unhandled case, should not happen - - if goto == 5: - w_12 = space.eq(w_11, w_obj_3) - v1 = space.is_true(w_12) - if v1 == True: - w_6 = space.w_True - goto = 6 - else: - assert v1 == False - w_obj_2, w_8 = w_obj_3, w_10 - goto = 4 - continue - - if goto == 6: - return w_6 - - fastf_instance___contains__ = __contains__ - -##SECTION## -## filename 'lib/_classobj.py' -## function '__abs__' -## firstlineno 399 -##SECTION## - def __abs__(space, __args__): - funcname = "__abs__" - signature = ['self'], None, None - defaults_w = [] - w_self, = __args__.parse(funcname, signature, defaults_w) - return fastf_instance___abs__(space, w_self) - - f_instance___abs__ = __abs__ - - def __abs__(space, w_self): - goto = 1 # startblock - while True: - - if goto == 1: - w_0 = space.call_function(gfunc_instance_getattr1, w_self, gs___abs__) - w_1 = space.call_function(w_0, ) - w_2 = w_1 - goto = 2 - - if goto == 2: - return w_2 - - fastf_instance___abs__ = __abs__ - -##SECTION## -## filename 'lib/_classobj.py' -## function '__float__' -## firstlineno 399 -##SECTION## - def __float__(space, __args__): - funcname = "__float__" - signature = ['self'], None, None - defaults_w = [] - w_self, = __args__.parse(funcname, signature, defaults_w) - return fastf_instance___float__(space, w_self) - - f_instance___float__ = __float__ - - def __float__(space, w_self): - goto = 1 # startblock - while True: - - if goto == 1: - w_0 = space.call_function(gfunc_instance_getattr1, w_self, gs___float__) - w_1 = space.call_function(w_0, ) - w_2 = w_1 - goto = 2 - - if goto == 2: - return w_2 - - fastf_instance___float__ = __float__ - -##SECTION## -## filename 'lib/_classobj.py' -## function '__hex__' -## firstlineno 399 -##SECTION## - def __hex__(space, __args__): - funcname = "__hex__" - signature = ['self'], None, None - defaults_w = [] - w_self, = __args__.parse(funcname, signature, defaults_w) - return fastf_instance___hex__(space, w_self) - - f_instance___hex__ = __hex__ - - def __hex__(space, w_self): - goto = 1 # startblock - while True: - - if goto == 1: - w_0 = space.call_function(gfunc_instance_getattr1, w_self, gs___hex__) - w_1 = space.call_function(w_0, ) - w_2 = w_1 - goto = 2 - - if goto == 2: - return w_2 - - fastf_instance___hex__ = __hex__ - -##SECTION## -## filename 'lib/_classobj.py' -## function '__int__' -## firstlineno 399 -##SECTION## - def __int__(space, __args__): - funcname = "__int__" - signature = ['self'], None, None - defaults_w = [] - w_self, = __args__.parse(funcname, signature, defaults_w) - return fastf_instance___int__(space, w_self) - - f_instance___int__ = __int__ - - def __int__(space, w_self): - goto = 1 # startblock - while True: - - if goto == 1: - w_0 = space.call_function(gfunc_instance_getattr1, w_self, gs___int__) - w_1 = space.call_function(w_0, ) - w_2 = w_1 - goto = 2 - - if goto == 2: - return w_2 - - fastf_instance___int__ = __int__ - -##SECTION## -## filename 'lib/_classobj.py' -## function '__invert__' -## firstlineno 399 -##SECTION## - def __invert__(space, __args__): - funcname = "__invert__" - signature = ['self'], None, None - defaults_w = [] - w_self, = __args__.parse(funcname, signature, defaults_w) - return fastf_instance___invert__(space, w_self) - - f_instance___invert__ = __invert__ - - def __invert__(space, w_self): - goto = 1 # startblock - while True: - - if goto == 1: - w_0 = space.call_function(gfunc_instance_getattr1, w_self, gs___invert__) - w_1 = space.call_function(w_0, ) - w_2 = w_1 - goto = 2 - - if goto == 2: - return w_2 - - fastf_instance___invert__ = __invert__ - -##SECTION## -## filename 'lib/_classobj.py' -## function '__long__' -## firstlineno 399 -##SECTION## - def __long__(space, __args__): - funcname = "__long__" - signature = ['self'], None, None - defaults_w = [] - w_self, = __args__.parse(funcname, signature, defaults_w) - return fastf_instance___long__(space, w_self) - - f_instance___long__ = __long__ - - def __long__(space, w_self): - goto = 1 # startblock - while True: - - if goto == 1: - w_0 = space.call_function(gfunc_instance_getattr1, w_self, gs___long__) - w_1 = space.call_function(w_0, ) - w_2 = w_1 - goto = 2 - - if goto == 2: - return w_2 - - fastf_instance___long__ = __long__ - -##SECTION## -## filename 'lib/_classobj.py' -## function '__neg__' -## firstlineno 399 -##SECTION## - def __neg__(space, __args__): - funcname = "__neg__" - signature = ['self'], None, None - defaults_w = [] - w_self, = __args__.parse(funcname, signature, defaults_w) - return fastf_instance___neg__(space, w_self) - - f_instance___neg__ = __neg__ - - def __neg__(space, w_self): - goto = 1 # startblock - while True: - - if goto == 1: - w_0 = space.call_function(gfunc_instance_getattr1, w_self, gs___neg__) - w_1 = space.call_function(w_0, ) - w_2 = w_1 - goto = 2 - - if goto == 2: - return w_2 - - fastf_instance___neg__ = __neg__ - -##SECTION## -## filename 'lib/_classobj.py' -## function '__oct__' -## firstlineno 399 -##SECTION## - def __oct__(space, __args__): - funcname = "__oct__" - signature = ['self'], None, None - defaults_w = [] - w_self, = __args__.parse(funcname, signature, defaults_w) - return fastf_instance___oct__(space, w_self) - - f_instance___oct__ = __oct__ - - def __oct__(space, w_self): - goto = 1 # startblock - while True: - - if goto == 1: - w_0 = space.call_function(gfunc_instance_getattr1, w_self, gs___oct__) - w_1 = space.call_function(w_0, ) - w_2 = w_1 - goto = 2 - - if goto == 2: - return w_2 - - fastf_instance___oct__ = __oct__ - -##SECTION## -## filename 'lib/_classobj.py' -## function '__pos__' -## firstlineno 399 -##SECTION## - def __pos__(space, __args__): - funcname = "__pos__" - signature = ['self'], None, None - defaults_w = [] - w_self, = __args__.parse(funcname, signature, defaults_w) - return fastf_instance___pos__(space, w_self) - - f_instance___pos__ = __pos__ - - def __pos__(space, w_self): - goto = 1 # startblock - while True: - - if goto == 1: - w_0 = space.call_function(gfunc_instance_getattr1, w_self, gs___pos__) - w_1 = space.call_function(w_0, ) - w_2 = w_1 - goto = 2 - - if goto == 2: - return w_2 - - fastf_instance___pos__ = __pos__ - -##SECTION## -## filename 'lib/_classobj.py' -## function '__coerce__' -## firstlineno 405 -##SECTION## - def __coerce__(space, __args__): - funcname = "__coerce__" - signature = ['self', 'other'], None, None - defaults_w = [] - w_self, w_other = __args__.parse(funcname, signature, defaults_w) - return fastf_instance___coerce__(space, w_self, w_other) - - f_instance___coerce__ = __coerce__ - - def __coerce__(space, w_self, w_other): - goto = 1 # startblock - while True: - - if goto == 1: - w_0 = space.call_function(gfunc_instance_getattr1, w_self, gs___coerce__, space.w_False) - v0 = space.is_true(w_0) - if v0 == True: - w_1, w_2 = w_0, w_other - goto = 2 - else: - assert v0 == False - w_3 = space.w_NotImplemented - goto = 3 - - if goto == 2: - w_4 = space.call_function(w_1, w_2) - w_3 = w_4 - goto = 3 - - if goto == 3: - return w_3 - - fastf_instance___coerce__ = __coerce__ - -##SECTION## -## filename 'lib/_classobj.py' -## function '__add__' -## firstlineno 422 -##SECTION## - def __add__(space, __args__): - funcname = "__add__" - signature = ['self', 'other'], None, None - defaults_w = [] - w_self, w_other = __args__.parse(funcname, signature, defaults_w) - return fastf_instance___add__(space, w_self, w_other) - - f_instance___add__ = __add__ - - def __add__(space, w_self, w_other): - goto = 1 # startblock - while True: - - if goto == 1: - w_0 = fastf__coerce(space, w_self, w_other) - w_1 = space.is_(w_0, space.w_None) - v0 = space.is_true(w_1) - if v0 == True: - w_self_1, w_other_1, w_coerced, w_2 = w_self, w_other, w_0, w_1 - goto = 3 - else: - assert v0 == False - w_self_2, w_other_2, w_coerced_1 = w_self, w_other, w_0 - goto = 2 - - if goto == 2: - w_3 = space.getitem(w_coerced_1, gi_0) - w_4 = space.is_(w_3, w_self_2) - (w_self_1, w_other_1, w_coerced, w_2) = (w_self_2, w_other_2, - w_coerced_1, w_4) - goto = 3 - - if goto == 3: - v1 = space.is_true(w_2) - if v1 == True: - w_other_3, w_5 = w_other_1, w_self_1 - goto = 4 - else: - assert v1 == False - w_coerced_2 = w_coerced - goto = 6 - - if goto == 4: - w_6 = space.call_function(gfunc_instance_getattr1, w_5, gs___add__, space.w_False) - v2 = space.is_true(w_6) - if v2 == True: - w_7, w_8 = w_6, w_other_3 - goto = 5 - else: - assert v2 == False - w_9 = space.w_NotImplemented - goto = 7 - - if goto == 5: - w_10 = space.call_function(w_7, w_8) - w_9 = w_10 - goto = 7 - - if goto == 6: - w_11 = space.getitem(w_coerced_2, gi_0) - w_12 = space.getitem(w_coerced_2, gi_1) - w_13 = space.add(w_11, w_12) - w_9 = w_13 - goto = 7 - - if goto == 7: - return w_9 - - fastf_instance___add__ = __add__ - -##SECTION## -## filename 'lib/_classobj.py' -## function '__and__' -## firstlineno 422 -##SECTION## - def __and__(space, __args__): - funcname = "__and__" - signature = ['self', 'other'], None, None - defaults_w = [] - w_self, w_other = __args__.parse(funcname, signature, defaults_w) - return fastf_instance___and__(space, w_self, w_other) - - f_instance___and__ = __and__ - - def __and__(space, w_self, w_other): - goto = 1 # startblock - while True: - - if goto == 1: - w_0 = fastf__coerce(space, w_self, w_other) - w_1 = space.is_(w_0, space.w_None) - v0 = space.is_true(w_1) - if v0 == True: - w_self_1, w_other_1, w_coerced, w_2 = w_self, w_other, w_0, w_1 - goto = 3 - else: - assert v0 == False - w_self_2, w_other_2, w_coerced_1 = w_self, w_other, w_0 - goto = 2 - - if goto == 2: - w_3 = space.getitem(w_coerced_1, gi_0) - w_4 = space.is_(w_3, w_self_2) - (w_self_1, w_other_1, w_coerced, w_2) = (w_self_2, w_other_2, - w_coerced_1, w_4) - goto = 3 - - if goto == 3: - v1 = space.is_true(w_2) - if v1 == True: - w_other_3, w_5 = w_other_1, w_self_1 - goto = 4 - else: - assert v1 == False - w_coerced_2 = w_coerced - goto = 6 - - if goto == 4: - w_6 = space.call_function(gfunc_instance_getattr1, w_5, gs___and__, space.w_False) - v2 = space.is_true(w_6) - if v2 == True: - w_7, w_8 = w_6, w_other_3 - goto = 5 - else: - assert v2 == False - w_9 = space.w_NotImplemented - goto = 7 - - if goto == 5: - w_10 = space.call_function(w_7, w_8) - w_9 = w_10 - goto = 7 - - if goto == 6: - w_11 = space.getitem(w_coerced_2, gi_0) - w_12 = space.getitem(w_coerced_2, gi_1) - w_13 = space.and_(w_11, w_12) - w_9 = w_13 - goto = 7 - - if goto == 7: - return w_9 - - fastf_instance___and__ = __and__ - -##SECTION## -## filename 'lib/_classobj.py' -## function '__div__' -## firstlineno 422 -##SECTION## - def __div__(space, __args__): - funcname = "__div__" - signature = ['self', 'other'], None, None - defaults_w = [] - w_self, w_other = __args__.parse(funcname, signature, defaults_w) - return fastf_instance___div__(space, w_self, w_other) - - f_instance___div__ = __div__ - - def __div__(space, w_self, w_other): - goto = 1 # startblock - while True: - - if goto == 1: - w_0 = fastf__coerce(space, w_self, w_other) - w_1 = space.is_(w_0, space.w_None) - v0 = space.is_true(w_1) - if v0 == True: - w_self_1, w_other_1, w_coerced, w_2 = w_self, w_other, w_0, w_1 - goto = 3 - else: - assert v0 == False - w_self_2, w_other_2, w_coerced_1 = w_self, w_other, w_0 - goto = 2 - - if goto == 2: - w_3 = space.getitem(w_coerced_1, gi_0) - w_4 = space.is_(w_3, w_self_2) - (w_self_1, w_other_1, w_coerced, w_2) = (w_self_2, w_other_2, - w_coerced_1, w_4) - goto = 3 - - if goto == 3: - v1 = space.is_true(w_2) - if v1 == True: - w_other_3, w_5 = w_other_1, w_self_1 - goto = 4 - else: - assert v1 == False - w_coerced_2 = w_coerced - goto = 6 - - if goto == 4: - w_6 = space.call_function(gfunc_instance_getattr1, w_5, gs___div__, space.w_False) - v2 = space.is_true(w_6) - if v2 == True: - w_7, w_8 = w_6, w_other_3 - goto = 5 - else: - assert v2 == False - w_9 = space.w_NotImplemented - goto = 7 - - if goto == 5: - w_10 = space.call_function(w_7, w_8) - w_9 = w_10 - goto = 7 - - if goto == 6: - w_11 = space.getitem(w_coerced_2, gi_0) - w_12 = space.getitem(w_coerced_2, gi_1) - w_13 = space.div(w_11, w_12) - w_9 = w_13 - goto = 7 - - if goto == 7: - return w_9 - - fastf_instance___div__ = __div__ - -##SECTION## -## filename 'lib/_classobj.py' -## function '__divmod__' -## firstlineno 422 -##SECTION## - def __divmod__(space, __args__): - funcname = "__divmod__" - signature = ['self', 'other'], None, None - defaults_w = [] - w_self, w_other = __args__.parse(funcname, signature, defaults_w) - return fastf_instance___divmod__(space, w_self, w_other) - - f_instance___divmod__ = __divmod__ - - def __divmod__(space, w_self, w_other): - goto = 1 # startblock - while True: - - if goto == 1: - w_0 = fastf__coerce(space, w_self, w_other) - w_1 = space.is_(w_0, space.w_None) - v0 = space.is_true(w_1) - if v0 == True: - w_self_1, w_other_1, w_coerced, w_2 = w_self, w_other, w_0, w_1 - goto = 3 - else: - assert v0 == False - w_self_2, w_other_2, w_coerced_1 = w_self, w_other, w_0 - goto = 2 - - if goto == 2: - w_3 = space.getitem(w_coerced_1, gi_0) - w_4 = space.is_(w_3, w_self_2) - (w_self_1, w_other_1, w_coerced, w_2) = (w_self_2, w_other_2, - w_coerced_1, w_4) - goto = 3 - - if goto == 3: - v1 = space.is_true(w_2) - if v1 == True: - w_other_3, w_5 = w_other_1, w_self_1 - goto = 4 - else: - assert v1 == False - w_coerced_2 = w_coerced - goto = 6 - - if goto == 4: - w_6 = space.call_function(gfunc_instance_getattr1, w_5, gs___divmod__, space.w_False) - v2 = space.is_true(w_6) - if v2 == True: - w_7, w_8 = w_6, w_other_3 - goto = 5 - else: - assert v2 == False - w_9 = space.w_NotImplemented - goto = 7 - - if goto == 5: - w_10 = space.call_function(w_7, w_8) - w_9 = w_10 - goto = 7 - - if goto == 6: - w_11 = space.getitem(w_coerced_2, gi_0) - w_12 = space.getitem(w_coerced_2, gi_1) - w_13 = space.divmod(w_11, w_12) - w_9 = w_13 - goto = 7 - - if goto == 7: - return w_9 - - fastf_instance___divmod__ = __divmod__ - -##SECTION## -## filename 'lib/_classobj.py' -## function '__floordiv__' -## firstlineno 422 -##SECTION## - def __floordiv__(space, __args__): - funcname = "__floordiv__" - signature = ['self', 'other'], None, None - defaults_w = [] - w_self, w_other = __args__.parse(funcname, signature, defaults_w) - return fastf_instance___floordiv__(space, w_self, w_other) - - f_instance___floordiv__ = __floordiv__ - - def __floordiv__(space, w_self, w_other): - goto = 1 # startblock - while True: - - if goto == 1: - w_0 = fastf__coerce(space, w_self, w_other) - w_1 = space.is_(w_0, space.w_None) - v0 = space.is_true(w_1) - if v0 == True: - w_self_1, w_other_1, w_coerced, w_2 = w_self, w_other, w_0, w_1 - goto = 3 - else: - assert v0 == False - w_self_2, w_other_2, w_coerced_1 = w_self, w_other, w_0 - goto = 2 - - if goto == 2: - w_3 = space.getitem(w_coerced_1, gi_0) - w_4 = space.is_(w_3, w_self_2) - (w_self_1, w_other_1, w_coerced, w_2) = (w_self_2, w_other_2, - w_coerced_1, w_4) - goto = 3 - - if goto == 3: - v1 = space.is_true(w_2) - if v1 == True: - w_other_3, w_5 = w_other_1, w_self_1 - goto = 4 - else: - assert v1 == False - w_coerced_2 = w_coerced - goto = 6 - - if goto == 4: - w_6 = space.call_function(gfunc_instance_getattr1, w_5, gs___floordiv__, space.w_False) - v2 = space.is_true(w_6) - if v2 == True: - w_7, w_8 = w_6, w_other_3 - goto = 5 - else: - assert v2 == False - w_9 = space.w_NotImplemented - goto = 7 - - if goto == 5: - w_10 = space.call_function(w_7, w_8) - w_9 = w_10 - goto = 7 - - if goto == 6: - w_11 = space.getitem(w_coerced_2, gi_0) - w_12 = space.getitem(w_coerced_2, gi_1) - w_13 = space.floordiv(w_11, w_12) - w_9 = w_13 - goto = 7 - - if goto == 7: - return w_9 - - fastf_instance___floordiv__ = __floordiv__ - -##SECTION## -## filename 'lib/_classobj.py' -## function '__lshift__' -## firstlineno 422 -##SECTION## - def __lshift__(space, __args__): - funcname = "__lshift__" - signature = ['self', 'other'], None, None - defaults_w = [] - w_self, w_other = __args__.parse(funcname, signature, defaults_w) - return fastf_instance___lshift__(space, w_self, w_other) - - f_instance___lshift__ = __lshift__ - - def __lshift__(space, w_self, w_other): - goto = 1 # startblock - while True: - - if goto == 1: - w_0 = fastf__coerce(space, w_self, w_other) - w_1 = space.is_(w_0, space.w_None) - v0 = space.is_true(w_1) - if v0 == True: - w_self_1, w_other_1, w_coerced, w_2 = w_self, w_other, w_0, w_1 - goto = 3 - else: - assert v0 == False - w_self_2, w_other_2, w_coerced_1 = w_self, w_other, w_0 - goto = 2 - - if goto == 2: - w_3 = space.getitem(w_coerced_1, gi_0) - w_4 = space.is_(w_3, w_self_2) - (w_self_1, w_other_1, w_coerced, w_2) = (w_self_2, w_other_2, - w_coerced_1, w_4) - goto = 3 - - if goto == 3: - v1 = space.is_true(w_2) - if v1 == True: - w_other_3, w_5 = w_other_1, w_self_1 - goto = 4 - else: - assert v1 == False - w_coerced_2 = w_coerced - goto = 6 - - if goto == 4: - w_6 = space.call_function(gfunc_instance_getattr1, w_5, gs___lshift__, space.w_False) - v2 = space.is_true(w_6) - if v2 == True: - w_7, w_8 = w_6, w_other_3 - goto = 5 - else: - assert v2 == False - w_9 = space.w_NotImplemented - goto = 7 - - if goto == 5: - w_10 = space.call_function(w_7, w_8) - w_9 = w_10 - goto = 7 - - if goto == 6: - w_11 = space.getitem(w_coerced_2, gi_0) - w_12 = space.getitem(w_coerced_2, gi_1) - w_13 = space.lshift(w_11, w_12) - w_9 = w_13 - goto = 7 - - if goto == 7: - return w_9 - - fastf_instance___lshift__ = __lshift__ - -##SECTION## -## filename 'lib/_classobj.py' -## function '__mod__' -## firstlineno 422 -##SECTION## - def __mod__(space, __args__): - funcname = "__mod__" - signature = ['self', 'other'], None, None - defaults_w = [] - w_self, w_other = __args__.parse(funcname, signature, defaults_w) - return fastf_instance___mod__(space, w_self, w_other) - - f_instance___mod__ = __mod__ - - def __mod__(space, w_self, w_other): - goto = 1 # startblock - while True: - - if goto == 1: - w_0 = fastf__coerce(space, w_self, w_other) - w_1 = space.is_(w_0, space.w_None) - v0 = space.is_true(w_1) - if v0 == True: - w_self_1, w_other_1, w_coerced, w_2 = w_self, w_other, w_0, w_1 - goto = 3 - else: - assert v0 == False - w_self_2, w_other_2, w_coerced_1 = w_self, w_other, w_0 - goto = 2 - - if goto == 2: - w_3 = space.getitem(w_coerced_1, gi_0) - w_4 = space.is_(w_3, w_self_2) - (w_self_1, w_other_1, w_coerced, w_2) = (w_self_2, w_other_2, - w_coerced_1, w_4) - goto = 3 - - if goto == 3: - v1 = space.is_true(w_2) - if v1 == True: - w_other_3, w_5 = w_other_1, w_self_1 - goto = 4 - else: - assert v1 == False - w_coerced_2 = w_coerced - goto = 6 - - if goto == 4: - w_6 = space.call_function(gfunc_instance_getattr1, w_5, gs___mod__, space.w_False) - v2 = space.is_true(w_6) - if v2 == True: - w_7, w_8 = w_6, w_other_3 - goto = 5 - else: - assert v2 == False - w_9 = space.w_NotImplemented - goto = 7 - - if goto == 5: - w_10 = space.call_function(w_7, w_8) - w_9 = w_10 - goto = 7 - - if goto == 6: - w_11 = space.getitem(w_coerced_2, gi_0) - w_12 = space.getitem(w_coerced_2, gi_1) - w_13 = space.mod(w_11, w_12) - w_9 = w_13 - goto = 7 - - if goto == 7: - return w_9 - - fastf_instance___mod__ = __mod__ - -##SECTION## -## filename 'lib/_classobj.py' -## function '__mul__' -## firstlineno 422 -##SECTION## - def __mul__(space, __args__): - funcname = "__mul__" - signature = ['self', 'other'], None, None - defaults_w = [] - w_self, w_other = __args__.parse(funcname, signature, defaults_w) - return fastf_instance___mul__(space, w_self, w_other) - - f_instance___mul__ = __mul__ - - def __mul__(space, w_self, w_other): - goto = 1 # startblock - while True: - - if goto == 1: - w_0 = fastf__coerce(space, w_self, w_other) - w_1 = space.is_(w_0, space.w_None) - v0 = space.is_true(w_1) - if v0 == True: - w_self_1, w_other_1, w_coerced, w_2 = w_self, w_other, w_0, w_1 - goto = 3 - else: - assert v0 == False - w_self_2, w_other_2, w_coerced_1 = w_self, w_other, w_0 - goto = 2 - - if goto == 2: - w_3 = space.getitem(w_coerced_1, gi_0) - w_4 = space.is_(w_3, w_self_2) - (w_self_1, w_other_1, w_coerced, w_2) = (w_self_2, w_other_2, - w_coerced_1, w_4) - goto = 3 - - if goto == 3: - v1 = space.is_true(w_2) - if v1 == True: - w_other_3, w_5 = w_other_1, w_self_1 - goto = 4 - else: - assert v1 == False - w_coerced_2 = w_coerced - goto = 6 - - if goto == 4: - w_6 = space.call_function(gfunc_instance_getattr1, w_5, gs___mul__, space.w_False) - v2 = space.is_true(w_6) - if v2 == True: - w_7, w_8 = w_6, w_other_3 - goto = 5 - else: - assert v2 == False - w_9 = space.w_NotImplemented - goto = 7 - - if goto == 5: - w_10 = space.call_function(w_7, w_8) - w_9 = w_10 - goto = 7 - - if goto == 6: - w_11 = space.getitem(w_coerced_2, gi_0) - w_12 = space.getitem(w_coerced_2, gi_1) - w_13 = space.mul(w_11, w_12) - w_9 = w_13 - goto = 7 - - if goto == 7: - return w_9 - - fastf_instance___mul__ = __mul__ - -##SECTION## -## filename 'lib/_classobj.py' -## function '__or__' -## firstlineno 422 -##SECTION## - def __or__(space, __args__): - funcname = "__or__" - signature = ['self', 'other'], None, None - defaults_w = [] - w_self, w_other = __args__.parse(funcname, signature, defaults_w) - return fastf_instance___or__(space, w_self, w_other) - - f_instance___or__ = __or__ - - def __or__(space, w_self, w_other): - goto = 1 # startblock - while True: - - if goto == 1: - w_0 = fastf__coerce(space, w_self, w_other) - w_1 = space.is_(w_0, space.w_None) - v0 = space.is_true(w_1) - if v0 == True: - w_self_1, w_other_1, w_coerced, w_2 = w_self, w_other, w_0, w_1 - goto = 3 - else: - assert v0 == False - w_self_2, w_other_2, w_coerced_1 = w_self, w_other, w_0 - goto = 2 - - if goto == 2: - w_3 = space.getitem(w_coerced_1, gi_0) - w_4 = space.is_(w_3, w_self_2) - (w_self_1, w_other_1, w_coerced, w_2) = (w_self_2, w_other_2, - w_coerced_1, w_4) - goto = 3 - - if goto == 3: - v1 = space.is_true(w_2) - if v1 == True: - w_other_3, w_5 = w_other_1, w_self_1 - goto = 4 - else: - assert v1 == False - w_coerced_2 = w_coerced - goto = 6 - - if goto == 4: - w_6 = space.call_function(gfunc_instance_getattr1, w_5, gs___or__, space.w_False) - v2 = space.is_true(w_6) - if v2 == True: - w_7, w_8 = w_6, w_other_3 - goto = 5 - else: - assert v2 == False - w_9 = space.w_NotImplemented - goto = 7 - - if goto == 5: - w_10 = space.call_function(w_7, w_8) - w_9 = w_10 - goto = 7 - - if goto == 6: - w_11 = space.getitem(w_coerced_2, gi_0) - w_12 = space.getitem(w_coerced_2, gi_1) - w_13 = space.or_(w_11, w_12) - w_9 = w_13 - goto = 7 - - if goto == 7: - return w_9 - - fastf_instance___or__ = __or__ - -##SECTION## -## filename 'lib/_classobj.py' -## function '__rshift__' -## firstlineno 422 -##SECTION## - def __rshift__(space, __args__): - funcname = "__rshift__" - signature = ['self', 'other'], None, None - defaults_w = [] - w_self, w_other = __args__.parse(funcname, signature, defaults_w) - return fastf_instance___rshift__(space, w_self, w_other) - - f_instance___rshift__ = __rshift__ - - def __rshift__(space, w_self, w_other): - goto = 1 # startblock - while True: - - if goto == 1: - w_0 = fastf__coerce(space, w_self, w_other) - w_1 = space.is_(w_0, space.w_None) - v0 = space.is_true(w_1) - if v0 == True: - w_self_1, w_other_1, w_coerced, w_2 = w_self, w_other, w_0, w_1 - goto = 3 - else: - assert v0 == False - w_self_2, w_other_2, w_coerced_1 = w_self, w_other, w_0 - goto = 2 - - if goto == 2: - w_3 = space.getitem(w_coerced_1, gi_0) - w_4 = space.is_(w_3, w_self_2) - (w_self_1, w_other_1, w_coerced, w_2) = (w_self_2, w_other_2, - w_coerced_1, w_4) - goto = 3 - - if goto == 3: - v1 = space.is_true(w_2) - if v1 == True: - w_other_3, w_5 = w_other_1, w_self_1 - goto = 4 - else: - assert v1 == False - w_coerced_2 = w_coerced - goto = 6 - - if goto == 4: - w_6 = space.call_function(gfunc_instance_getattr1, w_5, gs___rshift__, space.w_False) - v2 = space.is_true(w_6) - if v2 == True: - w_7, w_8 = w_6, w_other_3 - goto = 5 - else: - assert v2 == False - w_9 = space.w_NotImplemented - goto = 7 - - if goto == 5: - w_10 = space.call_function(w_7, w_8) - w_9 = w_10 - goto = 7 - - if goto == 6: - w_11 = space.getitem(w_coerced_2, gi_0) - w_12 = space.getitem(w_coerced_2, gi_1) - w_13 = space.rshift(w_11, w_12) - w_9 = w_13 - goto = 7 - - if goto == 7: - return w_9 - - fastf_instance___rshift__ = __rshift__ - -##SECTION## -## filename 'lib/_classobj.py' -## function '__sub__' -## firstlineno 422 -##SECTION## - def __sub__(space, __args__): - funcname = "__sub__" - signature = ['self', 'other'], None, None - defaults_w = [] - w_self, w_other = __args__.parse(funcname, signature, defaults_w) - return fastf_instance___sub__(space, w_self, w_other) - - f_instance___sub__ = __sub__ - - def __sub__(space, w_self, w_other): - goto = 1 # startblock - while True: - - if goto == 1: - w_0 = fastf__coerce(space, w_self, w_other) - w_1 = space.is_(w_0, space.w_None) - v0 = space.is_true(w_1) - if v0 == True: - w_self_1, w_other_1, w_coerced, w_2 = w_self, w_other, w_0, w_1 - goto = 3 - else: - assert v0 == False - w_self_2, w_other_2, w_coerced_1 = w_self, w_other, w_0 - goto = 2 - - if goto == 2: - w_3 = space.getitem(w_coerced_1, gi_0) - w_4 = space.is_(w_3, w_self_2) - (w_self_1, w_other_1, w_coerced, w_2) = (w_self_2, w_other_2, - w_coerced_1, w_4) - goto = 3 - - if goto == 3: - v1 = space.is_true(w_2) - if v1 == True: - w_other_3, w_5 = w_other_1, w_self_1 - goto = 4 - else: - assert v1 == False - w_coerced_2 = w_coerced - goto = 6 - - if goto == 4: - w_6 = space.call_function(gfunc_instance_getattr1, w_5, gs___sub__, space.w_False) - v2 = space.is_true(w_6) - if v2 == True: - w_7, w_8 = w_6, w_other_3 - goto = 5 - else: - assert v2 == False - w_9 = space.w_NotImplemented - goto = 7 - - if goto == 5: - w_10 = space.call_function(w_7, w_8) - w_9 = w_10 - goto = 7 - - if goto == 6: - w_11 = space.getitem(w_coerced_2, gi_0) - w_12 = space.getitem(w_coerced_2, gi_1) - w_13 = space.sub(w_11, w_12) - w_9 = w_13 - goto = 7 - - if goto == 7: - return w_9 - - fastf_instance___sub__ = __sub__ - -##SECTION## -## filename 'lib/_classobj.py' -## function '__truediv__' -## firstlineno 422 -##SECTION## - def __truediv__(space, __args__): - funcname = "__truediv__" - signature = ['self', 'other'], None, None - defaults_w = [] - w_self, w_other = __args__.parse(funcname, signature, defaults_w) - return fastf_instance___truediv__(space, w_self, w_other) - - f_instance___truediv__ = __truediv__ - - def __truediv__(space, w_self, w_other): - goto = 1 # startblock - while True: - - if goto == 1: - w_0 = fastf__coerce(space, w_self, w_other) - w_1 = space.is_(w_0, space.w_None) - v0 = space.is_true(w_1) - if v0 == True: - w_self_1, w_other_1, w_coerced, w_2 = w_self, w_other, w_0, w_1 - goto = 3 - else: - assert v0 == False - w_self_2, w_other_2, w_coerced_1 = w_self, w_other, w_0 - goto = 2 - - if goto == 2: - w_3 = space.getitem(w_coerced_1, gi_0) - w_4 = space.is_(w_3, w_self_2) - (w_self_1, w_other_1, w_coerced, w_2) = (w_self_2, w_other_2, - w_coerced_1, w_4) - goto = 3 - - if goto == 3: - v1 = space.is_true(w_2) - if v1 == True: - w_other_3, w_5 = w_other_1, w_self_1 - goto = 4 - else: - assert v1 == False - w_coerced_2 = w_coerced - goto = 6 - - if goto == 4: - w_6 = space.call_function(gfunc_instance_getattr1, w_5, gs___truediv__, space.w_False) - v2 = space.is_true(w_6) - if v2 == True: - w_7, w_8 = w_6, w_other_3 - goto = 5 - else: - assert v2 == False - w_9 = space.w_NotImplemented - goto = 7 - - if goto == 5: - w_10 = space.call_function(w_7, w_8) - w_9 = w_10 - goto = 7 - - if goto == 6: - w_11 = space.getitem(w_coerced_2, gi_0) - w_12 = space.getitem(w_coerced_2, gi_1) - w_13 = space.truediv(w_11, w_12) - w_9 = w_13 - goto = 7 - - if goto == 7: - return w_9 - - fastf_instance___truediv__ = __truediv__ - -##SECTION## -## filename 'lib/_classobj.py' -## function '__xor__' -## firstlineno 422 -##SECTION## -# global declaration -# global object gfunc__coerce - - def __xor__(space, __args__): - funcname = "__xor__" - signature = ['self', 'other'], None, None - defaults_w = [] - w_self, w_other = __args__.parse(funcname, signature, defaults_w) - return fastf_instance___xor__(space, w_self, w_other) - - f_instance___xor__ = __xor__ - - def __xor__(space, w_self, w_other): - goto = 1 # startblock - while True: - - if goto == 1: - w_0 = fastf__coerce(space, w_self, w_other) - w_1 = space.is_(w_0, space.w_None) - v0 = space.is_true(w_1) - if v0 == True: - w_self_1, w_other_1, w_coerced, w_2 = w_self, w_other, w_0, w_1 - goto = 3 - else: - assert v0 == False - w_self_2, w_other_2, w_coerced_1 = w_self, w_other, w_0 - goto = 2 - - if goto == 2: - w_3 = space.getitem(w_coerced_1, gi_0) - w_4 = space.is_(w_3, w_self_2) - (w_self_1, w_other_1, w_coerced, w_2) = (w_self_2, w_other_2, - w_coerced_1, w_4) - goto = 3 - - if goto == 3: - v1 = space.is_true(w_2) - if v1 == True: - w_other_3, w_5 = w_other_1, w_self_1 - goto = 4 - else: - assert v1 == False - w_coerced_2 = w_coerced - goto = 6 - - if goto == 4: - w_6 = space.call_function(gfunc_instance_getattr1, w_5, gs___xor__, space.w_False) - v2 = space.is_true(w_6) - if v2 == True: - w_7, w_8 = w_6, w_other_3 - goto = 5 - else: - assert v2 == False - w_9 = space.w_NotImplemented - goto = 7 - - if goto == 5: - w_10 = space.call_function(w_7, w_8) - w_9 = w_10 - goto = 7 - - if goto == 6: - w_11 = space.getitem(w_coerced_2, gi_0) - w_12 = space.getitem(w_coerced_2, gi_1) - w_13 = space.xor(w_11, w_12) - w_9 = w_13 - goto = 7 - - if goto == 7: - return w_9 - - fastf_instance___xor__ = __xor__ - -##SECTION## -## filename 'lib/_classobj.py' -## function '__radd__' -## firstlineno 432 -##SECTION## - def __radd__(space, __args__): - funcname = "__radd__" - signature = ['self', 'other'], None, None - defaults_w = [] - w_self, w_other = __args__.parse(funcname, signature, defaults_w) - return fastf_instance___radd__(space, w_self, w_other) - - f_instance___radd__ = __radd__ - - def __radd__(space, w_self, w_other): - goto = 1 # startblock - while True: - - if goto == 1: - w_0 = fastf__coerce(space, w_self, w_other) - w_1 = space.is_(w_0, space.w_None) - v0 = space.is_true(w_1) - if v0 == True: - w_self_1, w_other_1, w_coerced, w_2 = w_self, w_other, w_0, w_1 - goto = 3 - else: - assert v0 == False - w_self_2, w_other_2, w_coerced_1 = w_self, w_other, w_0 - goto = 2 - - if goto == 2: - w_3 = space.getitem(w_coerced_1, gi_0) - w_4 = space.is_(w_3, w_self_2) - (w_self_1, w_other_1, w_coerced, w_2) = (w_self_2, w_other_2, - w_coerced_1, w_4) - goto = 3 - - if goto == 3: - v1 = space.is_true(w_2) - if v1 == True: - w_other_3, w_5 = w_other_1, w_self_1 - goto = 4 - else: - assert v1 == False - w_coerced_2 = w_coerced - goto = 6 - - if goto == 4: - w_6 = space.call_function(gfunc_instance_getattr1, w_5, gs___radd__, space.w_False) - v2 = space.is_true(w_6) - if v2 == True: - w_7, w_8 = w_6, w_other_3 - goto = 5 - else: - assert v2 == False - w_9 = space.w_NotImplemented - goto = 7 - - if goto == 5: - w_10 = space.call_function(w_7, w_8) - w_9 = w_10 - goto = 7 - - if goto == 6: - w_11 = space.getitem(w_coerced_2, gi_1) - w_12 = space.getitem(w_coerced_2, gi_0) - w_13 = space.add(w_11, w_12) - w_9 = w_13 - goto = 7 - - if goto == 7: - return w_9 - - fastf_instance___radd__ = __radd__ - -##SECTION## -## filename 'lib/_classobj.py' -## function '__rand__' -## firstlineno 432 -##SECTION## - def __rand__(space, __args__): - funcname = "__rand__" - signature = ['self', 'other'], None, None - defaults_w = [] - w_self, w_other = __args__.parse(funcname, signature, defaults_w) - return fastf_instance___rand__(space, w_self, w_other) - - f_instance___rand__ = __rand__ - - def __rand__(space, w_self, w_other): - goto = 1 # startblock - while True: - - if goto == 1: - w_0 = fastf__coerce(space, w_self, w_other) - w_1 = space.is_(w_0, space.w_None) - v0 = space.is_true(w_1) - if v0 == True: - w_self_1, w_other_1, w_coerced, w_2 = w_self, w_other, w_0, w_1 - goto = 3 - else: - assert v0 == False - w_self_2, w_other_2, w_coerced_1 = w_self, w_other, w_0 - goto = 2 - - if goto == 2: - w_3 = space.getitem(w_coerced_1, gi_0) - w_4 = space.is_(w_3, w_self_2) - (w_self_1, w_other_1, w_coerced, w_2) = (w_self_2, w_other_2, - w_coerced_1, w_4) - goto = 3 - - if goto == 3: - v1 = space.is_true(w_2) - if v1 == True: - w_other_3, w_5 = w_other_1, w_self_1 - goto = 4 - else: - assert v1 == False - w_coerced_2 = w_coerced - goto = 6 - - if goto == 4: - w_6 = space.call_function(gfunc_instance_getattr1, w_5, gs___rand__, space.w_False) - v2 = space.is_true(w_6) - if v2 == True: - w_7, w_8 = w_6, w_other_3 - goto = 5 - else: - assert v2 == False - w_9 = space.w_NotImplemented - goto = 7 - - if goto == 5: - w_10 = space.call_function(w_7, w_8) - w_9 = w_10 - goto = 7 - - if goto == 6: - w_11 = space.getitem(w_coerced_2, gi_1) - w_12 = space.getitem(w_coerced_2, gi_0) - w_13 = space.and_(w_11, w_12) - w_9 = w_13 - goto = 7 - - if goto == 7: - return w_9 - - fastf_instance___rand__ = __rand__ - -##SECTION## -## filename 'lib/_classobj.py' -## function '__rdiv__' -## firstlineno 432 -##SECTION## - def __rdiv__(space, __args__): - funcname = "__rdiv__" - signature = ['self', 'other'], None, None - defaults_w = [] - w_self, w_other = __args__.parse(funcname, signature, defaults_w) - return fastf_instance___rdiv__(space, w_self, w_other) - - f_instance___rdiv__ = __rdiv__ - - def __rdiv__(space, w_self, w_other): - goto = 1 # startblock - while True: - - if goto == 1: - w_0 = fastf__coerce(space, w_self, w_other) - w_1 = space.is_(w_0, space.w_None) - v0 = space.is_true(w_1) - if v0 == True: - w_self_1, w_other_1, w_coerced, w_2 = w_self, w_other, w_0, w_1 - goto = 3 - else: - assert v0 == False - w_self_2, w_other_2, w_coerced_1 = w_self, w_other, w_0 - goto = 2 - - if goto == 2: - w_3 = space.getitem(w_coerced_1, gi_0) - w_4 = space.is_(w_3, w_self_2) - (w_self_1, w_other_1, w_coerced, w_2) = (w_self_2, w_other_2, - w_coerced_1, w_4) - goto = 3 - - if goto == 3: - v1 = space.is_true(w_2) - if v1 == True: - w_other_3, w_5 = w_other_1, w_self_1 - goto = 4 - else: - assert v1 == False - w_coerced_2 = w_coerced - goto = 6 - - if goto == 4: - w_6 = space.call_function(gfunc_instance_getattr1, w_5, gs___rdiv__, space.w_False) - v2 = space.is_true(w_6) - if v2 == True: - w_7, w_8 = w_6, w_other_3 - goto = 5 - else: - assert v2 == False - w_9 = space.w_NotImplemented - goto = 7 - - if goto == 5: - w_10 = space.call_function(w_7, w_8) - w_9 = w_10 - goto = 7 - - if goto == 6: - w_11 = space.getitem(w_coerced_2, gi_1) - w_12 = space.getitem(w_coerced_2, gi_0) - w_13 = space.div(w_11, w_12) - w_9 = w_13 - goto = 7 - - if goto == 7: - return w_9 - - fastf_instance___rdiv__ = __rdiv__ - -##SECTION## -## filename 'lib/_classobj.py' -## function '__rdivmod__' -## firstlineno 432 -##SECTION## - def __rdivmod__(space, __args__): - funcname = "__rdivmod__" - signature = ['self', 'other'], None, None - defaults_w = [] - w_self, w_other = __args__.parse(funcname, signature, defaults_w) - return fastf_instance___rdivmod__(space, w_self, w_other) - - f_instance___rdivmod__ = __rdivmod__ - - def __rdivmod__(space, w_self, w_other): - goto = 1 # startblock - while True: - - if goto == 1: - w_0 = fastf__coerce(space, w_self, w_other) - w_1 = space.is_(w_0, space.w_None) - v0 = space.is_true(w_1) - if v0 == True: - w_self_1, w_other_1, w_coerced, w_2 = w_self, w_other, w_0, w_1 - goto = 3 - else: - assert v0 == False - w_self_2, w_other_2, w_coerced_1 = w_self, w_other, w_0 - goto = 2 - - if goto == 2: - w_3 = space.getitem(w_coerced_1, gi_0) - w_4 = space.is_(w_3, w_self_2) - (w_self_1, w_other_1, w_coerced, w_2) = (w_self_2, w_other_2, - w_coerced_1, w_4) - goto = 3 - - if goto == 3: - v1 = space.is_true(w_2) - if v1 == True: - w_other_3, w_5 = w_other_1, w_self_1 - goto = 4 - else: - assert v1 == False - w_coerced_2 = w_coerced - goto = 6 - - if goto == 4: - w_6 = space.call_function(gfunc_instance_getattr1, w_5, gs___rdivmod__, space.w_False) - v2 = space.is_true(w_6) - if v2 == True: - w_7, w_8 = w_6, w_other_3 - goto = 5 - else: - assert v2 == False - w_9 = space.w_NotImplemented - goto = 7 - - if goto == 5: - w_10 = space.call_function(w_7, w_8) - w_9 = w_10 - goto = 7 - - if goto == 6: - w_11 = space.getitem(w_coerced_2, gi_1) - w_12 = space.getitem(w_coerced_2, gi_0) - w_13 = space.divmod(w_11, w_12) - w_9 = w_13 - goto = 7 - - if goto == 7: - return w_9 - - fastf_instance___rdivmod__ = __rdivmod__ - -##SECTION## -## filename 'lib/_classobj.py' -## function '__rfloordiv__' -## firstlineno 432 -##SECTION## - def __rfloordiv__(space, __args__): - funcname = "__rfloordiv__" - signature = ['self', 'other'], None, None - defaults_w = [] - w_self, w_other = __args__.parse(funcname, signature, defaults_w) - return fastf_instance___rfloordiv__(space, w_self, w_other) - - f_instance___rfloordiv__ = __rfloordiv__ - - def __rfloordiv__(space, w_self, w_other): - goto = 1 # startblock - while True: - - if goto == 1: - w_0 = fastf__coerce(space, w_self, w_other) - w_1 = space.is_(w_0, space.w_None) - v0 = space.is_true(w_1) - if v0 == True: - w_self_1, w_other_1, w_coerced, w_2 = w_self, w_other, w_0, w_1 - goto = 3 - else: - assert v0 == False - w_self_2, w_other_2, w_coerced_1 = w_self, w_other, w_0 - goto = 2 - - if goto == 2: - w_3 = space.getitem(w_coerced_1, gi_0) - w_4 = space.is_(w_3, w_self_2) - (w_self_1, w_other_1, w_coerced, w_2) = (w_self_2, w_other_2, - w_coerced_1, w_4) - goto = 3 - - if goto == 3: - v1 = space.is_true(w_2) - if v1 == True: - w_other_3, w_5 = w_other_1, w_self_1 - goto = 4 - else: - assert v1 == False - w_coerced_2 = w_coerced - goto = 6 - - if goto == 4: - w_6 = space.call_function(gfunc_instance_getattr1, w_5, gs___rfloordiv__, space.w_False) - v2 = space.is_true(w_6) - if v2 == True: - w_7, w_8 = w_6, w_other_3 - goto = 5 - else: - assert v2 == False - w_9 = space.w_NotImplemented - goto = 7 - - if goto == 5: - w_10 = space.call_function(w_7, w_8) - w_9 = w_10 - goto = 7 - - if goto == 6: - w_11 = space.getitem(w_coerced_2, gi_1) - w_12 = space.getitem(w_coerced_2, gi_0) - w_13 = space.floordiv(w_11, w_12) - w_9 = w_13 - goto = 7 - - if goto == 7: - return w_9 - - fastf_instance___rfloordiv__ = __rfloordiv__ - -##SECTION## -## filename 'lib/_classobj.py' -## function '__rlshift__' -## firstlineno 432 -##SECTION## - def __rlshift__(space, __args__): - funcname = "__rlshift__" - signature = ['self', 'other'], None, None - defaults_w = [] - w_self, w_other = __args__.parse(funcname, signature, defaults_w) - return fastf_instance___rlshift__(space, w_self, w_other) - - f_instance___rlshift__ = __rlshift__ - - def __rlshift__(space, w_self, w_other): - goto = 1 # startblock - while True: - - if goto == 1: - w_0 = fastf__coerce(space, w_self, w_other) - w_1 = space.is_(w_0, space.w_None) - v0 = space.is_true(w_1) - if v0 == True: - w_self_1, w_other_1, w_coerced, w_2 = w_self, w_other, w_0, w_1 - goto = 3 - else: - assert v0 == False - w_self_2, w_other_2, w_coerced_1 = w_self, w_other, w_0 - goto = 2 - - if goto == 2: - w_3 = space.getitem(w_coerced_1, gi_0) - w_4 = space.is_(w_3, w_self_2) - (w_self_1, w_other_1, w_coerced, w_2) = (w_self_2, w_other_2, - w_coerced_1, w_4) - goto = 3 - - if goto == 3: - v1 = space.is_true(w_2) - if v1 == True: - w_other_3, w_5 = w_other_1, w_self_1 - goto = 4 - else: - assert v1 == False - w_coerced_2 = w_coerced - goto = 6 - - if goto == 4: - w_6 = space.call_function(gfunc_instance_getattr1, w_5, gs___rlshift__, space.w_False) - v2 = space.is_true(w_6) - if v2 == True: - w_7, w_8 = w_6, w_other_3 - goto = 5 - else: - assert v2 == False - w_9 = space.w_NotImplemented - goto = 7 - - if goto == 5: - w_10 = space.call_function(w_7, w_8) - w_9 = w_10 - goto = 7 - - if goto == 6: - w_11 = space.getitem(w_coerced_2, gi_1) - w_12 = space.getitem(w_coerced_2, gi_0) - w_13 = space.lshift(w_11, w_12) - w_9 = w_13 - goto = 7 - - if goto == 7: - return w_9 - - fastf_instance___rlshift__ = __rlshift__ - -##SECTION## -## filename 'lib/_classobj.py' -## function '__rmod__' -## firstlineno 432 -##SECTION## - def __rmod__(space, __args__): - funcname = "__rmod__" - signature = ['self', 'other'], None, None - defaults_w = [] - w_self, w_other = __args__.parse(funcname, signature, defaults_w) - return fastf_instance___rmod__(space, w_self, w_other) - - f_instance___rmod__ = __rmod__ - - def __rmod__(space, w_self, w_other): - goto = 1 # startblock - while True: - - if goto == 1: - w_0 = fastf__coerce(space, w_self, w_other) - w_1 = space.is_(w_0, space.w_None) - v0 = space.is_true(w_1) - if v0 == True: - w_self_1, w_other_1, w_coerced, w_2 = w_self, w_other, w_0, w_1 - goto = 3 - else: - assert v0 == False - w_self_2, w_other_2, w_coerced_1 = w_self, w_other, w_0 - goto = 2 - - if goto == 2: - w_3 = space.getitem(w_coerced_1, gi_0) - w_4 = space.is_(w_3, w_self_2) - (w_self_1, w_other_1, w_coerced, w_2) = (w_self_2, w_other_2, - w_coerced_1, w_4) - goto = 3 - - if goto == 3: - v1 = space.is_true(w_2) - if v1 == True: - w_other_3, w_5 = w_other_1, w_self_1 - goto = 4 - else: - assert v1 == False - w_coerced_2 = w_coerced - goto = 6 - - if goto == 4: - w_6 = space.call_function(gfunc_instance_getattr1, w_5, gs___rmod__, space.w_False) - v2 = space.is_true(w_6) - if v2 == True: - w_7, w_8 = w_6, w_other_3 - goto = 5 - else: - assert v2 == False - w_9 = space.w_NotImplemented - goto = 7 - - if goto == 5: - w_10 = space.call_function(w_7, w_8) - w_9 = w_10 - goto = 7 - - if goto == 6: - w_11 = space.getitem(w_coerced_2, gi_1) - w_12 = space.getitem(w_coerced_2, gi_0) - w_13 = space.mod(w_11, w_12) - w_9 = w_13 - goto = 7 - - if goto == 7: - return w_9 - - fastf_instance___rmod__ = __rmod__ - -##SECTION## -## filename 'lib/_classobj.py' -## function '__rmul__' -## firstlineno 432 -##SECTION## - def __rmul__(space, __args__): - funcname = "__rmul__" - signature = ['self', 'other'], None, None - defaults_w = [] - w_self, w_other = __args__.parse(funcname, signature, defaults_w) - return fastf_instance___rmul__(space, w_self, w_other) - - f_instance___rmul__ = __rmul__ - - def __rmul__(space, w_self, w_other): - goto = 1 # startblock - while True: - - if goto == 1: - w_0 = fastf__coerce(space, w_self, w_other) - w_1 = space.is_(w_0, space.w_None) - v0 = space.is_true(w_1) - if v0 == True: - w_self_1, w_other_1, w_coerced, w_2 = w_self, w_other, w_0, w_1 - goto = 3 - else: - assert v0 == False - w_self_2, w_other_2, w_coerced_1 = w_self, w_other, w_0 - goto = 2 - - if goto == 2: - w_3 = space.getitem(w_coerced_1, gi_0) - w_4 = space.is_(w_3, w_self_2) - (w_self_1, w_other_1, w_coerced, w_2) = (w_self_2, w_other_2, - w_coerced_1, w_4) - goto = 3 - - if goto == 3: - v1 = space.is_true(w_2) - if v1 == True: - w_other_3, w_5 = w_other_1, w_self_1 - goto = 4 - else: - assert v1 == False - w_coerced_2 = w_coerced - goto = 6 - - if goto == 4: - w_6 = space.call_function(gfunc_instance_getattr1, w_5, gs___rmul__, space.w_False) - v2 = space.is_true(w_6) - if v2 == True: - w_7, w_8 = w_6, w_other_3 - goto = 5 - else: - assert v2 == False - w_9 = space.w_NotImplemented - goto = 7 - - if goto == 5: - w_10 = space.call_function(w_7, w_8) - w_9 = w_10 - goto = 7 - - if goto == 6: - w_11 = space.getitem(w_coerced_2, gi_1) - w_12 = space.getitem(w_coerced_2, gi_0) - w_13 = space.mul(w_11, w_12) - w_9 = w_13 - goto = 7 - - if goto == 7: - return w_9 - - fastf_instance___rmul__ = __rmul__ - -##SECTION## -## filename 'lib/_classobj.py' -## function '__ror__' -## firstlineno 432 -##SECTION## - def __ror__(space, __args__): - funcname = "__ror__" - signature = ['self', 'other'], None, None - defaults_w = [] - w_self, w_other = __args__.parse(funcname, signature, defaults_w) - return fastf_instance___ror__(space, w_self, w_other) - - f_instance___ror__ = __ror__ - - def __ror__(space, w_self, w_other): - goto = 1 # startblock - while True: - - if goto == 1: - w_0 = fastf__coerce(space, w_self, w_other) - w_1 = space.is_(w_0, space.w_None) - v0 = space.is_true(w_1) - if v0 == True: - w_self_1, w_other_1, w_coerced, w_2 = w_self, w_other, w_0, w_1 - goto = 3 - else: - assert v0 == False - w_self_2, w_other_2, w_coerced_1 = w_self, w_other, w_0 - goto = 2 - - if goto == 2: - w_3 = space.getitem(w_coerced_1, gi_0) - w_4 = space.is_(w_3, w_self_2) - (w_self_1, w_other_1, w_coerced, w_2) = (w_self_2, w_other_2, - w_coerced_1, w_4) - goto = 3 - - if goto == 3: - v1 = space.is_true(w_2) - if v1 == True: - w_other_3, w_5 = w_other_1, w_self_1 - goto = 4 - else: - assert v1 == False - w_coerced_2 = w_coerced - goto = 6 - - if goto == 4: - w_6 = space.call_function(gfunc_instance_getattr1, w_5, gs___ror__, space.w_False) - v2 = space.is_true(w_6) - if v2 == True: - w_7, w_8 = w_6, w_other_3 - goto = 5 - else: - assert v2 == False - w_9 = space.w_NotImplemented - goto = 7 - - if goto == 5: - w_10 = space.call_function(w_7, w_8) - w_9 = w_10 - goto = 7 - - if goto == 6: - w_11 = space.getitem(w_coerced_2, gi_1) - w_12 = space.getitem(w_coerced_2, gi_0) - w_13 = space.or_(w_11, w_12) - w_9 = w_13 - goto = 7 - - if goto == 7: - return w_9 - - fastf_instance___ror__ = __ror__ - -##SECTION## -## filename 'lib/_classobj.py' -## function '__rrshift__' -## firstlineno 432 -##SECTION## - def __rrshift__(space, __args__): - funcname = "__rrshift__" - signature = ['self', 'other'], None, None - defaults_w = [] - w_self, w_other = __args__.parse(funcname, signature, defaults_w) - return fastf_instance___rrshift__(space, w_self, w_other) - - f_instance___rrshift__ = __rrshift__ - - def __rrshift__(space, w_self, w_other): - goto = 1 # startblock - while True: - - if goto == 1: - w_0 = fastf__coerce(space, w_self, w_other) - w_1 = space.is_(w_0, space.w_None) - v0 = space.is_true(w_1) - if v0 == True: - w_self_1, w_other_1, w_coerced, w_2 = w_self, w_other, w_0, w_1 - goto = 3 - else: - assert v0 == False - w_self_2, w_other_2, w_coerced_1 = w_self, w_other, w_0 - goto = 2 - - if goto == 2: - w_3 = space.getitem(w_coerced_1, gi_0) - w_4 = space.is_(w_3, w_self_2) - (w_self_1, w_other_1, w_coerced, w_2) = (w_self_2, w_other_2, - w_coerced_1, w_4) - goto = 3 - - if goto == 3: - v1 = space.is_true(w_2) - if v1 == True: - w_other_3, w_5 = w_other_1, w_self_1 - goto = 4 - else: - assert v1 == False - w_coerced_2 = w_coerced - goto = 6 - - if goto == 4: - w_6 = space.call_function(gfunc_instance_getattr1, w_5, gs___rrshift__, space.w_False) - v2 = space.is_true(w_6) - if v2 == True: - w_7, w_8 = w_6, w_other_3 - goto = 5 - else: - assert v2 == False - w_9 = space.w_NotImplemented - goto = 7 - - if goto == 5: - w_10 = space.call_function(w_7, w_8) - w_9 = w_10 - goto = 7 - - if goto == 6: - w_11 = space.getitem(w_coerced_2, gi_1) - w_12 = space.getitem(w_coerced_2, gi_0) - w_13 = space.rshift(w_11, w_12) - w_9 = w_13 - goto = 7 - - if goto == 7: - return w_9 - - fastf_instance___rrshift__ = __rrshift__ - -##SECTION## -## filename 'lib/_classobj.py' -## function '__rsub__' -## firstlineno 432 -##SECTION## - def __rsub__(space, __args__): - funcname = "__rsub__" - signature = ['self', 'other'], None, None - defaults_w = [] - w_self, w_other = __args__.parse(funcname, signature, defaults_w) - return fastf_instance___rsub__(space, w_self, w_other) - - f_instance___rsub__ = __rsub__ - - def __rsub__(space, w_self, w_other): - goto = 1 # startblock - while True: - - if goto == 1: - w_0 = fastf__coerce(space, w_self, w_other) - w_1 = space.is_(w_0, space.w_None) - v0 = space.is_true(w_1) - if v0 == True: - w_self_1, w_other_1, w_coerced, w_2 = w_self, w_other, w_0, w_1 - goto = 3 - else: - assert v0 == False - w_self_2, w_other_2, w_coerced_1 = w_self, w_other, w_0 - goto = 2 - - if goto == 2: - w_3 = space.getitem(w_coerced_1, gi_0) - w_4 = space.is_(w_3, w_self_2) - (w_self_1, w_other_1, w_coerced, w_2) = (w_self_2, w_other_2, - w_coerced_1, w_4) - goto = 3 - - if goto == 3: - v1 = space.is_true(w_2) - if v1 == True: - w_other_3, w_5 = w_other_1, w_self_1 - goto = 4 - else: - assert v1 == False - w_coerced_2 = w_coerced - goto = 6 - - if goto == 4: - w_6 = space.call_function(gfunc_instance_getattr1, w_5, gs___rsub__, space.w_False) - v2 = space.is_true(w_6) - if v2 == True: - w_7, w_8 = w_6, w_other_3 - goto = 5 - else: - assert v2 == False - w_9 = space.w_NotImplemented - goto = 7 - - if goto == 5: - w_10 = space.call_function(w_7, w_8) - w_9 = w_10 - goto = 7 - - if goto == 6: - w_11 = space.getitem(w_coerced_2, gi_1) - w_12 = space.getitem(w_coerced_2, gi_0) - w_13 = space.sub(w_11, w_12) - w_9 = w_13 - goto = 7 - - if goto == 7: - return w_9 - - fastf_instance___rsub__ = __rsub__ - -##SECTION## -## filename 'lib/_classobj.py' -## function '__rtruediv__' -## firstlineno 432 -##SECTION## - def __rtruediv__(space, __args__): - funcname = "__rtruediv__" - signature = ['self', 'other'], None, None - defaults_w = [] - w_self, w_other = __args__.parse(funcname, signature, defaults_w) - return fastf_instance___rtruediv__(space, w_self, w_other) - - f_instance___rtruediv__ = __rtruediv__ - - def __rtruediv__(space, w_self, w_other): - goto = 1 # startblock - while True: - - if goto == 1: - w_0 = fastf__coerce(space, w_self, w_other) - w_1 = space.is_(w_0, space.w_None) - v0 = space.is_true(w_1) - if v0 == True: - w_self_1, w_other_1, w_coerced, w_2 = w_self, w_other, w_0, w_1 - goto = 3 - else: - assert v0 == False - w_self_2, w_other_2, w_coerced_1 = w_self, w_other, w_0 - goto = 2 - - if goto == 2: - w_3 = space.getitem(w_coerced_1, gi_0) - w_4 = space.is_(w_3, w_self_2) - (w_self_1, w_other_1, w_coerced, w_2) = (w_self_2, w_other_2, - w_coerced_1, w_4) - goto = 3 - - if goto == 3: - v1 = space.is_true(w_2) - if v1 == True: - w_other_3, w_5 = w_other_1, w_self_1 - goto = 4 - else: - assert v1 == False - w_coerced_2 = w_coerced - goto = 6 - - if goto == 4: - w_6 = space.call_function(gfunc_instance_getattr1, w_5, gs___rtruediv__, space.w_False) - v2 = space.is_true(w_6) - if v2 == True: - w_7, w_8 = w_6, w_other_3 - goto = 5 - else: - assert v2 == False - w_9 = space.w_NotImplemented - goto = 7 - - if goto == 5: - w_10 = space.call_function(w_7, w_8) - w_9 = w_10 - goto = 7 - - if goto == 6: - w_11 = space.getitem(w_coerced_2, gi_1) - w_12 = space.getitem(w_coerced_2, gi_0) - w_13 = space.truediv(w_11, w_12) - w_9 = w_13 - goto = 7 - - if goto == 7: - return w_9 - - fastf_instance___rtruediv__ = __rtruediv__ - -##SECTION## -## filename 'lib/_classobj.py' -## function '__rxor__' -## firstlineno 432 -##SECTION## - def __rxor__(space, __args__): - funcname = "__rxor__" - signature = ['self', 'other'], None, None - defaults_w = [] - w_self, w_other = __args__.parse(funcname, signature, defaults_w) - return fastf_instance___rxor__(space, w_self, w_other) - - f_instance___rxor__ = __rxor__ - - def __rxor__(space, w_self, w_other): - goto = 1 # startblock - while True: - - if goto == 1: - w_0 = fastf__coerce(space, w_self, w_other) - w_1 = space.is_(w_0, space.w_None) - v0 = space.is_true(w_1) - if v0 == True: - w_self_1, w_other_1, w_coerced, w_2 = w_self, w_other, w_0, w_1 - goto = 3 - else: - assert v0 == False - w_self_2, w_other_2, w_coerced_1 = w_self, w_other, w_0 - goto = 2 - - if goto == 2: - w_3 = space.getitem(w_coerced_1, gi_0) - w_4 = space.is_(w_3, w_self_2) - (w_self_1, w_other_1, w_coerced, w_2) = (w_self_2, w_other_2, - w_coerced_1, w_4) - goto = 3 - - if goto == 3: - v1 = space.is_true(w_2) - if v1 == True: - w_other_3, w_5 = w_other_1, w_self_1 - goto = 4 - else: - assert v1 == False - w_coerced_2 = w_coerced - goto = 6 - - if goto == 4: - w_6 = space.call_function(gfunc_instance_getattr1, w_5, gs___rxor__, space.w_False) - v2 = space.is_true(w_6) - if v2 == True: - w_7, w_8 = w_6, w_other_3 - goto = 5 - else: - assert v2 == False - w_9 = space.w_NotImplemented - goto = 7 - - if goto == 5: - w_10 = space.call_function(w_7, w_8) - w_9 = w_10 - goto = 7 - - if goto == 6: - w_11 = space.getitem(w_coerced_2, gi_1) - w_12 = space.getitem(w_coerced_2, gi_0) - w_13 = space.xor(w_11, w_12) - w_9 = w_13 - goto = 7 - - if goto == 7: - return w_9 - - fastf_instance___rxor__ = __rxor__ - -##SECTION## -## filename 'lib/_classobj.py' -## function '__iadd__' -## firstlineno 450 -##SECTION## - def __iadd__(space, __args__): - funcname = "__iadd__" - signature = ['self', 'other'], None, None - defaults_w = [] - w_self, w_other = __args__.parse(funcname, signature, defaults_w) - return fastf_instance___iadd__(space, w_self, w_other) - - f_instance___iadd__ = __iadd__ - - def __iadd__(space, w_self, w_other): - goto = 1 # startblock - while True: - - if goto == 1: - w_0 = space.call_function(gfunc_instance_getattr1, w_self, gs___iadd__, space.w_False) - v0 = space.is_true(w_0) - if v0 == True: - w_1, w_2 = w_0, w_other - goto = 2 - else: - assert v0 == False - w_3 = space.w_NotImplemented - goto = 3 - - if goto == 2: - w_4 = space.call_function(w_1, w_2) - w_3 = w_4 - goto = 3 - - if goto == 3: - return w_3 - - fastf_instance___iadd__ = __iadd__ - -##SECTION## -## filename 'lib/_classobj.py' -## function '__iand__' -## firstlineno 450 -##SECTION## - def __iand__(space, __args__): - funcname = "__iand__" - signature = ['self', 'other'], None, None - defaults_w = [] - w_self, w_other = __args__.parse(funcname, signature, defaults_w) - return fastf_instance___iand__(space, w_self, w_other) - - f_instance___iand__ = __iand__ - - def __iand__(space, w_self, w_other): - goto = 1 # startblock - while True: - - if goto == 1: - w_0 = space.call_function(gfunc_instance_getattr1, w_self, gs___iand__, space.w_False) - v0 = space.is_true(w_0) - if v0 == True: - w_1, w_2 = w_0, w_other - goto = 2 - else: - assert v0 == False - w_3 = space.w_NotImplemented - goto = 3 - - if goto == 2: - w_4 = space.call_function(w_1, w_2) - w_3 = w_4 - goto = 3 - - if goto == 3: - return w_3 - - fastf_instance___iand__ = __iand__ - -##SECTION## -## filename 'lib/_classobj.py' -## function '__idiv__' -## firstlineno 450 -##SECTION## - def __idiv__(space, __args__): - funcname = "__idiv__" - signature = ['self', 'other'], None, None - defaults_w = [] - w_self, w_other = __args__.parse(funcname, signature, defaults_w) - return fastf_instance___idiv__(space, w_self, w_other) - - f_instance___idiv__ = __idiv__ - - def __idiv__(space, w_self, w_other): - goto = 1 # startblock - while True: - - if goto == 1: - w_0 = space.call_function(gfunc_instance_getattr1, w_self, gs___idiv__, space.w_False) - v0 = space.is_true(w_0) - if v0 == True: - w_1, w_2 = w_0, w_other - goto = 2 - else: - assert v0 == False - w_3 = space.w_NotImplemented - goto = 3 - - if goto == 2: - w_4 = space.call_function(w_1, w_2) - w_3 = w_4 - goto = 3 - - if goto == 3: - return w_3 - - fastf_instance___idiv__ = __idiv__ - -##SECTION## -## filename 'lib/_classobj.py' -## function '__ifloordiv__' -## firstlineno 450 -##SECTION## - def __ifloordiv__(space, __args__): - funcname = "__ifloordiv__" - signature = ['self', 'other'], None, None - defaults_w = [] - w_self, w_other = __args__.parse(funcname, signature, defaults_w) - return fastf_instance___ifloordiv__(space, w_self, w_other) - - f_instance___ifloordiv__ = __ifloordiv__ - - def __ifloordiv__(space, w_self, w_other): - goto = 1 # startblock - while True: - - if goto == 1: - w_0 = space.call_function(gfunc_instance_getattr1, w_self, gs___ifloordiv__, space.w_False) - v0 = space.is_true(w_0) - if v0 == True: - w_1, w_2 = w_0, w_other - goto = 2 - else: - assert v0 == False - w_3 = space.w_NotImplemented - goto = 3 - - if goto == 2: - w_4 = space.call_function(w_1, w_2) - w_3 = w_4 - goto = 3 - - if goto == 3: - return w_3 - - fastf_instance___ifloordiv__ = __ifloordiv__ - -##SECTION## -## filename 'lib/_classobj.py' -## function '__ilshift__' -## firstlineno 450 -##SECTION## - def __ilshift__(space, __args__): - funcname = "__ilshift__" - signature = ['self', 'other'], None, None - defaults_w = [] - w_self, w_other = __args__.parse(funcname, signature, defaults_w) - return fastf_instance___ilshift__(space, w_self, w_other) - - f_instance___ilshift__ = __ilshift__ - - def __ilshift__(space, w_self, w_other): - goto = 1 # startblock - while True: - - if goto == 1: - w_0 = space.call_function(gfunc_instance_getattr1, w_self, gs___ilshift__, space.w_False) - v0 = space.is_true(w_0) - if v0 == True: - w_1, w_2 = w_0, w_other - goto = 2 - else: - assert v0 == False - w_3 = space.w_NotImplemented - goto = 3 - - if goto == 2: - w_4 = space.call_function(w_1, w_2) - w_3 = w_4 - goto = 3 - - if goto == 3: - return w_3 - - fastf_instance___ilshift__ = __ilshift__ - -##SECTION## -## filename 'lib/_classobj.py' -## function '__imod__' -## firstlineno 450 -##SECTION## - def __imod__(space, __args__): - funcname = "__imod__" - signature = ['self', 'other'], None, None - defaults_w = [] - w_self, w_other = __args__.parse(funcname, signature, defaults_w) - return fastf_instance___imod__(space, w_self, w_other) - - f_instance___imod__ = __imod__ - - def __imod__(space, w_self, w_other): - goto = 1 # startblock - while True: - - if goto == 1: - w_0 = space.call_function(gfunc_instance_getattr1, w_self, gs___imod__, space.w_False) - v0 = space.is_true(w_0) - if v0 == True: - w_1, w_2 = w_0, w_other - goto = 2 - else: - assert v0 == False - w_3 = space.w_NotImplemented - goto = 3 - - if goto == 2: - w_4 = space.call_function(w_1, w_2) - w_3 = w_4 - goto = 3 - - if goto == 3: - return w_3 - - fastf_instance___imod__ = __imod__ - -##SECTION## -## filename 'lib/_classobj.py' -## function '__imul__' -## firstlineno 450 -##SECTION## - def __imul__(space, __args__): - funcname = "__imul__" - signature = ['self', 'other'], None, None - defaults_w = [] - w_self, w_other = __args__.parse(funcname, signature, defaults_w) - return fastf_instance___imul__(space, w_self, w_other) - - f_instance___imul__ = __imul__ - - def __imul__(space, w_self, w_other): - goto = 1 # startblock - while True: - - if goto == 1: - w_0 = space.call_function(gfunc_instance_getattr1, w_self, gs___imul__, space.w_False) - v0 = space.is_true(w_0) - if v0 == True: - w_1, w_2 = w_0, w_other - goto = 2 - else: - assert v0 == False - w_3 = space.w_NotImplemented - goto = 3 - - if goto == 2: - w_4 = space.call_function(w_1, w_2) - w_3 = w_4 - goto = 3 - - if goto == 3: - return w_3 - - fastf_instance___imul__ = __imul__ - -##SECTION## -## filename 'lib/_classobj.py' -## function '__ior__' -## firstlineno 450 -##SECTION## - def __ior__(space, __args__): - funcname = "__ior__" - signature = ['self', 'other'], None, None - defaults_w = [] - w_self, w_other = __args__.parse(funcname, signature, defaults_w) - return fastf_instance___ior__(space, w_self, w_other) - - f_instance___ior__ = __ior__ - - def __ior__(space, w_self, w_other): - goto = 1 # startblock - while True: - - if goto == 1: - w_0 = space.call_function(gfunc_instance_getattr1, w_self, gs___ior__, space.w_False) - v0 = space.is_true(w_0) - if v0 == True: - w_1, w_2 = w_0, w_other - goto = 2 - else: - assert v0 == False - w_3 = space.w_NotImplemented - goto = 3 - - if goto == 2: - w_4 = space.call_function(w_1, w_2) - w_3 = w_4 - goto = 3 - - if goto == 3: - return w_3 - - fastf_instance___ior__ = __ior__ - -##SECTION## -## filename 'lib/_classobj.py' -## function '__ipow__' -## firstlineno 450 -##SECTION## - def __ipow__(space, __args__): - funcname = "__ipow__" - signature = ['self', 'other'], None, None - defaults_w = [] - w_self, w_other = __args__.parse(funcname, signature, defaults_w) - return fastf_instance___ipow__(space, w_self, w_other) - - f_instance___ipow__ = __ipow__ - - def __ipow__(space, w_self, w_other): - goto = 1 # startblock - while True: - - if goto == 1: - w_0 = space.call_function(gfunc_instance_getattr1, w_self, gs___ipow__, space.w_False) - v0 = space.is_true(w_0) - if v0 == True: - w_1, w_2 = w_0, w_other - goto = 2 - else: - assert v0 == False - w_3 = space.w_NotImplemented - goto = 3 - - if goto == 2: - w_4 = space.call_function(w_1, w_2) - w_3 = w_4 - goto = 3 - - if goto == 3: - return w_3 - - fastf_instance___ipow__ = __ipow__ - -##SECTION## -## filename 'lib/_classobj.py' -## function '__irshift__' -## firstlineno 450 -##SECTION## - def __irshift__(space, __args__): - funcname = "__irshift__" - signature = ['self', 'other'], None, None - defaults_w = [] - w_self, w_other = __args__.parse(funcname, signature, defaults_w) - return fastf_instance___irshift__(space, w_self, w_other) - - f_instance___irshift__ = __irshift__ - - def __irshift__(space, w_self, w_other): - goto = 1 # startblock - while True: - - if goto == 1: - w_0 = space.call_function(gfunc_instance_getattr1, w_self, gs___irshift__, space.w_False) - v0 = space.is_true(w_0) - if v0 == True: - w_1, w_2 = w_0, w_other - goto = 2 - else: - assert v0 == False - w_3 = space.w_NotImplemented - goto = 3 - - if goto == 2: - w_4 = space.call_function(w_1, w_2) - w_3 = w_4 - goto = 3 - - if goto == 3: - return w_3 - - fastf_instance___irshift__ = __irshift__ - -##SECTION## -## filename 'lib/_classobj.py' -## function '__isub__' -## firstlineno 450 -##SECTION## - def __isub__(space, __args__): - funcname = "__isub__" - signature = ['self', 'other'], None, None - defaults_w = [] - w_self, w_other = __args__.parse(funcname, signature, defaults_w) - return fastf_instance___isub__(space, w_self, w_other) - - f_instance___isub__ = __isub__ - - def __isub__(space, w_self, w_other): - goto = 1 # startblock - while True: - - if goto == 1: - w_0 = space.call_function(gfunc_instance_getattr1, w_self, gs___isub__, space.w_False) - v0 = space.is_true(w_0) - if v0 == True: - w_1, w_2 = w_0, w_other - goto = 2 - else: - assert v0 == False - w_3 = space.w_NotImplemented - goto = 3 - - if goto == 2: - w_4 = space.call_function(w_1, w_2) - w_3 = w_4 - goto = 3 - - if goto == 3: - return w_3 - - fastf_instance___isub__ = __isub__ - -##SECTION## -## filename 'lib/_classobj.py' -## function '__itruediv__' -## firstlineno 450 -##SECTION## - def __itruediv__(space, __args__): - funcname = "__itruediv__" - signature = ['self', 'other'], None, None - defaults_w = [] - w_self, w_other = __args__.parse(funcname, signature, defaults_w) - return fastf_instance___itruediv__(space, w_self, w_other) - - f_instance___itruediv__ = __itruediv__ - - def __itruediv__(space, w_self, w_other): - goto = 1 # startblock - while True: - - if goto == 1: - w_0 = space.call_function(gfunc_instance_getattr1, w_self, gs___itruediv__, space.w_False) - v0 = space.is_true(w_0) - if v0 == True: - w_1, w_2 = w_0, w_other - goto = 2 - else: - assert v0 == False - w_3 = space.w_NotImplemented - goto = 3 - - if goto == 2: - w_4 = space.call_function(w_1, w_2) - w_3 = w_4 - goto = 3 - - if goto == 3: - return w_3 - - fastf_instance___itruediv__ = __itruediv__ - -##SECTION## -## filename 'lib/_classobj.py' -## function '__ixor__' -## firstlineno 450 -##SECTION## - def __ixor__(space, __args__): - funcname = "__ixor__" - signature = ['self', 'other'], None, None - defaults_w = [] - w_self, w_other = __args__.parse(funcname, signature, defaults_w) - return fastf_instance___ixor__(space, w_self, w_other) - - f_instance___ixor__ = __ixor__ - - def __ixor__(space, w_self, w_other): - goto = 1 # startblock - while True: - - if goto == 1: - w_0 = space.call_function(gfunc_instance_getattr1, w_self, gs___ixor__, space.w_False) - v0 = space.is_true(w_0) - if v0 == True: - w_1, w_2 = w_0, w_other - goto = 2 - else: - assert v0 == False - w_3 = space.w_NotImplemented - goto = 3 - - if goto == 2: - w_4 = space.call_function(w_1, w_2) - w_3 = w_4 - goto = 3 - - if goto == 3: - return w_3 - - fastf_instance___ixor__ = __ixor__ - -##SECTION## -## filename 'lib/_classobj.py' -## function '__pow__' -## firstlineno 459 -##SECTION## - def __pow__(space, __args__): - funcname = "__pow__" - signature = ['self', 'other', 'modulo'], None, None - defaults_w = [space.w_None] - w_self, w_other, w_modulo = __args__.parse(funcname, signature, defaults_w) - return fastf_instance___pow__(space, w_self, w_other, w_modulo) - - f_instance___pow__ = __pow__ - - def __pow__(space, w_self, w_other, w_modulo): - goto = 1 # startblock - while True: - - if goto == 1: - w_0 = space.is_(w_modulo, space.w_None) - v0 = space.is_true(w_0) - if v0 == True: - w_self_1, w_other_1 = w_self, w_other - goto = 2 - else: - assert v0 == False - w_other_2, w_modulo_1, w_1 = w_other, w_modulo, w_self - goto = 8 - - if goto == 2: - w_2 = fastf__coerce(space, w_self_1, w_other_1) - w_3 = space.is_(w_2, space.w_None) - v1 = space.is_true(w_3) - if v1 == True: - (w_self_2, w_other_3, w_coerced, w_4) = (w_self_1, w_other_1, w_2, - w_3) - goto = 4 - else: - assert v1 == False - w_self_3, w_other_4, w_coerced_1 = w_self_1, w_other_1, w_2 - goto = 3 - - if goto == 3: - w_5 = space.getitem(w_coerced_1, gi_0) - w_6 = space.is_(w_5, w_self_3) - (w_self_2, w_other_3, w_coerced, w_4) = (w_self_3, w_other_4, - w_coerced_1, w_6) - goto = 4 - - if goto == 4: - v2 = space.is_true(w_4) - if v2 == True: - w_other_5, w_7 = w_other_3, w_self_2 - goto = 5 - else: - assert v2 == False - w_coerced_2 = w_coerced - goto = 7 - - if goto == 5: - w_8 = space.call_function(gfunc_instance_getattr1, w_7, gs___pow__, space.w_False) - v3 = space.is_true(w_8) - if v3 == True: - w_9, w_10 = w_8, w_other_5 - goto = 6 - else: - assert v3 == False - w_11 = space.w_NotImplemented - goto = 10 - - if goto == 6: - w_12 = space.call_function(w_9, w_10) - w_11 = w_12 - goto = 10 - - if goto == 7: - w_13 = space.getitem(w_coerced_2, gi_0) - w_14 = space.getitem(w_coerced_2, gi_1) - w_15 = space.pow(w_13, w_14, space.w_None) - w_11 = w_15 - goto = 10 - - if goto == 8: - w_16 = space.call_function(gfunc_instance_getattr1, w_1, gs___pow__, space.w_False) - v4 = space.is_true(w_16) - if v4 == True: - w_17, w_18, w_19 = w_16, w_other_2, w_modulo_1 - goto = 9 - else: - assert v4 == False - w_11 = space.w_NotImplemented - goto = 10 - - if goto == 9: - w_20 = space.call_function(w_17, w_18, w_19) - w_11 = w_20 - goto = 10 - - if goto == 10: - return w_11 - - fastf_instance___pow__ = __pow__ - -##SECTION## -## filename 'lib/_classobj.py' -## function '__rpow__' -## firstlineno 477 -##SECTION## - def __rpow__(space, __args__): - funcname = "__rpow__" - signature = ['self', 'other', 'modulo'], None, None - defaults_w = [space.w_None] - w_self, w_other, w_modulo = __args__.parse(funcname, signature, defaults_w) - return fastf_instance___rpow__(space, w_self, w_other, w_modulo) - - f_instance___rpow__ = __rpow__ - - def __rpow__(space, w_self, w_other, w_modulo): - goto = 1 # startblock - while True: - - if goto == 1: - w_0 = space.is_(w_modulo, space.w_None) - v0 = space.is_true(w_0) - if v0 == True: - w_self_1, w_other_1 = w_self, w_other - goto = 2 - else: - assert v0 == False - w_other_2, w_modulo_1, w_1 = w_other, w_modulo, w_self - goto = 8 - - if goto == 2: - w_2 = fastf__coerce(space, w_self_1, w_other_1) - w_3 = space.is_(w_2, space.w_None) - v1 = space.is_true(w_3) - if v1 == True: - (w_self_2, w_other_3, w_coerced, w_4) = (w_self_1, w_other_1, w_2, - w_3) - goto = 4 - else: - assert v1 == False - w_self_3, w_other_4, w_coerced_1 = w_self_1, w_other_1, w_2 - goto = 3 - - if goto == 3: - w_5 = space.getitem(w_coerced_1, gi_0) - w_6 = space.is_(w_5, w_self_3) - (w_self_2, w_other_3, w_coerced, w_4) = (w_self_3, w_other_4, - w_coerced_1, w_6) - goto = 4 - - if goto == 4: - v2 = space.is_true(w_4) - if v2 == True: - w_other_5, w_7 = w_other_3, w_self_2 - goto = 5 - else: - assert v2 == False - w_coerced_2 = w_coerced - goto = 7 - - if goto == 5: - w_8 = space.call_function(gfunc_instance_getattr1, w_7, gs___rpow__, space.w_False) - v3 = space.is_true(w_8) - if v3 == True: - w_9, w_10 = w_8, w_other_5 - goto = 6 - else: - assert v3 == False - w_11 = space.w_NotImplemented - goto = 10 - - if goto == 6: - w_12 = space.call_function(w_9, w_10) - w_11 = w_12 - goto = 10 - - if goto == 7: - w_13 = space.getitem(w_coerced_2, gi_1) - w_14 = space.getitem(w_coerced_2, gi_0) - w_15 = space.pow(w_13, w_14, space.w_None) - w_11 = w_15 - goto = 10 - - if goto == 8: - w_16 = space.call_function(gfunc_instance_getattr1, w_1, gs___rpow__, space.w_False) - v4 = space.is_true(w_16) - if v4 == True: - w_17, w_18, w_19 = w_16, w_other_2, w_modulo_1 - goto = 9 - else: - assert v4 == False - w_11 = space.w_NotImplemented - goto = 10 - - if goto == 9: - w_20 = space.call_function(w_17, w_18, w_19) - w_11 = w_20 - goto = 10 - - if goto == 10: - return w_11 - - fastf_instance___rpow__ = __rpow__ - -##SECTION## -## filename 'lib/_classobj.py' -## function '__nonzero__' -## firstlineno 495 -##SECTION## -# global declarations -# global object gs___nonzero_____should_return____0 -# global object gs___nonzero_____should_return_an_i - - def __nonzero__(space, __args__): - funcname = "__nonzero__" - signature = ['self'], None, None - defaults_w = [] - w_self, = __args__.parse(funcname, signature, defaults_w) - return fastf_instance___nonzero__(space, w_self) - - f_instance___nonzero__ = __nonzero__ - - def __nonzero__(space, w_self): - goto = 1 # startblock - while True: - - if goto == 1: - w_0 = space.call_function(gfunc_instance_getattr1, w_self, gs___nonzero__, space.w_False) - v0 = space.is_true(w_0) - if v0 == True: - w_1 = w_0 - goto = 3 - else: - assert v0 == False - w_2 = w_self - goto = 2 - - if goto == 2: - w_3 = space.call_function(gfunc_instance_getattr1, w_2, gs___len__, space.w_False) - v1 = space.is_true(w_3) - if v1 == True: - w_1 = w_3 - goto = 3 - else: - assert v1 == False - w_4 = space.w_True - goto = 13 - - if goto == 3: - w_5 = space.call_function(w_1, ) - w_6 = space.isinstance(w_5, space.w_int) - v2 = space.is_true(w_6) - if v2 == True: - w_ret = w_5 - goto = 4 - else: - assert v2 == False - goto = 11 - - if goto == 4: - w_7 = space.lt(w_ret, gi_0) - v3 = space.is_true(w_7) - if v3 == True: - goto = 5 - else: - assert v3 == False - w_8 = w_ret - goto = 10 - - if goto == 5: - w_9 = space.call_function(space.w_ValueError, gs___nonzero_____should_return____0) - w_10 = space.type(w_9) - w_11 = space.issubtype(w_10, space.w_type) - v4 = space.is_true(w_11) - if v4 == True: - w_12 = w_9 - goto = 9 - else: - assert v4 == False - w_13 = w_9 - goto = 8 - - if goto == 6: - w_14 = space.type(w_15) - w_etype, w_evalue = w_14, w_15 - goto = 12 - - if goto == 7: - w_17 = space.call_function(w_16, ) - w_18 = space.type(w_17) - w_etype, w_evalue = w_18, w_17 - goto = 12 - - if goto == 8: - w_19 = space.type(w_13) - w_etype, w_evalue = w_19, w_13 - goto = 12 - - if goto == 9: - w_20 = space.call_function(w_12, ) - w_21 = space.type(w_20) - w_etype, w_evalue = w_21, w_20 - goto = 12 - - if goto == 10: - w_22 = space.gt(w_8, gi_0) - w_4 = w_22 - goto = 13 - - if goto == 11: - w_23 = space.call_function(space.w_TypeError, gs___nonzero_____should_return_an_i) - w_24 = space.type(w_23) - w_25 = space.issubtype(w_24, space.w_type) - v5 = space.is_true(w_25) - if v5 == True: - w_16 = w_23 - goto = 7 - continue - else: - assert v5 == False - w_15 = w_23 - goto = 6 - continue - - if goto == 12: - raise gOperationError(w_etype, w_evalue) - - if goto == 13: - return w_4 - - fastf_instance___nonzero__ = __nonzero__ - -##SECTION## -## filename 'lib/_classobj.py' -## function '__call__' -## firstlineno 510 -##SECTION## -# global declaration -# global object gs__s_instance_has_no___call___meth - - def __call__(space, __args__): - funcname = "__call__" - signature = ['self'], 'args', 'kwds' - defaults_w = [] - w_self, w_args, w_kwds = __args__.parse(funcname, signature, defaults_w) - return fastf_instance___call__(space, w_self, w_args, w_kwds) - - f_instance___call__ = __call__ - - def __call__(space, w_self, w_args, w_kwds): - goto = 1 # startblock - while True: - - if goto == 1: - w_0 = space.call_function(gfunc_instance_getattr1, w_self, gs___call__, space.w_False) - v0 = space.is_true(w_0) - if v0 == True: - w_1, w_2, w_3 = w_0, w_args, w_kwds - goto = 6 - else: - assert v0 == False - w_4 = w_self - goto = 2 - - if goto == 2: - w_5 = space.getattr(w_4, gs___class__) - w_6 = space.getattr(w_5, gs___name__) - w_7 = space.mod(gs__s_instance_has_no___call___meth, w_6) - w_8 = space.is_(w_7, space.w_None) - v1 = space.is_true(w_8) - if v1 == True: - goto = 3 - else: - assert v1 == False - w_9 = w_7 - goto = 4 - - if goto == 3: - w_10 = space.call_function(space.w_AttributeError, ) - w_11 = space.type(w_10) - w_etype, w_evalue = w_11, w_10 - goto = 7 - - if goto == 4: - w_12 = space.type(w_9) - w_13 = space.issubtype(w_12, space.w_AttributeError) - v2 = space.is_true(w_13) - if v2 == True: - w_etype, w_evalue = w_12, w_9 - goto = 7 - else: - assert v2 == False - w_14 = w_9 - goto = 5 - - if goto == 5: - w_15 = space.call_function(space.w_AttributeError, w_14) - w_16 = space.type(w_15) - w_etype, w_evalue = w_16, w_15 - goto = 7 - - if goto == 6: - _args = gateway.Arguments.fromshape(space, (0, (), True, True), [w_2, w_3]) - w_17 = space.call_args(w_1, _args) - w_18 = w_17 - goto = 8 - - if goto == 7: - raise gOperationError(w_etype, w_evalue) - - if goto == 8: - return w_18 - - fastf_instance___call__ = __call__ - -##SECTION## -## filename 'lib/_classobj.py' -## function '__eq__' -## firstlineno 521 -##SECTION## - def __eq__(space, __args__): - funcname = "__eq__" - signature = ['self', 'other'], None, None - defaults_w = [] - w_self, w_other = __args__.parse(funcname, signature, defaults_w) - return fastf_instance___eq__(space, w_self, w_other) - - f_instance___eq__ = __eq__ - - def __eq__(space, w_self, w_other): - goto = 1 # startblock - while True: - - if goto == 1: - try: - w_0 = space.call_function(gfunc_instance_getattr1, w_self, gs___eq__) - w_1, w_2 = w_0, w_other - goto = 2 - except gOperationError, e: - e.normalize_exception(space) - if space.is_true(space.issubtype(e.w_type, space.w_Exception)): - w_3, w_4 = e.w_type, e.w_value - goto = 3 - else:raise # unhandled case, should not happen - - if goto == 2: - try: - w_5 = space.call_function(w_1, w_2) - w_6 = w_5 - goto = 6 - except gOperationError, e: - e.normalize_exception(space) - if space.is_true(space.issubtype(e.w_type, space.w_Exception)): - w_3, w_4 = e.w_type, e.w_value - goto = 3 - else:raise # unhandled case, should not happen - - if goto == 3: - w_7 = space.is_(w_3, space.w_AttributeError) - v0 = space.is_true(w_7) - if v0 == True: - w_6 = space.w_NotImplemented - goto = 6 - else: - assert v0 == False - w_8, w_9 = w_3, w_4 - goto = 4 - - if goto == 4: - w_10 = space.issubtype(w_8, space.w_AttributeError) - v1 = space.is_true(w_10) - if v1 == True: - w_6 = space.w_NotImplemented - goto = 6 - else: - assert v1 == False - w_etype, w_evalue = w_8, w_9 - goto = 5 - - if goto == 5: - raise gOperationError(w_etype, w_evalue) - - if goto == 6: - return w_6 - - fastf_instance___eq__ = __eq__ - -##SECTION## -## filename 'lib/_classobj.py' -## function '__ge__' -## firstlineno 521 -##SECTION## - def __ge__(space, __args__): - funcname = "__ge__" - signature = ['self', 'other'], None, None - defaults_w = [] - w_self, w_other = __args__.parse(funcname, signature, defaults_w) - return fastf_instance___ge__(space, w_self, w_other) - - f_instance___ge__ = __ge__ - - def __ge__(space, w_self, w_other): - goto = 1 # startblock - while True: - - if goto == 1: - try: - w_0 = space.call_function(gfunc_instance_getattr1, w_self, gs___ge__) - w_1, w_2 = w_0, w_other - goto = 2 - except gOperationError, e: - e.normalize_exception(space) - if space.is_true(space.issubtype(e.w_type, space.w_Exception)): - w_3, w_4 = e.w_type, e.w_value - goto = 3 - else:raise # unhandled case, should not happen - - if goto == 2: - try: - w_5 = space.call_function(w_1, w_2) - w_6 = w_5 - goto = 6 - except gOperationError, e: - e.normalize_exception(space) - if space.is_true(space.issubtype(e.w_type, space.w_Exception)): - w_3, w_4 = e.w_type, e.w_value - goto = 3 - else:raise # unhandled case, should not happen - - if goto == 3: - w_7 = space.is_(w_3, space.w_AttributeError) - v0 = space.is_true(w_7) - if v0 == True: - w_6 = space.w_NotImplemented - goto = 6 - else: - assert v0 == False - w_8, w_9 = w_3, w_4 - goto = 4 - - if goto == 4: - w_10 = space.issubtype(w_8, space.w_AttributeError) - v1 = space.is_true(w_10) - if v1 == True: - w_6 = space.w_NotImplemented - goto = 6 - else: - assert v1 == False - w_etype, w_evalue = w_8, w_9 - goto = 5 - - if goto == 5: - raise gOperationError(w_etype, w_evalue) - - if goto == 6: - return w_6 - - fastf_instance___ge__ = __ge__ - -##SECTION## -## filename 'lib/_classobj.py' -## function '__gt__' -## firstlineno 521 -##SECTION## - def __gt__(space, __args__): - funcname = "__gt__" - signature = ['self', 'other'], None, None - defaults_w = [] - w_self, w_other = __args__.parse(funcname, signature, defaults_w) - return fastf_instance___gt__(space, w_self, w_other) - - f_instance___gt__ = __gt__ - - def __gt__(space, w_self, w_other): - goto = 1 # startblock - while True: - - if goto == 1: - try: - w_0 = space.call_function(gfunc_instance_getattr1, w_self, gs___gt__) - w_1, w_2 = w_0, w_other - goto = 2 - except gOperationError, e: - e.normalize_exception(space) - if space.is_true(space.issubtype(e.w_type, space.w_Exception)): - w_3, w_4 = e.w_type, e.w_value - goto = 3 - else:raise # unhandled case, should not happen - - if goto == 2: - try: - w_5 = space.call_function(w_1, w_2) - w_6 = w_5 - goto = 6 - except gOperationError, e: - e.normalize_exception(space) - if space.is_true(space.issubtype(e.w_type, space.w_Exception)): - w_3, w_4 = e.w_type, e.w_value - goto = 3 - else:raise # unhandled case, should not happen - - if goto == 3: - w_7 = space.is_(w_3, space.w_AttributeError) - v0 = space.is_true(w_7) - if v0 == True: - w_6 = space.w_NotImplemented - goto = 6 - else: - assert v0 == False - w_8, w_9 = w_3, w_4 - goto = 4 - - if goto == 4: - w_10 = space.issubtype(w_8, space.w_AttributeError) - v1 = space.is_true(w_10) - if v1 == True: - w_6 = space.w_NotImplemented - goto = 6 - else: - assert v1 == False - w_etype, w_evalue = w_8, w_9 - goto = 5 - - if goto == 5: - raise gOperationError(w_etype, w_evalue) - - if goto == 6: - return w_6 - - fastf_instance___gt__ = __gt__ - -##SECTION## -## filename 'lib/_classobj.py' -## function '__le__' -## firstlineno 521 -##SECTION## - def __le__(space, __args__): - funcname = "__le__" - signature = ['self', 'other'], None, None - defaults_w = [] - w_self, w_other = __args__.parse(funcname, signature, defaults_w) - return fastf_instance___le__(space, w_self, w_other) - - f_instance___le__ = __le__ - - def __le__(space, w_self, w_other): - goto = 1 # startblock - while True: - - if goto == 1: - try: - w_0 = space.call_function(gfunc_instance_getattr1, w_self, gs___le__) - w_1, w_2 = w_0, w_other - goto = 2 - except gOperationError, e: - e.normalize_exception(space) - if space.is_true(space.issubtype(e.w_type, space.w_Exception)): - w_3, w_4 = e.w_type, e.w_value - goto = 3 - else:raise # unhandled case, should not happen - - if goto == 2: - try: - w_5 = space.call_function(w_1, w_2) - w_6 = w_5 - goto = 6 - except gOperationError, e: - e.normalize_exception(space) - if space.is_true(space.issubtype(e.w_type, space.w_Exception)): - w_3, w_4 = e.w_type, e.w_value - goto = 3 - else:raise # unhandled case, should not happen - - if goto == 3: - w_7 = space.is_(w_3, space.w_AttributeError) - v0 = space.is_true(w_7) - if v0 == True: - w_6 = space.w_NotImplemented - goto = 6 - else: - assert v0 == False - w_8, w_9 = w_3, w_4 - goto = 4 - - if goto == 4: - w_10 = space.issubtype(w_8, space.w_AttributeError) - v1 = space.is_true(w_10) - if v1 == True: - w_6 = space.w_NotImplemented - goto = 6 - else: - assert v1 == False - w_etype, w_evalue = w_8, w_9 - goto = 5 - - if goto == 5: - raise gOperationError(w_etype, w_evalue) - - if goto == 6: - return w_6 - - fastf_instance___le__ = __le__ - -##SECTION## -## filename 'lib/_classobj.py' -## function '__lt__' -## firstlineno 521 -##SECTION## - def __lt__(space, __args__): - funcname = "__lt__" - signature = ['self', 'other'], None, None - defaults_w = [] - w_self, w_other = __args__.parse(funcname, signature, defaults_w) - return fastf_instance___lt__(space, w_self, w_other) - - f_instance___lt__ = __lt__ - - def __lt__(space, w_self, w_other): - goto = 1 # startblock - while True: - - if goto == 1: - try: - w_0 = space.call_function(gfunc_instance_getattr1, w_self, gs___lt__) - w_1, w_2 = w_0, w_other - goto = 2 - except gOperationError, e: - e.normalize_exception(space) - if space.is_true(space.issubtype(e.w_type, space.w_Exception)): - w_3, w_4 = e.w_type, e.w_value - goto = 3 - else:raise # unhandled case, should not happen - - if goto == 2: - try: - w_5 = space.call_function(w_1, w_2) - w_6 = w_5 - goto = 6 - except gOperationError, e: - e.normalize_exception(space) - if space.is_true(space.issubtype(e.w_type, space.w_Exception)): - w_3, w_4 = e.w_type, e.w_value - goto = 3 - else:raise # unhandled case, should not happen - - if goto == 3: - w_7 = space.is_(w_3, space.w_AttributeError) - v0 = space.is_true(w_7) - if v0 == True: - w_6 = space.w_NotImplemented - goto = 6 - else: - assert v0 == False - w_8, w_9 = w_3, w_4 - goto = 4 - - if goto == 4: - w_10 = space.issubtype(w_8, space.w_AttributeError) - v1 = space.is_true(w_10) - if v1 == True: - w_6 = space.w_NotImplemented - goto = 6 - else: - assert v1 == False - w_etype, w_evalue = w_8, w_9 - goto = 5 - - if goto == 5: - raise gOperationError(w_etype, w_evalue) - - if goto == 6: - return w_6 - - fastf_instance___lt__ = __lt__ - -##SECTION## -## filename 'lib/_classobj.py' -## function '__ne__' -## firstlineno 521 -##SECTION## - def __ne__(space, __args__): - funcname = "__ne__" - signature = ['self', 'other'], None, None - defaults_w = [] - w_self, w_other = __args__.parse(funcname, signature, defaults_w) - return fastf_instance___ne__(space, w_self, w_other) - - f_instance___ne__ = __ne__ - - def __ne__(space, w_self, w_other): - goto = 1 # startblock - while True: - - if goto == 1: - try: - w_0 = space.call_function(gfunc_instance_getattr1, w_self, gs___ne__) - w_1, w_2 = w_0, w_other - goto = 2 - except gOperationError, e: - e.normalize_exception(space) - if space.is_true(space.issubtype(e.w_type, space.w_Exception)): - w_3, w_4 = e.w_type, e.w_value - goto = 3 - else:raise # unhandled case, should not happen - - if goto == 2: - try: - w_5 = space.call_function(w_1, w_2) - w_6 = w_5 - goto = 6 - except gOperationError, e: - e.normalize_exception(space) - if space.is_true(space.issubtype(e.w_type, space.w_Exception)): - w_3, w_4 = e.w_type, e.w_value - goto = 3 - else:raise # unhandled case, should not happen - - if goto == 3: - w_7 = space.is_(w_3, space.w_AttributeError) - v0 = space.is_true(w_7) - if v0 == True: - w_6 = space.w_NotImplemented - goto = 6 - else: - assert v0 == False - w_8, w_9 = w_3, w_4 - goto = 4 - - if goto == 4: - w_10 = space.issubtype(w_8, space.w_AttributeError) - v1 = space.is_true(w_10) - if v1 == True: - w_6 = space.w_NotImplemented - goto = 6 - else: - assert v1 == False - w_etype, w_evalue = w_8, w_9 - goto = 5 - - if goto == 5: - raise gOperationError(w_etype, w_evalue) - - if goto == 6: - return w_6 - - fastf_instance___ne__ = __ne__ - -##SECTION## -## filename 'lib/_classobj.py' -## function '__iter__' -## firstlineno 530 -##SECTION## -# global declarations -# global object gs___iter___returned_non_iterator_o -# global object gs_iteration_over_non_sequence - - def __iter__(space, __args__): - funcname = "__iter__" - signature = ['self'], None, None - defaults_w = [] - w_self, = __args__.parse(funcname, signature, defaults_w) - return fastf_instance___iter__(space, w_self) - - f_instance___iter__ = __iter__ - - def __iter__(space, w_self): - goto = 1 # startblock - while True: - - if goto == 1: - w_0 = space.call_function(gfunc_instance_getattr1, w_self, gs___iter__, space.w_False) - v0 = space.is_true(w_0) - if v0 == True: - w_1 = w_0 - goto = 2 - else: - assert v0 == False - w_self_1 = w_self - goto = 7 - - if goto == 2: - w_2 = space.call_function(w_1, ) - w_3 = fastf_mro_lookup(space, w_2, gs_next) - v1 = space.is_true(w_3) - if v1 == True: - w_4 = w_2 - goto = 11 - else: - assert v1 == False - w_5 = w_2 - goto = 3 - - if goto == 3: - w_6 = space.type(w_5) - w_7 = space.getattr(w_6, gs___name__) - w_8 = space.mod(gs___iter___returned_non_iterator_o, w_7) - w_9 = space.is_(w_8, space.w_None) - v2 = space.is_true(w_9) - if v2 == True: - goto = 4 - else: - assert v2 == False - w_10 = w_8 - goto = 5 - - if goto == 4: - w_11 = space.call_function(space.w_TypeError, ) - w_12 = space.type(w_11) - w_etype, w_evalue = w_12, w_11 - goto = 10 - - if goto == 5: - w_13 = space.type(w_10) - w_14 = space.issubtype(w_13, space.w_TypeError) - v3 = space.is_true(w_14) - if v3 == True: - w_etype, w_evalue = w_13, w_10 - goto = 10 - else: - assert v3 == False - w_15 = w_10 - goto = 6 - - if goto == 6: - w_16 = space.call_function(space.w_TypeError, w_15) - w_17 = space.type(w_16) - w_etype, w_evalue = w_17, w_16 - goto = 10 - - if goto == 7: - w_18 = space.call_function(gfunc_instance_getattr1, w_self_1, gs___getitem__, space.w_False) - v4 = space.is_true(w_18) - if v4 == True: - w_19 = w_self_1 - goto = 9 - else: - assert v4 == False - goto = 8 - - if goto == 8: - w_20 = space.call_function(space.w_TypeError, gs_iteration_over_non_sequence) - w_21 = space.type(w_20) - w_etype, w_evalue = w_21, w_20 - goto = 10 - - if goto == 9: - w_22 = space.call_function(space.builtin.get('_seqiter'), w_19) - w_4 = w_22 - goto = 11 - - if goto == 10: - raise gOperationError(w_etype, w_evalue) - - if goto == 11: - return w_4 - - fastf_instance___iter__ = __iter__ - -##SECTION## -## filename 'lib/_classobj.py' -## function 'next' -## firstlineno 545 -##SECTION## -# global declaration -# global object gs_instance_has_no_next___method - - def next(space, __args__): - funcname = "next" - signature = ['self'], None, None - defaults_w = [] - w_self, = __args__.parse(funcname, signature, defaults_w) - return fastf_instance_next(space, w_self) - - f_instance_next = next - - def next(space, w_self): - goto = 1 # startblock - while True: - - if goto == 1: - w_0 = space.call_function(gfunc_instance_getattr1, w_self, gs_next, space.w_False) - v0 = space.is_true(w_0) - if v0 == True: - w_1 = w_0 - goto = 3 - else: - assert v0 == False - goto = 2 - - if goto == 2: - w_2 = space.call_function(space.w_TypeError, gs_instance_has_no_next___method) - w_3 = space.type(w_2) - w_etype, w_evalue = w_3, w_2 - goto = 4 - - if goto == 3: - w_4 = space.call_function(w_1, ) - w_5 = w_4 - goto = 5 - - if goto == 4: - raise gOperationError(w_etype, w_evalue) - - if goto == 5: - return w_5 - - fastf_instance_next = next - -##SECTION## -## filename 'lib/_classobj.py' -## function '__cmp__' -## firstlineno 551 -##SECTION## -# global declarations -# global object gi_minus_1 -# global object gs___cmp___must_return_int - - def __cmp__(space, __args__): - funcname = "__cmp__" - signature = ['self', 'other'], None, None - defaults_w = [] - w_self, w_other = __args__.parse(funcname, signature, defaults_w) - return fastf_instance___cmp__(space, w_self, w_other) - - f_instance___cmp__ = __cmp__ - - def __cmp__(space, w_self, w_other): - goto = 1 # startblock - while True: - - if goto == 1: - w_0 = fastf__coerce(space, w_self, w_other) - w_1 = space.is_(w_0, space.w_None) - v0 = space.is_true(w_1) - if v0 == True: - w_w, w_v = w_other, w_self - goto = 5 - else: - assert v0 == False - w_coerced = w_0 - goto = 2 - - if goto == 2: - w_2 = space.getitem(w_coerced, gi_0) - w_3 = space.getitem(w_coerced, gi_1) - w_4 = space.isinstance(w_2, gcls_instance) - v1 = space.is_true(w_4) - if v1 == True: - w_w, w_v = w_3, w_2 - goto = 5 - else: - assert v1 == False - w_w_1, w_v_1 = w_3, w_2 - goto = 3 - - if goto == 3: - w_5 = space.isinstance(w_w_1, gcls_instance) - v2 = space.is_true(w_5) - if v2 == True: - w_w, w_v = w_w_1, w_v_1 - goto = 5 - else: - assert v2 == False - w_6, w_7 = w_v_1, w_w_1 - goto = 4 - - if goto == 4: - w_8 = space.cmp(w_6, w_7) - w_9 = w_8 - goto = 18 - - if goto == 5: - w_10 = space.isinstance(w_v, gcls_instance) - v3 = space.is_true(w_10) - if v3 == True: - w_w_2, w_v_2 = w_w, w_v - goto = 6 - else: - assert v3 == False - w_w_3, w_v_3 = w_w, w_v - goto = 11 - - if goto == 6: - w_11 = space.call_function(gfunc_instance_getattr1, w_v_2, gs___cmp__, space.w_False) - v4 = space.is_true(w_11) - if v4 == True: - w_12, w_13 = w_11, w_w_2 - goto = 7 - else: - assert v4 == False - w_w_3, w_v_3 = w_w_2, w_v_2 - goto = 11 - - if goto == 7: - w_14 = space.call_function(w_12, w_13) - w_15 = space.isinstance(w_14, space.w_int) - v5 = space.is_true(w_15) - if v5 == True: - w_res = w_14 - goto = 8 - else: - assert v5 == False - goto = 10 - - if goto == 8: - w_16 = space.gt(w_res, gi_0) - v6 = space.is_true(w_16) - if v6 == True: - w_9 = gi_1 - goto = 18 - else: - assert v6 == False - w_17 = w_res - goto = 9 - - if goto == 9: - w_18 = space.lt(w_17, gi_0) - v7 = space.is_true(w_18) - if v7 == True: - w_9 = gi_minus_1 - goto = 18 - else: - assert v7 == False - w_9 = gi_0 - goto = 18 - - if goto == 10: - w_19 = space.call_function(space.w_TypeError, gs___cmp___must_return_int) - w_20 = space.type(w_19) - w_etype, w_evalue = w_20, w_19 - goto = 17 - - if goto == 11: - w_21 = space.isinstance(w_w_3, gcls_instance) - v8 = space.is_true(w_21) - if v8 == True: - w_v_4, w_22 = w_v_3, w_w_3 - goto = 12 - else: - assert v8 == False - w_9 = space.w_NotImplemented - goto = 18 - - if goto == 12: - w_23 = space.call_function(gfunc_instance_getattr1, w_22, gs___cmp__, space.w_False) - v9 = space.is_true(w_23) - if v9 == True: - w_24, w_25 = w_23, w_v_4 - goto = 13 - else: - assert v9 == False - w_9 = space.w_NotImplemented - goto = 18 - - if goto == 13: - w_26 = space.call_function(w_24, w_25) - w_27 = space.isinstance(w_26, space.w_int) - v10 = space.is_true(w_27) - if v10 == True: - w_res_1 = w_26 - goto = 14 - else: - assert v10 == False - goto = 16 - - if goto == 14: - w_28 = space.gt(w_res_1, gi_0) - v11 = space.is_true(w_28) - if v11 == True: - w_9 = gi_1 - goto = 18 - else: - assert v11 == False - w_29 = w_res_1 - goto = 15 - - if goto == 15: - w_30 = space.lt(w_29, gi_0) - v12 = space.is_true(w_30) - if v12 == True: - w_9 = gi_minus_1 - goto = 18 - else: - assert v12 == False - w_9 = gi_0 - goto = 18 - - if goto == 16: - w_31 = space.call_function(space.w_TypeError, gs___cmp___must_return_int) - w_32 = space.type(w_31) - w_etype, w_evalue = w_32, w_31 - goto = 17 - - if goto == 17: - raise gOperationError(w_etype, w_evalue) - - if goto == 18: - return w_9 - - fastf_instance___cmp__ = __cmp__ - -##SECTION## -## filename 'lib/_classobj.py' -## function 'purify' -## firstlineno 589 -##SECTION## -# global declarations -# global object g3tuple -# global object gcls_classobj -# global object gs___module__ -# global object gs__classobj -# global object gs___new__ -# global object gsm___new__ -# global object gfunc___new__ -# global object gs___slots__ -# global object g3tuple_1 -# global object gs__name -# global object gs__bases -# global object gs___dict__ -# global object gs_classobj -# global object gcls_instance -# global object gsm___new___1 -# global object gfunc___new___1 -# global object g2tuple -# global object gs__class -# global object gs_instance -# global object gfunc_purify - - def purify(space, __args__): - funcname = "purify" - signature = [], None, None - defaults_w = [] - __args__.parse(funcname, signature, defaults_w) - return fastf_purify(space) - - f_purify = purify - - def purify(space): - goto = 1 # startblock - while True: - - if goto == 1: - w_0 = space.delattr(gcls_classobj, gs__name) - w_1 = space.delattr(gcls_classobj, gs__bases) - w_2 = space.delattr(gcls_classobj, gs___slots__) - w_3 = space.delattr(gcls_instance, gs__class) - w_4 = space.delattr(gcls_instance, gs___slots__) - w_5 = space.w_None - goto = 2 - - if goto == 2: - return w_5 - - fastf_purify = purify - -# global declarations -# global object gs___abs__ -# global object gfunc_instance___abs__ -# global object gs___add__ -# global object gfunc_instance___add__ -# global object gs___and__ -# global object gfunc_instance___and__ -# global object gs___call__ -# global object gfunc_instance___call__ -# global object gs___cmp__ -# global object gfunc_instance___cmp__ -# global object gs___coerce__ -# global object gfunc_instance___coerce__ -# global object gs___contains__ -# global object gfunc_instance___contains__ -# global object gs___del__ -# global object gfunc_instance___del__ -# global object gs___delattr__ -# global object gfunc_instance___delattr__ -# global object gs___delitem__ -# global object gfunc_instance___delitem__ -# global object gs___delslice__ -# global object gfunc_instance___delslice__ -# global object gs___div__ -# global object gfunc_instance___div__ -# global object gs___divmod__ -# global object gfunc_instance___divmod__ -# global object gs___eq__ -# global object gfunc_instance___eq__ -# global object gs___float__ -# global object gfunc_instance___float__ -# global object gs___floordiv__ -# global object gfunc_instance___floordiv__ -# global object gs___ge__ -# global object gfunc_instance___ge__ -# global object gs___getattribute__ -# global object gfunc_instance___getattribute__ -# global object gs___getitem__ -# global object gfunc_instance___getitem__ -# global object gs___getslice__ -# global object gfunc_instance___getslice__ -# global object gs___gt__ -# global object gfunc_instance___gt__ -# global object gs___hash__ -# global object gfunc_instance___hash__ -# global object gs___hex__ -# global object gfunc_instance___hex__ -# global object gs___iadd__ -# global object gfunc_instance___iadd__ -# global object gs___iand__ -# global object gfunc_instance___iand__ -# global object gs___idiv__ -# global object gfunc_instance___idiv__ -# global object gs___ifloordiv__ -# global object gfunc_instance___ifloordiv__ -# global object gs___ilshift__ -# global object gfunc_instance___ilshift__ -# global object gs___imod__ -# global object gfunc_instance___imod__ -# global object gs___imul__ -# global object gfunc_instance___imul__ -# global object gs___int__ -# global object gfunc_instance___int__ -# global object gs___invert__ -# global object gfunc_instance___invert__ -# global object gs___ior__ -# global object gfunc_instance___ior__ -# global object gs___ipow__ -# global object gfunc_instance___ipow__ -# global object gs___irshift__ -# global object gfunc_instance___irshift__ -# global object gs___isub__ -# global object gfunc_instance___isub__ -# global object gs___iter__ -# global object gfunc_instance___iter__ -# global object gs___itruediv__ -# global object gfunc_instance___itruediv__ -# global object gs___ixor__ -# global object gfunc_instance___ixor__ -# global object gs___le__ -# global object gfunc_instance___le__ -# global object gs___len__ -# global object gfunc_instance___len__ -# global object gs___long__ -# global object gfunc_instance___long__ -# global object gs___lshift__ -# global object gfunc_instance___lshift__ -# global object gs___lt__ -# global object gfunc_instance___lt__ -# global object gs___mod__ -# global object gfunc_instance___mod__ -# global object gs___mul__ -# global object gfunc_instance___mul__ -# global object gs___ne__ -# global object gfunc_instance___ne__ -# global object gs___neg__ -# global object gfunc_instance___neg__ -# global object gs___nonzero__ -# global object gfunc_instance___nonzero__ -# global object gs___oct__ -# global object gfunc_instance___oct__ -# global object gs___or__ -# global object gfunc_instance___or__ -# global object gs___pos__ -# global object gfunc_instance___pos__ -# global object gs___pow__ -# global object gfunc_instance___pow__ -# global object gs___radd__ -# global object gfunc_instance___radd__ -# global object gs___rand__ -# global object gfunc_instance___rand__ -# global object gs___rdiv__ -# global object gfunc_instance___rdiv__ -# global object gs___rdivmod__ -# global object gfunc_instance___rdivmod__ -# global object gs___repr__ -# global object gfunc_instance___repr__ -# global object gs___rfloordiv__ -# global object gfunc_instance___rfloordiv__ -# global object gs___rlshift__ -# global object gfunc_instance___rlshift__ -# global object gs___rmod__ -# global object gfunc_instance___rmod__ -# global object gs___rmul__ -# global object gfunc_instance___rmul__ -# global object gs___ror__ -# global object gfunc_instance___ror__ -# global object gs___rpow__ -# global object gfunc_instance___rpow__ -# global object gs___rrshift__ -# global object gfunc_instance___rrshift__ -# global object gs___rshift__ -# global object gfunc_instance___rshift__ -# global object gs___rsub__ -# global object gfunc_instance___rsub__ -# global object gs___rtruediv__ -# global object gfunc_instance___rtruediv__ -# global object gs___rxor__ -# global object gfunc_instance___rxor__ -# global object gs___setattr__ -# global object gfunc_instance___setattr__ -# global object gs___setitem__ -# global object gfunc_instance___setitem__ -# global object gs___setslice__ -# global object gfunc_instance___setslice__ -# global object gs___str__ -# global object gfunc_instance___str__ -# global object gs___sub__ -# global object gfunc_instance___sub__ -# global object gs___truediv__ -# global object gfunc_instance___truediv__ -# global object gs___xor__ -# global object gfunc_instance___xor__ -# global object gs_next -# global object gfunc_instance_next -# global object gfunc_classobj___call__ -# global object gfunc_classobj___delattr__ -# global object gfunc_classobj___getattribute__ -# global object gfunc_classobj___repr__ -# global object gfunc_classobj___setattr__ -# global object gfunc_classobj___str__ - -##SECTION## - _dic = space.newdict([]) - gs___module__ = space.wrap('__module__') - gs__classobj = space.wrap('_classobj') - space.setitem(_dic, gs___module__, gs__classobj) - gs___new__ = space.wrap('__new__') - from pypy.interpreter import gateway - gfunc___new__ = space.wrap(gateway.interp2app(f___new__, unwrap_spec=[gateway.ObjSpace, gateway.Arguments])) - gsm___new__ = space.wrap(gfunc___new__) - space.setitem(_dic, gs___new__, gsm___new__) - gs___slots__ = space.wrap('__slots__') - gs__name = space.wrap('_name') - gs__bases = space.wrap('_bases') - gs___dict__ = space.wrap('__dict__') - g3tuple_1 = space.newtuple([gs__name, gs__bases, gs___dict__]) - space.setitem(_dic, gs___slots__, g3tuple_1) - gs_classobj = space.wrap('classobj') - _bases = space.newtuple([space.w_object]) - _args = space.newtuple([gs_classobj, _bases, _dic]) - gcls_classobj = space.call(space.w_type, _args) - _dic = space.newdict([]) - space.setitem(_dic, gs___module__, gs__classobj) - gfunc___new___1 = space.wrap(gateway.interp2app(f___new___1, unwrap_spec=[gateway.ObjSpace, gateway.Arguments])) - gsm___new___1 = space.wrap(gfunc___new___1) - space.setitem(_dic, gs___new__, gsm___new___1) - gs__class = space.wrap('_class') - g2tuple = space.newtuple([gs__class, gs___dict__]) - space.setitem(_dic, gs___slots__, g2tuple) - gs_instance = space.wrap('instance') - _bases = space.newtuple([space.w_object]) - _args = space.newtuple([gs_instance, _bases, _dic]) - gcls_instance = space.call(space.w_type, _args) - gfunc_purify = space.wrap(gateway.interp2app(f_purify, unwrap_spec=[gateway.ObjSpace, gateway.Arguments])) - g3tuple = space.newtuple([gcls_classobj, gcls_instance, gfunc_purify]) - gs___abs__ = space.wrap('__abs__') - gfunc_instance___abs__ = space.wrap(gateway.interp2app(f_instance___abs__, unwrap_spec=[gateway.ObjSpace, gateway.Arguments])) - space.setattr(gcls_instance, gs___abs__, gfunc_instance___abs__) - gs___add__ = space.wrap('__add__') - gfunc_instance___add__ = space.wrap(gateway.interp2app(f_instance___add__, unwrap_spec=[gateway.ObjSpace, gateway.Arguments])) - space.setattr(gcls_instance, gs___add__, gfunc_instance___add__) - gs___and__ = space.wrap('__and__') - gfunc_instance___and__ = space.wrap(gateway.interp2app(f_instance___and__, unwrap_spec=[gateway.ObjSpace, gateway.Arguments])) - space.setattr(gcls_instance, gs___and__, gfunc_instance___and__) - gs___call__ = space.wrap('__call__') - gfunc_instance___call__ = space.wrap(gateway.interp2app(f_instance___call__, unwrap_spec=[gateway.ObjSpace, gateway.Arguments])) - space.setattr(gcls_instance, gs___call__, gfunc_instance___call__) - gs___cmp__ = space.wrap('__cmp__') - gfunc_instance___cmp__ = space.wrap(gateway.interp2app(f_instance___cmp__, unwrap_spec=[gateway.ObjSpace, gateway.Arguments])) - space.setattr(gcls_instance, gs___cmp__, gfunc_instance___cmp__) - gs___coerce__ = space.wrap('__coerce__') - gfunc_instance___coerce__ = space.wrap(gateway.interp2app(f_instance___coerce__, unwrap_spec=[gateway.ObjSpace, gateway.Arguments])) - space.setattr(gcls_instance, gs___coerce__, gfunc_instance___coerce__) - gs___contains__ = space.wrap('__contains__') - gfunc_instance___contains__ = space.wrap(gateway.interp2app(f_instance___contains__, unwrap_spec=[gateway.ObjSpace, gateway.Arguments])) - space.setattr(gcls_instance, gs___contains__, gfunc_instance___contains__) - gs___del__ = space.wrap('__del__') - gfunc_instance___del__ = space.wrap(gateway.interp2app(f_instance___del__, unwrap_spec=[gateway.ObjSpace, gateway.Arguments])) - space.setattr(gcls_instance, gs___del__, gfunc_instance___del__) - gs___delattr__ = space.wrap('__delattr__') - gfunc_instance___delattr__ = space.wrap(gateway.interp2app(f_instance___delattr__, unwrap_spec=[gateway.ObjSpace, gateway.Arguments])) - space.setattr(gcls_instance, gs___delattr__, gfunc_instance___delattr__) - gs___delitem__ = space.wrap('__delitem__') - gfunc_instance___delitem__ = space.wrap(gateway.interp2app(f_instance___delitem__, unwrap_spec=[gateway.ObjSpace, gateway.Arguments])) - space.setattr(gcls_instance, gs___delitem__, gfunc_instance___delitem__) - gs___delslice__ = space.wrap('__delslice__') - gfunc_instance___delslice__ = space.wrap(gateway.interp2app(f_instance___delslice__, unwrap_spec=[gateway.ObjSpace, gateway.Arguments])) - space.setattr(gcls_instance, gs___delslice__, gfunc_instance___delslice__) - gs___div__ = space.wrap('__div__') - gfunc_instance___div__ = space.wrap(gateway.interp2app(f_instance___div__, unwrap_spec=[gateway.ObjSpace, gateway.Arguments])) - space.setattr(gcls_instance, gs___div__, gfunc_instance___div__) - gs___divmod__ = space.wrap('__divmod__') - gfunc_instance___divmod__ = space.wrap(gateway.interp2app(f_instance___divmod__, unwrap_spec=[gateway.ObjSpace, gateway.Arguments])) - space.setattr(gcls_instance, gs___divmod__, gfunc_instance___divmod__) - gs___eq__ = space.wrap('__eq__') - gfunc_instance___eq__ = space.wrap(gateway.interp2app(f_instance___eq__, unwrap_spec=[gateway.ObjSpace, gateway.Arguments])) - space.setattr(gcls_instance, gs___eq__, gfunc_instance___eq__) - gs___float__ = space.wrap('__float__') - gfunc_instance___float__ = space.wrap(gateway.interp2app(f_instance___float__, unwrap_spec=[gateway.ObjSpace, gateway.Arguments])) - space.setattr(gcls_instance, gs___float__, gfunc_instance___float__) - gs___floordiv__ = space.wrap('__floordiv__') - gfunc_instance___floordiv__ = space.wrap(gateway.interp2app(f_instance___floordiv__, unwrap_spec=[gateway.ObjSpace, gateway.Arguments])) - space.setattr(gcls_instance, gs___floordiv__, gfunc_instance___floordiv__) - gs___ge__ = space.wrap('__ge__') - gfunc_instance___ge__ = space.wrap(gateway.interp2app(f_instance___ge__, unwrap_spec=[gateway.ObjSpace, gateway.Arguments])) - space.setattr(gcls_instance, gs___ge__, gfunc_instance___ge__) - gs___getattribute__ = space.wrap('__getattribute__') - gfunc_instance___getattribute__ = space.wrap(gateway.interp2app(f_instance___getattribute__, unwrap_spec=[gateway.ObjSpace, gateway.Arguments])) - space.setattr(gcls_instance, gs___getattribute__, gfunc_instance___getattribute__) - gs___getitem__ = space.wrap('__getitem__') - gfunc_instance___getitem__ = space.wrap(gateway.interp2app(f_instance___getitem__, unwrap_spec=[gateway.ObjSpace, gateway.Arguments])) - space.setattr(gcls_instance, gs___getitem__, gfunc_instance___getitem__) - gs___getslice__ = space.wrap('__getslice__') - gfunc_instance___getslice__ = space.wrap(gateway.interp2app(f_instance___getslice__, unwrap_spec=[gateway.ObjSpace, gateway.Arguments])) - space.setattr(gcls_instance, gs___getslice__, gfunc_instance___getslice__) - gs___gt__ = space.wrap('__gt__') - gfunc_instance___gt__ = space.wrap(gateway.interp2app(f_instance___gt__, unwrap_spec=[gateway.ObjSpace, gateway.Arguments])) - space.setattr(gcls_instance, gs___gt__, gfunc_instance___gt__) - gs___hash__ = space.wrap('__hash__') - gfunc_instance___hash__ = space.wrap(gateway.interp2app(f_instance___hash__, unwrap_spec=[gateway.ObjSpace, gateway.Arguments])) - space.setattr(gcls_instance, gs___hash__, gfunc_instance___hash__) - gs___hex__ = space.wrap('__hex__') - gfunc_instance___hex__ = space.wrap(gateway.interp2app(f_instance___hex__, unwrap_spec=[gateway.ObjSpace, gateway.Arguments])) - space.setattr(gcls_instance, gs___hex__, gfunc_instance___hex__) - gs___iadd__ = space.wrap('__iadd__') - gfunc_instance___iadd__ = space.wrap(gateway.interp2app(f_instance___iadd__, unwrap_spec=[gateway.ObjSpace, gateway.Arguments])) - space.setattr(gcls_instance, gs___iadd__, gfunc_instance___iadd__) - gs___iand__ = space.wrap('__iand__') - gfunc_instance___iand__ = space.wrap(gateway.interp2app(f_instance___iand__, unwrap_spec=[gateway.ObjSpace, gateway.Arguments])) - space.setattr(gcls_instance, gs___iand__, gfunc_instance___iand__) - gs___idiv__ = space.wrap('__idiv__') - gfunc_instance___idiv__ = space.wrap(gateway.interp2app(f_instance___idiv__, unwrap_spec=[gateway.ObjSpace, gateway.Arguments])) - space.setattr(gcls_instance, gs___idiv__, gfunc_instance___idiv__) - gs___ifloordiv__ = space.wrap('__ifloordiv__') - gfunc_instance___ifloordiv__ = space.wrap(gateway.interp2app(f_instance___ifloordiv__, unwrap_spec=[gateway.ObjSpace, gateway.Arguments])) - space.setattr(gcls_instance, gs___ifloordiv__, gfunc_instance___ifloordiv__) - gs___ilshift__ = space.wrap('__ilshift__') - gfunc_instance___ilshift__ = space.wrap(gateway.interp2app(f_instance___ilshift__, unwrap_spec=[gateway.ObjSpace, gateway.Arguments])) - space.setattr(gcls_instance, gs___ilshift__, gfunc_instance___ilshift__) - gs___imod__ = space.wrap('__imod__') - gfunc_instance___imod__ = space.wrap(gateway.interp2app(f_instance___imod__, unwrap_spec=[gateway.ObjSpace, gateway.Arguments])) - space.setattr(gcls_instance, gs___imod__, gfunc_instance___imod__) - gs___imul__ = space.wrap('__imul__') - gfunc_instance___imul__ = space.wrap(gateway.interp2app(f_instance___imul__, unwrap_spec=[gateway.ObjSpace, gateway.Arguments])) - space.setattr(gcls_instance, gs___imul__, gfunc_instance___imul__) - gs___int__ = space.wrap('__int__') - gfunc_instance___int__ = space.wrap(gateway.interp2app(f_instance___int__, unwrap_spec=[gateway.ObjSpace, gateway.Arguments])) - space.setattr(gcls_instance, gs___int__, gfunc_instance___int__) - gs___invert__ = space.wrap('__invert__') - gfunc_instance___invert__ = space.wrap(gateway.interp2app(f_instance___invert__, unwrap_spec=[gateway.ObjSpace, gateway.Arguments])) - space.setattr(gcls_instance, gs___invert__, gfunc_instance___invert__) - gs___ior__ = space.wrap('__ior__') - gfunc_instance___ior__ = space.wrap(gateway.interp2app(f_instance___ior__, unwrap_spec=[gateway.ObjSpace, gateway.Arguments])) - space.setattr(gcls_instance, gs___ior__, gfunc_instance___ior__) - gs___ipow__ = space.wrap('__ipow__') - gfunc_instance___ipow__ = space.wrap(gateway.interp2app(f_instance___ipow__, unwrap_spec=[gateway.ObjSpace, gateway.Arguments])) - space.setattr(gcls_instance, gs___ipow__, gfunc_instance___ipow__) - gs___irshift__ = space.wrap('__irshift__') - gfunc_instance___irshift__ = space.wrap(gateway.interp2app(f_instance___irshift__, unwrap_spec=[gateway.ObjSpace, gateway.Arguments])) - space.setattr(gcls_instance, gs___irshift__, gfunc_instance___irshift__) - gs___isub__ = space.wrap('__isub__') - gfunc_instance___isub__ = space.wrap(gateway.interp2app(f_instance___isub__, unwrap_spec=[gateway.ObjSpace, gateway.Arguments])) - space.setattr(gcls_instance, gs___isub__, gfunc_instance___isub__) - gs___iter__ = space.wrap('__iter__') - gfunc_instance___iter__ = space.wrap(gateway.interp2app(f_instance___iter__, unwrap_spec=[gateway.ObjSpace, gateway.Arguments])) - space.setattr(gcls_instance, gs___iter__, gfunc_instance___iter__) - gs___itruediv__ = space.wrap('__itruediv__') - gfunc_instance___itruediv__ = space.wrap(gateway.interp2app(f_instance___itruediv__, unwrap_spec=[gateway.ObjSpace, gateway.Arguments])) - space.setattr(gcls_instance, gs___itruediv__, gfunc_instance___itruediv__) - gs___ixor__ = space.wrap('__ixor__') - gfunc_instance___ixor__ = space.wrap(gateway.interp2app(f_instance___ixor__, unwrap_spec=[gateway.ObjSpace, gateway.Arguments])) - space.setattr(gcls_instance, gs___ixor__, gfunc_instance___ixor__) - gs___le__ = space.wrap('__le__') - gfunc_instance___le__ = space.wrap(gateway.interp2app(f_instance___le__, unwrap_spec=[gateway.ObjSpace, gateway.Arguments])) - space.setattr(gcls_instance, gs___le__, gfunc_instance___le__) - gs___len__ = space.wrap('__len__') - gfunc_instance___len__ = space.wrap(gateway.interp2app(f_instance___len__, unwrap_spec=[gateway.ObjSpace, gateway.Arguments])) - space.setattr(gcls_instance, gs___len__, gfunc_instance___len__) - gs___long__ = space.wrap('__long__') - gfunc_instance___long__ = space.wrap(gateway.interp2app(f_instance___long__, unwrap_spec=[gateway.ObjSpace, gateway.Arguments])) - space.setattr(gcls_instance, gs___long__, gfunc_instance___long__) - gs___lshift__ = space.wrap('__lshift__') - gfunc_instance___lshift__ = space.wrap(gateway.interp2app(f_instance___lshift__, unwrap_spec=[gateway.ObjSpace, gateway.Arguments])) - space.setattr(gcls_instance, gs___lshift__, gfunc_instance___lshift__) - gs___lt__ = space.wrap('__lt__') - gfunc_instance___lt__ = space.wrap(gateway.interp2app(f_instance___lt__, unwrap_spec=[gateway.ObjSpace, gateway.Arguments])) - space.setattr(gcls_instance, gs___lt__, gfunc_instance___lt__) - gs___mod__ = space.wrap('__mod__') - gfunc_instance___mod__ = space.wrap(gateway.interp2app(f_instance___mod__, unwrap_spec=[gateway.ObjSpace, gateway.Arguments])) - space.setattr(gcls_instance, gs___mod__, gfunc_instance___mod__) - gs___mul__ = space.wrap('__mul__') - gfunc_instance___mul__ = space.wrap(gateway.interp2app(f_instance___mul__, unwrap_spec=[gateway.ObjSpace, gateway.Arguments])) - space.setattr(gcls_instance, gs___mul__, gfunc_instance___mul__) - gs___ne__ = space.wrap('__ne__') - gfunc_instance___ne__ = space.wrap(gateway.interp2app(f_instance___ne__, unwrap_spec=[gateway.ObjSpace, gateway.Arguments])) - space.setattr(gcls_instance, gs___ne__, gfunc_instance___ne__) - gs___neg__ = space.wrap('__neg__') - gfunc_instance___neg__ = space.wrap(gateway.interp2app(f_instance___neg__, unwrap_spec=[gateway.ObjSpace, gateway.Arguments])) - space.setattr(gcls_instance, gs___neg__, gfunc_instance___neg__) - gs___nonzero__ = space.wrap('__nonzero__') - gfunc_instance___nonzero__ = space.wrap(gateway.interp2app(f_instance___nonzero__, unwrap_spec=[gateway.ObjSpace, gateway.Arguments])) - space.setattr(gcls_instance, gs___nonzero__, gfunc_instance___nonzero__) - gs___oct__ = space.wrap('__oct__') - gfunc_instance___oct__ = space.wrap(gateway.interp2app(f_instance___oct__, unwrap_spec=[gateway.ObjSpace, gateway.Arguments])) - space.setattr(gcls_instance, gs___oct__, gfunc_instance___oct__) - gs___or__ = space.wrap('__or__') - gfunc_instance___or__ = space.wrap(gateway.interp2app(f_instance___or__, unwrap_spec=[gateway.ObjSpace, gateway.Arguments])) - space.setattr(gcls_instance, gs___or__, gfunc_instance___or__) - gs___pos__ = space.wrap('__pos__') - gfunc_instance___pos__ = space.wrap(gateway.interp2app(f_instance___pos__, unwrap_spec=[gateway.ObjSpace, gateway.Arguments])) - space.setattr(gcls_instance, gs___pos__, gfunc_instance___pos__) - gs___pow__ = space.wrap('__pow__') - gfunc_instance___pow__ = space.wrap(gateway.interp2app(f_instance___pow__, unwrap_spec=[gateway.ObjSpace, gateway.Arguments])) - space.setattr(gcls_instance, gs___pow__, gfunc_instance___pow__) - gs___radd__ = space.wrap('__radd__') - gfunc_instance___radd__ = space.wrap(gateway.interp2app(f_instance___radd__, unwrap_spec=[gateway.ObjSpace, gateway.Arguments])) - space.setattr(gcls_instance, gs___radd__, gfunc_instance___radd__) - gs___rand__ = space.wrap('__rand__') - gfunc_instance___rand__ = space.wrap(gateway.interp2app(f_instance___rand__, unwrap_spec=[gateway.ObjSpace, gateway.Arguments])) - space.setattr(gcls_instance, gs___rand__, gfunc_instance___rand__) - gs___rdiv__ = space.wrap('__rdiv__') - gfunc_instance___rdiv__ = space.wrap(gateway.interp2app(f_instance___rdiv__, unwrap_spec=[gateway.ObjSpace, gateway.Arguments])) - space.setattr(gcls_instance, gs___rdiv__, gfunc_instance___rdiv__) - gs___rdivmod__ = space.wrap('__rdivmod__') - gfunc_instance___rdivmod__ = space.wrap(gateway.interp2app(f_instance___rdivmod__, unwrap_spec=[gateway.ObjSpace, gateway.Arguments])) - space.setattr(gcls_instance, gs___rdivmod__, gfunc_instance___rdivmod__) - gs___repr__ = space.wrap('__repr__') - gfunc_instance___repr__ = space.wrap(gateway.interp2app(f_instance___repr__, unwrap_spec=[gateway.ObjSpace, gateway.Arguments])) - space.setattr(gcls_instance, gs___repr__, gfunc_instance___repr__) - gs___rfloordiv__ = space.wrap('__rfloordiv__') - gfunc_instance___rfloordiv__ = space.wrap(gateway.interp2app(f_instance___rfloordiv__, unwrap_spec=[gateway.ObjSpace, gateway.Arguments])) - space.setattr(gcls_instance, gs___rfloordiv__, gfunc_instance___rfloordiv__) - gs___rlshift__ = space.wrap('__rlshift__') - gfunc_instance___rlshift__ = space.wrap(gateway.interp2app(f_instance___rlshift__, unwrap_spec=[gateway.ObjSpace, gateway.Arguments])) - space.setattr(gcls_instance, gs___rlshift__, gfunc_instance___rlshift__) - gs___rmod__ = space.wrap('__rmod__') - gfunc_instance___rmod__ = space.wrap(gateway.interp2app(f_instance___rmod__, unwrap_spec=[gateway.ObjSpace, gateway.Arguments])) - space.setattr(gcls_instance, gs___rmod__, gfunc_instance___rmod__) - gs___rmul__ = space.wrap('__rmul__') - gfunc_instance___rmul__ = space.wrap(gateway.interp2app(f_instance___rmul__, unwrap_spec=[gateway.ObjSpace, gateway.Arguments])) - space.setattr(gcls_instance, gs___rmul__, gfunc_instance___rmul__) - gs___ror__ = space.wrap('__ror__') - gfunc_instance___ror__ = space.wrap(gateway.interp2app(f_instance___ror__, unwrap_spec=[gateway.ObjSpace, gateway.Arguments])) - space.setattr(gcls_instance, gs___ror__, gfunc_instance___ror__) - gs___rpow__ = space.wrap('__rpow__') - gfunc_instance___rpow__ = space.wrap(gateway.interp2app(f_instance___rpow__, unwrap_spec=[gateway.ObjSpace, gateway.Arguments])) - space.setattr(gcls_instance, gs___rpow__, gfunc_instance___rpow__) - gs___rrshift__ = space.wrap('__rrshift__') - gfunc_instance___rrshift__ = space.wrap(gateway.interp2app(f_instance___rrshift__, unwrap_spec=[gateway.ObjSpace, gateway.Arguments])) - space.setattr(gcls_instance, gs___rrshift__, gfunc_instance___rrshift__) - gs___rshift__ = space.wrap('__rshift__') - gfunc_instance___rshift__ = space.wrap(gateway.interp2app(f_instance___rshift__, unwrap_spec=[gateway.ObjSpace, gateway.Arguments])) - space.setattr(gcls_instance, gs___rshift__, gfunc_instance___rshift__) - gs___rsub__ = space.wrap('__rsub__') - gfunc_instance___rsub__ = space.wrap(gateway.interp2app(f_instance___rsub__, unwrap_spec=[gateway.ObjSpace, gateway.Arguments])) - space.setattr(gcls_instance, gs___rsub__, gfunc_instance___rsub__) - gs___rtruediv__ = space.wrap('__rtruediv__') - gfunc_instance___rtruediv__ = space.wrap(gateway.interp2app(f_instance___rtruediv__, unwrap_spec=[gateway.ObjSpace, gateway.Arguments])) - space.setattr(gcls_instance, gs___rtruediv__, gfunc_instance___rtruediv__) - gs___rxor__ = space.wrap('__rxor__') - gfunc_instance___rxor__ = space.wrap(gateway.interp2app(f_instance___rxor__, unwrap_spec=[gateway.ObjSpace, gateway.Arguments])) - space.setattr(gcls_instance, gs___rxor__, gfunc_instance___rxor__) - gs___setattr__ = space.wrap('__setattr__') - gfunc_instance___setattr__ = space.wrap(gateway.interp2app(f_instance___setattr__, unwrap_spec=[gateway.ObjSpace, gateway.Arguments])) - space.setattr(gcls_instance, gs___setattr__, gfunc_instance___setattr__) - gs___setitem__ = space.wrap('__setitem__') - gfunc_instance___setitem__ = space.wrap(gateway.interp2app(f_instance___setitem__, unwrap_spec=[gateway.ObjSpace, gateway.Arguments])) - space.setattr(gcls_instance, gs___setitem__, gfunc_instance___setitem__) - gs___setslice__ = space.wrap('__setslice__') - gfunc_instance___setslice__ = space.wrap(gateway.interp2app(f_instance___setslice__, unwrap_spec=[gateway.ObjSpace, gateway.Arguments])) - space.setattr(gcls_instance, gs___setslice__, gfunc_instance___setslice__) - gs___str__ = space.wrap('__str__') - gfunc_instance___str__ = space.wrap(gateway.interp2app(f_instance___str__, unwrap_spec=[gateway.ObjSpace, gateway.Arguments])) - space.setattr(gcls_instance, gs___str__, gfunc_instance___str__) - gs___sub__ = space.wrap('__sub__') - gfunc_instance___sub__ = space.wrap(gateway.interp2app(f_instance___sub__, unwrap_spec=[gateway.ObjSpace, gateway.Arguments])) - space.setattr(gcls_instance, gs___sub__, gfunc_instance___sub__) - gs___truediv__ = space.wrap('__truediv__') - gfunc_instance___truediv__ = space.wrap(gateway.interp2app(f_instance___truediv__, unwrap_spec=[gateway.ObjSpace, gateway.Arguments])) - space.setattr(gcls_instance, gs___truediv__, gfunc_instance___truediv__) - gs___xor__ = space.wrap('__xor__') - gfunc_instance___xor__ = space.wrap(gateway.interp2app(f_instance___xor__, unwrap_spec=[gateway.ObjSpace, gateway.Arguments])) - space.setattr(gcls_instance, gs___xor__, gfunc_instance___xor__) - gs_next = space.wrap('next') - gfunc_instance_next = space.wrap(gateway.interp2app(f_instance_next, unwrap_spec=[gateway.ObjSpace, gateway.Arguments])) - space.setattr(gcls_instance, gs_next, gfunc_instance_next) - gfunc_classobj___call__ = space.wrap(gateway.interp2app(f_classobj___call__, unwrap_spec=[gateway.ObjSpace, gateway.Arguments])) - space.setattr(gcls_classobj, gs___call__, gfunc_classobj___call__) - gfunc_classobj___delattr__ = space.wrap(gateway.interp2app(f_classobj___delattr__, unwrap_spec=[gateway.ObjSpace, gateway.Arguments])) - space.setattr(gcls_classobj, gs___delattr__, gfunc_classobj___delattr__) - gfunc_classobj___getattribute__ = space.wrap(gateway.interp2app(f_classobj___getattribute__, unwrap_spec=[gateway.ObjSpace, gateway.Arguments])) - space.setattr(gcls_classobj, gs___getattribute__, gfunc_classobj___getattribute__) - gfunc_classobj___repr__ = space.wrap(gateway.interp2app(f_classobj___repr__, unwrap_spec=[gateway.ObjSpace, gateway.Arguments])) - space.setattr(gcls_classobj, gs___repr__, gfunc_classobj___repr__) - gfunc_classobj___setattr__ = space.wrap(gateway.interp2app(f_classobj___setattr__, unwrap_spec=[gateway.ObjSpace, gateway.Arguments])) - space.setattr(gcls_classobj, gs___setattr__, gfunc_classobj___setattr__) - gfunc_classobj___str__ = space.wrap(gateway.interp2app(f_classobj___str__, unwrap_spec=[gateway.ObjSpace, gateway.Arguments])) - space.setattr(gcls_classobj, gs___str__, gfunc_classobj___str__) - gfunc_get_class_module = space.wrap(gateway.interp2app(f_get_class_module, unwrap_spec=[gateway.ObjSpace, gateway.Arguments])) - gs__ = space.wrap('?') - gs___name__ = space.wrap('__name__') - gs__s__s = space.wrap('%s.%s') - gfunc_retrieve = space.wrap(gateway.interp2app(f_retrieve, unwrap_spec=[gateway.ObjSpace, gateway.Arguments])) - from pypy.interpreter.error import OperationError as gOperationError - gdescriptor_object___getattribute__ = space.getattr(space.w_object, gs___getattribute__) - gfunc_set_name = space.wrap(gateway.interp2app(f_set_name, unwrap_spec=[gateway.ObjSpace, gateway.Arguments])) - gs___bases__ = space.wrap('__bases__') - gfunc_set_bases = space.wrap(gateway.interp2app(f_set_bases, unwrap_spec=[gateway.ObjSpace, gateway.Arguments])) - gfunc_set_dict = space.wrap(gateway.interp2app(f_set_dict, unwrap_spec=[gateway.ObjSpace, gateway.Arguments])) - gdescriptor_object___setattr__ = space.getattr(space.w_object, gs___setattr__) - gs___dict___must_be_a_dictionary_ob = space.wrap( -"""__dict__ must be a dictionary object""") - gs___bases___must_be_a_tuple_object = space.wrap( -"""__bases__ must be a tuple object""") - gs___bases___items_must_be_classes = space.wrap( -"""__bases__ items must be classes""") - gdescriptor_classobj__bases = space.getattr(gcls_classobj, gs__bases) - gs___set__ = space.wrap('__set__') - gs___name___must_be_a_string_object = space.wrap( -"""__name__ must be a string object""") - gdescriptor_classobj__name = space.getattr(gcls_classobj, gs__name) - gfunc_uid = space.wrap(gateway.interp2app(f_uid, unwrap_spec=[gateway.ObjSpace, gateway.Arguments])) - gs__class__s__s_at_0x_x_ = space.wrap('') - gi_0 = space.wrap(0) - glong_0x7fffffffL = space.wrap(0x7fffffffL) # XXX implement long! - gi_2 = space.wrap(2) - gs___get__ = space.wrap('__get__') - gi_1 = space.wrap(1) - gfunc_lookup = space.wrap(gateway.interp2app(f_lookup, unwrap_spec=[gateway.ObjSpace, gateway.Arguments])) - gs_class__s_has_no_attribute__s = space.wrap('class %s has no attribute %s') - gfunc_mro_lookup = space.wrap(gateway.interp2app(f_mro_lookup, unwrap_spec=[gateway.ObjSpace, gateway.Arguments])) - gs___mro__ = space.wrap('__mro__') - g2tuple_1 = space.newtuple([space.w_None, space.w_None]) - g3tuple_2 = space.newtuple([gs___name__, gs___bases__, gs___dict__]) - gdescriptor_object___delattr__ = space.getattr(space.w_object, gs___delattr__) - gbltinmethod___new__ = space.getattr(space.w_object, gs___new__) - gdescriptor_instance__class = space.getattr(gcls_instance, gs__class) - gfunc_instance_getattr1 = space.wrap(gateway.interp2app(f_instance_getattr1, unwrap_spec=[gateway.ObjSpace, gateway.Arguments])) - gs___init__ = space.wrap('__init__') - gs___init_____should_return_None = space.wrap('__init__() should return None') - gs___class__ = space.wrap('__class__') - gs__s_instance_has_no_attribute__s = space.wrap( -"""%s instance has no attribute %s""") - gs_instance_has_no_next___method = space.wrap('instance has no next() method') - gfunc__coerce = space.wrap(gateway.interp2app(f__coerce, unwrap_spec=[gateway.ObjSpace, gateway.Arguments])) - gs___dict___must_be_set_to_a_dictio = space.wrap( -"""__dict__ must be set to a dictionary""") - gs___class___must_be_set_to_a_class = space.wrap( -"""__class__ must be set to a class""") - gs___s__s_instance_at_0x_x_ = space.wrap('<%s.%s instance at 0x%x>') - gs___nonzero_____should_return____0 = space.wrap( -"""__nonzero__() should return >= 0""") - gs___nonzero_____should_return_an_i = space.wrap( -"""__nonzero__() should return an int""") - gs___len_____should_return____0 = space.wrap('__len__() should return >= 0') - gs___len_____should_return_an_int = space.wrap( -"""__len__() should return an int""") - gs___iter___returned_non_iterator_o = space.wrap( -"""__iter__ returned non-iterator of type %s""") - gs_iteration_over_non_sequence = space.wrap('iteration over non-sequence') - gs_unhashable_instance = space.wrap('unhashable instance') - gs___hash_____should_return_an_int = space.wrap( -"""__hash__() should return an int""") - gs___getattr__ = space.wrap('__getattr__') - g2tuple_2 = space.newtuple([gs___dict__, gs___class__]) - gs__s_instance_has_no_attribute___s = space.wrap( -"""%s instance has no attribute '%s'""") - gi_minus_1 = space.wrap(-1) - gs___cmp___must_return_int = space.wrap('__cmp__ must return int') - gs__s_instance_has_no___call___meth = space.wrap( -"""%s instance has no __call__ method""") - gs_instance___first_arg_must_be_cla = space.wrap( -"""instance() first arg must be class""") - gs_instance___second_arg_must_be_di = space.wrap( -"""instance() second arg must be dictionary or None""") - gfunc_type_err = space.wrap(gateway.interp2app(f_type_err, unwrap_spec=[gateway.ObjSpace, gateway.Arguments])) - gs_name = space.wrap('name') - gs_string = space.wrap('string') - g0tuple = space.newtuple([]) - gs_bases = space.wrap('bases') - gs_tuple = space.wrap('tuple') - gs_dict = space.wrap('dict') - gs___doc__ = space.wrap('__doc__') - gs__getframe = space.wrap('_getframe') - gs_f_globals = space.wrap('f_globals') - gs_get = space.wrap('get') - gs_OLD_STYLE_CLASSES_IMPL = space.wrap('OLD_STYLE_CLASSES_IMPL') - _tup = space.newtuple([]) - g_object = space.call(space.w_object, _tup) - gs_callable = space.wrap('callable') - gs_base_must_be_class = space.wrap('base must be class') - gs_argument__s_must_be__s__not__s = space.wrap( -"""argument %s must be %s, not %s""") - return g3tuple - Modified: pypy/dist/pypy/objspace/std/objspace.py ============================================================================== --- pypy/dist/pypy/objspace/std/objspace.py (original) +++ pypy/dist/pypy/objspace/std/objspace.py Thu May 19 23:32:08 2005 @@ -106,12 +106,21 @@ def setup_old_style_classes(self): """NOT_RPYTHON""" - from pypy.module import classobjinterp # sanity check that this approach is working and is not too late assert not self.is_true(self.contains(self.builtin.w_dict,self.wrap('_classobj'))),"app-level code has seen dummy old style classes" assert not self.is_true(self.contains(self.builtin.w_dict,self.wrap('_instance'))),"app-level code has seen dummy old style classes" - w_setup = classobjinterp.initclassobj(self) - w_classobj, w_instance, w_purify = self.unpackiterable(w_setup) + # generate on-the-fly + class Fake: pass + fake = Fake() + import pypy.lib as lib + fname = os.path.join(os.path.split(lib.__file__)[0], '_classobj.py') + fake.filename = fname + fake.source = file(fname).read() + fake.modname = 'classobj' + w_dic = PyPyCacheDir.build_applevelinterp_dict(fake, self) + w_purify = self.getitem(w_dic, self.wrap('purify')) + w_classobj = self.getitem(w_dic, self.wrap('classobj')) + w_instance = self.getitem(w_dic, self.wrap('instance')) self.call_function(w_purify) self.w_classobj = w_classobj self.w_instance = w_instance @@ -119,13 +128,6 @@ def setup_exceptions(self): """NOT_RPYTHON""" ## hacking things in - class Fake: pass - fake = Fake() - import pypy.lib as lib - fname = os.path.join(os.path.split(lib.__file__)[0], '_exceptions.py') - fake.filename = fname - fake.source = file(fname).read() - fake.modname = 'exceptions' def call(w_type, w_args): space = self # too early for unpackiterable as well :-( @@ -138,6 +140,14 @@ bases = [space.w_object] res = W_TypeObject(space, name, bases, dic) return res + # generate on-the-fly + class Fake: pass + fake = Fake() + import pypy.lib as lib + fname = os.path.join(os.path.split(lib.__file__)[0], '_exceptions.py') + fake.filename = fname + fake.source = file(fname).read() + fake.modname = 'exceptions' try: # note that we hide the real call method by an instance variable! self.call = call Modified: pypy/dist/pypy/translator/geninterplevel.py ============================================================================== --- pypy/dist/pypy/translator/geninterplevel.py (original) +++ pypy/dist/pypy/translator/geninterplevel.py Thu May 19 23:32:08 2005 @@ -1526,6 +1526,8 @@ else: code = NiceCompile(filename)(sourcetext) dic = {'__name__': modname} + if filename: + dic['__file__'] = filename exec code in dic entrypoint = dic t = Translator(None, verbose=False, simplifying=needed_passes, From tismer at codespeak.net Thu May 19 23:39:25 2005 From: tismer at codespeak.net (tismer at codespeak.net) Date: Thu, 19 May 2005 23:39:25 +0200 (CEST) Subject: [pypy-svn] r12589 - pypy/dist/pypy/translator/tool Message-ID: <20050519213925.16EBD27B82@code1.codespeak.net> Author: tismer Date: Thu May 19 23:39:24 2005 New Revision: 12589 Modified: pypy/dist/pypy/translator/tool/tointerplevel.py Log: added a comment that says this tool is there but no longer needed Modified: pypy/dist/pypy/translator/tool/tointerplevel.py ============================================================================== --- pypy/dist/pypy/translator/tool/tointerplevel.py (original) +++ pypy/dist/pypy/translator/tool/tointerplevel.py Thu May 19 23:39:24 2005 @@ -1,3 +1,6 @@ +# this module can still be used, but it is no +# longer needed to bootstrap pypy. + import autopath import sys import optparse From tismer at codespeak.net Thu May 19 23:52:23 2005 From: tismer at codespeak.net (tismer at codespeak.net) Date: Thu, 19 May 2005 23:52:23 +0200 (CEST) Subject: [pypy-svn] r12590 - pypy/dist/pypy/translator Message-ID: <20050519215223.7445927B7B@code1.codespeak.net> Author: tismer Date: Thu May 19 23:52:23 2005 New Revision: 12590 Modified: pypy/dist/pypy/translator/geninterplevel.py Log: cleanup Modified: pypy/dist/pypy/translator/geninterplevel.py ============================================================================== --- pypy/dist/pypy/translator/geninterplevel.py (original) +++ pypy/dist/pypy/translator/geninterplevel.py Thu May 19 23:52:23 2005 @@ -1,5 +1,6 @@ """ -Implementation of a translator from application Python to interpreter level RPython. +Implementation of a translator from application Python to +interpreter level RPython. The idea is that we can automatically transform app-space implementations of methods into some equivalent representation at interpreter level. @@ -10,10 +11,24 @@ that globals are constants, for instance. This definition is not exact and might change. -Integration of this module will be done half-automatically -using a simple caching mechanism. The generated files are -not meant to be checked into svn, although this currently -still happens. +The interface for this module is + + (initfunc, newsrc) = translate_as_module( + sourcetext, + filename=None, + modname="app2interpexec", + tmpname=None) + +The returned newsrc is the generated source text. +It is used in gateway.py's caching mechanism. +The initfunc result is a function named "init"+modname +It must be called with a space instance and returns +a wrapped dict which is suitable to use as a module dict, +containing all trnaslatedobjects with their originalname. + +Integration of this module is finished. +There are no longer hand-generated source +pieces in pypy svn. """ from __future__ import generators @@ -1232,255 +1247,8 @@ # _____________________________________________________________________ -## this should go into some test file - -def somefunc(arg): - pass - -# XXX problem with local functions: -def randint(low, high, seed = 1234567): # really not a real random - return (seed % (high-low)) + low - -def small_loop(): - ''' this is a test for small loops. - How would we generate small blocks which call - each other? Hey, and """ is a doc string test """ - ''' - #from random import randint - # does not work. flowspace really complains on random. - # XXX we also seem to have problems with local functions - #def randint(low, high, seed = 1234567): # really not a real random - # return (seed % (high-low)) + low - - for i in range(10000): - r = randint(0, 10000) - if r > 9000: - return r - -def f(a,b): -## print "start" - a = [] - a.append(3) - for i in range(3): - pass#print i - if a > b: - try: - if b == 123: - raise ValueError - elif b == 321: - raise IndexError - return 123 - except ValueError: - raise TypeError - else: - dummy = somefunc(23) - return 42 - -class TestClass:pass - -def ff(a, b, c=3,*rest): - """ this is - some - docstring -""" - try: - try: - if rest: - raise SystemError, 42 - return a+b - finally: - a = 7 - if rest: - return len(rest),c - except TypeError: - print "eek" - -glob = 100 -def fff(): - global glob - return 42+glob - -def app_mod__String_ANY(format, values): - import _formatting - if isinstance(values, tuple): - return _formatting.format(format, values, None) - else: - if hasattr(values, 'keys'): - return _formatting.format(format, (values,), values) - else: - return _formatting.format(format, (values,), None) - -def app_str_decode__String_ANY_ANY(str, encoding=None, errors=None): - if encoding is None and errors is None: - return unicode(str) - elif errors is None: - return unicode(str, encoding) - else: - return unicode(str, encoding, errors) - - -def test_md5(): - #import md5 - # how do I avoid the builtin module? - from pypy.appspace import md5 - digest = md5.new("hello").hexdigest() - return digest - -def test_mod(): - return app_mod__String_ANY("-%s-", ["hallo"]) - -def test_join(): - return " ".join(["hi", "there"]) - -# cannot nest local classes, yet -# this appears to be a problem in flow space. -class AnIterClass(object): - def __init__(self): - self.lis = [c for c in "test"] - def next(self): - if self.lis: - return self.lis.pop() - raise StopIteration - def __iter__(self): - return self - -def test_iter(): - res = [] - for i in "hallo": - res.append(i) - for i in AnIterClass(): - res.append(i) - return res - -def test_loop(): - res = [] - i = 0 - while 1: - i += 1 - res.append(i) - if i == 42: - break - res.append(-i) - return res - -def test_exc(a=5): - try: - b = 0 - return a / b - except ZeroDivisionError: - return 42 - -def test_struct(): - from pypy.appspace import struct - import struct as stru - res1 = stru.pack('f',1.23), struct.pack('f',1.23) - res2 = struct.unpack('f', struct.pack('f',1.23)) - return res1, res2 - -def exceptions_helper(): - import pypy - prefix = os.path.dirname(pypy.__file__) - libdir = os.path.join(prefix, "lib") - fname = "_exceptions.py" - fpath = os.path.join(libdir, fname) - dic = {"__name__": "exceptions"} - execfile(fpath, dic) - #del dic["__builtins__"] - def test_exceptions(): - """ enumerate all exceptions """ - return dic.keys() - #return [thing for thing in _exceptions.__dict__.values()] - return dic, test_exceptions - -def make_class_instance_helper(): - import pypy - prefix = os.path.dirname(pypy.__file__) - libdir = os.path.join(prefix, "lib") - hold = sys.path - sys.path.insert(0, libdir) - import _classobj - sys.path = hold - def make_class_instance(): - return _classobj.classobj, _classobj.instance - return None, make_class_instance - -def test_complex(): - return 1j - -def test_NoneType(): - return types.NoneType - -def all_entries(): - res = [func() for func in entrypoints[:-1]] - return res - -entrypoints = (small_loop, - lambda: f(2, 3), - lambda: ff(2, 3, 5), - fff, - lambda: app_str_decode__String_ANY_ANY("hugo"), - test_mod, - test_md5, - test_join, - test_iter, - test_loop, - test_exc, - test_struct, - exceptions_helper, - make_class_instance_helper, - test_complex, - test_NoneType, - all_entries) -entrypoint = entrypoints[5] - -if False and __name__ == "__main__": - # XXX TODO: - # extract certain stuff like a general module maker - # and put this into tools/compile_exceptions, maybe??? - dic, entrypoint = exceptions_helper() - t = Translator(None, verbose=False, simplifying=needed_passes, - builtins_can_raise_exceptions=True) - gen = GenRpy(t, entrypoint) - gen.moddict = dic - gen.gen_source('/tmp/look.py') - - _oldcodetogointotestcases = ''' - import os, sys - from pypy.interpreter import autopath - srcdir = os.path.dirname(autopath.pypydir) - appdir = os.path.join(autopath.pypydir, 'appspace') - - if appdir not in sys.path: - sys.path.insert(0, appdir) - - dic = None - if entrypoint.__name__.endswith("_helper"): - dic, entrypoint = entrypoint() - t = Translator(entrypoint, verbose=False, simplifying=needed_passes, builtins_can_raise_exceptions=True) - gen = GenRpy(t) - gen.use_fast_call = True - if dic: gen.moddict = dic - import pypy.appspace.generated as tmp - pth = os.path.dirname(tmp.__file__) - ftmpname = "/tmp/look.py" - fname = os.path.join(pth, gen.modname+".py") - gen.gen_source(fname, ftmpname) - ''' - -def crazy_test(): - """ this thingy is generating the whole interpreter in itself""" - dic = {"__builtins__": __builtins__, "__name__": "__main__"} - execfile("/tmp/look.py", dic) - - entrypoint = dic[gen.entrypoint] - def test(): - entrypoint() - - t = Translator(test, verbose=False, simplifying=needed_passes, - builtins_can_raise_exceptions=True) - gen2 = GenRpy(t) - gen2.gen_source("/tmp/look2.py") - +# implementation of the interface that is finally only +# used: translate_as_module import py.code import cStringIO as StringIO From pedronis at codespeak.net Fri May 20 03:44:23 2005 From: pedronis at codespeak.net (pedronis at codespeak.net) Date: Fri, 20 May 2005 03:44:23 +0200 (CEST) Subject: [pypy-svn] r12591 - pypy/dist/pypy/documentation Message-ID: <20050520014423.3691727B76@code1.codespeak.net> Author: pedronis Date: Fri May 20 03:44:22 2005 New Revision: 12591 Modified: pypy/dist/pypy/documentation/index.txt Log: fixing some typos some "relevance" reordering and some additions to the links list Modified: pypy/dist/pypy/documentation/index.txt ============================================================================== --- pypy/dist/pypy/documentation/index.txt (original) +++ pypy/dist/pypy/documentation/index.txt Fri May 20 03:44:22 2005 @@ -40,20 +40,27 @@ what the pypy project is about and why you should care * Dynamo_ showcased `transparent dynamic optimization`_ - generating translating a binary program into an optimizied version at runtime. + generating an optimized version of a binary program at runtime. -* spyweb_ translates Python programs to Scheme. +* Tayloring Dynamo_ to interpreter implementations and challenges, + Gregory Sullivan et. al., + `Dynamic Native Optimization of Native Interpreters`_. IVME 03. 2003. -* `GNU lightning`_ generates assembly language at runtime. +* JikesRVM_ a research dynamic optimizing Java VM written in Java. + +* `Squeak`_ is a Smalltalk-80 implementation written in + Smalltalk, being used in `Croquet`_, an experimental + distributed multi-user/multi-programmer virtual world. * `LLVM`_ the low level virtual machine project. + +* spyweb_ translates Python programs to Scheme. * `Iron Python`_ a new Python implementation compiling Python into Microsofts Common Language Runtime (CLR) Intermediate Language (IL). -* `Squeak`_ is a Smalltalk-80 implementation written in - Smalltalk, being used in `Croquet`_, an experimental - distributed multi-user/multi-programmer virtual world. +* `GNU lightning`_ generates assembly language at runtime. + .. _`Squeak`: http://www.squeak.org/ .. _`Croquet`: http://www.opencroquet.org/ @@ -69,3 +76,5 @@ .. _`GNU lightning`: http://www.gnu.org/software/lightning/lightning.html .. _LLVM: http://llvm.cs.uiuc.edu/ .. _IronPython: http://www.python.org/pycon/dc2004/papers/9/ +.. _`Dynamic Native Optimization of Native Interpreters`: http://www.ai.mit.edu/~gregs/dynamorio.html +.. _JikesRVM: http://jikesrvm.sf.net From pedronis at codespeak.net Fri May 20 03:46:31 2005 From: pedronis at codespeak.net (pedronis at codespeak.net) Date: Fri, 20 May 2005 03:46:31 +0200 (CEST) Subject: [pypy-svn] r12592 - pypy/dist/pypy/documentation Message-ID: <20050520014631.2687027B76@code1.codespeak.net> Author: pedronis Date: Fri May 20 03:46:30 2005 New Revision: 12592 Modified: pypy/dist/pypy/documentation/index.txt Log: typographic detail Modified: pypy/dist/pypy/documentation/index.txt ============================================================================== --- pypy/dist/pypy/documentation/index.txt (original) +++ pypy/dist/pypy/documentation/index.txt Fri May 20 03:46:30 2005 @@ -42,7 +42,7 @@ * Dynamo_ showcased `transparent dynamic optimization`_ generating an optimized version of a binary program at runtime. -* Tayloring Dynamo_ to interpreter implementations and challenges, +* Tayloring Dynamo_ to interpreter implementations and challenges - Gregory Sullivan et. al., `Dynamic Native Optimization of Native Interpreters`_. IVME 03. 2003. From pedronis at codespeak.net Fri May 20 03:48:56 2005 From: pedronis at codespeak.net (pedronis at codespeak.net) Date: Fri, 20 May 2005 03:48:56 +0200 (CEST) Subject: [pypy-svn] r12593 - pypy/dist/pypy/documentation Message-ID: <20050520014856.372B127B76@code1.codespeak.net> Author: pedronis Date: Fri May 20 03:48:56 2005 New Revision: 12593 Modified: pypy/dist/pypy/documentation/index.txt Log: fix typo Modified: pypy/dist/pypy/documentation/index.txt ============================================================================== --- pypy/dist/pypy/documentation/index.txt (original) +++ pypy/dist/pypy/documentation/index.txt Fri May 20 03:48:56 2005 @@ -42,7 +42,7 @@ * Dynamo_ showcased `transparent dynamic optimization`_ generating an optimized version of a binary program at runtime. -* Tayloring Dynamo_ to interpreter implementations and challenges - +* Tailoring Dynamo_ to interpreter implementations and challenges - Gregory Sullivan et. al., `Dynamic Native Optimization of Native Interpreters`_. IVME 03. 2003. From pedronis at codespeak.net Fri May 20 05:34:38 2005 From: pedronis at codespeak.net (pedronis at codespeak.net) Date: Fri, 20 May 2005 05:34:38 +0200 (CEST) Subject: [pypy-svn] r12594 - in pypy/dist/pypy: annotation interpreter Message-ID: <20050520033438.ECAA627B7B@code1.codespeak.net> Author: pedronis Date: Fri May 20 05:34:38 2005 New Revision: 12594 Modified: pypy/dist/pypy/annotation/builtin.py pypy/dist/pypy/interpreter/gateway.py Log: I missed the blocked blocks testing the print changes. fixing 34 blocked blocks. teach the annotator to deal with the changes in gateway which are not a bit out of place. we still have a blocked block in targetpypymain right now! Modified: pypy/dist/pypy/annotation/builtin.py ============================================================================== --- pypy/dist/pypy/annotation/builtin.py (original) +++ pypy/dist/pypy/annotation/builtin.py Fri May 20 05:34:38 2005 @@ -99,7 +99,10 @@ if not s_attr.is_constant() or not isinstance(s_attr.const, str): getbookkeeper().warning('hasattr(%r, %r) is not RPythonic enough' % (s_obj, s_attr)) - return SomeBool() + r = SomeBool() + if s_obj.is_constant(): + r.const = hasattr(s_obj.const, s_attr.const) + return r def builtin_callable(s_obj): return SomeBool() Modified: pypy/dist/pypy/interpreter/gateway.py ============================================================================== --- pypy/dist/pypy/interpreter/gateway.py (original) +++ pypy/dist/pypy/interpreter/gateway.py Fri May 20 05:34:38 2005 @@ -532,7 +532,6 @@ def appcaller(space, *args_w): if not isinstance(space, ObjSpace): raise TypeError("first argument must be a space instance.") - # redirect if the space handles this specially if hasattr(space, 'specialcases'): sc = space.specialcases if ApplevelClass in sc: From pedronis at codespeak.net Fri May 20 05:41:27 2005 From: pedronis at codespeak.net (pedronis at codespeak.net) Date: Fri, 20 May 2005 05:41:27 +0200 (CEST) Subject: [pypy-svn] r12595 - pypy/dist/pypy/interpreter Message-ID: <20050520034127.D013627B7B@code1.codespeak.net> Author: pedronis Date: Fri May 20 05:41:27 2005 New Revision: 12595 Modified: pypy/dist/pypy/interpreter/gateway.py Log: comment Modified: pypy/dist/pypy/interpreter/gateway.py ============================================================================== --- pypy/dist/pypy/interpreter/gateway.py (original) +++ pypy/dist/pypy/interpreter/gateway.py Fri May 20 05:41:27 2005 @@ -532,6 +532,7 @@ def appcaller(space, *args_w): if not isinstance(space, ObjSpace): raise TypeError("first argument must be a space instance.") + # redirect if the space handles this specially XXX can this be factored a bit less flow space dependetly if hasattr(space, 'specialcases'): sc = space.specialcases if ApplevelClass in sc: From ac at codespeak.net Fri May 20 08:11:33 2005 From: ac at codespeak.net (ac at codespeak.net) Date: Fri, 20 May 2005 08:11:33 +0200 (CEST) Subject: [pypy-svn] r12596 - pypy/branch/non-fake-unicode/pypy/module/unicodedata Message-ID: <20050520061133.B638027B90@code1.codespeak.net> Author: ac Date: Fri May 20 08:11:33 2005 New Revision: 12596 Modified: pypy/branch/non-fake-unicode/pypy/module/unicodedata/functions.py Log: Fix typo. Modified: pypy/branch/non-fake-unicode/pypy/module/unicodedata/functions.py ============================================================================== --- pypy/branch/non-fake-unicode/pypy/module/unicodedata/functions.py (original) +++ pypy/branch/non-fake-unicode/pypy/module/unicodedata/functions.py Fri May 20 08:11:33 2005 @@ -7,9 +7,9 @@ def unichr_to_code_w(space, w_unichr): if not space.is_true(space.isinstance(w_unichr, space.w_unicode)): - raise TypeError, 'argument 1 must be unicode' + raise OperationError(space.w_TypeError, space.wrap('argument 1 must be unicode')) if not space.int_w(space.len(w_unichr)) == 1: - raise TypeError, 'need a single Unicode character as parameter' + raise OperationError(space.w_TypeError, space.wrap('need a single Unicode character as parameter')) return space.int_w(space.ord(w_unichr)) def lookup(space, w_name): @@ -33,7 +33,7 @@ return space.wrap(name) -def decimal(space, w_unichr, default=NoneNotWrapped): +def decimal(space, w_unichr, w_default=NoneNotWrapped): code = unichr_to_code_w(space, w_unichr) try: return space.wrap(unicodedb.decimal(code)) From ac at codespeak.net Fri May 20 08:12:07 2005 From: ac at codespeak.net (ac at codespeak.net) Date: Fri, 20 May 2005 08:12:07 +0200 (CEST) Subject: [pypy-svn] r12597 - pypy/branch/non-fake-unicode/pypy/objspace/std Message-ID: <20050520061207.9DAFF27B90@code1.codespeak.net> Author: ac Date: Fri May 20 08:12:07 2005 New Revision: 12597 Modified: pypy/branch/non-fake-unicode/pypy/objspace/std/unicodeobject.py Log: Slightly improve the unicode string formating. Modified: pypy/branch/non-fake-unicode/pypy/objspace/std/unicodeobject.py ============================================================================== --- pypy/branch/non-fake-unicode/pypy/objspace/std/unicodeobject.py (original) +++ pypy/branch/non-fake-unicode/pypy/objspace/std/unicodeobject.py Fri May 20 08:12:07 2005 @@ -766,8 +766,20 @@ raise TypeError("character mapping must return integer, None or unicode") return ''.join(result) +def unicode_to_str(val): + if isinstance(val, unicode): + return val.encode("utf-8") + return val + def mod__Unicode_ANY(format, values): - return unicode(format.encode("utf-8") % values, "utf-8") + format = format.encode("utf-8") + if isinstance(values, tuple): + values = tuple([unicode_to_str(val) for val in values]) + elif hasattr(values, 'keys'): + values = dict([(key, unicode_to_str(val)) for key, val in values.iteritems()]) + else: + values = unicode_to_str(values) + return unicode(format % values, "utf-8") ''') unicode_expandtabs__Unicode_ANY = app.interphook('unicode_expandtabs__Unicode_ANY') From hpk at codespeak.net Fri May 20 08:31:39 2005 From: hpk at codespeak.net (hpk at codespeak.net) Date: Fri, 20 May 2005 08:31:39 +0200 (CEST) Subject: [pypy-svn] r12598 - pypy/extradoc/talk Message-ID: <20050520063139.7D6F927B9F@code1.codespeak.net> Author: hpk Date: Fri May 20 08:31:39 2005 New Revision: 12598 Added: pypy/extradoc/talk/amsterdam-sprint-intro.pdf pypy/extradoc/talk/amsterdam-sprint-intro.sxi - copied unchanged from r12597, pypy/extradoc/talk/amsterdam.sxi Removed: pypy/extradoc/talk/amsterdam.sxi Log: renamed my amsterdam sprint intro slides Added: pypy/extradoc/talk/amsterdam-sprint-intro.pdf ============================================================================== Files (empty file) and pypy/extradoc/talk/amsterdam-sprint-intro.pdf Fri May 20 08:31:39 2005 differ Deleted: /pypy/extradoc/talk/amsterdam.sxi ============================================================================== Binary file. No diff available. From hpk at codespeak.net Fri May 20 08:44:51 2005 From: hpk at codespeak.net (hpk at codespeak.net) Date: Fri, 20 May 2005 08:44:51 +0200 (CEST) Subject: [pypy-svn] r12599 - pypy/dist/pypy/documentation Message-ID: <20050520064451.B727927B9E@code1.codespeak.net> Author: hpk Date: Fri May 20 08:44:51 2005 New Revision: 12599 Modified: pypy/dist/pypy/documentation/index.txt Log: issue65 in-progress split into a talk/presentations and related projects section. linked a few talks, mostly my own, because nobody else apparently cared to checkin things. Armin, can you checkin the pygame presentation from Pycon into a extradoc/talk/pypy-pycon2005 directory with a README how to start it? Modified: pypy/dist/pypy/documentation/index.txt ============================================================================== --- pypy/dist/pypy/documentation/index.txt (original) +++ pypy/dist/pypy/documentation/index.txt Fri May 20 08:44:51 2005 @@ -33,12 +33,27 @@ .. _`getting started`: getting_started.html .. _`theory`: theory.html -Further reading / related projects +Talks and Presentations ---------------------------------- * oscon2003-paper_ is a early paper presented at Oscon 2003 describing what the pypy project is about and why you should care +* `Architecture introduction slides`_ for the Amsterdam Sprint introduction Dec 2003. + +* `EU funding for FOSS`_ talk on Chaos Communication Conference Dec 2004. + +* `py lib slides`_ from the py lib talk at Pycon 2005 (py is used as a + support/testing library for PyPy) + +.. _oscon2003-paper: http://codespeak.net/pypy/index.cgi?extradoc/talk/oscon2003-paper.html +.. _`Architecture introduction slides`: http://codespeak.net/svn/pypy/extradoc/talk/amsterdam-sprint-intro.pdf +.. _`EU funding for FOSS`: http://codespeak.net/svn/pypy/extradoc/talk/2004-21C3-pypy-EU-hpk.pdf +.. _`py lib slides`: http://codespeak.net/svn/pypy/extradoc/talk/2005-pycon-py.pdf + +Related projects +---------------------------------- + * Dynamo_ showcased `transparent dynamic optimization`_ generating an optimized version of a binary program at runtime. @@ -67,7 +82,6 @@ .. _`Iron Python`: http://www.gotdotnet.com/workspaces/workspace.aspx?id=ad7acff7-ab1e-4bcb-99c0-57ac5a3a9742 .. _`transparent dynamic optimization`: http://www.hpl.hp.com/techreports/1999/HPL-1999-77.pdf .. _Dynamo: http://www.hpl.hp.com/techreports/1999/HPL-1999-78.pdf -.. _oscon2003-paper: http://codespeak.net/pypy/index.cgi?extradoc/talk/oscon2003-paper.html .. _optionaltool: http://codespeak.net/pypy/index.cgi?doc/optionaltool.html .. _testdesign: http://codespeak.net/pypy/index.cgi?doc/testdesign.html .. _feasible: http://codespeak.net/pipermail/pypy-dev/2004q2/001289.html From hpk at codespeak.net Fri May 20 08:46:58 2005 From: hpk at codespeak.net (hpk at codespeak.net) Date: Fri, 20 May 2005 08:46:58 +0200 (CEST) Subject: [pypy-svn] r12600 - pypy/extradoc/talk Message-ID: <20050520064658.ECBCA27BB2@code1.codespeak.net> Author: hpk Date: Fri May 20 08:46:58 2005 New Revision: 12600 Modified: pypy/extradoc/talk/2004-21C3-pypy-EU-hpk.pdf (props changed) pypy/extradoc/talk/2005-pycon-py.pdf (props changed) pypy/extradoc/talk/amsterdam-sprint-intro.pdf (props changed) Log: setting mime types to pdf From hpk at codespeak.net Fri May 20 08:53:27 2005 From: hpk at codespeak.net (hpk at codespeak.net) Date: Fri, 20 May 2005 08:53:27 +0200 (CEST) Subject: [pypy-svn] r12601 - pypy/dist/pypy/documentation Message-ID: <20050520065327.3543127BB7@code1.codespeak.net> Author: hpk Date: Fri May 20 08:53:27 2005 New Revision: 12601 Modified: pypy/dist/pypy/documentation/index.txt Log: a few tweaks and more cautious wording Modified: pypy/dist/pypy/documentation/index.txt ============================================================================== --- pypy/dist/pypy/documentation/index.txt (original) +++ pypy/dist/pypy/documentation/index.txt Fri May 20 08:53:27 2005 @@ -36,15 +36,17 @@ Talks and Presentations ---------------------------------- -* oscon2003-paper_ is a early paper presented at Oscon 2003 describing - what the pypy project is about and why you should care +* oscon2003-paper_ an early paper presented at Oscon 2003 describing + what the PyPy project is about and why you should care. -* `Architecture introduction slides`_ for the Amsterdam Sprint introduction Dec 2003. +* `Architecture introduction slides`_ a mostly up-to-date + introduction for the Amsterdam PyPy-Sprint Dec 2003. -* `EU funding for FOSS`_ talk on Chaos Communication Conference Dec 2004. +* `EU funding for FOSS`_ talk on Chaos Communication + Conference in Berlin, Dec 2004. -* `py lib slides`_ from the py lib talk at Pycon 2005 (py is used as a - support/testing library for PyPy) +* `py lib slides`_ from the py lib talk at Pycon 2005 + (py is used as a support/testing library for PyPy). .. _oscon2003-paper: http://codespeak.net/pypy/index.cgi?extradoc/talk/oscon2003-paper.html .. _`Architecture introduction slides`: http://codespeak.net/svn/pypy/extradoc/talk/amsterdam-sprint-intro.pdf From hpk at codespeak.net Fri May 20 09:32:35 2005 From: hpk at codespeak.net (hpk at codespeak.net) Date: Fri, 20 May 2005 09:32:35 +0200 (CEST) Subject: [pypy-svn] r12602 - in pypy/dist/pypy: documentation interpreter module module/__builtin__ module/__builtin__/test module/builtin module/sys module/sys2 translator Message-ID: <20050520073235.4FBBD27B3B@code1.codespeak.net> Author: hpk Date: Fri May 20 09:32:35 2005 New Revision: 12602 Added: pypy/dist/pypy/module/README.txt pypy/dist/pypy/module/__builtin__/ - copied from r12601, pypy/dist/pypy/module/builtin/ pypy/dist/pypy/module/sys/ - copied from r12601, pypy/dist/pypy/module/sys2/ Removed: pypy/dist/pypy/module/builtin/ pypy/dist/pypy/module/sys2/ Modified: pypy/dist/pypy/documentation/coding-guide.txt pypy/dist/pypy/interpreter/baseobjspace.py pypy/dist/pypy/module/__builtin__/test/test_complexobject.py pypy/dist/pypy/translator/ann_override.py Log: issue51 testing this got finally sensible after Chris's recent checkins: - renamed sys2 to sys - renamed builtin to __builtin__ - put a README into pypy/module warning against putting .py files in there - fixed all the references to sys2 and modules (i hope) Modified: pypy/dist/pypy/documentation/coding-guide.txt ============================================================================== --- pypy/dist/pypy/documentation/coding-guide.txt (original) +++ pypy/dist/pypy/documentation/coding-guide.txt Fri May 20 09:32:35 2005 @@ -451,7 +451,7 @@ >>>> import sys >>>> sys.__file__ - '/home/hpk/pypy-dist/pypy/module/sys2/__init__.pyc' + '/home/hpk/pypy-dist/pypy/module/sys/__init__.pyc' >>>> import operator >>>> operator.__file__ @@ -476,7 +476,7 @@ *pypy/modules* mixed interpreter/app-level builtin modules, such as - the sys and builtin module. + the ``sys`` and ``__builtin__`` module. *contents of PYTHONPATH* Modified: pypy/dist/pypy/interpreter/baseobjspace.py ============================================================================== --- pypy/dist/pypy/interpreter/baseobjspace.py (original) +++ pypy/dist/pypy/interpreter/baseobjspace.py Fri May 20 09:32:35 2005 @@ -117,13 +117,13 @@ def make_builtins(self): "NOT_RPYTHON: only for initializing the space." - from pypy.module.sys2 import Module + from pypy.module.sys import Module w_name = self.wrap('sys') self.sys = Module(self, w_name) w_modules = self.sys.get('modules') self.setitem(w_modules, w_name, self.wrap(self.sys)) - from pypy.module.builtin import Module + from pypy.module.__builtin__ import Module w_name = self.wrap('__builtin__') self.builtin = Module(self, w_name) w_builtin = self.wrap(self.builtin) Added: pypy/dist/pypy/module/README.txt ============================================================================== --- (empty file) +++ pypy/dist/pypy/module/README.txt Fri May 20 09:32:35 2005 @@ -0,0 +1,10 @@ + +this directory contains PyPy's builtin module implementation +that require access to interpreter level. See here +for more information: + + http://codespeak.net/pypy/index.cgi?doc/coding-guide.html#modules-in-pypy + +ATTENTION: don't put any '.py' files directly into pypy/module +because you can easily get import mixups on e.g. "import sys" +then (Python tries relative imports first). Modified: pypy/dist/pypy/module/__builtin__/test/test_complexobject.py ============================================================================== --- pypy/dist/pypy/module/builtin/test/test_complexobject.py (original) +++ pypy/dist/pypy/module/__builtin__/test/test_complexobject.py Fri May 20 09:32:35 2005 @@ -25,7 +25,7 @@ import sys import types -from pypy.module.builtin.app_complex import complex as pycomplex +from pypy.module.__builtin__.app_complex import complex as pycomplex try: unicode Modified: pypy/dist/pypy/translator/ann_override.py ============================================================================== --- pypy/dist/pypy/translator/ann_override.py (original) +++ pypy/dist/pypy/translator/ann_override.py Fri May 20 09:32:35 2005 @@ -5,7 +5,7 @@ from pypy.interpreter import error from pypy.interpreter import pyframe from pypy.objspace.std import fake -from pypy.module.sys2 import state as sys_state +from pypy.module.sys import state as sys_state import pypy.interpreter.typedef as itypedef import pypy.interpreter.pycode as pycode import pypy.interpreter.compiler as icompiler From hpk at codespeak.net Fri May 20 10:18:38 2005 From: hpk at codespeak.net (hpk at codespeak.net) Date: Fri, 20 May 2005 10:18:38 +0200 (CEST) Subject: [pypy-svn] r12603 - pypy/dist/pypy/documentation Message-ID: <20050520081838.61BE627B7B@code1.codespeak.net> Author: hpk Date: Fri May 20 10:18:38 2005 New Revision: 12603 Modified: pypy/dist/pypy/documentation/_ref.txt pypy/dist/pypy/documentation/getting_started.txt pypy/dist/pypy/documentation/objspace.txt Log: issue25 testing added and clarified a bit the trace object space documentation and linked to the implemenation file. regenerated references. removed the assignment to 'rxe' from the issue for now because it gives a false impression of "somebody currently cares for this". Modified: pypy/dist/pypy/documentation/_ref.txt ============================================================================== --- pypy/dist/pypy/documentation/_ref.txt (original) +++ pypy/dist/pypy/documentation/_ref.txt Fri May 20 10:18:38 2005 @@ -13,19 +13,19 @@ .. _`pypy/lib/test2`: http://codespeak.net/svn/pypy/dist/pypy/lib/test2 .. _`module/`: .. _`pypy/module`: http://codespeak.net/svn/pypy/dist/pypy/module +.. _`module/__builtin__/`: http://codespeak.net/svn/pypy/dist/pypy/module/__builtin__ .. _`module/_sre_pypy/`: http://codespeak.net/svn/pypy/dist/pypy/module/_sre_pypy -.. _`module/builtin/`: http://codespeak.net/svn/pypy/dist/pypy/module/builtin -.. _`pypy/module/builtin/__init__.py`: http://codespeak.net/svn/pypy/dist/pypy/module/builtin/__init__.py .. _`module/parser/`: http://codespeak.net/svn/pypy/dist/pypy/module/parser .. _`module/recparser/`: http://codespeak.net/svn/pypy/dist/pypy/module/recparser -.. _`module/sys2/`: http://codespeak.net/svn/pypy/dist/pypy/module/sys2 +.. _`module/sys/`: http://codespeak.net/svn/pypy/dist/pypy/module/sys .. _`pypy/objspace`: .. _`objspace/`: http://codespeak.net/svn/pypy/dist/pypy/objspace .. _`objspace/flow/`: http://codespeak.net/svn/pypy/dist/pypy/objspace/flow .. _`pypy/objspace/std`: .. _`objspace/std/`: http://codespeak.net/svn/pypy/dist/pypy/objspace/std .. _`objspace/thunk.py`: http://codespeak.net/svn/pypy/dist/pypy/objspace/thunk.py -.. _`objspace/trace.py`: http://codespeak.net/svn/pypy/dist/pypy/objspace/trace.py +.. _`objspace/trace.py`: +.. _`pypy/objspace/trace.py`: http://codespeak.net/svn/pypy/dist/pypy/objspace/trace.py .. _`rpython/`: http://codespeak.net/svn/pypy/dist/pypy/rpython .. _`tool/`: http://codespeak.net/svn/pypy/dist/pypy/tool .. _`tool/pytest/`: http://codespeak.net/svn/pypy/dist/pypy/tool/pytest Modified: pypy/dist/pypy/documentation/getting_started.txt ============================================================================== --- pypy/dist/pypy/documentation/getting_started.txt (original) +++ pypy/dist/pypy/documentation/getting_started.txt Fri May 20 10:18:38 2005 @@ -172,6 +172,8 @@ Note that the prompt of the interpreter-level console is only '>>>' since it runs on CPython level. To return to PyPy, press . +.. _`trace example`: + Tracing bytecode and operations on objects ++++++++++++++++++++++++++++++++++++++++++ @@ -527,13 +529,13 @@ `module/_sre_pypy/`_ an experimental approach wrapping CPython's ``_sre`` module without using faking -`module/builtin/`_ full implementation of CPython's ``__builtin__`` module. +`module/__builtin__/`_ full implementation of CPython's ``__builtin__`` module. `module/parser/`_ parser package from Jonathan David Riehl's `basil`_ package `module/recparser/`_ parser package from Logilab -`module/sys2/`_ implementation of CPython's ``sys`` module. +`module/sys/`_ implementation of CPython's ``sys`` module. `objspace/`_ `object space`_ implementations Modified: pypy/dist/pypy/documentation/objspace.txt ============================================================================== --- pypy/dist/pypy/documentation/objspace.txt (original) +++ pypy/dist/pypy/documentation/objspace.txt Fri May 20 10:18:38 2005 @@ -201,16 +201,25 @@ The Trace Object Space ====================== -The Trace Object space is a proxy object space, delegating most operations to -another one -- usually a standard object space -- while tracing them. It also -traces frame creation, deletion and bytecode execution. The ease with which -the Trace Object Space was implemented at the Amsterdam Sprint -underlines the power of the Object Space abstraction. (Of course, the -previously-implemented Flow Object Space producing the flow graph -already was proof enough). +The Trace Object space is a proxy object space, intercepting and memorizing +space operations. It also traces frame creation, deletion and bytecode execution. +It's implementation delegates to another object space - usually the standard +object space - in order to carry out the operations. The ease with which +the Trace Object Space was implemented in `pypy/objspace/trace.py`_ +underlines the power of the Object Space abstraction. -In an interactive PyPy prompt, type ``__pytrace__ = 1`` to enable it. +To make use of the tracing facilities you can at runtime switch +your interactive session to tracing mode by typing:: + >>> __pytrace__ = 1 + +(Also see the `trace example`_). + +Note that tracing mode will not show or record all space operations +by default to avoid presenting too much information. Only non-helper +operations are usually shown. + +.. _`trace example`: getting_started.html#trace-example The Thunk Object Space ====================== From hpk at codespeak.net Fri May 20 10:37:36 2005 From: hpk at codespeak.net (hpk at codespeak.net) Date: Fri, 20 May 2005 10:37:36 +0200 (CEST) Subject: [pypy-svn] r12605 - pypy/dist/pypy/documentation Message-ID: <20050520083736.34C0427B7B@code1.codespeak.net> Author: hpk Date: Fri May 20 10:37:36 2005 New Revision: 12605 Modified: pypy/dist/pypy/documentation/getting_started.txt Log: fixed links (after making py's link-checking stricter) Modified: pypy/dist/pypy/documentation/getting_started.txt ============================================================================== --- pypy/dist/pypy/documentation/getting_started.txt (original) +++ pypy/dist/pypy/documentation/getting_started.txt Fri May 20 10:37:36 2005 @@ -586,8 +586,8 @@ .. _`thunk object space`: objspace.html#the-thunk-object-space .. _StdObjSpace: objspace.html#the-standard-object-space .. _`abstract interpretation`: theory.html#abstract-interpretation -.. _`rpython`: coding-guide#rpython -.. _`type inferencing code`: translation#the-annotation-pass +.. _`rpython`: coding-guide.html#rpython +.. _`type inferencing code`: translation.html#the-annotation-pass .. _`RPython Typer`: translation.html#rpython-typer .. _`testing methods`: coding-guide.html#testing-in-pypy .. _`translation`: translation.html From hpk at codespeak.net Fri May 20 10:44:49 2005 From: hpk at codespeak.net (hpk at codespeak.net) Date: Fri, 20 May 2005 10:44:49 +0200 (CEST) Subject: [pypy-svn] r12606 - in pypy/dist/pypy/documentation: . tool Message-ID: <20050520084449.AC8A227B7B@code1.codespeak.net> Author: hpk Date: Fri May 20 10:44:49 2005 New Revision: 12606 Modified: pypy/dist/pypy/documentation/_ref.txt pypy/dist/pypy/documentation/coding-guide.txt pypy/dist/pypy/documentation/tool/makeref.py Log: fixed another link / made ref generation warn about links that contain a '/' but are not found. Modified: pypy/dist/pypy/documentation/_ref.txt ============================================================================== --- pypy/dist/pypy/documentation/_ref.txt (original) +++ pypy/dist/pypy/documentation/_ref.txt Fri May 20 10:44:49 2005 @@ -14,6 +14,7 @@ .. _`module/`: .. _`pypy/module`: http://codespeak.net/svn/pypy/dist/pypy/module .. _`module/__builtin__/`: http://codespeak.net/svn/pypy/dist/pypy/module/__builtin__ +.. _`pypy/module/__builtin__/__init__.py`: http://codespeak.net/svn/pypy/dist/pypy/module/__builtin__/__init__.py .. _`module/_sre_pypy/`: http://codespeak.net/svn/pypy/dist/pypy/module/_sre_pypy .. _`module/parser/`: http://codespeak.net/svn/pypy/dist/pypy/module/parser .. _`module/recparser/`: http://codespeak.net/svn/pypy/dist/pypy/module/recparser Modified: pypy/dist/pypy/documentation/coding-guide.txt ============================================================================== --- pypy/dist/pypy/documentation/coding-guide.txt (original) +++ pypy/dist/pypy/documentation/coding-guide.txt Fri May 20 10:44:49 2005 @@ -536,7 +536,7 @@ Application level specifiations are found in the `appleveldefs` dictionary found in ``__init__.py`` files of directories in ``pypy/module``. -For example, in `pypy/module/builtin/__init__.py`_ you find the following +For example, in `pypy/module/__builtin__/__init__.py`_ you find the following entry specifying where ``__builtin__.locals`` comes from:: ... @@ -547,14 +547,12 @@ interpreted at application level and the wrapped function value for ``locals`` will be extracted accordingly. -.. _`pypy/module/builtin/__init__.py`: http://codespeak.net/svn/pypy/dist/pypy/module/builtin/__init__.py - interpreter level definitions ............................. Interpreter level specifiations are found in the ``interpleveldefs`` dictionary found in ``__init__.py`` files of directories in ``pypy/module``. -For example, in `pypy/module/builtin/__init__.py`_ the following +For example, in `pypy/module/__builtin__/__init__.py`_ the following entry specifies where ``__builtin__.len`` comes from:: ... Modified: pypy/dist/pypy/documentation/tool/makeref.py ============================================================================== --- pypy/dist/pypy/documentation/tool/makeref.py (original) +++ pypy/dist/pypy/documentation/tool/makeref.py Fri May 20 10:44:49 2005 @@ -29,6 +29,9 @@ if cand.check(): target = dist_url + cand.relto(distdir) addlink(linkname, target) + break + else: + print "WARNING %s: link %r may be bogus" %(textfile, linkname) items = name2target.items() items.sort() @@ -40,5 +43,6 @@ lines.append(".. _`%s`: %s" %(linknamelist[-1], linktarget)) reffile.write("\n".join(lines)) -print "last ten lines" -for x in lines[-10:]: print x +print "wrote %d references to %r" %(len(lines), reffile) +#print "last ten lines" +#for x in lines[-10:]: print x From ac at codespeak.net Fri May 20 10:56:03 2005 From: ac at codespeak.net (ac at codespeak.net) Date: Fri, 20 May 2005 10:56:03 +0200 (CEST) Subject: [pypy-svn] r12607 - in pypy/branch/non-fake-unicode/pypy: lib objspace/std Message-ID: <20050520085603.E942E27B7B@code1.codespeak.net> Author: ac Date: Fri May 20 10:56:03 2005 New Revision: 12607 Modified: pypy/branch/non-fake-unicode/pypy/lib/_formatting.py pypy/branch/non-fake-unicode/pypy/objspace/std/unicodeobject.py Log: Make stringformatting handle unicode as well. Modified: pypy/branch/non-fake-unicode/pypy/lib/_formatting.py ============================================================================== --- pypy/branch/non-fake-unicode/pypy/lib/_formatting.py (original) +++ pypy/branch/non-fake-unicode/pypy/lib/_formatting.py Fri May 20 10:56:03 2005 @@ -6,6 +6,7 @@ # (1) rounding isn't always right (see comments in _float_formatting). # (2) something goes wrong in the f_alt case of %g handling. # (3) it's really, really slow. +import sys class _Flags(object): def __repr__(self): @@ -323,7 +324,7 @@ return self.std_wp(v) -format_registry = { +str_format_registry = { 'd':IntFormatter, 'i':IntFormatter, 'o':OctFormatter, @@ -344,6 +345,50 @@ # doesn't consume a value. '%':funcFormatter(lambda x:'%'), } + +class UnicodeStringFormatter(Formatter): + def format(self): + if isinstance(self.value, unicode): + return self.std_wp(self.value) + return self.std_wp(str(self.value)) + +class UnicodeCharFormatter(Formatter): + def format(self): + if isinstance(self.value, unicode): + v = self.value + if len(v) != 1: + raise TypeError, "%c requires int or unicode char" + else: + i = maybe_int(self.value) + if not 0 <= i <= sys.maxunicode: + raise OverflowError("OverflowError: unsigned byte " + "integer is greater than maximum") + v = unichr(i) + self.prec = None + return self.std_wp(v) + +unicode_format_registry = { + u'd':IntFormatter, + u'i':IntFormatter, + u'o':OctFormatter, + u'u':IntFormatter, + u'x':HexFormatter, + u'X':HexFormatter, + u'e':FloatEFormatter, + u'E':FloatEFormatter, + u'f':FloatFFormatter, + u'F':FloatFFormatter, + u'g':FloatGFormatter, + u'G':FloatGFormatter, + u'c':UnicodeCharFormatter, + u's':UnicodeStringFormatter, + u'r':funcFormatter(repr), + # this *can* get accessed, by e.g. '%()4%'%{'':1}. + # The usual %% case has to be handled specially as it + # doesn't consume a value. + u'%':funcFormatter(lambda x:u'%'), + } + del funcFormatter # don't irritate flow space @@ -374,7 +419,12 @@ return self.fmt[i:j] -def format(fmt, values, valuedict=None): +def format(fmt, values, valuedict=None, do_unicode=False): + if do_unicode: + format_registry = unicode_format_registry + else: + format_registry = str_format_registry + fmtiter = FmtIter(fmt) valueiter = iter(values) r = [] @@ -407,5 +457,7 @@ if valuedict is None: raise TypeError('not all arguments converted ' 'during string formatting') + if do_unicode: + return u''.join(r) return ''.join(r) Modified: pypy/branch/non-fake-unicode/pypy/objspace/std/unicodeobject.py ============================================================================== --- pypy/branch/non-fake-unicode/pypy/objspace/std/unicodeobject.py (original) +++ pypy/branch/non-fake-unicode/pypy/objspace/std/unicodeobject.py Fri May 20 10:56:03 2005 @@ -766,21 +766,13 @@ raise TypeError("character mapping must return integer, None or unicode") return ''.join(result) -def unicode_to_str(val): - if isinstance(val, unicode): - return val.encode("utf-8") - return val - def mod__Unicode_ANY(format, values): - format = format.encode("utf-8") + import _formatting if isinstance(values, tuple): - values = tuple([unicode_to_str(val) for val in values]) - elif hasattr(values, 'keys'): - values = dict([(key, unicode_to_str(val)) for key, val in values.iteritems()]) - else: - values = unicode_to_str(values) - return unicode(format % values, "utf-8") - + return _formatting.format(format, values, None, do_unicode=True) + if hasattr(values, 'keys'): + return _formatting.format(format, (values,), values, do_unicode=True) + return _formatting.format(format, (values,), None, do_unicode=True) ''') unicode_expandtabs__Unicode_ANY = app.interphook('unicode_expandtabs__Unicode_ANY') unicode_translate__Unicode_ANY = app.interphook('unicode_translate__Unicode_ANY') From hpk at codespeak.net Fri May 20 11:34:47 2005 From: hpk at codespeak.net (hpk at codespeak.net) Date: Fri, 20 May 2005 11:34:47 +0200 (CEST) Subject: [pypy-svn] r12608 - pypy/dist Message-ID: <20050520093447.BC78E27B7B@code1.codespeak.net> Author: hpk Date: Fri May 20 11:34:47 2005 New Revision: 12608 Modified: pypy/dist/README Log: issue5 resolved finalizing touch to README, this is considered done now. Modified: pypy/dist/README ============================================================================== --- pypy/dist/README (original) +++ pypy/dist/README Fri May 20 11:34:47 2005 @@ -1,5 +1,5 @@ -PyPy: Python in Python implementation Version 0.6 -================================================= +PyPy: Python in Python implementation / Version 0.6 +=================================================== Welcome to PyPy! PyPy-0.6 is the first public release after two years of spare-time and half a year of European Union From hpk at codespeak.net Fri May 20 12:15:30 2005 From: hpk at codespeak.net (hpk at codespeak.net) Date: Fri, 20 May 2005 12:15:30 +0200 (CEST) Subject: [pypy-svn] r12609 - pypy/dist/pypy/documentation Message-ID: <20050520101530.DB67227B7B@code1.codespeak.net> Author: hpk Date: Fri May 20 12:15:30 2005 New Revision: 12609 Modified: pypy/dist/pypy/documentation/_ref.txt pypy/dist/pypy/documentation/getting_started.txt Log: issue68 resolved issue37 testing cleaned up the LLVM refs (and all the other optional tools refs, added the py lib), added a more prominent note and am considering the LLVM issue closed. The only issue i have with issue37 (getting-started) is that iam not sure if it wouldn't be better to move the "directory reference" to the main doc page and reference it from "where to start reading sources". I tend to do this now. Modified: pypy/dist/pypy/documentation/_ref.txt ============================================================================== --- pypy/dist/pypy/documentation/_ref.txt (original) +++ pypy/dist/pypy/documentation/_ref.txt Fri May 20 12:15:30 2005 @@ -28,6 +28,7 @@ .. _`objspace/trace.py`: .. _`pypy/objspace/trace.py`: http://codespeak.net/svn/pypy/dist/pypy/objspace/trace.py .. _`rpython/`: http://codespeak.net/svn/pypy/dist/pypy/rpython +.. _`pypy/test_all.py`: http://codespeak.net/svn/pypy/dist/pypy/test_all.py .. _`tool/`: http://codespeak.net/svn/pypy/dist/pypy/tool .. _`tool/pytest/`: http://codespeak.net/svn/pypy/dist/pypy/tool/pytest .. _`tool/tb_server/`: http://codespeak.net/svn/pypy/dist/pypy/tool/tb_server Modified: pypy/dist/pypy/documentation/getting_started.txt ============================================================================== --- pypy/dist/pypy/documentation/getting_started.txt (original) +++ pypy/dist/pypy/documentation/getting_started.txt Fri May 20 12:15:30 2005 @@ -85,8 +85,6 @@ test_all.py is just another name for `py.test`_ which is the testing tool that we are using and enhancing for PyPy. -.. _`py.test`: http://codespeak.net/py/current/doc/test.html - Filing bugs or feature requests ------------------------------- @@ -324,7 +322,7 @@ avaiable in C (e.g. int) with low level versions. This can be ommited if no annotation (step 4) has been performed. -6. If you feel adventureous (and have LLVM installed and on your path) you can +6. If you feel adventureous (and have `LLVM installed`_ and on your path) you can also try to compile the graph with LLVM. This is still quite experimental and only works with some functions: One of the most visible restriction is that return type of the entry function has to be and int, float or bool. To @@ -427,48 +425,66 @@ Additional Tools for running (and hacking) PyPy ----------------------------------------------- -We use some optional tools for working on pypy. They are not required to run +We use some optional tools for developing PyPy. They are not required to run the basic tests or to get an interactive PyPy prompt but they help to understand and debug PyPy especially for the ongoing translation work. -Recommended tools -+++++++++++++++++ +graphviz & pygame for flowgraph viewing (highly recommended) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -*graphviz* +graphviz and pygame are both neccessary if you +want to look at generated flowgraphs: - (used for visualizing the control-flow) - http://www.research.att.com/sw/tools/graphviz/download.html + graphviz: http://www.research.att.com/sw/tools/graphviz/download.html -*pygame* + pygame: http://www.pygame.org/download.shtml - (to visualize control flow and annotation analysis of python programs) - http://www.pygame.org/download.shtml +.. _`LLVM installed`: -Optional tools -++++++++++++++ +LLVM ++++++ -*llvm* +LLVM is used by the optional `PyPy/LLVM backend`_ to generate processor +indepdendant machine level code for the `low level virtual machine`_ +to generate processor independant machine level code. LLVM can be quite +annoying to install: you need a fairly recent version of GCC to compile +it and there can be severe problems under windows. Here are detailed +instructions on how to install: - (used for the optional LLVM translation backend) - One of our backends uses the `low level virtual machine`_ to generate - processor independant machine level code. + http://llvm.cs.uiuc.edu/docs/GettingStarted.html - LLVM can be quite annoying to install: you need a fairly recent version of - GCC to compile it and there can be severe problems under windows. There are - detailed instructions on `how to install LLVM`_. To use the LLVM backend - of PyPy you don't need the GCC front end of LLVM, only LLVM itself. If you - run into problems with the installation the `LLVM mailing list`_ is very - helpful and friendly. +**NOTE: To use the LLVM backend of PyPy you don't need the GCC front end +of LLVM, only LLVM itself**. If you run into problems with the installation +the `LLVM mailing list`_ is very helpful and friendly. Note also that +the PyPy LLVM backend was developed using LLVM 1.4 but it seems to work +with LLVM 1.5. Nobody ever tried an older version. - Note that the PyPy LLVM backend was developed using LLVM 1.4 and it seems - to work with LLVM 1.5. Nobody ever tried an older version. +CLISP ++++++++ -*CLISP* +The CLISP backend is optional and not quite uptodate with the rest of +PyPy. Still there are a few examples you can try our backend out on. +Here is a link of a version that should work: - (used for the optional Lisp translation backend) http://clisp.cons.org/ +.. _`py.test`: + +py.test and the py lib ++++++++++++++++++++++++ + +The `py library`_ is used for supporting PyPy development and +running our tests against code and documentation as well as +compliancy tests. You don't need to install the py library because +it ships with PyPy and `pypy/test_all.py`_ is an alias for ``py.test`` +but if you want to have the ``py.test`` tool generally in your +path, you might like to visit: + + http://codespeak.net/py/current/doc/getting-started.html + +.. _`py library`: http://codespeak.net/py +.. _`PyPy/LLVM backend`: translation.html#llvm .. _`low level virtual machine`: http://llvm.cs.uiuc.edu/ .. _`how to install LLVM`: http://llvm.cs.uiuc.edu/docs/GettingStarted.html .. _`LLVM mailing list`: http://mail.cs.uiuc.edu/mailman/listinfo/llvmdev From hpk at codespeak.net Fri May 20 12:20:11 2005 From: hpk at codespeak.net (hpk at codespeak.net) Date: Fri, 20 May 2005 12:20:11 +0200 (CEST) Subject: [pypy-svn] r12610 - pypy/dist/pypy/documentation Message-ID: <20050520102011.0A9AA27B7B@code1.codespeak.net> Author: hpk Date: Fri May 20 12:20:10 2005 New Revision: 12610 Modified: pypy/dist/pypy/documentation/release-0.6.txt Log: issue16 resolved removing the somewhat strange reference to the "codespeak.net umbrella" although the weather is not nice right now and an umbrella wouldn't hurt and i also wouldn't mind some free advertisement. But it's a bit ouf ot context here (or am i missing something?). Closing this issue. If you want the umbrella, reinsert it. Modified: pypy/dist/pypy/documentation/release-0.6.txt ============================================================================== --- pypy/dist/pypy/documentation/release-0.6.txt (original) +++ pypy/dist/pypy/documentation/release-0.6.txt Fri May 20 12:20:10 2005 @@ -102,10 +102,9 @@ Carl Friedrich Bolz - PyPy development and activities happen as an open source project under - the http://codespeak.net/ umbrella and with the support of a - consortium funded by a EU IST research grant. Here is a list of - partners of the EU project: + PyPy development and activities happen as an open source project + and with the support of a consortium funded by a two year EU IST + research grant. Here is a list of partners of the EU project: Heinrich-Heine University (Germany), AB Strakt (Sweden) From ale at codespeak.net Fri May 20 12:39:59 2005 From: ale at codespeak.net (ale at codespeak.net) Date: Fri, 20 May 2005 12:39:59 +0200 (CEST) Subject: [pypy-svn] r12612 - pypy/dist/pypy/documentation Message-ID: <20050520103959.840E327B4C@code1.codespeak.net> Author: ale Date: Fri May 20 12:39:59 2005 New Revision: 12612 Modified: pypy/dist/pypy/documentation/coding-guide.txt Log: typo Modified: pypy/dist/pypy/documentation/coding-guide.txt ============================================================================== --- pypy/dist/pypy/documentation/coding-guide.txt (original) +++ pypy/dist/pypy/documentation/coding-guide.txt Fri May 20 12:39:59 2005 @@ -247,7 +247,7 @@ of its argument, masking away anything that doesn't fit in a C "signed long int". Its purpose is, in Python, to convert from a Python ``long`` that resulted from a previous operation back to a Python ``int``. The code generators ignore - intmask() entierely, as they are doing wrap-around signed arithmetic all the time + intmask() entirely, as they are doing wrap-around signed arithmetic all the time by default anyway. (We have no equivalent of the "int" versus "long int" distinction of C at the moment and assume "long ints" everywhere.) From hpk at codespeak.net Fri May 20 12:43:44 2005 From: hpk at codespeak.net (hpk at codespeak.net) Date: Fri, 20 May 2005 12:43:44 +0200 (CEST) Subject: [pypy-svn] r12613 - pypy/dist/pypy/documentation Message-ID: <20050520104344.0433127B4C@code1.codespeak.net> Author: hpk Date: Fri May 20 12:43:44 2005 New Revision: 12613 Added: pypy/dist/pypy/documentation/extradoc.txt - copied, changed from r12610, pypy/dist/pypy/documentation/index.txt Modified: pypy/dist/pypy/documentation/getting_started.txt pypy/dist/pypy/documentation/index.txt Log: issue65 resolved issue37 testing - moved the directory reference to the main 'doc' page - created a new 'extradoc' document listing talks and related projects and linked that document from the main doc page. - refactored getting_started.txt - refers to the directory reference - second too large chapter is split (i intend to do a bit of more work on this and then close issue37 as well) Copied: pypy/dist/pypy/documentation/extradoc.txt (from r12610, pypy/dist/pypy/documentation/index.txt) ============================================================================== --- pypy/dist/pypy/documentation/index.txt (original) +++ pypy/dist/pypy/documentation/extradoc.txt Fri May 20 12:43:44 2005 @@ -1,38 +1,7 @@ ================================================= -PyPy - a Python_ implementation written in Python +PyPy - talks and related projects ================================================= -.. _Python: http://www.python.org/dev/doc/maint24/ref/ref.html - -architecture_ gives a complete view of PyPy's basic design. - -`getting started`_ provides hands-on instructions -including a two-liner to run PyPy on your system. - -`coding guide`_ helps you to write code for PyPy. - -`object spaces`_ discusses the object space interface -and several implementations. - -`translation`_ offers the beginnings of documentation -about our low level code generator backends. - -`compliance test status`_ shows outcome information -about recent runs of CPython's regression tests against PyPy. - -`license`_ tells you that basically all of PyPy is licensed -under the OSI-approved very liberal MIT-license. - -.. _`license`: http://codespeak.net/svn/pypy/dist/LICENSE -.. _`compliance test status`: http://codespeak.net/~hpk/pypy-testresult/ -.. _`object spaces`: objspace.html -.. _`translation`: translation.html -.. _`coding guide`: coding-guide.html -.. _`architecture`: architecture.html -.. _`revision report`: http://codespeak.net/pypy/rev/current -.. _`getting started`: getting_started.html -.. _`theory`: theory.html - Talks and Presentations ---------------------------------- Modified: pypy/dist/pypy/documentation/getting_started.txt ============================================================================== --- pypy/dist/pypy/documentation/getting_started.txt (original) +++ pypy/dist/pypy/documentation/getting_started.txt Fri May 20 12:43:44 2005 @@ -63,6 +63,7 @@ for some guidance on how to continue. .. _`help on installing subversion`: svn-help.html +.. _subversion: svn-help.html Understanding PyPy's architecture --------------------------------- @@ -374,11 +375,12 @@ .. _`start reading sources`: Where to start reading the sources ----------------------------------- +================================== PyPy is made from parts that are relatively independent from each other. You should start looking at the part that attracts you most (all parts are -relative to the PyPy toplevel directory): +relative to the PyPy toplevel directory). You may look at our `directory reference`_ +or start off at one of the following points: * `pypy/interpreter`_ contains the basic interpreter: bytecode dispatcher in pyopcode.py_, frame and code objects in eval.py_ and pyframe.py_, @@ -405,21 +407,6 @@ `pypy/translator/annrpython.py`_. -To learn more -------------- - -* To learn more about PyPy and its development process, - read around in the documentation_ and consider - subscribing to the `mailing lists`_ (or simply - read the archives online) - -* show up on irc.freenode.net:6667, channel #pypy and ask - questions. The logs of the channel can be found at - http://nimrod.terra-link.net/pypy/_. - -* To help PyPy become Python-the-next-generation, you - are invited to participate in its development. - .. _optionaltool: Additional Tools for running (and hacking) PyPy @@ -513,104 +500,22 @@ .. _unit tests: http://codespeak.net/pypy/index.cgi?doc/testdesign.html .. _bug reports: https://codespeak.net/issue/pypy-dev/ +.. _`directory reference`: index.html#directory-reference -.. _`directory reference`: - -PyPy directory reference -====================================================== - -Here is a fully referenced alphabetical two-level deep -directory overview of PyPy: - -============================ =========================================== -Directory explanation/links -============================ =========================================== -`annotation/`_ `type inferencing code`_ for `RPython`_ programs - -`documentation/`_ text versions of PyPy `documentation`_ files shown on the website - -`documentation/revreport/`_ the source code for the `revision report`_ - -`documentation/website/`_ text versions of the navigation webpages - -`interpreter/`_ bytecode interpreter and related objects (frames, functions, modules,...) - -`lib/`_ PyPy's wholesale reimplementations of CPython modules_ - -`lib/test2/`_ tests running at interp-level against the reimplementations - -`module/`_ contains `mixed modules`_ implementing core modules with - both application and interpreter level code - -`module/_sre_pypy/`_ an experimental approach wrapping CPython's ``_sre`` module - without using faking - -`module/__builtin__/`_ full implementation of CPython's ``__builtin__`` module. - -`module/parser/`_ parser package from Jonathan David Riehl's `basil`_ package - -`module/recparser/`_ parser package from Logilab - -`module/sys/`_ implementation of CPython's ``sys`` module. +To learn more / get in contact +============================== -`objspace/`_ `object space`_ implementations - -`objspace/trace.py`_ the `trace object space`_ monitoring bytecode and space operations - -`objspace/thunk.py`_ the `thunk object space`_, providing unique object features - -`objspace/flow/`_ the FlowObjSpace_ implementing `abstract interpretation` - -`objspace/std/`_ the StdObjSpace_ implementing CPython's objects and types - -`rpython/`_ the `RPython Typer`_ - -`tool/`_ various utilities and hacks used from various places - -`tool/pytest/`_ support code for our `testing methods`_ - -`tool/tb_server/`_ a somewhat outdated http-server for presenting - tracebacks in a helpful manner - -`translator/`_ translation_ backends and support code - -`translator/genc/`_ the `GenC backend`_ producing a CPython C-extension - module from a given RPython program. - -`translator/java/`_ experimental code to utilize Java for annotation - -`translator/llvm/`_ contains the `LLVM backend`_ producing LLVM assembler - from fully annotated RPython programs - -`translator/tool/`_ helper tools for translation - -``*/test/`` many directories have a test subdirectory containing test - modules (see `Testing in PyPy`_) - -``_cache/`` holds cache files from internally translating application - level to interpreterlevel code. (XXXM0.5 insert link here - when geninterp documentation is there). -============================ =========================================== - -.. _`Testing in PyPy`: coding-guide.html#testing-in-pypy -.. _`mixed modules`: coding-guide.html#mixed-modules -.. _`modules`: coding-guide.html#modules -.. _`basil`: http://people.cs.uchicago.edu/~jriehl/BasilTalk.pdf -.. _`object space`: objspace.html -.. _FlowObjSpace: objspace.html#the-flow-object-space -.. _`trace object space`: objspace.html#the-trace-object-space -.. _`thunk object space`: objspace.html#the-thunk-object-space -.. _StdObjSpace: objspace.html#the-standard-object-space -.. _`abstract interpretation`: theory.html#abstract-interpretation -.. _`rpython`: coding-guide.html#rpython -.. _`type inferencing code`: translation.html#the-annotation-pass -.. _`RPython Typer`: translation.html#rpython-typer -.. _`testing methods`: coding-guide.html#testing-in-pypy -.. _`translation`: translation.html -.. _`GenC backend`: translation.html#genc -.. _`LLVM backend`: translation.html#llvm -.. _`revision report`: http://codespeak.net/pypy/rev/current +* To learn more about PyPy and its development process, + read around in the documentation_ and consider + subscribing to the `mailing lists`_ (or simply + read the archives online) + +* show up on irc.freenode.net:6667, channel #pypy and ask + questions. The logs of the channel can be found at + http://nimrod.terra-link.net/pypy/ -.. _subversion: svn-help.html +* To help PyPy become Python-the-next-generation, you + are invited to participate in its development. + .. include:: _ref.txt Modified: pypy/dist/pypy/documentation/index.txt ============================================================================== --- pypy/dist/pypy/documentation/index.txt (original) +++ pypy/dist/pypy/documentation/index.txt Fri May 20 12:43:44 2005 @@ -17,12 +17,16 @@ `translation`_ offers the beginnings of documentation about our low level code generator backends. +`talks and related projects`_ lists presentations +and related projects. + `compliance test status`_ shows outcome information about recent runs of CPython's regression tests against PyPy. `license`_ tells you that basically all of PyPy is licensed under the OSI-approved very liberal MIT-license. +.. _`talks and related projects`: extradoc.html .. _`license`: http://codespeak.net/svn/pypy/dist/LICENSE .. _`compliance test status`: http://codespeak.net/~hpk/pypy-testresult/ .. _`object spaces`: objspace.html @@ -33,64 +37,104 @@ .. _`getting started`: getting_started.html .. _`theory`: theory.html -Talks and Presentations ----------------------------------- -* oscon2003-paper_ an early paper presented at Oscon 2003 describing - what the PyPy project is about and why you should care. +.. _`directory reference`: + +PyPy directory cross-reference +====================================================== + +Here is a fully referenced alphabetical two-level deep +directory overview of PyPy: + +============================ =========================================== +Directory explanation/links +============================ =========================================== +`annotation/`_ `type inferencing code`_ for `RPython`_ programs + +`documentation/`_ text versions of PyPy `documentation`_ files shown on the website + +`documentation/revreport/`_ the source code for the `revision report`_ + +`documentation/website/`_ text versions of the navigation webpages + +`interpreter/`_ bytecode interpreter and related objects (frames, functions, modules,...) + +`lib/`_ PyPy's wholesale reimplementations of CPython modules_ + +`lib/test2/`_ tests running at interp-level against the reimplementations + +`module/`_ contains `mixed modules`_ implementing core modules with + both application and interpreter level code + +`module/_sre_pypy/`_ an experimental approach wrapping CPython's ``_sre`` module + without using faking + +`module/__builtin__/`_ full implementation of CPython's ``__builtin__`` module. + +`module/parser/`_ parser package from Jonathan David Riehl's `basil`_ package + +`module/recparser/`_ parser package from Logilab + +`module/sys/`_ implementation of CPython's ``sys`` module. + +`objspace/`_ `object space`_ implementations + +`objspace/trace.py`_ the `trace object space`_ monitoring bytecode and space operations + +`objspace/thunk.py`_ the `thunk object space`_, providing unique object features + +`objspace/flow/`_ the FlowObjSpace_ implementing `abstract interpretation` + +`objspace/std/`_ the StdObjSpace_ implementing CPython's objects and types + +`rpython/`_ the `RPython Typer`_ + +`tool/`_ various utilities and hacks used from various places + +`tool/pytest/`_ support code for our `testing methods`_ + +`tool/tb_server/`_ a somewhat outdated http-server for presenting + tracebacks in a helpful manner + +`translator/`_ translation_ backends and support code + +`translator/genc/`_ the `GenC backend`_ producing a CPython C-extension + module from a given RPython program. + +`translator/java/`_ experimental code to utilize Java for annotation + +`translator/llvm/`_ contains the `LLVM backend`_ producing LLVM assembler + from fully annotated RPython programs + +`translator/tool/`_ helper tools for translation + +``*/test/`` many directories have a test subdirectory containing test + modules (see `Testing in PyPy`_) + +``_cache/`` holds cache files from internally translating application + level to interpreterlevel code. (XXXM0.5 insert link here + when geninterp documentation is there). +============================ =========================================== + +.. _documentation: index.html +.. _`Testing in PyPy`: coding-guide.html#testing-in-pypy +.. _`mixed modules`: coding-guide.html#mixed-modules +.. _`modules`: coding-guide.html#modules +.. _`basil`: http://people.cs.uchicago.edu/~jriehl/BasilTalk.pdf +.. _`object space`: objspace.html +.. _FlowObjSpace: objspace.html#the-flow-object-space +.. _`trace object space`: objspace.html#the-trace-object-space +.. _`thunk object space`: objspace.html#the-thunk-object-space +.. _StdObjSpace: objspace.html#the-standard-object-space +.. _`abstract interpretation`: theory.html#abstract-interpretation +.. _`rpython`: coding-guide.html#rpython +.. _`type inferencing code`: translation.html#the-annotation-pass +.. _`RPython Typer`: translation.html#rpython-typer +.. _`testing methods`: coding-guide.html#testing-in-pypy +.. _`translation`: translation.html +.. _`GenC backend`: translation.html#genc +.. _`LLVM backend`: translation.html#llvm +.. _`revision report`: http://codespeak.net/pypy/rev/current -* `Architecture introduction slides`_ a mostly up-to-date - introduction for the Amsterdam PyPy-Sprint Dec 2003. -* `EU funding for FOSS`_ talk on Chaos Communication - Conference in Berlin, Dec 2004. - -* `py lib slides`_ from the py lib talk at Pycon 2005 - (py is used as a support/testing library for PyPy). - -.. _oscon2003-paper: http://codespeak.net/pypy/index.cgi?extradoc/talk/oscon2003-paper.html -.. _`Architecture introduction slides`: http://codespeak.net/svn/pypy/extradoc/talk/amsterdam-sprint-intro.pdf -.. _`EU funding for FOSS`: http://codespeak.net/svn/pypy/extradoc/talk/2004-21C3-pypy-EU-hpk.pdf -.. _`py lib slides`: http://codespeak.net/svn/pypy/extradoc/talk/2005-pycon-py.pdf - -Related projects ----------------------------------- - -* Dynamo_ showcased `transparent dynamic optimization`_ - generating an optimized version of a binary program at runtime. - -* Tailoring Dynamo_ to interpreter implementations and challenges - - Gregory Sullivan et. al., - `Dynamic Native Optimization of Native Interpreters`_. IVME 03. 2003. - -* JikesRVM_ a research dynamic optimizing Java VM written in Java. - -* `Squeak`_ is a Smalltalk-80 implementation written in - Smalltalk, being used in `Croquet`_, an experimental - distributed multi-user/multi-programmer virtual world. - -* `LLVM`_ the low level virtual machine project. - -* spyweb_ translates Python programs to Scheme. - -* `Iron Python`_ a new Python implementation compiling Python into - Microsofts Common Language Runtime (CLR) Intermediate Language (IL). - -* `GNU lightning`_ generates assembly language at runtime. - - -.. _`Squeak`: http://www.squeak.org/ -.. _`Croquet`: http://www.opencroquet.org/ -.. _`Iron Python`: http://www.gotdotnet.com/workspaces/workspace.aspx?id=ad7acff7-ab1e-4bcb-99c0-57ac5a3a9742 -.. _`transparent dynamic optimization`: http://www.hpl.hp.com/techreports/1999/HPL-1999-77.pdf -.. _Dynamo: http://www.hpl.hp.com/techreports/1999/HPL-1999-78.pdf -.. _optionaltool: http://codespeak.net/pypy/index.cgi?doc/optionaltool.html -.. _testdesign: http://codespeak.net/pypy/index.cgi?doc/testdesign.html -.. _feasible: http://codespeak.net/pipermail/pypy-dev/2004q2/001289.html -.. _rock: http://codespeak.net/pipermail/pypy-dev/2004q1/001255.html -.. _spyweb: http://spyweb.hopto.org/ -.. _`GNU lightning`: http://www.gnu.org/software/lightning/lightning.html -.. _LLVM: http://llvm.cs.uiuc.edu/ -.. _IronPython: http://www.python.org/pycon/dc2004/papers/9/ -.. _`Dynamic Native Optimization of Native Interpreters`: http://www.ai.mit.edu/~gregs/dynamorio.html -.. _JikesRVM: http://jikesrvm.sf.net +.. include:: _ref.txt From hpk at codespeak.net Fri May 20 12:48:46 2005 From: hpk at codespeak.net (hpk at codespeak.net) Date: Fri, 20 May 2005 12:48:46 +0200 (CEST) Subject: [pypy-svn] r12615 - pypy/dist/pypy/documentation Message-ID: <20050520104846.7C15D27B4D@code1.codespeak.net> Author: hpk Date: Fri May 20 12:48:46 2005 New Revision: 12615 Modified: pypy/dist/pypy/documentation/index.txt Log: shorten sentences a bit. Modified: pypy/dist/pypy/documentation/index.txt ============================================================================== --- pypy/dist/pypy/documentation/index.txt (original) +++ pypy/dist/pypy/documentation/index.txt Fri May 20 12:48:46 2005 @@ -20,11 +20,10 @@ `talks and related projects`_ lists presentations and related projects. -`compliance test status`_ shows outcome information -about recent runs of CPython's regression tests against PyPy. +`compliance test status`_ shows outcomes of +recent compliance test runs against PyPy. -`license`_ tells you that basically all of PyPy is licensed -under the OSI-approved very liberal MIT-license. +`license`_ contains licensing details (basically a straight MIT-license). .. _`talks and related projects`: extradoc.html .. _`license`: http://codespeak.net/svn/pypy/dist/LICENSE From hpk at codespeak.net Fri May 20 13:03:50 2005 From: hpk at codespeak.net (hpk at codespeak.net) Date: Fri, 20 May 2005 13:03:50 +0200 (CEST) Subject: [pypy-svn] r12616 - pypy/dist/pypy/documentation Message-ID: <20050520110350.0A8E227B5F@code1.codespeak.net> Author: hpk Date: Fri May 20 13:03:49 2005 New Revision: 12616 Modified: pypy/dist/pypy/documentation/getting_started.txt Log: issue37 done-cbb after a last reshuffling i am kind of happy with the getting-started document although i think that the 'trying out the translator' chapter is not nicely formatted. Modified: pypy/dist/pypy/documentation/getting_started.txt ============================================================================== --- pypy/dist/pypy/documentation/getting_started.txt (original) +++ pypy/dist/pypy/documentation/getting_started.txt Fri May 20 13:03:49 2005 @@ -107,7 +107,7 @@ got a release) or pypy-dist (if you checked out the most recent version using subversion). -Main entry point / special PyPy features +Main entry point ------------------------------------------ The py.py interpreter @@ -153,6 +153,9 @@ python py.py ../../lib-python/modified-2.3.4/test/pystone.py 10 +special PyPy features +-------------------------- + Interpreter-level console +++++++++++++++++++++++++ @@ -371,11 +374,8 @@ python translate_pypy.py targetrpystone2 - -.. _`start reading sources`: - Where to start reading the sources -================================== +---------------------------------- PyPy is made from parts that are relatively independent from each other. You should start looking at the part that attracts you most (all parts are @@ -470,6 +470,22 @@ http://codespeak.net/py/current/doc/getting-started.html + + +.. _`start reading sources`: + +Getting involved +================================== + +PyPy employs an open development process. You are invited +to join our `pypy-dev mailing list`_ or look at the other +`contact possibilities`_. We are also doing coding Sprints +which are separatedly announced and often happen around Python +conferences such as EuroPython or Pycon. + +.. _`pypy-dev mailing list`: http://codespeak.net/mailman/listinfo/pypy-dev +.. _`contact possibilities`: http://codespeak.net/pypy/index.cgi?contact + .. _`py library`: http://codespeak.net/py .. _`PyPy/LLVM backend`: translation.html#llvm .. _`low level virtual machine`: http://llvm.cs.uiuc.edu/ @@ -502,20 +518,4 @@ .. _`directory reference`: index.html#directory-reference -To learn more / get in contact -============================== - -* To learn more about PyPy and its development process, - read around in the documentation_ and consider - subscribing to the `mailing lists`_ (or simply - read the archives online) - -* show up on irc.freenode.net:6667, channel #pypy and ask - questions. The logs of the channel can be found at - http://nimrod.terra-link.net/pypy/ - -* To help PyPy become Python-the-next-generation, you - are invited to participate in its development. - - .. include:: _ref.txt From hpk at codespeak.net Fri May 20 13:06:20 2005 From: hpk at codespeak.net (hpk at codespeak.net) Date: Fri, 20 May 2005 13:06:20 +0200 (CEST) Subject: [pypy-svn] r12617 - pypy/dist/pypy/documentation Message-ID: <20050520110620.8884627B71@code1.codespeak.net> Author: hpk Date: Fri May 20 13:06:20 2005 New Revision: 12617 Modified: pypy/dist/pypy/documentation/getting_started.txt Log: clarify LISP reference Modified: pypy/dist/pypy/documentation/getting_started.txt ============================================================================== --- pypy/dist/pypy/documentation/getting_started.txt (original) +++ pypy/dist/pypy/documentation/getting_started.txt Fri May 20 13:06:20 2005 @@ -451,7 +451,7 @@ The CLISP backend is optional and not quite uptodate with the rest of PyPy. Still there are a few examples you can try our backend out on. -Here is a link of a version that should work: +Here is a link to a LISP implementation that should basically work: http://clisp.cons.org/ From hpk at codespeak.net Fri May 20 13:13:21 2005 From: hpk at codespeak.net (hpk at codespeak.net) Date: Fri, 20 May 2005 13:13:21 +0200 (CEST) Subject: [pypy-svn] r12618 - in pypy/dist/pypy/documentation: . tool Message-ID: <20050520111321.2D1E227B5F@code1.codespeak.net> Author: hpk Date: Fri May 20 13:13:21 2005 New Revision: 12618 Modified: pypy/dist/pypy/documentation/_ref.txt pypy/dist/pypy/documentation/index.txt pypy/dist/pypy/documentation/tool/makeref.py Log: issue48 resolved issue53 testing directory description is resolved, i just made the documentation reference the issue40 (geninterp documentation). Speaking of which: you can now simply reference `issueNN`_ and run pypy/documentation/tool/makeref.py to generate all needed references. Modified: pypy/dist/pypy/documentation/_ref.txt ============================================================================== --- pypy/dist/pypy/documentation/_ref.txt (original) +++ pypy/dist/pypy/documentation/_ref.txt Fri May 20 13:13:21 2005 @@ -1,3 +1,4 @@ +.. _`issue40`: http://codespeak.net/issue/pypy-dev/issue40 .. _`demo/`: http://codespeak.net/svn/pypy/dist/demo .. _`lib-python/`: http://codespeak.net/svn/pypy/dist/lib-python .. _`pypy/annotation`: Modified: pypy/dist/pypy/documentation/index.txt ============================================================================== --- pypy/dist/pypy/documentation/index.txt (original) +++ pypy/dist/pypy/documentation/index.txt Fri May 20 13:13:21 2005 @@ -111,7 +111,8 @@ modules (see `Testing in PyPy`_) ``_cache/`` holds cache files from internally translating application - level to interpreterlevel code. (XXXM0.5 insert link here + level to interpreterlevel code. (insert link when + `issue40`_ is resolved). when geninterp documentation is there). ============================ =========================================== Modified: pypy/dist/pypy/documentation/tool/makeref.py ============================================================================== --- pypy/dist/pypy/documentation/tool/makeref.py (original) +++ pypy/dist/pypy/documentation/tool/makeref.py Fri May 20 13:13:21 2005 @@ -5,6 +5,7 @@ pypydir = py.path.local(pypy.__file__).dirpath() distdir = pypydir.dirpath() dist_url = 'http://codespeak.net/svn/pypy/dist/' +issue_url = 'http://codespeak.net/issue/pypy-dev/' docdir = pypydir.join('documentation') reffile = pypydir.join('documentation', '_ref.txt') @@ -22,16 +23,17 @@ for textfile in docdir.visit(lambda x: x.ext == '.txt', lambda x: x.check(dotfile=0)): for linkname in linkrex.findall(textfile.read()): - if '/' not in linkname: - continue - for startloc in ('', 'pypy'): - cand = distdir.join(startloc, linkname) - if cand.check(): - target = dist_url + cand.relto(distdir) - addlink(linkname, target) - break - else: - print "WARNING %s: link %r may be bogus" %(textfile, linkname) + if '/' in linkname: + for startloc in ('', 'pypy'): + cand = distdir.join(startloc, linkname) + if cand.check(): + target = dist_url + cand.relto(distdir) + addlink(linkname, target) + break + else: + print "WARNING %s: link %r may be bogus" %(textfile, linkname) + elif linkname.startswith('issue'): + addlink(linkname, issue_url+linkname) items = name2target.items() items.sort() From hpk at codespeak.net Fri May 20 13:14:00 2005 From: hpk at codespeak.net (hpk at codespeak.net) Date: Fri, 20 May 2005 13:14:00 +0200 (CEST) Subject: [pypy-svn] r12619 - pypy/dist/pypy/documentation Message-ID: <20050520111400.E1C9727B5F@code1.codespeak.net> Author: hpk Date: Fri May 20 13:14:00 2005 New Revision: 12619 Modified: pypy/dist/pypy/documentation/index.txt Log: removed bogus line Modified: pypy/dist/pypy/documentation/index.txt ============================================================================== --- pypy/dist/pypy/documentation/index.txt (original) +++ pypy/dist/pypy/documentation/index.txt Fri May 20 13:14:00 2005 @@ -113,7 +113,6 @@ ``_cache/`` holds cache files from internally translating application level to interpreterlevel code. (insert link when `issue40`_ is resolved). - when geninterp documentation is there). ============================ =========================================== .. _documentation: index.html From arigo at codespeak.net Fri May 20 13:24:46 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Fri, 20 May 2005 13:24:46 +0200 (CEST) Subject: [pypy-svn] r12620 - pypy/dist/pypy/module/__builtin__ Message-ID: <20050520112446.A23E027B55@code1.codespeak.net> Author: arigo Date: Fri May 20 13:24:46 2005 New Revision: 12620 Modified: pypy/dist/pypy/module/__builtin__/app_inspect.py Log: No need to import __builtin__; it's our current builtins here. Modified: pypy/dist/pypy/module/__builtin__/app_inspect.py ============================================================================== --- pypy/dist/pypy/module/__builtin__/app_inspect.py (original) +++ pypy/dist/pypy/module/__builtin__/app_inspect.py Fri May 20 13:24:46 2005 @@ -80,13 +80,11 @@ return False def callable(ob): - import __builtin__ for c in type(ob).__mro__: if '__call__' in c.__dict__: - # after do_imports_immediately is always true, - # this is no longer RPython, because _instance - # does not exist at compile time. - if isinstance(ob, __builtin__._instance): # old style instance! + # NB. this is not RPython, because _instance + # does not exist when the flow graph sees it + if isinstance(ob, _instance): # old style instance! return getattr(ob, '__call__', None) is not None return True else: From hpk at codespeak.net Fri May 20 13:26:25 2005 From: hpk at codespeak.net (hpk at codespeak.net) Date: Fri, 20 May 2005 13:26:25 +0200 (CEST) Subject: [pypy-svn] r12621 - pypy/dist/pypy/documentation Message-ID: <20050520112625.652E127B55@code1.codespeak.net> Author: hpk Date: Fri May 20 13:26:25 2005 New Revision: 12621 Modified: pypy/dist/pypy/documentation/coding-guide.txt Log: typo and ReST fixing to match the style used throughout the rest of the documentation. Modified: pypy/dist/pypy/documentation/coding-guide.txt ============================================================================== --- pypy/dist/pypy/documentation/coding-guide.txt (original) +++ pypy/dist/pypy/documentation/coding-guide.txt Fri May 20 13:26:25 2005 @@ -332,23 +332,44 @@ Naming conventions ------------------ -* ``space``: the object space is only visible at interpreter-level, where it is by convention in a variable called ``space``. +* ``space``: the object space is only visible at + interpreter-level code, where it is by convention passed around by the name ``space``. -* ``w_xxx``: any object seen by application-level code is an object explicitely managed by the object space. From the interpreter-level point of view, this is called a *wrapped* object. The ``w_`` prefix is used for any type of application-level object. - -* ``xxx_w``: an interpreter-level container for wrapped objects, for example a list or a dict containing wrapped objects. Not to be confused with a wrapped object that would be a list or a dict: these are normal wrapped objects, so they use the ``w_`` prefix. +* ``w_xxx``: any object seen by application-level code is an + object explicitely managed by the object space. From the + interpreter-level point of view, this is called a *wrapped* + object. The ``w_`` prefix is used for any type of + application-level object. + +* ``xxx_w``: an interpreter-level container for wrapped + objects, for example a list or a dict containing wrapped + objects. Not to be confused with a wrapped object that + would be a list or a dict: these are normal wrapped objects, + so they use the ``w_`` prefix. Operations on ``w_xxx`` ----------------------- -The core interpreter considers wrapped objects as black boxes. It is not allowed to inspect them directly. The allowed operations are all dependent on the object space: they are called ``space.xxx()``, where ``xxx`` is a standard operation name (``add``, ``getattr``, ``call``, ``eq``...). The list of standard operations is found in the large table near the end of ``pypy.interpreter.baseobjspace``. These operations take wrapped arguments and return a wrapped result (or sometimes just None). +The core interpreter considers wrapped objects as black boxes. +It is not allowed to inspect them directly. The allowed +operations are all implemented on the object space: they are +called ``space.xxx()``, where ``xxx`` is a standard operation +name (``add``, ``getattr``, ``call``, ``eq``...). The list of +standard operations is found in the large table near the end +of ``pypy.interpreter.baseobjspace``. These operations take +wrapped arguments and return a wrapped result (or sometimes +just None). Also note some helpers: -* ``space.call_function(w_callable, ...)``: collects the given (already-wrapped) arguments, builds a wrapped tuple for them, and uses ``space.call()`` to perform the call. - -* ``space.call_method(w_object, 'method', ...)``: uses ``space.getattr()`` to get the method object, and then ``space.call_function()`` to invoke it. +* ``space.call_function(w_callable, ...)``: collects the given + (already-wrapped) arguments, builds a wrapped tuple for + them, and uses ``space.call()`` to perform the call. + +* ``space.call_method(w_object, 'method', ...)``: uses + ``space.getattr()`` to get the method object, and then + ``space.call_function()`` to invoke it. Building ``w_xxx`` objects @@ -356,53 +377,110 @@ From the core interpreter, wrapped objects are usually built as the result of an object space operation. The ways to directly create a wrapped object are: -* ``space.wrap(x)``: returns a wrapped object containing the value ``x``. Only works if ``x`` is either a simple value (integer, float, string) or an instance of an internal interpreter class (Function, Code, Frame...). - -* ``space.newlist([w_x, w_y, w_z...])``: returns a wrapped list from a list of already-wrapped objects. - -* ``space.newtuple([w_x, w_y, w_z...])``: returns a wrapped tuple from a list of already-wrapped objects. +* ``space.wrap(x)``: returns a wrapped object containing the + value ``x``. Only works if ``x`` is either a simple value + (integer, float, string) or an instance of an internal + interpreter class (Function, Code, Frame...). + +* ``space.newlist([w_x, w_y, w_z...])``: returns a wrapped + list from a list of already-wrapped objects. + +* ``space.newtuple([w_x, w_y, w_z...])``: returns a wrapped + tuple from a list of already-wrapped objects. + +* ``space.newdict([])``: returns a new, empty wrapped + dictionary. (The argument list can contain tuples ``(w_key, + w_value)`` but it seems that such a use is not common.) -* ``space.newdict([])``: returns a new, empty wrapped dictionary. (The argument list can contain tuples ``(w_key, w_value)`` but it seems that such a use is not common.) +* ``space.newbool(x)``: returns ``space.w_False`` or + ``space.w_True`` depending on the truth value of ``x``. -* ``space.newbool(x)``: returns ``space.w_False`` or ``space.w_True`` depending on the truth value of ``x``. - -There are a few less common constructors, described in the comments at the end of ``pypy.interpreter.baseobjspace``. +There are a few less common constructors, described in the +comments at the end of ``pypy.interpreter.baseobjspace``. Constant ``w_xxx`` objects -------------------------- -The object space holds a number of predefined wrapped objects. The most common ones are ``space.w_None`` and ``space.w_XxxError`` for each exception class ``XxxError`` (e.g. ``space.w_KeyError``, ``space.w_IndexError``, etc.). +The object space holds a number of predefined wrapped objects. +The most common ones are ``space.w_None`` and +``space.w_XxxError`` for each exception class ``XxxError`` +(e.g. ``space.w_KeyError``, ``space.w_IndexError``, etc.). Inspecting ``w_xxx`` objects ---------------------------- -The most delicate operation is for the interpreter to inspect a wrapped object, which must be done via the object space. - -* ``space.is_true(w_x)``: checks if the given wrapped object is considered to be ``True`` or ``False``. You must never use the truth-value of ``w_x`` directly; doing so (e.g. writing ``if w_x:``) will give you an error reminding you of the problem. - -* ``w_x == w_y`` or ``w_x is w_y``: DON'T DO THAT. The only half-official exception is to check if ``w_x`` contains a wrapped ``None``: you can write ``w_x == space.w_None``. Follow this rule; the case of ``None`` is easy to fix globally later if we find out that we need to. The rationale for this rule is that there is no reason that two wrappers are related in any way even if they contain what looks like the same object at application-level. To check for equality, use ``space.is_true(space.eq(w_x, w_y))`` or even better the short-cut ``space.eq_w(w_x, w_y)`` returning directly a interpreter-level bool. To check for identity, use ``space.is_true(space.is_(w_x, w_y))`` or better ``space.is_w(w_x, w_y)``. +The most delicate operation is for the interpreter to inspect +a wrapped object, which must be done via the object space. -* ``space.unpackiterable(w_x)``: this helper iterates ``w_x`` (using ``space.iter()`` and ``space.next()``) and collects the resulting wrapped objects in a list. Of course, in cases where iterating directly is better than collecting the elements in a list first, you should use ``space.iter()`` and ``space.next()`` directly. - -* ``space.unwrap(w_x)``: inverse of ``space.wrap()``. Attention! Using ``space.unwrap()`` must be avoided whenever possible, i.e. only use this when you are well aware that you are cheating, in unit tests or bootstrapping code. - -* ``space.interpclass_w(w_x)``: If w_x is a wrapped instance of an interpreter class -- for example Function, Frame, Cell, etc. -- return it unwrapped. Otherwise return None. - -* ``space.int_w(w_x)``: If w_x is an application-level integer or long which can be converted without overflow to an integer, return an interpreter-level integer. Otherwise raise TypeError or OverflowError. - -* ``space.str_w(w_x)``: If w_x is an application-level string, return an interpreter-level string. Otherwise raise TypeError. - -* ``space.float_w(w_x)``: If w_x is an application-level float, integer or long, return interpreter-level float. Otherwise raise TypeError or OverflowError in case of very large longs. - -Remember that you can usually obtain the information you want by invoking operations or methods on the wrapped objects; e.g. ``space.call_method(w_dict, 'iterkeys')`` returns a wrapped iterable that you can decode with ``space.unpackiterable()``. +* ``space.is_true(w_x)``: checks if the given wrapped object + is considered to be ``True`` or ``False``. You must never + use the truth-value of ``w_x`` directly; doing so (e.g. + writing ``if w_x:``) will give you an error reminding you of + the problem. + +* ``w_x == w_y`` or ``w_x is w_y``: DON'T DO THAT. The only + half-official exception is to check if ``w_x`` contains a + wrapped ``None``: you can write ``w_x == space.w_None``. + Follow this rule; the case of ``None`` is easy to fix + globally later if we find out that we need to. The + rationale for this rule is that there is no reason that two + wrappers are related in any way even if they contain what + looks like the same object at application-level. To check + for equality, use ``space.is_true(space.eq(w_x, w_y))`` or + even better the short-cut ``space.eq_w(w_x, w_y)`` returning + directly a interpreter-level bool. To check for identity, + use ``space.is_true(space.is_(w_x, w_y))`` or better + ``space.is_w(w_x, w_y)``. + +* ``space.unpackiterable(w_x)``: this helper iterates ``w_x`` + (using ``space.iter()`` and ``space.next()``) and collects + the resulting wrapped objects in a list. Of course, in + cases where iterating directly is better than collecting the + elements in a list first, you should use ``space.iter()`` + and ``space.next()`` directly. + +* ``space.unwrap(w_x)``: inverse of ``space.wrap()``. + Attention! Using ``space.unwrap()`` must be avoided + whenever possible, i.e. only use this when you are well + aware that you are cheating, in unit tests or bootstrapping + code. + +* ``space.interpclass_w(w_x)``: If w_x is a wrapped instance + of an interpreter class -- for example Function, Frame, + Cell, etc. -- return it unwrapped. Otherwise return None. + +* ``space.int_w(w_x)``: If w_x is an application-level integer + or long which can be converted without overflow to an + integer, return an interpreter-level integer. Otherwise + raise TypeError or OverflowError. + +* ``space.str_w(w_x)``: If w_x is an application-level string, + return an interpreter-level string. Otherwise raise + TypeError. + +* ``space.float_w(w_x)``: If w_x is an application-level + float, integer or long, return interpreter-level float. + Otherwise raise TypeError or OverflowError in case of very + large longs. + +Remember that you can usually obtain the information you want +by invoking operations or methods on the wrapped objects; e.g. +``space.call_method(w_dict, 'iterkeys')`` returns a wrapped +iterable that you can decode with ``space.unpackiterable()``. Application-level exceptions ---------------------------- -Interpreter-level code can use exceptions freely. However, all application-level exceptions are represented as an ``OperationError`` at interpreter-level. In other words, all exceptions that are potentially visible at application-level are internally an ``OperationError``. This is the case of all errors reported by the object space operations (``space.add()`` etc.). +Interpreter-level code can use exceptions freely. However, +all application-level exceptions are represented as an +``OperationError`` at interpreter-level. In other words, all +exceptions that are potentially visible at application-level +are internally an ``OperationError``. This is the case of all +errors reported by the object space operations +(``space.add()`` etc.). To raise an application-level exception:: @@ -417,9 +495,19 @@ raise ... -This construct catches all application-level exceptions, so we have to match it against the particular ``w_XxxError`` we are interested in and re-raise other exceptions. The exception instance ``e`` holds two attributes that you can inspect: ``e.w_type`` and ``e.w_value``. Do not use ``e.w_type`` to match an exception, as this will miss exceptions that are instances of subclasses. - -We are thinking about replacing ``OperationError`` with a family of common exception classes (e.g. ``AppKeyError``, ``AppIndexError``...) so that we can more easily catch them. The generic ``AppError`` would stand for all other application-level classes. +This construct catches all application-level exceptions, so we +have to match it against the particular ``w_XxxError`` we are +interested in and re-raise other exceptions. The exception +instance ``e`` holds two attributes that you can inspect: +``e.w_type`` and ``e.w_value``. Do not use ``e.w_type`` to +match an exception, as this will miss exceptions that are +instances of subclasses. + +We are thinking about replacing ``OperationError`` with a +family of common exception classes (e.g. ``AppKeyError``, +``AppIndexError``...) so that we can more easily catch them. +The generic ``AppError`` would stand for all other +application-level classes. .. _`modules`: From arigo at codespeak.net Fri May 20 13:30:44 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Fri, 20 May 2005 13:30:44 +0200 (CEST) Subject: [pypy-svn] r12622 - pypy/dist/pypy/interpreter Message-ID: <20050520113044.A3DB127B55@code1.codespeak.net> Author: arigo Date: Fri May 20 13:30:44 2005 New Revision: 12622 Modified: pypy/dist/pypy/interpreter/gateway.py Log: Fix the buggy "small clean-up" of r12564. The purpose is that setting use_geninterp=False at the class level should disable it as completely as possible. (Which means for all purposes apart from _exceptions and _classobj) Modified: pypy/dist/pypy/interpreter/gateway.py ============================================================================== --- pypy/dist/pypy/interpreter/gateway.py (original) +++ pypy/dist/pypy/interpreter/gateway.py Fri May 20 13:30:44 2005 @@ -514,7 +514,7 @@ self.modname = modname # look at the first three lines for a NOT_RPYTHON tag first = "\n".join(source.split("\n", 3)[:3]) - self.use_geninterp = "NOT_RPYTHON" not in first + self.use_geninterp = self.use_geninterp and "NOT_RPYTHON" not in first def getwdict(self, space): return space.fromcache(ApplevelCache).getorbuild(self) From hpk at codespeak.net Fri May 20 13:30:49 2005 From: hpk at codespeak.net (hpk at codespeak.net) Date: Fri, 20 May 2005 13:30:49 +0200 (CEST) Subject: [pypy-svn] r12623 - pypy/dist/pypy/documentation Message-ID: <20050520113049.5652C27B5A@code1.codespeak.net> Author: hpk Date: Fri May 20 13:30:49 2005 New Revision: 12623 Modified: pypy/dist/pypy/documentation/coding-guide.txt Log: issue64 done-cbb The wrapping and RPython section are ok for M0.5. However, the coding guide begins to feel a bit rough especially because there is no nice introduction section that explains why all the subchapters are there. Modified: pypy/dist/pypy/documentation/coding-guide.txt ============================================================================== --- pypy/dist/pypy/documentation/coding-guide.txt (original) +++ pypy/dist/pypy/documentation/coding-guide.txt Fri May 20 13:30:49 2005 @@ -408,8 +408,8 @@ (e.g. ``space.w_KeyError``, ``space.w_IndexError``, etc.). -Inspecting ``w_xxx`` objects ----------------------------- +Inspecting and unwrapping ``w_xxx`` objects +-------------------------------------------- The most delicate operation is for the interpreter to inspect a wrapped object, which must be done via the object space. From arigo at codespeak.net Fri May 20 13:39:26 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Fri, 20 May 2005 13:39:26 +0200 (CEST) Subject: [pypy-svn] r12624 - in pypy/dist/pypy/translator: . goal Message-ID: <20050520113926.17E9A27B55@code1.codespeak.net> Author: arigo Date: Fri May 20 13:39:25 2005 New Revision: 12624 Modified: pypy/dist/pypy/translator/annrpython.py pypy/dist/pypy/translator/goal/translate_pypy.py Log: Fail again the hard way when we have blocked blocks. They probably all show genuine problems by now. Modified: pypy/dist/pypy/translator/annrpython.py ============================================================================== --- pypy/dist/pypy/translator/annrpython.py (original) +++ pypy/dist/pypy/translator/annrpython.py Fri May 20 13:39:25 2005 @@ -154,12 +154,9 @@ traceback.print_exception(*self.why_not_annotated[block]) print '-+' * 30 print - print "++-" * 20 - print ('%d blocks are still blocked' % + print "++-" * 20 + raise AnnotatorError('%d blocks are still blocked' % self.annotated.values().count(False)) - print "continuing anyway ...." - print "++-" * 20 - def binding(self, arg, extquery=False): "Gives the SomeValue corresponding to the given Variable or Constant." Modified: pypy/dist/pypy/translator/goal/translate_pypy.py ============================================================================== --- pypy/dist/pypy/translator/goal/translate_pypy.py (original) +++ pypy/dist/pypy/translator/goal/translate_pypy.py Fri May 20 13:39:25 2005 @@ -55,10 +55,8 @@ if listen_port: run_async_server() if not options['-no-a']: - try: - a = t.annotate(inputtypes, overrides=pypy_overrides) - finally: - worstblocks_topten(t.annotator) + a = t.annotate(inputtypes, overrides=pypy_overrides) + worstblocks_topten(a) if not options['-no-s']: a.simplify() if not options['-no-t']: From arigo at codespeak.net Fri May 20 13:57:29 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Fri, 20 May 2005 13:57:29 +0200 (CEST) Subject: [pypy-svn] r12625 - in pypy/extradoc/talk/pypy-talk-pycon2005: . bubbob bubbob/ext5 bubbob/images bubbob/pat Message-ID: <20050520115729.8BEE027B52@code1.codespeak.net> Author: arigo Date: Fri May 20 13:57:28 2005 New Revision: 12625 Added: pypy/extradoc/talk/pypy-talk-pycon2005/ pypy/extradoc/talk/pypy-talk-pycon2005/README.txt (contents, props changed) pypy/extradoc/talk/pypy-talk-pycon2005/VeraMoBd.ttf (contents, props changed) pypy/extradoc/talk/pypy-talk-pycon2005/bubbob/ pypy/extradoc/talk/pypy-talk-pycon2005/bubbob/__init__.py (contents, props changed) pypy/extradoc/talk/pypy-talk-pycon2005/bubbob/ext5/ pypy/extradoc/talk/pypy-talk-pycon2005/bubbob/ext5/image1.ppm (contents, props changed) pypy/extradoc/talk/pypy-talk-pycon2005/bubbob/ext5/image2.ppm (contents, props changed) pypy/extradoc/talk/pypy-talk-pycon2005/bubbob/ext5/image3.ppm (contents, props changed) pypy/extradoc/talk/pypy-talk-pycon2005/bubbob/images/ pypy/extradoc/talk/pypy-talk-pycon2005/bubbob/images/bonus_0.ppm (contents, props changed) pypy/extradoc/talk/pypy-talk-pycon2005/bubbob/images/bonus_1.ppm (contents, props changed) pypy/extradoc/talk/pypy-talk-pycon2005/bubbob/images/bonus_10.ppm (contents, props changed) pypy/extradoc/talk/pypy-talk-pycon2005/bubbob/images/bonus_11.ppm (contents, props changed) pypy/extradoc/talk/pypy-talk-pycon2005/bubbob/images/bonus_12.ppm (contents, props changed) pypy/extradoc/talk/pypy-talk-pycon2005/bubbob/images/bonus_2.ppm (contents, props changed) pypy/extradoc/talk/pypy-talk-pycon2005/bubbob/images/bonus_3.ppm (contents, props changed) pypy/extradoc/talk/pypy-talk-pycon2005/bubbob/images/bonus_4.ppm (contents, props changed) pypy/extradoc/talk/pypy-talk-pycon2005/bubbob/images/bonus_5.ppm (contents, props changed) pypy/extradoc/talk/pypy-talk-pycon2005/bubbob/images/bonus_6.ppm (contents, props changed) pypy/extradoc/talk/pypy-talk-pycon2005/bubbob/images/bonus_7.ppm (contents, props changed) pypy/extradoc/talk/pypy-talk-pycon2005/bubbob/images/bonus_8.ppm (contents, props changed) pypy/extradoc/talk/pypy-talk-pycon2005/bubbob/images/bonus_9.ppm (contents, props changed) pypy/extradoc/talk/pypy-talk-pycon2005/bubbob/images/diamond_big_purple.ppm (contents, props changed) pypy/extradoc/talk/pypy-talk-pycon2005/bubbob/images/dragon_5.ppm (contents, props changed) pypy/extradoc/talk/pypy-talk-pycon2005/bubbob/images/flappy.ppm (contents, props changed) pypy/extradoc/talk/pypy-talk-pycon2005/bubbob/images/ghosty.ppm (contents, props changed) pypy/extradoc/talk/pypy-talk-pycon2005/bubbob/images/monky.ppm (contents, props changed) pypy/extradoc/talk/pypy-talk-pycon2005/bubbob/images/nasty.ppm pypy/extradoc/talk/pypy-talk-pycon2005/bubbob/images/orcy.ppm (contents, props changed) pypy/extradoc/talk/pypy-talk-pycon2005/bubbob/images/springy.ppm (contents, props changed) pypy/extradoc/talk/pypy-talk-pycon2005/bubbob/mnstrmap.py (contents, props changed) pypy/extradoc/talk/pypy-talk-pycon2005/bubbob/pat/ pypy/extradoc/talk/pypy-talk-pycon2005/bubbob/pat/pat00.ppm (contents, props changed) pypy/extradoc/talk/pypy-talk-pycon2005/bubbob/pat/pat01.ppm pypy/extradoc/talk/pypy-talk-pycon2005/bubbob/pat/pat02.ppm (contents, props changed) pypy/extradoc/talk/pypy-talk-pycon2005/bubbob/pat/pat03.ppm (contents, props changed) pypy/extradoc/talk/pypy-talk-pycon2005/bubbob/pat/pat04.ppm (contents, props changed) pypy/extradoc/talk/pypy-talk-pycon2005/bubbob/pat/pat05.ppm (contents, props changed) pypy/extradoc/talk/pypy-talk-pycon2005/bubbob/pat/pat06.ppm pypy/extradoc/talk/pypy-talk-pycon2005/bubbob/pat/pat07.ppm pypy/extradoc/talk/pypy-talk-pycon2005/bubbob/pat/pat09.ppm (contents, props changed) pypy/extradoc/talk/pypy-talk-pycon2005/bubbob/patmap.py (contents, props changed) pypy/extradoc/talk/pypy-talk-pycon2005/bubbob/pixmap.py (contents, props changed) pypy/extradoc/talk/pypy-talk-pycon2005/bubbob/sprmap.py (contents, props changed) pypy/extradoc/talk/pypy-talk-pycon2005/cyrvetic.ttf (contents, props changed) pypy/extradoc/talk/pypy-talk-pycon2005/def.py (contents, props changed) pypy/extradoc/talk/pypy-talk-pycon2005/ep.py (contents, props changed) pypy/extradoc/talk/pypy-talk-pycon2005/pycon.ppm (contents, props changed) pypy/extradoc/talk/pypy-talk-pycon2005/pycon.txt (contents, props changed) pypy/extradoc/talk/pypy-talk-pycon2005/pypy.ppm (contents, props changed) Log: Added the PyPy talk from PyCon 2005. Added: pypy/extradoc/talk/pypy-talk-pycon2005/README.txt ============================================================================== --- (empty file) +++ pypy/extradoc/talk/pypy-talk-pycon2005/README.txt Fri May 20 13:57:28 2005 @@ -0,0 +1,13 @@ + +PyPy +---- + http://codespeak.net/pypy/ + + Armin Rigo + + +This presentation requires Python and Pygame to run. +See http://www.pygame.org/ to install Pygame on your system. +Execute ep.py to start the presentation. Tested on a Linux +box, it should hopefully work on any platform. + Added: pypy/extradoc/talk/pypy-talk-pycon2005/VeraMoBd.ttf ============================================================================== Binary file. No diff available. Added: pypy/extradoc/talk/pypy-talk-pycon2005/bubbob/__init__.py ============================================================================== --- (empty file) +++ pypy/extradoc/talk/pypy-talk-pycon2005/bubbob/__init__.py Fri May 20 13:57:28 2005 @@ -0,0 +1 @@ +# empty Added: pypy/extradoc/talk/pypy-talk-pycon2005/bubbob/ext5/image1.ppm ============================================================================== Binary file. No diff available. Added: pypy/extradoc/talk/pypy-talk-pycon2005/bubbob/ext5/image2.ppm ============================================================================== Binary file. No diff available. Added: pypy/extradoc/talk/pypy-talk-pycon2005/bubbob/ext5/image3.ppm ============================================================================== Binary file. No diff available. Added: pypy/extradoc/talk/pypy-talk-pycon2005/bubbob/images/bonus_0.ppm ============================================================================== Binary file. No diff available. Added: pypy/extradoc/talk/pypy-talk-pycon2005/bubbob/images/bonus_1.ppm ============================================================================== Binary file. No diff available. Added: pypy/extradoc/talk/pypy-talk-pycon2005/bubbob/images/bonus_10.ppm ============================================================================== Binary file. No diff available. Added: pypy/extradoc/talk/pypy-talk-pycon2005/bubbob/images/bonus_11.ppm ============================================================================== Binary file. No diff available. Added: pypy/extradoc/talk/pypy-talk-pycon2005/bubbob/images/bonus_12.ppm ============================================================================== Binary file. No diff available. Added: pypy/extradoc/talk/pypy-talk-pycon2005/bubbob/images/bonus_2.ppm ============================================================================== Binary file. No diff available. Added: pypy/extradoc/talk/pypy-talk-pycon2005/bubbob/images/bonus_3.ppm ============================================================================== Binary file. No diff available. Added: pypy/extradoc/talk/pypy-talk-pycon2005/bubbob/images/bonus_4.ppm ============================================================================== Binary file. No diff available. Added: pypy/extradoc/talk/pypy-talk-pycon2005/bubbob/images/bonus_5.ppm ============================================================================== Binary file. No diff available. Added: pypy/extradoc/talk/pypy-talk-pycon2005/bubbob/images/bonus_6.ppm ============================================================================== Binary file. No diff available. Added: pypy/extradoc/talk/pypy-talk-pycon2005/bubbob/images/bonus_7.ppm ============================================================================== Binary file. No diff available. Added: pypy/extradoc/talk/pypy-talk-pycon2005/bubbob/images/bonus_8.ppm ============================================================================== Binary file. No diff available. Added: pypy/extradoc/talk/pypy-talk-pycon2005/bubbob/images/bonus_9.ppm ============================================================================== Binary file. No diff available. Added: pypy/extradoc/talk/pypy-talk-pycon2005/bubbob/images/diamond_big_purple.ppm ============================================================================== Binary file. No diff available. Added: pypy/extradoc/talk/pypy-talk-pycon2005/bubbob/images/dragon_5.ppm ============================================================================== Binary file. No diff available. Added: pypy/extradoc/talk/pypy-talk-pycon2005/bubbob/images/flappy.ppm ============================================================================== Binary file. No diff available. Added: pypy/extradoc/talk/pypy-talk-pycon2005/bubbob/images/ghosty.ppm ============================================================================== Binary file. No diff available. Added: pypy/extradoc/talk/pypy-talk-pycon2005/bubbob/images/monky.ppm ============================================================================== Binary file. No diff available. Added: pypy/extradoc/talk/pypy-talk-pycon2005/bubbob/images/nasty.ppm ============================================================================== Files (empty file) and pypy/extradoc/talk/pypy-talk-pycon2005/bubbob/images/nasty.ppm Fri May 20 13:57:28 2005 differ Added: pypy/extradoc/talk/pypy-talk-pycon2005/bubbob/images/orcy.ppm ============================================================================== Binary file. No diff available. Added: pypy/extradoc/talk/pypy-talk-pycon2005/bubbob/images/springy.ppm ============================================================================== Binary file. No diff available. Added: pypy/extradoc/talk/pypy-talk-pycon2005/bubbob/mnstrmap.py ============================================================================== --- (empty file) +++ pypy/extradoc/talk/pypy-talk-pycon2005/bubbob/mnstrmap.py Fri May 20 13:57:28 2005 @@ -0,0 +1,382 @@ + +class Monster1: + def __init__(self, x, y, dir, player=0): + self.x = x + self.y = y + self.dir = (1, -1)[dir] + self.player = player + +def nrange(start,n): + return range(start,start+n) + +class Nasty(Monster1): + right = nrange(239,4) + left = nrange(243,4) + jailed = nrange(247,3) + dead = nrange(253,4) + right_angry = nrange(800,4) + left_angry = nrange(804,4) + +class Monky(Monster1): + right = nrange(265,4) + left = nrange(269,4) + jailed = nrange(273,3) + dead = nrange(279,4) + left_weapon = right_weapon = nrange(451,1) # FIXME + decay_weapon = nrange(452,4) # FIXME + right_angry = nrange(808,4) + left_angry = nrange(812,4) + +class Ghosty(Monster1): + right = nrange(291,4) + left = nrange(295,4) + jailed = nrange(299,3) + dead = nrange(305,4) + right_angry = nrange(816,4) + left_angry = nrange(820,4) + +class Flappy(Monster1): + right = nrange(317,4) + left = nrange(321,4) + jailed = nrange(325,3) + dead = nrange(331,4) + right_angry = nrange(824,4) + left_angry = nrange(828,4) + +class Springy(Monster1): + right = nrange(343,4) + left = nrange(347,4) + jailed = nrange(351,3) + dead = nrange(357,4) + right_jump = nrange(369,2) + left_jump = nrange(371,2) + right_angry = nrange(832,4) + left_angry = nrange(836,4) + right_jump_angry = nrange(840,2) + left_jump_angry = nrange(842,2) + +class Orcy(Monster1): + right = nrange(373,4) + left = nrange(377,4) + jailed = nrange(381,3) + dead = nrange(387,4) + left_weapon = nrange(456,4) + right_weapon = nrange(460,4) + decay_weapon = nrange(456,0) # FIXME + right_angry = nrange(844,4) + left_angry = nrange(848,4) + +class Gramy(Monster1): + right = nrange(399,4) + left = nrange(403,4) + jailed = nrange(407,3) + dead = nrange(413,4) + left_weapon = right_weapon = nrange(472,4) # FIXME + right_angry = nrange(852,4) + left_angry = nrange(856,4) + +class Blitzy(Monster1): + right = left = nrange(425,4) + jailed = nrange(429,3) + dead = nrange(435,4) + right_angry = left_angry = nrange(860,4) + left_weapon = right_weapon = nrange(476,1) # FIXME + +class Ghost: + left = nrange(443,4) + right = nrange(447,4) + +class PlayerBubbles: + appearing = nrange(916,3) + bubble = nrange(910,3) + explosion = nrange(913,3) + left_weapon = nrange(464,4) + right_weapon = nrange(468,4) + decay_weapon = [] + +class LetterBubbles: + Extend = nrange(128,3) # FIXME + eXtend = nrange(136,3) + exTend = nrange(144,3) + extEnd = nrange(152,3) + exteNd = nrange(160,3) + extenD = nrange(168,3) + +class DyingBubble: + first = nrange(163,3) + medium = nrange(171,3) + last = nrange(155,3) + +class Fire: + ground = nrange(490,4) + drop = 489 + +class Lightning: + fired = 488 + +class Water: + h_flow = 900 + v_flow = 901 + start_right = 902 + start_left = 904 + bottom = 903 + top = 905 + tl_corner = 906 + bl_corner = 907 + br_corner = 908 + tr_corner = 909 + +class Flood: + waves = nrange(140,4) + fill = 495 + +class MiscPoints: + pink_100 = 496 + +class DigitsMisc: + digits_mask = nrange(519,10) + digits_border = nrange(920,10) + digits_white = nrange(930,10) + +class PotionBonuses: + coin = 477 + flower = 478 + trefle = 479 + rainbow = 480 + green_note = 481 + blue_note = 692 + + +class Bonuses: + monster_bonuses = [ + (593,1000), # banana + (594,2000), # peach + (595,3000), # quince + (596,4000), # pastec + (597,5000), # wine + (598,6000), # ananas + (599,8000) # diamond + ] + + door = 139 # Lots of diamonds + + red_potion = 637 #\ . + green_potion = 638 # > Clean the level and fill the top 5 lines with one of the PotionBonuses. + yellow_potion = 639 #/ + + kirsh = 600 + icecream1 = 601 + erdbeer = 602 + fish1 = 603 + tomato = 604 + donut = 605 + apple = 606 + corn = 607 + icecream2 = 608 + radish = 609 + + cyan_ice = 610 #\ . + violet_ice = 611 #| + peach2 = 612 # > Produced from the bubbles after a wand. + pastec2 = 613 #| + cream_pie = 614 #| + sugar_pie = 615 #/ + + brown_wand = 620 #\ . + yellow_wand = 621 #| + green_wand = 622 # > Bubbles turn into bonus of the previous set after + violet_wand = 623 # > the death of the last enemy plus a mega-bonus. + blue_wand = 624 #| + red_wand = 625 #/ + + violet_chest = 626 #\ . + blue_chest = 627 # > Bubbles turn into diamonds plus after the death + red_chest = 628 # > of the last enemy plus a mega-diamond + yellow_chest = 629 #/ + + shoe = 631 # speed player movements + grenade = 632 # put fire everywhere + + brown_umbrella = 633 # fire rain + grey_umbrella = 634 # water rain + violet_umbrella = 635 # spinning balls rain + + clock = 636 # time travel + coffee = 641 # Speed player's movements and fire rate. + book = 642 # Produces stars the middle-top going in any direction which kill the enemy upon contact. + heart_poison = 643 # Froze the enemy and they are now killed on contact. + gold_crux = 644 # become a bubble + red_crux = 645 # become a monster + blue_crux = 646 # become a monster + extend = 647 # Give 100'000 Points to the player and finish the level. + + ring = 640 # lord of the ring + green_pepper = 648 # hot stuff! + orange_thing = 649 # slippy + aubergine = 650 # rear gear + carrot = 651 # angry monsters + rape = 652 # auto-fire + white_carrot = 653 # fly + chickpea = 654 # shield + mushroom = 655 # pinball mode + egg = 656 # players permutation + chestnut = 657 # variation of frames per second + green_thing = 658 # sugar bomb + icecream3 = 659 # \ each icecream becomes two of the + icecream4 = 660 # \ next kind, which scores more points + icecream5 = 661 # / that's a lot of points in total + icecream6 = 662 # / + softice1 = 663 # shoot farther + softice2 = 665 # shoot nearer1 + french_fries = 664 # shoot 10 lightning bubbles + custard_pie = 666 # shoot faster + lollipop = 667 # invert left and right + cocktail = 668 # short-lived bubbles + ham = 669 # wall builder + bomb = 670 # explodes the structure of the level + beer = 671 # shoot 10 water bubbles + emerald = 672 # mega points + fish2 = 673 # mega blitz + sapphire = 681 # mega points + ruby = 682 # mega points + tin = 674 # angry (double-speed) player + hamburger = 675 # shoot 10 fire bubbles + insect = 676 # walls fall down + blue_necklace = 677 # player ubiquity + violet_necklace = 679 # monster ubiquity + butterfly = 678 # lunar gravity + conch = 680 # complete water flood + yellow_sugar = 630 # from a bonbon bomb + blue_sugar = 691 # from a bonbon bomb + +class Diamonds: + # Produced from the bubbles after last enemy is killed and a chest or wand has been caught. + violet = 616 + blue = 617 + red = 618 + yellow = 619 + +class Stars: + # Effect of the book. Kill monsters on contact. + blue = nrange(940,2) + yellow = nrange(942,2) + red = nrange(944,2) + green = nrange(946,2) + magenta = nrange(948,2) + cyan = nrange(950,2) + +class SpinningBalls: + free = nrange(482,4) + bubbled = nrange(486,2) + +class BigImages: + cyan_ice = 10 # Megabonus produced after a wand + violet_ice = 11 + peach2 = 12 + pastec2 = 13 + cream_pie = 14 + sugar_pie = 15 + violet = 16 + blue = 17 + red = 18 + yellow = 19 + blitz = 30 + hurryup = nrange(31,2) + +class birange: + def __init__(self, a,b,n): + self.a = a + self.n = n + def __getitem__(self, pn): + return range(self.a + 1000*pn, self.a + 1000*pn + self.n) + +class bidict: + def __init__(self, a,b): + self.a = a.items() + def __getitem__(self, pn): + pn *= 1000 + d = {} + for key, value in self.a: + d[key] = value + pn + return d + +class GreenAndBlue: + water_bubbles = birange(182,185,3) + fire_bubbles = birange(176,554,3) + light_bubbles = birange(179,557,3) + normal_bubbles = birange(188,195,3) + new_bubbles = birange(191,203,4) + players = birange(210,226,13) + jumping_players = birange(683,687,4) + new_players = birange(693,696,3) + numbers = birange(499,509,10) # FIXME: already seen below + comming = birange(693,696,3) + points = bidict({ + 100: 529, + 150: 530, + 200: 531, + 250: 532, + 300: 533, + 350: 534, + 500: 535, + 550: 536, + 600: 537, + 650: 538, + 700: 539, + 750: 540, + 800: 541, + 850: 542, + 900: 543, + 950: 544, + 1000: 545, + 2000: 546, + 3000: 547, + 4000: 548, + 5000: 549, + 6000: 550, + 7000: 551, + 8000: 552, + 9000: 553, + 10000: 20, + 20000: 21, + 30000: 22, + 40000: 23, + 50000: 24, + 60000: 25, + 70000: 26, + },{ + 100: 561, + 150: 562, + 200: 563, + 250: 564, + 300: 565, + 350: 566, + 500: 567, + 550: 568, + 600: 569, + 650: 570, + 700: 571, + 750: 572, + 800: 573, + 850: 574, + 900: 575, + 950: 576, + 1000: 577, + 2000: 578, + 3000: 579, + 4000: 580, + 5000: 581, + 6000: 582, + 7000: 583, + 8000: 584, + 9000: 585, + 10000: 90, + 20000: 91, + 30000: 92, + 40000: 93, + 50000: 94, + 60000: 95, + 70000: 96, + }) + gameover = birange(497,498,1) + digits = birange(499,509,10) Added: pypy/extradoc/talk/pypy-talk-pycon2005/bubbob/pat/pat00.ppm ============================================================================== Binary file. No diff available. Added: pypy/extradoc/talk/pypy-talk-pycon2005/bubbob/pat/pat01.ppm ============================================================================== Files (empty file) and pypy/extradoc/talk/pypy-talk-pycon2005/bubbob/pat/pat01.ppm Fri May 20 13:57:28 2005 differ Added: pypy/extradoc/talk/pypy-talk-pycon2005/bubbob/pat/pat02.ppm ============================================================================== Binary file. No diff available. Added: pypy/extradoc/talk/pypy-talk-pycon2005/bubbob/pat/pat03.ppm ============================================================================== Binary file. No diff available. Added: pypy/extradoc/talk/pypy-talk-pycon2005/bubbob/pat/pat04.ppm ============================================================================== Binary file. No diff available. Added: pypy/extradoc/talk/pypy-talk-pycon2005/bubbob/pat/pat05.ppm ============================================================================== Binary file. No diff available. Added: pypy/extradoc/talk/pypy-talk-pycon2005/bubbob/pat/pat06.ppm ============================================================================== Files (empty file) and pypy/extradoc/talk/pypy-talk-pycon2005/bubbob/pat/pat06.ppm Fri May 20 13:57:28 2005 differ Added: pypy/extradoc/talk/pypy-talk-pycon2005/bubbob/pat/pat07.ppm ============================================================================== Files (empty file) and pypy/extradoc/talk/pypy-talk-pycon2005/bubbob/pat/pat07.ppm Fri May 20 13:57:28 2005 differ Added: pypy/extradoc/talk/pypy-talk-pycon2005/bubbob/pat/pat09.ppm ============================================================================== Binary file. No diff available. Added: pypy/extradoc/talk/pypy-talk-pycon2005/bubbob/patmap.py ============================================================================== --- (empty file) +++ pypy/extradoc/talk/pypy-talk-pycon2005/bubbob/patmap.py Fri May 20 13:57:28 2005 @@ -0,0 +1,177 @@ +patmap = {(0, 0, 0): ('pat03.ppm', (0, 120, 24, 24)), + (1, 0, 0): ('pat01.ppm', (0, 24, 24, 24)), + (2, 0, 0): ('pat09.ppm', (0, 0, 24, 24)), + (2, 'l'): ('pat14.ppm', (0, 160, 40, 32)), + (3, 0, 0): ('pat06.ppm', (0, 120, 24, 24)), + (3, 'l'): ('pat17.ppm', (0, 32, 40, 32)), + (4, 0, 0): ('pat04.ppm', (0, 48, 24, 24)), + (4, 'l'): ('pat15.ppm', (0, 192, 40, 32)), + (5, 0, 0): ('pat01.ppm', (0, 216, 24, 24)), + (5, 'l'): ('pat19.ppm', (0, 96, 40, 32)), + (6, 0, 0): ('pat09.ppm', (0, 144, 24, 24)), + (6, 'l'): ('pat18.ppm', (0, 96, 40, 32)), + (7, 0, 0): ('pat07.ppm', (0, 24, 24, 24)), + (8, 0, 0): ('pat02.ppm', (0, 48, 24, 24)), + (9, 0, 0): ('pat09.ppm', (0, 216, 24, 24)), + (9, 'l'): ('pat11.ppm', (0, 64, 40, 32)), + (10, 0, 0): ('pat07.ppm', (0, 96, 24, 24)), + (10, 'l'): ('pat14.ppm', (0, 96, 40, 32)), + (11, 0, 0): ('pat05.ppm', (0, 24, 24, 24)), + (11, 'l'): ('pat13.ppm', (0, 32, 40, 32)), + (12, 0, 0): ('pat02.ppm', (0, 216, 24, 24)), + (12, 'l'): ('pat18.ppm', (0, 0, 40, 32)), + (13, 0, 0): ('pat00.ppm', (0, 72, 24, 24)), + (13, 'l'): ('pat18.ppm', (0, 128, 40, 32)), + (14, 0, 0): ('pat07.ppm', (0, 192, 24, 24)), + (15, 0, 0): ('pat05.ppm', (0, 192, 24, 24)), + (15, 'l'): ('pat18.ppm', (0, 32, 40, 32)), + (16, 0, 0): ('pat06.ppm', (0, 96, 24, 24)), + (16, 'l'): ('pat11.ppm', (0, 32, 40, 32)), + (17, 0, 0): ('pat04.ppm', (0, 0, 24, 24)), + (17, 'l'): ('pat14.ppm', (0, 64, 40, 32)), + (18, 0, 0): ('pat01.ppm', (0, 168, 24, 24)), + (18, 'l'): ('pat13.ppm', (0, 0, 40, 32)), + (19, 0, 0): ('pat09.ppm', (0, 96, 24, 24)), + (19, 'l'): ('pat16.ppm', (0, 192, 40, 32)), + (20, 0, 0): ('pat07.ppm', (0, 0, 24, 24)), + (20, 'l'): ('pat15.ppm', (0, 160, 40, 32)), + (21, 0, 0): ('pat04.ppm', (0, 192, 24, 24)), + (21, 'l'): ('pat19.ppm', (0, 64, 40, 32)), + (22, 0, 0): ('pat02.ppm', (0, 120, 24, 24)), + (22, 'l'): ('pat17.ppm', (0, 224, 40, 32)), + (23, 0, 0): ('pat10.ppm', (0, 24, 24, 24)), + (23, 'l'): ('pat12.ppm', (0, 64, 40, 32)), + (24, 0, 0): ('pat05.ppm', (0, 0, 24, 24)), + (24, 'l'): ('pat17.ppm', (0, 96, 40, 32)), + (25, 0, 0): ('pat02.ppm', (0, 168, 24, 24)), + (25, 'l'): ('pat15.ppm', (0, 64, 40, 32)), + (26, 0, 0): ('pat00.ppm', (0, 24, 24, 24)), + (26, 0, 1): ('pat00.ppm', (0, 0, 24, 24)), + (26, 1, 0): ('pat01.ppm', (0, 120, 24, 24)), + (26, 1, 1): ('pat08.ppm', (0, 144, 24, 24)), + (26, 'l'): ('pat13.ppm', (0, 224, 40, 32)), + (27, 0, 0): ('pat07.ppm', (0, 216, 24, 24)), + (27, 'l'): ('pat17.ppm', (0, 64, 40, 32)), + (28, 0, 0): ('pat05.ppm', (0, 168, 24, 24)), + (28, 'l'): ('pat15.ppm', (0, 224, 40, 32)), + (29, 0, 0): ('pat03.ppm', (0, 72, 24, 24)), + (30, 0, 0): ('pat00.ppm', (0, 216, 24, 24)), + (30, 'l'): ('pat17.ppm', (0, 160, 40, 32)), + (31, 0, 0): ('pat08.ppm', (0, 168, 24, 24)), + (31, 'l'): ('pat12.ppm', (0, 32, 40, 32)), + (32, 0, 0): ('pat08.ppm', (0, 0, 24, 24)), + (33, 0, 0): ('pat05.ppm', (0, 144, 24, 24)), + (33, 'l'): ('pat12.ppm', (0, 192, 40, 32)), + (34, 0, 0): ('pat03.ppm', (0, 48, 24, 24)), + (35, 0, 0): ('pat00.ppm', (0, 168, 24, 24)), + (35, 'l'): ('pat14.ppm', (0, 128, 40, 32)), + (36, 0, 0): ('pat07.ppm', (0, 120, 24, 24)), + (36, 'l'): ('pat16.ppm', (0, 96, 40, 32)), + (37, 0, 0): ('pat06.ppm', (0, 72, 24, 24)), + (38, 0, 0): ('pat03.ppm', (0, 216, 24, 24)), + (38, 'l'): ('pat11.ppm', (0, 128, 40, 32)), + (39, 0, 0): ('pat01.ppm', (0, 96, 24, 24)), + (40, 0, 0): ('pat08.ppm', (0, 48, 24, 24)), + (41, 0, 0): ('pat04.ppm', (0, 24, 24, 24)), + (41, 'l'): ('pat12.ppm', (0, 160, 40, 32)), + (42, 0, 0): ('pat01.ppm', (0, 192, 24, 24)), + (43, 0, 0): ('pat05.ppm', (0, 120, 24, 24)), + (43, 1, 0): ('pat08.ppm', (0, 72, 24, 24)), + (44, 0, 0): ('pat07.ppm', (0, 48, 24, 24)), + (45, 0, 0): ('pat04.ppm', (0, 216, 24, 24)), + (45, 'l'): ('pat16.ppm', (0, 224, 40, 32)), + (46, 0, 0): ('pat02.ppm', (0, 144, 24, 24)), + (46, 'l'): ('pat16.ppm', (0, 64, 40, 32)), + (47, 0, 0): ('pat10.ppm', (0, 72, 24, 24)), + (47, 'l'): ('pat19.ppm', (0, 224, 40, 32)), + (48, 0, 0): ('pat00.ppm', (0, 120, 24, 24)), + (48, 'l'): ('pat12.ppm', (0, 128, 40, 32)), + (49, 0, 0): ('pat08.ppm', (0, 96, 24, 24)), + (49, 'l'): ('pat11.ppm', (0, 192, 40, 32)), + (50, 0, 0): ('pat06.ppm', (0, 24, 24, 24)), + (50, 'l'): ('pat16.ppm', (0, 128, 40, 32)), + (51, 0, 0): ('pat03.ppm', (0, 144, 24, 24)), + (51, 'l'): ('pat14.ppm', (0, 0, 40, 32)), + (52, 0, 0): ('pat01.ppm', (0, 72, 24, 24)), + (52, 'l'): ('pat15.ppm', (0, 0, 40, 32)), + (53, 0, 0): ('pat09.ppm', (0, 48, 24, 24)), + (53, 'l'): ('pat16.ppm', (0, 32, 40, 32)), + (54, 0, 0): ('pat06.ppm', (0, 192, 24, 24)), + (54, 'l'): ('pat19.ppm', (0, 192, 40, 32)), + (55, 0, 0): ('pat04.ppm', (0, 96, 24, 24)), + (55, 'l'): ('pat18.ppm', (0, 160, 40, 32)), + (56, 0, 0): ('pat09.ppm', (0, 120, 24, 24)), + (56, 'l'): ('pat18.ppm', (0, 64, 40, 32)), + (57, 0, 0): ('pat00.ppm', (0, 144, 24, 24)), + (57, 'l'): ('pat12.ppm', (0, 96, 40, 32)), + (58, 0, 0): ('pat04.ppm', (0, 168, 24, 24)), + (59, 0, 0): ('pat02.ppm', (0, 72, 24, 24)), + (59, 'l'): ('pat14.ppm', (0, 192, 40, 32)), + (60, 0, 0): ('pat10.ppm', (0, 48, 24, 24)), + (60, 'l'): ('pat13.ppm', (0, 96, 40, 64)), + (61, 0, 0): ('pat07.ppm', (0, 168, 24, 24)), + (62, 0, 0): ('pat05.ppm', (0, 96, 24, 24)), + (62, 'l'): ('pat19.ppm', (0, 128, 40, 32)), + (63, 0, 0): ('pat03.ppm', (0, 0, 24, 24)), + (63, 'l'): ('pat20.ppm', (0, 0, 40, 32)), + (64, 0, 0): ('pat02.ppm', (0, 96, 24, 24)), + (64, 'l'): ('pat13.ppm', (0, 64, 40, 32)), + (65, 0, 0): ('pat10.ppm', (0, 0, 24, 24)), + (65, 'l'): ('pat19.ppm', (0, 32, 40, 32)), + (66, 0, 0): ('pat07.ppm', (0, 144, 24, 24)), + (66, 'l'): ('pat17.ppm', (0, 192, 40, 32)), + (67, 0, 0): ('pat05.ppm', (0, 72, 24, 24)), + (67, 'l'): ('pat11.ppm', (0, 224, 40, 32)), + (68, 0, 0): ('pat03.ppm', (0, 24, 24, 24)), + (68, 'l'): ('pat15.ppm', (0, 32, 40, 32)), + (69, 0, 0): ('pat00.ppm', (0, 96, 24, 24)), + (69, 'l'): ('pat13.ppm', (0, 192, 40, 32)), + (70, 0, 0): ('pat08.ppm', (0, 192, 24, 24)), + (70, 'l'): ('pat17.ppm', (0, 0, 40, 32)), + (71, 0, 0): ('pat06.ppm', (0, 0, 24, 24)), + (72, 0, 0): ('pat00.ppm', (0, 192, 24, 24)), + (72, 'l'): ('pat15.ppm', (0, 128, 40, 32)), + (73, 0, 0): ('pat08.ppm', (0, 120, 24, 24)), + (74, 0, 0): ('pat06.ppm', (0, 48, 24, 24)), + (75, 0, 0): ('pat03.ppm', (0, 192, 24, 24)), + (76, 0, 0): ('pat01.ppm', (0, 144, 24, 24)), + (76, 'l'): ('pat11.ppm', (0, 0, 40, 32)), + (77, 0, 0): ('pat09.ppm', (0, 72, 24, 24)), + (77, 'l'): ('pat14.ppm', (0, 32, 40, 32)), + (78, 0, 0): ('pat06.ppm', (0, 216, 24, 24)), + (78, 'l'): ('pat13.ppm', (0, 160, 40, 32)), + (79, 0, 0): ('pat04.ppm', (0, 144, 24, 24)), + (79, 'l'): ('pat16.ppm', (0, 160, 40, 32)), + (80, 0, 0): ('pat05.ppm', (0, 48, 24, 24)), + (81, 0, 0): ('pat02.ppm', (0, 192, 24, 24)), + (81, 'l'): ('pat17.ppm', (0, 128, 40, 32)), + (82, 0, 0): ('pat00.ppm', (0, 48, 24, 24)), + (82, 'l'): ('pat12.ppm', (0, 0, 40, 32)), + (83, 0, 0): ('pat08.ppm', (0, 24, 24, 24)), + (83, 'l'): ('pat11.ppm', (0, 96, 40, 32)), + (84, 0, 0): ('pat05.ppm', (0, 216, 24, 24)), + (84, 'l'): ('pat14.ppm', (0, 224, 40, 32)), + (84, 'r'): ('pat18.ppm', (0, 224, 40, 32)), + (85, 0, 0): ('pat03.ppm', (0, 96, 24, 24)), + (86, 0, 0): ('pat01.ppm', (0, 0, 24, 24)), + (87, 0, 0): ('pat08.ppm', (0, 216, 24, 24)), + (88, 0, 0): ('pat03.ppm', (0, 168, 24, 24)), + (88, 'l'): ('pat20.ppm', (0, 32, 40, 32)), + (89, 0, 0): ('pat01.ppm', (0, 48, 24, 24)), + (90, 0, 0): ('pat09.ppm', (0, 24, 24, 24)), + (90, 'l'): ('pat12.ppm', (0, 224, 40, 32)), + (91, 0, 0): ('pat06.ppm', (0, 144, 24, 24)), + (92, 0, 0): ('pat04.ppm', (0, 120, 24, 24)), + (92, 'l'): ('pat18.ppm', (0, 192, 40, 32)), + (93, 0, 0): ('pat02.ppm', (0, 24, 24, 24)), + (93, 'l'): ('pat11.ppm', (0, 160, 40, 32)), + (94, 0, 0): ('pat09.ppm', (0, 192, 24, 24)), + (94, 'l'): ('pat19.ppm', (0, 0, 40, 32)), + (95, 0, 0): ('pat07.ppm', (0, 72, 24, 24)), + (95, 'l'): ('pat15.ppm', (0, 96, 40, 32)), + (96, 0, 0): ('pat06.ppm', (0, 168, 24, 24)), + (97, 0, 0): ('pat04.ppm', (0, 72, 24, 24)), + (97, 'l'): ('pat16.ppm', (0, 0, 40, 32)), + (98, 0, 0): ('pat02.ppm', (0, 0, 24, 24)), + (98, 'l'): ('pat19.ppm', (0, 160, 40, 32)), + (99, 0, 0): ('pat09.ppm', (0, 168, 24, 24))} Added: pypy/extradoc/talk/pypy-talk-pycon2005/bubbob/pixmap.py ============================================================================== --- (empty file) +++ pypy/extradoc/talk/pypy-talk-pycon2005/bubbob/pixmap.py Fri May 20 13:57:28 2005 @@ -0,0 +1,131 @@ +from __future__ import generators +import cStringIO + +def decodepixmap(data): + f = cStringIO.StringIO(data) + sig = f.readline().strip() + assert sig == "P6" + while 1: + line = f.readline().strip() + if not line.startswith('#'): + break + wh = line.split() + w, h = map(int, wh) + sig = f.readline().strip() + assert sig == "255" + data = f.read() + f.close() + return w, h, data + +def encodepixmap(w, h, data): + return 'P6\n%d %d\n255\n%s' % (w, h, data) + +def cropimage((w, h, data), (x1, y1, w1, h1)): + assert 0 <= x1 <= x1+w1 <= w + assert 0 <= y1 <= y1+h1 <= h + scanline = w*3 + lines = [data[p:p+w1*3] + for p in range(y1*scanline + x1*3, + (y1+h1)*scanline + x1*3, + scanline)] + return w1, h1, ''.join(lines) + +def vflip(w, h, data): + scanline = w*3 + lines = [data[p:p+scanline] for p in range(0, len(data), scanline)] + lines.reverse() + return ''.join(lines) + +def makebkgnd(w, h, data): + scanline = 3*w + result = [] + for position in range(0, scanline*h, scanline): + line = [] + for p in range(position, position+scanline, 3): + line.append(2 * (chr(ord(data[p ]) >> 3) + + chr(ord(data[p+1]) >> 3) + + chr(ord(data[p+2]) >> 3))) + line = ''.join(line) + result.append(line) + result.append(line) + return w*2, h*2, ''.join(result) + +def col((r, g, b)): + r = ord(r) + g = ord(g) + b = ord(b) + return ((g>>2 + r>>3) << 24) | (b << 16) | (g << 8) | r + +def imagezoomer(w, h, data): + "Zoom a cartoon image by a factor of three, progressively." + scale = 3 + scanline = 3*w + rw = (w-1)*scale+1 + rh = (h-1)*scale+1 + pixels = [] + colcache = {} + revcache = {} + for base in range(0, scanline*h, scanline): + line = [] + for x in range(w): + key = data[base + 3*x : base + 3*(x+1)] + try: + c = colcache[key] + except KeyError: + c = colcache[key] = col(key) + revcache[c] = key + line.append(c) + pixels.append(line) + if base % scale == 1: + yield None + + Pairs = { + (0, 0): [(0, 0, 0, 0), + (-1,0, 1, 0), + (0,-1, 0, 1)], + (1, 0): [(0, 0, 1, 0), + (0, 1, 1,-1), + (0,-1, 1, 1)], + (2, 0): [(0, 0, 1, 0), + (0, 1, 1,-1), + (0,-1, 1, 1)], + (0, 1): [(0, 0, 0, 1), + (-1,0, 1, 1), + (1, 0,-1, 1)], + (1, 1): [(0, 0, 1, 1), + (0, 1, 1, -1), + (1, 0,-1, 1)], + (2, 1): [(1, 0, 0, 1), + (0,-1, 1, 1), + (0, 0, 2, 1)], + (0, 2): [(0, 0, 0, 1), + (-1,0, 1, 1), + (1, 0,-1, 1)], + (1, 2): [(0, 1, 1, 0), + (-1,0, 1, 1), + (0, 0, 1, 2)], + (2, 2): [(0, 0, 1, 1), + (0, 1, 2, 0), + (1, 0, 0, 2)], + } + result = [] + for y in range(rh): + yield None + for x in range(rw): + # ______________________________ + + i = x//scale + j = y//scale + ps = [] + for dx1, dy1, dx2, dy2 in Pairs[x%scale, y%scale]: + if (0 <= i+dx1 < w and 0 <= i+dx2 < w and + 0 <= j+dy1 < h and 0 <= j+dy2 < h): + p1 = pixels[j+dy1][i+dx1] + p2 = pixels[j+dy2][i+dx2] + ps.append(max(p1, p2)) + p1 = min(ps) + + # ______________________________ + result.append(revcache[p1]) + data = ''.join(result) + yield (rw, rh, data) Added: pypy/extradoc/talk/pypy-talk-pycon2005/bubbob/sprmap.py ============================================================================== --- (empty file) +++ pypy/extradoc/talk/pypy-talk-pycon2005/bubbob/sprmap.py Fri May 20 13:57:28 2005 @@ -0,0 +1,522 @@ +sprmap = { + 10:('ice_cyan_big.ppm', (0, 0, 90, 90)), + 11:('ice_violet_big.ppm', (0, 0, 90, 90)), + 12:('peach_big.ppm', (0, 0, 90, 90)), + 13:('pastec_big.ppm', (0, 0, 90, 90)), + 14:('cream_pie_big.ppm', (0, 0, 90, 90)), + 15:('sugar_pie_big.ppm', (0, 0, 90, 90)), + 16:('diamond_big_purple.ppm', (0, 0, 90, 90)), + 17:('diamond_big_blue.ppm', (0, 0, 90, 90)), + 18:('diamond_big_red.ppm', (0, 0, 90, 90)), + 19:('diamond_big_yellow.ppm', (0, 0, 90, 90)), + 30:('lightning_large.ppm', (0, 0, 90, 66)), + 31:('yellow_Hurry_up.ppm', (0, 0, 136, 24)), + 32:('red_Hurry_up.ppm', (0, 0, 136, 24)), + 128:('extend.ppm', (0, 0, 32, 32)), + 129:('extend.ppm', (0, 32, 32, 32)), + 130:('extend.ppm', (0, 64, 32, 32)), + 131:('bubble.ppm', (0, 0, 32, 32)), + 132:('bubble.ppm', (0, 32, 32, 32)), + 133:('bubble.ppm', (0, 64, 32, 32)), + 134:('bubble.ppm', (0, 96, 32, 32)), + 135:('bubble.ppm', (0, 128, 32, 32)), + 136:('extend.ppm', (0, 96, 32, 32)), + 137:('extend.ppm', (0, 128, 32, 32)), + 138:('extend.ppm', (0, 160, 32, 32)), + 139:('door.ppm', (0, 0, 32, 32)), + 140:('water_surface.ppm', (0, 0, 16, 16)), + 141:('water_surface.ppm', (0, 16, 16, 16)), + 142:('water_surface.ppm', (0, 32, 16, 16)), + 143:('water_surface.ppm', (0, 48, 16, 16)), + 144:('extend.ppm', (0, 192, 32, 32)), + 145:('extend.ppm', (0, 224, 32, 32)), + 146:('extend.ppm', (0, 256, 32, 32)), + 152:('extend.ppm', (0, 288, 32, 32)), + 153:('extend.ppm', (0, 320, 32, 32)), + 154:('extend.ppm', (0, 352, 32, 32)), + 155:('bubble.ppm', (0, 352, 32, 32)), + 156:('bubble.ppm', (0, 384, 32, 32)), + 157:('bubble.ppm', (0, 416, 32, 32)), + 160:('extend.ppm', (0, 384, 32, 32)), + 161:('extend.ppm', (0, 416, 32, 32)), + 162:('extend.ppm', (0, 448, 32, 32)), + 163:('bubble.ppm', (0, 160, 32, 32)), + 164:('bubble.ppm', (0, 192, 32, 32)), + 165:('bubble.ppm', (0, 224, 32, 32)), + 168:('extend.ppm', (0, 480, 32, 32)), + 169:('extend.ppm', (0, 512, 32, 32)), + 170:('extend.ppm', (0, 544, 32, 32)), + 171:('bubble.ppm', (0, 256, 32, 32)), + 172:('bubble.ppm', (0, 288, 32, 32)), + 173:('bubble.ppm', (0, 320, 32, 32)), + 239:('nasty.ppm', (0, 0, 32, 32)), + 240:('nasty.ppm', (0, 32, 32, 32)), + 241:('nasty.ppm', (0, 64, 32, 32)), + 242:('nasty.ppm', (0, 96, 32, 32)), + 243:('nasty.ppm', (0, 128, 32, 32)), + 244:('nasty.ppm', (0, 160, 32, 32)), + 245:('nasty.ppm', (0, 192, 32, 32)), + 246:('nasty.ppm', (0, 224, 32, 32)), + 247:('nasty.ppm', (0, 256, 32, 32)), + 248:('nasty.ppm', (0, 288, 32, 32)), + 249:('nasty.ppm', (0, 320, 32, 32)), + 253:('nasty.ppm', (0, 352, 32, 32)), + 254:('nasty.ppm', (0, 384, 32, 32)), + 255:('nasty.ppm', (0, 416, 32, 32)), + 256:('nasty.ppm', (0, 448, 32, 32)), + 265:('monky.ppm', (0, 0, 32, 32)), + 266:('monky.ppm', (0, 32, 32, 32)), + 267:('monky.ppm', (0, 64, 32, 32)), + 268:('monky.ppm', (0, 96, 32, 32)), + 269:('monky.ppm', (0, 128, 32, 32)), + 270:('monky.ppm', (0, 160, 32, 32)), + 271:('monky.ppm', (0, 192, 32, 32)), + 272:('monky.ppm', (0, 224, 32, 32)), + 273:('monky.ppm', (0, 256, 32, 32)), + 274:('monky.ppm', (0, 288, 32, 32)), + 275:('monky.ppm', (0, 320, 32, 32)), + 279:('monky.ppm', (0, 352, 32, 32)), + 280:('monky.ppm', (0, 384, 32, 32)), + 281:('monky.ppm', (0, 416, 32, 32)), + 282:('monky.ppm', (0, 448, 32, 32)), + 291:('ghosty.ppm', (0, 0, 32, 32)), + 292:('ghosty.ppm', (0, 32, 32, 32)), + 293:('ghosty.ppm', (0, 64, 32, 32)), + 294:('ghosty.ppm', (0, 96, 32, 32)), + 295:('ghosty.ppm', (0, 128, 32, 32)), + 296:('ghosty.ppm', (0, 160, 32, 32)), + 297:('ghosty.ppm', (0, 192, 32, 32)), + 298:('ghosty.ppm', (0, 224, 32, 32)), + 299:('ghosty.ppm', (0, 256, 32, 32)), + 300:('ghosty.ppm', (0, 288, 32, 32)), + 301:('ghosty.ppm', (0, 320, 32, 32)), + 305:('ghosty.ppm', (0, 352, 32, 32)), + 306:('ghosty.ppm', (0, 384, 32, 32)), + 307:('ghosty.ppm', (0, 416, 32, 32)), + 308:('ghosty.ppm', (0, 448, 32, 32)), + 317:('flappy.ppm', (0, 0, 32, 32)), + 318:('flappy.ppm', (0, 32, 32, 32)), + 319:('flappy.ppm', (0, 64, 32, 32)), + 320:('flappy.ppm', (0, 96, 32, 32)), + 321:('flappy.ppm', (0, 128, 32, 32)), + 322:('flappy.ppm', (0, 160, 32, 32)), + 323:('flappy.ppm', (0, 192, 32, 32)), + 324:('flappy.ppm', (0, 224, 32, 32)), + 325:('flappy.ppm', (0, 256, 32, 32)), + 326:('flappy.ppm', (0, 288, 32, 32)), + 327:('flappy.ppm', (0, 320, 32, 32)), + 331:('flappy.ppm', (0, 352, 32, 32)), + 332:('flappy.ppm', (0, 384, 32, 32)), + 333:('flappy.ppm', (0, 416, 32, 32)), + 334:('flappy.ppm', (0, 448, 32, 32)), + 343:('springy.ppm', (0, 0, 32, 32)), + 344:('springy.ppm', (0, 32, 32, 32)), + 345:('springy.ppm', (0, 64, 32, 32)), + 346:('springy.ppm', (0, 96, 32, 32)), + 347:('springy.ppm', (0, 128, 32, 32)), + 348:('springy.ppm', (0, 160, 32, 32)), + 349:('springy.ppm', (0, 192, 32, 32)), + 350:('springy.ppm', (0, 224, 32, 32)), + 351:('springy.ppm', (0, 256, 32, 32)), + 352:('springy.ppm', (0, 288, 32, 32)), + 353:('springy.ppm', (0, 320, 32, 32)), + 357:('springy.ppm', (0, 352, 32, 32)), + 358:('springy.ppm', (0, 384, 32, 32)), + 359:('springy.ppm', (0, 416, 32, 32)), + 360:('springy.ppm', (0, 448, 32, 32)), + 369:('springy.ppm', (0, 480, 32, 32)), + 370:('springy.ppm', (0, 512, 32, 32)), + 371:('springy.ppm', (0, 544, 32, 32)), + 372:('springy.ppm', (0, 576, 32, 32)), + 373:('orcy.ppm', (0, 0, 32, 32)), + 374:('orcy.ppm', (0, 32, 32, 32)), + 375:('orcy.ppm', (0, 64, 32, 32)), + 376:('orcy.ppm', (0, 96, 32, 32)), + 377:('orcy.ppm', (0, 128, 32, 32)), + 378:('orcy.ppm', (0, 160, 32, 32)), + 379:('orcy.ppm', (0, 192, 32, 32)), + 380:('orcy.ppm', (0, 224, 32, 32)), + 381:('orcy.ppm', (0, 256, 32, 32)), + 382:('orcy.ppm', (0, 288, 32, 32)), + 383:('orcy.ppm', (0, 320, 32, 32)), + 387:('orcy.ppm', (0, 352, 32, 32)), + 388:('orcy.ppm', (0, 384, 32, 32)), + 389:('orcy.ppm', (0, 416, 32, 32)), + 390:('orcy.ppm', (0, 448, 32, 32)), + 399:('gramy.ppm', (0, 0, 32, 32)), + 400:('gramy.ppm', (0, 32, 32, 32)), + 401:('gramy.ppm', (0, 64, 32, 32)), + 402:('gramy.ppm', (0, 96, 32, 32)), + 403:('gramy.ppm', (0, 128, 32, 32)), + 404:('gramy.ppm', (0, 160, 32, 32)), + 405:('gramy.ppm', (0, 192, 32, 32)), + 406:('gramy.ppm', (0, 224, 32, 32)), + 407:('gramy.ppm', (0, 256, 32, 32)), + 408:('gramy.ppm', (0, 288, 32, 32)), + 409:('gramy.ppm', (0, 320, 32, 32)), + 413:('gramy.ppm', (0, 352, 32, 32)), + 414:('gramy.ppm', (0, 384, 32, 32)), + 415:('gramy.ppm', (0, 416, 32, 32)), + 416:('gramy.ppm', (0, 448, 32, 32)), + 425:('blitzy.ppm', (0, 0, 32, 32)), + 426:('blitzy.ppm', (0, 32, 32, 32)), + 427:('blitzy.ppm', (0, 64, 32, 32)), + 428:('blitzy.ppm', (0, 96, 32, 32)), + 429:('blitzy.ppm', (0, 128, 32, 32)), + 430:('blitzy.ppm', (0, 160, 32, 32)), + 431:('blitzy.ppm', (0, 192, 32, 32)), + 435:('blitzy.ppm', (0, 224, 32, 32)), + 436:('blitzy.ppm', (0, 256, 32, 32)), + 437:('blitzy.ppm', (0, 288, 32, 32)), + 438:('blitzy.ppm', (0, 320, 32, 32)), + 443:('ghost.ppm', (0, 0, 32, 32)), + 444:('ghost.ppm', (0, 32, 32, 32)), + 445:('ghost.ppm', (0, 64, 32, 32)), + 446:('ghost.ppm', (0, 96, 32, 32)), + 447:('ghost.ppm', (0, 128, 32, 32)), + 448:('ghost.ppm', (0, 160, 32, 32)), + 449:('ghost.ppm', (0, 192, 32, 32)), + 450:('ghost.ppm', (0, 224, 32, 32)), + 451:('monky.ppm', (0, 480, 32, 32)), + 452:('monky.ppm', (0, 512, 32, 32)), + 453:('monky.ppm', (0, 544, 32, 32)), + 454:('monky.ppm', (0, 576, 32, 32)), + 455:('monky.ppm', (0, 608, 32, 32)), + 456:('orcy.ppm', (0, 480, 32, 32)), + 457:('orcy.ppm', (0, 512, 32, 32)), + 458:('orcy.ppm', (0, 544, 32, 32)), + 459:('orcy.ppm', (0, 576, 32, 32)), + 460:('orcy.ppm', (0, 608, 32, 32)), + 461:('orcy.ppm', (0, 640, 32, 32)), + 462:('orcy.ppm', (0, 672, 32, 32)), + 463:('orcy.ppm', (0, 704, 32, 32)), + 464:('shot.ppm', (0, 0, 32, 32)), + 465:('shot.ppm', (0, 32, 32, 32)), + 466:('shot.ppm', (0, 64, 32, 32)), + 467:('shot.ppm', (0, 96, 32, 32)), + 468:('shot.ppm', (0, 128, 32, 32)), + 469:('shot.ppm', (0, 160, 32, 32)), + 470:('shot.ppm', (0, 192, 32, 32)), + 471:('shot.ppm', (0, 224, 32, 32)), + 472:('gramy.ppm', (0, 480, 32, 32)), + 473:('gramy.ppm', (0, 512, 32, 32)), + 474:('gramy.ppm', (0, 544, 32, 32)), + 475:('gramy.ppm', (0, 576, 32, 32)), + 476:('blitzy_shot.ppm', (0, 0, 16, 32)), + 477:('bonus_0.ppm', (0, 0, 32, 32)), + 478:('bonus_0.ppm', (0, 32, 32, 32)), + 479:('bonus_0.ppm', (0, 64, 32, 32)), + 480:('bonus_0.ppm', (0, 96, 32, 32)), + 481:('bonus_0.ppm', (0, 128, 32, 32)), + 482:('spinning_drop.ppm', (0, 0, 16, 16)), + 483:('spinning_drop.ppm', (0, 16, 16, 16)), + 484:('spinning_drop.ppm', (0, 32, 16, 16)), + 485:('spinning_drop.ppm', (0, 48, 16, 16)), + 486:('spinning_drop.ppm', (0, 64, 16, 16)), + 487:('spinning_drop.ppm', (0, 80, 16, 16)), + 488:('lightning_small.ppm', (0, 0, 24, 24)), + 489:('fire_drop.ppm', (0, 0, 9, 16)), + 490:('fire_surface.ppm', (0, 0, 16, 16)), + 491:('fire_surface.ppm', (0, 16, 16, 16)), + 492:('fire_surface.ppm', (0, 32, 16, 16)), + 493:('fire_surface.ppm', (0, 48, 16, 16)), + 495:('water_still.ppm', (0, 0, 16, 16)), + 496:('bonus_0.ppm', (0, 160, 32, 20)), + 519:('level_digits.ppm', (0, 0, 14, 20)), + 520:('level_digits.ppm', (0, 20, 14, 20)), + 521:('level_digits.ppm', (0, 40, 14, 20)), + 522:('level_digits.ppm', (0, 60, 14, 20)), + 523:('level_digits.ppm', (0, 80, 14, 20)), + 524:('level_digits.ppm', (0, 100, 14, 20)), + 525:('level_digits.ppm', (0, 120, 14, 20)), + 526:('level_digits.ppm', (0, 140, 14, 20)), + 527:('level_digits.ppm', (0, 160, 14, 20)), + 528:('level_digits.ppm', (0, 180, 14, 20)), + 593:('bonus_1.ppm', (0, 0, 32, 32)), + 594:('bonus_1.ppm', (0, 32, 32, 32)), + 595:('bonus_1.ppm', (0, 64, 32, 32)), + 596:('bonus_1.ppm', (0, 96, 32, 32)), + 597:('bonus_1.ppm', (0, 128, 32, 32)), + 598:('bonus_1.ppm', (0, 160, 32, 32)), + 599:('bonus_1.ppm', (0, 192, 32, 32)), + 600:('bonus_1.ppm', (0, 224, 32, 32)), + 601:('bonus_2.ppm', (0, 0, 32, 32)), + 602:('bonus_2.ppm', (0, 32, 32, 32)), + 603:('bonus_2.ppm', (0, 64, 32, 32)), + 604:('bonus_2.ppm', (0, 96, 32, 32)), + 605:('bonus_2.ppm', (0, 128, 32, 32)), + 606:('bonus_2.ppm', (0, 160, 32, 32)), + 607:('bonus_2.ppm', (0, 192, 32, 32)), + 608:('bonus_2.ppm', (0, 224, 32, 32)), + 609:('bonus_3.ppm', (0, 0, 32, 32)), + 610:('bonus_3.ppm', (0, 32, 32, 32)), + 611:('bonus_3.ppm', (0, 64, 32, 32)), + 612:('bonus_3.ppm', (0, 96, 32, 32)), + 613:('bonus_3.ppm', (0, 128, 32, 32)), + 614:('bonus_3.ppm', (0, 160, 32, 32)), + 615:('bonus_3.ppm', (0, 192, 32, 32)), + 616:('bonus_3.ppm', (0, 224, 32, 32)), + 617:('bonus_4.ppm', (0, 0, 32, 32)), + 618:('bonus_4.ppm', (0, 32, 32, 32)), + 619:('bonus_4.ppm', (0, 64, 32, 32)), + 620:('bonus_4.ppm', (0, 96, 32, 32)), + 621:('bonus_4.ppm', (0, 128, 32, 32)), + 622:('bonus_4.ppm', (0, 160, 32, 32)), + 623:('bonus_4.ppm', (0, 192, 32, 32)), + 624:('bonus_4.ppm', (0, 224, 32, 32)), + 625:('bonus_5.ppm', (0, 0, 32, 32)), + 626:('bonus_5.ppm', (0, 32, 32, 32)), + 627:('bonus_5.ppm', (0, 64, 32, 32)), + 628:('bonus_5.ppm', (0, 96, 32, 32)), + 629:('bonus_5.ppm', (0, 128, 32, 32)), + 630:('bonus_5.ppm', (0, 160, 32, 32)), + 631:('bonus_5.ppm', (0, 192, 32, 32)), + 632:('bonus_5.ppm', (0, 224, 32, 32)), + 633:('bonus_6.ppm', (0, 0, 32, 32)), + 634:('bonus_6.ppm', (0, 32, 32, 32)), + 635:('bonus_6.ppm', (0, 64, 32, 32)), + 636:('bonus_6.ppm', (0, 96, 32, 32)), + 637:('bonus_6.ppm', (0, 128, 32, 32)), + 638:('bonus_6.ppm', (0, 160, 32, 32)), + 639:('bonus_6.ppm', (0, 192, 32, 32)), + 640:('bonus_6.ppm', (0, 224, 32, 32)), + 641:('bonus_7.ppm', (0, 0, 32, 32)), + 642:('bonus_7.ppm', (0, 32, 32, 32)), + 643:('bonus_7.ppm', (0, 64, 32, 32)), + 644:('bonus_7.ppm', (0, 96, 32, 32)), + 645:('bonus_7.ppm', (0, 128, 32, 32)), + 646:('bonus_7.ppm', (0, 160, 32, 32)), + 647:('bonus_7.ppm', (0, 192, 32, 32)), + 648:('bonus_7.ppm', (0, 224, 32, 32)), + 649:('bonus_8.ppm', (0, 0, 32, 32)), + 650:('bonus_8.ppm', (0, 32, 32, 32)), + 651:('bonus_8.ppm', (0, 64, 32, 32)), + 652:('bonus_8.ppm', (0, 96, 32, 32)), + 653:('bonus_8.ppm', (0, 128, 32, 32)), + 654:('bonus_8.ppm', (0, 160, 32, 32)), + 655:('bonus_8.ppm', (0, 192, 32, 32)), + 656:('bonus_8.ppm', (0, 224, 32, 32)), + 657:('bonus_9.ppm', (0, 0, 32, 32)), + 658:('bonus_9.ppm', (0, 32, 32, 32)), + 659:('bonus_9.ppm', (0, 64, 32, 32)), + 660:('bonus_9.ppm', (0, 96, 32, 32)), + 661:('bonus_9.ppm', (0, 128, 32, 32)), + 662:('bonus_9.ppm', (0, 160, 32, 32)), + 663:('bonus_9.ppm', (0, 192, 32, 32)), + 664:('bonus_9.ppm', (0, 224, 32, 32)), + 665:('bonus_10.ppm', (0, 0, 32, 32)), + 666:('bonus_10.ppm', (0, 32, 32, 32)), + 667:('bonus_10.ppm', (0, 64, 32, 32)), + 668:('bonus_10.ppm', (0, 96, 32, 32)), + 669:('bonus_10.ppm', (0, 128, 32, 32)), + 670:('bonus_10.ppm', (0, 160, 32, 32)), + 671:('bonus_10.ppm', (0, 192, 32, 32)), + 672:('bonus_10.ppm', (0, 224, 32, 32)), + 673:('bonus_11.ppm', (0, 0, 32, 32)), + 674:('bonus_11.ppm', (0, 32, 32, 32)), + 675:('bonus_11.ppm', (0, 64, 32, 32)), + 676:('bonus_11.ppm', (0, 96, 32, 32)), + 677:('bonus_11.ppm', (0, 128, 32, 32)), + 678:('bonus_11.ppm', (0, 160, 32, 32)), + 679:('bonus_11.ppm', (0, 192, 32, 32)), + 680:('bonus_11.ppm', (0, 224, 32, 32)), + 681:('bonus_12.ppm', (0, 0, 32, 32)), + 682:('bonus_12.ppm', (0, 32, 32, 32)), + 691:('bonus_12.ppm', (0, 64, 32, 32)), + 692:('bonus_12.ppm', (0, 96, 32, 32)), + 800:('nasty_angry.ppm', (0, 0, 32, 32)), + 801:('nasty_angry.ppm', (0, 32, 32, 32)), + 802:('nasty_angry.ppm', (0, 64, 32, 32)), + 803:('nasty_angry.ppm', (0, 96, 32, 32)), + 804:('nasty_angry.ppm', (0, 128, 32, 32)), + 805:('nasty_angry.ppm', (0, 160, 32, 32)), + 806:('nasty_angry.ppm', (0, 192, 32, 32)), + 807:('nasty_angry.ppm', (0, 224, 32, 32)), + 808:('monky_angry.ppm', (0, 0, 32, 32)), + 809:('monky_angry.ppm', (0, 32, 32, 32)), + 810:('monky_angry.ppm', (0, 64, 32, 32)), + 811:('monky_angry.ppm', (0, 96, 32, 32)), + 812:('monky_angry.ppm', (0, 128, 32, 32)), + 813:('monky_angry.ppm', (0, 160, 32, 32)), + 814:('monky_angry.ppm', (0, 192, 32, 32)), + 815:('monky_angry.ppm', (0, 224, 32, 32)), + 816:('ghosty_angry.ppm', (0, 0, 32, 32)), + 817:('ghosty_angry.ppm', (0, 32, 32, 32)), + 818:('ghosty_angry.ppm', (0, 64, 32, 32)), + 819:('ghosty_angry.ppm', (0, 96, 32, 32)), + 820:('ghosty_angry.ppm', (0, 128, 32, 32)), + 821:('ghosty_angry.ppm', (0, 160, 32, 32)), + 822:('ghosty_angry.ppm', (0, 192, 32, 32)), + 823:('ghosty_angry.ppm', (0, 224, 32, 32)), + 824:('flapy_angry.ppm', (0, 0, 32, 32)), + 825:('flapy_angry.ppm', (0, 32, 32, 32)), + 826:('flapy_angry.ppm', (0, 64, 32, 32)), + 827:('flapy_angry.ppm', (0, 96, 32, 32)), + 828:('flapy_angry.ppm', (0, 128, 32, 32)), + 829:('flapy_angry.ppm', (0, 160, 32, 32)), + 830:('flapy_angry.ppm', (0, 192, 32, 32)), + 831:('flapy_angry.ppm', (0, 224, 32, 32)), + 832:('springy_angry.ppm', (0, 0, 32, 32)), + 833:('springy_angry.ppm', (0, 32, 32, 32)), + 834:('springy_angry.ppm', (0, 64, 32, 32)), + 835:('springy_angry.ppm', (0, 96, 32, 32)), + 836:('springy_angry.ppm', (0, 128, 32, 32)), + 837:('springy_angry.ppm', (0, 160, 32, 32)), + 838:('springy_angry.ppm', (0, 192, 32, 32)), + 839:('springy_angry.ppm', (0, 224, 32, 32)), + 840:('springy_angry.ppm', (0, 256, 32, 32)), + 841:('springy_angry.ppm', (0, 288, 32, 32)), + 842:('springy_angry.ppm', (0, 320, 32, 32)), + 843:('springy_angry.ppm', (0, 352, 32, 32)), + 844:('orcy_angry.ppm', (0, 0, 32, 32)), + 845:('orcy_angry.ppm', (0, 32, 32, 32)), + 846:('orcy_angry.ppm', (0, 64, 32, 32)), + 847:('orcy_angry.ppm', (0, 96, 32, 32)), + 848:('orcy_angry.ppm', (0, 128, 32, 32)), + 849:('orcy_angry.ppm', (0, 160, 32, 32)), + 850:('orcy_angry.ppm', (0, 192, 32, 32)), + 851:('orcy_angry.ppm', (0, 224, 32, 32)), + 852:('gramy_angry.ppm', (0, 0, 32, 32)), + 853:('gramy_angry.ppm', (0, 32, 32, 32)), + 854:('gramy_angry.ppm', (0, 64, 32, 32)), + 855:('gramy_angry.ppm', (0, 96, 32, 32)), + 856:('gramy_angry.ppm', (0, 128, 32, 32)), + 857:('gramy_angry.ppm', (0, 160, 32, 32)), + 858:('gramy_angry.ppm', (0, 192, 32, 32)), + 859:('gramy_angry.ppm', (0, 224, 32, 32)), + 860:('blitzy_angry.ppm', (0, 0, 32, 32)), + 861:('blitzy_angry.ppm', (0, 32, 32, 32)), + 862:('blitzy_angry.ppm', (0, 64, 32, 32)), + 863:('blitzy_angry.ppm', (0, 96, 32, 32)), + 900:('water_flow.ppm', (0, 0, 16, 16)), + 901:('water_flow.ppm', (0, 16, 16, 16)), + 902:('water_flow.ppm', (0, 32, 16, 16)), + 903:('water_flow.ppm', (0, 48, 16, 16)), + 904:('water_flow.ppm', (0, 64, 16, 16)), + 905:('water_flow.ppm', (0, 80, 16, 16)), + 906:('water_flow.ppm', (0, 96, 16, 16)), + 907:('water_flow.ppm', (0, 112, 16, 16)), + 908:('water_flow.ppm', (0, 128, 16, 16)), + 909:('water_flow.ppm', (0, 144, 16, 16)), + 910:('big_bubble.ppm', (0, 0, 64, 64)), + 911:('big_bubble.ppm', (0, 64, 64, 64)), + 912:('big_bubble.ppm', (0, 128, 64, 64)), + 913:('big_bubble.ppm', (0, 192, 64, 64)), + 914:('big_bubble.ppm', (0, 256, 64, 64)), + 915:('big_bubble.ppm', (0, 320, 64, 64)), + 916:('big_bubble.ppm', (0, 384, 64, 64)), + 917:('big_bubble.ppm', (0, 448, 64, 64)), + 918:('big_bubble.ppm', (0, 512, 64, 64)), + 920:('level_digits.ppm', (0, 200, 14, 20)), + 921:('level_digits.ppm', (0, 220, 14, 20)), + 922:('level_digits.ppm', (0, 240, 14, 20)), + 923:('level_digits.ppm', (0, 260, 14, 20)), + 924:('level_digits.ppm', (0, 280, 14, 20)), + 925:('level_digits.ppm', (0, 300, 14, 20)), + 926:('level_digits.ppm', (0, 320, 14, 20)), + 927:('level_digits.ppm', (0, 340, 14, 20)), + 928:('level_digits.ppm', (0, 360, 14, 20)), + 929:('level_digits.ppm', (0, 380, 14, 20)), + 930:('level_digits.ppm', (0, 400, 14, 20)), + 931:('level_digits.ppm', (0, 420, 14, 20)), + 932:('level_digits.ppm', (0, 440, 14, 20)), + 933:('level_digits.ppm', (0, 460, 14, 20)), + 934:('level_digits.ppm', (0, 480, 14, 20)), + 935:('level_digits.ppm', (0, 500, 14, 20)), + 936:('level_digits.ppm', (0, 520, 14, 20)), + 937:('level_digits.ppm', (0, 540, 14, 20)), + 938:('level_digits.ppm', (0, 560, 14, 20)), + 939:('level_digits.ppm', (0, 580, 14, 20)), + 940:('star_large.ppm', (0, 0, 32, 32)), + 941:('star_large.ppm', (0, 32, 32, 32)), + 942:('star_large.ppm', (0, 64, 32, 32)), + 943:('star_large.ppm', (0, 96, 32, 32)), + 944:('star_large.ppm', (0, 128, 32, 32)), + 945:('star_large.ppm', (0, 160, 32, 32)), + 946:('star_large.ppm', (0, 192, 32, 32)), + 947:('star_large.ppm', (0, 224, 32, 32)), + 948:('star_large.ppm', (0, 256, 32, 32)), + 949:('star_large.ppm', (0, 288, 32, 32)), + 950:('star_large.ppm', (0, 320, 32, 32)), + 951:('star_large.ppm', (0, 352, 32, 32)), + + 20:('10000_%d.ppm', (0, 0, 90, 40)), + 21:('20000_%d.ppm', (0, 0, 98, 45)), + 22:('30000_%d.ppm', (0, 0, 98, 45)), + 23:('40000_%d.ppm', (0, 0, 98, 45)), + 24:('50000_%d.ppm', (0, 0, 95, 45)), + 25:('60000_%d.ppm', (0, 0, 96, 45)), + 26:('70000_%d.ppm', (0, 0, 96, 45)), + 176:('dragon_bubble_%d.ppm', (0, 0, 32, 32)), + 177:('dragon_bubble_%d.ppm', (0, 32, 32, 32)), + 178:('dragon_bubble_%d.ppm', (0, 64, 32, 32)), + 179:('dragon_bubble_%d.ppm', (0, 96, 32, 32)), + 180:('dragon_bubble_%d.ppm', (0, 128, 32, 32)), + 181:('dragon_bubble_%d.ppm', (0, 160, 32, 32)), + 182:('dragon_bubble_%d.ppm', (0, 192, 32, 32)), + 183:('dragon_bubble_%d.ppm', (0, 224, 32, 32)), + 184:('dragon_bubble_%d.ppm', (0, 256, 32, 32)), + 188:('dragon_bubble_%d.ppm', (0, 288, 32, 32)), + 189:('dragon_bubble_%d.ppm', (0, 320, 32, 32)), + 190:('dragon_bubble_%d.ppm', (0, 352, 32, 32)), + 191:('dragon_bubble_%d.ppm', (0, 384, 32, 32)), + 192:('dragon_bubble_%d.ppm', (0, 416, 32, 32)), + 193:('dragon_bubble_%d.ppm', (0, 448, 32, 32)), + 194:('dragon_bubble_%d.ppm', (0, 480, 32, 32)), + 210:('dragon_%d.ppm', (0, 0, 32, 32)), + 211:('dragon_%d.ppm', (0, 32, 32, 32)), + 212:('dragon_%d.ppm', (0, 64, 32, 32)), + 213:('dragon_%d.ppm', (0, 96, 32, 32)), + 214:('dragon_%d.ppm', (0, 128, 32, 32)), + 215:('dragon_%d.ppm', (0, 160, 32, 32)), + 216:('dragon_%d.ppm', (0, 192, 32, 32)), + 217:('dragon_%d.ppm', (0, 224, 32, 32)), + 218:('dragon_%d.ppm', (0, 256, 32, 32)), + 219:('dragon_%d.ppm', (0, 288, 32, 32)), + 220:('dragon_%d.ppm', (0, 320, 32, 32)), + 221:('dragon_%d.ppm', (0, 352, 32, 32)), + 222:('dragon_%d.ppm', (0, 384, 32, 32)), + 497:('game_over_%d.ppm', (0, 0, 64, 32)), + 499:('digits_%d.ppm', (0, 0, 14, 17)), + 500:('digits_%d.ppm', (0, 17, 14, 17)), + 501:('digits_%d.ppm', (0, 34, 14, 17)), + 502:('digits_%d.ppm', (0, 51, 14, 17)), + 503:('digits_%d.ppm', (0, 68, 14, 17)), + 504:('digits_%d.ppm', (0, 85, 14, 17)), + 505:('digits_%d.ppm', (0, 102, 14, 17)), + 506:('digits_%d.ppm', (0, 119, 14, 17)), + 507:('digits_%d.ppm', (0, 136, 14, 17)), + 508:('digits_%d.ppm', (0, 153, 14, 17)), + 529:('point_%d.ppm', (0, 0, 48, 24)), + 530:('point_%d.ppm', (0, 24, 48, 24)), + 531:('point_%d.ppm', (0, 48, 48, 24)), + 532:('point_%d.ppm', (0, 72, 48, 24)), + 533:('point_%d.ppm', (0, 96, 48, 24)), + 534:('point_%d.ppm', (0, 120, 48, 24)), + 535:('point_%d.ppm', (0, 144, 48, 24)), + 536:('point_%d.ppm', (0, 168, 48, 24)), + 537:('point_%d.ppm', (0, 192, 48, 24)), + 538:('point_%d.ppm', (0, 216, 48, 24)), + 539:('point_%d.ppm', (0, 240, 48, 24)), + 540:('point_%d.ppm', (0, 264, 48, 24)), + 541:('point_%d.ppm', (0, 288, 48, 24)), + 542:('point_%d.ppm', (0, 312, 48, 24)), + 543:('point_%d.ppm', (0, 336, 48, 24)), + 544:('point_%d.ppm', (0, 360, 48, 24)), + 545:('point_%d.ppm', (0, 384, 48, 24)), + 546:('point_%d.ppm', (0, 408, 48, 24)), + 547:('point_%d.ppm', (0, 432, 48, 24)), + 548:('point_%d.ppm', (0, 456, 48, 24)), + 549:('point_%d.ppm', (0, 480, 48, 24)), + 550:('point_%d.ppm', (0, 504, 48, 24)), + 551:('point_%d.ppm', (0, 528, 48, 24)), + 552:('point_%d.ppm', (0, 552, 48, 24)), + 553:('point_%d.ppm', (0, 576, 48, 24)), + 683:('dragon_%d.ppm', (0, 416, 32, 32)), + 684:('dragon_%d.ppm', (0, 448, 32, 32)), + 685:('dragon_%d.ppm', (0, 480, 32, 32)), + 686:('dragon_%d.ppm', (0, 512, 32, 32)), + 693:('dragon_%d.ppm', (0, 544, 32, 32)), + 694:('dragon_%d.ppm', (0, 576, 32, 32)), + 695:('dragon_%d.ppm', (0, 608, 32, 32)), + } Added: pypy/extradoc/talk/pypy-talk-pycon2005/cyrvetic.ttf ============================================================================== Binary file. No diff available. Added: pypy/extradoc/talk/pypy-talk-pycon2005/def.py ============================================================================== --- (empty file) +++ pypy/extradoc/talk/pypy-talk-pycon2005/def.py Fri May 20 13:57:28 2005 @@ -0,0 +1,693 @@ + +def hwall(x, y, cnt): + for i in range(cnt): + b.sprites.append(Sprite(x, y, b.wallico)) + x += 16 + +def vwall(x, y, cnt): + for i in range(cnt): + b.sprites.append(Sprite(x, y, b.wallico)) + y += 16 + +Player = mnstrmap.GreenAndBlue.players[5] +Player = Player[3:6] +sprmap['py'] = ('pycon.ppm', (0, 0, 32, 32)) + +class MyRunner(ProgramRunner): + + def __init__(self, x, y, stateexample, statelines, program, states): + self.st = StateFrame(x, y+64, stateexample, statelines, + self.statebgcolor, self.stateformat) + self.mascotte = Sprite(x, y, sprget(self.images[-1], doublesize)) + ProgramRunner.__init__(self, program, self.st, self.images, states) + + def kill(self): + self.st.kill() + self.mascotte.kill() + ProgramRunner.kill(self) + +class RunCPython(MyRunner): + statebgcolor = 0xC0C0C0 + images = mnstrmap.Nasty.right + stateformat = '%s = %s' + +#class RunSpace(MyRunner): +# statebgcolor = 0xFF8080 +# images = Player +# stateformat = '%s <- %s' + +COMPRESSED = 0 + +class Bookkeeper(LogFrame): + image = mnstrmap.Monky.right[0], None + sdx = +6 + sdy = -40 + bgcolor = 0xFFFF80 + from_right = 0 + def __init__(self, x, y, example, nblines=None): + if COMPRESSED: + nblines = nblines or 9 + interline = 5 + else: + nblines = nblines or 7 + interline = 12 + LogFrame.__init__(self, x, y, example, nblines=nblines, + bgcolor=self.bgcolor, interline=interline) + self.s = Sprite(x + self.w*self.from_right + self.sdx, + y + self.h + self.sdy, + sprget(*self.image)) + def kill(self): + self.s.kill() + LogFrame.kill(self) + def revive(self, dx=0, dy=0): + LogFrame.revive(self, dx, dy) + self.s.revive(dx, dy) + +class Codemaker(Bookkeeper): + image = mnstrmap.Springy.right[0], None + +class DarkerCodemaker(Codemaker): + bgcolor = 0xD0D060 + +class CPU(Bookkeeper): + bgcolor = 0xC080FF + image = ('lem-walk', 1, 0), doublesize + sdx = -6 + sdy = -72 + +class CPU_Right(CPU): + bgcolor = 0xC080FF + image = ('lem-walk', -1, 0), doublesize + sdx = -56 + sdy = -72 + from_right = 1 + +class CPU_Nowhere(CPU_Right): + sdy = -9999 + + +class TextFrame(LogFrame): + shadow = 3 + + def __init__(self, x, y, text, bgcolor): + text += ' ' + LogFrame.__init__(self, x, y, text, 1, bgcolor) + self.append(text) + + +class Space(Frame): + hack = 169 + + def __init__(self, x=200, y=370): + Frame.__init__(self, x, y, 520, 210, self.bgcolor) + self.mascotte = Sprite(x+420, y-64, sprget(self.images[-1], doublesize)) + self.operations = [ + TextFrame(x+220, y+25, '__add__', self.opcolor), + TextFrame(x+220, y+85, '__getitem__', self.opcolor), + TextFrame(x+220, y+145, '__getattribute__', self.opcolor), + #TextFrame(x+220, y+205, '__hash__', self.opcolor), + ] + #for i in range(10,-1,-5): + # t = TextFrame(x+20+i, y+145+i*2, '__getattribute__', self.opcolor) + self.linepos = {} + + def goto(self, yline, steps=15): + def anim(line, key): + newline = Line(line.x+77, line.y, line.text[len(key)+3:], line.size, + line.bold, line.font, 0xFF0000) + op = self.operations[int(yline+0.5)] + op.ontop() + self.linepos[yline] = line.x, line.y + x2 = self.x+240 + y2 = self.y+30+int(yline*60) + for t in newline.straightline(x2, y2, steps): + yield t + newline.kill() + return anim + + def comefrom(self, yline, value, steps=12): + def anim(line, key): + line.text = line.text[:len(key)+3] + newline = Line(self.x+240, self.y+30+yline*60, str(value), line.size, + line.bold, line.font, 0xFF0000) + op = self.operations[int(yline+0.5)] + op.ontop() + for t in newline.straightline(newline.x, newline.y+60): + yield t + for t in newline.straightline(line.x+self.hack, line.y, steps): + yield t + line.text += ' ' + str(value) + newline.kill() + return anim + + def compute(self, yline): + def anim(line, key): + op = self.operations[int(yline+0.5)] + opbg = op.bgcolor + for t in range(4): + op.bgcolor = 0xFF8080 + for i in range(2): yield None + op.bgcolor = opbg + for i in range(2): yield None + return anim + + +class StdObjSpace(Space): + bgcolor = 0x8080FF + opcolor = 0xD0D0FF + images = mnstrmap.Orcy.left + +class FruitObjSpace(Space): + bgcolor = 0xFFFF00 + opcolor = 0xFFFF90 + images = mnstrmap.Flappy.left + hack = 157 + +class FlowObjSpace(Space): + bgcolor = 0xFF70FF + opcolor = 0xFFC0FF + images = mnstrmap.Ghosty.left + +# flash the __getitem__ a bit +# record operations somewhere on FlowObjSpace +# much slower! + + +# ____________________________________________________________ + +b = Board() +#h1 = HeadLine(bwidth//2, 80, "PyPy", 48, color=0xFF0000) +h2 = HeadLine(bwidth//2, 300, "PyPy", 160, color=0xCC1E2F) + +sprmap['pypy'] = ('pypy.ppm', (0, 0, 149, 110)) +Sprite((bwidth-149)//2, 100, sprget('pypy')) + +#h3 = HeadLine(bwidth//2, 450, " featuring", 32, color=0xCCCCCC) +b.pause('Press Space to continue and Left Arrow to go back') + +for h in [h2]: + h.gen.append(h.shiftcolor(0x400000, 4)) +b.animate('', 0) + +# ____________________________________________________________ + +def slide_nextline(line, pause=True, foreground=[]): + global text + for p in b.sprites[:]: + if isinstance(p, Program): + p.kill() + for s in p.allspr: + s.kill() + text += line + '\n' + p = Program(90, 250, text) + for s in foreground: + s.kill(); s.revive() + b.animate('', 0) + p.s.h += 8 + if pause: + b.pause(' ') + +def slide(title, lines): + global b, text + b = Board() + h = Line(60, 120, title, 56, color=0x101010) + h.gen.append(h.shiftcolor(0xFFBFDF, 3)) + b.animate('', 0) + text = '' + for line in lines: + slide_nextline(line) + + +slide('PyPy Status Report', + ['Highly compliant Python implementation in Python', + 'Quite complete', + 'Some original features already', + 'Program analysis/checking toolchain']) + +# ____________________________________________________________ + +class Lemming(Sprite): + def right(self, tox): + self.setimages(self.cyclic([('lem-walk', 1, i) for i in range(8)], 1, + doublesize)) + while self.x < tox: + yield None + self.step(4, 0) + def down(self, toy): + self.setimages(self.cyclic([('lem-fall', 1, i) for i in range(4)], 1, + doublesize)) + while self.y < toy: + yield None + self.step(0, 8) + def run(self): + sprget(('lem-fall', 1, 0), doublesize) + sprget(('lem-crash', 0), doublesize) + for t in self.right(16+15*16-24): + yield t + for t in self.down(self.y+32): + yield t + for t in self.right(16+19*16-24): + yield t + for t in self.down(bheight - 80): + yield t + self.setimages(self.cyclic([('lem-crash', n) for n in range(16)], 1, + doublesize)) + for n in range(17): + yield None + self.kill() + yield "stop" + +leftcol = 100 + +##b = Board() +##s = HeadLine(bwidth//2, 48, "Penty", 64, color=0x000000) +##s.gen.append(s.shiftcolor(0x0080FF, 4)) +##slast = Sprite(leftcol, s.y-20, sprget(('lem-walk', 1, 0), doublesize)) +##hwall(16, 384, 15) +##hwall(256, 384+32, 4) +##Lemming(192-64, 384-64) +##b.animate('+A Lemming in the role of the CPU: pretty dumb, follows path, crashes') + +# ____________________________________________________________ + +class Nasty(Sprite): + def left(self, tox): + self.setimages(self.cyclic(mnstrmap.Nasty.left, 1, doublesize)) + while self.x > tox: + yield None + self.step(-9, 0) + def right(self, tox): + self.setimages(self.cyclic(mnstrmap.Nasty.right, 1, doublesize)) + while self.x < tox: + yield None + self.step(9, 0) + def up(self, toy): + while self.y > toy: + self.step(0, -16) + yield None + def down(self, toy): + while self.y < toy: + self.step(0, 16) + yield None + def run(self): + for t in self.right(300): + yield t + self.setimages(None) + yield None + self.seticon(sprget(mnstrmap.Nasty.left[1], doublesize)) + yield None + yield None + self.seticon(sprget(mnstrmap.Nasty.right[1], doublesize)) + yield None + yield None + self.seticon(sprget(mnstrmap.Nasty.left[2], doublesize)) + for t in self.up(384): + yield t + for t in self.left(136): + yield t + for t in self.down(bheight-80): + yield t + for t in self.left(16): + yield t + for t in self.right(100): + yield t + yield "stop" + +##b = Board(last=slast) +##s = HeadLine(bwidth//2, 160, "CPy", 64, color=0x000000) +##s.gen.append(s.shiftcolor(0xA0A0A0, 4)) +##slast = Sprite(leftcol, s.y-16, sprget(mnstrmap.Nasty.right[0], doublesize)) +##hwall(192, 448, 24) +##Nasty(230, bheight-80) +##b.animate('+The regular CPython interpreter: an automaton, dumb too, more robust') + +# ____________________________________________________________ + +##b = Board(last=slast) +##s = HeadLine(bwidth//2, 272, "The Abstracter", 48, color=0x000000) +##s.gen.append(s.shiftcolor(0xCC1E2F, 4)) +##Sprite(leftcol, s.y-16, sprget(Player[0], doublesize)) +##b.animate('+The Psyco guys, which we will introduce in due time...') + +# ____________________________________________________________ + +##s = HeadLine(bwidth//2, 384, "The Bookkeeper", 48, color=0x000000) +##s.gen.append(s.shiftcolor(0xC8C8C8, 4)) +##Sprite(leftcol, s.y-16, sprget(mnstrmap.Monky.right[0], doublesize)) +##b.animate('+The Psyco guys, which we will introduce in due time...') + +# ____________________________________________________________ + +##s = HeadLine(bwidth//2, 484, "The Codemaker", 48, color=0x000000) +##s.gen.append(s.shiftcolor(0xFF9933, 4)) +##Sprite(leftcol, s.y-16, sprget(mnstrmap.Springy.right[0], doublesize)) +##b.animate('+The Psyco guys, which we will introduce in due time...') + +# ============================================================ + +b = Board() +p = Program(170, 50, """ +def sum(seq): + total = 0 + for i in range(len(seq)): + total += seq[i] + return total +""") +Sprite(p.s.x + p.s.w - 48 - 32, p.s.y + 7, sprget('py', doublesize)) +b.pause('The Python code example we will use for the whole presentation') + +# ____________________________________________________________ + +seq = [6,3,8,1,5] +states = [ + (1, {'seq': seq}), + 'pause+At the left, the "state" of the automaton keeps track of the local variables', + (2, {'total': 0}), + ] +total = 0 +for i in range(len(seq)): + states.append((3, {'i': i})) + total += seq[i] + states.append((4, {'total': total})) +states.append((5, {})) + +r = RunCPython(40, 320, {'seq': seq}, 3, p, states) +b.animate('Here is how CPython interprets this code') + +r.kill() + +# ____________________________________________________________ + +seq = [6,3,8] + +RED = 0xC00000 +GREEN = 0x008000 + +b = Board() +p = Program(170, 50, """ +def sum(seq): + total = 0 + for i in range(len(seq)): + total += seq[i] + return total +""") +space = StdObjSpace() +states = [ + 'pause', + (1, {'seq ': ' '+str(seq)}), + (2, {'total': ' 0'}), + (3, {'i ': ' 0'}), + (3, {'item ': ''}), + 'pause', + + (3, {'seq ': space.goto(0.9, 35), + 'i ': space.goto(1.2, 35)}), + (3, {}), + (3, {}), + (3, {}), + (3, {}), + (3, {'item ': space.compute(1)}), + (3, {}), + (3, {'item ': space.comefrom(1, 6, 25)}), + (3, {}), + (3, {}), + (3, {}), + (3, {}), + (3, {}), + (3, {}), + 'pause', + + (3, {'total': space.goto(-0.1, 35), + 'item ': space.goto(0.2, 35)}), + (3, {}), + (3, {}), + (3, {}), + (3, {'total': space.compute(0)}), + (3, {}), + (3, {'total': space.comefrom(0, 6, 25)}), + (3, {}), + (3, {}), + (3, {}), + (3, {}), + (3, {}), + (4, {}), + 'pause', + + #(2, {'total': 0}), + ] +total = 0 +for i in range(len(seq)): + total += seq[i] + if i>0: + states.extend([ + (3, {'i ': ' '+str(i)}), + (3, {'seq ': space.goto(0.9), + 'i ': space.goto(1.2)}), + (3, {'item ': space.compute(1)}), + (3, {'item ': space.comefrom(1, seq[i])}), + (3, {}), + (3, {}), + (3, {}), + + (3, {'total': space.goto(-0.1), + 'item ': space.goto(0.2)}), + (3, {'total': space.compute(0)}), + (3, {'total': space.comefrom(0, total)}), + (3, {}), + (4, {}), + (4, {}), + ]) +states.append((5, {})) + +r = RunCPython(40, 300, {'total': ''}, 4, p, states) + +b.animate('') + + + +# ____________________________________________________________ + +RED = 0xC00000 +GREEN = 0x008000 + +b = Board() +p = Program(170, 50, """ +def sum(seq): + total = 0 + for i in range(len(seq)): + total += seq[i] + return total +""") +space = FruitObjSpace() +states = [ + (1, {'seq ': ' \x00594'}), + (2, {'total': ' \x00596'}), + (3, {'i ': ' \x00597'}), + (3, {'item ': ''}), + 'pause', + + (3, {'seq ': space.goto(0.9), + 'i ': space.goto(1.2)}), + (3, {}), + (3, {'item ': space.comefrom(1, '\x00598')}), + (3, {}), + (3, {}), + #'pause', + + (3, {'total': space.goto(-0.1), + 'item ': space.goto(0.2)}), + (3, {}), + (3, {'total': space.comefrom(0, '\x00593')}), + (3, {}), + (4, {}), + #'pause', + + (3, {'seq ': space.goto(0.9), + 'i ': space.goto(1.2)}), + (3, {}), + (3, {'item ': space.comefrom(1, '\x00602')}), + (3, {}), + (3, {}), + #'pause', + + (3, {'total': space.goto(-0.1), + 'item ': space.goto(0.2)}), + (3, {}), + (3, {'total': space.comefrom(0, '\x00606')}), + (3, {}), + (4, {}), + ] + +states.append((5, {})) + +r = RunCPython(40, 300, {'total': ''}, 4, p, states) + +b.animate('') + + +# ____________________________________________________________ + +RED = 0xC00000 +GREEN = 0x008000 + +b = Board() +p = Program(40, 50, """ +def sum(seq): + total = 0 + for i in range(len(seq)): + total += seq[i] + return total +""") +space = FlowObjSpace() +states = [ + (1, {'seq ': ' A'}), + (2, {'total': ' B'}), + (3, {'i ': ' C'}), + (3, {'item ': ''}), + 'pause', + + (3, {'seq ': space.goto(0.9), + 'i ': space.goto(1.2)}), + (3, {}), + (3, {'item ': space.comefrom(1, 'D')}), + (3, {}), + (3, {}), + + (3, {'total': space.goto(-0.1), + 'item ': space.goto(0.2)}), + (3, {}), + (3, {'total': space.comefrom(0, 'E')}), + (3, {}), + (4, {}), + ] + +r = RunCPython(40, 300, {'total': ''}, 4, p, states) + +b.animate('') + +p = Program(510, 140, "D = getitem(A, C)\nE = add(B, D)\n", bgcolor=0xFFFF7F) +b.pause(' ') + +# ____________________________________________________________ + +##### * <=> translator.py: t.view() +b = Board() +b.pause(' ') +##### + +slide("Staticness Conditions", + ["do whatever you like at boot-time", + "then no more dynamic function/class creation", + "constant globals, constant class attr/methods", + "can use exceptions", + "type coherency"]) + +slide("Type Coherency", + ['a "type" means here a "set of objects"', + "customizable for your program", + 'for PyPy, we implemented a reasonable selection']) + +##### * <=> t.annotate() +b = Board() +b.pause(' ') +##### + +slide("Algorithm", + ['"naive" forward propagation', + 'also known as "abstract interpretation"', + 'bottom-up fixpoint search', + 'user provides an entry point function']) + +slide("Features", + ["analyses the preinitialized program in-memory", + "no user annotation", + "full-program analysis"]) + +s1 = Sprite(364, 333, sprget(691)) # sugar +b.pause(' ') + +s2 = Sprite(364, 294, sprget(618)) # red diamond +b.pause(' ') + +s3 = Sprite(364-32+3, 196, sprget(16)) # big violet diamond +b.pause(' ') + +slide_nextline("mostly language-independent", False, [s1,s2,s3]) +Sprite(450, 400-8, sprget(593)) +Sprite(470, 396-8, sprget(596)) +Sprite(482, 402-8, sprget(606)) +Sprite(530, 397, sprget(595)) +Sprite(512, 400, sprget(594)) +b.pause(' ') + +# ____________________________________________________________ + +slide("Compare To", + ["@types(int, str, returning=int) "]) + +s = Sprite(480, 246, sprget(618)) +n = Sprite(bwidth-8*15, 246, sprget(mnstrmap.Monky.left[-1])) +n.setimages(n.cyclic(mnstrmap.Monky.left, 1)) +n.gen.append(n.walkabit(20-8, -15, 0)) +b.animate('', 0) +s.kill() +n.setimages(n.cyclic(mnstrmap.Monky.right, 1)) +n.gen.append(n.walkabit(20, +15, 0)) +b.animate('') +n.kill() + +slide_nextline("exact restriction-less typing (local vars only) ", False) +s1 = Sprite(660, 296, sprget(618)) +s2 = Sprite(660+32, 296, sprget(619)) +b.pause(' ') + +slide_nextline("full-program source code analysis (Starkiller)", False, [s1,s2]) +s3 = Sprite(660+16, 333, sprget(630)) # sugar +b.pause(' ') + +# ____________________________________________________________ + +slide("Related Tools", []) +slide_nextline("Python2C", False) +slide_nextline("Pyrex (Python-like source with types)", False) +slide_nextline("Psyco (100% run-time)") + +# ____________________________________________________________ + +slide("PyPy's Type Model", + ["int, float, str, bool, function", + "tuple, list, dict, iter", + "prebuilt constants", + "class, instance"]) + +##### * <=> t.annotate() with OO (translate_pypy1.py?) +b = Board() +b.pause(' ') +##### + +slide("Code Generation", + ["can generate Pyrex (at PyCon 2004 already)", + "can generate a slow C extension module (a la Python2C)", + "can do Common Lisp / Java / LLVM / C++ / Python..."]) + +slide("Next Steps", + ["good C code", + "Java? maybe, for object model", + "LLVM in development (Carl Friedrich Bolz)"]) + +slide("Conclusion", + [" PyPy CPython-compliancy: OK ", + " PyPy running over CPython: nice but too slow", + " type inferencing tools: OK", + "infer types in PyPy source: OK"]) +slide_nextline( + " generate fast typed code: next step!", False) + +for x, images in [(0, mnstrmap.Monky.right), + (-64, mnstrmap.Nasty.right), + (-128, mnstrmap.Orcy.right)]: + n = Sprite(x, bheight-32-16, sprget(images[-1])) + n.setimages(n.cyclic(images, 1)) + n.gen.append(n.walkabit((bwidth+192)//15, +15, 0)) +b.animate('') + Added: pypy/extradoc/talk/pypy-talk-pycon2005/ep.py ============================================================================== --- (empty file) +++ pypy/extradoc/talk/pypy-talk-pycon2005/ep.py Fri May 20 13:57:28 2005 @@ -0,0 +1,651 @@ +from __future__ import generators +import pygame +from pygame.locals import * +import sys, os +from bubbob import pixmap +from bubbob.patmap import patmap +from bubbob import mnstrmap + +SubtitlesLine = 0 +#SubtitlesLine = 28 + +bwidth = 784 +bheight = 592 + +pygame.init() +winstyle = HWSURFACE # |FULLSCREEN +bestdepth = pygame.display.mode_ok((bwidth, bheight+SubtitlesLine), winstyle, 32) +screen = pygame.display.set_mode((bwidth, bheight+SubtitlesLine), winstyle, + bestdepth) + + +class Ico: + Cache = {} + + def __init__(self, filename, rect, filter=None, colorkey=0x010101): + try: + img = Ico.Cache[filename, filter] + except KeyError: + data = open(filename, 'rb').read() + w, h, data = pixmap.decodepixmap(data) + if filter: + w, h, data = filter(w, h, data) + img = pygame.image.fromstring(data, (w, h), "RGB") + if colorkey is not None: + img.set_colorkey(color(colorkey), RLEACCEL) + Ico.Cache[filename, filter] = img + if filter: + rect = doublerect(rect) + self.img = img.subsurface(rect) + self.w, self.h = self.img.get_size() + def draw(self, x, y): + screen.blit(self.img, (x, y)) + +sprmap = {} + +def doublesize(w, h, data): + scanline = 3*w + result = [] + for position in range(0, scanline*h, scanline): + line = [] + for p in range(position, position+scanline, 3): + line.append(2 * (data[p ] + data[p+1] + data[p+2])) + line = ''.join(line) + result.append(line) + result.append(line) + return w*2, h*2, ''.join(result) + +def doublerect((x, y, w, h)): + return x*2, y*2, w*2, h*2 + +def sprget(n, filter=None, spriconcache={}): + try: + return spriconcache[n, filter] + except KeyError: + filename, rect = sprmap[n] + ico = Ico(filename, rect, filter) + spriconcache[n, filter] = ico + return ico + +def loadpattern(n): + filename, rect = patmap[n] + filename = os.path.join('pat', filename) + bitmap = gamesrv.getbitmap(filename, keycol) + return bitmap, rect + +def patterns(): + for n in range(100): + filename, rect = patmap[n, 0, 0] + filename = os.path.join('bubbob', 'pat', filename) + ico1 = Ico(filename, rect) + x, y, w, h = rect + ico2 = Ico(filename, (x, y, 16, 16), pixmap.makebkgnd, colorkey=None) + yield ico1, ico2 + +try: + import psyco +except ImportError: + pass +else: + psyco.bind(doublesize) + psyco.bind(pixmap.makebkgnd) + +class GoToFrame: + pass + +class Board: + TargetFrame = 1 + subtitle = '' + + def __init__(self, last=None): + self.wallico, self.bkgndico = Patterns.next() + if last is None: + sprites = [] + else: + sprites = b.sprites[:b.sprites.index(last)+1] + self.sprites = sprites + + def insertbefore(self, s1, s2): + self.sprites.remove(s1) + i = self.sprites.index(s2) + self.sprites.insert(i, s1) + + def draw(self): + for x in range(24, bwidth-16, 32): + for y in range(24, bheight-16, 32): + self.bkgndico.draw(x,y) + for x in range(0, bwidth, 16): + self.wallico.draw(x, 0) + for y in range(16, bheight-16, 16): + self.wallico.draw(0, y) + self.wallico.draw(bwidth-16, y) + screen.fill((0, 0, 0), (0, bheight, 16, 16)) + for x in range(0, bwidth, 16): + self.wallico.draw(x, bheight-16) + + for s in self.sprites: + s.draw() + if SubtitlesLine > 0: + draw_subtitle(self.subtitle) + pygame.display.flip() + + def handle(self, event): + if event.type == KEYDOWN: + if event.key == K_LEFT: + Board.TargetFrame = int(Board.CurFrame-0.5) + if Board.TargetFrame < 0: + Board.TargetFrame = 0 + return 1 + if event.key == K_RIGHT: + Board.TargetFrame = int(Board.CurFrame+1) + return 1 + if event.key == K_SPACE: + return 1 + if event.type == QUIT: + raise SystemExit + return 0 + + def animate(self, msg, pausing=1): + while 1: + if msg.startswith('+'): + msg = msg[1:] + self.subtitle = msg.strip() + else: + self.subtitle = '' + stop = None + clock = pygame.time.Clock() + progress = 1 + Board.CurFrame += 0.5 + while not stop and progress: + if Board.TargetFrame is None: + self.draw() + clock.tick(9) + e = pygame.event.poll() + if e: + self.handle(e) + progress = 0 + for s in self.sprites[:]: + for g in s.gen[:]: + try: + stop = g.next() or stop + except StopIteration: + s.gen.remove(g) + else: + progress = 1 + self.pause(msg, pausing) + if not (isinstance(stop, str) and stop.startswith("pause")): + break + msg = stop[5:] + pausing = 1 + + def pause(self, msg, pausing=1): + self.subtitle = msg.strip() + Board.CurFrame = int(Board.CurFrame+1) + while 1: + if Board.TargetFrame is None: + self.draw() + if pausing: + e = pygame.event.wait() + while not self.handle(e): + e = pygame.event.wait() + if Board.TargetFrame is None: + break + pausing = 1 + if Board.TargetFrame == Board.CurFrame: + Board.TargetFrame = None + continue + if Board.TargetFrame < Board.CurFrame: + raise GoToFrame() + break + +# ____________________________________________________________ + +class Sprite: + imgsetter = None + run = None + + def __init__(self, x, y, ico=None): + self.x = x + self.y = y + self.ico = ico + self.gen = [] + if self.run is not None: + self.gen.append(self.run()) + b.sprites.append(self) + + def setimages(self, gen): + if self.imgsetter is not None: + self.gen.remove(self.imgsetter) + self.imgsetter = gen + if gen is not None: + self.gen.append(gen) + + def draw(self): + if self.ico: + self.ico.draw(self.x, self.y) + + def move(self, x, y, ico=None): + self.x = x + self.y = y + if ico: + self.ico = ico + + def step(self, dx, dy): + self.x += dx + self.y += dy + + def seticon(self, ico): + self.ico = ico + + def kill(self): + b.sprites.remove(self) + + def revive(self, dx=0, dy=0): + del self.gen[:] + b.sprites.append(self) + if dx or dy: + self.gen.append(self.straightline(self.x+dx, self.y+dy)) + + def cyclic(self, nimages, speed=5, filter=None): + images = [sprget(n, filter) for n in nimages] + speed = range(speed) + while 1: + for img in images: + self.seticon(img) + for i in speed: + yield None + + def straightline(self, x, y, steps=5): + for i in range(steps): + f = 1.5 / (steps-i) + self.move(int(f*x + (1-f)*self.x), + int(f*y + (1-f)*self.y)) + yield None + + def walkabit(self, n, dx, dy): + for i in range(n): + self.step(dx, dy) + yield None + yield "stop" + + def stopafter(self, delay): + for i in range(delay): + yield None + yield "stop" + + def die(self, delay): + for i in range(delay): + yield None + self.kill() + + def ontop(self): + b.sprites.remove(self) + b.sprites.append(self) + +# ____________________________________________________________ + +FONT = 'cyrvetic.ttf' +FONT2 = 'VeraMoBd.ttf' + +def getfont(size, bold, font): + font = pygame.font.Font(font, size) + font.set_bold(bold) + return font + +def color(c): + return c >> 16, (c >> 8) & 0xFF, c & 0xFF + +def colorstep(current, target, f): + r1, g1, b1 = color(current) + r2, g2, b2 = color(target) + r = f*r2 + (1-f)*r1 + g = f*g2 + (1-f)*g1 + b = f*b2 + (1-f)*b1 + return (int(r) << 16) | (int(g) << 8) | int(b) + +def draw_subtitle(s): + screen.fill((0, 0, 0), (0, bheight+5, bwidth, SubtitlesLine-5)) + if s: + font = getfont(16, 0, FONT2) + imgs = [font.render(line, 0, (255, 255, 255), (0, 0, 60)) + for line in s.split('\n')] + imgs.reverse() + y = bheight+SubtitlesLine + for img in imgs: + w, h = img.get_size() + y -= h + screen.blit(img, ((bwidth-w)//2, y)) + +class Line(Sprite): + TextCache = {} + + def __init__(self, x, y, text, size, bold=1, font=FONT, color=0xFFFFFF): + self.x = x + self.y = y + self.text = text + self.size = size + self.bold = bold + self.font = font + self.color = color + self.gen = [] + self.setup() + b.sprites.append(self) + + def setup(self): + pass + + def render(self): + text = self.text + if '\x00' in text: + i = text.index('\x00') + ico = eval(text[i+1:]) + text = text[:i] + else: + ico = None + key = (text, self.size, self.bold, self.font, self.color, ico) + try: + return Line.TextCache[key] + except KeyError: + font = getfont(self.size, self.bold, self.font) + img = font.render(text or ' ', 1, color(self.color)) + if ico is not None: + ico = sprget(ico) + w, h = img.get_size() + s = pygame.Surface((w+ico.w, max(h,ico.h))) + s.fill((1,1,1)) + s.blit(img, (0,0)) + s.blit(ico.img, (w,0)) + s.set_colorkey((1,1,1)) + img = s + Line.TextCache[key] = img + return img + + def draw(self): + img = self.render() + screen.blit(img, (self.x, self.y)) + + def shiftcolor(self, target, steps, delay=0): + for i in range(delay): + yield None + for i in range(steps): + f = float(i+1) / steps + self.color = colorstep(self.color, target, f) + yield None + + +class CenterLine(Line): + def setup(self): + w, h = self.render().get_size() + self.x -= w//2 + +class HeadLine(CenterLine): + def setup(self): + CenterLine.setup(self) + Line(self.x+4, self.y+4, self.text, self.size, + self.bold, self.font, color = 0x000000) + +class Frame(Sprite): + shadow = 6 + + def __init__(self, x, y, w, h, bgcolor=0xFFFFFF): + self.x = x + self.y = y + self.w = w + self.h = h + self.bgcolor = bgcolor + self.gen = [] + self.setup() + b.sprites.append(self) + + def setup(self): + pass + + def draw(self): + x, y, w, h = self.x, self.y, self.w, self.h + screen.fill(color(self.bgcolor), (x, y, w, h)) + shadow = color(0x000000) + s = self.shadow + screen.fill(shadow, (x+s, y+h, w, s)) + screen.fill(shadow, (x+w, y+s, s, h-s)) + +class Program: + + def __init__(self, x, y, text, bgcolor=0xFFFFFF): + self.x = x + self.y = y + lines = text.split('\n') + if not lines[0]: del lines[0] + allspr = [] + y0 = y + for line in lines: + if line: + allspr.append(Line(x, y, line, 20, 0, + font=FONT2, color=0x000000)) + y += 48 + maxw = max([s.render().get_size()[0] for s in allspr]) + self.s = Frame(x-20, y0-20, maxw+40, y-y0-40, bgcolor=bgcolor) + b.insertbefore(self.s, allspr[0]) + self.allspr = allspr + [self.s] + + def getcoord(self, linenum): + return (self.x - 12, self.y + 48*linenum - 29) + +class ProgramRunner(Sprite): + + def __init__(self, program, state, images, steps): + x, y = program.getcoord(0) + Sprite.__init__(self, x, y, sprget(images[0])) + self.setimages(self.cyclic(images, 1)) + self.program = program + self.state = state + self.steps = steps + + def go(self, linenum): + x, y = self.program.getcoord(linenum) + for t in self.straightline(x, y): + yield t + + def run(self): + for state in self.steps: + if isinstance(state, str) and state.startswith("pause"): + yield state + else: + linenum, statechanges = state + self.state.change(statechanges) + for t in self.go(linenum): + yield t + yield None + yield "stop" + +class StateFrame(Frame): + font = FONT2 + size = 20 + liney0 = 35 + + def __init__(self, x, y, example, nblines, bgcolor, format = '%s = %s'): + self.format = format + wmax = 0 + for keyvalue in example.items(): + s = Line(0, 0, self.format % keyvalue, self.size, 0, self.font) + w, h = s.render().get_size() + if w > wmax: wmax = w + self.hstep = h+12 + s.kill() + Frame.__init__(self, x, y, wmax+30, nblines*self.hstep+50, bgcolor) + self.state = {} + + def change(self, nstate): + for key, value in nstate.items(): + if isinstance(key, LogFrame): + key.log(value) + continue + try: + line = self.state[key] + except KeyError: + line = Line(self.x + 15, + self.y + len(self.state)*self.hstep + self.liney0, + '', self.size, 0, self.font, self.bgcolor) + self.state[key] = line + self.gen.append(self.blink(line, key, value)) + + def blink(self, line, key, value): + if callable(value): + for t in value(line, key): + yield t + return + + for t in line.shiftcolor(self.bgcolor, 3): + yield t + if value is None: + return + fgcolor = 0x000000 + if (isinstance(value, tuple) and len(value) == 2 + and isinstance(value[0], int)): + fgcolor, value = value + line.text = self.format % (key, value) + for t in line.shiftcolor(fgcolor, 3): + yield t + + def kill(self): + for key, line in self.state.items(): + line.kill() + Frame.kill(self) + +class LogFrame(Frame): + font = FONT2 + size = 20 + + def __init__(self, x, y, example, nblines, bgcolor=0xFFFF80, interline=12): + s = Line(0, 0, example, self.size, 0, self.font) + w, h = s.render().get_size() + self.hstep = h+interline + s.kill() + Frame.__init__(self, x, y, w+60, nblines*self.hstep+10, bgcolor) + self.lines = [] + self.nblines = nblines + + def append(self, text, immed=1): + fgcolor = 0x000000 + if (isinstance(text, tuple) and len(text) == 2 + and isinstance(text[0], int)): + fgcolor, text = text + self.lines.append(Line(self.x+44, self.y, text, self.size, 0, self.font, + self.bgcolor)) + if len(self.lines) > self.nblines: + self.lines.pop(0).kill() + if immed: + self.lines[-1].color = fgcolor + lines = list(self.lines) + lines.reverse() + y = self.y + self.h + for line in lines: + y -= self.hstep + line.move(line.x, y) + return fgcolor + + def log(self, text): + self.gen.append(self.insertline(text)) + + def insertline(self, text): + fgcolor = self.append(text, 0) + lines = [(line, line.color) for line in self.lines] + lines[-1] = (self.lines[-1], fgcolor) + rng = range(0, self.hstep, 10) + rng.reverse() + lines.reverse() + for dy in rng: + f = 1.0 - float(dy)/self.hstep + y = self.y + self.h + dy + for line, targetcolor in lines: + y -= self.hstep + line.move(line.x, y) + line.color = colorstep(line.color, targetcolor, f) + yield None + + def kill(self): + for line in self.lines: + line.kill() + Frame.kill(self) + + def revive(self, dx=0, dy=0): + Frame.revive(self, dx, dy) + for line in self.lines: + line.revive(dx, dy) + + def ontop(self): + Frame.ontop(self) + for line in self.lines: + line.ontop() + +# ____________________________________________________________ + +MAX = 10 + +from bubbob.sprmap import sprmap as localmap + +for key, (filename, rect) in localmap.items(): + filename = os.path.join('bubbob', 'images', filename) + if filename.find('%d') >= 0: + for i in range(MAX): + sprmap[key+1000*i] = (filename % i, rect) + else: + sprmap[key] = (filename, rect) + +localmap = { + ('lem-walk', 1,0) : ('image1.ppm', ( 0, 0, 32, 32)), + ('lem-walk', 1,1) : ('image1.ppm', ( 32, 0, 32, 32)), + ('lem-walk', 1,2) : ('image1.ppm', ( 64, 0, 32, 32)), + ('lem-walk', 1,3) : ('image1.ppm', ( 96, 0, 32, 32)), + ('lem-walk', 1,4) : ('image1.ppm', (128, 0, 32, 32)), + ('lem-walk', 1,5) : ('image1.ppm', (160, 0, 32, 32)), + ('lem-walk', 1,6) : ('image1.ppm', (192, 0, 32, 32)), + ('lem-walk', 1,7) : ('image1.ppm', (224, 0, 32, 32)), + ('lem-fall', 1,0) : ('image1.ppm', (256, 0, 32, 32)), + ('lem-fall', 1,1) : ('image1.ppm', (288, 0, 32, 32)), + ('lem-fall', 1,2) : ('image1.ppm', (320, 0, 32, 32)), + ('lem-fall', 1,3) : ('image1.ppm', (352, 0, 32, 32)), + + ('lem-fall',-1,3) : ('image2.ppm', ( 0, 0, 32, 32)), + ('lem-fall',-1,2) : ('image2.ppm', ( 32, 0, 32, 32)), + ('lem-fall',-1,1) : ('image2.ppm', ( 64, 0, 32, 32)), + ('lem-fall',-1,0) : ('image2.ppm', ( 96, 0, 32, 32)), + ('lem-walk',-1,7) : ('image2.ppm', (128, 0, 32, 32)), + ('lem-walk',-1,6) : ('image2.ppm', (160, 0, 32, 32)), + ('lem-walk',-1,5) : ('image2.ppm', (192, 0, 32, 32)), + ('lem-walk',-1,4) : ('image2.ppm', (224, 0, 32, 32)), + ('lem-walk',-1,3) : ('image2.ppm', (256, 0, 32, 32)), + ('lem-walk',-1,2) : ('image2.ppm', (288, 0, 32, 32)), + ('lem-walk',-1,1) : ('image2.ppm', (320, 0, 32, 32)), + ('lem-walk',-1,0) : ('image2.ppm', (352, 0, 32, 32)), + + ('lem-jail', 0) : ('image4.ppm', ( 0, 0, 32, 32)), + ('lem-jail', 1) : ('image4.ppm', ( 0, 32, 32, 32)), + ('lem-jail', 2) : ('image4.ppm', ( 0, 64, 32, 32)), + } +for n in range(16): + localmap[('lem-crash', n)] = ('image3.ppm', (32*n, 0, 32, 32)) + +for key, (filename, rect) in localmap.items(): + filename = os.path.join('bubbob', 'ext5', filename) + sprmap[key] = (filename, rect) + +# ____________________________________________________________ + +def run(): + global Patterns + while 1: + Patterns = patterns() + Board.CurFrame = 0 + try: + execfile('def.py', globals(), globals()) + except GoToFrame: + continue + else: + break + +if len(sys.argv) > 1: + Board.TargetFrame = int(sys.argv[1]) +try: + run() +finally: + print Board.CurFrame Added: pypy/extradoc/talk/pypy-talk-pycon2005/pycon.ppm ============================================================================== Binary file. No diff available. Added: pypy/extradoc/talk/pypy-talk-pycon2005/pycon.txt ============================================================================== --- (empty file) +++ pypy/extradoc/talk/pypy-talk-pycon2005/pycon.txt Fri May 20 13:57:28 2005 @@ -0,0 +1,71 @@ + - status report + . compliancy with CPython + . analysis/checking toolchain + . easy hacks -o thunk + + * ep2004-pypy + + - flow obj space + . placeholder objects + . records operations + +* <=> translator.py: t.view() + + - staticness restrictions + . do whatever you like at boot-time + . then no more dynamic function/class creation, no generator + . constant globals, constant class attributes/methods + . can use exceptions + . type coherency + + - type annotation + . "type" as in "set of objects" + . custom selection of types + +* <=> t.annotate() + + - algorithm + . "naive" forward propagation + . also known as "abstract interpretation" + . bottom-up fixpoint search + + - features + . analyses the preinitialized program in-memory + . full-program analysis + . no user annotation + . mostly language-independent + + - contrasting to + . declaring types everywhere + . exact restriction-less typing (local vars only) + . full-program source code analysis (Starkiller) + + - (cont) + . Python2C (supersceded) + . Pyrex (analysis of Python-like source with types) + . Psyco (100% run-time) + + - PyPy's type model + . int, float, str, bool, function, class + . tuple, list, dict, iter + . prebuilt-constant + . class, instance + > mostly single inheritance + > attributes lifted to base class on demand + +* <=> t.annotate() with OO (translate_pypy1.py?) + + - code generation + . can generate Pyrex (at PyCon 2004 already) + . can generate a slow C extension module (a la Python2C) + . Common Lisp / Java / LLVM / C++ / Python... + + - next steps + . good C code + . Java, for object model + . LLVM in development (Carl Friedrich Bolz) + + - status + . rather CPython-compliant source base in PyPy + . mostly annotatable + . next step: use the type annotations in the code generator! Added: pypy/extradoc/talk/pypy-talk-pycon2005/pypy.ppm ============================================================================== Binary file. No diff available. From arigo at codespeak.net Fri May 20 14:02:31 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Fri, 20 May 2005 14:02:31 +0200 (CEST) Subject: [pypy-svn] r12626 - pypy/extradoc/talk/pypy-talk-pycon2005 Message-ID: <20050520120231.D51BD27B56@code1.codespeak.net> Author: arigo Date: Fri May 20 14:02:31 2005 New Revision: 12626 Modified: pypy/extradoc/talk/pypy-talk-pycon2005/README.txt Log: How to download the presentation. Modified: pypy/extradoc/talk/pypy-talk-pycon2005/README.txt ============================================================================== --- pypy/extradoc/talk/pypy-talk-pycon2005/README.txt (original) +++ pypy/extradoc/talk/pypy-talk-pycon2005/README.txt Fri May 20 14:02:31 2005 @@ -11,3 +11,6 @@ Execute ep.py to start the presentation. Tested on a Linux box, it should hopefully work on any platform. +To download the presentation with Subversion, type: + + svn co http://codespeak.net/svn/pypy/extradoc/talk/pypy-talk-pycon2005 From arigo at codespeak.net Fri May 20 14:05:42 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Fri, 20 May 2005 14:05:42 +0200 (CEST) Subject: [pypy-svn] r12627 - pypy/dist/pypy/documentation Message-ID: <20050520120542.30EED27B55@code1.codespeak.net> Author: arigo Date: Fri May 20 14:05:42 2005 New Revision: 12627 Modified: pypy/dist/pypy/documentation/extradoc.txt Log: issue65 resolved Checked-in the PyCon2005 talk. Modified: pypy/dist/pypy/documentation/extradoc.txt ============================================================================== --- pypy/dist/pypy/documentation/extradoc.txt (original) +++ pypy/dist/pypy/documentation/extradoc.txt Fri May 20 14:05:42 2005 @@ -14,13 +14,16 @@ * `EU funding for FOSS`_ talk on Chaos Communication Conference in Berlin, Dec 2004. -* `py lib slides`_ from the py lib talk at Pycon 2005 +* `PyCon 2005`_ animated slices, mostly reporting on the translator status. + +* `py lib slides`_ from the py lib talk at PyCon 2005 (py is used as a support/testing library for PyPy). .. _oscon2003-paper: http://codespeak.net/pypy/index.cgi?extradoc/talk/oscon2003-paper.html .. _`Architecture introduction slides`: http://codespeak.net/svn/pypy/extradoc/talk/amsterdam-sprint-intro.pdf .. _`EU funding for FOSS`: http://codespeak.net/svn/pypy/extradoc/talk/2004-21C3-pypy-EU-hpk.pdf .. _`py lib slides`: http://codespeak.net/svn/pypy/extradoc/talk/2005-pycon-py.pdf +.. _`PyCon 2005`: http://codespeak.net/svn/pypy/extradoc/talk/pypy-talk-pycon2005/ Related projects ---------------------------------- From rxe at codespeak.net Fri May 20 14:15:18 2005 From: rxe at codespeak.net (rxe at codespeak.net) Date: Fri, 20 May 2005 14:15:18 +0200 (CEST) Subject: [pypy-svn] r12628 - pypy/dist/pypy/documentation Message-ID: <20050520121518.7581E27B56@code1.codespeak.net> Author: rxe Date: Fri May 20 14:15:18 2005 New Revision: 12628 Modified: pypy/dist/pypy/documentation/misc.txt Log: Consistency with american english / english english. Modified: pypy/dist/pypy/documentation/misc.txt ============================================================================== --- pypy/dist/pypy/documentation/misc.txt (original) +++ pypy/dist/pypy/documentation/misc.txt Fri May 20 14:15:18 2005 @@ -364,7 +364,7 @@ - automated (unit-)testing framework with html/pdf reports -**Synchronisation with Standard Python** +**Synchronization with Standard Python** - Keeping PyPy in sync with potential changes to Standard Python. @@ -617,7 +617,7 @@ **Stackless Integration + More Performance Hacks** -- Identification and Implementation of Optimisations through modifications +- Identification and Implementation of Optimizations through modifications of the Translator. - Enable Massive Parallelism in a Single Thread. @@ -663,7 +663,7 @@ machine code for multiple processor architectures. Enable dynamic foreign function calls. -- Research optimisation heuristics for the Just-In-Time compiler. +- Research optimization heuristics for the Just-In-Time compiler. - A Just-In-Time compiler for PyPy !!! Outperform the state-of-the art (Psyco, Stackless). From rxe at codespeak.net Fri May 20 14:41:44 2005 From: rxe at codespeak.net (rxe at codespeak.net) Date: Fri, 20 May 2005 14:41:44 +0200 (CEST) Subject: [pypy-svn] r12629 - pypy/dist/pypy/documentation Message-ID: <20050520124144.D3D2E27B55@code1.codespeak.net> Author: rxe Date: Fri May 20 14:41:44 2005 New Revision: 12629 Modified: pypy/dist/pypy/documentation/coding-guide.txt Log: Fix minor spelling/grammar typos. Modified: pypy/dist/pypy/documentation/coding-guide.txt ============================================================================== --- pypy/dist/pypy/documentation/coding-guide.txt (original) +++ pypy/dist/pypy/documentation/coding-guide.txt Fri May 20 14:41:44 2005 @@ -45,7 +45,7 @@ In order to make a C code generator feasible we restrict ourselves to a subset of the Python language, and we adhere to some rules which make -translation to lower level langauges more obvious. +translation to lower level languages more obvious. Unlike source-to-source translations (like e.g. Starkiller_) we start translation from live python code objects which constitute our Python @@ -57,13 +57,13 @@ However, when the PyPy interpreter is started as a Python program, it can use all of the Python language until it reaches interpretation -runtime. That is, during initialisation our program is free to use the +runtime. That is, during initialization our program is free to use the full dynamism of Python, including dynamic code generation. An example can be found in the current implementation which is quite elegant: For the definition of all the opcodes of the Python interpreter, the module ``dis`` is imported and used to initialize our -bytecode interpreter. (See ``__initclass_`` in `pyopcode.py`_). This +bytecode interpreter. (See ``__initclass__`` in `pyopcode.py`_). This saves us from adding extra modules to PyPy. The import code is run at startup time, and we are allowed to use the CPython builtin import function. @@ -153,7 +153,7 @@ **dicts** - dicts with string keys only (preferrably the kind of strings that are usually + dicts with string keys only (preferably the kind of strings that are usually interned in CPython, i.e. short strings that look like identifiers). The implementation could safely decide that all dict keys should be interned. @@ -213,7 +213,7 @@ integers mutate into longs on overflow. However, shifting to the left truncates up to 2.3 but extends to longs as well in 2.4. By contrast, we need a way to perform wrap-around machine-sized arithmetic by default, while still being -able to check for overflow when we need it explicitely. Moreover, we need a +able to check for overflow when we need it explicitly. Moreover, we need a consistent behavior before and after translation. We use normal integers for signed arithmetic. It means that before @@ -282,7 +282,7 @@ # complain Code with no exception handlers does not raise exceptions (after it has been -translated, that is. When you run it on top of CPython, it always may raise +translated, that is. When you run it on top of CPython, it may raise exceptions, of course). By supplying an exception handler, you ask for error checking. Without, you assure the system that the operation cannot fail. This rule does not apply to *function calls*: any called function is @@ -303,11 +303,11 @@ try: z = some_other_function(x, y) except IndexError: - # only catches explicitely-raised IndexErrors in some_other_function() + # only catches explicitly-raised IndexErrors in some_other_function() # other exceptions can be raised, too, and will not be caught here. The ovfcheck() function described above follows the same rule: in case of -overflow, it explicitely raise OverflowError, which can be caught anywhere. +overflow, it explicitly raise OverflowError, which can be caught anywhere. Exceptions explicitly raised or re-raised will always be generated. @@ -326,7 +326,7 @@ PyPy is made of Python source code at two levels: there is on the one hand *application-level code* that looks like normal Python code, and that implements some functionalities as one would expect from Python code (e.g. one can give a pure Python implementation of some built-in functions like ``zip()``). There is also *interpreter-level code* for the functionalities that must more directly manipulate interpreter data and objects (e.g. the main loop of the interpreter, and the various object spaces). -Application-level code doesn't see object spaces explicitely: it runs using an object space to support the objects it manipulates, but this is implicit. There is no need for particular conventions for application-level code. The sequel is only about interpreter-level code. (Ideally, no application-level variable should be called ``space`` or ``w_xxx`` to avoid confusion.) +Application-level code doesn't see object spaces explicitly: it runs using an object space to support the objects it manipulates, but this is implicit. There is no need for particular conventions for application-level code. The sequel is only about interpreter-level code. (Ideally, no application-level variable should be called ``space`` or ``w_xxx`` to avoid confusion.) Naming conventions @@ -336,7 +336,7 @@ interpreter-level code, where it is by convention passed around by the name ``space``. * ``w_xxx``: any object seen by application-level code is an - object explicitely managed by the object space. From the + object explicitly managed by the object space. From the interpreter-level point of view, this is called a *wrapped* object. The ``w_`` prefix is used for any type of application-level object. @@ -589,7 +589,7 @@ Modifying a CPython library module or regression test ------------------------------------------------------- -Although PyPy is very compatible to CPython we sometimes need +Although PyPy is very compatible with CPython we sometimes need to change modules contained in our copy of the standard library, often due to the fact that PyPy works with all new-style classes by default and CPython has a number of places where it relies @@ -602,7 +602,7 @@ svn cp lib-python/2.3.4/somemodule.py lib-python/modified-2.3.4/ and subsequently you edit and commit ``lib-python/modified-2.3.4/somemodule.py``. -These copying operation is important because it keeps the original +This copying operation is important because it keeps the original CPython tree clean and makes it obvious what we had to change. .. _`mixed module mechanism`: @@ -622,7 +622,7 @@ application level definitions ............................. -Application level specifiations are found in the `appleveldefs` +Application level specifications are found in the `appleveldefs` dictionary found in ``__init__.py`` files of directories in ``pypy/module``. For example, in `pypy/module/__builtin__/__init__.py`_ you find the following entry specifying where ``__builtin__.locals`` comes from:: @@ -638,7 +638,7 @@ interpreter level definitions ............................. -Interpreter level specifiations are found in the ``interpleveldefs`` +Interpreter level specifications are found in the ``interpleveldefs`` dictionary found in ``__init__.py`` files of directories in ``pypy/module``. For example, in `pypy/module/__builtin__/__init__.py`_ the following entry specifies where ``__builtin__.len`` comes from:: From arigo at codespeak.net Fri May 20 14:43:33 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Fri, 20 May 2005 14:43:33 +0200 (CEST) Subject: [pypy-svn] r12630 - pypy/extradoc/talk/pypy-talk-pycon2005 Message-ID: <20050520124333.96AD127B55@code1.codespeak.net> Author: arigo Date: Fri May 20 14:43:33 2005 New Revision: 12630 Added: pypy/extradoc/talk/pypy-talk-pycon2005/pycon.draft - copied unchanged from r12625, pypy/extradoc/talk/pypy-talk-pycon2005/pycon.txt Removed: pypy/extradoc/talk/pypy-talk-pycon2005/pycon.txt Log: "txt" means "ReST"... move this file out of the way. Deleted: /pypy/extradoc/talk/pypy-talk-pycon2005/pycon.txt ============================================================================== --- /pypy/extradoc/talk/pypy-talk-pycon2005/pycon.txt Fri May 20 14:43:33 2005 +++ (empty file) @@ -1,71 +0,0 @@ - - status report - . compliancy with CPython - . analysis/checking toolchain - . easy hacks -o thunk - - * ep2004-pypy - - - flow obj space - . placeholder objects - . records operations - -* <=> translator.py: t.view() - - - staticness restrictions - . do whatever you like at boot-time - . then no more dynamic function/class creation, no generator - . constant globals, constant class attributes/methods - . can use exceptions - . type coherency - - - type annotation - . "type" as in "set of objects" - . custom selection of types - -* <=> t.annotate() - - - algorithm - . "naive" forward propagation - . also known as "abstract interpretation" - . bottom-up fixpoint search - - - features - . analyses the preinitialized program in-memory - . full-program analysis - . no user annotation - . mostly language-independent - - - contrasting to - . declaring types everywhere - . exact restriction-less typing (local vars only) - . full-program source code analysis (Starkiller) - - - (cont) - . Python2C (supersceded) - . Pyrex (analysis of Python-like source with types) - . Psyco (100% run-time) - - - PyPy's type model - . int, float, str, bool, function, class - . tuple, list, dict, iter - . prebuilt-constant - . class, instance - > mostly single inheritance - > attributes lifted to base class on demand - -* <=> t.annotate() with OO (translate_pypy1.py?) - - - code generation - . can generate Pyrex (at PyCon 2004 already) - . can generate a slow C extension module (a la Python2C) - . Common Lisp / Java / LLVM / C++ / Python... - - - next steps - . good C code - . Java, for object model - . LLVM in development (Carl Friedrich Bolz) - - - status - . rather CPython-compliant source base in PyPy - . mostly annotatable - . next step: use the type annotations in the code generator! From hpk at codespeak.net Fri May 20 14:53:11 2005 From: hpk at codespeak.net (hpk at codespeak.net) Date: Fri, 20 May 2005 14:53:11 +0200 (CEST) Subject: [pypy-svn] r12631 - pypy/dist/pypy/documentation Message-ID: <20050520125311.804BF27B53@code1.codespeak.net> Author: hpk Date: Fri May 20 14:53:11 2005 New Revision: 12631 Modified: pypy/dist/pypy/documentation/getting_started.txt Log: fixed the LLVM section (it's probably me who introduced a doubling sentence part). Modified: pypy/dist/pypy/documentation/getting_started.txt ============================================================================== --- pypy/dist/pypy/documentation/getting_started.txt (original) +++ pypy/dist/pypy/documentation/getting_started.txt Fri May 20 14:53:11 2005 @@ -431,20 +431,22 @@ LLVM +++++ -LLVM is used by the optional `PyPy/LLVM backend`_ to generate processor -indepdendant machine level code for the `low level virtual machine`_ -to generate processor independant machine level code. LLVM can be quite -annoying to install: you need a fairly recent version of GCC to compile -it and there can be severe problems under windows. Here are detailed -instructions on how to install: +LLVM is used by the optional `PyPy/LLVM backend`_ to generate +processor indepdendant machine level code for the `low level +virtual machine`_. LLVM can be quite annoying to install: you +need a fairly recent version of GCC to compile it and there +can be severe problems under windows. **NOTE: To use the LLVM +backend of PyPy you don't need the GCC front end of LLVM, only +LLVM itself**. Here are detailed instructions on how to +install: http://llvm.cs.uiuc.edu/docs/GettingStarted.html -**NOTE: To use the LLVM backend of PyPy you don't need the GCC front end -of LLVM, only LLVM itself**. If you run into problems with the installation -the `LLVM mailing list`_ is very helpful and friendly. Note also that -the PyPy LLVM backend was developed using LLVM 1.4 but it seems to work -with LLVM 1.5. Nobody ever tried an older version. +If you run into problems with the installation the `LLVM +mailing list`_ is very helpful and friendly. Note also that +the PyPy LLVM backend was developed using LLVM 1.4 but it +seems to work with LLVM 1.5. Nobody ever tried an older +version. CLISP +++++++ From hpk at codespeak.net Fri May 20 15:05:48 2005 From: hpk at codespeak.net (hpk at codespeak.net) Date: Fri, 20 May 2005 15:05:48 +0200 (CEST) Subject: [pypy-svn] r12632 - pypy/extradoc/talk/pypy-talk-pycon2005 Message-ID: <20050520130548.A705027B55@code1.codespeak.net> Author: hpk Date: Fri May 20 15:05:48 2005 New Revision: 12632 Modified: pypy/extradoc/talk/pypy-talk-pycon2005/README.txt Log: took the freedom to modify the Readme to be somewhat more explaining. Modified: pypy/extradoc/talk/pypy-talk-pycon2005/README.txt ============================================================================== --- pypy/extradoc/talk/pypy-talk-pycon2005/README.txt (original) +++ pypy/extradoc/talk/pypy-talk-pycon2005/README.txt Fri May 20 15:05:48 2005 @@ -1,16 +1,23 @@ -PyPy ----- +PyPy - Pycon 2005 presentation PyPy +=================================== + http://codespeak.net/pypy/ Armin Rigo +This directory contains the PyPy presentation from +Pycon 2005 in Washington DC. The ppresentation requires +Python and Pygame to run. See http://www.pygame.org/ +on how to install Pygame on your system. Then +perform the equivalent of: + + svn co http://codespeak.net/svn/pypy/extradoc/talk/pypy-talk-pycon2005 -This presentation requires Python and Pygame to run. -See http://www.pygame.org/ to install Pygame on your system. -Execute ep.py to start the presentation. Tested on a Linux -box, it should hopefully work on any platform. +And then run:: -To download the presentation with Subversion, type: + python ep.py - svn co http://codespeak.net/svn/pypy/extradoc/talk/pypy-talk-pycon2005 +you can then hit the `space` key to move forward in the +animated presentation. This is only tested on linux, +but it should hopefully work on other platforms. From arigo at codespeak.net Fri May 20 15:06:11 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Fri, 20 May 2005 15:06:11 +0200 (CEST) Subject: [pypy-svn] r12633 - pypy/dist/pypy/lib/test2 Message-ID: <20050520130611.EE71827B53@code1.codespeak.net> Author: arigo Date: Fri May 20 15:06:11 2005 New Revision: 12633 Modified: pypy/dist/pypy/lib/test2/test_file_extra.py Log: Wrong test. Fixed. Modified: pypy/dist/pypy/lib/test2/test_file_extra.py ============================================================================== --- pypy/dist/pypy/lib/test2/test_file_extra.py (original) +++ pypy/dist/pypy/lib/test2/test_file_extra.py Fri May 20 15:06:11 2005 @@ -102,11 +102,12 @@ assert f.read() == 'hello\nworld\n' f.close() - def test_rw_universal(self): + def test_r_universal(self): # XXX tests in progress fn = str(udir.join('temptestfile')) - f = _file.file(fn, 'w+U') + f = open(fn, 'wb') f.write('hello\r\nworld\r\n') - f.seek(0) + f.close() + f = _file.file(fn, 'rU') assert f.read() == 'hello\nworld\n' f.close() From hpk at codespeak.net Fri May 20 15:06:15 2005 From: hpk at codespeak.net (hpk at codespeak.net) Date: Fri, 20 May 2005 15:06:15 +0200 (CEST) Subject: [pypy-svn] r12634 - pypy/dist/pypy/documentation Message-ID: <20050520130615.AA0C627B58@code1.codespeak.net> Author: hpk Date: Fri May 20 15:06:15 2005 New Revision: 12634 Modified: pypy/dist/pypy/documentation/extradoc.txt Log: better link to the Pycon 2005 presentation Modified: pypy/dist/pypy/documentation/extradoc.txt ============================================================================== --- pypy/dist/pypy/documentation/extradoc.txt (original) +++ pypy/dist/pypy/documentation/extradoc.txt Fri May 20 15:06:15 2005 @@ -23,7 +23,7 @@ .. _`Architecture introduction slides`: http://codespeak.net/svn/pypy/extradoc/talk/amsterdam-sprint-intro.pdf .. _`EU funding for FOSS`: http://codespeak.net/svn/pypy/extradoc/talk/2004-21C3-pypy-EU-hpk.pdf .. _`py lib slides`: http://codespeak.net/svn/pypy/extradoc/talk/2005-pycon-py.pdf -.. _`PyCon 2005`: http://codespeak.net/svn/pypy/extradoc/talk/pypy-talk-pycon2005/ +.. _`PyCon 2005`: http://codespeak.net/pypy/index.cgi?extradoc/talk/pypy-talk-pycon2005/README.html Related projects ---------------------------------- From rxe at codespeak.net Fri May 20 15:14:38 2005 From: rxe at codespeak.net (rxe at codespeak.net) Date: Fri, 20 May 2005 15:14:38 +0200 (CEST) Subject: [pypy-svn] r12635 - pypy/dist/pypy/documentation Message-ID: <20050520131438.21D2B27B53@code1.codespeak.net> Author: rxe Date: Fri May 20 15:14:37 2005 New Revision: 12635 Modified: pypy/dist/pypy/documentation/objspace.txt Log: Added a description of trace object space and some of its motivations. Kind of a bit wordy... might want to strip it down a bit? Modified: pypy/dist/pypy/documentation/objspace.txt ============================================================================== --- pypy/dist/pypy/documentation/objspace.txt (original) +++ pypy/dist/pypy/documentation/objspace.txt Fri May 20 15:14:37 2005 @@ -201,25 +201,46 @@ The Trace Object Space ====================== -The Trace Object space is a proxy object space, intercepting and memorizing -space operations. It also traces frame creation, deletion and bytecode execution. -It's implementation delegates to another object space - usually the standard -object space - in order to carry out the operations. The ease with which -the Trace Object Space was implemented in `pypy/objspace/trace.py`_ -underlines the power of the Object Space abstraction. +The Trace Object Space was first written at the Amsterdam sprint. The ease +with which the Trace Object Space was implemented in `pypy/objspace/trace.py`_ +underlines the power of the Object Space abstraction. Effectively it is a +simple proxy object space. It has gone through various refactors to reach its +original objective, which was to show how bytecode in code objects ultimately +performs computation via an object space. + +This space will intercept space operations in realtime and as a side effect +will memorize them. It also traces frame creation, deletion and bytecode +execution. Its implementation delegates to another object space - usually the +standard object space - in order to carry out the operations. + +The pretty printing aims to be a graphical way of introducing programmers, and +especially ones familiar with CPython, to how PyPy works from a bytecode and +frames perspective. As a result one can grasp an intuitive idea of how +`Abstract Interpretation`_ records via tracing all execution paths of the +individual operations if one removes the bytecode out of the equation. This is +the purpose of the `Flow Object Space`_. + +Another educational use of Trace Object Space is that it allows a Python user +who has little understanding of how the interpreter works, a rapid way of +understanding what bytecodes are and what an object space is. When a statement +or expression is typed on the command line, one can see what is happening +behind the scenes. This will hopefully give users a better mental framework +when they are writing code. To make use of the tracing facilities you can at runtime switch your interactive session to tracing mode by typing:: >>> __pytrace__ = 1 -(Also see the `trace example`_). - Note that tracing mode will not show or record all space operations by default to avoid presenting too much information. Only non-helper operations are usually shown. -.. _`trace example`: getting_started.html#trace-example +A quick introduction on how to use the trace object space can be `found here`_. + +.. _`found here` : getting_started.html#tracing-bytecode-and-operations-on-objects +.. _`Abstract Interpretation`: theory.html#abstract-interpretation + The Thunk Object Space ====================== @@ -245,6 +266,8 @@ +>> _`flow object space`: + The Flow Object Space ===================== From rxe at codespeak.net Fri May 20 15:17:31 2005 From: rxe at codespeak.net (rxe at codespeak.net) Date: Fri, 20 May 2005 15:17:31 +0200 (CEST) Subject: [pypy-svn] r12636 - pypy/dist/pypy/tool Message-ID: <20050520131731.22B1E27B4F@code1.codespeak.net> Author: rxe Date: Fri May 20 15:17:30 2005 New Revision: 12636 Modified: pypy/dist/pypy/tool/pydis.py Log: Ensure works for both CPython code objects and pypy code objects. Add a repr method for interpreter level repr_with_space(). Modified: pypy/dist/pypy/tool/pydis.py ============================================================================== --- pypy/dist/pypy/tool/pydis.py (original) +++ pypy/dist/pypy/tool/pydis.py Fri May 20 15:17:30 2005 @@ -33,7 +33,7 @@ def __ne__(self, other): return not (self == other) - def reprargstring(self): + def reprargstring(self, space = None): """ return a string representation of any arguments. (empty for no args)""" oparg = self.oparg if oparg is None: @@ -43,12 +43,8 @@ s = repr(oparg).rjust(5) + " " if op in hasconst: - # support both real code objects and PyCode objects - try: - consts = co.co_consts - except AttributeError: - consts = co.co_consts_w - s += '(' + `consts[oparg]` + ')' + consts = self.get_consts(space) + s += '(' + consts[oparg] + ')' elif op in hasname: s += '(' + co.co_names[oparg] + ')' elif op in hasjrel: @@ -63,6 +59,21 @@ s += '(' + free[oparg] + ')' return s + def get_consts(self, space=None): + # support both real code objects and PyCode objects + co = self.disresult.code + if hasattr(co, "co_consts"): + return [repr(c) for c in co.co_consts] + + if space is None: + return [repr(c) for c in co.co_consts_w] + + r = lambda x: space.str_w(space.repr(x)) + return [r(c) for c in co.co_consts_w] + + def repr_with_space(self, space): + return self.name + self.reprargstring(space) + def __repr__(self): return self.name + self.reprargstring() @@ -113,12 +124,15 @@ if hasattr(co, 'func_code'): co = co.func_code + if hasattr(co, 'code'): + co = co.code + disresult = DisResult(co) code = co.co_code byte_increments = [ord(c) for c in co.co_lnotab[0::2]] line_increments = [ord(c) for c in co.co_lnotab[1::2]] - table_length = len(byte_increments) # == len(line_increments) + table_length = len(byte_increments) lineno = co.co_firstlineno table_index = 0 From rxe at codespeak.net Fri May 20 15:36:26 2005 From: rxe at codespeak.net (rxe at codespeak.net) Date: Fri, 20 May 2005 15:36:26 +0200 (CEST) Subject: [pypy-svn] r12637 - in pypy/dist/pypy: objspace tool Message-ID: <20050520133626.E8A7927B4F@code1.codespeak.net> Author: rxe Date: Fri May 20 15:36:26 2005 New Revision: 12637 Added: pypy/dist/pypy/tool/traceconfig.py Modified: pypy/dist/pypy/objspace/trace.py pypy/dist/pypy/tool/traceop.py Log: issue25 in-progress * Added configuration file (there must be better ways to do this.) * Ignore cache building in trace object space. * WIP checkin on traceop.py: more configuration options and display operation on one line. Modified: pypy/dist/pypy/objspace/trace.py ============================================================================== --- pypy/dist/pypy/objspace/trace.py (original) +++ pypy/dist/pypy/objspace/trace.py Fri May 20 15:36:26 2005 @@ -53,11 +53,11 @@ class TraceResult(object): """ This is the state of tracing-in-progress. """ - def __init__(self, tracespace): + def __init__(self, tracespace, **printer_options): self.events = [] self.reentrant = True self.tracespace = tracespace - self.printer = ResultPrinter() + self.printer = ResultPrinter(**printer_options) def append(self, event): if self.reentrant: @@ -164,7 +164,7 @@ operations[name] = name # Remove list - for name in ["wrap", "unwrap"]: + for name in ["wrap", "unwrap", "interpclass_w"]: if name in operations: del operations[name] return operations @@ -190,36 +190,55 @@ def __getattribute__(self, name): obj = super(Trace, self).__getattribute__(name) - if name in operations: - assert callable(obj) - obj = CallableTracer(self._result, name, obj) + if name in operations and not self._in_cache: + assert callable(obj) + obj = CallableTracer(self._result, name, obj) return obj def __pypytrace__(self): pass + def enter_cache_building_mode(self): + self._in_cache += 1 + + def leave_cache_building_mode(self, val): + self._in_cache -= 1 + def settrace(self): - self._result = TraceResult(self) + self._result = TraceResult(self, **self._config_options) def getresult(self): return self._result def getexecutioncontext(self): ec = super(Trace, self).getexecutioncontext() - assert not isinstance(ec, ExecutionContextTracer) - return ExecutionContextTracer(self._result, ec) + if not self._in_cache: + assert not isinstance(ec, ExecutionContextTracer) + ec = ExecutionContextTracer(self._result, ec) + return ec def reset_trace(self): """ Returns the class to it's original form. """ space.__class__ = space.__oldclass__ del space.__oldclass__ - if hasattr(self, "_result"): - del self._result + for k in ["_result", "_in_cache", "_config_options"]: + if hasattr(self, k): + delattr(self, k) trace_clz = type("Trace%s" % repr(space), (Trace,), {}) space.__oldclass__, space.__class__ = space.__class__, trace_clz - + + # XXX TEMP - also if we do use a config file, should use execfile + from pypy.tool.traceconfig import config + config_options = {} + config_options.update(config) + + # Avoid __getattribute__() woes + space._in_cache = 0 + space._config_options = config_options + space._result = None + space.settrace() return space Added: pypy/dist/pypy/tool/traceconfig.py ============================================================================== --- (empty file) +++ pypy/dist/pypy/tool/traceconfig.py Fri May 20 15:36:26 2005 @@ -0,0 +1,24 @@ +""" Trace object space configuration options - set with __pytrace__=1 +in py.py """ + +config = { + # An optional filename to use for trace output. None is stdout + "output_filename" : None, + + # Some internal interpreter code is written at applevel - by default + # it is a good idea to hide this. + "show_hidden_applevel" : False, + + # Many operations call back into the object space + "recursive_operations" : False, + + # Show the bytecode or just the operations + "show_bytecode" : True, + + # Indentor string used for output + "indentor" : ' ', + + # Show wrapped values in bytecode + "show_wrapped_consts_bytecode" : True + +} Modified: pypy/dist/pypy/tool/traceop.py ============================================================================== --- pypy/dist/pypy/tool/traceop.py (original) +++ pypy/dist/pypy/tool/traceop.py Fri May 20 15:36:26 2005 @@ -5,6 +5,8 @@ import autopath +import sys + def reversed(seq): length = len(seq) for index in range(length-1, -1, -1): @@ -25,66 +27,118 @@ class ResultPrinter: def __init__(self, + output_filename = None, show_hidden_applevel = False, recursive_operations = False, - indentor = ' '): - + show_bytecode = True, + indentor = ' ', + show_wrapped_consts_bytecode = True): + + if output_filename is None: + self.out = sys.stdout + else: + self.out = open(output_filename, "w") + # Configurable stuff self.indentor = indentor + self.show_bytecode = show_bytecode self.show_hidden_applevel = show_hidden_applevel self.recursive_operations = recursive_operations + self.show_wrapped_consts_bytecode = show_wrapped_consts_bytecode # Keeps a stack of current state to handle # showing of applevel and recursive operations self.indent_state = Stack() + # Some printing state + self.last_line_was_new = True + def reset(self): self.indent_state = Stack() - def print_line(self, line, additional_indent = 0): + def valid_state(self): state = self.indent_state.top() if state is not None and not state[0]: - return - - indent_count = len([c for c, t, f in self.indent_state if c]) - if indent_count: - indent = indent_count + additional_indent - 1 - assert (indent >= 0) - line = (self.indentor * indent) + "|-" + line + return False + return True - print line - - def print_line_operations(self, line, additional_indent = 0): - self.print_line(line, additional_indent = additional_indent) - + def print_line(self, line, new_line = True): + if self.last_line_was_new: + indent_count = len([c for c, t, f in self.indent_state if c]) + if indent_count: + indent = indent_count - 1 + assert (indent >= 0) + line = (self.indentor * indent) + "|-" + line + + if new_line: + self.last_line_was_new = True + print >>self.out, line + else: + print >>self.out, line, + self.last_line_was_new = False + def print_frame(self, print_type, frame): - + if not self.valid_state(): + return + + # Force new line if not the case + if not self.last_line_was_new: + print >>self.out, "" + self.last_line_was_new = True + code = getattr(frame, 'code', None) filename = getattr(code, 'co_filename', "") + filename = filename.replace("\n", "\\n") lineno = getattr(code, 'co_firstlineno', "") - s = "<<<<<%s %s @ %s>>>>>>>" % (print_type, filename, lineno) + s = " <<<< %s %s @ %s >>>>" % (print_type, filename, lineno) self.print_line(s) - def print_bytecode(self, index, bytecode): - s = "%2d%s%s" % (index, (self.indentor * 2), bytecode) - self.print_line(s) + def print_bytecode(self, index, bytecode, space): + if not self.valid_state(): + return + + if self.show_bytecode: + if self.show_wrapped_consts_bytecode: + bytecode_str = repr(bytecode) + else: + bytecode_str = bytecode.repr_with_space(space) - def print_op_enter(self, name, str_args): - s = " " * 17 - s += ">> %s%s" % (name, str_args) - self.print_line_operations(s) + s = "%2d%s%s" % (index, (self.indentor * 2), bytecode_str) + self.print_line(s) + + def print_op_enter(self, space, name, args): + if not self.valid_state(): + return + + s = " " * 4 + s += "%s" % name + s += "(" + ", ".join([repr_value(space, ii) for ii in args]) + ")" + self.print_line(s, new_line=False) + def print_op_leave(self, space, name, res): + if not self.valid_state(): + return + + if self.last_line_was_new: + s = " " * 4 + else: + s = " " + + s += "-> %s" % repr_value(space, res) + self.print_line(s) + + def print_op_exc(self, name, exc, space): + if not self.valid_state(): + return + + if self.last_line_was_new: + s = " " * 4 + else: + s = " " + s += "-> (%s)" % repr_value(space, exc) - def print_op_leave(self, name, str_res): - s = " " * 20 - s += "%s =: %s" % (name, str_res) - self.print_line_operations(s) - - def print_op_exc(self, name, exc): - s = " " * 17 - s += "x= %s %s" % (name, exc) - self.print_line_operations(s) + self.print_line(s) def print_result(self, space, event_result): for event in event_result.getevents(): @@ -100,7 +154,7 @@ else: show = False - self.indent_state.append((show, trace.EnterFrame, frame)) + self.indent_state.push((show, trace.EnterFrame, frame)) self.print_frame("enter", frame) elif isinstance(event, trace.LeaveFrame): @@ -119,7 +173,7 @@ # Get bytecode from frame disresult = event_result.getdisresult(frame) bytecode = disresult.getbytecode(event.index) - self.print_bytecode(event.index, bytecode) + self.print_bytecode(event.index, bytecode, space) elif isinstance(event, trace.CallBegin): lastframe = self.get_last_frame() @@ -138,21 +192,18 @@ if prev_indent_state[1] == trace.CallBegin: show = False - self.indent_state.append((show, trace.CallBegin, None)) - self.print_op_enter(info.name, repr_args(space, - self.get_last_frame(), - info.args)) + self.indent_state.push((show, trace.CallBegin, None)) + self.print_op_enter(space, info.name, info.args) elif isinstance(event, trace.CallFinished): info = event.callinfo - - self.print_op_leave(info.name, repr_value(space, event.res)) + self.print_op_leave(space, info.name, event.res) self.indent_state.pop() elif isinstance(event, trace.CallException): info = event.callinfo - self.print_op_exc(info.name, event.ex) + self.print_op_exc(info.name, event.ex, space) self.indent_state.pop() def get_last_frame(self): @@ -162,36 +213,138 @@ print_result = ResultPrinter().print_result -def repr_value(space, value): - """ representations for debugging purposes """ - try: - # XXX Sure this won't go down well - didn't really want - # to clutter up the interpeter code - from pypy.interpreter.function import Function, Method - from pypy.interpreter.eval import Code - - if isinstance(value, Function): - res = "Function(%s)" % value.name - - if isinstance(value, Method): - res = "Method(%s)" % value.w_function.name - raise Exception, "XXX only certain types or toooo slow" - except: - res = str(value) +## XXX Sort out for next release :-( + +## def isinstance2(space, w_obj, cls): +## return space.is_true(space.appexec([w_obj, (space.wrap(cls.__name__))], +## """(o,c): +## return o.__class__.__name__ == c""")) + +## def get_dict_repr(space, w_obj): +## return space.str_w(space.appexec([w_obj],"""(d): +## s = "{" +## it = iter(d.items()) +## ii = 3 +## try: +## k, v = it.next() +## while True: +## s += "%s=%s" % (k,v) +## ii -= 1 +## if ii == 0: +## break +## k, v = it.next() +## s += ", " +## except StopIteration: +## pass +## s += "}" +## return s""")) - return res[:80] +## def repr_value(space, obj): +## """ representations for debugging purposes """ -def repr_args(space, frame, args): - l = [] - for arg in args: - if frame and space.is_true(space.is_(arg, frame.w_globals)): - l.append('globals()') - elif frame and space.is_true(space.is_(arg, space.builtin)): - l.append('__builtin__') - else: - l.append(repr_value(space, arg)) +## # Special case true and false (from space.is_true()) - we use a +## # different representation from a wrapped object reprs method. +## if obj == True: +## return "TRUE" + +## elif obj == False: +## return "FALSE" + +## # Special case - arguments +## from pypy.interpreter.argument import Arguments +## if isinstance(obj, Arguments): +## return "Arguments XXX" + +## # Special case - operation error +## from pypy.interpreter.error import OperationError +## if isinstance(obj, OperationError): +## return "OperationError(%s, %s)" % (repr_value(space, obj.w_type), +## repr_value(space, obj.w_value)) + + +## if hasattr(obj, "iter"): +## return repr([repr_value(x) for x in obj]) +## # pypy isintacnce macro type +## # if dict/list/tuple +## # iter over first 3 types +## try: +## if isinstance2(space, obj, dict): +## return simple_repr(obj) +## if isinstance2(space, obj, tuple): +## return simple_repr2(obj) +## if isinstance2(space, obj, list): +## return simple_repr2(obj) +## except: +## pass + +## # Ok belows might take a long time... + +## # Try object's repr +## try: +## return space.str_w(space.repr(obj)) +## except: +## pass + +## # Arggh - unwrap repr +## try: +## return repr(space.unwrap(obj)) +## except: +## pass + +## # Give up... +## return repr(obj) + + +## res = simple_repr(obj) + +## try: +## from pypy.interpreter.baseobjspace import W_Root +## from pypy.interpreter.argument import Argument +## if isinstance(obj, W_Root): +## return simple_repr(space.unwrap(obj)) + +## if isinstance(obj, Argument): +## args_w, kwds_w = obj.unpack() +## res = "Argument(" +## res += ", ".join([repr_value(ii) for ii in args_w]) +## res += ")" +## except: +## pass + + +## elif space.is_true(space.appexec([w_value, space.wrap("keys")], """(x,y): +## return hasattr(x,y)""")): +## res = "Dict(%s)" % (space.str_w(space.repr(space.call_method(w_value, "keys")))[:40]) + + +## except: +## try: +## # XXX Sure this won't go down well - didn't really want +## # to clutter up the interpeter code +## from pypy.interpreter.function import Function, Method +## from pypy.interpreter.eval import Code - return "(" + ", ".join(l) + ")" +## if isinstance(w_value, Function): +## res = "Function(%s)" % value.name + +## if isinstance(w_value, Method): +## res = "Method(%s)" % value.w_function.name + +## raise Exception, "XXX only certain types or toooo slow" +## except: +## res = str(w_value) + +## return res[:80] + + +def simple_repr(space, obj): + res = repr(obj) + if len(res) > 80: + res = res[:76] + "..." + return res +repr_value = simple_repr + +# __________________________________________________________________________ def perform_trace(tspace, app_func, *args_w, **kwds_w): from pypy.interpreter.gateway import app2interp @@ -223,12 +376,12 @@ # Wrap up our space, with a trace space tspace = trace.create_trace_space(space) - def app_test(x): + def func(x): count = 0 for ii in range(x): count += ii return count # Note includes lazy loading of builtins - res = perform_trace(tspace, app_test, tspace.wrap(5)) + res = perform_trace(tspace, func, tspace.wrap(5)) print "Result:", res From cfbolz at codespeak.net Fri May 20 15:49:13 2005 From: cfbolz at codespeak.net (cfbolz at codespeak.net) Date: Fri, 20 May 2005 15:49:13 +0200 (CEST) Subject: [pypy-svn] r12639 - pypy/dist/pypy/documentation Message-ID: <20050520134913.2FFDE27B4F@code1.codespeak.net> Author: cfbolz Date: Fri May 20 15:49:13 2005 New Revision: 12639 Modified: pypy/dist/pypy/documentation/getting_started.txt Log: issue37 testing reformated the translation section to contain subsections instead of an enumeration like the rest of the document. Modified: pypy/dist/pypy/documentation/getting_started.txt ============================================================================== --- pypy/dist/pypy/documentation/getting_started.txt (original) +++ pypy/dist/pypy/documentation/getting_started.txt Fri May 20 15:49:13 2005 @@ -285,94 +285,115 @@ ------------------------- The translator is a tool based on the PyPy interpreter which can translate -sufficiently static Python programs into low-level code. +sufficiently static Python programs into low-level code. To be able to use it +you need to: -1. Download and install `Dot Graphviz`_. + * Download and install `Dot Graphviz`_. -2. Download and install Pygame_ if you do not already have it. + * Download and install Pygame_ if you do not already have it. -3. Type:: +To start the interactive translator do:: - cd pypy/bin - python translator.py + cd pypy/bin + python translator.py - Test snippets of translatable code are provided in the file - ``pypy/translator/test/snippet.py``, which is imported under the name - ``test``. For example:: +Test snippets of translatable code are provided in the file +``pypy/translator/test/snippet.py``, which is imported under the name +``test``. For example:: - >>> t = Translator(test.is_perfect_number) - >>> t.view() + >>> t = Translator(test.is_perfect_number) + >>> t.view() .. >>> from pypy.translator.translator import Translator .. >>> from pypy.translator.test import snippet as test -4. We have a type annotator that can completely infer types for functions like - ``is_perfect_number`` (as well as for much larger examples):: - >>> a = t.annotate([int]) - >>> t.view() +trying out the type annotator ++++++++++++++++++++++++++++++ - Move the mouse over variable names (in red) to see their inferred types. To - perform simplifications based on the annotation you can do:: +We have a type annotator that can completely infer types for functions like +``is_perfect_number`` (as well as for much larger examples):: - >>> a.simplify() + >>> a = t.annotate([int]) + >>> t.view() -5. The graph can be turned into C code:: +Move the mouse over variable names (in red) to see their inferred types. To +perform simplifications based on the annotation you can do:: - >>> a.specialize() - >>> f = t.ccompile() + >>> a.simplify() - The first command replaces operations with variables of types that are - avaiable in C (e.g. int) with low level versions. This can be ommited if no - annotation (step 4) has been performed. -6. If you feel adventureous (and have `LLVM installed`_ and on your path) you can - also try to compile the graph with LLVM. This is still quite experimental - and only works with some functions: One of the most visible restriction is - that return type of the entry function has to be and int, float or bool. To - try it do:: +translating the flow graph to C code +++++++++++++++++++++++++++++++++++++ - >>> print t.llvm() - >>> f = t.llvmcompile(optimize=True) - >>> f(28) - 1 +The graph can be turned into C code:: - This works only with fully annotated graphs. + >>> a.specialize() + >>> f = t.ccompile() -7. There is a small-to-medium demo showing the translator and the annotator:: +The first command replaces operations with variables of types that are +avaiable in C (e.g. int) with low level versions. This can be ommited if no +annotation (step 4) has been performed. - cd demo - python bpnn.py - This causes ``bpnn.py`` to display itself as a call graph and class - hierarchy. Clicking on functions shows the flow graph of the particular - function. Clicking on a class shows the attributes of its instances. All - this information (call graph, local variables' types, attributes of - instances) is computed by the annotator. +translating the flow graph to LLVM code ++++++++++++++++++++++++++++++++++++++++ -8. Not for the faint of heart nor the owner of a very old machine: you can - run the annotator over the whole PyPy interpreter itself. This is the - largest and ultimate example of source that our annotator can (very - successfully!) process:: +If you feel adventureous (and have `LLVM installed`_ and on your path) you can +also try to compile the graph with LLVM. This is still quite experimental +and only works with some functions: One of the most visible restriction is +that return type of the entry function has to be and int, float or bool. To +try it do:: - cd pypy/translator/goal - python translate_pypy.py -no-t -no-c + >>> print t.llvm() + >>> f = t.llvmcompile(optimize=True) + >>> f(28) + 1 - Moving around is difficult because of the sheer size of the result. - For this reason, the debugger prompt you get at the end has been - enhanced with commands to facilitate locating functions and classes. - Type ``help graphs`` for a list of the new commands. Help is also - available on each of these new commands. +This works only with fully annotated graphs. - The ``translate_pypy`` script itself takes a number of options controlling - what to translate and how. See ``translate_pypy.py -h``. Try out:: +a slightly larger example ++++++++++++++++++++++++++ - cd pypy/translator/goal - python translate_pypy.py targetrpystone +There is a small-to-medium demo showing the translator and the annotator:: + + cd demo + python bpnn.py + +This causes ``bpnn.py`` to display itself as a call graph and class +hierarchy. Clicking on functions shows the flow graph of the particular +function. Clicking on a class shows the attributes of its instances. All +this information (call graph, local variables' types, attributes of +instances) is computed by the annotator. + +translating the PyPy interpreter +++++++++++++++++++++++++++++++++ + +Not for the faint of heart nor the owner of a very old machine: you can +run the annotator over the whole PyPy interpreter itself. This is the +largest and ultimate example of source that our annotator can (very +successfully!) process:: + + cd pypy/translator/goal + python translate_pypy.py -no-t -no-c + +Moving around is difficult because of the sheer size of the result. +For this reason, the debugger prompt you get at the end has been +enhanced with commands to facilitate locating functions and classes. +Type ``help graphs`` for a list of the new commands. Help is also +available on each of these new commands. + +The ``translate_pypy`` script itself takes a number of options controlling +what to translate and how. See ``translate_pypy.py -h``. Try out:: + + cd pypy/translator/goal + python translate_pypy.py targetrpystone + +or a simplified, scaled-down version:: + + python translate_pypy.py targetrpystone2 - or a simplified, scaled-down version:: - python translate_pypy.py targetrpystone2 Where to start reading the sources ---------------------------------- From tismer at codespeak.net Fri May 20 17:56:21 2005 From: tismer at codespeak.net (tismer at codespeak.net) Date: Fri, 20 May 2005 17:56:21 +0200 (CEST) Subject: [pypy-svn] r12641 - pypy/dist/pypy/documentation Message-ID: <20050520155621.3FC3F27B53@code1.codespeak.net> Author: tismer Date: Fri May 20 17:56:21 2005 New Revision: 12641 Modified: pypy/dist/pypy/documentation/translation.txt Log: small corrections Modified: pypy/dist/pypy/documentation/translation.txt ============================================================================== --- pypy/dist/pypy/documentation/translation.txt (original) +++ pypy/dist/pypy/documentation/translation.txt Fri May 20 17:56:21 2005 @@ -451,7 +451,7 @@ v3 = int_add(v1, v2) -where -- in C notation -- all three variables v1, v2 and v3 are typed ``int``. This is done by attaching an attribute ``concretetype`` to v1, v2 and v3 (which might be instances of Variable or possibly Constant). In our model, this ``concretetype`` is ``pypy.rpython.lltypes.Signed``. Of course, the purpose of replacing the operation called ``int`` with ``int_add`` is that code generators no longer have to worry about what kind of addition (or concatenation maybe?) it means. +where -- in C notation -- all three variables v1, v2 and v3 are typed ``int``. This is done by attaching an attribute ``concretetype`` to v1, v2 and v3 (which might be instances of Variable or possibly Constant). In our model, this ``concretetype`` is ``pypy.rpython.lltypes.Signed``. Of course, the purpose of replacing the operation called ``add`` with ``int_add`` is that code generators no longer have to worry about what kind of addition (or concatenation maybe?) it means. The process in more details @@ -619,7 +619,7 @@ represent the corresponding object in LLVM and knows what code to generate for space operations on the object, what global definitions the object needs etc. -Some examples to make this cleare: A `ClassRepr`_ object represents a class, a +Some examples to make this clearer: A `ClassRepr`_ object represents a class, a `FuncRepr`_ object represent a function (or method). The following happens if the space operation ``simple_call`` is performed on a function: An appropriate ``FuncRepr`` object is constructed which generates LLVM code for the function From arigo at codespeak.net Fri May 20 17:57:55 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Fri, 20 May 2005 17:57:55 +0200 (CEST) Subject: [pypy-svn] r12642 - in pypy/dist/pypy/documentation: . website Message-ID: <20050520155755.B121327B53@code1.codespeak.net> Author: arigo Date: Fri May 20 17:57:55 2005 New Revision: 12642 Modified: pypy/dist/pypy/documentation/architecture.txt pypy/dist/pypy/documentation/extradoc.txt pypy/dist/pypy/documentation/website/news.txt Log: issue39 resolved Brain-stormed short mission statement for the front page. We tried to make it very self-contained, and very short. Now a link, "more...", points to an extended version which gives the main goals. The links to the existing projects -- mainly Psyco and Stackless -- are moved in the next paragraph, as well as to the Related projects section. Modified: pypy/dist/pypy/documentation/architecture.txt ============================================================================== --- pypy/dist/pypy/documentation/architecture.txt (original) +++ pypy/dist/pypy/documentation/architecture.txt Fri May 20 17:57:55 2005 @@ -11,6 +11,19 @@ .. _`getting started`: getting_started.html +Goals +===== + +PyPy is a reimplementation of Python_ written in Python itself, flexible and +easy to experiment with. Our long-term goals are to target a large variety of +platforms, small and large, by providing a compiler toolsuite that can produce +custom Python versions. Platform, Memory and Threading models are to become +aspects of the translation process - as opposed to encoding low level details +into a language implementation itself. Then dynamic optimization techniques +- implemented as another translation aspect - should become robust against +language changes. + + PyPy - an implementation of Python in Python ============================================ @@ -30,8 +43,8 @@ reasonably efficient C code from the source of PyPy, thereby reducing the speed penalty. This goal is no longer far away. -Later in the project, we will introduce optimisations (following the ideas -of Psyco) that should make PyPy run faster than CPython. +Later in the project, we will introduce optimizations (following the ideas +of Psyco_ and Stackless_) that should make PyPy run faster than CPython. An important aspect of implementing Python in Python is the high level of abstraction and compactness of the language. This yields an implementation @@ -53,7 +66,10 @@ tests not depending on C extension modules (most of the remaining 10% are arguably dependant on very obscure implementation details of CPython). -.. _Python: http://www.python.org/doc/2.4.1/ref/ref.html +.. _Python: http://www.python.org/doc/current/ref/ref.html +.. _Psyco: http://psyco.sourceforge.net +.. _Stackless: http://stackless.com + Higher level picture ==================== Modified: pypy/dist/pypy/documentation/extradoc.txt ============================================================================== --- pypy/dist/pypy/documentation/extradoc.txt (original) +++ pypy/dist/pypy/documentation/extradoc.txt Fri May 20 17:57:55 2005 @@ -35,6 +35,10 @@ Gregory Sullivan et. al., `Dynamic Native Optimization of Native Interpreters`_. IVME 03. 2003. +* Stackless_ is a recursion-free version of Python. + +* Psyco_ is a just-in-time specializer for Python. + * JikesRVM_ a research dynamic optimizing Java VM written in Java. * `Squeak`_ is a Smalltalk-80 implementation written in @@ -45,12 +49,16 @@ * spyweb_ translates Python programs to Scheme. +* Jython_ is a Python implementation in Java. + * `Iron Python`_ a new Python implementation compiling Python into Microsofts Common Language Runtime (CLR) Intermediate Language (IL). * `GNU lightning`_ generates assembly language at runtime. - +.. _Stackless: http://stackless.com +.. _Psyco: http://psyco.sourceforge.net +.. _Jython: http://www.jython.org .. _`Squeak`: http://www.squeak.org/ .. _`Croquet`: http://www.opencroquet.org/ .. _`Iron Python`: http://www.gotdotnet.com/workspaces/workspace.aspx?id=ad7acff7-ab1e-4bcb-99c0-57ac5a3a9742 Modified: pypy/dist/pypy/documentation/website/news.txt ============================================================================== --- pypy/dist/pypy/documentation/website/news.txt (original) +++ pypy/dist/pypy/documentation/website/news.txt Fri May 20 17:57:55 2005 @@ -1,16 +1,13 @@ - The PyPy project aims at producing a simple runtime-system for the Python - language. We want to express the basic abstractions within the - Python Language itself. We later want to have a minimal - core which is not written in Python and doesn't need CPython anymore. - We want to take care that technologies such as `Psyco`_ and `Stackless`_ - will easily integrate. Simplicity and Flexibilty are the foremost goals. - Rumors have it that the secret goal is being faster-than-C which is - nonsense, isn't it? + The PyPy project aims at producing a flexible and fast Python_ + implementation. The guiding idea is to translate a Python-level + description of the Python language itself to lower level languages. + Rumors have it that the secret goal is being faster-than-C which is + nonsense, isn't it? `more...`_ -.. _Psyco: http://psyco.sf.net -.. _Stackless: http://stackless.com +.. _Python: http://www.python.org/doc/current/ref/ref.html +.. _`more...`: ../architecture.html#goals Next Sprint after EuroPython 2005 1st-7th July From hpk at codespeak.net Fri May 20 18:21:37 2005 From: hpk at codespeak.net (hpk at codespeak.net) Date: Fri, 20 May 2005 18:21:37 +0200 (CEST) Subject: [pypy-svn] r12643 - in pypy/dist/pypy/documentation: . website Message-ID: <20050520162137.038F927B4F@code1.codespeak.net> Author: hpk Date: Fri May 20 18:21:36 2005 New Revision: 12643 Modified: pypy/dist/pypy/documentation/architecture.txt pypy/dist/pypy/documentation/website/news.txt Log: renamed goals -> mission statement and therein: then -> eventually Modified: pypy/dist/pypy/documentation/architecture.txt ============================================================================== --- pypy/dist/pypy/documentation/architecture.txt (original) +++ pypy/dist/pypy/documentation/architecture.txt Fri May 20 18:21:36 2005 @@ -11,15 +11,15 @@ .. _`getting started`: getting_started.html -Goals -===== +Mission statement +==================== PyPy is a reimplementation of Python_ written in Python itself, flexible and easy to experiment with. Our long-term goals are to target a large variety of platforms, small and large, by providing a compiler toolsuite that can produce custom Python versions. Platform, Memory and Threading models are to become aspects of the translation process - as opposed to encoding low level details -into a language implementation itself. Then dynamic optimization techniques +into a language implementation itself. Eventually, dynamic optimization techniques - implemented as another translation aspect - should become robust against language changes. Modified: pypy/dist/pypy/documentation/website/news.txt ============================================================================== --- pypy/dist/pypy/documentation/website/news.txt (original) +++ pypy/dist/pypy/documentation/website/news.txt Fri May 20 18:21:36 2005 @@ -7,7 +7,7 @@ nonsense, isn't it? `more...`_ .. _Python: http://www.python.org/doc/current/ref/ref.html -.. _`more...`: ../architecture.html#goals +.. _`more...`: ../architecture.html#mission-statement Next Sprint after EuroPython 2005 1st-7th July From cfbolz at codespeak.net Fri May 20 18:23:00 2005 From: cfbolz at codespeak.net (cfbolz at codespeak.net) Date: Fri, 20 May 2005 18:23:00 +0200 (CEST) Subject: [pypy-svn] r12644 - pypy/dist/pypy/documentation Message-ID: <20050520162300.F25EE27B4F@code1.codespeak.net> Author: cfbolz Date: Fri May 20 18:23:00 2005 New Revision: 12644 Modified: pypy/dist/pypy/documentation/getting_started.txt Log: Some tiny fixes to getting_started. Modified: pypy/dist/pypy/documentation/getting_started.txt ============================================================================== --- pypy/dist/pypy/documentation/getting_started.txt (original) +++ pypy/dist/pypy/documentation/getting_started.txt Fri May 20 18:23:00 2005 @@ -28,7 +28,7 @@ This will give you a PyPy prompt, i.e. a very compliant Python interpreter implemented in Python. Because this version -of PyPy still runs on top of CPython, it runs around 3000-4000 +of PyPy still runs on top of CPython, it runs around 2000 times slower than the original CPython. The 0.6 release focus really was on compliancy: PyPy passes around `90% of CPythons core language regression tests`_. @@ -252,12 +252,12 @@ python test_all.py module/test/test_builtin.py ``test_all.py`` is actually just a synonym for `py.test`_ which is -our external testing tool. If you have installed that then you +our external testing tool. If you have installed that you can as well just issue ``py.test DIRECTORY_OR_FILE`` in order to perform test runs or simply start it without arguments to run all tests below the current directory. -Finally, there are standard regression tests which you can +Finally, there are the CPython regression tests which you can run like this:: cd lib-python-2.3.4/test @@ -333,7 +333,7 @@ The first command replaces operations with variables of types that are avaiable in C (e.g. int) with low level versions. This can be ommited if no -annotation (step 4) has been performed. +annotation (see last subsection) has been performed. translating the flow graph to LLVM code @@ -366,6 +366,9 @@ this information (call graph, local variables' types, attributes of instances) is computed by the annotator. +As soon as you close the PyGame window, the function is turned into C code, +compiled and executed. + translating the PyPy interpreter ++++++++++++++++++++++++++++++++ From hpk at codespeak.net Fri May 20 18:27:47 2005 From: hpk at codespeak.net (hpk at codespeak.net) Date: Fri, 20 May 2005 18:27:47 +0200 (CEST) Subject: [pypy-svn] r12645 - pypy/dist/pypy/documentation Message-ID: <20050520162747.00DBB27B4F@code1.codespeak.net> Author: hpk Date: Fri May 20 18:27:47 2005 New Revision: 12645 Modified: pypy/dist/pypy/documentation/architecture.txt pypy/dist/pypy/documentation/coding-guide.txt pypy/dist/pypy/documentation/getting_started.txt pypy/dist/pypy/documentation/objspace.txt pypy/dist/pypy/documentation/translation.txt Log: unified main documentation page headers note especially that i took the date out of the architecture.txt. It doesn't make sense IMO because the architecture is probably the one that changes the least. Modified: pypy/dist/pypy/documentation/architecture.txt ============================================================================== --- pypy/dist/pypy/documentation/architecture.txt (original) +++ pypy/dist/pypy/documentation/architecture.txt Fri May 20 18:27:47 2005 @@ -1,5 +1,5 @@ ================================================== -Overview of PyPy's current architecture (May 2005) +PyPy - architecture overview ================================================== .. contents:: Modified: pypy/dist/pypy/documentation/coding-guide.txt ============================================================================== --- pypy/dist/pypy/documentation/coding-guide.txt (original) +++ pypy/dist/pypy/documentation/coding-guide.txt Fri May 20 18:27:47 2005 @@ -1,5 +1,5 @@ ===================================== -PyPy Coding Guide +PyPy - Coding Guide ===================================== .. contents:: Modified: pypy/dist/pypy/documentation/getting_started.txt ============================================================================== --- pypy/dist/pypy/documentation/getting_started.txt (original) +++ pypy/dist/pypy/documentation/getting_started.txt Fri May 20 18:27:47 2005 @@ -1,5 +1,5 @@ ================================== -Getting started with PyPy +PyPy - Getting started ================================== .. contents:: Modified: pypy/dist/pypy/documentation/objspace.txt ============================================================================== --- pypy/dist/pypy/documentation/objspace.txt (original) +++ pypy/dist/pypy/documentation/objspace.txt Fri May 20 18:27:47 2005 @@ -1,6 +1,6 @@ -================== -PyPy Object Spaces -================== +====================== +PyPy - Object Spaces +====================== .. contents:: .. sectnum:: Modified: pypy/dist/pypy/documentation/translation.txt ============================================================================== --- pypy/dist/pypy/documentation/translation.txt (original) +++ pypy/dist/pypy/documentation/translation.txt Fri May 20 18:27:47 2005 @@ -1,5 +1,5 @@ ===================== - PyPy Translation + PyPy - Translation ===================== .. contents:: From hpk at codespeak.net Fri May 20 18:32:08 2005 From: hpk at codespeak.net (hpk at codespeak.net) Date: Fri, 20 May 2005 18:32:08 +0200 (CEST) Subject: [pypy-svn] r12646 - pypy/dist/pypy/documentation Message-ID: <20050520163208.A67B227B4F@code1.codespeak.net> Author: hpk Date: Fri May 20 18:32:08 2005 New Revision: 12646 Modified: pypy/dist/pypy/documentation/architecture.txt pypy/dist/pypy/documentation/getting_started.txt Log: unifying to the capitalization detail level :-) Modified: pypy/dist/pypy/documentation/architecture.txt ============================================================================== --- pypy/dist/pypy/documentation/architecture.txt (original) +++ pypy/dist/pypy/documentation/architecture.txt Fri May 20 18:32:08 2005 @@ -1,5 +1,5 @@ ================================================== -PyPy - architecture overview +PyPy - Architecture Overview ================================================== .. contents:: Modified: pypy/dist/pypy/documentation/getting_started.txt ============================================================================== --- pypy/dist/pypy/documentation/getting_started.txt (original) +++ pypy/dist/pypy/documentation/getting_started.txt Fri May 20 18:32:08 2005 @@ -1,5 +1,5 @@ ================================== -PyPy - Getting started +PyPy - Getting Started ================================== .. contents:: From cfbolz at codespeak.net Fri May 20 19:07:20 2005 From: cfbolz at codespeak.net (cfbolz at codespeak.net) Date: Fri, 20 May 2005 19:07:20 +0200 (CEST) Subject: [pypy-svn] r12647 - pypy/dist/pypy/documentation Message-ID: <20050520170720.B8F3827B52@code1.codespeak.net> Author: cfbolz Date: Fri May 20 19:07:20 2005 New Revision: 12647 Modified: pypy/dist/pypy/documentation/getting_started.txt Log: small fixes to getting_started: link to architecture, typos, up-to-date tracing example Modified: pypy/dist/pypy/documentation/getting_started.txt ============================================================================== --- pypy/dist/pypy/documentation/getting_started.txt (original) +++ pypy/dist/pypy/documentation/getting_started.txt Fri May 20 19:07:20 2005 @@ -163,7 +163,7 @@ on the console you enter the interpreter-level console, a usual CPython console. You can then access internal objects of PyPy (e.g. the object space) and any variables you have created on the PyPy -prompt with the affix ``w_``:: +prompt with the prefix ``w_``:: >>>> a = 123 >>>> @@ -172,7 +172,13 @@ W_IntObject(123) Note that the prompt of the interpreter-level console is only '>>>' since -it runs on CPython level. To return to PyPy, press . +it runs on CPython level. If you want to return to PyPy, press (under +Linux) or , (under Windows). + +You may be interested in reading more about the distinction between +`interpreter-level and app-level`_. + +.. _`interpreter-level and app-level`: architecture.html#interpreter-level .. _`trace example`: @@ -186,18 +192,17 @@ >>>> __pytrace__ = 1 Tracing enabled >>>> a = 1 + 2 - |-<<<<a = 1 + 2 @ 1>>>>>>> + |- <<<< enter a = 1 + 2 @ 1 >>>> |- 0 LOAD_CONST 0 (W_IntObject(1)) |- 3 LOAD_CONST 1 (W_IntObject(2)) |- 6 BINARY_ADD - |- >> add(W_IntObject(1), W_IntObject(2)) - |- add =: W_IntObject(3) + |- add(W_IntObject(1), W_IntObject(2)) -> W_IntObject(3) |- 7 STORE_NAME 0 (a) - |- >> setitem(globals(), W_StringObject('a'), W_IntObject(3)) - |- setitem =: + |- setitem(W_DictObject([ |-10 LOAD_CONST 2 () |-13 RETURN_VALUE - |-<<<<a = 1 + 2 @ 1>>>>>>> + |- <<<< leave a = 1 + 2 @ 1 >>>> + lazily computed objects +++++++++++++++++++++++ From tismer at codespeak.net Fri May 20 19:09:38 2005 From: tismer at codespeak.net (tismer at codespeak.net) Date: Fri, 20 May 2005 19:09:38 +0200 (CEST) Subject: [pypy-svn] r12648 - pypy/dist/pypy/lib Message-ID: <20050520170938.5F68127B52@code1.codespeak.net> Author: tismer Date: Fri May 20 19:09:38 2005 New Revision: 12648 Modified: pypy/dist/pypy/lib/_classobj.py Log: removed meanwhile misleading instructions how to generate classobjinterp. This is now automated. Saw it when testing my documentation :-) Modified: pypy/dist/pypy/lib/_classobj.py ============================================================================== --- pypy/dist/pypy/lib/_classobj.py (original) +++ pypy/dist/pypy/lib/_classobj.py Fri May 20 19:09:38 2005 @@ -1,7 +1,3 @@ -# - classobjinterp obtained from _classobj with: -# translator/tool/tointerplevel.py --modname=classobj --out module/classobjinterp.py lib/_classobj.py classobj instance purify - - import sys, operator # producing nicer code objects by exec From arigo at codespeak.net Fri May 20 19:14:19 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Fri, 20 May 2005 19:14:19 +0200 (CEST) Subject: [pypy-svn] r12649 - pypy/dist Message-ID: <20050520171419.57DD227B52@code1.codespeak.net> Author: arigo Date: Fri May 20 19:14:19 2005 New Revision: 12649 Modified: pypy/dist/LICENSE (props changed) pypy/dist/README (props changed) Log: fixeol. From hpk at codespeak.net Fri May 20 19:16:51 2005 From: hpk at codespeak.net (hpk at codespeak.net) Date: Fri, 20 May 2005 19:16:51 +0200 (CEST) Subject: [pypy-svn] r12650 - pypy/dist/pypy/documentation Message-ID: <20050520171651.6628427B52@code1.codespeak.net> Author: hpk Date: Fri May 20 19:16:51 2005 New Revision: 12650 Modified: pypy/dist/pypy/documentation/architecture.txt Log: tweaking the introduction part of the architecture document. I always found that this was mixing current status and higher level ideas too much. hope you like it. Modified: pypy/dist/pypy/documentation/architecture.txt ============================================================================== --- pypy/dist/pypy/documentation/architecture.txt (original) +++ pypy/dist/pypy/documentation/architecture.txt Fri May 20 19:16:51 2005 @@ -30,45 +30,52 @@ It has become a tradition in the development of computer languages to implement each language in itself. This serves many purposes. By doing so, you demonstrate the versatility of the language, and its applicability for -large projects. A compiler/interpreter is close to as complex as software -ever gets. - -The PyPy project aims to do this for Python_ and has made some significant -progress. In a number of one week sprints, attracting approximately -10 developers each, we made an almost complete implementation of Python in -Python. Currently it is rather slow, benchmarking at a factor 2000 times -slower than regular Python (henceforth referred to as CPython). - -For some time now the bleeding edge PyPy work has been focused on generating -reasonably efficient C code from the source of PyPy, thereby reducing the -speed penalty. This goal is no longer far away. - -Later in the project, we will introduce optimizations (following the ideas -of Psyco_ and Stackless_) that should make PyPy run faster than CPython. +large projects. Writing compilers and interpreters are among the most +complex endeavours in software development. An important aspect of implementing Python in Python is the high level of -abstraction and compactness of the language. This yields an implementation +abstraction and compactness of the language. This allows an implementation that is, in some respects, easier to understand and play with than the one -done in C. +done in C. Actually, the existing CPython implementation is mostly +well written and it is often possible to manually translate according +CPython code to PyPy by just stripping away many low level details. Another carrying idea in PyPy is to build the implementation in the form of a number of independent modules with clearly defined and well tested API's. This eases reuse and allows experimenting with multiple implementations of specific features. -Our rather complete and 2.3-compliant interpreter is about 22000 lines of -code, with another 7000 lines of unit tests. If we include the tools, the +Later in the project, we will introduce optimizations, following the ideas +of Psyco_ and Stackless_, that should make PyPy run Python programs +faster than CPython. + +.. _Python: http://www.python.org/doc/current/ref/ref.html +.. _Psyco: http://psyco.sourceforge.net +.. _Stackless: http://stackless.com + +Status of the implementation (May 2005) +--------------------------------------- + +In a number of one week sprints, attracting approximately 10 developers each, +we made an almost complete implementation of Python in Python. Currently it is +slow, benchmarking at a factor 2000 times slower than regular Python +(henceforth referred to as CPython). This was expected because running a +bytecode interpreter on top of CPython obviously imposes a +double-interpretation penalty. + +Our rather complete and Python 2.3-compliant interpreter is about 22000 lines +of code, with another 7000 lines of unit tests. If we include the tools, the parts related to code analysis and generation, and the standard library modules ported from C, PyPy is now 55000 lines of code and 20000 lines of tests. -We also pass a number of CPython's own tests, including 90% of the "core" -tests not depending on C extension modules (most of the remaining 10% are +PyPy already passes a lot of CPython's own regression tests, including 90% of the +core tests not depending on C extension modules (most of the remaining 10% are arguably dependant on very obscure implementation details of CPython). -.. _Python: http://www.python.org/doc/current/ref/ref.html -.. _Psyco: http://psyco.sourceforge.net -.. _Stackless: http://stackless.com +For some time now the bleeding edge PyPy work has been focused on generating +reasonably efficient C code from the source of PyPy, thereby reducing the +speed penalty. This goal is no longer far away. Higher level picture From tismer at codespeak.net Fri May 20 19:55:10 2005 From: tismer at codespeak.net (tismer at codespeak.net) Date: Fri, 20 May 2005 19:55:10 +0200 (CEST) Subject: [pypy-svn] r12652 - pypy/dist/pypy/documentation Message-ID: <20050520175510.8B6B727B52@code1.codespeak.net> Author: tismer Date: Fri May 20 19:55:10 2005 New Revision: 12652 Modified: pypy/dist/pypy/documentation/translation.txt Log: some rudimentary geninterplevel documentation Modified: pypy/dist/pypy/documentation/translation.txt ============================================================================== --- pypy/dist/pypy/documentation/translation.txt (original) +++ pypy/dist/pypy/documentation/translation.txt Fri May 20 19:55:10 2005 @@ -42,7 +42,6 @@ .. _`Common Lisp`: http://codespeak.net/svn/pypy/dist/pypy/translator/gencl.py .. _Pyrex: http://codespeak.net/svn/pypy/dist/pypy/translator/pyrex/genpyrex.py .. _Java: http://codespeak.net/svn/pypy/dist/pypy/translator/java/ -.. _`Python again`: http://codespeak.net/svn/pypy/dist/pypy/translator/geninterplevel.py @@ -582,7 +581,7 @@ The task of GenC is to convert a flow graph into C code. By itself, GenC does not use the annotations in the graph. It can actually convert unannotated graphs to C. However, to make use of the annotations if they are present, an extra pass is needed: the `RPython Typer`_, whose task is to modify the flow graph according to the annotations, replacing operations with lower-level C-ish equivalents. -XXX GenC is currently in the process of being updated to use the RPython Typer. more documentation needed when this is done. +XXX GenC is currently in the process of being updated to use the RPython Typer. more documentation needed when this is done. But the basic principle of creating code from flowgraphs is similar to the `Python back-end`_. @@ -716,3 +715,135 @@ .. _`tiny function`: http://codespeak.net/svn/pypy/dist/pypy/translator/llvm/operations.ll .. _`written in C`: http://codespeak.net/svn/pypy/dist/pypy/translator/llvm/list.c +.. _`Python again`: +.. _`Python back-end`: + +The Python Back-End +=================== + +http://codespeak.net/svn/pypy/dist/pypy/translator/geninterplevel.py + +Motivation +---------- + +Translation from Python to Python: Why should we do this, since we have an interpreter already? + +The advantage of translation from Python to Python is, that the produced code does the same thing as the corresponding interpreted code, but no interpreter is needed any longer to execute this code. + +Certain pieces of PyPy are implemented in PyPy itself. That is, when interpreting some operations which are not given in our interpreter level implementation, they are implemented by excuting code in application level. + +.. _exceptions: http://codespeak.net/svn/pypy/dist/pypy/lib/_exceptions.py + +.. _oldstyle: http://codespeak.net/svn/pypy/dist/pypy/lib/_classobj.py + + +Examples are exceptions_ and oldstyle_ classes. They are needed in a very early phase of bootstrapping StdObjspace, but for simplicity, they are written as RPythonic application level code. This implies that the interpreter must be quite completely initialized to execute this code ? impossible in the early phase, where we have neither exceptions implemented nor classes available. + +Solution +-------- + +This bootstrap issue is solved by invoking a new interpreter which runs on FlowObjspace. FlowObjspace is complete without complicated initialization. It is able to do abstract interpretation of any Rpythonic code, without actually implementing anything. It just records all the operations the interpreter ?would? have done by building flowgraphs for all the code. What the Python backend does is just to produce correct Python code from these flowgraphs and return it as source code. + +Example +------- + +.. _implementation: http://codespeak.net/svn/pypy/dist/pypy/translator/geninterplevel.py + +Let?s try the little example from above_. You might want to look at the +flowgraph that it produces. Here, we directly run the Python translation +and look at the generated source. See also the header section of the implementation_ +for the interface:: + + >>> from pypy.translator.geninterplevel import translate_as_module + >>> entrypoint, source = translate_as_module(""" + ... + ... def g(n): + ... i = 0 + ... while n: + ... i = i + n + ... n = n - 1 + ... return i + ... + ... """) + +This call has invoked a PyPy interpreter running on FlowObjspace, recorded every +possible codepath into a flowgraph, and then rendered the following source code:: + + >>> print source + #!/bin/env python + # -*- coding: LATIN-1 -*- + + #************************************************************* + + def initapp2interpexec(space): + """NOT_RPYTHON""" + + def g(space, __args__): + funcname = "g" + signature = ['n'], None, None + defaults_w = [] + w_n_2, = __args__.parse(funcname, signature, defaults_w) + return fastf_g(space, w_n_2) + + f_g = g + + def g(space, w_n_2): + goto = 3 # startblock + while True: + + if goto == 1: + v0 = space.is_true(w_n) + if v0 == True: + w_n_1, w_0 = w_n, w_i + goto = 2 + else: + assert v0 == False + w_1 = w_i + goto = 4 + + if goto == 2: + w_2 = space.add(w_0, w_n_1) + w_3 = space.sub(w_n_1, space.w_True) + w_n, w_i = w_3, w_2 + goto = 1 + continue + + if goto == 3: + w_n, w_i = w_n_2, space.w_False + goto = 1 + continue + + if goto == 4: + return w_1 + + fastf_g = g + + g3dict = space.newdict([]) + gs___name__ = space.wrap('__name__') + gs_app2interpexec = space.wrap('app2interpexec') + space.setitem(g3dict, gs___name__, gs_app2interpexec) + gs_g = space.wrap('g') + from pypy.interpreter import gateway + gfunc_g = space.wrap(gateway.interp2app(f_g, unwrap_spec=[gateway.ObjSpace, gateway.Arguments])) + space.setitem(g3dict, gs_g, gfunc_g) + return g3dict + +You see that actually a single function is produced: 'initapp2interpexec'. This is the +function that you will call with a space as argument. It defines a few functions and then +does a number of initialization steps, builds the global objects the function need, +and produces the interface function gfunc_g to be called from interpreter level. + +The return value is 'g3dict', which contains a module name and the function we asked for. + +Let's have a look at the meatof this code: The first definition of g is just +for the argument parsing and is used as f_g in the gateway.interp2app. +We look at the second definition, fastf_f. Comparing to the flowgraph from above_, +you see a code block for every block in the graph. +Since Python has no goto statement, the jumps between the blocks are implemented +by a loop that switches over a "goto" variable. + +How it works +------------ + +XXX to be added later + From tismer at codespeak.net Fri May 20 19:57:13 2005 From: tismer at codespeak.net (tismer at codespeak.net) Date: Fri, 20 May 2005 19:57:13 +0200 (CEST) Subject: [pypy-svn] r12653 - pypy/dist/pypy/documentation Message-ID: <20050520175713.BB26D27B52@code1.codespeak.net> Author: tismer Date: Fri May 20 19:57:13 2005 New Revision: 12653 Modified: pypy/dist/pypy/documentation/translation.txt Log: typos Modified: pypy/dist/pypy/documentation/translation.txt ============================================================================== --- pypy/dist/pypy/documentation/translation.txt (original) +++ pypy/dist/pypy/documentation/translation.txt Fri May 20 19:57:13 2005 @@ -835,9 +835,10 @@ The return value is 'g3dict', which contains a module name and the function we asked for. -Let's have a look at the meatof this code: The first definition of g is just +Let's have a look at the body of this code: The first definition of g is just for the argument parsing and is used as f_g in the gateway.interp2app. -We look at the second definition, fastf_f. Comparing to the flowgraph from above_, +We look at the second definition, fastf_f, which does the actual +computation. Comparing to the flowgraph from above_, you see a code block for every block in the graph. Since Python has no goto statement, the jumps between the blocks are implemented by a loop that switches over a "goto" variable. From arigo at codespeak.net Fri May 20 20:00:06 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Fri, 20 May 2005 20:00:06 +0200 (CEST) Subject: [pypy-svn] r12655 - pypy/dist/pypy/interpreter/test Message-ID: <20050520180006.0E56827B52@code1.codespeak.net> Author: arigo Date: Fri May 20 20:00:05 2005 New Revision: 12655 Modified: pypy/dist/pypy/interpreter/test/test_py.py Log: Disable this test on Windows until we know how to fix py.process.cmdexec() to detect error codes. Modified: pypy/dist/pypy/interpreter/test/test_py.py ============================================================================== --- pypy/dist/pypy/interpreter/test/test_py.py (original) +++ pypy/dist/pypy/interpreter/test/test_py.py Fri May 20 20:00:05 2005 @@ -76,6 +76,8 @@ """ def test_tb_normalization(): + if sys.platform == "win32": + py.test.skip("cannot detect process exit code for now") tmpfilepath = str(udir.join("test_py_script.py")) tmpfile = file( tmpfilepath, "w" ) tmpfile.write(TB_NORMALIZATION_CHK) From pedronis at codespeak.net Fri May 20 20:04:16 2005 From: pedronis at codespeak.net (pedronis at codespeak.net) Date: Fri, 20 May 2005 20:04:16 +0200 (CEST) Subject: [pypy-svn] r12656 - pypy/dist/pypy/documentation Message-ID: <20050520180416.56AF127B53@code1.codespeak.net> Author: pedronis Date: Fri May 20 20:04:16 2005 New Revision: 12656 Modified: pypy/dist/pypy/documentation/translation.txt Log: basically removed some strange chars from the file Modified: pypy/dist/pypy/documentation/translation.txt ============================================================================== --- pypy/dist/pypy/documentation/translation.txt (original) +++ pypy/dist/pypy/documentation/translation.txt Fri May 20 20:04:16 2005 @@ -737,19 +737,26 @@ .. _oldstyle: http://codespeak.net/svn/pypy/dist/pypy/lib/_classobj.py -Examples are exceptions_ and oldstyle_ classes. They are needed in a very early phase of bootstrapping StdObjspace, but for simplicity, they are written as RPythonic application level code. This implies that the interpreter must be quite completely initialized to execute this code ? impossible in the early phase, where we have neither exceptions implemented nor classes available. +Examples are exceptions_ and oldstyle_ classes. They are needed in a very early phase of bootstrapping StdObjspace, but for simplicity, they are written as RPythonic application level code. This implies that the interpreter must be quite completely initialized to execute this code, which is impossible in the early phase, where we have neither exceptions implemented nor classes available. Solution -------- -This bootstrap issue is solved by invoking a new interpreter which runs on FlowObjspace. FlowObjspace is complete without complicated initialization. It is able to do abstract interpretation of any Rpythonic code, without actually implementing anything. It just records all the operations the interpreter ?would? have done by building flowgraphs for all the code. What the Python backend does is just to produce correct Python code from these flowgraphs and return it as source code. +This bootstrap issue is solved by invoking a new interpreter which +runs on FlowObjspace. FlowObjspace is complete without complicated +initialization. It is able to do abstract interpretation of any +Rpythonic code, without actually implementing anything. It just +records all the operations the interpreter would have done by +building flowgraphs for all the code. What the Python backend does is +just to produce correct Python code from these flowgraphs and return +it as source code. Example ------- .. _implementation: http://codespeak.net/svn/pypy/dist/pypy/translator/geninterplevel.py -Let?s try the little example from above_. You might want to look at the +Let's try the little example from above_. You might want to look at the flowgraph that it produces. Here, we directly run the Python translation and look at the generated source. See also the header section of the implementation_ for the interface:: From hpk at codespeak.net Fri May 20 20:11:54 2005 From: hpk at codespeak.net (hpk at codespeak.net) Date: Fri, 20 May 2005 20:11:54 +0200 (CEST) Subject: [pypy-svn] r12657 - pypy/dist/pypy/documentation Message-ID: <20050520181154.2869A27B52@code1.codespeak.net> Author: hpk Date: Fri May 20 20:11:53 2005 New Revision: 12657 Modified: pypy/dist/pypy/documentation/getting_started.txt Log: prevent the web page from looking ugly at the expense of not reproducing the trace-obj space output exactly verbatim. Modified: pypy/dist/pypy/documentation/getting_started.txt ============================================================================== --- pypy/dist/pypy/documentation/getting_started.txt (original) +++ pypy/dist/pypy/documentation/getting_started.txt Fri May 20 20:11:53 2005 @@ -198,7 +198,9 @@ |- 6 BINARY_ADD |- add(W_IntObject(1), W_IntObject(2)) -> W_IntObject(3) |- 7 STORE_NAME 0 (a) - |- setitem(W_DictObject([ + |- setitem(W_DictObject([ |-10 LOAD_CONST 2 () |-13 RETURN_VALUE |- <<<< leave a = 1 + 2 @ 1 >>>> From hpk at codespeak.net Fri May 20 20:31:20 2005 From: hpk at codespeak.net (hpk at codespeak.net) Date: Fri, 20 May 2005 20:31:20 +0200 (CEST) Subject: [pypy-svn] r12660 - pypy/dist/pypy/documentation Message-ID: <20050520183120.BFB7127B4D@code1.codespeak.net> Author: hpk Date: Fri May 20 20:31:20 2005 New Revision: 12660 Modified: pypy/dist/pypy/documentation/architecture.txt pypy/dist/pypy/documentation/translation.txt Log: put some wording from geninterplevel.py into the motivation part of geninterp and refactor the motivation part a bit, add a link to the appropriate architecture section (where it is explained that applevel is preferable). Modified: pypy/dist/pypy/documentation/architecture.txt ============================================================================== --- pypy/dist/pypy/documentation/architecture.txt (original) +++ pypy/dist/pypy/documentation/architecture.txt Fri May 20 20:31:20 2005 @@ -257,6 +257,8 @@ interpreting. +.. _`app-preferable`: + Application level is often preferable ------------------------------------- Modified: pypy/dist/pypy/documentation/translation.txt ============================================================================== --- pypy/dist/pypy/documentation/translation.txt (original) +++ pypy/dist/pypy/documentation/translation.txt Fri May 20 20:31:20 2005 @@ -726,18 +726,28 @@ Motivation ---------- -Translation from Python to Python: Why should we do this, since we have an interpreter already? - -The advantage of translation from Python to Python is, that the produced code does the same thing as the corresponding interpreted code, but no interpreter is needed any longer to execute this code. - -Certain pieces of PyPy are implemented in PyPy itself. That is, when interpreting some operations which are not given in our interpreter level implementation, they are implemented by excuting code in application level. +PyPy often makes use of `application-level`_ helper methods. +The idea of the 'geninterplevel' backend is to automatically transform +such application level implementations to their equivalent representation +at interpreter level. Then, the RPython to C translation hopefully can +produce more efficient code than always re-interpreting these methods. + +One property of translation from application level Python to +Python is, that the produced code does the same thing as the +corresponding interpreted code, but no interpreter is needed +any longer to execute this code. +.. _`application-level`: architecture.html#app-preferable .. _exceptions: http://codespeak.net/svn/pypy/dist/pypy/lib/_exceptions.py - .. _oldstyle: http://codespeak.net/svn/pypy/dist/pypy/lib/_classobj.py - -Examples are exceptions_ and oldstyle_ classes. They are needed in a very early phase of bootstrapping StdObjspace, but for simplicity, they are written as RPythonic application level code. This implies that the interpreter must be quite completely initialized to execute this code, which is impossible in the early phase, where we have neither exceptions implemented nor classes available. +Examples are exceptions_ and oldstyle_ classes. They are +needed in a very early phase of bootstrapping StdObjspace, but +for simplicity, they are written as RPythonic application +level code. This implies that the interpreter must be quite +completely initialized to execute this code, which is +impossible in the early phase, where we have neither +exceptions implemented nor classes available. Solution -------- From hpk at codespeak.net Fri May 20 20:43:05 2005 From: hpk at codespeak.net (hpk at codespeak.net) Date: Fri, 20 May 2005 20:43:05 +0200 (CEST) Subject: [pypy-svn] r12661 - pypy/dist/pypy/documentation Message-ID: <20050520184305.8E11A27B4D@code1.codespeak.net> Author: hpk Date: Fri May 20 20:43:05 2005 New Revision: 12661 Modified: pypy/dist/pypy/documentation/index.txt Log: finally link the geninterp documentation instead of the issue Modified: pypy/dist/pypy/documentation/index.txt ============================================================================== --- pypy/dist/pypy/documentation/index.txt (original) +++ pypy/dist/pypy/documentation/index.txt Fri May 20 20:43:05 2005 @@ -110,11 +110,11 @@ ``*/test/`` many directories have a test subdirectory containing test modules (see `Testing in PyPy`_) -``_cache/`` holds cache files from internally translating application - level to interpreterlevel code. (insert link when - `issue40`_ is resolved). +``_cache/`` holds cache files from internally `translating application + level to interpreterlevel`_ code. ============================ =========================================== +.. _`translating application level to interpreterlevel`: translation.html#python-back-end .. _documentation: index.html .. _`Testing in PyPy`: coding-guide.html#testing-in-pypy .. _`mixed modules`: coding-guide.html#mixed-modules From tismer at codespeak.net Fri May 20 20:45:24 2005 From: tismer at codespeak.net (tismer at codespeak.net) Date: Fri, 20 May 2005 20:45:24 +0200 (CEST) Subject: [pypy-svn] r12662 - pypy/dist/pypy/documentation Message-ID: <20050520184524.6AC9927B4D@code1.codespeak.net> Author: tismer Date: Fri May 20 20:45:24 2005 New Revision: 12662 Modified: pypy/dist/pypy/documentation/translation.txt Log: renamed it to the ugly name :-( Modified: pypy/dist/pypy/documentation/translation.txt ============================================================================== --- pypy/dist/pypy/documentation/translation.txt (original) +++ pypy/dist/pypy/documentation/translation.txt Fri May 20 20:45:24 2005 @@ -718,8 +718,8 @@ .. _`Python again`: .. _`Python back-end`: -The Python Back-End -=================== +The Interplevel Back-End +======================== http://codespeak.net/svn/pypy/dist/pypy/translator/geninterplevel.py From tismer at codespeak.net Fri May 20 20:56:09 2005 From: tismer at codespeak.net (tismer at codespeak.net) Date: Fri, 20 May 2005 20:56:09 +0200 (CEST) Subject: [pypy-svn] r12663 - pypy/dist/pypy/documentation Message-ID: <20050520185609.F041727B4D@code1.codespeak.net> Author: tismer Date: Fri May 20 20:56:09 2005 New Revision: 12663 Modified: pypy/dist/pypy/documentation/translation.txt Log: testing how this looks, cannot see the same formatting from here. Modified: pypy/dist/pypy/documentation/translation.txt ============================================================================== --- pypy/dist/pypy/documentation/translation.txt (original) +++ pypy/dist/pypy/documentation/translation.txt Fri May 20 20:56:09 2005 @@ -792,6 +792,8 @@ #************************************************************* +the single gobal function:: + def initapp2interpexec(space): """NOT_RPYTHON""" From tismer at codespeak.net Fri May 20 21:06:45 2005 From: tismer at codespeak.net (tismer at codespeak.net) Date: Fri, 20 May 2005 21:06:45 +0200 (CEST) Subject: [pypy-svn] r12664 - pypy/dist/pypy/documentation Message-ID: <20050520190645.935F127B4F@code1.codespeak.net> Author: tismer Date: Fri May 20 21:06:45 2005 New Revision: 12664 Modified: pypy/dist/pypy/documentation/translation.txt Log: testing Modified: pypy/dist/pypy/documentation/translation.txt ============================================================================== --- pypy/dist/pypy/documentation/translation.txt (original) +++ pypy/dist/pypy/documentation/translation.txt Fri May 20 21:06:45 2005 @@ -790,10 +790,6 @@ #!/bin/env python # -*- coding: LATIN-1 -*- - #************************************************************* - -the single gobal function:: - def initapp2interpexec(space): """NOT_RPYTHON""" @@ -806,6 +802,8 @@ f_g = g +``The meat of the code``:: + def g(space, w_n_2): goto = 3 # startblock while True: @@ -837,6 +835,8 @@ fastf_g = g +``Initialisation code``:: + g3dict = space.newdict([]) gs___name__ = space.wrap('__name__') gs_app2interpexec = space.wrap('app2interpexec') From arigo at codespeak.net Fri May 20 21:07:09 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Fri, 20 May 2005 21:07:09 +0200 (CEST) Subject: [pypy-svn] r12665 - pypy/dist/pypy/module/__builtin__/test Message-ID: <20050520190709.EAA2D27B4F@code1.codespeak.net> Author: arigo Date: Fri May 20 21:07:09 2005 New Revision: 12665 Modified: pypy/dist/pypy/module/__builtin__/test/test_import.py Log: Mystery failure, probably related to quoting, on Windows. Modified: pypy/dist/pypy/module/__builtin__/test/test_import.py ============================================================================== --- pypy/dist/pypy/module/__builtin__/test/test_import.py (original) +++ pypy/dist/pypy/module/__builtin__/test/test_import.py Fri May 20 21:07:09 2005 @@ -154,6 +154,8 @@ raises(ImportError,imp_b) def test_PYTHONPATH_takes_precedence(space): + if sys.platform == "win32": + py.test.skip("unresolved issues with win32 shell quoting rules") from pypy.interpreter.test.test_py import pypypath extrapath = udir.ensure("pythonpath", dir=1) extrapath.join("urllib.py").write("print 42\n") From tismer at codespeak.net Fri May 20 21:12:43 2005 From: tismer at codespeak.net (tismer at codespeak.net) Date: Fri, 20 May 2005 21:12:43 +0200 (CEST) Subject: [pypy-svn] r12666 - pypy/dist/pypy/documentation Message-ID: <20050520191243.3495727B4F@code1.codespeak.net> Author: tismer Date: Fri May 20 21:12:43 2005 New Revision: 12666 Modified: pypy/dist/pypy/documentation/translation.txt Log: testing Modified: pypy/dist/pypy/documentation/translation.txt ============================================================================== --- pypy/dist/pypy/documentation/translation.txt (original) +++ pypy/dist/pypy/documentation/translation.txt Fri May 20 21:12:43 2005 @@ -802,7 +802,9 @@ f_g = g -``The meat of the code``:: +``the real code body is here:`` + +:: def g(space, w_n_2): goto = 3 # startblock @@ -835,7 +837,9 @@ fastf_g = g -``Initialisation code``:: +``the rest is initialization:`` + +:: g3dict = space.newdict([]) gs___name__ = space.wrap('__name__') From tismer at codespeak.net Fri May 20 21:22:20 2005 From: tismer at codespeak.net (tismer at codespeak.net) Date: Fri, 20 May 2005 21:22:20 +0200 (CEST) Subject: [pypy-svn] r12667 - pypy/dist/pypy/documentation Message-ID: <20050520192220.6A72727B4F@code1.codespeak.net> Author: tismer Date: Fri May 20 21:22:20 2005 New Revision: 12667 Modified: pypy/dist/pypy/documentation/translation.txt Log: no chance, I can't rip the output into pieces, or the indentation will be broken. Modified: pypy/dist/pypy/documentation/translation.txt ============================================================================== --- pypy/dist/pypy/documentation/translation.txt (original) +++ pypy/dist/pypy/documentation/translation.txt Fri May 20 21:22:20 2005 @@ -802,10 +802,6 @@ f_g = g -``the real code body is here:`` - -:: - def g(space, w_n_2): goto = 3 # startblock while True: @@ -837,10 +833,6 @@ fastf_g = g -``the rest is initialization:`` - -:: - g3dict = space.newdict([]) gs___name__ = space.wrap('__name__') gs_app2interpexec = space.wrap('app2interpexec') From cfbolz at codespeak.net Fri May 20 21:39:29 2005 From: cfbolz at codespeak.net (cfbolz at codespeak.net) Date: Fri, 20 May 2005 21:39:29 +0200 (CEST) Subject: [pypy-svn] r12668 - in pypy/dist/pypy/documentation: . website Message-ID: <20050520193929.C569927B4F@code1.codespeak.net> Author: cfbolz Date: Fri May 20 21:39:29 2005 New Revision: 12668 Added: pypy/dist/pypy/documentation/news-0.6.txt Modified: pypy/dist/pypy/documentation/website/news.txt Log: added news item to be put on the web page. Added: pypy/dist/pypy/documentation/news-0.6.txt ============================================================================== --- (empty file) +++ pypy/dist/pypy/documentation/news-0.6.txt Fri May 20 21:39:29 2005 @@ -0,0 +1,14 @@ + +First PyPy release +================== + +We are happy to announce the first public release of PyPy after two years of +spare-time and half a year of EU funded development. The 0.6 release is +a preview release, concentrating on CPython compatibility. +Read more in the `release announcement`_ or head over to our `getting +started`_ document to give it a try. + +.. _`release announcement`: http://codespeak.net/pypy/index.cgi?doc/release-0.6.html +.. _`getting started`: http://codespeak.net/pypy/index.cgi?getting-started + +*(05/20/2005)* Modified: pypy/dist/pypy/documentation/website/news.txt ============================================================================== --- pypy/dist/pypy/documentation/website/news.txt (original) +++ pypy/dist/pypy/documentation/website/news.txt Fri May 20 21:39:29 2005 @@ -9,6 +9,19 @@ .. _Python: http://www.python.org/doc/current/ref/ref.html .. _`more...`: ../architecture.html#mission-statement +First PyPy release +================== + +We are happy to announce the first public release of PyPy after two years of +spare-time and half a year of EU funded development. The 0.6 release is +a preview release, concentrating on CPython compatibility. +Read more in the `release announcement`_ or head over to our `getting +started'_ document to give it a try. + +.. _`release announcement`: http://codespeak.net/pypy/index.cgi?doc/release-0.6.html +.. _`getting started`: http://codespeak.net/pypy/index.cgi?getting-started + +*(05/20/2005)* Next Sprint after EuroPython 2005 1st-7th July ====================================================== From arigo at codespeak.net Fri May 20 21:41:14 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Fri, 20 May 2005 21:41:14 +0200 (CEST) Subject: [pypy-svn] r12669 - pypy/dist/pypy/documentation Message-ID: <20050520194114.1DCA927B4C@code1.codespeak.net> Author: arigo Date: Fri May 20 21:41:13 2005 New Revision: 12669 Modified: pypy/dist/pypy/documentation/translation.txt Log: Typo. Modified: pypy/dist/pypy/documentation/translation.txt ============================================================================== --- pypy/dist/pypy/documentation/translation.txt (original) +++ pypy/dist/pypy/documentation/translation.txt Fri May 20 21:41:13 2005 @@ -852,7 +852,7 @@ Let's have a look at the body of this code: The first definition of g is just for the argument parsing and is used as f_g in the gateway.interp2app. -We look at the second definition, fastf_f, which does the actual +We look at the second definition, fastf_g, which does the actual computation. Comparing to the flowgraph from above_, you see a code block for every block in the graph. Since Python has no goto statement, the jumps between the blocks are implemented From cfbolz at codespeak.net Fri May 20 21:45:14 2005 From: cfbolz at codespeak.net (cfbolz at codespeak.net) Date: Fri, 20 May 2005 21:45:14 +0200 (CEST) Subject: [pypy-svn] r12670 - pypy/dist/pypy/documentation/website Message-ID: <20050520194514.3F78927B4C@code1.codespeak.net> Author: cfbolz Date: Fri May 20 21:45:14 2005 New Revision: 12670 Modified: pypy/dist/pypy/documentation/website/news.txt Log: AARGH! Modified: pypy/dist/pypy/documentation/website/news.txt ============================================================================== --- pypy/dist/pypy/documentation/website/news.txt (original) +++ pypy/dist/pypy/documentation/website/news.txt Fri May 20 21:45:14 2005 @@ -9,20 +9,6 @@ .. _Python: http://www.python.org/doc/current/ref/ref.html .. _`more...`: ../architecture.html#mission-statement -First PyPy release -================== - -We are happy to announce the first public release of PyPy after two years of -spare-time and half a year of EU funded development. The 0.6 release is -a preview release, concentrating on CPython compatibility. -Read more in the `release announcement`_ or head over to our `getting -started'_ document to give it a try. - -.. _`release announcement`: http://codespeak.net/pypy/index.cgi?doc/release-0.6.html -.. _`getting started`: http://codespeak.net/pypy/index.cgi?getting-started - -*(05/20/2005)* - Next Sprint after EuroPython 2005 1st-7th July ====================================================== From cfbolz at codespeak.net Fri May 20 21:46:34 2005 From: cfbolz at codespeak.net (cfbolz at codespeak.net) Date: Fri, 20 May 2005 21:46:34 +0200 (CEST) Subject: [pypy-svn] r12671 - pypy/dist/pypy/documentation Message-ID: <20050520194634.89A7927B4C@code1.codespeak.net> Author: cfbolz Date: Fri May 20 21:46:34 2005 New Revision: 12671 Modified: pypy/dist/pypy/documentation/news-0.6.txt Log: Fixing ReST errors. Modified: pypy/dist/pypy/documentation/news-0.6.txt ============================================================================== --- pypy/dist/pypy/documentation/news-0.6.txt (original) +++ pypy/dist/pypy/documentation/news-0.6.txt Fri May 20 21:46:34 2005 @@ -5,10 +5,10 @@ We are happy to announce the first public release of PyPy after two years of spare-time and half a year of EU funded development. The 0.6 release is a preview release, concentrating on CPython compatibility. -Read more in the `release announcement`_ or head over to our `getting -started`_ document to give it a try. +Read more in the `release announcement`_ or head over to our +`getting started`_ document to give it a try. +*(05/20/2005)* .. _`release announcement`: http://codespeak.net/pypy/index.cgi?doc/release-0.6.html .. _`getting started`: http://codespeak.net/pypy/index.cgi?getting-started -*(05/20/2005)* From hpk at codespeak.net Fri May 20 21:55:36 2005 From: hpk at codespeak.net (hpk at codespeak.net) Date: Fri, 20 May 2005 21:55:36 +0200 (CEST) Subject: [pypy-svn] r12672 - pypy/dist/pypy/documentation Message-ID: <20050520195536.0646027B4C@code1.codespeak.net> Author: hpk Date: Fri May 20 21:55:35 2005 New Revision: 12672 Modified: pypy/dist/pypy/documentation/news-0.6.txt Log: streamlined 0.6 news item Modified: pypy/dist/pypy/documentation/news-0.6.txt ============================================================================== --- pypy/dist/pypy/documentation/news-0.6.txt (original) +++ pypy/dist/pypy/documentation/news-0.6.txt Fri May 20 21:55:35 2005 @@ -1,13 +1,13 @@ -First PyPy release -================== +First PyPy release! +=================== We are happy to announce the first public release of PyPy after two years of spare-time and half a year of EU funded development. The 0.6 release is -a preview release, concentrating on CPython compatibility. -Read more in the `release announcement`_ or head over to our -`getting started`_ document to give it a try. -*(05/20/2005)* +a preview release, concentrating on CPython compatibility, good documentation +and nice starting points into the PyPy code base. We invite you to head +over to to the `getting started`_ document or read more in the +`release announcement`_. *(05/20/2005)* .. _`release announcement`: http://codespeak.net/pypy/index.cgi?doc/release-0.6.html .. _`getting started`: http://codespeak.net/pypy/index.cgi?getting-started From tismer at codespeak.net Fri May 20 21:59:37 2005 From: tismer at codespeak.net (tismer at codespeak.net) Date: Fri, 20 May 2005 21:59:37 +0200 (CEST) Subject: [pypy-svn] r12673 - pypy/dist/pypy/documentation Message-ID: <20050520195937.057AF27B4C@code1.codespeak.net> Author: tismer Date: Fri May 20 21:59:36 2005 New Revision: 12673 Modified: pypy/dist/pypy/documentation/translation.txt Log: some more blathering Modified: pypy/dist/pypy/documentation/translation.txt ============================================================================== --- pypy/dist/pypy/documentation/translation.txt (original) +++ pypy/dist/pypy/documentation/translation.txt Fri May 20 21:59:36 2005 @@ -858,6 +858,33 @@ Since Python has no goto statement, the jumps between the blocks are implemented by a loop that switches over a "goto" variable. +:: + + . + if goto == 1: + v0 = space.is_true(w_n) + if v0 == True: + w_n_1, w_0 = w_n, w_i + goto = 2 + else: + assert v0 == False + w_1 = w_i + goto = 4 + +This is the implementation of the ``while n:``. You see how every +instruction produces a new variable. There is no implicit state, +everything is passed over to the next block by initializing its +input variables. This directly resembles the nature of flowgraphs. +They are completely stateless. + +Note that it is possible to rewrite this by re-using variables, +trying to produce nested blocks instead of the goto construction +and much more. For the C backend, this makes no sense since the +compiler does it for us. For the Python interpreter it could +give a bit more speed. But this is a temporary format and will +get optimized anyway when we produce the executable. + + How it works ------------ From pedronis at codespeak.net Fri May 20 21:59:52 2005 From: pedronis at codespeak.net (pedronis at codespeak.net) Date: Fri, 20 May 2005 21:59:52 +0200 (CEST) Subject: [pypy-svn] r12674 - pypy/dist/pypy/interpreter Message-ID: <20050520195952.CA18827B4F@code1.codespeak.net> Author: pedronis Date: Fri May 20 21:59:52 2005 New Revision: 12674 Modified: pypy/dist/pypy/interpreter/gateway.py Log: preserve the possibly modified class level setting for use_geninterp Modified: pypy/dist/pypy/interpreter/gateway.py ============================================================================== --- pypy/dist/pypy/interpreter/gateway.py (original) +++ pypy/dist/pypy/interpreter/gateway.py Fri May 20 21:59:52 2005 @@ -514,7 +514,8 @@ self.modname = modname # look at the first three lines for a NOT_RPYTHON tag first = "\n".join(source.split("\n", 3)[:3]) - self.use_geninterp = self.use_geninterp and "NOT_RPYTHON" not in first + if "NOT_RPYTHON" in first: + self.use_geninterp = False def getwdict(self, space): return space.fromcache(ApplevelCache).getorbuild(self) From hpk at codespeak.net Fri May 20 22:03:22 2005 From: hpk at codespeak.net (hpk at codespeak.net) Date: Fri, 20 May 2005 22:03:22 +0200 (CEST) Subject: [pypy-svn] r12675 - pypy/dist/pypy/documentation Message-ID: <20050520200322.8ED8427B4C@code1.codespeak.net> Author: hpk Date: Fri May 20 22:03:22 2005 New Revision: 12675 Removed: pypy/dist/pypy/documentation/news-0.6.txt Modified: pypy/dist/pypy/documentation/getting_started.txt Log: removing news-0.6 (i keep it in a local buffer) putting download links into getting-started Modified: pypy/dist/pypy/documentation/getting_started.txt ============================================================================== --- pypy/dist/pypy/documentation/getting_started.txt (original) +++ pypy/dist/pypy/documentation/getting_started.txt Fri May 20 22:03:22 2005 @@ -15,11 +15,12 @@ Download one of the following release files and unpack it: -*pypy-0.6 (not released yet)* +*pypy-0.6 (05/20/2005)* - * download `pypy-0.6.zip` or `pypy-0.6.tar.gz` and unpack it + * download one of `pypy-0.6.tar.bz2`_, `pypy-0.6.tar.gz`_ or + `pypy-0.6.zip`_ and unpack it - * alternatively run ``svn co http://codespeak.net/svn/pypy/tag/0.6 pypy-0.6`` + * alternatively run ``svn co http://codespeak.net/svn/pypy/release/0.6 pypy-0.6`` then change to the ``pypy-0.6`` directory and execute the following command line:: @@ -37,6 +38,9 @@ for guidance on how to continue. .. _`90% of CPythons core language regression tests`: http://codespeak.net/~hpk/pypy-testresult/ +.. _`pypy-0.6.tar.bz2`: http://codespeak.net/download/pypy/pypy-0.6.tar.bz2 +.. _`pypy-0.6.zip`: http://codespeak.net/download/pypy/pypy-0.6.zip +.. _`pypy-0.6.tar.gz`: http://codespeak.net/download/pypy/pypy-0.6.tar.gz Svn-check out & run the latest PyPy as a two-liner -------------------------------------------------- Deleted: /pypy/dist/pypy/documentation/news-0.6.txt ============================================================================== --- /pypy/dist/pypy/documentation/news-0.6.txt Fri May 20 22:03:22 2005 +++ (empty file) @@ -1,14 +0,0 @@ - -First PyPy release! -=================== - -We are happy to announce the first public release of PyPy after two years of -spare-time and half a year of EU funded development. The 0.6 release is -a preview release, concentrating on CPython compatibility, good documentation -and nice starting points into the PyPy code base. We invite you to head -over to to the `getting started`_ document or read more in the -`release announcement`_. *(05/20/2005)* - -.. _`release announcement`: http://codespeak.net/pypy/index.cgi?doc/release-0.6.html -.. _`getting started`: http://codespeak.net/pypy/index.cgi?getting-started - From tismer at codespeak.net Fri May 20 22:10:35 2005 From: tismer at codespeak.net (tismer at codespeak.net) Date: Fri, 20 May 2005 22:10:35 +0200 (CEST) Subject: [pypy-svn] r12676 - pypy/dist/pypy/documentation Message-ID: <20050520201035.52B2427B4C@code1.codespeak.net> Author: tismer Date: Fri May 20 22:10:35 2005 New Revision: 12676 Modified: pypy/dist/pypy/documentation/translation.txt Log: more details Modified: pypy/dist/pypy/documentation/translation.txt ============================================================================== --- pypy/dist/pypy/documentation/translation.txt (original) +++ pypy/dist/pypy/documentation/translation.txt Fri May 20 22:10:35 2005 @@ -860,8 +860,7 @@ :: - . - if goto == 1: + . if goto == 1: v0 = space.is_true(w_n) if v0 == True: w_n_1, w_0 = w_n, w_i @@ -871,16 +870,31 @@ w_1 = w_i goto = 4 -This is the implementation of the ``while n:``. You see how every -instruction produces a new variable. There is no implicit state, +This is the implementation of the ``while n:``. There is no implicit state, everything is passed over to the next block by initializing its input variables. This directly resembles the nature of flowgraphs. They are completely stateless. + +:: + + . if goto == 2: + w_2 = space.add(w_0, w_n_1) + w_3 = space.sub(w_n_1, space.w_True) + w_n, w_i = w_3, w_2 + goto = 1 + continue + +The ``i = i + n`` and ``n = n - 1`` instructions. +You see how every instruction produces a new variable. +The state is again shuffled around by assigning to the +input variables ``w_n`` and ``w_i`` of the next target, block 1. + Note that it is possible to rewrite this by re-using variables, trying to produce nested blocks instead of the goto construction -and much more. For the C backend, this makes no sense since the -compiler does it for us. For the Python interpreter it could +and much more. The source would look much more like what we +used to write by hand. For the C backend, this doesn'r make much +sense since the compiler optimizes it for us. For the Python interpreter it could give a bit more speed. But this is a temporary format and will get optimized anyway when we produce the executable. From tismer at codespeak.net Fri May 20 22:14:07 2005 From: tismer at codespeak.net (tismer at codespeak.net) Date: Fri, 20 May 2005 22:14:07 +0200 (CEST) Subject: [pypy-svn] r12677 - pypy/dist/pypy/documentation Message-ID: <20050520201407.7ED7427B4B@code1.codespeak.net> Author: tismer Date: Fri May 20 22:14:07 2005 New Revision: 12677 Modified: pypy/dist/pypy/documentation/translation.txt Log: getting nicer Modified: pypy/dist/pypy/documentation/translation.txt ============================================================================== --- pypy/dist/pypy/documentation/translation.txt (original) +++ pypy/dist/pypy/documentation/translation.txt Fri May 20 22:14:07 2005 @@ -848,15 +848,15 @@ does a number of initialization steps, builds the global objects the function need, and produces the interface function gfunc_g to be called from interpreter level. -The return value is 'g3dict', which contains a module name and the function we asked for. +The return value is ``g3dict``, which contains a module name and the function we asked for. -Let's have a look at the body of this code: The first definition of g is just -for the argument parsing and is used as f_g in the gateway.interp2app. -We look at the second definition, fastf_g, which does the actual +Let's have a look at the body of this code: The first definition of ``g`` is just +for the argument parsing and is used as ``f_g`` in the gateway.interp2app. +We look at the second definition, ``fastf_g``, which does the actual computation. Comparing to the flowgraph from above_, you see a code block for every block in the graph. Since Python has no goto statement, the jumps between the blocks are implemented -by a loop that switches over a "goto" variable. +by a loop that switches over a ``goto`` variable. :: @@ -870,7 +870,7 @@ w_1 = w_i goto = 4 -This is the implementation of the ``while n:``. There is no implicit state, +This is the implementation of the "``while n:``". There is no implicit state, everything is passed over to the next block by initializing its input variables. This directly resembles the nature of flowgraphs. They are completely stateless. @@ -885,7 +885,7 @@ goto = 1 continue -The ``i = i + n`` and ``n = n - 1`` instructions. +The "``i = i + n``" and "``n = n - 1``" instructions. You see how every instruction produces a new variable. The state is again shuffled around by assigning to the input variables ``w_n`` and ``w_i`` of the next target, block 1. From hpk at codespeak.net Fri May 20 22:14:48 2005 From: hpk at codespeak.net (hpk at codespeak.net) Date: Fri, 20 May 2005 22:14:48 +0200 (CEST) Subject: [pypy-svn] r12678 - pypy/dist/pypy/documentation Message-ID: <20050520201448.29D7327B4B@code1.codespeak.net> Author: hpk Date: Fri May 20 22:14:47 2005 New Revision: 12678 Modified: pypy/dist/pypy/documentation/getting_started.txt Log: remove the links to look at fixing pickle Modified: pypy/dist/pypy/documentation/getting_started.txt ============================================================================== --- pypy/dist/pypy/documentation/getting_started.txt (original) +++ pypy/dist/pypy/documentation/getting_started.txt Fri May 20 22:14:47 2005 @@ -17,8 +17,8 @@ *pypy-0.6 (05/20/2005)* - * download one of `pypy-0.6.tar.bz2`_, `pypy-0.6.tar.gz`_ or - `pypy-0.6.zip`_ and unpack it + * download one of `pypy-0.6.tar.bz2`, `pypy-0.6.tar.gz` or + `pypy-0.6.zip` and unpack it * alternatively run ``svn co http://codespeak.net/svn/pypy/release/0.6 pypy-0.6`` From tismer at codespeak.net Fri May 20 22:17:34 2005 From: tismer at codespeak.net (tismer at codespeak.net) Date: Fri, 20 May 2005 22:17:34 +0200 (CEST) Subject: [pypy-svn] r12679 - pypy/dist/pypy/documentation Message-ID: <20050520201734.D9E8327B4B@code1.codespeak.net> Author: tismer Date: Fri May 20 22:17:34 2005 New Revision: 12679 Modified: pypy/dist/pypy/documentation/translation.txt Log: typo Modified: pypy/dist/pypy/documentation/translation.txt ============================================================================== --- pypy/dist/pypy/documentation/translation.txt (original) +++ pypy/dist/pypy/documentation/translation.txt Fri May 20 22:17:34 2005 @@ -893,7 +893,7 @@ Note that it is possible to rewrite this by re-using variables, trying to produce nested blocks instead of the goto construction and much more. The source would look much more like what we -used to write by hand. For the C backend, this doesn'r make much +used to write by hand. For the C backend, this doesn't make much sense since the compiler optimizes it for us. For the Python interpreter it could give a bit more speed. But this is a temporary format and will get optimized anyway when we produce the executable. From tismer at codespeak.net Fri May 20 22:36:05 2005 From: tismer at codespeak.net (tismer at codespeak.net) Date: Fri, 20 May 2005 22:36:05 +0200 (CEST) Subject: [pypy-svn] r12681 - pypy/dist/pypy/objspace/std Message-ID: <20050520203605.C527527B4B@code1.codespeak.net> Author: tismer Date: Fri May 20 22:36:05 2005 New Revision: 12681 Modified: pypy/dist/pypy/objspace/std/objecttype.py Log: had to disable geninterp for the copy_reg related stuff. The problem is that the always import hits use here. We need to rething how to handle these. For now, disbaling is just fine. Modified: pypy/dist/pypy/objspace/std/objecttype.py ============================================================================== --- pypy/dist/pypy/objspace/std/objecttype.py (original) +++ pypy/dist/pypy/objspace/std/objecttype.py Fri May 20 22:36:05 2005 @@ -79,6 +79,7 @@ return reduce_1(space, w_obj, w_proto) app = gateway.applevel(r''' +# NOT_RPYTHON def reduce_1(obj, proto): import copy_reg return copy_reg._reduce_ex(obj, proto) From arigo at codespeak.net Fri May 20 22:57:24 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Fri, 20 May 2005 22:57:24 +0200 (CEST) Subject: [pypy-svn] r12682 - in pypy/dist/pypy: module/__builtin__ objspace/flow objspace/std translator translator/tool Message-ID: <20050520205724.97B7827B4B@code1.codespeak.net> Author: arigo Date: Fri May 20 22:57:24 2005 New Revision: 12682 Removed: pypy/dist/pypy/translator/tool/tointerplevel.py Modified: pypy/dist/pypy/module/__builtin__/app_inspect.py pypy/dist/pypy/objspace/flow/objspace.py pypy/dist/pypy/objspace/flow/specialcase.py pypy/dist/pypy/objspace/std/objecttype.py pypy/dist/pypy/objspace/std/stringobject.py pypy/dist/pypy/translator/geninterplevel.py pypy/dist/pypy/translator/translator.py Log: Testing, quick fix. Modified: pypy/dist/pypy/module/__builtin__/app_inspect.py ============================================================================== --- pypy/dist/pypy/module/__builtin__/app_inspect.py (original) +++ pypy/dist/pypy/module/__builtin__/app_inspect.py Fri May 20 22:57:24 2005 @@ -1,5 +1,4 @@ """ -NOT_RPYTHON Plain Python definition of the builtin functions related to run-time program introspection. """ @@ -80,11 +79,10 @@ return False def callable(ob): + import __builtin__ # XXX this is insane but required for now for geninterp for c in type(ob).__mro__: if '__call__' in c.__dict__: - # NB. this is not RPython, because _instance - # does not exist when the flow graph sees it - if isinstance(ob, _instance): # old style instance! + if isinstance(ob, __builtin__._instance): # old style instance! return getattr(ob, '__call__', None) is not None return True else: Modified: pypy/dist/pypy/objspace/flow/objspace.py ============================================================================== --- pypy/dist/pypy/objspace/flow/objspace.py (original) +++ pypy/dist/pypy/objspace/flow/objspace.py Fri May 20 22:57:24 2005 @@ -31,6 +31,7 @@ full_exceptions = False builtins_can_raise_exceptions = False + do_imports_immediately = True def initialize(self): import __builtin__ Modified: pypy/dist/pypy/objspace/flow/specialcase.py ============================================================================== --- pypy/dist/pypy/objspace/flow/specialcase.py (original) +++ pypy/dist/pypy/objspace/flow/specialcase.py Fri May 20 22:57:24 2005 @@ -79,7 +79,8 @@ # fn = pyframe.normalize_exception.get_function(space) # this is now routed through the objspace, directly. # space.specialcases[fn] = sc_normalize_exception - space.specialcases[__import__] = sc_import + if space.do_imports_immediately: + space.specialcases[__import__] = sc_import # redirect ApplevelClass for print et al. space.specialcases[ApplevelClass] = sc_applevel # turn calls to built-in functions to the corresponding operation, Modified: pypy/dist/pypy/objspace/std/objecttype.py ============================================================================== --- pypy/dist/pypy/objspace/std/objecttype.py (original) +++ pypy/dist/pypy/objspace/std/objecttype.py Fri May 20 22:57:24 2005 @@ -79,7 +79,6 @@ return reduce_1(space, w_obj, w_proto) app = gateway.applevel(r''' -# NOT_RPYTHON def reduce_1(obj, proto): import copy_reg return copy_reg._reduce_ex(obj, proto) Modified: pypy/dist/pypy/objspace/std/stringobject.py ============================================================================== --- pypy/dist/pypy/objspace/std/stringobject.py (original) +++ pypy/dist/pypy/objspace/std/stringobject.py Fri May 20 22:57:24 2005 @@ -1009,9 +1009,9 @@ # this one should do the import of _formatting: app2 = gateway.applevel(''' + import _formatting def mod__String_ANY(format, values): - import _formatting if isinstance(values, tuple): return _formatting.format(format, values, None) else: Modified: pypy/dist/pypy/translator/geninterplevel.py ============================================================================== --- pypy/dist/pypy/translator/geninterplevel.py (original) +++ pypy/dist/pypy/translator/geninterplevel.py Fri May 20 22:57:24 2005 @@ -65,7 +65,7 @@ import pypy # __path__ import py.path -GI_VERSION = '1.0.8' # bump this for substantial changes +GI_VERSION = '1.0.9' # bump this for substantial changes # ____________________________________________________________ def eval_helper(self, typename, expr): @@ -1296,9 +1296,19 @@ dic = {'__name__': modname} if filename: dic['__file__'] = filename - exec code in dic + + # XXX allow the app-level code to contain e.g. "import _formatting" + libdir = os.path.join(pypy.__path__[0], "lib") + hold = sys.path[:] + sys.path.insert(0, libdir) + try: + exec code in dic + finally: + sys.path[:] = hold + entrypoint = dic t = Translator(None, verbose=False, simplifying=needed_passes, + do_imports_immediately=False, builtins_can_raise_exceptions=True) gen = GenRpy(t, entrypoint, modname, dic) if tmpname: @@ -1308,11 +1318,7 @@ tmpname = 'nada' out = _file(tmpname, 'w') gen.f = out - libdir = os.path.join(pypy.__path__[0], "lib") - hold = sys.path[:] - sys.path.insert(0, libdir) gen.gen_source(tmpname, file=_file) - sys.path[:] = hold out.close() newsrc = _file(tmpname).read() code = py.code.Source(newsrc).compile() Deleted: /pypy/dist/pypy/translator/tool/tointerplevel.py ============================================================================== --- /pypy/dist/pypy/translator/tool/tointerplevel.py Fri May 20 22:57:24 2005 +++ (empty file) @@ -1,78 +0,0 @@ -# this module can still be used, but it is no -# longer needed to bootstrap pypy. - -import autopath -import sys -import optparse -import os -import new - -from pypy.objspace.flow.objspace import FlowObjSpace -from pypy.translator.translator import Translator -from pypy.translator.geninterplevel import GenRpy, needed_passes as genrpy_needed_passes - -# change default -FlowObjSpace.builtins_can_raise_exceptions = True - -def main(): - opt_parser = optparse.OptionParser(usage="usage: %prog [options] module-file obj-name...") - opt_parser.add_option("--import-as", dest="as", type="string", - help="import module-file with this name") - opt_parser.add_option("-o","--out",dest="output",type="string", help="output file") - opt_parser.add_option("--modname",dest="modname", type="string", help="modname to be used by GenRpy") - - options, args = opt_parser.parse_args() - - if len(args) < 1: - opt_parser.error("missing module-file") - if len(args) < 2: - print "no obj-name given. Using the module dict!" - - modfile = os.path.abspath(args[0]) - - name = os.path.splitext(os.path.basename(modfile))[0] - - as = options.as or name - - mod = new.module(as) - mod.__dict__['__file__'] = modfile - execfile(modfile, mod.__dict__) - - del mod.__dict__['__builtins__'] - - modname = options.modname or name - - objs = [] - - for objname in args[1:]: - try: - objs.append(getattr(mod, objname)) - except AttributeError, e: - raise Exception,"module has no object '%s'" % objname - - if len(objs) == 0: - entrypoint = mod.__dict__ - elif len(objs) == 1: - entrypoint = objs[0] - else: - entrypoint = tuple(objs) - - t = Translator(None, verbose=False, simplifying=genrpy_needed_passes, builtins_can_raise_exceptions=True) - gen = GenRpy(t, entrypoint, modname, mod.__dict__) - - output = options.output or modname + "interp.py" - - print "generating %s..." % output - - gen.gen_source(output) - - - -if __name__ == "__main__": - main() - - - - - - Modified: pypy/dist/pypy/translator/translator.py ============================================================================== --- pypy/dist/pypy/translator/translator.py (original) +++ pypy/dist/pypy/translator/translator.py Fri May 20 22:57:24 2005 @@ -22,11 +22,13 @@ class Translator: def __init__(self, func=None, verbose=False, simplifying=True, + do_imports_immediately=True, builtins_can_raise_exceptions=False): self.entrypoint = func self.verbose = verbose self.simplifying = simplifying self.builtins_can_raise_exceptions = builtins_can_raise_exceptions + self.do_imports_immediately = do_imports_immediately self.clear() def clear(self): @@ -56,6 +58,7 @@ assert not self.frozen space = FlowObjSpace() space.builtins_can_raise_exceptions = self.builtins_can_raise_exceptions + space.do_imports_immediately = self.do_imports_immediately graph = space.build_flow(func) if self.simplifying: simplify_graph(graph, self.simplifying) From hpk at codespeak.net Fri May 20 23:09:05 2005 From: hpk at codespeak.net (hpk at codespeak.net) Date: Fri, 20 May 2005 23:09:05 +0200 (CEST) Subject: [pypy-svn] r12685 - pypy/dist/pypy Message-ID: <20050520210905.537F727B4C@code1.codespeak.net> Author: hpk Date: Fri May 20 23:09:05 2005 New Revision: 12685 Removed: pypy/dist/pypy/README.22 Log: it doesn't seem neccessary (anymore) to have notices for 2.2 here Deleted: /pypy/dist/pypy/README.22 ============================================================================== --- /pypy/dist/pypy/README.22 Fri May 20 23:09:05 2005 +++ (empty file) @@ -1,66 +0,0 @@ -CPython version 2.2 compatibility of PyPy - -History - Seo Sanghyeon, 2005-04-06 (r10349) - -First, you should use CPython version 2.3 or greater to run PyPy. -Running PyPy on top of 2.2 is definitely NOT supported. - -That said, there are some supports in the code to run PyPy -on top of 2.2, most notably "from __future__ import generators". -This document lists some of known problems. - -* opcode.py -opcode module is new in 2.3, and is used in the interpreter core. -Just copying this file from 2.3 should work. Without this, PyPy -won't even start. - -* boolean -In 2.2, bool is a builtin_function_or_method, not a type. This breaks -anything boolean related in the annotator. - -* func_with_new_name -pypy.tool.hack has a code to rename already defined function, which -is disabled for 2.2. You lose descriptive names like binop_xxx_impl, -and some gateway tests checking function name will fail. - -* operator.is_ -In 2.2, operator module doesn't include "is_(a, b)", which should be -equivalent to "a is b". This causes some problem in the flow objspace. - -* issubclass -2.2 doesn't allow tuple as the second argument to issubclass. This -affects the annotator. - -* extended slice -2.2 can't do extended slice -- the optional third argument in slicing -syntax. This affects the trace objspace. - -* C module -Anything using new-in-2.3 features of borrowed C modules won't work. -For example, socket.settimeout. - -* C API -All genc tests will fail due to difference between Python C headers. - -* universal newline -Universal newline support is new in 2.3. This lets tests for builtin -module testing this feature to fail. - -* int long unification -In 2.2, int() will raise OverflowError if argument is too large to -convert to int. In 2.3, this silently returns long. Tests explicitly -testing this does fail. - -* generators -Files using generators have needed __future__ import at the top -of the file. This should cause no problem. - -* exec without newline -It is a SyntaxError to exec string without trailing newline in 2.2. -This is CPython bug #501622. All known instances of this is worked -around. - -* misc features -"string in string" doesn't work in 2.2. dict.pop and dict.fromkeys -is new in 2.3. These have caused problems in the past. From hpk at codespeak.net Fri May 20 23:14:32 2005 From: hpk at codespeak.net (hpk at codespeak.net) Date: Fri, 20 May 2005 23:14:32 +0200 (CEST) Subject: [pypy-svn] r12687 - pypy/dist/pypy/documentation Message-ID: <20050520211432.0B40227B4C@code1.codespeak.net> Author: hpk Date: Fri May 20 23:14:31 2005 New Revision: 12687 Modified: pypy/dist/pypy/documentation/getting_started.txt Log: bringing in the links again Modified: pypy/dist/pypy/documentation/getting_started.txt ============================================================================== --- pypy/dist/pypy/documentation/getting_started.txt (original) +++ pypy/dist/pypy/documentation/getting_started.txt Fri May 20 23:14:31 2005 @@ -17,8 +17,8 @@ *pypy-0.6 (05/20/2005)* - * download one of `pypy-0.6.tar.bz2`, `pypy-0.6.tar.gz` or - `pypy-0.6.zip` and unpack it + * download one of `pypy-0.6.tar.bz2`_, `pypy-0.6.tar.gz`_ or + `pypy-0.6.zip`_ and unpack it * alternatively run ``svn co http://codespeak.net/svn/pypy/release/0.6 pypy-0.6`` From hpk at codespeak.net Fri May 20 23:22:07 2005 From: hpk at codespeak.net (hpk at codespeak.net) Date: Fri, 20 May 2005 23:22:07 +0200 (CEST) Subject: [pypy-svn] r12689 - pypy/dist/pypy/documentation/website Message-ID: <20050520212207.416F627B4C@code1.codespeak.net> Author: hpk Date: Fri May 20 23:22:07 2005 New Revision: 12689 Modified: pypy/dist/pypy/documentation/website/news.txt Log: added the 0.6 release news item Modified: pypy/dist/pypy/documentation/website/news.txt ============================================================================== --- pypy/dist/pypy/documentation/website/news.txt (original) +++ pypy/dist/pypy/documentation/website/news.txt Fri May 20 23:22:07 2005 @@ -9,6 +9,19 @@ .. _Python: http://www.python.org/doc/current/ref/ref.html .. _`more...`: ../architecture.html#mission-statement +First PyPy release! +=================== + +We are happy to announce the first public release of PyPy after two years of +spare-time and half a year of EU funded development. The 0.6 release is +a preview release, concentrating on CPython compatibility, good documentation +and nice starting points into the PyPy code base. We invite you to head +over to to the `getting started`_ document or read more in the +`release announcement`_. *(05/20/2005)* + +.. _`release announcement`: http://codespeak.net/pypy/index.cgi?doc/release-0.6.html +.. _`getting started`: http://codespeak.net/pypy/index.cgi?getting-started + Next Sprint after EuroPython 2005 1st-7th July ====================================================== From hpk at codespeak.net Fri May 20 23:49:23 2005 From: hpk at codespeak.net (hpk at codespeak.net) Date: Fri, 20 May 2005 23:49:23 +0200 (CEST) Subject: [pypy-svn] r12692 - pypy/dist/pypy/documentation/website Message-ID: <20050520214923.AE34F27B53@code1.codespeak.net> Author: hpk Date: Fri May 20 23:49:23 2005 New Revision: 12692 Modified: pypy/dist/pypy/documentation/website/news.txt Log: fix typo Modified: pypy/dist/pypy/documentation/website/news.txt ============================================================================== --- pypy/dist/pypy/documentation/website/news.txt (original) +++ pypy/dist/pypy/documentation/website/news.txt Fri May 20 23:49:23 2005 @@ -16,7 +16,7 @@ spare-time and half a year of EU funded development. The 0.6 release is a preview release, concentrating on CPython compatibility, good documentation and nice starting points into the PyPy code base. We invite you to head -over to to the `getting started`_ document or read more in the +over to the `getting started`_ document or read more in the `release announcement`_. *(05/20/2005)* .. _`release announcement`: http://codespeak.net/pypy/index.cgi?doc/release-0.6.html From tismer at codespeak.net Sat May 21 00:02:01 2005 From: tismer at codespeak.net (tismer at codespeak.net) Date: Sat, 21 May 2005 00:02:01 +0200 (CEST) Subject: [pypy-svn] r12693 - in pypy/dist/pypy: annotation interpreter objspace/flow objspace/flow/test translator/test Message-ID: <20050520220201.B9B4227B53@code1.codespeak.net> Author: tismer Date: Sat May 21 00:02:01 2005 New Revision: 12693 Modified: pypy/dist/pypy/annotation/builtin.py pypy/dist/pypy/interpreter/eval.py pypy/dist/pypy/objspace/flow/specialcase.py pypy/dist/pypy/objspace/flow/test/test_objspace.py pypy/dist/pypy/translator/test/rpystone.py Log: added the option to switch eager imports on and off. If it is off, then it is handled via an entry in builtin and still a little special-casing in specialcase.py, see that file. Note that I had to change a line in test_objspace, because lazy importing Modified: pypy/dist/pypy/annotation/builtin.py ============================================================================== --- pypy/dist/pypy/annotation/builtin.py (original) +++ pypy/dist/pypy/annotation/builtin.py Sat May 21 00:02:01 2005 @@ -198,6 +198,8 @@ def time_func(): return SomeFloat() +def import_func(*args): + return SomeObject() # collect all functions import __builtin__ @@ -236,6 +238,9 @@ BUILTIN_ANALYZERS[time.time] = time_func BUILTIN_ANALYZERS[time.clock] = time_func +# import +BUILTIN_ANALYZERS[__import__] = import_func + # annotation of low-level types from pypy.annotation.model import SomePtr from pypy.rpython import lltypes Modified: pypy/dist/pypy/interpreter/eval.py ============================================================================== --- pypy/dist/pypy/interpreter/eval.py (original) +++ pypy/dist/pypy/interpreter/eval.py Sat May 21 00:02:01 2005 @@ -100,7 +100,7 @@ def setfastscope(self, scope_w): """Abstract. Initialize the fast locals from a list of values, where the order is according to self.code.signature().""" - raise TypeError, "abstract" + raise TypeError, "abstract" def fast2locals(self): # Copy values from self.fastlocals_w to self.w_locals Modified: pypy/dist/pypy/objspace/flow/specialcase.py ============================================================================== --- pypy/dist/pypy/objspace/flow/specialcase.py (original) +++ pypy/dist/pypy/objspace/flow/specialcase.py Sat May 21 00:02:01 2005 @@ -9,6 +9,8 @@ from pypy.tool.cache import Cache from pypy.tool.sourcetools import NiceCompile, compile2 +EAGER_IMPORTS = True + def sc_import(space, fn, args): w_name, w_glob, w_loc, w_frm = args.fixedunpack(4) try: @@ -18,7 +20,12 @@ # import * in a function gives us the locals as Variable # we forbid it as a SyntaxError raise SyntaxError, "RPython: import * is not allowed in functions" - return space.wrap(mod) + if EAGER_IMPORTS: + return space.wrap(mod) + # redirect it, but avoid showing the globals + w_glob = Constant({}) + return space.do_operation('simple_call', Constant(__import__), + w_name, w_glob, w_loc, w_frm) def sc_operator(space, fn, args): args_w, kwds_w = args.unpack() Modified: pypy/dist/pypy/objspace/flow/test/test_objspace.py ============================================================================== --- pypy/dist/pypy/objspace/flow/test/test_objspace.py (original) +++ pypy/dist/pypy/objspace/flow/test/test_objspace.py Sat May 21 00:02:01 2005 @@ -379,7 +379,6 @@ #__________________________________________________________ def specialcases(x): - import operator operator.lt(x,3) operator.le(x,3) operator.eq(x,3) Modified: pypy/dist/pypy/translator/test/rpystone.py ============================================================================== --- pypy/dist/pypy/translator/test/rpystone.py (original) +++ pypy/dist/pypy/translator/test/rpystone.py Sat May 21 00:02:01 2005 @@ -279,6 +279,8 @@ sys.exit(100) def entrypoint(loops=None): + import string # just a little test + print string.replace("import works", "s", "x") if loops is None: loops = LOOPS # initialize early, for slow space nargs = len(sys.argv) - 1 From tismer at codespeak.net Sat May 21 00:02:42 2005 From: tismer at codespeak.net (tismer at codespeak.net) Date: Sat, 21 May 2005 00:02:42 +0200 (CEST) Subject: [pypy-svn] r12694 - pypy/dist/pypy/translator Message-ID: <20050520220242.A17C527B53@code1.codespeak.net> Author: tismer Date: Sat May 21 00:02:42 2005 New Revision: 12694 Modified: pypy/dist/pypy/translator/geninterplevel.py Log: more detailed docstring Modified: pypy/dist/pypy/translator/geninterplevel.py ============================================================================== --- pypy/dist/pypy/translator/geninterplevel.py (original) +++ pypy/dist/pypy/translator/geninterplevel.py Sat May 21 00:02:42 2005 @@ -2,14 +2,15 @@ Implementation of a translator from application Python to interpreter level RPython. -The idea is that we can automatically transform app-space implementations -of methods into some equivalent representation at interpreter level. -Then, the RPython to C translation might hopefully spit out some -more efficient code than always interpreting these methods. - -Note that the appspace functions are treated as rpythonic, in a sense -that globals are constants, for instance. This definition is not -exact and might change. +The idea is that we can automatically transform application level +implementations of methods into some equivalent representation at +interpreter level. Then, the RPython to C translation might +hopefully spit out some more efficient code than always interpreting +these methods. + +Note that the application level functions are treated as rpythonic, +in a sense that globals are constants, for instance. This definition +is not exact and might change. The interface for this module is @@ -19,6 +20,17 @@ modname="app2interpexec", tmpname=None) +If filename is given, it is used as a reference where +this sourcetext can be literally found, to produce +real line numbers. It cannot be just any name but +must exist and contain the source code somewhere. + +modname is optional and will be put into the dictionary +to be created. + +tmpname is optional. If given, a temporary file will +be created for debugging purposes. + The returned newsrc is the generated source text. It is used in gateway.py's caching mechanism. The initfunc result is a function named "init"+modname From tismer at codespeak.net Sat May 21 05:20:23 2005 From: tismer at codespeak.net (tismer at codespeak.net) Date: Sat, 21 May 2005 05:20:23 +0200 (CEST) Subject: [pypy-svn] r12697 - in pypy/dist/pypy: objspace/flow translator Message-ID: <20050521032023.40FF627B5D@code1.codespeak.net> Author: tismer Date: Sat May 21 05:20:22 2005 New Revision: 12697 Modified: pypy/dist/pypy/objspace/flow/specialcase.py pypy/dist/pypy/translator/geninterplevel.py Log: made the decision of whether to do imports immediately configurable. Special-casing still applies, since we don't want to expose our globals during an import. I had a very funny side-effect, after the last panic-checkin. Somehow, a reference to _formatting is kept around, even after we used _formatting globally. Changed geninterp in a way that it checks whether a module can be imported. If not, pypy/lib is temporarily added to sys.path during the import. Anyway, I guess our deliverable suffers from this problem and it will crash every time people are running code twice, requiring the _formatting module. The cached version will fail to resolve the import. :-( Modified: pypy/dist/pypy/objspace/flow/specialcase.py ============================================================================== --- pypy/dist/pypy/objspace/flow/specialcase.py (original) +++ pypy/dist/pypy/objspace/flow/specialcase.py Sat May 21 05:20:22 2005 @@ -9,20 +9,18 @@ from pypy.tool.cache import Cache from pypy.tool.sourcetools import NiceCompile, compile2 -EAGER_IMPORTS = True - def sc_import(space, fn, args): w_name, w_glob, w_loc, w_frm = args.fixedunpack(4) try: - mod = __import__(space.unwrap(w_name), space.unwrap(w_glob), - space.unwrap(w_loc), space.unwrap(w_frm)) + name, glob, loc, frm = (space.unwrap(w_name), space.unwrap(w_glob), + space.unwrap(w_loc), space.unwrap(w_frm)) except UnwrapException: # import * in a function gives us the locals as Variable # we forbid it as a SyntaxError raise SyntaxError, "RPython: import * is not allowed in functions" - if EAGER_IMPORTS: - return space.wrap(mod) - # redirect it, but avoid showing the globals + if space.do_imports_immediately: + return space.wrap(__import__(name, glob, loc, frm)) + # redirect it, but avoid exposing the globals w_glob = Constant({}) return space.do_operation('simple_call', Constant(__import__), w_name, w_glob, w_loc, w_frm) @@ -86,8 +84,7 @@ # fn = pyframe.normalize_exception.get_function(space) # this is now routed through the objspace, directly. # space.specialcases[fn] = sc_normalize_exception - if space.do_imports_immediately: - space.specialcases[__import__] = sc_import + space.specialcases[__import__] = sc_import # redirect ApplevelClass for print et al. space.specialcases[ApplevelClass] = sc_applevel # turn calls to built-in functions to the corresponding operation, Modified: pypy/dist/pypy/translator/geninterplevel.py ============================================================================== --- pypy/dist/pypy/translator/geninterplevel.py (original) +++ pypy/dist/pypy/translator/geninterplevel.py Sat May 21 05:20:22 2005 @@ -77,7 +77,7 @@ import pypy # __path__ import py.path -GI_VERSION = '1.0.9' # bump this for substantial changes +GI_VERSION = '1.1.0' # bump this for substantial changes # ____________________________________________________________ def eval_helper(self, typename, expr): @@ -406,8 +406,26 @@ value.__file__.endswith('.py') or value.__file__.endswith('.pyo')) : return bltinmod_helper(self, value) + # we might have createda reference to a module + # that is non-standard. + # check whether we can import + try: + import value + need_extra_path = False + except ImportError: + need_extra_path = True name = self.uniquename('mod_%s' % value.__name__) - self.initcode.append1('import %s as _tmp' % value.__name__) + if need_extra_path: + self.initcode.append1('import pypy') + self.initcode.append1('import sys') + self.initcode.append1('import os') + self.initcode.append1('libdir = os.path.join(pypy.__path__[0], "lib")\n' + 'hold = sys.path[:]\n' + 'sys.path.insert(0, libdir)\n' + 'import %s as _tmp\n' + 'sys.path[:] = hold\n' % value.__name__) + else: + self.initcode.append1('import %s as _tmp' % value.__name__) self.initcode.append1('%s = space.wrap(_tmp)' % (name)) return name @@ -1285,7 +1303,7 @@ pass def translate_as_module(sourcetext, filename=None, modname="app2interpexec", - tmpname=None): + do_imports_immediately=False, tmpname=None): """ compile sourcetext as a module, translating to interp level. The result is the init function that creates the wrapped module dict, together with the generated source text. @@ -1320,7 +1338,7 @@ entrypoint = dic t = Translator(None, verbose=False, simplifying=needed_passes, - do_imports_immediately=False, + do_imports_immediately=do_imports_immediately, builtins_can_raise_exceptions=True) gen = GenRpy(t, entrypoint, modname, dic) if tmpname: From hpk at codespeak.net Sat May 21 12:44:08 2005 From: hpk at codespeak.net (hpk at codespeak.net) Date: Sat, 21 May 2005 12:44:08 +0200 (CEST) Subject: [pypy-svn] r12699 - pypy/branch/0.6.x Message-ID: <20050521104408.622F927B60@code1.codespeak.net> Author: hpk Date: Sat May 21 12:44:08 2005 New Revision: 12699 Added: pypy/branch/0.6.x/ - copied from r12698, pypy/release/0.6/ Log: open a 0.6.x branch for fixing at least the 0.6 buggy behvaiour with respect to python -c "print '%s' % 3" python -c "print '%s' % 3" the second one failing. From lac at codespeak.net Sat May 21 12:47:51 2005 From: lac at codespeak.net (lac at codespeak.net) Date: Sat, 21 May 2005 12:47:51 +0200 (CEST) Subject: [pypy-svn] r12700 - pypy/dist/pypy/documentation Message-ID: <20050521104751.630D927B60@code1.codespeak.net> Author: lac Date: Sat May 21 12:47:51 2005 New Revision: 12700 Modified: pypy/dist/pypy/documentation/contributor.txt Log: Dutch capitalisation rules for 'van' names. If only the last name is used, capitalise the 'v': i.e. 'Python was created by Van Rossum.' But if the first name is included, the 'v' is not capitalised. i.e. 'Python was created by Guido van Rossum.' see: http://www.python.org/~guido/ Modified: pypy/dist/pypy/documentation/contributor.txt ============================================================================== --- pypy/dist/pypy/documentation/contributor.txt (original) +++ pypy/dist/pypy/documentation/contributor.txt Sat May 21 12:47:51 2005 @@ -22,7 +22,7 @@ Jacob Hallen Marius Gedminas Laura Creighton - Guido Van Rossum + Guido van Rossum Richard Emslie Ludovic Aubry Adrien Di Mascio From arigo at codespeak.net Sat May 21 13:04:07 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Sat, 21 May 2005 13:04:07 +0200 (CEST) Subject: [pypy-svn] r12701 - in pypy/branch/0.6.x/pypy: interpreter translator Message-ID: <20050521110407.0996B27B60@code1.codespeak.net> Author: arigo Date: Sat May 21 13:04:06 2005 New Revision: 12701 Modified: pypy/branch/0.6.x/pypy/interpreter/gateway.py pypy/branch/0.6.x/pypy/translator/geninterplevel.py Log: issue75 testing Moved a hack elsewhere, basically. Importing stringobject's apphelpers from the cache didn't find _formatting at interp-level. This is all very broken, but out of reach of a simple clean-up. Modified: pypy/branch/0.6.x/pypy/interpreter/gateway.py ============================================================================== --- pypy/branch/0.6.x/pypy/interpreter/gateway.py (original) +++ pypy/branch/0.6.x/pypy/interpreter/gateway.py Sat May 21 13:04:06 2005 @@ -7,7 +7,7 @@ """ -import types, sys, md5, os +import types, sys, md5, os, autopath NoneNotWrapped = object() @@ -595,32 +595,38 @@ cls._setup() from pypy.translator.geninterplevel import translate_as_module - scramble = md5.new(cls.seed) - scramble.update(self.source) - key = scramble.hexdigest() - initfunc = cls.known_source.get(key) - if not initfunc: - # try to get it from file - name = key - if self.filename: - prename = os.path.splitext(os.path.basename(self.filename))[0] - else: - prename = 'zznoname' - name = "%s_%s" % (prename, name) - try: - __import__("pypy._cache."+name) - except ImportError, x: - # print x - pass - else: - initfunc = cls.known_source[key] - if not initfunc: - # build it and put it into a file - initfunc, newsrc = translate_as_module( - self.source, self.filename, self.modname) - fname = cls.cache_path.join(name+".py").strpath - f = file(fname, "w") - print >> f, """\ + + # XXX HACK HACK HACK XXX + # XXX allow the app-level code to contain e.g. "import _formatting" + libdir = os.path.join(autopath.pypydir, "lib") + sys.path.append(libdir) + try: + scramble = md5.new(cls.seed) + scramble.update(self.source) + key = scramble.hexdigest() + initfunc = cls.known_source.get(key) + if not initfunc: + # try to get it from file + name = key + if self.filename: + prename = os.path.splitext(os.path.basename(self.filename))[0] + else: + prename = 'zznoname' + name = "%s_%s" % (prename, name) + try: + __import__("pypy._cache."+name) + except ImportError, x: + # print x + pass + else: + initfunc = cls.known_source[key] + if not initfunc: + # build it and put it into a file + initfunc, newsrc = translate_as_module( + self.source, self.filename, self.modname) + fname = cls.cache_path.join(name+".py").strpath + f = file(fname, "w") + print >> f, """\ # self-destruct on double-click: if __name__ == "__main__": from pypy import _cache @@ -631,11 +637,14 @@ os.unlink(namestart+ending) except os.error: pass""" % name - print >> f - print >> f, newsrc - print >> f, "from pypy._cache import known_source" - print >> f, "known_source[%r] = %s" % (key, initfunc.__name__) - w_glob = initfunc(space) + print >> f + print >> f, newsrc + print >> f, "from pypy._cache import known_source" + print >> f, "known_source[%r] = %s" % (key, initfunc.__name__) + w_glob = initfunc(space) + finally: + if libdir in sys.path: + sys.path.remove(libdir) return w_glob build_applevelinterp_dict = classmethod(build_applevelinterp_dict) Modified: pypy/branch/0.6.x/pypy/translator/geninterplevel.py ============================================================================== --- pypy/branch/0.6.x/pypy/translator/geninterplevel.py (original) +++ pypy/branch/0.6.x/pypy/translator/geninterplevel.py Sat May 21 13:04:06 2005 @@ -1296,15 +1296,7 @@ dic = {'__name__': modname} if filename: dic['__file__'] = filename - - # XXX allow the app-level code to contain e.g. "import _formatting" - libdir = os.path.join(pypy.__path__[0], "lib") - hold = sys.path[:] - sys.path.insert(0, libdir) - try: - exec code in dic - finally: - sys.path[:] = hold + exec code in dic entrypoint = dic t = Translator(None, verbose=False, simplifying=needed_passes, From hpk at codespeak.net Sat May 21 13:35:07 2005 From: hpk at codespeak.net (hpk at codespeak.net) Date: Sat, 21 May 2005 13:35:07 +0200 (CEST) Subject: [pypy-svn] r12702 - pypy/dist/pypy/documentation Message-ID: <20050521113507.A408B27B60@code1.codespeak.net> Author: hpk Date: Sat May 21 13:35:07 2005 New Revision: 12702 Modified: pypy/dist/pypy/documentation/getting_started.txt Log: reference the 0.6.1 bugfix release Modified: pypy/dist/pypy/documentation/getting_started.txt ============================================================================== --- pypy/dist/pypy/documentation/getting_started.txt (original) +++ pypy/dist/pypy/documentation/getting_started.txt Sat May 21 13:35:07 2005 @@ -10,19 +10,22 @@ Just the facts ============== -getting & running the PyPy 0.6 release ---------------------------------------- +getting & running the PyPy 0.6.1 release +----------------------------------------- + + Note that the 0.6 release was broken and + thus you find only the 0.6.1 release here. Download one of the following release files and unpack it: -*pypy-0.6 (05/20/2005)* +*pypy-0.6.1 (05/21/2005)* - * download one of `pypy-0.6.tar.bz2`_, `pypy-0.6.tar.gz`_ or - `pypy-0.6.zip`_ and unpack it + * download one of `pypy-0.6.1.tar.bz2`_, `pypy-0.6.1.tar.gz`_ or + `pypy-0.6.1.zip`_ (windows line-endings) and unpack it - * alternatively run ``svn co http://codespeak.net/svn/pypy/release/0.6 pypy-0.6`` + * alternatively run ``svn co http://codespeak.net/svn/pypy/release/0.6.1 pypy-0.6.1`` -then change to the ``pypy-0.6`` directory +then change to the ``pypy-0.6.1`` directory and execute the following command line:: python pypy/bin/py.py @@ -30,7 +33,7 @@ This will give you a PyPy prompt, i.e. a very compliant Python interpreter implemented in Python. Because this version of PyPy still runs on top of CPython, it runs around 2000 -times slower than the original CPython. The 0.6 release focus +times slower than the original CPython. The release focus really was on compliancy: PyPy passes around `90% of CPythons core language regression tests`_. @@ -38,9 +41,9 @@ for guidance on how to continue. .. _`90% of CPythons core language regression tests`: http://codespeak.net/~hpk/pypy-testresult/ -.. _`pypy-0.6.tar.bz2`: http://codespeak.net/download/pypy/pypy-0.6.tar.bz2 -.. _`pypy-0.6.zip`: http://codespeak.net/download/pypy/pypy-0.6.zip -.. _`pypy-0.6.tar.gz`: http://codespeak.net/download/pypy/pypy-0.6.tar.gz +.. _`pypy-0.6.1.tar.bz2`: http://codespeak.net/download/pypy/pypy-0.6.1.tar.bz2 +.. _`pypy-0.6.1.zip`: http://codespeak.net/download/pypy/pypy-0.6.1.zip +.. _`pypy-0.6.1.tar.gz`: http://codespeak.net/download/pypy/pypy-0.6.1.tar.gz Svn-check out & run the latest PyPy as a two-liner -------------------------------------------------- From arigo at codespeak.net Sat May 21 13:42:24 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Sat, 21 May 2005 13:42:24 +0200 (CEST) Subject: [pypy-svn] r12706 - in pypy/dist/pypy: interpreter translator Message-ID: <20050521114224.6B99227B60@code1.codespeak.net> Author: arigo Date: Sat May 21 13:42:24 2005 New Revision: 12706 Modified: pypy/dist/pypy/interpreter/gateway.py pypy/dist/pypy/translator/geninterplevel.py Log: Port the bugfix 0.6 -> 0.6.1 to the trunk. Modified: pypy/dist/pypy/interpreter/gateway.py ============================================================================== --- pypy/dist/pypy/interpreter/gateway.py (original) +++ pypy/dist/pypy/interpreter/gateway.py Sat May 21 13:42:24 2005 @@ -7,7 +7,7 @@ """ -import types, sys, md5, os +import types, sys, md5, os, autopath NoneNotWrapped = object() @@ -595,32 +595,38 @@ cls._setup() from pypy.translator.geninterplevel import translate_as_module - scramble = md5.new(cls.seed) - scramble.update(self.source) - key = scramble.hexdigest() - initfunc = cls.known_source.get(key) - if not initfunc: - # try to get it from file - name = key - if self.filename: - prename = os.path.splitext(os.path.basename(self.filename))[0] - else: - prename = 'zznoname' - name = "%s_%s" % (prename, name) - try: - __import__("pypy._cache."+name) - except ImportError, x: - # print x - pass - else: - initfunc = cls.known_source[key] - if not initfunc: - # build it and put it into a file - initfunc, newsrc = translate_as_module( - self.source, self.filename, self.modname) - fname = cls.cache_path.join(name+".py").strpath - f = file(fname, "w") - print >> f, """\ + + # XXX HACK HACK HACK XXX + # XXX allow the app-level code to contain e.g. "import _formatting" + libdir = os.path.join(autopath.pypydir, "lib") + sys.path.append(libdir) + try: + scramble = md5.new(cls.seed) + scramble.update(self.source) + key = scramble.hexdigest() + initfunc = cls.known_source.get(key) + if not initfunc: + # try to get it from file + name = key + if self.filename: + prename = os.path.splitext(os.path.basename(self.filename))[0] + else: + prename = 'zznoname' + name = "%s_%s" % (prename, name) + try: + __import__("pypy._cache."+name) + except ImportError, x: + # print x + pass + else: + initfunc = cls.known_source[key] + if not initfunc: + # build it and put it into a file + initfunc, newsrc = translate_as_module( + self.source, self.filename, self.modname) + fname = cls.cache_path.join(name+".py").strpath + f = file(fname, "w") + print >> f, """\ # self-destruct on double-click: if __name__ == "__main__": from pypy import _cache @@ -631,11 +637,14 @@ os.unlink(namestart+ending) except os.error: pass""" % name - print >> f - print >> f, newsrc - print >> f, "from pypy._cache import known_source" - print >> f, "known_source[%r] = %s" % (key, initfunc.__name__) - w_glob = initfunc(space) + print >> f + print >> f, newsrc + print >> f, "from pypy._cache import known_source" + print >> f, "known_source[%r] = %s" % (key, initfunc.__name__) + w_glob = initfunc(space) + finally: + if libdir in sys.path: + sys.path.remove(libdir) return w_glob build_applevelinterp_dict = classmethod(build_applevelinterp_dict) Modified: pypy/dist/pypy/translator/geninterplevel.py ============================================================================== --- pypy/dist/pypy/translator/geninterplevel.py (original) +++ pypy/dist/pypy/translator/geninterplevel.py Sat May 21 13:42:24 2005 @@ -1326,15 +1326,7 @@ dic = {'__name__': modname} if filename: dic['__file__'] = filename - - # XXX allow the app-level code to contain e.g. "import _formatting" - libdir = os.path.join(pypy.__path__[0], "lib") - hold = sys.path[:] - sys.path.insert(0, libdir) - try: - exec code in dic - finally: - sys.path[:] = hold + exec code in dic entrypoint = dic t = Translator(None, verbose=False, simplifying=needed_passes, From arigo at codespeak.net Sat May 21 14:12:41 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Sat, 21 May 2005 14:12:41 +0200 (CEST) Subject: [pypy-svn] r12709 - in pypy/dist/pypy: interpreter translator Message-ID: <20050521121241.A4AEF27B6D@code1.codespeak.net> Author: arigo Date: Sat May 21 14:12:41 2005 New Revision: 12709 Removed: pypy/dist/pypy/interpreter/gateway.py pypy/dist/pypy/translator/geninterplevel.py Log: Reverting... Deleted: /pypy/dist/pypy/interpreter/gateway.py ============================================================================== --- /pypy/dist/pypy/interpreter/gateway.py Sat May 21 14:12:41 2005 +++ (empty file) @@ -1,750 +0,0 @@ -""" - -Gateway between app-level and interpreter-level: -* BuiltinCode (call interp-level code from app-level) -* app2interp (embed an app-level function into an interp-level callable) -* interp2app (publish an interp-level object to be visible from app-level) - -""" - -import types, sys, md5, os, autopath - -NoneNotWrapped = object() - -from pypy.tool.sourcetools import func_with_new_name -from pypy.interpreter.error import OperationError -from pypy.interpreter import eval -from pypy.interpreter.function import Function, Method -from pypy.interpreter.baseobjspace import W_Root, ObjSpace, BaseWrappable -from pypy.interpreter.baseobjspace import Wrappable, SpaceCache -from pypy.interpreter.argument import Arguments -from pypy.tool.sourcetools import NiceCompile, compile2 - -# internal non-translatable parts: -import py - -class Signature: - "NOT_RPYTHON" - def __init__(self, func=None, argnames=None, varargname=None, - kwargname=None, name = None): - self.func = func - if func is not None: - self.name = func.__name__ - else: - self.name = name - if argnames is None: - argnames = [] - self.argnames = argnames - self.varargname = varargname - self.kwargname = kwargname - - def next_arg(self): - return self._argiter.next() - - def append(self, argname): - self.argnames.append(argname) - - def signature(self): - return self.argnames, self.varargname, self.kwargname - - def apply_unwrap_spec(self, unwrap_spec, recipe, new_sig): - self._argiter = iter(self.argnames) - for el in unwrap_spec: - recipe(el, self, new_sig) - return new_sig - - -class UnwrapSpecRecipe: - "NOT_RPYTHON" - - bases_order = [BaseWrappable, W_Root, ObjSpace, Arguments, object] - - def dispatch(self, meth_family, el, orig_sig, new_sig): - if isinstance(el, str): - getattr(self, "%s_%s" % (meth_family, el))(el, orig_sig, new_sig) - elif isinstance(el, tuple): - getattr(self, "%s_%s" % (meth_family, 'function'))(el, orig_sig, new_sig) - else: - for typ in self.bases_order: - if issubclass(el, typ): - getattr(self, "%s__%s" % (meth_family, typ.__name__))(el, orig_sig, new_sig) - break - else: - assert False, "no match for unwrap_spec element: %s" % el - - def check(self, el, orig_sig, new_sig): - self.dispatch("check", el, orig_sig, new_sig) - - def emit(self, el, orig_sig, new_sig): - self.dispatch("emit", el, orig_sig, new_sig) - - - # checks for checking interp2app func argument names wrt unwrap_spec - # and synthetizing an app-level signature - - def check_function(self, (func, cls), orig_sig, app_sig): - self.check(cls, orig_sig, app_sig) - - def check__BaseWrappable(self, el, orig_sig, app_sig): - name = el.__name__ - argname = orig_sig.next_arg() - assert not argname.startswith('w_'), ( - "unwrapped %s argument %s of built-in function %r should " - "not start with 'w_'" % (name, argname, orig_sig.func)) - app_sig.append(argname) - - def check__ObjSpace(self, el, orig_sig, app_sig): - orig_sig.next_arg() - - def check__W_Root(self, el, orig_sig, app_sig): - assert el is W_Root, "oops" - argname = orig_sig.next_arg() - assert argname.startswith('w_'), ( - "argument %s of built-in function %r should " - "start with 'w_'" % (argname, orig_sig.func)) - app_sig.append(argname[2:]) - - def check__Arguments(self, el, orig_sig, app_sig): - argname = orig_sig.next_arg() - assert app_sig.varargname is None,( - "built-in function %r has conflicting rest args specs" % orig_sig.func) - app_sig.varargname = 'args' - app_sig.kwargname = 'keywords' - - def check_starargs(self, el, orig_sig, app_sig): - varargname = orig_sig.varargname - assert varargname.endswith('_w'), ( - "argument *%s of built-in function %r should end in '_w'" % - (varargname, orig_sig.func)) - assert app_sig.varargname is None,( - "built-in function %r has conflicting rest args specs" % orig_sig.func) - app_sig.varargname = varargname[:-2] - - def check_args_w(self, el, orig_sig, app_sig): - argname = orig_sig.next_arg() - assert argname.endswith('_w'), ( - "rest arguments arg %s of built-in function %r should end in '_w'" % - (argname, orig_sig.func)) - assert app_sig.varargname is None,( - "built-in function %r has conflicting rest args specs" % orig_sig.func) - app_sig.varargname = argname[:-2] - - def check_w_args(self, el, orig_sig, app_sig): - argname = orig_sig.next_arg() - assert argname.startswith('w_'), ( - "rest arguments arg %s of built-in function %r should start 'w_'" % - (argname, orig_sig.func)) - assert app_sig.varargname is None,( - "built-in function %r has conflicting rest args specs" % orig_sig.func) - app_sig.varargname = argname[2:] - - def check__object(self, el, orig_sig, app_sig): - if el not in (int, str, float): - assert False, "unsupported basic type in uwnrap_spec" - name = el.__name__ - argname = orig_sig.next_arg() - assert not argname.startswith('w_'), ( - "unwrapped %s argument %s of built-in function %r should " - "not start with 'w_'" % (name, argname, orig_sig.func)) - app_sig.append(argname) - - # collect code to emit for interp2app builtin frames based on unwrap_spec - - def emit_function(self, (func, cls), orig_sig, emit_sig): - name = func.__name__ - cur = emit_sig.through_scope_w - emit_sig.setfastscope.append( - "obj = %s(scope_w[%d])" % (name, cur)) - emit_sig.miniglobals[name] = func - emit_sig.setfastscope.append( - "self.%s_arg%d = obj" % (name,cur)) - emit_sig.through_scope_w += 1 - emit_sig.run_args.append("self.%s_arg%d" % (name,cur)) - - def emit__BaseWrappable(self, el, orig_sig, emit_sig): - name = el.__name__ - cur = emit_sig.through_scope_w - emit_sig.setfastscope.append( - "obj = self.space.interpclass_w(scope_w[%d])" % cur) - emit_sig.setfastscope.append( - "if obj is None or not isinstance(obj, %s):" % name) - emit_sig.setfastscope.append( - " raise OperationError(self.space.w_TypeError,self.space.wrap('expected %%s' %% %s.typedef.name ))" % name) # xxx - emit_sig.miniglobals[name] = el - emit_sig.miniglobals['OperationError'] = OperationError - emit_sig.setfastscope.append( - "self.%s_arg%d = obj" % (name,cur)) - emit_sig.through_scope_w += 1 - emit_sig.run_args.append("self.%s_arg%d" % (name,cur)) - - def emit__ObjSpace(self, el, orig_sig, emit_sig): - emit_sig.run_args.append('self.space') - - def emit__W_Root(self, el, orig_sig, emit_sig): - cur = emit_sig.through_scope_w - emit_sig.setfastscope.append( - "self.w_arg%d = scope_w[%d]" % (cur,cur)) - emit_sig.through_scope_w += 1 - emit_sig.run_args.append("self.w_arg%d" % cur) - - def emit__Arguments(self, el, orig_sig, emit_sig): - cur = emit_sig.through_scope_w - emit_sig.through_scope_w += 2 - emit_sig.miniglobals['Arguments'] = Arguments - emit_sig.setfastscope.append( - "self.arguments_arg = " - "Arguments.frompacked(self.space,scope_w[%d],scope_w[%d])" - % (cur, cur+1)) - emit_sig.run_args.append("self.arguments_arg") - - def emit_starargs(self, el, orig_sig, emit_sig): - emit_sig.setfastscope.append( - "self.starargs_arg_w = self.space.unpacktuple(scope_w[%d])" % - (emit_sig.through_scope_w)) - emit_sig.through_scope_w += 1 - emit_sig.run_args.append("*self.starargs_arg_w") - - def emit_args_w(self, el, orig_sig, emit_sig): - emit_sig.setfastscope.append( - "self.args_w = self.space.unpacktuple(scope_w[%d])" % - (emit_sig.through_scope_w)) - emit_sig.through_scope_w += 1 - emit_sig.run_args.append("self.args_w") - - def emit_w_args(self, el, orig_sig, emit_sig): - cur = emit_sig.through_scope_w - emit_sig.setfastscope.append( - "self.w_args = scope_w[%d]" % cur) - emit_sig.through_scope_w += 1 - emit_sig.run_args.append("self.w_args") - - def emit__object(self, el, orig_sig, emit_sig): - if el not in (int, str, float): - assert False, "unsupported basic type in uwnrap_spec" - name = el.__name__ - cur = emit_sig.through_scope_w - emit_sig.setfastscope.append( - "self.%s_arg%d = self.space.%s_w(scope_w[%d])" % - (name,cur,name,cur)) - emit_sig.through_scope_w += 1 - emit_sig.run_args.append("self.%s_arg%d" % (name,cur)) - -class BuiltinFrame(eval.Frame): - "Frame emulation for BuiltinCode." - # Subclasses of this are defined with the function to delegate to attached through miniglobals. - # Initialization of locals is already done by the time run() is called, - # via the interface defined in eval.Frame. - - def setfastscope(self, scope_w): - """Subclasses with behavior specific for an unwrap spec are generated""" - raise TypeError, "abstract" - - def getfastscope(self): - raise OperationError(self.space.w_TypeError, - self.space.wrap("cannot get fastscope of a BuiltinFrame")) - - def run(self): - try: - w_result = self._run() - except KeyboardInterrupt: - raise OperationError(self.space.w_KeyboardInterrupt, self.space.w_None) - except MemoryError: - raise OperationError(self.space.w_MemoryError, self.space.w_None) - except RuntimeError, e: - raise OperationError(self.space.w_RuntimeError, - self.space.wrap("internal error: " + str(e))) - if w_result is None: - w_result = self.space.w_None - return w_result - - def _run(self): - """Subclasses with behavior specific for an unwrap spec are generated""" - raise TypeError, "abstract" - -class FuncBox(object): - pass - -class BuiltinCodeSignature(Signature): - "NOT_RPYTHON" - - def __init__(self,*args,**kwds): - self.unwrap_spec = kwds.get('unwrap_spec') - del kwds['unwrap_spec'] - Signature.__init__(self,*args,**kwds) - self.setfastscope = [] - self.run_args = [] - self.through_scope_w = 0 - self.miniglobals = {} - - def _make_unwrap_frame_class(self, cache={}): - try: - key = tuple(self.unwrap_spec) - frame_cls, box_cls, run_args = cache[key] - assert run_args == self.run_args,"unexpected: same spec, different run_args" - return frame_cls, box_cls - except KeyError: - parts = [] - for el in self.unwrap_spec: - if isinstance(el, tuple): - parts.append(''.join([getattr(subel, '__name__', subel) for subel in el])) - else: - parts.append(getattr(el, '__name__', el)) - label = '_'.join(parts) - #print label - setfastscope = self.setfastscope - if not setfastscope: - setfastscope = ["pass"] - setfastscope = ["def setfastscope_UWS_%s(self, scope_w):" % label, - #"print 'ENTER',self.code.func.__name__", - #"print scope_w" - ] + setfastscope - setfastscope = '\n '.join(setfastscope) - # Python 2.2 SyntaxError without newline: Bug #501622 - setfastscope += '\n' - d = {} - exec compile2(setfastscope) in self.miniglobals, d - d['setfastscope'] = d['setfastscope_UWS_%s' % label] - del d['setfastscope_UWS_%s' % label] - - self.miniglobals['OperationError'] = OperationError - source = """if 1: - def _run_UWS_%s(self): - return self.box.func(%s) - \n""" % (label, ','.join(self.run_args)) - exec compile2(source) in self.miniglobals, d - d['_run'] = d['_run_UWS_%s' % label] - del d['_run_UWS_%s' % label] - frame_cls = type("BuiltinFrame_UWS_%s" % label, (BuiltinFrame,), d) - box_cls = type("FuncBox_UWS_%s" % label, (FuncBox,), {}) - cache[key] = frame_cls, box_cls, self.run_args - return frame_cls, box_cls - - def make_frame_class(self, func, cache={}): - frame_uw_cls, box_cls = self._make_unwrap_frame_class() - box = box_cls() - box.func = func - return type("BuiltinFrame_for_%s" % self.name, - (frame_uw_cls,),{'box': box}) - -def make_builtin_frame_class(func, orig_sig, unwrap_spec): - "NOT_RPYTHON" - name = (getattr(func, '__module__', None) or '')+'_'+func.__name__ - emit_sig = orig_sig.apply_unwrap_spec(unwrap_spec, UnwrapSpecRecipe().emit, - BuiltinCodeSignature(name=name, unwrap_spec=unwrap_spec)) - cls = emit_sig.make_frame_class(func) - return cls - - - -class BuiltinCode(eval.Code): - "The code object implementing a built-in (interpreter-level) hook." - - # When a BuiltinCode is stored in a Function object, - # you get the functionality of CPython's built-in function type. - - def __init__(self, func, unwrap_spec = None, self_type = None): - "NOT_RPYTHON" - # 'implfunc' is the interpreter-level function. - # Note that this uses a lot of (construction-time) introspection. - eval.Code.__init__(self, func.__name__) - self.docstring = func.__doc__ - - # unwrap_spec can be passed to interp2app or - # attached as an attribute to the function. - # It is a list of types or singleton objects: - # baseobjspace.ObjSpace is used to specify the space argument - # baseobjspace.W_Root is for wrapped arguments to keep wrapped - # baseobjspace.BaseWrappable subclasses imply interpclass_w and a typecheck - # argument.Arguments is for a final rest arguments Arguments object - # 'args_w' for unpacktuple applied to rest arguments - # 'w_args' for rest arguments passed as wrapped tuple - # str,int,float: unwrap argument as such type - # (function, cls) use function to check/unwrap argument of type cls - - # First extract the signature from the (CPython-level) code object - from pypy.interpreter import pycode - argnames, varargname, kwargname = pycode.cpython_code_signature(func.func_code) - - if unwrap_spec is None: - unwrap_spec = getattr(func,'unwrap_spec',None) - - if unwrap_spec is None: - unwrap_spec = [ObjSpace]+ [W_Root] * (len(argnames)-1) - - if self_type: - unwrap_spec = ['self'] + unwrap_spec[1:] - - if self_type: - assert unwrap_spec[0] == 'self',"self_type without 'self' spec element" - unwrap_spec = list(unwrap_spec) - unwrap_spec[0] = self_type - - orig_sig = Signature(func, argnames, varargname, kwargname) - - app_sig = orig_sig.apply_unwrap_spec(unwrap_spec, UnwrapSpecRecipe().check, - Signature(func)) - - self.sig = argnames, varargname, kwargname = app_sig.signature() - - self.minargs = len(argnames) - if varargname: - self.maxargs = sys.maxint - else: - self.maxargs = self.minargs - - self.framecls = make_builtin_frame_class(func, orig_sig, unwrap_spec) - - def create_frame(self, space, w_globals, closure=None): - return self.framecls(space, self, w_globals) - - def signature(self): - return self.sig - - def getdocstring(self): - return self.docstring - - -class interp2app(Wrappable): - """Build a gateway that calls 'f' at interp-level.""" - - # NOTICE interp2app defaults are stored and passed as - # wrapped values, this to avoid having scope_w be of mixed - # wrapped and unwrapped types; - # an exception is made for the NoneNotWrapped special value - # which is passed around as default as an unwrapped None, - # unwrapped None and wrapped types are compatible - # - # Takes optionally an unwrap_spec, see BuiltinCode - - NOT_RPYTHON_ATTRIBUTES = ['_staticdefs'] - - def __init__(self, f, app_name=None, unwrap_spec = None): - "NOT_RPYTHON" - Wrappable.__init__(self) - # f must be a function whose name does NOT start with 'app_' - self_type = None - if hasattr(f, 'im_func'): - self_type = f.im_class - f = f.im_func - if not isinstance(f, types.FunctionType): - raise TypeError, "function expected, got %r instead" % f - if app_name is None: - if f.func_name.startswith('app_'): - raise ValueError, ("function name %r suspiciously starts " - "with 'app_'" % f.func_name) - app_name = f.func_name - self._code = BuiltinCode(f, unwrap_spec=unwrap_spec, self_type = self_type) - self.__name__ = f.func_name - self.name = app_name - self._staticdefs = list(f.func_defaults or ()) - - def _getdefaults(self, space): - "NOT_RPYTHON" - defs_w = [] - for val in self._staticdefs: - if val is NoneNotWrapped: - defs_w.append(None) - else: - defs_w.append(space.wrap(val)) - return defs_w - - # lazy binding to space - - def __spacebind__(self, space): - # we first make a real Function object out of it - # and the result is a wrapped version of this Function. - return self.get_function(space) - - def get_function(self, space): - return self.getcache(space).getorbuild(self) - - def getcache(self, space): - return space.fromcache(GatewayCache) - - def get_method(self, obj): - # to bind this as a method out of an instance, we build a - # Function and get it. - # the object space is implicitely fetched out of the instance - assert self._code.ismethod, ( - 'global built-in function %r used as method' % - self._code.func) - - space = obj.space - fn = self.get_function(space) - w_obj = space.wrap(obj) - return Method(space, space.wrap(fn), - w_obj, space.type(w_obj)) - - -class GatewayCache(SpaceCache): - def build(cache, gateway): - "NOT_RPYTHON" - space = cache.space - defs = gateway._getdefaults(space) # needs to be implemented by subclass - code = gateway._code - fn = Function(space, code, None, defs, forcename = gateway.name) - return fn - - -# -# the next gateways are to be used only for -# temporary/initialization purposes - -class interp2app_temp(interp2app): - "NOT_RPYTHON" - def getcache(self, space): - return self.__dict__.setdefault(space, GatewayCache(space)) - - -# and now for something completely different ... -# - -class ApplevelClass: - """A container for app-level source code that should be executed - as a module in the object space; interphook() builds a static - interp-level function that invokes the callable with the given - name at app-level.""" - - hidden_applevel = True - use_geninterp = True # change this to disable geninterp globally - - def __init__(self, source, filename = None, modname = '__builtin__'): - self.filename = filename - self.source = source - self.modname = modname - # look at the first three lines for a NOT_RPYTHON tag - first = "\n".join(source.split("\n", 3)[:3]) - if "NOT_RPYTHON" in first: - self.use_geninterp = False - - def getwdict(self, space): - return space.fromcache(ApplevelCache).getorbuild(self) - - def buildmodule(self, space, name='applevel'): - from pypy.interpreter.module import Module - return Module(space, space.wrap(name), self.getwdict(space)) - - def wget(self, space, name): - w_globals = self.getwdict(space) - return space.getitem(w_globals, space.wrap(name)) - - def interphook(self, name): - "NOT_RPYTHON" - def appcaller(space, *args_w): - if not isinstance(space, ObjSpace): - raise TypeError("first argument must be a space instance.") - # redirect if the space handles this specially XXX can this be factored a bit less flow space dependetly - if hasattr(space, 'specialcases'): - sc = space.specialcases - if ApplevelClass in sc: - ret_w = sc[ApplevelClass](space, self, name, args_w) - if ret_w is not None: # it was RPython - return ret_w - args = Arguments(space, list(args_w)) - w_func = self.wget(space, name) - return space.call_args(w_func, args) - def get_function(space): - w_func = self.wget(space, name) - return space.unwrap(w_func) - appcaller = func_with_new_name(appcaller, name) - appcaller.get_function = get_function - return appcaller - - def _freeze_(self): - return True # hint for the annotator: applevel instances are constants - - -class ApplevelCache(SpaceCache): - """The cache mapping each applevel instance to its lazily built w_dict""" - - def build(self, app): - "NOT_RPYTHON. Called indirectly by Applevel.getwdict()." - if app.use_geninterp: - return PyPyCacheDir.build_applevelinterp_dict(app, self.space) - else: - return build_applevel_dict(app, self.space) - - -# __________ pure applevel version __________ - -def build_applevel_dict(self, space): - "NOT_RPYTHON" - if self.filename is None: - code = py.code.Source(self.source).compile() - else: - code = NiceCompile(self.filename)(self.source) - - from pypy.interpreter.pycode import PyCode - pycode = PyCode(space)._from_code(code, hidden_applevel=self.hidden_applevel) - w_glob = space.newdict([]) - space.setitem(w_glob, space.wrap('__name__'), space.wrap('__builtin__')) - space.exec_(pycode, w_glob, w_glob) - return w_glob - -# __________ geninterplevel version __________ - -class PyPyCacheDir: - # similar to applevel, but using translation to interp-level. - # This version maintains a cache folder with single files. - - def build_applevelinterp_dict(cls, self, space): - "NOT_RPYTHON" - # N.B. 'self' is the ApplevelInterp; this is a class method, - # just so that we have a convenient place to store the global state. - if not cls._setup_done: - cls._setup() - - from pypy.translator.geninterplevel import translate_as_module - - # XXX HACK HACK HACK XXX - # XXX allow the app-level code to contain e.g. "import _formatting" - libdir = os.path.join(autopath.pypydir, "lib") - sys.path.append(libdir) - try: - scramble = md5.new(cls.seed) - scramble.update(self.source) - key = scramble.hexdigest() - initfunc = cls.known_source.get(key) - if not initfunc: - # try to get it from file - name = key - if self.filename: - prename = os.path.splitext(os.path.basename(self.filename))[0] - else: - prename = 'zznoname' - name = "%s_%s" % (prename, name) - try: - __import__("pypy._cache."+name) - except ImportError, x: - # print x - pass - else: - initfunc = cls.known_source[key] - if not initfunc: - # build it and put it into a file - initfunc, newsrc = translate_as_module( - self.source, self.filename, self.modname) - fname = cls.cache_path.join(name+".py").strpath - f = file(fname, "w") - print >> f, """\ -# self-destruct on double-click: -if __name__ == "__main__": - from pypy import _cache - import os - namestart = os.path.join(os.path.split(_cache.__file__)[0], '%s') - for ending in ('.py', '.pyc', '.pyo'): - try: - os.unlink(namestart+ending) - except os.error: - pass""" % name - print >> f - print >> f, newsrc - print >> f, "from pypy._cache import known_source" - print >> f, "known_source[%r] = %s" % (key, initfunc.__name__) - w_glob = initfunc(space) - finally: - if libdir in sys.path: - sys.path.remove(libdir) - return w_glob - build_applevelinterp_dict = classmethod(build_applevelinterp_dict) - - _setup_done = False - - def _setup(cls): - """NOT_RPYTHON""" - lp = py.path.local - import pypy, os - p = lp(pypy.__file__).new(basename='_cache').ensure(dir=1) - cls.cache_path = p - ini = p.join('__init__.py') - try: - if not ini.check(): - raise ImportError # don't import if only a .pyc file left!!! - from pypy._cache import known_source, \ - GI_VERSION_RENDERED - except ImportError: - GI_VERSION_RENDERED = 0 - from pypy.translator.geninterplevel import GI_VERSION - cls.seed = md5.new(str(GI_VERSION)).digest() - if GI_VERSION != GI_VERSION_RENDERED or GI_VERSION is None: - for pth in p.listdir(): - try: - pth.remove() - except: pass - file(str(ini), "w").write("""\ -# This folder acts as a cache for code snippets which have been -# compiled by compile_as_module(). -# It will get a new entry for every piece of code that has -# not been seen, yet. -# -# Caution! Only the code snippet is checked. If something -# is imported, changes are not detected. Also, changes -# to geninterplevel or gateway are also not checked. -# Exception: There is a checked version number in geninterplevel.py -# -# If in doubt, remove this file from time to time. - -GI_VERSION_RENDERED = %r - -known_source = {} - -# self-destruct on double-click: -def harakiri(): - import pypy._cache as _c - import py - lp = py.path.local - for pth in lp(_c.__file__).dirpath().listdir(): - try: - pth.remove() - except: pass - -if __name__ == "__main__": - harakiri() - -del harakiri -""" % GI_VERSION) - import pypy._cache - cls.known_source = pypy._cache.known_source - cls._setup_done = True - _setup = classmethod(_setup) - -# ____________________________________________________________ - -def appdef(source, applevel=ApplevelClass): - """ NOT_RPYTHON: build an app-level helper function, like for example: - myfunc = appdef('''myfunc(x, y): - return x+y - ''') - """ - from pypy.interpreter.pycode import PyCode - if not isinstance(source, str): - source = str(py.code.Source(source).strip()) - assert source.startswith("def "), "can only transform functions" - source = source[4:] - p = source.find('(') - assert p >= 0 - funcname = source[:p].strip() - source = source[p:] - return applevel("def %s%s\n" % (funcname, source)).interphook(funcname) - -applevel = ApplevelClass # backward compatibility -app2interp = appdef # backward compatibility - - -class applevel_temp(ApplevelClass): - hidden_applevel = False - def getwdict(self, space): # no cache - return build_applevel_dict(self, space) - -if ApplevelClass.use_geninterp: - class applevelinterp_temp(ApplevelClass): - hidden_applevel = False - def getwdict(self, space): # no cache - return PyPyCacheDir.build_applevelinterp_dict(self, space) -else: - applevelinterp_temp = applevel_temp - -# app2interp_temp is used for testing mainly -def app2interp_temp(func, applevel_temp=applevel_temp): - """ NOT_RPYTHON """ - return appdef(func, applevel_temp) Deleted: /pypy/dist/pypy/translator/geninterplevel.py ============================================================================== --- /pypy/dist/pypy/translator/geninterplevel.py Sat May 21 14:12:41 2005 +++ (empty file) @@ -1,1366 +0,0 @@ -""" -Implementation of a translator from application Python to -interpreter level RPython. - -The idea is that we can automatically transform application level -implementations of methods into some equivalent representation at -interpreter level. Then, the RPython to C translation might -hopefully spit out some more efficient code than always interpreting -these methods. - -Note that the application level functions are treated as rpythonic, -in a sense that globals are constants, for instance. This definition -is not exact and might change. - -The interface for this module is - - (initfunc, newsrc) = translate_as_module( - sourcetext, - filename=None, - modname="app2interpexec", - tmpname=None) - -If filename is given, it is used as a reference where -this sourcetext can be literally found, to produce -real line numbers. It cannot be just any name but -must exist and contain the source code somewhere. - -modname is optional and will be put into the dictionary -to be created. - -tmpname is optional. If given, a temporary file will -be created for debugging purposes. - -The returned newsrc is the generated source text. -It is used in gateway.py's caching mechanism. -The initfunc result is a function named "init"+modname -It must be called with a space instance and returns -a wrapped dict which is suitable to use as a module dict, -containing all trnaslatedobjects with their originalname. - -Integration of this module is finished. -There are no longer hand-generated source -pieces in pypy svn. -""" - -from __future__ import generators -import autopath, os, sys, exceptions, inspect, types -import cPickle as pickle, __builtin__ -from copy_reg import _HEAPTYPE -from pypy.objspace.flow.model import Variable, Constant, SpaceOperation -from pypy.objspace.flow.model import FunctionGraph, Block, Link -from pypy.objspace.flow.model import last_exception -from pypy.objspace.flow.model import traverse, uniqueitems, checkgraph -from pypy.interpreter.pycode import CO_VARARGS, CO_VARKEYWORDS -from pypy.annotation import model as annmodel -from types import FunctionType, CodeType, ModuleType -from pypy.interpreter.error import OperationError -from pypy.interpreter.argument import Arguments -from pypy.rpython.rarithmetic import r_int, r_uint - -from pypy.translator.translator import Translator -from pypy.objspace.flow import FlowObjSpace - -from pypy.tool.sourcetools import render_docstr, NiceCompile - -from pypy.translator.gensupp import ordered_blocks, UniqueList, builtin_base, \ - c_string, uniquemodulename, C_IDENTIFIER, NameManager - - -# list of simplifcation passes needed by geninterp -from pypy.translator.simplify import transform_ovfcheck, all_passes as needed_passes - -needed_passes = needed_passes[:] -needed_passes.remove(transform_ovfcheck) - - -import pypy # __path__ -import py.path - -GI_VERSION = '1.1.0' # bump this for substantial changes -# ____________________________________________________________ - -def eval_helper(self, typename, expr): - name = self.uniquename("gtype_%s" % typename) - unique = self.uniquenameofprebuilt("eval_helper", eval_helper) - self.initcode.append1( - 'def %s(expr):\n' - ' dic = space.newdict([])\n' - ' if "types." in expr:\n' - ' space.exec_("import types", dic, dic)\n' - ' else:\n' - ' space.exec_("", dic, dic)\n' - ' return space.eval(expr, dic, dic)' % (unique, )) - self.initcode.append1('%s = %s(%r)' % (name, unique, expr)) - return name - -def unpickle_helper(self, name, value): - unique = self.uniquenameofprebuilt("unpickle_helper", unpickle_helper) - self.initcode.append1( - 'def %s(value):\n' - ' dic = space.newdict([])\n' - ' space.exec_("import cPickle as pickle", dic, dic)\n' - ' return space.eval("pickle.loads(%%r)" %% value, dic, dic)' % unique) - self.initcode.append1('%s = %s(%r)' % ( - name, unique, pickle.dumps(value, 2)) ) - -# hey, for longs we can do even easier: -def long_helper(self, name, value): - unique = self.uniquenameofprebuilt("long_helper", long_helper) - self.initcode.append1( - 'def %s(value):\n' - ' dic = space.newdict([])\n' - ' space.exec_("", dic, dic) # init __builtins__\n' - ' return space.eval("long(%%r, 16)" %% value, dic, dic)' % unique) - self.initcode.append1('%s = %s(%r)' % ( - name, unique, hex(value)[2:-1] ) ) - -def bltinmod_helper(self, mod): - name = self.uniquename("mod_%s" % mod.__name__) - unique = self.uniquenameofprebuilt("bltinmod_helper", bltinmod_helper) - self.initcode.append1( - 'def %s(name):\n' - ' dic = space.newdict([])\n' - ' space.exec_("import %%s" %% name, dic, dic)\n' - ' return space.eval("%%s" %% name, dic, dic)' % (unique, )) - self.initcode.append1('%s = %s(%r)' % (name, unique, mod.__name__)) - return name - -class GenRpy: - def __init__(self, translator, entrypoint=None, modname=None, moddict=None): - self.translator = translator - if entrypoint is None: - entrypoint = translator.entrypoint - self.entrypoint = entrypoint - self.modname = self.trans_funcname(modname or - uniquemodulename(entrypoint)) - self.moddict = moddict # the dict if we translate a module - - def late_OperationError(): - self.initcode.append1( - 'from pypy.interpreter.error import OperationError as gOperationError') - return 'gOperationError' - def late_Arguments(): - self.initcode.append1('from pypy.interpreter import gateway') - return 'gateway.Arguments' - - self.rpynames = {Constant(None).key: 'space.w_None', - Constant(False).key: 'space.w_False', - Constant(True).key: 'space.w_True', - Constant(OperationError).key: late_OperationError, - Constant(Arguments).key: late_Arguments, - } - u = UniqueList - self.initcode = u() # list of lines for the module's initxxx() - self.latercode = u() # list of generators generating extra lines - # for later in initxxx() -- for recursive - # objects - self.namespace = NameManager() - self.namespace.make_reserved_names('__doc__ __args__ space goto') - self.globaldecl = [] - self.globalobjects = [] - self.pendingfunctions = [] - self.currentfunc = None - self.debugstack = () # linked list of nested nameof() - - # special constructors: - self.has_listarg = {} - for name in "newtuple newlist newdict newstring".split(): - self.has_listarg[name] = name - - # catching all builtins in advance, to avoid problems - # with modified builtins - - # add a dummy _issubtype() to builtins - def _issubtype(cls1, cls2): - raise TypeError, "this dummy should *not* be reached" - __builtin__._issubtype = _issubtype - - class bltinstub: - def __init__(self, name): - self.__name__ = name - def __repr__(self): - return '<%s>' % self.__name__ - - self.builtin_ids = dict( [ - (id(value), bltinstub(key)) - for key, value in __builtin__.__dict__.items() - if callable(value) and type(value) not in [type(Exception), type] ] ) - - self.space = FlowObjSpace() # for introspection - - self.use_fast_call = True - self.specialize_goto = False - self._labeltable = {} # unique label names, reused per func - - self._space_arities = None - - def expr(self, v, localscope, wrapped = True): - if isinstance(v, Variable): - return localscope.localname(v.name, wrapped) - elif isinstance(v, Constant): - return self.nameof(v.value, - debug=('Constant in the graph of', self.currentfunc)) - else: - raise TypeError, "expr(%r)" % (v,) - - def arglist(self, args, localscope): - res = [self.expr(arg, localscope) for arg in args] - return ", ".join(res) - - def oper(self, op, localscope): - if op.opname == "simple_call": - v = op.args[0] - space_shortcut = self.try_space_shortcut_for_builtin(v, len(op.args)-1) - if space_shortcut is not None: - # space method call - exv = space_shortcut - fmt = "%(res)s = %(func)s(%(args)s)" - else: - exv = self.expr(v, localscope) - # default for a spacecall: - fmt = "%(res)s = space.call_function(%(func)s, %(args)s)" - # see if we can optimize for a fast call. - # we just do the very simple ones. - if self.use_fast_call and (isinstance(v, Constant) - and exv.startswith('gfunc_')): - func = v.value - if (not func.func_code.co_flags & CO_VARARGS) and ( - func.func_defaults is None): - fmt = "%(res)s = fastf_%(func)s(space, %(args)s)" - exv = exv[6:] - return fmt % {"res" : self.expr(op.result, localscope), - "func": exv, - "args": self.arglist(op.args[1:], localscope) } - if op.opname == "call_args": - v = op.args[0] - exv = self.expr(v, localscope) - fmt = ( - "_args = %(Arg)s.fromshape(space, %(shape)s, [%(data_w)s])\n" - "%(res)s = space.call_args(%(func)s, _args)") - assert isinstance(op.args[1], Constant) - shape = op.args[1].value - return fmt % {"res": self.expr(op.result, localscope), - "func": exv, - "shape": repr(shape), - "data_w": self.arglist(op.args[2:], localscope), - 'Arg': self.nameof(Arguments) } - if op.opname in self.has_listarg: - fmt = "%s = %s([%s])" - else: - fmt = "%s = %s(%s)" - # special case is_true - wrapped = op.opname != "is_true" - oper = "space.%s" % op.opname - return fmt % (self.expr(op.result, localscope, wrapped), oper, - self.arglist(op.args, localscope)) - - def large_assignment(self, left, right, margin=65): - expr = "(%s) = (%s)" % (", ".join(left), ", ".join(right)) - pieces = expr.split(",") - res = [pieces.pop(0)] - for piece in pieces: - if len(res[-1])+len(piece)+1 > margin: - res[-1] += "," - res.append(piece) - else: - res[-1] += (","+piece) - return res - - def large_initialize(self, vars, margin=65): - res = [] - nonestr = "None" - margin -= len(nonestr) - for var in vars: - ass = var+"=" - if not res or len(res[-1]) >= margin: - res.append(ass) - else: - res[-1] += ass - res = [line + nonestr for line in res] - return res - - def mklabel(self, blocknum): - if self.specialize_goto: - lbname = self._labeltable.get(blocknum) - if not lbname: - self.initcode.append1( - 'from pypy.objspace.flow.framestate import SpecTag') - lbname = self.uniquename("glabel_%d" % blocknum) - self._labeltable[blocknum] = lbname - self.initcode.append1('%s = SpecTag()' % lbname) - return lbname - else: - return repr(blocknum) - - def gen_link(self, link, localscope, blocknum, block, linklocalvars=None): - "Generate the code to jump across the given Link." - linklocalvars = linklocalvars or {} - left, right = [], [] - for a1, a2 in zip(link.args, link.target.inputargs): - if a1 in linklocalvars: - src = linklocalvars[a1] - else: - src = self.expr(a1, localscope) - left.append(self.expr(a2, localscope)) - right.append(src) - if left: # anything at all? - txt = "%s = %s" % (", ".join(left), ", ".join(right)) - if len(txt) <= 65: # arbitrary - yield txt - else: - for line in self.large_assignment(left, right): - yield line - goto = blocknum[link.target] - yield 'goto = %s' % self.mklabel(goto) - if goto <= blocknum[block]: - yield 'continue' - - def register_early(self, obj, name): - # this was needed for recursive lists. - # note that self.latercode led to too late initialization. - key = Constant(obj).key - self.rpynames[key] = name - - def nameof(self, obj, debug=None, namehint=None): - key = Constant(obj).key - try: - txt = self.rpynames[key] - if type(txt) is not str: - # this is a predefined constant, initialized on first use - func = txt - txt = func() - self.rpynames[key] = txt - return txt - - except KeyError: - if debug: - stackentry = debug, obj - else: - stackentry = obj - self.debugstack = (self.debugstack, stackentry) - obj_builtin_base = builtin_base(obj) - if obj_builtin_base in (object, int, long) and type(obj) is not obj_builtin_base: - # assume it's a user defined thingy - name = self.nameof_instance(obj) - else: - # shortcutting references to __builtin__ - if id(obj) in self.builtin_ids: - func = self.builtin_ids[id(obj)] - name = "(space.builtin.get(space.str_w(%s)))" % self.nameof(func.__name__) - else: - for cls in type(obj).__mro__: - meth = getattr(self, - 'nameof_' + cls.__name__.replace(' ', ''), - None) - if meth: - break - else: - raise Exception, "nameof(%r)" % (obj,) - - code = meth.im_func.func_code - if namehint and 'namehint' in code.co_varnames[:code.co_argcount]: - name = meth(obj, namehint=namehint) - else: - name = meth(obj) - self.debugstack, x = self.debugstack - assert x is stackentry - self.rpynames[key] = name - return name - - def uniquename(self, basename): - name = self.namespace.uniquename(basename) - self.globalobjects.append(name) - self.globaldecl.append('# global object %s' % (name,)) - return name - - def uniquenameofprebuilt(self, basename, obj): - # identifying an object and giving it a name, - # without the attempt to render it. - key = Constant(obj).key - try: - txt = self.rpynames[key] - except KeyError: - self.rpynames[key] = txt = self.uniquename(basename) - return txt - - - def nameof_NotImplementedType(self, value): - return "space.w_NotImplemented" - - def nameof_object(self, value): - if type(value) is not object: - # try to just wrap it? - name = self.uniquename('g_%sinst_%r' % (type(value).__name__, value)) - self.initcode.append1('%s = space.wrap(%r)' % (name, value)) - return name - name = self.uniquename('g_object') - self.initcode.append('_tup = space.newtuple([])\n' - '%s = space.call(space.w_object, _tup)' - % name) - return name - - def nameof_module(self, value): - if value is os or not hasattr(value, "__file__") or \ - not (value.__file__.endswith('.pyc') or - value.__file__.endswith('.py') or - value.__file__.endswith('.pyo')) : - return bltinmod_helper(self, value) - # we might have createda reference to a module - # that is non-standard. - # check whether we can import - try: - import value - need_extra_path = False - except ImportError: - need_extra_path = True - name = self.uniquename('mod_%s' % value.__name__) - if need_extra_path: - self.initcode.append1('import pypy') - self.initcode.append1('import sys') - self.initcode.append1('import os') - self.initcode.append1('libdir = os.path.join(pypy.__path__[0], "lib")\n' - 'hold = sys.path[:]\n' - 'sys.path.insert(0, libdir)\n' - 'import %s as _tmp\n' - 'sys.path[:] = hold\n' % value.__name__) - else: - self.initcode.append1('import %s as _tmp' % value.__name__) - self.initcode.append1('%s = space.wrap(_tmp)' % (name)) - return name - - - def nameof_int(self, value): - if value >= 0: - name = 'gi_%d' % value - else: - # make sure that the type ident is completely described by - # the prefixbefore the initial '_' for easy postprocessing - name = 'gi_minus_%d' % abs(value) - name = self.uniquename(name) - self.initcode.append1('%s = space.wrap(%d)' % (name, value)) - return name - - def nameof_long(self, value): - # assume we want them in hex most of the time - if value < 256L: - s = "%dL" % value - else: - s = "0x%08xL" % value - if value >= 0: - name = 'glong_%s' % s - else: - # mae sure that the type ident is completely described by - # the prefix before the initial '_' - name = 'glong_minus_%d' % abs(value) - name = self.uniquename(name) - # allow literally short longs only, meaning they - # must fit into a machine word. - if (sys.maxint*2+1)&value == value: - self.initcode.append1('%s = space.wrap(%s) # XXX implement long!' % (name, s)) - else: - long_helper(self, name, value) - return name - - def nameof_float(self, value): - name = 'gfloat_%s' % value - name = (name.replace('-', 'minus') - .replace('.', 'dot')) - name = self.uniquename(name) - self.initcode.append1('%s = space.wrap(%r)' % (name, value)) - return name - - def nameof_str(self, value): - if [c for c in value if c<' ' or c>'~' or c=='"' or c=='\\']: - # non-printable string - namestr = repr(value)[1:-1] - else: - # printable string - namestr = value - if not namestr: - namestr = "_emptystr_" - name = self.uniquename('gs_' + namestr[:32]) - if len(value) < 30 and "\n" not in value: - txt = '%s = space.wrap(%r)' % (name, value) - else: - txt = render_docstr(value, '%s = space.wrap(\n' % name, ')') - txt = txt, # not splitted - self.initcode.append(txt) - return name - - def skipped_function(self, func): - # debugging only! Generates a placeholder for missing functions - # that raises an exception when called. - name = self.uniquename('gskippedfunc_' + func.__name__) - self.globaldecl.append('# global decl %s' % (name, )) - self.initcode.append('# build func %s' % name) - return name - - def skipped_class(self, cls): - # debugging only! Generates a placeholder for missing classes - # that raises an exception when called. - name = self.uniquename('gskippedclass_' + cls.__name__) - self.globaldecl.append('# global decl %s' % (name, )) - self.initcode.append1('# build class %s' % name) - return name - - def trans_funcname(self, s): - return s.translate(C_IDENTIFIER) - - def nameof_function(self, func, namehint=''): - if hasattr(func, 'geninterplevel_name'): - return func.geninterplevel_name(self) - - printable_name = '(%s:%d) %s' % ( - self.trans_funcname(func.func_globals.get('__name__', '?')), - func.func_code.co_firstlineno, - func.__name__) - if self.translator.frozen: - if func not in self.translator.flowgraphs: - print "NOT GENERATING", printable_name - return self.skipped_function(func) - else: - if (func.func_doc and - func.func_doc.lstrip().startswith('NOT_RPYTHON')): - print "skipped", printable_name - return self.skipped_function(func) - name = self.uniquename('gfunc_' + self.trans_funcname( - namehint + func.__name__)) - f_name = 'f_' + name[6:] - self.initcode.append1('from pypy.interpreter import gateway') - self.initcode.append1('%s = space.wrap(gateway.interp2app(%s, unwrap_spec=[gateway.ObjSpace, gateway.Arguments]))' % (name, f_name)) - self.pendingfunctions.append(func) - return name - - def nameof_staticmethod(self, sm): - # XXX XXX XXXX - func = sm.__get__(42.5) - name = self.uniquename('gsm_' + func.__name__) - functionname = self.nameof(func) - self.initcode.append1('%s = space.wrap(%s)' % (name, functionname)) - return name - - def nameof_instancemethod(self, meth): - if meth.im_self is None: - # no error checking here - return self.nameof(meth.im_func, namehint="%s_" % meth.im_class.__name__) - else: - ob = self.nameof(meth.im_self) - func = self.nameof(meth.im_func) - typ = self.nameof(meth.im_class) - name = self.uniquename('gmeth_' + meth.im_func.__name__) - funcname = self.nameof(meth.im_func.__name__) - self.initcode.append1( - '%s = space.getattr(%s, %s)' % (name, ob, funcname)) - return name - - def should_translate_attr(self, pbc, attr): - ann = self.translator.annotator - if ann is None: - ignore = getattr(pbc.__class__, 'NOT_RPYTHON_ATTRIBUTES', []) - if attr in ignore: - return False - else: - return "probably" # True - classdef = ann.getuserclasses().get(pbc.__class__) - if classdef and classdef.about_attribute(attr) is not None: - return True - return False - - def later(self, gen): - self.latercode.append1((gen, self.debugstack)) - - def nameof_instance(self, instance): - klass = instance.__class__ - name = self.uniquename('ginst_' + klass.__name__) - cls = self.nameof(klass) - if hasattr(klass, '__base__'): - base_class = builtin_base(instance) - base = self.nameof(base_class) - else: - base_class = None - base = cls - def initinstance(): - content = instance.__dict__.items() - content.sort() - for key, value in content: - if self.should_translate_attr(instance, key): - try: - yield 'space.setattr(%s, %s, %s)' % ( - name, self.nameof(key), self.nameof(value)) - except: - print >> sys.stderr, "Problem while generating %s of %r" % ( - name, instance) - raise - self.initcode.append1("%s = space.call_method(%s, '__new__', %s)" % ( - name, cls, cls)) - self.later(initinstance()) - return name - - def space_arities(self): - if self._space_arities is None: - arities = self._space_arities = {} - for name, sym, arity, specnames in self.space.MethodTable: - arities[name] = arity - arities['isinstance'] = 2 - return self._space_arities - - def try_space_shortcut_for_builtin(self, v, nargs): - if isinstance(v, Constant) and id(v.value) in self.builtin_ids: - name = self.builtin_ids[id(v.value)].__name__ - if hasattr(self.space, name): - if self.space_arities().get(name, -1) == nargs: - return "space.%s" % name - return None - - def nameof_builtin_function_or_method(self, func): - if func.__self__ is None: - # builtin function - if id(func) in self.builtin_ids: - func = self.builtin_ids[id(func)] - return "(space.builtin.get(space.str_w(%s)))" % self.nameof(func.__name__) - # where does it come from? Python2.2 doesn't have func.__module__ - for modname, module in sys.modules.items(): - if hasattr(module, '__file__'): - if (module.__file__.endswith('.py') or - module.__file__.endswith('.pyc') or - module.__file__.endswith('.pyo')): - continue # skip non-builtin modules - if func is getattr(module, func.__name__, None): - break - else: - raise Exception, '%r not found in any built-in module' % (func,) - #if modname == '__builtin__': - # # be lazy - # return "(space.builtin.get(space.str_w(%s)))" % self.nameof(func.__name__) - if modname == 'sys': - # be lazy - return "(space.sys.get(space.str_w(%s)))" % self.nameof(func.__name__) - else: - name = self.uniquename('gbltin_' + func.__name__) - self.initcode.append1('%s = space.getattr(%s, %s)' % ( - name, self.nameof(module), self.nameof(func.__name__))) - else: - # builtin (bound) method - name = self.uniquename('gbltinmethod_' + func.__name__) - self.initcode.append1('%s = space.getattr(%s, %s)' % ( - name, self.nameof(func.__self__), self.nameof(func.__name__))) - return name - - def nameof_classobj(self, cls): - printable_name = cls.__name__ - if cls.__doc__ and cls.__doc__.lstrip().startswith('NOT_RPYTHON'): - #raise Exception, "%r should never be reached" % (cls,) - print "skipped class", printable_name - return self.skipped_class(cls) - - metaclass = "space.w_type" - name = self.uniquename('gcls_' + cls.__name__) - - if issubclass(cls, Exception): - # if cls.__module__ == 'exceptions': - # don't rely on this, py.magic redefines AssertionError - if getattr(__builtin__,cls.__name__,None) is cls: - # exception are defined on the space - return 'space.w_%s' % cls.__name__ - - if not isinstance(cls, type): - assert type(cls) is type(Exception) - # do *not* change metaclass, but leave the - # decision to what PyPy thinks is correct. - # metaclass = 'space.w_classobj' - - basenames = [self.nameof(base) for base in cls.__bases__] - - def initclassobj(): - content = cls.__dict__.items() - content.sort() - for key, value in content: - if key.startswith('__'): - if key in ['__module__', '__doc__', '__dict__', - '__weakref__', '__metaclass__', '__slots__','__new__']: - continue - - # redirect value through class interface, in order to - # get methods instead of functions. - value = getattr(cls, key) - - if isinstance(value, staticmethod) and value.__get__(1) not in self.translator.flowgraphs and self.translator.frozen: - print "skipped staticmethod:", value - continue - if isinstance(value, FunctionType) and value not in self.translator.flowgraphs and self.translator.frozen: - print "skipped function:", value - continue - - yield 'space.setattr(%s, %s, %s)' % ( - name, self.nameof(key), self.nameof(value)) - - baseargs = ", ".join(basenames) - self.initcode.append('_dic = space.newdict([])') - for key, value in cls.__dict__.items(): - if key.startswith('__'): - if key in ['__module__', '__metaclass__', '__slots__','__new__']: - keyname = self.nameof(key) - valname = self.nameof(value) - self.initcode.append("space.setitem(_dic, %s, %s)" % ( - keyname, valname)) - - if cls.__doc__ is not None: - sdoc = self.nameof("__doc__") - docobj = cls.__dict__["__doc__"] - if type(docobj) in (str, unicode): - docstr = render_docstr(cls, "_doc = space.wrap(", ")") - self.initcode.append((docstr,)) # not splitted - else: - self.initcode.append("_doc = %s" % self.nameof(docobj) ) - self.initcode.append("space.setitem(_dic, %s, _doc)" % (sdoc,)) - self.initcode.append1('_bases = space.newtuple([%(bases)s])\n' - '_args = space.newtuple([%(name)s, _bases, _dic])\n' - '%(klass)s = space.call(%(meta)s, _args)' - % {"bases": baseargs, - "klass": name, - "name" : self.nameof(cls.__name__), - "meta" : metaclass} ) - - self.later(initclassobj()) - return name - - nameof_class = nameof_classobj # for Python 2.2 - - typename_mapping = { - object: 'space.w_object', - int: 'space.w_int', - long: 'space.w_long', - bool: 'space.w_bool', - list: 'space.w_list', - tuple: 'space.w_tuple', - dict: 'space.w_dict', - str: 'space.w_str', - float: 'space.w_float', - slice: 'space.w_slice', - type(Exception()): 'space.wrap(types.InstanceType)', - type: 'space.w_type', - complex:'space.wrap(types.ComplexType)', - unicode:'space.w_unicode', - basestring: (eval_helper, 'basestring', 'basestring'), - file: (eval_helper, 'file', 'file'), - type(None): (eval_helper, 'NoneType', 'type(None)'), - CodeType: (eval_helper, 'code', 'type((lambda:42).func_code)'), - ModuleType: (eval_helper, 'ModuleType', 'types.ModuleType'), - xrange: (eval_helper, 'xrange', 'xrange'), - - ##r_int: 'space.w_int', - ##r_uint: 'space.w_int', - - type(len): (eval_helper, 'FunctionType', 'type(lambda:42)'), - # type 'method_descriptor': - # XXX small problem here: - # XXX with space.eval, we get - # XXX but with wrap, we get - type(list.append): (eval_helper, "method_descriptor", "type(list.append)"), - # type 'wrapper_descriptor': - type(type(None).__repr__): (eval_helper, "wrapper_descriptor", - "type(type(None).__repr__)"), - # type 'getset_descriptor': - # XXX here we get , - # while eval gives us - type(type.__dict__['__dict__']): (eval_helper, "getset_descriptor", - "type(type.__dict__[\'__dict__\'])"), - # type 'member_descriptor': - # XXX this does not work in eval! - # type(type.__dict__['__basicsize__']): "cannot eval type(type.__dict__['__basicsize__'])", - # XXX there seems to be no working support for member descriptors ??? - type(types.GeneratorType.gi_frame): - (eval_helper, "member_descriptor", 'type(property.fdel)'), - types.ClassType: 'space.w_classobj', - types.MethodType: (eval_helper, "instancemethod", - "type((lambda:42).__get__(42))"), - property: (eval_helper, "property", 'property'), - } - - def nameof_type(self, cls): - if cls in self.typename_mapping: - ret = self.typename_mapping[cls] - if type(ret) is tuple: - ret = ret[0](self, ret[1], ret[2]) - return ret - assert cls.__module__ != '__builtin__' or cls.__flags__&_HEAPTYPE, ( - "built-in class %r not found in typename_mapping " - "while compiling %s" % (cls, self.currentfunc and - self.currentfunc.__name__ or "*no function at all*")) - return self.nameof_classobj(cls) - - def nameof_tuple(self, tup): - name = self.uniquename('g%dtuple' % len(tup)) - args = [self.nameof(x) for x in tup] - args = ', '.join(args) - self.initcode.append1('%s = space.newtuple([%s])' % (name, args)) - return name - - def nameof_list(self, lis): - name = self.uniquename('g%dlist' % len(lis)) - # note that self.latercode led to too late initialization. - self.register_early(lis, name) - # try to save at least one assignment. - if lis and lis[0] is not lis: - default = lis[0] - else: - default = None - self.initcode.append('%s = space.newlist([%s])' % (name, self.nameof(default))) - self.initcode.append('%s = space.mul(%s, %s)' % (name, name, self.nameof(len(lis)))) - for i in range(len(lis)): - if lis[i] is not default: - item = self.nameof(lis[i]) - self.initcode.append('space.setitem(%s, %s, %s);' % ( - name, self.nameof(i), item)) - return name - - def nameof_dict(self, dic): - assert dic is not __builtins__ - name = self.uniquename('g%ddict' % len(dic)) - self.register_early(dic, name) - self.initcode.append('%s = space.newdict([])' % (name,)) - for k in dic: - if k == '__builtins__': - continue - self.initcode.append('space.setitem(%s, %s, %s)'%( - name, self.nameof(k), self.nameof(dic[k]))) - return name - - # strange prebuilt instances below, don't look too closely - # XXX oh well. - def nameof_member_descriptor(self, md): - name = self.uniquename('gdescriptor_%s_%s' % ( - md.__objclass__.__name__, md.__name__)) - cls = self.nameof(md.__objclass__) - # do I need to take the dict and then getitem??? - self.initcode.append1('%s = space.getattr(%s, %s)' % - (name, cls, self.nameof(md.__name__))) - return name - nameof_getset_descriptor = nameof_member_descriptor - nameof_method_descriptor = nameof_member_descriptor - nameof_wrapper_descriptor = nameof_member_descriptor - - def nameof_file(self, fil): - if fil is sys.stdin: - return 'space.sys.get("stdin")' - if fil is sys.stdout: - return 'space.sys.get("stdout")' - if fil is sys.stderr: - return 'space.sys.get("stderr")' - raise Exception, 'Cannot translate an already-open file: %r' % (fil,) - - def gen_source(self, fname, ftmpname=None, file=file): - self.fname = fname - self.ftmpname = ftmpname - - # generate unordered source file, first. - # I prefer this over ordering everything in memory. - fname = self.fname - if self.ftmpname: - fname = self.ftmpname - f = file(fname, "w") - # generate ordered source file - try: - self.f = f - self.gen_source_temp() - finally: - f.close() - - def copyfile(source, target): - file(target, "w").write(file(source).read()) - - def order_sections(fname): - sep = "\n##SECTION##\n" - txt = file(fname).read() - pieces = txt.split(sep) - prelude = pieces.pop(0) - postlude = pieces.pop() - dic = {} - while pieces: - func = pieces.pop() - head = pieces.pop() - key = makekey(head, len(pieces)) - dic[key] = head + sep + func - lis = dic.items() - lis.sort() - lis = [prelude] + [func for head, func in lis] + [postlude] - txt = sep.join(lis) - file(fname, "w").write(txt) - - def makekey(txt, uniqueno): - dic = {} - for line in txt.split("\n"): - ign, name, value = line.split(None, 2) - dic[name] = eval(value, {}) - key = (dic["filename"], dic["firstlineno"], - dic["function"], uniqueno) - return key - - order_sections(fname) - if self.ftmpname: - copyfile(self.ftmpname, self.fname) - - def gen_source_temp(self): - f = self.f - - # header - print >> f, self.RPY_HEADER - print >> f - - info = { - 'modname': self.modname, - # the side-effects of this is kick-start the process - 'entrypoint': None # self.nameof(self.entrypoint), - } - # header """def initmodule(space):""" - print >> f, self.RPY_INIT_HEADER % info - - # doc - if self.moddict and self.moddict.get("__doc__"): - doc = self.moddict["__doc__"] - print >> f, render_docstr(doc, " __doc__ = \\\n") - print >> f - # make sure it is not rendered again - key = Constant(doc).key - self.rpynames[key] = "w__doc__" - self.initcode.append("w__doc__ = space.wrap(__doc__)") - - # info.entrypoint must be done *after* __doc__ is handled, - # because nameof(entrypoint) might touch __doc__ early. - info["entrypoint"] = self.nameof(self.entrypoint) - - # function implementations - while self.pendingfunctions or self.latercode: - if self.pendingfunctions: - func = self.pendingfunctions.pop() - self.currentfunc = func - self.gen_rpyfunction(func) - # collect more of the latercode after each function - while self.latercode: - gen, self.debugstack = self.latercode.pop() - #self.initcode.extend(gen) -- eats TypeError! bad CPython! - for line in gen: - self.initcode.append1(line) - self.debugstack = () - self.gen_global_declarations() - - # set the final splitter - print >> f, "##SECTION##" - # footer, init code - for codelines in self.initcode: - # keep docstrings unindented - indent = " " - if type(codelines) is tuple: - codelines = codelines[0].split("\n", 1) - codelines[0] = indent + codelines[0] - indent = "" - else: - codelines = codelines.split("\n") - for codeline in codelines: - print >> f, indent + codeline - - self.gen_trailer(info, " ") - # do not close the file here! - - def gen_trailer(self, info, indent): - if self.moddict: - # we are generating a module, no __main__ etc. - print >> self.f, indent + "return %s" % self.nameof(self.entrypoint) - print >> self.f - else: - # we should have an entrypoint function - info['entrypointname'] = self.trans_funcname(self.entrypoint.__name__) - print >> self.f, self.RPY_INIT_FOOTER % info - - def gen_global_declarations(self): - g = self.globaldecl - if g: - f = self.f - print >> f, '# global declaration%s' % ('s'*(len(g)>1)) - for line in g: - print >> f, line - print >> f - del g[:] - g = self.globalobjects - for name in g: - pass # self.initcode.append1('# REGISTER_GLOBAL(%s)' % (name,)) - del g[:] - - def rel_filename(self, name): - # try to find a name relative to pypy and unify. - # if not possible, stick with the original. - ref = py.path.local(pypy.__path__[0]) - rel = py.path.local(name).relto(ref) - if rel: - # make it os independent - return rel.replace('\\', '/') - return name # no success - - def gen_rpyfunction(self, func): - - f = self.f - print >> f, "##SECTION##" # simple to split, afterwards - print >> f, ("## filename %r\n" - "## function %r\n" - "## firstlineno %d") % ( - self.rel_filename(func.func_code.co_filename), - func.func_code.co_name, - func.func_code.co_firstlineno) - print >> f, "##SECTION##" - localscope = self.namespace.localScope() - body = list(self.rpyfunction_body(func, localscope)) - name_of_defaults = [self.nameof(x, debug=('Default argument of', func)) - for x in (func.func_defaults or ())] - self.gen_global_declarations() - - # print header - docstr = render_docstr(func, " ") - cname = self.nameof(func) - assert cname.startswith('gfunc_') - f_name = 'f_' + cname[6:] - - # collect all the local variables - graph = self.translator.getflowgraph(func) - localslst = [] - def visit(node): - if isinstance(node, Block): - localslst.extend(node.getvariables()) - traverse(visit, graph) - localnames = [self.expr(a, localscope) for a in uniqueitems(localslst)] - - # collect all the arguments - vararg = varkw = None - varargname = varkwname = None - all_args = graph.getargs() - p = len(all_args) - if func.func_code.co_flags & CO_VARKEYWORDS: - p -= 1 - varkw = graph.getargs()[p] - varkwname = func.func_code.co_varnames[p] - if func.func_code.co_flags & CO_VARARGS: - p -= 1 - vararg = graph.getargs()[p] - varargname = func.func_code.co_varnames[p] - positional_args = all_args[:p] - - fast_args = [self.expr(a, localscope) for a in positional_args] - if vararg is not None: - vararg = self.expr(vararg, localscope) - fast_args.append(vararg) - if varkw is not None: - varkw = self.expr(varkw, localscope) - fast_args.append(varkw) - fast_name = 'fast' + f_name - - fast_set = dict(zip(fast_args, fast_args)) - - # create function declaration - name = self.trans_funcname(func.__name__) # for - argstr = ", ".join(['space'] + fast_args) - fast_function_header = (' def %s(%s):' - % (name, argstr)) - - def install_func(f_name, name): - yield '' - yield ' %s = %s' % (f_name, name) - #import __builtin__ - #dic = __builtin__.__dict__ - #if dic.get(name): - # yield 'del %s # hiding a builtin!' % name - #else: - # self.initcode.append1('del m.%s' % (name,)) - - print >> f, ' def %s(space, __args__):' % (name,) - if docstr is not None: - print >> f, docstr - print >> f - def tupstr(seq): - if len(seq) == 1: - fmt = '%s,' - else: - fmt = '%s' - return fmt % ', '.join(seq) - def tupassstr(seq): - if not seq: - return "" - else: - return tupstr(seq) + " = " - - print >> f, ' funcname = "%s"' % func.__name__ - - kwlist = list(func.func_code.co_varnames[:func.func_code.co_argcount]) - signature = ' signature = %r' % kwlist - signature = ", ".join([signature, repr(varargname), repr(varkwname)]) - print >> f, signature - - print >> f, ' defaults_w = [%s]' % ", ".join(name_of_defaults) - - print >> f, ' %s__args__.parse(funcname, signature, defaults_w)' % ( - tupassstr(fast_args),) - print >> f, ' return %s(%s)' % (fast_name, ', '.join(["space"]+fast_args)) - - for line in install_func(f_name, name): - print >> f, line - - print >> f - print >> f, fast_function_header - if docstr is not None: - print >> f, docstr - - fast_locals = [arg for arg in localnames if arg not in fast_set] -## # if goto is specialized, the false detection of -## # uninitialized variables goes away. -## if fast_locals and not self.specialize_goto: -## print >> f -## for line in self.large_initialize(fast_locals): -## print >> f, " %s" % line -## print >> f - - # print the body - for line in body: - print >> f, line - for line in install_func("fast"+f_name, name): - print >> f, line - print >> f - - # print the PyMethodDef - # skipped - - if not self.translator.frozen: - # this is only to keep the RAM consumption under control - pass # del self.translator.flowgraphs[func] - # got duplicate flowgraphs when doing this! - - def rpyfunction_body(self, func, localscope): - try: - graph = self.translator.getflowgraph(func) - except Exception, e: - print 20*"*", e - print func - raise - # not needed, we use tuple assignment! - # remove_direct_loops(graph) - checkgraph(graph) - - allblocks = [] - - f = self.f - t = self.translator - #t.simplify(func) - graph = t.getflowgraph(func) - - - start = graph.startblock - allblocks = ordered_blocks(graph) - nblocks = len(allblocks) - - blocknum = {} - for block in allblocks: - blocknum[block] = len(blocknum)+1 - - yield " goto = %s # startblock" % self.mklabel(blocknum[start]) - yield " while True:" - - def render_block(block): - catch_exception = block.exitswitch == Constant(last_exception) - regular_op = len(block.operations) - catch_exception - # render all but maybe the last op - for op in block.operations[:regular_op]: - for line in self.oper(op, localscope).split("\n"): - yield "%s" % line - # render the last op if it is exception handled - for op in block.operations[regular_op:]: - yield "try:" - for line in self.oper(op, localscope).split("\n"): - yield " %s" % line - - if len(block.exits) == 0: - if len(block.inputargs) == 2: # exc_cls, exc_value - # exceptional return block - exc_cls = self.expr(block.inputargs[0], localscope) - exc_val = self.expr(block.inputargs[1], localscope) - yield "raise %s(%s, %s)" % (self.nameof(OperationError), - exc_cls, exc_val) - else: - # regular return block - retval = self.expr(block.inputargs[0], localscope) - yield "return %s" % retval - return - elif block.exitswitch is None: - # single-exit block - assert len(block.exits) == 1 - for op in self.gen_link(block.exits[0], localscope, blocknum, block): - yield "%s" % op - elif catch_exception: - # block catching the exceptions raised by its last operation - # we handle the non-exceptional case first - link = block.exits[0] - assert link.exitcase is None - for op in self.gen_link(link, localscope, blocknum, block): - yield " %s" % op - # we must catch the exception raised by the last operation, - # which goes to the last err%d_%d label written above. - # Since we only have OperationError, we need to select: - yield "except %s, e:" % (self.nameof(OperationError),) - yield " e.normalize_exception(space)" - q = "if" - for link in block.exits[1:]: - assert issubclass(link.exitcase, Exception) - # Exeption classes come unwrapped in link.exitcase - yield " %s space.is_true(space.issubtype(e.w_type, %s)):" % (q, - self.nameof(link.exitcase)) - q = "elif" - for op in self.gen_link(link, localscope, blocknum, block, { - link.last_exception: 'e.w_type', - link.last_exc_value: 'e.w_value'}): - yield " %s" % op - yield " else:raise # unhandled case, should not happen" - else: - # block ending in a switch on a value - exits = list(block.exits) - if len(exits) == 2 and ( - exits[0].exitcase is False and exits[1].exitcase is True): - # order these guys like Python does - exits.reverse() - q = "if" - for link in exits[:-1]: - yield "%s %s == %s:" % (q, self.expr(block.exitswitch, - localscope), - link.exitcase) - for op in self.gen_link(link, localscope, blocknum, block): - yield " %s" % op - q = "elif" - link = exits[-1] - yield "else:" - yield " assert %s == %s" % (self.expr(block.exitswitch, - localscope), - link.exitcase) - for op in self.gen_link(exits[-1], localscope, blocknum, block): - yield " %s" % op - - cmpop = ('==', 'is') [self.specialize_goto] - for block in allblocks: - blockno = blocknum[block] - yield "" - yield " if goto %s %s:" % (cmpop, self.mklabel(blockno)) - for line in render_block(block): - yield " %s" % line - -# ____________________________________________________________ - - RPY_HEADER = '''#!/bin/env python -# -*- coding: LATIN-1 -*-''' - - RPY_SEP = "#*************************************************************" - - RPY_INIT_HEADER = RPY_SEP + ''' - -def init%(modname)s(space): - """NOT_RPYTHON""" -''' - - RPY_INIT_FOOTER = ''' -# entry point: %(entrypointname)s, %(entrypoint)s -if __name__ == "__main__": - from pypy.objspace.std import StdObjSpace - from pypy.objspace.std.model import UnwrapError - space = StdObjSpace() - init%(modname)s(space) - ret = space.call(%(entrypoint)s, space.newtuple([])) - try: - print space.unwrap(ret) - except UnwrapError: - print "cannot unwrap, here the wrapped result:" - print ret -''' - -# _____________________________________________________________________ - -# implementation of the interface that is finally only -# used: translate_as_module - -import py.code -import cStringIO as StringIO - -class memfile(object): - _storage = {} - def __init__(self, name, mode="r"): - if mode == "w": - self._storage[name] = StringIO.StringIO() - elif mode == "r": - try: - data = self._storage[name].getvalue() - except IndexError: - data = file(name).read() - self._storage[name] = StringIO.StringIO(data) - else: - raise ValueError, "mode %s not supported" % mode - self._file = self._storage[name] - def __getattr__(self, name): - return getattr(self._file, name) - def close(self): - pass - -def translate_as_module(sourcetext, filename=None, modname="app2interpexec", - do_imports_immediately=False, tmpname=None): - """ compile sourcetext as a module, translating to interp level. - The result is the init function that creates the wrapped module dict, - together with the generated source text. - This init function needs a space as argument. - tmpname can be passed for debugging purposes. - - Example: - - initfunc, newsrc = translate_as_module(text) - from pypy.objspace.std import Space - space = Space() - dic = initfunc(space) - # and now use the members of the dict - """ - # create something like a module - if filename is None: - code = py.code.Source(sourcetext).compile() - else: - code = NiceCompile(filename)(sourcetext) - dic = {'__name__': modname} - if filename: - dic['__file__'] = filename - exec code in dic - - entrypoint = dic - t = Translator(None, verbose=False, simplifying=needed_passes, - do_imports_immediately=do_imports_immediately, - builtins_can_raise_exceptions=True) - gen = GenRpy(t, entrypoint, modname, dic) - if tmpname: - _file = file - else: - _file = memfile - tmpname = 'nada' - out = _file(tmpname, 'w') - gen.f = out - gen.gen_source(tmpname, file=_file) - out.close() - newsrc = _file(tmpname).read() - code = py.code.Source(newsrc).compile() - dic = {'__name__': modname} - exec code in dic - # now we just need to return the init function, - # which then needs to be called with the space to return the dict. - return dic['init%s' % modname], newsrc - -#___________________________________________________________________ - -# some testing code - -testcode = """ -def f(a, b): - return a + b - -def g(): - return f(f(1, 2), f(4, 8)) -""" - -if __name__ == '__main__': - res = translate_as_module(testcode, tmpname='/tmp/look.py') From arigo at codespeak.net Sat May 21 14:13:37 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Sat, 21 May 2005 14:13:37 +0200 (CEST) Subject: [pypy-svn] r12710 - in pypy/dist/pypy: interpreter translator Message-ID: <20050521121337.81BA727B6D@code1.codespeak.net> Author: arigo Date: Sat May 21 14:13:37 2005 New Revision: 12710 Added: pypy/dist/pypy/interpreter/gateway.py - copied unchanged from r12705, pypy/dist/pypy/interpreter/gateway.py pypy/dist/pypy/translator/geninterplevel.py - copied unchanged from r12705, pypy/dist/pypy/translator/geninterplevel.py Log: Reverted to r12705. From arigo at codespeak.net Sat May 21 14:19:32 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Sat, 21 May 2005 14:19:32 +0200 (CEST) Subject: [pypy-svn] r12711 - pypy/dist/pypy/translator Message-ID: <20050521121932.19D4827B6D@code1.codespeak.net> Author: arigo Date: Sat May 21 14:19:31 2005 New Revision: 12711 Modified: pypy/dist/pypy/translator/geninterplevel.py Log: Missing try:finally: Modified: pypy/dist/pypy/translator/geninterplevel.py ============================================================================== --- pypy/dist/pypy/translator/geninterplevel.py (original) +++ pypy/dist/pypy/translator/geninterplevel.py Sat May 21 14:19:31 2005 @@ -77,7 +77,7 @@ import pypy # __path__ import py.path -GI_VERSION = '1.1.0' # bump this for substantial changes +GI_VERSION = '1.1.1' # bump this for substantial changes # ____________________________________________________________ def eval_helper(self, typename, expr): @@ -420,10 +420,12 @@ self.initcode.append1('import sys') self.initcode.append1('import os') self.initcode.append1('libdir = os.path.join(pypy.__path__[0], "lib")\n' - 'hold = sys.path[:]\n' 'sys.path.insert(0, libdir)\n' - 'import %s as _tmp\n' - 'sys.path[:] = hold\n' % value.__name__) + 'try:\n' + ' import %s as _tmp\n' + 'finally:\n' + ' if libdir in sys.path:\n' + ' sys.path.remove(libdir)\n' % value.__name__) else: self.initcode.append1('import %s as _tmp' % value.__name__) self.initcode.append1('%s = space.wrap(_tmp)' % (name)) @@ -1329,12 +1331,12 @@ # XXX allow the app-level code to contain e.g. "import _formatting" libdir = os.path.join(pypy.__path__[0], "lib") - hold = sys.path[:] sys.path.insert(0, libdir) try: exec code in dic finally: - sys.path[:] = hold + if libdir in sys.path: + sys.path.remove(libdir) entrypoint = dic t = Translator(None, verbose=False, simplifying=needed_passes, From arigo at codespeak.net Sat May 21 15:21:54 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Sat, 21 May 2005 15:21:54 +0200 (CEST) Subject: [pypy-svn] r12712 - pypy/dist/pypy/translator/c Message-ID: <20050521132154.97AA527B61@code1.codespeak.net> Author: arigo Date: Sat May 21 15:21:54 2005 New Revision: 12712 Added: pypy/dist/pypy/translator/c/ - copied from r12446, user/arigo/hack/pypy-hack/c/ Log: Moving this back in place. From hpk at codespeak.net Sat May 21 15:44:39 2005 From: hpk at codespeak.net (hpk at codespeak.net) Date: Sat, 21 May 2005 15:44:39 +0200 (CEST) Subject: [pypy-svn] r12714 - pypy/dist/pypy/documentation Message-ID: <20050521134439.7B09327B61@code1.codespeak.net> Author: hpk Date: Sat May 21 15:44:39 2005 New Revision: 12714 Modified: pypy/dist/pypy/documentation/getting_started.txt Log: fix linking Modified: pypy/dist/pypy/documentation/getting_started.txt ============================================================================== --- pypy/dist/pypy/documentation/getting_started.txt (original) +++ pypy/dist/pypy/documentation/getting_started.txt Sat May 21 15:44:39 2005 @@ -411,6 +411,7 @@ python translate_pypy.py targetrpystone2 +.. _`start reading sources`: Where to start reading the sources ---------------------------------- @@ -512,8 +513,6 @@ -.. _`start reading sources`: - Getting involved ================================== From arigo at codespeak.net Sat May 21 19:06:16 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Sat, 21 May 2005 19:06:16 +0200 (CEST) Subject: [pypy-svn] r12715 - in pypy/dist/pypy: annotation annotation/test rpython rpython/test translator/genc translator/genc/test Message-ID: <20050521170616.597BD27B61@code1.codespeak.net> Author: arigo Date: Sat May 21 19:06:16 2005 New Revision: 12715 Modified: pypy/dist/pypy/annotation/builtin.py pypy/dist/pypy/annotation/test/test_model.py pypy/dist/pypy/rpython/lltypes.py pypy/dist/pypy/rpython/rlist.py pypy/dist/pypy/rpython/test/test_llann.py pypy/dist/pypy/rpython/test/test_lltypes.py pypy/dist/pypy/translator/genc/lltype.py pypy/dist/pypy/translator/genc/test/test_lltyped.py Log: Added a distinction between Struct and GcStruct, as well as Array and GcArray. The Gc version are the ones that come with a reference counter (or other GC supporting memory), and can be malloc'ed. The non-Gc versions are the ones that can be inlined inside other structures. Lots of other small changes triggered by this... Modified: pypy/dist/pypy/annotation/builtin.py ============================================================================== --- pypy/dist/pypy/annotation/builtin.py (original) +++ pypy/dist/pypy/annotation/builtin.py Sat May 21 19:06:16 2005 @@ -265,12 +265,9 @@ assert isinstance(s_p, SomePtr), "casting of non-pointer: %r" % s_p assert PtrT.is_constant() PtrT = PtrT.const - parent_example_p = PtrT._example() - first_p = parent_example_p._first() - if s_p.ll_ptrtype == lltypes.typeOf(first_p): - candidate_p = first_p - else: - candidate_p = s_p.ll_ptrtype._example() + parent_p = PtrT._example() + candidate_p = s_p.ll_ptrtype._example() + parent_p._setfirst(candidate_p) return SomePtr(ll_ptrtype=lltypes.typeOf(lltypes.cast_parent(PtrT, candidate_p))) BUILTIN_ANALYZERS[lltypes.malloc] = malloc Modified: pypy/dist/pypy/annotation/test/test_model.py ============================================================================== --- pypy/dist/pypy/annotation/test/test_model.py (original) +++ pypy/dist/pypy/annotation/test/test_model.py Sat May 21 19:06:16 2005 @@ -112,8 +112,8 @@ assert s_uz.contains(s_u) assert ll_to_annotation(lltypes.Bool._defl()).contains(SomeBool()) assert ll_to_annotation(lltypes.Char._defl()).contains(SomeChar()) - S = lltypes.Struct('s') - A = lltypes.Array() + S = lltypes.GcStruct('s') + A = lltypes.GcArray() s_p = ll_to_annotation(lltypes.malloc(S)) assert isinstance(s_p, SomePtr) and s_p.ll_ptrtype == lltypes.GcPtr(S) s_p = ll_to_annotation(lltypes.malloc(A, 0)) @@ -136,17 +136,17 @@ assert annotation_to_lltype(s_u1) == lltypes.Unsigned assert annotation_to_lltype(SomeBool()) == lltypes.Bool assert annotation_to_lltype(SomeChar()) == lltypes.Char - PS = lltypes.GcPtr(lltypes.Struct('s')) + PS = lltypes.GcPtr(lltypes.GcStruct('s')) s_p = SomePtr(ll_ptrtype=PS) assert annotation_to_lltype(s_p) == PS py.test.raises(ValueError, "annotation_to_lltype(si0)") def test_ll_union(): - PS1 = lltypes.GcPtr(lltypes.Struct('s')) - PS2 = lltypes.GcPtr(lltypes.Struct('s')) - PS3 = lltypes.GcPtr(lltypes.Struct('s3')) - PA1 = lltypes.GcPtr(lltypes.Array()) - PA2 = lltypes.GcPtr(lltypes.Array()) + PS1 = lltypes.GcPtr(lltypes.GcStruct('s')) + PS2 = lltypes.GcPtr(lltypes.GcStruct('s')) + PS3 = lltypes.GcPtr(lltypes.GcStruct('s3')) + PA1 = lltypes.GcPtr(lltypes.GcArray()) + PA2 = lltypes.GcPtr(lltypes.GcArray()) assert unionof(SomePtr(PS1),SomePtr(PS1)) == SomePtr(PS1) assert unionof(SomePtr(PS1),SomePtr(PS2)) == SomePtr(PS2) Modified: pypy/dist/pypy/rpython/lltypes.py ============================================================================== --- pypy/dist/pypy/rpython/lltypes.py (original) +++ pypy/dist/pypy/rpython/lltypes.py Sat May 21 19:06:16 2005 @@ -56,11 +56,18 @@ if name in flds: raise TypeError("%s: repeated field name" % self._name) flds[name] = typ - + if isinstance(typ, GC_CONTAINER): + if name == fields[0][0] and isinstance(self, GC_CONTAINER): + pass # can inline a GC_CONTAINER as 1st field of GcStruct + else: + raise TypeError("%s: cannot inline GC container %r" % ( + self._name, typ)) + # look if we have an inlined variable-sized array as the last field if fields: for name, typ in fields[:-1]: typ._inline_is_varsize(False) + first = False name, typ = fields[-1] if typ._inline_is_varsize(True): self._arrayfld = name @@ -85,7 +92,8 @@ for name in self._names]) def __str__(self): - return "Struct %s { %s }" % (self._name, self._str_fields()) + return "%s %s { %s }" % (self.__class__.__name__, + self._name, self._str_fields()) def _defl(self, parent=None): return _struct(self, parent=parent) @@ -97,6 +105,9 @@ n = 1 return _struct(self, n) +class GcStruct(Struct): + pass + class Array(ContainerType): def __init__(self, *fields): self.OF = Struct("", *fields) @@ -109,11 +120,16 @@ return True def __str__(self): - return "Array of { %s }" % (self.OF._str_fields(),) + return "%s of { %s }" % (self.__class__.__name__, + self.OF._str_fields(),) def _container_example(self): return _array(self, 1) +class GcArray(Array): + def _inline_is_varsize(self, last): + raise TypeError("cannot inline a GC array inside a structure") + class FuncType(ContainerType): def __init__(self, args, result): for arg in args: @@ -140,9 +156,14 @@ class ForwardReference(ContainerType): def become(self, realcontainertype): + if not isinstance(realcontainertype, GC_CONTAINER): + raise TypeError("ForwardReference can only be to GcStruct or " + "GcArray, not %r" % (realcontainertype,)) self.__class__ = realcontainertype.__class__ self.__dict__ = realcontainertype.__dict__ +GC_CONTAINER = (GcStruct, GcArray, PyObjectType, ForwardReference) + class Primitive(LowLevelType): def __init__(self, name, default): @@ -170,10 +191,12 @@ if not isinstance(TO, ContainerType): raise TypeError, ("can only point to a Struct or an Array or a FuncType, " "not to %s" % (TO,)) + if 'gc' in flags: + if not isinstance(TO, GC_CONTAINER): + raise TypeError, ("GcPtr can only point to GcStruct, GcArray or" + " PyObject, not to %s" % (TO,)) self.TO = TO self.flags = frozendict(flags) - if isinstance(TO, FuncType) and 'gc' in self.flags: - raise TypeError, "function pointers are not gc-able" def _str_flags(self): flags = self.flags.keys() @@ -261,7 +284,9 @@ # * converting from TO-structure to a parent TO-structure whose first # field is the original structure if (not isinstance(CURTYPE.TO, Struct) or - not isinstance(PTRTYPE.TO, Struct)): + not isinstance(PTRTYPE.TO, Struct) or + len(PTRTYPE.TO._names) == 0 or + PTRTYPE.TO._flds[PTRTYPE.TO._names[0]] != CURTYPE.TO): raise InvalidCast(CURTYPE, PTRTYPE) ptr._check() parent = ptr._obj._wrparent() @@ -279,7 +304,7 @@ T = typeOf(val) if isinstance(T, ContainerType): assert not isinstance(T, FuncType), "functions cannot be substructures" - if can_have_gc and isinstance(T, Struct): + if can_have_gc and isinstance(T, GcStruct): val = _ptr(GcPtr(T), val) else: val = _ptr(_TmpPtr(T), val) @@ -323,10 +348,21 @@ raise AttributeError("%r instance has no field %r" % (self._T, field_name)) - def _first(self): + def _setfirst(self, p): if isinstance(self._T, Struct) and self._T._names: - return self.__getattr__(self._T._names[0]) - raise AttributeError("%r instance has no first field" % (self._T,)) + if not isinstance(p, _ptr) or not isinstance(p._obj, _struct): + raise InvalidCast(typeOf(p), typeOf(self)) + field_name = self._T._names[0] + T1 = self._T._flds[field_name] + T2 = typeOf(p._obj) + if T1 != T2: + raise InvalidCast(typeOf(p), typeOf(self)) + self._check() + setattr(self._obj, field_name, p._obj) + p._obj._wrparent = weakref.ref(self._obj) + p._obj._wrparent_type = typeOf(self._obj) + return + raise TypeError("%r instance has no first field" % (self._T,)) def __setattr__(self, field_name, val): if isinstance(self._T, Struct): Modified: pypy/dist/pypy/rpython/rlist.py ============================================================================== --- pypy/dist/pypy/rpython/rlist.py (original) +++ pypy/dist/pypy/rpython/rlist.py Sat May 21 19:06:16 2005 @@ -19,8 +19,8 @@ LISTPTR = self.LISTPTR LIST = self.LIST ITEM = self.ITEM - LIST.become(Struct("list", - ("items", GcPtr(Array(('item', ITEM)))))) + LIST.become(GcStruct("list", + ("items", GcPtr(GcArray(('item', ITEM)))))) def getitem(l, i): return l.items[i].item Modified: pypy/dist/pypy/rpython/test/test_llann.py ============================================================================== --- pypy/dist/pypy/rpython/test/test_llann.py (original) +++ pypy/dist/pypy/rpython/test/test_llann.py Sat May 21 19:06:16 2005 @@ -8,7 +8,7 @@ from pypy.translator.annrpython import RPythonAnnotator def test_simple(self): - S = Struct("s", ('v', Signed)) + S = GcStruct("s", ('v', Signed)) def llf(): s = malloc(S) return s.v @@ -18,7 +18,7 @@ def test_simple2(self): S = Struct("s", ('v', Signed)) - S2 = Struct("s2", ('a',S), ('b',S)) + S2 = GcStruct("s2", ('a',S), ('b',S)) def llf(): s = malloc(S2) return s.a.v+s.b.v @@ -27,7 +27,7 @@ assert s.knowntype == int def test_array(self): - A = Array(('v', Signed)) + A = GcArray(('v', Signed)) def llf(): a = malloc(A, 1) return a[0].v @@ -36,7 +36,7 @@ assert s.knowntype == int def test_cast_flags(self): - S1 = Struct("s1", ('a', Signed), ('b', Unsigned)) + S1 = GcStruct("s1", ('a', Signed), ('b', Unsigned)) NGCPS1 = NonGcPtr(S1) def llf(): p1 = malloc(S1) @@ -49,7 +49,25 @@ def test_cast_parent(self): S2 = Struct("s2", ('a', Signed)) - S1 = Struct("s1", ('sub1', S2), ('sub2', S2)) + S1 = GcStruct("s1", ('sub1', S2), ('sub2', S2)) + GCPS1 = GcPtr(S1) + NGCPS1 = NonGcPtr(S1) + NGCPS2 = NonGcPtr(S2) + def llf(): + p1 = malloc(S1) + p2 = p1.sub1 + p3 = cast_flags(NGCPS2, p2) + p4 = cast_parent(NGCPS1, p3) + p5 = cast_flags(GCPS1, p4) + return p5 + a = self.RPythonAnnotator() + s = a.build_types(llf, []) + assert isinstance(s, annmodel.SomePtr) + assert s.ll_ptrtype == GCPS1 + + def test_cast_parent_from_gc(self): + S2 = GcStruct("s2", ('a', Signed)) + S1 = GcStruct("s1", ('sub1', S2), ('x', Signed)) GCPS1 = GcPtr(S1) def llf(): p1 = malloc(S1) @@ -62,7 +80,7 @@ assert s.ll_ptrtype == GCPS1 def test_array_length(self): - A = Array(('v', Signed)) + A = GcArray(('v', Signed)) def llf(): a = malloc(A, 1) return len(a) Modified: pypy/dist/pypy/rpython/test/test_lltypes.py ============================================================================== --- pypy/dist/pypy/rpython/test/test_lltypes.py (original) +++ pypy/dist/pypy/rpython/test/test_lltypes.py Sat May 21 19:06:16 2005 @@ -2,7 +2,7 @@ from pypy.rpython.lltypes import _TmpPtr def test_basics(): - S0 = Struct("s0", ('a', Signed), ('b', Signed)) + S0 = GcStruct("s0", ('a', Signed), ('b', Signed)) assert S0.a == Signed assert S0.b == Signed s0 = malloc(S0) @@ -16,7 +16,7 @@ assert s0.a == 1 assert s0.b == 1 # simple array - Ar = Array(('v', Signed)) + Ar = GcArray(('v', Signed)) x = malloc(Ar,0) print x assert len(x) == 0 @@ -32,8 +32,8 @@ assert [x[z].v for z in range(3)] == [1, 2, 3] # def define_list(T): - List_typ = Struct("list", - ("items", GcPtr(Array(('item',T))))) + List_typ = GcStruct("list", + ("items", GcPtr(GcArray(('item',T))))) def newlist(): l = malloc(List_typ) items = malloc(List_typ.items.TO, 0) @@ -65,7 +65,7 @@ assert iitem(l, 0) == 2 assert iitem(l, 1) == 3 - IWrap = Struct("iwrap", ('v', Signed)) + IWrap = GcStruct("iwrap", ('v', Signed)) List_typ, iwnewlist, iwappend, iwitem = define_list(GcPtr(IWrap)) l = iwnewlist() @@ -82,12 +82,14 @@ assert iwitem(l, 1).v == 3 # not allowed - List_typ, iwnewlistzzz, iwappendzzz, iwitemzzz = define_list(IWrap) # works but + S = Struct("s", ('v', Signed)) + List_typ, iwnewlistzzz, iwappendzzz, iwitemzzz = define_list(S) # works but l = iwnewlistzzz() - py.test.raises(TypeError, "iwappendzzz(l, malloc(IWrap))") + S1 = GcStruct("strange", ('s', S)) + py.test.raises(TypeError, "iwappendzzz(l, malloc(S1).s)") def test_varsizestruct(): - S1 = Struct("s1", ('a', Signed), ('rest', Array(('v', Signed)))) + S1 = GcStruct("s1", ('a', Signed), ('rest', Array(('v', Signed)))) py.test.raises(TypeError, "malloc(S1)") s1 = malloc(S1, 4) assert s1.a == 0 @@ -105,17 +107,27 @@ assert s1.rest[3].v == 5 py.test.raises(TypeError, "Struct('invalid', ('rest', Array(('v', Signed))), ('a', Signed))") + py.test.raises(TypeError, "Struct('invalid', ('rest', GcArray(('v', Signed))), ('a', Signed))") + py.test.raises(TypeError, "Struct('invalid', ('x', Struct('s1', ('a', Signed), ('rest', Array(('v', Signed))))))") py.test.raises(TypeError, "Struct('invalid', ('x', S1))") def test_substructure_ptr(): S2 = Struct("s2", ('a', Signed)) - S1 = Struct("s1", ('sub1', S2), ('sub2', S2)) + S1 = GcStruct("s1", ('sub1', S2), ('sub2', S2)) p1 = malloc(S1) - assert typeOf(p1.sub1) == GcPtr(S2) + assert typeOf(p1.sub1) == _TmpPtr(S2) + assert typeOf(p1.sub2) == _TmpPtr(S2) + +def test_gc_substructure_ptr(): + S1 = GcStruct("s2", ('a', Signed)) + S2 = Struct("s3", ('a', Signed)) + S0 = GcStruct("s1", ('sub1', S1), ('sub2', S2)) + p1 = malloc(S0) + assert typeOf(p1.sub1) == GcPtr(S1) assert typeOf(p1.sub2) == _TmpPtr(S2) def test_tagged_pointer(): - S1 = Struct("s1", ('a', Signed), ('b', Unsigned)) + S1 = GcStruct("s1", ('a', Signed), ('b', Unsigned)) PList = [ GcPtr(S1), NonGcPtr(S1), @@ -129,7 +141,7 @@ assert PList[2] == GcPtr(S1, mytag=True) def test_cast_flags(): - S1 = Struct("s1", ('a', Signed), ('b', Unsigned)) + S1 = GcStruct("s1", ('a', Signed), ('b', Unsigned)) p1 = malloc(S1) p2 = cast_flags(NonGcPtr(S1), p1) assert typeOf(p2) == NonGcPtr(S1) @@ -150,19 +162,27 @@ def test_cast_parent(): S2 = Struct("s2", ('a', Signed)) - S1 = Struct("s1", ('sub1', S2), ('sub2', S2)) + S1 = GcStruct("s1", ('sub1', S2), ('sub2', S2)) p1 = malloc(S1) p2 = p1.sub1 - assert typeOf(p2) == GcPtr(S2) - p3 = cast_parent(GcPtr(S1), p2) - assert typeOf(p3) == GcPtr(S1) - assert p3 == p1 + assert typeOf(p2) == _TmpPtr(S2) + p3 = cast_flags(NonGcPtr(S2), p2) + assert typeOf(p3) == NonGcPtr(S2) + p4 = cast_parent(NonGcPtr(S1), p3) + assert typeOf(p4) == NonGcPtr(S1) + p5 = cast_flags(GcPtr(S1), p4) + assert typeOf(p5) == GcPtr(S1) + assert p5 == p1 + py.test.raises(TypeError, "cast_parent(GcPtr(S1), p1.sub1)") py.test.raises(TypeError, "cast_parent(GcPtr(S1), p1.sub2)") py.test.raises(TypeError, "cast_parent(_TmpPtr(S1), p1.sub2)") + py.test.raises(TypeError, "cast_parent(NonGcPtr(S2), p3)") + SUnrelated = Struct("unrelated") + py.test.raises(TypeError, "cast_parent(NonGcPtr(SUnrelated), p3)") def test_best_effort_gced_parent_detection(): S2 = Struct("s2", ('a', Signed)) - S1 = Struct("s1", ('sub1', S2), ('sub2', S2), ('tail', Array(('e', Signed)))) + S1 = GcStruct("s1", ('sub1', S2), ('sub2', S2), ('tail', Array(('e', Signed)))) p1 = malloc(S1, 1) p2 = p1.sub2 assert p2.a == 0 @@ -176,7 +196,7 @@ py.test.raises(RuntimeError, "p3[0]") def test_best_effort_gced_parent_for_arrays(): - A1 = Array(('v', Signed)) + A1 = GcArray(('v', Signed)) p1 = malloc(A1, 10) p1[5].v=3 assert p1[0].v == 0 @@ -189,9 +209,9 @@ py.test.raises(RuntimeError, "p1_5.v") def test_examples(): - A1 = Array(('v', Signed)) - S = Struct("s", ('v', Signed)) - St = Struct("st", ('v', Signed),('trail', A1)) + A1 = GcArray(('v', Signed)) + S = GcStruct("s", ('v', Signed)) + St = GcStruct("st", ('v', Signed),('trail', Array(('v', Signed)))) PA1 = GcPtr(A1) PS = GcPtr(S) @@ -220,3 +240,20 @@ py.test.raises(TypeError, pf, 0, 0) py.test.raises(TypeError, pf, 'a') +def test_inconsistent_gc_containers(): + A = GcArray(('y', Signed)) + S = GcStruct('b', ('y', Signed)) + py.test.raises(TypeError, "GcPtr(Struct('a', ('x', Signed)))") + py.test.raises(TypeError, "Struct('a', ('x', S))") + py.test.raises(TypeError, "GcStruct('a', ('x', Signed), ('y', S))") + py.test.raises(TypeError, "Array(('x', S))") + py.test.raises(TypeError, "GcArray(('x', S))") + py.test.raises(TypeError, "Struct('a', ('x', A))") + py.test.raises(TypeError, "GcStruct('a', ('x', A))") + +def test_forward_reference(): + F = ForwardReference() + S = GcStruct('abc', ('x', GcPtr(F))) + F.become(S) + assert S.x == GcPtr(S) + py.test.raises(TypeError, "ForwardReference().become(Struct('abc'))") Modified: pypy/dist/pypy/translator/genc/lltype.py ============================================================================== --- pypy/dist/pypy/translator/genc/lltype.py (original) +++ pypy/dist/pypy/translator/genc/lltype.py Sat May 21 19:06:16 2005 @@ -203,7 +203,9 @@ ll2concretetypemap = { lltypes.Struct: CStructType, + lltypes.GcStruct: CStructType, lltypes.Array: CArrayType, + lltypes.GcArray: CArrayType, lltypes._PtrType: CPtrType, lltypes.Primitive: get_primitive_type, } Modified: pypy/dist/pypy/translator/genc/test/test_lltyped.py ============================================================================== --- pypy/dist/pypy/translator/genc/test/test_lltyped.py (original) +++ pypy/dist/pypy/translator/genc/test/test_lltyped.py Sat May 21 19:06:16 2005 @@ -18,7 +18,7 @@ return skip_missing_compiler(t.ccompile) def test_simple(self): - S = Struct("s", ('v', Signed)) + S = GcStruct("s", ('v', Signed)) def llf(): s = malloc(S) return s.v @@ -27,7 +27,7 @@ def test_simple2(self): S = Struct("s", ('v', Signed)) - S2 = Struct("s2", ('a',S), ('b',S)) + S2 = GcStruct("s2", ('a',S), ('b',S)) def llf(): s = malloc(S2) s.a.v = 6 From arigo at codespeak.net Sat May 21 19:12:23 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Sat, 21 May 2005 19:12:23 +0200 (CEST) Subject: [pypy-svn] r12716 - in pypy/dist/pypy/translator/c: . test Message-ID: <20050521171223.5060427B61@code1.codespeak.net> Author: arigo Date: Sat May 21 19:12:23 2005 New Revision: 12716 Modified: pypy/dist/pypy/translator/c/node.py pypy/dist/pypy/translator/c/test/test_database.py Log: Forgot to fix this according to the changes in lltypes.py. Modified: pypy/dist/pypy/translator/c/node.py ============================================================================== --- pypy/dist/pypy/translator/c/node.py (original) +++ pypy/dist/pypy/translator/c/node.py Sat May 21 19:12:23 2005 @@ -1,6 +1,7 @@ from __future__ import generators from pypy.translator.gensupp import C_IDENTIFIER from pypy.rpython.lltypes import Struct, Array, FuncType, PyObject +from pypy.rpython.lltypes import GcStruct, GcArray class StructDefNode: @@ -61,7 +62,9 @@ ContainerNodeClass = { Struct: StructNode, + GcStruct: StructNode, Array: ArrayNode, + GcArray: ArrayNode, FuncType: FuncNode, PyObject: PyObjectNode, } Modified: pypy/dist/pypy/translator/c/test/test_database.py ============================================================================== --- pypy/dist/pypy/translator/c/test/test_database.py (original) +++ pypy/dist/pypy/translator/c/test/test_database.py Sat May 21 19:12:23 2005 @@ -13,7 +13,7 @@ def test_struct(): db = LowLevelDatabase() - S = Struct('test', ('x', Signed)) + S = GcStruct('test', ('x', Signed)) s = malloc(S) s.x = 42 assert db.get(s).startswith('&g_') @@ -22,7 +22,7 @@ def test_inlined_struct(): db = LowLevelDatabase() - S = Struct('test', ('x', Struct('subtest', ('y', Signed)))) + S = GcStruct('test', ('x', Struct('subtest', ('y', Signed)))) s = malloc(S) s.x.y = 42 assert db.get(s).startswith('&g_') @@ -33,8 +33,8 @@ def test_complete(): db = LowLevelDatabase() - T = Struct('subtest', ('y', Signed)) - S = Struct('test', ('x', GcPtr(T))) + T = GcStruct('subtest', ('y', Signed)) + S = GcStruct('test', ('x', GcPtr(T))) s = malloc(S) s.x = malloc(T) s.x.y = 42 From arigo at codespeak.net Sat May 21 22:14:43 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Sat, 21 May 2005 22:14:43 +0200 (CEST) Subject: [pypy-svn] r12717 - in pypy/dist/pypy: rpython translator/c translator/c/test Message-ID: <20050521201443.212F527B6D@code1.codespeak.net> Author: arigo Date: Sat May 21 22:14:42 2005 New Revision: 12717 Modified: pypy/dist/pypy/rpython/lltypes.py pypy/dist/pypy/translator/c/database.py pypy/dist/pypy/translator/c/node.py pypy/dist/pypy/translator/c/test/test_database.py Log: Generating now static structure definitions, possibly nested ones. Modified: pypy/dist/pypy/rpython/lltypes.py ============================================================================== --- pypy/dist/pypy/rpython/lltypes.py (original) +++ pypy/dist/pypy/rpython/lltypes.py Sat May 21 22:14:42 2005 @@ -310,6 +310,17 @@ val = _ptr(_TmpPtr(T), val) return val +def parentlink(container): + parent = container._check() + if parent is not None: + assert isinstance(parent, _struct) + for name in parent._TYPE._names: + if getattr(parent, name) is container: + return parent, name + raise RuntimeError("lost ourselves") + else: + return None, None + class _ptr(object): @@ -447,6 +458,8 @@ % (self, self._wrparent_type)) else: parent._check() + return parent + return None def __repr__(self): return '<%s>' % (self,) @@ -465,7 +478,6 @@ def __str__(self): return 'struct %s { %s }' % (self._TYPE._name, self._str_fields()) - class _array(object): _wrparent = None @@ -489,6 +501,8 @@ % (self, self._wrparent_type)) else: parent._check() + return parent + return None def __repr__(self): return '<%s>' % (self,) Modified: pypy/dist/pypy/translator/c/database.py ============================================================================== --- pypy/dist/pypy/translator/c/database.py (original) +++ pypy/dist/pypy/translator/c/database.py Sat May 21 22:14:42 2005 @@ -1,6 +1,7 @@ from pypy.translator.gensupp import NameManager from pypy.rpython.lltypes import Primitive, _PtrType, typeOf from pypy.rpython.lltypes import Struct, Array, FuncType, PyObject +from pypy.rpython.lltypes import ContainerType from pypy.rpython.typer import PyObjPtr from pypy.objspace.flow.model import Constant from pypy.translator.c.primitive import PrimitiveName, PrimitiveType @@ -31,6 +32,20 @@ else register union ''') + def gettypedefnode(self, T): + try: + node = self.structdefnodes[T] + except KeyError: + if isinstance(T, Struct): + node = StructDefNode(self, T) + elif isinstance(T, Array): + node = ArrayDefNode(self, T) + else: + raise Exception("don't know about %r" % (T,)) + self.structdefnodes[T] = node + self.structdeflist.append(node) + return node + def gettype(self, T, who_asks=None): if isinstance(T, Primitive): return PrimitiveType[T] @@ -38,15 +53,7 @@ typename = self.gettype(T.TO) # who_asks not propagated return typename.replace('@', '*@') elif isinstance(T, (Struct, Array)): - try: - node = self.structdefnodes[T] - except KeyError: - if isinstance(T, Struct): - node = StructDefNode(self, T) - else: - node = ArrayDefNode(self, T) - self.structdefnodes[T] = node - self.structdeflist.append(node) + node = self.gettypedefnode(T) if who_asks is not None: who_asks.dependencies[node] = True return 'struct %s @' % node.name @@ -64,23 +71,36 @@ else: raise Exception("don't know about type %r" % (T,)) + def getcontainernode(self, container): + try: + node = self.containernodes[container] + except KeyError: + T = typeOf(container) + nodecls = ContainerNodeClass[T.__class__] + node = nodecls(self, T, container) + self.containernodes[container] = node + self.containerlist.append(node) + return node + def get(self, obj): T = typeOf(obj) if isinstance(T, Primitive): return PrimitiveName[T](obj) elif isinstance(T, _PtrType): - try: - node = self.containernodes[obj] - except KeyError: - nodecls = ContainerNodeClass[T.TO.__class__] - node = nodecls(self, T.TO, obj) - self.containernodes[obj] = node - self.containerlist.append(node) + node = self.getcontainernode(obj._obj) return node.ptrname else: raise Exception("don't know about %r" % (obj,)) def complete(self): for node in self.containerlist: - for value in node.enum_dependencies(self): - self.get(value) + for value in node.enum_dependencies(): + if isinstance(typeOf(value), ContainerType): + self.getcontainernode(value) + else: + self.get(value) + + def globalcontainers(self): + for node in self.containerlist: + if node.globalcontainer: + yield node Modified: pypy/dist/pypy/translator/c/node.py ============================================================================== --- pypy/dist/pypy/translator/c/node.py (original) +++ pypy/dist/pypy/translator/c/node.py Sat May 21 22:14:42 2005 @@ -1,7 +1,27 @@ from __future__ import generators from pypy.translator.gensupp import C_IDENTIFIER -from pypy.rpython.lltypes import Struct, Array, FuncType, PyObject -from pypy.rpython.lltypes import GcStruct, GcArray +from pypy.rpython.lltypes import Struct, Array, FuncType, PyObject, typeOf +from pypy.rpython.lltypes import GcStruct, GcArray, GC_CONTAINER, ContainerType +from pypy.rpython.lltypes import parentlink + + +def needs_refcount(T): + if not isinstance(T, GC_CONTAINER): + return False + if isinstance(T, GcStruct): + if T._names and isinstance(T._flds[T._names[0]], GC_CONTAINER): + return False # refcount already in the first first + return True + +def somelettersfrom(s): + upcase = [c for c in s if c.isupper()] + if not upcase: + upcase = [c for c in s.title() if c.isupper()] + locase = [c for c in s if c.islower()] + if locase and upcase: + return ''.join(upcase).lower() + else: + return s[:2].lower() class StructDefNode: @@ -10,10 +30,23 @@ self.STRUCT = STRUCT self.name = db.namespace.uniquename(STRUCT._name) self.dependencies = {} - self.typenames = [] + self.fields = [] + self.prefix = somelettersfrom(STRUCT._name) + '_' for name in STRUCT._names: T = STRUCT._flds[name] - self.typenames.append(db.gettype(T, who_asks=self)) + typename = db.gettype(T, who_asks=self) + self.fields.append((self.c_struct_field_name(name), typename)) + + def c_struct_field_name(self, name): + return self.prefix + name + + def definition(self): + yield 'struct %s {' % self.name + if needs_refcount(self.STRUCT): + yield '\tlong refcount;' + for name, typename in self.fields: + yield '\t%s;' % typename.replace('@', name) + yield '};' class ArrayDefNode: @@ -24,36 +57,85 @@ self.dependencies = {} self.structname = db.gettype(ARRAY.OF, who_asks=self) + def definition(self): + yield 'struct %s {' % self.name + if needs_refcount(self.ARRAY): + yield '\tlong refcount;' + yield '\tlong length;' + yield '\t%s;' % self.structname.replace('@', 'items[1]') + yield '};' + class ContainerNode: def __init__(self, db, T, obj): + self.db = db self.T = T self.obj = obj - self.name = db.namespace.uniquename('g_' + self.basename()) - self.ptrname = '&' + self.name - self.dependencies = {} - self.typename = db.gettype(T, who_asks=self) + #self.dependencies = {} + self.typename = db.gettype(T) #, who_asks=self) + parent, fldname = parentlink(obj) + if parent is None: + self.name = db.namespace.uniquename('g_' + self.basename()) + self.globalcontainer = True + else: + parentnode = db.getcontainernode(parent) + defnode = db.gettypedefnode(parentnode.T) + fldname = defnode.c_struct_field_name(fldname) + self.name = parentnode.name + '.' + fldname + self.globalcontainer = False + self.ptrname = '&%s' % self.name + + def forward_declaration(self): + yield '%s; /* forward */' % self.typename.replace('@', self.name) + + def implementation(self): + lines = list(self.initializationexpr()) + lines[0] = '%s = %s' % (self.typename.replace('@', self.name), lines[0]) + lines[-1] += ';' + return lines class StructNode(ContainerNode): + def basename(self): return self.T._name - def enum_dependencies(self, db): + + def enum_dependencies(self): for name in self.T._names: yield getattr(self.obj, name) + def initializationexpr(self, prefix=''): + yield '{' + if needs_refcount(self.T): + yield '\t1,' + for name in self.T._names: + value = getattr(self.obj, name) + if isinstance(typeOf(value), ContainerType): + node = self.db.getcontainernode(value) + expr = '\n'.join(node.initializationexpr(prefix+name+'.')) + expr += ',' + else: + expr = self.db.get(value) + i = expr.find('\n') + if i<0: i = len(expr) + expr = '%s,\t/* %s%s */%s' % (expr[:i], prefix, name, expr[i:]) + expr = expr.replace('\n', '\n\t') # indentation + yield '\t%s' % expr + yield '}' + + class ArrayNode(ContainerNode): def basename(self): return 'array' - def enum_dependencies(self, db): + def enum_dependencies(self): for i in range(len(self.obj)): yield self.obj[i] class FuncNode(ContainerNode): def basename(self): return self.obj._name - def enum_dependencies(self, db): + def enum_dependencies(self): Booom class PyObjectNode(ContainerNode): Modified: pypy/dist/pypy/translator/c/test/test_database.py ============================================================================== --- pypy/dist/pypy/translator/c/test/test_database.py (original) +++ pypy/dist/pypy/translator/c/test/test_database.py Sat May 21 22:14:42 2005 @@ -17,7 +17,7 @@ s = malloc(S) s.x = 42 assert db.get(s).startswith('&g_') - assert db.containernodes.keys() == [s] + assert db.containernodes.keys() == [s._obj] assert db.structdefnodes.keys() == [S] def test_inlined_struct(): @@ -26,7 +26,7 @@ s = malloc(S) s.x.y = 42 assert db.get(s).startswith('&g_') - assert db.containernodes.keys() == [s] + assert db.containernodes.keys() == [s._obj] assert len(db.structdefnodes) == 2 assert S in db.structdefnodes assert S.x in db.structdefnodes @@ -39,11 +39,30 @@ s.x = malloc(T) s.x.y = 42 assert db.get(s).startswith('&g_') - assert db.containernodes.keys() == [s] + assert db.containernodes.keys() == [s._obj] db.complete() assert len(db.containernodes) == 2 - assert s in db.containernodes - assert s.x in db.containernodes + assert s._obj in db.containernodes + assert s.x._obj in db.containernodes assert len(db.structdefnodes) == 2 assert S in db.structdefnodes assert S.x.TO in db.structdefnodes + +def test_codegen(): + db = LowLevelDatabase() + U = Struct('inlined', ('z', Signed)) + T = GcStruct('subtest', ('y', Signed)) + S = GcStruct('test', ('x', GcPtr(T)), ('u', U), ('p', NonGcPtr(U))) + s = malloc(S) + s.x = malloc(T) + s.x.y = 42 + s.u.z = -100 + s.p = cast_flags(NonGcPtr(U), s.u) + db.get(s) + db.complete() + for node in db.structdeflist: + print '\n'.join(node.definition()) + for node in db.globalcontainers(): + print '\n'.join(node.forward_declaration()) + for node in db.globalcontainers(): + print '\n'.join(node.implementation()) From hpk at codespeak.net Sat May 21 22:44:41 2005 From: hpk at codespeak.net (hpk at codespeak.net) Date: Sat, 21 May 2005 22:44:41 +0200 (CEST) Subject: [pypy-svn] r12718 - pypy/dist/pypy/documentation Message-ID: <20050521204441.8E1EC27B6D@code1.codespeak.net> Author: hpk Date: Sat May 21 22:44:41 2005 New Revision: 12718 Modified: pypy/dist/pypy/documentation/translation.txt Log: fixed SSA wording and linked it with the indeed pretty good wikipedia article carl suggested. also fixed formatting in that area (i think by now we are not using very-long-lines anymore) Modified: pypy/dist/pypy/documentation/translation.txt ============================================================================== --- pypy/dist/pypy/documentation/translation.txt (original) +++ pypy/dist/pypy/documentation/translation.txt Sat May 21 22:44:41 2005 @@ -23,18 +23,33 @@ Here are the steps we follow to translate a given program: -1. The complete program is imported. If needed, extra initialization is performed. Once this is done, the program must be present in memory is a form that is "static enough" in the sense of RPython_. - -2. The `Flow Object Space`_ processes the input program, turning each function independently into a `control flow graph`_ data structure recording sequences of basic operations in "single-style assignment". - -3. Optionally, the Annotator_ performs global type inference on the control flow graphs. Each variable gets annotated with an inferred type. - -4. The `RPython typer`_ can use the high-level types inferred by the Annotator to turn the operations in the control flow graphs into low-level operations over low-level types (close to the C types: struct, array, pointer...). - -5. One of the Code Generators (XXX not documented yet) turns the optionally annotated/typed flow graphs and produces a source file in a lower-level language: C_, LLVM_, `Common Lisp`_, Pyrex_, Java_, or `Python again`_ (this is used in PyPy to turn sufficiently RPythonic app-level code into interp-level code). +1. The complete program is imported. If needed, extra initialization is + performed. Once this is done, the program must be present in memory is + a form that is "static enough" in the sense of RPython_. + +2. The `Flow Object Space`_ processes the input program, turning each + function independently into a `control flow graph`_ data structure + recording sequences of basic operations in + static single assignment form `SSA`_. + +3. Optionally, the Annotator_ performs global type inference on the + control flow graphs. Each variable gets annotated with an inferred + type. + +4. The `RPython typer`_ can use the high-level types inferred by the + Annotator to turn the operations in the control flow graphs into + low-level operations over low-level types (close to the C types: struct, + array, pointer...). + + One of the Code Generators (XXX not documented yet) turns the + optionally annotated/typed flow graphs and produces a source file in + a lower-level language: C_, LLVM_, `Common Lisp`_, Pyrex_, Java_, or + `Python again`_ (this is used in PyPy to turn sufficiently RPythonic + app-level code into interp-level code). 6. This lower-level source file is compiled to produce an executable. +.. _`SSA`: http://en.wikipedia.org/wiki/Static_single_assignment_form .. _`translator.py`: http://codespeak.net/svn/pypy/dist/pypy/translator/translator.py .. _`play around`: getting_started.html#trying-out-the-translator .. _`Flow Object Space`: objspace.html#the-flow-object-space From arigo at codespeak.net Sat May 21 23:21:55 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Sat, 21 May 2005 23:21:55 +0200 (CEST) Subject: [pypy-svn] r12719 - in pypy/dist/pypy: rpython translator/c translator/c/test Message-ID: <20050521212155.8EFD427B6D@code1.codespeak.net> Author: arigo Date: Sat May 21 23:21:55 2005 New Revision: 12719 Modified: pypy/dist/pypy/rpython/lltypes.py pypy/dist/pypy/translator/c/database.py pypy/dist/pypy/translator/c/node.py pypy/dist/pypy/translator/c/test/test_database.py Log: Very strange code, but does the job. Generating variable-length, predefined global arrays in C is rather fun. Modified: pypy/dist/pypy/rpython/lltypes.py ============================================================================== --- pypy/dist/pypy/rpython/lltypes.py (original) +++ pypy/dist/pypy/rpython/lltypes.py Sat May 21 23:21:55 2005 @@ -27,7 +27,7 @@ def __str__(self): return self.__class__.__name__ - def _defl(self, parent=None): + def _defl(self, parent=None, parentindex=None): raise NotImplementedError def _freeze_(self): @@ -95,8 +95,8 @@ return "%s %s { %s }" % (self.__class__.__name__, self._name, self._str_fields()) - def _defl(self, parent=None): - return _struct(self, parent=parent) + def _defl(self, parent=None, parentindex=None): + return _struct(self, parent=parent, parentindex=parentindex) def _container_example(self): if self._arrayfld is None: @@ -173,7 +173,7 @@ def __str__(self): return self._name - def _defl(self, parent=None): + def _defl(self, parent=None, parentindex=None): return self._default _example = _defl @@ -211,7 +211,7 @@ def __str__(self): return 'ptr(%s) to %s' % (self._str_flags(), self.TO) - def _defl(self, parent=None): + def _defl(self, parent=None, parentindex=None): return _ptr(self, None) def _example(self): @@ -313,11 +313,16 @@ def parentlink(container): parent = container._check() if parent is not None: - assert isinstance(parent, _struct) - for name in parent._TYPE._names: - if getattr(parent, name) is container: - return parent, name - raise RuntimeError("lost ourselves") + return parent, container._wrparent_index +## if isinstance(parent, _struct): +## for name in parent._TYPE._names: +## if getattr(parent, name) is container: +## return parent, name +## raise RuntimeError("lost ourselves") +## if isinstance(parent, _array): +## raise TypeError("cannot fish a pointer to an array item or an " +## "inlined substructure of it") +## raise AssertionError("don't know about %r" % (parent,)) else: return None, None @@ -431,7 +436,7 @@ class _struct(object): _wrparent = None - def __init__(self, TYPE, n=None, parent=None): + def __init__(self, TYPE, n=None, parent=None, parentindex=None): self._TYPE = TYPE if n is not None and TYPE._arrayfld is None: raise TypeError("%r is not variable-sized" % (TYPE,)) @@ -439,15 +444,16 @@ raise TypeError("%r is variable-sized" % (TYPE,)) for fld, typ in TYPE._flds.items(): if isinstance(typ, Struct): - value = _struct(typ, parent=self) + value = _struct(typ, parent=self, parentindex=fld) elif fld == TYPE._arrayfld: - value = _array(typ, n, parent=self) + value = _array(typ, n, parent=self, parentindex=fld) else: value = typ._defl() setattr(self, fld, value) if parent is not None: self._wrparent_type = typeOf(parent) self._wrparent = weakref.ref(parent) + self._wrparent_index = parentindex def _check(self): if self._wrparent is not None: @@ -481,16 +487,18 @@ class _array(object): _wrparent = None - def __init__(self, TYPE, n, parent=None): + def __init__(self, TYPE, n, parent=None, parentindex=None): if not isinstance(n, int): raise TypeError, "array length must be an int" if n < 0: raise ValueError, "negative array length" self._TYPE = TYPE - self.items = [TYPE.OF._defl(parent=self) for j in range(n)] + self.items = [TYPE.OF._defl(parent=self, parentindex=j) + for j in range(n)] if parent is not None: self._wrparent_type = typeOf(parent) self._wrparent = weakref.ref(parent) + self._wrparent_index = parentindex def _check(self): if self._wrparent is not None: Modified: pypy/dist/pypy/translator/c/database.py ============================================================================== --- pypy/dist/pypy/translator/c/database.py (original) +++ pypy/dist/pypy/translator/c/database.py Sat May 21 23:21:55 2005 @@ -32,28 +32,33 @@ else register union ''') - def gettypedefnode(self, T): + def gettypedefnode(self, T, varlength=1): + if varlength <= 1: + varlength = 1 # it's C after all + key = T + else: + key = T, varlength try: - node = self.structdefnodes[T] + node = self.structdefnodes[key] except KeyError: if isinstance(T, Struct): node = StructDefNode(self, T) elif isinstance(T, Array): - node = ArrayDefNode(self, T) + node = ArrayDefNode(self, T, varlength) else: raise Exception("don't know about %r" % (T,)) - self.structdefnodes[T] = node + self.structdefnodes[key] = node self.structdeflist.append(node) return node - def gettype(self, T, who_asks=None): + def gettype(self, T, varlength=1, who_asks=None): if isinstance(T, Primitive): return PrimitiveType[T] elif isinstance(T, _PtrType): typename = self.gettype(T.TO) # who_asks not propagated return typename.replace('@', '*@') elif isinstance(T, (Struct, Array)): - node = self.gettypedefnode(T) + node = self.gettypedefnode(T, varlength=varlength) if who_asks is not None: who_asks.dependencies[node] = True return 'struct %s @' % node.name Modified: pypy/dist/pypy/translator/c/node.py ============================================================================== --- pypy/dist/pypy/translator/c/node.py (original) +++ pypy/dist/pypy/translator/c/node.py Sat May 21 23:21:55 2005 @@ -40,6 +40,10 @@ def c_struct_field_name(self, name): return self.prefix + name + def access_expr(self, baseexpr, fldname): + fldname = self.c_struct_field_name(fldname) + return '%s.%s' % (baseexpr, fldname) + def definition(self): yield 'struct %s {' % self.name if needs_refcount(self.STRUCT): @@ -51,18 +55,28 @@ class ArrayDefNode: - def __init__(self, db, ARRAY): + def __init__(self, db, ARRAY, varlength): self.ARRAY = ARRAY - self.name = db.namespace.uniquename('array') + if varlength == 1: + basename = 'array' + else: + basename = db.gettypedefnode(ARRAY).name + basename = '%s_len%d' % (basename, varlength) + self.name = db.namespace.uniquename(basename) self.dependencies = {} self.structname = db.gettype(ARRAY.OF, who_asks=self) + self.varlength = varlength + + def access_expr(self, baseexpr, index): + return '%s.items[%d]' % (baseexpr, index) def definition(self): yield 'struct %s {' % self.name if needs_refcount(self.ARRAY): yield '\tlong refcount;' yield '\tlong length;' - yield '\t%s;' % self.structname.replace('@', 'items[1]') + yield '\t%s;' % self.structname.replace('@', 'items[%d]' % + self.varlength) yield '};' @@ -74,27 +88,36 @@ self.obj = obj #self.dependencies = {} self.typename = db.gettype(T) #, who_asks=self) - parent, fldname = parentlink(obj) + self.implementationtypename = db.gettype(T, varlength=self.getlength()) + parent, parentindex = parentlink(obj) if parent is None: self.name = db.namespace.uniquename('g_' + self.basename()) self.globalcontainer = True else: + self.globalcontainer = False parentnode = db.getcontainernode(parent) defnode = db.gettypedefnode(parentnode.T) - fldname = defnode.c_struct_field_name(fldname) - self.name = parentnode.name + '.' + fldname - self.globalcontainer = False + self.name = defnode.access_expr(parentnode.name, parentindex) self.ptrname = '&%s' % self.name + if self.typename != self.implementationtypename: + self.ptrname = '((%s)(void*)%s)' % (self.typename.replace('@', '*'), + self.ptrname) def forward_declaration(self): - yield '%s; /* forward */' % self.typename.replace('@', self.name) + yield '%s; /* forward */' % ( + self.implementationtypename.replace('@', self.name)) def implementation(self): lines = list(self.initializationexpr()) - lines[0] = '%s = %s' % (self.typename.replace('@', self.name), lines[0]) + lines[0] = '%s = %s' % ( + self.implementationtypename.replace('@', self.name), + lines[0]) lines[-1] += ';' return lines + def getlength(self): + return 1 + class StructNode(ContainerNode): @@ -126,11 +149,28 @@ class ArrayNode(ContainerNode): + def basename(self): return 'array' + def enum_dependencies(self): - for i in range(len(self.obj)): - yield self.obj[i] + return self.obj.items + + def getlength(self): + return len(self.obj.items) + + def initializationexpr(self, prefix=''): + yield '{' + if needs_refcount(self.T): + yield '\t1,' + yield '\t%d,' % len(self.obj.items) + for j in range(len(self.obj.items)): + node = self.db.getcontainernode(self.obj.items[j]) + expr = '\n'.join(node.initializationexpr('%s%d.' % (prefix, j))) + expr += ',' + expr = expr.replace('\n', '\n\t') # indentation + yield '\t%s' % expr + yield '}' class FuncNode(ContainerNode): def basename(self): Modified: pypy/dist/pypy/translator/c/test/test_database.py ============================================================================== --- pypy/dist/pypy/translator/c/test/test_database.py (original) +++ pypy/dist/pypy/translator/c/test/test_database.py Sat May 21 23:21:55 2005 @@ -66,3 +66,22 @@ print '\n'.join(node.forward_declaration()) for node in db.globalcontainers(): print '\n'.join(node.implementation()) + +def test_codegen_2(): + db = LowLevelDatabase() + A = GcArray(('x', Signed)) + S = GcStruct('test', ('aptr', GcPtr(A))) + a = malloc(A, 3) + a[0].x = 100 + a[1].x = 101 + a[2].x = 102 + s = malloc(S) + s.aptr = a + db.get(s) + db.complete() + for node in db.structdeflist: + print '\n'.join(node.definition()) + for node in db.globalcontainers(): + print '\n'.join(node.forward_declaration()) + for node in db.globalcontainers(): + print '\n'.join(node.implementation()) From arigo at codespeak.net Sat May 21 23:40:32 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Sat, 21 May 2005 23:40:32 +0200 (CEST) Subject: [pypy-svn] r12720 - in pypy/dist/pypy/translator/c: . test Message-ID: <20050521214032.03E2027B6D@code1.codespeak.net> Author: arigo Date: Sat May 21 23:40:32 2005 New Revision: 12720 Modified: pypy/dist/pypy/translator/c/database.py pypy/dist/pypy/translator/c/node.py pypy/dist/pypy/translator/c/test/test_database.py Log: Can produce static variable-sized structures too. Modified: pypy/dist/pypy/translator/c/database.py ============================================================================== --- pypy/dist/pypy/translator/c/database.py (original) +++ pypy/dist/pypy/translator/c/database.py Sat May 21 23:40:32 2005 @@ -42,7 +42,7 @@ node = self.structdefnodes[key] except KeyError: if isinstance(T, Struct): - node = StructDefNode(self, T) + node = StructDefNode(self, T, varlength) elif isinstance(T, Array): node = ArrayDefNode(self, T, varlength) else: Modified: pypy/dist/pypy/translator/c/node.py ============================================================================== --- pypy/dist/pypy/translator/c/node.py (original) +++ pypy/dist/pypy/translator/c/node.py Sat May 21 23:40:32 2005 @@ -26,15 +26,23 @@ class StructDefNode: - def __init__(self, db, STRUCT): + def __init__(self, db, STRUCT, varlength=1): self.STRUCT = STRUCT - self.name = db.namespace.uniquename(STRUCT._name) + if varlength == 1: + basename = STRUCT._name + else: + basename = db.gettypedefnode(STRUCT).name + basename = '%s_len%d' % (basename, varlength) + self.name = db.namespace.uniquename(basename) self.dependencies = {} self.fields = [] self.prefix = somelettersfrom(STRUCT._name) + '_' for name in STRUCT._names: T = STRUCT._flds[name] - typename = db.gettype(T, who_asks=self) + if name == STRUCT._arrayfld: + typename = db.gettype(T, varlength=varlength, who_asks=self) + else: + typename = db.gettype(T, who_asks=self) self.fields.append((self.c_struct_field_name(name), typename)) def c_struct_field_name(self, name): @@ -55,7 +63,7 @@ class ArrayDefNode: - def __init__(self, db, ARRAY, varlength): + def __init__(self, db, ARRAY, varlength=1): self.ARRAY = ARRAY if varlength == 1: basename = 'array' @@ -128,6 +136,13 @@ for name in self.T._names: yield getattr(self.obj, name) + def getlength(self): + if self.T._arrayfld is None: + return 1 + else: + array = getattr(self.obj, self.T._arrayfld) + return len(array.items) + def initializationexpr(self, prefix=''): yield '{' if needs_refcount(self.T): @@ -172,6 +187,7 @@ yield '\t%s' % expr yield '}' + class FuncNode(ContainerNode): def basename(self): return self.obj._name Modified: pypy/dist/pypy/translator/c/test/test_database.py ============================================================================== --- pypy/dist/pypy/translator/c/test/test_database.py (original) +++ pypy/dist/pypy/translator/c/test/test_database.py Sat May 21 23:40:32 2005 @@ -85,3 +85,27 @@ print '\n'.join(node.forward_declaration()) for node in db.globalcontainers(): print '\n'.join(node.implementation()) + +def test_codegen_3(): + db = LowLevelDatabase() + A = GcStruct('varsizedstuff', ('x', Signed), ('y', Array(('i', Signed)))) + S = GcStruct('test', ('aptr', GcPtr(A)), + ('anitem', NonGcPtr(A.y.OF)), + ('anarray', NonGcPtr(A.y))) + a = malloc(A, 3) + a.x = 99 + a.y[0].i = 100 + a.y[1].i = 101 + a.y[2].i = 102 + s = malloc(S) + s.aptr = a + s.anitem = cast_flags(NonGcPtr(A.y.OF), a.y[1]) + s.anarray = cast_flags(NonGcPtr(A.y), a.y) + db.get(s) + db.complete() + for node in db.structdeflist: + print '\n'.join(node.definition()) + for node in db.globalcontainers(): + print '\n'.join(node.forward_declaration()) + for node in db.globalcontainers(): + print '\n'.join(node.implementation()) From arigo at codespeak.net Sun May 22 21:47:58 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Sun, 22 May 2005 21:47:58 +0200 (CEST) Subject: [pypy-svn] r12724 - pypy/dist/pypy/translator/c Message-ID: <20050522194758.5C8CF27B6D@code1.codespeak.net> Author: arigo Date: Sun May 22 21:47:58 2005 New Revision: 12724 Removed: pypy/dist/pypy/translator/c/repr.py pypy/dist/pypy/translator/c/struct.py Log: Old tentatives, no longer relevant. Deleted: /pypy/dist/pypy/translator/c/repr.py ============================================================================== --- /pypy/dist/pypy/translator/c/repr.py Sun May 22 21:47:58 2005 +++ (empty file) @@ -1,17 +0,0 @@ - -class Repr: - """Base class: a representation of a constant value of a specific type. - Each Repr instance knows how to generate C code that defines the - corresponding value, and which C expression can be used to read it. - """ - def __init__(self, db, lowleveltype, value): - self.db = db - self.lowleveltype = lowleveltype - self.value = value - - def follow_references(self): - pass - - def follow_type_references(db, lowleveltype): - pass - follow_type_references = staticmethod(follow_type_references) Deleted: /pypy/dist/pypy/translator/c/struct.py ============================================================================== --- /pypy/dist/pypy/translator/c/struct.py Sun May 22 21:47:58 2005 +++ (empty file) @@ -1,12 +0,0 @@ -from pypy.rpython.lltypes import * -from pypy.translator.c.repr import Repr - - -class ReprStruct(Repr): - - def follow_type_references(db, lowleveltype): - T = lowleveltype.TO - assert isinstance(T, Struct) - for name in T._names: - db.getlltype(T._flds[name]) - follow_type_references = staticmethod(follow_type_references) From arigo at codespeak.net Sun May 22 23:20:23 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Sun, 22 May 2005 23:20:23 +0200 (CEST) Subject: [pypy-svn] r12726 - in pypy/dist/pypy: rpython translator/c translator/c/test Message-ID: <20050522212023.89A6F27B6D@code1.codespeak.net> Author: arigo Date: Sun May 22 23:20:23 2005 New Revision: 12726 Modified: pypy/dist/pypy/rpython/lltypes.py pypy/dist/pypy/translator/c/database.py pypy/dist/pypy/translator/c/node.py pypy/dist/pypy/translator/c/test/test_database.py Log: Support for functions in c/database and c/node. Missing: writing the body itself (duh). Modified: pypy/dist/pypy/rpython/lltypes.py ============================================================================== --- pypy/dist/pypy/rpython/lltypes.py (original) +++ pypy/dist/pypy/rpython/lltypes.py Sun May 22 23:20:23 2005 @@ -311,7 +311,7 @@ return val def parentlink(container): - parent = container._check() + parent = container._parentstructure() if parent is not None: return parent, container._wrparent_index ## if isinstance(parent, _struct): @@ -455,18 +455,21 @@ self._wrparent = weakref.ref(parent) self._wrparent_index = parentindex - def _check(self): + def _parentstructure(self): if self._wrparent is not None: parent = self._wrparent() if parent is None: raise RuntimeError("accessing substructure %r,\n" "but already garbage collected parent %r" % (self, self._wrparent_type)) - else: - parent._check() - return parent + return parent return None + def _check(self): + parent = self._parentstructure() + if parent is not None: + parent._check() + def __repr__(self): return '<%s>' % (self,) @@ -500,18 +503,21 @@ self._wrparent = weakref.ref(parent) self._wrparent_index = parentindex - def _check(self): + def _parentstructure(self): if self._wrparent is not None: parent = self._wrparent() if parent is None: raise RuntimeError("accessing subarray %r,\n" "but already garbage collected parent %r" % (self, self._wrparent_type)) - else: - parent._check() - return parent + return parent return None + def _check(self): + parent = self._parentstructure() + if parent is not None: + parent._check() + def __repr__(self): return '<%s>' % (self,) @@ -526,6 +532,9 @@ self._callable = None self.__dict__.update(attrs) + def _parentstructure(self): + return None + def _check(self): if self._callable is None: raise RuntimeError,"calling undefined function" @@ -545,3 +554,8 @@ raise TypeError, "malloc for Structs and Arrays only" return _ptr(GcPtr(T), o) +def function(TYPE, name, **attrs): + if not isinstance(TYPE, FuncType): + raise TypeError, "function() for FuncTypes only" + o = _func(TYPE, _name=name, **attrs) + return _ptr(NonGcPtr(TYPE), o) Modified: pypy/dist/pypy/translator/c/database.py ============================================================================== --- pypy/dist/pypy/translator/c/database.py (original) +++ pypy/dist/pypy/translator/c/database.py Sun May 22 23:20:23 2005 @@ -1,12 +1,12 @@ from pypy.translator.gensupp import NameManager from pypy.rpython.lltypes import Primitive, _PtrType, typeOf -from pypy.rpython.lltypes import Struct, Array, FuncType, PyObject +from pypy.rpython.lltypes import Struct, Array, FuncType, PyObject, Void from pypy.rpython.lltypes import ContainerType from pypy.rpython.typer import PyObjPtr from pypy.objspace.flow.model import Constant from pypy.translator.c.primitive import PrimitiveName, PrimitiveType from pypy.translator.c.node import StructDefNode, ArrayDefNode -from pypy.translator.c.node import ContainerNodeClass +from pypy.translator.c.node import ContainerNodeClass, cdecl # ____________________________________________________________ @@ -51,7 +51,7 @@ self.structdeflist.append(node) return node - def gettype(self, T, varlength=1, who_asks=None): + def gettype(self, T, varlength=1, who_asks=None, argnames=[]): if isinstance(T, Primitive): return PrimitiveType[T] elif isinstance(T, _PtrType): @@ -62,16 +62,20 @@ if who_asks is not None: who_asks.dependencies[node] = True return 'struct %s @' % node.name - elif isinstance(T, PyObject): + elif T == PyObject: return 'PyObject' elif isinstance(T, FuncType): resulttype = self.gettype(T.RESULT) - argtypes = ', '.join([self.gettype(ARG) for ARG in T.ARGS - if ARG != Void]) - if argtypes: - argtypes = argtypes.replace('@', '') - else: - argtypes = 'void' + argtypes = [] + for i in range(len(T.ARGS)): + if T.ARGS[i] != Void: + argtype = self.gettype(T.ARGS[i]) + try: + argname = argnames[i] + except IndexError: + argname = '' + argtypes.append(cdecl(argtype, argname)) + argtypes = ', '.join(argtypes) or 'void' return resulttype.replace('@', '(@)(%s)' % argtypes) else: raise Exception("don't know about type %r" % (T,)) @@ -92,8 +96,11 @@ if isinstance(T, Primitive): return PrimitiveName[T](obj) elif isinstance(T, _PtrType): - node = self.getcontainernode(obj._obj) - return node.ptrname + if obj: # test if the ptr is non-NULL + node = self.getcontainernode(obj._obj) + return node.ptrname + else: + return 'NULL' else: raise Exception("don't know about %r" % (obj,)) @@ -109,3 +116,25 @@ for node in self.containerlist: if node.globalcontainer: yield node + + def write_all_declarations(self, f): + print >> f + print >> f, '/********************************************************/' + print >> f, '/*** Structures definition ***/' + print >> f + for node in self.structdeflist: + print >> f, '\n'.join(node.definition()) + print >> f + print >> f, '/********************************************************/' + print >> f, '/*** Forward declarations ***/' + print >> f + for node in self.globalcontainers(): + print >> f, '\n'.join(node.forward_declaration()) + + def write_all_implementations(self, f): + print >> f + print >> f, '/********************************************************/' + print >> f, '/*** Implementations ***/' + print >> f + for node in self.globalcontainers(): + print >> f, '\n'.join(node.implementation()) Modified: pypy/dist/pypy/translator/c/node.py ============================================================================== --- pypy/dist/pypy/translator/c/node.py (original) +++ pypy/dist/pypy/translator/c/node.py Sun May 22 23:20:23 2005 @@ -57,7 +57,7 @@ if needs_refcount(self.STRUCT): yield '\tlong refcount;' for name, typename in self.fields: - yield '\t%s;' % typename.replace('@', name) + yield '\t%s;' % cdecl(typename, name) yield '};' @@ -83,8 +83,7 @@ if needs_refcount(self.ARRAY): yield '\tlong refcount;' yield '\tlong length;' - yield '\t%s;' % self.structname.replace('@', 'items[%d]' % - self.varlength) + yield '\t%s;' % cdecl(self.structname, 'items[%d]' % self.varlength) yield '};' @@ -113,12 +112,12 @@ def forward_declaration(self): yield '%s; /* forward */' % ( - self.implementationtypename.replace('@', self.name)) + cdecl(self.implementationtypename, self.name)) def implementation(self): lines = list(self.initializationexpr()) lines[0] = '%s = %s' % ( - self.implementationtypename.replace('@', self.name), + cdecl(self.implementationtypename, self.name), lines[0]) lines[-1] += ';' return lines @@ -188,11 +187,56 @@ yield '}' +# XXX move FuncNode to funcdef.py +from pypy.objspace.flow.model import * + class FuncNode(ContainerNode): + + def __init__(self, db, T, obj): + graph = obj.graph # only user-defined functions with graphs for now + argnames = [v.name for v in graph.getargs()] + self.db = db + self.T = T + self.obj = obj + #self.dependencies = {} + self.typename = db.gettype(T) #, who_asks=self) + self.implementationtypename = db.gettype(T, argnames=argnames) + self.name = db.namespace.uniquename('g_' + self.basename()) + self.globalcontainer = True + self.ptrname = self.name + # collect all variables and constants used in the body, + # and get their types now + result = [] + def visit(block): + if isinstance(block, Block): + result.extend(block.inputargs) + for op in block.operations: + result.extend(op.args) + for link in block.exits: + result.extend(link.args) + traverse(visit, graph) + self.varmap = {} + for v in uniqueitems(result): + T = v.concretetype + self.varmap[v] = self.db.gettype(T) + def basename(self): return self.obj._name + + def allvariables(self): + return [v for v in self.varmap if isinstance(v, Variable)] + + def allconstants(self): + return [v for v in self.varmap if isinstance(v, Constant)] + def enum_dependencies(self): - Booom + return [c.value for c in self.allconstants()] + + def implementation(self): + yield '%s {' % cdecl(self.implementationtypename, self.name) + yield '\tlots-of-strange-code' + yield '}' + class PyObjectNode(ContainerNode): basename = 'BOOOM' @@ -206,3 +250,16 @@ FuncType: FuncNode, PyObject: PyObjectNode, } + +# +# helper +# +def cdecl(ctype, cname): + """ + Produce a C declaration from a 'type template' and an identifier. + The type template must contain a '@' sign at the place where the + name should be inserted, according to the strange C syntax rules. + """ + # the (@) case is for functions, where if there is a plain (@) around + # the function name, we don't need the very confusing parenthesis + return ctype.replace('(@)', '@').replace('@', cname).strip() Modified: pypy/dist/pypy/translator/c/test/test_database.py ============================================================================== --- pypy/dist/pypy/translator/c/test/test_database.py (original) +++ pypy/dist/pypy/translator/c/test/test_database.py Sun May 22 23:20:23 2005 @@ -1,7 +1,8 @@ -import autopath +import autopath, sys from pypy.rpython.lltypes import * from pypy.translator.c.database import LowLevelDatabase -from pypy.objspace.flow.model import Constant +from pypy.objspace.flow.model import Constant, Variable, SpaceOperation +from pypy.objspace.flow.model import Block, Link, FunctionGraph from pypy.rpython.lltypes import Struct, Array, malloc @@ -60,12 +61,8 @@ s.p = cast_flags(NonGcPtr(U), s.u) db.get(s) db.complete() - for node in db.structdeflist: - print '\n'.join(node.definition()) - for node in db.globalcontainers(): - print '\n'.join(node.forward_declaration()) - for node in db.globalcontainers(): - print '\n'.join(node.implementation()) + db.write_all_declarations(sys.stdout) + db.write_all_implementations(sys.stdout) def test_codegen_2(): db = LowLevelDatabase() @@ -79,12 +76,8 @@ s.aptr = a db.get(s) db.complete() - for node in db.structdeflist: - print '\n'.join(node.definition()) - for node in db.globalcontainers(): - print '\n'.join(node.forward_declaration()) - for node in db.globalcontainers(): - print '\n'.join(node.implementation()) + db.write_all_declarations(sys.stdout) + db.write_all_implementations(sys.stdout) def test_codegen_3(): db = LowLevelDatabase() @@ -103,9 +96,40 @@ s.anarray = cast_flags(NonGcPtr(A.y), a.y) db.get(s) db.complete() - for node in db.structdeflist: - print '\n'.join(node.definition()) - for node in db.globalcontainers(): - print '\n'.join(node.forward_declaration()) - for node in db.globalcontainers(): - print '\n'.join(node.implementation()) + db.write_all_declarations(sys.stdout) + db.write_all_implementations(sys.stdout) + +def test_func_simple(): + # -------------------- flowgraph building -------------------- + # def f(x): + # return x+1 + x = Variable("x") + x.concretetype = Signed + result = Variable("result") + result.concretetype = Signed + one = Constant(1) + one.concretetype = Signed + op = SpaceOperation("int_add", [x, one], result) + block = Block([x]) + graph = FunctionGraph("f", block) + block.operations.append(op) + block.closeblock(Link([result], graph.returnblock)) + graph.getreturnvar().concretetype = Signed + # -------------------- end -------------------- + + F = FuncType([Signed], Signed) + f = function(F, "f", graph=graph) + db = LowLevelDatabase() + db.get(f) + db.complete() + db.write_all_declarations(sys.stdout) + db.write_all_implementations(sys.stdout) + + S = GcStruct('testing', ('fptr', NonGcPtr(F))) + s = malloc(S) + s.fptr = f + db = LowLevelDatabase() + db.get(s) + db.complete() + db.write_all_declarations(sys.stdout) + db.write_all_implementations(sys.stdout) From ac at codespeak.net Mon May 23 10:51:22 2005 From: ac at codespeak.net (ac at codespeak.net) Date: Mon, 23 May 2005 10:51:22 +0200 (CEST) Subject: [pypy-svn] r12731 - pypy/dist/lib-python Message-ID: <20050523085122.24CBB27B5D@code1.codespeak.net> Author: ac Date: Mon May 23 10:51:21 2005 New Revision: 12731 Modified: pypy/dist/lib-python/conftest.py Log: TestCase methods have there own machinery for calling setUp/tearDown. Modified: pypy/dist/lib-python/conftest.py ============================================================================== --- pypy/dist/lib-python/conftest.py (original) +++ pypy/dist/lib-python/conftest.py Mon May 23 10:51:21 2005 @@ -131,11 +131,7 @@ return namemethodlist, doctestlist def run_testcase_method(method): - method.setUp() - try: - method() - finally: - method.tearDown() + method() def set_argv(filename): sys.argv[:] = ['python', filename] From ac at codespeak.net Mon May 23 13:05:59 2005 From: ac at codespeak.net (ac at codespeak.net) Date: Mon, 23 May 2005 13:05:59 +0200 (CEST) Subject: [pypy-svn] r12735 - in pypy/dist/pypy: documentation interpreter lib module/__builtin__ module/unicodedata objspace/std objspace/std/test Message-ID: <20050523110559.E32FD27B8D@code1.codespeak.net> Author: ac Date: Mon May 23 13:05:59 2005 New Revision: 12735 Added: pypy/dist/pypy/module/unicodedata/ (props changed) - copied from r12617, pypy/branch/non-fake-unicode/pypy/module/unicodedata/ Modified: pypy/dist/pypy/documentation/objspace.txt pypy/dist/pypy/interpreter/baseobjspace.py pypy/dist/pypy/lib/_formatting.py pypy/dist/pypy/module/__builtin__/__init__.py pypy/dist/pypy/module/__builtin__/app_misc.py pypy/dist/pypy/module/__builtin__/compiling.py pypy/dist/pypy/module/__builtin__/operation.py pypy/dist/pypy/module/unicodedata/__init__.py (contents, props changed) pypy/dist/pypy/module/unicodedata/functions.py (props changed) pypy/dist/pypy/module/unicodedata/generate_unicodedb.py (props changed) pypy/dist/pypy/module/unicodedata/unicodedb.py (props changed) pypy/dist/pypy/objspace/std/floattype.py pypy/dist/pypy/objspace/std/inttype.py pypy/dist/pypy/objspace/std/longtype.py pypy/dist/pypy/objspace/std/objspace.py pypy/dist/pypy/objspace/std/test/test_unicodestring.py pypy/dist/pypy/objspace/std/unicodeobject.py pypy/dist/pypy/objspace/std/unicodetype.py Log: Merge the 'non-fake-unicode' branch. Modified: pypy/dist/pypy/documentation/objspace.txt ============================================================================== --- pypy/dist/pypy/documentation/objspace.txt (original) +++ pypy/dist/pypy/documentation/objspace.txt Mon May 23 13:05:59 2005 @@ -93,6 +93,9 @@ **newstring(asciilist):** Creates a string from a list of wrapped integers. +**newunicode(codelist):** + Creates a unicode string from a list of wrapped integers. + Conversions from Application Level to Interpreter Level ---------------------------------------------------------- Modified: pypy/dist/pypy/interpreter/baseobjspace.py ============================================================================== --- pypy/dist/pypy/interpreter/baseobjspace.py (original) +++ pypy/dist/pypy/interpreter/baseobjspace.py Mon May 23 13:05:59 2005 @@ -129,6 +129,7 @@ w_builtin = self.wrap(self.builtin) self.setitem(w_modules, w_name, w_builtin) self.setitem(self.builtin.w_dict, self.wrap('__builtins__'), w_builtin) + self.setbuiltinmodule('unicodedata') # XXX we need to resolve unwrapping issues to # make this the default _sre module @@ -532,6 +533,7 @@ # newtuple([w_1, w_2,...]) -> w_tuple # newlist([w_1, w_2,...]) -> w_list # newstring([w_1, w_2,...]) -> w_string from ascii numbers (bytes) +# newunicode([w_1, w_2,...]) -> w_unicode from numbers # newdict([(w_key,w_value),...]) -> w_dict # newslice(w_start,w_stop,w_step) -> w_slice # call_args(w_obj,Arguments()) -> w_result @@ -549,6 +551,7 @@ 'newtuple', 'newlist', 'newstring', + 'newunicode', 'newdict', 'newslice', 'call_args' Modified: pypy/dist/pypy/lib/_formatting.py ============================================================================== --- pypy/dist/pypy/lib/_formatting.py (original) +++ pypy/dist/pypy/lib/_formatting.py Mon May 23 13:05:59 2005 @@ -6,6 +6,7 @@ # (1) rounding isn't always right (see comments in _float_formatting). # (2) something goes wrong in the f_alt case of %g handling. # (3) it's really, really slow. +import sys class _Flags(object): def __repr__(self): @@ -103,6 +104,9 @@ return (c, flags, width, prec, value) +class NeedUnicodeFormattingError(Exception): + pass + class Formatter(object): def __init__(self, char, flags, width, prec, value): self.char = char @@ -314,6 +318,9 @@ v = self.value if len(v) != 1: raise TypeError, "%c requires int or char" + + elif isinstance(self.value, unicode): + raise NeedUnicodeFormattingError else: i = maybe_int(self.value) if not 0 <= i <= 255: @@ -323,8 +330,15 @@ self.prec = None return self.std_wp(v) +class StringFormatter(Formatter): + def format(self): + if isinstance(self.value, unicode): + raise NeedUnicodeFormattingError + return self.std_wp(str(self.value)) + -format_registry = { + +str_format_registry = { 'd':IntFormatter, 'i':IntFormatter, 'o':OctFormatter, @@ -338,13 +352,61 @@ 'g':FloatGFormatter, 'G':FloatGFormatter, 'c':CharFormatter, - 's':funcFormatter(str), + 's':StringFormatter, 'r':funcFormatter(repr), # this *can* get accessed, by e.g. '%()4%'%{'':1}. # The usual %% case has to be handled specially as it # doesn't consume a value. '%':funcFormatter(lambda x:'%'), } + +class UnicodeStringFormatter(Formatter): + def format(self): + if isinstance(self.value, unicode): + return self.std_wp(self.value) + return self.std_wp(str(self.value)) + +class UnicodeCharFormatter(Formatter): + def format(self): + if isinstance(self.value, unicode): + v = self.value + if len(v) != 1: + raise TypeError, "%c requires int or unicode char" + elif isinstance(self.value, str): + v = unicode(self.value) + if len(v) != 1: + raise TypeError, "%c requires int or unicode char" + else: + i = maybe_int(self.value) + if not 0 <= i <= sys.maxunicode: + raise OverflowError("OverflowError: unsigned byte " + "integer is greater than maximum") + v = unichr(i) + self.prec = None + return self.std_wp(v) + +unicode_format_registry = { + u'd':IntFormatter, + u'i':IntFormatter, + u'o':OctFormatter, + u'u':IntFormatter, + u'x':HexFormatter, + u'X':HexFormatter, + u'e':FloatEFormatter, + u'E':FloatEFormatter, + u'f':FloatFFormatter, + u'F':FloatFFormatter, + u'g':FloatGFormatter, + u'G':FloatGFormatter, + u'c':UnicodeCharFormatter, + u's':UnicodeStringFormatter, + u'r':funcFormatter(repr), + # this *can* get accessed, by e.g. '%()4%'%{'':1}. + # The usual %% case has to be handled specially as it + # doesn't consume a value. + u'%':funcFormatter(lambda x:u'%'), + } + del funcFormatter # don't irritate flow space @@ -375,7 +437,12 @@ return self.fmt[i:j] -def format(fmt, values, valuedict=None): +def format(fmt, values, valuedict=None, do_unicode=False): + if do_unicode: + format_registry = unicode_format_registry + else: + format_registry = str_format_registry + fmtiter = FmtIter(fmt) valueiter = iter(values) r = [] @@ -394,7 +461,20 @@ # so let's be explicit about the args: # r.append(f(*t).format()) char, flags, width, prec, value = t - r.append(f(char, flags, width, prec, value).format()) + try: + r.append(f(char, flags, width, prec, value).format()) + except NeedUnicodeFormattingError: + # Switch to using the unicode formatters and retry. + do_unicode = True + format_registry = unicode_format_registry + try: + f = format_registry[t[0]] + except KeyError: + raise ValueError("unsupported format character " + "'%s' (0x%x) at index %d" + %(t[0], ord(t[0]), fmtiter.i-1)) + r.append(f(char, flags, width, prec, value).format()) + else: # efficiency hack: r.append(c + fmtiter.skip_to_fmt()) @@ -408,5 +488,7 @@ if valuedict is None: raise TypeError('not all arguments converted ' 'during string formatting') + if do_unicode: + return u''.join(r) return ''.join(r) Modified: pypy/dist/pypy/module/__builtin__/__init__.py ============================================================================== --- pypy/dist/pypy/module/__builtin__/__init__.py (original) +++ pypy/dist/pypy/module/__builtin__/__init__.py Mon May 23 13:05:59 2005 @@ -47,7 +47,6 @@ 'complex' : 'app_complex.complex', 'intern' : 'app_misc.intern', - 'unichr' : 'app_misc.unichr', 'buffer' : 'app_buffer.buffer', 'reload' : 'app_misc.reload', } @@ -64,7 +63,7 @@ 'object' : '(space.w_object)', 'file' : '(space.wrap(file))', 'open' : '(space.wrap(file))', - 'unicode' : '(space.wrap(unicode))', # XXX faked + 'unicode' : '(space.w_unicode)', # old-style classes dummy support '_classobj' : 'space.w_classobj', @@ -76,6 +75,7 @@ # interp-level function definitions 'abs' : 'operation.abs', 'chr' : 'operation.chr', + 'unichr' : 'operation.unichr', 'len' : 'operation.len', 'ord' : 'operation.ord', 'pow' : 'operation.pow', Modified: pypy/dist/pypy/module/__builtin__/app_misc.py ============================================================================== --- pypy/dist/pypy/module/__builtin__/app_misc.py (original) +++ pypy/dist/pypy/module/__builtin__/app_misc.py Mon May 23 13:05:59 2005 @@ -11,13 +11,6 @@ return _stringtable.setdefault(s,s) -def unichr(code): - import sys - if (code < 0 or code > sys.maxunicode): - raise ValueError('unichr() arg not in range(%#x)'%(sys.maxunicode + 1)) - return unicode('\\U%08x' %(code), 'unicode-escape') - - def reload(module): import imp, sys, errno Modified: pypy/dist/pypy/module/__builtin__/compiling.py ============================================================================== --- pypy/dist/pypy/module/__builtin__/compiling.py (original) +++ pypy/dist/pypy/module/__builtin__/compiling.py Mon May 23 13:05:59 2005 @@ -9,7 +9,7 @@ def compile(space, w_source, filename, mode, flags=0, dont_inherit=0): if space.is_true(space.isinstance(w_source, space.w_unicode)): - str_ = space.unwrap(w_source) # xxx generic unwrap + str_ = u''.join(w_source._value) # Bad exposing of unicode internals else: str_ = space.str_w(w_source) Modified: pypy/dist/pypy/module/__builtin__/operation.py ============================================================================== --- pypy/dist/pypy/module/__builtin__/operation.py (original) +++ pypy/dist/pypy/module/__builtin__/operation.py Mon May 23 13:05:59 2005 @@ -15,6 +15,9 @@ w_character = space.newstring([w_ascii]) return w_character +def unichr(space, w_code): + return space.newunicode([w_code]) + def len(space, w_obj): "len(object) -> integer\n\nReturn the number of items of a sequence or mapping." return space.len(w_obj) Modified: pypy/dist/pypy/module/unicodedata/__init__.py ============================================================================== --- pypy/branch/non-fake-unicode/pypy/module/unicodedata/__init__.py (original) +++ pypy/dist/pypy/module/unicodedata/__init__.py Mon May 23 13:05:59 2005 @@ -1,6 +1,6 @@ -from pypy.interpreter.lazymodule import LazyModule +from pypy.interpreter.mixedmodule import MixedModule -class Module(LazyModule): +class Module(MixedModule): appleveldefs = { } interpleveldefs = { Modified: pypy/dist/pypy/objspace/std/floattype.py ============================================================================== --- pypy/dist/pypy/objspace/std/floattype.py (original) +++ pypy/dist/pypy/objspace/std/floattype.py Mon May 23 13:05:59 2005 @@ -1,5 +1,6 @@ from pypy.objspace.std.stdtypedef import * from pypy.interpreter.error import OperationError +from pypy.objspace.std.strutil import ParseStringError def descr__new__(space, w_floattype, w_x=0.0): from pypy.objspace.std.floatobject import W_FloatObject @@ -10,6 +11,14 @@ except ValueError, e: raise OperationError(space.w_ValueError, space.wrap(str(e))) + elif space.is_true(space.isinstance(w_value, space.w_unicode)): + try: + # XXX can produce unwrapped long + from unicodeobject import unicode_to_decimal_w + value = float(unicode_to_decimal_w(space, w_value)) + except ParseStringError, e: + raise OperationError(space.w_ValueError, + space.wrap(e.msg)) else: w_obj = space.float(w_value) if space.is_true(space.is_(w_floattype, space.w_float)): Modified: pypy/dist/pypy/objspace/std/inttype.py ============================================================================== --- pypy/dist/pypy/objspace/std/inttype.py (original) +++ pypy/dist/pypy/objspace/std/inttype.py Mon May 23 13:05:59 2005 @@ -28,6 +28,15 @@ space.wrap(e.msg)) except ParseStringOverflowError, e: w_longval = retry_to_w_long(space, e.parser) + elif space.is_true(space.isinstance(w_value, space.w_unicode)): + try: + from unicodeobject import unicode_to_decimal_w + value = string_to_int(space, unicode_to_decimal_w(space, w_value)) + except ParseStringError, e: + raise OperationError(space.w_ValueError, + space.wrap(e.msg)) + except ParseStringOverflowError, e: + w_longval = retry_to_w_long(space, e.parser) else: # otherwise, use the __int__() method w_obj = space.int(w_value) Modified: pypy/dist/pypy/objspace/std/longtype.py ============================================================================== --- pypy/dist/pypy/objspace/std/longtype.py (original) +++ pypy/dist/pypy/objspace/std/longtype.py Mon May 23 13:05:59 2005 @@ -18,6 +18,14 @@ except ParseStringError, e: raise OperationError(space.w_ValueError, space.wrap(e.msg)) + elif space.is_true(space.isinstance(w_value, space.w_unicode)): + try: + # XXX can produce unwrapped long + from unicodeobject import unicode_to_decimal_w + value = string_to_long(unicode_to_decimal_w(space, w_value)) + except ParseStringError, e: + raise OperationError(space.w_ValueError, + space.wrap(e.msg)) else: # otherwise, use the __long__() method w_obj = space.long(w_value) Modified: pypy/dist/pypy/objspace/std/objspace.py ============================================================================== --- pypy/dist/pypy/objspace/std/objspace.py (original) +++ pypy/dist/pypy/objspace/std/objspace.py Mon May 23 13:05:59 2005 @@ -199,6 +199,8 @@ return W_IntObject(self, x) if isinstance(x, str): return W_StringObject(self, x) + if isinstance(x, unicode): + return W_UnicodeObject(self, [u for u in x]) if isinstance(x, dict): items_w = [(self.wrap(k), self.wrap(v)) for (k, v) in x.iteritems()] return W_DictObject(self, items_w) @@ -283,6 +285,14 @@ self.wrap("character code not in range(256)")) return W_StringObject(self, ''.join(chars)) + def newunicode(self, chars_w): + try: + chars = [unichr(self.int_w(w_c)) for w_c in chars_w] + except ValueError, e: # unichr(out-of-range) + raise OperationError(self.w_ValueError, + self.wrap("character code not in range(0x110000)")) + return W_UnicodeObject(self, chars) + def newseqiter(self, w_obj): return W_SeqIterObject(self, w_obj) Modified: pypy/dist/pypy/objspace/std/test/test_unicodestring.py ============================================================================== --- pypy/dist/pypy/objspace/std/test/test_unicodestring.py (original) +++ pypy/dist/pypy/objspace/std/test/test_unicodestring.py Mon May 23 13:05:59 2005 @@ -38,3 +38,29 @@ def test_contains(self): assert u'a' in 'abc' assert 'a' in u'abc' + + def test_splitlines(self): + assert u''.splitlines() == [] + assert u''.splitlines(1) == [] + assert u'\n'.splitlines() == [u''] + assert u'a'.splitlines() == [u'a'] + assert u'one\ntwo'.splitlines() == [u'one', u'two'] + assert u'\ntwo\nthree'.splitlines() == [u'', u'two', u'three'] + assert u'\n\n'.splitlines() == [u'', u''] + assert u'a\nb\nc'.splitlines(1) == [u'a\n', u'b\n', u'c'] + assert u'\na\nb\n'.splitlines(1) == [u'\n', u'a\n', u'b\n'] + + def test_zfill(self): + assert u'123'.zfill(6) == u'000123' + assert u'123'.zfill(2) == u'123' + assert u'123'.zfill(6) == u'000123' + assert u'+123'.zfill(2) == u'+123' + assert u'+123'.zfill(4) == u'+123' + assert u'+123'.zfill(6) == u'+00123' + + def test_split(self): + assert (u'this is the split function'.split() == + [u'this', u'is', u'the', u'split', u'function']) + assert (u'this!is!the!split!function'.split('!') == + [u'this', u'is', u'the', u'split', u'function']) + Modified: pypy/dist/pypy/objspace/std/unicodeobject.py ============================================================================== --- pypy/dist/pypy/objspace/std/unicodeobject.py (original) +++ pypy/dist/pypy/objspace/std/unicodeobject.py Mon May 23 13:05:59 2005 @@ -1,129 +1,824 @@ from pypy.objspace.std.objspace import * -from pypy.objspace.std.fake import fake_type, wrap_exception +from pypy.interpreter import gateway +from pypy.objspace.std.fake import wrap_exception from pypy.objspace.std.stringobject import W_StringObject -from pypy.objspace.std.strutil import string_to_w_long, ParseStringError +from pypy.objspace.std.noneobject import W_NoneObject +from pypy.objspace.std.sliceobject import W_SliceObject +from pypy.objspace.std import slicetype +from pypy.objspace.std.strutil import string_to_int, string_to_long, ParseStringError +from pypy.rpython.rarithmetic import intmask +from pypy.module.unicodedata import unicodedb + +class W_UnicodeObject(W_Object): + from pypy.objspace.std.unicodetype import unicode_typedef as typedef + + def __init__(w_self, space, unicodechars): + W_Object.__init__(w_self, space) + w_self._value = unicodechars + if len(unicodechars) == 0: + w_self.w_hash = space.wrap(0) + else: + w_self.w_hash = None + def __repr__(w_self): + """ representation for debugging purposes """ + return "%s(%r)" % (w_self.__class__.__name__, w_self._value) -W_UnicodeObject = fake_type(unicode) +registerimplementation(W_UnicodeObject) # Helper for converting int/long -import unicodedata def unicode_to_decimal_w(space, w_unistr): - result = [] - for uchr in space.unwrap(w_unistr): - if uchr.isspace(): - result.append(' ') + unistr = w_unistr._value + result = ['\0'] * len(unistr) + digits = [ '0', '1', '2', '3', '4', + '5', '6', '7', '8', '9'] + for i in xrange(len(unistr)): + uchr = ord(unistr[i]) + if unicodedb.isspace(uchr): + result[i] = ' ' continue try: - result.append(chr(ord('0') + unicodedata.decimal(uchr))) - continue - except ValueError: - ch = ord(uchr) - if 0 < ch < 256: - result.append(chr(ch)) - continue - raise OperationError(space.w_UnicodeEncodeError, space.wrap('invalid decimal Unicode string')) + result[i] = digits[unicodedb.decimal(uchr)] + except KeyError: + if 0 < uchr < 256: + result[i] = chr(uchr) + else: + raise OperationError(space.w_UnicodeEncodeError, space.wrap('invalid decimal Unicode string')) return ''.join(result) # string-to-unicode delegation def delegate_String2Unicode(w_str): space = w_str.space - return W_UnicodeObject(space, unicode(space.str_w(w_str))) + return space.call_function(space.w_unicode, w_str) def str_w__Unicode(space, w_uni): - return space.str_w(space.call_method(w_uni, 'encode')) + return space.str_w(space.str(w_uni)) -def eq__Unicode_ANY(space, w_uni, w_other): - try: - return space.newbool(space.unwrap(w_uni) == space.unwrap(w_other)) - except: - wrap_exception(space) +def repr__Unicode(space, w_uni): + return space.wrap(repr(u''.join(w_uni._value))) -def ne__Unicode_ANY(space, w_uni, w_other): - try: - return space.newbool(space.unwrap(w_uni) != space.unwrap(w_other)) - except: - wrap_exception(space) +def str__Unicode(space, w_uni): + return space.call_method(w_uni, 'encode') +def cmp__Unicode_Unicode(space, w_left, w_right): + left = w_left._value + right = w_right._value + for i in range(min(len(left), len(right))): + test = ord(left[i]) - ord(right[i]) + if test < 0: + return space.wrap(-1) + if test > 0: + return space.wrap(1) + + test = len(left) - len(right) + if test < 0: + return space.wrap(-1) + if test > 0: + return space.wrap(1) + return space.wrap(0) -def lt__Unicode_ANY(space, w_uni, w_other): +def cmp__Unicode_ANY(space, w_left, w_right): try: - return space.newbool(space.unwrap(w_uni) < space.unwrap(w_other)) + w_right = space.call_function(space.w_unicode, w_right) except: - wrap_exception(space) + return space.wrap(1) + return space.cmp(w_left, w_right) -def gt__Unicode_ANY(space, w_uni, w_other): - try: - return space.newbool(space.unwrap(w_uni) > space.unwrap(w_other)) - except: - wrap_exception(space) +def ord__Unicode(space, w_uni): + if len(w_uni._value) != 1: + raise OperationError(space.w_TypeError, space.wrap('ord() expected a character')) + return space.wrap(ord(w_uni._value[0])) -def le__Unicode_ANY(space, w_uni, w_other): - try: - return space.newbool(space.unwrap(w_uni) <= space.unwrap(w_other)) - except: - wrap_exception(space) +def add__Unicode_Unicode(space, w_left, w_right): + left = w_left._value + right = w_right._value + leftlen = len(left) + rightlen = len(right) + result = [u'\0'] * (leftlen + rightlen) + for i in range(leftlen): + result[i] = left[i] + for i in range(rightlen): + result[i + leftlen] = right[i] + return W_UnicodeObject(space, result) + +def add__String_Unicode(space, w_left, w_right): + return space.add(space.call_function(space.w_unicode, w_left) , w_right) + +def add__Unicode_String(space, w_left, w_right): + return space.add(w_left, space.call_function(space.w_unicode, w_right)) + +def contains__String_Unicode(space, w_container, w_item): + return space.contains(space.call_function(space.w_unicode, w_container), w_item ) + +def _find(self, sub, start, end): + if len(sub) == 0: + return start + if start >= end: + return -1 + for i in range(start, end - len(sub) + 1): + for j in range(len(sub)): + if self[i + j] != sub[j]: + break + else: + return i + return -1 + +def _rfind(self, sub, start, end): + if len(sub) == 0: + return end + if end - start < len(sub): + return -1 + for i in range(end - len(sub), start - 1, -1): + for j in range(len(sub)): + if self[i + j] != sub[j]: + break + else: + return i + return -1 + +def contains__Unicode_Unicode(space, w_container, w_item): + item = w_item._value + container = w_container._value + return space.newbool(_find(container, item, 0, len(container)) >= 0) + +def unicode_join__Unicode_ANY(space, w_self, w_list): + list = space.unpackiterable(w_list) + delim = w_self._value + totlen = 0 + if len(list) == 0: + return W_UnicodeObject(space, []) + for i in range(len(list)): + item = list[i] + if space.is_true(space.isinstance(item, space.w_unicode)): + list[i] = item._value + elif space.is_true(space.isinstance(item, space.w_str)): + list[i] = space.call_function(space.w_unicode, item)._value + else: + w_msg = space.mod(space.wrap('sequence item %d: expected string or Unicode'), + space.wrap(i)) + raise OperationError(space.w_TypeError, w_msg) + totlen += len(list[i]) + totlen += len(delim) * (len(list) - 1) + if len(list) == 1: + return W_UnicodeObject(space, list[0]) + # Allocate result + result = [u'\0'] * totlen + first = list[0] + for i in range(len(first)): + result[i] = first[i] + offset = len(first) + for i in range(1, len(list)): + item = list[i] + # Add delimiter + for j in range(len(delim)): + result[offset + j] = delim[j] + offset += len(delim) + # Add item from list + for j in range(len(item)): + result[offset + j] = item[j] + offset += len(item) + return W_UnicodeObject(space, result) + +def unicode_encode__Unicode_String_String(space, w_self, w_encoding, w_errors): + try: + return space.wrap(u''.join(w_self._value).encode(space.str_w(w_encoding), space.str_w(w_errors))) + except: + wrap_exception(space) + +def unicode_encode__Unicode_String_None(space, w_self, w_encoding, w_none): + try: + return space.wrap(u''.join(w_self._value).encode(space.str_w(w_encoding))) + except: + wrap_exception(space) + +def unicode_encode__Unicode_None_None(space, w_self, w_encoding, w_errors): + try: + return space.wrap(u''.join(w_self._value).encode()) + except: + wrap_exception(space) + +def hash__Unicode(space, w_uni): + if w_uni.w_hash is None: + chars = w_uni._value + x = ord(chars[0]) << 7 + for c in chars: + x = intmask((1000003 * x) ^ ord(c)) + h = intmask(x ^ len(chars)) + if h == -1: + h = -2 + w_uni.w_hash = space.wrap(h) + return w_uni.w_hash + +def len__Unicode(space, w_uni): + return space.wrap(len(w_uni._value)) + +def getitem__Unicode_ANY(space, w_uni, w_index): + ival = space.int_w(w_index) + uni = w_uni._value + ulen = len(uni) + if ival < 0: + ival += ulen + if ival < 0 or ival >= ulen: + exc = space.call_function(space.w_IndexError, + space.wrap("unicode index out of range")) + raise OperationError(space.w_IndexError, exc) + return W_UnicodeObject(space, [uni[ival]]) + +def getitem__Unicode_Slice(space, w_uni, w_slice): + uni = w_uni._value + length = len(uni) + start, stop, step, sl = slicetype.indices4(space, w_slice, length) + r = [uni[start + i*step] for i in range(sl)] + return W_UnicodeObject(space, r) + +def unicode_getslice__Unicode_ANY_ANY(space, w_uni, w_start, w_end): + w_slice = space.call_function(space.w_slice, w_start, w_end) + uni = w_uni._value + length = len(uni) + start, stop, step, sl = slicetype.indices4(space, w_slice, length) + return W_UnicodeObject(space, uni[start:stop]) + +def mul__Unicode_ANY(space, w_uni, w_times): + chars = w_uni._value + charlen = len(chars) + times = space.int_w(w_times) + if times <= 0 or charlen == 0: + return W_UnicodeObject(space, []) + if times == 1: + return space.call_function(space.w_unicode, w_uni) + if charlen == 1: + return W_UnicodeObject(space, [w_uni._value[0]] * times) + + try: + result = [u'\0'] * (charlen * times) + except OverflowError: + raise OperationError(space.w_OverflowError, space.wrap('repeated string is too long')) + for i in range(times): + offset = i * charlen + for j in range(charlen): + result[offset + j] = chars[j] + return W_UnicodeObject(space, result) + +def mul__ANY_Unicode(space, w_times, w_uni): + return space.mul(w_uni, w_times) + +def _isspace(uchar): + return unicodedb.isspace(ord(uchar)) + +def unicode_isspace__Unicode(space, w_unicode): + if len(w_unicode._value) == 0: + return space.w_False + for uchar in w_unicode._value: + if not unicodedb.isspace(ord(uchar)): + return space.w_False + return space.w_True + +def unicode_isalpha__Unicode(space, w_unicode): + if len(w_unicode._value) == 0: + return space.w_False + for uchar in w_unicode._value: + if not unicodedb.isalpha(ord(uchar)): + return space.w_False + return space.w_True + +def unicode_isalnum__Unicode(space, w_unicode): + if len(w_unicode._value) == 0: + return space.w_False + for uchar in w_unicode._value: + if not (unicodedb.isalpha(ord(uchar)) or + unicodedb.isnumeric(ord(uchar))): + return space.w_False + return space.w_True + +def unicode_isdecimal__Unicode(space, w_unicode): + if len(w_unicode._value) == 0: + return space.w_False + for uchar in w_unicode._value: + if not unicodedb.isdecimal(ord(uchar)): + return space.w_False + return space.w_True + +def unicode_isdigit__Unicode(space, w_unicode): + if len(w_unicode._value) == 0: + return space.w_False + for uchar in w_unicode._value: + if not unicodedb.isdigit(ord(uchar)): + return space.w_False + return space.w_True + +def unicode_isnumeric__Unicode(space, w_unicode): + if len(w_unicode._value) == 0: + return space.w_False + for uchar in w_unicode._value: + if not unicodedb.isnumeric(ord(uchar)): + return space.w_False + return space.w_True + +def unicode_islower__Unicode(space, w_unicode): + cased = False + for uchar in w_unicode._value: + if (unicodedb.isupper(ord(uchar)) or + unicodedb.istitle(ord(uchar))): + return space.w_False + if not cased and unicodedb.islower(ord(uchar)): + cased = True + return space.newbool(cased) + +def unicode_isupper__Unicode(space, w_unicode): + cased = False + for uchar in w_unicode._value: + if (unicodedb.islower(ord(uchar)) or + unicodedb.istitle(ord(uchar))): + return space.w_False + if not cased and unicodedb.isupper(ord(uchar)): + cased = True + return space.newbool(cased) + +def unicode_istitle__Unicode(space, w_unicode): + cased = False + previous_is_cased = False + for uchar in w_unicode._value: + if (unicodedb.isupper(ord(uchar)) or + unicodedb.istitle(ord(uchar))): + if previous_is_cased: + return space.w_False + previous_is_cased = cased = True + elif unicodedb.islower(ord(uchar)): + if not previous_is_cased: + return space.w_False + previous_is_cased = cased = True + else: + previous_is_cased = False + return space.newbool(cased) + +def _strip(space, w_self, w_chars, left, right): + "internal function called by str_xstrip methods" + u_self = w_self._value + u_chars = w_chars._value + + lpos = 0 + rpos = len(u_self) + + if left: + while lpos < rpos and u_self[lpos] in u_chars: + lpos += 1 + + if right: + while rpos > lpos and u_self[rpos - 1] in u_chars: + rpos -= 1 + + result = [u'\0'] * (rpos - lpos) + for i in range(rpos - lpos): + result[i] = u_self[lpos + i] + return W_UnicodeObject(space, result) + +def _strip_none(space, w_self, left, right): + "internal function called by str_xstrip methods" + u_self = w_self._value + + lpos = 0 + rpos = len(u_self) + + if left: + while lpos < rpos and _isspace(u_self[lpos]): + lpos += 1 + + if right: + while rpos > lpos and _isspace(u_self[rpos - 1]): + rpos -= 1 + + result = [u'\0'] * (rpos - lpos) + for i in range(rpos - lpos): + result[i] = u_self[lpos + i] + return W_UnicodeObject(space, result) + +def unicode_strip__Unicode_None(space, w_self, w_chars): + return _strip_none(space, w_self, 1, 1) +def unicode_strip__Unicode_Unicode(space, w_self, w_chars): + return _strip(space, w_self, w_chars, 1, 1) +def unicode_strip__Unicode_String(space, w_self, w_chars): + return space.call_method(w_self, 'strip', + space.call_function(space.w_unicode, w_chars)) + +def unicode_lstrip__Unicode_None(space, w_self, w_chars): + return _strip_none(space, w_self, 1, 0) +def unicode_lstrip__Unicode_Unicode(space, w_self, w_chars): + return _strip(space, w_self, w_chars, 1, 0) +def unicode_lstrip__Unicode_String(space, w_self, w_chars): + return space.call_method(w_self, 'lstrip', + space.call_function(space.w_unicode, w_chars)) + +def unicode_rstrip__Unicode_None(space, w_self, w_chars): + return _strip_none(space, w_self, 0, 1) +def unicode_rstrip__Unicode_Unicode(space, w_self, w_chars): + return _strip(space, w_self, w_chars, 0, 1) +def unicode_rstrip__Unicode_String(space, w_self, w_chars): + return space.call_method(w_self, 'rstrip', + space.call_function(space.w_unicode, w_chars)) + +def unicode_capitalize__Unicode(space, w_self): + input = w_self._value + if len(input) == 0: + return W_UnicodeObject(space, []) + result = [u'\0'] * len(input) + result[0] = unichr(unicodedb.toupper(ord(input[0]))) + for i in range(1, len(input)): + result[i] = unichr(unicodedb.tolower(ord(input[i]))) + return W_UnicodeObject(space, result) + +def unicode_title__Unicode(space, w_self): + input = w_self._value + if len(input) == 0: + return w_self + result = [u'\0'] * len(input) + + previous_is_cased = 0 + for i in range(len(input)): + unichar = ord(input[i]) + if previous_is_cased: + result[i] = unichr(unicodedb.tolower(unichar)) + else: + result[i] = unichr(unicodedb.totitle(unichar)) + previous_is_cased = unicodedb.iscased(unichar) + return W_UnicodeObject(space, result) + +def unicode_lower__Unicode(space, w_self): + input = w_self._value + result = [u'\0'] * len(input) + for i in range(len(input)): + result[i] = unichr(unicodedb.tolower(ord(input[i]))) + return W_UnicodeObject(space, result) + +def unicode_upper__Unicode(space, w_self): + input = w_self._value + result = [u'\0'] * len(input) + for i in range(len(input)): + result[i] = unichr(unicodedb.toupper(ord(input[i]))) + return W_UnicodeObject(space, result) + +def unicode_swapcase__Unicode(space, w_self): + input = w_self._value + result = [u'\0'] * len(input) + for i in range(len(input)): + unichar = ord(input[i]) + if unicodedb.islower(unichar): + result[i] = unichr(unicodedb.toupper(unichar)) + elif unicodedb.isupper(unichar): + result[i] = unichr(unicodedb.tolower(unichar)) + else: + result[i] = input[i] + return W_UnicodeObject(space, result) + +def _normalize_index(length, index): + if index < 0: + index += length + if index < 0: + index = 0 + elif index > length: + index = length + return index -def ge__Unicode_ANY(space, w_uni, w_other): - try: - return space.newbool(space.unwrap(w_uni) >= space.unwrap(w_other)) - except: - wrap_exception(space) +def unicode_endswith__Unicode_Unicode_ANY_ANY(space, w_self, w_substr, w_start, w_end): + self = w_self._value + start = _normalize_index(len(self), space.int_w(w_start)) + end = _normalize_index(len(self), space.int_w(w_end)) -def ord__Unicode(space, w_uni): - try: - return space.wrap(ord(space.unwrap(w_uni))) - except: - wrap_exception(space) + substr = w_substr._value + substr_len = len(substr) + + if end - start < substr_len: + return space.w_False # substring is too long + start = end - substr_len + for i in range(substr_len): + if self[start + i] != substr[i]: + return space.w_False + return space.w_True -# xxx unicode.__float__ should not exist. For now this approach avoids to deal with unicode in more places -def float__Unicode(space, w_uni): - try: - return space.wrap(float(unicode_to_decimal_w(space, w_uni))) - except: - wrap_exception(space) - -# xxx unicode.__int__ should not exist -def int__Unicode(space, w_uni): - try: - s = unicode_to_decimal_w(space, w_uni) - except: - wrap_exception(space) - raise - return space.call_function(space.w_int, space.wrap(s)) +def unicode_startswith__Unicode_Unicode_ANY_ANY(space, w_self, w_substr, w_start, w_end): + self = w_self._value + start = _normalize_index(len(self), space.int_w(w_start)) + end = _normalize_index(len(self), space.int_w(w_end)) -# xxx unicode.__long__ should not exist -def long__Unicode(space, w_uni): - try: - return string_to_w_long(space, unicode_to_decimal_w(space, w_uni)) - except ParseStringError, e: - raise OperationError(space.w_ValueError, space.wrap(e.msg)) - except: - wrap_exception(space) + substr = w_substr._value + substr_len = len(substr) + + if end - start < substr_len: + return space.w_False # substring is too long + + for i in range(substr_len): + if self[start + i] != substr[i]: + return space.w_False + return space.w_True -def add__Unicode_Unicode(space, w_left, w_right): - return space.wrap(space.unwrap(w_left) + space.unwrap(w_right)) +def unicode_center__Unicode_ANY(space, w_self, w_width): + self = w_self._value + width = space.int_w(w_width) + padding = width - len(self) + if padding < 0: + return space.call_function(space.w_unicode, w_self) + leftpad = padding // 2 + (padding & width & 1) + result = [u' '] * width + for i in range(len(self)): + result[leftpad + i] = self[i] + return W_UnicodeObject(space, result) -def contains__String_Unicode(space, w_left, w_right): - try: - return space.wrap(space.unwrap(w_right) in space.unwrap(w_left)) - except: - wrap_exception(space) -def contains__Unicode_Unicode(space, w_left, w_right): - return space.wrap(space.unwrap(w_right) in space.unwrap(w_left)) +def unicode_ljust__Unicode_ANY(space, w_self, w_width): + self = w_self._value + width = space.int_w(w_width) + padding = width - len(self) + if padding < 0: + return space.call_function(space.w_unicode, w_self) + result = [u' '] * width + for i in range(len(self)): + result[i] = self[i] + return W_UnicodeObject(space, result) -# str.strip(unicode) needs to convert self to unicode and call unicode.strip -def str_strip__String_Unicode(space, w_self, w_chars ): +def unicode_rjust__Unicode_ANY(space, w_self, w_width): + self = w_self._value + width = space.int_w(w_width) + padding = width - len(self) + if padding < 0: + return space.call_function(space.w_unicode, w_self) + result = [u' '] * width + for i in range(len(self)): + result[padding + i] = self[i] + return W_UnicodeObject(space, result) + +def unicode_zfill__Unicode_ANY(space, w_self, w_width): + self = w_self._value + width = space.int_w(w_width) + if len(self) == 0: + return W_UnicodeObject(space, [u'0'] * width) + padding = width - len(self) + if padding <= 0: + return space.call_function(space.w_unicode, w_self) + result = [u'0'] * width + for i in range(len(self)): + result[padding + i] = self[i] + # Move sign to first position + if self[0] in (u'+', u'-'): + result[0] = self[0] + result[padding] = u'0' + return W_UnicodeObject(space, result) + +def unicode_splitlines__Unicode_ANY(space, w_self, w_keepends): + self = w_self._value + keepends = 0 + if space.int_w(w_keepends): + keepends = 1 + if len(self) == 0: + return space.newlist([]) + + start = 0 + end = len(self) + pos = 0 + lines = [] + while pos < end: + if unicodedb.islinebreak(ord(self[pos])): + if (self[pos] == u'\r' and pos + 1 < end and + self[pos + 1] == u'\n'): + # Count CRLF as one linebreak + lines.append(W_UnicodeObject(space, + self[start:pos + keepends * 2])) + pos += 1 + else: + lines.append(W_UnicodeObject(space, + self[start:pos + keepends])) + pos += 1 + start = pos + else: + pos += 1 + if not unicodedb.islinebreak(ord(self[end - 1])): + lines.append(W_UnicodeObject(space, self[start:])) + return space.newlist(lines) + +def unicode_find__Unicode_Unicode_ANY_ANY(space, w_self, w_substr, w_start, w_end): + self = w_self._value + start = _normalize_index(len(self), space.int_w(w_start)) + end = _normalize_index(len(self), space.int_w(w_end)) + substr = w_substr._value + return space.wrap(_find(self, substr, start, end)) + +def unicode_rfind__Unicode_Unicode_ANY_ANY(space, w_self, w_substr, w_start, w_end): + self = w_self._value + start = _normalize_index(len(self), space.int_w(w_start)) + end = _normalize_index(len(self), space.int_w(w_end)) + substr = w_substr._value + return space.wrap(_rfind(self, substr, start, end)) + +def unicode_index__Unicode_Unicode_ANY_ANY(space, w_self, w_substr, w_start, w_end): self = w_self._value - return space.wrap( unicode(self).strip( space.unwrap(w_chars) ) ) -def str_lstrip__String_Unicode(space, w_self, w_chars ): + start = _normalize_index(len(self), space.int_w(w_start)) + end = _normalize_index(len(self), space.int_w(w_end)) + substr = w_substr._value + index = _find(self, substr, start, end) + if index < 0: + raise OperationError(space.w_ValueError, + space.wrap('substring not found')) + return space.wrap(index) + +def unicode_rindex__Unicode_Unicode_ANY_ANY(space, w_self, w_substr, w_start, w_end): self = w_self._value - return space.wrap( unicode(self).lstrip( space.unwrap(w_chars) ) ) -def str_rstrip__String_Unicode(space, w_self, w_chars ): + start = _normalize_index(len(self), space.int_w(w_start)) + end = _normalize_index(len(self), space.int_w(w_end)) + substr = w_substr._value + index = _rfind(self, substr, start, end) + if index < 0: + raise OperationError(space.w_ValueError, + space.wrap('substring not found')) + return space.wrap(index) + +def unicode_count__Unicode_Unicode_ANY_ANY(space, w_self, w_substr, w_start, w_end): self = w_self._value - return space.wrap( unicode(self).rstrip( space.unwrap(w_chars) ) ) -# we use the following magic to register strip_string_unicode as a String multimethod -import stringtype + start = _normalize_index(len(self), space.int_w(w_start)) + end = _normalize_index(len(self), space.int_w(w_end)) + substr = w_substr._value + count = 0 + while start <= end: + index = _find(self, substr, start, end) + if index < 0: + break + start = index + 1 + count += 1 + return space.wrap(count) -register_all(vars(), stringtype) +def unicode_split__Unicode_None_ANY(space, w_self, w_none, w_maxsplit): + self = w_self._value + maxsplit = space.int_w(w_maxsplit) + parts = [] + if len(self) == 0: + return space.newlist([]) + start = 0 + end = len(self) + while maxsplit != 0 and start < end: + index = start + for index in range(start, end): + if _isspace(self[index]): + break + else: + break + parts.append(W_UnicodeObject(space, self[start:index])) + maxsplit -= 1 + # Eat whitespace + for start in range(index + 1, end): + if not _isspace(self[start]): + break + else: + return space.newlist(parts) + parts.append(W_UnicodeObject(space, self[start:])) + return space.newlist(parts) + + +def unicode_split__Unicode_Unicode_ANY(space, w_self, w_delim, w_maxsplit): + self = w_self._value + delim = w_delim._value + maxsplit = space.int_w(w_maxsplit) + delim_len = len(delim) + if delim_len == 0: + raise OperationError(space.w_ValueError, + space.wrap('empty separator')) + parts = [] + if len(self) == 0: + return space.newlist([]) + start = 0 + end = len(self) + while maxsplit != 0: + index = _find(self, delim, start, end) + if index < 0: + break + parts.append(W_UnicodeObject(space, self[start:index])) + start = index + delim_len + maxsplit -= 1 + parts.append(W_UnicodeObject(space, self[start:])) + return space.newlist(parts) + +def _split(space, self, maxsplit): + if len(self) == 0: + return [] + if maxsplit == 0: + return [W_UnicodeObject(space, self)] + index = 0 + end = len(self) + parts = [W_UnicodeObject(space, [])] + maxsplit -= 1 + while maxsplit != 0: + if index >= end: + break + parts.append(W_UnicodeObject(space, [self[index]])) + index += 1 + maxsplit -= 1 + parts.append(W_UnicodeObject(space, self[index:])) + return parts + +def unicode_replace__Unicode_Unicode_Unicode_ANY(space, w_self, w_old, + w_new, w_maxsplit): + if len(w_old._value): + w_parts = space.call_method(w_self, 'split', w_old, w_maxsplit) + else: + self = w_self._value + maxsplit = space.int_w(w_maxsplit) + w_parts = space.newlist(_split(space, self, maxsplit)) + return space.call_method(w_new, 'join', w_parts) + + +'translate' +app = gateway.applevel(r''' +import sys + +def unicode_expandtabs__Unicode_ANY(self, tabsize): + parts = self.split(u'\t') + result = [ parts[0] ] + prevsize = 0 + for ch in parts[0]: + prevsize += 1 + if ch in (u"\n", u"\r"): + prevsize = 0 + for i in range(1, len(parts)): + pad = tabsize - prevsize % tabsize + result.append(u' ' * pad) + nextpart = parts[i] + result.append(nextpart) + prevsize = 0 + for ch in nextpart: + prevsize += 1 + if ch in (u"\n", u"\r"): + prevsize = 0 + return u''.join(result) + +def unicode_translate__Unicode_ANY(self, table): + result = [] + for unichar in self: + try: + newval = table[ord(unichar)] + except KeyError: + result.append(unichar) + else: + if newval is None: + continue + elif isinstance(newval, int): + if newval < 0 or newval > sys.maxunicode: + raise TypeError("character mapping must be in range(0x%x)"%(sys.maxunicode + 1,)) + result.append(unichr(newval)) + elif isinstance(newval, unicode): + result.append(newval) + else: + raise TypeError("character mapping must return integer, None or unicode") + return ''.join(result) + +def mod__Unicode_ANY(format, values): + import _formatting + if isinstance(values, tuple): + return _formatting.format(format, values, None, do_unicode=True) + if hasattr(values, 'keys'): + return _formatting.format(format, (values,), values, do_unicode=True) + return _formatting.format(format, (values,), None, do_unicode=True) +''') +unicode_expandtabs__Unicode_ANY = app.interphook('unicode_expandtabs__Unicode_ANY') +unicode_translate__Unicode_ANY = app.interphook('unicode_translate__Unicode_ANY') +mod__Unicode_ANY = app.interphook('mod__Unicode_ANY') + +import unicodetype +register_all(vars(), unicodetype) + +# str.strip(unicode) needs to convert self to unicode and call unicode.strip +# we use the following magic to register strip_string_unicode as a String multimethod. +class str_methods: + import stringtype + W_UnicodeObject = W_UnicodeObject + from pypy.objspace.std.stringobject import W_StringObject + def str_strip__String_Unicode(space, w_self, w_chars): + return space.call_method(space.call_function(space.w_unicode, w_self), + 'strip', w_chars) + def str_lstrip__String_Unicode(space, w_self, w_chars): + return space.call_method(space.call_function(space.w_unicode, w_self), + 'lstrip', w_chars) + self = w_self._value + def str_rstrip__String_Unicode(space, w_self, w_chars): + return space.call_method(space.call_function(space.w_unicode, w_self), + 'rstrip', w_chars) + def str_count__String_Unicode_ANY_ANY(space, w_self, w_substr, w_start, w_end): + return space.call_method(space.call_function(space.w_unicode, w_self), + 'count', w_substr, w_start, w_end) + def str_find__String_Unicode_ANY_ANY(space, w_self, w_substr, w_start, w_end): + return space.call_method(space.call_function(space.w_unicode, w_self), + 'find', w_substr, w_start, w_end) + def str_rfind__String_Unicode_ANY_ANY(space, w_self, w_substr, w_start, w_end): + return space.call_method(space.call_function(space.w_unicode, w_self), + 'rfind', w_substr, w_start, w_end) + def str_index__String_Unicode_ANY_ANY(space, w_self, w_substr, w_start, w_end): + return space.call_method(space.call_function(space.w_unicode, w_self), + 'index', w_substr, w_start, w_end) + def str_rindex__String_Unicode_ANY_ANY(space, w_self, w_substr, w_start, w_end): + return space.call_method(space.call_function(space.w_unicode, w_self), + 'rindex', w_substr, w_start, w_end) + + def str_replace__String_Unicode_Unicode_ANY(space, w_self, w_old, w_new, w_maxsplit): + return space.call_method(space.call_function(space.w_unicode, w_self), + 'replace', w_old, w_new, w_maxsplit) + + def str_split__String_Unicode_ANY(space, w_self, w_delim, w_maxsplit): + return space.call_method(space.call_function(space.w_unicode, w_self), + 'split', w_delim, w_maxsplit) + + register_all(vars(), stringtype) Modified: pypy/dist/pypy/objspace/std/unicodetype.py ============================================================================== --- pypy/dist/pypy/objspace/std/unicodetype.py (original) +++ pypy/dist/pypy/objspace/std/unicodetype.py Mon May 23 13:05:59 2005 @@ -1,3 +1,119 @@ -from pypy.objspace.std.fake import fake_type +from pypy.objspace.std.stdtypedef import * +from pypy.objspace.std.basestringtype import basestring_typedef +from pypy.interpreter.error import OperationError -unicode_typedef = fake_type(unicode).typedef +from sys import maxint + +unicode_capitalize = MultiMethod('capitalize', 1) +unicode_center = MultiMethod('center', 2, ) +unicode_count = MultiMethod('count', 4, defaults=(0, maxint)) +unicode_encode = MultiMethod('encode', 3, defaults=(None, None)) +unicode_endswith = MultiMethod('endswith', 4, defaults=(0,maxint)) +unicode_expandtabs = MultiMethod('expandtabs', 2, defaults=(8,)) +unicode_find = MultiMethod('find', 4, defaults=(0, maxint)) +unicode_index = MultiMethod('index', 4, defaults=(0, maxint)) +unicode_isalnum = MultiMethod('isalnum', 1) +unicode_isalpha = MultiMethod('isalpha', 1) +unicode_isdecimal = MultiMethod('isdecimal', 1) +unicode_isdigit = MultiMethod('isdigit', 1) +unicode_islower = MultiMethod('islower', 1) +unicode_isnumeric = MultiMethod('isnumeric', 1) +unicode_isspace = MultiMethod('isspace', 1) +unicode_istitle = MultiMethod('istitle', 1) +unicode_isupper = MultiMethod('isupper', 1) +unicode_join = MultiMethod('join', 2) +unicode_ljust = MultiMethod('ljust', 2) +unicode_lower = MultiMethod('lower', 1) +unicode_lstrip = MultiMethod('lstrip', 2, defaults=(None,)) +unicode_replace = MultiMethod('replace', 4, defaults=(-1,)) +unicode_rfind = MultiMethod('rfind', 4, defaults=(0, maxint)) +unicode_rindex = MultiMethod('rindex', 4, defaults=(0, maxint)) +unicode_rjust = MultiMethod('rjust', 2) +unicode_rstrip = MultiMethod('rstrip', 2, defaults=(None,)) +unicode_split = MultiMethod('split', 3, defaults=(None,-1)) +unicode_splitlines = MultiMethod('splitlines', 2, defaults=(0,)) +unicode_startswith = MultiMethod('startswith', 4, defaults=(0,maxint)) +unicode_strip = MultiMethod('strip', 2, defaults=(None,)) +unicode_swapcase = MultiMethod('swapcase', 1) +unicode_title = MultiMethod('title', 1) +unicode_translate = MultiMethod('translate', 2) +unicode_upper = MultiMethod('upper', 1) +unicode_zfill = MultiMethod('zfill', 2) +unicode_getslice = MultiMethod('__getslice__', 3) +# ____________________________________________________________ + +app = gateway.applevel(''' +import codecs, sys + +def unicode_from_encoded_object(obj, encoding, errors): + # Fix later for buffer + if type(obj).__name__ == 'buffer': + obj = obj.buf + if encoding is None: + encoding = sys.getdefaultencoding() + decoder = codecs.getdecoder(encoding) + if errors is None: + retval, lenght = decoder(obj) + else: + retval, length = decoder(obj, errors) + if not isinstance(retval, unicode): + raise TypeError("decoder did not return an unicode object (type=%s)" % + type(retval).__name__) + return retval + +def unicode_from_object(obj): + if isinstance(obj, str): + res = obj + else: + try: + unicode_method = obj.__unicode__ + except AttributeError: + res = str(obj) + else: + res = unicode_method() + if isinstance(res, unicode): + return res + return unicode_from_encoded_object(res, None, "strict") + +''') +unicode_from_object = app.interphook('unicode_from_object') +unicode_from_encoded_object = app.interphook('unicode_from_encoded_object') + + +def descr__new__(space, w_unicodetype, w_obj=None, w_encoding=None, w_errors=None): + from pypy.objspace.std.unicodeobject import W_UnicodeObject + w_obj_type = space.type(w_obj) + + if space.is_w(w_obj_type, space.w_unicode): + if (not space.is_w(w_encoding, space.w_None) or + not space.is_w(w_errors, space.w_None)): + raise OperationError(space.w_TypeError, + space.wrap('decoding Unicode is not supported')) + if space.is_w(w_unicodetype, space.w_unicode): + return w_obj + w_value = w_obj + elif space.is_w(w_obj, space.w_None): + w_value = W_UnicodeObject(space, []) + elif (space.is_w(w_encoding, space.w_None) and + space.is_w(w_errors, space.w_None)): + if space.is_true(space.isinstance(w_obj, space.w_unicode)): + w_value = w_obj + else: + w_value = unicode_from_object(space, w_obj) + else: + w_value = unicode_from_encoded_object(space, w_obj, w_encoding, w_errors) + w_newobj = space.allocate_instance(W_UnicodeObject, w_unicodetype) + w_newobj.__init__(space, w_value._value) + return w_newobj + +# ____________________________________________________________ + +unicode_typedef = StdTypeDef("unicode", basestring_typedef, + __new__ = newmethod(descr__new__), + __doc__ = '''unicode(string [, encoding[, errors]]) -> object + +Create a new Unicode object from the given encoded string. +encoding defaults to the current default string encoding. +errors can be 'strict', 'replace' or 'ignore' and defaults to 'strict'.''' + ) +unicode_typedef.registermethods(globals()) From ac at codespeak.net Mon May 23 13:16:54 2005 From: ac at codespeak.net (ac at codespeak.net) Date: Mon, 23 May 2005 13:16:54 +0200 (CEST) Subject: [pypy-svn] r12737 - pypy/branch/non-fake-unicode Message-ID: <20050523111654.DFC6327B8D@code1.codespeak.net> Author: ac Date: Mon May 23 13:16:54 2005 New Revision: 12737 Removed: pypy/branch/non-fake-unicode/ Log: Remove the branch as it has been merged. From ac at codespeak.net Mon May 23 13:28:33 2005 From: ac at codespeak.net (ac at codespeak.net) Date: Mon, 23 May 2005 13:28:33 +0200 (CEST) Subject: [pypy-svn] r12738 - pypy/dist/pypy/module/unicodedata Message-ID: <20050523112833.D259927B82@code1.codespeak.net> Author: ac Date: Mon May 23 13:28:33 2005 New Revision: 12738 Added: pypy/dist/pypy/module/unicodedata/function.py - copied unchanged from r12737, pypy/dist/pypy/module/unicodedata/functions.py Removed: pypy/dist/pypy/module/unicodedata/functions.py Modified: pypy/dist/pypy/module/unicodedata/__init__.py Log: Fix some naming issues. Modified: pypy/dist/pypy/module/unicodedata/__init__.py ============================================================================== --- pypy/dist/pypy/module/unicodedata/__init__.py (original) +++ pypy/dist/pypy/module/unicodedata/__init__.py Mon May 23 13:28:33 2005 @@ -4,17 +4,17 @@ appleveldefs = { } interpleveldefs = { - 'lookup' : 'functions.lookup', - 'name' : 'functions.name', - 'decimal' : 'functions.decimal', - 'digit' : 'functions.digit', - 'numeric' : 'functions.numeric', - 'category' : 'functions.category', - 'bidirectional' : 'functions.bidirectional', - 'combining' : 'functions.combining', - 'mirrored' : 'functions.mirrored', - 'decomposition' : 'functions.decomposition', - 'normalize' : 'functions.normalize', + 'lookup' : 'function.lookup', + 'name' : 'function.name', + 'decimal' : 'function.decimal', + 'digit' : 'function.digit', + 'numeric' : 'function.numeric', + 'category' : 'function.category', + 'bidirectional' : 'function.bidirectional', + 'combining' : 'function.combining', + 'mirrored' : 'function.mirrored', + 'decomposition' : 'function.decomposition', + 'normalize' : 'function.normalize', 'unidata_version' : 'space.wrap(unicodedb.version)', '__doc__' : "space.wrap('unicode character database')", } Deleted: /pypy/dist/pypy/module/unicodedata/functions.py ============================================================================== --- /pypy/dist/pypy/module/unicodedata/functions.py Mon May 23 13:28:33 2005 +++ (empty file) @@ -1,105 +0,0 @@ -""" -Implementation of the interpreter-level functions in the module unicodedata. -""" -from pypy.interpreter.gateway import NoneNotWrapped -from pypy.module.unicodedata import unicodedb -from pypy.interpreter.error import OperationError - -def unichr_to_code_w(space, w_unichr): - if not space.is_true(space.isinstance(w_unichr, space.w_unicode)): - raise OperationError(space.w_TypeError, space.wrap('argument 1 must be unicode')) - if not space.int_w(space.len(w_unichr)) == 1: - raise OperationError(space.w_TypeError, space.wrap('need a single Unicode character as parameter')) - return space.int_w(space.ord(w_unichr)) - -def lookup(space, w_name): - name = space.str_w(w_name) - try: - code = unicodedb.lookup(name) - except KeyError: - msg = space.mod(space.wrap("undefined character name '%s'"), w_name) - raise OperationError(space.w_KeyError, msg) - return space.call_function(space.getattr(space.w_builtin, 'unichr'), - space.wrap(code)) - -def name(space, w_unichr, w_default=NoneNotWrapped): - code = unichr_to_code_w(space, w_unichr) - try: - name = unicodedb.name(code) - except KeyError: - if w_default is not None: - return w_default - raise OperationError(space.w_ValueError, space.wrap('no such name')) - return space.wrap(name) - - -def decimal(space, w_unichr, w_default=NoneNotWrapped): - code = unichr_to_code_w(space, w_unichr) - try: - return space.wrap(unicodedb.decimal(code)) - except KeyError: - pass - if w_default is not None: - return w_default - raise OperationError(space.w_ValueError, space.wrap('not a decimal')) - -def digit(space, w_unichr, w_default=NoneNotWrapped): - code = unichr_to_code_w(space, w_unichr) - try: - return space.wrap(unicodedb.digit(code)) - except KeyError: - pass - if w_default is not None: - return w_default - raise OperationError(space.w_ValueError, space.wrap('not a digit')) - -def numeric(space, w_unichr, w_default=NoneNotWrapped): - code = unichr_to_code_w(space, w_unichr) - try: - return space.wrap(unicodedb.numeric(code)) - except KeyError: - pass - if w_default is not None: - return w_default - raise OperationError(space.w_ValueError, - space.wrap('not a numeric character')) - -def category(space, w_unichr): - code = unichr_to_code_w(space, w_unichr) - return space.wrap(unicodedb.category(code)) - -def bidirectional(space, w_unichr): - code = unichr_to_code_w(space, w_unichr) - return space.wrap(unicodedb.bidirectional(code)) - -def combining(space, w_unichr): - code = unichr_to_code_w(space, w_unichr) - return space.wrap(unicodedb.combining(code)) - -def mirrored(space, w_unichr): - code = unichr_to_code_w(space, w_unichr) - return space.wrap(unicodedb.mirrored(code)) - -def decomposition(space, w_unichr): - code = unichr_to_code_w(space, w_unichr) - raise OperationError(space.w_NotImplementedError, - space.wrap('Decomposition is not implemented')) - -def normalize(space, w_form, w_unistr): - form = space.str_w(w_form) - if not space.is_true(space.isinstance(w_unistr, space.w_unicode)): - raise TypeError, 'argument 2 must be unicode' - if form == 'NFC': - raise OperationError(space.w_NotImplementedError, - space.wrap('Normalization is not implemented')) - if form == 'NFD': - raise OperationError(space.w_NotImplementedError, - space.wrap('Normalization is not implemented')) - if form == 'NFKC': - raise OperationError(space.w_NotImplementedError, - space.wrap('Normalization is not implemented')) - if form == 'NFKD': - raise OperationError(space.w_NotImplementedError, - space.wrap('Normalization is not implemented')) - raise OperationError(space.w_ValueError, - space.wrap('invalid normalization form')) From ac at codespeak.net Mon May 23 13:50:38 2005 From: ac at codespeak.net (ac at codespeak.net) Date: Mon, 23 May 2005 13:50:38 +0200 (CEST) Subject: [pypy-svn] r12739 - in pypy/dist/pypy/objspace/std: . test Message-ID: <20050523115038.F25D227B5B@code1.codespeak.net> Author: ac Date: Mon May 23 13:50:38 2005 New Revision: 12739 Modified: pypy/dist/pypy/objspace/std/longtype.py pypy/dist/pypy/objspace/std/test/test_unicodestring.py Log: Fix creation of long from unicode. Modified: pypy/dist/pypy/objspace/std/longtype.py ============================================================================== --- pypy/dist/pypy/objspace/std/longtype.py (original) +++ pypy/dist/pypy/objspace/std/longtype.py Mon May 23 13:50:38 2005 @@ -20,9 +20,8 @@ space.wrap(e.msg)) elif space.is_true(space.isinstance(w_value, space.w_unicode)): try: - # XXX can produce unwrapped long from unicodeobject import unicode_to_decimal_w - value = string_to_long(unicode_to_decimal_w(space, w_value)) + w_value = string_to_w_long(space, unicode_to_decimal_w(space, w_value)) except ParseStringError, e: raise OperationError(space.w_ValueError, space.wrap(e.msg)) Modified: pypy/dist/pypy/objspace/std/test/test_unicodestring.py ============================================================================== --- pypy/dist/pypy/objspace/std/test/test_unicodestring.py (original) +++ pypy/dist/pypy/objspace/std/test/test_unicodestring.py Mon May 23 13:50:38 2005 @@ -64,3 +64,12 @@ assert (u'this!is!the!split!function'.split('!') == [u'this', u'is', u'the', u'split', u'function']) + def test_long_from_unicode(self): + assert long(u'12345678901234567890') == 12345678901234567890 + assert int(u'12345678901234567890') == 12345678901234567890 + + def test_int_from_unicode(self): + assert int(u'12345') == 12345 + + def test_float_from_unicode(self): + assert float(u'123.456e89') == 123.456e89 From pedronis at codespeak.net Mon May 23 15:04:40 2005 From: pedronis at codespeak.net (pedronis at codespeak.net) Date: Mon, 23 May 2005 15:04:40 +0200 (CEST) Subject: [pypy-svn] r12742 - pypy/dist/pypy/module/unicodedata Message-ID: <20050523130440.E02D227B5D@code1.codespeak.net> Author: pedronis Date: Mon May 23 15:04:40 2005 New Revision: 12742 Modified: pypy/dist/pypy/module/unicodedata/function.py Log: use new interface space.builtin.get Modified: pypy/dist/pypy/module/unicodedata/function.py ============================================================================== --- pypy/dist/pypy/module/unicodedata/function.py (original) +++ pypy/dist/pypy/module/unicodedata/function.py Mon May 23 15:04:40 2005 @@ -19,7 +19,7 @@ except KeyError: msg = space.mod(space.wrap("undefined character name '%s'"), w_name) raise OperationError(space.w_KeyError, msg) - return space.call_function(space.getattr(space.w_builtin, 'unichr'), + return space.call_function(space.builtin.get('unichr'), space.wrap(code)) def name(space, w_unichr, w_default=NoneNotWrapped): From ac at codespeak.net Mon May 23 15:04:45 2005 From: ac at codespeak.net (ac at codespeak.net) Date: Mon, 23 May 2005 15:04:45 +0200 (CEST) Subject: [pypy-svn] r12743 - in pypy/dist/pypy: module/__builtin__ objspace/std Message-ID: <20050523130445.3A43627B66@code1.codespeak.net> Author: ac Date: Mon May 23 15:04:44 2005 New Revision: 12743 Modified: pypy/dist/pypy/module/__builtin__/compiling.py pypy/dist/pypy/objspace/std/unicodeobject.py Log: Allow unwraping of unicode objects to the benefit of faked functions getting unicode arguments. Use the pypy codecs module to encode unicode objects. Modified: pypy/dist/pypy/module/__builtin__/compiling.py ============================================================================== --- pypy/dist/pypy/module/__builtin__/compiling.py (original) +++ pypy/dist/pypy/module/__builtin__/compiling.py Mon May 23 15:04:44 2005 @@ -9,7 +9,7 @@ def compile(space, w_source, filename, mode, flags=0, dont_inherit=0): if space.is_true(space.isinstance(w_source, space.w_unicode)): - str_ = u''.join(w_source._value) # Bad exposing of unicode internals + str_ = space.unwrap(w_source) # Bad exposing of unicode internals else: str_ = space.str_w(w_source) Modified: pypy/dist/pypy/objspace/std/unicodeobject.py ============================================================================== --- pypy/dist/pypy/objspace/std/unicodeobject.py (original) +++ pypy/dist/pypy/objspace/std/unicodeobject.py Mon May 23 15:04:44 2005 @@ -1,6 +1,5 @@ from pypy.objspace.std.objspace import * from pypy.interpreter import gateway -from pypy.objspace.std.fake import wrap_exception from pypy.objspace.std.stringobject import W_StringObject from pypy.objspace.std.noneobject import W_NoneObject from pypy.objspace.std.sliceobject import W_SliceObject @@ -23,6 +22,11 @@ """ representation for debugging purposes """ return "%s(%r)" % (w_self.__class__.__name__, w_self._value) + def unwrap(w_self): + # For faked functions taking unicodearguments. + # Remove when we no longer need faking. + return u''.join(w_self._value) + registerimplementation(W_UnicodeObject) # Helper for converting int/long @@ -178,23 +182,6 @@ offset += len(item) return W_UnicodeObject(space, result) -def unicode_encode__Unicode_String_String(space, w_self, w_encoding, w_errors): - try: - return space.wrap(u''.join(w_self._value).encode(space.str_w(w_encoding), space.str_w(w_errors))) - except: - wrap_exception(space) - -def unicode_encode__Unicode_String_None(space, w_self, w_encoding, w_none): - try: - return space.wrap(u''.join(w_self._value).encode(space.str_w(w_encoding))) - except: - wrap_exception(space) - -def unicode_encode__Unicode_None_None(space, w_self, w_encoding, w_errors): - try: - return space.wrap(u''.join(w_self._value).encode()) - except: - wrap_exception(space) def hash__Unicode(space, w_uni): if w_uni.w_hash is None: @@ -770,14 +757,30 @@ import _formatting if isinstance(values, tuple): return _formatting.format(format, values, None, do_unicode=True) - if hasattr(values, 'keys'): + if hasattr(values, "keys"): return _formatting.format(format, (values,), values, do_unicode=True) return _formatting.format(format, (values,), None, do_unicode=True) + +def unicode_encode__Unicode_ANY_ANY(unistr, encoding=None, errors=None): + import codecs, sys + if encoding is None: + encoding = sys.getdefaultencoding() + + encoder = codecs.getencoder(encoding) + if errors is None: + retval, lenght = encoder(unistr) + else: + retval, length = encoder(unistr, errors) + + return retval + ''') unicode_expandtabs__Unicode_ANY = app.interphook('unicode_expandtabs__Unicode_ANY') unicode_translate__Unicode_ANY = app.interphook('unicode_translate__Unicode_ANY') mod__Unicode_ANY = app.interphook('mod__Unicode_ANY') +unicode_encode__Unicode_ANY_ANY = app.interphook('unicode_encode__Unicode_ANY_ANY') + import unicodetype register_all(vars(), unicodetype) From arigo at codespeak.net Mon May 23 17:46:30 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Mon, 23 May 2005 17:46:30 +0200 (CEST) Subject: [pypy-svn] r12745 - pypy/dist/pypy/translator/c Message-ID: <20050523154630.0DE4627B64@code1.codespeak.net> Author: arigo Date: Mon May 23 17:46:29 2005 New Revision: 12745 Added: pypy/dist/pypy/translator/c/funcgen.py - copied, changed from r12743, pypy/dist/pypy/translator/c/funcdef.py pypy/dist/pypy/translator/c/support.py (contents, props changed) Removed: pypy/dist/pypy/translator/c/funcdef.py Modified: pypy/dist/pypy/translator/c/database.py pypy/dist/pypy/translator/c/node.py pypy/dist/pypy/translator/c/primitive.py Log: In the process of integrating node.py and funcgen.py (formerly funcdef.py). Modified: pypy/dist/pypy/translator/c/database.py ============================================================================== --- pypy/dist/pypy/translator/c/database.py (original) +++ pypy/dist/pypy/translator/c/database.py Mon May 23 17:46:29 2005 @@ -1,12 +1,13 @@ -from pypy.translator.gensupp import NameManager from pypy.rpython.lltypes import Primitive, _PtrType, typeOf from pypy.rpython.lltypes import Struct, Array, FuncType, PyObject, Void from pypy.rpython.lltypes import ContainerType from pypy.rpython.typer import PyObjPtr from pypy.objspace.flow.model import Constant from pypy.translator.c.primitive import PrimitiveName, PrimitiveType +from pypy.translator.c.primitive import PrimitiveErrorValue from pypy.translator.c.node import StructDefNode, ArrayDefNode -from pypy.translator.c.node import ContainerNodeClass, cdecl +from pypy.translator.c.node import ContainerNodeClass +from pypy.translator.c.support import cdecl, CNameManager, ErrorValue # ____________________________________________________________ @@ -17,20 +18,7 @@ self.structdeflist = [] self.containernodes = {} self.containerlist = [] - self.namespace = NameManager() - # keywords cannot be reused. This is the C99 draft's list. - self.namespace.make_reserved_names(''' - auto enum restrict unsigned - break extern return void - case float short volatile - char for signed while - const goto sizeof _Bool - continue if static _Complex - default inline struct _Imaginary - do int switch - double long typedef - else register union - ''') + self.namespace = CNameManager() def gettypedefnode(self, T, varlength=1): if varlength <= 1: @@ -92,17 +80,24 @@ return node def get(self, obj): - T = typeOf(obj) - if isinstance(T, Primitive): - return PrimitiveName[T](obj) - elif isinstance(T, _PtrType): - if obj: # test if the ptr is non-NULL - node = self.getcontainernode(obj._obj) - return node.ptrname + if isinstance(obj, ErrorValue): + T = obj.TYPE + if isinstance(T, Primitive): + return PrimitiveErrorValue[T] else: return 'NULL' else: - raise Exception("don't know about %r" % (obj,)) + T = typeOf(obj) + if isinstance(T, Primitive): + return PrimitiveName[T](obj) + elif isinstance(T, _PtrType): + if obj: # test if the ptr is non-NULL + node = self.getcontainernode(obj._obj) + return node.ptrname + else: + return 'NULL' + else: + raise Exception("don't know about %r" % (obj,)) def complete(self): for node in self.containerlist: @@ -120,21 +115,24 @@ def write_all_declarations(self, f): print >> f print >> f, '/********************************************************/' - print >> f, '/*** Structures definition ***/' + print >> f, '/*** Structure definitions ***/' print >> f for node in self.structdeflist: - print >> f, '\n'.join(node.definition()) + for line in node.definition(): + print >> f, line print >> f print >> f, '/********************************************************/' print >> f, '/*** Forward declarations ***/' print >> f for node in self.globalcontainers(): - print >> f, '\n'.join(node.forward_declaration()) + for line in node.forward_declaration(): + print >> f, line def write_all_implementations(self, f): print >> f print >> f, '/********************************************************/' print >> f, '/*** Implementations ***/' - print >> f for node in self.globalcontainers(): - print >> f, '\n'.join(node.implementation()) + print >> f + for line in node.implementation(): + print >> f, line Deleted: /pypy/dist/pypy/translator/c/funcdef.py ============================================================================== --- /pypy/dist/pypy/translator/c/funcdef.py Mon May 23 17:46:29 2005 +++ (empty file) @@ -1,607 +0,0 @@ -from __future__ import generators -from pypy.objspace.flow import FlowObjSpace -from pypy.objspace.flow.model import Variable, Constant, SpaceOperation -from pypy.objspace.flow.model import traverse, uniqueitems, checkgraph -from pypy.objspace.flow.model import Block, Link, FunctionGraph -from pypy.objspace.flow.model import last_exception -from pypy.translator.simplify import simplify_graph -from pypy.translator.unsimplify import remove_direct_loops -from pypy.rpython.typer import PyObjPtr -from pypy.interpreter.pycode import CO_VARARGS -from pypy.tool.compile import compile2 -from types import FunctionType - -from pypy.translator.gensupp import c_string - -# Set this if you want call trace frames to be built -USE_CALL_TRACE = False -# XXX doesn't work any more because of the way gen_wrapper() works, sorry - - -class FunctionDef: - """ - Collects information about a function which we have to generate. - The operations of each function are collected in a C function - with signature: - - static T fn_xxx(T1 arg1, T2 arg2, etc); - - where the T, T1, T2.. are C types like 'int' or 'PyObject *'. - - If needed, another wrapper function is created with a signature - suitable for the built-in function type of CPython: - - static PyObject *pyfn_xxx(PyObject *self, PyObject *args, PyObject* kw); - - The built-in function object, if needed, is put in the global - variable named gfn_xxx. - """ - - def __init__(self, func, genc, graph=None, fast_name=None): - self.func = func - self.genc = genc - - # get the function name - namespace = genc.namespace - if fast_name is None: - fast_name = namespace.uniquename('fn_' + func.__name__) # fn_xxx - self.fast_name = fast_name - self.base_name = fast_name[3:] # xxx - self.wrapper_name = None # pyfn_xxx - self.globalobject_name = None # gfunc_xxx - self.localscope = namespace.localScope() - - # get the flow graph, and ensure that there is no direct loop in it - # as we cannot generate valid code for this case. - if graph is None: - graph = genc.translator.getflowgraph(func) - self.graph = graph - remove_direct_loops(genc.translator, graph) - checkgraph(graph) - graph_args = graph.getargs() - - # collect all the local variables - localslst = [] - def visit(node): - if isinstance(node, Block): - localslst.extend(node.getvariables()) - traverse(visit, graph) - fast_set = dict(zip(graph_args, graph_args)) - self.localnames = [self.decl(a) for a in localslst if a not in fast_set] - - # collect all the arguments - fast_args = [self.expr(a) for a in graph_args] - declare_fast_args = [self.decl(a) for a in graph_args] - if USE_CALL_TRACE: - declare_fast_args.insert(0, 'TRACE_ARGS') - declare_fast_args = ', '.join(declare_fast_args) or 'void' - ctret = self.ctypeof(graph.getreturnvar()) - fast_function_header = 'static %s %s(%s)' % ( - ctret.typename, self.fast_name, declare_fast_args) - - # store misc. information - self.fast_function_header = fast_function_header - self.graphargs = graph_args - self.ctret = ctret - self.vararg = bool(func.func_code.co_flags & CO_VARARGS) - self.fast_args = fast_args - self.func_defaults = func.func_defaults or () - - error_return = getattr(ctret, 'error_return', 'NULL') - self.return_error = 'FUNCTION_RETURN(%s)' % error_return - - # generate the forward header - self.genc.globaldecl.append(fast_function_header + '; /* forward */') - - - def ctypeof(self, var_or_const): - return getattr(var_or_const, 'concretetype', PyObjPtr) - - def get_globalobject(self): - if self.globalobject_name is None: - self.wrapper_name = 'py' + self.fast_name - self.globalobject_name = self.genc.pyobj.uniquename('gfunc_' + - self.base_name) - return self.globalobject_name - - def clear(self): - del self.localscope - del self.localnames - del self.graph - - def decl(self, v): - assert isinstance(v, Variable) - ct = self.ctypeof(v) - return '%s %s' % (ct.typename, self.localscope.localname(v.name)) - - def expr(self, v): - if isinstance(v, Variable): - return self.localscope.localname(v.name) - elif isinstance(v, Constant): - return self.genc.nameofconst(v, - debug=('Constant in the graph of', self.func)) - else: - raise TypeError, "expr(%r)" % (v,) - - # ____________________________________________________________ - - def gen_wrapper(self): - # the wrapper is the function that takes the CPython signature - # - # PyObject *fn(PyObject *self, PyObject *args, PyObject *kwds) - # - # and decodes the arguments and calls the "real" C function. - # We generate the wrapper itself as a Python function which is - # turned into C. This makes gen_wrapper() more or less clean. - # - - TPyObject = self.genc.pyobjtype - TInt = self.genc.translator.getconcretetype(CIntType) - TNone = self.genc.translator.getconcretetype(CNoneType) - TBorrowed = self.genc.translator.getconcretetype(CBorrowedPyObjectType) - args_ct = [self.ctypeof(a) for a in self.graphargs] - res_ct = self.ctret - nb_positional_args = len(self.graphargs) - self.vararg - - # "def wrapper(self, args, kwds)" - vself = Variable('self') - vargs = Variable('args') - vkwds = Variable('kwds') - block = Block([vself, vargs, vkwds]) - vfname = Constant(self.base_name) - - # avoid incref/decref on the arguments: 'self' and 'kwds' can be NULL - vself.concretetype = TBorrowed - vargs.concretetype = TBorrowed - vkwds.concretetype = TBorrowed - - # "argument_i = decode_arg(fname, pos, name, vargs, vkwds)" or - # "argument_i = decode_arg_def(fname, pos, name, vargs, vkwds, default)" - varguments = [] - varnames = self.func.func_code.co_varnames - for i in range(nb_positional_args): - opargs = [vfname, Constant(i), - Constant(varnames[i]), vargs, vkwds] - opargs[1].concretetype = TInt - try: - default_value = self.func_defaults[i - nb_positional_args] - except IndexError: - opname = 'decode_arg' - else: - opname = 'decode_arg_def' - opargs.append(Constant(default_value)) - v = Variable('a%d' % i) - block.operations.append(SpaceOperation(opname, opargs, v)) - varguments.append(v) - - if self.vararg: - # "vararg = vargs[n:]" - vararg = Variable('vararg') - opargs = [vargs, Constant(nb_positional_args), Constant(None)] - block.operations.append(SpaceOperation('getslice', opargs, vararg)) - varguments.append(vararg) - else: - # "check_no_more_arg(fname, n, vargs)" - vnone = Variable() - vnone.concretetype = TNone - opargs = [vfname, Constant(nb_positional_args), vargs] - opargs[1].concretetype = TInt - block.operations.append(SpaceOperation('check_no_more_arg', - opargs, vnone)) - - if self.genc.translator.annotator is not None: - # "argument_i = type_conversion_operations(argument_i)" - from pypy.translator.genc.ctyper import GenCSpecializer - from pypy.translator.typer import flatten_ops - typer = GenCSpecializer(self.genc.translator.annotator) - - assert len(varguments) == len(self.graphargs) - for i in range(len(varguments)): - varguments[i].concretetype = TPyObject - varguments[i], convops = typer.convertvar(varguments[i], - args_ct[i]) - flatten_ops(convops, block.operations) - else: - typer = None - - # "result = direct_call(func, argument_0, argument_1, ..)" - opargs = [Constant(self.func)] + varguments - opargs[0].concretetype = self.genc.translator.getconcretetype( - CFuncPtrType, tuple(args_ct), res_ct) - vresult = Variable('result') - block.operations.append(SpaceOperation('direct_call', opargs, vresult)) - - if typer is not None: - # "result2 = type_conversion_operations(result)" - vresult.concretetype = res_ct - vresult, convops = typer.convertvar(vresult, TPyObject) - flatten_ops(convops, block.operations) - - # "return result" - wgraph = FunctionGraph(self.wrapper_name, block) - block.closeblock(Link([vresult], wgraph.returnblock)) - checkgraph(wgraph) - - # generate the C source of this wrapper function - wfuncdef = FunctionDef(dummy_wrapper, self.genc, - wgraph, self.wrapper_name) - self.genc.gen_cfunction(wfuncdef) - - - def DISABLED_OLD_gen_wrapper(self, f): - # XXX this is a huge mess. Think about producing the wrapper by - # generating its content as a flow graph... - func = self.func - f_name = self.wrapper_name - name_of_defaults = self.name_of_defaults - graphargs = self.graphargs - vararg = self.vararg - nb_positional_args = len(graphargs) - vararg - - min_number_of_args = nb_positional_args - len(name_of_defaults) - print >> f, 'static PyObject *' - print >> f, '%s(PyObject* self, PyObject* args, PyObject* kwds)' % ( - f_name,) - print >> f, '{' - if USE_CALL_TRACE: - print >> f, '\tFUNCTION_HEAD(%s, %s, args, %s, __FILE__, __LINE__ - 2)' % ( - c_string('%s(%s)' % (self.base_name, ', '.join(name_of_defaults))), - self.globalobject_name, - '(%s)' % (', '.join(map(c_string, name_of_defaults) + ['NULL']),), - ) - - kwlist = ['"%s"' % name for name in - func.func_code.co_varnames[:func.func_code.co_argcount]] - kwlist.append('0') - print >> f, '\tstatic char* kwlist[] = {%s};' % (', '.join(kwlist),) - - numberednames = ['o%d' % (i+1) for i in range(len(graphargs))] - if vararg: - numberednames[-1] = 'ovararg' - numberednames.append('oret') - print >> f, '\tPyObject *%s;' % (', *'.join(numberednames)) - conversions = [] - call_fast_args = [] - for a, numberedname in zip(graphargs, numberednames): - ct = self.ctypeof(a) - if ct == self.genc.pyobjtype: - call_fast_args.append(numberedname) - else: - convert_from_obj = ct.opname_conv_from_obj # simple conv only! - convertedname = numberedname.replace('o', 'a') - print >> f, '\t%s %s;' % (ct.typename, convertedname) - conversions.append('\tOP_%s(%s, %s, type_error)' % ( - convert_from_obj.upper(), numberedname, convertedname)) - # XXX successfully converted objects may need to be decrefed - # XXX even though they are not PyObjects - call_fast_args.append(convertedname) - # return value conversion - ct = self.ctret - if ct == self.genc.pyobjtype: - putresultin = 'oret' - footer = None - else: - convert_to_obj = ct.opname_conv_to_obj # simple conv only for now! - print >> f, '\t%s aret;' % (ct.typename,) - putresultin = 'aret' - footer = 'OP_%s(aret, oret, type_error)' % convert_to_obj.upper() - print >> f - - if USE_CALL_TRACE: - print >> f, '\tFUNCTION_CHECK()' - - # argument unpacking - if vararg: - print >> f, '\tovararg = PyTuple_GetSlice(args, %d, INT_MAX);' % ( - nb_positional_args,) - print >> f, '\tif (ovararg == NULL)' - print >> f, '\t\tFUNCTION_RETURN(NULL)' - print >> f, '\targs = PyTuple_GetSlice(args, 0, %d);' % ( - nb_positional_args,) - print >> f, '\tif (args == NULL) {' - print >> f, '\t\tERR_DECREF(ovararg)' - print >> f, '\t\tFUNCTION_RETURN(NULL)' - print >> f, '\t}' - tail = """{ -\t\tERR_DECREF(args) -\t\tERR_DECREF(ovararg) -\t\tFUNCTION_RETURN(NULL); -\t} -\tPy_DECREF(args);""" - else: - tail = '\n\t\tFUNCTION_RETURN(NULL)' - for i in range(len(name_of_defaults)): - print >> f, '\t%s = %s;' % ( - numberednames[min_number_of_args+i], - name_of_defaults[i]) - fmt = 'O'*min_number_of_args - if min_number_of_args < nb_positional_args: - fmt += '|' + 'O'*(nb_positional_args-min_number_of_args) - lst = ['args', 'kwds', - '"%s:%s"' % (fmt, func.__name__), - 'kwlist', - ] - lst += ['&' + a for a in numberednames] - print >> f, '\tif (!PyArg_ParseTupleAndKeywords(%s))' % ', '.join(lst), - print >> f, tail - - for line in conversions: - print >> f, line - - if USE_CALL_TRACE: - call_fast_args.insert(0, 'TRACE_CALL') - call_fast_args = ', '.join(call_fast_args) - print >> f, '\t%s = %s(%s);' % (putresultin, self.fast_name, - call_fast_args) - if footer: - print >> f, '\t' + footer - print >> f, '\treturn oret;' - - if conversions or footer: - print >> f, ' type_error:' - print >> f, ' return NULL;' - - print >> f, '}' - print >> f - - # ____________________________________________________________ - - def gen_cfunction(self, f, body): - print >> f, self.fast_function_header - print >> f, '{' - - localnames = self.localnames - lengths = [len(a) for a in localnames] - lengths.append(9999) - start = 0 - while start < len(localnames): - total = lengths[start] + 9 - end = start+1 - while total + lengths[end] < 76: - total += lengths[end] + 2 - end += 1 - print >> f, '\t' + '; '.join(localnames[start:end]) + ';' - start = end - - # generate an incref for each input argument - for a in self.graphargs: - print >> f, '\t' + self.cincref(a) - - # print the body - for line in body: - if line.endswith(':'): - if line.startswith('err'): - fmt = '\t%s' - else: - fmt = ' %s\n' - elif line: - fmt = '\t%s\n' - else: - fmt = '%s\n' - f.write(fmt % line) - print >> f, '}' - print >> f - - # ____________________________________________________________ - - def cfunction_body(self): - graph = self.graph - - blocknum = {} - allblocks = [] - - def gen_link(link, linklocalvars=None): - "Generate the code to jump across the given Link." - has_ref = {} - linklocalvars = linklocalvars or {} - for v in to_release: - linklocalvars[v] = self.expr(v) - has_ref = linklocalvars.copy() - for a1, a2 in zip(link.args, link.target.inputargs): - if a1 in linklocalvars: - src = linklocalvars[a1] - else: - src = self.expr(a1) - line = 'MOVE(%s, %s)' % (src, self.expr(a2)) - if a1 in has_ref: - del has_ref[a1] - else: - ct1 = self.ctypeof(a1) - ct2 = self.ctypeof(a2) - assert ct1 == ct2 - line += '\t' + self.cincref(a2) - yield line - for v in has_ref: - yield self.cdecref(v, linklocalvars[v]) - yield 'goto block%d;' % blocknum[link.target] - - # collect all blocks - def visit(block): - if isinstance(block, Block): - allblocks.append(block) - blocknum[block] = len(blocknum) - traverse(visit, graph) - - # generate the body of each block - for block in allblocks: - yield '' - yield 'block%d:' % blocknum[block] - to_release = list(block.inputargs) - for op in block.operations: - err = 'err%d_%d' % (blocknum[block], len(to_release)) - macro = 'OP_%s' % op.opname.upper() - meth = getattr(self, macro, None) - if meth: - yield meth(op, err) - else: - lst = [self.expr(v) for v in op.args] - lst.append(self.expr(op.result)) - lst.append(err) - yield '%s(%s)' % (macro, ', '.join(lst)) - to_release.append(op.result) - - err_reachable = False - if len(block.exits) == 0: - if len(block.inputargs) == 2: # exc_cls, exc_value - # exceptional return block - exc_cls = self.expr(block.inputargs[0]) - exc_value = self.expr(block.inputargs[1]) - yield 'PyErr_Restore(%s, %s, NULL);' % (exc_cls, exc_value) - yield self.return_error - else: - # regular return block - retval = self.expr(block.inputargs[0]) - yield 'FUNCTION_RETURN(%s)' % retval - continue - elif block.exitswitch is None: - # single-exit block - assert len(block.exits) == 1 - for op in gen_link(block.exits[0]): - yield op - yield '' - elif block.exitswitch == Constant(last_exception): - # block catching the exceptions raised by its last operation - # we handle the non-exceptional case first - link = block.exits[0] - assert link.exitcase is None - for op in gen_link(link): - yield op - # we must catch the exception raised by the last operation, - # which goes to the last err%d_%d label written above. - yield '' - to_release.pop() # skip default error handling for this label - yield 'err%d_%d:' % (blocknum[block], len(to_release)) - yield '' - for link in block.exits[1:]: - assert issubclass(link.exitcase, Exception) - yield 'if (PyErr_ExceptionMatches(%s)) {' % ( - self.genc.nameofvalue(link.exitcase),) - yield '\tPyObject *exc_cls, *exc_value, *exc_tb;' - yield '\tPyErr_Fetch(&exc_cls, &exc_value, &exc_tb);' - yield '\tif (exc_value == NULL) {' - yield '\t\texc_value = Py_None;' - yield '\t\tPy_INCREF(Py_None);' - yield '\t}' - yield '\tPy_XDECREF(exc_tb);' - for op in gen_link(link, { - link.last_exception: 'exc_cls', - link.last_exc_value: 'exc_value'}): - yield '\t' + op - yield '}' - err_reachable = True - else: - # block ending in a switch on a value - ct = self.ctypeof(block.exitswitch) - for link in block.exits[:-1]: - assert link.exitcase in (False, True) - yield 'if (%s == %s) {' % (self.expr(block.exitswitch), - self.genc.nameofvalue(link.exitcase, ct)) - for op in gen_link(link): - yield '\t' + op - yield '}' - link = block.exits[-1] - assert link.exitcase in (False, True) - yield 'assert(%s == %s);' % (self.expr(block.exitswitch), - self.genc.nameofvalue(link.exitcase, ct)) - for op in gen_link(block.exits[-1]): - yield op - yield '' - - while to_release: - v = to_release.pop() - if err_reachable: - yield self.cdecref(v) - yield 'err%d_%d:' % (blocknum[block], len(to_release)) - err_reachable = True - if err_reachable: - yield self.return_error - - # ____________________________________________________________ - - # the C preprocessor cannot handle operations taking a variable number - # of arguments, so here are Python methods that do it - - def OP_NEWLIST(self, op, err): - args = [self.expr(v) for v in op.args] - r = self.expr(op.result) - if len(args) == 0: - return 'OP_NEWLIST0(%s, %s)' % (r, err) - else: - args.insert(0, '%d' % len(args)) - return 'OP_NEWLIST((%s), %s, %s)' % (', '.join(args), r, err) - - def OP_NEWDICT(self, op, err): - args = [self.expr(v) for v in op.args] - r = self.expr(op.result) - if len(args) == 0: - return 'OP_NEWDICT0(%s, %s)' % (r, err) - else: - assert len(args) % 2 == 0 - args.insert(0, '%d' % (len(args)//2)) - return 'OP_NEWDICT((%s), %s, %s)' % (', '.join(args), r, err) - - def OP_NEWTUPLE(self, op, err): - args = [self.expr(v) for v in op.args] - r = self.expr(op.result) - args.insert(0, '%d' % len(args)) - return 'OP_NEWTUPLE((%s), %s, %s)' % (', '.join(args), r, err) - - def OP_SIMPLE_CALL(self, op, err): - args = [self.expr(v) for v in op.args] - r = self.expr(op.result) - args.append('NULL') - return 'OP_SIMPLE_CALL((%s), %s, %s)' % (', '.join(args), r, err) - - def OP_CALL_ARGS(self, op, err): - args = [self.expr(v) for v in op.args] - r = self.expr(op.result) - return 'OP_CALL_ARGS((%s), %s, %s)' % (', '.join(args), r, err) - - def OP_DIRECT_CALL(self, op, err): - args = [self.expr(v) for v in op.args] - r = self.expr(op.result) - return '%s = %s(%s); if (PyErr_Occurred()) FAIL(%s)' % ( - r, args[0], ', '.join(args[1:]), err) - - def OP_INST_GETATTR(self, op, err): - return '%s = INST_ATTR_%s__%s(%s);' % ( - self.expr(op.result), - op.args[0].concretetype.typename, - op.args[1].value, - self.expr(op.args[0])) - - def OP_INST_SETATTR(self, op, err): - return 'INST_ATTR_%s__%s(%s) = %s;' % ( - op.args[0].concretetype.typename, - op.args[1].value, - self.expr(op.args[0]), - self.expr(op.args[2])) - - def OP_CONV_TO_OBJ(self, op, err): - v = op.args[0] - return '%s = CONV_TO_OBJ_%s(%s); if (PyErr_Occurred()) FAIL(%s)' % ( - self.expr(op.result), self.ctypeof(v).typename, self.expr(v), err) - - def OP_CONV_FROM_OBJ(self, op, err): - v = op.args[0] - return '%s = CONV_FROM_OBJ_%s(%s); if (PyErr_Occurred()) FAIL(%s)' %( - self.expr(op.result), self.ctypeof(op.result).typename, - self.expr(v), err) - - def OP_INCREF(self, op, err): - return self.cincref(op.args[0]) - - def OP_DECREF(self, op, err): - return self.cdecref(op.args[0]) - - def cincref(self, v): - return 'OP_INCREF_%s(%s)' % (self.ctypeof(v).typename, self.expr(v)) - - def cdecref(self, v, expr=None): - return 'OP_DECREF_%s(%s)' % (self.ctypeof(v).typename, - expr or self.expr(v)) - -# ____________________________________________________________ - -def dummy_wrapper(self, args, kwds): - pass Copied: pypy/dist/pypy/translator/c/funcgen.py (from r12743, pypy/dist/pypy/translator/c/funcdef.py) ============================================================================== --- pypy/dist/pypy/translator/c/funcdef.py (original) +++ pypy/dist/pypy/translator/c/funcgen.py Mon May 23 17:46:29 2005 @@ -1,394 +1,93 @@ from __future__ import generators -from pypy.objspace.flow import FlowObjSpace -from pypy.objspace.flow.model import Variable, Constant, SpaceOperation -from pypy.objspace.flow.model import traverse, uniqueitems, checkgraph -from pypy.objspace.flow.model import Block, Link, FunctionGraph -from pypy.objspace.flow.model import last_exception -from pypy.translator.simplify import simplify_graph -from pypy.translator.unsimplify import remove_direct_loops -from pypy.rpython.typer import PyObjPtr -from pypy.interpreter.pycode import CO_VARARGS -from pypy.tool.compile import compile2 -from types import FunctionType - -from pypy.translator.gensupp import c_string - -# Set this if you want call trace frames to be built -USE_CALL_TRACE = False -# XXX doesn't work any more because of the way gen_wrapper() works, sorry +from pypy.rpython.lltypes import PyObject, GcPtr +from pypy.translator.gensupp import ordered_blocks +from pypy.translator.c.support import cdecl, ErrorValue +from pypy.objspace.flow.model import Variable, Constant, Block +from pypy.objspace.flow.model import traverse, uniqueitems -class FunctionDef: - """ - Collects information about a function which we have to generate. - The operations of each function are collected in a C function - with signature: - - static T fn_xxx(T1 arg1, T2 arg2, etc); - - where the T, T1, T2.. are C types like 'int' or 'PyObject *'. - - If needed, another wrapper function is created with a signature - suitable for the built-in function type of CPython: +PyObjPtr = GcPtr(PyObject) # default type for untyped Vars and Consts - static PyObject *pyfn_xxx(PyObject *self, PyObject *args, PyObject* kw); - The built-in function object, if needed, is put in the global - variable named gfn_xxx. +class FunctionCodeGenerator: + """ + Collects information about a function which we have to generate + from a flow graph. """ - def __init__(self, func, genc, graph=None, fast_name=None): - self.func = func - self.genc = genc - - # get the function name - namespace = genc.namespace - if fast_name is None: - fast_name = namespace.uniquename('fn_' + func.__name__) # fn_xxx - self.fast_name = fast_name - self.base_name = fast_name[3:] # xxx - self.wrapper_name = None # pyfn_xxx - self.globalobject_name = None # gfunc_xxx - self.localscope = namespace.localScope() - - # get the flow graph, and ensure that there is no direct loop in it - # as we cannot generate valid code for this case. - if graph is None: - graph = genc.translator.getflowgraph(func) + def __init__(self, graph, gettype, getvalue): self.graph = graph - remove_direct_loops(genc.translator, graph) - checkgraph(graph) - graph_args = graph.getargs() - - # collect all the local variables - localslst = [] - def visit(node): - if isinstance(node, Block): - localslst.extend(node.getvariables()) - traverse(visit, graph) - fast_set = dict(zip(graph_args, graph_args)) - self.localnames = [self.decl(a) for a in localslst if a not in fast_set] - - # collect all the arguments - fast_args = [self.expr(a) for a in graph_args] - declare_fast_args = [self.decl(a) for a in graph_args] - if USE_CALL_TRACE: - declare_fast_args.insert(0, 'TRACE_ARGS') - declare_fast_args = ', '.join(declare_fast_args) or 'void' - ctret = self.ctypeof(graph.getreturnvar()) - fast_function_header = 'static %s %s(%s)' % ( - ctret.typename, self.fast_name, declare_fast_args) - - # store misc. information - self.fast_function_header = fast_function_header - self.graphargs = graph_args - self.ctret = ctret - self.vararg = bool(func.func_code.co_flags & CO_VARARGS) - self.fast_args = fast_args - self.func_defaults = func.func_defaults or () - - error_return = getattr(ctret, 'error_return', 'NULL') - self.return_error = 'FUNCTION_RETURN(%s)' % error_return - - # generate the forward header - self.genc.globaldecl.append(fast_function_header + '; /* forward */') - - - def ctypeof(self, var_or_const): - return getattr(var_or_const, 'concretetype', PyObjPtr) - - def get_globalobject(self): - if self.globalobject_name is None: - self.wrapper_name = 'py' + self.fast_name - self.globalobject_name = self.genc.pyobj.uniquename('gfunc_' + - self.base_name) - return self.globalobject_name - - def clear(self): - del self.localscope - del self.localnames - del self.graph + self.getvalue = getvalue + self.typemap = self.collecttypes(gettype) + + def collecttypes(self, gettype): + # collect all variables and constants used in the body, + # and get their types now + result = [] + def visit(block): + if isinstance(block, Block): + result.extend(block.inputargs) + for op in block.operations: + result.extend(op.args) + for link in block.exits: + result.extend(link.args) + traverse(visit, self.graph) + typemap = {} + for v in uniqueitems(result): + T = getattr(v, 'concretetype', PyObjPtr) + typemap[v] = gettype(T) + return typemap + + def argnames(self): + return [v.name for v in self.graph.getargs()] + + def allvariables(self): + return [v for v in self.typemap if isinstance(v, Variable)] + + def allconstants(self): + return [v for v in self.typemap if isinstance(v, Constant)] + + def allconstantvalues(self): + for v, T in self.typemap.iteritems(): + if isinstance(v, Constant): + yield v.value def decl(self, v): - assert isinstance(v, Variable) - ct = self.ctypeof(v) - return '%s %s' % (ct.typename, self.localscope.localname(v.name)) + assert isinstance(v, Variable), repr(v) + return cdecl(self.typemap[v], v.name) def expr(self, v): if isinstance(v, Variable): - return self.localscope.localname(v.name) + return v.name elif isinstance(v, Constant): - return self.genc.nameofconst(v, - debug=('Constant in the graph of', self.func)) + return self.getvalue(v.value) else: raise TypeError, "expr(%r)" % (v,) - # ____________________________________________________________ - - def gen_wrapper(self): - # the wrapper is the function that takes the CPython signature - # - # PyObject *fn(PyObject *self, PyObject *args, PyObject *kwds) - # - # and decodes the arguments and calls the "real" C function. - # We generate the wrapper itself as a Python function which is - # turned into C. This makes gen_wrapper() more or less clean. - # - - TPyObject = self.genc.pyobjtype - TInt = self.genc.translator.getconcretetype(CIntType) - TNone = self.genc.translator.getconcretetype(CNoneType) - TBorrowed = self.genc.translator.getconcretetype(CBorrowedPyObjectType) - args_ct = [self.ctypeof(a) for a in self.graphargs] - res_ct = self.ctret - nb_positional_args = len(self.graphargs) - self.vararg - - # "def wrapper(self, args, kwds)" - vself = Variable('self') - vargs = Variable('args') - vkwds = Variable('kwds') - block = Block([vself, vargs, vkwds]) - vfname = Constant(self.base_name) - - # avoid incref/decref on the arguments: 'self' and 'kwds' can be NULL - vself.concretetype = TBorrowed - vargs.concretetype = TBorrowed - vkwds.concretetype = TBorrowed - - # "argument_i = decode_arg(fname, pos, name, vargs, vkwds)" or - # "argument_i = decode_arg_def(fname, pos, name, vargs, vkwds, default)" - varguments = [] - varnames = self.func.func_code.co_varnames - for i in range(nb_positional_args): - opargs = [vfname, Constant(i), - Constant(varnames[i]), vargs, vkwds] - opargs[1].concretetype = TInt - try: - default_value = self.func_defaults[i - nb_positional_args] - except IndexError: - opname = 'decode_arg' - else: - opname = 'decode_arg_def' - opargs.append(Constant(default_value)) - v = Variable('a%d' % i) - block.operations.append(SpaceOperation(opname, opargs, v)) - varguments.append(v) - - if self.vararg: - # "vararg = vargs[n:]" - vararg = Variable('vararg') - opargs = [vargs, Constant(nb_positional_args), Constant(None)] - block.operations.append(SpaceOperation('getslice', opargs, vararg)) - varguments.append(vararg) - else: - # "check_no_more_arg(fname, n, vargs)" - vnone = Variable() - vnone.concretetype = TNone - opargs = [vfname, Constant(nb_positional_args), vargs] - opargs[1].concretetype = TInt - block.operations.append(SpaceOperation('check_no_more_arg', - opargs, vnone)) - - if self.genc.translator.annotator is not None: - # "argument_i = type_conversion_operations(argument_i)" - from pypy.translator.genc.ctyper import GenCSpecializer - from pypy.translator.typer import flatten_ops - typer = GenCSpecializer(self.genc.translator.annotator) - - assert len(varguments) == len(self.graphargs) - for i in range(len(varguments)): - varguments[i].concretetype = TPyObject - varguments[i], convops = typer.convertvar(varguments[i], - args_ct[i]) - flatten_ops(convops, block.operations) - else: - typer = None - - # "result = direct_call(func, argument_0, argument_1, ..)" - opargs = [Constant(self.func)] + varguments - opargs[0].concretetype = self.genc.translator.getconcretetype( - CFuncPtrType, tuple(args_ct), res_ct) - vresult = Variable('result') - block.operations.append(SpaceOperation('direct_call', opargs, vresult)) - - if typer is not None: - # "result2 = type_conversion_operations(result)" - vresult.concretetype = res_ct - vresult, convops = typer.convertvar(vresult, TPyObject) - flatten_ops(convops, block.operations) - - # "return result" - wgraph = FunctionGraph(self.wrapper_name, block) - block.closeblock(Link([vresult], wgraph.returnblock)) - checkgraph(wgraph) - - # generate the C source of this wrapper function - wfuncdef = FunctionDef(dummy_wrapper, self.genc, - wgraph, self.wrapper_name) - self.genc.gen_cfunction(wfuncdef) - - - def DISABLED_OLD_gen_wrapper(self, f): - # XXX this is a huge mess. Think about producing the wrapper by - # generating its content as a flow graph... - func = self.func - f_name = self.wrapper_name - name_of_defaults = self.name_of_defaults - graphargs = self.graphargs - vararg = self.vararg - nb_positional_args = len(graphargs) - vararg - - min_number_of_args = nb_positional_args - len(name_of_defaults) - print >> f, 'static PyObject *' - print >> f, '%s(PyObject* self, PyObject* args, PyObject* kwds)' % ( - f_name,) - print >> f, '{' - if USE_CALL_TRACE: - print >> f, '\tFUNCTION_HEAD(%s, %s, args, %s, __FILE__, __LINE__ - 2)' % ( - c_string('%s(%s)' % (self.base_name, ', '.join(name_of_defaults))), - self.globalobject_name, - '(%s)' % (', '.join(map(c_string, name_of_defaults) + ['NULL']),), - ) - - kwlist = ['"%s"' % name for name in - func.func_code.co_varnames[:func.func_code.co_argcount]] - kwlist.append('0') - print >> f, '\tstatic char* kwlist[] = {%s};' % (', '.join(kwlist),) - - numberednames = ['o%d' % (i+1) for i in range(len(graphargs))] - if vararg: - numberednames[-1] = 'ovararg' - numberednames.append('oret') - print >> f, '\tPyObject *%s;' % (', *'.join(numberednames)) - conversions = [] - call_fast_args = [] - for a, numberedname in zip(graphargs, numberednames): - ct = self.ctypeof(a) - if ct == self.genc.pyobjtype: - call_fast_args.append(numberedname) - else: - convert_from_obj = ct.opname_conv_from_obj # simple conv only! - convertedname = numberedname.replace('o', 'a') - print >> f, '\t%s %s;' % (ct.typename, convertedname) - conversions.append('\tOP_%s(%s, %s, type_error)' % ( - convert_from_obj.upper(), numberedname, convertedname)) - # XXX successfully converted objects may need to be decrefed - # XXX even though they are not PyObjects - call_fast_args.append(convertedname) - # return value conversion - ct = self.ctret - if ct == self.genc.pyobjtype: - putresultin = 'oret' - footer = None - else: - convert_to_obj = ct.opname_conv_to_obj # simple conv only for now! - print >> f, '\t%s aret;' % (ct.typename,) - putresultin = 'aret' - footer = 'OP_%s(aret, oret, type_error)' % convert_to_obj.upper() - print >> f - - if USE_CALL_TRACE: - print >> f, '\tFUNCTION_CHECK()' - - # argument unpacking - if vararg: - print >> f, '\tovararg = PyTuple_GetSlice(args, %d, INT_MAX);' % ( - nb_positional_args,) - print >> f, '\tif (ovararg == NULL)' - print >> f, '\t\tFUNCTION_RETURN(NULL)' - print >> f, '\targs = PyTuple_GetSlice(args, 0, %d);' % ( - nb_positional_args,) - print >> f, '\tif (args == NULL) {' - print >> f, '\t\tERR_DECREF(ovararg)' - print >> f, '\t\tFUNCTION_RETURN(NULL)' - print >> f, '\t}' - tail = """{ -\t\tERR_DECREF(args) -\t\tERR_DECREF(ovararg) -\t\tFUNCTION_RETURN(NULL); -\t} -\tPy_DECREF(args);""" - else: - tail = '\n\t\tFUNCTION_RETURN(NULL)' - for i in range(len(name_of_defaults)): - print >> f, '\t%s = %s;' % ( - numberednames[min_number_of_args+i], - name_of_defaults[i]) - fmt = 'O'*min_number_of_args - if min_number_of_args < nb_positional_args: - fmt += '|' + 'O'*(nb_positional_args-min_number_of_args) - lst = ['args', 'kwds', - '"%s:%s"' % (fmt, func.__name__), - 'kwlist', - ] - lst += ['&' + a for a in numberednames] - print >> f, '\tif (!PyArg_ParseTupleAndKeywords(%s))' % ', '.join(lst), - print >> f, tail - - for line in conversions: - print >> f, line - - if USE_CALL_TRACE: - call_fast_args.insert(0, 'TRACE_CALL') - call_fast_args = ', '.join(call_fast_args) - print >> f, '\t%s = %s(%s);' % (putresultin, self.fast_name, - call_fast_args) - if footer: - print >> f, '\t' + footer - print >> f, '\treturn oret;' - - if conversions or footer: - print >> f, ' type_error:' - print >> f, ' return NULL;' - - print >> f, '}' - print >> f + def error_return_value(self): + T = self.typemap[self.graph.getreturnvar()] + return self.getvalue(ErrorValue(T)) # ____________________________________________________________ - def gen_cfunction(self, f, body): - print >> f, self.fast_function_header - print >> f, '{' - - localnames = self.localnames - lengths = [len(a) for a in localnames] - lengths.append(9999) - start = 0 - while start < len(localnames): - total = lengths[start] + 9 - end = start+1 - while total + lengths[end] < 76: - total += lengths[end] + 2 - end += 1 - print >> f, '\t' + '; '.join(localnames[start:end]) + ';' - start = end - - # generate an incref for each input argument - for a in self.graphargs: - print >> f, '\t' + self.cincref(a) - - # print the body - for line in body: - if line.endswith(':'): - if line.startswith('err'): - fmt = '\t%s' - else: - fmt = ' %s\n' - elif line: - fmt = '\t%s\n' - else: - fmt = '%s\n' - f.write(fmt % line) - print >> f, '}' - print >> f + def cfunction_declarations(self): + # declare the local variables, excluding the function arguments + inputargset = {} + for a in self.graph.getargs(): + inputargset[a] = True + + for v in self.allvariables(): + if v not in inputargset: + yield '%s;' % self.decl(v) # ____________________________________________________________ def cfunction_body(self): graph = self.graph - blocknum = {} - allblocks = [] + # generate an incref for each input argument + for a in self.graph.getargs(): + yield self.cincref(a) def gen_link(link, linklocalvars=None): "Generate the code to jump across the given Link." @@ -402,7 +101,7 @@ src = linklocalvars[a1] else: src = self.expr(a1) - line = 'MOVE(%s, %s)' % (src, self.expr(a2)) + line = '%s = %s;' % (self.expr(a2), src) if a1 in has_ref: del has_ref[a1] else: @@ -416,11 +115,10 @@ yield 'goto block%d;' % blocknum[link.target] # collect all blocks - def visit(block): - if isinstance(block, Block): - allblocks.append(block) - blocknum[block] = len(blocknum) - traverse(visit, graph) + allblocks = ordered_blocks(graph) + blocknum = {} + for block in allblocks: + blocknum[block] = len(blocknum) # generate the body of each block for block in allblocks: @@ -437,7 +135,7 @@ lst = [self.expr(v) for v in op.args] lst.append(self.expr(op.result)) lst.append(err) - yield '%s(%s)' % (macro, ', '.join(lst)) + yield '%s(%s);' % (macro, ', '.join(lst)) to_release.append(op.result) err_reachable = False @@ -447,11 +145,11 @@ exc_cls = self.expr(block.inputargs[0]) exc_value = self.expr(block.inputargs[1]) yield 'PyErr_Restore(%s, %s, NULL);' % (exc_cls, exc_value) - yield self.return_error + yield 'return %s;' % self.error_return_value() else: # regular return block retval = self.expr(block.inputargs[0]) - yield 'FUNCTION_RETURN(%s)' % retval + yield 'return %s;' % retval continue elif block.exitswitch is None: # single-exit block @@ -514,7 +212,7 @@ yield 'err%d_%d:' % (blocknum[block], len(to_release)) err_reachable = True if err_reachable: - yield self.return_error + yield 'return %s;' % self.error_return_value() # ____________________________________________________________ @@ -595,13 +293,7 @@ return self.cdecref(op.args[0]) def cincref(self, v): - return 'OP_INCREF_%s(%s)' % (self.ctypeof(v).typename, self.expr(v)) + return '/*XXX INCREF*/' def cdecref(self, v, expr=None): - return 'OP_DECREF_%s(%s)' % (self.ctypeof(v).typename, - expr or self.expr(v)) - -# ____________________________________________________________ - -def dummy_wrapper(self, args, kwds): - pass + return '/*XXX DECREF*/' Modified: pypy/dist/pypy/translator/c/node.py ============================================================================== --- pypy/dist/pypy/translator/c/node.py (original) +++ pypy/dist/pypy/translator/c/node.py Mon May 23 17:46:29 2005 @@ -1,8 +1,9 @@ from __future__ import generators -from pypy.translator.gensupp import C_IDENTIFIER from pypy.rpython.lltypes import Struct, Array, FuncType, PyObject, typeOf from pypy.rpython.lltypes import GcStruct, GcArray, GC_CONTAINER, ContainerType from pypy.rpython.lltypes import parentlink +from pypy.translator.c.funcgen import FunctionCodeGenerator +from pypy.translator.c.support import cdecl, somelettersfrom def needs_refcount(T): @@ -13,16 +14,6 @@ return False # refcount already in the first first return True -def somelettersfrom(s): - upcase = [c for c in s if c.isupper()] - if not upcase: - upcase = [c for c in s.title() if c.isupper()] - locase = [c for c in s if c.islower()] - if locase and upcase: - return ''.join(upcase).lower() - else: - return s[:2].lower() - class StructDefNode: @@ -86,6 +77,8 @@ yield '\t%s;' % cdecl(self.structname, 'items[%d]' % self.varlength) yield '};' +# ____________________________________________________________ + class ContainerNode: @@ -111,7 +104,7 @@ self.ptrname) def forward_declaration(self): - yield '%s; /* forward */' % ( + yield '%s;' % ( cdecl(self.implementationtypename, self.name)) def implementation(self): @@ -187,54 +180,69 @@ yield '}' -# XXX move FuncNode to funcdef.py -from pypy.objspace.flow.model import * - class FuncNode(ContainerNode): + globalcontainer = True def __init__(self, db, T, obj): graph = obj.graph # only user-defined functions with graphs for now - argnames = [v.name for v in graph.getargs()] + self.funcgen = FunctionCodeGenerator(graph, db.gettype, db.get) self.db = db self.T = T self.obj = obj #self.dependencies = {} self.typename = db.gettype(T) #, who_asks=self) + argnames = self.funcgen.argnames() self.implementationtypename = db.gettype(T, argnames=argnames) self.name = db.namespace.uniquename('g_' + self.basename()) - self.globalcontainer = True self.ptrname = self.name - # collect all variables and constants used in the body, - # and get their types now - result = [] - def visit(block): - if isinstance(block, Block): - result.extend(block.inputargs) - for op in block.operations: - result.extend(op.args) - for link in block.exits: - result.extend(link.args) - traverse(visit, graph) - self.varmap = {} - for v in uniqueitems(result): - T = v.concretetype - self.varmap[v] = self.db.gettype(T) def basename(self): return self.obj._name - def allvariables(self): - return [v for v in self.varmap if isinstance(v, Variable)] - - def allconstants(self): - return [v for v in self.varmap if isinstance(v, Constant)] - def enum_dependencies(self): - return [c.value for c in self.allconstants()] + return self.funcgen.allconstantvalues() def implementation(self): + funcgen = self.funcgen yield '%s {' % cdecl(self.implementationtypename, self.name) - yield '\tlots-of-strange-code' + # + # declare the local variables + # + localnames = list(funcgen.cfunction_declarations()) + lengths = [len(a) for a in localnames] + lengths.append(9999) + start = 0 + while start < len(localnames): + # pack the local declarations over a few lines as possible + total = lengths[start] + 8 + end = start+1 + while total + lengths[end] < 77: + total += lengths[end] + 1 + end += 1 + yield '\t' + ' '.join(localnames[start:end]) + start = end + # + # generate the body itself + # + lineprefix = '' + for line in funcgen.cfunction_body(): + # performs some formatting on the generated body: + # indent normal lines with tabs; indent labels less than the rest + if line.endswith(':'): + if line.startswith('err'): + lineprefix += '\t' + line + continue # merge this 'err:' label with the following line + else: + fmt = '%s %s' + elif line: + fmt = '%s\t%s' + else: + fmt = '%s%s' + yield fmt % (lineprefix, line) + lineprefix = '' + + if lineprefix: # unlikely + yield lineprefix yield '}' @@ -250,16 +258,3 @@ FuncType: FuncNode, PyObject: PyObjectNode, } - -# -# helper -# -def cdecl(ctype, cname): - """ - Produce a C declaration from a 'type template' and an identifier. - The type template must contain a '@' sign at the place where the - name should be inserted, according to the strange C syntax rules. - """ - # the (@) case is for functions, where if there is a plain (@) around - # the function name, we don't need the very confusing parenthesis - return ctype.replace('(@)', '@').replace('@', cname).strip() Modified: pypy/dist/pypy/translator/c/primitive.py ============================================================================== --- pypy/dist/pypy/translator/c/primitive.py (original) +++ pypy/dist/pypy/translator/c/primitive.py Mon May 23 17:46:29 2005 @@ -40,3 +40,11 @@ Bool: 'char @', Void: 'void @', } + +PrimitiveErrorValue = { + Signed: '-1', + Unsigned: '((unsigned) -1)', + Char: '((char) -1)', + Bool: '((char) -1)', + Void: '/* error */', + } Added: pypy/dist/pypy/translator/c/support.py ============================================================================== --- (empty file) +++ pypy/dist/pypy/translator/c/support.py Mon May 23 17:46:29 2005 @@ -0,0 +1,47 @@ +from pypy.translator.gensupp import NameManager + +class ErrorValue: + def __init__(self, TYPE): + self.TYPE = TYPE + + +# +# helpers +# +def cdecl(ctype, cname): + """ + Produce a C declaration from a 'type template' and an identifier. + The type template must contain a '@' sign at the place where the + name should be inserted, according to the strange C syntax rules. + """ + # the (@) case is for functions, where if there is a plain (@) around + # the function name, we don't need the very confusing parenthesis + return ctype.replace('(@)', '@').replace('@', cname).strip() + +def somelettersfrom(s): + upcase = [c for c in s if c.isupper()] + if not upcase: + upcase = [c for c in s.title() if c.isupper()] + locase = [c for c in s if c.islower()] + if locase and upcase: + return ''.join(upcase).lower() + else: + return s[:2].lower() + + +class CNameManager(NameManager): + def __init__(self): + NameManager.__init__(self) + # keywords cannot be reused. This is the C99 draft's list. + self.make_reserved_names(''' + auto enum restrict unsigned + break extern return void + case float short volatile + char for signed while + const goto sizeof _Bool + continue if static _Complex + default inline struct _Imaginary + do int switch + double long typedef + else register union + ''') From pedronis at codespeak.net Mon May 23 19:54:38 2005 From: pedronis at codespeak.net (pedronis at codespeak.net) Date: Mon, 23 May 2005 19:54:38 +0200 (CEST) Subject: [pypy-svn] r12749 - pypy/dist/pypy/objspace/flow Message-ID: <20050523175438.90FDF27B5D@code1.codespeak.net> Author: pedronis Date: Mon May 23 19:54:38 2005 New Revision: 12749 Modified: pypy/dist/pypy/objspace/flow/objspace.py Log: let flow-space capture sys methods used in our codebase Modified: pypy/dist/pypy/objspace/flow/objspace.py ============================================================================== --- pypy/dist/pypy/objspace/flow/objspace.py (original) +++ pypy/dist/pypy/objspace/flow/objspace.py Mon May 23 19:54:38 2005 @@ -69,6 +69,8 @@ Constant('api_version'): True, Constant('exit'): True, Constant('exc_info'): True, + Constant('getrefcount'): True, + Constant('getdefaultencoding'): True, # this is an incomplete list of true constants. # if we add much more, a dedicated class # might be considered for special objects. From pedronis at codespeak.net Mon May 23 19:56:19 2005 From: pedronis at codespeak.net (pedronis at codespeak.net) Date: Mon, 23 May 2005 19:56:19 +0200 (CEST) Subject: [pypy-svn] r12750 - pypy/dist/pypy/module/unicodedata Message-ID: <20050523175619.3254427B5D@code1.codespeak.net> Author: pedronis Date: Mon May 23 19:56:18 2005 New Revision: 12750 Modified: pypy/dist/pypy/module/unicodedata/generate_unicodedb.py pypy/dist/pypy/module/unicodedata/unicodedb.py Log: use 'in' instead of 'has_key' Modified: pypy/dist/pypy/module/unicodedata/generate_unicodedb.py ============================================================================== --- pypy/dist/pypy/module/unicodedata/generate_unicodedb.py (original) +++ pypy/dist/pypy/module/unicodedata/generate_unicodedb.py Mon May 23 19:56:18 2005 @@ -208,19 +208,19 @@ return _decimal[code] def isdecimal(code): - return _decimal.has_key(code) + return code in _decimal def digit(code): return _digit[code] def isdigit(code): - return _digit.has_key(code) + return code in _digit def numeric(code): return _numeric[code] def isnumeric(code): - return _numeric.has_key(code) + return code in _numeric ''' # Combining @@ -308,7 +308,7 @@ table = read_unicodedata(infile) print >> outfile, '# UNICODE CHARACTER DATABASE' - print >> outfile, '# This file was genrated with the command:' + print >> outfile, '# This file was generated with the command:' print >> outfile, '# ', ' '.join(sys.argv) print >> outfile writeUnicodedata(unidata_version, table, outfile) Modified: pypy/dist/pypy/module/unicodedata/unicodedb.py ============================================================================== --- pypy/dist/pypy/module/unicodedata/unicodedb.py (original) +++ pypy/dist/pypy/module/unicodedata/unicodedb.py Mon May 23 19:56:18 2005 @@ -1,5 +1,5 @@ # UNICODE CHARACTER DATABASE -# This file was genrated with the command: +# This file was generated with the command: # ./generate_unicodedb.py -o unicodedb.py UnicodeData-3.2.0.txt CompositionExclusions-3.2.0.txt version = '3.2.0' @@ -15889,19 +15889,19 @@ return _decimal[code] def isdecimal(code): - return _decimal.has_key(code) + return code in _decimal def digit(code): return _digit[code] def isdigit(code): - return _digit.has_key(code) + return code in _digit def numeric(code): return _numeric[code] def isnumeric(code): - return _numeric.has_key(code) + return code in _numeric _combining = { From pedronis at codespeak.net Mon May 23 19:58:36 2005 From: pedronis at codespeak.net (pedronis at codespeak.net) Date: Mon, 23 May 2005 19:58:36 +0200 (CEST) Subject: [pypy-svn] r12751 - pypy/dist/pypy/annotation Message-ID: <20050523175836.A869627B5D@code1.codespeak.net> Author: pedronis Date: Mon May 23 19:58:36 2005 New Revision: 12751 Modified: pypy/dist/pypy/annotation/binaryop.py pypy/dist/pypy/annotation/bookkeeper.py pypy/dist/pypy/annotation/builtin.py pypy/dist/pypy/annotation/model.py pypy/dist/pypy/annotation/unaryop.py Log: support for - 1-char unicode strings as SomeUnicodeCodePoint - dict.get Modified: pypy/dist/pypy/annotation/binaryop.py ============================================================================== --- pypy/dist/pypy/annotation/binaryop.py (original) +++ pypy/dist/pypy/annotation/binaryop.py Mon May 23 19:58:36 2005 @@ -5,6 +5,7 @@ from pypy.annotation.pairtype import pair, pairtype from pypy.annotation.model import SomeObject, SomeInteger, SomeBool from pypy.annotation.model import SomeString, SomeChar, SomeList, SomeDict +from pypy.annotation.model import SomeUnicodeCodePoint from pypy.annotation.model import SomeTuple, SomeImpossibleValue from pypy.annotation.model import SomeInstance, SomeBuiltin, SomeIterator from pypy.annotation.model import SomePBC, SomeSlice, SomeFloat @@ -247,6 +248,11 @@ def union((chr1, chr2)): return SomeChar() +class __extend__(pairtype(SomeUnicodeCodePoint, SomeUnicodeCodePoint)): + + def union((uchr1, uchr2)): + return SomeUnicodeCodePoint() + class __extend__(pairtype(SomeString, SomeObject)): def mod((str, args)): Modified: pypy/dist/pypy/annotation/bookkeeper.py ============================================================================== --- pypy/dist/pypy/annotation/bookkeeper.py (original) +++ pypy/dist/pypy/annotation/bookkeeper.py Mon May 23 19:58:36 2005 @@ -140,6 +140,8 @@ result = SomeChar() else: result = SomeString() + elif tp is unicode and len(x) == 1: + result = SomeUnicodeCodePoint() elif tp is tuple: result = SomeTuple(items = [self.immutablevalue(e) for e in x]) elif tp is float: Modified: pypy/dist/pypy/annotation/builtin.py ============================================================================== --- pypy/dist/pypy/annotation/builtin.py (original) +++ pypy/dist/pypy/annotation/builtin.py Mon May 23 19:58:36 2005 @@ -7,6 +7,7 @@ from pypy.tool.ansi_print import ansi_print from pypy.annotation.model import SomeInteger, SomeObject, SomeChar, SomeBool from pypy.annotation.model import SomeList, SomeString, SomeTuple, SomeSlice +from pypy.annotation.model import SomeUnicodeCodePoint from pypy.annotation.model import SomeFloat, unionof from pypy.annotation.bookkeeper import getbookkeeper from pypy.objspace.flow.model import Constant @@ -42,8 +43,11 @@ def builtin_chr(s_int): return SomeChar() -def builtin_unicode(s_obj): # XXX - return SomeString() +def builtin_unichr(s_int): + return SomeUnicodeCodePoint() + +def builtin_unicode(s_obj): + raise TypeError, "unicode() calls should not happen at interp-level" def our_issubclass(cls1, cls2): """ we're going to try to be less silly in the face of old-style classes""" @@ -187,7 +191,7 @@ return SomeInteger() def unicodedata_decimal(s_uchr): - return SomeInteger() + raise TypeError, "unicodedate.decimal() calls should not happen at interp-level" def test(*args): return SomeBool() Modified: pypy/dist/pypy/annotation/model.py ============================================================================== --- pypy/dist/pypy/annotation/model.py (original) +++ pypy/dist/pypy/annotation/model.py Mon May 23 19:58:36 2005 @@ -180,6 +180,9 @@ class SomeChar(SomeString): "Stands for an object known to be a string of length 1." +class SomeUnicodeCodePoint(SomeObject): + knowntype = unicode + "Stands for an object known to be a unicode codepoint." class SomeList(SomeObject): "Stands for a homogenous list of any length." Modified: pypy/dist/pypy/annotation/unaryop.py ============================================================================== --- pypy/dist/pypy/annotation/unaryop.py (original) +++ pypy/dist/pypy/annotation/unaryop.py Mon May 23 19:58:36 2005 @@ -7,6 +7,7 @@ from pypy.annotation.pairtype import pair from pypy.annotation.model import SomeObject, SomeInteger, SomeBool from pypy.annotation.model import SomeString, SomeChar, SomeList, SomeDict +from pypy.annotation.model import SomeUnicodeCodePoint from pypy.annotation.model import SomeTuple, SomeImpossibleValue from pypy.annotation.model import SomeInstance, SomeBuiltin, SomeFloat from pypy.annotation.model import SomeIterator, SomePBC, new_or_old_class @@ -241,6 +242,9 @@ def iter(dct): return SomeIterator(dct.dictdef.read_key()) + def method_get(dct, key, dfl): + return unionof(dct.dictdef.read_value(), dfl) + def method_copy(dct): return dct @@ -285,6 +289,11 @@ def len(chr): return immutablevalue(1) +class __extend__(SomeUnicodeCodePoint): + + def ord(uchr): + return SomeInteger(nonneg=True) + class __extend__(SomeIterator): From pedronis at codespeak.net Mon May 23 20:03:43 2005 From: pedronis at codespeak.net (pedronis at codespeak.net) Date: Mon, 23 May 2005 20:03:43 +0200 (CEST) Subject: [pypy-svn] r12752 - pypy/dist/pypy/objspace/std Message-ID: <20050523180343.13D7227B5D@code1.codespeak.net> Author: pedronis Date: Mon May 23 20:03:42 2005 New Revision: 12752 Modified: pypy/dist/pypy/objspace/std/objspace.py pypy/dist/pypy/objspace/std/unicodeobject.py pypy/dist/pypy/objspace/std/unicodetype.py Log: - assert unicode results (or arguments) as W_UnicodeObjects beyond the inferred W_Root - made unicode_join__Unicode_ANY type-proper - hackish fix for types of W_UnicodeObject.__init__ in space.wrap(unicode) Modified: pypy/dist/pypy/objspace/std/objspace.py ============================================================================== --- pypy/dist/pypy/objspace/std/objspace.py (original) +++ pypy/dist/pypy/objspace/std/objspace.py Mon May 23 20:03:42 2005 @@ -200,7 +200,7 @@ if isinstance(x, str): return W_StringObject(self, x) if isinstance(x, unicode): - return W_UnicodeObject(self, [u for u in x]) + return W_UnicodeObject(self, [unichr(ord(u)) for u in x]) # xxx if isinstance(x, dict): items_w = [(self.wrap(k), self.wrap(v)) for (k, v) in x.iteritems()] return W_DictObject(self, items_w) Modified: pypy/dist/pypy/objspace/std/unicodeobject.py ============================================================================== --- pypy/dist/pypy/objspace/std/unicodeobject.py (original) +++ pypy/dist/pypy/objspace/std/unicodeobject.py Mon May 23 20:03:42 2005 @@ -31,6 +31,9 @@ # Helper for converting int/long def unicode_to_decimal_w(space, w_unistr): + if not isinstance(w_unistr, W_UnicodeObject): + raise OperationError(space.w_TypeError, + space.wrap("expected unicode")) unistr = w_unistr._value result = ['\0'] * len(unistr) digits = [ '0', '1', '2', '3', '4', @@ -52,7 +55,9 @@ # string-to-unicode delegation def delegate_String2Unicode(w_str): space = w_str.space - return space.call_function(space.w_unicode, w_str) + w_uni = space.call_function(space.w_unicode, w_str) + assert isinstance(w_uni, W_UnicodeObject) # help the annotator! + return w_uni def str_w__Unicode(space, w_uni): return space.str_w(space.str(w_uni)) @@ -150,33 +155,38 @@ totlen = 0 if len(list) == 0: return W_UnicodeObject(space, []) + values_list = [None] * len(list) + values_list[0] = [u'\0'] for i in range(len(list)): item = list[i] if space.is_true(space.isinstance(item, space.w_unicode)): - list[i] = item._value + pass elif space.is_true(space.isinstance(item, space.w_str)): - list[i] = space.call_function(space.w_unicode, item)._value + item = space.call_function(space.w_unicode, item) else: w_msg = space.mod(space.wrap('sequence item %d: expected string or Unicode'), space.wrap(i)) raise OperationError(space.w_TypeError, w_msg) - totlen += len(list[i]) - totlen += len(delim) * (len(list) - 1) - if len(list) == 1: - return W_UnicodeObject(space, list[0]) + assert isinstance(item, W_UnicodeObject) + item = item._value + totlen += len(item) + values_list[i] = item + totlen += len(delim) * (len(values_list) - 1) + if len(values_list) == 1: + return W_UnicodeObject(space, values_list[0]) # Allocate result result = [u'\0'] * totlen - first = list[0] + first = values_list[0] for i in range(len(first)): result[i] = first[i] offset = len(first) - for i in range(1, len(list)): - item = list[i] + for i in range(1, len(values_list)): + item = values_list[i] # Add delimiter for j in range(len(delim)): result[offset + j] = delim[j] offset += len(delim) - # Add item from list + # Add item from values_list for j in range(len(item)): result[offset + j] = item[j] offset += len(item) Modified: pypy/dist/pypy/objspace/std/unicodetype.py ============================================================================== --- pypy/dist/pypy/objspace/std/unicodetype.py (original) +++ pypy/dist/pypy/objspace/std/unicodetype.py Mon May 23 20:03:42 2005 @@ -102,6 +102,8 @@ w_value = unicode_from_object(space, w_obj) else: w_value = unicode_from_encoded_object(space, w_obj, w_encoding, w_errors) + # help the annotator! also the ._value depends on W_UnicodeObject layout + assert isinstance(w_value, W_UnicodeObject) w_newobj = space.allocate_instance(W_UnicodeObject, w_unicodetype) w_newobj.__init__(space, w_value._value) return w_newobj From ludal at codespeak.net Mon May 23 20:05:24 2005 From: ludal at codespeak.net (ludal at codespeak.net) Date: Mon, 23 May 2005 20:05:24 +0200 (CEST) Subject: [pypy-svn] r12753 - pypy/dist/pypy/module/recparser Message-ID: <20050523180524.D338727B5D@code1.codespeak.net> Author: ludal Date: Mon May 23 20:05:24 2005 New Revision: 12753 Added: pypy/dist/pypy/module/recparser/tuplebuilder.py Log: * a builder that builds directly a tuple tree bypassing the syntax tree Added: pypy/dist/pypy/module/recparser/tuplebuilder.py ============================================================================== --- (empty file) +++ pypy/dist/pypy/module/recparser/tuplebuilder.py Mon May 23 20:05:24 2005 @@ -0,0 +1,61 @@ + +from grammar import BaseGrammarBuilder +from syntaxtree import TOKEN_MAP, SYMBOLS, NT_OFFSET + + +def _expand_nodes( nodes ): + expanded = [] + for n in nodes: + if n[0]==-2: + expanded.extend( expand_nodes(n[1:]) ) + else: + expanded.append(n) + return tuple(expanded) + +def expand_nodes( nodes ): + r = _expand_nodes( nodes ) + for n in nodes: + assert type(n[0])==int + return r + +class TupleBuilder(BaseGrammarBuilder): + """A builder that directly produce the AST""" + + def __init__( self, rules=None, debug=0, lineno=False ): + BaseGrammarBuilder.__init__(self, rules, debug ) + self.lineno = True + + def alternative( self, rule, source ): + # Do nothing, keep rule on top of the stack + if rule.is_root(): + node = [ SYMBOLS.get( rule.name, (0,rule.name) ) ] + node += expand_nodes( [self.stack[-1]] ) + self.stack[-1] = tuple(node) + return True + + def sequence(self, rule, source, elts_number): + """ """ + if rule.is_root(): + node = [ SYMBOLS.get( rule.name, (0,rule.name) ) ] + else: + node = [ -2 ] + if elts_number>0: + node += expand_nodes( self.stack[-elts_number:] ) + self.stack[-elts_number:] = [tuple(node)] + else: + self.stack.append( tuple(node) ) + return True + + def token(self, name, value, source): + num = TOKEN_MAP.get( name, -1) + lineno = source.current_line() + if value is None: + if name not in ("NEWLINE", "INDENT", "DEDENT", "ENDMARKER"): + value = name + else: + value = '' + if self.lineno: + self.stack.append( (num, value, lineno) ) + else: + self.stack.append( (num, value) ) + return True From arigo at codespeak.net Mon May 23 23:50:36 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Mon, 23 May 2005 23:50:36 +0200 (CEST) Subject: [pypy-svn] r12755 - in pypy/dist/pypy: objspace/flow rpython tool translator/c translator/c/test Message-ID: <20050523215036.D81BA27B66@code1.codespeak.net> Author: arigo Date: Mon May 23 23:50:36 2005 New Revision: 12755 Modified: pypy/dist/pypy/objspace/flow/model.py pypy/dist/pypy/rpython/lltypes.py pypy/dist/pypy/tool/uid.py pypy/dist/pypy/translator/c/database.py pypy/dist/pypy/translator/c/funcgen.py pypy/dist/pypy/translator/c/node.py pypy/dist/pypy/translator/c/pyobj.py pypy/dist/pypy/translator/c/support.py pypy/dist/pypy/translator/c/test/test_database.py Log: - Moved the logic of class Constant in a base class pypy.tool.uid.Hashable. - Reused Hashable as the base class for a class _pyobject in lltypes. - More in-development changes to fully support PyObjects in translator/c/. - A few bug fixes. Modified: pypy/dist/pypy/objspace/flow/model.py ============================================================================== --- pypy/dist/pypy/objspace/flow/model.py (original) +++ pypy/dist/pypy/objspace/flow/model.py Mon May 23 23:50:36 2005 @@ -4,6 +4,7 @@ # the below object/attribute model evolved from # a discussion in Berlin, 4th of october 2003 from __future__ import generators +from pypy.tool.uid import Hashable """ memory size before and after introduction of __slots__ @@ -218,37 +219,9 @@ self._name = name + '_' + self.name[1:] -class Constant: - __slots__ = ["key", "value", "concretetype"] - - def __init__(self, value): - self.value = value # a concrete value - # try to be smart about constant mutable or immutable values - key = type(self.value), self.value # to avoid confusing e.g. 0 and 0.0 - try: - hash(key) - except TypeError: - key = id(self.value) - self.key = key - - def __eq__(self, other): - return self.__class__ is other.__class__ and self.key == other.key +class Constant(Hashable): + __slots__ = ["concretetype"] - def __ne__(self, other): - return not (self == other) - - def __hash__(self): - return hash(self.key) - - def __repr__(self): - # try to limit the size of the repr to make it more readable - r = repr(self.value) - if (r.startswith('<') and r.endswith('>') and - hasattr(self.value, '__name__')): - r = '%s %s' % (type(self.value).__name__, self.value.__name__) - elif len(r) > 60 or (len(r) > 30 and type(self.value) is not str): - r = r[:20] + '...' + r[-8:] - return '(%s)' % (r,) class SpaceOperation: __slots__ = "opname args result offset".split() Modified: pypy/dist/pypy/rpython/lltypes.py ============================================================================== --- pypy/dist/pypy/rpython/lltypes.py (original) +++ pypy/dist/pypy/rpython/lltypes.py Mon May 23 23:50:36 2005 @@ -1,6 +1,7 @@ import weakref import py from pypy.rpython.rarithmetic import r_uint +from pypy.tool.uid import Hashable class frozendict(dict): @@ -545,6 +546,22 @@ def __str__(self): return "func %s" % self._name +class _pyobject(Hashable): + _TYPE = PyObject + + def _parentstructure(self): + return None + + def _check(self): + pass + + def __repr__(self): + return '<%s>' % (self,) + + def __str__(self): + return "pyobject %s" % (super(_pyobject, self).__str__(),) + + def malloc(T, n=None): if isinstance(T, Struct): o = _struct(T, n) @@ -559,3 +576,8 @@ raise TypeError, "function() for FuncTypes only" o = _func(TYPE, _name=name, **attrs) return _ptr(NonGcPtr(TYPE), o) + +def pyobject(obj, **flags): + T = _PtrType(PyObject, **flags) + o = _pyobject(obj) + return _ptr(T, o) Modified: pypy/dist/pypy/tool/uid.py ============================================================================== --- pypy/dist/pypy/tool/uid.py (original) +++ pypy/dist/pypy/tool/uid.py Mon May 23 23:50:36 2005 @@ -18,3 +18,44 @@ representation makes sense """ return fixid(id(obj)) + + +class Hashable(object): + """ + A Hashable instance encapsulates any object, but is always usable as a + key in dictionaries. This is based on id() for mutable objects and on + real hash/compare for immutable ones. + """ + __slots__ = ["key", "value"] + + def __init__(self, value): + self.value = value # a concrete value + # try to be smart about constant mutable or immutable values + key = type(self.value), self.value # to avoid confusing e.g. 0 and 0.0 + try: + hash(key) + except TypeError: + key = id(self.value) + self.key = key + + def __eq__(self, other): + return self.__class__ is other.__class__ and self.key == other.key + + def __ne__(self, other): + return not (self == other) + + def __hash__(self): + return hash(self.key) + + def __repr__(self): + return '(%s)' % (self,) + + def __str__(self): + # try to limit the size of the repr to make it more readable + r = repr(self.value) + if (r.startswith('<') and r.endswith('>') and + hasattr(self.value, '__name__')): + r = '%s %s' % (type(self.value).__name__, self.value.__name__) + elif len(r) > 60 or (len(r) > 30 and type(self.value) is not str): + r = r[:20] + '...' + r[-8:] + return r Modified: pypy/dist/pypy/translator/c/database.py ============================================================================== --- pypy/dist/pypy/translator/c/database.py (original) +++ pypy/dist/pypy/translator/c/database.py Mon May 23 23:50:36 2005 @@ -8,6 +8,7 @@ from pypy.translator.c.node import StructDefNode, ArrayDefNode from pypy.translator.c.node import ContainerNodeClass from pypy.translator.c.support import cdecl, CNameManager, ErrorValue +#from pypy.translator.c.pyobj import PyObjMaker # ____________________________________________________________ @@ -19,6 +20,7 @@ self.containernodes = {} self.containerlist = [] self.namespace = CNameManager() + #self.pyobjmaker = PyObjMaker(self.namespace) def gettypedefnode(self, T, varlength=1): if varlength <= 1: @@ -51,7 +53,7 @@ who_asks.dependencies[node] = True return 'struct %s @' % node.name elif T == PyObject: - return 'PyObject' + return 'PyObject @' elif isinstance(T, FuncType): resulttype = self.gettype(T.RESULT) argtypes = [] @@ -84,8 +86,10 @@ T = obj.TYPE if isinstance(T, Primitive): return PrimitiveErrorValue[T] - else: + elif isinstance(T, _PtrType): return 'NULL' + else: + raise Exception("don't know about %r" % (T,)) else: T = typeOf(obj) if isinstance(T, Primitive): Modified: pypy/dist/pypy/translator/c/funcgen.py ============================================================================== --- pypy/dist/pypy/translator/c/funcgen.py (original) +++ pypy/dist/pypy/translator/c/funcgen.py Mon May 23 23:50:36 2005 @@ -1,12 +1,14 @@ from __future__ import generators -from pypy.rpython.lltypes import PyObject, GcPtr from pypy.translator.gensupp import ordered_blocks from pypy.translator.c.support import cdecl, ErrorValue +from pypy.translator.c.support import llvalue_from_constant from pypy.objspace.flow.model import Variable, Constant, Block from pypy.objspace.flow.model import traverse, uniqueitems +from pypy.rpython.lltypes import GcPtr, NonGcPtr, PyObject -PyObjPtr = GcPtr(PyObject) # default type for untyped Vars and Consts +PyObjGcPtr = GcPtr(PyObject) +PyObjNonGcPtr = NonGcPtr(PyObject) class FunctionCodeGenerator: @@ -18,7 +20,7 @@ def __init__(self, graph, gettype, getvalue): self.graph = graph self.getvalue = getvalue - self.typemap = self.collecttypes(gettype) + self.typemap, self.returntype = self.collecttypes(gettype) def collecttypes(self, gettype): # collect all variables and constants used in the body, @@ -33,10 +35,17 @@ result.extend(link.args) traverse(visit, self.graph) typemap = {} + returnvar = self.graph.getreturnvar() + result.append(returnvar) for v in uniqueitems(result): - T = getattr(v, 'concretetype', PyObjPtr) + if isinstance(v, Variable): + T = getattr(v, 'concretetype', PyObjGcPtr) + else: + T = getattr(v, 'concretetype', PyObjNonGcPtr) typemap[v] = gettype(T) - return typemap + if v is returnvar: + returntype = T + return typemap, returntype def argnames(self): return [v.name for v in self.graph.getargs()] @@ -50,7 +59,7 @@ def allconstantvalues(self): for v, T in self.typemap.iteritems(): if isinstance(v, Constant): - yield v.value + yield llvalue_from_constant(v) def decl(self, v): assert isinstance(v, Variable), repr(v) @@ -65,8 +74,7 @@ raise TypeError, "expr(%r)" % (v,) def error_return_value(self): - T = self.typemap[self.graph.getreturnvar()] - return self.getvalue(ErrorValue(T)) + return self.getvalue(ErrorValue(self.returntype)) # ____________________________________________________________ Modified: pypy/dist/pypy/translator/c/node.py ============================================================================== --- pypy/dist/pypy/translator/c/node.py (original) +++ pypy/dist/pypy/translator/c/node.py Mon May 23 23:50:36 2005 @@ -1,5 +1,5 @@ from __future__ import generators -from pypy.rpython.lltypes import Struct, Array, FuncType, PyObject, typeOf +from pypy.rpython.lltypes import Struct, Array, FuncType, PyObjectType, typeOf from pypy.rpython.lltypes import GcStruct, GcArray, GC_CONTAINER, ContainerType from pypy.rpython.lltypes import parentlink from pypy.translator.c.funcgen import FunctionCodeGenerator @@ -247,14 +247,24 @@ class PyObjectNode(ContainerNode): - basename = 'BOOOM' + globalcontainer = True + typename = 'PyObject @' + implementationtypename = 'PyObject *@' + + def __init__(self, db, T, obj): + # obj is a _pyobject here; obj.value is the underlying CPython object + self.db = db + self.T = T + self.obj = obj + self.name = db.namespace.uniquename('g_' + WORKING_ON_IT) + self.ptrname = self.name ContainerNodeClass = { - Struct: StructNode, - GcStruct: StructNode, - Array: ArrayNode, - GcArray: ArrayNode, - FuncType: FuncNode, - PyObject: PyObjectNode, + Struct: StructNode, + GcStruct: StructNode, + Array: ArrayNode, + GcArray: ArrayNode, + FuncType: FuncNode, + PyObjectType: PyObjectNode, } Modified: pypy/dist/pypy/translator/c/pyobj.py ============================================================================== --- pypy/dist/pypy/translator/c/pyobj.py (original) +++ pypy/dist/pypy/translator/c/pyobj.py Mon May 23 23:50:36 2005 @@ -4,9 +4,6 @@ from pypy.objspace.flow.model import Variable, Constant from pypy.translator.gensupp import builtin_base, NameManager -from pypy.translator.c.repr import Repr - -from pypy.translator.gensupp import builtin_base, NameManager from pypy.rpython.rarithmetic import r_int, r_uint @@ -17,29 +14,15 @@ from pypy.interpreter.baseobjspace import ObjSpace -class ReprPyObject(Repr): - """Handles 'PyObject*'; factored out from GenC. +class PyObjMaker: + """Handles 'PyObject*'; factored out from LowLevelDatabase. This class contains all the nameof_xxx() methods that allow a wild variety of Python objects to be 'pickled' as Python source code that will reconstruct them. """ - def __init__(self, translator): - self.translator = translator - self.namespace = NameManager() - # keywords cannot be reused. This is the C99 draft's list. - self.namespace.make_reserved_names(''' - auto enum restrict unsigned - break extern return void - case float short volatile - char for signed while - const goto sizeof _Bool - continue if static _Complex - default inline struct _Imaginary - do int switch - double long typedef - else register union - ''') + def __init__(self, namespace): + self.namespace = namespace self.cnames = {Constant(None).key: 'Py_None', Constant(False).key: 'Py_False', Constant(True).key: 'Py_True', Modified: pypy/dist/pypy/translator/c/support.py ============================================================================== --- pypy/dist/pypy/translator/c/support.py (original) +++ pypy/dist/pypy/translator/c/support.py Mon May 23 23:50:36 2005 @@ -1,3 +1,4 @@ +from pypy.rpython import lltypes from pypy.translator.gensupp import NameManager class ErrorValue: @@ -29,6 +30,16 @@ return s[:2].lower() +def llvalue_from_constant(c): + try: + T = c.concretetype + except AttributeError: + return lltypes.pyobject(c.value) + else: + assert lltypes.typeOf(c.value) == T + return c.value + + class CNameManager(NameManager): def __init__(self): NameManager.__init__(self) Modified: pypy/dist/pypy/translator/c/test/test_database.py ============================================================================== --- pypy/dist/pypy/translator/c/test/test_database.py (original) +++ pypy/dist/pypy/translator/c/test/test_database.py Mon May 23 23:50:36 2005 @@ -1,5 +1,6 @@ import autopath, sys from pypy.rpython.lltypes import * +from pypy.translator.translator import Translator from pypy.translator.c.database import LowLevelDatabase from pypy.objspace.flow.model import Constant, Variable, SpaceOperation from pypy.objspace.flow.model import Block, Link, FunctionGraph @@ -133,3 +134,26 @@ db.complete() db.write_all_declarations(sys.stdout) db.write_all_implementations(sys.stdout) + +def WORKING_ON_test_untyped_func(): + def f(x): + return x+1 + t = Translator(f) + graph = t.getflowgraph() + + F = FuncType([GcPtr(PyObject)], GcPtr(PyObject)) + f = function(F, "f", graph=graph) + db = LowLevelDatabase() + db.get(f) + db.complete() + db.write_all_declarations(sys.stdout) + db.write_all_implementations(sys.stdout) + + S = GcStruct('testing', ('fptr', NonGcPtr(F))) + s = malloc(S) + s.fptr = f + db = LowLevelDatabase() + db.get(s) + db.complete() + db.write_all_declarations(sys.stdout) + db.write_all_implementations(sys.stdout) From arigo at codespeak.net Tue May 24 01:29:39 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Tue, 24 May 2005 01:29:39 +0200 (CEST) Subject: [pypy-svn] r12756 - in pypy/dist/pypy/translator/c: . test Message-ID: <20050523232939.A0F1627B5D@code1.codespeak.net> Author: arigo Date: Tue May 24 01:29:39 2005 New Revision: 12756 Added: pypy/dist/pypy/translator/c/g_include.h - copied, changed from r12755, pypy/dist/pypy/translator/genc/g_include.h pypy/dist/pypy/translator/c/g_module.h - copied unchanged from r12755, pypy/dist/pypy/translator/genc/g_module.h pypy/dist/pypy/translator/c/g_support.h - copied unchanged from r12755, pypy/dist/pypy/translator/genc/g_support.h pypy/dist/pypy/translator/c/g_trace.h - copied unchanged from r12755, pypy/dist/pypy/translator/genc/g_trace.h pypy/dist/pypy/translator/c/pyobj_include.h - copied unchanged from r12755, pypy/dist/pypy/translator/genc/pyobj_include.h Modified: pypy/dist/pypy/translator/c/database.py pypy/dist/pypy/translator/c/funcgen.py pypy/dist/pypy/translator/c/node.py pypy/dist/pypy/translator/c/pyobj.py pypy/dist/pypy/translator/c/test/test_database.py Log: - Reasonable(?) support for PyObjects is integrated again. - Generating complete modules again, too. Modified: pypy/dist/pypy/translator/c/database.py ============================================================================== --- pypy/dist/pypy/translator/c/database.py (original) +++ pypy/dist/pypy/translator/c/database.py Tue May 24 01:29:39 2005 @@ -8,7 +8,7 @@ from pypy.translator.c.node import StructDefNode, ArrayDefNode from pypy.translator.c.node import ContainerNodeClass from pypy.translator.c.support import cdecl, CNameManager, ErrorValue -#from pypy.translator.c.pyobj import PyObjMaker +from pypy.translator.c.pyobj import PyObjMaker # ____________________________________________________________ @@ -20,7 +20,7 @@ self.containernodes = {} self.containerlist = [] self.namespace = CNameManager() - #self.pyobjmaker = PyObjMaker(self.namespace) + self.pyobjmaker = PyObjMaker(self.namespace, self.get) def gettypedefnode(self, T, varlength=1): if varlength <= 1: @@ -104,39 +104,20 @@ raise Exception("don't know about %r" % (obj,)) def complete(self): - for node in self.containerlist: + i = 0 + while True: + self.pyobjmaker.collect_initcode() + if i == len(self.containerlist): + break + node = self.containerlist[i] for value in node.enum_dependencies(): if isinstance(typeOf(value), ContainerType): self.getcontainernode(value) else: self.get(value) + i += 1 def globalcontainers(self): for node in self.containerlist: if node.globalcontainer: yield node - - def write_all_declarations(self, f): - print >> f - print >> f, '/********************************************************/' - print >> f, '/*** Structure definitions ***/' - print >> f - for node in self.structdeflist: - for line in node.definition(): - print >> f, line - print >> f - print >> f, '/********************************************************/' - print >> f, '/*** Forward declarations ***/' - print >> f - for node in self.globalcontainers(): - for line in node.forward_declaration(): - print >> f, line - - def write_all_implementations(self, f): - print >> f - print >> f, '/********************************************************/' - print >> f, '/*** Implementations ***/' - for node in self.globalcontainers(): - print >> f - for line in node.implementation(): - print >> f, line Modified: pypy/dist/pypy/translator/c/funcgen.py ============================================================================== --- pypy/dist/pypy/translator/c/funcgen.py (original) +++ pypy/dist/pypy/translator/c/funcgen.py Tue May 24 01:29:39 2005 @@ -69,7 +69,7 @@ if isinstance(v, Variable): return v.name elif isinstance(v, Constant): - return self.getvalue(v.value) + return self.getvalue(llvalue_from_constant(v)) else: raise TypeError, "expr(%r)" % (v,) Copied: pypy/dist/pypy/translator/c/g_include.h (from r12755, pypy/dist/pypy/translator/genc/g_include.h) ============================================================================== --- pypy/dist/pypy/translator/genc/g_include.h (original) +++ pypy/dist/pypy/translator/c/g_include.h Tue May 24 01:29:39 2005 @@ -14,10 +14,4 @@ #include "g_support.h" #include "g_module.h" -#include "heapobject_include.h" -#include "int_include.h" -#include "list_include.h" -#include "none_include.h" #include "pyobj_include.h" -#include "tuple_include.h" -#include "ll_include.h" Modified: pypy/dist/pypy/translator/c/node.py ============================================================================== --- pypy/dist/pypy/translator/c/node.py (original) +++ pypy/dist/pypy/translator/c/node.py Tue May 24 01:29:39 2005 @@ -256,9 +256,15 @@ self.db = db self.T = T self.obj = obj - self.name = db.namespace.uniquename('g_' + WORKING_ON_IT) + self.name = db.pyobjmaker.computenameof(obj.value) self.ptrname = self.name + def enum_dependencies(self): + return [] + + def implementation(self): + return [] + ContainerNodeClass = { Struct: StructNode, Modified: pypy/dist/pypy/translator/c/pyobj.py ============================================================================== --- pypy/dist/pypy/translator/c/pyobj.py (original) +++ pypy/dist/pypy/translator/c/pyobj.py Tue May 24 01:29:39 2005 @@ -6,6 +6,7 @@ from pypy.translator.gensupp import builtin_base, NameManager from pypy.rpython.rarithmetic import r_int, r_uint +from pypy.rpython.lltypes import pyobject # XXX maybe this can be done more elegantly: # needed to convince should_translate_attr @@ -21,60 +22,48 @@ reconstruct them. """ - def __init__(self, namespace): + def __init__(self, namespace, getvalue): self.namespace = namespace - self.cnames = {Constant(None).key: 'Py_None', - Constant(False).key: 'Py_False', - Constant(True).key: 'Py_True', - } + self.getvalue = getvalue self.initcode = [ # list of lines for the module's initxxx() 'import new, types, sys', - 'Py_None = None', - 'Py_False = False', - 'Py_True = True', ] - self.globaldecl = [] self.latercode = [] # list of generators generating extra lines # for later in initxxx() -- for recursive # objects - self.globalobjects = [] self.debugstack = () # linked list of nested nameof() def nameof(self, obj, debug=None): - key = Constant(obj).key + if debug: + stackentry = debug, obj + else: + stackentry = obj + self.debugstack = (self.debugstack, stackentry) try: - return self.cnames[key] - except KeyError: - if debug: - stackentry = debug, obj - else: - stackentry = obj - self.debugstack = (self.debugstack, stackentry) - obj_builtin_base = builtin_base(obj) - if obj_builtin_base in (object, int, long) and type(obj) is not obj_builtin_base: - # assume it's a user defined thingy - name = self.nameof_instance(obj) - else: - for cls in type(obj).__mro__: - meth = getattr(self, - 'nameof_' + cls.__name__.replace(' ', ''), - None) - if meth: - break - else: - raise Exception, "nameof(%r)" % (obj,) - name = meth(obj) + return self.getvalue(pyobject(obj)) + finally: self.debugstack, x = self.debugstack assert x is stackentry - self.cnames[key] = name - return name + + def computenameof(self, obj): + obj_builtin_base = builtin_base(obj) + if obj_builtin_base in (object, int, long) and type(obj) is not obj_builtin_base: + # assume it's a user defined thingy + return self.nameof_instance(obj) + else: + for cls in type(obj).__mro__: + meth = getattr(self, + 'nameof_' + cls.__name__.replace(' ', ''), + None) + if meth: + break + else: + raise Exception, "nameof(%r)" % (obj,) + return meth(obj) def uniquename(self, basename): - name = self.namespace.uniquename(basename) - self.globalobjects.append(name) - self.globaldecl.append('static PyObject *%s;' % (name,)) - return name + return self.namespace.uniquename(basename) def initcode_python(self, name, pyexpr): # generate init code that will evaluate the given Python expression @@ -420,36 +409,26 @@ def later(self, gen): self.latercode.append((gen, self.debugstack)) - def collect_globals(self, genc): + def collect_initcode(self): while self.latercode: gen, self.debugstack = self.latercode.pop() #self.initcode.extend(gen) -- eats TypeError! bad CPython! for line in gen: self.initcode.append(line) self.debugstack = () - if genc.f2 is not None: - for line in self.initcode: - print >> genc.f2, line - del self.initcode[:] - result = self.globaldecl - self.globaldecl = [] - return result - - def getfrozenbytecode(self, genc): - if genc.f2 is not None: - genc.f2.seek(0) - self.initcode.insert(0, genc.f2.read()) + + def getfrozenbytecode(self): self.initcode.append('') source = '\n'.join(self.initcode) del self.initcode[:] - co = compile(source, genc.modname, 'exec') - del source + co = compile(source, '', 'exec') + originalsource = source small = zlib.compress(marshal.dumps(co)) source = """if 1: import zlib, marshal exec marshal.loads(zlib.decompress(%r))""" % small # Python 2.2 SyntaxError without newline: Bug #501622 source += '\n' - co = compile(source, genc.modname, 'exec') + co = compile(source, '', 'exec') del source - return marshal.dumps(co) + return marshal.dumps(co), originalsource Modified: pypy/dist/pypy/translator/c/test/test_database.py ============================================================================== --- pypy/dist/pypy/translator/c/test/test_database.py (original) +++ pypy/dist/pypy/translator/c/test/test_database.py Tue May 24 01:29:39 2005 @@ -7,6 +7,20 @@ from pypy.rpython.lltypes import Struct, Array, malloc +def dump_on_stdout(database): + print '/*********************************/' + for node in database.structdeflist: + for line in node.definition(): + print line + print + for node in database.globalcontainers(): + for line in node.forward_declaration(): + print line + for node in database.globalcontainers(): + print + for line in node.implementation(): + print line + def test_primitive(): db = LowLevelDatabase() @@ -62,8 +76,7 @@ s.p = cast_flags(NonGcPtr(U), s.u) db.get(s) db.complete() - db.write_all_declarations(sys.stdout) - db.write_all_implementations(sys.stdout) + dump_on_stdout(db) def test_codegen_2(): db = LowLevelDatabase() @@ -77,8 +90,7 @@ s.aptr = a db.get(s) db.complete() - db.write_all_declarations(sys.stdout) - db.write_all_implementations(sys.stdout) + dump_on_stdout(db) def test_codegen_3(): db = LowLevelDatabase() @@ -97,8 +109,7 @@ s.anarray = cast_flags(NonGcPtr(A.y), a.y) db.get(s) db.complete() - db.write_all_declarations(sys.stdout) - db.write_all_implementations(sys.stdout) + dump_on_stdout(db) def test_func_simple(): # -------------------- flowgraph building -------------------- @@ -123,8 +134,7 @@ db = LowLevelDatabase() db.get(f) db.complete() - db.write_all_declarations(sys.stdout) - db.write_all_implementations(sys.stdout) + dump_on_stdout(db) S = GcStruct('testing', ('fptr', NonGcPtr(F))) s = malloc(S) @@ -132,10 +142,9 @@ db = LowLevelDatabase() db.get(s) db.complete() - db.write_all_declarations(sys.stdout) - db.write_all_implementations(sys.stdout) + dump_on_stdout(db) -def WORKING_ON_test_untyped_func(): +def test_untyped_func(): def f(x): return x+1 t = Translator(f) @@ -146,8 +155,7 @@ db = LowLevelDatabase() db.get(f) db.complete() - db.write_all_declarations(sys.stdout) - db.write_all_implementations(sys.stdout) + dump_on_stdout(db) S = GcStruct('testing', ('fptr', NonGcPtr(F))) s = malloc(S) @@ -155,5 +163,4 @@ db = LowLevelDatabase() db.get(s) db.complete() - db.write_all_declarations(sys.stdout) - db.write_all_implementations(sys.stdout) + dump_on_stdout(db) From pedronis at codespeak.net Tue May 24 03:39:05 2005 From: pedronis at codespeak.net (pedronis at codespeak.net) Date: Tue, 24 May 2005 03:39:05 +0200 (CEST) Subject: [pypy-svn] r12757 - pypy/dist/pypy/objspace/flow Message-ID: <20050524013905.0ECFC27B60@code1.codespeak.net> Author: pedronis Date: Tue May 24 03:39:04 2005 New Revision: 12757 Modified: pypy/dist/pypy/objspace/flow/model.py Log: more last_exc* sanity checks Modified: pypy/dist/pypy/objspace/flow/model.py ============================================================================== --- pypy/dist/pypy/objspace/flow/model.py (original) +++ pypy/dist/pypy/objspace/flow/model.py Tue May 24 03:39:04 2005 @@ -388,6 +388,12 @@ assert len(link.args) == len(link.target.inputargs) assert link.prevblock is block exc_link = link in exc_links + if exc_link: + assert link.last_exception is not None + assert link.last_exc_value is not None + else: + assert link.last_exception is None + assert link.last_exc_value is None for v in link.args: assert isinstance(v, (Constant, Variable)) if isinstance(v, Variable): From adim at codespeak.net Tue May 24 08:34:22 2005 From: adim at codespeak.net (adim at codespeak.net) Date: Tue, 24 May 2005 08:34:22 +0200 (CEST) Subject: [pypy-svn] r12758 - pypy/branch/pycompiler Message-ID: <20050524063422.A0D4C27B60@code1.codespeak.net> Author: adim Date: Tue May 24 08:34:22 2005 New Revision: 12758 Added: pypy/branch/pycompiler/ - copied from r12757, pypy/dist/pypy/ Log: new branch for developing python parser / compiler and integrating it in PyPy From ludal at codespeak.net Tue May 24 11:52:20 2005 From: ludal at codespeak.net (ludal at codespeak.net) Date: Tue, 24 May 2005 11:52:20 +0200 (CEST) Subject: [pypy-svn] r12759 - pypy/branch/pycompiler/module/recparser Message-ID: <20050524095220.CEA4B27B57@code1.codespeak.net> Author: ludal Date: Tue May 24 11:52:20 2005 New Revision: 12759 Modified: pypy/branch/pycompiler/module/recparser/__init__.py pypy/branch/pycompiler/module/recparser/compat.py pypy/branch/pycompiler/module/recparser/pyparser.py pypy/branch/pycompiler/module/recparser/pythonparse.py pypy/branch/pycompiler/module/recparser/pythonutil.py pypy/branch/pycompiler/module/recparser/syntaxtree.py Log: * reorganisation : move around some functions and defs * add ast_xxx function family to produce ast tree from source Modified: pypy/branch/pycompiler/module/recparser/__init__.py ============================================================================== --- pypy/branch/pycompiler/module/recparser/__init__.py (original) +++ pypy/branch/pycompiler/module/recparser/__init__.py Tue May 24 11:52:20 2005 @@ -3,10 +3,8 @@ from pypy.interpreter.mixedmodule import MixedModule -import pythonutil - debug_print( "Loading grammar %s" % pythonutil.PYTHON_GRAMMAR ) -PYTHON_PARSER = pythonutil.python_grammar() +import pythonutil class Module(MixedModule): """The builtin parser module. Modified: pypy/branch/pycompiler/module/recparser/compat.py ============================================================================== --- pypy/branch/pycompiler/module/recparser/compat.py (original) +++ pypy/branch/pycompiler/module/recparser/compat.py Tue May 24 11:52:20 2005 @@ -1,7 +1,7 @@ """Compatibility layer for CPython's parser module""" from pythonparse import parse_python_source -from pypy.module.recparser import PYTHON_PARSER +from pythonutil import PYTHON_PARSER from compiler import transformer, compile as pycompile def suite( source ): Modified: pypy/branch/pycompiler/module/recparser/pyparser.py ============================================================================== --- pypy/branch/pycompiler/module/recparser/pyparser.py (original) +++ pypy/branch/pycompiler/module/recparser/pyparser.py Tue May 24 11:52:20 2005 @@ -9,7 +9,7 @@ from pypy.interpreter.pycode import PyCode from syntaxtree import SyntaxNode from pythonparse import parse_python_source -from pypy.module.recparser import PYTHON_PARSER +from pythonutil import PYTHON_PARSER __all__ = [ "ASTType", "STType", "suite", "expr" ] Modified: pypy/branch/pycompiler/module/recparser/pythonparse.py ============================================================================== --- pypy/branch/pycompiler/module/recparser/pythonparse.py (original) +++ pypy/branch/pycompiler/module/recparser/pythonparse.py Tue May 24 11:52:20 2005 @@ -1,16 +1,32 @@ #!/usr/bin/env python -from grammar import BaseGrammarBuilder from pythonlexer import PythonSource from ebnfparse import parse_grammar import sys -import pythonutil +import os import symbol +import grammar -def parse_python_source( textsrc, gram, goal ): +# parse the python grammar corresponding to our CPython version +_ver = ".".join([str(i) for i in sys.version_info[:2]]) +PYTHON_GRAMMAR = os.path.join( os.path.dirname(__file__), "data", "Grammar" + _ver ) + +def python_grammar(): + """returns a """ + level = grammar.DEBUG + grammar.DEBUG = 0 + gram = parse_grammar( file(PYTHON_GRAMMAR) ) + grammar.DEBUG = level + return gram + +PYTHON_PARSER = python_grammar() + + +def parse_python_source( textsrc, gram, goal, builder=None ): """Parse a python source according to goal""" target = gram.rules[goal] src = PythonSource(textsrc) - builder = BaseGrammarBuilder(debug=False, rules=gram.rules) + if builder is None: + builder = grammar.BaseGrammarBuilder(debug=False, rules=gram.rules) result = target.match(src, builder) # XXX find a clean way to process encoding declarations if src.encoding: @@ -20,46 +36,17 @@ raise SyntaxError("at %s" % src.debug() ) return builder -def parse_file_input(pyf, gram): +def parse_file_input(pyf, gram, builder=None): """Parse a python file""" - return parse_python_source( pyf.read(), gram, "file_input" ) + return parse_python_source( pyf.read(), gram, "file_input", builder ) -def parse_single_input(textsrc, gram): - """Parse a python file""" - return parse_python_source( textsrc, gram, "single_input" ) +def parse_single_input(textsrc, gram, builder=None): + """Parse a python single statement""" + return parse_python_source( textsrc, gram, "single_input", builder ) + +def parse_eval_input(textsrc, gram, builder=None): + """Parse a python expression""" + return parse_python_source( textsrc, gram, "eval_input", builder ) -def parse_eval_input(textsrc, gram): - """Parse a python file""" - return parse_python_source( textsrc, gram, "eval_input" ) -def pypy_parse(filename): - """parse using PyPy's parser module and return nested tuples - """ - pyf = file(filename) - builder = parse_file_input(pyf, pythonutil.python_grammar()) - pyf.close() - if builder.stack: - # print builder.stack[-1] - root_node = builder.stack[-1] - nested_tuples = root_node.totuple() - if hasattr(builder, '_source_encoding'): - # XXX: maybe the parser could fix that instead ? - return ( symbol.encoding_decl, nested_tuples, builder._source_encoding) - else: - return nested_tuples - return None # XXX raise an exception instead - -if __name__ == "__main__": - if len(sys.argv) < 2: - print "python parse.py [-d N] test_file.py" - sys.exit(1) - if sys.argv[1] == "-d": - debug_level = int(sys.argv[2]) - test_file = sys.argv[3] - else: - test_file = sys.argv[1] - print "-"*20 - print - print "pyparse \n", pypy_parse(test_file) - print "parser \n", pythonutil.python_parse(test_file) Modified: pypy/branch/pycompiler/module/recparser/pythonutil.py ============================================================================== --- pypy/branch/pycompiler/module/recparser/pythonutil.py (original) +++ pypy/branch/pycompiler/module/recparser/pythonutil.py Tue May 24 11:52:20 2005 @@ -1,30 +1,11 @@ -__all__ = ["python_grammar", "PYTHON_GRAMMAR" ] +__all__ = ["python_parse", "pypy_parse","ast_single_input", "ast_file_input", "ast_eval_input" ] -import os -import sys - -_ver = ".".join([str(i) for i in sys.version_info[:2]]) -PYTHON_GRAMMAR = os.path.join( os.path.dirname(__file__), "data", "Grammar" + _ver ) - -def python_grammar(): - """returns a """ - from ebnfparse import parse_grammar - level = get_debug() - set_debug( 0 ) - gram = parse_grammar( file(PYTHON_GRAMMAR) ) - set_debug( level ) - return gram - -def get_debug(): - """Return debug level""" - import grammar - return grammar.DEBUG - -def set_debug( level ): - """sets debug mode to """ - import grammar - grammar.DEBUG = level +import grammar +import pythonparse +from compiler.transformer import Transformer +from tuplebuilder import TupleBuilder +PYTHON_PARSER = pythonparse.PYTHON_PARSER def python_parse(filename): """parse using CPython's parser module and return nested tuples @@ -33,3 +14,64 @@ import parser tp2 = parser.suite(pyf.read()) return tp2.totuple() + +def pypy_parse(filename): + """parse using PyPy's parser module and return nested tuples + """ + pyf = file(filename) + builder = parse_file_input(pyf, pythonutil.PYTHON_PARSER ) + pyf.close() + if builder.stack: + # print builder.stack[-1] + root_node = builder.stack[-1] + nested_tuples = root_node.totuple() + if hasattr(builder, '_source_encoding'): + # XXX: maybe the parser could fix that instead ? + return ( symbol.encoding_decl, nested_tuples, builder._source_encoding) + else: + return nested_tuples + return None # XXX raise an exception instead + + +def ast_single_input( text ): + builder = TupleBuilder( PYTHON_PARSER.rules ) + pythonparse.parse_python_source( text, PYTHON_PARSER, "single_input", builder ) + tree = builder.stack[-1] + trans = Transformer() + ast = trans.transform( tree ) + return ast + +def ast_file_input( filename ): + pyf = file(filename,"r") + text = pyf.read() + builder = TupleBuilder( PYTHON_PARSER.rules ) + pythonparse.parse_python_source( text, PYTHON_PARSER, "file_input", builder ) + tree = builder.stack[-1] + trans = Transformer() + ast = trans.transform( tree ) + return ast, tree + +def ast_eval_input( textsrc ): + builder = TupleBuilder( PYTHON_PARSER.rules ) + pythonparse.parse_python_source( textsrc, PYTHON_PARSER, "eval_input", builder ) + tree = builder.stack[-1] + trans = Transformer() + ast = trans.transform( tree ) + return ast + + + +if __name__ == "__main__": + import sys + if len(sys.argv) < 2: + print "python parse.py [-d N] test_file.py" + sys.exit(1) + if sys.argv[1] == "-d": + debug_level = int(sys.argv[2]) + test_file = sys.argv[3] + else: + test_file = sys.argv[1] + print "-"*20 + print + print "pyparse \n", pypy_parse(test_file) + print "parser \n", python_parse(test_file) Modified: pypy/branch/pycompiler/module/recparser/syntaxtree.py ============================================================================== --- pypy/branch/pycompiler/module/recparser/syntaxtree.py (original) +++ pypy/branch/pycompiler/module/recparser/syntaxtree.py Tue May 24 11:52:20 2005 @@ -60,7 +60,7 @@ "|" : token.VBAR, "|=" : token.VBAREQUAL, } - +NT_OFFSET = token.NT_OFFSET SYMBOLS = {} # copies the numerical mapping between symbol name and symbol value # into SYMBOLS From arigo at codespeak.net Tue May 24 12:00:24 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Tue, 24 May 2005 12:00:24 +0200 (CEST) Subject: [pypy-svn] r12760 - in pypy/dist/pypy: annotation annotation/test rpython rpython/test translator/c translator/c/test translator/genc translator/genc/test Message-ID: <20050524100024.4E73327B53@code1.codespeak.net> Author: arigo Date: Tue May 24 12:00:23 2005 New Revision: 12760 Added: pypy/dist/pypy/rpython/lltype.py - copied, changed from r12755, pypy/dist/pypy/rpython/lltypes.py pypy/dist/pypy/rpython/rtyper.py - copied, changed from r12755, pypy/dist/pypy/rpython/typer.py pypy/dist/pypy/rpython/test/test_lltype.py - copied, changed from r12755, pypy/dist/pypy/rpython/test/test_lltypes.py pypy/dist/pypy/rpython/test/test_rtyper.py - copied, changed from r12755, pypy/dist/pypy/rpython/test/test_typer.py Removed: pypy/dist/pypy/rpython/lltypes.py pypy/dist/pypy/rpython/test/test_lltypes.py pypy/dist/pypy/rpython/test/test_typer.py pypy/dist/pypy/rpython/typer.py Modified: pypy/dist/pypy/annotation/binaryop.py pypy/dist/pypy/annotation/bookkeeper.py pypy/dist/pypy/annotation/builtin.py pypy/dist/pypy/annotation/model.py pypy/dist/pypy/annotation/test/test_model.py pypy/dist/pypy/annotation/unaryop.py pypy/dist/pypy/rpython/rlist.py pypy/dist/pypy/rpython/test/test_llann.py pypy/dist/pypy/rpython/test/test_rlist.py pypy/dist/pypy/translator/c/database.py pypy/dist/pypy/translator/c/funcgen.py pypy/dist/pypy/translator/c/node.py pypy/dist/pypy/translator/c/primitive.py pypy/dist/pypy/translator/c/pyobj.py pypy/dist/pypy/translator/c/support.py pypy/dist/pypy/translator/c/test/test_database.py pypy/dist/pypy/translator/genc/ctyper.py pypy/dist/pypy/translator/genc/lltype.py pypy/dist/pypy/translator/genc/test/test_lltyped.py Log: Renamed files in rpython: - typer.py ---> rtyper.py - lltypes.py ---> lltype.py Lots of fixes to the import statements in the rest of the code. Modified: pypy/dist/pypy/annotation/binaryop.py ============================================================================== --- pypy/dist/pypy/annotation/binaryop.py (original) +++ pypy/dist/pypy/annotation/binaryop.py Tue May 24 12:00:23 2005 @@ -477,7 +477,6 @@ return pair(s, pbc).union() # annotation of low-level types -from pypy.rpython import lltypes from pypy.annotation.model import SomePtr, ll_to_annotation class __extend__(pairtype(SomePtr, SomePtr)): Modified: pypy/dist/pypy/annotation/bookkeeper.py ============================================================================== --- pypy/dist/pypy/annotation/bookkeeper.py (original) +++ pypy/dist/pypy/annotation/bookkeeper.py Tue May 24 12:00:23 2005 @@ -16,7 +16,6 @@ from pypy.interpreter.pycode import cpython_code_signature from pypy.interpreter.argument import ArgErr from pypy.rpython.rarithmetic import r_uint -from pypy.rpython import lltypes from pypy.tool.unionfind import UnionFind import inspect, new @@ -224,8 +223,6 @@ def valueoftype(self, t): """The most precise SomeValue instance that contains all objects of type t.""" - if isinstance(t, lltypes.LowLevelType): - return ll_to_annotation(t._example()) assert isinstance(t, (type, ClassType)) if t is bool: return SomeBool() Modified: pypy/dist/pypy/annotation/builtin.py ============================================================================== --- pypy/dist/pypy/annotation/builtin.py (original) +++ pypy/dist/pypy/annotation/builtin.py Tue May 24 12:00:23 2005 @@ -247,15 +247,15 @@ # annotation of low-level types from pypy.annotation.model import SomePtr -from pypy.rpython import lltypes +from pypy.rpython import lltype def malloc(T, n=None): assert n is None or n.knowntype == int assert T.is_constant() if n is not None: n = 1 - p = lltypes.malloc(T.const, n) - r = SomePtr(lltypes.typeOf(p)) + p = lltype.malloc(T.const, n) + r = SomePtr(lltype.typeOf(p)) #print "MALLOC", r return r @@ -263,7 +263,7 @@ #print "CAST", s_p assert isinstance(s_p, SomePtr), "casting of non-pointer: %r" % s_p assert PtrT.is_constant() - return SomePtr(ll_ptrtype=lltypes.typeOf(lltypes.cast_flags(PtrT.const, s_p.ll_ptrtype._example()))) + return SomePtr(ll_ptrtype=lltype.typeOf(lltype.cast_flags(PtrT.const, s_p.ll_ptrtype._example()))) def cast_parent(PtrT, s_p): assert isinstance(s_p, SomePtr), "casting of non-pointer: %r" % s_p @@ -272,9 +272,9 @@ parent_p = PtrT._example() candidate_p = s_p.ll_ptrtype._example() parent_p._setfirst(candidate_p) - return SomePtr(ll_ptrtype=lltypes.typeOf(lltypes.cast_parent(PtrT, candidate_p))) + return SomePtr(ll_ptrtype=lltype.typeOf(lltype.cast_parent(PtrT, candidate_p))) -BUILTIN_ANALYZERS[lltypes.malloc] = malloc -BUILTIN_ANALYZERS[lltypes.cast_flags] = cast_flags -BUILTIN_ANALYZERS[lltypes.cast_parent] = cast_parent +BUILTIN_ANALYZERS[lltype.malloc] = malloc +BUILTIN_ANALYZERS[lltype.cast_flags] = cast_flags +BUILTIN_ANALYZERS[lltype.cast_parent] = cast_parent Modified: pypy/dist/pypy/annotation/model.py ============================================================================== --- pypy/dist/pypy/annotation/model.py (original) +++ pypy/dist/pypy/annotation/model.py Tue May 24 12:00:23 2005 @@ -320,14 +320,14 @@ self.ll_ptrtype = ll_ptrtype -from pypy.rpython import lltypes +from pypy.rpython import lltype annotation_to_ll_map = [ - (SomeBool(), lltypes.Bool), - (SomeInteger(), lltypes.Signed), - (SomeInteger(nonneg=True, unsigned=True), lltypes.Unsigned), - (SomeChar(), lltypes.Char), - (SomePBC({None: True}), lltypes.Void), + (SomeBool(), lltype.Bool), + (SomeInteger(), lltype.Signed), + (SomeInteger(nonneg=True, unsigned=True), lltype.Unsigned), + (SomeChar(), lltype.Char), + (SomePBC({None: True}), lltype.Void), ] def annotation_to_lltype(s_val, info=None): @@ -348,7 +348,7 @@ def ll_to_annotation(v): if v is None: raise ValueError, "cannot retrieve Void low-level type value" - typ = lltypes.typeOf(v) + typ = lltype.typeOf(v) s = ll_to_annotation_map.get(typ) if s is None: return SomePtr(typ) Modified: pypy/dist/pypy/annotation/test/test_model.py ============================================================================== --- pypy/dist/pypy/annotation/test/test_model.py (original) +++ pypy/dist/pypy/annotation/test/test_model.py Tue May 24 12:00:23 2005 @@ -103,21 +103,21 @@ assert s1 != s2 def test_ll_to_annotation(): - s_z = ll_to_annotation(lltypes.Signed._defl()) + s_z = ll_to_annotation(lltype.Signed._defl()) s_s = SomeInteger() s_u = SomeInteger(nonneg=True, unsigned=True) assert s_z.contains(s_s) assert not s_z.contains(s_u) - s_uz = ll_to_annotation(lltypes.Unsigned._defl()) + s_uz = ll_to_annotation(lltype.Unsigned._defl()) assert s_uz.contains(s_u) - assert ll_to_annotation(lltypes.Bool._defl()).contains(SomeBool()) - assert ll_to_annotation(lltypes.Char._defl()).contains(SomeChar()) - S = lltypes.GcStruct('s') - A = lltypes.GcArray() - s_p = ll_to_annotation(lltypes.malloc(S)) - assert isinstance(s_p, SomePtr) and s_p.ll_ptrtype == lltypes.GcPtr(S) - s_p = ll_to_annotation(lltypes.malloc(A, 0)) - assert isinstance(s_p, SomePtr) and s_p.ll_ptrtype == lltypes.GcPtr(A) + assert ll_to_annotation(lltype.Bool._defl()).contains(SomeBool()) + assert ll_to_annotation(lltype.Char._defl()).contains(SomeChar()) + S = lltype.GcStruct('s') + A = lltype.GcArray() + s_p = ll_to_annotation(lltype.malloc(S)) + assert isinstance(s_p, SomePtr) and s_p.ll_ptrtype == lltype.GcPtr(S) + s_p = ll_to_annotation(lltype.malloc(A, 0)) + assert isinstance(s_p, SomePtr) and s_p.ll_ptrtype == lltype.GcPtr(A) def test_annotation_to_lltype(): from pypy.rpython.rarithmetic import r_uint @@ -128,25 +128,25 @@ s_u = SomeInteger(nonneg=True, unsigned=True); s_u1 = SomeInteger(nonneg=True, unsigned=True); s_u1.const = r_uint(1) - assert annotation_to_lltype(s_i) == lltypes.Signed - assert annotation_to_lltype(s_pos) == lltypes.Signed - assert annotation_to_lltype(s_1) == lltypes.Signed - assert annotation_to_lltype(s_m1) == lltypes.Signed - assert annotation_to_lltype(s_u) == lltypes.Unsigned - assert annotation_to_lltype(s_u1) == lltypes.Unsigned - assert annotation_to_lltype(SomeBool()) == lltypes.Bool - assert annotation_to_lltype(SomeChar()) == lltypes.Char - PS = lltypes.GcPtr(lltypes.GcStruct('s')) + assert annotation_to_lltype(s_i) == lltype.Signed + assert annotation_to_lltype(s_pos) == lltype.Signed + assert annotation_to_lltype(s_1) == lltype.Signed + assert annotation_to_lltype(s_m1) == lltype.Signed + assert annotation_to_lltype(s_u) == lltype.Unsigned + assert annotation_to_lltype(s_u1) == lltype.Unsigned + assert annotation_to_lltype(SomeBool()) == lltype.Bool + assert annotation_to_lltype(SomeChar()) == lltype.Char + PS = lltype.GcPtr(lltype.GcStruct('s')) s_p = SomePtr(ll_ptrtype=PS) assert annotation_to_lltype(s_p) == PS py.test.raises(ValueError, "annotation_to_lltype(si0)") def test_ll_union(): - PS1 = lltypes.GcPtr(lltypes.GcStruct('s')) - PS2 = lltypes.GcPtr(lltypes.GcStruct('s')) - PS3 = lltypes.GcPtr(lltypes.GcStruct('s3')) - PA1 = lltypes.GcPtr(lltypes.GcArray()) - PA2 = lltypes.GcPtr(lltypes.GcArray()) + PS1 = lltype.GcPtr(lltype.GcStruct('s')) + PS2 = lltype.GcPtr(lltype.GcStruct('s')) + PS3 = lltype.GcPtr(lltype.GcStruct('s3')) + PA1 = lltype.GcPtr(lltype.GcArray()) + PA2 = lltype.GcPtr(lltype.GcArray()) assert unionof(SomePtr(PS1),SomePtr(PS1)) == SomePtr(PS1) assert unionof(SomePtr(PS1),SomePtr(PS2)) == SomePtr(PS2) Modified: pypy/dist/pypy/annotation/unaryop.py ============================================================================== --- pypy/dist/pypy/annotation/unaryop.py (original) +++ pypy/dist/pypy/annotation/unaryop.py Tue May 24 12:00:23 2005 @@ -435,7 +435,6 @@ pass # annotation of low-level types -from pypy.rpython import lltypes from pypy.annotation.model import SomePtr, ll_to_annotation, annotation_to_lltype class __extend__(SomePtr): Copied: pypy/dist/pypy/rpython/lltype.py (from r12755, pypy/dist/pypy/rpython/lltypes.py) ============================================================================== --- pypy/dist/pypy/rpython/lltypes.py (original) +++ pypy/dist/pypy/rpython/lltype.py Tue May 24 12:00:23 2005 @@ -190,7 +190,7 @@ class _PtrType(LowLevelType): def __init__(self, TO, **flags): if not isinstance(TO, ContainerType): - raise TypeError, ("can only point to a Struct or an Array or a FuncType, " + raise TypeError, ("can only point to a Container type, " "not to %s" % (TO,)) if 'gc' in flags: if not isinstance(TO, GC_CONTAINER): @@ -571,13 +571,13 @@ raise TypeError, "malloc for Structs and Arrays only" return _ptr(GcPtr(T), o) -def function(TYPE, name, **attrs): +def functionptr(TYPE, name, **attrs): if not isinstance(TYPE, FuncType): raise TypeError, "function() for FuncTypes only" o = _func(TYPE, _name=name, **attrs) return _ptr(NonGcPtr(TYPE), o) -def pyobject(obj, **flags): +def pyobjectptr(obj, **flags): T = _PtrType(PyObject, **flags) o = _pyobject(obj) return _ptr(T, o) Deleted: /pypy/dist/pypy/rpython/lltypes.py ============================================================================== --- /pypy/dist/pypy/rpython/lltypes.py Tue May 24 12:00:23 2005 +++ (empty file) @@ -1,583 +0,0 @@ -import weakref -import py -from pypy.rpython.rarithmetic import r_uint -from pypy.tool.uid import Hashable - -class frozendict(dict): - - def __hash__(self): - items = self.items() - items.sort() - return hash(tuple(items)) - - -class LowLevelType(object): - def __eq__(self, other): - return self.__class__ is other.__class__ and self.__dict__ == other.__dict__ - def __ne__(self, other): - return not (self == other) - - def __hash__(self): - items = self.__dict__.items() - items.sort() - return hash((self.__class__,) + tuple(items)) - - def __repr__(self): - return '<%s>' % (self,) - - def __str__(self): - return self.__class__.__name__ - - def _defl(self, parent=None, parentindex=None): - raise NotImplementedError - - def _freeze_(self): - return True - - def _inline_is_varsize(self, last): - return False - - -class ContainerType(LowLevelType): - def _inline_is_varsize(self, last): - raise TypeError, "%r cannot be inlined in structure" % self - - -class Struct(ContainerType): - def __init__(self, name, *fields): - self._name = name - flds = {} - names = [] - self._arrayfld = None - for name, typ in fields: - if name.startswith('_'): - raise NameError, ("%s: field name %r should not start with " - "an underscore" % (self._name, name,)) - names.append(name) - if name in flds: - raise TypeError("%s: repeated field name" % self._name) - flds[name] = typ - if isinstance(typ, GC_CONTAINER): - if name == fields[0][0] and isinstance(self, GC_CONTAINER): - pass # can inline a GC_CONTAINER as 1st field of GcStruct - else: - raise TypeError("%s: cannot inline GC container %r" % ( - self._name, typ)) - - # look if we have an inlined variable-sized array as the last field - if fields: - for name, typ in fields[:-1]: - typ._inline_is_varsize(False) - first = False - name, typ = fields[-1] - if typ._inline_is_varsize(True): - self._arrayfld = name - self._flds = frozendict(flds) - self._names = tuple(names) - - def _inline_is_varsize(self, last): - if self._arrayfld: - raise TypeError("cannot inline a var-sized struct " - "inside another struct") - return False - - def __getattr__(self, name): - try: - return self._flds[name] - except KeyError: - raise AttributeError, 'struct %s has no field %r' % (self._name, - name) - - def _str_fields(self): - return ', '.join(['%s: %s' % (name, self._flds[name]) - for name in self._names]) - - def __str__(self): - return "%s %s { %s }" % (self.__class__.__name__, - self._name, self._str_fields()) - - def _defl(self, parent=None, parentindex=None): - return _struct(self, parent=parent, parentindex=parentindex) - - def _container_example(self): - if self._arrayfld is None: - n = None - else: - n = 1 - return _struct(self, n) - -class GcStruct(Struct): - pass - -class Array(ContainerType): - def __init__(self, *fields): - self.OF = Struct("", *fields) - if self.OF._arrayfld is not None: - raise TypeError("array cannot contain an inlined array") - - def _inline_is_varsize(self, last): - if not last: - raise TypeError("array field must be last") - return True - - def __str__(self): - return "%s of { %s }" % (self.__class__.__name__, - self.OF._str_fields(),) - - def _container_example(self): - return _array(self, 1) - -class GcArray(Array): - def _inline_is_varsize(self, last): - raise TypeError("cannot inline a GC array inside a structure") - -class FuncType(ContainerType): - def __init__(self, args, result): - for arg in args: - if isinstance(arg, ContainerType): - raise TypeError, "function arguments can only be primitives or pointers" - self.ARGS = tuple(args) - if isinstance(result, ContainerType): - raise TypeError, "function result can only be primitive or pointer" - self.RESULT = result - - def __str__(self): - args = ', '.join(map(str, self.ARGS)) - return "Func ( %s ) -> %s" % (args, self.RESULT) - - def _container_example(self): - def ex(*args): - return self.RESULT._example() - return _func(self, _callable=ex) - -class PyObjectType(ContainerType): - def __str__(self): - return "PyObject" -PyObject = PyObjectType() - -class ForwardReference(ContainerType): - def become(self, realcontainertype): - if not isinstance(realcontainertype, GC_CONTAINER): - raise TypeError("ForwardReference can only be to GcStruct or " - "GcArray, not %r" % (realcontainertype,)) - self.__class__ = realcontainertype.__class__ - self.__dict__ = realcontainertype.__dict__ - -GC_CONTAINER = (GcStruct, GcArray, PyObjectType, ForwardReference) - - -class Primitive(LowLevelType): - def __init__(self, name, default): - self._name = name - self._default = default - - def __str__(self): - return self._name - - def _defl(self, parent=None, parentindex=None): - return self._default - - _example = _defl - - -Signed = Primitive("Signed", 0) -Unsigned = Primitive("Unsigned", r_uint(0)) -Char = Primitive("Char", '\x00') -Bool = Primitive("Bool", False) -Void = Primitive("Void", None) - - -class _PtrType(LowLevelType): - def __init__(self, TO, **flags): - if not isinstance(TO, ContainerType): - raise TypeError, ("can only point to a Struct or an Array or a FuncType, " - "not to %s" % (TO,)) - if 'gc' in flags: - if not isinstance(TO, GC_CONTAINER): - raise TypeError, ("GcPtr can only point to GcStruct, GcArray or" - " PyObject, not to %s" % (TO,)) - self.TO = TO - self.flags = frozendict(flags) - - def _str_flags(self): - flags = self.flags.keys() - flags.sort() - result = [] - for flag in flags: - if self.flags[flag] is not True: - flag = '%s=%r' % (flag, self.flags[flag]) - result.append(flag) - return ', '.join(result) - - def __str__(self): - return 'ptr(%s) to %s' % (self._str_flags(), self.TO) - - def _defl(self, parent=None, parentindex=None): - return _ptr(self, None) - - def _example(self): - o = self.TO._container_example() - return _ptr(self, o) - - def withflags(self, **flags): - newflags = self.flags.copy() - newflags.update(flags) - return _PtrType(self.TO, **newflags) - -def GcPtr(TO, **flags): - return _PtrType(TO, gc=True, **flags) - -def NonGcPtr(TO, **flags): - return _PtrType(TO, **flags) - - -# ____________________________________________________________ - - -def typeOf(val): - if isinstance(val, bool): - return Bool - if isinstance(val, r_uint): - return Unsigned - if isinstance(val, int): - return Signed - if isinstance(val, str): - assert len(val) == 1 - return Char - if val is None: - return Void # maybe - return val._TYPE - -class InvalidCast(TypeError): - pass - -def cast_flags(PTRTYPE, ptr): - if not isinstance(ptr, _ptr) or not isinstance(PTRTYPE, _PtrType): - raise TypeError, "can only cast pointers to other pointers" - CURTYPE = ptr._TYPE - if CURTYPE.TO != PTRTYPE.TO: - raise TypeError, "cast_flags only between pointers to the same type" - # allowed direct casts (for others, you need several casts): - # * adding one flag - curflags = CURTYPE.flags - newflags = PTRTYPE.flags - if len(curflags) + 1 == len(newflags): - for key in curflags: - if key not in newflags or curflags[key] != newflags[key]: - raise InvalidCast(CURTYPE, PTRTYPE) - # * removing one flag - elif len(curflags) - 1 == len(newflags): - for key in newflags: - if key not in curflags or curflags[key] != newflags[key]: - raise InvalidCast(CURTYPE, PTRTYPE) - # end - else: - raise InvalidCast(CURTYPE, PTRTYPE) - return _ptr(PTRTYPE, ptr._obj) - -def cast_parent(PTRTYPE, ptr): - if not isinstance(ptr, _ptr) or not isinstance(PTRTYPE, _PtrType): - raise TypeError, "can only cast pointers to other pointers" - CURTYPE = ptr._TYPE - if CURTYPE.flags != PTRTYPE.flags: - raise TypeError("cast_parent() cannot change the flags (%s) to (%s)" - % (CURTYPE._str_flags(), PTRTYPE._str_flags())) - # * converting from TO-structure to a parent TO-structure whose first - # field is the original structure - if (not isinstance(CURTYPE.TO, Struct) or - not isinstance(PTRTYPE.TO, Struct) or - len(PTRTYPE.TO._names) == 0 or - PTRTYPE.TO._flds[PTRTYPE.TO._names[0]] != CURTYPE.TO): - raise InvalidCast(CURTYPE, PTRTYPE) - ptr._check() - parent = ptr._obj._wrparent() - PARENTTYPE = ptr._obj._wrparent_type - if getattr(parent, PARENTTYPE._names[0]) is not ptr._obj: - raise InvalidCast(CURTYPE, PTRTYPE) - return _ptr(PTRTYPE, parent) - - -def _TmpPtr(TO): - return _PtrType(TO, _tmp=True) - -def _expose(val, can_have_gc=False): - """XXX A nice docstring here""" - T = typeOf(val) - if isinstance(T, ContainerType): - assert not isinstance(T, FuncType), "functions cannot be substructures" - if can_have_gc and isinstance(T, GcStruct): - val = _ptr(GcPtr(T), val) - else: - val = _ptr(_TmpPtr(T), val) - return val - -def parentlink(container): - parent = container._parentstructure() - if parent is not None: - return parent, container._wrparent_index -## if isinstance(parent, _struct): -## for name in parent._TYPE._names: -## if getattr(parent, name) is container: -## return parent, name -## raise RuntimeError("lost ourselves") -## if isinstance(parent, _array): -## raise TypeError("cannot fish a pointer to an array item or an " -## "inlined substructure of it") -## raise AssertionError("don't know about %r" % (parent,)) - else: - return None, None - - -class _ptr(object): - - def __init__(self, TYPE, pointing_to): - self.__dict__['_TYPE'] = TYPE - self.__dict__['_T'] = TYPE.TO - self.__dict__['_obj'] = pointing_to - - def __eq__(self, other): - if not isinstance(other, _ptr): - raise TypeError("comparing pointer with %r object" % ( - type(other).__name__,)) - if self._TYPE != other._TYPE: - raise TypeError("comparing %r and %r" % (self._TYPE, other._TYPE)) - return self._obj is other._obj - - def __ne__(self, other): - return not (self == other) - - def __nonzero__(self): - return self._obj is not None - - def _check(self): - if self._obj is None: - raise RuntimeError("dereferencing 'NULL' pointer to %r" % (self._T,)) - self._obj._check() - - def __getattr__(self, field_name): # ! can only return basic or ptr ! - if isinstance(self._T, Struct): - if field_name in self._T._flds: - self._check() - o = getattr(self._obj, field_name) - can_have_gc = (field_name == self._T._names[0] and - 'gc' in self._TYPE.flags) - return _expose(o, can_have_gc) - raise AttributeError("%r instance has no field %r" % (self._T, - field_name)) - - def _setfirst(self, p): - if isinstance(self._T, Struct) and self._T._names: - if not isinstance(p, _ptr) or not isinstance(p._obj, _struct): - raise InvalidCast(typeOf(p), typeOf(self)) - field_name = self._T._names[0] - T1 = self._T._flds[field_name] - T2 = typeOf(p._obj) - if T1 != T2: - raise InvalidCast(typeOf(p), typeOf(self)) - self._check() - setattr(self._obj, field_name, p._obj) - p._obj._wrparent = weakref.ref(self._obj) - p._obj._wrparent_type = typeOf(self._obj) - return - raise TypeError("%r instance has no first field" % (self._T,)) - - def __setattr__(self, field_name, val): - if isinstance(self._T, Struct): - if field_name in self._T._flds: - T1 = self._T._flds[field_name] - T2 = typeOf(val) - if T1 != T2: - raise TypeError("%r instance field %r:\n" - "expects %r\n" - " got %r" % (self._T, field_name, T1, T2)) - self._check() - setattr(self._obj, field_name, val) - return - raise AttributeError("%r instance has no field %r" % (self._T, - field_name)) - - def __getitem__(self, i): # ! can only return basic or ptr ! - if isinstance(self._T, Array): - self._check() - if not (0 <= i < len(self._obj.items)): - raise IndexError("array index out of bounds") - o = self._obj.items[i] - return _expose(o) - raise TypeError("%r instance is not an array" % (self._T,)) - - def __setitem__(self, i, val): # ! not allowed ! - if isinstance(self._T, Array): - raise TypeError("cannot directly assign to array items") - raise TypeError("%r instance is not an array" % (self._T,)) - - def __len__(self): - if isinstance(self._T, Array): - self._check() - return len(self._obj.items) - raise TypeError("%r instance is not an array" % (self._T,)) - - def __repr__(self): - return '<%s>' % (self,) - - def __str__(self): - return '%s to %s' % (self._TYPE.__class__.__name__.lower(), self._obj) - - def __call__(self, *args): - if isinstance(self._T, FuncType): - self._check() - if len(args) != len(self._T.ARGS): - raise TypeError,"calling %r with wrong argument number: %r" % (self._T, args) - for a, ARG in zip(args, self._T.ARGS): - if typeOf(a) != ARG: - raise TypeError,"calling %r with wrong argument types: %r" % (self._T, args) - return self._obj._callable(*args) - raise TypeError("%r instance is not a function" % (self._T,)) - - -class _struct(object): - _wrparent = None - - def __init__(self, TYPE, n=None, parent=None, parentindex=None): - self._TYPE = TYPE - if n is not None and TYPE._arrayfld is None: - raise TypeError("%r is not variable-sized" % (TYPE,)) - if n is None and TYPE._arrayfld is not None: - raise TypeError("%r is variable-sized" % (TYPE,)) - for fld, typ in TYPE._flds.items(): - if isinstance(typ, Struct): - value = _struct(typ, parent=self, parentindex=fld) - elif fld == TYPE._arrayfld: - value = _array(typ, n, parent=self, parentindex=fld) - else: - value = typ._defl() - setattr(self, fld, value) - if parent is not None: - self._wrparent_type = typeOf(parent) - self._wrparent = weakref.ref(parent) - self._wrparent_index = parentindex - - def _parentstructure(self): - if self._wrparent is not None: - parent = self._wrparent() - if parent is None: - raise RuntimeError("accessing substructure %r,\n" - "but already garbage collected parent %r" - % (self, self._wrparent_type)) - return parent - return None - - def _check(self): - parent = self._parentstructure() - if parent is not None: - parent._check() - - def __repr__(self): - return '<%s>' % (self,) - - def _str_fields(self): - fields = [] - for name in self._TYPE._names: - T = self._TYPE._flds[name] - if isinstance(T, Primitive): - reprvalue = repr(getattr(self, name)) - else: - reprvalue = '...' - fields.append('%s=%s' % (name, reprvalue)) - return ', '.join(fields) - - def __str__(self): - return 'struct %s { %s }' % (self._TYPE._name, self._str_fields()) - -class _array(object): - _wrparent = None - - def __init__(self, TYPE, n, parent=None, parentindex=None): - if not isinstance(n, int): - raise TypeError, "array length must be an int" - if n < 0: - raise ValueError, "negative array length" - self._TYPE = TYPE - self.items = [TYPE.OF._defl(parent=self, parentindex=j) - for j in range(n)] - if parent is not None: - self._wrparent_type = typeOf(parent) - self._wrparent = weakref.ref(parent) - self._wrparent_index = parentindex - - def _parentstructure(self): - if self._wrparent is not None: - parent = self._wrparent() - if parent is None: - raise RuntimeError("accessing subarray %r,\n" - "but already garbage collected parent %r" - % (self, self._wrparent_type)) - return parent - return None - - def _check(self): - parent = self._parentstructure() - if parent is not None: - parent._check() - - def __repr__(self): - return '<%s>' % (self,) - - def __str__(self): - return 'array [ %s ]' % (', '.join(['{%s}' % item._str_fields() - for item in self.items]),) - -class _func(object): - def __init__(self, TYPE, **attrs): - self._TYPE = TYPE - self._name = "?" - self._callable = None - self.__dict__.update(attrs) - - def _parentstructure(self): - return None - - def _check(self): - if self._callable is None: - raise RuntimeError,"calling undefined function" - - def __repr__(self): - return '<%s>' % (self,) - - def __str__(self): - return "func %s" % self._name - -class _pyobject(Hashable): - _TYPE = PyObject - - def _parentstructure(self): - return None - - def _check(self): - pass - - def __repr__(self): - return '<%s>' % (self,) - - def __str__(self): - return "pyobject %s" % (super(_pyobject, self).__str__(),) - - -def malloc(T, n=None): - if isinstance(T, Struct): - o = _struct(T, n) - elif isinstance(T, Array): - o = _array(T, n) - else: - raise TypeError, "malloc for Structs and Arrays only" - return _ptr(GcPtr(T), o) - -def function(TYPE, name, **attrs): - if not isinstance(TYPE, FuncType): - raise TypeError, "function() for FuncTypes only" - o = _func(TYPE, _name=name, **attrs) - return _ptr(NonGcPtr(TYPE), o) - -def pyobject(obj, **flags): - T = _PtrType(PyObject, **flags) - o = _pyobject(obj) - return _ptr(T, o) Modified: pypy/dist/pypy/rpython/rlist.py ============================================================================== --- pypy/dist/pypy/rpython/rlist.py (original) +++ pypy/dist/pypy/rpython/rlist.py Tue May 24 12:00:23 2005 @@ -1,6 +1,6 @@ import py from pypy.annotation.model import * -from pypy.rpython.lltypes import * +from pypy.rpython.lltype import * from pypy.tool.sourcetools import compile_template Copied: pypy/dist/pypy/rpython/rtyper.py (from r12755, pypy/dist/pypy/rpython/typer.py) ============================================================================== --- pypy/dist/pypy/rpython/typer.py (original) +++ pypy/dist/pypy/rpython/rtyper.py Tue May 24 12:00:23 2005 @@ -1,5 +1,5 @@ import types -from pypy.rpython.lltypes import * +from pypy.rpython.lltype import * from pypy.annotation.model import * from pypy.objspace.flow.model import Variable, Constant, SpaceOperation from pypy.translator.typer import Specializer, flatten_ops, TyperError @@ -203,8 +203,10 @@ try: functyp = python_function.TYPE except AttributeError: + inputargs_s = [ll_to_annotation(t._example()) + for t in argtypes] s_returnvalue = self.annotator.build_types(python_function, - argtypes) + inputargs_s) inferred_type = annotation_to_lltype(s_returnvalue, info=python_function) if inferred_type != restype: Modified: pypy/dist/pypy/rpython/test/test_llann.py ============================================================================== --- pypy/dist/pypy/rpython/test/test_llann.py (original) +++ pypy/dist/pypy/rpython/test/test_llann.py Tue May 24 12:00:23 2005 @@ -1,4 +1,4 @@ -from pypy.rpython.lltypes import * +from pypy.rpython.lltype import * from pypy.annotation import model as annmodel @@ -94,6 +94,6 @@ def llf(p): return p(0) a = self.RPythonAnnotator() - s = a.build_types(llf, [PF]) + s = a.build_types(llf, [annmodel.SomePtr(PF)]) assert s.knowntype == int Copied: pypy/dist/pypy/rpython/test/test_lltype.py (from r12755, pypy/dist/pypy/rpython/test/test_lltypes.py) ============================================================================== --- pypy/dist/pypy/rpython/test/test_lltypes.py (original) +++ pypy/dist/pypy/rpython/test/test_lltype.py Tue May 24 12:00:23 2005 @@ -1,5 +1,5 @@ -from pypy.rpython.lltypes import * -from pypy.rpython.lltypes import _TmpPtr +from pypy.rpython.lltype import * +from pypy.rpython.lltype import _TmpPtr def test_basics(): S0 = GcStruct("s0", ('a', Signed), ('b', Signed)) Deleted: /pypy/dist/pypy/rpython/test/test_lltypes.py ============================================================================== --- /pypy/dist/pypy/rpython/test/test_lltypes.py Tue May 24 12:00:23 2005 +++ (empty file) @@ -1,259 +0,0 @@ -from pypy.rpython.lltypes import * -from pypy.rpython.lltypes import _TmpPtr - -def test_basics(): - S0 = GcStruct("s0", ('a', Signed), ('b', Signed)) - assert S0.a == Signed - assert S0.b == Signed - s0 = malloc(S0) - print s0 - assert typeOf(s0) == GcPtr(S0) - assert s0.a == 0 - assert s0.b == 0 - assert typeOf(s0.a) == Signed - s0.a = 1 - s0.b = s0.a - assert s0.a == 1 - assert s0.b == 1 - # simple array - Ar = GcArray(('v', Signed)) - x = malloc(Ar,0) - print x - assert len(x) == 0 - x = malloc(Ar,3) - print x - assert typeOf(x) == GcPtr(Ar) - assert typeOf(x[0]) == _TmpPtr(Ar.OF) - assert typeOf(x[0].v) == Signed - assert x[0].v == 0 - x[0].v = 1 - x[1].v = 2 - x[2].v = 3 - assert [x[z].v for z in range(3)] == [1, 2, 3] - # - def define_list(T): - List_typ = GcStruct("list", - ("items", GcPtr(GcArray(('item',T))))) - def newlist(): - l = malloc(List_typ) - items = malloc(List_typ.items.TO, 0) - l.items = items - return l - - def append(l, newitem): - length = len(l.items) - newitems = malloc(List_typ.items.TO, length+1) - i = 0 - while i v1 = cast_flags(self) - # v2 = simple_call(v1, ...) --> v2 = simple_call(meth, v1, ...) - # - # where 'v1' becomes a pointer with the (method='method_name') flag. - # It points to 'self', but the flag modifies its meaning to - # "pointer to the method 'method_name' of self" instead of just - # "pointer to self". - # - method_name = pattern[0] - s_self = pattern[1] - method = substitution[0] - SELFPTR = substitution[1] - METHODPTR = SELFPTR.withflags(method=method_name) - s_method_name = self.annotator.bookkeeper.immutablevalue(method_name) - - self['getattr', s_self, s_method_name] = ( - 'cast_flags', SELFPTR, None, METHODPTR) - - s_method = s_self.find_method(method_name) - self[('simple_call', s_method) + pattern[2:]] = ( - method, SELFPTR) + substitution[2:] - - def maketype(self, cls, s_annotation): - try: - return self.typecache[cls, s_annotation] - except KeyError: - newtype = cls(s_annotation) - self.typecache[cls, s_annotation] = newtype - newtype.define(self) - return newtype - - def annotation2concretetype(self, s_value): - try: - return annotation_to_lltype(s_value) - except ValueError: - if isinstance(s_value, SomeList): - return self.maketype(ListType, s_value).LISTPTR - return PyObjPtr - - def convertvar(self, v, concretetype): - """Get the operation(s) needed to convert 'v' to the given type.""" - ops = [] - v_concretetype = getattr(v, 'concretetype', PyObjPtr) - if isinstance(v, Constant): - # we should never modify a Constant in-place - v = Constant(v.value) - v.concretetype = concretetype - - elif v_concretetype != concretetype: - try: - subst = self.concreteconversions[v_concretetype, concretetype] - except KeyError: - raise TyperError("cannot convert from %r\n" - "to %r" % (v_concretetype, concretetype)) - vresult = Variable() - op = SpaceOperation('?', [v], vresult) - flatten_ops(self.substitute_op(op, subst), ops) - v = vresult - - return v, ops - - def specialized_op(self, op, bindings): - assert len(op.args) == len(bindings) - - # first check for direct low-level operations on pointers - if op.args and isinstance(bindings[0], SomePtr): - PTR = bindings[0].ll_ptrtype - - if op.opname == 'getitem': - s_result = self.annotator.binding(op.result) - T = annotation_to_lltype(s_result, 'getitem') - return self.typed_op(op, [PTR, Signed], T, - newopname='getarrayitem') - - if op.opname == 'len': - return self.typed_op(op, [PTR], Signed, - newopname='getarraysize') - - if op.opname == 'getattr': - assert isinstance(op.args[1], Constant) - s_result = self.annotator.binding(op.result) - FIELD_TYPE = PTR.TO._flds[op.args[1].value] - T = annotation_to_lltype(s_result, 'getattr') - if isinstance(FIELD_TYPE, ContainerType): - newopname = 'getsubstruct' - else: - newopname = 'getfield' - return self.typed_op(op, [PTR, Void], T, newopname=newopname) - - if op.opname == 'setattr': - assert isinstance(op.args[1], Constant) - FIELD_TYPE = PTR.TO._flds[op.args[1].value] - assert not isinstance(FIELD_TYPE, ContainerType) - return self.typed_op(op, [PTR, Void, FIELD_TYPE], Void, - newopname='setfield') - - if op.opname == 'eq': - return self.typed_op(op, [PTR, PTR], Bool, - newopname='ptr_eq') - if op.opname == 'ne': - return self.typed_op(op, [PTR, PTR], Bool, - newopname='ptr_ne') - - # generic specialization based on the registration table - patternlist = self.registry.get(op.opname, []) - for pattern, substitution in patternlist: - if pattern and pattern[-1] is Ellipsis: - pattern = pattern[:-1] - if len(pattern) > len(op.args): - continue - elif len(pattern) != len(op.args): - continue - for s_match, s_value in zip(pattern, bindings): - if not s_match.contains(s_value): - break - else: - # match! - try: - return self.substitute_op(op, substitution) - except Retry: - return self.specialized_op(op, bindings) - - # specialization not found - argtypes = [self.defaultconcretetype] * len(op.args) - return self.typed_op(op, argtypes, self.defaultconcretetype) - - def substitute_op(self, op, substitution): - if isinstance(substitution, tuple): - newopname = substitution[0] - argtypes = substitution[1:-1] - resulttype = substitution[-1] - assert len(argtypes) == len(op.args) - # None in the substitution list means "remove this argument" - while None in argtypes: - argtypes = list(argtypes) - i = argtypes.index(None) - del argtypes[i] - args = list(op.args) - del args[i] - op = SpaceOperation(op.opname, args, op.result) - return self.typed_op(op, argtypes, resulttype, - newopname = newopname) - else: - assert callable(substitution), "type error in the registry tables" - return substitution(self, op) - - def typed_op(self, op, argtypes, restype, newopname=None): - if isinstance(newopname, types.FunctionType): - python_function = newopname - newargs = [Constant(python_function)] + op.args - op = SpaceOperation('simple_call', newargs, op.result) - try: - functyp = python_function.TYPE - except AttributeError: - s_returnvalue = self.annotator.build_types(python_function, - argtypes) - inferred_type = annotation_to_lltype(s_returnvalue, - info=python_function) - if inferred_type != restype: - raise TyperError("%r return type mismatch:\n" - "declared %r\n" - "inferred %r" % (python_function, - inferred_type, restype)) - functyp = NonGcPtr(FuncType(argtypes, restype)) - python_function.TYPE = functyp - argtypes = [functyp] + list(argtypes) - newopname = None - return Specializer.typed_op(self, op, argtypes, restype, newopname) - - -def substitute_malloc(typer, op): - s_result = typer.annotator.binding(op.result) - T = annotation_to_lltype(s_result, 'malloc') - if len(op.args) == 2: - substitution = 'malloc', None, Void, T - else: - substitution = 'malloc_varsize', None, Void, Signed, T - return typer.substitute_op(op, substitution) Modified: pypy/dist/pypy/translator/c/database.py ============================================================================== --- pypy/dist/pypy/translator/c/database.py (original) +++ pypy/dist/pypy/translator/c/database.py Tue May 24 12:00:23 2005 @@ -1,7 +1,6 @@ -from pypy.rpython.lltypes import Primitive, _PtrType, typeOf -from pypy.rpython.lltypes import Struct, Array, FuncType, PyObject, Void -from pypy.rpython.lltypes import ContainerType -from pypy.rpython.typer import PyObjPtr +from pypy.rpython.lltype import Primitive, _PtrType, typeOf +from pypy.rpython.lltype import Struct, Array, FuncType, PyObject, Void +from pypy.rpython.lltype import ContainerType from pypy.objspace.flow.model import Constant from pypy.translator.c.primitive import PrimitiveName, PrimitiveType from pypy.translator.c.primitive import PrimitiveErrorValue Modified: pypy/dist/pypy/translator/c/funcgen.py ============================================================================== --- pypy/dist/pypy/translator/c/funcgen.py (original) +++ pypy/dist/pypy/translator/c/funcgen.py Tue May 24 12:00:23 2005 @@ -4,7 +4,7 @@ from pypy.translator.c.support import llvalue_from_constant from pypy.objspace.flow.model import Variable, Constant, Block from pypy.objspace.flow.model import traverse, uniqueitems -from pypy.rpython.lltypes import GcPtr, NonGcPtr, PyObject +from pypy.rpython.lltype import GcPtr, NonGcPtr, PyObject PyObjGcPtr = GcPtr(PyObject) Modified: pypy/dist/pypy/translator/c/node.py ============================================================================== --- pypy/dist/pypy/translator/c/node.py (original) +++ pypy/dist/pypy/translator/c/node.py Tue May 24 12:00:23 2005 @@ -1,7 +1,7 @@ from __future__ import generators -from pypy.rpython.lltypes import Struct, Array, FuncType, PyObjectType, typeOf -from pypy.rpython.lltypes import GcStruct, GcArray, GC_CONTAINER, ContainerType -from pypy.rpython.lltypes import parentlink +from pypy.rpython.lltype import Struct, Array, FuncType, PyObjectType, typeOf +from pypy.rpython.lltype import GcStruct, GcArray, GC_CONTAINER, ContainerType +from pypy.rpython.lltype import parentlink from pypy.translator.c.funcgen import FunctionCodeGenerator from pypy.translator.c.support import cdecl, somelettersfrom Modified: pypy/dist/pypy/translator/c/primitive.py ============================================================================== --- pypy/dist/pypy/translator/c/primitive.py (original) +++ pypy/dist/pypy/translator/c/primitive.py Tue May 24 12:00:23 2005 @@ -1,4 +1,4 @@ -from pypy.rpython.lltypes import * +from pypy.rpython.lltype import * # ____________________________________________________________ # Modified: pypy/dist/pypy/translator/c/pyobj.py ============================================================================== --- pypy/dist/pypy/translator/c/pyobj.py (original) +++ pypy/dist/pypy/translator/c/pyobj.py Tue May 24 12:00:23 2005 @@ -6,7 +6,7 @@ from pypy.translator.gensupp import builtin_base, NameManager from pypy.rpython.rarithmetic import r_int, r_uint -from pypy.rpython.lltypes import pyobject +from pypy.rpython.lltype import pyobjectptr # XXX maybe this can be done more elegantly: # needed to convince should_translate_attr @@ -41,7 +41,7 @@ stackentry = obj self.debugstack = (self.debugstack, stackentry) try: - return self.getvalue(pyobject(obj)) + return self.getvalue(pyobjectptr(obj)) finally: self.debugstack, x = self.debugstack assert x is stackentry Modified: pypy/dist/pypy/translator/c/support.py ============================================================================== --- pypy/dist/pypy/translator/c/support.py (original) +++ pypy/dist/pypy/translator/c/support.py Tue May 24 12:00:23 2005 @@ -1,4 +1,4 @@ -from pypy.rpython import lltypes +from pypy.rpython import lltype from pypy.translator.gensupp import NameManager class ErrorValue: @@ -34,9 +34,9 @@ try: T = c.concretetype except AttributeError: - return lltypes.pyobject(c.value) + return lltype.pyobjectptr(c.value) else: - assert lltypes.typeOf(c.value) == T + assert lltype.typeOf(c.value) == T return c.value Modified: pypy/dist/pypy/translator/c/test/test_database.py ============================================================================== --- pypy/dist/pypy/translator/c/test/test_database.py (original) +++ pypy/dist/pypy/translator/c/test/test_database.py Tue May 24 12:00:23 2005 @@ -1,10 +1,9 @@ import autopath, sys -from pypy.rpython.lltypes import * +from pypy.rpython.lltype import * from pypy.translator.translator import Translator from pypy.translator.c.database import LowLevelDatabase from pypy.objspace.flow.model import Constant, Variable, SpaceOperation from pypy.objspace.flow.model import Block, Link, FunctionGraph -from pypy.rpython.lltypes import Struct, Array, malloc def dump_on_stdout(database): @@ -130,7 +129,7 @@ # -------------------- end -------------------- F = FuncType([Signed], Signed) - f = function(F, "f", graph=graph) + f = functionptr(F, "f", graph=graph) db = LowLevelDatabase() db.get(f) db.complete() @@ -151,7 +150,7 @@ graph = t.getflowgraph() F = FuncType([GcPtr(PyObject)], GcPtr(PyObject)) - f = function(F, "f", graph=graph) + f = functionptr(F, "f", graph=graph) db = LowLevelDatabase() db.get(f) db.complete() Modified: pypy/dist/pypy/translator/genc/ctyper.py ============================================================================== --- pypy/dist/pypy/translator/genc/ctyper.py (original) +++ pypy/dist/pypy/translator/genc/ctyper.py Tue May 24 12:00:23 2005 @@ -16,7 +16,7 @@ from pypy.translator.genc.classtype import CClassPtrType from pypy.translator.genc.instancetype import CInstanceType from pypy.translator.genc.lltype import CPtrType, CLiteralTypeName -from pypy.rpython import lltypes +from pypy.rpython import lltype import types from pypy.interpreter.pycode import CO_VARARGS @@ -131,7 +131,7 @@ if op.opname == 'simple_call' and isinstance(op.args[0], Constant): # XXX move me elsewhere func = op.args[0].value - if func is lltypes.malloc: + if func is lltype.malloc: s_result = self.annotator.binding(op.result) ctliteral = self.annotator.translator.getconcretetype( CLiteralTypeName) @@ -142,12 +142,12 @@ [ctliteral], self.annotation2concretetype(s_result)) ] else: - if isinstance(ct, lltypes.Struct): + if isinstance(ct, lltype.Struct): assert ct._arrayfld is not None sizefield = ct._arrayfld + '.size' varstruct = ct._flds[ct._arrayfld].OF else: - assert isinstance(ct, lltypes.Array) + assert isinstance(ct, lltype.Array) sizefield = 'size' varstruct = ct.OF Modified: pypy/dist/pypy/translator/genc/lltype.py ============================================================================== --- pypy/dist/pypy/translator/genc/lltype.py (original) +++ pypy/dist/pypy/translator/genc/lltype.py Tue May 24 12:00:23 2005 @@ -2,7 +2,7 @@ from pypy.translator.genc.basetype import CType from pypy.translator.gensupp import C_IDENTIFIER from pypy.objspace.flow.model import SpaceOperation, Constant, Variable -from pypy.rpython import lltypes +from pypy.rpython import lltype class CLiteral(CType): # HACK! TEMPORARY @@ -12,7 +12,7 @@ class CLiteralTypeName(CType): # HACK! TEMPORARY def nameof(self, obj, debug=None): - assert isinstance(obj, lltypes.LowLevelType) + assert isinstance(obj, lltype.LowLevelType) ct = ll2concretetype(self.translator, obj) return ct.typename @@ -69,7 +69,7 @@ cliteral = typer.annotator.translator.getconcretetype(CLiteral) s_result = typer.annotator.binding(op.result) ctresult = typer.annotation2concretetype(s_result) - if isinstance(attrtype, lltypes.ContainerType): + if isinstance(attrtype, lltype.ContainerType): yield typer.typed_op(op, [self, cliteral], ctresult, newopname='getsubstruct') else: @@ -87,7 +87,7 @@ attrname = v_attrname.value attrtype = self.lltype.TO._flds[attrname] cliteral = typer.annotator.translator.getconcretetype(CLiteral) - if isinstance(attrtype, lltypes.ContainerType): + if isinstance(attrtype, lltype.ContainerType): raise AssertionError("cannot setattr to a substructure") ctinput = ll2concretetype(typer.annotator.translator, attrtype) yield typer.typed_op(op, [self, cliteral, ctinput], typer.TNone, @@ -190,11 +190,11 @@ from pypy.translator.genc import inttype, nonetype primitivetypemap = { - lltypes.Signed: inttype.CIntType, - lltypes.Unsigned: inttype.CUnsignedType, - #lltypes.Char: ... - lltypes.Bool: inttype.CIntType, - lltypes.Void: nonetype.CNoneType, + lltype.Signed: inttype.CIntType, + lltype.Unsigned: inttype.CUnsignedType, + #lltype.Char: ... + lltype.Bool: inttype.CIntType, + lltype.Void: nonetype.CNoneType, } def get_primitive_type(translator, lltype): @@ -202,12 +202,12 @@ return translator.getconcretetype(cls) ll2concretetypemap = { - lltypes.Struct: CStructType, - lltypes.GcStruct: CStructType, - lltypes.Array: CArrayType, - lltypes.GcArray: CArrayType, - lltypes._PtrType: CPtrType, - lltypes.Primitive: get_primitive_type, + lltype.Struct: CStructType, + lltype.GcStruct: CStructType, + lltype.Array: CArrayType, + lltype.GcArray: CArrayType, + lltype._PtrType: CPtrType, + lltype.Primitive: get_primitive_type, } def ll2concretetype(translator, lltype): Modified: pypy/dist/pypy/translator/genc/test/test_lltyped.py ============================================================================== --- pypy/dist/pypy/translator/genc/test/test_lltyped.py (original) +++ pypy/dist/pypy/translator/genc/test/test_lltyped.py Tue May 24 12:00:23 2005 @@ -1,4 +1,4 @@ -from pypy.rpython.lltypes import * +from pypy.rpython.lltype import * from pypy.translator.tool.buildpyxmodule import skip_missing_compiler from pypy.translator.translator import Translator from pypy.translator.genc.ctyper import GenCSpecializer From arigo at codespeak.net Tue May 24 12:01:08 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Tue, 24 May 2005 12:01:08 +0200 (CEST) Subject: [pypy-svn] r12761 - in pypy/dist/pypy/translator/c: . test Message-ID: <20050524100108.293A727B57@code1.codespeak.net> Author: arigo Date: Tue May 24 12:01:07 2005 New Revision: 12761 Added: pypy/dist/pypy/translator/c/genc.py (contents, props changed) pypy/dist/pypy/translator/c/test/test_genc.py (contents, props changed) Log: Generation of a complete CPython extension module again (forgot to check in yesterday). Added: pypy/dist/pypy/translator/c/genc.py ============================================================================== --- (empty file) +++ pypy/dist/pypy/translator/c/genc.py Tue May 24 12:01:07 2005 @@ -0,0 +1,127 @@ +import autopath +import os +from pypy.translator.c.node import PyObjectNode + + +def gen_source(database, modulename, targetdir): + filename = os.path.join(targetdir, modulename + '.c') + f = open(filename, 'w') + + # + # Header + # + print >> f, '#include "g_include.h"' + + # + # All declarations + # + print >> f + print >> f, '/***********************************************************/' + print >> f, '/*** Structure definitions ***/' + print >> f + for node in database.structdeflist: + for line in node.definition(): + print >> f, line + print >> f + print >> f, '/***********************************************************/' + print >> f, '/*** Forward declarations ***/' + print >> f + for node in database.globalcontainers(): + for line in node.forward_declaration(): + print >> f, line + + # + # Implementation of functions and global structures and arrays + # + print >> f + print >> f, '/***********************************************************/' + print >> f, '/*** Implementations ***/' + for node in database.globalcontainers(): + print >> f + for line in node.implementation(): + print >> f, line + + # + # PyObject support (strange) code + # + print >> f + print >> f, '/***********************************************************/' + print >> f, '/*** Table of global PyObjects ***/' + print >> f + print >> f, 'static globalobjectdef_t globalobjectdefs[] = {' + for node in database.globalcontainers(): + if isinstance(node, PyObjectNode): + name = node.name + if not name.startswith('gfunc_'): + print >> f, '\t{&%s, "%s"},' % (name, name) + print >> f, '\t{ NULL }\t/* Sentinel */' + print >> f, '};' + print >> f + print >> f, '/***********************************************************/' + print >> f, '/*** Table of functions ***/' + print >> f + print >> f, 'static globalfunctiondef_t globalfunctiondefs[] = {' + print >> f, '\t/* XXX */' + print >> f, '\t{ NULL }\t/* Sentinel */' + print >> f, '};' + print >> f + print >> f, '/***********************************************************/' + print >> f, '/*** Frozen Python bytecode: the initialization code ***/' + print >> f + print >> f, 'static char *frozen_initcode[] = {"\\' + bytecode, originalsource = database.pyobjmaker.getfrozenbytecode() + g = open(os.path.join(targetdir, 'frozen.py'), 'w') + g.write(originalsource) + g.close() + def char_repr(c): + if c in '\\"': return '\\' + c + if ' ' <= c < '\x7F': return c + return '\\%03o' % ord(c) + for i in range(0, len(bytecode), 32): + print >> f, ''.join([char_repr(c) for c in bytecode[i:i+32]])+'\\' + if (i+32) % 1024 == 0: + print >> f, '", "\\' + print >> f, '"};' + print >> f, "#define FROZEN_INITCODE_SIZE %d" % len(bytecode) + print >> f + + # + # Module initialization function + # + print >> f, '/***********************************************************/' + print >> f, '/*** Module initialization function ***/' + print >> f + print >> f, 'MODULE_INITFUNC(%s)' % modulename + print >> f, '{' + print >> f, '\tSETUP_MODULE(%s)' % modulename + #print >> f, '\tPyModule_AddObject(m, "%(entrypointname)s", %(entrypoint)s);' + print >> f, '}' + f.close() + + # + # Generate a setup.py while we're at it + # + pypy_include_dir = autopath.this_dir + f = open(os.path.join(targetdir, 'setup.py'), 'w') + f.write(SETUP_PY % locals()) + f.close() + + +SETUP_PY = ''' +from distutils.core import setup +from distutils.extension import Extension +from distutils.ccompiler import get_default_compiler + +PYPY_INCLUDE_DIR = %(pypy_include_dir)r + +extra_compile_args = [] +if get_default_compiler() == "unix": + extra_compile_args.extend(["-Wno-unused-label", + "-Wno-unused-variable"]) + +setup(name="%(modulename)s", + ext_modules = [Extension(name = "%(modulename)s", + sources = ["%(modulename)s.c"], + extra_compile_args = extra_compile_args, + include_dirs = [PYPY_INCLUDE_DIR])]) +''' Added: pypy/dist/pypy/translator/c/test/test_genc.py ============================================================================== --- (empty file) +++ pypy/dist/pypy/translator/c/test/test_genc.py Tue May 24 12:01:07 2005 @@ -0,0 +1,35 @@ +import autopath, sys, os +from pypy.rpython.lltype import * +from pypy.translator.translator import Translator +from pypy.translator.c.database import LowLevelDatabase +from pypy.translator.c.genc import gen_source +from pypy.objspace.flow.model import Constant, Variable, SpaceOperation +from pypy.objspace.flow.model import Block, Link, FunctionGraph +from pypy.tool.udir import udir +from pypy.translator.tool.buildpyxmodule import make_module_from_c +from pypy.translator.gensupp import uniquemodulename + + +def compile_db(db): + modulename = uniquemodulename('testing') + targetdir = udir.join(modulename).ensure(dir=1) + gen_source(db, modulename, str(targetdir)) + make_module_from_c(targetdir.join(modulename+'.c'), + include_dirs = [os.path.dirname(autopath.this_dir)]) + + +def test_untyped_func(): + def f(x): + return x+1 + t = Translator(f) + graph = t.getflowgraph() + + F = FuncType([GcPtr(PyObject)], GcPtr(PyObject)) + S = GcStruct('testing', ('fptr', NonGcPtr(F))) + f = functionptr(F, "f", graph=graph) + s = malloc(S) + s.fptr = f + db = LowLevelDatabase() + db.get(s) + db.complete() + compile_db(db) From adim at codespeak.net Tue May 24 12:23:18 2005 From: adim at codespeak.net (adim at codespeak.net) Date: Tue, 24 May 2005 12:23:18 +0200 (CEST) Subject: [pypy-svn] r12763 - in pypy/branch/pycompiler/module/recparser: . test Message-ID: <20050524102318.D8D2A27B53@code1.codespeak.net> Author: adim Date: Tue May 24 12:23:18 2005 New Revision: 12763 Modified: pypy/branch/pycompiler/module/recparser/__init__.py pypy/branch/pycompiler/module/recparser/pythonparse.py pypy/branch/pycompiler/module/recparser/pythonutil.py pypy/branch/pycompiler/module/recparser/test/test_samples.py pypy/branch/pycompiler/module/recparser/tuplebuilder.py Log: - fixed bad imports - changed pypy_parse() implementation to directly use TupleBuilder() (tests OK) Modified: pypy/branch/pycompiler/module/recparser/__init__.py ============================================================================== --- pypy/branch/pycompiler/module/recparser/__init__.py (original) +++ pypy/branch/pycompiler/module/recparser/__init__.py Tue May 24 12:23:18 2005 @@ -3,8 +3,8 @@ from pypy.interpreter.mixedmodule import MixedModule -debug_print( "Loading grammar %s" % pythonutil.PYTHON_GRAMMAR ) -import pythonutil +import pythonparse +debug_print( "Loading grammar %s" % pythonparse.PYTHON_GRAMMAR ) class Module(MixedModule): """The builtin parser module. Modified: pypy/branch/pycompiler/module/recparser/pythonparse.py ============================================================================== --- pypy/branch/pycompiler/module/recparser/pythonparse.py (original) +++ pypy/branch/pycompiler/module/recparser/pythonparse.py Tue May 24 12:23:18 2005 @@ -47,6 +47,3 @@ def parse_eval_input(textsrc, gram, builder=None): """Parse a python expression""" return parse_python_source( textsrc, gram, "eval_input", builder ) - - - Modified: pypy/branch/pycompiler/module/recparser/pythonutil.py ============================================================================== --- pypy/branch/pycompiler/module/recparser/pythonutil.py (original) +++ pypy/branch/pycompiler/module/recparser/pythonutil.py Tue May 24 12:23:18 2005 @@ -15,23 +15,21 @@ tp2 = parser.suite(pyf.read()) return tp2.totuple() + +import symbol def pypy_parse(filename): - """parse using PyPy's parser module and return nested tuples - """ + """parse using PyPy's parser module and return nested tuples + """ pyf = file(filename) - builder = parse_file_input(pyf, pythonutil.PYTHON_PARSER ) + text = pyf.read() pyf.close() - if builder.stack: - # print builder.stack[-1] - root_node = builder.stack[-1] - nested_tuples = root_node.totuple() - if hasattr(builder, '_source_encoding'): - # XXX: maybe the parser could fix that instead ? - return ( symbol.encoding_decl, nested_tuples, builder._source_encoding) - else: - return nested_tuples - return None # XXX raise an exception instead - + builder = TupleBuilder( PYTHON_PARSER.rules ) + pythonparse.parse_python_source(text, PYTHON_PARSER, 'file_input', builder) + nested_tuples = builder.stack[-1] + if hasattr(builder, '_source_encoding'): + # XXX: maybe the parser could fix that instead ? + return ( symbol.encoding_decl, nested_tuples, builder._source_encoding) + return nested_tuples def ast_single_input( text ): builder = TupleBuilder( PYTHON_PARSER.rules ) Modified: pypy/branch/pycompiler/module/recparser/test/test_samples.py ============================================================================== --- pypy/branch/pycompiler/module/recparser/test/test_samples.py (original) +++ pypy/branch/pycompiler/module/recparser/test/test_samples.py Tue May 24 12:23:18 2005 @@ -1,7 +1,7 @@ """test module for CPython / PyPy nested tuples comparison""" import os, os.path as osp -from pypy.module.recparser.pythonutil import python_parse -from pypy.module.recparser.pythonparse import pypy_parse +from pypy.module.recparser.pythonutil import python_parse, pypy_parse +# from pypy.module.recparser.pythonparse import pypy_parse from pprint import pprint from pypy.module.recparser import grammar grammar.DEBUG = False @@ -39,7 +39,7 @@ def assert_tuples_equal(tup1, tup2, curpos = ()): for index, (elt1, elt2) in enumerate(zip(tup1, tup2)): if elt1 != elt2: - if type(elt1) is tuple and type(elt2) is tuple: + if isinstance(elt1, tuple) and isinstance(elt2, tuple): assert_tuples_equal(elt1, elt2, curpos + (index,)) raise AssertionError('Found difference at %s : %s != %s\n' % (curpos, name(elt1), name(elt2) ), curpos) Modified: pypy/branch/pycompiler/module/recparser/tuplebuilder.py ============================================================================== --- pypy/branch/pycompiler/module/recparser/tuplebuilder.py (original) +++ pypy/branch/pycompiler/module/recparser/tuplebuilder.py Tue May 24 12:23:18 2005 @@ -1,6 +1,6 @@ from grammar import BaseGrammarBuilder -from syntaxtree import TOKEN_MAP, SYMBOLS, NT_OFFSET +from syntaxtree import TOKEN_MAP, SYMBOLS # , NT_OFFSET def _expand_nodes( nodes ): @@ -17,13 +17,13 @@ for n in nodes: assert type(n[0])==int return r - + class TupleBuilder(BaseGrammarBuilder): """A builder that directly produce the AST""" def __init__( self, rules=None, debug=0, lineno=False ): BaseGrammarBuilder.__init__(self, rules, debug ) - self.lineno = True + self.lineno = lineno def alternative( self, rule, source ): # Do nothing, keep rule on top of the stack From ludal at codespeak.net Tue May 24 14:18:30 2005 From: ludal at codespeak.net (ludal at codespeak.net) Date: Tue, 24 May 2005 14:18:30 +0200 (CEST) Subject: [pypy-svn] r12766 - in pypy/branch/pycompiler: interpreter interpreter/test tool Message-ID: <20050524121830.30AE627B56@code1.codespeak.net> Author: ludal Date: Tue May 24 14:18:30 2005 New Revision: 12766 Modified: pypy/branch/pycompiler/interpreter/baseobjspace.py pypy/branch/pycompiler/interpreter/compiler.py pypy/branch/pycompiler/interpreter/executioncontext.py pypy/branch/pycompiler/interpreter/test/test_compiler.py pypy/branch/pycompiler/tool/option.py Log: * first shot at introducing options for baseobjspace and such Modified: pypy/branch/pycompiler/interpreter/baseobjspace.py ============================================================================== --- pypy/branch/pycompiler/interpreter/baseobjspace.py (original) +++ pypy/branch/pycompiler/interpreter/baseobjspace.py Tue May 24 14:18:30 2005 @@ -1,9 +1,11 @@ from pypy.interpreter.executioncontext import ExecutionContext from pypy.interpreter.error import OperationError from pypy.interpreter.argument import Arguments +from pypy.interpreter.compiler import CPythonCompiler, PythonCompiler from pypy.interpreter.miscutils import ThreadLocals from pypy.tool.cache import Cache from pypy.rpython.rarithmetic import r_uint +import pypy.tool.option __all__ = ['ObjSpace', 'OperationError', 'Wrappable', 'BaseWrappable', 'W_Root'] @@ -92,12 +94,17 @@ full_exceptions = True # full support for exceptions (normalization & more) - def __init__(self): + def __init__(self, options = None): "NOT_RPYTHON: Basic initialization of objects." self.fromcache = InternalSpaceCache(self).getorbuild self.threadlocals = ThreadLocals() # set recursion limit # sets all the internal descriptors + + # XXX: Options in option.py is replaced by a function so + # it's not really clean to do a from option import Options + # since changing import order can change the Options object + self.options = options or pypy.tool.option.Options() self.initialize() def __repr__(self): @@ -133,9 +140,17 @@ # XXX we need to resolve unwrapping issues to # make this the default _sre module - #self.setbuiltinmodule("_sre", "_sre_pypy") - - # XXX disabled: self.setbuiltinmodule('parser') + #self.setbuiltinmodule("_sre", "_sre_pypy") + if self.options.parser == "recparser": + self.setbuiltinmodule('parser','recparser') + elif self.options.parser == "parser": + self.setbuiltinmodule('parser') + + if self.options.uselibfile: + self.appexec([], '''(): + from _file import file + __builtins__.file = __builtins__.open = file + ''') # initialize with "bootstrap types" from objspace (e.g. w_None) for name, value in self.__dict__.items(): @@ -176,6 +191,13 @@ "Factory function for execution contexts." return ExecutionContext(self) + def createcompiler(self): + "Factory function creating a compiler object." + # XXX: cache the compiler object ? + if self.options.compiler == "recparser": + return PythonCompiler(self) + return CPythonCompiler(self) + # Following is a friendly interface to common object space operations # that can be defined in term of more primitive ones. Subclasses # may also override specific functions for performance. Modified: pypy/branch/pycompiler/interpreter/compiler.py ============================================================================== --- pypy/branch/pycompiler/interpreter/compiler.py (original) +++ pypy/branch/pycompiler/interpreter/compiler.py Tue May 24 14:18:30 2005 @@ -6,7 +6,7 @@ from pypy.interpreter.error import OperationError -class Compiler: +class AbstractCompiler: """Abstract base class for a bytecode compiler.""" # The idea is to grow more methods here over the time, @@ -80,11 +80,14 @@ import warnings import __future__ compiler_flags = 0 +compiler_features = {} for fname in __future__.all_feature_names: - compiler_flags |= getattr(__future__, fname).compiler_flag + flag = getattr(__future__, fname).compiler_flag + compiler_flags |= flag + compiler_features[fname] = flag -class CPythonCompiler(Compiler): +class CPythonCompiler(AbstractCompiler): """Faked implementation of a compiler, using the underlying compile().""" def compile(self, source, filename, mode, flags): @@ -162,3 +165,88 @@ def restore_warn_explicit(self, warnings, old_warn_explicit): warnings.warn_explicit = old_warn_explicit + +class PythonCompiler(CPythonCompiler): + """Pure python compiler, using the compile().""" + + def compile(self, source, filename, mode, flags): + flags |= __future__.generators.compiler_flag # always on (2.2 compat) + space = self.space + try: + from pypy.module.recparser import compat + # HACK use our parser instead of the CPython's one + compat.transformer.parser = compat + c = compat.pycompile(source, filename, mode) + # It would be nice to propagate all exceptions to app level, + # but here we only propagate the 'usual' ones, until we figure + # out how to do it generically. + except SyntaxError,e: + w_synerr = space.newtuple([space.wrap(e.msg), + space.newtuple([space.wrap(e.filename), + space.wrap(e.lineno), + space.wrap(e.offset), + space.wrap(e.text)])]) + raise OperationError(space.w_SyntaxError, w_synerr) + except ValueError,e: + raise OperationError(space.w_ValueError,space.wrap(str(e))) + except TypeError,e: + raise OperationError(space.w_TypeError,space.wrap(str(e))) + from pypy.interpreter.pycode import PyCode + return space.wrap(PyCode(space)._from_code(c)) + +class PyPyCompiler(CPythonCompiler): + """Pure python compiler, using the compile().""" + + def compile(self, source, filename, mode, flags): + flags |= __future__.generators.compiler_flag # always on (2.2 compat) + space = self.space + try: + tree = # get the parse tree + gen = + # HACK use our parser instead of the CPython's one + compat.transformer.parser = compat + c = compat.pycompile(source, filename, mode, flags) + if mode == "single": + gen = InteractiveCodeGenerator(tree) + elif mode == "exec": + gen = ModuleCodeGenerator(tree) + elif mode == "eval": + gen = ExpressionCodeGenerator(tree) + else: + raise OperationError(space.w_ValueError, + space.wrap("compile() 3rd arg must be 'exec' or " + "'eval' or 'single'") ) + + # set compiler flags (doesn't work, code is generated at __init__ time) + #genflags = [] + #for feature,flag in compiler_features.items(): + # if flags | flag: + # genflags.append(feature) + #gen.futures = tuple(genflags) + + + + # It would be nice to propagate all exceptions to app level, + # but here we only propagate the 'usual' ones, until we figure + # out how to do it generically. + except SyntaxError,e: + w_synerr = space.newtuple([space.wrap(e.msg), + space.newtuple([space.wrap(e.filename), + space.wrap(e.lineno), + space.wrap(e.offset), + space.wrap(e.text)])]) + raise OperationError(space.w_SyntaxError, w_synerr) + except ValueError,e: + raise OperationError(space.w_ValueError,space.wrap(str(e))) + except TypeError,e: + raise OperationError(space.w_TypeError,space.wrap(str(e))) + from pypy.interpreter.pycode import PyCode + return space.wrap(PyCode(space)._from_code(c)) + + def compile_module(self, source, filename, mode ): + pass + + def compile_interactive + + +Compiler = PythonCompiler Modified: pypy/branch/pycompiler/interpreter/executioncontext.py ============================================================================== --- pypy/branch/pycompiler/interpreter/executioncontext.py (original) +++ pypy/branch/pycompiler/interpreter/executioncontext.py Tue May 24 14:18:30 2005 @@ -1,7 +1,6 @@ import sys from pypy.interpreter.miscutils import Stack from pypy.interpreter.error import OperationError -from pypy.interpreter.compiler import CPythonCompiler class ExecutionContext: """An ExecutionContext holds the state of an execution thread @@ -14,7 +13,7 @@ self.w_tracefunc = None self.w_profilefunc = None self.is_tracing = 0 - self.compiler = CPythonCompiler(space) + self.compiler = space.createcompiler() def enter(self, frame): if self.framestack.depth() > self.space.sys.recursionlimit: Modified: pypy/branch/pycompiler/interpreter/test/test_compiler.py ============================================================================== --- pypy/branch/pycompiler/interpreter/test/test_compiler.py (original) +++ pypy/branch/pycompiler/interpreter/test/test_compiler.py Tue May 24 14:18:30 2005 @@ -1,13 +1,13 @@ import __future__ import autopath import py -from pypy.interpreter.compiler import CPythonCompiler, Compiler +from pypy.interpreter.compiler import CPythonCompiler, PythonCompiler from pypy.interpreter.pycode import PyCode -class TestCompiler: +class BaseTestCompiler: def setup_method(self, method): - self.compiler = CPythonCompiler(self.space) + self.compiler = self.space.createcompiler() def test_compile(self): code = self.compiler.compile('6*7', '', 'eval', 0) @@ -48,6 +48,16 @@ assert flags == flags2 -class TestECCompiler(TestCompiler): +class TestECCompiler(BaseTestCompiler): def setup_method(self, method): self.compiler = self.space.getexecutioncontext().compiler + +class TestPyCCompiler(BaseTestCompiler): + def setup_method(self, method): + self.compiler = CPythonCompiler(self.space) + + +class TestPyPyCompiler(BaseTestCompiler): + def setup_method(self, method): + self.compiler = PythonCompiler(self.space) + Modified: pypy/branch/pycompiler/tool/option.py ============================================================================== --- pypy/branch/pycompiler/tool/option.py (original) +++ pypy/branch/pycompiler/tool/option.py Tue May 24 14:18:30 2005 @@ -10,6 +10,8 @@ spaces = [] oldstyle = 0 uselibfile = 0 + parser = "recparser" + compiler = "recparser" def run_tb_server(option, opt, value, parser): from pypy.tool import tb_server @@ -55,7 +57,6 @@ this is configured via the environment variable OBJSPACE """ - if not name: if Options.spaces: name = Options.spaces[-1] @@ -67,10 +68,10 @@ except KeyError: module = __import__("pypy.objspace.%s" % name, None, None, ["Space"]) Space = module.Space - space = Space() + space = Space( Options() ) if name == 'std' and Options.oldstyle: space.enable_old_style_classes_as_default_metaclass() - if Options.uselibfile: + if False and Options.uselibfile: space.appexec([], '''(): from _file import file __builtins__.file = __builtins__.open = file From pedronis at codespeak.net Tue May 24 14:20:46 2005 From: pedronis at codespeak.net (pedronis at codespeak.net) Date: Tue, 24 May 2005 14:20:46 +0200 (CEST) Subject: [pypy-svn] r12767 - in pypy/dist/pypy/translator: . goal Message-ID: <20050524122046.231EF27B56@code1.codespeak.net> Author: pedronis Date: Tue May 24 14:20:45 2005 New Revision: 12767 Modified: pypy/dist/pypy/translator/annrpython.py pypy/dist/pypy/translator/goal/translate_pypy.py Log: - be more aggressive annotating exception handling with constant last_exception - added sanity check about except blocks to translate_pypy Modified: pypy/dist/pypy/translator/annrpython.py ============================================================================== --- pypy/dist/pypy/translator/annrpython.py (original) +++ pypy/dist/pypy/translator/annrpython.py Tue May 24 14:20:45 2005 @@ -435,6 +435,7 @@ if isinstance(link.exitcase, (types.ClassType, type)) \ and issubclass(link.exitcase, Exception): + assert last_exception_var and last_exc_value_var last_exception_object = annmodel.SomeObject() last_exception_object.knowntype = type if isinstance(last_exception_var, Constant): @@ -454,10 +455,10 @@ for a,v in zip(link.args,link.target.inputargs): renaming.setdefault(a, []).append(v) for a,v in zip(link.args,link.target.inputargs): - if a is last_exception_var: + if a == last_exception_var: assert in_except_block cells.append(last_exception_object) - elif a is last_exc_value_var: + elif a == last_exc_value_var: assert in_except_block cells.append(last_exc_value_object) last_exc_value_vars.append(v) Modified: pypy/dist/pypy/translator/goal/translate_pypy.py ============================================================================== --- pypy/dist/pypy/translator/goal/translate_pypy.py (original) +++ pypy/dist/pypy/translator/goal/translate_pypy.py Tue May 24 14:20:45 2005 @@ -56,6 +56,7 @@ run_async_server() if not options['-no-a']: a = t.annotate(inputtypes, overrides=pypy_overrides) + sanity_check_exceptblocks(t) worstblocks_topten(a) if not options['-no-s']: a.simplify() @@ -66,6 +67,25 @@ options['-no-mark-some-objects'] = True # Do not do this again find_someobjects(t) +def sanity_check_exceptblocks(translator): + annotator = translator.annotator + irreg = 0 + for graph in translator.flowgraphs.itervalues(): + et, ev = graph.exceptblock.inputargs + s_et = annotator.binding(et, extquery=True) + s_ev = annotator.binding(ev, extquery=True) + if s_et: + if s_et.knowntype == type: + if s_et.__class__ == SomeObject: + if hasattr(s_et, 'is_type_of') and s_et.is_type_of == [ev]: + continue + else: + if s_et.__class__ == annmodel.SomePBC: + continue + print "*****", graph.name, "exceptblock is not completely sane" + irreg += 1 + if irreg == 0: + print "*** All exceptblocks seem sane." def find_someobjects(translator, quiet=False): """Find all functions in that have SomeObject in their signature.""" From ludal at codespeak.net Tue May 24 14:21:39 2005 From: ludal at codespeak.net (ludal at codespeak.net) Date: Tue, 24 May 2005 14:21:39 +0200 (CEST) Subject: [pypy-svn] r12768 - pypy/branch/pycompiler/module/recparser/compiler Message-ID: <20050524122139.AC27227B56@code1.codespeak.net> Author: ludal Date: Tue May 24 14:21:39 2005 New Revision: 12768 Added: pypy/branch/pycompiler/module/recparser/compiler/ pypy/branch/pycompiler/module/recparser/compiler/__init__.py pypy/branch/pycompiler/module/recparser/compiler/ast.py pypy/branch/pycompiler/module/recparser/compiler/ast.txt pypy/branch/pycompiler/module/recparser/compiler/astfactory.py pypy/branch/pycompiler/module/recparser/compiler/astgen.py pypy/branch/pycompiler/module/recparser/compiler/consts.py pypy/branch/pycompiler/module/recparser/compiler/future.py pypy/branch/pycompiler/module/recparser/compiler/misc.py pypy/branch/pycompiler/module/recparser/compiler/pyassem.py pypy/branch/pycompiler/module/recparser/compiler/pycodegen.py pypy/branch/pycompiler/module/recparser/compiler/symbols.py pypy/branch/pycompiler/module/recparser/compiler/syntax.py pypy/branch/pycompiler/module/recparser/compiler/transformer.py pypy/branch/pycompiler/module/recparser/compiler/visitor.py Log: * included modified version of the original compiler module Added: pypy/branch/pycompiler/module/recparser/compiler/__init__.py ============================================================================== --- (empty file) +++ pypy/branch/pycompiler/module/recparser/compiler/__init__.py Tue May 24 14:21:39 2005 @@ -0,0 +1,26 @@ +"""Package for parsing and compiling Python source code + +There are several functions defined at the top level that are imported +from modules contained in the package. + +parse(buf, mode="exec") -> AST + Converts a string containing Python source code to an abstract + syntax tree (AST). The AST is defined in compiler.ast. + +parseFile(path) -> AST + The same as parse(open(path)) + +walk(ast, visitor, verbose=None) + Does a pre-order walk over the ast using the visitor instance. + See compiler.visitor for details. + +compile(source, filename, mode, flags=None, dont_inherit=None) + Returns a code object. A replacement for the builtin compile() function. + +compileFile(filename) + Generates a .pyc file by compiling filename. +""" + +from transformer import parse, parseFile +from visitor import walk +from pycodegen import compile, compileFile Added: pypy/branch/pycompiler/module/recparser/compiler/ast.py ============================================================================== --- (empty file) +++ pypy/branch/pycompiler/module/recparser/compiler/ast.py Tue May 24 14:21:39 2005 @@ -0,0 +1,1532 @@ +"""Python abstract syntax node definitions + +This file is automatically generated by Tools/compiler/astgen.py +""" +from consts import CO_VARARGS, CO_VARKEYWORDS + +def flatten(list): + l = [] + for elt in list: + t = type(elt) + if t is tuple or t is list: + for elt2 in flatten(elt): + l.append(elt2) + else: + l.append(elt) + return l + +def flatten_nodes(list): + return [n for n in flatten(list) if isinstance(n, Node)] + +nodes = {} + +class Node: + """Abstract base class for ast nodes.""" + def getChildren(self): + pass # implemented by subclasses + def __iter__(self): + for n in self.getChildren(): + yield n + def asList(self): # for backwards compatibility + return self.getChildren() + def getChildNodes(self): + pass # implemented by subclasses + def visit(self, visitor): + return visitor.visitNode(self) + +class EmptyNode(Node): + def visit(self, visitor): + return visitor.visitEmptyNode(self) + +class Expression(Node): + # Expression is an artificial node class to support "eval" + nodes["expression"] = "Expression" + def __init__(self, node): + self.node = node + + def getChildren(self): + return self.node, + + def getChildNodes(self): + return self.node, + + def __repr__(self): + return "Expression(%s)" % (repr(self.node)) + + def visit(self, visitor): + return visitor.visitExpression(self) + +class Add(Node): + def __init__(self, (left, right), lineno=None): + self.left = left + self.right = right + self.lineno = lineno + + def getChildren(self): + return self.left, self.right + + def getChildNodes(self): + return self.left, self.right + + def __repr__(self): + return "Add((%s, %s))" % (repr(self.left), repr(self.right)) + + def visit(self, visitor): + return visitor.visitAdd(self) + +class And(Node): + def __init__(self, nodes, lineno=None): + self.nodes = nodes + self.lineno = lineno + + def getChildren(self): + return tuple(flatten(self.nodes)) + + def getChildNodes(self): + nodelist = [] + nodelist.extend(flatten_nodes(self.nodes)) + return tuple(nodelist) + + def __repr__(self): + return "And(%s)" % (repr(self.nodes),) + + def visit(self, visitor): + return visitor.visitAnd(self) + +class AssAttr(Node): + def __init__(self, expr, attrname, flags, lineno=None): + self.expr = expr + self.attrname = attrname + self.flags = flags + self.lineno = lineno + + def getChildren(self): + return self.expr, self.attrname, self.flags + + def getChildNodes(self): + return self.expr, + + def __repr__(self): + return "AssAttr(%s, %s, %s)" % (repr(self.expr), repr(self.attrname), repr(self.flags)) + + def visit(self, visitor): + return visitor.visitAssAttr(self) + +class AssList(Node): + def __init__(self, nodes, lineno=None): + self.nodes = nodes + self.lineno = lineno + + def getChildren(self): + return tuple(flatten(self.nodes)) + + def getChildNodes(self): + nodelist = [] + nodelist.extend(flatten_nodes(self.nodes)) + return tuple(nodelist) + + def __repr__(self): + return "AssList(%s)" % (repr(self.nodes),) + + def visit(self, visitor): + return visitor.visitAssList(self) + +class AssName(Node): + def __init__(self, name, flags, lineno=None): + self.name = name + self.flags = flags + self.lineno = lineno + + def getChildren(self): + return self.name, self.flags + + def getChildNodes(self): + return () + + def __repr__(self): + return "AssName(%s, %s)" % (repr(self.name), repr(self.flags)) + + def visit(self, visitor): + return visitor.visitAssName(self) + +class AssTuple(Node): + def __init__(self, nodes, lineno=None): + self.nodes = nodes + self.lineno = lineno + + def getChildren(self): + return tuple(flatten(self.nodes)) + + def getChildNodes(self): + nodelist = [] + nodelist.extend(flatten_nodes(self.nodes)) + return tuple(nodelist) + + def __repr__(self): + return "AssTuple(%s)" % (repr(self.nodes),) + + def visit(self, visitor): + return visitor.visitAssTuple(self) + +class Assert(Node): + def __init__(self, test, fail, lineno=None): + self.test = test + self.fail = fail + self.lineno = lineno + + def getChildren(self): + children = [] + children.append(self.test) + children.append(self.fail) + return tuple(children) + + def getChildNodes(self): + nodelist = [] + nodelist.append(self.test) + if self.fail is not None: + nodelist.append(self.fail) + return tuple(nodelist) + + def __repr__(self): + return "Assert(%s, %s)" % (repr(self.test), repr(self.fail)) + + def visit(self, visitor): + return visitor.visitAssert(self) + +class Assign(Node): + def __init__(self, nodes, expr, lineno=None): + self.nodes = nodes + self.expr = expr + self.lineno = lineno + + def getChildren(self): + children = [] + children.extend(flatten(self.nodes)) + children.append(self.expr) + return tuple(children) + + def getChildNodes(self): + nodelist = [] + nodelist.extend(flatten_nodes(self.nodes)) + nodelist.append(self.expr) + return tuple(nodelist) + + def __repr__(self): + return "Assign(%s, %s)" % (repr(self.nodes), repr(self.expr)) + + def visit(self, visitor): + return visitor.visitAssign(self) + +class AugAssign(Node): + def __init__(self, node, op, expr, lineno=None): + self.node = node + self.op = op + self.expr = expr + self.lineno = lineno + + def getChildren(self): + return self.node, self.op, self.expr + + def getChildNodes(self): + return self.node, self.expr + + def __repr__(self): + return "AugAssign(%s, %s, %s)" % (repr(self.node), repr(self.op), repr(self.expr)) + + def visit(self, visitor): + return visitor.visitAugAssign(self) + +class Backquote(Node): + def __init__(self, expr, lineno=None): + self.expr = expr + self.lineno = lineno + + def getChildren(self): + return self.expr, + + def getChildNodes(self): + return self.expr, + + def __repr__(self): + return "Backquote(%s)" % (repr(self.expr),) + + def visit(self, visitor): + return visitor.visitBackquote(self) + +class Bitand(Node): + def __init__(self, nodes, lineno=None): + self.nodes = nodes + self.lineno = lineno + + def getChildren(self): + return tuple(flatten(self.nodes)) + + def getChildNodes(self): + nodelist = [] + nodelist.extend(flatten_nodes(self.nodes)) + return tuple(nodelist) + + def __repr__(self): + return "Bitand(%s)" % (repr(self.nodes),) + + def visit(self, visitor): + return visitor.visitBitand(self) + +class Bitor(Node): + def __init__(self, nodes, lineno=None): + self.nodes = nodes + self.lineno = lineno + + def getChildren(self): + return tuple(flatten(self.nodes)) + + def getChildNodes(self): + nodelist = [] + nodelist.extend(flatten_nodes(self.nodes)) + return tuple(nodelist) + + def __repr__(self): + return "Bitor(%s)" % (repr(self.nodes),) + + def visit(self, visitor): + return visitor.visitBitor(self) + +class Bitxor(Node): + def __init__(self, nodes, lineno=None): + self.nodes = nodes + self.lineno = lineno + + def getChildren(self): + return tuple(flatten(self.nodes)) + + def getChildNodes(self): + nodelist = [] + nodelist.extend(flatten_nodes(self.nodes)) + return tuple(nodelist) + + def __repr__(self): + return "Bitxor(%s)" % (repr(self.nodes),) + + def visit(self, visitor): + return visitor.visitBitxor(self) + +class Break(Node): + def __init__(self, lineno=None): + self.lineno = lineno + + def getChildren(self): + return () + + def getChildNodes(self): + return () + + def __repr__(self): + return "Break()" + + def visit(self, visitor): + return visitor.visitBreak(self) + +class CallFunc(Node): + def __init__(self, node, args, star_args = None, dstar_args = None, lineno=None): + self.node = node + self.args = args + self.star_args = star_args + self.dstar_args = dstar_args + self.lineno = lineno + + def getChildren(self): + children = [] + children.append(self.node) + children.extend(flatten(self.args)) + children.append(self.star_args) + children.append(self.dstar_args) + return tuple(children) + + def getChildNodes(self): + nodelist = [] + nodelist.append(self.node) + nodelist.extend(flatten_nodes(self.args)) + if self.star_args is not None: + nodelist.append(self.star_args) + if self.dstar_args is not None: + nodelist.append(self.dstar_args) + return tuple(nodelist) + + def __repr__(self): + return "CallFunc(%s, %s, %s, %s)" % (repr(self.node), repr(self.args), repr(self.star_args), repr(self.dstar_args)) + + def visit(self, visitor): + return visitor.visitCallFunc(self) + +class Class(Node): + def __init__(self, name, bases, doc, code, lineno=None): + self.name = name + self.bases = bases + self.doc = doc + self.code = code + self.lineno = lineno + + def getChildren(self): + children = [] + children.append(self.name) + children.extend(flatten(self.bases)) + children.append(self.doc) + children.append(self.code) + return tuple(children) + + def getChildNodes(self): + nodelist = [] + nodelist.extend(flatten_nodes(self.bases)) + nodelist.append(self.code) + return tuple(nodelist) + + def __repr__(self): + return "Class(%s, %s, %s, %s)" % (repr(self.name), repr(self.bases), repr(self.doc), repr(self.code)) + + def visit(self, visitor): + return visitor.visitClass(self) + +class Compare(Node): + def __init__(self, expr, ops, lineno=None): + self.expr = expr + self.ops = ops + self.lineno = lineno + + def getChildren(self): + children = [] + children.append(self.expr) + children.extend(flatten(self.ops)) + return tuple(children) + + def getChildNodes(self): + nodelist = [] + nodelist.append(self.expr) + nodelist.extend(flatten_nodes(self.ops)) + return tuple(nodelist) + + def __repr__(self): + return "Compare(%s, %s)" % (repr(self.expr), repr(self.ops)) + + def visit(self, visitor): + return visitor.visitCompare(self) + +class Const(Node): + def __init__(self, value, lineno=None): + self.value = value + self.lineno = lineno + + def getChildren(self): + return self.value, + + def getChildNodes(self): + return () + + def __repr__(self): + return "Const(%s)" % (repr(self.value),) + + def visit(self, visitor): + return visitor.visitConst(self) + +class Continue(Node): + def __init__(self, lineno=None): + self.lineno = lineno + + def getChildren(self): + return () + + def getChildNodes(self): + return () + + def __repr__(self): + return "Continue()" + + def visit(self, visitor): + return visitor.visitContinue(self) + +class Decorators(Node): + def __init__(self, nodes, lineno=None): + self.nodes = nodes + self.lineno = lineno + + def getChildren(self): + return tuple(flatten(self.nodes)) + + def getChildNodes(self): + nodelist = [] + nodelist.extend(flatten_nodes(self.nodes)) + return tuple(nodelist) + + def __repr__(self): + return "Decorators(%s)" % (repr(self.nodes),) + + def visit(self, visitor): + return visitor.visitDecorators(self) + +class Dict(Node): + def __init__(self, items, lineno=None): + self.items = items + self.lineno = lineno + + def getChildren(self): + return tuple(flatten(self.items)) + + def getChildNodes(self): + nodelist = [] + nodelist.extend(flatten_nodes(self.items)) + return tuple(nodelist) + + def __repr__(self): + return "Dict(%s)" % (repr(self.items),) + + def visit(self, visitor): + return visitor.visitDict(self) + +class Discard(Node): + def __init__(self, expr, lineno=None): + self.expr = expr + self.lineno = lineno + + def getChildren(self): + return self.expr, + + def getChildNodes(self): + return self.expr, + + def __repr__(self): + return "Discard(%s)" % (repr(self.expr),) + + def visit(self, visitor): + return visitor.visitDiscard(self) + +class Div(Node): + def __init__(self, (left, right), lineno=None): + self.left = left + self.right = right + self.lineno = lineno + + def getChildren(self): + return self.left, self.right + + def getChildNodes(self): + return self.left, self.right + + def __repr__(self): + return "Div((%s, %s))" % (repr(self.left), repr(self.right)) + + def visit(self, visitor): + return visitor.visitDiv(self) + +class Ellipsis(Node): + def __init__(self, lineno=None): + self.lineno = lineno + + def getChildren(self): + return () + + def getChildNodes(self): + return () + + def __repr__(self): + return "Ellipsis()" + + def visit(self, visitor): + return visitor.visitEllipsis(self) + +class Exec(Node): + def __init__(self, expr, locals, globals, lineno=None): + self.expr = expr + self.locals = locals + self.globals = globals + self.lineno = lineno + + def getChildren(self): + children = [] + children.append(self.expr) + children.append(self.locals) + children.append(self.globals) + return tuple(children) + + def getChildNodes(self): + nodelist = [] + nodelist.append(self.expr) + if self.locals is not None: + nodelist.append(self.locals) + if self.globals is not None: + nodelist.append(self.globals) + return tuple(nodelist) + + def __repr__(self): + return "Exec(%s, %s, %s)" % (repr(self.expr), repr(self.locals), repr(self.globals)) + + def visit(self, visitor): + return visitor.visitExec(self) + +class FloorDiv(Node): + def __init__(self, (left, right), lineno=None): + self.left = left + self.right = right + self.lineno = lineno + + def getChildren(self): + return self.left, self.right + + def getChildNodes(self): + return self.left, self.right + + def __repr__(self): + return "FloorDiv((%s, %s))" % (repr(self.left), repr(self.right)) + + def visit(self, visitor): + return visitor.visitFloorDiv(self) + +class For(Node): + def __init__(self, assign, list, body, else_, lineno=None): + self.assign = assign + self.list = list + self.body = body + self.else_ = else_ + self.lineno = lineno + + def getChildren(self): + children = [] + children.append(self.assign) + children.append(self.list) + children.append(self.body) + children.append(self.else_) + return tuple(children) + + def getChildNodes(self): + nodelist = [] + nodelist.append(self.assign) + nodelist.append(self.list) + nodelist.append(self.body) + if self.else_ is not None: + nodelist.append(self.else_) + return tuple(nodelist) + + def __repr__(self): + return "For(%s, %s, %s, %s)" % (repr(self.assign), repr(self.list), repr(self.body), repr(self.else_)) + + def visit(self, visitor): + return visitor.visitFor(self) + +class From(Node): + def __init__(self, modname, names, lineno=None): + self.modname = modname + self.names = names + self.lineno = lineno + + def getChildren(self): + return self.modname, self.names + + def getChildNodes(self): + return () + + def __repr__(self): + return "From(%s, %s)" % (repr(self.modname), repr(self.names)) + + def visit(self, visitor): + return visitor.visitFrom(self) + +class Function(Node): + def __init__(self, decorators, name, argnames, defaults, flags, doc, code, lineno=None): + self.decorators = decorators + self.name = name + self.argnames = argnames + self.defaults = defaults + self.flags = flags + self.doc = doc + self.code = code + self.lineno = lineno + self.varargs = self.kwargs = None + if flags & CO_VARARGS: + self.varargs = 1 + if flags & CO_VARKEYWORDS: + self.kwargs = 1 + + + + def getChildren(self): + children = [] + children.append(self.decorators) + children.append(self.name) + children.append(self.argnames) + children.extend(flatten(self.defaults)) + children.append(self.flags) + children.append(self.doc) + children.append(self.code) + return tuple(children) + + def getChildNodes(self): + nodelist = [] + if self.decorators is not None: + nodelist.append(self.decorators) + nodelist.extend(flatten_nodes(self.defaults)) + nodelist.append(self.code) + return tuple(nodelist) + + def __repr__(self): + return "Function(%s, %s, %s, %s, %s, %s, %s)" % (repr(self.decorators), repr(self.name), repr(self.argnames), repr(self.defaults), repr(self.flags), repr(self.doc), repr(self.code)) + + def visit(self, visitor): + return visitor.visitFunction(self) + +class GenExpr(Node): + def __init__(self, code, lineno=None): + self.code = code + self.lineno = lineno + self.argnames = ['[outmost-iterable]'] + self.varargs = self.kwargs = None + + + + def getChildren(self): + return self.code, + + def getChildNodes(self): + return self.code, + + def __repr__(self): + return "GenExpr(%s)" % (repr(self.code),) + + def visit(self, visitor): + return visitor.visitGenExpr(self) + +class GenExprFor(Node): + def __init__(self, assign, iter, ifs, lineno=None): + self.assign = assign + self.iter = iter + self.ifs = ifs + self.lineno = lineno + self.is_outmost = False + + + def getChildren(self): + children = [] + children.append(self.assign) + children.append(self.iter) + children.extend(flatten(self.ifs)) + return tuple(children) + + def getChildNodes(self): + nodelist = [] + nodelist.append(self.assign) + nodelist.append(self.iter) + nodelist.extend(flatten_nodes(self.ifs)) + return tuple(nodelist) + + def __repr__(self): + return "GenExprFor(%s, %s, %s)" % (repr(self.assign), repr(self.iter), repr(self.ifs)) + + def visit(self, visitor): + return visitor.visitGenExprFor(self) + +class GenExprIf(Node): + def __init__(self, test, lineno=None): + self.test = test + self.lineno = lineno + + def getChildren(self): + return self.test, + + def getChildNodes(self): + return self.test, + + def __repr__(self): + return "GenExprIf(%s)" % (repr(self.test),) + + def visit(self, visitor): + return visitor.visitGenExprIf(self) + +class GenExprInner(Node): + def __init__(self, expr, quals, lineno=None): + self.expr = expr + self.quals = quals + self.lineno = lineno + + def getChildren(self): + children = [] + children.append(self.expr) + children.extend(flatten(self.quals)) + return tuple(children) + + def getChildNodes(self): + nodelist = [] + nodelist.append(self.expr) + nodelist.extend(flatten_nodes(self.quals)) + return tuple(nodelist) + + def __repr__(self): + return "GenExprInner(%s, %s)" % (repr(self.expr), repr(self.quals)) + + def visit(self, visitor): + return visitor.visitGenExprInner(self) + +class Getattr(Node): + def __init__(self, expr, attrname, lineno=None): + self.expr = expr + self.attrname = attrname + self.lineno = lineno + + def getChildren(self): + return self.expr, self.attrname + + def getChildNodes(self): + return self.expr, + + def __repr__(self): + return "Getattr(%s, %s)" % (repr(self.expr), repr(self.attrname)) + + def visit(self, visitor): + return visitor.visitGetattr(self) + +class Global(Node): + def __init__(self, names, lineno=None): + self.names = names + self.lineno = lineno + + def getChildren(self): + return self.names, + + def getChildNodes(self): + return () + + def __repr__(self): + return "Global(%s)" % (repr(self.names),) + + def visit(self, visitor): + return visitor.visitGlobal(self) + +class If(Node): + def __init__(self, tests, else_, lineno=None): + self.tests = tests + self.else_ = else_ + self.lineno = lineno + + def getChildren(self): + children = [] + children.extend(flatten(self.tests)) + children.append(self.else_) + return tuple(children) + + def getChildNodes(self): + nodelist = [] + nodelist.extend(flatten_nodes(self.tests)) + if self.else_ is not None: + nodelist.append(self.else_) + return tuple(nodelist) + + def __repr__(self): + return "If(%s, %s)" % (repr(self.tests), repr(self.else_)) + + def visit(self, visitor): + return visitor.visitIf(self) + +class Import(Node): + def __init__(self, names, lineno=None): + self.names = names + self.lineno = lineno + + def getChildren(self): + return self.names, + + def getChildNodes(self): + return () + + def __repr__(self): + return "Import(%s)" % (repr(self.names),) + + def visit(self, visitor): + return visitor.visitImport(self) + +class Invert(Node): + def __init__(self, expr, lineno=None): + self.expr = expr + self.lineno = lineno + + def getChildren(self): + return self.expr, + + def getChildNodes(self): + return self.expr, + + def __repr__(self): + return "Invert(%s)" % (repr(self.expr),) + + def visit(self, visitor): + return visitor.visitInvert(self) + +class Keyword(Node): + def __init__(self, name, expr, lineno=None): + self.name = name + self.expr = expr + self.lineno = lineno + + def getChildren(self): + return self.name, self.expr + + def getChildNodes(self): + return self.expr, + + def __repr__(self): + return "Keyword(%s, %s)" % (repr(self.name), repr(self.expr)) + + def visit(self, visitor): + return visitor.visitKeyword(self) + +class Lambda(Node): + def __init__(self, argnames, defaults, flags, code, lineno=None): + self.argnames = argnames + self.defaults = defaults + self.flags = flags + self.code = code + self.lineno = lineno + self.varargs = self.kwargs = None + if flags & CO_VARARGS: + self.varargs = 1 + if flags & CO_VARKEYWORDS: + self.kwargs = 1 + + + + def getChildren(self): + children = [] + children.append(self.argnames) + children.extend(flatten(self.defaults)) + children.append(self.flags) + children.append(self.code) + return tuple(children) + + def getChildNodes(self): + nodelist = [] + nodelist.extend(flatten_nodes(self.defaults)) + nodelist.append(self.code) + return tuple(nodelist) + + def __repr__(self): + return "Lambda(%s, %s, %s, %s)" % (repr(self.argnames), repr(self.defaults), repr(self.flags), repr(self.code)) + + def visit(self, visitor): + return visitor.visitLambda(self) + +class LeftShift(Node): + def __init__(self, (left, right), lineno=None): + self.left = left + self.right = right + self.lineno = lineno + + def getChildren(self): + return self.left, self.right + + def getChildNodes(self): + return self.left, self.right + + def __repr__(self): + return "LeftShift((%s, %s))" % (repr(self.left), repr(self.right)) + + def visit(self, visitor): + return visitor.visitLeftShift(self) + +class List(Node): + def __init__(self, nodes, lineno=None): + self.nodes = nodes + self.lineno = lineno + + def getChildren(self): + return tuple(flatten(self.nodes)) + + def getChildNodes(self): + nodelist = [] + nodelist.extend(flatten_nodes(self.nodes)) + return tuple(nodelist) + + def __repr__(self): + return "List(%s)" % (repr(self.nodes),) + + def visit(self, visitor): + return visitor.visitList(self) + +class ListComp(Node): + def __init__(self, expr, quals, lineno=None): + self.expr = expr + self.quals = quals + self.lineno = lineno + + def getChildren(self): + children = [] + children.append(self.expr) + children.extend(flatten(self.quals)) + return tuple(children) + + def getChildNodes(self): + nodelist = [] + nodelist.append(self.expr) + nodelist.extend(flatten_nodes(self.quals)) + return tuple(nodelist) + + def __repr__(self): + return "ListComp(%s, %s)" % (repr(self.expr), repr(self.quals)) + + def visit(self, visitor): + return visitor.visitListComp(self) + +class ListCompFor(Node): + def __init__(self, assign, list, ifs, lineno=None): + self.assign = assign + self.list = list + self.ifs = ifs + self.lineno = lineno + + def getChildren(self): + children = [] + children.append(self.assign) + children.append(self.list) + children.extend(flatten(self.ifs)) + return tuple(children) + + def getChildNodes(self): + nodelist = [] + nodelist.append(self.assign) + nodelist.append(self.list) + nodelist.extend(flatten_nodes(self.ifs)) + return tuple(nodelist) + + def __repr__(self): + return "ListCompFor(%s, %s, %s)" % (repr(self.assign), repr(self.list), repr(self.ifs)) + + def visit(self, visitor): + return visitor.visitListCompFor(self) + +class ListCompIf(Node): + def __init__(self, test, lineno=None): + self.test = test + self.lineno = lineno + + def getChildren(self): + return self.test, + + def getChildNodes(self): + return self.test, + + def __repr__(self): + return "ListCompIf(%s)" % (repr(self.test),) + + def visit(self, visitor): + return visitor.visitListCompIf(self) + +class Mod(Node): + def __init__(self, (left, right), lineno=None): + self.left = left + self.right = right + self.lineno = lineno + + def getChildren(self): + return self.left, self.right + + def getChildNodes(self): + return self.left, self.right + + def __repr__(self): + return "Mod((%s, %s))" % (repr(self.left), repr(self.right)) + + def visit(self, visitor): + return visitor.visitMod(self) + +class Module(Node): + def __init__(self, doc, node, lineno=None): + self.doc = doc + self.node = node + self.lineno = lineno + + def getChildren(self): + return self.doc, self.node + + def getChildNodes(self): + return self.node, + + def __repr__(self): + return "Module(%s, %s)" % (repr(self.doc), repr(self.node)) + + def visit(self, visitor): + return visitor.visitModule(self) + +class Mul(Node): + def __init__(self, (left, right), lineno=None): + self.left = left + self.right = right + self.lineno = lineno + + def getChildren(self): + return self.left, self.right + + def getChildNodes(self): + return self.left, self.right + + def __repr__(self): + return "Mul((%s, %s))" % (repr(self.left), repr(self.right)) + + def visit(self, visitor): + return visitor.visitMul(self) + +class Name(Node): + def __init__(self, name, lineno=None): + self.name = name + self.lineno = lineno + + def getChildren(self): + return self.name, + + def getChildNodes(self): + return () + + def __repr__(self): + return "Name(%s)" % (repr(self.name),) + + def visit(self, visitor): + return visitor.visitName(self) + +class Not(Node): + def __init__(self, expr, lineno=None): + self.expr = expr + self.lineno = lineno + + def getChildren(self): + return self.expr, + + def getChildNodes(self): + return self.expr, + + def __repr__(self): + return "Not(%s)" % (repr(self.expr),) + + def visit(self, visitor): + return visitor.visitNot(self) + +class Or(Node): + def __init__(self, nodes, lineno=None): + self.nodes = nodes + self.lineno = lineno + + def getChildren(self): + return tuple(flatten(self.nodes)) + + def getChildNodes(self): + nodelist = [] + nodelist.extend(flatten_nodes(self.nodes)) + return tuple(nodelist) + + def __repr__(self): + return "Or(%s)" % (repr(self.nodes),) + + def visit(self, visitor): + return visitor.visitOr(self) + +class Pass(Node): + def __init__(self, lineno=None): + self.lineno = lineno + + def getChildren(self): + return () + + def getChildNodes(self): + return () + + def __repr__(self): + return "Pass()" + + def visit(self, visitor): + return visitor.visitPass(self) + +class Power(Node): + def __init__(self, (left, right), lineno=None): + self.left = left + self.right = right + self.lineno = lineno + + def getChildren(self): + return self.left, self.right + + def getChildNodes(self): + return self.left, self.right + + def __repr__(self): + return "Power((%s, %s))" % (repr(self.left), repr(self.right)) + + def visit(self, visitor): + return visitor.visitPower(self) + +class Print(Node): + def __init__(self, nodes, dest, lineno=None): + self.nodes = nodes + self.dest = dest + self.lineno = lineno + + def getChildren(self): + children = [] + children.extend(flatten(self.nodes)) + children.append(self.dest) + return tuple(children) + + def getChildNodes(self): + nodelist = [] + nodelist.extend(flatten_nodes(self.nodes)) + if self.dest is not None: + nodelist.append(self.dest) + return tuple(nodelist) + + def __repr__(self): + return "Print(%s, %s)" % (repr(self.nodes), repr(self.dest)) + + def visit(self, visitor): + return visitor.visitPrint(self) + +class Printnl(Node): + def __init__(self, nodes, dest, lineno=None): + self.nodes = nodes + self.dest = dest + self.lineno = lineno + + def getChildren(self): + children = [] + children.extend(flatten(self.nodes)) + children.append(self.dest) + return tuple(children) + + def getChildNodes(self): + nodelist = [] + nodelist.extend(flatten_nodes(self.nodes)) + if self.dest is not None: + nodelist.append(self.dest) + return tuple(nodelist) + + def __repr__(self): + return "Printnl(%s, %s)" % (repr(self.nodes), repr(self.dest)) + + def visit(self, visitor): + return visitor.visitPrintnl(self) + +class Raise(Node): + def __init__(self, expr1, expr2, expr3, lineno=None): + self.expr1 = expr1 + self.expr2 = expr2 + self.expr3 = expr3 + self.lineno = lineno + + def getChildren(self): + children = [] + children.append(self.expr1) + children.append(self.expr2) + children.append(self.expr3) + return tuple(children) + + def getChildNodes(self): + nodelist = [] + if self.expr1 is not None: + nodelist.append(self.expr1) + if self.expr2 is not None: + nodelist.append(self.expr2) + if self.expr3 is not None: + nodelist.append(self.expr3) + return tuple(nodelist) + + def __repr__(self): + return "Raise(%s, %s, %s)" % (repr(self.expr1), repr(self.expr2), repr(self.expr3)) + + def visit(self, visitor): + return visitor.visitRaise(self) + +class Return(Node): + def __init__(self, value, lineno=None): + self.value = value + self.lineno = lineno + + def getChildren(self): + return self.value, + + def getChildNodes(self): + return self.value, + + def __repr__(self): + return "Return(%s)" % (repr(self.value),) + + def visit(self, visitor): + return visitor.visitReturn(self) + +class RightShift(Node): + def __init__(self, (left, right), lineno=None): + self.left = left + self.right = right + self.lineno = lineno + + def getChildren(self): + return self.left, self.right + + def getChildNodes(self): + return self.left, self.right + + def __repr__(self): + return "RightShift((%s, %s))" % (repr(self.left), repr(self.right)) + + def visit(self, visitor): + return visitor.visitRightShift(self) + +class Slice(Node): + def __init__(self, expr, flags, lower, upper, lineno=None): + self.expr = expr + self.flags = flags + self.lower = lower + self.upper = upper + self.lineno = lineno + + def getChildren(self): + children = [] + children.append(self.expr) + children.append(self.flags) + children.append(self.lower) + children.append(self.upper) + return tuple(children) + + def getChildNodes(self): + nodelist = [] + nodelist.append(self.expr) + if self.lower is not None: + nodelist.append(self.lower) + if self.upper is not None: + nodelist.append(self.upper) + return tuple(nodelist) + + def __repr__(self): + return "Slice(%s, %s, %s, %s)" % (repr(self.expr), repr(self.flags), repr(self.lower), repr(self.upper)) + + def visit(self, visitor): + return visitor.visitSlice(self) + +class Sliceobj(Node): + def __init__(self, nodes, lineno=None): + self.nodes = nodes + self.lineno = lineno + + def getChildren(self): + return tuple(flatten(self.nodes)) + + def getChildNodes(self): + nodelist = [] + nodelist.extend(flatten_nodes(self.nodes)) + return tuple(nodelist) + + def __repr__(self): + return "Sliceobj(%s)" % (repr(self.nodes),) + + def visit(self, visitor): + return visitor.visitSliceobj(self) + +class Stmt(Node): + def __init__(self, nodes, lineno=None): + self.nodes = nodes + self.lineno = lineno + + def getChildren(self): + return tuple(flatten(self.nodes)) + + def getChildNodes(self): + nodelist = [] + nodelist.extend(flatten_nodes(self.nodes)) + return tuple(nodelist) + + def __repr__(self): + return "Stmt(%s)" % (repr(self.nodes),) + + def visit(self, visitor): + return visitor.visitStmt(self) + +class Sub(Node): + def __init__(self, (left, right), lineno=None): + self.left = left + self.right = right + self.lineno = lineno + + def getChildren(self): + return self.left, self.right + + def getChildNodes(self): + return self.left, self.right + + def __repr__(self): + return "Sub((%s, %s))" % (repr(self.left), repr(self.right)) + + def visit(self, visitor): + return visitor.visitSub(self) + +class Subscript(Node): + def __init__(self, expr, flags, subs, lineno=None): + self.expr = expr + self.flags = flags + self.subs = subs + self.lineno = lineno + + def getChildren(self): + children = [] + children.append(self.expr) + children.append(self.flags) + children.extend(flatten(self.subs)) + return tuple(children) + + def getChildNodes(self): + nodelist = [] + nodelist.append(self.expr) + nodelist.extend(flatten_nodes(self.subs)) + return tuple(nodelist) + + def __repr__(self): + return "Subscript(%s, %s, %s)" % (repr(self.expr), repr(self.flags), repr(self.subs)) + + def visit(self, visitor): + return visitor.visitSubscript(self) + +class TryExcept(Node): + def __init__(self, body, handlers, else_, lineno=None): + self.body = body + self.handlers = handlers + self.else_ = else_ + self.lineno = lineno + + def getChildren(self): + children = [] + children.append(self.body) + children.extend(flatten(self.handlers)) + children.append(self.else_) + return tuple(children) + + def getChildNodes(self): + nodelist = [] + nodelist.append(self.body) + nodelist.extend(flatten_nodes(self.handlers)) + if self.else_ is not None: + nodelist.append(self.else_) + return tuple(nodelist) + + def __repr__(self): + return "TryExcept(%s, %s, %s)" % (repr(self.body), repr(self.handlers), repr(self.else_)) + + def visit(self, visitor): + return visitor.visitTryExcept(self) + +class TryFinally(Node): + def __init__(self, body, final, lineno=None): + self.body = body + self.final = final + self.lineno = lineno + + def getChildren(self): + return self.body, self.final + + def getChildNodes(self): + return self.body, self.final + + def __repr__(self): + return "TryFinally(%s, %s)" % (repr(self.body), repr(self.final)) + + def visit(self, visitor): + return visitor.visitTryFinally(self) + +class Tuple(Node): + def __init__(self, nodes, lineno=None): + self.nodes = nodes + self.lineno = lineno + + def getChildren(self): + return tuple(flatten(self.nodes)) + + def getChildNodes(self): + nodelist = [] + nodelist.extend(flatten_nodes(self.nodes)) + return tuple(nodelist) + + def __repr__(self): + return "Tuple(%s)" % (repr(self.nodes),) + + def visit(self, visitor): + return visitor.visitTuple(self) + +class UnaryAdd(Node): + def __init__(self, expr, lineno=None): + self.expr = expr + self.lineno = lineno + + def getChildren(self): + return self.expr, + + def getChildNodes(self): + return self.expr, + + def __repr__(self): + return "UnaryAdd(%s)" % (repr(self.expr),) + + def visit(self, visitor): + return visitor.visitUnaryAdd(self) + +class UnarySub(Node): + def __init__(self, expr, lineno=None): + self.expr = expr + self.lineno = lineno + + def getChildren(self): + return self.expr, + + def getChildNodes(self): + return self.expr, + + def __repr__(self): + return "UnarySub(%s)" % (repr(self.expr),) + + def visit(self, visitor): + return visitor.visitUnarySub(self) + +class While(Node): + def __init__(self, test, body, else_, lineno=None): + self.test = test + self.body = body + self.else_ = else_ + self.lineno = lineno + + def getChildren(self): + children = [] + children.append(self.test) + children.append(self.body) + children.append(self.else_) + return tuple(children) + + def getChildNodes(self): + nodelist = [] + nodelist.append(self.test) + nodelist.append(self.body) + if self.else_ is not None: + nodelist.append(self.else_) + return tuple(nodelist) + + def __repr__(self): + return "While(%s, %s, %s)" % (repr(self.test), repr(self.body), repr(self.else_)) + + def visit(self, visitor): + return visitor.visitWhile(self) + +class Yield(Node): + def __init__(self, value, lineno=None): + self.value = value + self.lineno = lineno + + def getChildren(self): + return self.value, + + def getChildNodes(self): + return self.value, + + def __repr__(self): + return "Yield(%s)" % (repr(self.value),) + + def visit(self, visitor): + return visitor.visitYield(self) + +for name, obj in globals().items(): + if isinstance(obj, type) and issubclass(obj, Node): + nodes[name.lower()] = obj Added: pypy/branch/pycompiler/module/recparser/compiler/ast.txt ============================================================================== --- (empty file) +++ pypy/branch/pycompiler/module/recparser/compiler/ast.txt Tue May 24 14:21:39 2005 @@ -0,0 +1,99 @@ +# This file describes the nodes of the AST in ast.py. The module is +# generated by astgen.py. +# The descriptions use the following special notation to describe +# properties of the children: +# * this child is not a node +# ! this child is a sequence that contains nodes in it +# & this child may be set to None +# = ... a default value for the node constructor (optional args) +Module: doc*, node +Stmt: nodes! +Decorators: nodes! +Function: decorators&, name*, argnames*, defaults!, flags*, doc*, code +Lambda: argnames*, defaults!, flags*, code +Class: name*, bases!, doc*, code +Pass: +Break: +Continue: +For: assign, list, body, else_& +While: test, body, else_& +If: tests!, else_& +Exec: expr, locals&, globals& +From: modname*, names* +Import: names* +Raise: expr1&, expr2&, expr3& +TryFinally: body, final +TryExcept: body, handlers!, else_& +Return: value +Yield: value +Const: value* +Print: nodes!, dest& +Printnl: nodes!, dest& +Discard: expr +AugAssign: node, op*, expr +Assign: nodes!, expr +AssTuple: nodes! +AssList: nodes! +AssName: name*, flags* +AssAttr: expr, attrname*, flags* +ListComp: expr, quals! +ListCompFor: assign, list, ifs! +ListCompIf: test +GenExpr: code +GenExprInner: expr, quals! +GenExprFor: assign, iter, ifs! +GenExprIf: test +List: nodes! +Dict: items! +Not: expr +Compare: expr, ops! +Name: name* +Global: names* +Backquote: expr +Getattr: expr, attrname* +CallFunc: node, args!, star_args& = None, dstar_args& = None +Keyword: name*, expr +Subscript: expr, flags*, subs! +Ellipsis: +Sliceobj: nodes! +Slice: expr, flags*, lower&, upper& +Assert: test, fail& +Tuple: nodes! +Or: nodes! +And: nodes! +Bitor: nodes! +Bitxor: nodes! +Bitand: nodes! +LeftShift: (left, right) +RightShift: (left, right) +Add: (left, right) +Sub: (left, right) +Mul: (left, right) +Div: (left, right) +Mod: (left, right) +Power: (left, right) +FloorDiv: (left, right) +UnaryAdd: expr +UnarySub: expr +Invert: expr + +init(Function): + self.varargs = self.kwargs = None + if flags & CO_VARARGS: + self.varargs = 1 + if flags & CO_VARKEYWORDS: + self.kwargs = 1 + +init(Lambda): + self.varargs = self.kwargs = None + if flags & CO_VARARGS: + self.varargs = 1 + if flags & CO_VARKEYWORDS: + self.kwargs = 1 + +init(GenExpr): + self.argnames = ['[outmost-iterable]'] + self.varargs = self.kwargs = None + +init(GenExprFor): + self.is_outmost = False Added: pypy/branch/pycompiler/module/recparser/compiler/astfactory.py ============================================================================== --- (empty file) +++ pypy/branch/pycompiler/module/recparser/compiler/astfactory.py Tue May 24 14:21:39 2005 @@ -0,0 +1,41 @@ + +from ast import * + +class TokenNode(Node): + pass + +def make_subscript( name, source, nodes ): + """'.' '.' '.' | [test] ':' [test] [ ':' [test] ] | test""" + n = nodes[0] + if n.isToken(): + if n.value == '.': + n1 = nodes[2] + if n1.isToken() and n1.value == '.': + return Ellipsis() + elif n.value == ':': + return make_slice( name, source, nodes ) + if len(nodes)>1: + return make_slice( name, source, nodes ) + return n + +def make_subscriptlist( name, source, nodes ): + """ idx (',' idx)* """ + values = [] + for i in range(0, len(nodes), 2): + values.append( nodes[i] ) + return Subscript( values ) + +def make_slice( name, source, nodes ): + """TODO""" + idx = 0 + + for n in nodes: + + + + + + +for name, factory in globals().items(): + if name.startswith("make_"): + astfactory[name[5:]] = factory Added: pypy/branch/pycompiler/module/recparser/compiler/astgen.py ============================================================================== --- (empty file) +++ pypy/branch/pycompiler/module/recparser/compiler/astgen.py Tue May 24 14:21:39 2005 @@ -0,0 +1,300 @@ +"""Generate ast module from specification + +This script generates the ast module from a simple specification, +which makes it easy to accomodate changes in the grammar. This +approach would be quite reasonable if the grammar changed often. +Instead, it is rather complex to generate the appropriate code. And +the Node interface has changed more often than the grammar. +""" +# This is a slightly modified version from the original that adds a +# visit method to each node + +import fileinput +import getopt +import re +import sys +from StringIO import StringIO + +SPEC = "ast.txt" +COMMA = ", " + +def load_boilerplate(file): + f = open(file) + buf = f.read() + f.close() + i = buf.find('### ''PROLOGUE') + j = buf.find('### ''EPILOGUE') + pro = buf[i+12:j].strip() + epi = buf[j+12:].strip() + return pro, epi + +def strip_default(arg): + """Return the argname from an 'arg = default' string""" + i = arg.find('=') + if i == -1: + return arg + t = arg[:i].strip() + return t + +P_NODE = 1 +P_OTHER = 2 +P_NESTED = 3 +P_NONE = 4 + +class NodeInfo: + """Each instance describes a specific AST node""" + def __init__(self, name, args): + self.name = name + self.args = args.strip() + self.argnames = self.get_argnames() + self.argprops = self.get_argprops() + self.nargs = len(self.argnames) + self.init = [] + + def get_argnames(self): + if '(' in self.args: + i = self.args.find('(') + j = self.args.rfind(')') + args = self.args[i+1:j] + else: + args = self.args + return [strip_default(arg.strip()) + for arg in args.split(',') if arg] + + def get_argprops(self): + """Each argument can have a property like '*' or '!' + + XXX This method modifies the argnames in place! + """ + d = {} + hardest_arg = P_NODE + for i in range(len(self.argnames)): + arg = self.argnames[i] + if arg.endswith('*'): + arg = self.argnames[i] = arg[:-1] + d[arg] = P_OTHER + hardest_arg = max(hardest_arg, P_OTHER) + elif arg.endswith('!'): + arg = self.argnames[i] = arg[:-1] + d[arg] = P_NESTED + hardest_arg = max(hardest_arg, P_NESTED) + elif arg.endswith('&'): + arg = self.argnames[i] = arg[:-1] + d[arg] = P_NONE + hardest_arg = max(hardest_arg, P_NONE) + else: + d[arg] = P_NODE + self.hardest_arg = hardest_arg + + if hardest_arg > P_NODE: + self.args = self.args.replace('*', '') + self.args = self.args.replace('!', '') + self.args = self.args.replace('&', '') + + return d + + def gen_source(self): + buf = StringIO() + print >> buf, "class %s(Node):" % self.name + self._gen_init(buf) + print >> buf + self._gen_getChildren(buf) + print >> buf + self._gen_getChildNodes(buf) + print >> buf + self._gen_repr(buf) + print >> buf + self._gen_visit(buf) + buf.seek(0, 0) + return buf.read() + + def _gen_init(self, buf): + if self.args: + print >> buf, " def __init__(self, %s, lineno=None):" % self.args + else: + print >> buf, " def __init__(self, lineno=None):" + if self.argnames: + for name in self.argnames: + print >> buf, " self.%s = %s" % (name, name) + print >> buf, " self.lineno = lineno" + if self.init: + print >> buf, "".join([" " + line for line in self.init]) + + def _gen_getChildren(self, buf): + print >> buf, " def getChildren(self):" + if len(self.argnames) == 0: + print >> buf, " return ()" + else: + if self.hardest_arg < P_NESTED: + clist = COMMA.join(["self.%s" % c + for c in self.argnames]) + if self.nargs == 1: + print >> buf, " return %s," % clist + else: + print >> buf, " return %s" % clist + else: + if len(self.argnames) == 1: + print >> buf, " return tuple(flatten(self.%s))" % self.argnames[0] + else: + print >> buf, " children = []" + template = " children.%s(%sself.%s%s)" + for name in self.argnames: + if self.argprops[name] == P_NESTED: + print >> buf, template % ("extend", "flatten(", + name, ")") + else: + print >> buf, template % ("append", "", name, "") + print >> buf, " return tuple(children)" + + def _gen_getChildNodes(self, buf): + print >> buf, " def getChildNodes(self):" + if len(self.argnames) == 0: + print >> buf, " return ()" + else: + if self.hardest_arg < P_NESTED: + clist = ["self.%s" % c + for c in self.argnames + if self.argprops[c] == P_NODE] + if len(clist) == 0: + print >> buf, " return ()" + elif len(clist) == 1: + print >> buf, " return %s," % clist[0] + else: + print >> buf, " return %s" % COMMA.join(clist) + else: + print >> buf, " nodelist = []" + template = " nodelist.%s(%sself.%s%s)" + for name in self.argnames: + if self.argprops[name] == P_NONE: + tmp = (" if self.%s is not None:\n" + " nodelist.append(self.%s)") + print >> buf, tmp % (name, name) + elif self.argprops[name] == P_NESTED: + print >> buf, template % ("extend", "flatten_nodes(", + name, ")") + elif self.argprops[name] == P_NODE: + print >> buf, template % ("append", "", name, "") + print >> buf, " return tuple(nodelist)" + + def _gen_repr(self, buf): + print >> buf, " def __repr__(self):" + if self.argnames: + fmt = COMMA.join(["%s"] * self.nargs) + if '(' in self.args: + fmt = '(%s)' % fmt + vals = ["repr(self.%s)" % name for name in self.argnames] + vals = COMMA.join(vals) + if self.nargs == 1: + vals = vals + "," + print >> buf, ' return "%s(%s)" %% (%s)' % \ + (self.name, fmt, vals) + else: + print >> buf, ' return "%s()"' % self.name + + def _gen_visit(self, buf): + print >> buf, " def visit(self, visitor):" + print >> buf, " return visitor.visit%s(self)" % self.name + +rx_init = re.compile('init\((.*)\):') + +def parse_spec(file): + classes = {} + cur = None + for line in fileinput.input(file): + if line.strip().startswith('#'): + continue + mo = rx_init.search(line) + if mo is None: + if cur is None: + # a normal entry + try: + name, args = line.split(':') + except ValueError: + continue + classes[name] = NodeInfo(name, args) + cur = None + else: + # some code for the __init__ method + cur.init.append(line) + else: + # some extra code for a Node's __init__ method + name = mo.group(1) + cur = classes[name] + return sorted(classes.values(), key=lambda n: n.name) + +def main(): + prologue, epilogue = load_boilerplate(sys.argv[-1]) + print prologue + print + classes = parse_spec(SPEC) + for info in classes: + print info.gen_source() + print epilogue + +if __name__ == "__main__": + main() + sys.exit(0) + +### PROLOGUE +"""Python abstract syntax node definitions + +This file is automatically generated by Tools/compiler/astgen.py +""" +from consts import CO_VARARGS, CO_VARKEYWORDS + +def flatten(list): + l = [] + for elt in list: + t = type(elt) + if t is tuple or t is list: + for elt2 in flatten(elt): + l.append(elt2) + else: + l.append(elt) + return l + +def flatten_nodes(list): + return [n for n in flatten(list) if isinstance(n, Node)] + +nodes = {} + +class Node: + """Abstract base class for ast nodes.""" + def getChildren(self): + pass # implemented by subclasses + def __iter__(self): + for n in self.getChildren(): + yield n + def asList(self): # for backwards compatibility + return self.getChildren() + def getChildNodes(self): + pass # implemented by subclasses + def visit(self, visitor, *args): + return visitor.visitNode(self, *args) + +class EmptyNode(Node): + def visit(self, visitor, *args): + return visitor.visitEmptyNode(self, *args) + +class Expression(Node): + # Expression is an artificial node class to support "eval" + nodes["expression"] = "Expression" + def __init__(self, node): + self.node = node + + def getChildren(self): + return self.node, + + def getChildNodes(self): + return self.node, + + def __repr__(self): + return "Expression(%s)" % (repr(self.node)) + + def visit(self, visitor, *args): + return visitor.visitExpression(self, *args) + +### EPILOGUE +for name, obj in globals().items(): + if isinstance(obj, type) and issubclass(obj, Node): + nodes[name.lower()] = obj Added: pypy/branch/pycompiler/module/recparser/compiler/consts.py ============================================================================== --- (empty file) +++ pypy/branch/pycompiler/module/recparser/compiler/consts.py Tue May 24 14:21:39 2005 @@ -0,0 +1,19 @@ +# operation flags +OP_ASSIGN = 'OP_ASSIGN' +OP_DELETE = 'OP_DELETE' +OP_APPLY = 'OP_APPLY' + +SC_LOCAL = 1 +SC_GLOBAL = 2 +SC_FREE = 3 +SC_CELL = 4 +SC_UNKNOWN = 5 + +CO_OPTIMIZED = 0x0001 +CO_NEWLOCALS = 0x0002 +CO_VARARGS = 0x0004 +CO_VARKEYWORDS = 0x0008 +CO_NESTED = 0x0010 +CO_GENERATOR = 0x0020 +CO_GENERATOR_ALLOWED = 0x1000 +CO_FUTURE_DIVISION = 0x2000 Added: pypy/branch/pycompiler/module/recparser/compiler/future.py ============================================================================== --- (empty file) +++ pypy/branch/pycompiler/module/recparser/compiler/future.py Tue May 24 14:21:39 2005 @@ -0,0 +1,72 @@ +"""Parser for future statements + +""" + +from compiler import ast, walk + +def is_future(stmt): + """Return true if statement is a well-formed future statement""" + if not isinstance(stmt, ast.From): + return 0 + if stmt.modname == "__future__": + return 1 + else: + return 0 + +class FutureParser: + + features = ("nested_scopes", "generators", "division") + + def __init__(self): + self.found = {} # set + + def visitModule(self, node): + stmt = node.node + for s in stmt.nodes: + if not self.check_stmt(s): + break + + def check_stmt(self, stmt): + if is_future(stmt): + for name, asname in stmt.names: + if name in self.features: + self.found[name] = 1 + else: + raise SyntaxError, \ + "future feature %s is not defined" % name + stmt.valid_future = 1 + return 1 + return 0 + + def get_features(self): + """Return list of features enabled by future statements""" + return self.found.keys() + +class BadFutureParser: + """Check for invalid future statements""" + + def visitFrom(self, node): + if hasattr(node, 'valid_future'): + return + if node.modname != "__future__": + return + raise SyntaxError, "invalid future statement" + +def find_futures(node): + p1 = FutureParser() + p2 = BadFutureParser() + walk(node, p1) + walk(node, p2) + return p1.get_features() + +if __name__ == "__main__": + import sys + from compiler import parseFile, walk + + for file in sys.argv[1:]: + print file + tree = parseFile(file) + v = FutureParser() + walk(tree, v) + print v.found + print Added: pypy/branch/pycompiler/module/recparser/compiler/misc.py ============================================================================== --- (empty file) +++ pypy/branch/pycompiler/module/recparser/compiler/misc.py Tue May 24 14:21:39 2005 @@ -0,0 +1,74 @@ +import types + +def flatten(tup): + elts = [] + for elt in tup: + if type(elt) == types.TupleType: + elts = elts + flatten(elt) + else: + elts.append(elt) + return elts + +class Set: + def __init__(self): + self.elts = {} + def __len__(self): + return len(self.elts) + def __contains__(self, elt): + return self.elts.has_key(elt) + def add(self, elt): + self.elts[elt] = elt + def elements(self): + return self.elts.keys() + def has_elt(self, elt): + return self.elts.has_key(elt) + def remove(self, elt): + del self.elts[elt] + def copy(self): + c = Set() + c.elts.update(self.elts) + return c + +class Stack: + def __init__(self): + self.stack = [] + self.pop = self.stack.pop + def __len__(self): + return len(self.stack) + def push(self, elt): + self.stack.append(elt) + def top(self): + return self.stack[-1] + def __getitem__(self, index): # needed by visitContinue() + return self.stack[index] + +MANGLE_LEN = 256 # magic constant from compile.c + +def mangle(name, klass): + if not name.startswith('__'): + return name + if len(name) + 2 >= MANGLE_LEN: + return name + if name.endswith('__'): + return name + try: + i = 0 + while klass[i] == '_': + i = i + 1 + except IndexError: + return name + klass = klass[i:] + + tlen = len(klass) + len(name) + if tlen > MANGLE_LEN: + klass = klass[:MANGLE_LEN-tlen] + + return "_%s%s" % (klass, name) + +def set_filename(filename, tree): + """Set the filename attribute to filename on every node in tree""" + worklist = [tree] + while worklist: + node = worklist.pop(0) + node.filename = filename + worklist.extend(node.getChildNodes()) Added: pypy/branch/pycompiler/module/recparser/compiler/pyassem.py ============================================================================== --- (empty file) +++ pypy/branch/pycompiler/module/recparser/compiler/pyassem.py Tue May 24 14:21:39 2005 @@ -0,0 +1,818 @@ +"""A flow graph representation for Python bytecode""" + +import dis +import new +import sys +import types + +from compiler import misc +from compiler.consts \ + import CO_OPTIMIZED, CO_NEWLOCALS, CO_VARARGS, CO_VARKEYWORDS + +class FlowGraph: + def __init__(self): + self.current = self.entry = Block() + self.exit = Block("exit") + self.blocks = misc.Set() + self.blocks.add(self.entry) + self.blocks.add(self.exit) + + def startBlock(self, block): + if self._debug: + if self.current: + print "end", repr(self.current) + print " next", self.current.next + print " ", self.current.get_children() + print repr(block) + self.current = block + + def nextBlock(self, block=None): + # XXX think we need to specify when there is implicit transfer + # from one block to the next. might be better to represent this + # with explicit JUMP_ABSOLUTE instructions that are optimized + # out when they are unnecessary. + # + # I think this strategy works: each block has a child + # designated as "next" which is returned as the last of the + # children. because the nodes in a graph are emitted in + # reverse post order, the "next" block will always be emitted + # immediately after its parent. + # Worry: maintaining this invariant could be tricky + if block is None: + block = self.newBlock() + + # Note: If the current block ends with an unconditional + # control transfer, then it is incorrect to add an implicit + # transfer to the block graph. The current code requires + # these edges to get the blocks emitted in the right order, + # however. :-( If a client needs to remove these edges, call + # pruneEdges(). + + self.current.addNext(block) + self.startBlock(block) + + def newBlock(self): + b = Block() + self.blocks.add(b) + return b + + def startExitBlock(self): + self.startBlock(self.exit) + + _debug = 0 + + def _enable_debug(self): + self._debug = 1 + + def _disable_debug(self): + self._debug = 0 + + def emit(self, *inst): + if self._debug: + print "\t", inst + if inst[0] in ['RETURN_VALUE', 'YIELD_VALUE']: + self.current.addOutEdge(self.exit) + if len(inst) == 2 and isinstance(inst[1], Block): + self.current.addOutEdge(inst[1]) + self.current.emit(inst) + + def getBlocksInOrder(self): + """Return the blocks in reverse postorder + + i.e. each node appears before all of its successors + """ + # XXX make sure every node that doesn't have an explicit next + # is set so that next points to exit + for b in self.blocks.elements(): + if b is self.exit: + continue + if not b.next: + b.addNext(self.exit) + order = dfs_postorder(self.entry, {}) + order.reverse() + self.fixupOrder(order, self.exit) + # hack alert + if not self.exit in order: + order.append(self.exit) + + return order + + def fixupOrder(self, blocks, default_next): + """Fixup bad order introduced by DFS.""" + + # XXX This is a total mess. There must be a better way to get + # the code blocks in the right order. + + self.fixupOrderHonorNext(blocks, default_next) + self.fixupOrderForward(blocks, default_next) + + def fixupOrderHonorNext(self, blocks, default_next): + """Fix one problem with DFS. + + The DFS uses child block, but doesn't know about the special + "next" block. As a result, the DFS can order blocks so that a + block isn't next to the right block for implicit control + transfers. + """ + index = {} + for i in range(len(blocks)): + index[blocks[i]] = i + + for i in range(0, len(blocks) - 1): + b = blocks[i] + n = blocks[i + 1] + if not b.next or b.next[0] == default_next or b.next[0] == n: + continue + # The blocks are in the wrong order. Find the chain of + # blocks to insert where they belong. + cur = b + chain = [] + elt = cur + while elt.next and elt.next[0] != default_next: + chain.append(elt.next[0]) + elt = elt.next[0] + # Now remove the blocks in the chain from the current + # block list, so that they can be re-inserted. + l = [] + for b in chain: + assert index[b] > i + l.append((index[b], b)) + l.sort() + l.reverse() + for j, b in l: + del blocks[index[b]] + # Insert the chain in the proper location + blocks[i:i + 1] = [cur] + chain + # Finally, re-compute the block indexes + for i in range(len(blocks)): + index[blocks[i]] = i + + def fixupOrderForward(self, blocks, default_next): + """Make sure all JUMP_FORWARDs jump forward""" + index = {} + chains = [] + cur = [] + for b in blocks: + index[b] = len(chains) + cur.append(b) + if b.next and b.next[0] == default_next: + chains.append(cur) + cur = [] + chains.append(cur) + + while 1: + constraints = [] + + for i in range(len(chains)): + l = chains[i] + for b in l: + for c in b.get_children(): + if index[c] < i: + forward_p = 0 + for inst in b.insts: + if inst[0] == 'JUMP_FORWARD': + if inst[1] == c: + forward_p = 1 + if not forward_p: + continue + constraints.append((index[c], i)) + + if not constraints: + break + + # XXX just do one for now + # do swaps to get things in the right order + goes_before, a_chain = constraints[0] + assert a_chain > goes_before + c = chains[a_chain] + chains.remove(c) + chains.insert(goes_before, c) + + del blocks[:] + for c in chains: + for b in c: + blocks.append(b) + + def getBlocks(self): + return self.blocks.elements() + + def getRoot(self): + """Return nodes appropriate for use with dominator""" + return self.entry + + def getContainedGraphs(self): + l = [] + for b in self.getBlocks(): + l.extend(b.getContainedGraphs()) + return l + +def dfs_postorder(b, seen): + """Depth-first search of tree rooted at b, return in postorder""" + order = [] + seen[b] = b + for c in b.get_children(): + if seen.has_key(c): + continue + order = order + dfs_postorder(c, seen) + order.append(b) + return order + +class Block: + _count = 0 + + def __init__(self, label=''): + self.insts = [] + self.inEdges = misc.Set() + self.outEdges = misc.Set() + self.label = label + self.bid = Block._count + self.next = [] + Block._count = Block._count + 1 + + def __repr__(self): + if self.label: + return "" % (self.label, self.bid) + else: + return "" % (self.bid) + + def __str__(self): + insts = map(str, self.insts) + return "" % (self.label, self.bid, + '\n'.join(insts)) + + def emit(self, inst): + op = inst[0] + if op[:4] == 'JUMP': + self.outEdges.add(inst[1]) + self.insts.append(inst) + + def getInstructions(self): + return self.insts + + def addInEdge(self, block): + self.inEdges.add(block) + + def addOutEdge(self, block): + self.outEdges.add(block) + + def addNext(self, block): + self.next.append(block) + assert len(self.next) == 1, map(str, self.next) + + _uncond_transfer = ('RETURN_VALUE', 'RAISE_VARARGS', 'YIELD_VALUE', + 'JUMP_ABSOLUTE', 'JUMP_FORWARD', 'CONTINUE_LOOP') + + def pruneNext(self): + """Remove bogus edge for unconditional transfers + + Each block has a next edge that accounts for implicit control + transfers, e.g. from a JUMP_IF_FALSE to the block that will be + executed if the test is true. + + These edges must remain for the current assembler code to + work. If they are removed, the dfs_postorder gets things in + weird orders. However, they shouldn't be there for other + purposes, e.g. conversion to SSA form. This method will + remove the next edge when it follows an unconditional control + transfer. + """ + try: + op, arg = self.insts[-1] + except (IndexError, ValueError): + return + if op in self._uncond_transfer: + self.next = [] + + def get_children(self): + if self.next and self.next[0] in self.outEdges: + self.outEdges.remove(self.next[0]) + return self.outEdges.elements() + self.next + + def getContainedGraphs(self): + """Return all graphs contained within this block. + + For example, a MAKE_FUNCTION block will contain a reference to + the graph for the function body. + """ + contained = [] + for inst in self.insts: + if len(inst) == 1: + continue + op = inst[1] + if hasattr(op, 'graph'): + contained.append(op.graph) + return contained + +# flags for code objects + +# the FlowGraph is transformed in place; it exists in one of these states +RAW = "RAW" +FLAT = "FLAT" +CONV = "CONV" +DONE = "DONE" + +class PyFlowGraph(FlowGraph): + super_init = FlowGraph.__init__ + + def __init__(self, name, filename, args=(), optimized=0, klass=None): + self.super_init() + self.name = name + self.filename = filename + self.docstring = None + self.args = args # XXX + self.argcount = getArgCount(args) + self.klass = klass + if optimized: + self.flags = CO_OPTIMIZED | CO_NEWLOCALS + else: + self.flags = 0 + self.consts = [] + self.names = [] + # Free variables found by the symbol table scan, including + # variables used only in nested scopes, are included here. + self.freevars = [] + self.cellvars = [] + # The closure list is used to track the order of cell + # variables and free variables in the resulting code object. + # The offsets used by LOAD_CLOSURE/LOAD_DEREF refer to both + # kinds of variables. + self.closure = [] + self.varnames = list(args) or [] + for i in range(len(self.varnames)): + var = self.varnames[i] + if isinstance(var, TupleArg): + self.varnames[i] = var.getName() + self.stage = RAW + + def setDocstring(self, doc): + self.docstring = doc + + def setFlag(self, flag): + self.flags = self.flags | flag + if flag == CO_VARARGS: + self.argcount = self.argcount - 1 + + def checkFlag(self, flag): + if self.flags & flag: + return 1 + + def setFreeVars(self, names): + self.freevars = list(names) + + def setCellVars(self, names): + self.cellvars = names + + def getCode(self): + """Get a Python code object""" + if self.stage == RAW: + self.computeStackDepth() + self.flattenGraph() + if self.stage == FLAT: + self.convertArgs() + if self.stage == CONV: + self.makeByteCode() + if self.stage == DONE: + return self.newCodeObject() + raise RuntimeError, "inconsistent PyFlowGraph state" + + def dump(self, io=None): + if io: + save = sys.stdout + sys.stdout = io + pc = 0 + for t in self.insts: + opname = t[0] + if opname == "SET_LINENO": + print + if len(t) == 1: + print "\t", "%3d" % pc, opname + pc = pc + 1 + else: + print "\t", "%3d" % pc, opname, t[1] + pc = pc + 3 + if io: + sys.stdout = save + + def computeStackDepth(self): + """Compute the max stack depth. + + Approach is to compute the stack effect of each basic block. + Then find the path through the code with the largest total + effect. + """ + depth = {} + exit = None + for b in self.getBlocks(): + depth[b] = findDepth(b.getInstructions()) + + seen = {} + + def max_depth(b, d): + if seen.has_key(b): + return d + seen[b] = 1 + d = d + depth[b] + children = b.get_children() + if children: + return max([max_depth(c, d) for c in children]) + else: + if not b.label == "exit": + return max_depth(self.exit, d) + else: + return d + + self.stacksize = max_depth(self.entry, 0) + + def flattenGraph(self): + """Arrange the blocks in order and resolve jumps""" + assert self.stage == RAW + self.insts = insts = [] + pc = 0 + begin = {} + end = {} + for b in self.getBlocksInOrder(): + begin[b] = pc + for inst in b.getInstructions(): + insts.append(inst) + if len(inst) == 1: + pc = pc + 1 + elif inst[0] != "SET_LINENO": + # arg takes 2 bytes + pc = pc + 3 + end[b] = pc + pc = 0 + for i in range(len(insts)): + inst = insts[i] + if len(inst) == 1: + pc = pc + 1 + elif inst[0] != "SET_LINENO": + pc = pc + 3 + opname = inst[0] + if self.hasjrel.has_elt(opname): + oparg = inst[1] + offset = begin[oparg] - pc + insts[i] = opname, offset + elif self.hasjabs.has_elt(opname): + insts[i] = opname, begin[inst[1]] + self.stage = FLAT + + hasjrel = misc.Set() + for i in dis.hasjrel: + hasjrel.add(dis.opname[i]) + hasjabs = misc.Set() + for i in dis.hasjabs: + hasjabs.add(dis.opname[i]) + + def convertArgs(self): + """Convert arguments from symbolic to concrete form""" + assert self.stage == FLAT + self.consts.insert(0, self.docstring) + self.sort_cellvars() + for i in range(len(self.insts)): + t = self.insts[i] + if len(t) == 2: + opname, oparg = t + conv = self._converters.get(opname, None) + if conv: + self.insts[i] = opname, conv(self, oparg) + self.stage = CONV + + def sort_cellvars(self): + """Sort cellvars in the order of varnames and prune from freevars. + """ + cells = {} + for name in self.cellvars: + cells[name] = 1 + self.cellvars = [name for name in self.varnames + if cells.has_key(name)] + for name in self.cellvars: + del cells[name] + self.cellvars = self.cellvars + cells.keys() + self.closure = self.cellvars + self.freevars + + def _lookupName(self, name, list): + """Return index of name in list, appending if necessary + + This routine uses a list instead of a dictionary, because a + dictionary can't store two different keys if the keys have the + same value but different types, e.g. 2 and 2L. The compiler + must treat these two separately, so it does an explicit type + comparison before comparing the values. + """ + t = type(name) + for i in range(len(list)): + if t == type(list[i]) and list[i] == name: + return i + end = len(list) + list.append(name) + return end + + _converters = {} + def _convert_LOAD_CONST(self, arg): + if hasattr(arg, 'getCode'): + arg = arg.getCode() + return self._lookupName(arg, self.consts) + + def _convert_LOAD_FAST(self, arg): + self._lookupName(arg, self.names) + return self._lookupName(arg, self.varnames) + _convert_STORE_FAST = _convert_LOAD_FAST + _convert_DELETE_FAST = _convert_LOAD_FAST + + def _convert_LOAD_NAME(self, arg): + if self.klass is None: + self._lookupName(arg, self.varnames) + return self._lookupName(arg, self.names) + + def _convert_NAME(self, arg): + if self.klass is None: + self._lookupName(arg, self.varnames) + return self._lookupName(arg, self.names) + _convert_STORE_NAME = _convert_NAME + _convert_DELETE_NAME = _convert_NAME + _convert_IMPORT_NAME = _convert_NAME + _convert_IMPORT_FROM = _convert_NAME + _convert_STORE_ATTR = _convert_NAME + _convert_LOAD_ATTR = _convert_NAME + _convert_DELETE_ATTR = _convert_NAME + _convert_LOAD_GLOBAL = _convert_NAME + _convert_STORE_GLOBAL = _convert_NAME + _convert_DELETE_GLOBAL = _convert_NAME + + def _convert_DEREF(self, arg): + self._lookupName(arg, self.names) + self._lookupName(arg, self.varnames) + return self._lookupName(arg, self.closure) + _convert_LOAD_DEREF = _convert_DEREF + _convert_STORE_DEREF = _convert_DEREF + + def _convert_LOAD_CLOSURE(self, arg): + self._lookupName(arg, self.varnames) + return self._lookupName(arg, self.closure) + + _cmp = list(dis.cmp_op) + def _convert_COMPARE_OP(self, arg): + return self._cmp.index(arg) + + # similarly for other opcodes... + + for name, obj in locals().items(): + if name[:9] == "_convert_": + opname = name[9:] + _converters[opname] = obj + del name, obj, opname + + def makeByteCode(self): + assert self.stage == CONV + self.lnotab = lnotab = LineAddrTable() + for t in self.insts: + opname = t[0] + if len(t) == 1: + lnotab.addCode(self.opnum[opname]) + else: + oparg = t[1] + if opname == "SET_LINENO": + lnotab.nextLine(oparg) + continue + hi, lo = twobyte(oparg) + try: + lnotab.addCode(self.opnum[opname], lo, hi) + except ValueError: + print opname, oparg + print self.opnum[opname], lo, hi + raise + self.stage = DONE + + opnum = {} + for num in range(len(dis.opname)): + opnum[dis.opname[num]] = num + del num + + def newCodeObject(self): + assert self.stage == DONE + if (self.flags & CO_NEWLOCALS) == 0: + nlocals = 0 + else: + nlocals = len(self.varnames) + argcount = self.argcount + if self.flags & CO_VARKEYWORDS: + argcount = argcount - 1 + return new.code(argcount, nlocals, self.stacksize, self.flags, + self.lnotab.getCode(), self.getConsts(), + tuple(self.names), tuple(self.varnames), + self.filename, self.name, self.lnotab.firstline, + self.lnotab.getTable(), tuple(self.freevars), + tuple(self.cellvars)) + + def getConsts(self): + """Return a tuple for the const slot of the code object + + Must convert references to code (MAKE_FUNCTION) to code + objects recursively. + """ + l = [] + for elt in self.consts: + if isinstance(elt, PyFlowGraph): + elt = elt.getCode() + l.append(elt) + return tuple(l) + +def isJump(opname): + if opname[:4] == 'JUMP': + return 1 + +class TupleArg: + """Helper for marking func defs with nested tuples in arglist""" + def __init__(self, count, names): + self.count = count + self.names = names + def __repr__(self): + return "TupleArg(%s, %s)" % (self.count, self.names) + def getName(self): + return ".%d" % self.count + +def getArgCount(args): + argcount = len(args) + if args: + for arg in args: + if isinstance(arg, TupleArg): + numNames = len(misc.flatten(arg.names)) + argcount = argcount - numNames + return argcount + +def twobyte(val): + """Convert an int argument into high and low bytes""" + assert type(val) == types.IntType + return divmod(val, 256) + +class LineAddrTable: + """lnotab + + This class builds the lnotab, which is documented in compile.c. + Here's a brief recap: + + For each SET_LINENO instruction after the first one, two bytes are + added to lnotab. (In some cases, multiple two-byte entries are + added.) The first byte is the distance in bytes between the + instruction for the last SET_LINENO and the current SET_LINENO. + The second byte is offset in line numbers. If either offset is + greater than 255, multiple two-byte entries are added -- see + compile.c for the delicate details. + """ + + def __init__(self): + self.code = [] + self.codeOffset = 0 + self.firstline = 0 + self.lastline = 0 + self.lastoff = 0 + self.lnotab = [] + + def addCode(self, *args): + for arg in args: + self.code.append(chr(arg)) + self.codeOffset = self.codeOffset + len(args) + + def nextLine(self, lineno): + if self.firstline == 0: + self.firstline = lineno + self.lastline = lineno + else: + # compute deltas + addr = self.codeOffset - self.lastoff + line = lineno - self.lastline + # Python assumes that lineno always increases with + # increasing bytecode address (lnotab is unsigned char). + # Depending on when SET_LINENO instructions are emitted + # this is not always true. Consider the code: + # a = (1, + # b) + # In the bytecode stream, the assignment to "a" occurs + # after the loading of "b". This works with the C Python + # compiler because it only generates a SET_LINENO instruction + # for the assignment. + if line >= 0: + push = self.lnotab.append + while addr > 255: + push(255); push(0) + addr -= 255 + while line > 255: + push(addr); push(255) + line -= 255 + addr = 0 + if addr > 0 or line > 0: + push(addr); push(line) + self.lastline = lineno + self.lastoff = self.codeOffset + + def getCode(self): + return ''.join(self.code) + + def getTable(self): + return ''.join(map(chr, self.lnotab)) + +class StackDepthTracker: + # XXX 1. need to keep track of stack depth on jumps + # XXX 2. at least partly as a result, this code is broken + + def findDepth(self, insts, debug=0): + depth = 0 + maxDepth = 0 + for i in insts: + opname = i[0] + if debug: + print i, + delta = self.effect.get(opname, None) + if delta is not None: + depth = depth + delta + else: + # now check patterns + for pat, pat_delta in self.patterns: + if opname[:len(pat)] == pat: + delta = pat_delta + depth = depth + delta + break + # if we still haven't found a match + if delta is None: + meth = getattr(self, opname, None) + if meth is not None: + depth = depth + meth(i[1]) + if depth > maxDepth: + maxDepth = depth + if debug: + print depth, maxDepth + return maxDepth + + effect = { + 'POP_TOP': -1, + 'DUP_TOP': 1, + 'SLICE+1': -1, + 'SLICE+2': -1, + 'SLICE+3': -2, + 'STORE_SLICE+0': -1, + 'STORE_SLICE+1': -2, + 'STORE_SLICE+2': -2, + 'STORE_SLICE+3': -3, + 'DELETE_SLICE+0': -1, + 'DELETE_SLICE+1': -2, + 'DELETE_SLICE+2': -2, + 'DELETE_SLICE+3': -3, + 'STORE_SUBSCR': -3, + 'DELETE_SUBSCR': -2, + # PRINT_EXPR? + 'PRINT_ITEM': -1, + 'RETURN_VALUE': -1, + 'YIELD_VALUE': -1, + 'EXEC_STMT': -3, + 'BUILD_CLASS': -2, + 'STORE_NAME': -1, + 'STORE_ATTR': -2, + 'DELETE_ATTR': -1, + 'STORE_GLOBAL': -1, + 'BUILD_MAP': 1, + 'COMPARE_OP': -1, + 'STORE_FAST': -1, + 'IMPORT_STAR': -1, + 'IMPORT_NAME': 0, + 'IMPORT_FROM': 1, + 'LOAD_ATTR': 0, # unlike other loads + # close enough... + 'SETUP_EXCEPT': 3, + 'SETUP_FINALLY': 3, + 'FOR_ITER': 1, + } + # use pattern match + patterns = [ + ('BINARY_', -1), + ('LOAD_', 1), + ] + + def UNPACK_SEQUENCE(self, count): + return count-1 + def BUILD_TUPLE(self, count): + return -count+1 + def BUILD_LIST(self, count): + return -count+1 + def CALL_FUNCTION(self, argc): + hi, lo = divmod(argc, 256) + return -(lo + hi * 2) + def CALL_FUNCTION_VAR(self, argc): + return self.CALL_FUNCTION(argc)-1 + def CALL_FUNCTION_KW(self, argc): + return self.CALL_FUNCTION(argc)-1 + def CALL_FUNCTION_VAR_KW(self, argc): + return self.CALL_FUNCTION(argc)-2 + def MAKE_FUNCTION(self, argc): + return -argc + def MAKE_CLOSURE(self, argc): + # XXX need to account for free variables too! + return -argc + def BUILD_SLICE(self, argc): + if argc == 2: + return -1 + elif argc == 3: + return -2 + def DUP_TOPX(self, argc): + return argc + +findDepth = StackDepthTracker().findDepth Added: pypy/branch/pycompiler/module/recparser/compiler/pycodegen.py ============================================================================== --- (empty file) +++ pypy/branch/pycompiler/module/recparser/compiler/pycodegen.py Tue May 24 14:21:39 2005 @@ -0,0 +1,1479 @@ +import imp +import os +import marshal +import struct +import sys +import types +from cStringIO import StringIO + +from compiler import ast, parse, walk, syntax +from compiler import pyassem, misc, future, symbols +from compiler.consts import SC_LOCAL, SC_GLOBAL, SC_FREE, SC_CELL +from compiler.consts import CO_VARARGS, CO_VARKEYWORDS, CO_NEWLOCALS,\ + CO_NESTED, CO_GENERATOR, CO_GENERATOR_ALLOWED, CO_FUTURE_DIVISION +from compiler.pyassem import TupleArg + +# XXX The version-specific code can go, since this code only works with 2.x. +# Do we have Python 1.x or Python 2.x? +try: + VERSION = sys.version_info[0] +except AttributeError: + VERSION = 1 + +callfunc_opcode_info = { + # (Have *args, Have **args) : opcode + (0,0) : "CALL_FUNCTION", + (1,0) : "CALL_FUNCTION_VAR", + (0,1) : "CALL_FUNCTION_KW", + (1,1) : "CALL_FUNCTION_VAR_KW", +} + +LOOP = 1 +EXCEPT = 2 +TRY_FINALLY = 3 +END_FINALLY = 4 + +def compileFile(filename, display=0): + f = open(filename, 'U') + buf = f.read() + f.close() + mod = Module(buf, filename) + try: + mod.compile(display) + except SyntaxError: + raise + else: + f = open(filename + "c", "wb") + mod.dump(f) + f.close() + +def compile(source, filename, mode, flags=None, dont_inherit=None): + """Replacement for builtin compile() function""" + if flags is not None or dont_inherit is not None: + raise RuntimeError, "not implemented yet" + + if mode == "single": + gen = Interactive(source, filename) + elif mode == "exec": + gen = Module(source, filename) + elif mode == "eval": + gen = Expression(source, filename) + else: + raise ValueError("compile() 3rd arg must be 'exec' or " + "'eval' or 'single'") + gen.compile() + return gen.code + +class AbstractCompileMode: + + mode = None # defined by subclass + + def __init__(self, source, filename): + self.source = source + self.filename = filename + self.code = None + + def _get_tree(self): + tree = parse(self.source, self.mode) + misc.set_filename(self.filename, tree) + syntax.check(tree) + return tree + + def compile(self): + pass # implemented by subclass + + def getCode(self): + return self.code + +class Expression(AbstractCompileMode): + + mode = "eval" + + def compile(self): + tree = self._get_tree() + gen = ExpressionCodeGenerator(tree) + self.code = gen.getCode() + +class Interactive(AbstractCompileMode): + + mode = "single" + + def compile(self): + tree = self._get_tree() + gen = InteractiveCodeGenerator(tree) + self.code = gen.getCode() + +class Module(AbstractCompileMode): + + mode = "exec" + + def compile(self, display=0): + tree = self._get_tree() + gen = ModuleCodeGenerator(tree) + if display: + import pprint + print pprint.pprint(tree) + self.code = gen.getCode() + + def dump(self, f): + f.write(self.getPycHeader()) + marshal.dump(self.code, f) + + MAGIC = imp.get_magic() + + def getPycHeader(self): + # compile.c uses marshal to write a long directly, with + # calling the interface that would also generate a 1-byte code + # to indicate the type of the value. simplest way to get the + # same effect is to call marshal and then skip the code. + mtime = os.path.getmtime(self.filename) + mtime = struct.pack(' 0: + top = top - 1 + kind, loop_block = self.setups[top] + if kind == LOOP: + break + if kind != LOOP: + raise SyntaxError, "'continue' outside loop (%s, %d)" % \ + (node.filename, node.lineno) + self.emit('CONTINUE_LOOP', loop_block) + self.nextBlock() + elif kind == END_FINALLY: + msg = "'continue' not allowed inside 'finally' clause (%s, %d)" + raise SyntaxError, msg % (node.filename, node.lineno) + + def visitTest(self, node, jump): + end = self.newBlock() + for child in node.nodes[:-1]: + self.visit(child) + self.emit(jump, end) + self.nextBlock() + self.emit('POP_TOP') + self.visit(node.nodes[-1]) + self.nextBlock(end) + + def visitAnd(self, node): + self.visitTest(node, 'JUMP_IF_FALSE') + + def visitOr(self, node): + self.visitTest(node, 'JUMP_IF_TRUE') + + def visitCompare(self, node): + self.visit(node.expr) + cleanup = self.newBlock() + for op, code in node.ops[:-1]: + self.visit(code) + self.emit('DUP_TOP') + self.emit('ROT_THREE') + self.emit('COMPARE_OP', op) + self.emit('JUMP_IF_FALSE', cleanup) + self.nextBlock() + self.emit('POP_TOP') + # now do the last comparison + if node.ops: + op, code = node.ops[-1] + self.visit(code) + self.emit('COMPARE_OP', op) + if len(node.ops) > 1: + end = self.newBlock() + self.emit('JUMP_FORWARD', end) + self.startBlock(cleanup) + self.emit('ROT_TWO') + self.emit('POP_TOP') + self.nextBlock(end) + + # list comprehensions + __list_count = 0 + + def visitListComp(self, node): + self.set_lineno(node) + # setup list + append = "$append%d" % self.__list_count + self.__list_count = self.__list_count + 1 + self.emit('BUILD_LIST', 0) + self.emit('DUP_TOP') + self.emit('LOAD_ATTR', 'append') + self._implicitNameOp('STORE', append) + + stack = [] + for i, for_ in zip(range(len(node.quals)), node.quals): + start, anchor = self.visit(for_) + cont = None + for if_ in for_.ifs: + if cont is None: + cont = self.newBlock() + self.visit(if_, cont) + stack.insert(0, (start, cont, anchor)) + + self._implicitNameOp('LOAD', append) + self.visit(node.expr) + self.emit('CALL_FUNCTION', 1) + self.emit('POP_TOP') + + for start, cont, anchor in stack: + if cont: + skip_one = self.newBlock() + self.emit('JUMP_FORWARD', skip_one) + self.startBlock(cont) + self.emit('POP_TOP') + self.nextBlock(skip_one) + self.emit('JUMP_ABSOLUTE', start) + self.startBlock(anchor) + self._implicitNameOp('DELETE', append) + + self.__list_count = self.__list_count - 1 + + def visitListCompFor(self, node): + start = self.newBlock() + anchor = self.newBlock() + + self.visit(node.list) + self.emit('GET_ITER') + self.nextBlock(start) + self.set_lineno(node, force=True) + self.emit('FOR_ITER', anchor) + self.nextBlock() + self.visit(node.assign) + return start, anchor + + def visitListCompIf(self, node, branch): + self.set_lineno(node, force=True) + self.visit(node.test) + self.emit('JUMP_IF_FALSE', branch) + self.newBlock() + self.emit('POP_TOP') + + def visitGenExpr(self, node): + gen = GenExprCodeGenerator(node, self.scopes, self.class_name, + self.get_module()) + walk(node.code, gen) + gen.finish() + self.set_lineno(node) + frees = gen.scope.get_free_vars() + if frees: + for name in frees: + self.emit('LOAD_CLOSURE', name) + self.emit('LOAD_CONST', gen) + self.emit('MAKE_CLOSURE', 0) + else: + self.emit('LOAD_CONST', gen) + self.emit('MAKE_FUNCTION', 0) + + # precomputation of outmost iterable + self.visit(node.code.quals[0].iter) + self.emit('GET_ITER') + self.emit('CALL_FUNCTION', 1) + + def visitGenExprInner(self, node): + self.set_lineno(node) + # setup list + + stack = [] + for i, for_ in zip(range(len(node.quals)), node.quals): + start, anchor = self.visit(for_) + cont = None + for if_ in for_.ifs: + if cont is None: + cont = self.newBlock() + self.visit(if_, cont) + stack.insert(0, (start, cont, anchor)) + + self.visit(node.expr) + self.emit('YIELD_VALUE') + + for start, cont, anchor in stack: + if cont: + skip_one = self.newBlock() + self.emit('JUMP_FORWARD', skip_one) + self.startBlock(cont) + self.emit('POP_TOP') + self.nextBlock(skip_one) + self.emit('JUMP_ABSOLUTE', start) + self.startBlock(anchor) + self.emit('LOAD_CONST', None) + + def visitGenExprFor(self, node): + start = self.newBlock() + anchor = self.newBlock() + + if node.is_outmost: + self.loadName('[outmost-iterable]') + else: + self.visit(node.iter) + self.emit('GET_ITER') + + self.nextBlock(start) + self.set_lineno(node, force=True) + self.emit('FOR_ITER', anchor) + self.nextBlock() + self.visit(node.assign) + return start, anchor + + def visitGenExprIf(self, node, branch): + self.set_lineno(node, force=True) + self.visit(node.test) + self.emit('JUMP_IF_FALSE', branch) + self.newBlock() + self.emit('POP_TOP') + + # exception related + + def visitAssert(self, node): + # XXX would be interesting to implement this via a + # transformation of the AST before this stage + if __debug__: + end = self.newBlock() + self.set_lineno(node) + # XXX AssertionError appears to be special case -- it is always + # loaded as a global even if there is a local name. I guess this + # is a sort of renaming op. + self.nextBlock() + self.visit(node.test) + self.emit('JUMP_IF_TRUE', end) + self.nextBlock() + self.emit('POP_TOP') + self.emit('LOAD_GLOBAL', 'AssertionError') + if node.fail: + self.visit(node.fail) + self.emit('RAISE_VARARGS', 2) + else: + self.emit('RAISE_VARARGS', 1) + self.nextBlock(end) + self.emit('POP_TOP') + + def visitRaise(self, node): + self.set_lineno(node) + n = 0 + if node.expr1: + self.visit(node.expr1) + n = n + 1 + if node.expr2: + self.visit(node.expr2) + n = n + 1 + if node.expr3: + self.visit(node.expr3) + n = n + 1 + self.emit('RAISE_VARARGS', n) + + def visitTryExcept(self, node): + body = self.newBlock() + handlers = self.newBlock() + end = self.newBlock() + if node.else_: + lElse = self.newBlock() + else: + lElse = end + self.set_lineno(node) + self.emit('SETUP_EXCEPT', handlers) + self.nextBlock(body) + self.setups.push((EXCEPT, body)) + self.visit(node.body) + self.emit('POP_BLOCK') + self.setups.pop() + self.emit('JUMP_FORWARD', lElse) + self.startBlock(handlers) + + last = len(node.handlers) - 1 + for i in range(len(node.handlers)): + expr, target, body = node.handlers[i] + self.set_lineno(expr) + if expr: + self.emit('DUP_TOP') + self.visit(expr) + self.emit('COMPARE_OP', 'exception match') + next = self.newBlock() + self.emit('JUMP_IF_FALSE', next) + self.nextBlock() + self.emit('POP_TOP') + self.emit('POP_TOP') + if target: + self.visit(target) + else: + self.emit('POP_TOP') + self.emit('POP_TOP') + self.visit(body) + self.emit('JUMP_FORWARD', end) + if expr: + self.nextBlock(next) + else: + self.nextBlock() + if expr: # XXX + self.emit('POP_TOP') + self.emit('END_FINALLY') + if node.else_: + self.nextBlock(lElse) + self.visit(node.else_) + self.nextBlock(end) + + def visitTryFinally(self, node): + body = self.newBlock() + final = self.newBlock() + self.set_lineno(node) + self.emit('SETUP_FINALLY', final) + self.nextBlock(body) + self.setups.push((TRY_FINALLY, body)) + self.visit(node.body) + self.emit('POP_BLOCK') + self.setups.pop() + self.emit('LOAD_CONST', None) + self.nextBlock(final) + self.setups.push((END_FINALLY, final)) + self.visit(node.final) + self.emit('END_FINALLY') + self.setups.pop() + + # misc + + def visitDiscard(self, node): + self.set_lineno(node) + self.visit(node.expr) + self.emit('POP_TOP') + + def visitConst(self, node): + self.emit('LOAD_CONST', node.value) + + def visitKeyword(self, node): + self.emit('LOAD_CONST', node.name) + self.visit(node.expr) + + def visitGlobal(self, node): + # no code to generate + pass + + def visitName(self, node): + self.set_lineno(node) + self.loadName(node.name) + + def visitPass(self, node): + self.set_lineno(node) + + def visitImport(self, node): + self.set_lineno(node) + for name, alias in node.names: + if VERSION > 1: + self.emit('LOAD_CONST', None) + self.emit('IMPORT_NAME', name) + mod = name.split(".")[0] + if alias: + self._resolveDots(name) + self.storeName(alias) + else: + self.storeName(mod) + + def visitFrom(self, node): + self.set_lineno(node) + fromlist = map(lambda (name, alias): name, node.names) + if VERSION > 1: + self.emit('LOAD_CONST', tuple(fromlist)) + self.emit('IMPORT_NAME', node.modname) + for name, alias in node.names: + if VERSION > 1: + if name == '*': + self.namespace = 0 + self.emit('IMPORT_STAR') + # There can only be one name w/ from ... import * + assert len(node.names) == 1 + return + else: + self.emit('IMPORT_FROM', name) + self._resolveDots(name) + self.storeName(alias or name) + else: + self.emit('IMPORT_FROM', name) + self.emit('POP_TOP') + + def _resolveDots(self, name): + elts = name.split(".") + if len(elts) == 1: + return + for elt in elts[1:]: + self.emit('LOAD_ATTR', elt) + + def visitGetattr(self, node): + self.visit(node.expr) + self.emit('LOAD_ATTR', self.mangle(node.attrname)) + + # next five implement assignments + + def visitAssign(self, node): + self.set_lineno(node) + self.visit(node.expr) + dups = len(node.nodes) - 1 + for i in range(len(node.nodes)): + elt = node.nodes[i] + if i < dups: + self.emit('DUP_TOP') + if isinstance(elt, ast.Node): + self.visit(elt) + + def visitAssName(self, node): + if node.flags == 'OP_ASSIGN': + self.storeName(node.name) + elif node.flags == 'OP_DELETE': + self.set_lineno(node) + self.delName(node.name) + else: + print "oops", node.flags + + def visitAssAttr(self, node): + self.visit(node.expr) + if node.flags == 'OP_ASSIGN': + self.emit('STORE_ATTR', self.mangle(node.attrname)) + elif node.flags == 'OP_DELETE': + self.emit('DELETE_ATTR', self.mangle(node.attrname)) + else: + print "warning: unexpected flags:", node.flags + print node + + def _visitAssSequence(self, node, op='UNPACK_SEQUENCE'): + if findOp(node) != 'OP_DELETE': + self.emit(op, len(node.nodes)) + for child in node.nodes: + self.visit(child) + + if VERSION > 1: + visitAssTuple = _visitAssSequence + visitAssList = _visitAssSequence + else: + def visitAssTuple(self, node): + self._visitAssSequence(node, 'UNPACK_TUPLE') + + def visitAssList(self, node): + self._visitAssSequence(node, 'UNPACK_LIST') + + # augmented assignment + + def visitAugAssign(self, node): + self.set_lineno(node) + aug_node = wrap_aug(node.node) + self.visit(aug_node, "load") + self.visit(node.expr) + self.emit(self._augmented_opcode[node.op]) + self.visit(aug_node, "store") + + _augmented_opcode = { + '+=' : 'INPLACE_ADD', + '-=' : 'INPLACE_SUBTRACT', + '*=' : 'INPLACE_MULTIPLY', + '/=' : 'INPLACE_DIVIDE', + '//=': 'INPLACE_FLOOR_DIVIDE', + '%=' : 'INPLACE_MODULO', + '**=': 'INPLACE_POWER', + '>>=': 'INPLACE_RSHIFT', + '<<=': 'INPLACE_LSHIFT', + '&=' : 'INPLACE_AND', + '^=' : 'INPLACE_XOR', + '|=' : 'INPLACE_OR', + } + + def visitAugName(self, node, mode): + if mode == "load": + self.loadName(node.name) + elif mode == "store": + self.storeName(node.name) + + def visitAugGetattr(self, node, mode): + if mode == "load": + self.visit(node.expr) + self.emit('DUP_TOP') + self.emit('LOAD_ATTR', self.mangle(node.attrname)) + elif mode == "store": + self.emit('ROT_TWO') + self.emit('STORE_ATTR', self.mangle(node.attrname)) + + def visitAugSlice(self, node, mode): + if mode == "load": + self.visitSlice(node, 1) + elif mode == "store": + slice = 0 + if node.lower: + slice = slice | 1 + if node.upper: + slice = slice | 2 + if slice == 0: + self.emit('ROT_TWO') + elif slice == 3: + self.emit('ROT_FOUR') + else: + self.emit('ROT_THREE') + self.emit('STORE_SLICE+%d' % slice) + + def visitAugSubscript(self, node, mode): + if len(node.subs) > 1: + raise SyntaxError, "augmented assignment to tuple is not possible" + if mode == "load": + self.visitSubscript(node, 1) + elif mode == "store": + self.emit('ROT_THREE') + self.emit('STORE_SUBSCR') + + def visitExec(self, node): + self.visit(node.expr) + if node.locals is None: + self.emit('LOAD_CONST', None) + else: + self.visit(node.locals) + if node.globals is None: + self.emit('DUP_TOP') + else: + self.visit(node.globals) + self.emit('EXEC_STMT') + + def visitCallFunc(self, node): + pos = 0 + kw = 0 + self.set_lineno(node) + self.visit(node.node) + for arg in node.args: + self.visit(arg) + if isinstance(arg, ast.Keyword): + kw = kw + 1 + else: + pos = pos + 1 + if node.star_args is not None: + self.visit(node.star_args) + if node.dstar_args is not None: + self.visit(node.dstar_args) + have_star = node.star_args is not None + have_dstar = node.dstar_args is not None + opcode = callfunc_opcode_info[have_star, have_dstar] + self.emit(opcode, kw << 8 | pos) + + def visitPrint(self, node, newline=0): + self.set_lineno(node) + if node.dest: + self.visit(node.dest) + for child in node.nodes: + if node.dest: + self.emit('DUP_TOP') + self.visit(child) + if node.dest: + self.emit('ROT_TWO') + self.emit('PRINT_ITEM_TO') + else: + self.emit('PRINT_ITEM') + if node.dest and not newline: + self.emit('POP_TOP') + + def visitPrintnl(self, node): + self.visitPrint(node, newline=1) + if node.dest: + self.emit('PRINT_NEWLINE_TO') + else: + self.emit('PRINT_NEWLINE') + + def visitReturn(self, node): + self.set_lineno(node) + self.visit(node.value) + self.emit('RETURN_VALUE') + + def visitYield(self, node): + self.set_lineno(node) + self.visit(node.value) + self.emit('YIELD_VALUE') + + # slice and subscript stuff + + def visitSlice(self, node, aug_flag=None): + # aug_flag is used by visitAugSlice + self.visit(node.expr) + slice = 0 + if node.lower: + self.visit(node.lower) + slice = slice | 1 + if node.upper: + self.visit(node.upper) + slice = slice | 2 + if aug_flag: + if slice == 0: + self.emit('DUP_TOP') + elif slice == 3: + self.emit('DUP_TOPX', 3) + else: + self.emit('DUP_TOPX', 2) + if node.flags == 'OP_APPLY': + self.emit('SLICE+%d' % slice) + elif node.flags == 'OP_ASSIGN': + self.emit('STORE_SLICE+%d' % slice) + elif node.flags == 'OP_DELETE': + self.emit('DELETE_SLICE+%d' % slice) + else: + print "weird slice", node.flags + raise + + def visitSubscript(self, node, aug_flag=None): + self.visit(node.expr) + for sub in node.subs: + self.visit(sub) + if aug_flag: + self.emit('DUP_TOPX', 2) + if len(node.subs) > 1: + self.emit('BUILD_TUPLE', len(node.subs)) + if node.flags == 'OP_APPLY': + self.emit('BINARY_SUBSCR') + elif node.flags == 'OP_ASSIGN': + self.emit('STORE_SUBSCR') + elif node.flags == 'OP_DELETE': + self.emit('DELETE_SUBSCR') + + # binary ops + + def binaryOp(self, node, op): + self.visit(node.left) + self.visit(node.right) + self.emit(op) + + def visitAdd(self, node): + return self.binaryOp(node, 'BINARY_ADD') + + def visitSub(self, node): + return self.binaryOp(node, 'BINARY_SUBTRACT') + + def visitMul(self, node): + return self.binaryOp(node, 'BINARY_MULTIPLY') + + def visitDiv(self, node): + return self.binaryOp(node, self._div_op) + + def visitFloorDiv(self, node): + return self.binaryOp(node, 'BINARY_FLOOR_DIVIDE') + + def visitMod(self, node): + return self.binaryOp(node, 'BINARY_MODULO') + + def visitPower(self, node): + return self.binaryOp(node, 'BINARY_POWER') + + def visitLeftShift(self, node): + return self.binaryOp(node, 'BINARY_LSHIFT') + + def visitRightShift(self, node): + return self.binaryOp(node, 'BINARY_RSHIFT') + + # unary ops + + def unaryOp(self, node, op): + self.visit(node.expr) + self.emit(op) + + def visitInvert(self, node): + return self.unaryOp(node, 'UNARY_INVERT') + + def visitUnarySub(self, node): + return self.unaryOp(node, 'UNARY_NEGATIVE') + + def visitUnaryAdd(self, node): + return self.unaryOp(node, 'UNARY_POSITIVE') + + def visitUnaryInvert(self, node): + return self.unaryOp(node, 'UNARY_INVERT') + + def visitNot(self, node): + return self.unaryOp(node, 'UNARY_NOT') + + def visitBackquote(self, node): + return self.unaryOp(node, 'UNARY_CONVERT') + + # bit ops + + def bitOp(self, nodes, op): + self.visit(nodes[0]) + for node in nodes[1:]: + self.visit(node) + self.emit(op) + + def visitBitand(self, node): + return self.bitOp(node.nodes, 'BINARY_AND') + + def visitBitor(self, node): + return self.bitOp(node.nodes, 'BINARY_OR') + + def visitBitxor(self, node): + return self.bitOp(node.nodes, 'BINARY_XOR') + + # object constructors + + def visitEllipsis(self, node): + self.emit('LOAD_CONST', Ellipsis) + + def visitTuple(self, node): + self.set_lineno(node) + for elt in node.nodes: + self.visit(elt) + self.emit('BUILD_TUPLE', len(node.nodes)) + + def visitList(self, node): + self.set_lineno(node) + for elt in node.nodes: + self.visit(elt) + self.emit('BUILD_LIST', len(node.nodes)) + + def visitSliceobj(self, node): + for child in node.nodes: + self.visit(child) + self.emit('BUILD_SLICE', len(node.nodes)) + + def visitDict(self, node): + self.set_lineno(node) + self.emit('BUILD_MAP', 0) + for k, v in node.items: + self.emit('DUP_TOP') + self.visit(k) + self.visit(v) + self.emit('ROT_THREE') + self.emit('STORE_SUBSCR') + +class NestedScopeMixin: + """Defines initClass() for nested scoping (Python 2.2-compatible)""" + def initClass(self): + self.__class__.NameFinder = LocalNameFinder + self.__class__.FunctionGen = FunctionCodeGenerator + self.__class__.ClassGen = ClassCodeGenerator + +class ModuleCodeGenerator(NestedScopeMixin, CodeGenerator): + __super_init = CodeGenerator.__init__ + + scopes = None + + def __init__(self, tree): + self.graph = pyassem.PyFlowGraph("", tree.filename) + self.futures = future.find_futures(tree) + self.__super_init() + walk(tree, self) + + def get_module(self): + return self + +class ExpressionCodeGenerator(NestedScopeMixin, CodeGenerator): + __super_init = CodeGenerator.__init__ + + scopes = None + futures = () + + def __init__(self, tree): + self.graph = pyassem.PyFlowGraph("", tree.filename) + self.__super_init() + walk(tree, self) + + def get_module(self): + return self + +class InteractiveCodeGenerator(NestedScopeMixin, CodeGenerator): + + __super_init = CodeGenerator.__init__ + + scopes = None + futures = () + + def __init__(self, tree): + self.graph = pyassem.PyFlowGraph("", tree.filename) + self.__super_init() + self.set_lineno(tree) + walk(tree, self) + self.emit('RETURN_VALUE') + + def get_module(self): + return self + + def visitDiscard(self, node): + # XXX Discard means it's an expression. Perhaps this is a bad + # name. + self.visit(node.expr) + self.emit('PRINT_EXPR') + +class AbstractFunctionCode: + optimized = 1 + lambdaCount = 0 + + def __init__(self, func, scopes, isLambda, class_name, mod): + self.class_name = class_name + self.module = mod + if isLambda: + klass = FunctionCodeGenerator + name = "" % klass.lambdaCount + klass.lambdaCount = klass.lambdaCount + 1 + else: + name = func.name + + args, hasTupleArg = generateArgList(func.argnames) + self.graph = pyassem.PyFlowGraph(name, func.filename, args, + optimized=1) + self.isLambda = isLambda + self.super_init() + + if not isLambda and func.doc: + self.setDocstring(func.doc) + + lnf = walk(func.code, self.NameFinder(args), verbose=0) + self.locals.push(lnf.getLocals()) + if func.varargs: + self.graph.setFlag(CO_VARARGS) + if func.kwargs: + self.graph.setFlag(CO_VARKEYWORDS) + self.set_lineno(func) + if hasTupleArg: + self.generateArgUnpack(func.argnames) + + def get_module(self): + return self.module + + def finish(self): + self.graph.startExitBlock() + if not self.isLambda: + self.emit('LOAD_CONST', None) + self.emit('RETURN_VALUE') + + def generateArgUnpack(self, args): + for i in range(len(args)): + arg = args[i] + if type(arg) == types.TupleType: + self.emit('LOAD_FAST', '.%d' % (i * 2)) + self.unpackSequence(arg) + + def unpackSequence(self, tup): + if VERSION > 1: + self.emit('UNPACK_SEQUENCE', len(tup)) + else: + self.emit('UNPACK_TUPLE', len(tup)) + for elt in tup: + if type(elt) == types.TupleType: + self.unpackSequence(elt) + else: + self._nameOp('STORE', elt) + + unpackTuple = unpackSequence + +class FunctionCodeGenerator(NestedScopeMixin, AbstractFunctionCode, + CodeGenerator): + super_init = CodeGenerator.__init__ # call be other init + scopes = None + + __super_init = AbstractFunctionCode.__init__ + + def __init__(self, func, scopes, isLambda, class_name, mod): + self.scopes = scopes + self.scope = scopes[func] + self.__super_init(func, scopes, isLambda, class_name, mod) + self.graph.setFreeVars(self.scope.get_free_vars()) + self.graph.setCellVars(self.scope.get_cell_vars()) + if self.scope.generator is not None: + self.graph.setFlag(CO_GENERATOR) + +class GenExprCodeGenerator(NestedScopeMixin, AbstractFunctionCode, + CodeGenerator): + super_init = CodeGenerator.__init__ # call be other init + scopes = None + + __super_init = AbstractFunctionCode.__init__ + + def __init__(self, gexp, scopes, class_name, mod): + self.scopes = scopes + self.scope = scopes[gexp] + self.__super_init(gexp, scopes, 1, class_name, mod) + self.graph.setFreeVars(self.scope.get_free_vars()) + self.graph.setCellVars(self.scope.get_cell_vars()) + self.graph.setFlag(CO_GENERATOR) + +class AbstractClassCode: + + def __init__(self, klass, scopes, module): + self.class_name = klass.name + self.module = module + self.graph = pyassem.PyFlowGraph(klass.name, klass.filename, + optimized=0, klass=1) + self.super_init() + lnf = walk(klass.code, self.NameFinder(), verbose=0) + self.locals.push(lnf.getLocals()) + self.graph.setFlag(CO_NEWLOCALS) + if klass.doc: + self.setDocstring(klass.doc) + + def get_module(self): + return self.module + + def finish(self): + self.graph.startExitBlock() + self.emit('LOAD_LOCALS') + self.emit('RETURN_VALUE') + +class ClassCodeGenerator(NestedScopeMixin, AbstractClassCode, CodeGenerator): + super_init = CodeGenerator.__init__ + scopes = None + + __super_init = AbstractClassCode.__init__ + + def __init__(self, klass, scopes, module): + self.scopes = scopes + self.scope = scopes[klass] + self.__super_init(klass, scopes, module) + self.graph.setFreeVars(self.scope.get_free_vars()) + self.graph.setCellVars(self.scope.get_cell_vars()) + self.set_lineno(klass) + self.emit("LOAD_GLOBAL", "__name__") + self.storeName("__module__") + if klass.doc: + self.emit("LOAD_CONST", klass.doc) + self.storeName('__doc__') + +def generateArgList(arglist): + """Generate an arg list marking TupleArgs""" + args = [] + extra = [] + count = 0 + for i in range(len(arglist)): + elt = arglist[i] + if type(elt) == types.StringType: + args.append(elt) + elif type(elt) == types.TupleType: + args.append(TupleArg(i * 2, elt)) + extra.extend(misc.flatten(elt)) + count = count + 1 + else: + raise ValueError, "unexpect argument type:", elt + return args + extra, count + +def findOp(node): + """Find the op (DELETE, LOAD, STORE) in an AssTuple tree""" + v = OpFinder() + walk(node, v, verbose=0) + return v.op + +class OpFinder: + def __init__(self): + self.op = None + def visitAssName(self, node): + if self.op is None: + self.op = node.flags + elif self.op != node.flags: + raise ValueError, "mixed ops in stmt" + visitAssAttr = visitAssName + visitSubscript = visitAssName + +class Delegator: + """Base class to support delegation for augmented assignment nodes + + To generator code for augmented assignments, we use the following + wrapper classes. In visitAugAssign, the left-hand expression node + is visited twice. The first time the visit uses the normal method + for that node . The second time the visit uses a different method + that generates the appropriate code to perform the assignment. + These delegator classes wrap the original AST nodes in order to + support the variant visit methods. + """ + def __init__(self, obj): + self.obj = obj + + def __getattr__(self, attr): + return getattr(self.obj, attr) + +class AugGetattr(Delegator): + pass + +class AugName(Delegator): + pass + +class AugSlice(Delegator): + pass + +class AugSubscript(Delegator): + pass + +wrapper = { + ast.Getattr: AugGetattr, + ast.Name: AugName, + ast.Slice: AugSlice, + ast.Subscript: AugSubscript, + } + +def wrap_aug(node): + return wrapper[node.__class__](node) + +if __name__ == "__main__": + for file in sys.argv[1:]: + compileFile(file) Added: pypy/branch/pycompiler/module/recparser/compiler/symbols.py ============================================================================== --- (empty file) +++ pypy/branch/pycompiler/module/recparser/compiler/symbols.py Tue May 24 14:21:39 2005 @@ -0,0 +1,467 @@ +"""Module symbol-table generator""" + +import ast +from consts import SC_LOCAL, SC_GLOBAL, SC_FREE, SC_CELL, SC_UNKNOWN +from misc import mangle +from visitor import ASTVisitor + +import sys + +MANGLE_LEN = 256 + +class Scope: + # XXX how much information do I need about each name? + def __init__(self, name, module, klass=None): + self.name = name + self.module = module + self.defs = {} + self.uses = {} + self.globals = {} + self.params = {} + self.frees = {} + self.cells = {} + self.children = [] + # nested is true if the class could contain free variables, + # i.e. if it is nested within another function. + self.nested = None + self.generator = None + self.klass = None + if klass is not None: + for i in range(len(klass)): + if klass[i] != '_': + self.klass = klass[i:] + break + + def __repr__(self): + return "<%s: %s>" % (self.__class__.__name__, self.name) + + def mangle(self, name): + if self.klass is None: + return name + return mangle(name, self.klass) + + def add_def(self, name): + self.defs[self.mangle(name)] = 1 + + def add_use(self, name): + self.uses[self.mangle(name)] = 1 + + def add_global(self, name): + name = self.mangle(name) + if self.uses.has_key(name) or self.defs.has_key(name): + pass # XXX warn about global following def/use + if self.params.has_key(name): + raise SyntaxError, "%s in %s is global and parameter" % \ + (name, self.name) + self.globals[name] = 1 + self.module.add_def(name) + + def add_param(self, name): + name = self.mangle(name) + self.defs[name] = 1 + self.params[name] = 1 + + def get_names(self): + d = {} + d.update(self.defs) + d.update(self.uses) + d.update(self.globals) + return d.keys() + + def add_child(self, child): + self.children.append(child) + + def get_children(self): + return self.children + + def DEBUG(self): + print >> sys.stderr, self.name, self.nested and "nested" or "" + print >> sys.stderr, "\tglobals: ", self.globals + print >> sys.stderr, "\tcells: ", self.cells + print >> sys.stderr, "\tdefs: ", self.defs + print >> sys.stderr, "\tuses: ", self.uses + print >> sys.stderr, "\tfrees:", self.frees + + def check_name(self, name): + """Return scope of name. + + The scope of a name could be LOCAL, GLOBAL, FREE, or CELL. + """ + if self.globals.has_key(name): + return SC_GLOBAL + if self.cells.has_key(name): + return SC_CELL + if self.defs.has_key(name): + return SC_LOCAL + if self.nested and (self.frees.has_key(name) or + self.uses.has_key(name)): + return SC_FREE + if self.nested: + return SC_UNKNOWN + else: + return SC_GLOBAL + + def get_free_vars(self): + if not self.nested: + return () + free = {} + free.update(self.frees) + for name in self.uses.keys(): + if not (self.defs.has_key(name) or + self.globals.has_key(name)): + free[name] = 1 + return free.keys() + + def handle_children(self): + for child in self.children: + frees = child.get_free_vars() + globals = self.add_frees(frees) + for name in globals: + child.force_global(name) + + def force_global(self, name): + """Force name to be global in scope. + + Some child of the current node had a free reference to name. + When the child was processed, it was labelled a free + variable. Now that all its enclosing scope have been + processed, the name is known to be a global or builtin. So + walk back down the child chain and set the name to be global + rather than free. + + Be careful to stop if a child does not think the name is + free. + """ + self.globals[name] = 1 + if self.frees.has_key(name): + del self.frees[name] + for child in self.children: + if child.check_name(name) == SC_FREE: + child.force_global(name) + + def add_frees(self, names): + """Process list of free vars from nested scope. + + Returns a list of names that are either 1) declared global in the + parent or 2) undefined in a top-level parent. In either case, + the nested scope should treat them as globals. + """ + child_globals = [] + for name in names: + sc = self.check_name(name) + if self.nested: + if sc == SC_UNKNOWN or sc == SC_FREE \ + or isinstance(self, ClassScope): + self.frees[name] = 1 + elif sc == SC_GLOBAL: + child_globals.append(name) + elif isinstance(self, FunctionScope) and sc == SC_LOCAL: + self.cells[name] = 1 + elif sc != SC_CELL: + child_globals.append(name) + else: + if sc == SC_LOCAL: + self.cells[name] = 1 + elif sc != SC_CELL: + child_globals.append(name) + return child_globals + + def get_cell_vars(self): + return self.cells.keys() + +class ModuleScope(Scope): + __super_init = Scope.__init__ + + def __init__(self): + self.__super_init("global", self) + +class FunctionScope(Scope): + pass + +class GenExprScope(Scope): + __super_init = Scope.__init__ + + __counter = 1 + + def __init__(self, module, klass=None): + i = self.__counter + self.__counter += 1 + self.__super_init("generator expression<%d>"%i, module, klass) + self.add_param('[outmost-iterable]') + + def get_names(self): + keys = Scope.get_names() + return keys + +class LambdaScope(FunctionScope): + __super_init = Scope.__init__ + + __counter = 1 + + def __init__(self, module, klass=None): + i = self.__counter + self.__counter += 1 + self.__super_init("lambda.%d" % i, module, klass) + +class ClassScope(Scope): + __super_init = Scope.__init__ + + def __init__(self, name, module): + self.__super_init(name, module, name) + +class SymbolVisitor(ASTVisitor): + def __init__(self): + self.scopes = {} + self.klass = None + + # node that define new scopes + + def visitModule(self, node): + scope = self.module = self.scopes[node] = ModuleScope() + self.visit(node.node, scope) + + visitExpression = visitModule + + def visitFunction(self, node, parent): + if node.decorators: + self.visit(node.decorators, parent) + parent.add_def(node.name) + for n in node.defaults: + self.visit(n, parent) + scope = FunctionScope(node.name, self.module, self.klass) + if parent.nested or isinstance(parent, FunctionScope): + scope.nested = 1 + self.scopes[node] = scope + self._do_args(scope, node.argnames) + self.visit(node.code, scope) + self.handle_free_vars(scope, parent) + + def visitGenExpr(self, node, parent): + scope = GenExprScope(self.module, self.klass); + if parent.nested or isinstance(parent, FunctionScope) \ + or isinstance(parent, GenExprScope): + scope.nested = 1 + + self.scopes[node] = scope + self.visit(node.code, scope) + + self.handle_free_vars(scope, parent) + + def visitGenExprInner(self, node, scope): + for genfor in node.quals: + self.visit(genfor, scope) + + self.visit(node.expr, scope) + + def visitGenExprFor(self, node, scope): + self.visit(node.assign, scope, 1) + self.visit(node.iter, scope) + for if_ in node.ifs: + self.visit(if_, scope) + + def visitGenExprIf(self, node, scope): + self.visit(node.test, scope) + + def visitLambda(self, node, parent, assign=0): + # Lambda is an expression, so it could appear in an expression + # context where assign is passed. The transformer should catch + # any code that has a lambda on the left-hand side. + assert not assign + + for n in node.defaults: + self.visit(n, parent) + scope = LambdaScope(self.module, self.klass) + if parent.nested or isinstance(parent, FunctionScope): + scope.nested = 1 + self.scopes[node] = scope + self._do_args(scope, node.argnames) + self.visit(node.code, scope) + self.handle_free_vars(scope, parent) + + def _do_args(self, scope, args): + for name in args: + if type(name) == tuple: + self._do_args(scope, name) + else: + scope.add_param(name) + + def handle_free_vars(self, scope, parent): + parent.add_child(scope) + scope.handle_children() + + def visitClass(self, node, parent): + parent.add_def(node.name) + for n in node.bases: + self.visit(n, parent) + scope = ClassScope(node.name, self.module) + if parent.nested or isinstance(parent, FunctionScope): + scope.nested = 1 + if node.doc is not None: + scope.add_def('__doc__') + scope.add_def('__module__') + self.scopes[node] = scope + prev = self.klass + self.klass = node.name + self.visit(node.code, scope) + self.klass = prev + self.handle_free_vars(scope, parent) + + # name can be a def or a use + + # XXX a few calls and nodes expect a third "assign" arg that is + # true if the name is being used as an assignment. only + # expressions contained within statements may have the assign arg. + + def visitName(self, node, scope, assign=0): + if assign: + scope.add_def(node.name) + else: + scope.add_use(node.name) + + # operations that bind new names + + def visitFor(self, node, scope): + self.visit(node.assign, scope, 1) + self.visit(node.list, scope) + self.visit(node.body, scope) + if node.else_: + self.visit(node.else_, scope) + + def visitFrom(self, node, scope): + for name, asname in node.names: + if name == "*": + continue + scope.add_def(asname or name) + + def visitImport(self, node, scope): + for name, asname in node.names: + i = name.find(".") + if i > -1: + name = name[:i] + scope.add_def(asname or name) + + def visitGlobal(self, node, scope): + for name in node.names: + scope.add_global(name) + + def visitAssign(self, node, scope): + """Propagate assignment flag down to child nodes. + + The Assign node doesn't itself contains the variables being + assigned to. Instead, the children in node.nodes are visited + with the assign flag set to true. When the names occur in + those nodes, they are marked as defs. + + Some names that occur in an assignment target are not bound by + the assignment, e.g. a name occurring inside a slice. The + visitor handles these nodes specially; they do not propagate + the assign flag to their children. + """ + for n in node.nodes: + self.visit(n, scope, 1) + self.visit(node.expr, scope) + + def visitAssName(self, node, scope, assign=1): + scope.add_def(node.name) + + def visitAssAttr(self, node, scope, assign=0): + self.visit(node.expr, scope, 0) + + def visitSubscript(self, node, scope, assign=0): + self.visit(node.expr, scope, 0) + for n in node.subs: + self.visit(n, scope, 0) + + def visitSlice(self, node, scope, assign=0): + self.visit(node.expr, scope, 0) + if node.lower: + self.visit(node.lower, scope, 0) + if node.upper: + self.visit(node.upper, scope, 0) + + def visitAugAssign(self, node, scope): + # If the LHS is a name, then this counts as assignment. + # Otherwise, it's just use. + self.visit(node.node, scope) + if isinstance(node.node, ast.Name): + self.visit(node.node, scope, 1) # XXX worry about this + self.visit(node.expr, scope) + + # prune if statements if tests are false + + _const_types = str, int, float + + def visitIf(self, node, scope): + for test, body in node.tests: + if isinstance(test, ast.Const): + if type(test.value) in self._const_types: + if not test.value: + continue + self.visit(test, scope) + self.visit(body, scope) + if node.else_: + self.visit(node.else_, scope) + + # a yield statement signals a generator + + def visitYield(self, node, scope): + scope.generator = 1 + self.visit(node.value, scope) + +def sort(l): + l = l[:] + l.sort() + return l + +def list_eq(l1, l2): + return sort(l1) == sort(l2) + +if __name__ == "__main__": + import sys + from compiler import parseFile, walk + import symtable + + def get_names(syms): + return [s for s in [s.get_name() for s in syms.get_symbols()] + if not (s.startswith('_[') or s.startswith('.'))] + + for file in sys.argv[1:]: + print file + f = open(file) + buf = f.read() + f.close() + syms = symtable.symtable(buf, file, "exec") + mod_names = get_names(syms) + tree = parseFile(file) + s = SymbolVisitor() + walk(tree, s) + + # compare module-level symbols + names2 = s.scopes[tree].get_names() + + if not list_eq(mod_names, names2): + print + print "oops", file + print sort(mod_names) + print sort(names2) + sys.exit(-1) + + d = {} + d.update(s.scopes) + del d[tree] + scopes = d.values() + del d + + for s in syms.get_symbols(): + if s.is_namespace(): + l = [sc for sc in scopes + if sc.name == s.get_name()] + if len(l) > 1: + print "skipping", s.get_name() + else: + if not list_eq(get_names(s.get_namespace()), + l[0].get_names()): + print s.get_name() + print sort(get_names(s.get_namespace())) + print sort(l[0].get_names()) + sys.exit(-1) Added: pypy/branch/pycompiler/module/recparser/compiler/syntax.py ============================================================================== --- (empty file) +++ pypy/branch/pycompiler/module/recparser/compiler/syntax.py Tue May 24 14:21:39 2005 @@ -0,0 +1,46 @@ +"""Check for errs in the AST. + +The Python parser does not catch all syntax errors. Others, like +assignments with invalid targets, are caught in the code generation +phase. + +The compiler package catches some errors in the transformer module. +But it seems clearer to write checkers that use the AST to detect +errors. +""" + +from compiler import ast, walk + +def check(tree, multi=None): + v = SyntaxErrorChecker(multi) + walk(tree, v) + return v.errors + +class SyntaxErrorChecker: + """A visitor to find syntax errors in the AST.""" + + def __init__(self, multi=None): + """Create new visitor object. + + If optional argument multi is not None, then print messages + for each error rather than raising a SyntaxError for the + first. + """ + self.multi = multi + self.errors = 0 + + def error(self, node, msg): + self.errors = self.errors + 1 + if self.multi is not None: + print "%s:%s: %s" % (node.filename, node.lineno, msg) + else: + raise SyntaxError, "%s (%s:%s)" % (msg, node.filename, node.lineno) + + def visitAssign(self, node): + # the transformer module handles many of these + for target in node.nodes: + pass +## if isinstance(target, ast.AssList): +## if target.lineno is None: +## target.lineno = node.lineno +## self.error(target, "can't assign to list comprehension") Added: pypy/branch/pycompiler/module/recparser/compiler/transformer.py ============================================================================== --- (empty file) +++ pypy/branch/pycompiler/module/recparser/compiler/transformer.py Tue May 24 14:21:39 2005 @@ -0,0 +1,1437 @@ +"""Parse tree transformation module. + +Transforms Python source code into an abstract syntax tree (AST) +defined in the ast module. + +The simplest ways to invoke this module are via parse and parseFile. +parse(buf) -> AST +parseFile(path) -> AST +""" + +# Original version written by Greg Stein (gstein at lyra.org) +# and Bill Tutt (rassilon at lima.mudlib.org) +# February 1997. +# +# Modifications and improvements for Python 2.0 by Jeremy Hylton and +# Mark Hammond +# +# Some fixes to try to have correct line number on almost all nodes +# (except Module, Discard and Stmt) added by Sylvain Thenault +# +# Portions of this file are: +# Copyright (C) 1997-1998 Greg Stein. All Rights Reserved. +# +# This module is provided under a BSD-ish license. See +# http://www.opensource.org/licenses/bsd-license.html +# and replace OWNER, ORGANIZATION, and YEAR as appropriate. + +from ast import * +import parser +import symbol +import token +import sys + +PYTHON_23 = sys.version_info[0]==2 and sys.version_info[1]==3 +PYTHON_24 = sys.version_info[0]==2 and sys.version_info[1]==4 + +class WalkerError(StandardError): + pass + +from consts import CO_VARARGS, CO_VARKEYWORDS +from consts import OP_ASSIGN, OP_DELETE, OP_APPLY + +def parseFile(path): + f = open(path, "U") + # XXX The parser API tolerates files without a trailing newline, + # but not strings without a trailing newline. Always add an extra + # newline to the file contents, since we're going through the string + # version of the API. + src = f.read() + "\n" + f.close() + return parse(src) + +def parse(buf, mode="exec"): + if mode == "exec" or mode == "single": + return Transformer().parsesuite(buf) + elif mode == "eval": + return Transformer().parseexpr(buf) + else: + raise ValueError("compile() arg 3 must be" + " 'exec' or 'eval' or 'single'") + +def asList(nodes): + l = [] + for item in nodes: + if hasattr(item, "asList"): + l.append(item.asList()) + else: + if type(item) is type( (None, None) ): + l.append(tuple(asList(item))) + elif type(item) is type( [] ): + l.append(asList(item)) + else: + l.append(item) + return l + +def extractLineNo(ast): + if not isinstance(ast[1], tuple): + # get a terminal node + return ast[2] + for child in ast[1:]: + if isinstance(child, tuple): + lineno = extractLineNo(child) + if lineno is not None: + return lineno + +def Node(*args): + kind = args[0] + if nodes.has_key(kind): + try: + return nodes[kind](*args[1:]) + except TypeError: + print nodes[kind], len(args), args + raise + else: + raise WalkerError, "Can't find appropriate Node type: %s" % str(args) + #return apply(ast.Node, args) + +class Transformer: + """Utility object for transforming Python parse trees. + + Exposes the following methods: + tree = transform(ast_tree) + tree = parsesuite(text) + tree = parseexpr(text) + tree = parsefile(fileob | filename) + """ + + def __init__(self): + self._dispatch = {} + for value, name in symbol.sym_name.items(): + if hasattr(self, name): + self._dispatch[value] = getattr(self, name) + self._dispatch[token.NEWLINE] = self.com_NEWLINE + self._atom_dispatch = {token.LPAR: self.atom_lpar, + token.LSQB: self.atom_lsqb, + token.LBRACE: self.atom_lbrace, + token.BACKQUOTE: self.atom_backquote, + token.NUMBER: self.atom_number, + token.STRING: self.atom_string, + token.NAME: self.atom_name, + } + self.encoding = None + + def transform(self, tree): + """Transform an AST into a modified parse tree.""" + if not (isinstance(tree, tuple) or isinstance(tree, list)): + tree = parser.ast2tuple(tree, line_info=1) + return self.compile_node(tree) + + def parsesuite(self, text): + """Return a modified parse tree for the given suite text.""" + return self.transform(parser.suite(text)) + + def parseexpr(self, text): + """Return a modified parse tree for the given expression text.""" + return self.transform(parser.expr(text)) + + def parsefile(self, file): + """Return a modified parse tree for the contents of the given file.""" + if type(file) == type(''): + file = open(file) + return self.parsesuite(file.read()) + + # -------------------------------------------------------------- + # + # PRIVATE METHODS + # + + def compile_node(self, node): + ### emit a line-number node? + n = node[0] + + if n == symbol.encoding_decl: + self.encoding = node[2] + node = node[1] + n = node[0] + + if n == symbol.single_input: + return self.single_input(node[1:]) + if n == symbol.file_input: + return self.file_input(node[1:]) + if n == symbol.eval_input: + return self.eval_input(node[1:]) + if n == symbol.lambdef: + return self.lambdef(node[1:]) + if n == symbol.funcdef: + return self.funcdef(node[1:]) + if n == symbol.classdef: + return self.classdef(node[1:]) + + raise WalkerError, ('unexpected node type', n) + + def single_input(self, node): + ### do we want to do anything about being "interactive" ? + + # NEWLINE | simple_stmt | compound_stmt NEWLINE + n = node[0][0] + if n != token.NEWLINE: + return self.com_stmt(node[0]) + + return Pass() + + def file_input(self, nodelist): + doc = self.get_docstring(nodelist, symbol.file_input) + if doc is not None: + i = 1 + else: + i = 0 + stmts = [] + for node in nodelist[i:]: + if node[0] != token.ENDMARKER and node[0] != token.NEWLINE: + self.com_append_stmt(stmts, node) + return Module(doc, Stmt(stmts)) + + def eval_input(self, nodelist): + # from the built-in function input() + ### is this sufficient? + return Expression(self.com_node(nodelist[0])) + + def decorator_name(self, nodelist): + listlen = len(nodelist) + assert listlen >= 1 and listlen % 2 == 1 + + item = self.atom_name(nodelist) + i = 1 + while i < listlen: + assert nodelist[i][0] == token.DOT + assert nodelist[i + 1][0] == token.NAME + item = Getattr(item, nodelist[i + 1][1]) + i += 2 + + return item + + def decorator(self, nodelist): + # '@' dotted_name [ '(' [arglist] ')' ] + assert len(nodelist) in (3, 5, 6) + assert nodelist[0][0] == token.AT + assert nodelist[-1][0] == token.NEWLINE + + assert nodelist[1][0] == symbol.dotted_name + funcname = self.decorator_name(nodelist[1][1:]) + + if len(nodelist) > 3: + assert nodelist[2][0] == token.LPAR + expr = self.com_call_function(funcname, nodelist[3]) + else: + expr = funcname + + return expr + + def decorators(self, nodelist): + # decorators: decorator ([NEWLINE] decorator)* NEWLINE + items = [] + for dec_nodelist in nodelist: + assert dec_nodelist[0] == symbol.decorator + items.append(self.decorator(dec_nodelist[1:])) + return Decorators(items) + + def funcdef(self, nodelist): + # -6 -5 -4 -3 -2 -1 + # funcdef: [decorators] 'def' NAME parameters ':' suite + # parameters: '(' [varargslist] ')' + + if len(nodelist) == 6: + assert nodelist[0][0] == symbol.decorators + decorators = self.decorators(nodelist[0][1:]) + else: + assert len(nodelist) == 5 + decorators = None + + lineno = nodelist[-4][2] + name = nodelist[-4][1] + args = nodelist[-3][2] + + if args[0] == symbol.varargslist: + names, defaults, flags = self.com_arglist(args[1:]) + else: + names = defaults = () + flags = 0 + doc = self.get_docstring(nodelist[-1]) + + # code for function + code = self.com_node(nodelist[-1]) + + if doc is not None: + assert isinstance(code, Stmt) + assert isinstance(code.nodes[0], Discard) + del code.nodes[0] + return Function(decorators, name, names, defaults, flags, doc, code, + lineno=lineno) + + def lambdef(self, nodelist): + # lambdef: 'lambda' [varargslist] ':' test + if nodelist[2][0] == symbol.varargslist: + names, defaults, flags = self.com_arglist(nodelist[2][1:]) + else: + names = defaults = () + flags = 0 + + # code for lambda + code = self.com_node(nodelist[-1]) + + return Lambda(names, defaults, flags, code, lineno=nodelist[1][2]) + + def classdef(self, nodelist): + # classdef: 'class' NAME ['(' testlist ')'] ':' suite + + name = nodelist[1][1] + doc = self.get_docstring(nodelist[-1]) + if nodelist[2][0] == token.COLON: + bases = [] + else: + bases = self.com_bases(nodelist[3]) + + # code for class + code = self.com_node(nodelist[-1]) + + if doc is not None: + assert isinstance(code, Stmt) + assert isinstance(code.nodes[0], Discard) + del code.nodes[0] + + return Class(name, bases, doc, code, lineno=nodelist[1][2]) + + def stmt(self, nodelist): + return self.com_stmt(nodelist[0]) + + small_stmt = stmt + flow_stmt = stmt + compound_stmt = stmt + + def simple_stmt(self, nodelist): + # small_stmt (';' small_stmt)* [';'] NEWLINE + stmts = [] + for i in range(0, len(nodelist), 2): + self.com_append_stmt(stmts, nodelist[i]) + return Stmt(stmts) + + def parameters(self, nodelist): + raise WalkerError + + def varargslist(self, nodelist): + raise WalkerError + + def fpdef(self, nodelist): + raise WalkerError + + def fplist(self, nodelist): + raise WalkerError + + def dotted_name(self, nodelist): + raise WalkerError + + def comp_op(self, nodelist): + raise WalkerError + + def trailer(self, nodelist): + raise WalkerError + + def sliceop(self, nodelist): + raise WalkerError + + def argument(self, nodelist): + raise WalkerError + + # -------------------------------------------------------------- + # + # STATEMENT NODES (invoked by com_node()) + # + + def expr_stmt(self, nodelist): + # augassign testlist | testlist ('=' testlist)* + en = nodelist[-1] + exprNode = self.lookup_node(en)(en[1:]) + if len(nodelist) == 1: + return Discard(exprNode, lineno=exprNode.lineno) + if nodelist[1][0] == token.EQUAL: + nodesl = [] + for i in range(0, len(nodelist) - 2, 2): + nodesl.append(self.com_assign(nodelist[i], OP_ASSIGN)) + return Assign(nodesl, exprNode, lineno=nodelist[1][2]) + else: + lval = self.com_augassign(nodelist[0]) + op = self.com_augassign_op(nodelist[1]) + return AugAssign(lval, op[1], exprNode, lineno=op[2]) + raise WalkerError, "can't get here" + + def print_stmt(self, nodelist): + # print ([ test (',' test)* [','] ] | '>>' test [ (',' test)+ [','] ]) + items = [] + if len(nodelist) == 1: + start = 1 + dest = None + elif nodelist[1][0] == token.RIGHTSHIFT: + assert len(nodelist) == 3 \ + or nodelist[3][0] == token.COMMA + dest = self.com_node(nodelist[2]) + start = 4 + else: + dest = None + start = 1 + for i in range(start, len(nodelist), 2): + items.append(self.com_node(nodelist[i])) + if nodelist[-1][0] == token.COMMA: + return Print(items, dest, lineno=nodelist[0][2]) + return Printnl(items, dest, lineno=nodelist[0][2]) + + def del_stmt(self, nodelist): + return self.com_assign(nodelist[1], OP_DELETE) + + def pass_stmt(self, nodelist): + return Pass(lineno=nodelist[0][2]) + + def break_stmt(self, nodelist): + return Break(lineno=nodelist[0][2]) + + def continue_stmt(self, nodelist): + return Continue(lineno=nodelist[0][2]) + + def return_stmt(self, nodelist): + # return: [testlist] + if len(nodelist) < 2: + return Return(Const(None), lineno=nodelist[0][2]) + return Return(self.com_node(nodelist[1]), lineno=nodelist[0][2]) + + def yield_stmt(self, nodelist): + return Yield(self.com_node(nodelist[1]), lineno=nodelist[0][2]) + + def raise_stmt(self, nodelist): + # raise: [test [',' test [',' test]]] + if len(nodelist) > 5: + expr3 = self.com_node(nodelist[5]) + else: + expr3 = None + if len(nodelist) > 3: + expr2 = self.com_node(nodelist[3]) + else: + expr2 = None + if len(nodelist) > 1: + expr1 = self.com_node(nodelist[1]) + else: + expr1 = None + return Raise(expr1, expr2, expr3, lineno=nodelist[0][2]) + + def import_stmt(self, nodelist): + # import_stmt: import_name | import_from + assert len(nodelist) == 1 + return self.com_node(nodelist[0]) + + def import_name(self, nodelist): + # import_name: 'import' dotted_as_names + return Import(self.com_dotted_as_names(nodelist[1]), + lineno=nodelist[0][2]) + + def import_from(self, nodelist): + # import_from: 'from' dotted_name 'import' ('*' | + # '(' import_as_names ')' | import_as_names) + assert nodelist[0][1] == 'from' + assert nodelist[1][0] == symbol.dotted_name + assert nodelist[2][1] == 'import' + fromname = self.com_dotted_name(nodelist[1]) + if nodelist[3][0] == token.STAR: + return From(fromname, [('*', None)], + lineno=nodelist[0][2]) + else: + node = nodelist[3 + (nodelist[3][0] == token.LPAR)] + return From(fromname, self.com_import_as_names(node), + lineno=nodelist[0][2]) + + def global_stmt(self, nodelist): + # global: NAME (',' NAME)* + names = [] + for i in range(1, len(nodelist), 2): + names.append(nodelist[i][1]) + return Global(names, lineno=nodelist[0][2]) + + def exec_stmt(self, nodelist): + # exec_stmt: 'exec' expr ['in' expr [',' expr]] + expr1 = self.com_node(nodelist[1]) + if len(nodelist) >= 4: + expr2 = self.com_node(nodelist[3]) + if len(nodelist) >= 6: + expr3 = self.com_node(nodelist[5]) + else: + expr3 = None + else: + expr2 = expr3 = None + + return Exec(expr1, expr2, expr3, lineno=nodelist[0][2]) + + def assert_stmt(self, nodelist): + # 'assert': test, [',' test] + expr1 = self.com_node(nodelist[1]) + if (len(nodelist) == 4): + expr2 = self.com_node(nodelist[3]) + else: + expr2 = None + return Assert(expr1, expr2, lineno=nodelist[0][2]) + + def if_stmt(self, nodelist): + # if: test ':' suite ('elif' test ':' suite)* ['else' ':' suite] + tests = [] + for i in range(0, len(nodelist) - 3, 4): + testNode = self.com_node(nodelist[i + 1]) + suiteNode = self.com_node(nodelist[i + 3]) + tests.append((testNode, suiteNode)) + + if len(nodelist) % 4 == 3: + elseNode = self.com_node(nodelist[-1]) +## elseNode.lineno = nodelist[-1][1][2] + else: + elseNode = None + return If(tests, elseNode, lineno=nodelist[0][2]) + + def while_stmt(self, nodelist): + # 'while' test ':' suite ['else' ':' suite] + + testNode = self.com_node(nodelist[1]) + bodyNode = self.com_node(nodelist[3]) + + if len(nodelist) > 4: + elseNode = self.com_node(nodelist[6]) + else: + elseNode = None + + return While(testNode, bodyNode, elseNode, lineno=nodelist[0][2]) + + def for_stmt(self, nodelist): + # 'for' exprlist 'in' exprlist ':' suite ['else' ':' suite] + + assignNode = self.com_assign(nodelist[1], OP_ASSIGN) + listNode = self.com_node(nodelist[3]) + bodyNode = self.com_node(nodelist[5]) + + if len(nodelist) > 8: + elseNode = self.com_node(nodelist[8]) + else: + elseNode = None + + return For(assignNode, listNode, bodyNode, elseNode, + lineno=nodelist[0][2]) + + def try_stmt(self, nodelist): + # 'try' ':' suite (except_clause ':' suite)+ ['else' ':' suite] + # | 'try' ':' suite 'finally' ':' suite + if nodelist[3][0] != symbol.except_clause: + return self.com_try_finally(nodelist) + + return self.com_try_except(nodelist) + + def suite(self, nodelist): + # simple_stmt | NEWLINE INDENT NEWLINE* (stmt NEWLINE*)+ DEDENT + if len(nodelist) == 1: + return self.com_stmt(nodelist[0]) + + stmts = [] + for node in nodelist: + if node[0] == symbol.stmt: + self.com_append_stmt(stmts, node) + return Stmt(stmts) + + # -------------------------------------------------------------- + # + # EXPRESSION NODES (invoked by com_node()) + # + + def testlist(self, nodelist): + # testlist: expr (',' expr)* [','] + # testlist_safe: test [(',' test)+ [',']] + # exprlist: expr (',' expr)* [','] + return self.com_binary(Tuple, nodelist) + + testlist_safe = testlist # XXX + testlist1 = testlist + exprlist = testlist + + def testlist_gexp(self, nodelist): + if len(nodelist) == 2 and nodelist[1][0] == symbol.gen_for: + test = self.com_node(nodelist[0]) + return self.com_generator_expression(test, nodelist[1]) + return self.testlist(nodelist) + + def test(self, nodelist): + # and_test ('or' and_test)* | lambdef + if len(nodelist) == 1 and nodelist[0][0] == symbol.lambdef: + return self.lambdef(nodelist[0]) + return self.com_binary(Or, nodelist) + + def and_test(self, nodelist): + # not_test ('and' not_test)* + return self.com_binary(And, nodelist) + + def not_test(self, nodelist): + # 'not' not_test | comparison + result = self.com_node(nodelist[-1]) + if len(nodelist) == 2: + return Not(result, lineno=nodelist[0][2]) + return result + + def comparison(self, nodelist): + # comparison: expr (comp_op expr)* + node = self.com_node(nodelist[0]) + if len(nodelist) == 1: + return node + + results = [] + for i in range(2, len(nodelist), 2): + nl = nodelist[i-1] + + # comp_op: '<' | '>' | '=' | '>=' | '<=' | '<>' | '!=' | '==' + # | 'in' | 'not' 'in' | 'is' | 'is' 'not' + n = nl[1] + if n[0] == token.NAME: + type = n[1] + if len(nl) == 3: + if type == 'not': + type = 'not in' + else: + type = 'is not' + else: + type = _cmp_types[n[0]] + + lineno = nl[1][2] + results.append((type, self.com_node(nodelist[i]))) + + # we need a special "compare" node so that we can distinguish + # 3 < x < 5 from (3 < x) < 5 + # the two have very different semantics and results (note that the + # latter form is always true) + + return Compare(node, results, lineno=lineno) + + def expr(self, nodelist): + # xor_expr ('|' xor_expr)* + return self.com_binary(Bitor, nodelist) + + def xor_expr(self, nodelist): + # xor_expr ('^' xor_expr)* + return self.com_binary(Bitxor, nodelist) + + def and_expr(self, nodelist): + # xor_expr ('&' xor_expr)* + return self.com_binary(Bitand, nodelist) + + def shift_expr(self, nodelist): + # shift_expr ('<<'|'>>' shift_expr)* + node = self.com_node(nodelist[0]) + for i in range(2, len(nodelist), 2): + right = self.com_node(nodelist[i]) + if nodelist[i-1][0] == token.LEFTSHIFT: + node = LeftShift([node, right], lineno=nodelist[1][2]) + elif nodelist[i-1][0] == token.RIGHTSHIFT: + node = RightShift([node, right], lineno=nodelist[1][2]) + else: + raise ValueError, "unexpected token: %s" % nodelist[i-1][0] + return node + + def arith_expr(self, nodelist): + node = self.com_node(nodelist[0]) + for i in range(2, len(nodelist), 2): + right = self.com_node(nodelist[i]) + if nodelist[i-1][0] == token.PLUS: + node = Add([node, right], lineno=nodelist[1][2]) + elif nodelist[i-1][0] == token.MINUS: + node = Sub([node, right], lineno=nodelist[1][2]) + else: + raise ValueError, "unexpected token: %s" % nodelist[i-1][0] + return node + + def term(self, nodelist): + node = self.com_node(nodelist[0]) + for i in range(2, len(nodelist), 2): + right = self.com_node(nodelist[i]) + t = nodelist[i-1][0] + if t == token.STAR: + node = Mul([node, right]) + elif t == token.SLASH: + node = Div([node, right]) + elif t == token.PERCENT: + node = Mod([node, right]) + elif t == token.DOUBLESLASH: + node = FloorDiv([node, right]) + else: + raise ValueError, "unexpected token: %s" % t + node.lineno = nodelist[1][2] + return node + + def factor(self, nodelist): + elt = nodelist[0] + t = elt[0] + node = self.lookup_node(nodelist[-1])(nodelist[-1][1:]) + # need to handle (unary op)constant here... + if t == token.PLUS: + return UnaryAdd(node, lineno=elt[2]) + elif t == token.MINUS: + return UnarySub(node, lineno=elt[2]) + elif t == token.TILDE: + node = Invert(node, lineno=elt[2]) + return node + + def power(self, nodelist): + # power: atom trailer* ('**' factor)* + node = self.com_node(nodelist[0]) + for i in range(1, len(nodelist)): + elt = nodelist[i] + if elt[0] == token.DOUBLESTAR: + return Power([node, self.com_node(nodelist[i+1])], + lineno=elt[2]) + + node = self.com_apply_trailer(node, elt) + + return node + + def atom(self, nodelist): + return self._atom_dispatch[nodelist[0][0]](nodelist) + n.lineno = nodelist[0][2] + return n + + def atom_lpar(self, nodelist): + if nodelist[1][0] == token.RPAR: + return Tuple(()) + return self.com_node(nodelist[1]) + + def atom_lsqb(self, nodelist): + if nodelist[1][0] == token.RSQB: + return List(()) + return self.com_list_constructor(nodelist[1]) + + def atom_lbrace(self, nodelist): + if nodelist[1][0] == token.RBRACE: + return Dict(()) + return self.com_dictmaker(nodelist[1]) + + def atom_backquote(self, nodelist): + return Backquote(self.com_node(nodelist[1])) + + def atom_number(self, nodelist): + ### need to verify this matches compile.c + k = eval(nodelist[0][1]) + return Const(k, lineno=nodelist[0][2]) + + def decode_literal(self, lit): + if self.encoding: + # this is particularly fragile & a bit of a + # hack... changes in compile.c:parsestr and + # tokenizer.c must be reflected here. + if self.encoding not in ['utf-8', 'iso-8859-1']: + lit = unicode(lit, 'utf-8').encode(self.encoding) + return eval("# coding: %s\n%s" % (self.encoding, lit)) + else: + return eval(lit) + + def atom_string(self, nodelist): + k = '' + for node in nodelist: + k += self.decode_literal(node[1]) + return Const(k, lineno=nodelist[0][2]) + + def atom_name(self, nodelist): + return Name(nodelist[0][1], lineno=nodelist[0][2]) + + # -------------------------------------------------------------- + # + # INTERNAL PARSING UTILITIES + # + + # The use of com_node() introduces a lot of extra stack frames, + # enough to cause a stack overflow compiling test.test_parser with + # the standard interpreter recursionlimit. The com_node() is a + # convenience function that hides the dispatch details, but comes + # at a very high cost. It is more efficient to dispatch directly + # in the callers. In these cases, use lookup_node() and call the + # dispatched node directly. + + def lookup_node(self, node): + return self._dispatch[node[0]] + + _callers = {} + + def com_node(self, node): + # Note: compile.c has handling in com_node for del_stmt, pass_stmt, + # break_stmt, stmt, small_stmt, flow_stmt, simple_stmt, + # and compound_stmt. + # We'll just dispatch them. + return self._dispatch[node[0]](node[1:]) + + def com_NEWLINE(self, *args): + # A ';' at the end of a line can make a NEWLINE token appear + # here, Render it harmless. (genc discards ('discard', + # ('const', xxxx)) Nodes) + return Discard(Const(None)) + + def com_arglist(self, nodelist): + # varargslist: + # (fpdef ['=' test] ',')* ('*' NAME [',' '**' NAME] | '**' NAME) + # | fpdef ['=' test] (',' fpdef ['=' test])* [','] + # fpdef: NAME | '(' fplist ')' + # fplist: fpdef (',' fpdef)* [','] + names = [] + defaults = [] + flags = 0 + + i = 0 + while i < len(nodelist): + node = nodelist[i] + if node[0] == token.STAR or node[0] == token.DOUBLESTAR: + if node[0] == token.STAR: + node = nodelist[i+1] + if node[0] == token.NAME: + names.append(node[1]) + flags = flags | CO_VARARGS + i = i + 3 + + if i < len(nodelist): + # should be DOUBLESTAR + t = nodelist[i][0] + if t == token.DOUBLESTAR: + node = nodelist[i+1] + else: + raise ValueError, "unexpected token: %s" % t + names.append(node[1]) + flags = flags | CO_VARKEYWORDS + + break + + # fpdef: NAME | '(' fplist ')' + names.append(self.com_fpdef(node)) + + i = i + 1 + if i >= len(nodelist): + break + + if nodelist[i][0] == token.EQUAL: + defaults.append(self.com_node(nodelist[i + 1])) + i = i + 2 + elif len(defaults): + # XXX This should be a syntax error. + # Treat "(a=1, b)" as "(a=1, b=None)" + defaults.append(Const(None)) + + i = i + 1 + + return names, defaults, flags + + def com_fpdef(self, node): + # fpdef: NAME | '(' fplist ')' + if node[1][0] == token.LPAR: + return self.com_fplist(node[2]) + return node[1][1] + + def com_fplist(self, node): + # fplist: fpdef (',' fpdef)* [','] + if len(node) == 2: + return self.com_fpdef(node[1]) + list = [] + for i in range(1, len(node), 2): + list.append(self.com_fpdef(node[i])) + return tuple(list) + + def com_dotted_name(self, node): + # String together the dotted names and return the string + name = "" + for n in node: + if type(n) == type(()) and n[0] == 1: + name = name + n[1] + '.' + return name[:-1] + + def com_dotted_as_name(self, node): + assert node[0] == symbol.dotted_as_name + node = node[1:] + dot = self.com_dotted_name(node[0][1:]) + if len(node) == 1: + return dot, None + assert node[1][1] == 'as' + assert node[2][0] == token.NAME + return dot, node[2][1] + + def com_dotted_as_names(self, node): + assert node[0] == symbol.dotted_as_names + node = node[1:] + names = [self.com_dotted_as_name(node[0])] + for i in range(2, len(node), 2): + names.append(self.com_dotted_as_name(node[i])) + return names + + def com_import_as_name(self, node): + assert node[0] == symbol.import_as_name + node = node[1:] + assert node[0][0] == token.NAME + if len(node) == 1: + return node[0][1], None + assert node[1][1] == 'as', node + assert node[2][0] == token.NAME + return node[0][1], node[2][1] + + def com_import_as_names(self, node): + assert node[0] == symbol.import_as_names + node = node[1:] + names = [self.com_import_as_name(node[0])] + for i in range(2, len(node), 2): + names.append(self.com_import_as_name(node[i])) + return names + + def com_bases(self, node): + bases = [] + for i in range(1, len(node), 2): + bases.append(self.com_node(node[i])) + return bases + + def com_try_finally(self, nodelist): + # try_fin_stmt: "try" ":" suite "finally" ":" suite + return TryFinally(self.com_node(nodelist[2]), + self.com_node(nodelist[5]), + lineno=nodelist[0][2]) + + def com_try_except(self, nodelist): + # try_except: 'try' ':' suite (except_clause ':' suite)* ['else' suite] + #tryexcept: [TryNode, [except_clauses], elseNode)] + stmt = self.com_node(nodelist[2]) + clauses = [] + elseNode = None + for i in range(3, len(nodelist), 3): + node = nodelist[i] + if node[0] == symbol.except_clause: + # except_clause: 'except' [expr [',' expr]] */ + if len(node) > 2: + expr1 = self.com_node(node[2]) + if len(node) > 4: + expr2 = self.com_assign(node[4], OP_ASSIGN) + else: + expr2 = None + else: + expr1 = expr2 = None + clauses.append((expr1, expr2, self.com_node(nodelist[i+2]))) + + if node[0] == token.NAME: + elseNode = self.com_node(nodelist[i+2]) + return TryExcept(self.com_node(nodelist[2]), clauses, elseNode, + lineno=nodelist[0][2]) + + def com_augassign_op(self, node): + assert node[0] == symbol.augassign + return node[1] + + def com_augassign(self, node): + """Return node suitable for lvalue of augmented assignment + + Names, slices, and attributes are the only allowable nodes. + """ + l = self.com_node(node) + if l.__class__ in (Name, Slice, Subscript, Getattr): + return l + raise SyntaxError, "can't assign to %s" % l.__class__.__name__ + + def com_assign(self, node, assigning): + # return a node suitable for use as an "lvalue" + # loop to avoid trivial recursion + while 1: + t = node[0] + if t == symbol.exprlist or t == symbol.testlist or (PYTHON_24 and t == symbol.testlist_gexp): + if len(node) > 2: + return self.com_assign_tuple(node, assigning) + node = node[1] + elif t in _assign_types: + if len(node) > 2: + raise SyntaxError, "can't assign to operator" + node = node[1] + elif t == symbol.power: + if node[1][0] != symbol.atom: + raise SyntaxError, "can't assign to operator" + if len(node) > 2: + primary = self.com_node(node[1]) + for i in range(2, len(node)-1): + ch = node[i] + if ch[0] == token.DOUBLESTAR: + raise SyntaxError, "can't assign to operator" + primary = self.com_apply_trailer(primary, ch) + return self.com_assign_trailer(primary, node[-1], + assigning) + node = node[1] + elif t == symbol.atom: + t = node[1][0] + if t == token.LPAR: + node = node[2] + if node[0] == token.RPAR: + raise SyntaxError, "can't assign to ()" + elif t == token.LSQB: + node = node[2] + if node[0] == token.RSQB: + raise SyntaxError, "can't assign to []" + return self.com_assign_list(node, assigning) + elif t == token.NAME: + return self.com_assign_name(node[1], assigning) + else: + raise SyntaxError, "can't assign to literal" + else: + raise SyntaxError, "bad assignment" + + def com_assign_tuple(self, node, assigning): + assigns = [] + for i in range(1, len(node), 2): + assigns.append(self.com_assign(node[i], assigning)) + return AssTuple(assigns, lineno=extractLineNo(node)) + + def com_assign_list(self, node, assigning): + assigns = [] + for i in range(1, len(node), 2): + if i + 1 < len(node): + if node[i + 1][0] == symbol.list_for: + raise SyntaxError, "can't assign to list comprehension" + assert node[i + 1][0] == token.COMMA, node[i + 1] + assigns.append(self.com_assign(node[i], assigning)) + return AssList(assigns, lineno=extractLineNo(node)) + + def com_assign_name(self, node, assigning): + return AssName(node[1], assigning, lineno=node[2]) + + def com_assign_trailer(self, primary, node, assigning): + t = node[1][0] + if t == token.DOT: + return self.com_assign_attr(primary, node[2], assigning) + if t == token.LSQB: + return self.com_subscriptlist(primary, node[2], assigning) + if t == token.LPAR: + raise SyntaxError, "can't assign to function call" + raise SyntaxError, "unknown trailer type: %s" % t + + def com_assign_attr(self, primary, node, assigning): + return AssAttr(primary, node[1], assigning, lineno=node[-1]) + + def com_binary(self, constructor, nodelist): + "Compile 'NODE (OP NODE)*' into (type, [ node1, ..., nodeN ])." + l = len(nodelist) + if l == 1: + n = nodelist[0] + return self.lookup_node(n)(n[1:]) + items = [] + for i in range(0, l, 2): + n = nodelist[i] + items.append(self.lookup_node(n)(n[1:])) + return constructor(items, lineno=extractLineNo(nodelist)) + + def com_stmt(self, node): + result = self.lookup_node(node)(node[1:]) + assert result is not None + if isinstance(result, Stmt): + return result + return Stmt([result]) + + def com_append_stmt(self, stmts, node): + result = self.lookup_node(node)(node[1:]) + assert result is not None + if isinstance(result, Stmt): + stmts.extend(result.nodes) + else: + stmts.append(result) + + if hasattr(symbol, 'list_for'): + def com_list_constructor(self, nodelist): + # listmaker: test ( list_for | (',' test)* [','] ) + values = [] + for i in range(1, len(nodelist)): + if nodelist[i][0] == symbol.list_for: + assert len(nodelist[i:]) == 1 + return self.com_list_comprehension(values[0], + nodelist[i]) + elif nodelist[i][0] == token.COMMA: + continue + values.append(self.com_node(nodelist[i])) + return List(values, lineno=values[0].lineno) + + def com_list_comprehension(self, expr, node): + # list_iter: list_for | list_if + # list_for: 'for' exprlist 'in' testlist [list_iter] + # list_if: 'if' test [list_iter] + + # XXX should raise SyntaxError for assignment + + lineno = node[1][2] + fors = [] + while node: + t = node[1][1] + if t == 'for': + assignNode = self.com_assign(node[2], OP_ASSIGN) + listNode = self.com_node(node[4]) + newfor = ListCompFor(assignNode, listNode, []) + newfor.lineno = node[1][2] + fors.append(newfor) + if len(node) == 5: + node = None + else: + node = self.com_list_iter(node[5]) + elif t == 'if': + test = self.com_node(node[2]) + newif = ListCompIf(test, lineno=node[1][2]) + newfor.ifs.append(newif) + if len(node) == 3: + node = None + else: + node = self.com_list_iter(node[3]) + else: + raise SyntaxError, \ + ("unexpected list comprehension element: %s %d" + % (node, lineno)) + return ListComp(expr, fors, lineno=lineno) + + def com_list_iter(self, node): + assert node[0] == symbol.list_iter + return node[1] + else: + def com_list_constructor(self, nodelist): + values = [] + for i in range(1, len(nodelist), 2): + values.append(self.com_node(nodelist[i])) + return List(values) + + if hasattr(symbol, 'gen_for'): + def com_generator_expression(self, expr, node): + # gen_iter: gen_for | gen_if + # gen_for: 'for' exprlist 'in' test [gen_iter] + # gen_if: 'if' test [gen_iter] + + lineno = node[1][2] + fors = [] + while node: + t = node[1][1] + if t == 'for': + assignNode = self.com_assign(node[2], OP_ASSIGN) + genNode = self.com_node(node[4]) + newfor = GenExprFor(assignNode, genNode, [], + lineno=node[1][2]) + fors.append(newfor) + if (len(node)) == 5: + node = None + else: + node = self.com_gen_iter(node[5]) + elif t == 'if': + test = self.com_node(node[2]) + newif = GenExprIf(test, lineno=node[1][2]) + newfor.ifs.append(newif) + if len(node) == 3: + node = None + else: + node = self.com_gen_iter(node[3]) + else: + raise SyntaxError, \ + ("unexpected generator expression element: %s %d" + % (node, lineno)) + fors[0].is_outmost = True + return GenExpr(GenExprInner(expr, fors), lineno=lineno) + + def com_gen_iter(self, node): + assert node[0] == symbol.gen_iter + return node[1] + + def com_dictmaker(self, nodelist): + # dictmaker: test ':' test (',' test ':' value)* [','] + items = [] + for i in range(1, len(nodelist), 4): + items.append((self.com_node(nodelist[i]), + self.com_node(nodelist[i+2]))) + return Dict(items) + + def com_apply_trailer(self, primaryNode, nodelist): + t = nodelist[1][0] + if t == token.LPAR: + return self.com_call_function(primaryNode, nodelist[2]) + if t == token.DOT: + return self.com_select_member(primaryNode, nodelist[2]) + if t == token.LSQB: + return self.com_subscriptlist(primaryNode, nodelist[2], OP_APPLY) + + raise SyntaxError, 'unknown node type: %s' % t + + def com_select_member(self, primaryNode, nodelist): + if nodelist[0] != token.NAME: + raise SyntaxError, "member must be a name" + return Getattr(primaryNode, nodelist[1], lineno=nodelist[2]) + + def com_call_function(self, primaryNode, nodelist): + if nodelist[0] == token.RPAR: + return CallFunc(primaryNode, [], lineno=extractLineNo(nodelist)) + args = [] + kw = 0 + len_nodelist = len(nodelist) + for i in range(1, len_nodelist, 2): + node = nodelist[i] + if node[0] == token.STAR or node[0] == token.DOUBLESTAR: + break + kw, result = self.com_argument(node, kw) + + if len_nodelist != 2 and isinstance(result, GenExpr) \ + and len(node) == 3 and node[2][0] == symbol.gen_for: + # allow f(x for x in y), but reject f(x for x in y, 1) + # should use f((x for x in y), 1) instead of f(x for x in y, 1) + raise SyntaxError, 'generator expression needs parenthesis' + + args.append(result) + else: + # No broken by star arg, so skip the last one we processed. + i = i + 1 + if i < len_nodelist and nodelist[i][0] == token.COMMA: + # need to accept an application that looks like "f(a, b,)" + i = i + 1 + star_node = dstar_node = None + while i < len_nodelist: + tok = nodelist[i] + ch = nodelist[i+1] + i = i + 3 + if tok[0]==token.STAR: + if star_node is not None: + raise SyntaxError, 'already have the varargs indentifier' + star_node = self.com_node(ch) + elif tok[0]==token.DOUBLESTAR: + if dstar_node is not None: + raise SyntaxError, 'already have the kwargs indentifier' + dstar_node = self.com_node(ch) + else: + raise SyntaxError, 'unknown node type: %s' % tok + return CallFunc(primaryNode, args, star_node, dstar_node, + lineno=extractLineNo(nodelist)) + + def com_argument(self, nodelist, kw): + if len(nodelist) == 3 and nodelist[2][0] == symbol.gen_for: + test = self.com_node(nodelist[1]) + return 0, self.com_generator_expression(test, nodelist[2]) + if len(nodelist) == 2: + if kw: + raise SyntaxError, "non-keyword arg after keyword arg" + return 0, self.com_node(nodelist[1]) + result = self.com_node(nodelist[3]) + n = nodelist[1] + while len(n) == 2 and n[0] != token.NAME: + n = n[1] + if n[0] != token.NAME: + raise SyntaxError, "keyword can't be an expression (%s)"%n[0] + node = Keyword(n[1], result, lineno=n[2]) + return 1, node + + def com_subscriptlist(self, primary, nodelist, assigning): + # slicing: simple_slicing | extended_slicing + # simple_slicing: primary "[" short_slice "]" + # extended_slicing: primary "[" slice_list "]" + # slice_list: slice_item ("," slice_item)* [","] + + # backwards compat slice for '[i:j]' + if len(nodelist) == 2: + sub = nodelist[1] + if (sub[1][0] == token.COLON or \ + (len(sub) > 2 and sub[2][0] == token.COLON)) and \ + sub[-1][0] != symbol.sliceop: + return self.com_slice(primary, sub, assigning) + + subscripts = [] + for i in range(1, len(nodelist), 2): + subscripts.append(self.com_subscript(nodelist[i])) + return Subscript(primary, assigning, subscripts, + lineno=extractLineNo(nodelist)) + + def com_subscript(self, node): + # slice_item: expression | proper_slice | ellipsis + ch = node[1] + t = ch[0] + if t == token.DOT and node[2][0] == token.DOT: + return Ellipsis() + if t == token.COLON or len(node) > 2: + return self.com_sliceobj(node) + return self.com_node(ch) + + def com_sliceobj(self, node): + # proper_slice: short_slice | long_slice + # short_slice: [lower_bound] ":" [upper_bound] + # long_slice: short_slice ":" [stride] + # lower_bound: expression + # upper_bound: expression + # stride: expression + # + # Note: a stride may be further slicing... + + items = [] + + if node[1][0] == token.COLON: + items.append(Const(None)) + i = 2 + else: + items.append(self.com_node(node[1])) + # i == 2 is a COLON + i = 3 + + if i < len(node) and node[i][0] == symbol.test: + items.append(self.com_node(node[i])) + i = i + 1 + else: + items.append(Const(None)) + + # a short_slice has been built. look for long_slice now by looking + # for strides... + for j in range(i, len(node)): + ch = node[j] + if len(ch) == 2: + items.append(Const(None)) + else: + items.append(self.com_node(ch[2])) + return Sliceobj(items, lineno=extractLineNo(node)) + + def com_slice(self, primary, node, assigning): + # short_slice: [lower_bound] ":" [upper_bound] + lower = upper = None + if len(node) == 3: + if node[1][0] == token.COLON: + upper = self.com_node(node[2]) + else: + lower = self.com_node(node[1]) + elif len(node) == 4: + lower = self.com_node(node[1]) + upper = self.com_node(node[3]) + return Slice(primary, assigning, lower, upper, + lineno=extractLineNo(node)) + + def get_docstring(self, node, n=None): + if n is None: + n = node[0] + node = node[1:] + if n == symbol.suite: + if len(node) == 1: + return self.get_docstring(node[0]) + for sub in node: + if sub[0] == symbol.stmt: + return self.get_docstring(sub) + return None + if n == symbol.file_input: + for sub in node: + if sub[0] == symbol.stmt: + return self.get_docstring(sub) + return None + if n == symbol.atom: + if node[0][0] == token.STRING: + s = '' + for t in node: + s = s + eval(t[1]) + return s + return None + if n == symbol.stmt or n == symbol.simple_stmt \ + or n == symbol.small_stmt: + return self.get_docstring(node[0]) + if n in _doc_nodes and len(node) == 1: + return self.get_docstring(node[0]) + return None + + +_doc_nodes = [ + symbol.expr_stmt, + symbol.testlist, + symbol.testlist_safe, + symbol.test, + symbol.and_test, + symbol.not_test, + symbol.comparison, + symbol.expr, + symbol.xor_expr, + symbol.and_expr, + symbol.shift_expr, + symbol.arith_expr, + symbol.term, + symbol.factor, + symbol.power, + ] + +# comp_op: '<' | '>' | '=' | '>=' | '<=' | '<>' | '!=' | '==' +# | 'in' | 'not' 'in' | 'is' | 'is' 'not' +_cmp_types = { + token.LESS : '<', + token.GREATER : '>', + token.EQEQUAL : '==', + token.EQUAL : '==', + token.LESSEQUAL : '<=', + token.GREATEREQUAL : '>=', + token.NOTEQUAL : '!=', + } + +_legal_node_types = [ + symbol.funcdef, + symbol.classdef, + symbol.stmt, + symbol.small_stmt, + symbol.flow_stmt, + symbol.simple_stmt, + symbol.compound_stmt, + symbol.expr_stmt, + symbol.print_stmt, + symbol.del_stmt, + symbol.pass_stmt, + symbol.break_stmt, + symbol.continue_stmt, + symbol.return_stmt, + symbol.raise_stmt, + symbol.import_stmt, + symbol.global_stmt, + symbol.exec_stmt, + symbol.assert_stmt, + symbol.if_stmt, + symbol.while_stmt, + symbol.for_stmt, + symbol.try_stmt, + symbol.suite, + symbol.testlist, + symbol.testlist_safe, + symbol.test, + symbol.and_test, + symbol.not_test, + symbol.comparison, + symbol.exprlist, + symbol.expr, + symbol.xor_expr, + symbol.and_expr, + symbol.shift_expr, + symbol.arith_expr, + symbol.term, + symbol.factor, + symbol.power, + symbol.atom, + ] + +if hasattr(symbol, 'yield_stmt'): + _legal_node_types.append(symbol.yield_stmt) + +_assign_types = [ + symbol.test, + symbol.and_test, + symbol.not_test, + symbol.comparison, + symbol.expr, + symbol.xor_expr, + symbol.and_expr, + symbol.shift_expr, + symbol.arith_expr, + symbol.term, + symbol.factor, + ] + +import types +_names = {} +for k, v in symbol.sym_name.items(): + _names[k] = v +for k, v in token.tok_name.items(): + _names[k] = v + +def debug_tree(tree): + l = [] + for elt in tree: + if type(elt) == types.IntType: + l.append(_names.get(elt, elt)) + elif type(elt) == types.StringType: + l.append(elt) + else: + l.append(debug_tree(elt)) + return l Added: pypy/branch/pycompiler/module/recparser/compiler/visitor.py ============================================================================== --- (empty file) +++ pypy/branch/pycompiler/module/recparser/compiler/visitor.py Tue May 24 14:21:39 2005 @@ -0,0 +1,130 @@ +from compiler import ast + +# XXX should probably rename ASTVisitor to ASTWalker +# XXX can it be made even more generic? + +class ASTVisitor: + """Performs a depth-first walk of the AST + + The ASTVisitor will walk the AST, performing either a preorder or + postorder traversal depending on which method is called. + + methods: + preorder(tree, visitor) + postorder(tree, visitor) + tree: an instance of ast.Node + visitor: an instance with visitXXX methods + + The ASTVisitor is responsible for walking over the tree in the + correct order. For each node, it checks the visitor argument for + a method named 'visitNodeType' where NodeType is the name of the + node's class, e.g. Class. If the method exists, it is called + with the node as its sole argument. + + The visitor method for a particular node type can control how + child nodes are visited during a preorder walk. (It can't control + the order during a postorder walk, because it is called _after_ + the walk has occurred.) The ASTVisitor modifies the visitor + argument by adding a visit method to the visitor; this method can + be used to visit a child node of arbitrary type. + """ + + VERBOSE = 0 + + def __init__(self): + self.node = None + self._cache = {} + + def default(self, node, *args): + for child in node.getChildNodes(): + self.dispatch(child, *args) + + def dispatch(self, node, *args): + self.node = node + klass = node.__class__ + meth = self._cache.get(klass, None) + if meth is None: + className = klass.__name__ + meth = getattr(self.visitor, 'visit' + className, self.default) + self._cache[klass] = meth +## if self.VERBOSE > 0: +## className = klass.__name__ +## if self.VERBOSE == 1: +## if meth == 0: +## print "dispatch", className +## else: +## print "dispatch", className, (meth and meth.__name__ or '') + return meth(node, *args) + + def preorder(self, tree, visitor, *args): + """Do preorder walk of tree using visitor""" + self.visitor = visitor + visitor.visit = self.dispatch + self.dispatch(tree, *args) # XXX *args make sense? + +class ExampleASTVisitor(ASTVisitor): + """Prints examples of the nodes that aren't visited + + This visitor-driver is only useful for development, when it's + helpful to develop a visitor incrementally, and get feedback on what + you still have to do. + """ + examples = {} + + def dispatch(self, node, *args): + self.node = node + meth = self._cache.get(node.__class__, None) + className = node.__class__.__name__ + if meth is None: + meth = getattr(self.visitor, 'visit' + className, 0) + self._cache[node.__class__] = meth + if self.VERBOSE > 1: + print "dispatch", className, (meth and meth.__name__ or '') + if meth: + meth(node, *args) + elif self.VERBOSE > 0: + klass = node.__class__ + if not self.examples.has_key(klass): + self.examples[klass] = klass + print + print self.visitor + print klass + for attr in dir(node): + if attr[0] != '_': + print "\t", "%-12.12s" % attr, getattr(node, attr) + print + return self.default(node, *args) + +# XXX this is an API change + +_walker = ASTVisitor +def walk(tree, visitor, walker=None, verbose=None): + if walker is None: + walker = _walker() + if verbose is not None: + walker.VERBOSE = verbose + walker.preorder(tree, visitor) + return walker.visitor + +def dumpNode(node): + print node.__class__ + for attr in dir(node): + if attr[0] != '_': + print "\t", "%-10.10s" % attr, getattr(node, attr) + + +class ASTVisitor(object): + """This is a visitor base class used to provide the visit + method in replacement of the former visitor.visit = walker.dispatch + It could also use to identify base type for visit arguments of AST nodes + """ + def visit(self, node, *args): + node.visit(self, *args) + + def default(self, node, *args): + for child in node.getChildNodes(): + self.dispatch(child, *args) + + def __getattr__(self, name ): + return self.default + From adim at codespeak.net Tue May 24 15:17:52 2005 From: adim at codespeak.net (adim at codespeak.net) Date: Tue, 24 May 2005 15:17:52 +0200 (CEST) Subject: [pypy-svn] r12769 - pypy/branch/pycompiler/module/recparser/test Message-ID: <20050524131752.6DC5127B56@code1.codespeak.net> Author: adim Date: Tue May 24 15:17:52 2005 New Revision: 12769 Modified: pypy/branch/pycompiler/module/recparser/test/test_pytokenizer.py Log: had problems to run py.test on the TestSuite class. problems disappear when using functions rather than methods Modified: pypy/branch/pycompiler/module/recparser/test/test_pytokenizer.py ============================================================================== --- pypy/branch/pycompiler/module/recparser/test/test_pytokenizer.py (original) +++ pypy/branch/pycompiler/module/recparser/test/test_pytokenizer.py Tue May 24 15:17:52 2005 @@ -11,69 +11,69 @@ tokens.append((last_token, value)) return tokens -class TestSuite: - """Tokenizer test suite""" - PUNCTS = [ - # Here should be listed each existing punctuation - '>=', '<>', '!=', '<', '>', '<=', '==', '*=', - '//=', '%=', '^=', '<<=', '**=', '|=', - '+=', '>>=', '=', '&=', '/=', '-=', ',', '^', - '>>', '&', '+', '*', '-', '/', '.', '**', - '%', '<<', '//', '|', ')', '(', ';', ':', - '@', '[', ']', '`', '{', '}', - ] - - NUMBERS = [ - # Here should be listed each different form of number - '1', '1.23', '1.', '0', - '1L', '1l', - '0x12L', '0x12l', '0X12', '0x12', - '1j', '1J', - '1e2', '1.2e4', - '0.1', '0.', '0.12', '.2', - ] - - BAD_NUMBERS = [ - 'j', '0xg', '0xj', '0xJ', - ] - - def test_empty_string(self): - """make sure defined regexps don't match empty string""" - rgxes = {'numbers' : py_number, - 'defsym' : g_symdef, - 'strings' : g_string, - 'names' : py_name, - 'punct' : py_punct, - } - for label, rgx in rgxes.items(): - assert rgx.match('') is None, '%s matches empty string' % label - - def test_several_lines_list(self): - """tests list definition on several lines""" - s = """['a' - ]""" - tokens = parse_source(s) - assert tokens == [('[', None), ('STRING', "'a'"), (']', None), - ('NEWLINE', ''), ('ENDMARKER', None)] - - def test_numbers(self): - """make sure all kind of numbers are correctly parsed""" - for number in self.NUMBERS: - assert parse_source(number)[0] == ('NUMBER', number) - neg = '-%s' % number - assert parse_source(neg)[:2] == [('-', None), ('NUMBER', number)] - for number in self.BAD_NUMBERS: - assert parse_source(number)[0] != ('NUMBER', number) - - def test_hex_number(self): - """basic pasrse""" - tokens = parse_source("a = 0x12L") - assert tokens == [('NAME', 'a'), ('=', None), ('NUMBER', '0x12L'), - ('NEWLINE', ''), ('ENDMARKER', None)] - - def test_punct(self): - """make sure each punctuation is correctly parsed""" - for pstr in self.PUNCTS: - tokens = parse_source(pstr) - assert tokens[0][0] == pstr +## class TestSuite: +## """Tokenizer test suite""" +PUNCTS = [ + # Here should be listed each existing punctuation + '>=', '<>', '!=', '<', '>', '<=', '==', '*=', + '//=', '%=', '^=', '<<=', '**=', '|=', + '+=', '>>=', '=', '&=', '/=', '-=', ',', '^', + '>>', '&', '+', '*', '-', '/', '.', '**', + '%', '<<', '//', '|', ')', '(', ';', ':', + '@', '[', ']', '`', '{', '}', + ] + +NUMBERS = [ + # Here should be listed each different form of number + '1', '1.23', '1.', '0', + '1L', '1l', + '0x12L', '0x12l', '0X12', '0x12', + '1j', '1J', + '1e2', '1.2e4', + '0.1', '0.', '0.12', '.2', + ] + +BAD_NUMBERS = [ + 'j', '0xg', '0xj', '0xJ', + ] + +def test_empty_string(): + """make sure defined regexps don't match empty string""" + rgxes = {'numbers' : py_number, + 'defsym' : g_symdef, + 'strings' : g_string, + 'names' : py_name, + 'punct' : py_punct, + } + for label, rgx in rgxes.items(): + assert rgx.match('') is None, '%s matches empty string' % label + +def test_several_lines_list(): + """tests list definition on several lines""" + s = """['a' + ]""" + tokens = parse_source(s) + assert tokens == [('[', None), ('STRING', "'a'"), (']', None), + ('NEWLINE', ''), ('ENDMARKER', None)] + +def test_numbers(): + """make sure all kind of numbers are correctly parsed""" + for number in NUMBERS: + assert parse_source(number)[0] == ('NUMBER', number) + neg = '-%s' % number + assert parse_source(neg)[:2] == [('-', None), ('NUMBER', number)] + for number in BAD_NUMBERS: + assert parse_source(number)[0] != ('NUMBER', number) + +def test_hex_number(): + """basic pasrse""" + tokens = parse_source("a = 0x12L") + assert tokens == [('NAME', 'a'), ('=', None), ('NUMBER', '0x12L'), + ('NEWLINE', ''), ('ENDMARKER', None)] + +def test_punct(): + """make sure each punctuation is correctly parsed""" + for pstr in PUNCTS: + tokens = parse_source(pstr) + assert tokens[0][0] == pstr From adim at codespeak.net Tue May 24 15:18:21 2005 From: adim at codespeak.net (adim at codespeak.net) Date: Tue, 24 May 2005 15:18:21 +0200 (CEST) Subject: [pypy-svn] r12770 - pypy/branch/pycompiler/module/recparser Message-ID: <20050524131821.B78D527B56@code1.codespeak.net> Author: adim Date: Tue May 24 15:18:21 2005 New Revision: 12770 Modified: pypy/branch/pycompiler/module/recparser/pythonutil.py Log: bad indentation fix Modified: pypy/branch/pycompiler/module/recparser/pythonutil.py ============================================================================== --- pypy/branch/pycompiler/module/recparser/pythonutil.py (original) +++ pypy/branch/pycompiler/module/recparser/pythonutil.py Tue May 24 15:18:21 2005 @@ -18,8 +18,8 @@ import symbol def pypy_parse(filename): - """parse using PyPy's parser module and return nested tuples - """ + """parse using PyPy's parser module and return nested tuples + """ pyf = file(filename) text = pyf.read() pyf.close() From hpk at codespeak.net Tue May 24 15:58:48 2005 From: hpk at codespeak.net (hpk at codespeak.net) Date: Tue, 24 May 2005 15:58:48 +0200 (CEST) Subject: [pypy-svn] r12771 - pypy/dist/pypy/documentation Message-ID: <20050524135848.6269127B57@code1.codespeak.net> Author: hpk Date: Tue May 24 15:58:48 2005 New Revision: 12771 Modified: pypy/dist/pypy/documentation/coding-guide.txt Log: added "branching" information/recommendations to the coding guide. Modified: pypy/dist/pypy/documentation/coding-guide.txt ============================================================================== --- pypy/dist/pypy/documentation/coding-guide.txt (original) +++ pypy/dist/pypy/documentation/coding-guide.txt Tue May 24 15:58:48 2005 @@ -732,8 +732,8 @@ includes w_self. Don't use ``w_`` in application level python only code. -Committing ----------- +Committing & Branching to the repository +----------------------------------------------------- - write good log messages because several people are reading the diffs. @@ -743,6 +743,19 @@ that the property 'svn:eol-style' is set to native which allows checkin/checkout in native line-ending format. +- branching (aka "svn copy") of source code should usually + happen at ``svn/pypy/dist`` level in order to have a full + self-contained pypy checkout for each branch. For branching + a ``try1`` branch you would for example do:: + + svn cp http://codespeak.net/svn/pypy/dist \ + http://codespeak.net/svn/pypy/branch/try1 + + This allows to checkout the ``try1`` branch and receive a + self-contained working-copy for the branch. Note that + branching/copying is a cheap operation with subversion, as it + takes constant time irrespective of the size of the tree. + - To learn more about how to use subversion read `this document`_. .. _`this document`: svn-help.html From hpk at codespeak.net Tue May 24 17:49:49 2005 From: hpk at codespeak.net (hpk at codespeak.net) Date: Tue, 24 May 2005 17:49:49 +0200 (CEST) Subject: [pypy-svn] r12773 - pypy/dist/pypy/documentation Message-ID: <20050524154949.B5E0C27B5B@code1.codespeak.net> Author: hpk Date: Tue May 24 17:49:49 2005 New Revision: 12773 Modified: pypy/dist/pypy/documentation/redirections Log: added a redirection that hopefully helps with http://www.python.org/pycon/2005/papers/78/pypy.html Modified: pypy/dist/pypy/documentation/redirections ============================================================================== --- pypy/dist/pypy/documentation/redirections (original) +++ pypy/dist/pypy/documentation/redirections Tue May 24 17:49:49 2005 @@ -25,5 +25,7 @@ 'basicblock.asc' : 'objspace.html#the-flow-model', 'coding-style.html' : 'coding-guide.html', + + 'controlflow.html' : 'objspace.html#the-flow-model', } From ericvrp at codespeak.net Tue May 24 21:56:44 2005 From: ericvrp at codespeak.net (ericvrp at codespeak.net) Date: Tue, 24 May 2005 21:56:44 +0200 (CEST) Subject: [pypy-svn] r12774 - pypy/dist/pypy/documentation Message-ID: <20050524195644.B92A927B5B@code1.codespeak.net> Author: ericvrp Date: Tue May 24 21:56:44 2005 New Revision: 12774 Modified: pypy/dist/pypy/documentation/translation.txt Log: fixed small typo Modified: pypy/dist/pypy/documentation/translation.txt ============================================================================== --- pypy/dist/pypy/documentation/translation.txt (original) +++ pypy/dist/pypy/documentation/translation.txt Tue May 24 21:56:44 2005 @@ -384,7 +384,7 @@ +++++++++++++++++++++++++++++++++++++++ Constants in the flowgraph are annotated with a corresponding -``SomeXxx`` instance with 'const' attribute set to the their value. +``SomeXxx`` instance with 'const' attribute set to their value. Constant instances of user-defined classes, callables (which include functions but also class types themself) and staticmethod are treated From arigo at codespeak.net Tue May 24 23:41:17 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Tue, 24 May 2005 23:41:17 +0200 (CEST) Subject: [pypy-svn] r12775 - in pypy/dist/pypy: annotation rpython tool Message-ID: <20050524214117.528A927B56@code1.codespeak.net> Author: arigo Date: Tue May 24 23:41:17 2005 New Revision: 12775 Added: pypy/dist/pypy/rpython/rbuiltin.py (contents, props changed) pypy/dist/pypy/rpython/rint.py (contents, props changed) pypy/dist/pypy/rpython/robject.py (contents, props changed) pypy/dist/pypy/rpython/rptr.py (contents, props changed) Modified: pypy/dist/pypy/annotation/bookkeeper.py pypy/dist/pypy/annotation/model.py pypy/dist/pypy/rpython/lltype.py pypy/dist/pypy/rpython/rlist.py pypy/dist/pypy/rpython/rtyper.py pypy/dist/pypy/tool/sourcetools.py Log: Reworked rlist.py to be kind of reasonable. Then changed everything around it to support the new way it's written. The idea is that the rtyper is organized is a similar way than the annotator. It uses __extend__(pairtype(SomeX, SomeY)) to define methods than handle specific cases; the difference is that the methods (called rtype_*) have the purpose of producing low-level operations which will replace the original high-level operation. The logic about producing type-specialized versions of the low-level types like lists has been moved to a helper 'direct_call()' that annotates and calls a given low-level function. The RPythonTyper no longer subclasses pypy.translator.typer.Specializer. The latter should go away in the future. (The diff of some files don't make sense because they have been mostly rewritten from scratch.) Modified: pypy/dist/pypy/annotation/bookkeeper.py ============================================================================== --- pypy/dist/pypy/annotation/bookkeeper.py (original) +++ pypy/dist/pypy/annotation/bookkeeper.py Tue May 24 23:41:17 2005 @@ -408,10 +408,12 @@ except KeyError: if isinstance(thing, FunctionType): # XXX XXX XXX HAAAAAAAAAAAACK - # xxx we need a way to let know subsequent phases (the generator) about the specialized function - # the caller flowgraph as it is doesn't. - # This line just avoids that the flowgraph of the original function, which is what will be considered - # and compiled for now will be computed during generation itself + # xxx we need a way to let know subsequent phases (the + # generator) about the specialized function. + # The caller flowgraph, as it is, doesn't know. + # This line just avoids that the flowgraph of the original + # function (which is what will be considered and compiled for + # now) will be computed during generation itself. self.annotator.translator.getflowgraph(thing) # thing = func_with_new_name(thing, name or thing.func_name) Modified: pypy/dist/pypy/annotation/model.py ============================================================================== --- pypy/dist/pypy/annotation/model.py (original) +++ pypy/dist/pypy/annotation/model.py Tue May 24 23:41:17 2005 @@ -355,6 +355,9 @@ else: return s +def lltype_to_annotation(T): + return ll_to_annotation(T._example()) + # ____________________________________________________________ Modified: pypy/dist/pypy/rpython/lltype.py ============================================================================== --- pypy/dist/pypy/rpython/lltype.py (original) +++ pypy/dist/pypy/rpython/lltype.py Tue May 24 23:41:17 2005 @@ -45,7 +45,7 @@ class Struct(ContainerType): def __init__(self, name, *fields): - self._name = name + self._name = self.__name__ = name flds = {} names = [] self._arrayfld = None @@ -110,6 +110,7 @@ pass class Array(ContainerType): + __name__ = 'array' def __init__(self, *fields): self.OF = Struct("", *fields) if self.OF._arrayfld is not None: @@ -132,6 +133,7 @@ raise TypeError("cannot inline a GC array inside a structure") class FuncType(ContainerType): + __name__ = 'func' def __init__(self, args, result): for arg in args: if isinstance(arg, ContainerType): @@ -151,6 +153,7 @@ return _func(self, _callable=ex) class PyObjectType(ContainerType): + __name__ = 'PyObject' def __str__(self): return "PyObject" PyObject = PyObjectType() @@ -168,7 +171,7 @@ class Primitive(LowLevelType): def __init__(self, name, default): - self._name = name + self._name = self.__name__ = name self._default = default def __str__(self): @@ -188,6 +191,8 @@ class _PtrType(LowLevelType): + __name__ = property(lambda self: '%sPtr' % self.TO.__name__) + def __init__(self, TO, **flags): if not isinstance(TO, ContainerType): raise TypeError, ("can only point to a Container type, " Added: pypy/dist/pypy/rpython/rbuiltin.py ============================================================================== --- (empty file) +++ pypy/dist/pypy/rpython/rbuiltin.py Tue May 24 23:41:17 2005 @@ -0,0 +1,33 @@ +from pypy.annotation.pairtype import pair, pairtype +from pypy.annotation.model import SomeBuiltin +from pypy.rpython.lltype import malloc, Void, Signed +from pypy.rpython.rtyper import TyperError, peek_at_result_annotation +from pypy.rpython.rtyper import receiveconst, receive, direct_op + + +class __extend__(SomeBuiltin): + + def rtype_simple_call(s_blt, *args_s): + if not s_blt.is_constant(): + raise TyperError("non-constant built-in") + bltintyper = BUILTIN_TYPER[s_blt.const] + return bltintyper(*args_s) + +# ____________________________________________________________ + +def rtype_malloc(s_pbc_type, s_varlength=None): + assert s_pbc_type.is_constant() + v_type = receiveconst(Void, s_pbc_type.const) + s_result = peek_at_result_annotation() + if s_varlength is None: + return direct_op('malloc', [v_type], + resulttype = s_result.lowleveltype()) + else: + v_varlength = receive(Signed, arg=2) # NOTE, arg=0 is the s_blt above + return direct_op('malloc_varsize', [v_type, v_varlength], + resulttype = s_result.lowleveltype()) + + +BUILTIN_TYPER = { + malloc: rtype_malloc, + } Added: pypy/dist/pypy/rpython/rint.py ============================================================================== --- (empty file) +++ pypy/dist/pypy/rpython/rint.py Tue May 24 23:41:17 2005 @@ -0,0 +1,17 @@ +from pypy.annotation.pairtype import pair, pairtype +from pypy.annotation.model import SomeInteger +from pypy.rpython.lltype import Signed, Unsigned +from pypy.rpython.rtyper import peek_at_result_annotation, receive, direct_op + + +class __extend__(pairtype(SomeInteger, SomeInteger)): + + def rtype_add((s_int1, s_int2)): + if peek_at_result_annotation().unsigned: + v_int1 = receive(Unsigned, arg=0) + v_int2 = receive(Unsigned, arg=1) + return direct_op('uint_add', [v_int1, v_int2], resulttype=Unsigned) + else: + v_int1 = receive(Signed, arg=0) + v_int2 = receive(Signed, arg=1) + return direct_op('int_add', [v_int1, v_int2], resulttype=Signed) Modified: pypy/dist/pypy/rpython/rlist.py ============================================================================== --- pypy/dist/pypy/rpython/rlist.py (original) +++ pypy/dist/pypy/rpython/rlist.py Tue May 24 23:41:17 2005 @@ -1,67 +1,100 @@ -import py -from pypy.annotation.model import * +from pypy.annotation.pairtype import pair, pairtype +from pypy.annotation.model import SomeList, SomeInteger from pypy.rpython.lltype import * -from pypy.tool.sourcetools import compile_template +from pypy.rpython.rtyper import receive, receiveconst +from pypy.rpython.rtyper import peek_at_result_annotation, direct_call - -class ListType: - - def __init__(self, s_list): - assert isinstance(s_list, SomeList) - self.s_list = s_list - self.s_item = s_list.listdef.listitem.s_value - self.LIST = ForwardReference() - self.LISTPTR = GcPtr(self.LIST) - #self.ITEM = ... see below - - def define(self, typer): - self.ITEM = typer.annotation2concretetype(self.s_item) - LISTPTR = self.LISTPTR - LIST = self.LIST - ITEM = self.ITEM - LIST.become(GcStruct("list", - ("items", GcPtr(GcArray(('item', ITEM)))))) - - def getitem(l, i): - return l.items[i].item - - typer['getitem', self.s_list, SomeInteger()] = ( - getitem, LISTPTR, Signed, ITEM) - - def append(l, newitem): - length = len(l.items) - newitems = malloc(LIST.items.TO, length+1) - i = 0 - while i v1 = cast_flags(self) - # v2 = simple_call(v1, ...) --> v2 = simple_call(meth, v1, ...) - # - # where 'v1' becomes a pointer with the (method='method_name') flag. - # It points to 'self', but the flag modifies its meaning to - # "pointer to the method 'method_name' of self" instead of just - # "pointer to self". - # - method_name = pattern[0] - s_self = pattern[1] - method = substitution[0] - SELFPTR = substitution[1] - METHODPTR = SELFPTR.withflags(method=method_name) - s_method_name = self.annotator.bookkeeper.immutablevalue(method_name) - - self['getattr', s_self, s_method_name] = ( - 'cast_flags', SELFPTR, None, METHODPTR) - - s_method = s_self.find_method(method_name) - self[('simple_call', s_method) + pattern[2:]] = ( - method, SELFPTR) + substitution[2:] - - def maketype(self, cls, s_annotation): - try: - return self.typecache[cls, s_annotation] - except KeyError: - newtype = cls(s_annotation) - self.typecache[cls, s_annotation] = newtype - newtype.define(self) - return newtype - - def annotation2concretetype(self, s_value): - try: - return annotation_to_lltype(s_value) - except ValueError: - if isinstance(s_value, SomeList): - return self.maketype(ListType, s_value).LISTPTR - return PyObjPtr - - def convertvar(self, v, concretetype): - """Get the operation(s) needed to convert 'v' to the given type.""" - ops = [] - v_concretetype = getattr(v, 'concretetype', PyObjPtr) - if isinstance(v, Constant): - # we should never modify a Constant in-place - v = Constant(v.value) - v.concretetype = concretetype + self.annotator = annotator + self.specialized_ll_functions = {} - elif v_concretetype != concretetype: + def specialize(self): + """Main entry point: specialize all annotated blocks of the program.""" + # new blocks can be created as a result of specialize_block(), so + # we need to be careful about the loop here. + already_seen = {} + pending = self.annotator.annotated.keys() + while pending: + for block in pending: + if block.operations != (): + self.specialize_block(block) + already_seen[block] = True + pending = [block for block in self.annotator.annotated + if block not in already_seen] + + def setconcretetype(self, v): + assert isinstance(v, Variable) + s_value = self.annotator.binding(v, True) + if s_value is not None: + v.concretetype = s_value.lowleveltype() + + def enter_operation(self, op, newops): + TLS.rtyper = self + TLS.currentoperation = op + TLS.newops = newops + + def leave_operation(self): + del TLS.rtyper + del TLS.currentoperation + del TLS.newops + + def specialize_block(self, block): + # give the best possible types to the input args + for a in block.inputargs: + self.setconcretetype(a) + + # specialize all the operations, as far as possible + newops = [] + varmapping = {} + for op in block.operations: try: - subst = self.concreteconversions[v_concretetype, concretetype] - except KeyError: - raise TyperError("cannot convert from %r\n" - "to %r" % (v_concretetype, concretetype)) - vresult = Variable() - op = SpaceOperation('?', [v], vresult) - flatten_ops(self.substitute_op(op, subst), ops) - v = vresult - - return v, ops - - def specialized_op(self, op, bindings): - assert len(op.args) == len(bindings) - - # first check for direct low-level operations on pointers - if op.args and isinstance(bindings[0], SomePtr): - PTR = bindings[0].ll_ptrtype - - if op.opname == 'getitem': - s_result = self.annotator.binding(op.result) - T = annotation_to_lltype(s_result, 'getitem') - return self.typed_op(op, [PTR, Signed], T, - newopname='getarrayitem') - - if op.opname == 'len': - return self.typed_op(op, [PTR], Signed, - newopname='getarraysize') - - if op.opname == 'getattr': - assert isinstance(op.args[1], Constant) - s_result = self.annotator.binding(op.result) - FIELD_TYPE = PTR.TO._flds[op.args[1].value] - T = annotation_to_lltype(s_result, 'getattr') - if isinstance(FIELD_TYPE, ContainerType): - newopname = 'getsubstruct' - else: - newopname = 'getfield' - return self.typed_op(op, [PTR, Void], T, newopname=newopname) - - if op.opname == 'setattr': - assert isinstance(op.args[1], Constant) - FIELD_TYPE = PTR.TO._flds[op.args[1].value] - assert not isinstance(FIELD_TYPE, ContainerType) - return self.typed_op(op, [PTR, Void, FIELD_TYPE], Void, - newopname='setfield') - - if op.opname == 'eq': - return self.typed_op(op, [PTR, PTR], Bool, - newopname='ptr_eq') - if op.opname == 'ne': - return self.typed_op(op, [PTR, PTR], Bool, - newopname='ptr_ne') - - # generic specialization based on the registration table - patternlist = self.registry.get(op.opname, []) - for pattern, substitution in patternlist: - if pattern and pattern[-1] is Ellipsis: - pattern = pattern[:-1] - if len(pattern) > len(op.args): - continue - elif len(pattern) != len(op.args): - continue - for s_match, s_value in zip(pattern, bindings): - if not s_match.contains(s_value): - break - else: - # match! - try: - return self.substitute_op(op, substitution) - except Retry: - return self.specialized_op(op, bindings) - - # specialization not found - argtypes = [self.defaultconcretetype] * len(op.args) - return self.typed_op(op, argtypes, self.defaultconcretetype) - - def substitute_op(self, op, substitution): - if isinstance(substitution, tuple): - newopname = substitution[0] - argtypes = substitution[1:-1] - resulttype = substitution[-1] - assert len(argtypes) == len(op.args) - # None in the substitution list means "remove this argument" - while None in argtypes: - argtypes = list(argtypes) - i = argtypes.index(None) - del argtypes[i] args = list(op.args) - del args[i] - op = SpaceOperation(op.opname, args, op.result) - return self.typed_op(op, argtypes, resulttype, - newopname = newopname) - else: - assert callable(substitution), "type error in the registry tables" - return substitution(self, op) + bindings = [self.annotator.binding(a, True) for a in args] - def typed_op(self, op, argtypes, restype, newopname=None): - if isinstance(newopname, types.FunctionType): - python_function = newopname - newargs = [Constant(python_function)] + op.args - op = SpaceOperation('simple_call', newargs, op.result) + self.enter_operation(op, newops) + try: + self.consider_op(op, varmapping) + finally: + self.leave_operation() + + except TyperError, e: + e.where = (block, op) + raise + + block.operations[:] = newops + block.renamevariables(varmapping) + self.insert_link_conversions(block) + + def insert_link_conversions(self, block): + # insert the needed conversions on the links + can_insert_here = block.exitswitch is None and len(block.exits) == 1 + for link in block.exits: try: - functyp = python_function.TYPE - except AttributeError: - inputargs_s = [ll_to_annotation(t._example()) - for t in argtypes] - s_returnvalue = self.annotator.build_types(python_function, - inputargs_s) - inferred_type = annotation_to_lltype(s_returnvalue, - info=python_function) - if inferred_type != restype: - raise TyperError("%r return type mismatch:\n" - "declared %r\n" - "inferred %r" % (python_function, - inferred_type, restype)) - functyp = NonGcPtr(FuncType(argtypes, restype)) - python_function.TYPE = functyp - argtypes = [functyp] + list(argtypes) - newopname = None - return Specializer.typed_op(self, op, argtypes, restype, newopname) - - -def substitute_malloc(typer, op): - s_result = typer.annotator.binding(op.result) - T = annotation_to_lltype(s_result, 'malloc') - if len(op.args) == 2: - substitution = 'malloc', None, Void, T + for i in range(len(link.args)): + a1 = link.args[i] + ##if a1 in (link.last_exception, link.last_exc_value):# treated specially in gen_link + ## continue + a2 = link.target.inputargs[i] + s_a1 = self.annotator.binding(a1) + s_a2 = self.annotator.binding(a2) + if s_a1 == s_a2: + continue # no conversion needed + newops = [] + self.enter_operation(None, newops) + try: + a1 = self.convertvar(a1, s_a1, s_a2) + finally: + self.leave_operation() + if newops and not can_insert_here: + # cannot insert conversion operations around a single + # link, unless it is the only exit of this block. + # create a new block along the link... + newblock = insert_empty_block(self.annotator.translator, + link) + # ...and do the conversions there. + self.insert_link_conversions(newblock) + break # done with this link + else: + block.operations.extend(newops) + link.args[i] = a1 + except TyperError, e: + e.where = (block, link) + raise + + def consider_op(self, op, varmapping): + argcells = [self.annotator.binding(a) for a in op.args] + consider_meth = getattr(self, 'consider_op_'+op.opname) + resultvar = consider_meth(*argcells) + s_expected = self.annotator.binding(op.result) + if resultvar is None: + # no return value + if s_expected != annmodel.SomeImpossibleValue(): + raise TyperError("the annotator doesn't agree that '%s' " + "has no return value" % op.opname) + op.result.concretetype = Void + elif isinstance(resultvar, Variable): + # for simplicity of the consider_meth, resultvar is usually not + # op.result here. We have to replace resultvar with op.result + # in all generated operations. + varmapping[resultvar] = op.result + resulttype = resultvar.concretetype + op.result.concretetype = s_expected.lowleveltype() + if op.result.concretetype != resulttype: + raise TyperError("inconsistent type for the result of '%s':\n" + "annotator says %r\n" + " rtyper says %r" % (op.opname, + op.result.concretetype, + resulttype)) + else: + # consider_meth() can actually generate no operation and return + # a Constant. + if not s_expected.is_constant(): + raise TyperError("the annotator doesn't agree that '%s' " + "returns a constant" % op.opname) + if resultvar.value != s_expected.const: + raise TyperError("constant mismatch: %r vs %r" % ( + resultvar.value, s_expected.const)) + op.result.concretetype = s_expected.lowleveltype() + + # __________ regular operations __________ + + def _registeroperations(loc): + # All unary operations + for opname in annmodel.UNARY_OPERATIONS: + exec """ +def consider_op_%s(self, arg, *args): + return arg.rtype_%s(*args) +""" % (opname, opname) in globals(), loc + # All binary operations + for opname in annmodel.BINARY_OPERATIONS: + exec """ +def consider_op_%s(self, arg1, arg2, *args): + return pair(arg1,arg2).rtype_%s(*args) +""" % (opname, opname) in globals(), loc + + _registeroperations(locals()) + del _registeroperations + + # __________ irregular operations __________ + + def consider_op_newlist(self, *items_s): + return rlist.rtype_newlist(*items_s) + + +# ____________________________________________________________ +# +# Global helpers, working on the current operation (as stored in TLS) + +def _requestedtype(s_requested): + if isinstance(s_requested, LowLevelType): + lowleveltype = s_requested + s_requested = annmodel.lltype_to_annotation(lowleveltype) + elif isinstance(s_requested, annmodel.SomeObject): + lowleveltype = s_requested.lowleveltype() + else: + raise TypeError("SomeObject or LowLevelType expected, got %r" % ( + s_requested,)) + return s_requested, lowleveltype + +def receiveconst(s_requested, value): + """Return a Constant with the given value, of the requested type. + s_requested can be a SomeXxx annotation or a primitive low-level type. + """ + if isinstance(s_requested, LowLevelType): + lowleveltype = s_requested + else: + lowleveltype = s_requested.lowleveltype() + c = Constant(value) + c.concretetype = lowleveltype + return c + +def receive(s_requested, arg): + """Returns the arg'th input argument of the current operation, + as a Variable or Constant converted to the requested type. + s_requested can be a SomeXxx annotation or a primitive low-level type. + """ + v = TLS.currentoperation.args[arg] + if isinstance(v, Constant): + return receiveconst(s_requested, v.value) + + s_binding = TLS.rtyper.annotator.binding(v, True) + if s_binding is None: + s_binding = annmodel.SomeObject() + if s_binding.is_constant(): + return receiveconst(s_requested, s_binding.const) + + s_requested, lowleveltype = _requestedtype(s_requested) + return convertvar(v, s_binding, s_requested) + +def convertvar(v, s_from, s_to): + if s_from != s_to: + v = pair(s_from, s_to).rtype_convert_from_to(v) + return v + + +def peek_at_result_annotation(): + return TLS.rtyper.annotator.binding(TLS.currentoperation.result) + + +def direct_call(ll_function, *args_v): + annotator = TLS.rtyper.annotator + spec_key = [ll_function] + spec_name = [ll_function.func_name] + args_s = [] + for v in args_v: + s_value = annotator.binding(v, True) + if s_value is None: + s_value = annmodel.SomeObject() + if v.concretetype == Void: + if not s_value.is_constant(): + raise TyperError("non-constant variable of type Void") + key = s_value.const # specialize by constant value + args_s.append(s_value) + suffix = 'Const' + else: + key = v.concretetype # specialize by low-level type + args_s.append(annmodel.lltype_to_annotation(key)) + suffix = '' + spec_key.append(key) + spec_name.append(valid_identifier(getattr(key, '__name__', key))+suffix) + spec_key = tuple(spec_key) + try: + spec_function, resulttype = ( + TLS.rtyper.specialized_ll_functions[spec_key]) + except KeyError: + name = '_'.join(spec_name) + spec_function = func_with_new_name(ll_function, name) + # flow and annotate (the copy of) the low-level function + s_returnvalue = annotator.build_types(spec_function, args_s) + resulttype = annmodel.annotation_to_lltype(s_returnvalue, + "%s: " % ll_function.func_name) + # cache the result + TLS.rtyper.specialized_ll_functions[spec_key] = ( + spec_function, resulttype) + + # build the 'direct_call' operation + lltypes = [v.concretetype for v in args_v] + FT = FuncType(lltypes, resulttype) + c = Constant(functionptr(FT, ll_function.func_name, _callable=spec_function)) + c.concretetype = NonGcPtr(FT) + return direct_op('direct_call', [c]+list(args_v), resulttype=resulttype) + + +def direct_op(opname, args, resulttype=None): + v = Variable() + TLS.newops.append(SpaceOperation(opname, args, v)) + if resulttype is None: + v.concretetype = Void + return None else: - substitution = 'malloc_varsize', None, Void, Signed, T - return typer.substitute_op(op, substitution) + v.concretetype = resulttype + return v + + +# _______________________________________________________________________ +# this has the side-effect of registering the unary and binary operations +from pypy.rpython import robject, rlist, rptr, rbuiltin, rint Modified: pypy/dist/pypy/tool/sourcetools.py ============================================================================== --- pypy/dist/pypy/tool/sourcetools.py (original) +++ pypy/dist/pypy/tool/sourcetools.py Tue May 24 23:41:17 2005 @@ -221,5 +221,17 @@ f.func_dict.update(func.func_dict) return f else: - def func_with_new_name(func, newname): - return func + raise Exception("sorry, Python 2.2 not supported") + # because we need to return a new function object -- impossible in 2.2, + # cannot create functions with closures without using veeeery strange code + +PY_IDENTIFIER = ''.join([(('0' <= chr(i) <= '9' or + 'a' <= chr(i) <= 'z' or + 'A' <= chr(i) <= 'Z') and chr(i) or '_') + for i in range(256)]) + +def valid_identifier(stuff): + stuff = str(stuff).translate(PY_IDENTIFIER) + if not stuff or ('0' <= stuff[0] <= '9'): + stuff = '_' + stuff + return stuff From tismer at codespeak.net Wed May 25 01:01:40 2005 From: tismer at codespeak.net (tismer at codespeak.net) Date: Wed, 25 May 2005 01:01:40 +0200 (CEST) Subject: [pypy-svn] r12776 - pypy/dist/pypy/documentation Message-ID: <20050524230140.EAF3A27B56@code1.codespeak.net> Author: tismer Date: Wed May 25 01:01:40 2005 New Revision: 12776 Modified: pypy/dist/pypy/documentation/translation.txt Log: some preliminary docon _cache related stuff which shouldgo into gateway docu. Modified: pypy/dist/pypy/documentation/translation.txt ============================================================================== --- pypy/dist/pypy/documentation/translation.txt (original) +++ pypy/dist/pypy/documentation/translation.txt Wed May 25 01:01:40 2005 @@ -858,15 +858,15 @@ space.setitem(g3dict, gs_g, gfunc_g) return g3dict -You see that actually a single function is produced: 'initapp2interpexec'. This is the +You see that actually a single function is produced: ``initapp2interpexec``. This is the function that you will call with a space as argument. It defines a few functions and then does a number of initialization steps, builds the global objects the function need, -and produces the interface function gfunc_g to be called from interpreter level. +and produces the interface function ``gfunc_g`` to be called from interpreter level. The return value is ``g3dict``, which contains a module name and the function we asked for. Let's have a look at the body of this code: The first definition of ``g`` is just -for the argument parsing and is used as ``f_g`` in the gateway.interp2app. +for the argument parsing and is used as ``f_g`` in the ``gateway.interp2app``. We look at the second definition, ``fastf_g``, which does the actual computation. Comparing to the flowgraph from above_, you see a code block for every block in the graph. @@ -913,6 +913,30 @@ give a bit more speed. But this is a temporary format and will get optimized anyway when we produce the executable. +Interplevel Snippets in the Sources +----------------------------------- + +.. _`_exceptions.py`: http://codespeak.net/svn/pypy/dist/pypy/lib/_exceptions.py +.. _`_classobj.py`: http://codespeak.net/svn/pypy/dist/pypy/lib/_classobj.py + +Code written in application space can consist of complete files +to be translated (`_exceptions.py`_, `_classobj.py`_), or they +can be tiny snippets scattered all over a source file, similar +to our example from above. + +Translation of these snippets is done automatically and cached +in pypy/_cache with the modulename and the md5 checksum appended +to it as file name. If you have run your copy of pypy already, +this folder should exist and have some generated files in it. +These files consist of the generated code plus a little code +that auto-destructs the cached file (plus .pyc/.pyo versions) +if it is executed as __main__. On windows this means you can wipe +a cached code snippet clear by double-clicking it. Note also that +the auto-generated __init__.py file wipes the whole directory +when executed. + +XXX this should go into some interpreter.doc, where gateway should be explained + How it works ------------ From ludal at codespeak.net Wed May 25 01:10:28 2005 From: ludal at codespeak.net (ludal at codespeak.net) Date: Wed, 25 May 2005 01:10:28 +0200 (CEST) Subject: [pypy-svn] r12777 - in pypy/branch/pycompiler: interpreter module/recparser module/recparser/compiler Message-ID: <20050524231028.A7BF827B56@code1.codespeak.net> Author: ludal Date: Wed May 25 01:10:28 2005 New Revision: 12777 Modified: pypy/branch/pycompiler/interpreter/compiler.py pypy/branch/pycompiler/module/recparser/compiler/ast.py pypy/branch/pycompiler/module/recparser/compiler/astgen.py pypy/branch/pycompiler/module/recparser/compiler/symbols.py pypy/branch/pycompiler/module/recparser/compiler/visitor.py pypy/branch/pycompiler/module/recparser/pythonutil.py pypy/branch/pycompiler/module/recparser/tuplebuilder.py Log: * changed recparser/compiler/symbols and visitor to use a more 'standard' visitor pattern which should be closer to rpython * misc fixes * regenerate ast.py so that visit method accepts a variable number of arguments Modified: pypy/branch/pycompiler/interpreter/compiler.py ============================================================================== --- pypy/branch/pycompiler/interpreter/compiler.py (original) +++ pypy/branch/pycompiler/interpreter/compiler.py Wed May 25 01:10:28 2005 @@ -201,8 +201,8 @@ flags |= __future__.generators.compiler_flag # always on (2.2 compat) space = self.space try: - tree = # get the parse tree - gen = + tree = None # get the parse tree + gen = None # HACK use our parser instead of the CPython's one compat.transformer.parser = compat c = compat.pycompile(source, filename, mode, flags) Modified: pypy/branch/pycompiler/module/recparser/compiler/ast.py ============================================================================== --- pypy/branch/pycompiler/module/recparser/compiler/ast.py (original) +++ pypy/branch/pycompiler/module/recparser/compiler/ast.py Wed May 25 01:10:28 2005 @@ -31,12 +31,12 @@ return self.getChildren() def getChildNodes(self): pass # implemented by subclasses - def visit(self, visitor): - return visitor.visitNode(self) + def visit(self, visitor, *args): + return visitor.visitNode(self, *args) class EmptyNode(Node): - def visit(self, visitor): - return visitor.visitEmptyNode(self) + def visit(self, visitor, *args): + return visitor.visitEmptyNode(self, *args) class Expression(Node): # Expression is an artificial node class to support "eval" @@ -53,8 +53,8 @@ def __repr__(self): return "Expression(%s)" % (repr(self.node)) - def visit(self, visitor): - return visitor.visitExpression(self) + def visit(self, visitor, *args): + return visitor.visitExpression(self, *args) class Add(Node): def __init__(self, (left, right), lineno=None): @@ -71,8 +71,8 @@ def __repr__(self): return "Add((%s, %s))" % (repr(self.left), repr(self.right)) - def visit(self, visitor): - return visitor.visitAdd(self) + def visit(self, visitor, *args): + return visitor.visitAdd(self, *args) class And(Node): def __init__(self, nodes, lineno=None): @@ -90,8 +90,8 @@ def __repr__(self): return "And(%s)" % (repr(self.nodes),) - def visit(self, visitor): - return visitor.visitAnd(self) + def visit(self, visitor, *args): + return visitor.visitAnd(self, *args) class AssAttr(Node): def __init__(self, expr, attrname, flags, lineno=None): @@ -109,8 +109,8 @@ def __repr__(self): return "AssAttr(%s, %s, %s)" % (repr(self.expr), repr(self.attrname), repr(self.flags)) - def visit(self, visitor): - return visitor.visitAssAttr(self) + def visit(self, visitor, *args): + return visitor.visitAssAttr(self, *args) class AssList(Node): def __init__(self, nodes, lineno=None): @@ -128,8 +128,8 @@ def __repr__(self): return "AssList(%s)" % (repr(self.nodes),) - def visit(self, visitor): - return visitor.visitAssList(self) + def visit(self, visitor, *args): + return visitor.visitAssList(self, *args) class AssName(Node): def __init__(self, name, flags, lineno=None): @@ -146,8 +146,8 @@ def __repr__(self): return "AssName(%s, %s)" % (repr(self.name), repr(self.flags)) - def visit(self, visitor): - return visitor.visitAssName(self) + def visit(self, visitor, *args): + return visitor.visitAssName(self, *args) class AssTuple(Node): def __init__(self, nodes, lineno=None): @@ -165,8 +165,8 @@ def __repr__(self): return "AssTuple(%s)" % (repr(self.nodes),) - def visit(self, visitor): - return visitor.visitAssTuple(self) + def visit(self, visitor, *args): + return visitor.visitAssTuple(self, *args) class Assert(Node): def __init__(self, test, fail, lineno=None): @@ -190,8 +190,8 @@ def __repr__(self): return "Assert(%s, %s)" % (repr(self.test), repr(self.fail)) - def visit(self, visitor): - return visitor.visitAssert(self) + def visit(self, visitor, *args): + return visitor.visitAssert(self, *args) class Assign(Node): def __init__(self, nodes, expr, lineno=None): @@ -214,8 +214,8 @@ def __repr__(self): return "Assign(%s, %s)" % (repr(self.nodes), repr(self.expr)) - def visit(self, visitor): - return visitor.visitAssign(self) + def visit(self, visitor, *args): + return visitor.visitAssign(self, *args) class AugAssign(Node): def __init__(self, node, op, expr, lineno=None): @@ -233,8 +233,8 @@ def __repr__(self): return "AugAssign(%s, %s, %s)" % (repr(self.node), repr(self.op), repr(self.expr)) - def visit(self, visitor): - return visitor.visitAugAssign(self) + def visit(self, visitor, *args): + return visitor.visitAugAssign(self, *args) class Backquote(Node): def __init__(self, expr, lineno=None): @@ -250,8 +250,8 @@ def __repr__(self): return "Backquote(%s)" % (repr(self.expr),) - def visit(self, visitor): - return visitor.visitBackquote(self) + def visit(self, visitor, *args): + return visitor.visitBackquote(self, *args) class Bitand(Node): def __init__(self, nodes, lineno=None): @@ -269,8 +269,8 @@ def __repr__(self): return "Bitand(%s)" % (repr(self.nodes),) - def visit(self, visitor): - return visitor.visitBitand(self) + def visit(self, visitor, *args): + return visitor.visitBitand(self, *args) class Bitor(Node): def __init__(self, nodes, lineno=None): @@ -288,8 +288,8 @@ def __repr__(self): return "Bitor(%s)" % (repr(self.nodes),) - def visit(self, visitor): - return visitor.visitBitor(self) + def visit(self, visitor, *args): + return visitor.visitBitor(self, *args) class Bitxor(Node): def __init__(self, nodes, lineno=None): @@ -307,8 +307,8 @@ def __repr__(self): return "Bitxor(%s)" % (repr(self.nodes),) - def visit(self, visitor): - return visitor.visitBitxor(self) + def visit(self, visitor, *args): + return visitor.visitBitxor(self, *args) class Break(Node): def __init__(self, lineno=None): @@ -323,8 +323,8 @@ def __repr__(self): return "Break()" - def visit(self, visitor): - return visitor.visitBreak(self) + def visit(self, visitor, *args): + return visitor.visitBreak(self, *args) class CallFunc(Node): def __init__(self, node, args, star_args = None, dstar_args = None, lineno=None): @@ -355,8 +355,8 @@ def __repr__(self): return "CallFunc(%s, %s, %s, %s)" % (repr(self.node), repr(self.args), repr(self.star_args), repr(self.dstar_args)) - def visit(self, visitor): - return visitor.visitCallFunc(self) + def visit(self, visitor, *args): + return visitor.visitCallFunc(self, *args) class Class(Node): def __init__(self, name, bases, doc, code, lineno=None): @@ -383,8 +383,8 @@ def __repr__(self): return "Class(%s, %s, %s, %s)" % (repr(self.name), repr(self.bases), repr(self.doc), repr(self.code)) - def visit(self, visitor): - return visitor.visitClass(self) + def visit(self, visitor, *args): + return visitor.visitClass(self, *args) class Compare(Node): def __init__(self, expr, ops, lineno=None): @@ -407,8 +407,8 @@ def __repr__(self): return "Compare(%s, %s)" % (repr(self.expr), repr(self.ops)) - def visit(self, visitor): - return visitor.visitCompare(self) + def visit(self, visitor, *args): + return visitor.visitCompare(self, *args) class Const(Node): def __init__(self, value, lineno=None): @@ -424,8 +424,8 @@ def __repr__(self): return "Const(%s)" % (repr(self.value),) - def visit(self, visitor): - return visitor.visitConst(self) + def visit(self, visitor, *args): + return visitor.visitConst(self, *args) class Continue(Node): def __init__(self, lineno=None): @@ -440,8 +440,8 @@ def __repr__(self): return "Continue()" - def visit(self, visitor): - return visitor.visitContinue(self) + def visit(self, visitor, *args): + return visitor.visitContinue(self, *args) class Decorators(Node): def __init__(self, nodes, lineno=None): @@ -459,8 +459,8 @@ def __repr__(self): return "Decorators(%s)" % (repr(self.nodes),) - def visit(self, visitor): - return visitor.visitDecorators(self) + def visit(self, visitor, *args): + return visitor.visitDecorators(self, *args) class Dict(Node): def __init__(self, items, lineno=None): @@ -478,8 +478,8 @@ def __repr__(self): return "Dict(%s)" % (repr(self.items),) - def visit(self, visitor): - return visitor.visitDict(self) + def visit(self, visitor, *args): + return visitor.visitDict(self, *args) class Discard(Node): def __init__(self, expr, lineno=None): @@ -495,8 +495,8 @@ def __repr__(self): return "Discard(%s)" % (repr(self.expr),) - def visit(self, visitor): - return visitor.visitDiscard(self) + def visit(self, visitor, *args): + return visitor.visitDiscard(self, *args) class Div(Node): def __init__(self, (left, right), lineno=None): @@ -513,8 +513,8 @@ def __repr__(self): return "Div((%s, %s))" % (repr(self.left), repr(self.right)) - def visit(self, visitor): - return visitor.visitDiv(self) + def visit(self, visitor, *args): + return visitor.visitDiv(self, *args) class Ellipsis(Node): def __init__(self, lineno=None): @@ -529,8 +529,8 @@ def __repr__(self): return "Ellipsis()" - def visit(self, visitor): - return visitor.visitEllipsis(self) + def visit(self, visitor, *args): + return visitor.visitEllipsis(self, *args) class Exec(Node): def __init__(self, expr, locals, globals, lineno=None): @@ -558,8 +558,8 @@ def __repr__(self): return "Exec(%s, %s, %s)" % (repr(self.expr), repr(self.locals), repr(self.globals)) - def visit(self, visitor): - return visitor.visitExec(self) + def visit(self, visitor, *args): + return visitor.visitExec(self, *args) class FloorDiv(Node): def __init__(self, (left, right), lineno=None): @@ -576,8 +576,8 @@ def __repr__(self): return "FloorDiv((%s, %s))" % (repr(self.left), repr(self.right)) - def visit(self, visitor): - return visitor.visitFloorDiv(self) + def visit(self, visitor, *args): + return visitor.visitFloorDiv(self, *args) class For(Node): def __init__(self, assign, list, body, else_, lineno=None): @@ -607,8 +607,8 @@ def __repr__(self): return "For(%s, %s, %s, %s)" % (repr(self.assign), repr(self.list), repr(self.body), repr(self.else_)) - def visit(self, visitor): - return visitor.visitFor(self) + def visit(self, visitor, *args): + return visitor.visitFor(self, *args) class From(Node): def __init__(self, modname, names, lineno=None): @@ -625,8 +625,8 @@ def __repr__(self): return "From(%s, %s)" % (repr(self.modname), repr(self.names)) - def visit(self, visitor): - return visitor.visitFrom(self) + def visit(self, visitor, *args): + return visitor.visitFrom(self, *args) class Function(Node): def __init__(self, decorators, name, argnames, defaults, flags, doc, code, lineno=None): @@ -668,8 +668,8 @@ def __repr__(self): return "Function(%s, %s, %s, %s, %s, %s, %s)" % (repr(self.decorators), repr(self.name), repr(self.argnames), repr(self.defaults), repr(self.flags), repr(self.doc), repr(self.code)) - def visit(self, visitor): - return visitor.visitFunction(self) + def visit(self, visitor, *args): + return visitor.visitFunction(self, *args) class GenExpr(Node): def __init__(self, code, lineno=None): @@ -689,8 +689,8 @@ def __repr__(self): return "GenExpr(%s)" % (repr(self.code),) - def visit(self, visitor): - return visitor.visitGenExpr(self) + def visit(self, visitor, *args): + return visitor.visitGenExpr(self, *args) class GenExprFor(Node): def __init__(self, assign, iter, ifs, lineno=None): @@ -718,8 +718,8 @@ def __repr__(self): return "GenExprFor(%s, %s, %s)" % (repr(self.assign), repr(self.iter), repr(self.ifs)) - def visit(self, visitor): - return visitor.visitGenExprFor(self) + def visit(self, visitor, *args): + return visitor.visitGenExprFor(self, *args) class GenExprIf(Node): def __init__(self, test, lineno=None): @@ -735,8 +735,8 @@ def __repr__(self): return "GenExprIf(%s)" % (repr(self.test),) - def visit(self, visitor): - return visitor.visitGenExprIf(self) + def visit(self, visitor, *args): + return visitor.visitGenExprIf(self, *args) class GenExprInner(Node): def __init__(self, expr, quals, lineno=None): @@ -759,8 +759,8 @@ def __repr__(self): return "GenExprInner(%s, %s)" % (repr(self.expr), repr(self.quals)) - def visit(self, visitor): - return visitor.visitGenExprInner(self) + def visit(self, visitor, *args): + return visitor.visitGenExprInner(self, *args) class Getattr(Node): def __init__(self, expr, attrname, lineno=None): @@ -777,8 +777,8 @@ def __repr__(self): return "Getattr(%s, %s)" % (repr(self.expr), repr(self.attrname)) - def visit(self, visitor): - return visitor.visitGetattr(self) + def visit(self, visitor, *args): + return visitor.visitGetattr(self, *args) class Global(Node): def __init__(self, names, lineno=None): @@ -794,8 +794,8 @@ def __repr__(self): return "Global(%s)" % (repr(self.names),) - def visit(self, visitor): - return visitor.visitGlobal(self) + def visit(self, visitor, *args): + return visitor.visitGlobal(self, *args) class If(Node): def __init__(self, tests, else_, lineno=None): @@ -819,8 +819,8 @@ def __repr__(self): return "If(%s, %s)" % (repr(self.tests), repr(self.else_)) - def visit(self, visitor): - return visitor.visitIf(self) + def visit(self, visitor, *args): + return visitor.visitIf(self, *args) class Import(Node): def __init__(self, names, lineno=None): @@ -836,8 +836,8 @@ def __repr__(self): return "Import(%s)" % (repr(self.names),) - def visit(self, visitor): - return visitor.visitImport(self) + def visit(self, visitor, *args): + return visitor.visitImport(self, *args) class Invert(Node): def __init__(self, expr, lineno=None): @@ -853,8 +853,8 @@ def __repr__(self): return "Invert(%s)" % (repr(self.expr),) - def visit(self, visitor): - return visitor.visitInvert(self) + def visit(self, visitor, *args): + return visitor.visitInvert(self, *args) class Keyword(Node): def __init__(self, name, expr, lineno=None): @@ -871,8 +871,8 @@ def __repr__(self): return "Keyword(%s, %s)" % (repr(self.name), repr(self.expr)) - def visit(self, visitor): - return visitor.visitKeyword(self) + def visit(self, visitor, *args): + return visitor.visitKeyword(self, *args) class Lambda(Node): def __init__(self, argnames, defaults, flags, code, lineno=None): @@ -906,8 +906,8 @@ def __repr__(self): return "Lambda(%s, %s, %s, %s)" % (repr(self.argnames), repr(self.defaults), repr(self.flags), repr(self.code)) - def visit(self, visitor): - return visitor.visitLambda(self) + def visit(self, visitor, *args): + return visitor.visitLambda(self, *args) class LeftShift(Node): def __init__(self, (left, right), lineno=None): @@ -924,8 +924,8 @@ def __repr__(self): return "LeftShift((%s, %s))" % (repr(self.left), repr(self.right)) - def visit(self, visitor): - return visitor.visitLeftShift(self) + def visit(self, visitor, *args): + return visitor.visitLeftShift(self, *args) class List(Node): def __init__(self, nodes, lineno=None): @@ -943,8 +943,8 @@ def __repr__(self): return "List(%s)" % (repr(self.nodes),) - def visit(self, visitor): - return visitor.visitList(self) + def visit(self, visitor, *args): + return visitor.visitList(self, *args) class ListComp(Node): def __init__(self, expr, quals, lineno=None): @@ -967,8 +967,8 @@ def __repr__(self): return "ListComp(%s, %s)" % (repr(self.expr), repr(self.quals)) - def visit(self, visitor): - return visitor.visitListComp(self) + def visit(self, visitor, *args): + return visitor.visitListComp(self, *args) class ListCompFor(Node): def __init__(self, assign, list, ifs, lineno=None): @@ -994,8 +994,8 @@ def __repr__(self): return "ListCompFor(%s, %s, %s)" % (repr(self.assign), repr(self.list), repr(self.ifs)) - def visit(self, visitor): - return visitor.visitListCompFor(self) + def visit(self, visitor, *args): + return visitor.visitListCompFor(self, *args) class ListCompIf(Node): def __init__(self, test, lineno=None): @@ -1011,8 +1011,8 @@ def __repr__(self): return "ListCompIf(%s)" % (repr(self.test),) - def visit(self, visitor): - return visitor.visitListCompIf(self) + def visit(self, visitor, *args): + return visitor.visitListCompIf(self, *args) class Mod(Node): def __init__(self, (left, right), lineno=None): @@ -1029,8 +1029,8 @@ def __repr__(self): return "Mod((%s, %s))" % (repr(self.left), repr(self.right)) - def visit(self, visitor): - return visitor.visitMod(self) + def visit(self, visitor, *args): + return visitor.visitMod(self, *args) class Module(Node): def __init__(self, doc, node, lineno=None): @@ -1047,8 +1047,8 @@ def __repr__(self): return "Module(%s, %s)" % (repr(self.doc), repr(self.node)) - def visit(self, visitor): - return visitor.visitModule(self) + def visit(self, visitor, *args): + return visitor.visitModule(self, *args) class Mul(Node): def __init__(self, (left, right), lineno=None): @@ -1065,8 +1065,8 @@ def __repr__(self): return "Mul((%s, %s))" % (repr(self.left), repr(self.right)) - def visit(self, visitor): - return visitor.visitMul(self) + def visit(self, visitor, *args): + return visitor.visitMul(self, *args) class Name(Node): def __init__(self, name, lineno=None): @@ -1082,8 +1082,8 @@ def __repr__(self): return "Name(%s)" % (repr(self.name),) - def visit(self, visitor): - return visitor.visitName(self) + def visit(self, visitor, *args): + return visitor.visitName(self, *args) class Not(Node): def __init__(self, expr, lineno=None): @@ -1099,8 +1099,8 @@ def __repr__(self): return "Not(%s)" % (repr(self.expr),) - def visit(self, visitor): - return visitor.visitNot(self) + def visit(self, visitor, *args): + return visitor.visitNot(self, *args) class Or(Node): def __init__(self, nodes, lineno=None): @@ -1118,8 +1118,8 @@ def __repr__(self): return "Or(%s)" % (repr(self.nodes),) - def visit(self, visitor): - return visitor.visitOr(self) + def visit(self, visitor, *args): + return visitor.visitOr(self, *args) class Pass(Node): def __init__(self, lineno=None): @@ -1134,8 +1134,8 @@ def __repr__(self): return "Pass()" - def visit(self, visitor): - return visitor.visitPass(self) + def visit(self, visitor, *args): + return visitor.visitPass(self, *args) class Power(Node): def __init__(self, (left, right), lineno=None): @@ -1152,8 +1152,8 @@ def __repr__(self): return "Power((%s, %s))" % (repr(self.left), repr(self.right)) - def visit(self, visitor): - return visitor.visitPower(self) + def visit(self, visitor, *args): + return visitor.visitPower(self, *args) class Print(Node): def __init__(self, nodes, dest, lineno=None): @@ -1177,8 +1177,8 @@ def __repr__(self): return "Print(%s, %s)" % (repr(self.nodes), repr(self.dest)) - def visit(self, visitor): - return visitor.visitPrint(self) + def visit(self, visitor, *args): + return visitor.visitPrint(self, *args) class Printnl(Node): def __init__(self, nodes, dest, lineno=None): @@ -1202,8 +1202,8 @@ def __repr__(self): return "Printnl(%s, %s)" % (repr(self.nodes), repr(self.dest)) - def visit(self, visitor): - return visitor.visitPrintnl(self) + def visit(self, visitor, *args): + return visitor.visitPrintnl(self, *args) class Raise(Node): def __init__(self, expr1, expr2, expr3, lineno=None): @@ -1232,8 +1232,8 @@ def __repr__(self): return "Raise(%s, %s, %s)" % (repr(self.expr1), repr(self.expr2), repr(self.expr3)) - def visit(self, visitor): - return visitor.visitRaise(self) + def visit(self, visitor, *args): + return visitor.visitRaise(self, *args) class Return(Node): def __init__(self, value, lineno=None): @@ -1249,8 +1249,8 @@ def __repr__(self): return "Return(%s)" % (repr(self.value),) - def visit(self, visitor): - return visitor.visitReturn(self) + def visit(self, visitor, *args): + return visitor.visitReturn(self, *args) class RightShift(Node): def __init__(self, (left, right), lineno=None): @@ -1267,8 +1267,8 @@ def __repr__(self): return "RightShift((%s, %s))" % (repr(self.left), repr(self.right)) - def visit(self, visitor): - return visitor.visitRightShift(self) + def visit(self, visitor, *args): + return visitor.visitRightShift(self, *args) class Slice(Node): def __init__(self, expr, flags, lower, upper, lineno=None): @@ -1298,8 +1298,8 @@ def __repr__(self): return "Slice(%s, %s, %s, %s)" % (repr(self.expr), repr(self.flags), repr(self.lower), repr(self.upper)) - def visit(self, visitor): - return visitor.visitSlice(self) + def visit(self, visitor, *args): + return visitor.visitSlice(self, *args) class Sliceobj(Node): def __init__(self, nodes, lineno=None): @@ -1317,8 +1317,8 @@ def __repr__(self): return "Sliceobj(%s)" % (repr(self.nodes),) - def visit(self, visitor): - return visitor.visitSliceobj(self) + def visit(self, visitor, *args): + return visitor.visitSliceobj(self, *args) class Stmt(Node): def __init__(self, nodes, lineno=None): @@ -1336,8 +1336,8 @@ def __repr__(self): return "Stmt(%s)" % (repr(self.nodes),) - def visit(self, visitor): - return visitor.visitStmt(self) + def visit(self, visitor, *args): + return visitor.visitStmt(self, *args) class Sub(Node): def __init__(self, (left, right), lineno=None): @@ -1354,8 +1354,8 @@ def __repr__(self): return "Sub((%s, %s))" % (repr(self.left), repr(self.right)) - def visit(self, visitor): - return visitor.visitSub(self) + def visit(self, visitor, *args): + return visitor.visitSub(self, *args) class Subscript(Node): def __init__(self, expr, flags, subs, lineno=None): @@ -1380,8 +1380,8 @@ def __repr__(self): return "Subscript(%s, %s, %s)" % (repr(self.expr), repr(self.flags), repr(self.subs)) - def visit(self, visitor): - return visitor.visitSubscript(self) + def visit(self, visitor, *args): + return visitor.visitSubscript(self, *args) class TryExcept(Node): def __init__(self, body, handlers, else_, lineno=None): @@ -1408,8 +1408,8 @@ def __repr__(self): return "TryExcept(%s, %s, %s)" % (repr(self.body), repr(self.handlers), repr(self.else_)) - def visit(self, visitor): - return visitor.visitTryExcept(self) + def visit(self, visitor, *args): + return visitor.visitTryExcept(self, *args) class TryFinally(Node): def __init__(self, body, final, lineno=None): @@ -1426,8 +1426,8 @@ def __repr__(self): return "TryFinally(%s, %s)" % (repr(self.body), repr(self.final)) - def visit(self, visitor): - return visitor.visitTryFinally(self) + def visit(self, visitor, *args): + return visitor.visitTryFinally(self, *args) class Tuple(Node): def __init__(self, nodes, lineno=None): @@ -1445,8 +1445,8 @@ def __repr__(self): return "Tuple(%s)" % (repr(self.nodes),) - def visit(self, visitor): - return visitor.visitTuple(self) + def visit(self, visitor, *args): + return visitor.visitTuple(self, *args) class UnaryAdd(Node): def __init__(self, expr, lineno=None): @@ -1462,8 +1462,8 @@ def __repr__(self): return "UnaryAdd(%s)" % (repr(self.expr),) - def visit(self, visitor): - return visitor.visitUnaryAdd(self) + def visit(self, visitor, *args): + return visitor.visitUnaryAdd(self, *args) class UnarySub(Node): def __init__(self, expr, lineno=None): @@ -1479,8 +1479,8 @@ def __repr__(self): return "UnarySub(%s)" % (repr(self.expr),) - def visit(self, visitor): - return visitor.visitUnarySub(self) + def visit(self, visitor, *args): + return visitor.visitUnarySub(self, *args) class While(Node): def __init__(self, test, body, else_, lineno=None): @@ -1507,8 +1507,8 @@ def __repr__(self): return "While(%s, %s, %s)" % (repr(self.test), repr(self.body), repr(self.else_)) - def visit(self, visitor): - return visitor.visitWhile(self) + def visit(self, visitor, *args): + return visitor.visitWhile(self, *args) class Yield(Node): def __init__(self, value, lineno=None): @@ -1524,8 +1524,8 @@ def __repr__(self): return "Yield(%s)" % (repr(self.value),) - def visit(self, visitor): - return visitor.visitYield(self) + def visit(self, visitor, *args): + return visitor.visitYield(self, *args) for name, obj in globals().items(): if isinstance(obj, type) and issubclass(obj, Node): Modified: pypy/branch/pycompiler/module/recparser/compiler/astgen.py ============================================================================== --- pypy/branch/pycompiler/module/recparser/compiler/astgen.py (original) +++ pypy/branch/pycompiler/module/recparser/compiler/astgen.py Wed May 25 01:10:28 2005 @@ -192,8 +192,8 @@ print >> buf, ' return "%s()"' % self.name def _gen_visit(self, buf): - print >> buf, " def visit(self, visitor):" - print >> buf, " return visitor.visit%s(self)" % self.name + print >> buf, " def visit(self, visitor, *args):" + print >> buf, " return visitor.visit%s(self, *args)" % self.name rx_init = re.compile('init\((.*)\):') Modified: pypy/branch/pycompiler/module/recparser/compiler/symbols.py ============================================================================== --- pypy/branch/pycompiler/module/recparser/compiler/symbols.py (original) +++ pypy/branch/pycompiler/module/recparser/compiler/symbols.py Wed May 25 01:10:28 2005 @@ -216,7 +216,7 @@ # node that define new scopes - def visitModule(self, node): + def visitModule(self, node ): scope = self.module = self.scopes[node] = ModuleScope() self.visit(node.node, scope) Modified: pypy/branch/pycompiler/module/recparser/compiler/visitor.py ============================================================================== --- pypy/branch/pycompiler/module/recparser/compiler/visitor.py (original) +++ pypy/branch/pycompiler/module/recparser/compiler/visitor.py Wed May 25 01:10:28 2005 @@ -123,7 +123,7 @@ def default(self, node, *args): for child in node.getChildNodes(): - self.dispatch(child, *args) + child.visit(self, *args) def __getattr__(self, name ): return self.default Modified: pypy/branch/pycompiler/module/recparser/pythonutil.py ============================================================================== --- pypy/branch/pycompiler/module/recparser/pythonutil.py (original) +++ pypy/branch/pycompiler/module/recparser/pythonutil.py Wed May 25 01:10:28 2005 @@ -15,7 +15,6 @@ tp2 = parser.suite(pyf.read()) return tp2.totuple() - import symbol def pypy_parse(filename): """parse using PyPy's parser module and return nested tuples @@ -42,12 +41,16 @@ def ast_file_input( filename ): pyf = file(filename,"r") text = pyf.read() + return ast_srcfile_input( text, filename ) + +def ast_srcfile_input( srctext, filename ): + # TODO do something with the filename builder = TupleBuilder( PYTHON_PARSER.rules ) - pythonparse.parse_python_source( text, PYTHON_PARSER, "file_input", builder ) + pythonparse.parse_python_source( srctext, PYTHON_PARSER, "file_input", builder ) tree = builder.stack[-1] trans = Transformer() ast = trans.transform( tree ) - return ast, tree + return ast def ast_eval_input( textsrc ): builder = TupleBuilder( PYTHON_PARSER.rules ) Modified: pypy/branch/pycompiler/module/recparser/tuplebuilder.py ============================================================================== --- pypy/branch/pycompiler/module/recparser/tuplebuilder.py (original) +++ pypy/branch/pycompiler/module/recparser/tuplebuilder.py Wed May 25 01:10:28 2005 @@ -21,7 +21,7 @@ class TupleBuilder(BaseGrammarBuilder): """A builder that directly produce the AST""" - def __init__( self, rules=None, debug=0, lineno=False ): + def __init__( self, rules=None, debug=0, lineno=True ): BaseGrammarBuilder.__init__(self, rules, debug ) self.lineno = lineno From tismer at codespeak.net Wed May 25 01:14:40 2005 From: tismer at codespeak.net (tismer at codespeak.net) Date: Wed, 25 May 2005 01:14:40 +0200 (CEST) Subject: [pypy-svn] r12778 - pypy/dist/pypy/translator/c Message-ID: <20050524231440.82E7827B56@code1.codespeak.net> Author: tismer Date: Wed May 25 01:14:40 2005 New Revision: 12778 Modified: pypy/dist/pypy/translator/c/pyobj.py Log: NameManager is unused Modified: pypy/dist/pypy/translator/c/pyobj.py ============================================================================== --- pypy/dist/pypy/translator/c/pyobj.py (original) +++ pypy/dist/pypy/translator/c/pyobj.py Wed May 25 01:14:40 2005 @@ -3,7 +3,7 @@ from types import FunctionType, CodeType, InstanceType, ClassType from pypy.objspace.flow.model import Variable, Constant -from pypy.translator.gensupp import builtin_base, NameManager +from pypy.translator.gensupp import builtin_base from pypy.rpython.rarithmetic import r_int, r_uint from pypy.rpython.lltype import pyobjectptr From tismer at codespeak.net Wed May 25 01:26:05 2005 From: tismer at codespeak.net (tismer at codespeak.net) Date: Wed, 25 May 2005 01:26:05 +0200 (CEST) Subject: [pypy-svn] r12779 - pypy/dist/pypy/translator/c Message-ID: <20050524232605.4B03B27B56@code1.codespeak.net> Author: tismer Date: Wed May 25 01:26:05 2005 New Revision: 12779 Modified: pypy/dist/pypy/translator/c/pyobj.py Log: added unicode support btw.: I'm going to abuse this module for pickling. This is temporary and intentional, just to trigger considering, that this module is not unique to C, but a general base thing. Modified: pypy/dist/pypy/translator/c/pyobj.py ============================================================================== --- pypy/dist/pypy/translator/c/pyobj.py (original) +++ pypy/dist/pypy/translator/c/pyobj.py Wed May 25 01:26:05 2005 @@ -116,14 +116,11 @@ def nameof_str(self, value): name = self.uniquename('gstr_' + value[:32]) -## if [c for c in value if c<' ' or c>'~' or c=='"' or c=='\\']: -## # non-printable string -## s = 'chr_%s' % name -## self.globaldecl.append('static char %s[] = { %s };' % ( -## s, ', '.join(['%d' % ord(c) for c in value]))) -## else: -## # printable string -## s = '"%s"' % value + self.initcode_python(name, repr(value)) + return name + + def nameof_unicode(self, value): + name = self.uniquename('guni_' + str(value[:32])) self.initcode_python(name, repr(value)) return name From tismer at codespeak.net Wed May 25 01:39:46 2005 From: tismer at codespeak.net (tismer at codespeak.net) Date: Wed, 25 May 2005 01:39:46 +0200 (CEST) Subject: [pypy-svn] r12780 - in pypy/dist/pypy/translator/pickle: . attic Message-ID: <20050524233946.87EAC27B56@code1.codespeak.net> Author: tismer Date: Wed May 25 01:39:46 2005 New Revision: 12780 Added: pypy/dist/pypy/translator/pickle/ pypy/dist/pypy/translator/pickle/attic/ pypy/dist/pypy/translator/pickle/attic/genpickle.py (contents, props changed) Log: trashing first attempts of pickling just for reference. It is *soo* much simpler if we re-use what we have... Added: pypy/dist/pypy/translator/pickle/attic/genpickle.py ============================================================================== --- (empty file) +++ pypy/dist/pypy/translator/pickle/attic/genpickle.py Wed May 25 01:39:46 2005 @@ -0,0 +1,108 @@ +"""Flow Graph Pickling + +This file contains the necessary plumbing for pickle.py + +note that cPickle respected copy_reg for local since +a long time. Pickle still seems to ignore it. +""" + +from pickle import Pickler, loads, dumps, PicklingError +from types import * +import copy_reg +from copy_reg import dispatch_table + +# taken from Stackless' pickle correction patch: +if 1: + def save_function(self, obj): + print "SAVE_GLOB:", obj + try: + return self.save_global(obj) + except PicklingError, e: + print e + pass + # Check copy_reg.dispatch_table + reduce = dispatch_table.get(type(obj)) + if reduce: + rv = reduce(obj) + else: + # Check for a __reduce_ex__ method, fall back to __reduce__ + reduce = getattr(obj, "__reduce_ex__", None) + if reduce: + rv = reduce(self.proto) + else: + reduce = getattr(obj, "__reduce__", None) + if reduce: + rv = reduce() + else: + raise e + return self.save_reduce(obj=obj, *rv) + +def run_patched(func, *args, **kwds): + dispatch = Pickler.dispatch + hold = dispatch[FunctionType] + table = dispatch_table.copy() + try: + dispatch[FunctionType] = save_global_fallback + copy_reg.pickle(FunctionType, func_reduce) + return func(*args, **kwds) + finally: + dispatch[FunctionType] = hold + dispatch_table.clear() + dispatch_table.update(table) + +def func_reduce(f): + print "FUNC:", f, f.func_globals.get(__name__, "NAME?") + print "class_:", getattr(f,"class_", None) + global hack + hack = f + #if hasattr(f, 'class_'): + # return (func_class_restore, (f.class_, f.__name__)) + return (func_restore, (f.func_code, f.func_globals and {}, + f.func_name, f.func_defaults, + ()and f.func_closure),)##!! f.func_dict) + +def builtin_meth_reduce(m): + print "BUILTIN METH:", m + return (builtin_meth_restore, (m.__name__, m.__self__)) + +def builtin_meth_restore(name, obj): + return getattr(obj, name) + +def func_class_restore(klass, name): + return getattr(klass, name).im_func + +def func_restore(*args): + # general fallback + return FunctionType(*args) + +def code_reduce(c): + return (code_restore, (c.co_argcount, c.co_nlocals, c.co_stacksize, + c.co_flags, c.co_code, c.co_consts, c.co_names, + c.co_varnames, c.co_filename, c.co_name, + c.co_firstlineno, c.co_lnotab, c.co_freevars, + c.co_cellvars) ) + +def code_restore(*args): + return CodeType(*args) + +class dummy: pass + +type_registry = { + FunctionType: lambda:1, + NoneType: None, + ClassType: dummy, + } + +def type_reduce(t): + try: + return type_restore, (type_registry[t],) + except KeyError: + print 79*"_" + raise PicklingError, "cannot reduce type %r" % t + +def type_restore(*args): + return type(args[0]) + +def mydumps(*args, **kwds): + return run_patched(dumps, *args, **kwds) + From tismer at codespeak.net Wed May 25 05:35:38 2005 From: tismer at codespeak.net (tismer at codespeak.net) Date: Wed, 25 May 2005 05:35:38 +0200 (CEST) Subject: [pypy-svn] r12781 - pypy/dist/pypy/translator/pickle Message-ID: <20050525033538.94FE927B5B@code1.codespeak.net> Author: tismer Date: Wed May 25 05:35:38 2005 New Revision: 12781 Added: pypy/dist/pypy/translator/pickle/__init__.py pypy/dist/pypy/translator/pickle/genpickle.py Log: a nearly working pickling solution, with almost no new code appended. It is great if we can re-use, avoiding maintanence of principles which we don't really need (lick the pickleprotocol). Needs a bit more plus tests... Added: pypy/dist/pypy/translator/pickle/__init__.py ============================================================================== Added: pypy/dist/pypy/translator/pickle/genpickle.py ============================================================================== --- (empty file) +++ pypy/dist/pypy/translator/pickle/genpickle.py Wed May 25 05:35:38 2005 @@ -0,0 +1,134 @@ +""" +Generate a Python source file from the flowmodel. +The purpose is to create something that allows +to restart code generation after flowing and maybe +annotation. +""" +import autopath, os +from pypy.objspace.flow.model import Constant, Variable, Block, Link +from pypy.objspace.flow.flowcontext import SpamBlock, EggBlock +from pypy.objspace.flow.model import SpaceOperation, FunctionGraph + +from pypy.tool.tls import tlsobject +from pypy.translator.gensupp import uniquemodulename, NameManager + +from pypy.translator.c.pyobj import PyObjMaker + +# XXX the latter import is temporary. +# I think we will refactor again and +# put a slightly more general module +# into ./.. + +# ____________________________________________________________ + + +class GenPickle(PyObjMaker): + + def __init__(self, translator): + self.translator = translator + PyObjMaker.__init__(self, NameManager(), None) + self.initcode.append("""\ +from pypy.objspace.flow.model import Constant, Variable, Block, Link +from pypy.objspace.flow.model import SpaceOperation, FunctionGraph +from pypy.translator.translator import Translator""") + + def nameof(self, obj): + try: + return self.dispatch[type(obj)](self, obj) + except KeyError: + return self.computenameof(obj) + + def computenameof(self, obj): + # XXX PyObjMaker should probably be less greedy + if type(obj) in self.dispatch: + return self.dispatch[type(obj)](self, obj) + return PyObjMaker.computenameof(self, obj) + + dispatch = {} + + def nameof_Constant(self, obj): + name = self.uniquename("gcon") + value = self.nameof(obj.value) + self.initcode.append("%s = Constant(%s)" % (name, value)) + if hasattr(obj, "concretetype"): + concrete = self.nameof(obj.concretetype) + self.initcode.append("%s.concretetype=%s" % (name, concrete)) + return name + dispatch[Constant] = nameof_Constant + + def nameof_Variable(self, obj): + name = self.uniquename("gvar") + self.initcode.append("%s = Variable(%r)" % (name, obj.name)) + if hasattr(obj, "concretetype"): + concrete = self.nameof(obj.concretetype) + self.initcode.append("%s.concretetype=%s" % (name, concrete)) + return name + dispatch[Variable] = nameof_Variable + + def nameof_Link(self, obj): + name = self.uniquename("glink") + args = self.nameof(obj.args) + target = self.nameof(obj.target) + exitcase = self.nameof(obj.exitcase) + ia = self.initcode.append + ia("%s = Link(%s, %s, %s)" % (args, target, exitcase)) + if obj.last_exception: + ia("%s.last_exception = %s" % self.nameof(obj.last_exception)) + ia("%s.last_exc_value = %s" % self.nameof(obj.last_exc_value)) + return name + dispatch[Link] = nameof_Link + + def nameof_Block(self, obj): + name = self.uniquename("gblock") + inputargs = self.nameof(obj.inputargs) + operations = self.nameof(obj.operations) + exitswitch = self.nameof(obj.exitswitch) + exits = self.nameof(obj.exits) + ia = self.initcode.append + ia("%s = Block(%s)" % (name, inputargs,) ) + ia("%s.operations = %s" % (name, operations) ) + ia("%s.exitswitch = %s" % (name, exitswitch) ) + ia("%s.exits = %s" % (name, exits) ) + if obj.isstartblock: ia("%s.exits = True" % (name, ) ) + if obj.exc_handler: ia("%s.exc_handler = True" % (name, ) ) + return name + dispatch[Block] = dispatch[SpamBlock] = dispatch[EggBlock] = nameof_Block + + def nameof_SpaceOperation(self, obj): + name = self.uniquename("gsop") + opname = self.nameof(intern(obj.opname)) + args = self.nameof(obj.args) + result = self.nameof(obj.result) + ia = self.initcode.append + ia("%s = SpaceOperation(%s, %s, %s)" % (name, opname, args, result) ) + if obj.offset != -1: ia("%s.offset= %d" % (name, obj.offset) ) + return name + dispatch[SpaceOperation] = nameof_SpaceOperation + + def nameof_FunctionGraph(self,obj): + name = self.uniquename("gfgraph") + + def nameofconst(self, c, debug=None): + try: + concretetype = c.concretetype + except AttributeError: + concretetype = self.pyobjtype + return concretetype.nameof(c.value, debug=debug) + + def nameofvalue(self, value, concretetype=None, debug=None): + return (concretetype or self.pyobjtype).nameof(value, debug=debug) + + def getfuncdef(self, func): + if func not in self.funcdefs: + if self.translator.frozen: + if func not in self.translator.flowgraphs: + return None + else: + if (func.func_doc and + func.func_doc.lstrip().startswith('NOT_RPYTHON')): + return None + funcdef = FunctionDef(func, self) + self.funcdefs[func] = funcdef + self.allfuncdefs.append(funcdef) + self.pendingfunctions.append(funcdef) + return self.funcdefs[func] From adim at codespeak.net Wed May 25 09:54:26 2005 From: adim at codespeak.net (adim at codespeak.net) Date: Wed, 25 May 2005 09:54:26 +0200 (CEST) Subject: [pypy-svn] r12786 - pypy/branch/pycompiler/module/recparser Message-ID: <20050525075426.EC25B27B57@code1.codespeak.net> Author: adim Date: Wed May 25 09:54:26 2005 New Revision: 12786 Modified: pypy/branch/pycompiler/module/recparser/pythonutil.py Log: we don't want linenos in nested tuples when using pypy_parse Modified: pypy/branch/pycompiler/module/recparser/pythonutil.py ============================================================================== --- pypy/branch/pycompiler/module/recparser/pythonutil.py (original) +++ pypy/branch/pycompiler/module/recparser/pythonutil.py Wed May 25 09:54:26 2005 @@ -22,7 +22,7 @@ pyf = file(filename) text = pyf.read() pyf.close() - builder = TupleBuilder( PYTHON_PARSER.rules ) + builder = TupleBuilder( PYTHON_PARSER.rules, lineno=False) pythonparse.parse_python_source(text, PYTHON_PARSER, 'file_input', builder) nested_tuples = builder.stack[-1] if hasattr(builder, '_source_encoding'): From hpk at codespeak.net Wed May 25 09:55:59 2005 From: hpk at codespeak.net (hpk at codespeak.net) Date: Wed, 25 May 2005 09:55:59 +0200 (CEST) Subject: [pypy-svn] r12787 - pypy/extradoc/talk Message-ID: <20050525075559.C027627B5B@code1.codespeak.net> Author: hpk Date: Wed May 25 09:55:59 2005 New Revision: 12787 Modified: pypy/extradoc/talk/oscon2003-paper.txt Log: a few ReST fixes (for using 0.3.7 docutils instead of 0.3.3) Modified: pypy/extradoc/talk/oscon2003-paper.txt ============================================================================== --- pypy/extradoc/talk/oscon2003-paper.txt (original) +++ pypy/extradoc/talk/oscon2003-paper.txt Wed May 25 09:55:59 2005 @@ -606,13 +606,13 @@ .. [#] The Jython homespage: http://www.jython.org/ .. [#] The complete text is as follows: -.. line-block:: +.. :: *The Zen of Python* by Tim Peters -.. line-block:: +.. :: *Beautiful is better than ugly. Explicit is better than implicit. @@ -634,11 +634,9 @@ If the implementation is easy to explain, it may be a good idea. Namespaces are one honking great idea -- let's do more of those!* -.. [#] The full text for historians and other curious people is: +.. [#] The full text for historians and other curious people is:: -.. line-block:: - - slips=[ + slips=[ (1, 'Kals MatMarkn', 6150, 'Chutney for Curry', 'dinner Saturday'), (2, 'Kals MatMarkn', 32000, 'Spaghetti, Beer', 'dinner Monday'), (2, 'Kals MatMarkn', -810, 'Deposit on Beer Bottles', 'various'), From ericvrp at codespeak.net Wed May 25 10:33:45 2005 From: ericvrp at codespeak.net (ericvrp at codespeak.net) Date: Wed, 25 May 2005 10:33:45 +0200 (CEST) Subject: [pypy-svn] r12789 - pypy/dist/pypy/translator/llvm Message-ID: <20050525083345.3E83D27B57@code1.codespeak.net> Author: ericvrp Date: Wed May 25 10:33:45 2005 New Revision: 12789 Modified: pypy/dist/pypy/translator/llvm/build_llvm_module.py Log: added llvm compile support for x64-64 Modified: pypy/dist/pypy/translator/llvm/build_llvm_module.py ============================================================================== --- pypy/dist/pypy/translator/llvm/build_llvm_module.py (original) +++ pypy/dist/pypy/translator/llvm/build_llvm_module.py Wed May 25 10:33:45 2005 @@ -14,7 +14,7 @@ from pypy.translator.tool.buildpyxmodule import make_c_from_pyxfile from pypy.translator.tool import stdoutcapture -debug = 1 +debug = False class CompileError(exceptions.Exception): pass @@ -27,22 +27,31 @@ lastdir = path.local() os.chdir(str(dirpath)) modname = pyxfile.purebasename - ops1 = ["llvm-as %s -f -o %s.bc" % (llvmfile, llvmfile.purebasename), - "opt %s -f %s.bc -o %s_optimized.bc" % (OPTIMIZATION_SWITCHES, - llvmfile.purebasename, - llvmfile.purebasename), - "llc -enable-correct-eh-support %s_optimized.bc -f -o %s.s" % \ - (llvmfile.purebasename, llvmfile.purebasename), - "as %s.s -o %s.o" % (llvmfile.purebasename, llvmfile.purebasename)] - if not optimize: - ops1 = ["llvm-as %s -f" % llvmfile, - "llc -enable-correct-eh-support %s.bc -f -o %s.s" % \ - (llvmfile.purebasename, llvmfile.purebasename), - "as %s.s -o %s.o" % (llvmfile.purebasename, - llvmfile.purebasename)] - ops2 = ["gcc -c -fPIC -I/usr/include/python2.3 %s.c" % pyxfile.purebasename, - "gcc -shared %s.o %s.o -o %s.so" % (llvmfile.purebasename, - modname, modname)] + b = llvmfile.purebasename + + if sys.maxint == 2147483647: #32 bit platform + if optimize: + ops1 = ["llvm-as %s.ll -f -o %s.bc" % (b, b), + "opt %s -f %s.bc -o %s_optimized.bc" % (OPTIMIZATION_SWITCHES, b, b), + "llc -enable-correct-eh-support %s_optimized.bc -f -o %s.s" % (b, b), + "as %s.s -o %s.o" % (b, b)] + else: + ops1 = ["llvm-as %s.ll -f -o %s.bc" % (b, b), + "llc -enable-correct-eh-support %s.bc -f -o %s.s" % (b, b), + "as %s.s -o %s.o" % (b, b)] + ops2 = ["gcc -c -shared -I/usr/include/python2.3 %s.c" % pyxfile.purebasename, + "gcc -shared %s.o %s.o -o %s.so" % (b, modname, modname)] + else: #assume 64 bit platform (x86-64?) + #this special case for x86-64 (called ia64 in llvm) can go as soon as llc supports ia64 assembly output! + if optimize: + ops1 = ["llvm-as %s.ll -f -o %s.bc" % (b, b), + "opt %s -f %s.bc -o %s_optimized.bc" % (OPTIMIZATION_SWITCHES, b, b), + "llc -enable-correct-eh-support %s_optimized.bc -march=c -f -o %s.c" % (b, b)] + else: + ops1 = ["llvm-as %s.ll -f -o %s.bc" % (b, b), + "llc -enable-correct-eh-support %s.bc -march=c -f -o %s.c" % (b, b)] + ops2 = ["gcc -shared -fPIC -I/usr/include/python2.3 %s.c %s.c -o %s.so" % (b, modname, modname)] + try: if debug: print "modname", modname c = stdoutcapture.Capture(mixed_out_err = True) @@ -50,11 +59,11 @@ try: try: for op in ops1: - print op + if debug: print op cmdexec(op) make_c_from_pyxfile(pyxfile) for op in ops2: - print op + if debug: print op cmdexec(op) finally: foutput, foutput = c.done() From ericvrp at codespeak.net Wed May 25 12:39:24 2005 From: ericvrp at codespeak.net (ericvrp at codespeak.net) Date: Wed, 25 May 2005 12:39:24 +0200 (CEST) Subject: [pypy-svn] r12793 - pypy/dist/pypy/translator/llvm Message-ID: <20050525103924.B305627B5B@code1.codespeak.net> Author: ericvrp Date: Wed May 25 12:39:24 2005 New Revision: 12793 Modified: pypy/dist/pypy/translator/llvm/classrepr.py pypy/dist/pypy/translator/llvm/funcrepr.py pypy/dist/pypy/translator/llvm/pbcrepr.py Log: this makes all llvm tests pass on x86-64 Modified: pypy/dist/pypy/translator/llvm/classrepr.py ============================================================================== --- pypy/dist/pypy/translator/llvm/classrepr.py (original) +++ pypy/dist/pypy/translator/llvm/classrepr.py Wed May 25 12:39:24 2005 @@ -21,8 +21,8 @@ from pypy.translator.llvm.funcrepr import VirtualMethodRepr from pypy.translator.llvm.memorylayout import MemoryLayout -debug = True -lazy_debug = True +debug = False +lazy_debug = False class ClassRepr(TypeRepr): l_classes = {} @@ -122,7 +122,7 @@ def get_globals(self): s = "\n%s = internal global %%std.class {%%std.class* null, uint %i}" - s = s % (self.objectname, abs(id(self))) + s = s % (self.objectname, abs(id(self)) & 0xFFFFFFF) return self.definition + s def collect_init_code(self, lblock, l_func): @@ -247,7 +247,7 @@ self.objectname = gen.get_global_tmp("class.%s.object" % self.exception.__name__) s = "%s = internal global %%std.class {%%std.class* null, uint %i}" - self.definition = s % (self.objectname, abs(id(exception))) + self.definition = s % (self.objectname, abs(id(exception)) & 0xFFFFFFF) self.dependencies = sets.Set() lazy_attributes = ['l_base', 'memlayout'] Modified: pypy/dist/pypy/translator/llvm/funcrepr.py ============================================================================== --- pypy/dist/pypy/translator/llvm/funcrepr.py (original) +++ pypy/dist/pypy/translator/llvm/funcrepr.py Wed May 25 12:39:24 2005 @@ -342,7 +342,7 @@ if len(l_exits) == 1 and self.pyblock.exits[1].exitcase == Exception: lexcblock.uncond_branch("%" + l_exits[0].toblock) else: - sw = [(str(abs(id(ex.exitcase))), "%" + l_l.toblock) + sw = [(str(abs(id(ex.exitcase)) & 0xFFFFFFF), "%" + l_l.toblock) for ex, l_l in zip(self.pyblock.exits[1:], l_exits)] lexcblock.switch(l_ui, "%" + self.lblock.label + ".unwind", sw) lunwindblock = llvmbc.BasicBlock(self.lblock.label + ".unwind") @@ -628,7 +628,7 @@ entryblock.getelementptr(l_uip, l_cl, [0, 1]) entryblock.load(l_ui, l_uip) entryblock.switch(l_ui, "%" + self.l_commonbase.classdef.cls.__name__, - [(str(abs(id(l_c))), "%" + l_c.classdef.cls.__name__) + [(str(abs(id(l_c)) & 0xFFFFFFF), "%" + l_c.classdef.cls.__name__) for l_c in self.l_classes]) lfunc = llvmbc.Function(self.llvmfuncdef(), entryblock) for i, l_cls in enumerate(self.l_classes): Modified: pypy/dist/pypy/translator/llvm/pbcrepr.py ============================================================================== --- pypy/dist/pypy/translator/llvm/pbcrepr.py (original) +++ pypy/dist/pypy/translator/llvm/pbcrepr.py Wed May 25 12:39:24 2005 @@ -85,7 +85,7 @@ self.memlayout = MemoryLayout(attribs, l_types, self.gen) self.definition = "%s = %s" % (self.name, self.memlayout.definition()) s = "\n%s = internal global %%std.class {%%std.class* null, uint %i}" - self.definition += s % (self.objectname, abs(id(self))) + self.definition += s % (self.objectname, abs(id(self)) & 0xFFFFFFF) def llvmtype(self): return "%std.class*" From arigo at codespeak.net Wed May 25 13:53:11 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Wed, 25 May 2005 13:53:11 +0200 (CEST) Subject: [pypy-svn] r12794 - pypy/dist/pypy/documentation Message-ID: <20050525115311.B924727B5B@code1.codespeak.net> Author: arigo Date: Wed May 25 13:53:11 2005 New Revision: 12794 Modified: pypy/dist/pypy/documentation/_ref.txt pypy/dist/pypy/documentation/translation.txt Log: - Updated translation.txt to the changes in lltype.py. - Give a guided tour of lltype. Modified: pypy/dist/pypy/documentation/_ref.txt ============================================================================== --- pypy/dist/pypy/documentation/_ref.txt (original) +++ pypy/dist/pypy/documentation/_ref.txt Wed May 25 13:53:11 2005 @@ -1,8 +1,8 @@ -.. _`issue40`: http://codespeak.net/issue/pypy-dev/issue40 .. _`demo/`: http://codespeak.net/svn/pypy/dist/demo .. _`lib-python/`: http://codespeak.net/svn/pypy/dist/lib-python .. _`pypy/annotation`: .. _`annotation/`: http://codespeak.net/svn/pypy/dist/pypy/annotation +.. _`annotation/binaryop.py`: http://codespeak.net/svn/pypy/dist/pypy/annotation/binaryop.py .. _`documentation/`: http://codespeak.net/svn/pypy/dist/pypy/documentation .. _`documentation/revreport/`: http://codespeak.net/svn/pypy/dist/pypy/documentation/revreport .. _`documentation/website/`: http://codespeak.net/svn/pypy/dist/pypy/documentation/website @@ -26,9 +26,11 @@ .. _`pypy/objspace/std`: .. _`objspace/std/`: http://codespeak.net/svn/pypy/dist/pypy/objspace/std .. _`objspace/thunk.py`: http://codespeak.net/svn/pypy/dist/pypy/objspace/thunk.py -.. _`objspace/trace.py`: -.. _`pypy/objspace/trace.py`: http://codespeak.net/svn/pypy/dist/pypy/objspace/trace.py +.. _`pypy/objspace/trace.py`: +.. _`objspace/trace.py`: http://codespeak.net/svn/pypy/dist/pypy/objspace/trace.py .. _`rpython/`: http://codespeak.net/svn/pypy/dist/pypy/rpython +.. _`rpython/lltype.py`: http://codespeak.net/svn/pypy/dist/pypy/rpython/lltype.py +.. _`rpython/rlist.py`: http://codespeak.net/svn/pypy/dist/pypy/rpython/rlist.py .. _`pypy/test_all.py`: http://codespeak.net/svn/pypy/dist/pypy/test_all.py .. _`tool/`: http://codespeak.net/svn/pypy/dist/pypy/tool .. _`tool/pytest/`: http://codespeak.net/svn/pypy/dist/pypy/tool/pytest Modified: pypy/dist/pypy/documentation/translation.txt ============================================================================== --- pypy/dist/pypy/documentation/translation.txt (original) +++ pypy/dist/pypy/documentation/translation.txt Wed May 25 13:53:11 2005 @@ -465,35 +465,85 @@ v3 = int_add(v1, v2) -where -- in C notation -- all three variables v1, v2 and v3 are typed ``int``. This is done by attaching an attribute ``concretetype`` to v1, v2 and v3 (which might be instances of Variable or possibly Constant). In our model, this ``concretetype`` is ``pypy.rpython.lltypes.Signed``. Of course, the purpose of replacing the operation called ``add`` with ``int_add`` is that code generators no longer have to worry about what kind of addition (or concatenation maybe?) it means. +where -- in C notation -- all three variables v1, v2 and v3 are typed ``int``. This is done by attaching an attribute ``concretetype`` to v1, v2 and v3 (which might be instances of Variable or possibly Constant). In our model, this ``concretetype`` is ``pypy.rpython.lltype.Signed``. Of course, the purpose of replacing the operation called ``add`` with ``int_add`` is that code generators no longer have to worry about what kind of addition (or concatenation maybe?) it means. The process in more details --------------------------- -The RPython Typer does the following transformations for each block of all the annotated flow graphs (each block is processed independently, by assuming that the already-computed annotations are globally correct): +The RPython Typer has a structure similar to that of the Annotator_: both consider each block of the flow graphs in turn, and perform some analysis on each operation. In both cases the analysis of an operation depends on the annotations of its input arguments. This is reflected in the usage of the same ``__extend__`` syntax in the source files (compare e.g. `annotation/binaryop.py`_ and `rpython/rlist.py`_). -* We first replace all Variables that have constant annotations with real Constants in the flow graph. +The analogy stops here, though: while it runs, the Annotator is in the middle of computing the annotations, so it might need to reflow and generalize until a fixpoint is reached. The Typer, by contrast, works on the final annotations that the Annotator computed, without changing them, assuming that they are globally consistent. There is no need to reflow: the Typer considers each block only once. And unlike the Annotator, the Typer completely modifies the flow graph, by replacing each operation with some low-level operations. -* For the time being, we assume that each SomeXxx annotation has a canonical low-level representation. For example, all variables annotated with SomeInteger() will correspond to the ``Signed`` low-level type. Each input argument of the block are tagged with the canonical low-level representation (this is done by attaching an attribute ``concretetype`` to each Variable). - -* Each operation, with its argument's annotation, is looked up in a table which specifies with which low-level operation(s) it should be substituted. If needed, the arguments are first converted (with extra operations) from their current ``concretetype`` to the required low-level types. For constant arguments, we just attach the ``concretetype`` to the Constant instance; as for Variables, this tells the code generator of which type the constant really is. Finally, the substitution rules specify the ``concretetype`` of the result. It is attached to the result Variable, and will be used further down the block to detect when conversions are needed. - -* When a block has been transformed in this way, all the links are considered; if the concrete types of the Variables that exit do not match the canonical low-level types expected by the target block, conversions are inserted -- they are put in a new block inserted along the link, as they are of no concern to the other exit links. - -This may look like flowing, similar to what the annotator does, but it is limited to a single block; for global coherency it trusts the more involved fixpoint-based algorithm run by the annotator. +The main assumption of the RTyper, for the time being, is that each SomeXxx annotation has a canonical low-level representation. For example, all variables annotated with SomeInteger() will correspond to the ``Signed`` low-level type. The RTyper computes the canonical low-level type for each Variable based on its annotation, and stores it in the attribute ``concretetype``. It also computes a ``concretetype`` for Constants, to match the way they are used in the low-level operations (for example, ``int_add(x, 1)`` requires a ``Constant(1)`` with ``concretetype=Signed``, but an untyped ``add(x, 1)`` works with a ``Constant(1)`` that must actually be a PyObject at run-time). Low-Level Types --------------- -For now, the RPython Typer uses a standard low-level model which we believe can correspond rather directly to various target languages from C to LLVM to Java. This model is implemented in the first part of `lltypes.py`_. +The RPython Typer uses a standard low-level model which we believe can correspond rather directly to various target languages from C to LLVM to Java. This model is implemented in the first part of `rpython/lltype.py`_. -The second part of `lltypes.py`_ is a runnable implementation of these types, for testing purposes. It allows us to write and test plain Python code using a malloc() function to obtain and manipulate structures and arrays. This is useful for example to implement RPython types like 'list' with its operations and methods. +The second part of `rpython/lltype.py`_ is a runnable implementation of these types, for testing purposes. It allows us to write and test plain Python code using a malloc() function to obtain and manipulate structures and arrays. This is useful for example to implement RPython types like 'list' with its operations and methods. The basic assumption is that Variables (i.e. local variables and function arguments and return value) all contain "simple" values: basically, just integers or pointers. All the "container" data structures (struct and array) are allocated in the heap, and they are always manipulated via pointers. (There is no equivalent to the C notion of local variable of a ``struct`` type.) -.. _`lltypes.py`: http://codespeak.net/svn/pypy/dist/pypy/rpython/lltypes.py +Here is a quick tour:: + + >>> from pypy.rpython.lltype import * + +(The module is called ``lltypes`` in PyPy release 0.6.) + +Here are a few primitive low-level types, and the typeOf() function to figure them out:: + + >>> Signed + + >>> typeOf(5) + + >>> typeOf(r_uint(12)) + + >>> typeOf('x') + + +Let's say that we want to build a type "point", which is a structure with two integer fields "x" and "y":: + + >>> POINT = GcStruct('point', ('x', Signed), ('y', Signed)) + >>> POINT + + +The structure is a ``GcStruct``, which means a structure that can be allocated in the heap and eventually freed by some garbage collector. (For platforms where we use reference counting, think about ``GcStruct`` as a struct with an additional reference counter field.) (NB. in PyPy release 0.6, GcStruct and GcArray don't exist; you must use Struct and Array instead.) + +Giving a name ('point') to the GcStruct is only for clarity: it is used in the representation. + + >>> p = malloc(POINT) + >>> p + <_ptrtype to struct point { x=0, y=0 }> + >>> p.x = 5 + >>> p.x + 5 + >>> p + <_ptrtype to struct point { x=5, y=0 }> + +``malloc()`` allocates a structure from the heap, initalizes it to 0 (currently), and returns a pointer to it. The point of all this is to work with a very limited, easily controllable set of types, and define implementations of types like list in this elementary world. The ``malloc()`` function is a kind of placeholder, which must eventually be provided by the code generator for the target platform; but as we have just seen its Python implementation in `rpython/lltype.py`_ works too, which is primarily useful for testing, interactive exploring, etc. + +The argument to ``malloc()`` is the structure type directly, but it returns a pointer to the structure, as ``typeOf()`` tells you:: + + >>> typeOf(p) + + +For the purpose of creating structures with pointers to other structures, we can declare pointer types explicitely:: + + >>> typeOf(p) == GcPtr(POINT) + True + >>> BIZARRE = GcStruct('bizarre', ('p1', GcPtr(POINT)), ('p2', GcPtr(POINT))) + >>> b = malloc(BIZARRE) + >>> b.p1 + <_ptrtype to None> + >>> b.p1 = b.p2 = p + >>> b.p1.y = 42 + >>> b.p2.y + 42 + +The world of low-level types is more complicated than integers and GcStructs, though. The next pages are a reference guide. Primitive Types @@ -519,9 +569,10 @@ Structure Types +++++++++++++++ -Structure types are built as instances of ``pypy.rpython.lltypes.Struct``:: +Structure types are built as instances of ``pypy.rpython.lltype.Struct``:: MyStructType = Struct('somename', ('field1', Type1), ('field2', Type2)...) + MyStructType = GcStruct('somename', ('field1', Type1), ('field2', Type2)...) This declares a structure (or a Pascal ``record``) containing the specified named fields with the given types. The field names cannot start with an underscore. As noted above, you cannot directly manipulate structure objects, but only pointer to structures living in the heap. @@ -529,18 +580,23 @@ A structure can also contain an inlined array (see below), but only as its last field: in this case it is a "variable-sized" structure, whose memory layout starts with the non-variable fields and ends with a variable number of array items. This number is determined when a structure is allocated in the heap. Variable-sized structures cannot be inlined in other structures. +GcStructs have a platform-specific GC header (e.g. a reference counter); only these can be malloc()ed. Structs have no header, and are suitable for being embedded ("inlined") inside other structures. As an exception, a GcStruct can be embedded as the first field of a GcStruct: the parent structure uses the same GC header as the substructure. + Array Types +++++++++++ -An array type is built as an instance of ``pypy.rpython.lltypes.Array``:: +An array type is built as an instance of ``pypy.rpython.lltype.Array``:: MyArrayType = Array(('field1', Type1), ('field2', Type2)...) + MyArrayType = GcArray(('field1', Type1), ('field2', Type2)...) The items of an array are always structures; the arguments to Array() give the fields of these structures (it can of course be a single field). The allowed field types follow the same rules as for Struct(), but this particular structure cannot be variable-sized. For now, each array stores its length explicitely in a header. An array can never be resized: it occupies a fixed amount of bytes determined when it is allocated. +GcArrays can be malloc()ed (the length must be specified when malloc() is called, and arrays cannot be resized). Plain Arrays cannot be malloc()ed but can be used as the last field of a structure, to make a variable-sized structure. The whole structure can then be malloc()ed, and the length of the array is specified at this time. + Pointer Types +++++++++++++ @@ -550,7 +606,7 @@ GcPtr(T, **flags) NonGcPtr(T, **flags) -The so-called GC pointers are the ones that hold a reference to the object they point to. Typically, the malloc() operation allocates and returns a GcPtr to a new structure or array. In a refcounting implementation, malloc() would allocate enough space for a reference counter before the actual structure, and initialize it to 1. Actually, GC pointers can only point to a malloc()ed structure or array. Non-GC pointers are used when you know that a pointer doesn't hold a (counted) reference to an object, usually because the object has no reference counter at all: for example, functions don't have one; more importantly, inlined substructures don't have one either. For them, care must be taken to ensure that the bigger structure of which they are part of isn't freed while the NonGcPtr to the substructure is still in use. +The so-called GC pointers are the ones that hold a reference to the object they point to. Only GcStruct, GcArray and PyObject can have GcPtrs to them. Typically, the malloc() operation allocates and returns a GcPtr to a new structure or array. In a refcounting implementation, malloc() would allocate enough space for a reference counter before the actual structure, and initialize it to 1. Actually, GC pointers can only point to a malloc()ed structure or array. Non-GC pointers are used when you know that a pointer doesn't hold a (counted) reference to an object, usually because the object has no reference counter at all: for example, functions don't have one; more importantly, inlined substructures don't have one either. For them, care must be taken to ensure that the bigger structure of which they are part of isn't freed while the NonGcPtr to the substructure is still in use. All pointer types can also have additional flags, whose meaning is unspecified at this level (apart from the flag ``gc=True`` which GcPtrs have and NonGcPtrs miss). Types with different flags are incompatible, but the cast_flags() operation is provided to perform explicit casts. The intention is for example to represent the high-level object "the method append() of this list" as the type ``GcPtr(ListType, method='append')`` -- i.e. a pointer to the list in question with an additional flag specifying that the pointer represents the method append() of that list, as opposed to the list itself. @@ -578,7 +634,7 @@ This list concatenation flow graph is then annotated as usual, with one difference: the annotator has to be taught about malloc() and the way the pointer thus obtained can be manipulated. This generates a flow graph which is hopefully completely annotated with the SomePtr annotation. Introduced just for this case, SomePtr maps directly to a low-level pointer type. This is the only change needed to the Annotator to allow it to perform type inferrence of our very-low-level snippets of code. -See for example http://codespeak.net/svn/pypy/dist/pypy/rpython/rlist.py. +See for example `rpython/rlist.py`_. @@ -943,3 +999,6 @@ XXX to be added later + + +.. include:: _ref.txt From arigo at codespeak.net Wed May 25 18:02:09 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Wed, 25 May 2005 18:02:09 +0200 (CEST) Subject: [pypy-svn] r12795 - in pypy/dist/pypy: annotation rpython rpython/test Message-ID: <20050525160209.DDA2427B84@code1.codespeak.net> Author: arigo Date: Wed May 25 18:02:09 2005 New Revision: 12795 Modified: pypy/dist/pypy/annotation/builtin.py pypy/dist/pypy/annotation/model.py pypy/dist/pypy/annotation/unaryop.py pypy/dist/pypy/rpython/rbuiltin.py pypy/dist/pypy/rpython/rint.py pypy/dist/pypy/rpython/robject.py pypy/dist/pypy/rpython/rptr.py pypy/dist/pypy/rpython/rtyper.py pypy/dist/pypy/rpython/test/test_rlist.py Log: RTyper support for method calls. list.append() seems to work, but it would be nice to have a real way to check the generated flow graphs instead of just asserting that the rtyper didn't crash and looking around a bit in pygame. Modified: pypy/dist/pypy/annotation/builtin.py ============================================================================== --- pypy/dist/pypy/annotation/builtin.py (original) +++ pypy/dist/pypy/annotation/builtin.py Wed May 25 18:02:09 2005 @@ -9,6 +9,7 @@ from pypy.annotation.model import SomeList, SomeString, SomeTuple, SomeSlice from pypy.annotation.model import SomeUnicodeCodePoint from pypy.annotation.model import SomeFloat, unionof +from pypy.annotation.model import annotation_to_lltype from pypy.annotation.bookkeeper import getbookkeeper from pypy.objspace.flow.model import Constant import pypy.rpython.rarithmetic @@ -274,7 +275,12 @@ parent_p._setfirst(candidate_p) return SomePtr(ll_ptrtype=lltype.typeOf(lltype.cast_parent(PtrT, candidate_p))) +def typeOf(s_val): + lltype = annotation_to_lltype(s_val, info="in typeOf(): ") + return immutablevalue(lltype) + BUILTIN_ANALYZERS[lltype.malloc] = malloc BUILTIN_ANALYZERS[lltype.cast_flags] = cast_flags BUILTIN_ANALYZERS[lltype.cast_parent] = cast_parent +BUILTIN_ANALYZERS[lltype.typeOf] = typeOf Modified: pypy/dist/pypy/annotation/model.py ============================================================================== --- pypy/dist/pypy/annotation/model.py (original) +++ pypy/dist/pypy/annotation/model.py Wed May 25 18:02:09 2005 @@ -303,9 +303,10 @@ class SomeBuiltin(SomeObject): "Stands for a built-in function or method with special-cased analysis." knowntype = BuiltinFunctionType # == BuiltinMethodType - def __init__(self, analyser, s_self=None): + def __init__(self, analyser, s_self=None, methodname=None): self.analyser = analyser self.s_self = s_self + self.methodname = methodname class SomeImpossibleValue(SomeObject): Modified: pypy/dist/pypy/annotation/unaryop.py ============================================================================== --- pypy/dist/pypy/annotation/unaryop.py (original) +++ pypy/dist/pypy/annotation/unaryop.py Wed May 25 18:02:09 2005 @@ -102,7 +102,7 @@ def find_method(obj, name): "Look for a special-case implementation for the named method." analyser = getattr(obj.__class__, 'method_' + name) - return SomeBuiltin(analyser, obj) + return SomeBuiltin(analyser, obj, name) def getattr(obj, s_attr): # get a SomeBuiltin if the SomeObject has Modified: pypy/dist/pypy/rpython/rbuiltin.py ============================================================================== --- pypy/dist/pypy/rpython/rbuiltin.py (original) +++ pypy/dist/pypy/rpython/rbuiltin.py Wed May 25 18:02:09 2005 @@ -1,18 +1,40 @@ from pypy.annotation.pairtype import pair, pairtype -from pypy.annotation.model import SomeBuiltin -from pypy.rpython.lltype import malloc, Void, Signed +from pypy.annotation.model import SomeBuiltin, SomeObject +from pypy.rpython.lltype import malloc, typeOf, Void, Signed from pypy.rpython.rtyper import TyperError, peek_at_result_annotation -from pypy.rpython.rtyper import receiveconst, receive, direct_op +from pypy.rpython.rtyper import receiveconst, receive, direct_op, convertvar class __extend__(SomeBuiltin): + def lowleveltype(s_blt): + if s_blt.s_self is None: + assert s_blt.is_constant() + return Void + else: + # methods of a known name are implemented as just their 'self' + assert s_blt.methodname is not None + return s_blt.s_self.lowleveltype() + def rtype_simple_call(s_blt, *args_s): - if not s_blt.is_constant(): - raise TyperError("non-constant built-in") - bltintyper = BUILTIN_TYPER[s_blt.const] + if s_blt.s_self is None: + if not s_blt.is_constant(): + raise TyperError("non-constant built-in") + bltintyper = BUILTIN_TYPER[s_blt.const] + else: + # methods: look up the rtype_method_xxx() + name = 'rtype_method_' + s_blt.methodname + bltintyper = getattr(s_blt.s_self, name) return bltintyper(*args_s) + +class __extend__(pairtype(SomeBuiltin, SomeObject)): + + def rtype_convert_from_to((s_blt, s_to), v): + if s_blt.s_self is None: + raise TyperError("conversion requested on a built-in function") + return convertvar(v, s_blt.s_self, s_to) + # ____________________________________________________________ def rtype_malloc(s_pbc_type, s_varlength=None): @@ -27,7 +49,12 @@ return direct_op('malloc_varsize', [v_type, v_varlength], resulttype = s_result.lowleveltype()) +def rtype_typeOf(s_value): + s_result = peek_at_result_annotation() + return receiveconst(Void, s_result.const) + BUILTIN_TYPER = { malloc: rtype_malloc, + typeOf: rtype_typeOf, } Modified: pypy/dist/pypy/rpython/rint.py ============================================================================== --- pypy/dist/pypy/rpython/rint.py (original) +++ pypy/dist/pypy/rpython/rint.py Wed May 25 18:02:09 2005 @@ -1,13 +1,19 @@ from pypy.annotation.pairtype import pair, pairtype -from pypy.annotation.model import SomeInteger -from pypy.rpython.lltype import Signed, Unsigned +from pypy.annotation.model import SomeInteger, SomeBool +from pypy.rpython.lltype import Signed, Unsigned, Bool from pypy.rpython.rtyper import peek_at_result_annotation, receive, direct_op +from pypy.rpython.rtyper import TyperError class __extend__(pairtype(SomeInteger, SomeInteger)): + def rtype_convert_from_to((s_from, s_to), v): + # assume that converting between signed and unsigned doesn't need + # an operation for now + return v + def rtype_add((s_int1, s_int2)): - if peek_at_result_annotation().unsigned: + if s_int1.unsigned or s_int2.unsigned: v_int1 = receive(Unsigned, arg=0) v_int2 = receive(Unsigned, arg=1) return direct_op('uint_add', [v_int1, v_int2], resulttype=Unsigned) @@ -15,3 +21,25 @@ v_int1 = receive(Signed, arg=0) v_int2 = receive(Signed, arg=1) return direct_op('int_add', [v_int1, v_int2], resulttype=Signed) + + rtype_inplace_add = rtype_add + + def rtype_lt((s_int1, s_int2)): + if s_int1.unsigned or s_int2.unsigned: + if not s_int1.nonneg or not s_int2.nonneg: + raise TyperError("comparing a signed and an unsigned number") + v_int1 = receive(Unsigned, arg=0) + v_int2 = receive(Unsigned, arg=1) + return direct_op('uint_lt', [v_int1, v_int2], resulttype=Bool) + else: + v_int1 = receive(Signed, arg=0) + v_int2 = receive(Signed, arg=1) + return direct_op('int_lt', [v_int1, v_int2], resulttype=Bool) + + + +class __extend__(SomeBool): + + def rtype_is_true(s_bool): + v_bool = receive(Bool, arg=0) + return v_bool Modified: pypy/dist/pypy/rpython/robject.py ============================================================================== --- pypy/dist/pypy/rpython/robject.py (original) +++ pypy/dist/pypy/rpython/robject.py Wed May 25 18:02:09 2005 @@ -3,7 +3,7 @@ from pypy.annotation.model import SomePBC from pypy.rpython.lltype import PyObject, GcPtr, Void from pypy.rpython.rtyper import TyperError, peek_at_result_annotation -from pypy.rpython.rtyper import receiveconst +from pypy.rpython.rtyper import receiveconst, receive PyObjPtr = GcPtr(PyObject) @@ -20,6 +20,19 @@ else: return PyObjPtr + def rtype_getattr(s_obj, s_attr): + if s_attr.is_constant() and isinstance(s_attr.const, str): + attr = s_attr.const + try: + s_obj.find_method(attr) # just to check it is here + except AttributeError: + raise TyperError("no method %s on %r" % (attr, s_obj)) + else: + # implement methods (of a known name) as just their 'self' + return receive(s_obj, arg=0) + else: + raise TyperError("getattr() with a non-constant attribute name") + class __extend__(pairtype(SomeObject, SomeObject)): Modified: pypy/dist/pypy/rpython/rptr.py ============================================================================== --- pypy/dist/pypy/rpython/rptr.py (original) +++ pypy/dist/pypy/rpython/rptr.py Wed May 25 18:02:09 2005 @@ -32,6 +32,12 @@ v_value = receive(FIELD_TYPE, arg=2) direct_op('setfield', [v_ptr, v_attr, v_value]) + def rtype_len(s_ptr): + v_ptr = receive(s_ptr, arg=0) + s_result = peek_at_result_annotation() + return direct_op('getarraysize', [v_ptr], + resulttype = s_result.lowleveltype()) + class __extend__(pairtype(SomePtr, SomeInteger)): Modified: pypy/dist/pypy/rpython/rtyper.py ============================================================================== --- pypy/dist/pypy/rpython/rtyper.py (original) +++ pypy/dist/pypy/rpython/rtyper.py Wed May 25 18:02:09 2005 @@ -83,6 +83,15 @@ raise block.operations[:] = newops + # multiple renamings (v1->v2->v3->...) are possible + while True: + done = True + for v1, v2 in varmapping.items(): + if v2 in varmapping: + varmapping[v1] = varmapping[v2] + done = False + if done: + break block.renamevariables(varmapping) self.insert_link_conversions(block) @@ -103,7 +112,7 @@ newops = [] self.enter_operation(None, newops) try: - a1 = self.convertvar(a1, s_a1, s_a2) + a1 = convertvar(a1, s_a1, s_a2) finally: self.leave_operation() if newops and not can_insert_here: Modified: pypy/dist/pypy/rpython/test/test_rlist.py ============================================================================== --- pypy/dist/pypy/rpython/test/test_rlist.py (original) +++ pypy/dist/pypy/rpython/test/test_rlist.py Wed May 25 18:02:09 2005 @@ -16,7 +16,7 @@ assert "did not crash" -def NOT_READY_test_append(): +def test_append(): def dummyfn(): l = [] l.append(5) @@ -27,5 +27,5 @@ t.annotate([]) typer = RPythonTyper(t.annotator) typer.specialize() - t.view() + #t.view() assert "did not crash" From arigo at codespeak.net Wed May 25 20:01:39 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Wed, 25 May 2005 20:01:39 +0200 (CEST) Subject: [pypy-svn] r12796 - in pypy/dist/pypy: objspace/flow rpython rpython/test Message-ID: <20050525180139.E887527B97@code1.codespeak.net> Author: arigo Date: Wed May 25 20:01:39 2005 New Revision: 12796 Modified: pypy/dist/pypy/objspace/flow/model.py pypy/dist/pypy/rpython/rtyper.py pypy/dist/pypy/rpython/test/test_rlist.py Log: - Very minimal checking of the flow graphs produced by the RTyper. - Fixed a bug discovered by this. Modified: pypy/dist/pypy/objspace/flow/model.py ============================================================================== --- pypy/dist/pypy/objspace/flow/model.py (original) +++ pypy/dist/pypy/objspace/flow/model.py Wed May 25 20:01:39 2005 @@ -367,7 +367,7 @@ if isinstance(v, Variable): assert v in vars else: - assert v.value != last_exception + assert v.value is not last_exception #assert v.value != last_exc_value exc_links = {} if block.exitswitch is None: @@ -402,7 +402,7 @@ assert v != block.operations[-1].result else: if not exc_link: - assert v.value != last_exception + assert v.value is not last_exception #assert v.value != last_exc_value vars_previous_blocks.update(vars) Modified: pypy/dist/pypy/rpython/rtyper.py ============================================================================== --- pypy/dist/pypy/rpython/rtyper.py (original) +++ pypy/dist/pypy/rpython/rtyper.py Wed May 25 20:01:39 2005 @@ -146,7 +146,6 @@ # for simplicity of the consider_meth, resultvar is usually not # op.result here. We have to replace resultvar with op.result # in all generated operations. - varmapping[resultvar] = op.result resulttype = resultvar.concretetype op.result.concretetype = s_expected.lowleveltype() if op.result.concretetype != resulttype: @@ -155,6 +154,9 @@ " rtyper says %r" % (op.opname, op.result.concretetype, resulttype)) + while resultvar in varmapping: + resultvar = varmapping[resultvar] + varmapping[resultvar] = op.result else: # consider_meth() can actually generate no operation and return # a Constant. Modified: pypy/dist/pypy/rpython/test/test_rlist.py ============================================================================== --- pypy/dist/pypy/rpython/test/test_rlist.py (original) +++ pypy/dist/pypy/rpython/test/test_rlist.py Wed May 25 20:01:39 2005 @@ -13,7 +13,7 @@ typer = RPythonTyper(t.annotator) typer.specialize() #t.view() - assert "did not crash" + t.checkgraphs() def test_append(): @@ -28,4 +28,4 @@ typer = RPythonTyper(t.annotator) typer.specialize() #t.view() - assert "did not crash" + t.checkgraphs() From ale at codespeak.net Wed May 25 23:17:35 2005 From: ale at codespeak.net (ale at codespeak.net) Date: Wed, 25 May 2005 23:17:35 +0200 (CEST) Subject: [pypy-svn] r12797 - pypy/dist/pypy/lib Message-ID: <20050525211735.840A427B84@code1.codespeak.net> Author: ale Date: Wed May 25 23:17:35 2005 New Revision: 12797 Modified: pypy/dist/pypy/lib/inprogress__codecs.py pypy/dist/pypy/lib/unicodecodec.py Log: _codecs.py is almost ready to get enabled. pypy's tests pass, but I havnt been able to test the regression tests Modified: pypy/dist/pypy/lib/inprogress__codecs.py ============================================================================== --- pypy/dist/pypy/lib/inprogress__codecs.py (original) +++ pypy/dist/pypy/lib/inprogress__codecs.py Wed May 25 23:17:35 2005 @@ -34,8 +34,7 @@ Copyright (c) Corporation for National Research Initiatives. """ -from unicodecodec_ import * - +from unicodecodec import * #/* --- Registry ----------------------------------------------------------- */ codec_search_path = [] codec_search_cache = {} @@ -61,12 +60,24 @@ result = codec_search_cache.get(encoding,None) if not result: + if len(codec_search_path) == 0: + import encodings + if len(codec_search_path) == 0: + raise LookupError("no codec search functions registered: can't find encoding") + if not isinstance(encoding,str): + raise TypeError("Encoding must be a string") for search in codec_search_path: result=search(encoding) if result : - codec_search_cache[encoding] = result - break + if not( type(result) == tuple and len(result) == 4): + raise TypeError("codec search functions must return 4-tuples") + else: + codec_search_cache[encoding] = result + return result + if not result: + raise LookupError( "unknown encoding: %s", encoding) return result + lookup = codec_lookup @@ -80,11 +91,15 @@ 'xmlcharrefreplace' as well as any other name registered with codecs.register_error that can handle ValueErrors. """ - - encoder = lookup(encoding)[0] - if encoder : - res = encoder(v,errors) - return res[0] + if isinstance(encoding,str): + encoder = lookup(encoding)[0] + if encoder and isinstance(errors,str): + res = encoder(v,errors) + return res[0] + else: + raise TypeError("Errors must be a string") + else: + raise TypeError("Encoding must be a string") def decode(obj,encoding='defaultencoding',errors='strict'): """decode(obj, [encoding[,errors]]) -> object @@ -96,12 +111,15 @@ as well as any other name registerd with codecs.register_error that is able to handle ValueErrors. """ - decoder = lookup(encoding)[1] - if decoder: - res = decoder(obj,errors) + if isinstance(encoding,str): + decoder = lookup(encoding)[1] + if decoder and isinstance(errors,str): + res = decoder(v,errors) + return res[0] + else: + raise TypeError("Errors must be a string") else: - raise LookupError("No such encoding") - return res[0] + raise TypeError("Encoding must be a string") def latin_1_encode( obj,errors='strict'): """None @@ -132,7 +150,7 @@ """None """ res = PyUnicode_DecodeUTF8Stateful(data, len(data), errors, final) - res = ''.join(res) + res = u''.join(res) return res,len(res) def raw_unicode_escape_decode( data,errors='strict'): @@ -145,7 +163,7 @@ def utf_7_decode( data,errors='strict'): """None """ - res = PyUnicode_DecodeUTF7(data,errors='strict') + res = PyUnicode_DecodeUTF7(data,len(data),errors='strict') res = ''.join(res) return res,len(res) @@ -160,7 +178,7 @@ """None """ res = PyUnicode_DecodeLatin1(data,len(data),errors) - res = ''.join(res) + res = u''.join(res) return res, len(res) def utf_16_decode( data,errors='strict',final=None): @@ -182,7 +200,7 @@ """None """ res = PyUnicode_DecodeASCII(data,len(data),errors) - res = ''.join(res) + res = u''.join(res) return res, len(res) def charmap_encode(obj,errors='strict',mapping='latin-1'): Modified: pypy/dist/pypy/lib/unicodecodec.py ============================================================================== --- pypy/dist/pypy/lib/unicodecodec.py (original) +++ pypy/dist/pypy/lib/unicodecodec.py Wed May 25 23:17:35 2005 @@ -190,8 +190,8 @@ i+=1 if (inShift) : - outpos = p-PyUnicode_AS_UNICODE(unicode); - endinpos = size; + #XXX This aint right + endinpos = size raise UnicodeDecodeError, "unterminated shift sequence" return p @@ -232,8 +232,8 @@ else: bitsleft += 16 charsleft += ch #((ord(charsleft) << 16) | ord(ch)) - out, charsleft, bitsleft = ENCODE(out, charsleft, bitsleft) - + p, bitsleft = ENCODE(charsleft, bitsleft) + out += p ## /* If the next character is special then we dont' need to terminate ## the shift sequence. If the next character is not a BASE64 character ## or '-' then the shift sequence will be terminated implicitly and we @@ -401,22 +401,22 @@ # /* ASCII is equivalent to the first 128 ordinals in Unicode. */ if (size == 1 and ord(s) < 128) : - return PyUnicode_FromUnicode(unicode(s), 1) + return [unichr(ord(s))] if (size == 0): - return unicode('') + return [u''] #unicode('') p = [] pos = 0 while pos < len(s): c = s[pos] if ord(c) < 128: - p += c + p += unichr(ord(c)) pos += 1 else: res = unicode_call_errorhandler( errors, "ascii", "ordinal not in range(128)", s, pos, pos+1) - p += res[0] + p += unicode(res[0]) pos = res[1] return p @@ -565,7 +565,7 @@ p = [] bom = sys.byteorder - if (byteorder == 0): + if (byteorder == 'native'): bom = sys.byteorder p += STORECHAR(0xFEFF,bom) @@ -573,12 +573,12 @@ if (size == 0): return "" - if (byteorder == -1): + if (byteorder == 'little' ): bom = 'little' - elif (byteorder == 1): + elif (byteorder == 'big'): bom = 'big' - + for c in s: ch = ord(c) ch2 = 0 @@ -845,7 +845,7 @@ def PyUnicode_EncodeUTF8(s,size,errors): - assert(s != None) + #assert(s != None) assert(size >= 0) p = [] i = 0 @@ -892,12 +892,12 @@ def PyUnicode_DecodeLatin1(s, size, errors): #/* Latin-1 is equivalent to the first 256 ordinals in Unicode. */ - if (size == 1): - return [PyUnicode_FromUnicode(s, 1)] +## if (size == 1): +## return [PyUnicode_FromUnicode(s, 1)] pos = 0 p = [] while (pos < size): - p += s[pos] + p += unichr(ord(s[pos])) pos += 1 return p @@ -911,16 +911,13 @@ encoding = "ascii" if (size == 0): - return '' + return [''] res = [] pos=0 while pos < len(p): #for ch in p: ch = p[pos] - try: - ord(ch) - except TypeError: - print "Typeerror",ch,type(ch) + if ord(ch) < limit: res += chr(ord(ch)) pos += 1 @@ -933,6 +930,7 @@ x = unicode_call_errorhandler(errors,encoding,reason,p,collstart,collend,False) res += str(x[0]) pos = x[1] + return res def PyUnicode_EncodeLatin1(p,size,errors): @@ -983,7 +981,7 @@ if (size == 0): return u'' - + p = [] pos = 0 while (pos < size): @@ -1044,7 +1042,7 @@ # /* \UXXXXXXXX */ elif ch == 'U': - digits = 8; + digits = 8 message = "truncated \\UXXXXXXXX escape"; x = hexescape(s,pos+1,digits,message,errors) p += x[0] @@ -1052,6 +1050,7 @@ ## /* \N{name} */ elif ch == 'N': message = "malformed \\N character escape" + pos += 1 try: import unicodedata except ImportError: @@ -1068,8 +1067,9 @@ look += 1 try: chr = unicodedata.lookup(s[pos:look]) + #x = hexescape(chr,pos+1,8,message,errors) except KeyError: - x=unicode_call_errorhandler(errors,"unicodeescape",message,s,pos-1,size) + x=unicode_call_errorhandler(errors,"unicodeescape",message,s,pos-1,look) else: x = hexescape(s,pos+1,look-pos,message,errors) p += x[0] @@ -1115,15 +1115,13 @@ rep = mapping[c] - if not rep: - raise UnicodeError if isinstance(rep,(int,long)): if rep<256: return chr(rep) else: raise TypeError - elif isinstance(rep,unicode): - raise TypeError +## elif isinstance(rep,unicode): +## raise TypeError else: return rep From ale at codespeak.net Wed May 25 23:48:47 2005 From: ale at codespeak.net (ale at codespeak.net) Date: Wed, 25 May 2005 23:48:47 +0200 (CEST) Subject: [pypy-svn] r12798 - pypy/dist/pypy/objspace/std Message-ID: <20050525214847.327E627B84@code1.codespeak.net> Author: ale Date: Wed May 25 23:48:47 2005 New Revision: 12798 Modified: pypy/dist/pypy/objspace/std/unicodetype.py Log: typo Modified: pypy/dist/pypy/objspace/std/unicodetype.py ============================================================================== --- pypy/dist/pypy/objspace/std/unicodetype.py (original) +++ pypy/dist/pypy/objspace/std/unicodetype.py Wed May 25 23:48:47 2005 @@ -53,7 +53,7 @@ encoding = sys.getdefaultencoding() decoder = codecs.getdecoder(encoding) if errors is None: - retval, lenght = decoder(obj) + retval, length = decoder(obj) else: retval, length = decoder(obj, errors) if not isinstance(retval, unicode): From ericvrp at codespeak.net Thu May 26 09:52:10 2005 From: ericvrp at codespeak.net (ericvrp at codespeak.net) Date: Thu, 26 May 2005 09:52:10 +0200 (CEST) Subject: [pypy-svn] r12800 - pypy/dist/pypy/rpython Message-ID: <20050526075210.40B8227B53@code1.codespeak.net> Author: ericvrp Date: Thu May 26 09:52:09 2005 New Revision: 12800 Modified: pypy/dist/pypy/rpython/rint.py Log: added rtype_sub and SomeInteger.rtype_is_true , will try to do a more complete list next Modified: pypy/dist/pypy/rpython/rint.py ============================================================================== --- pypy/dist/pypy/rpython/rint.py (original) +++ pypy/dist/pypy/rpython/rint.py Thu May 26 09:52:09 2005 @@ -24,6 +24,18 @@ rtype_inplace_add = rtype_add + def rtype_sub((s_int1, s_int2)): + if s_int1.unsigned or s_int2.unsigned: + v_int1 = receive(Unsigned, arg=0) + v_int2 = receive(Unsigned, arg=1) + return direct_op('uint_sub', [v_int1, v_int2], resulttype=Unsigned) + else: + v_int1 = receive(Signed, arg=0) + v_int2 = receive(Signed, arg=1) + return direct_op('int_sub', [v_int1, v_int2], resulttype=Signed) + + rtype_inplace_sub = rtype_sub + def rtype_lt((s_int1, s_int2)): if s_int1.unsigned or s_int2.unsigned: if not s_int1.nonneg or not s_int2.nonneg: @@ -37,6 +49,12 @@ return direct_op('int_lt', [v_int1, v_int2], resulttype=Bool) +class __extend__(SomeInteger): + + def rtype_is_true(s_int): + v_int = receive(Signed, arg=0) + return direct_op('int_is_true', [v_int], resulttype=Bool) + class __extend__(SomeBool): From ericvrp at codespeak.net Thu May 26 11:57:57 2005 From: ericvrp at codespeak.net (ericvrp at codespeak.net) Date: Thu, 26 May 2005 11:57:57 +0200 (CEST) Subject: [pypy-svn] r12801 - pypy/dist/pypy/rpython Message-ID: <20050526095757.92C3B27B57@code1.codespeak.net> Author: ericvrp Date: Thu May 26 11:57:57 2005 New Revision: 12801 Modified: pypy/dist/pypy/rpython/rint.py Log: added more rint methods. Someone please check if this is basicly right! Modified: pypy/dist/pypy/rpython/rint.py ============================================================================== --- pypy/dist/pypy/rpython/rint.py (original) +++ pypy/dist/pypy/rpython/rint.py Thu May 26 11:57:57 2005 @@ -12,6 +12,8 @@ # an operation for now return v + #arithmetic + def rtype_add((s_int1, s_int2)): if s_int1.unsigned or s_int2.unsigned: v_int1 = receive(Unsigned, arg=0) @@ -24,6 +26,18 @@ rtype_inplace_add = rtype_add + def rtype_add_ovf((s_int1, s_int2)): + if s_int1.unsigned or s_int2.unsigned: + v_int1 = receive(Unsigned, arg=0) + v_int2 = receive(Unsigned, arg=1) + return direct_op('uint_add_ovf', [v_int1, v_int2], resulttype=Unsigned) + else: + v_int1 = receive(Signed, arg=0) + v_int2 = receive(Signed, arg=1) + return direct_op('int_add_ovf', [v_int1, v_int2], resulttype=Signed) + + rtype_inplace_add_ovf = rtype_add_ovf + def rtype_sub((s_int1, s_int2)): if s_int1.unsigned or s_int2.unsigned: v_int1 = receive(Unsigned, arg=0) @@ -36,6 +50,165 @@ rtype_inplace_sub = rtype_sub + def rtype_sub_ovf((s_int1, s_int2)): + if s_int1.unsigned or s_int2.unsigned: + v_int1 = receive(Unsigned, arg=0) + v_int2 = receive(Unsigned, arg=1) + return direct_op('uint_sub_ovf', [v_int1, v_int2], resulttype=Unsigned) + else: + v_int1 = receive(Signed, arg=0) + v_int2 = receive(Signed, arg=1) + return direct_op('int_sub_ovf', [v_int1, v_int2], resulttype=Signed) + + rtype_inplace_sub_ovf = rtype_sub_ovf + + def rtype_mul((s_int1, s_int2)): + if s_int1.unsigned or s_int2.unsigned: + v_int1 = receive(Unsigned, arg=0) + v_int2 = receive(Unsigned, arg=1) + return direct_op('uint_mul', [v_int1, v_int2], resulttype=Unsigned) + else: + v_int1 = receive(Signed, arg=0) + v_int2 = receive(Signed, arg=1) + return direct_op('int_mul', [v_int1, v_int2], resulttype=Signed) + + rtype_inplace_mul = rtype_mul + + def rtype_div((s_int1, s_int2)): + if s_int1.unsigned or s_int2.unsigned: + v_int1 = receive(Unsigned, arg=0) + v_int2 = receive(Unsigned, arg=1) + return direct_op('uint_div', [v_int1, v_int2], resulttype=Unsigned) + else: + v_int1 = receive(Signed, arg=0) + v_int2 = receive(Signed, arg=1) + return direct_op('int_div', [v_int1, v_int2], resulttype=Signed) + + rtype_inplace_div = rtype_div + + def rtype_mod((s_int1, s_int2)): + if s_int1.unsigned or s_int2.unsigned: + v_int1 = receive(Unsigned, arg=0) + v_int2 = receive(Unsigned, arg=1) + return direct_op('uint_mod', [v_int1, v_int2], resulttype=Unsigned) + else: + v_int1 = receive(Signed, arg=0) + v_int2 = receive(Signed, arg=1) + return direct_op('int_mod', [v_int1, v_int2], resulttype=Signed) + + rtype_inplace_mod = rtype_mod + + def rtype_xor((s_int1, s_int2)): + if s_int1.unsigned or s_int2.unsigned: + v_int1 = receive(Unsigned, arg=0) + v_int2 = receive(Unsigned, arg=1) + return direct_op('uint_xor', [v_int1, v_int2], resulttype=Unsigned) + else: + v_int1 = receive(Signed, arg=0) + v_int2 = receive(Signed, arg=1) + return direct_op('int_xor', [v_int1, v_int2], resulttype=Signed) + + rtype_inplace_xor = rtype_xor + + def rtype_and_((s_int1, s_int2)): + if s_int1.unsigned or s_int2.unsigned: + v_int1 = receive(Unsigned, arg=0) + v_int2 = receive(Unsigned, arg=1) + return direct_op('uint_and', [v_int1, v_int2], resulttype=Unsigned) + else: + v_int1 = receive(Signed, arg=0) + v_int2 = receive(Signed, arg=1) + return direct_op('int_and', [v_int1, v_int2], resulttype=Signed) + + rtype_inplace_and = rtype_and_ + + def rtype_or_((s_int1, s_int2)): + if s_int1.unsigned or s_int2.unsigned: + v_int1 = receive(Unsigned, arg=0) + v_int2 = receive(Unsigned, arg=1) + return direct_op('uint_or', [v_int1, v_int2], resulttype=Unsigned) + else: + v_int1 = receive(Signed, arg=0) + v_int2 = receive(Signed, arg=1) + return direct_op('int_or', [v_int1, v_int2], resulttype=Signed) + + rtype_inplace_or = rtype_or_ + + def rtype_lshift((s_int1, s_int2)): + if s_int1.unsigned or s_int2.unsigned: + v_int1 = receive(Unsigned, arg=0) + v_int2 = receive(Unsigned, arg=1) + return direct_op('uint_lshift', [v_int1, v_int2], resulttype=Unsigned) + else: + v_int1 = receive(Signed, arg=0) + v_int2 = receive(Signed, arg=1) + return direct_op('int_lshift', [v_int1, v_int2], resulttype=Signed) + + rtype_inplace_lshift = rtype_lshift + + def rtype_rshift((s_int1, s_int2)): + if s_int1.unsigned or s_int2.unsigned: + v_int1 = receive(Unsigned, arg=0) + v_int2 = receive(Unsigned, arg=1) + return direct_op('uint_rshift', [v_int1, v_int2], resulttype=Unsigned) + else: + v_int1 = receive(Signed, arg=0) + v_int2 = receive(Signed, arg=1) + return direct_op('int_rshift', [v_int1, v_int2], resulttype=Signed) + + rtype_inplace_rshift = rtype_rshift + + def rtype_lshift_ovf((s_int1, s_int2)): + if s_int1.unsigned or s_int2.unsigned: + v_int1 = receive(Unsigned, arg=0) + v_int2 = receive(Unsigned, arg=1) + return direct_op('uint_lshift_ovf', [v_int1, v_int2], resulttype=Unsigned) + else: + v_int1 = receive(Signed, arg=0) + v_int2 = receive(Signed, arg=1) + return direct_op('int_lshift_ovf', [v_int1, v_int2], resulttype=Signed) + + rtype_inplace_lshift_ovf = rtype_lshift_ovf + + def rtype_rshift_ovf((s_int1, s_int2)): + if s_int1.unsigned or s_int2.unsigned: + v_int1 = receive(Unsigned, arg=0) + v_int2 = receive(Unsigned, arg=1) + return direct_op('uint_rshift_ovf', [v_int1, v_int2], resulttype=Unsigned) + else: + v_int1 = receive(Signed, arg=0) + v_int2 = receive(Signed, arg=1) + return direct_op('int_rshift_ovf', [v_int1, v_int2], resulttype=Signed) + + rtype_inplace_rshift_ovf = rtype_rshift_ovf + + def rtype_pow((s_int1, s_int2)): + #XXX RPythonTyper gives this error: TypeError: rtype_pow() takes exactly 1 argument (2 given) + if s_int1.unsigned or s_int2.unsigned: + v_int1 = receive(Unsigned, arg=0) + v_int2 = receive(Unsigned, arg=1) + return direct_op('uint_pow', [v_int1, v_int2], resulttype=Unsigned) + else: + v_int1 = receive(Signed, arg=0) + v_int2 = receive(Signed, arg=1) + return direct_op('int_pow', [v_int1, v_int2], resulttype=Signed) + + rtype_inplace_pow = rtype_pow + + #comparisons: eq is_ ne lt le gt ge + + def rtype_eq((s_int1, s_int2)): + v_int1 = receive(Signed, arg=0) + v_int2 = receive(Signed, arg=1) + return direct_op('int_eq', [v_int1, v_int2], resulttype=Bool) + + rtype_is_ = rtype_eq + + def rtype_ne((s_int1, s_int2)): + v_int1 = receive(Signed, arg=0) + v_int2 = receive(Signed, arg=1) + return direct_op('int_ne', [v_int1, v_int2], resulttype=Bool) + def rtype_lt((s_int1, s_int2)): if s_int1.unsigned or s_int2.unsigned: if not s_int1.nonneg or not s_int2.nonneg: @@ -48,6 +221,42 @@ v_int2 = receive(Signed, arg=1) return direct_op('int_lt', [v_int1, v_int2], resulttype=Bool) + def rtype_le((s_int1, s_int2)): + if s_int1.unsigned or s_int2.unsigned: + if not s_int1.nonneg or not s_int2.nonneg: + raise TyperError("comparing a signed and an unsigned number") + v_int1 = receive(Unsigned, arg=0) + v_int2 = receive(Unsigned, arg=1) + return direct_op('uint_le', [v_int1, v_int2], resulttype=Bool) + else: + v_int1 = receive(Signed, arg=0) + v_int2 = receive(Signed, arg=1) + return direct_op('int_le', [v_int1, v_int2], resulttype=Bool) + + def rtype_gt((s_int1, s_int2)): + if s_int1.unsigned or s_int2.unsigned: + if not s_int1.nonneg or not s_int2.nonneg: + raise TyperError("comparing a signed and an unsigned number") + v_int1 = receive(Unsigned, arg=0) + v_int2 = receive(Unsigned, arg=1) + return direct_op('uint_gt', [v_int1, v_int2], resulttype=Bool) + else: + v_int1 = receive(Signed, arg=0) + v_int2 = receive(Signed, arg=1) + return direct_op('int_gt', [v_int1, v_int2], resulttype=Bool) + + def rtype_ge((s_int1, s_int2)): + if s_int1.unsigned or s_int2.unsigned: + if not s_int1.nonneg or not s_int2.nonneg: + raise TyperError("comparing a signed and an unsigned number") + v_int1 = receive(Unsigned, arg=0) + v_int2 = receive(Unsigned, arg=1) + return direct_op('uint_ge', [v_int1, v_int2], resulttype=Bool) + else: + v_int1 = receive(Signed, arg=0) + v_int2 = receive(Signed, arg=1) + return direct_op('int_ge', [v_int1, v_int2], resulttype=Bool) + class __extend__(SomeInteger): @@ -55,6 +264,29 @@ v_int = receive(Signed, arg=0) return direct_op('int_is_true', [v_int], resulttype=Bool) + #Unary arithmetic operations + + def rtype_abs(s_int): + v_int = receive(Signed, arg=0) + return direct_op('int_abs', [v_int], resulttype=Signed) + + def rtype_abs_ovf(s_int): + v_int = receive(Signed, arg=0) + return direct_op('int_abs_ovf', [v_int], resulttype=Signed) + + def rtype_invert(s_int): + v_int = receive(Signed, arg=0) + return direct_op('int_invert', [v_int], resulttype=Signed) + + def rtype_neg(s_int): + v_int = receive(Signed, arg=0) + return direct_op('int_neg', [v_int], resulttype=Signed) + + def rtype_pos(s_int): + #XXX I think this is a nop and should really be removed from the graph + v_int = receive(Signed, arg=0) + return direct_op('int_pos', [v_int], resulttype=Signed) + class __extend__(SomeBool): From ac at codespeak.net Thu May 26 17:40:13 2005 From: ac at codespeak.net (ac at codespeak.net) Date: Thu, 26 May 2005 17:40:13 +0200 (CEST) Subject: [pypy-svn] r12809 - pypy/dist/pypy/module/unicodedata Message-ID: <20050526154013.7C63E27B52@code1.codespeak.net> Author: ac Date: Thu May 26 17:40:13 2005 New Revision: 12809 Modified: pypy/dist/pypy/module/unicodedata/CompositionExclusions-3.2.0.txt (props changed) pypy/dist/pypy/module/unicodedata/CompositionExclusions-4.1.0.txt (props changed) pypy/dist/pypy/module/unicodedata/UnicodeData-3.2.0.txt (props changed) pypy/dist/pypy/module/unicodedata/UnicodeData-4.1.0.txt (props changed) Log: Fix eol-style. From cfbolz at codespeak.net Thu May 26 18:36:42 2005 From: cfbolz at codespeak.net (cfbolz at codespeak.net) Date: Thu, 26 May 2005 18:36:42 +0200 (CEST) Subject: [pypy-svn] r12810 - in pypy/dist/pypy/translator/llvm: . test Message-ID: <20050526163642.E076A27B5F@code1.codespeak.net> Author: cfbolz Date: Thu May 26 18:36:42 2005 New Revision: 12810 Modified: pypy/dist/pypy/translator/llvm/funcrepr.py pypy/dist/pypy/translator/llvm/genllvm.py pypy/dist/pypy/translator/llvm/llvmbc.py pypy/dist/pypy/translator/llvm/representation.py pypy/dist/pypy/translator/llvm/test/test_class.py pypy/dist/pypy/translator/llvm/test/test_genllvm.py pypy/dist/pypy/translator/llvm/test/test_seq.py pypy/dist/pypy/translator/llvm/test/test_snippet.py pypy/dist/pypy/translator/llvm/typerepr.py Log: tart of rewrite of genllvm: added simple arithmetic types. Nearly everything is broken now (is disabled most tests), because the typer supports so few things. Most tests crash in RPythonTyper.specialize(). On the plus side: The ugly operations.ll can probably go soon. Modified: pypy/dist/pypy/translator/llvm/funcrepr.py ============================================================================== --- pypy/dist/pypy/translator/llvm/funcrepr.py (original) +++ pypy/dist/pypy/translator/llvm/funcrepr.py Thu May 26 18:36:42 2005 @@ -250,15 +250,22 @@ l_op = getattr(l_arg0, "op_" + op.opname, None) if l_op is not None: l_op(l_target, op.args, self.lblock, self.l_func) - elif op.opname in INTRINSIC_OPS: + return + try: + l_arg0.op(op.opname, l_target, op.args, self.lblock, self.l_func) + except NotImplementedError: + pass + except CompileError: + pass + if op.opname in INTRINSIC_OPS: l_args = [self.gen.get_repr(arg) for arg in op.args[1:]] self.l_func.dependencies.update(l_args) self.lblock.spaceop(l_target, op.opname, [l_arg0] + l_args) - else: - s = "SpaceOperation %s not supported. Target: %s " \ - "Args: %s " % (op.opname, l_target, op.args) + \ - "Dispatched on: %s" % l_arg0 - raise CompileError, s + return + s = "SpaceOperation %s not supported. Target: %s " \ + "Args: %s " % (op.opname, l_target, op.args) + \ + "Dispatched on: %s" % l_arg0 + raise CompileError, s def create_terminator_instr(self): if debug: Modified: pypy/dist/pypy/translator/llvm/genllvm.py ============================================================================== --- pypy/dist/pypy/translator/llvm/genllvm.py (original) +++ pypy/dist/pypy/translator/llvm/genllvm.py Thu May 26 18:36:42 2005 @@ -13,8 +13,11 @@ import autopath import sets, StringIO -from pypy.objspace.flow.model import Constant +from pypy.objspace.flow.model import Constant, Variable from pypy.annotation import model as annmodel + +from pypy.rpython import rtyper, lltype + from pypy.translator import transform from pypy.translator.translator import Translator from pypy.translator.llvm import llvmbc @@ -29,7 +32,9 @@ from pypy.translator.llvm.representation import CompileError from pypy.translator.llvm.funcrepr import EntryFunctionRepr -debug = False +from pypy.translator.llvm import reprmap + +debug = True def llvmcompile(transl, optimize=False): @@ -37,6 +42,9 @@ return gen.compile(optimize) def get_key(obj): + if isinstance(obj, list): + return id(obj) + return obj #XXX Get rid of this: #LLVMGenerator should only cache gen_repr requestes, #the Repr classes should be responsible for deciding which queries @@ -60,6 +68,8 @@ def __init__(self, transl): self.translator = transl self.annotator = self.translator.annotator + self.rtyper = rtyper.RPythonTyper(self.annotator) + self.rtyper.specialize() self.global_counts = {} self.local_counts = {} self.repr_classes = [] @@ -75,8 +85,8 @@ self.l_entrypoint = EntryFunctionRepr("%__entry__" + self.entryname, self.translator.functions[0], self) - classrepr.create_builtin_exceptions(self, - self.l_entrypoint.dependencies) +## classrepr.create_builtin_exceptions( +## self, self.l_entrypoint.get_dependencies()) self.local_counts[self.l_entrypoint] = 0 self.l_entrypoint.setup() @@ -107,11 +117,12 @@ def get_local_tmp(self, type, l_function): self.local_counts[l_function] += 1 - return TmpVariableRepr("tmp_%i" % self.local_counts[l_function], type, + return TmpVariableRepr("tmp.%i" % self.local_counts[l_function], type, self) def get_repr(self, obj): self.depth += 1 + key = get_key(obj) if debug: print " " * self.depth, print "looking for object", obj, type(obj).__name__, @@ -119,24 +130,44 @@ if isinstance(obj, LLVMRepr): self.depth -= 1 return obj - if get_key(obj) in self.llvm_reprs: + if key in self.llvm_reprs: self.depth -= 1 if debug: - print "->exists already:", self.llvm_reprs[get_key(obj)] - return self.llvm_reprs[get_key(obj)] + print "->exists already:", self.llvm_reprs[key] + return self.llvm_reprs[key] + elif isinstance(obj, Variable): + try: + obj.concretetype + except AttributeError: + self.rtyper.setconcretetype(obj) + result = representation.VariableRepr(obj, self) + self.llvm_reprs[result] = result + self.depth -= 1 + return result + elif isinstance(obj, lltype.Primitive): + result = reprmap.PRIMITIVE_TYPES[obj](self) + self.llvm_reprs[key] = result + self.depth -= 1 + return result + if isinstance(obj, Constant): + try: + T = lltype.typeOf(obj) + if isinstance(T, lltype.Primitive): + result = reprmap.PRIMITIVE_REPRS[concretetype](obj, self) + self.llvm_reprs[key] = result + self.depth -= 1 + return result + #XXX find the right type if it is not a Primitive + except AttributeError: + pass for cl in self.repr_classes: try: g = cl.get(obj, self) except AttributeError: continue if g is not None: - self.llvm_reprs[get_key(obj)] = g + self.llvm_reprs[key] = g self.local_counts[g] = 0 -## if not hasattr(g.__class__, "lazy_attributes"): -## if debug: -## print " " * self.depth, -## print "calling setup of %s, repr of %s" % (g, obj) -## g.setup() self.depth -= 1 return g raise CompileError, "Can't get repr of %s, %s" % (obj, obj.__class__) @@ -182,7 +213,7 @@ def unlazyify(self): if debug: print - print "$$$$$$$$$$$$$$ unlazyify" + print "unlazyify" while len(self.lazy_objects): obj = self.lazy_objects.pop() if debug: @@ -226,3 +257,11 @@ remove_loops(l_dep, seen_repr.union(sets.Set([l_repr]))) deps.difference_update(remove) +## def f(): +## l = [10,20,30] +## return l[2] + +## t = Translator(f) +## a = t.annotate([]) + +## flg = t.getflowgraph() Modified: pypy/dist/pypy/translator/llvm/llvmbc.py ============================================================================== --- pypy/dist/pypy/translator/llvm/llvmbc.py (original) +++ pypy/dist/pypy/translator/llvm/llvmbc.py Thu May 26 18:36:42 2005 @@ -86,6 +86,14 @@ self.phi_done = True self.instructions.append("unwind") + #Arithmetic instructions + def binary_instruction(self, instr, l_target, l_a, l_b): + self.phi_done = True + assert l_a.llvmtype() == l_b.llvmtype() + s = "%s = %s %s, %s" % (l_target.llvmname(), instr, + l_a.typed_name(), l_b.llvmname()) + self.instructions.append(s) + #Memory access instructions def load(self, l_target, l_pter): self.phi_done = True Modified: pypy/dist/pypy/translator/llvm/representation.py ============================================================================== --- pypy/dist/pypy/translator/llvm/representation.py (original) +++ pypy/dist/pypy/translator/llvm/representation.py Thu May 26 18:36:42 2005 @@ -21,15 +21,20 @@ from pypy.objspace.flow.model import Variable, Constant from pypy.objspace.flow.model import last_exception -# this is only used as a token for the pointer to the last exception object -last_exc_value = object() + +from pypy.rpython import lltype from pypy.annotation import model as annmodel from pypy.translator.llvm.lazyattribute import MetaLazyRepr + LLVM_SIMPLE_TYPES = {annmodel.SomeChar: "sbyte", annmodel.SomeBool: "bool", annmodel.SomeFloat: "double"} +# this is only used as a token for the pointer to the last exception object +last_exc_value = object() + + debug = False @@ -65,6 +70,14 @@ def llvmtype(self): return self.type.typename() + def llvmsize(self): + raise NotImplementedError, "This object has no size!" + + def op(self, opname, l_target, args, lblock, l_func): + if hasattr(self, "type") and hasattr(self.type, "t_op"): + return self.type.t_op(opname, l_target, args, lblock, l_func) + raise CompileError, "op '%s' not supported" % opname + def typed_name(self): return self.llvmtype() + " " + self.llvmname() @@ -74,7 +87,68 @@ except AttributeError: return sets.Set() +class SignedRepr(LLVMRepr): + def __init__(self, value, gen): + if debug: + print "SignedRepr: %d" % value + self.value = value + self.gen = gen + self.type = self.gen.get_repr(lltype.Signed) + + def llvmname(self): + return str(self.value) + + def get_dependencies(self): + return [self.type] + +class UnsignedRepr(LLVMRepr): + def __init__(self, value, gen): + if debug: + print "UnsignedRepr: %d" % value + self.value = value + self.gen = gen + self.type = self.gen.get_repr(lltype.Unsigned) + def llvmname(self): + return str(self.value) + + def get_dependencies(self): + return [self.type] + +class BoolRepr(LLVMRepr): + def __init__(self, value, gen): + if debug: + print "BoolRepr: %d" % value + self.value = bool(value) + self.gen = gen + self.type = self.gen.get_repr(lltype.Bool) + + def llvmname(self): + return str(self.value).lower() + + def get_dependencies(self): + return [self.type] + +class CharRepr(LLVMRepr): + def __init__(self, value, gen): + if debug: + print "CharRepr: %d" % value + assert len(value) == 1 + self.value = value + self.gen = gen + self.type = self.gen.get_repr(lltype.Char) + + def llvmname(self): + value = value + if ' ' <= value < '\x7f': + return "'%s'" % (value.replace("'", r"\'"),) + else: + return '%d' % ord(value) + + def get_dependencies(self): + return [self.type] + + class SimpleRepr(LLVMRepr): """Representation of values that only need simple representation: bool, char (string of length 1), last_exception, last_exc_value""" @@ -163,14 +237,19 @@ if debug: print "VariableRepr: %s" % (var.name) self.var = var - type_ = gen.annotator.binding(var) + try: + type_ = var.concretetype + except AttributeError: + type_ = gen.annotator.binding(var.c) self.type = gen.get_repr(type_) + print "XXXXXXXXXXXXXXXX", self.type self.dependencies = sets.Set([self.type]) def llvmname(self): return "%" + self.var.name def __getattr__(self, name): + print "$%%%%%%%%%%%%%%%%%getattr called", name, self.type.typename() if name.startswith("op_"): return getattr(self.type, "t_" + name, None) elif name.startswith("cast_"): Modified: pypy/dist/pypy/translator/llvm/test/test_class.py ============================================================================== --- pypy/dist/pypy/translator/llvm/test/test_class.py (original) +++ pypy/dist/pypy/translator/llvm/test/test_class.py Thu May 26 18:36:42 2005 @@ -14,6 +14,7 @@ class TestClass(object): def setup_method(self, method): + py.test.skip("nothing works for now") if not llvm_found: py.test.skip("llvm-as not found on path.") @@ -71,6 +72,6 @@ assert f(True) == -36 assert f(False) == 14 - def test_circular_classdef(self): + def DONOTtest_circular_classdef(self): f = compile_function(llvmsnippet.circular_classdef, []) assert f() == 10 Modified: pypy/dist/pypy/translator/llvm/test/test_genllvm.py ============================================================================== --- pypy/dist/pypy/translator/llvm/test/test_genllvm.py (original) +++ pypy/dist/pypy/translator/llvm/test/test_genllvm.py Thu May 26 18:36:42 2005 @@ -62,7 +62,7 @@ f = compile_function(llvmsnippet.simple2, []) assert f() == 0 - def test_simple4(self): + def DONOTtest_simple4(self): f = compile_function(llvmsnippet.simple4, []) assert f() == 4 @@ -71,7 +71,7 @@ assert f(1) == 12 assert f(0) == 13 - def test_ackermann(self): + def DONOTtest_ackermann(self): f = compile_function(llvmsnippet.ackermann, [int, int]) for i in range(10): assert f(0, i) == i + 1 @@ -79,26 +79,27 @@ assert f(2, i) == 2 * i + 3 assert f(3, i) == 2 ** (i + 3) - 3 - def test_calling(self): + def DONOTtest_calling(self): f = compile_function(llvmsnippet.calling1, [int]) assert f(10) == 1 - def test_call_default_arguments(self): + def DONOTtest_call_default_arguments(self): f = compile_function(llvmsnippet.call_default_arguments, [int, int]) for i in range(3): assert f(i + 3, i) == llvmsnippet.call_default_arguments(i + 3, i) - def test_call_list_default_argument(self): + def DONOTtest_call_list_default_argument(self): f = compile_function(llvmsnippet.call_list_default_argument, [int]) for i in range(20): assert f(i) == llvmsnippet.call_list_default_argument(i) - def test_return_none(self): + def DONOTtest_return_none(self): f = compile_function(llvmsnippet.return_none, []) assert f() is None class TestFloat(object): def setup_method(self, method): + py.test.skip("nothing works for now") if not llvm_found: py.test.skip("llvm-as not found on path.") @@ -113,6 +114,7 @@ class TestString(object): def setup_method(self, method): + py.test.skip("nothing works for now") if not llvm_found: py.test.skip("llvm-as not found on path.") @@ -123,6 +125,7 @@ class TestException(object): def setup_method(self,method): + py.test.skip("nothing works for now") if not llvm_found: py.test.skip("llvm-as not found on path") @@ -159,6 +162,7 @@ class TestPBC(object): def setup_method(self, method): + py.test.skip("nothing works for now") if not llvm_found: py.test.skip("llvm-as not found on path.") @@ -169,7 +173,7 @@ assert f(2) == 6 assert f(3) == 8 - def test_pbc_function2(self): + def DONOTtest_pbc_function2(self): f = compile_function(llvmsnippet.pbc_function2, [int]) assert f(0) == 13 assert f(1) == 15 Modified: pypy/dist/pypy/translator/llvm/test/test_seq.py ============================================================================== --- pypy/dist/pypy/translator/llvm/test/test_seq.py (original) +++ pypy/dist/pypy/translator/llvm/test/test_seq.py Thu May 26 18:36:42 2005 @@ -14,6 +14,7 @@ class TestLLVMArray(object): def setup_method(self, method): + py.test.skip("nothing works for now") if not llvm_found: py.test.skip("llvm-as not found on path.") @@ -107,6 +108,7 @@ class TestTuple(object): def setup_method(self, method): + py.test.skip("nothing works for now") if not llvm_found: py.test.skip("llvm-as not found on path.") Modified: pypy/dist/pypy/translator/llvm/test/test_snippet.py ============================================================================== --- pypy/dist/pypy/translator/llvm/test/test_snippet.py (original) +++ pypy/dist/pypy/translator/llvm/test/test_snippet.py Thu May 26 18:36:42 2005 @@ -14,6 +14,7 @@ class TestSnippet(object): def setup_method(self, method): + py.test.skip("nothing works for now") if not llvm_found: py.test.skip("llvm-as not found on path.") Modified: pypy/dist/pypy/translator/llvm/typerepr.py ============================================================================== --- pypy/dist/pypy/translator/llvm/typerepr.py (original) +++ pypy/dist/pypy/translator/llvm/typerepr.py Thu May 26 18:36:42 2005 @@ -16,6 +16,12 @@ from pypy.translator.llvm.representation import LLVM_SIMPLE_TYPES +import sys +if 2147483647 == sys.maxint: + BYTES_IN_INT = 4 +else: + BYTES_IN_INT = 8 + class TypeRepr(LLVMRepr): def get(obj, gen): @@ -56,10 +62,92 @@ return self.name def llvmname(self): - raise CompileError, "This type is not an object." + raise NotImplementedError, "This type is not an object." def llvmtype(self): - raise CompileError, "This type is not an object." + raise NotImplementedError, \ + "This type is not an object. %s" % self.__class__ + + def llvmsize(self): + raise NotImplementedError, "This type does not have a size." + + +class SignedTypeRepr(TypeRepr): + directly_supported_ops = { + "int_add": "add", + "int_sub": "sub", + "int_mul": "mul", + "int_div": "div", + "int_mod": "rem", + "int_xor": "xor", + "int_and_": "and", + "int_eq": "seteq", + "int_ne": "setne", + "int_gt": "setgt", + "int_ge": "setge", + "int_lt": "setlt", + "int_le": "setle"} + + def __init__(self, gen): + if debug: + print "SignedTypeRepr" + self.gen = gen + + def t_op(self, opname, l_target, args, lblock, l_func): + if opname in SignedTypeRepr.directly_supported_ops: + assert len(args) == 2 + l_args = [self.gen.get_repr(arg) for arg in args] + l_func.dependencies.update(l_args) + lblock.binary_instruction( + SignedTypeRepr.directly_supported_ops[opname], l_target, + l_args[0], l_args[1]) + + def t_op_int_is_true(self, l_target, args, lblock, l_func): + l_arg = self.gen.get_repr(args[0]) + l_func.dependencies.add(l_arg) + lblock.cast(l_target, l_arg) + + def typename(self): + return "int" + + def llvmsize(self): + return BYTES_IN_INT + +class UnsignedTypeRepr(TypeRepr): + def __init__(self, gen): + if debug: + print "UnsignedTypeRepr" + self.gen = gen + + def typename(self): + return "uint" + + def llvmsize(self): + return BYTES_IN_INT + +class BoolTypeRepr(TypeRepr): + def __init__(self, gen): + if debug: + print "BoolTypeRepr" + self.gen = gen + + def typename(self): + return "bool" + + def llvmsize(self): + return 1 + +class CharTypeRepr(TypeRepr): + def __init__(self, gen): + if debug: + print "CharTypeRepr" + self.gen = gen + + def typename(self): + return "sbyte" + + def llvmsize(self): + return 1 class StringTypeRepr(TypeRepr): From arigo at codespeak.net Thu May 26 18:38:36 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Thu, 26 May 2005 18:38:36 +0200 (CEST) Subject: [pypy-svn] r12811 - pypy/dist/pypy/rpython Message-ID: <20050526163836.9F12127B84@code1.codespeak.net> Author: arigo Date: Thu May 26 18:38:36 2005 New Revision: 12811 Modified: pypy/dist/pypy/rpython/rtyper.py Log: Give the return variable the proper low-level type too. Modified: pypy/dist/pypy/rpython/rtyper.py ============================================================================== --- pypy/dist/pypy/rpython/rtyper.py (original) +++ pypy/dist/pypy/rpython/rtyper.py Thu May 26 18:38:36 2005 @@ -37,8 +37,7 @@ pending = self.annotator.annotated.keys() while pending: for block in pending: - if block.operations != (): - self.specialize_block(block) + self.specialize_block(block) already_seen[block] = True pending = [block for block in self.annotator.annotated if block not in already_seen] @@ -65,6 +64,8 @@ self.setconcretetype(a) # specialize all the operations, as far as possible + if block.operations == (): # return or except block + return newops = [] varmapping = {} for op in block.operations: From adim at codespeak.net Thu May 26 19:18:06 2005 From: adim at codespeak.net (adim at codespeak.net) Date: Thu, 26 May 2005 19:18:06 +0200 (CEST) Subject: [pypy-svn] r12814 - pypy/branch/pycompiler/module/recparser Message-ID: <20050526171806.31CD427B5F@code1.codespeak.net> Author: adim Date: Thu May 26 19:18:06 2005 New Revision: 12814 Modified: pypy/branch/pycompiler/module/recparser/ebnflexer.py pypy/branch/pycompiler/module/recparser/ebnfparse.py pypy/branch/pycompiler/module/recparser/grammar.py pypy/branch/pycompiler/module/recparser/pythonlexer.py pypy/branch/pycompiler/module/recparser/pythonparse.py Log: - added lookehead (don't try to match rule when the next token is not in the rule's first set) - added small tests - Still unfinished, and breaks (for now) test_samples.py Modified: pypy/branch/pycompiler/module/recparser/ebnflexer.py ============================================================================== --- pypy/branch/pycompiler/module/recparser/ebnflexer.py (original) +++ pypy/branch/pycompiler/module/recparser/ebnflexer.py Thu May 26 19:18:06 2005 @@ -21,6 +21,7 @@ TokenSource.__init__(self) self.input = inpstring self.pos = 0 + self._peeked = None def context(self): return self.pos @@ -36,6 +37,10 @@ self.pos = ctx def next(self): + if self._peeked is not None: + self._peeked = None + return self._peeked + pos = self.pos inp = self.input m = g_skip.match(inp, pos) @@ -67,5 +72,11 @@ return 'SYMBOL',tk raise ValueError("Unknown token at pos=%d context='%s'" % (pos,inp[pos:pos+20]) ) + def peek(self): +## self._peeked = None +## self._peeked = self.next() +## return self._peeked + return None + def debug(self): return self.input[self.pos:self.pos+20] Modified: pypy/branch/pycompiler/module/recparser/ebnfparse.py ============================================================================== --- pypy/branch/pycompiler/module/recparser/ebnfparse.py (original) +++ pypy/branch/pycompiler/module/recparser/ebnfparse.py Thu May 26 19:18:06 2005 @@ -32,7 +32,7 @@ Token.__init__(self, "NAME") self.keywords = keywords - def match(self, source, builder): + def match(self, source, builder, level=0): """Matches a token. the default implementation is to match any token whose type corresponds to the object's name. You can extend Token Modified: pypy/branch/pycompiler/module/recparser/grammar.py ============================================================================== --- pypy/branch/pycompiler/module/recparser/grammar.py (original) +++ pypy/branch/pycompiler/module/recparser/grammar.py Thu May 26 19:18:06 2005 @@ -38,6 +38,22 @@ ###################################################################### + +def build_first_sets(rules): + # PSEUDO CODE + changed = True + loops = 0 + while changed: + loops += 1 + changed = False + for rule in rules: + size = len(rule.first_set) + rule.calc_first_set() + new_size = len(rule.first_set) + if new_size != size: + changed = True + print "Done", loops, "loops" + from syntaxtree import SyntaxNode, TempSyntaxNode, TokenNode class BaseGrammarBuilder(object): @@ -102,6 +118,9 @@ self.name = name self.args = [] self._is_root = False + self.first_set = [] + self.first_set_complete = False + self._processing = False def is_root(self): """This is a root node of the grammar, that is one that will @@ -110,7 +129,35 @@ return False return True - def match(self, source, builder): + def match(self, source, builder, level=0): + """Try to match a grammar rule + + If next set of tokens matches this grammar element, use + to build an appropriate object, otherwise returns None. + + /!\ If the sets of element didn't match the current grammar + element, then the is restored as it was before the + call to the match() method + + returns None if no match or an object build by builder + """ + tok_tuple = source.peek() + # + if tok_tuple is not None: + if tok_tuple not in self.first_set: + prefix = '%s<<<' % (' ' * level) + else: + prefix = '%s>>>' % (' ' * level) + print prefix, " TOKEN =", tok_tuple + print prefix, " RULE =", self + print prefix, " FIRST SET =", self.first_set + print "*" * 50 + # + if tok_tuple is not None and EmptyToken not in self.first_set and tok_tuple not in self.first_set: + return None + return self._match(source, builder, level) + + def _match(self, source, builder, level=0): """Try to match a grammar rule If next set of tokens matches this grammar element, use @@ -131,13 +178,13 @@ # To consider if we need to improve speed in parsing pass - def first_set(self): - """Returns a list of possible tokens that can start this rule - None means the rule can be empty - """ - # **NOT USED** **NOT IMPLEMENTED** - # To consider if we need to improve speed in parsing - pass +## def calc_first_set(self): +## """Returns a list of possible tokens that can start this rule +## None means the rule can be empty +## """ +## # **NOT USED** **NOT IMPLEMENTED** +## # To consider if we need to improve speed in parsing +## pass def __str__(self): return self.display(0) @@ -159,6 +206,15 @@ print "matched %s (%s): %s" % (self.__class__.__name__, sargs, self.display() ) return ret + + def calc_first_set(self): + """returns the list of possible next tokens + *must* be implemented in subclasses + """ + # XXX: first_set could probably be implemented with sets + return [] + + class Alternative(GrammarElement): """Represents an alternative in a grammar rule (as in S -> A | B | C)""" def __init__(self, name, *args): @@ -167,17 +223,21 @@ for i in self.args: assert isinstance( i, GrammarElement ) - def match(self, source, builder): + def _match(self, source, builder, level=0): """If any of the rules in self.args matches returns the object built from the first rules that matches """ if DEBUG>1: print "try alt:", self.display() + tok = source.peek() # Here we stop at the first match we should # try instead to get the longest alternative # to see if this solve our problems with infinite recursion for rule in self.args: - m = rule.match( source, builder ) + if tok is not None and tok not in rule.first_set: + print "Skipping impossible rule: %s" % (rule,) + continue + m = rule.match(source, builder, level+1) if m: ret = builder.alternative( self, source ) return self.debug_return( ret ) @@ -192,7 +252,18 @@ name = "" items = [ a.display(1) for a in self.args ] return name+"(" + "|".join( items ) + ")" - + + def calc_first_set(self): + """returns the list of possible next tokens + if S -> (A | B | C): + LAH(S) = Union( LAH(A), LAH(B), LAH(C) ) + """ + # do this to avoid problems on indirect recursive rules + for rule in self.args: + for t in rule.first_set: + if t not in self.first_set: + self.first_set.append(t) + class Sequence(GrammarElement): """Reprensents a Sequence in a grammar rule (as in S -> A B C)""" @@ -202,14 +273,20 @@ for i in self.args: assert isinstance( i, GrammarElement ) - def match(self, source, builder): + def _match(self, source, builder, level=0): """matches all of the symbols in order""" if DEBUG>1: print "try seq:", self.display() ctx = source.context() bctx = builder.context() + if self.name == 'listmaker': + print "----------------------------- LISTMAKER !" for rule in self.args: - m = rule.match(source, builder) + if self.name == 'listmaker': + print " -------------- IN LISTMAKER, rule =", rule + m = rule.match(source, builder, level+1) + if self.name == 'listmaker': + print " !!!!!!!!!!!!!! IN LISTMAKER, doesn't match %s" % (rule,) if not m: # Restore needed because some rules may have been matched # before the one that failed @@ -229,6 +306,24 @@ items = [a.display(1) for a in self.args] return name + "(" + " ".join( items ) + ")" + def calc_first_set(self): + """returns the list of possible next tokens + if S -> A* B C: + LAH(S) = Union( LAH(A), LAH(B) ) + if S -> A+ B C: + LAH(S) = LAH(A) + if S -> A B C: + LAH(S) = LAH(A) + """ + for rule in self.args: + # while we're in this loop, keep agregating possible tokens + for t in rule.first_set: + if t not in self.first_set: + self.first_set.append(t) + if EmptyToken not in rule.first_set: + break + + class KleenStar(GrammarElement): """Represents a KleenStar in a grammar rule as in (S -> A+) or (S -> A*)""" def __init__(self, name, _min = 0, _max = -1, rule=None): @@ -239,8 +334,10 @@ raise ValueError("KleenStar needs max==-1 or max>1") self.max = _max self.star = "x" + if self.min == 0: + self.first_set.append( EmptyToken ) - def match(self, source, builder): + def _match(self, source, builder, level=0): """matches a number of times self.args[0]. the number must be comprised between self._min and self._max inclusive. -1 is used to represent infinity""" if DEBUG>1: @@ -250,7 +347,7 @@ rules = 0 rule = self.args[0] while True: - m = rule.match(source, builder) + m = rule.match(source, builder, level+1) if not m: # Rule should be matched at least 'min' times if rules A*: + LAH(S) = Union( LAH(A), EmptyToken ) + if S -> A+: + LAH(S) = LAH(A) + """ + rule = self.args[0] + self.first_set = rule.first_set[:] + if self.min == 0 and EmptyToken not in self.first_set: + self.first_set.append(EmptyToken) + class Token(GrammarElement): """Represents a Token in a grammar rule (a lexer token)""" def __init__( self, name, value = None): GrammarElement.__init__( self, name ) self.value = value + self.first_set = [self] - def match(self, source, builder): + def _match(self, source, builder, level=0): """Matches a token. the default implementation is to match any token whose type corresponds to the object's name. You can extend Token @@ -301,7 +411,7 @@ """ ctx = source.context() tk_type, tk_value = source.next() - if tk_type==self.name: + if tk_type == self.name: if self.value is None: ret = builder.token( tk_type, tk_value, source ) return self.debug_return( ret, tk_type ) @@ -320,3 +430,28 @@ return "<%s>=='%s'" % (self.name, self.value) + def __eq__(self, other): + """convenience '==' implementation, this is *not* a *real* equality test + a Token instance can be compared to: + - another Token instance in which case all fields (name and value) + must be equal + - a tuple, such as those yielded by the Python lexer, in which case + the comparison algorithm is similar to the one in match() + XXX refactor match and __eq__ ? + """ + if other is None: + return False + elif isinstance(other, Token): + return self.value == other.value and self.name == other.name + elif isinstance(other, tuple) and len(other) == 2: + tk_type, tk_value = other + return tk_type == self.name and self.value in (None, tk_value) + return False + + + def calc_first_set(self): + """returns the list of possible next tokens + """ + pass + +EmptyToken = object() # Token('???') Modified: pypy/branch/pycompiler/module/recparser/pythonlexer.py ============================================================================== --- pypy/branch/pycompiler/module/recparser/pythonlexer.py (original) +++ pypy/branch/pycompiler/module/recparser/pythonlexer.py Thu May 26 19:18:06 2005 @@ -223,6 +223,14 @@ if DEBUG: print "%d/%d: %s, %s" % (self.stack_pos, len(self.stack), tok, val) return (tok, val) + + def peek(self): + """returns next token without consuming it""" + ctx = self.context() + tok_tuple = self.next() + self.restore(ctx) + return tok_tuple + def end_of_file(self): """return DEDENT and ENDMARKER""" Modified: pypy/branch/pycompiler/module/recparser/pythonparse.py ============================================================================== --- pypy/branch/pycompiler/module/recparser/pythonparse.py (original) +++ pypy/branch/pycompiler/module/recparser/pythonparse.py Thu May 26 19:18:06 2005 @@ -16,6 +16,8 @@ grammar.DEBUG = 0 gram = parse_grammar( file(PYTHON_GRAMMAR) ) grammar.DEBUG = level + # Build first sets for each rule (including anonymous ones) + grammar.build_first_sets(gram.items) return gram PYTHON_PARSER = python_grammar() From adim at codespeak.net Thu May 26 19:18:51 2005 From: adim at codespeak.net (adim at codespeak.net) Date: Thu, 26 May 2005 19:18:51 +0200 (CEST) Subject: [pypy-svn] r12815 - pypy/branch/pycompiler/module/recparser/test Message-ID: <20050526171851.CC82C27B84@code1.codespeak.net> Author: adim Date: Thu May 26 19:18:51 2005 New Revision: 12815 Added: pypy/branch/pycompiler/module/recparser/test/test_lookahead.py Log: - forgot to add this file on last checkin Added: pypy/branch/pycompiler/module/recparser/test/test_lookahead.py ============================================================================== --- (empty file) +++ pypy/branch/pycompiler/module/recparser/test/test_lookahead.py Thu May 26 19:18:51 2005 @@ -0,0 +1,70 @@ +from pypy.module.recparser.grammar import Alternative, Sequence, KleenStar, \ + Token, EmptyToken, build_first_sets + +class TestLookAheadBasics: + + def setup_method(self, method): + self.tok1 = Token('t1', 'foo') + self.tok2 = Token('t2', 'bar') + self.tok3 = Token('t3', 'foobar') + self.tokens = [self.tok1, self.tok2, self.tok3] + build_first_sets(self.tokens) + + def test_basic_token(self): + assert self.tok1.first_set == [self.tok1] + + + def test_basic_alternative(self): + alt = Alternative('alt', *self.tokens) + build_first_sets([alt]) + assert alt.first_set == self.tokens + + + def test_basic_sequence(self): + seq = Sequence('seq', *self.tokens) + build_first_sets([seq]) + assert seq.first_set == [self.tokens[0]] + + def test_basic_kleenstar(self): + tok1, tok2, tok3 = self.tokens + kstar = KleenStar('kstar', 1, 3, tok1) + build_first_sets([kstar]) + assert kstar.first_set == [tok1] + kstar = KleenStar('kstar', 0, 3, tok1) + build_first_sets([kstar]) + assert kstar.first_set == [tok1, EmptyToken] + + +def test_token_comparison(): + assert Token('t1', 'foo') == Token('t1', 'foo') + assert ('t1', 'foo') == Token('t1', 'foo') + + # assert Token('t1', 'foo') == Token('t1', None) + assert ('t1', 'foo') == Token('t1', None) + + assert Token('t1', 'foo') != Token('t2', 'foo') + assert ('t1', 'foo') != Token('t2', 'foo') + + assert Token('t2', 'foo') != Token('t1', None) + assert ('t2', 'foo') != Token('t1', None) + + +class TestLookAhead: + + def setup_method(self, method): + self.LOW = Token('LOW', 'low') + self.CAP = Token('CAP' ,'cap') + self.A = Alternative('A') + k1 = KleenStar('k1', 0, rule=self.LOW) + k2 = KleenStar('k2', 0, rule=self.CAP) + self.B = Sequence('B', k1, self.A) + self.C = Sequence('C', k2, self.A) + self.A.args = [self.B, self.C] + build_first_sets([self.A, self.B, self.C, self.LOW, self.CAP, k1, k2]) + + def test_S_first_set(self): + for s in [('LOW', 'low'), EmptyToken, ('CAP', 'cap')]: + assert s in self.A.first_set + assert s in self.B.first_set + assert s in self.C.first_set + From cfbolz at codespeak.net Thu May 26 23:47:26 2005 From: cfbolz at codespeak.net (cfbolz at codespeak.net) Date: Thu, 26 May 2005 23:47:26 +0200 (CEST) Subject: [pypy-svn] r12823 - pypy/dist/pypy/documentation/images Message-ID: <20050526214726.97B5627B4D@code1.codespeak.net> Author: cfbolz Date: Thu May 26 23:47:26 2005 New Revision: 12823 Added: pypy/dist/pypy/documentation/images/ pypy/dist/pypy/documentation/images/translation.sxd (contents, props changed) Log: issue74 in-progress Added a simple diagram which shows the different stages of translation. Added: pypy/dist/pypy/documentation/images/translation.sxd ============================================================================== Binary file. No diff available. From hpk at codespeak.net Fri May 27 00:10:13 2005 From: hpk at codespeak.net (hpk at codespeak.net) Date: Fri, 27 May 2005 00:10:13 +0200 (CEST) Subject: [pypy-svn] r12824 - in pypy/dist/pypy/documentation: image images Message-ID: <20050526221013.C1C2227B5F@code1.codespeak.net> Author: hpk Date: Fri May 27 00:10:13 2005 New Revision: 12824 Added: pypy/dist/pypy/documentation/image/ - copied from r12823, pypy/dist/pypy/documentation/images/ Removed: pypy/dist/pypy/documentation/images/ Log: being anal about non-plural(s) From ludal at codespeak.net Fri May 27 02:45:36 2005 From: ludal at codespeak.net (ludal at codespeak.net) Date: Fri, 27 May 2005 02:45:36 +0200 (CEST) Subject: [pypy-svn] r12827 - pypy/branch/pycompiler/module/recparser Message-ID: <20050527004536.B2A0327B84@code1.codespeak.net> Author: ludal Date: Fri May 27 02:45:36 2005 New Revision: 12827 Modified: pypy/branch/pycompiler/module/recparser/ebnflexer.py pypy/branch/pycompiler/module/recparser/ebnfparse.py pypy/branch/pycompiler/module/recparser/grammar.py pypy/branch/pycompiler/module/recparser/pythonlexer.py Log: * now Sources return Token objects instead of tuple * renamed __eq__ to match_token (its asymetric) * implements __eq__ for in testing * implements peek for ebnflexer -- lookahead works for ebnfparser Modified: pypy/branch/pycompiler/module/recparser/ebnflexer.py ============================================================================== --- pypy/branch/pycompiler/module/recparser/ebnflexer.py (original) +++ pypy/branch/pycompiler/module/recparser/ebnflexer.py Fri May 27 02:45:36 2005 @@ -4,7 +4,7 @@ """ import re -from grammar import TokenSource +from grammar import TokenSource, Token DEBUG = False @@ -38,8 +38,9 @@ def next(self): if self._peeked is not None: + peeked = self._peeked self._peeked = None - return self._peeked + return peeked pos = self.pos inp = self.input @@ -48,35 +49,35 @@ pos = m.end() if pos==len(inp): self.pos = pos - return None, None + return Token("EOF", None) m = g_skip.match(inp, pos) m = g_symdef.match(inp,pos) if m: tk = m.group(0) self.pos = m.end() - return 'SYMDEF',tk[:-1] + return Token('SYMDEF',tk[:-1]) m = g_tok.match(inp,pos) if m: tk = m.group(0) self.pos = m.end() - return tk,tk + return Token(tk,tk) m = g_string.match(inp,pos) if m: tk = m.group(0) self.pos = m.end() - return 'STRING',tk[1:-1] + return Token('STRING',tk[1:-1]) m = g_symbol.match(inp,pos) if m: tk = m.group(0) self.pos = m.end() - return 'SYMBOL',tk + return Token('SYMBOL',tk) raise ValueError("Unknown token at pos=%d context='%s'" % (pos,inp[pos:pos+20]) ) def peek(self): -## self._peeked = None -## self._peeked = self.next() -## return self._peeked - return None + if self._peeked is not None: + return self._peeked + self._peeked = self.next() + return self._peeked def debug(self): return self.input[self.pos:self.pos+20] Modified: pypy/branch/pycompiler/module/recparser/ebnfparse.py ============================================================================== --- pypy/branch/pycompiler/module/recparser/ebnfparse.py (original) +++ pypy/branch/pycompiler/module/recparser/ebnfparse.py Fri May 27 02:45:36 2005 @@ -1,6 +1,6 @@ #!/usr/bin/env python from grammar import BaseGrammarBuilder, Alternative, Sequence, Token, \ - KleenStar, GrammarElement + KleenStar, GrammarElement, build_first_sets, EmptyToken from ebnflexer import GrammarSource import re @@ -44,14 +44,35 @@ # error unknown or negative integer """ ctx = source.context() - tk_type, tk_value = source.next() - if tk_type==self.name: - if tk_value not in self.keywords: - ret = builder.token( tk_type, tk_value, source ) - return self.debug_return( ret, tk_type, tk_value ) + tk = source.next() + if tk.name==self.name: + if tk.value not in self.keywords: + ret = builder.token( tk.name, tk.value, source ) + return self.debug_return( ret, tk.name, tk.value ) source.restore( ctx ) return None + def match_token(self, other): + """convenience '==' implementation, this is *not* a *real* equality test + a Token instance can be compared to: + - another Token instance in which case all fields (name and value) + must be equal + - a tuple, such as those yielded by the Python lexer, in which case + the comparison algorithm is similar to the one in match() + XXX: + 1/ refactor match and __eq__ ? + 2/ make source.next and source.peek return a Token() instance + """ + if not isinstance(other, Token): + raise RuntimeError("Unexpected token type %r" % other) + if other is EmptyToken: + return False + if other.name != self.name: + return False + if other.value in self.keywords: + return False + return True + class EBNFVisitor(object): def __init__(self): @@ -178,6 +199,7 @@ raise SyntaxError("Got symbol star_opt with value='%s'" % tok.value ) return myrule +rules = None def grammar_grammar(): """Builds the grammar for the grammar file @@ -193,6 +215,7 @@ option: '[' alternative ']' group: '(' alternative ')' star? """ + global rules # star: '*' | '+' star = Alternative( "star", Token('*'), Token('+') ) star_opt = KleenStar ( "star_opt", 0, 1, rule=star ) @@ -223,7 +246,11 @@ string = Token('STRING') alt = Alternative( "sequence_alt", symbol, string, option, group ) sequence.args = [ alt ] - + + + rules = [ star, star_opt, symbol, alternative, rule, grammar, sequence, + seq_cont_list, sequence_cont, option, group, alt ] + build_first_sets( rules ) return grammar @@ -244,7 +271,7 @@ from pprint import pprint if __name__ == "__main__": - grambuild = parse_grammar(file('../python/Grammar')) + grambuild = parse_grammar(file('data/Grammar2.3')) for i,r in enumerate(grambuild.items): print "% 3d : %s" % (i, r) pprint(grambuild.terminals.keys()) Modified: pypy/branch/pycompiler/module/recparser/grammar.py ============================================================================== --- pypy/branch/pycompiler/module/recparser/grammar.py (original) +++ pypy/branch/pycompiler/module/recparser/grammar.py Fri May 27 02:45:36 2005 @@ -141,19 +141,20 @@ returns None if no match or an object build by builder """ - tok_tuple = source.peek() + token = source.peek() + in_first_set = self.match_first_set(token) # - if tok_tuple is not None: - if tok_tuple not in self.first_set: - prefix = '%s<<<' % (' ' * level) + if 0 and token is not None: + if in_first_set: + prefix = '%s+++' % (' ' * level) else: - prefix = '%s>>>' % (' ' * level) - print prefix, " TOKEN =", tok_tuple + prefix = '%s---' % (' ' * level) + print prefix, " TOKEN =", token print prefix, " RULE =", self print prefix, " FIRST SET =", self.first_set print "*" * 50 # - if tok_tuple is not None and EmptyToken not in self.first_set and tok_tuple not in self.first_set: + if not in_first_set and EmptyToken not in self.first_set: return None return self._match(source, builder, level) @@ -214,6 +215,17 @@ # XXX: first_set could probably be implemented with sets return [] + def match_first_set(self, other): + """matching is not equality: + token('NAME','x') matches token('NAME',None) + """ + for tk in self.first_set: + if tk.match_token( other ): + return True + return False + + def in_first_set(self, other): + return other in self.first_set class Alternative(GrammarElement): """Represents an alternative in a grammar rule (as in S -> A | B | C)""" @@ -234,8 +246,8 @@ # try instead to get the longest alternative # to see if this solve our problems with infinite recursion for rule in self.args: - if tok is not None and tok not in rule.first_set: - print "Skipping impossible rule: %s" % (rule,) + if not rule.match_first_set(tok): + #print "Skipping impossible rule: %s" % (rule,) continue m = rule.match(source, builder, level+1) if m: @@ -410,14 +422,15 @@ # error unknown or negative integer """ ctx = source.context() - tk_type, tk_value = source.next() - if tk_type == self.name: + tk = source.next() + # XXX: match_token + if tk.name == self.name: if self.value is None: - ret = builder.token( tk_type, tk_value, source ) - return self.debug_return( ret, tk_type ) - elif self.value == tk_value: - ret = builder.token( tk_type, tk_value, source ) - return self.debug_return( ret, tk_type, tk_value ) + ret = builder.token( tk.name, tk.value, source ) + return self.debug_return( ret, tk.name ) + elif self.value == tk.value: + ret = builder.token( tk.name, tk.value, source ) + return self.debug_return( ret, tk.name, tk.value ) if DEBUG>1: print "tried tok:", self.display() source.restore( ctx ) @@ -430,28 +443,33 @@ return "<%s>=='%s'" % (self.name, self.value) - def __eq__(self, other): + def match_token(self, other): """convenience '==' implementation, this is *not* a *real* equality test a Token instance can be compared to: - another Token instance in which case all fields (name and value) must be equal - a tuple, such as those yielded by the Python lexer, in which case the comparison algorithm is similar to the one in match() - XXX refactor match and __eq__ ? + XXX: + 1/ refactor match and __eq__ ? + 2/ make source.next and source.peek return a Token() instance """ - if other is None: + if not isinstance(other, Token): + raise RuntimeError("Unexpected token type %r" % other) + if other is EmptyToken: return False - elif isinstance(other, Token): - return self.value == other.value and self.name == other.name - elif isinstance(other, tuple) and len(other) == 2: - tk_type, tk_value = other - return tk_type == self.name and self.value in (None, tk_value) - return False + res = other.name == self.name and self.value in (None, other.value) + #print "matching", self, other, res + return res + + def __eq__(self, other): + return self.name == other.name and self.value == other.value + def calc_first_set(self): - """returns the list of possible next tokens + """computes the list of possible next tokens """ pass -EmptyToken = object() # Token('???') +EmptyToken = Token(None) Modified: pypy/branch/pycompiler/module/recparser/pythonlexer.py ============================================================================== --- pypy/branch/pycompiler/module/recparser/pythonlexer.py (original) +++ pypy/branch/pycompiler/module/recparser/pythonlexer.py Fri May 27 02:45:36 2005 @@ -3,7 +3,7 @@ analyser in grammar.py """ -from grammar import TokenSource +from grammar import TokenSource, Token DEBUG = False import re @@ -214,22 +214,23 @@ def next(self): if self.stack_pos >= len(self.stack): tok, val = self._next() - self.stack.append( (tok, val, self.line) ) + token = Token( tok, val ) + self.stack.append( ( token, self.line) ) self._current_line = self.line else: - tok,val,line = self.stack[self.stack_pos] + token, line = self.stack[self.stack_pos] self._current_line = line self.stack_pos += 1 if DEBUG: print "%d/%d: %s, %s" % (self.stack_pos, len(self.stack), tok, val) - return (tok, val) + return token def peek(self): """returns next token without consuming it""" ctx = self.context() - tok_tuple = self.next() + token = self.next() self.restore(ctx) - return tok_tuple + return token def end_of_file(self): From ericvrp at codespeak.net Fri May 27 09:13:30 2005 From: ericvrp at codespeak.net (ericvrp at codespeak.net) Date: Fri, 27 May 2005 09:13:30 +0200 (CEST) Subject: [pypy-svn] r12828 - pypy/dist/pypy/documentation/image Message-ID: <20050527071330.A2FA627B53@code1.codespeak.net> Author: ericvrp Date: Fri May 27 09:13:30 2005 New Revision: 12828 Modified: pypy/dist/pypy/documentation/image/translation.sxd Log: typo (glow graph->flow graph). Still needs to be done to the pdf on the site also! Modified: pypy/dist/pypy/documentation/image/translation.sxd ============================================================================== Binary files. No diff available. From arigo at codespeak.net Fri May 27 12:12:30 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Fri, 27 May 2005 12:12:30 +0200 (CEST) Subject: [pypy-svn] r12833 - in pypy/dist/pypy: annotation translator/test Message-ID: <20050527101230.32A1827B92@code1.codespeak.net> Author: arigo Date: Fri May 27 12:12:30 2005 New Revision: 12833 Modified: pypy/dist/pypy/annotation/binaryop.py pypy/dist/pypy/translator/test/test_annrpython.py Log: Fix a bug in the annotation of inplace_pow (thanks ericvrp). Tests for pow and inplace_pow. Modified: pypy/dist/pypy/annotation/binaryop.py ============================================================================== --- pypy/dist/pypy/annotation/binaryop.py (original) +++ pypy/dist/pypy/annotation/binaryop.py Fri May 27 12:12:30 2005 @@ -84,7 +84,8 @@ def inplace_floordiv((obj1, obj2)): return pair(obj1, obj2).floordiv() def inplace_div((obj1, obj2)): return pair(obj1, obj2).div() def inplace_mod((obj1, obj2)): return pair(obj1, obj2).mod() - def inplace_pow((obj1, obj2), obj3):return pair(obj1, obj2).pow(obj3) + def inplace_pow((obj1, obj2)): return pair(obj1, obj2).pow( + SomePBC({None: True})) def inplace_lshift((obj1, obj2)): return pair(obj1, obj2).lshift() def inplace_rshift((obj1, obj2)): return pair(obj1, obj2).rshift() def inplace_and((obj1, obj2)): return pair(obj1, obj2).and_() Modified: pypy/dist/pypy/translator/test/test_annrpython.py ============================================================================== --- pypy/dist/pypy/translator/test/test_annrpython.py (original) +++ pypy/dist/pypy/translator/test/test_annrpython.py Fri May 27 12:12:30 2005 @@ -1037,7 +1037,15 @@ finally: sys.argv = oldvalue assert s is not None - + + def test_pow(self): + def f(n): + n **= 2 + return 2 ** n + a = self.RPythonAnnotator() + s = a.build_types(f, [int]) + # result should be an integer + assert s.knowntype == int def g(n): From ericvrp at codespeak.net Fri May 27 13:16:41 2005 From: ericvrp at codespeak.net (ericvrp at codespeak.net) Date: Fri, 27 May 2005 13:16:41 +0200 (CEST) Subject: [pypy-svn] r12836 - pypy/dist/pypy/rpython Message-ID: <20050527111641.C632327B56@code1.codespeak.net> Author: ericvrp Date: Fri May 27 13:16:41 2005 New Revision: 12836 Added: pypy/dist/pypy/rpython/rbool.py pypy/dist/pypy/rpython/rfloat.py Modified: pypy/dist/pypy/rpython/rint.py pypy/dist/pypy/rpython/rtyper.py Log: fixed lshift,rshift,pow,abs,eq,ne refactored a little to cut down on the amount of duplicate code. needs more work. added more of the same. Added: pypy/dist/pypy/rpython/rbool.py ============================================================================== --- (empty file) +++ pypy/dist/pypy/rpython/rbool.py Fri May 27 13:16:41 2005 @@ -0,0 +1,10 @@ +from pypy.annotation.model import SomeBool +from pypy.rpython.lltype import Bool +from pypy.rpython.rtyper import receive + + +class __extend__(SomeBool): + + def rtype_is_true(s_bool): + v_bool = receive(Bool, arg=0) + return v_bool Added: pypy/dist/pypy/rpython/rfloat.py ============================================================================== --- (empty file) +++ pypy/dist/pypy/rpython/rfloat.py Fri May 27 13:16:41 2005 @@ -0,0 +1,17 @@ +from pypy.annotation.pairtype import pair, pairtype +from pypy.annotation.model import SomeFloat, SomeInteger, SomeBool +from pypy.rpython.lltype import Signed, Unsigned, Bool +from pypy.rpython.rtyper import peek_at_result_annotation, receive, direct_op +from pypy.rpython.rtyper import TyperError + + +class __extend__(pairtype(SomeFloat, SomeFloat)): + pass + + +class __extend__(pairtype(SomeFloat, SomeInteger)): + pass + + +class __extend__(SomeFloat): + pass Modified: pypy/dist/pypy/rpython/rint.py ============================================================================== --- pypy/dist/pypy/rpython/rint.py (original) +++ pypy/dist/pypy/rpython/rint.py Fri May 27 13:16:41 2005 @@ -1,5 +1,5 @@ from pypy.annotation.pairtype import pair, pairtype -from pypy.annotation.model import SomeInteger, SomeBool +from pypy.annotation.model import SomeInteger, SomeBool, SomePBC from pypy.rpython.lltype import Signed, Unsigned, Bool from pypy.rpython.rtyper import peek_at_result_annotation, receive, direct_op from pypy.rpython.rtyper import TyperError @@ -135,7 +135,7 @@ rtype_inplace_or = rtype_or_ def rtype_lshift((s_int1, s_int2)): - if s_int1.unsigned or s_int2.unsigned: + if s_int1.unsigned: v_int1 = receive(Unsigned, arg=0) v_int2 = receive(Unsigned, arg=1) return direct_op('uint_lshift', [v_int1, v_int2], resulttype=Unsigned) @@ -147,7 +147,7 @@ rtype_inplace_lshift = rtype_lshift def rtype_rshift((s_int1, s_int2)): - if s_int1.unsigned or s_int2.unsigned: + if s_int1.unsigned: v_int1 = receive(Unsigned, arg=0) v_int2 = receive(Unsigned, arg=1) return direct_op('uint_rshift', [v_int1, v_int2], resulttype=Unsigned) @@ -159,7 +159,7 @@ rtype_inplace_rshift = rtype_rshift def rtype_lshift_ovf((s_int1, s_int2)): - if s_int1.unsigned or s_int2.unsigned: + if s_int1.unsigned: v_int1 = receive(Unsigned, arg=0) v_int2 = receive(Unsigned, arg=1) return direct_op('uint_lshift_ovf', [v_int1, v_int2], resulttype=Unsigned) @@ -171,7 +171,7 @@ rtype_inplace_lshift_ovf = rtype_lshift_ovf def rtype_rshift_ovf((s_int1, s_int2)): - if s_int1.unsigned or s_int2.unsigned: + if s_int1.unsigned: v_int1 = receive(Unsigned, arg=0) v_int2 = receive(Unsigned, arg=1) return direct_op('uint_rshift_ovf', [v_int1, v_int2], resulttype=Unsigned) @@ -182,81 +182,65 @@ rtype_inplace_rshift_ovf = rtype_rshift_ovf - def rtype_pow((s_int1, s_int2)): - #XXX RPythonTyper gives this error: TypeError: rtype_pow() takes exactly 1 argument (2 given) + def rtype_pow((s_int1, s_int2), s_int3=SomePBC({None: True})): + if isinstance(s_int3, SomeInteger): + if s_int3.unsigned: + v_int3_list = [receive(Unsigned, arg=2)] + else: + v_int3_list = [receive(Signed, arg=2)] + elif s_int3.is_constant() and s_int3.const is None: + v_int3_list = [] + else: + raise TyperError("pow() 3rd argument must be int or None") if s_int1.unsigned or s_int2.unsigned: v_int1 = receive(Unsigned, arg=0) v_int2 = receive(Unsigned, arg=1) - return direct_op('uint_pow', [v_int1, v_int2], resulttype=Unsigned) + return direct_op('uint_pow', [v_int1, v_int2] + v_int3_list, resulttype=Unsigned) else: v_int1 = receive(Signed, arg=0) v_int2 = receive(Signed, arg=1) - return direct_op('int_pow', [v_int1, v_int2], resulttype=Signed) + return direct_op('int_pow', [v_int1, v_int2] + v_int3_list, resulttype=Signed) rtype_inplace_pow = rtype_pow #comparisons: eq is_ ne lt le gt ge - def rtype_eq((s_int1, s_int2)): - v_int1 = receive(Signed, arg=0) - v_int2 = receive(Signed, arg=1) - return direct_op('int_eq', [v_int1, v_int2], resulttype=Bool) - + def rtype_eq(args): + return _rtype_compare_template(args, 'eq') + rtype_is_ = rtype_eq - def rtype_ne((s_int1, s_int2)): - v_int1 = receive(Signed, arg=0) - v_int2 = receive(Signed, arg=1) - return direct_op('int_ne', [v_int1, v_int2], resulttype=Bool) + def rtype_ne(args): + return _rtype_compare_template(args, 'ne') - def rtype_lt((s_int1, s_int2)): - if s_int1.unsigned or s_int2.unsigned: - if not s_int1.nonneg or not s_int2.nonneg: - raise TyperError("comparing a signed and an unsigned number") - v_int1 = receive(Unsigned, arg=0) - v_int2 = receive(Unsigned, arg=1) - return direct_op('uint_lt', [v_int1, v_int2], resulttype=Bool) - else: - v_int1 = receive(Signed, arg=0) - v_int2 = receive(Signed, arg=1) - return direct_op('int_lt', [v_int1, v_int2], resulttype=Bool) + def rtype_lt(args): + return _rtype_compare_template(args, 'lt') - def rtype_le((s_int1, s_int2)): - if s_int1.unsigned or s_int2.unsigned: - if not s_int1.nonneg or not s_int2.nonneg: - raise TyperError("comparing a signed and an unsigned number") - v_int1 = receive(Unsigned, arg=0) - v_int2 = receive(Unsigned, arg=1) - return direct_op('uint_le', [v_int1, v_int2], resulttype=Bool) - else: - v_int1 = receive(Signed, arg=0) - v_int2 = receive(Signed, arg=1) - return direct_op('int_le', [v_int1, v_int2], resulttype=Bool) + def rtype_le(args): + return _rtype_compare_template(args, 'le') - def rtype_gt((s_int1, s_int2)): - if s_int1.unsigned or s_int2.unsigned: - if not s_int1.nonneg or not s_int2.nonneg: - raise TyperError("comparing a signed and an unsigned number") - v_int1 = receive(Unsigned, arg=0) - v_int2 = receive(Unsigned, arg=1) - return direct_op('uint_gt', [v_int1, v_int2], resulttype=Bool) - else: - v_int1 = receive(Signed, arg=0) - v_int2 = receive(Signed, arg=1) - return direct_op('int_gt', [v_int1, v_int2], resulttype=Bool) + def rtype_gt(args): + return _rtype_compare_template(args, 'gt') + + def rtype_ge(args): + return _rtype_compare_template(args, 'ge') + +#Helper functions for comparisons + +def _rtype_compare_template((s_int1, s_int2), func): + if s_int1.unsigned or s_int2.unsigned: + if not s_int1.nonneg or not s_int2.nonneg: + raise TyperError("comparing a signed and an unsigned number") + v_int1 = receive(Unsigned, arg=0) + v_int2 = receive(Unsigned, arg=1) + return direct_op('uint_'+func, [v_int1, v_int2], resulttype=Bool) + else: + v_int1 = receive(Signed, arg=0) + v_int2 = receive(Signed, arg=1) + return direct_op('int_'+func, [v_int1, v_int2], resulttype=Bool) - def rtype_ge((s_int1, s_int2)): - if s_int1.unsigned or s_int2.unsigned: - if not s_int1.nonneg or not s_int2.nonneg: - raise TyperError("comparing a signed and an unsigned number") - v_int1 = receive(Unsigned, arg=0) - v_int2 = receive(Unsigned, arg=1) - return direct_op('uint_ge', [v_int1, v_int2], resulttype=Bool) - else: - v_int1 = receive(Signed, arg=0) - v_int2 = receive(Signed, arg=1) - return direct_op('int_ge', [v_int1, v_int2], resulttype=Bool) +# class __extend__(SomeInteger): @@ -267,7 +251,10 @@ #Unary arithmetic operations def rtype_abs(s_int): - v_int = receive(Signed, arg=0) + if s_int.unsigned: + v_int = receive(Unsigned, arg=0) + else: + v_int = receive(Signed, arg=0) return direct_op('int_abs', [v_int], resulttype=Signed) def rtype_abs_ovf(s_int): @@ -283,13 +270,7 @@ return direct_op('int_neg', [v_int], resulttype=Signed) def rtype_pos(s_int): - #XXX I think this is a nop and should really be removed from the graph - v_int = receive(Signed, arg=0) - return direct_op('int_pos', [v_int], resulttype=Signed) - - -class __extend__(SomeBool): - - def rtype_is_true(s_bool): - v_bool = receive(Bool, arg=0) - return v_bool + if s_int.unsigned: + return receive(Unsigned, arg=0) + else: + return receive(Signed, arg=0) Modified: pypy/dist/pypy/rpython/rtyper.py ============================================================================== --- pypy/dist/pypy/rpython/rtyper.py (original) +++ pypy/dist/pypy/rpython/rtyper.py Fri May 27 13:16:41 2005 @@ -306,4 +306,4 @@ # _______________________________________________________________________ # this has the side-effect of registering the unary and binary operations -from pypy.rpython import robject, rlist, rptr, rbuiltin, rint +from pypy.rpython import robject, rlist, rptr, rbuiltin, rint, rbool, rfloat From ludal at codespeak.net Fri May 27 14:38:20 2005 From: ludal at codespeak.net (ludal at codespeak.net) Date: Fri, 27 May 2005 14:38:20 +0200 (CEST) Subject: [pypy-svn] r12837 - in pypy/branch/pycompiler/module/recparser: . test Message-ID: <20050527123820.A5C7A27B56@code1.codespeak.net> Author: ludal Date: Fri May 27 14:38:20 2005 New Revision: 12837 Added: pypy/branch/pycompiler/module/recparser/astbuilder.py Modified: pypy/branch/pycompiler/module/recparser/__init__.py pypy/branch/pycompiler/module/recparser/ebnfparse.py pypy/branch/pycompiler/module/recparser/grammar.py pypy/branch/pycompiler/module/recparser/pythonlexer.py pypy/branch/pycompiler/module/recparser/test/test_samples.py pypy/branch/pycompiler/module/recparser/test/unittest_samples.py Log: * grammar should now be LL(1) ie use less backtracking than before Modified: pypy/branch/pycompiler/module/recparser/__init__.py ============================================================================== --- pypy/branch/pycompiler/module/recparser/__init__.py (original) +++ pypy/branch/pycompiler/module/recparser/__init__.py Fri May 27 14:38:20 2005 @@ -1,42 +1,44 @@ from pypy.interpreter.error import OperationError, debug_print from pypy.interpreter import module -from pypy.interpreter.mixedmodule import MixedModule + + import pythonparse debug_print( "Loading grammar %s" % pythonparse.PYTHON_GRAMMAR ) -class Module(MixedModule): - """The builtin parser module. - """ - - - appleveldefs = { - # 'ParserError' : 'app_class.ParserError', - } - interpleveldefs = { - '__name__' : '(space.wrap("parser"))', - '__doc__' : '(space.wrap("parser (recparser version) module"))', - - 'suite' : 'pyparser.suite', - 'expr' : 'pyparser.expr', - 'STType' : 'pyparser.STType', - 'ast2tuple' : 'pyparser.ast2tuple', -# 'ASTType' : 'pyparser.STType', - # 'sequence2st' : 'pyparser.sequence2st', - #'eval_input' : 'pyparser.eval_input', - #'file_input' : 'pyparser.file_input', - #'compileast' : 'pyparser.compileast', - #'st2tuple' : 'pyparser.st2tuple', - #'st2list' : 'pyparser.st2list', - #'issuite' : 'pyparser.issuite', - #'ast2tuple' : 'pyparser.ast2tuple', - #'tuple2st' : 'pyparser.tuple2st', - #'isexpr' : 'pyparser.isexpr', - #'ast2list' : 'pyparser.ast2list', - #'sequence2ast' : 'pyparser.sequence2ast', - #'tuple2ast' : 'pyparser.tuple2ast', - #'_pickler' : 'pyparser._pickler', - #'compilest' : 'pyparser.compilest', - } +## from pypy.interpreter.mixedmodule import MixedModule +## class Module(MixedModule): +## """The builtin parser module. +## """ + + +## appleveldefs = { +## # 'ParserError' : 'app_class.ParserError', +## } +## interpleveldefs = { +## '__name__' : '(space.wrap("parser"))', +## '__doc__' : '(space.wrap("parser (recparser version) module"))', + +## 'suite' : 'pyparser.suite', +## 'expr' : 'pyparser.expr', +## 'STType' : 'pyparser.STType', +## 'ast2tuple' : 'pyparser.ast2tuple', +## # 'ASTType' : 'pyparser.STType', +## # 'sequence2st' : 'pyparser.sequence2st', +## #'eval_input' : 'pyparser.eval_input', +## #'file_input' : 'pyparser.file_input', +## #'compileast' : 'pyparser.compileast', +## #'st2tuple' : 'pyparser.st2tuple', +## #'st2list' : 'pyparser.st2list', +## #'issuite' : 'pyparser.issuite', +## #'ast2tuple' : 'pyparser.ast2tuple', +## #'tuple2st' : 'pyparser.tuple2st', +## #'isexpr' : 'pyparser.isexpr', +## #'ast2list' : 'pyparser.ast2list', +## #'sequence2ast' : 'pyparser.sequence2ast', +## #'tuple2ast' : 'pyparser.tuple2ast', +## #'_pickler' : 'pyparser._pickler', +## #'compilest' : 'pyparser.compilest', +## } Added: pypy/branch/pycompiler/module/recparser/astbuilder.py ============================================================================== --- (empty file) +++ pypy/branch/pycompiler/module/recparser/astbuilder.py Fri May 27 14:38:20 2005 @@ -0,0 +1,48 @@ + + +from grammar import BaseGrammarBuilder +from compiler.ast import nodes, TokenNode +from compiler.astfactory import factory_functions, group_factory, syntaxnode_factory + +class AstBuilder(BaseGrammarBuilder): + """A builder that directly produce the AST""" + + def __init__( self, rules=None, debug=0 ): + BaseGrammarBuilder.__init__(self, rules, debug ) + + def top(self, n=1): + toplist = [] + for node in self.stack[-n:]: + toplist += node.expand() + return toplist + + def alternative( self, rule, source ): + # Do nothing, keep rule on top of the stack + if rule.is_root(): + ast_factory = factory_functions.get( rule.name, syntaxnode_factory ) + elems = self.top() + node = ast_factory( rule.name, source, elems ) + self.stack[-1] = node + if self.debug: + self.stack[-1].dumpstr() + return True + + def sequence(self, rule, source, elts_number): + """ """ + items = self.top( elts_number ) + if rule.is_root(): + ast_factory = factory_functions.get( rule.name, syntaxnode_factory ) + else: + ast_factory = group_factory + + node = ast_factory( rule.name, source, items ) + # replace N elements with 1 element regrouping them + if elts_number >= 1: + self.stack[-elts_number:] = node + else: + self.stack.append(node) + return True + + def token(self, name, value, source): + self.stack.append(TokenNode(name, source, value)) + return True Modified: pypy/branch/pycompiler/module/recparser/ebnfparse.py ============================================================================== --- pypy/branch/pycompiler/module/recparser/ebnfparse.py (original) +++ pypy/branch/pycompiler/module/recparser/ebnfparse.py Fri May 27 14:38:20 2005 @@ -250,6 +250,10 @@ rules = [ star, star_opt, symbol, alternative, rule, grammar, sequence, seq_cont_list, sequence_cont, option, group, alt ] + for r in rules: + r._trace = False + for tk in r.args: + tk._trace = False build_first_sets( rules ) return grammar Modified: pypy/branch/pycompiler/module/recparser/grammar.py ============================================================================== --- pypy/branch/pycompiler/module/recparser/grammar.py (original) +++ pypy/branch/pycompiler/module/recparser/grammar.py Fri May 27 14:38:20 2005 @@ -35,6 +35,14 @@ """Returns the current line number""" return 0 + def get_pos(self): + """Returns the current source position of the scanner""" + return 0 + + def get_source_text(self, pos1, pos2 ): + """Returns the source text between two scanner positions""" + return "" + ###################################################################### @@ -53,6 +61,8 @@ if new_size != size: changed = True print "Done", loops, "loops" + for r in rules: + r.reorder_rule() from syntaxtree import SyntaxNode, TempSyntaxNode, TokenNode @@ -121,6 +131,7 @@ self.first_set = [] self.first_set_complete = False self._processing = False + self._trace = False def is_root(self): """This is a root node of the grammar, that is one that will @@ -142,21 +153,45 @@ returns None if no match or an object build by builder """ token = source.peek() + pos1 = source.get_pos() in_first_set = self.match_first_set(token) + if not in_first_set: # and not EmptyToken in self.first_set: + if EmptyToken in self.first_set: + ret = builder.sequence(self, source, 0 ) + if self._trace: + prefix = '%seee' % (' ' * level) + print prefix, " RULE =", self + print prefix, " TOKEN =", token + print prefix, " FIRST SET =", self.first_set + return self.debug_return( ret, 0 ) + if self._trace: + prefix = '%srrr' % (' ' * level) + print prefix, " RULE =", self + print prefix, " TOKEN =", token + print prefix, " FIRST SET =", self.first_set + return None + elif self._trace: + prefix = '%s>>>' % (' ' * level) + print prefix, " RULE =", self + print prefix, " TOKEN =", token + print prefix, " FIRST SET =", self.first_set + # - if 0 and token is not None: - if in_first_set: - prefix = '%s+++' % (' ' * level) + res = self._match(source, builder, level) + if self._trace: + pos2 = source.get_pos() + if res: + prefix = '%s+++' % (' ' * level) else: - prefix = '%s---' % (' ' * level) - print prefix, " TOKEN =", token + prefix = '%s---' % (' ' * level) print prefix, " RULE =", self + print prefix, " TOKEN =", token print prefix, " FIRST SET =", self.first_set - print "*" * 50 + print prefix, " TEXT ='%s'" % source.get_source_text(pos1,pos2) + if res: + print "*" * 50 # - if not in_first_set and EmptyToken not in self.first_set: - return None - return self._match(source, builder, level) + return res def _match(self, source, builder, level=0): """Try to match a grammar rule @@ -227,11 +262,17 @@ def in_first_set(self, other): return other in self.first_set + def reorder_rule(self): + """Called after the computation of first set to allow rules to be reordered + to avoid ambiguities""" + pass + class Alternative(GrammarElement): """Represents an alternative in a grammar rule (as in S -> A | B | C)""" def __init__(self, name, *args): GrammarElement.__init__(self, name ) self.args = list(args) + self._reordered = False for i in self.args: assert isinstance( i, GrammarElement ) @@ -246,8 +287,9 @@ # try instead to get the longest alternative # to see if this solve our problems with infinite recursion for rule in self.args: - if not rule.match_first_set(tok): - #print "Skipping impossible rule: %s" % (rule,) + if not rule.match_first_set(tok) and EmptyToken not in rule.first_set: + if self._trace: + print "Skipping impossible rule: %s" % (rule,) continue m = rule.match(source, builder, level+1) if m: @@ -270,12 +312,31 @@ if S -> (A | B | C): LAH(S) = Union( LAH(A), LAH(B), LAH(C) ) """ + # do this to avoid problems on indirect recursive rules for rule in self.args: for t in rule.first_set: if t not in self.first_set: self.first_set.append(t) + def reorder_rules(self): + # take the opportunity to reorder rules in alternatives + # so that rules with Empty in their first set come last + # warn if two rules have empty in their first set + empty_set = [] + not_empty_set = [] + for r in self.args: + if EmptyToken in r.first_set: + empty_set.append( r ) + else: + not_empty_set.append( r ) + if len(empty_set)>1 and not self._reordered: + print "Warning: alternative %s has more than one rule matching Empty" % self + self._reordered = True + self.args[:] = not_empty_set + self.args.extend( empty_set ) + + class Sequence(GrammarElement): """Reprensents a Sequence in a grammar rule (as in S -> A B C)""" @@ -291,14 +352,8 @@ print "try seq:", self.display() ctx = source.context() bctx = builder.context() - if self.name == 'listmaker': - print "----------------------------- LISTMAKER !" for rule in self.args: - if self.name == 'listmaker': - print " -------------- IN LISTMAKER, rule =", rule m = rule.match(source, builder, level+1) - if self.name == 'listmaker': - print " !!!!!!!!!!!!!! IN LISTMAKER, doesn't match %s" % (rule,) if not m: # Restore needed because some rules may have been matched # before the one that failed @@ -328,12 +383,15 @@ LAH(S) = LAH(A) """ for rule in self.args: + if EmptyToken in self.first_set: + self.first_set.remove( EmptyToken ) # while we're in this loop, keep agregating possible tokens for t in rule.first_set: if t not in self.first_set: self.first_set.append(t) if EmptyToken not in rule.first_set: break + class KleenStar(GrammarElement): Modified: pypy/branch/pycompiler/module/recparser/pythonlexer.py ============================================================================== --- pypy/branch/pycompiler/module/recparser/pythonlexer.py (original) +++ pypy/branch/pycompiler/module/recparser/pythonlexer.py Fri May 27 14:38:20 2005 @@ -213,18 +213,29 @@ def next(self): if self.stack_pos >= len(self.stack): + pos0 = self.pos tok, val = self._next() token = Token( tok, val ) - self.stack.append( ( token, self.line) ) + self.stack.append( ( token, self.line, pos0) ) self._current_line = self.line else: - token, line = self.stack[self.stack_pos] + token, line, pos0 = self.stack[self.stack_pos] self._current_line = line self.stack_pos += 1 if DEBUG: print "%d/%d: %s, %s" % (self.stack_pos, len(self.stack), tok, val) return token + def get_pos(self): + if self.stack_pos >= len(self.stack): + return self.pos + else: + token, line, pos = self.stack[self.stack_pos] + return pos + + def get_source_text(self, pos0, pos1 ): + return self.input[pos0:pos1] + def peek(self): """returns next token without consuming it""" ctx = self.context() Modified: pypy/branch/pycompiler/module/recparser/test/test_samples.py ============================================================================== --- pypy/branch/pycompiler/module/recparser/test/test_samples.py (original) +++ pypy/branch/pycompiler/module/recparser/test/test_samples.py Fri May 27 14:38:20 2005 @@ -53,6 +53,7 @@ yield check_parse, abspath def check_parse(filepath): + print "Testing:", filepath pypy_tuples = pypy_parse(filepath) python_tuples = python_parse(filepath) try: Modified: pypy/branch/pycompiler/module/recparser/test/unittest_samples.py ============================================================================== --- pypy/branch/pycompiler/module/recparser/test/unittest_samples.py (original) +++ pypy/branch/pycompiler/module/recparser/test/unittest_samples.py Fri May 27 14:38:20 2005 @@ -2,7 +2,7 @@ import os, os.path as osp import sys -from pypy.module.recparser.pythonutil import python_parse, pypy_parse, set_debug +from pypy.module.recparser.pythonutil import python_parse, pypy_parse from pprint import pprint from pypy.module.recparser import grammar grammar.DEBUG = False @@ -85,7 +85,8 @@ opts, args = getopt.getopt( sys.argv[1:], "d:", [] ) for opt, val in opts: if opt == "-d": - set_debug(int(val)) + pass +# set_debug(int(val)) if args: samples = args else: From ericvrp at codespeak.net Fri May 27 16:15:48 2005 From: ericvrp at codespeak.net (ericvrp at codespeak.net) Date: Fri, 27 May 2005 16:15:48 +0200 (CEST) Subject: [pypy-svn] r12839 - in pypy/dist/pypy: annotation rpython Message-ID: <20050527141548.9CEDE27B53@code1.codespeak.net> Author: ericvrp Date: Fri May 27 16:15:48 2005 New Revision: 12839 Modified: pypy/dist/pypy/annotation/model.py pypy/dist/pypy/rpython/lltype.py pypy/dist/pypy/rpython/rfloat.py Log: Added (Some)Float and started implementing rfloat.py Modified: pypy/dist/pypy/annotation/model.py ============================================================================== --- pypy/dist/pypy/annotation/model.py (original) +++ pypy/dist/pypy/annotation/model.py Fri May 27 16:15:48 2005 @@ -327,6 +327,7 @@ (SomeBool(), lltype.Bool), (SomeInteger(), lltype.Signed), (SomeInteger(nonneg=True, unsigned=True), lltype.Unsigned), + (SomeFloat(), lltype.Float), (SomeChar(), lltype.Char), (SomePBC({None: True}), lltype.Void), ] Modified: pypy/dist/pypy/rpython/lltype.py ============================================================================== --- pypy/dist/pypy/rpython/lltype.py (original) +++ pypy/dist/pypy/rpython/lltype.py Fri May 27 16:15:48 2005 @@ -185,6 +185,7 @@ Signed = Primitive("Signed", 0) Unsigned = Primitive("Unsigned", r_uint(0)) +Float = Primitive("Float", 0.0) Char = Primitive("Char", '\x00') Bool = Primitive("Bool", False) Void = Primitive("Void", None) @@ -246,6 +247,8 @@ return Unsigned if isinstance(val, int): return Signed + if isinstance(val, float): + return Float if isinstance(val, str): assert len(val) == 1 return Char Modified: pypy/dist/pypy/rpython/rfloat.py ============================================================================== --- pypy/dist/pypy/rpython/rfloat.py (original) +++ pypy/dist/pypy/rpython/rfloat.py Fri May 27 16:15:48 2005 @@ -1,17 +1,69 @@ from pypy.annotation.pairtype import pair, pairtype -from pypy.annotation.model import SomeFloat, SomeInteger, SomeBool -from pypy.rpython.lltype import Signed, Unsigned, Bool +from pypy.annotation.model import SomeFloat, SomeInteger, SomeBool, SomePBC +from pypy.rpython.lltype import Signed, Unsigned, Bool, Float from pypy.rpython.rtyper import peek_at_result_annotation, receive, direct_op from pypy.rpython.rtyper import TyperError class __extend__(pairtype(SomeFloat, SomeFloat)): - pass + def rtype_add(args): + return _rtype_template(args, 'add') + + rtype_inplace_add = rtype_add + + def rtype_sub(args): + return _rtype_template(args, 'sub') + + rtype_inplace_sub = rtype_sub + + def rtype_mul(args): + return _rtype_template(args, 'mul') + + rtype_inplace_mul = rtype_mul + + def rtype_div(args): + return _rtype_template(args, 'div') + + rtype_inplace_div = rtype_div + + def rtype_pow((s_float1, s_float2), s_float3=SomePBC({None: True})): + if isinstance(s_float3, SomeInteger): + v_float3_list = [receive(Float, arg=2)] + elif s_float3.is_constant() and s_float3.const is None: + v_float3_list = [] + else: + raise TyperError("pow() 3rd argument must be int or None") + v_float1 = receive(Float, arg=0) + v_float2 = receive(Float, arg=1) + return direct_op('float_pow', [v_float1, v_float2] + v_float3_list, resulttype=Float) + + rtype_inplace_pow = rtype_pow + + +#Helpers SomeFloat,Somefloat + +def _rtype_template((s_float1, s_float2), func): + v_float1 = receive(Float, arg=0) + v_float2 = receive(Float, arg=1) + return direct_op('float_'+func, [v_float1, v_float2], resulttype=Float) + + +# class __extend__(pairtype(SomeFloat, SomeInteger)): pass class __extend__(SomeFloat): - pass + + def rtype_is_true(s_float): + v_float = receive(Float, arg=0) + return direct_op('float_is_true', [v_float], resulttype=Bool) + + def rtype_neg(s_int): + v_int = receive(Float, arg=0) + return direct_op('float_neg', [v_int], resulttype=Float) + + def rtype_pos(s_int): + return receive(Float, arg=0) From arigo at codespeak.net Fri May 27 16:27:42 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Fri, 27 May 2005 16:27:42 +0200 (CEST) Subject: [pypy-svn] r12841 - in pypy/dist/pypy/rpython: . test Message-ID: <20050527142742.26BB227B53@code1.codespeak.net> Author: arigo Date: Fri May 27 16:27:41 2005 New Revision: 12841 Added: pypy/dist/pypy/rpython/rpbc.py (contents, props changed) Modified: pypy/dist/pypy/rpython/robject.py pypy/dist/pypy/rpython/rtyper.py pypy/dist/pypy/rpython/test/test_rtyper.py Log: - moved SomePBC in its own file, rpbc.py. - preliminary support for function calls. Modified: pypy/dist/pypy/rpython/robject.py ============================================================================== --- pypy/dist/pypy/rpython/robject.py (original) +++ pypy/dist/pypy/rpython/robject.py Fri May 27 16:27:41 2005 @@ -1,8 +1,7 @@ from pypy.annotation.pairtype import pair, pairtype from pypy.annotation.model import SomeObject, annotation_to_lltype -from pypy.annotation.model import SomePBC from pypy.rpython.lltype import PyObject, GcPtr, Void -from pypy.rpython.rtyper import TyperError, peek_at_result_annotation +from pypy.rpython.rtyper import TyperError from pypy.rpython.rtyper import receiveconst, receive @@ -44,14 +43,3 @@ else: raise TyperError("don't know how to convert from %r to %r" % ( s_from, s_to)) - - -class __extend__(SomePBC): - - def rtype_getattr(s_pbc, s_attr): - attr = s_attr.const - s_result = peek_at_result_annotation() - if s_result.is_constant(): - return receiveconst(s_result, s_result.const) - else: - NotImplementedYet Added: pypy/dist/pypy/rpython/rpbc.py ============================================================================== --- (empty file) +++ pypy/dist/pypy/rpython/rpbc.py Fri May 27 16:27:41 2005 @@ -0,0 +1,38 @@ +import types +from pypy.annotation.pairtype import pair, pairtype +from pypy.annotation.model import SomePBC +from pypy.rpython.lltype import Void, FuncType, functionptr +from pypy.rpython.rtyper import TLS, receive, receiveconst, direct_op +from pypy.rpython.rtyper import peek_at_result_annotation + + +class __extend__(SomePBC): + + def rtype_getattr(s_pbc, s_attr): + attr = s_attr.const + s_result = peek_at_result_annotation() + if s_result.is_constant(): + return receiveconst(s_result, s_result.const) + else: + NotImplementedYet + + def rtype_simple_call(s_pbc, *args_s): + if not s_pbc.is_constant(): + NotImplementedYet + func = s_pbc.const + if not isinstance(func, types.FunctionType): + NotImplementedYet + # XXX hackish + a = TLS.rtyper.annotator + graph = a.translator.getflowgraph(func) + llinputs = [a.binding(v).lowleveltype() for v in graph.getargs()] + s_output = a.binding(graph.getreturnvar(), None) + if s_output is None: + lloutput = Void + else: + lloutput = s_output.lowleveltype() + FT = FuncType(llinputs, lloutput) + f = functionptr(FT, func.func_name, _callable=func) + args_v = [receive(llinputs[i], arg=i+1) for i in range(len(args_s))] + c = receiveconst(FT, f) + return direct_op('direct_call', [c] + args_v, resulttype=lloutput) Modified: pypy/dist/pypy/rpython/rtyper.py ============================================================================== --- pypy/dist/pypy/rpython/rtyper.py (original) +++ pypy/dist/pypy/rpython/rtyper.py Fri May 27 16:27:41 2005 @@ -307,3 +307,4 @@ # _______________________________________________________________________ # this has the side-effect of registering the unary and binary operations from pypy.rpython import robject, rlist, rptr, rbuiltin, rint, rbool, rfloat +from pypy.rpython import rpbc Modified: pypy/dist/pypy/rpython/test/test_rtyper.py ============================================================================== --- pypy/dist/pypy/rpython/test/test_rtyper.py (original) +++ pypy/dist/pypy/rpython/test/test_rtyper.py Fri May 27 16:27:41 2005 @@ -12,4 +12,18 @@ typer = RPythonTyper(t.annotator) typer.specialize() #t.view() - assert "did not crash" + t.checkgraphs() + + +def test_function_call(): + def g(x, y): + return x-y + def f(x): + return g(1, x) + + t = Translator(f) + t.annotate([int]) + typer = RPythonTyper(t.annotator) + typer.specialize() + #t.view() + t.checkgraphs() From arigo at codespeak.net Fri May 27 16:34:41 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Fri, 27 May 2005 16:34:41 +0200 (CEST) Subject: [pypy-svn] r12843 - pypy/dist/pypy/translator/c Message-ID: <20050527143441.D529B27B6E@code1.codespeak.net> Author: arigo Date: Fri May 27 16:34:41 2005 New Revision: 12843 Modified: pypy/dist/pypy/translator/c/funcgen.py Log: Support for Py_INCREF/Py_DECREF. Modified: pypy/dist/pypy/translator/c/funcgen.py ============================================================================== --- pypy/dist/pypy/translator/c/funcgen.py (original) +++ pypy/dist/pypy/translator/c/funcgen.py Fri May 27 16:34:41 2005 @@ -4,7 +4,7 @@ from pypy.translator.c.support import llvalue_from_constant from pypy.objspace.flow.model import Variable, Constant, Block from pypy.objspace.flow.model import traverse, uniqueitems -from pypy.rpython.lltype import GcPtr, NonGcPtr, PyObject +from pypy.rpython.lltype import GcPtr, NonGcPtr, PyObject, Void, Primitive PyObjGcPtr = GcPtr(PyObject) @@ -20,9 +20,12 @@ def __init__(self, graph, gettype, getvalue): self.graph = graph self.getvalue = getvalue - self.typemap, self.returntype = self.collecttypes(gettype) + self.lltypemap = self.collecttypes() + self.typemap = {} + for v, T in self.lltypemap.items(): + self.typemap[v] = gettype(T) - def collecttypes(self, gettype): + def collecttypes(self): # collect all variables and constants used in the body, # and get their types now result = [] @@ -34,18 +37,15 @@ for link in block.exits: result.extend(link.args) traverse(visit, self.graph) - typemap = {} - returnvar = self.graph.getreturnvar() - result.append(returnvar) + resultvar = self.graph.getreturnvar() + lltypemap = {resultvar: Void} # default value, normally overridden for v in uniqueitems(result): if isinstance(v, Variable): T = getattr(v, 'concretetype', PyObjGcPtr) else: T = getattr(v, 'concretetype', PyObjNonGcPtr) - typemap[v] = gettype(T) - if v is returnvar: - returntype = T - return typemap, returntype + lltypemap[v] = T + return lltypemap def argnames(self): return [v.name for v in self.graph.getargs()] @@ -57,7 +57,7 @@ return [v for v in self.typemap if isinstance(v, Constant)] def allconstantvalues(self): - for v, T in self.typemap.iteritems(): + for v in self.typemap: if isinstance(v, Constant): yield llvalue_from_constant(v) @@ -74,7 +74,8 @@ raise TypeError, "expr(%r)" % (v,) def error_return_value(self): - return self.getvalue(ErrorValue(self.returntype)) + returnlltype = self.lltypemap[self.graph.getreturnvar()] + return self.getvalue(ErrorValue(returnlltype)) # ____________________________________________________________ @@ -95,7 +96,9 @@ # generate an incref for each input argument for a in self.graph.getargs(): - yield self.cincref(a) + line = self.cincref(a) + if line: + yield line def gen_link(link, linklocalvars=None): "Generate the code to jump across the given Link." @@ -143,7 +146,7 @@ lst = [self.expr(v) for v in op.args] lst.append(self.expr(op.result)) lst.append(err) - yield '%s(%s);' % (macro, ', '.join(lst)) + yield '%s(%s)' % (macro, ', '.join(lst)) to_release.append(op.result) err_reachable = False @@ -301,7 +304,21 @@ return self.cdecref(op.args[0]) def cincref(self, v): - return '/*XXX INCREF*/' + T = self.lltypemap[v] + if not isinstance(T, Primitive) and 'gc' in T.flags: + if T.TO == PyObject: + return 'Py_INCREF(%s);' % v.name + else: + return '/*XXX INCREF*/' + else: + return '' def cdecref(self, v, expr=None): - return '/*XXX DECREF*/' + T = self.lltypemap[v] + if not isinstance(T, Primitive) and 'gc' in T.flags: + if T.TO == PyObject: + return 'Py_DECREF(%s);' % v.name + else: + return '/*XXX DECREF*/' + else: + return '' From ale at codespeak.net Fri May 27 16:39:10 2005 From: ale at codespeak.net (ale at codespeak.net) Date: Fri, 27 May 2005 16:39:10 +0200 (CEST) Subject: [pypy-svn] r12844 - pypy/dist/pypy/lib Message-ID: <20050527143910.E172E27B6E@code1.codespeak.net> Author: ale Date: Fri May 27 16:39:10 2005 New Revision: 12844 Modified: pypy/dist/pypy/lib/inprogress__codecs.py Log: typo and check the type of the return value Modified: pypy/dist/pypy/lib/inprogress__codecs.py ============================================================================== --- pypy/dist/pypy/lib/inprogress__codecs.py (original) +++ pypy/dist/pypy/lib/inprogress__codecs.py Fri May 27 16:39:10 2005 @@ -75,7 +75,7 @@ codec_search_cache[encoding] = result return result if not result: - raise LookupError( "unknown encoding: %s", encoding) + raise LookupError( "unknown encoding: %s" % encoding) return result @@ -115,6 +115,8 @@ decoder = lookup(encoding)[1] if decoder and isinstance(errors,str): res = decoder(v,errors) + if not isinstance(res,tuple) or len(res) != 2: + raise TypeError("encoder must return a tuple (object,integer)") return res[0] else: raise TypeError("Errors must be a string") From arigo at codespeak.net Fri May 27 16:58:12 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Fri, 27 May 2005 16:58:12 +0200 (CEST) Subject: [pypy-svn] r12845 - pypy/dist/pypy/rpython Message-ID: <20050527145812.E766027B6E@code1.codespeak.net> Author: arigo Date: Fri May 27 16:58:12 2005 New Revision: 12845 Modified: pypy/dist/pypy/rpython/rpbc.py pypy/dist/pypy/rpython/rtyper.py Log: Produce functionptrs with both a _callable and a graph attribute. It makes more sense for code generators should depend on 'graph' rather than '_callable'. Modified: pypy/dist/pypy/rpython/rpbc.py ============================================================================== --- pypy/dist/pypy/rpython/rpbc.py (original) +++ pypy/dist/pypy/rpython/rpbc.py Fri May 27 16:58:12 2005 @@ -1,7 +1,7 @@ import types from pypy.annotation.pairtype import pair, pairtype from pypy.annotation.model import SomePBC -from pypy.rpython.lltype import Void, FuncType, functionptr +from pypy.rpython.lltype import Void, FuncType, functionptr, NonGcPtr from pypy.rpython.rtyper import TLS, receive, receiveconst, direct_op from pypy.rpython.rtyper import peek_at_result_annotation @@ -32,7 +32,7 @@ else: lloutput = s_output.lowleveltype() FT = FuncType(llinputs, lloutput) - f = functionptr(FT, func.func_name, _callable=func) + f = functionptr(FT, func.func_name, graph = graph, _callable = func) args_v = [receive(llinputs[i], arg=i+1) for i in range(len(args_s))] - c = receiveconst(FT, f) + c = receiveconst(NonGcPtr(FT), f) return direct_op('direct_call', [c] + args_v, resulttype=lloutput) Modified: pypy/dist/pypy/rpython/rtyper.py ============================================================================== --- pypy/dist/pypy/rpython/rtyper.py (original) +++ pypy/dist/pypy/rpython/rtyper.py Fri May 27 16:58:12 2005 @@ -2,7 +2,7 @@ from pypy.annotation import model as annmodel from pypy.objspace.flow.model import Variable, Constant, Block, Link from pypy.objspace.flow.model import SpaceOperation -from pypy.rpython.lltype import Void, LowLevelType, NonGcPtr +from pypy.rpython.lltype import Void, LowLevelType, NonGcPtr, ContainerType from pypy.rpython.lltype import FuncType, functionptr from pypy.tool.tls import tlsobject from pypy.tool.sourcetools import func_with_new_name, valid_identifier @@ -217,6 +217,9 @@ lowleveltype = s_requested else: lowleveltype = s_requested.lowleveltype() + assert not isinstance(lowleveltype, ContainerType), ( + "missing a GcPtr or NonGcPtr in the type specification of %r" % + (lowleveltype,)) c = Constant(value) c.concretetype = lowleveltype return c @@ -272,24 +275,26 @@ spec_name.append(valid_identifier(getattr(key, '__name__', key))+suffix) spec_key = tuple(spec_key) try: - spec_function, resulttype = ( + spec_function, spec_graph, resulttype = ( TLS.rtyper.specialized_ll_functions[spec_key]) except KeyError: name = '_'.join(spec_name) spec_function = func_with_new_name(ll_function, name) # flow and annotate (the copy of) the low-level function + spec_graph = annotator.translator.getflowgraph(spec_function) s_returnvalue = annotator.build_types(spec_function, args_s) resulttype = annmodel.annotation_to_lltype(s_returnvalue, "%s: " % ll_function.func_name) # cache the result TLS.rtyper.specialized_ll_functions[spec_key] = ( - spec_function, resulttype) + spec_function, spec_graph, resulttype) # build the 'direct_call' operation lltypes = [v.concretetype for v in args_v] FT = FuncType(lltypes, resulttype) - c = Constant(functionptr(FT, ll_function.func_name, _callable=spec_function)) - c.concretetype = NonGcPtr(FT) + f = functionptr(FT, ll_function.func_name, graph = spec_graph, + _callable = spec_function) + c = receiveconst(NonGcPtr(FT), f) return direct_op('direct_call', [c]+list(args_v), resulttype=resulttype) From arigo at codespeak.net Fri May 27 17:02:43 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Fri, 27 May 2005 17:02:43 +0200 (CEST) Subject: [pypy-svn] r12846 - pypy/dist/pypy/translator/c/test Message-ID: <20050527150243.10C5527B72@code1.codespeak.net> Author: arigo Date: Fri May 27 17:02:42 2005 New Revision: 12846 Modified: pypy/dist/pypy/translator/c/test/test_database.py Log: Generating fully-typed function calls works "out of the box". Modified: pypy/dist/pypy/translator/c/test/test_database.py ============================================================================== --- pypy/dist/pypy/translator/c/test/test_database.py (original) +++ pypy/dist/pypy/translator/c/test/test_database.py Fri May 27 17:02:42 2005 @@ -1,5 +1,6 @@ import autopath, sys from pypy.rpython.lltype import * +from pypy.rpython.rtyper import RPythonTyper from pypy.translator.translator import Translator from pypy.translator.c.database import LowLevelDatabase from pypy.objspace.flow.model import Constant, Variable, SpaceOperation @@ -163,3 +164,27 @@ db.get(s) db.complete() dump_on_stdout(db) + +def test_function_call(): + def g(x, y): + return x-y + def f(x): + return g(1, x) + t = Translator(f) + a = t.annotate([int]) + RPythonTyper(t.annotator).specialize() + + F = FuncType([Signed], Signed) + f = functionptr(F, "f", graph=t.getflowgraph()) + db = LowLevelDatabase() + db.get(f) + db.complete() + dump_on_stdout(db) + +def INPROGRESS_test_func_as_pyobject(): + def f(x): + return x+1 + db = LowLevelDatabase() + db.get(pyobjectptr(f)) + db.complete() + dump_on_stdout(db) From ericvrp at codespeak.net Fri May 27 17:08:29 2005 From: ericvrp at codespeak.net (ericvrp at codespeak.net) Date: Fri, 27 May 2005 17:08:29 +0200 (CEST) Subject: [pypy-svn] r12847 - pypy/dist/pypy/rpython Message-ID: <20050527150829.6186F27B72@code1.codespeak.net> Author: ericvrp Date: Fri May 27 17:08:29 2005 New Revision: 12847 Modified: pypy/dist/pypy/rpython/rbool.py pypy/dist/pypy/rpython/rfloat.py Log: Added float comparison operator Added functions (still need implementation) for casts between bool,int and float Modified: pypy/dist/pypy/rpython/rbool.py ============================================================================== --- pypy/dist/pypy/rpython/rbool.py (original) +++ pypy/dist/pypy/rpython/rbool.py Fri May 27 17:08:29 2005 @@ -1,8 +1,23 @@ -from pypy.annotation.model import SomeBool +from pypy.annotation.pairtype import pair, pairtype +from pypy.annotation.model import SomeBool, SomeFloat, SomeInteger from pypy.rpython.lltype import Bool from pypy.rpython.rtyper import receive +class __extend__(pairtype(SomeBool, SomeInteger)): + + def rtype_convert_from_to((s_from, s_to), v): + # XXX TODO convert SomeBool->SomeInteger + return v + + +class __extend__(pairtype(SomeBool, SomeFloat)): + + def rtype_convert_from_to((s_from, s_to), v): + # XXX TODO convert SomeBool->SomeFloat + return v + + class __extend__(SomeBool): def rtype_is_true(s_bool): Modified: pypy/dist/pypy/rpython/rfloat.py ============================================================================== --- pypy/dist/pypy/rpython/rfloat.py (original) +++ pypy/dist/pypy/rpython/rfloat.py Fri May 27 17:08:29 2005 @@ -7,6 +7,8 @@ class __extend__(pairtype(SomeFloat, SomeFloat)): + #Arithmetic + def rtype_add(args): return _rtype_template(args, 'add') @@ -40,6 +42,28 @@ rtype_inplace_pow = rtype_pow + #comparisons: eq is_ ne lt le gt ge + + def rtype_eq(args): + return _rtype_compare_template(args, 'eq') + + #rtype_is_ = rtype_eq + + def rtype_ne(args): + return _rtype_compare_template(args, 'ne') + + def rtype_lt(args): + return _rtype_compare_template(args, 'lt') + + def rtype_le(args): + return _rtype_compare_template(args, 'le') + + def rtype_gt(args): + return _rtype_compare_template(args, 'gt') + + def rtype_ge(args): + return _rtype_compare_template(args, 'ge') + #Helpers SomeFloat,Somefloat @@ -48,11 +72,26 @@ v_float2 = receive(Float, arg=1) return direct_op('float_'+func, [v_float1, v_float2], resulttype=Float) +def _rtype_compare_template((s_float1, s_float2), func): + v_float1 = receive(Float, arg=0) + v_float2 = receive(Float, arg=1) + return direct_op('float_'+func, [v_float1, v_float2], resulttype=Bool) + # class __extend__(pairtype(SomeFloat, SomeInteger)): - pass + + def rtype_convert_from_to((s_from, s_to), v): + #XXX TODO convert SomeFloat->SomeInteger + return v + + +class __extend__(pairtype(SomeFloat, SomeBool)): + + def rtype_convert_from_to((s_from, s_to), v): + #XXX TODO convert SomeFloat->SomeBool + return v class __extend__(SomeFloat): From arigo at codespeak.net Fri May 27 17:38:09 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Fri, 27 May 2005 17:38:09 +0200 (CEST) Subject: [pypy-svn] r12848 - pypy/dist/pypy/rpython Message-ID: <20050527153809.EAED427B6E@code1.codespeak.net> Author: arigo Date: Fri May 27 17:38:09 2005 New Revision: 12848 Modified: pypy/dist/pypy/rpython/rpbc.py pypy/dist/pypy/rpython/rtyper.py Log: Refactor: rtyper.getfunctionptr() returns a low-level function pointer, typed as found by the annotator, from a Python function object. Modified: pypy/dist/pypy/rpython/rpbc.py ============================================================================== --- pypy/dist/pypy/rpython/rpbc.py (original) +++ pypy/dist/pypy/rpython/rpbc.py Fri May 27 17:38:09 2005 @@ -1,7 +1,7 @@ import types from pypy.annotation.pairtype import pair, pairtype from pypy.annotation.model import SomePBC -from pypy.rpython.lltype import Void, FuncType, functionptr, NonGcPtr +from pypy.rpython.lltype import typeOf from pypy.rpython.rtyper import TLS, receive, receiveconst, direct_op from pypy.rpython.rtyper import peek_at_result_annotation @@ -23,16 +23,10 @@ if not isinstance(func, types.FunctionType): NotImplementedYet # XXX hackish - a = TLS.rtyper.annotator - graph = a.translator.getflowgraph(func) - llinputs = [a.binding(v).lowleveltype() for v in graph.getargs()] - s_output = a.binding(graph.getreturnvar(), None) - if s_output is None: - lloutput = Void - else: - lloutput = s_output.lowleveltype() - FT = FuncType(llinputs, lloutput) - f = functionptr(FT, func.func_name, graph = graph, _callable = func) - args_v = [receive(llinputs[i], arg=i+1) for i in range(len(args_s))] - c = receiveconst(NonGcPtr(FT), f) - return direct_op('direct_call', [c] + args_v, resulttype=lloutput) + f = TLS.rtyper.getfunctionptr(func) + FUNCPTR = typeOf(f) + args_v = [receive(FUNCPTR.TO.ARGS[i], arg=i+1) + for i in range(len(args_s))] + c = receiveconst(FUNCPTR, f) + return direct_op('direct_call', [c] + args_v, + resulttype = FUNCPTR.TO.RESULT) Modified: pypy/dist/pypy/rpython/rtyper.py ============================================================================== --- pypy/dist/pypy/rpython/rtyper.py (original) +++ pypy/dist/pypy/rpython/rtyper.py Fri May 27 17:38:09 2005 @@ -3,7 +3,7 @@ from pypy.objspace.flow.model import Variable, Constant, Block, Link from pypy.objspace.flow.model import SpaceOperation from pypy.rpython.lltype import Void, LowLevelType, NonGcPtr, ContainerType -from pypy.rpython.lltype import FuncType, functionptr +from pypy.rpython.lltype import FuncType, functionptr, typeOf from pypy.tool.tls import tlsobject from pypy.tool.sourcetools import func_with_new_name, valid_identifier from pypy.translator.unsimplify import insert_empty_block @@ -193,6 +193,20 @@ def consider_op_newlist(self, *items_s): return rlist.rtype_newlist(*items_s) + # __________ utilities __________ + + def getfunctionptr(self, func): + """Make a functionptr from the given Python function.""" + a = self.annotator + graph = a.translator.getflowgraph(func) + llinputs = [a.binding(v).lowleveltype() for v in graph.getargs()] + s_output = a.binding(graph.getreturnvar(), None) + if s_output is None: + lloutput = Void + else: + lloutput = s_output.lowleveltype() + FT = FuncType(llinputs, lloutput) + return functionptr(FT, func.func_name, graph = graph, _callable = func) # ____________________________________________________________ # @@ -275,27 +289,21 @@ spec_name.append(valid_identifier(getattr(key, '__name__', key))+suffix) spec_key = tuple(spec_key) try: - spec_function, spec_graph, resulttype = ( - TLS.rtyper.specialized_ll_functions[spec_key]) + spec_function = TLS.rtyper.specialized_ll_functions[spec_key] except KeyError: name = '_'.join(spec_name) spec_function = func_with_new_name(ll_function, name) # flow and annotate (the copy of) the low-level function spec_graph = annotator.translator.getflowgraph(spec_function) - s_returnvalue = annotator.build_types(spec_function, args_s) - resulttype = annmodel.annotation_to_lltype(s_returnvalue, - "%s: " % ll_function.func_name) + annotator.build_types(spec_function, args_s) # cache the result - TLS.rtyper.specialized_ll_functions[spec_key] = ( - spec_function, spec_graph, resulttype) + TLS.rtyper.specialized_ll_functions[spec_key] = spec_function # build the 'direct_call' operation - lltypes = [v.concretetype for v in args_v] - FT = FuncType(lltypes, resulttype) - f = functionptr(FT, ll_function.func_name, graph = spec_graph, - _callable = spec_function) - c = receiveconst(NonGcPtr(FT), f) - return direct_op('direct_call', [c]+list(args_v), resulttype=resulttype) + f = TLS.rtyper.getfunctionptr(spec_function) + c = receiveconst(typeOf(f), f) + return direct_op('direct_call', [c]+list(args_v), + resulttype = typeOf(f).TO.RESULT) def direct_op(opname, args, resulttype=None): From adim at codespeak.net Fri May 27 20:43:13 2005 From: adim at codespeak.net (adim at codespeak.net) Date: Fri, 27 May 2005 20:43:13 +0200 (CEST) Subject: [pypy-svn] r12853 - pypy/branch/pycompiler/module/recparser Message-ID: <20050527184313.9E4FA27B7D@code1.codespeak.net> Author: adim Date: Fri May 27 20:43:13 2005 New Revision: 12853 Modified: pypy/branch/pycompiler/module/recparser/ebnflexer.py pypy/branch/pycompiler/module/recparser/ebnfparse.py pypy/branch/pycompiler/module/recparser/grammar.py Log: - essentially cleaning ebnflexer.py - made the LOOK_AHEAD optional _ improved peek / restore_context in ebnflexer Modified: pypy/branch/pycompiler/module/recparser/ebnflexer.py ============================================================================== --- pypy/branch/pycompiler/module/recparser/ebnflexer.py (original) +++ pypy/branch/pycompiler/module/recparser/ebnflexer.py Fri May 27 20:43:13 2005 @@ -24,7 +24,7 @@ self._peeked = None def context(self): - return self.pos + return self.pos, self._peeked def offset(self, ctx=None): if ctx is None: @@ -33,8 +33,8 @@ assert type(ctx)==int return ctx - def restore(self, ctx ): - self.pos = ctx + def restore(self, ctx): + self.pos, self._peeked = ctx def next(self): if self._peeked is not None: Modified: pypy/branch/pycompiler/module/recparser/ebnfparse.py ============================================================================== --- pypy/branch/pycompiler/module/recparser/ebnfparse.py (original) +++ pypy/branch/pycompiler/module/recparser/ebnfparse.py Fri May 27 20:43:13 2005 @@ -250,10 +250,6 @@ rules = [ star, star_opt, symbol, alternative, rule, grammar, sequence, seq_cont_list, sequence_cont, option, group, alt ] - for r in rules: - r._trace = False - for tk in r.args: - tk._trace = False build_first_sets( rules ) return grammar Modified: pypy/branch/pycompiler/module/recparser/grammar.py ============================================================================== --- pypy/branch/pycompiler/module/recparser/grammar.py (original) +++ pypy/branch/pycompiler/module/recparser/grammar.py Fri May 27 20:43:13 2005 @@ -9,6 +9,7 @@ """ DEBUG = 0 +USE_LOOKAHEAD = True #### Abstract interface for a lexer/tokenizer class TokenSource(object): @@ -48,22 +49,29 @@ def build_first_sets(rules): - # PSEUDO CODE + """builds the real first tokens set for each rule in + + Because a rule can be recursive (directly or indirectly), the + *simplest* algorithm to build each first set is to recompute them + until Computation(N) = Computation(N-1), N being the number of rounds. + As an example, on Python2.3's grammar, we need 19 cycles to compute + full first sets. + """ changed = True - loops = 0 while changed: - loops += 1 + # loop while one first set is changed changed = False for rule in rules: + # For each rule, recompute first set size = len(rule.first_set) rule.calc_first_set() new_size = len(rule.first_set) if new_size != size: changed = True - print "Done", loops, "loops" for r in rules: r.reorder_rule() + from syntaxtree import SyntaxNode, TempSyntaxNode, TokenNode class BaseGrammarBuilder(object): @@ -136,9 +144,10 @@ def is_root(self): """This is a root node of the grammar, that is one that will be included in the syntax tree""" - if self.name!=":" and self.name.startswith(":"): + if self.name != ":" and self.name.startswith(":"): return False return True + def match(self, source, builder, level=0): """Try to match a grammar rule @@ -152,6 +161,9 @@ returns None if no match or an object build by builder """ + if not USE_LOOKAHEAD: + return self._match(source, builder, level) + token = source.peek() pos1 = source.get_pos() in_first_set = self.match_first_set(token) @@ -159,40 +171,36 @@ if EmptyToken in self.first_set: ret = builder.sequence(self, source, 0 ) if self._trace: - prefix = '%seee' % (' ' * level) - print prefix, " RULE =", self - print prefix, " TOKEN =", token - print prefix, " FIRST SET =", self.first_set + self._debug_display(token, level, 'eee') return self.debug_return( ret, 0 ) if self._trace: - prefix = '%srrr' % (' ' * level) - print prefix, " RULE =", self - print prefix, " TOKEN =", token - print prefix, " FIRST SET =", self.first_set + self._debug_display(token, level, 'rrr') return None elif self._trace: - prefix = '%s>>>' % (' ' * level) - print prefix, " RULE =", self - print prefix, " TOKEN =", token - print prefix, " FIRST SET =", self.first_set - - # + self._debug_display(token, level, '>>>') + res = self._match(source, builder, level) if self._trace: pos2 = source.get_pos() if res: - prefix = '%s+++' % (' ' * level) + prefix = '+++' else: - prefix = '%s---' % (' ' * level) - print prefix, " RULE =", self - print prefix, " TOKEN =", token - print prefix, " FIRST SET =", self.first_set - print prefix, " TEXT ='%s'" % source.get_source_text(pos1,pos2) + prefix = '---' + self._debug_display(token, level, prefix) + print ' '*level, prefix, " TEXT ='%s'" % ( + source.get_source_text(pos1,pos2)) if res: print "*" * 50 - # return res + def _debug_display(self, token, level, prefix): + """prints context debug informations""" + prefix = '%s%s' % (' ' * level, prefix) + print prefix, " RULE =", self + print prefix, " TOKEN =", token + print prefix, " FIRST SET =", self.first_set + + def _match(self, source, builder, level=0): """Try to match a grammar rule @@ -214,14 +222,6 @@ # To consider if we need to improve speed in parsing pass -## def calc_first_set(self): -## """Returns a list of possible tokens that can start this rule -## None means the rule can be empty -## """ -## # **NOT USED** **NOT IMPLEMENTED** -## # To consider if we need to improve speed in parsing -## pass - def __str__(self): return self.display(0) @@ -287,10 +287,11 @@ # try instead to get the longest alternative # to see if this solve our problems with infinite recursion for rule in self.args: - if not rule.match_first_set(tok) and EmptyToken not in rule.first_set: - if self._trace: - print "Skipping impossible rule: %s" % (rule,) - continue + if USE_LOOKAHEAD: + if not rule.match_first_set(tok) and EmptyToken not in rule.first_set: + if self._trace: + print "Skipping impossible rule: %s" % (rule,) + continue m = rule.match(source, builder, level+1) if m: ret = builder.alternative( self, source ) @@ -312,32 +313,43 @@ if S -> (A | B | C): LAH(S) = Union( LAH(A), LAH(B), LAH(C) ) """ - # do this to avoid problems on indirect recursive rules for rule in self.args: for t in rule.first_set: if t not in self.first_set: self.first_set.append(t) + # self.first_set[t] = 1 - def reorder_rules(self): + def reorder_rule(self): # take the opportunity to reorder rules in alternatives # so that rules with Empty in their first set come last # warn if two rules have empty in their first set empty_set = [] not_empty_set = [] - for r in self.args: - if EmptyToken in r.first_set: - empty_set.append( r ) + # is only needed for warning / debugging purposes + tokens_set = [] + for rule in self.args: + if EmptyToken in rule.first_set: + empty_set.append(rule) else: - not_empty_set.append( r ) - if len(empty_set)>1 and not self._reordered: + not_empty_set.append(rule) + if DEBUG: + # This loop is only neede dfor warning / debugging purposes + # It will check if a token is part of several first sets of + # a same alternative + for token in rule.first_set: + if token is not EmptyToken and token in tokens_set: + print "Warning, token %s in\n\t%s's first set is part " \ + "of a previous rule's first set in alternative\n\t" \ + "%s" % (token, rule, self) + tokens_set.append(token) + if len(empty_set) > 1 and not self._reordered: print "Warning: alternative %s has more than one rule matching Empty" % self self._reordered = True self.args[:] = not_empty_set self.args.extend( empty_set ) - class Sequence(GrammarElement): """Reprensents a Sequence in a grammar rule (as in S -> A B C)""" def __init__(self, name, *args): @@ -385,10 +397,12 @@ for rule in self.args: if EmptyToken in self.first_set: self.first_set.remove( EmptyToken ) + # del self.first_set[EmptyToken] # while we're in this loop, keep agregating possible tokens for t in rule.first_set: if t not in self.first_set: self.first_set.append(t) + # self.first_set[t] = 1 if EmptyToken not in rule.first_set: break @@ -406,6 +420,7 @@ self.star = "x" if self.min == 0: self.first_set.append( EmptyToken ) + # self.first_set[EmptyToken] = 1 def _match(self, source, builder, level=0): """matches a number of times self.args[0]. the number must be comprised @@ -458,8 +473,10 @@ """ rule = self.args[0] self.first_set = rule.first_set[:] + # self.first_set = dict(rule.first_set) if self.min == 0 and EmptyToken not in self.first_set: self.first_set.append(EmptyToken) + # self.first_set[EmptyToken] = 1 class Token(GrammarElement): """Represents a Token in a grammar rule (a lexer token)""" @@ -467,8 +484,9 @@ GrammarElement.__init__( self, name ) self.value = value self.first_set = [self] + # self.first_set = {self: 1} - def _match(self, source, builder, level=0): + def match(self, source, builder, level=0): """Matches a token. the default implementation is to match any token whose type corresponds to the object's name. You can extend Token From ericvrp at codespeak.net Fri May 27 22:08:02 2005 From: ericvrp at codespeak.net (ericvrp at codespeak.net) Date: Fri, 27 May 2005 22:08:02 +0200 (CEST) Subject: [pypy-svn] r12854 - pypy/dist/pypy/rpython Message-ID: <20050527200802.BBC8F27B7D@code1.codespeak.net> Author: ericvrp Date: Fri May 27 22:08:02 2005 New Revision: 12854 Modified: pypy/dist/pypy/rpython/rbool.py pypy/dist/pypy/rpython/rfloat.py pypy/dist/pypy/rpython/rint.py Log: Added some debug code. Checkpoint before I start working on explicitly casting signed <-> unsigned ints inr rint.py. Modified: pypy/dist/pypy/rpython/rbool.py ============================================================================== --- pypy/dist/pypy/rpython/rbool.py (original) +++ pypy/dist/pypy/rpython/rbool.py Fri May 27 22:08:02 2005 @@ -4,17 +4,19 @@ from pypy.rpython.rtyper import receive +debug = True + class __extend__(pairtype(SomeBool, SomeInteger)): def rtype_convert_from_to((s_from, s_to), v): - # XXX TODO convert SomeBool->SomeInteger + if debug: print 'XXX TODO cast SomeBool->SomeInteger' return v class __extend__(pairtype(SomeBool, SomeFloat)): def rtype_convert_from_to((s_from, s_to), v): - # XXX TODO convert SomeBool->SomeFloat + if debug: print 'XXX TODO cast SomeBool->SomeFloat' return v Modified: pypy/dist/pypy/rpython/rfloat.py ============================================================================== --- pypy/dist/pypy/rpython/rfloat.py (original) +++ pypy/dist/pypy/rpython/rfloat.py Fri May 27 22:08:02 2005 @@ -5,6 +5,8 @@ from pypy.rpython.rtyper import TyperError +debug = True + class __extend__(pairtype(SomeFloat, SomeFloat)): #Arithmetic @@ -47,7 +49,7 @@ def rtype_eq(args): return _rtype_compare_template(args, 'eq') - #rtype_is_ = rtype_eq + rtype_is_ = rtype_eq def rtype_ne(args): return _rtype_compare_template(args, 'ne') @@ -83,23 +85,40 @@ class __extend__(pairtype(SomeFloat, SomeInteger)): def rtype_convert_from_to((s_from, s_to), v): - #XXX TODO convert SomeFloat->SomeInteger + if debug: print 'XXX TODO cast SomeFloat->SomeInteger' + return v + + +# + +class __extend__(pairtype(SomeInteger, SomeFloat)): + + def rtype_convert_from_to((s_from, s_to), v): + if debug: print 'XXX TODO cast SomeInteger->SomeFloat' return v +# + class __extend__(pairtype(SomeFloat, SomeBool)): def rtype_convert_from_to((s_from, s_to), v): - #XXX TODO convert SomeFloat->SomeBool + if debug: print 'XXX TODO cast SomeFloat->SomeBool' return v +# + class __extend__(SomeFloat): def rtype_is_true(s_float): v_float = receive(Float, arg=0) return direct_op('float_is_true', [v_float], resulttype=Bool) + def rtype_nonzero(s_float): + v_float = receive(Float, arg=0) + return direct_op('float_nonzero', [v_float], resulttype=Bool) + def rtype_neg(s_int): v_int = receive(Float, arg=0) return direct_op('float_neg', [v_int], resulttype=Float) Modified: pypy/dist/pypy/rpython/rint.py ============================================================================== --- pypy/dist/pypy/rpython/rint.py (original) +++ pypy/dist/pypy/rpython/rint.py Fri May 27 22:08:02 2005 @@ -5,11 +5,20 @@ from pypy.rpython.rtyper import TyperError +debug = True + class __extend__(pairtype(SomeInteger, SomeInteger)): - def rtype_convert_from_to((s_from, s_to), v): - # assume that converting between signed and unsigned doesn't need - # an operation for now + def rtype_convert_from_to((s_from, s_to), v): #XXX What is v here? + if s_from.unsigned != s_to.unsigned: + if s_to.unsigned: + if debug: print 'explicit cast Signed->Unsigned' + v_int = receive(Signed, arg=0) + return direct_op('cast_int_to_uint', [v_int], resulttype=Unsigned) + else: + if debug: print 'explicit cast Unsigned->Signed' + v_int = receive(Unsigned, arg=0) + return direct_op('cast_uint_to_int', [v_int], resulttype=Signed) return v #arithmetic @@ -255,11 +264,11 @@ v_int = receive(Unsigned, arg=0) else: v_int = receive(Signed, arg=0) - return direct_op('int_abs', [v_int], resulttype=Signed) + return direct_op('int_abs', [v_int], resulttype=Signed) #XXX I would like to make this Unsigned, but the annotator insists it is Signed! def rtype_abs_ovf(s_int): v_int = receive(Signed, arg=0) - return direct_op('int_abs_ovf', [v_int], resulttype=Signed) + return direct_op('int_abs_ovf', [v_int], resulttype=Signed) #XXX I would like to make this Unsigned, but the annotator insists it is Signed! def rtype_invert(s_int): v_int = receive(Signed, arg=0) From ericvrp at codespeak.net Sat May 28 00:25:07 2005 From: ericvrp at codespeak.net (ericvrp at codespeak.net) Date: Sat, 28 May 2005 00:25:07 +0200 (CEST) Subject: [pypy-svn] r12855 - pypy/dist/pypy/rpython Message-ID: <20050527222507.4125C27B52@code1.codespeak.net> Author: ericvrp Date: Sat May 28 00:25:07 2005 New Revision: 12855 Modified: pypy/dist/pypy/rpython/rbool.py pypy/dist/pypy/rpython/rfloat.py pypy/dist/pypy/rpython/rint.py Log: Added explicit casting. This should also work for signed <-> unsigned integers. Some backends require this feature (LLVM). Modified: pypy/dist/pypy/rpython/rbool.py ============================================================================== --- pypy/dist/pypy/rpython/rbool.py (original) +++ pypy/dist/pypy/rpython/rbool.py Sat May 28 00:25:07 2005 @@ -1,27 +1,32 @@ -from pypy.annotation.pairtype import pair, pairtype -from pypy.annotation.model import SomeBool, SomeFloat, SomeInteger -from pypy.rpython.lltype import Bool -from pypy.rpython.rtyper import receive +from pypy.annotation.pairtype import pairtype +from pypy.annotation.model import SomeFloat, SomeInteger, SomeBool, SomePBC +from pypy.rpython.lltype import Signed, Unsigned, Bool, Float +from pypy.rpython.rtyper import receive, direct_op +from pypy.rpython.rtyper import TyperError -debug = True +debug = False class __extend__(pairtype(SomeBool, SomeInteger)): def rtype_convert_from_to((s_from, s_to), v): - if debug: print 'XXX TODO cast SomeBool->SomeInteger' - return v + if s_to.unsigned: + if debug: print 'explicit cast_bool_to_uint' + return direct_op('cast_bool_to_uint', [v], resulttype=Unsigned) + else: + if debug: print 'explicit cast_bool_to_int' + return direct_op('cast_bool_to_int', [v], resulttype=Signed) class __extend__(pairtype(SomeBool, SomeFloat)): def rtype_convert_from_to((s_from, s_to), v): - if debug: print 'XXX TODO cast SomeBool->SomeFloat' - return v + if debug: print 'explicit cast_bool_to_float' + return direct_op('cast_bool_to_float', [v], resulttype=Float) class __extend__(SomeBool): def rtype_is_true(s_bool): - v_bool = receive(Bool, arg=0) + v_bool = receive(Bool, 0) return v_bool Modified: pypy/dist/pypy/rpython/rfloat.py ============================================================================== --- pypy/dist/pypy/rpython/rfloat.py (original) +++ pypy/dist/pypy/rpython/rfloat.py Sat May 28 00:25:07 2005 @@ -1,11 +1,11 @@ -from pypy.annotation.pairtype import pair, pairtype +from pypy.annotation.pairtype import pairtype from pypy.annotation.model import SomeFloat, SomeInteger, SomeBool, SomePBC from pypy.rpython.lltype import Signed, Unsigned, Bool, Float -from pypy.rpython.rtyper import peek_at_result_annotation, receive, direct_op +from pypy.rpython.rtyper import receive, direct_op from pypy.rpython.rtyper import TyperError -debug = True +debug = False class __extend__(pairtype(SomeFloat, SomeFloat)): @@ -33,13 +33,13 @@ def rtype_pow((s_float1, s_float2), s_float3=SomePBC({None: True})): if isinstance(s_float3, SomeInteger): - v_float3_list = [receive(Float, arg=2)] + v_float3_list = [receive(Float, 2)] elif s_float3.is_constant() and s_float3.const is None: v_float3_list = [] else: raise TyperError("pow() 3rd argument must be int or None") - v_float1 = receive(Float, arg=0) - v_float2 = receive(Float, arg=1) + v_float1 = receive(Float, 0) + v_float2 = receive(Float, 1) return direct_op('float_pow', [v_float1, v_float2] + v_float3_list, resulttype=Float) rtype_inplace_pow = rtype_pow @@ -70,13 +70,13 @@ #Helpers SomeFloat,Somefloat def _rtype_template((s_float1, s_float2), func): - v_float1 = receive(Float, arg=0) - v_float2 = receive(Float, arg=1) + v_float1 = receive(Float, 0) + v_float2 = receive(Float, 1) return direct_op('float_'+func, [v_float1, v_float2], resulttype=Float) def _rtype_compare_template((s_float1, s_float2), func): - v_float1 = receive(Float, arg=0) - v_float2 = receive(Float, arg=1) + v_float1 = receive(Float, 0) + v_float2 = receive(Float, 1) return direct_op('float_'+func, [v_float1, v_float2], resulttype=Bool) @@ -85,8 +85,12 @@ class __extend__(pairtype(SomeFloat, SomeInteger)): def rtype_convert_from_to((s_from, s_to), v): - if debug: print 'XXX TODO cast SomeFloat->SomeInteger' - return v + if s_to.unsigned: + if debug: print 'explicit cast_float_to_uint' + return direct_op('cast_float_to_uint', [v], resulttype=Unsigned) + else: + if debug: print 'explicit cast_float_to_int' + return direct_op('cast_float_to_int', [v], resulttype=Signed) # @@ -94,8 +98,12 @@ class __extend__(pairtype(SomeInteger, SomeFloat)): def rtype_convert_from_to((s_from, s_to), v): - if debug: print 'XXX TODO cast SomeInteger->SomeFloat' - return v + if s_from.unsigned: + if debug: print 'explicit cast_uint_to_float' + return direct_op('cast_uint_to_float', [v], resulttype=Float) + else: + if debug: print 'explicit cast_int_to_float' + return direct_op('cast_int_to_float', [v], resulttype=Float) # @@ -103,8 +111,8 @@ class __extend__(pairtype(SomeFloat, SomeBool)): def rtype_convert_from_to((s_from, s_to), v): - if debug: print 'XXX TODO cast SomeFloat->SomeBool' - return v + if debug: print 'explicit cast_float_to_bool' + return direct_op('cast_float_to_bool', [v], resulttype=Bool) #XXX or can 'float_is_true' be reused here? # @@ -112,16 +120,16 @@ class __extend__(SomeFloat): def rtype_is_true(s_float): - v_float = receive(Float, arg=0) + v_float = receive(Float, 0) return direct_op('float_is_true', [v_float], resulttype=Bool) def rtype_nonzero(s_float): - v_float = receive(Float, arg=0) + v_float = receive(Float, 0) return direct_op('float_nonzero', [v_float], resulttype=Bool) def rtype_neg(s_int): - v_int = receive(Float, arg=0) + v_int = receive(Float, 0) return direct_op('float_neg', [v_int], resulttype=Float) def rtype_pos(s_int): - return receive(Float, arg=0) + return receive(Float, 0) Modified: pypy/dist/pypy/rpython/rint.py ============================================================================== --- pypy/dist/pypy/rpython/rint.py (original) +++ pypy/dist/pypy/rpython/rint.py Sat May 28 00:25:07 2005 @@ -1,192 +1,190 @@ -from pypy.annotation.pairtype import pair, pairtype -from pypy.annotation.model import SomeInteger, SomeBool, SomePBC -from pypy.rpython.lltype import Signed, Unsigned, Bool -from pypy.rpython.rtyper import peek_at_result_annotation, receive, direct_op +from pypy.annotation.pairtype import pairtype +from pypy.annotation.model import SomeFloat, SomeInteger, SomeBool, SomePBC +from pypy.rpython.lltype import Signed, Unsigned, Bool, Float +from pypy.rpython.rtyper import receive, direct_op from pypy.rpython.rtyper import TyperError -debug = True +debug = False class __extend__(pairtype(SomeInteger, SomeInteger)): - def rtype_convert_from_to((s_from, s_to), v): #XXX What is v here? - if s_from.unsigned != s_to.unsigned: + def rtype_convert_from_to((s_from, s_to), v): + if s_from.unsigned != s_to.unsigned: #XXX Can _receive_may_cast(...) be used here? if s_to.unsigned: - if debug: print 'explicit cast Signed->Unsigned' - v_int = receive(Signed, arg=0) - return direct_op('cast_int_to_uint', [v_int], resulttype=Unsigned) + if debug: print 'explicit cast_int_to_uint' + return direct_op('cast_int_to_uint', [v], resulttype=Unsigned) else: - if debug: print 'explicit cast Unsigned->Signed' - v_int = receive(Unsigned, arg=0) - return direct_op('cast_uint_to_int', [v_int], resulttype=Signed) + if debug: print 'explicit cast_uint_to_int' + return direct_op('cast_uint_to_int', [v], resulttype=Signed) return v #arithmetic def rtype_add((s_int1, s_int2)): if s_int1.unsigned or s_int2.unsigned: - v_int1 = receive(Unsigned, arg=0) - v_int2 = receive(Unsigned, arg=1) + v_int1 = _receive_may_cast(s_int1, Unsigned, 0) + v_int2 = _receive_may_cast(s_int2, Unsigned, 1) return direct_op('uint_add', [v_int1, v_int2], resulttype=Unsigned) else: - v_int1 = receive(Signed, arg=0) - v_int2 = receive(Signed, arg=1) + v_int1 = _receive_may_cast(s_int1, Signed, 0) + v_int2 = _receive_may_cast(s_int2, Signed, 1) return direct_op('int_add', [v_int1, v_int2], resulttype=Signed) rtype_inplace_add = rtype_add def rtype_add_ovf((s_int1, s_int2)): if s_int1.unsigned or s_int2.unsigned: - v_int1 = receive(Unsigned, arg=0) - v_int2 = receive(Unsigned, arg=1) + v_int1 = _receive_may_cast(s_int1, Unsigned, 0) + v_int2 = _receive_may_cast(s_int2, Unsigned, 1) return direct_op('uint_add_ovf', [v_int1, v_int2], resulttype=Unsigned) else: - v_int1 = receive(Signed, arg=0) - v_int2 = receive(Signed, arg=1) + v_int1 = _receive_may_cast(s_int1, Signed, 0) + v_int2 = _receive_may_cast(s_int2, Signed, 1) return direct_op('int_add_ovf', [v_int1, v_int2], resulttype=Signed) rtype_inplace_add_ovf = rtype_add_ovf def rtype_sub((s_int1, s_int2)): if s_int1.unsigned or s_int2.unsigned: - v_int1 = receive(Unsigned, arg=0) - v_int2 = receive(Unsigned, arg=1) + v_int1 = _receive_may_cast(s_int1, Unsigned, 0) + v_int2 = _receive_may_cast(s_int2, Unsigned, 1) return direct_op('uint_sub', [v_int1, v_int2], resulttype=Unsigned) else: - v_int1 = receive(Signed, arg=0) - v_int2 = receive(Signed, arg=1) + v_int1 = _receive_may_cast(s_int1, Signed, 0) + v_int2 = _receive_may_cast(s_int2, Signed, 1) return direct_op('int_sub', [v_int1, v_int2], resulttype=Signed) rtype_inplace_sub = rtype_sub def rtype_sub_ovf((s_int1, s_int2)): if s_int1.unsigned or s_int2.unsigned: - v_int1 = receive(Unsigned, arg=0) - v_int2 = receive(Unsigned, arg=1) + v_int1 = _receive_may_cast(s_int1, Unsigned, 0) + v_int2 = _receive_may_cast(s_int2, Unsigned, 1) return direct_op('uint_sub_ovf', [v_int1, v_int2], resulttype=Unsigned) else: - v_int1 = receive(Signed, arg=0) - v_int2 = receive(Signed, arg=1) + v_int1 = _receive_may_cast(s_int1, Signed, 0) + v_int2 = _receive_may_cast(s_int2, Signed, 1) return direct_op('int_sub_ovf', [v_int1, v_int2], resulttype=Signed) rtype_inplace_sub_ovf = rtype_sub_ovf def rtype_mul((s_int1, s_int2)): if s_int1.unsigned or s_int2.unsigned: - v_int1 = receive(Unsigned, arg=0) - v_int2 = receive(Unsigned, arg=1) + v_int1 = _receive_may_cast(s_int1, Unsigned, 0) + v_int2 = _receive_may_cast(s_int2, Unsigned, 1) return direct_op('uint_mul', [v_int1, v_int2], resulttype=Unsigned) else: - v_int1 = receive(Signed, arg=0) - v_int2 = receive(Signed, arg=1) + v_int1 = _receive_may_cast(s_int1, Signed, 0) + v_int2 = _receive_may_cast(s_int2, Signed, 1) return direct_op('int_mul', [v_int1, v_int2], resulttype=Signed) rtype_inplace_mul = rtype_mul def rtype_div((s_int1, s_int2)): if s_int1.unsigned or s_int2.unsigned: - v_int1 = receive(Unsigned, arg=0) - v_int2 = receive(Unsigned, arg=1) + v_int1 = _receive_may_cast(s_int1, Unsigned, 0) + v_int2 = _receive_may_cast(s_int2, Unsigned, 1) return direct_op('uint_div', [v_int1, v_int2], resulttype=Unsigned) else: - v_int1 = receive(Signed, arg=0) - v_int2 = receive(Signed, arg=1) + v_int1 = _receive_may_cast(s_int1, Signed, 0) + v_int2 = _receive_may_cast(s_int2, Signed, 1) return direct_op('int_div', [v_int1, v_int2], resulttype=Signed) rtype_inplace_div = rtype_div def rtype_mod((s_int1, s_int2)): if s_int1.unsigned or s_int2.unsigned: - v_int1 = receive(Unsigned, arg=0) - v_int2 = receive(Unsigned, arg=1) + v_int1 = _receive_may_cast(s_int1, Unsigned, 0) + v_int2 = _receive_may_cast(s_int2, Unsigned, 1) return direct_op('uint_mod', [v_int1, v_int2], resulttype=Unsigned) else: - v_int1 = receive(Signed, arg=0) - v_int2 = receive(Signed, arg=1) + v_int1 = _receive_may_cast(s_int1, Signed, 0) + v_int2 = _receive_may_cast(s_int2, Signed, 1) return direct_op('int_mod', [v_int1, v_int2], resulttype=Signed) rtype_inplace_mod = rtype_mod def rtype_xor((s_int1, s_int2)): if s_int1.unsigned or s_int2.unsigned: - v_int1 = receive(Unsigned, arg=0) - v_int2 = receive(Unsigned, arg=1) + v_int1 = _receive_may_cast(s_int1, Unsigned, 0) + v_int2 = _receive_may_cast(s_int2, Unsigned, 1) return direct_op('uint_xor', [v_int1, v_int2], resulttype=Unsigned) else: - v_int1 = receive(Signed, arg=0) - v_int2 = receive(Signed, arg=1) + v_int1 = _receive_may_cast(s_int1, Signed, 0) + v_int2 = _receive_may_cast(s_int2, Signed, 1) return direct_op('int_xor', [v_int1, v_int2], resulttype=Signed) rtype_inplace_xor = rtype_xor def rtype_and_((s_int1, s_int2)): if s_int1.unsigned or s_int2.unsigned: - v_int1 = receive(Unsigned, arg=0) - v_int2 = receive(Unsigned, arg=1) + v_int1 = _receive_may_cast(s_int1, Unsigned, 0) + v_int2 = _receive_may_cast(s_int2, Unsigned, 1) return direct_op('uint_and', [v_int1, v_int2], resulttype=Unsigned) else: - v_int1 = receive(Signed, arg=0) - v_int2 = receive(Signed, arg=1) + v_int1 = _receive_may_cast(s_int1, Signed, 0) + v_int2 = _receive_may_cast(s_int2, Signed, 1) return direct_op('int_and', [v_int1, v_int2], resulttype=Signed) rtype_inplace_and = rtype_and_ def rtype_or_((s_int1, s_int2)): if s_int1.unsigned or s_int2.unsigned: - v_int1 = receive(Unsigned, arg=0) - v_int2 = receive(Unsigned, arg=1) + v_int1 = _receive_may_cast(s_int1, Unsigned, 0) + v_int2 = _receive_may_cast(s_int2, Unsigned, 1) return direct_op('uint_or', [v_int1, v_int2], resulttype=Unsigned) else: - v_int1 = receive(Signed, arg=0) - v_int2 = receive(Signed, arg=1) + v_int1 = _receive_may_cast(s_int1, Signed, 0) + v_int2 = _receive_may_cast(s_int2, Signed, 1) return direct_op('int_or', [v_int1, v_int2], resulttype=Signed) rtype_inplace_or = rtype_or_ def rtype_lshift((s_int1, s_int2)): if s_int1.unsigned: - v_int1 = receive(Unsigned, arg=0) - v_int2 = receive(Unsigned, arg=1) + v_int1 = _receive_may_cast(s_int1, Unsigned, 0) + v_int2 = _receive_may_cast(s_int2, Unsigned, 1) return direct_op('uint_lshift', [v_int1, v_int2], resulttype=Unsigned) else: - v_int1 = receive(Signed, arg=0) - v_int2 = receive(Signed, arg=1) + v_int1 = _receive_may_cast(s_int1, Signed, 0) + v_int2 = _receive_may_cast(s_int2, Signed, 1) return direct_op('int_lshift', [v_int1, v_int2], resulttype=Signed) rtype_inplace_lshift = rtype_lshift def rtype_rshift((s_int1, s_int2)): if s_int1.unsigned: - v_int1 = receive(Unsigned, arg=0) - v_int2 = receive(Unsigned, arg=1) + v_int1 = _receive_may_cast(s_int1, Unsigned, 0) + v_int2 = _receive_may_cast(s_int2, Unsigned, 1) return direct_op('uint_rshift', [v_int1, v_int2], resulttype=Unsigned) else: - v_int1 = receive(Signed, arg=0) - v_int2 = receive(Signed, arg=1) + v_int1 = _receive_may_cast(s_int1, Signed, 0) + v_int2 = _receive_may_cast(s_int2, Signed, 1) return direct_op('int_rshift', [v_int1, v_int2], resulttype=Signed) rtype_inplace_rshift = rtype_rshift def rtype_lshift_ovf((s_int1, s_int2)): if s_int1.unsigned: - v_int1 = receive(Unsigned, arg=0) - v_int2 = receive(Unsigned, arg=1) + v_int1 = _receive_may_cast(s_int1, Unsigned, 0) + v_int2 = _receive_may_cast(s_int2, Unsigned, 1) return direct_op('uint_lshift_ovf', [v_int1, v_int2], resulttype=Unsigned) else: - v_int1 = receive(Signed, arg=0) - v_int2 = receive(Signed, arg=1) + v_int1 = _receive_may_cast(s_int1, Signed, 0) + v_int2 = _receive_may_cast(s_int2, Signed, 1) return direct_op('int_lshift_ovf', [v_int1, v_int2], resulttype=Signed) rtype_inplace_lshift_ovf = rtype_lshift_ovf def rtype_rshift_ovf((s_int1, s_int2)): if s_int1.unsigned: - v_int1 = receive(Unsigned, arg=0) - v_int2 = receive(Unsigned, arg=1) + v_int1 = _receive_may_cast(s_int1, Unsigned, 0) + v_int2 = _receive_may_cast(s_int2, Unsigned, 1) return direct_op('uint_rshift_ovf', [v_int1, v_int2], resulttype=Unsigned) else: - v_int1 = receive(Signed, arg=0) - v_int2 = receive(Signed, arg=1) + v_int1 = _receive_may_cast(s_int1, Signed, 0) + v_int2 = _receive_may_cast(s_int2, Signed, 1) return direct_op('int_rshift_ovf', [v_int1, v_int2], resulttype=Signed) rtype_inplace_rshift_ovf = rtype_rshift_ovf @@ -194,20 +192,20 @@ def rtype_pow((s_int1, s_int2), s_int3=SomePBC({None: True})): if isinstance(s_int3, SomeInteger): if s_int3.unsigned: - v_int3_list = [receive(Unsigned, arg=2)] + v_int3_list = [_receive_may_cast(s_int1, Unsigned, 2)] else: - v_int3_list = [receive(Signed, arg=2)] + v_int3_list = [_receive_may_cast(s_int1, Signed, 2)] elif s_int3.is_constant() and s_int3.const is None: v_int3_list = [] else: raise TyperError("pow() 3rd argument must be int or None") if s_int1.unsigned or s_int2.unsigned: - v_int1 = receive(Unsigned, arg=0) - v_int2 = receive(Unsigned, arg=1) + v_int1 = _receive_may_cast(s_int1, Unsigned, 0) + v_int2 = _receive_may_cast(s_int2, Unsigned, 1) return direct_op('uint_pow', [v_int1, v_int2] + v_int3_list, resulttype=Unsigned) else: - v_int1 = receive(Signed, arg=0) - v_int2 = receive(Signed, arg=1) + v_int1 = _receive_may_cast(s_int1, Signed, 0) + v_int2 = _receive_may_cast(s_int2, Signed, 1) return direct_op('int_pow', [v_int1, v_int2] + v_int3_list, resulttype=Signed) rtype_inplace_pow = rtype_pow @@ -234,18 +232,39 @@ def rtype_ge(args): return _rtype_compare_template(args, 'ge') +#Helper functions + +def _receive_may_cast(s_var, s_requested, arg): + v = receive(s_requested, arg) + s = (Signed,Unsigned)[s_var.unsigned] + if s != s_requested: + if s_requested is Unsigned: + if debug: print 'cast_int_to_uint' + return direct_op('cast_int_to_uint', [v], resulttype=Unsigned) + else: + if debug: print 'cast_uint_to_int' + return direct_op('cast_uint_to_int', [v], resulttype=Signed) + #elif debug: + # if s_requested is Unsigned: + # if debug: print 'fake cast_uint_to_uint' + # return direct_op('cast_uint_to_uint', [v], resulttype=Unsigned) + # else: + # if debug: print 'fake cast_int_to_int' + # return direct_op('cast_int_to_int', [v], resulttype=Signed) + return v + #Helper functions for comparisons def _rtype_compare_template((s_int1, s_int2), func): if s_int1.unsigned or s_int2.unsigned: if not s_int1.nonneg or not s_int2.nonneg: raise TyperError("comparing a signed and an unsigned number") - v_int1 = receive(Unsigned, arg=0) - v_int2 = receive(Unsigned, arg=1) + v_int1 = _receive_may_cast(s_int1, Unsigned, 0) + v_int2 = _receive_may_cast(s_int2, Unsigned, 1) return direct_op('uint_'+func, [v_int1, v_int2], resulttype=Bool) else: - v_int1 = receive(Signed, arg=0) - v_int2 = receive(Signed, arg=1) + v_int1 = _receive_may_cast(s_int1, Signed, 0) + v_int2 = _receive_may_cast(s_int2, Signed, 1) return direct_op('int_'+func, [v_int1, v_int2], resulttype=Bool) @@ -254,32 +273,35 @@ class __extend__(SomeInteger): def rtype_is_true(s_int): - v_int = receive(Signed, arg=0) + v_int = _receive_may_cast(s_int, Signed, 0) return direct_op('int_is_true', [v_int], resulttype=Bool) #Unary arithmetic operations def rtype_abs(s_int): if s_int.unsigned: - v_int = receive(Unsigned, arg=0) + return _receive_may_cast(s_int, Unsigned, 0) else: - v_int = receive(Signed, arg=0) - return direct_op('int_abs', [v_int], resulttype=Signed) #XXX I would like to make this Unsigned, but the annotator insists it is Signed! + v_int = _receive_may_cast(s_int, Signed, 0) + return direct_op('int_abs', [v_int], resulttype=Signed) #XXX I would like to make this Unsigned, but the annotator insists it is Signed! def rtype_abs_ovf(s_int): - v_int = receive(Signed, arg=0) - return direct_op('int_abs_ovf', [v_int], resulttype=Signed) #XXX I would like to make this Unsigned, but the annotator insists it is Signed! + if s_int.unsigned: + return _receive_may_cast(s_int, Unsigned, 0) + else: + v_int = _receive_may_cast(s_int, Signed, 0) + direct_op('int_abs_ovf', [v_int], resulttype=Signed) #XXX I would like to make this Unsigned, but the annotator insists it is Signed! def rtype_invert(s_int): - v_int = receive(Signed, arg=0) + v_int = _receive_may_cast(s_int, Signed, 0) return direct_op('int_invert', [v_int], resulttype=Signed) def rtype_neg(s_int): - v_int = receive(Signed, arg=0) + v_int = _receive_may_cast(s_int, Signed, 0) return direct_op('int_neg', [v_int], resulttype=Signed) def rtype_pos(s_int): if s_int.unsigned: - return receive(Unsigned, arg=0) + return _receive_may_cast(s_int, Unsigned, 0) else: - return receive(Signed, arg=0) + return _receive_may_cast(s_int, Signed, 0) From cfbolz at codespeak.net Sat May 28 00:57:00 2005 From: cfbolz at codespeak.net (cfbolz at codespeak.net) Date: Sat, 28 May 2005 00:57:00 +0200 (CEST) Subject: [pypy-svn] r12856 - pypy/dist/pypy/translator/llvm Message-ID: <20050527225700.659F327B52@code1.codespeak.net> Author: cfbolz Date: Sat May 28 00:57:00 2005 New Revision: 12856 Added: pypy/dist/pypy/translator/llvm/reprmap.py Log: forgot to add file. Argh Added: pypy/dist/pypy/translator/llvm/reprmap.py ============================================================================== --- (empty file) +++ pypy/dist/pypy/translator/llvm/reprmap.py Sat May 28 00:57:00 2005 @@ -0,0 +1,21 @@ +import autopath + +from pypy.rpython import lltype + +from pypy.translator.llvm import representation, funcrepr, typerepr, seqrepr +from pypy.translator.llvm import classrepr, pbcrepr + +PRIMITIVE_REPRS = { + lltype.Signed: representation.SignedRepr, + lltype.Unsigned: representation.UnsignedRepr, + lltype.Char: representation.CharRepr, + lltype.Bool: representation.BoolRepr +} + +PRIMITIVE_TYPES = { + lltype.Signed: typerepr.SignedTypeRepr, + lltype.Unsigned: typerepr.UnsignedTypeRepr, + lltype.Char: typerepr.CharTypeRepr, + lltype.Bool: typerepr.BoolTypeRepr, +} + From arigo at codespeak.net Sun May 29 00:04:00 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Sun, 29 May 2005 00:04:00 +0200 (CEST) Subject: [pypy-svn] r12863 - pypy/dist/pypy/rpython Message-ID: <20050528220400.8605D27B5F@code1.codespeak.net> Author: arigo Date: Sun May 29 00:04:00 2005 New Revision: 12863 Modified: pypy/dist/pypy/rpython/rbool.py pypy/dist/pypy/rpython/rbuiltin.py pypy/dist/pypy/rpython/rfloat.py pypy/dist/pypy/rpython/rint.py pypy/dist/pypy/rpython/rlist.py pypy/dist/pypy/rpython/robject.py pypy/dist/pypy/rpython/rpbc.py pypy/dist/pypy/rpython/rptr.py pypy/dist/pypy/rpython/rtyper.py Log: Some refactoring, according to the lines of the pypy-dev post http://codespeak.net/pipermail/pypy-dev/2005q2/002109.html In a word, the thread-local storage is gone and we pass around a HighLevelOp object ('hop' for short :-) Modified: pypy/dist/pypy/rpython/rbool.py ============================================================================== --- pypy/dist/pypy/rpython/rbool.py (original) +++ pypy/dist/pypy/rpython/rbool.py Sun May 29 00:04:00 2005 @@ -1,7 +1,6 @@ from pypy.annotation.pairtype import pairtype from pypy.annotation.model import SomeFloat, SomeInteger, SomeBool, SomePBC from pypy.rpython.lltype import Signed, Unsigned, Bool, Float -from pypy.rpython.rtyper import receive, direct_op from pypy.rpython.rtyper import TyperError @@ -9,24 +8,24 @@ class __extend__(pairtype(SomeBool, SomeInteger)): - def rtype_convert_from_to((s_from, s_to), v): + def rtype_convert_from_to((s_from, s_to), v, llops): if s_to.unsigned: if debug: print 'explicit cast_bool_to_uint' - return direct_op('cast_bool_to_uint', [v], resulttype=Unsigned) + return llops.genop('cast_bool_to_uint', [v], resulttype=Unsigned) else: if debug: print 'explicit cast_bool_to_int' - return direct_op('cast_bool_to_int', [v], resulttype=Signed) + return llops.genop('cast_bool_to_int', [v], resulttype=Signed) class __extend__(pairtype(SomeBool, SomeFloat)): - def rtype_convert_from_to((s_from, s_to), v): + def rtype_convert_from_to((s_from, s_to), v, llops): if debug: print 'explicit cast_bool_to_float' - return direct_op('cast_bool_to_float', [v], resulttype=Float) + return llops.genop('cast_bool_to_float', [v], resulttype=Float) class __extend__(SomeBool): - def rtype_is_true(s_bool): - v_bool = receive(Bool, 0) - return v_bool + def rtype_is_true(_, hop): + vlist = hop.inputargs(Bool) + return vlist[0] Modified: pypy/dist/pypy/rpython/rbuiltin.py ============================================================================== --- pypy/dist/pypy/rpython/rbuiltin.py (original) +++ pypy/dist/pypy/rpython/rbuiltin.py Sun May 29 00:04:00 2005 @@ -1,8 +1,7 @@ from pypy.annotation.pairtype import pair, pairtype from pypy.annotation.model import SomeBuiltin, SomeObject from pypy.rpython.lltype import malloc, typeOf, Void, Signed -from pypy.rpython.rtyper import TyperError, peek_at_result_annotation -from pypy.rpython.rtyper import receiveconst, receive, direct_op, convertvar +from pypy.rpython.rtyper import TyperError class __extend__(SomeBuiltin): @@ -16,42 +15,41 @@ assert s_blt.methodname is not None return s_blt.s_self.lowleveltype() - def rtype_simple_call(s_blt, *args_s): + def rtype_simple_call(s_blt, hop): if s_blt.s_self is None: if not s_blt.is_constant(): raise TyperError("non-constant built-in") bltintyper = BUILTIN_TYPER[s_blt.const] + hop.s_popfirstarg() else: # methods: look up the rtype_method_xxx() name = 'rtype_method_' + s_blt.methodname bltintyper = getattr(s_blt.s_self, name) - return bltintyper(*args_s) + return bltintyper(hop) class __extend__(pairtype(SomeBuiltin, SomeObject)): - def rtype_convert_from_to((s_blt, s_to), v): + def rtype_convert_from_to((s_blt, s_to), v, llops): if s_blt.s_self is None: raise TyperError("conversion requested on a built-in function") - return convertvar(v, s_blt.s_self, s_to) + return llops.convertvar(v, s_blt.s_self, s_to) # ____________________________________________________________ -def rtype_malloc(s_pbc_type, s_varlength=None): - assert s_pbc_type.is_constant() - v_type = receiveconst(Void, s_pbc_type.const) - s_result = peek_at_result_annotation() - if s_varlength is None: - return direct_op('malloc', [v_type], - resulttype = s_result.lowleveltype()) +def rtype_malloc(hop): + assert hop.args_s[0].is_constant() + if hop.nb_args == 1: + vlist = hop.inputargs(Void) + return hop.genop('malloc', vlist, + resulttype = hop.s_result.lowleveltype()) else: - v_varlength = receive(Signed, arg=2) # NOTE, arg=0 is the s_blt above - return direct_op('malloc_varsize', [v_type, v_varlength], - resulttype = s_result.lowleveltype()) - -def rtype_typeOf(s_value): - s_result = peek_at_result_annotation() - return receiveconst(Void, s_result.const) + vlist = hop.inputargs(Void, Signed) + return hop.genop('malloc_varsize', vlist, + resulttype = hop.s_result.lowleveltype()) + +def rtype_typeOf(hop): + return hop.inputconst(Void, hop.s_result.const) BUILTIN_TYPER = { Modified: pypy/dist/pypy/rpython/rfloat.py ============================================================================== --- pypy/dist/pypy/rpython/rfloat.py (original) +++ pypy/dist/pypy/rpython/rfloat.py Sun May 29 00:04:00 2005 @@ -1,7 +1,6 @@ from pypy.annotation.pairtype import pairtype from pypy.annotation.model import SomeFloat, SomeInteger, SomeBool, SomePBC from pypy.rpython.lltype import Signed, Unsigned, Bool, Float -from pypy.rpython.rtyper import receive, direct_op from pypy.rpython.rtyper import TyperError @@ -11,125 +10,122 @@ #Arithmetic - def rtype_add(args): - return _rtype_template(args, 'add') + def rtype_add(_, hop): + return _rtype_template(hop, 'add') rtype_inplace_add = rtype_add - def rtype_sub(args): - return _rtype_template(args, 'sub') + def rtype_sub(_, hop): + return _rtype_template(hop, 'sub') rtype_inplace_sub = rtype_sub - def rtype_mul(args): - return _rtype_template(args, 'mul') + def rtype_mul(_, hop): + return _rtype_template(hop, 'mul') rtype_inplace_mul = rtype_mul - def rtype_div(args): - return _rtype_template(args, 'div') + def rtype_div(_, hop): + return _rtype_template(hop, 'div') rtype_inplace_div = rtype_div - def rtype_pow((s_float1, s_float2), s_float3=SomePBC({None: True})): - if isinstance(s_float3, SomeInteger): - v_float3_list = [receive(Float, 2)] - elif s_float3.is_constant() and s_float3.const is None: - v_float3_list = [] + def rtype_pow(_, hop): + s_float3 = hop.args_s[2] + if s_float3.is_constant() and s_float3.const is None: + vlist = hop.inputargs(Float, Float, Void)[:2] else: - raise TyperError("pow() 3rd argument must be int or None") - v_float1 = receive(Float, 0) - v_float2 = receive(Float, 1) - return direct_op('float_pow', [v_float1, v_float2] + v_float3_list, resulttype=Float) + vlist = hop.inputargs(Float, Float, Float) + return hop.genop('float_pow', vlist, resulttype=Float) - rtype_inplace_pow = rtype_pow + def rtype_inplace_pow(_, hop): + return _rtype_template(hop, 'pow') #comparisons: eq is_ ne lt le gt ge - def rtype_eq(args): - return _rtype_compare_template(args, 'eq') + def rtype_eq(_, hop): + return _rtype_compare_template(hop, 'eq') rtype_is_ = rtype_eq - def rtype_ne(args): - return _rtype_compare_template(args, 'ne') + def rtype_ne(_, hop): + return _rtype_compare_template(hop, 'ne') - def rtype_lt(args): - return _rtype_compare_template(args, 'lt') + def rtype_lt(_, hop): + return _rtype_compare_template(hop, 'lt') - def rtype_le(args): - return _rtype_compare_template(args, 'le') + def rtype_le(_, hop): + return _rtype_compare_template(hop, 'le') - def rtype_gt(args): - return _rtype_compare_template(args, 'gt') + def rtype_gt(_, hop): + return _rtype_compare_template(hop, 'gt') - def rtype_ge(args): - return _rtype_compare_template(args, 'ge') + def rtype_ge(_, hop): + return _rtype_compare_template(hop, 'ge') #Helpers SomeFloat,Somefloat -def _rtype_template((s_float1, s_float2), func): - v_float1 = receive(Float, 0) - v_float2 = receive(Float, 1) - return direct_op('float_'+func, [v_float1, v_float2], resulttype=Float) - -def _rtype_compare_template((s_float1, s_float2), func): - v_float1 = receive(Float, 0) - v_float2 = receive(Float, 1) - return direct_op('float_'+func, [v_float1, v_float2], resulttype=Bool) +def _rtype_template(hop, func): + vlist = hop.inputargs(Float, Float) + return hop.genop('float_'+func, vlist, resulttype=Float) + +def _rtype_compare_template(hop, func): + vlist = hop.inputargs(Float, Float) + return hop.genop('float_'+func, vlist, resulttype=Bool) # -class __extend__(pairtype(SomeFloat, SomeInteger)): +## XXX we have probably no implicit casts from float to integer +##class __extend__(pairtype(SomeFloat, SomeInteger)): - def rtype_convert_from_to((s_from, s_to), v): - if s_to.unsigned: - if debug: print 'explicit cast_float_to_uint' - return direct_op('cast_float_to_uint', [v], resulttype=Unsigned) - else: - if debug: print 'explicit cast_float_to_int' - return direct_op('cast_float_to_int', [v], resulttype=Signed) +## def rtype_convert_from_to((s_from, s_to), v): +## if s_to.unsigned: +## if debug: print 'explicit cast_float_to_uint' +## return direct_op('cast_float_to_uint', [v], resulttype=Unsigned) +## else: +## if debug: print 'explicit cast_float_to_int' +## return direct_op('cast_float_to_int', [v], resulttype=Signed) # class __extend__(pairtype(SomeInteger, SomeFloat)): - def rtype_convert_from_to((s_from, s_to), v): + def rtype_convert_from_to((s_from, s_to), v, llops): if s_from.unsigned: if debug: print 'explicit cast_uint_to_float' - return direct_op('cast_uint_to_float', [v], resulttype=Float) + return llops.genop('cast_uint_to_float', [v], resulttype=Float) else: if debug: print 'explicit cast_int_to_float' - return direct_op('cast_int_to_float', [v], resulttype=Float) + return llops.genop('cast_int_to_float', [v], resulttype=Float) # -class __extend__(pairtype(SomeFloat, SomeBool)): +## XXX we have probably no implicit casts from float to bool +##class __extend__(pairtype(SomeFloat, SomeBool)): - def rtype_convert_from_to((s_from, s_to), v): - if debug: print 'explicit cast_float_to_bool' - return direct_op('cast_float_to_bool', [v], resulttype=Bool) #XXX or can 'float_is_true' be reused here? +## def rtype_convert_from_to((s_from, s_to), v): +## if debug: print 'explicit cast_float_to_bool' +## return direct_op('cast_float_to_bool', [v], resulttype=Bool) #XXX or can 'float_is_true' be reused here? # class __extend__(SomeFloat): - def rtype_is_true(s_float): - v_float = receive(Float, 0) - return direct_op('float_is_true', [v_float], resulttype=Bool) - - def rtype_nonzero(s_float): - v_float = receive(Float, 0) - return direct_op('float_nonzero', [v_float], resulttype=Bool) + def rtype_is_true(_, hop): + vlist = hop.inputargs(Float) + return hop.genop('float_is_true', vlist, resulttype=Bool) + + rtype_nonzero = rtype_is_true def rtype_neg(s_int): - v_int = receive(Float, 0) - return direct_op('float_neg', [v_int], resulttype=Float) + vlist = receive(Float) + return hop.genop('float_neg', vlist, resulttype=Float) def rtype_pos(s_int): - return receive(Float, 0) + v_list = receive(Float) + return vlist[0] Modified: pypy/dist/pypy/rpython/rint.py ============================================================================== --- pypy/dist/pypy/rpython/rint.py (original) +++ pypy/dist/pypy/rpython/rint.py Sun May 29 00:04:00 2005 @@ -1,7 +1,6 @@ from pypy.annotation.pairtype import pairtype from pypy.annotation.model import SomeFloat, SomeInteger, SomeBool, SomePBC from pypy.rpython.lltype import Signed, Unsigned, Bool, Float -from pypy.rpython.rtyper import receive, direct_op from pypy.rpython.rtyper import TyperError @@ -9,299 +8,189 @@ class __extend__(pairtype(SomeInteger, SomeInteger)): - def rtype_convert_from_to((s_from, s_to), v): - if s_from.unsigned != s_to.unsigned: #XXX Can _receive_may_cast(...) be used here? + def rtype_convert_from_to((s_from, s_to), v, llops): + if s_from.unsigned != s_to.unsigned: if s_to.unsigned: if debug: print 'explicit cast_int_to_uint' - return direct_op('cast_int_to_uint', [v], resulttype=Unsigned) + return llops.genop('cast_int_to_uint', [v], resulttype=Unsigned) else: if debug: print 'explicit cast_uint_to_int' - return direct_op('cast_uint_to_int', [v], resulttype=Signed) + return llops.genop('cast_uint_to_int', [v], resulttype=Signed) return v #arithmetic - - def rtype_add((s_int1, s_int2)): - if s_int1.unsigned or s_int2.unsigned: - v_int1 = _receive_may_cast(s_int1, Unsigned, 0) - v_int2 = _receive_may_cast(s_int2, Unsigned, 1) - return direct_op('uint_add', [v_int1, v_int2], resulttype=Unsigned) - else: - v_int1 = _receive_may_cast(s_int1, Signed, 0) - v_int2 = _receive_may_cast(s_int2, Signed, 1) - return direct_op('int_add', [v_int1, v_int2], resulttype=Signed) + def rtype_add(_, hop): + return _rtype_template(hop, 'add') rtype_inplace_add = rtype_add - def rtype_add_ovf((s_int1, s_int2)): - if s_int1.unsigned or s_int2.unsigned: - v_int1 = _receive_may_cast(s_int1, Unsigned, 0) - v_int2 = _receive_may_cast(s_int2, Unsigned, 1) - return direct_op('uint_add_ovf', [v_int1, v_int2], resulttype=Unsigned) - else: - v_int1 = _receive_may_cast(s_int1, Signed, 0) - v_int2 = _receive_may_cast(s_int2, Signed, 1) - return direct_op('int_add_ovf', [v_int1, v_int2], resulttype=Signed) - + def rtype_add_ovf(_, hop): + return _rtype_template(hop, 'add_ovf') rtype_inplace_add_ovf = rtype_add_ovf - def rtype_sub((s_int1, s_int2)): - if s_int1.unsigned or s_int2.unsigned: - v_int1 = _receive_may_cast(s_int1, Unsigned, 0) - v_int2 = _receive_may_cast(s_int2, Unsigned, 1) - return direct_op('uint_sub', [v_int1, v_int2], resulttype=Unsigned) - else: - v_int1 = _receive_may_cast(s_int1, Signed, 0) - v_int2 = _receive_may_cast(s_int2, Signed, 1) - return direct_op('int_sub', [v_int1, v_int2], resulttype=Signed) - + def rtype_sub(_, hop): + return _rtype_template(hop, 'sub') rtype_inplace_sub = rtype_sub - def rtype_sub_ovf((s_int1, s_int2)): - if s_int1.unsigned or s_int2.unsigned: - v_int1 = _receive_may_cast(s_int1, Unsigned, 0) - v_int2 = _receive_may_cast(s_int2, Unsigned, 1) - return direct_op('uint_sub_ovf', [v_int1, v_int2], resulttype=Unsigned) - else: - v_int1 = _receive_may_cast(s_int1, Signed, 0) - v_int2 = _receive_may_cast(s_int2, Signed, 1) - return direct_op('int_sub_ovf', [v_int1, v_int2], resulttype=Signed) - + def rtype_sub_ovf(_, hop): + return _rtype_template(hop, 'sub_ovf') rtype_inplace_sub_ovf = rtype_sub_ovf - def rtype_mul((s_int1, s_int2)): - if s_int1.unsigned or s_int2.unsigned: - v_int1 = _receive_may_cast(s_int1, Unsigned, 0) - v_int2 = _receive_may_cast(s_int2, Unsigned, 1) - return direct_op('uint_mul', [v_int1, v_int2], resulttype=Unsigned) - else: - v_int1 = _receive_may_cast(s_int1, Signed, 0) - v_int2 = _receive_may_cast(s_int2, Signed, 1) - return direct_op('int_mul', [v_int1, v_int2], resulttype=Signed) - + def rtype_mul(_, hop): + return _rtype_template(hop, 'mul') rtype_inplace_mul = rtype_mul - def rtype_div((s_int1, s_int2)): - if s_int1.unsigned or s_int2.unsigned: - v_int1 = _receive_may_cast(s_int1, Unsigned, 0) - v_int2 = _receive_may_cast(s_int2, Unsigned, 1) - return direct_op('uint_div', [v_int1, v_int2], resulttype=Unsigned) - else: - v_int1 = _receive_may_cast(s_int1, Signed, 0) - v_int2 = _receive_may_cast(s_int2, Signed, 1) - return direct_op('int_div', [v_int1, v_int2], resulttype=Signed) - + def rtype_div(_, hop): + return _rtype_template(hop, 'div') rtype_inplace_div = rtype_div - def rtype_mod((s_int1, s_int2)): - if s_int1.unsigned or s_int2.unsigned: - v_int1 = _receive_may_cast(s_int1, Unsigned, 0) - v_int2 = _receive_may_cast(s_int2, Unsigned, 1) - return direct_op('uint_mod', [v_int1, v_int2], resulttype=Unsigned) - else: - v_int1 = _receive_may_cast(s_int1, Signed, 0) - v_int2 = _receive_may_cast(s_int2, Signed, 1) - return direct_op('int_mod', [v_int1, v_int2], resulttype=Signed) - + def rtype_mod(_, hop): + return _rtype_template(hop, 'mod') rtype_inplace_mod = rtype_mod - def rtype_xor((s_int1, s_int2)): - if s_int1.unsigned or s_int2.unsigned: - v_int1 = _receive_may_cast(s_int1, Unsigned, 0) - v_int2 = _receive_may_cast(s_int2, Unsigned, 1) - return direct_op('uint_xor', [v_int1, v_int2], resulttype=Unsigned) - else: - v_int1 = _receive_may_cast(s_int1, Signed, 0) - v_int2 = _receive_may_cast(s_int2, Signed, 1) - return direct_op('int_xor', [v_int1, v_int2], resulttype=Signed) - + def rtype_xor(_, hop): + return _rtype_template(hop, 'xor') rtype_inplace_xor = rtype_xor - def rtype_and_((s_int1, s_int2)): - if s_int1.unsigned or s_int2.unsigned: - v_int1 = _receive_may_cast(s_int1, Unsigned, 0) - v_int2 = _receive_may_cast(s_int2, Unsigned, 1) - return direct_op('uint_and', [v_int1, v_int2], resulttype=Unsigned) - else: - v_int1 = _receive_may_cast(s_int1, Signed, 0) - v_int2 = _receive_may_cast(s_int2, Signed, 1) - return direct_op('int_and', [v_int1, v_int2], resulttype=Signed) - + def rtype_and_(_, hop): + return _rtype_template(hop, 'and') rtype_inplace_and = rtype_and_ - def rtype_or_((s_int1, s_int2)): - if s_int1.unsigned or s_int2.unsigned: - v_int1 = _receive_may_cast(s_int1, Unsigned, 0) - v_int2 = _receive_may_cast(s_int2, Unsigned, 1) - return direct_op('uint_or', [v_int1, v_int2], resulttype=Unsigned) - else: - v_int1 = _receive_may_cast(s_int1, Signed, 0) - v_int2 = _receive_may_cast(s_int2, Signed, 1) - return direct_op('int_or', [v_int1, v_int2], resulttype=Signed) - + def rtype_or_(_, hop): + return _rtype_template(hop, 'or') rtype_inplace_or = rtype_or_ - def rtype_lshift((s_int1, s_int2)): - if s_int1.unsigned: - v_int1 = _receive_may_cast(s_int1, Unsigned, 0) - v_int2 = _receive_may_cast(s_int2, Unsigned, 1) - return direct_op('uint_lshift', [v_int1, v_int2], resulttype=Unsigned) - else: - v_int1 = _receive_may_cast(s_int1, Signed, 0) - v_int2 = _receive_may_cast(s_int2, Signed, 1) - return direct_op('int_lshift', [v_int1, v_int2], resulttype=Signed) - + def rtype_lshift(_, hop): + return _rtype_template(hop, 'lshift') rtype_inplace_lshift = rtype_lshift - def rtype_rshift((s_int1, s_int2)): - if s_int1.unsigned: - v_int1 = _receive_may_cast(s_int1, Unsigned, 0) - v_int2 = _receive_may_cast(s_int2, Unsigned, 1) - return direct_op('uint_rshift', [v_int1, v_int2], resulttype=Unsigned) - else: - v_int1 = _receive_may_cast(s_int1, Signed, 0) - v_int2 = _receive_may_cast(s_int2, Signed, 1) - return direct_op('int_rshift', [v_int1, v_int2], resulttype=Signed) - - rtype_inplace_rshift = rtype_rshift - - def rtype_lshift_ovf((s_int1, s_int2)): - if s_int1.unsigned: - v_int1 = _receive_may_cast(s_int1, Unsigned, 0) - v_int2 = _receive_may_cast(s_int2, Unsigned, 1) - return direct_op('uint_lshift_ovf', [v_int1, v_int2], resulttype=Unsigned) - else: - v_int1 = _receive_may_cast(s_int1, Signed, 0) - v_int2 = _receive_may_cast(s_int2, Signed, 1) - return direct_op('int_lshift_ovf', [v_int1, v_int2], resulttype=Signed) - + def rtype_lshift_ovf(_, hop): + return _rtype_template(hop, 'lshift_ovf') rtype_inplace_lshift_ovf = rtype_lshift_ovf - def rtype_rshift_ovf((s_int1, s_int2)): - if s_int1.unsigned: - v_int1 = _receive_may_cast(s_int1, Unsigned, 0) - v_int2 = _receive_may_cast(s_int2, Unsigned, 1) - return direct_op('uint_rshift_ovf', [v_int1, v_int2], resulttype=Unsigned) - else: - v_int1 = _receive_may_cast(s_int1, Signed, 0) - v_int2 = _receive_may_cast(s_int2, Signed, 1) - return direct_op('int_rshift_ovf', [v_int1, v_int2], resulttype=Signed) + def rtype_rshift(_, hop): + return _rtype_template(hop, 'rshift') + rtype_inplace_rshift = rtype_rshift + def rtype_rshift_ovf(_, hop): + return _rtype_template(hop, 'rshift_ovf') rtype_inplace_rshift_ovf = rtype_rshift_ovf - def rtype_pow((s_int1, s_int2), s_int3=SomePBC({None: True})): - if isinstance(s_int3, SomeInteger): - if s_int3.unsigned: - v_int3_list = [_receive_may_cast(s_int1, Unsigned, 2)] + def rtype_pow(_, hop): + s_int3 = hop.args_s[2] + if hop.s_result.unsigned: + if s_int3.is_constant() and s_int3.const is None: + vlist = hop.inputargs(Unsigned, Unsigned, Void)[:2] else: - v_int3_list = [_receive_may_cast(s_int1, Signed, 2)] - elif s_int3.is_constant() and s_int3.const is None: - v_int3_list = [] - else: - raise TyperError("pow() 3rd argument must be int or None") - if s_int1.unsigned or s_int2.unsigned: - v_int1 = _receive_may_cast(s_int1, Unsigned, 0) - v_int2 = _receive_may_cast(s_int2, Unsigned, 1) - return direct_op('uint_pow', [v_int1, v_int2] + v_int3_list, resulttype=Unsigned) + vlist = hop.inputargs(Unsigned, Unsigned, Unsigned) + return hop.genop('uint_pow', vlist, resulttype=Unsigned) else: - v_int1 = _receive_may_cast(s_int1, Signed, 0) - v_int2 = _receive_may_cast(s_int2, Signed, 1) - return direct_op('int_pow', [v_int1, v_int2] + v_int3_list, resulttype=Signed) + if s_int3.is_constant() and s_int3.const is None: + vlist = hop.inputargs(Signed, Signed, Void)[:2] + else: + vlist = hop.inputargs(Signed, Signed, Signed) + return hop.genop('int_pow', vlist, resulttype=Signed) - rtype_inplace_pow = rtype_pow + def rtype_inplace_pow(_, hop): + return _rtype_template(hop, 'pow') #comparisons: eq is_ ne lt le gt ge - def rtype_eq(args): - return _rtype_compare_template(args, 'eq') + def rtype_eq(_, hop): + return _rtype_compare_template(hop, 'eq') rtype_is_ = rtype_eq - def rtype_ne(args): - return _rtype_compare_template(args, 'ne') + def rtype_ne(_, hop): + return _rtype_compare_template(hop, 'ne') - def rtype_lt(args): - return _rtype_compare_template(args, 'lt') + def rtype_lt(_, hop): + return _rtype_compare_template(hop, 'lt') - def rtype_le(args): - return _rtype_compare_template(args, 'le') + def rtype_le(_, hop): + return _rtype_compare_template(hop, 'le') - def rtype_gt(args): - return _rtype_compare_template(args, 'gt') + def rtype_gt(_, hop): + return _rtype_compare_template(hop, 'gt') - def rtype_ge(args): - return _rtype_compare_template(args, 'ge') + def rtype_ge(_, hop): + return _rtype_compare_template(hop, 'ge') #Helper functions -def _receive_may_cast(s_var, s_requested, arg): - v = receive(s_requested, arg) - s = (Signed,Unsigned)[s_var.unsigned] - if s != s_requested: - if s_requested is Unsigned: - if debug: print 'cast_int_to_uint' - return direct_op('cast_int_to_uint', [v], resulttype=Unsigned) - else: - if debug: print 'cast_uint_to_int' - return direct_op('cast_uint_to_int', [v], resulttype=Signed) - #elif debug: - # if s_requested is Unsigned: - # if debug: print 'fake cast_uint_to_uint' - # return direct_op('cast_uint_to_uint', [v], resulttype=Unsigned) - # else: - # if debug: print 'fake cast_int_to_int' - # return direct_op('cast_int_to_int', [v], resulttype=Signed) - return v - +def _rtype_template(hop, func): + if hop.s_result.unsigned: + vlist = hop.inputargs(Unsigned, Unsigned) + return hop.genop('uint_'+func, vlist, resulttype=Unsigned) + else: + vlist = hop.inputargs(Signed, Signed) + return hop.genop('int_'+func, vlist, resulttype=Signed) + #Helper functions for comparisons -def _rtype_compare_template((s_int1, s_int2), func): +def _rtype_compare_template(hop, func): + s_int1, s_int2 = hop.args_s if s_int1.unsigned or s_int2.unsigned: if not s_int1.nonneg or not s_int2.nonneg: raise TyperError("comparing a signed and an unsigned number") - v_int1 = _receive_may_cast(s_int1, Unsigned, 0) - v_int2 = _receive_may_cast(s_int2, Unsigned, 1) - return direct_op('uint_'+func, [v_int1, v_int2], resulttype=Bool) + vlist = hop.inputargs(Unsigned, Unsigned) + return hop.genop('uint_'+func, vlist, resulttype=Bool) else: - v_int1 = _receive_may_cast(s_int1, Signed, 0) - v_int2 = _receive_may_cast(s_int2, Signed, 1) - return direct_op('int_'+func, [v_int1, v_int2], resulttype=Bool) + vlist = hop.inputargs(Signed, Signed) + return hop.genop('int_'+func, vlist, resulttype=Bool) # class __extend__(SomeInteger): - def rtype_is_true(s_int): - v_int = _receive_may_cast(s_int, Signed, 0) - return direct_op('int_is_true', [v_int], resulttype=Bool) - - #Unary arithmetic operations - - def rtype_abs(s_int): + def rtype_is_true(s_int, hop): if s_int.unsigned: - return _receive_may_cast(s_int, Unsigned, 0) + vlist = hop.inputargs(Unsigned) + return hop.genop('uint_is_true', vlist, resulttype=Bool) else: - v_int = _receive_may_cast(s_int, Signed, 0) - return direct_op('int_abs', [v_int], resulttype=Signed) #XXX I would like to make this Unsigned, but the annotator insists it is Signed! + vlist = hop.inputargs(Signed) + return hop.genop('int_is_true', vlist, resulttype=Bool) - def rtype_abs_ovf(s_int): - if s_int.unsigned: - return _receive_may_cast(s_int, Unsigned, 0) - else: - v_int = _receive_may_cast(s_int, Signed, 0) - direct_op('int_abs_ovf', [v_int], resulttype=Signed) #XXX I would like to make this Unsigned, but the annotator insists it is Signed! + rtype_nonzero = rtype_is_true - def rtype_invert(s_int): - v_int = _receive_may_cast(s_int, Signed, 0) - return direct_op('int_invert', [v_int], resulttype=Signed) - - def rtype_neg(s_int): - v_int = _receive_may_cast(s_int, Signed, 0) - return direct_op('int_neg', [v_int], resulttype=Signed) + #Unary arithmetic operations + + def rtype_abs(_, hop): + if hop.s_result.unsigned: + vlist = hop.inputargs(Unsigned) + return vlist[0] + else: + vlist = hop.inputargs(Signed) + return hop.genop('int_abs', vlist, resulttype=Signed) + + def rtype_abs_ovf(_, hop): + if hop.s_result.unsigned: + vlist = hop.inputargs(Unsigned) + return vlist[0] + else: + vlist = hop.inputargs(Signed) + return hop.genop('int_abs_ovf', vlist, resulttype=Signed) + + def rtype_invert(_, hop): + if hop.s_result.unsigned: + vlist = hop.inputargs(Unsigned) + return hop.genop('uint_invert', vlist, resulttype=Unsigned) + else: + vlist = hop.inputargs(Signed) + return hop.genop('int_invert', vlist, resulttype=Signed) + + def rtype_neg(_, hop): + if hop.s_result.unsigned: + vlist = hop.inputargs(Unsigned) + return hop.genop('uint_neg', vlist, resulttype=Unsigned) + else: + vlist = hop.inputargs(Signed) + return hop.genop('int_neg', vlist, resulttype=Signed) - def rtype_pos(s_int): + def rtype_pos(_, hop): if s_int.unsigned: - return _receive_may_cast(s_int, Unsigned, 0) + vlist = hop.inputargs(Unsigned) else: - return _receive_may_cast(s_int, Signed, 0) + vlist = hop.inputargs(Signed) + return vlist[0] Modified: pypy/dist/pypy/rpython/rlist.py ============================================================================== --- pypy/dist/pypy/rpython/rlist.py (original) +++ pypy/dist/pypy/rpython/rlist.py Sun May 29 00:04:00 2005 @@ -1,8 +1,6 @@ from pypy.annotation.pairtype import pair, pairtype from pypy.annotation.model import SomeList, SomeInteger from pypy.rpython.lltype import * -from pypy.rpython.rtyper import receive, receiveconst -from pypy.rpython.rtyper import peek_at_result_annotation, direct_call # ____________________________________________________________ # @@ -26,25 +24,24 @@ def get_s_items(s_list): return s_list.listdef.listitem.s_value - def rtype_len(s_lst): - v_lst = receive(s_lst, arg=0) - return direct_call(ll_len, v_lst) - - def rtype_method_append(s_lst, s_value): - v_lst = receive(s_lst, arg=0) - v_value = receive(s_lst.get_s_items(), arg=1) - direct_call(ll_append, v_lst, v_value) + def rtype_len(s_lst, hop): + v_lst = hop.inputargs(s_lst) + return hop.gendirectcall(ll_len, v_lst) + + def rtype_method_append(s_lst, hop): + v_lst, v_value = hop.inputargs(s_lst, s_lst.get_s_items()) + hop.gendirectcall(ll_append, v_lst, v_value) class __extend__(pairtype(SomeList, SomeInteger)): - def rtype_getitem((s_lst1, s_int2)): - v_lst = receive(s_lst1, arg=0) - v_index = receive(Signed, arg=1) + def rtype_getitem((s_lst1, s_int2), hop): + v_lst, v_index = hop.inputargs(s_lst1, Signed) if s_int2.nonneg: - return direct_call(ll_getitem_nonneg, v_lst, v_index) + llfn = ll_getitem_nonneg else: - return direct_call(ll_getitem, v_lst, v_index) + llfn = ll_getitem + return hop.gendirectcall(llfn, v_lst, v_index) # ____________________________________________________________ @@ -86,15 +83,15 @@ l.items = malloc(LISTPTR.TO.items.TO, length) return l -def rtype_newlist(*items_s): - nb_args = len(items_s) - s_list = peek_at_result_annotation() +def rtype_newlist(hop): + nb_args = hop.nb_args + s_list = hop.s_result s_listitem = s_list.get_s_items() - items_v = [receive(s_listitem, arg=i) for i in range(nb_args)] - c1 = receiveconst(Void, s_list.lowleveltype()) - v_result = direct_call(ll_newlist, c1, receiveconst(Signed, nb_args)) + c1 = hop.inputconst(Void, s_list.lowleveltype()) + c2 = hop.inputconst(Signed, nb_args) + v_result = hop.gendirectcall(ll_newlist, c1, c2) for i in range(nb_args): - direct_call(ll_setitem_nonneg, v_result, - receiveconst(Signed, i), - items_v[i]) + ci = hop.inputconst(Signed, i) + v_item = hop.inputarg(s_listitem, arg=i) + hop.gendirectcall(ll_setitem_nonneg, v_result, ci, v_item) return v_result Modified: pypy/dist/pypy/rpython/robject.py ============================================================================== --- pypy/dist/pypy/rpython/robject.py (original) +++ pypy/dist/pypy/rpython/robject.py Sun May 29 00:04:00 2005 @@ -2,7 +2,6 @@ from pypy.annotation.model import SomeObject, annotation_to_lltype from pypy.rpython.lltype import PyObject, GcPtr, Void from pypy.rpython.rtyper import TyperError -from pypy.rpython.rtyper import receiveconst, receive PyObjPtr = GcPtr(PyObject) @@ -19,7 +18,8 @@ else: return PyObjPtr - def rtype_getattr(s_obj, s_attr): + def rtype_getattr(s_obj, hop): + s_attr = hop.args_s[1] if s_attr.is_constant() and isinstance(s_attr.const, str): attr = s_attr.const try: @@ -28,14 +28,14 @@ raise TyperError("no method %s on %r" % (attr, s_obj)) else: # implement methods (of a known name) as just their 'self' - return receive(s_obj, arg=0) + return hop.inputarg(s_obj, arg=0) else: raise TyperError("getattr() with a non-constant attribute name") class __extend__(pairtype(SomeObject, SomeObject)): - def rtype_convert_from_to((s_from, s_to), v): + def rtype_convert_from_to((s_from, s_to), v, llops): FROM = s_from.lowleveltype() TO = s_to.lowleveltype() if PyObjPtr == FROM == TO: Modified: pypy/dist/pypy/rpython/rpbc.py ============================================================================== --- pypy/dist/pypy/rpython/rpbc.py (original) +++ pypy/dist/pypy/rpython/rpbc.py Sun May 29 00:04:00 2005 @@ -2,31 +2,28 @@ from pypy.annotation.pairtype import pair, pairtype from pypy.annotation.model import SomePBC from pypy.rpython.lltype import typeOf -from pypy.rpython.rtyper import TLS, receive, receiveconst, direct_op -from pypy.rpython.rtyper import peek_at_result_annotation class __extend__(SomePBC): - def rtype_getattr(s_pbc, s_attr): - attr = s_attr.const - s_result = peek_at_result_annotation() - if s_result.is_constant(): - return receiveconst(s_result, s_result.const) + def rtype_getattr(_, hop): + attr = hop.args_s[1].const + if hop.s_result.is_constant(): + return hop.inputconst(hop.s_result, hop.s_result.const) else: NotImplementedYet - def rtype_simple_call(s_pbc, *args_s): - if not s_pbc.is_constant(): + def rtype_simple_call(_, hop): + s_func = hop.s_popfirstarg() + if not s_func.is_constant(): NotImplementedYet - func = s_pbc.const + func = s_func.const if not isinstance(func, types.FunctionType): NotImplementedYet # XXX hackish - f = TLS.rtyper.getfunctionptr(func) + f = hop.rtyper.getfunctionptr(func) FUNCPTR = typeOf(f) - args_v = [receive(FUNCPTR.TO.ARGS[i], arg=i+1) - for i in range(len(args_s))] - c = receiveconst(FUNCPTR, f) - return direct_op('direct_call', [c] + args_v, + args_v = hop.inputargs(*FUNCPTR.TO.ARGS) + c = hop.inputconst(FUNCPTR, f) + return hop.genop('direct_call', [c] + args_v, resulttype = FUNCPTR.TO.RESULT) Modified: pypy/dist/pypy/rpython/rptr.py ============================================================================== --- pypy/dist/pypy/rpython/rptr.py (original) +++ pypy/dist/pypy/rpython/rptr.py Sun May 29 00:04:00 2005 @@ -1,8 +1,6 @@ from pypy.annotation.pairtype import pair, pairtype from pypy.annotation.model import SomePtr, SomeInteger from pypy.rpython.lltype import ContainerType, Void, Signed -from pypy.rpython.rtyper import receive, receiveconst -from pypy.rpython.rtyper import peek_at_result_annotation, direct_op class __extend__(SomePtr): @@ -10,40 +8,33 @@ def lowleveltype(s_ptr): return s_ptr.ll_ptrtype - def rtype_getattr(s_ptr, s_attr): - attr = s_attr.const + def rtype_getattr(s_ptr, hop): + attr = hop.args_s[1].const FIELD_TYPE = getattr(s_ptr.ll_ptrtype.TO, attr) if isinstance(FIELD_TYPE, ContainerType): newopname = 'getsubstruct' else: newopname = 'getfield' - v_ptr = receive(s_ptr, arg=0) - v_attr = receiveconst(Void, attr) - s_result = peek_at_result_annotation() - return direct_op(newopname, [v_ptr, v_attr], - resulttype = s_result.lowleveltype()) + vlist = hop.inputargs(s_ptr, Void) + return hop.genop(newopname, vlist, + resulttype = hop.s_result.lowleveltype()) - def rtype_setattr(s_ptr, s_attr, s_value): - attr = s_attr.const + def rtype_setattr(s_ptr, hop): + attr = hop.args_s[1].const FIELD_TYPE = getattr(s_ptr.ll_ptrtype.TO, attr) assert not isinstance(FIELD_TYPE, ContainerType) - v_ptr = receive(s_ptr, arg=0) - v_attr = receiveconst(Void, attr) - v_value = receive(FIELD_TYPE, arg=2) - direct_op('setfield', [v_ptr, v_attr, v_value]) - - def rtype_len(s_ptr): - v_ptr = receive(s_ptr, arg=0) - s_result = peek_at_result_annotation() - return direct_op('getarraysize', [v_ptr], - resulttype = s_result.lowleveltype()) + vlist = hop.inputargs(s_ptr, Void, FIELD_TYPE) + hop.genop('setfield', vlist) + + def rtype_len(s_ptr, hop): + vlist = hop.inputargs(s_ptr) + return hop.genop('getarraysize', vlist, + resulttype = hop.s_result.lowleveltype()) class __extend__(pairtype(SomePtr, SomeInteger)): - def rtype_getitem((s_ptr, s_int)): - v_ptr = receive(s_ptr, arg=0) - v_index = receive(Signed, arg=1) - s_result = peek_at_result_annotation() - return direct_op('getarrayitem', [v_ptr, v_index], - resulttype = s_result.lowleveltype()) + def rtype_getitem((s_ptr, s_int), hop): + vlist = hop.inputargs(s_ptr, Signed) + return hop.genop('getarrayitem', vlist, + resulttype = hop.s_result.lowleveltype()) Modified: pypy/dist/pypy/rpython/rtyper.py ============================================================================== --- pypy/dist/pypy/rpython/rtyper.py (original) +++ pypy/dist/pypy/rpython/rtyper.py Sun May 29 00:04:00 2005 @@ -4,12 +4,9 @@ from pypy.objspace.flow.model import SpaceOperation from pypy.rpython.lltype import Void, LowLevelType, NonGcPtr, ContainerType from pypy.rpython.lltype import FuncType, functionptr, typeOf -from pypy.tool.tls import tlsobject from pypy.tool.sourcetools import func_with_new_name, valid_identifier from pypy.translator.unsimplify import insert_empty_block -TLS = tlsobject() - # XXX copied from pypy.translator.typer and modified. # We'll remove pypy.translator.typer at some point. @@ -48,16 +45,6 @@ if s_value is not None: v.concretetype = s_value.lowleveltype() - def enter_operation(self, op, newops): - TLS.rtyper = self - TLS.currentoperation = op - TLS.newops = newops - - def leave_operation(self): - del TLS.rtyper - del TLS.currentoperation - del TLS.newops - def specialize_block(self, block): # give the best possible types to the input args for a in block.inputargs: @@ -66,19 +53,12 @@ # specialize all the operations, as far as possible if block.operations == (): # return or except block return - newops = [] + newops = LowLevelOpList(self) varmapping = {} for op in block.operations: try: - args = list(op.args) - bindings = [self.annotator.binding(a, True) for a in args] - - self.enter_operation(op, newops) - try: - self.consider_op(op, varmapping) - finally: - self.leave_operation() - + hop = HighLevelOp(self, op, newops) + self.translate_hl_to_ll(hop, varmapping) except TyperError, e: e.where = (block, op) raise @@ -110,12 +90,8 @@ s_a2 = self.annotator.binding(a2) if s_a1 == s_a2: continue # no conversion needed - newops = [] - self.enter_operation(None, newops) - try: - a1 = convertvar(a1, s_a1, s_a2) - finally: - self.leave_operation() + newops = LowLevelOpList(self) + a1 = newops.convertvar(a1, s_a1, s_a2) if newops and not can_insert_here: # cannot insert conversion operations around a single # link, unless it is the only exit of this block. @@ -132,23 +108,22 @@ e.where = (block, link) raise - def consider_op(self, op, varmapping): - argcells = [self.annotator.binding(a) for a in op.args] - consider_meth = getattr(self, 'consider_op_'+op.opname) - resultvar = consider_meth(*argcells) - s_expected = self.annotator.binding(op.result) + def translate_hl_to_ll(self, hop, varmapping): + op = hop.spaceop + translate_meth = getattr(self, 'translate_op_'+op.opname) + resultvar = translate_meth(hop) if resultvar is None: # no return value - if s_expected != annmodel.SomeImpossibleValue(): + if hop.s_result != annmodel.SomeImpossibleValue(): raise TyperError("the annotator doesn't agree that '%s' " "has no return value" % op.opname) op.result.concretetype = Void elif isinstance(resultvar, Variable): - # for simplicity of the consider_meth, resultvar is usually not + # for simplicity of the translate_meth, resultvar is usually not # op.result here. We have to replace resultvar with op.result # in all generated operations. resulttype = resultvar.concretetype - op.result.concretetype = s_expected.lowleveltype() + op.result.concretetype = hop.s_result.lowleveltype() if op.result.concretetype != resulttype: raise TyperError("inconsistent type for the result of '%s':\n" "annotator says %r\n" @@ -159,15 +134,14 @@ resultvar = varmapping[resultvar] varmapping[resultvar] = op.result else: - # consider_meth() can actually generate no operation and return - # a Constant. - if not s_expected.is_constant(): + # translate_meth() returned a Constant + if not hop.s_result.is_constant(): raise TyperError("the annotator doesn't agree that '%s' " "returns a constant" % op.opname) - if resultvar.value != s_expected.const: + if resultvar.value != hop.s_result.const: raise TyperError("constant mismatch: %r vs %r" % ( - resultvar.value, s_expected.const)) - op.result.concretetype = s_expected.lowleveltype() + resultvar.value, hop.s_result.const)) + op.result.concretetype = hop.s_result.lowleveltype() # __________ regular operations __________ @@ -175,14 +149,17 @@ # All unary operations for opname in annmodel.UNARY_OPERATIONS: exec """ -def consider_op_%s(self, arg, *args): - return arg.rtype_%s(*args) +def translate_op_%s(self, hop): + s_arg1 = hop.args_s[0] + return s_arg1.rtype_%s(hop) """ % (opname, opname) in globals(), loc # All binary operations for opname in annmodel.BINARY_OPERATIONS: exec """ -def consider_op_%s(self, arg1, arg2, *args): - return pair(arg1,arg2).rtype_%s(*args) +def translate_op_%s(self, hop): + s_arg1 = hop.args_s[0] + s_arg2 = hop.args_s[1] + return pair(s_arg1, s_arg2).rtype_%s(hop) """ % (opname, opname) in globals(), loc _registeroperations(locals()) @@ -190,8 +167,8 @@ # __________ irregular operations __________ - def consider_op_newlist(self, *items_s): - return rlist.rtype_newlist(*items_s) + def translate_op_newlist(self, hop): + return rlist.rtype_newlist(hop) # __________ utilities __________ @@ -208,29 +185,17 @@ FT = FuncType(llinputs, lloutput) return functionptr(FT, func.func_name, graph = graph, _callable = func) -# ____________________________________________________________ -# -# Global helpers, working on the current operation (as stored in TLS) -def _requestedtype(s_requested): - if isinstance(s_requested, LowLevelType): - lowleveltype = s_requested - s_requested = annmodel.lltype_to_annotation(lowleveltype) - elif isinstance(s_requested, annmodel.SomeObject): - lowleveltype = s_requested.lowleveltype() - else: - raise TypeError("SomeObject or LowLevelType expected, got %r" % ( - s_requested,)) - return s_requested, lowleveltype +# ____________________________________________________________ -def receiveconst(s_requested, value): +def inputconst(type, value): """Return a Constant with the given value, of the requested type. - s_requested can be a SomeXxx annotation or a primitive low-level type. + 'type' can be a SomeXxx annotation or a low-level type. """ - if isinstance(s_requested, LowLevelType): - lowleveltype = s_requested + if isinstance(type, LowLevelType): + lowleveltype = type else: - lowleveltype = s_requested.lowleveltype() + lowleveltype = type.lowleveltype() assert not isinstance(lowleveltype, ContainerType), ( "missing a GcPtr or NonGcPtr in the type specification of %r" % (lowleveltype,)) @@ -238,84 +203,126 @@ c.concretetype = lowleveltype return c -def receive(s_requested, arg): - """Returns the arg'th input argument of the current operation, - as a Variable or Constant converted to the requested type. - s_requested can be a SomeXxx annotation or a primitive low-level type. +# ____________________________________________________________ + +class HighLevelOp: + nb_popped = 0 + + def __init__(self, rtyper, spaceop, llops): + self.rtyper = rtyper + self.spaceop = spaceop + self.nb_args = len(spaceop.args) + self.llops = llops + self.args_s = [rtyper.annotator.binding(a) for a in spaceop.args] + self.s_result = rtyper.annotator.binding(spaceop.result) + + def inputarg(self, converted_to, arg): + """Returns the arg'th input argument of the current operation, + as a Variable or Constant converted to the requested type. + 'converted_to' can be a SomeXxx annotation or a primitive low-level + type. + """ + v = self.spaceop.args[self.nb_popped + arg] + if isinstance(v, Constant): + return inputconst(converted_to, v.value) + + s_binding = self.args_s[arg] + if s_binding is None: + s_binding = annmodel.SomeObject() + if s_binding.is_constant(): + return inputconst(converted_to, s_binding.const) + + if isinstance(converted_to, LowLevelType): + converted_to = annmodel.lltype_to_annotation(converted_to) + return self.llops.convertvar(v, s_binding, converted_to) + + def inputargs(self, *converted_to): + assert len(converted_to) == self.nb_args, ( + "operation argument count mismatch: '%s' has %d+%d arguments" % ( + self.spaceop.opname, self.nb_popped, self.nb_args)) + vars = [] + for i in range(len(converted_to)): + vars.append(self.inputarg(converted_to[i], i)) + return vars + + inputconst = staticmethod(inputconst) # export via the HighLevelOp class + + def genop(self, opname, args_v, resulttype=None): + return self.llops.genop(opname, args_v, resulttype) + + def gendirectcall(self, ll_function, *args_v): + return self.llops.gendirectcall(ll_function, *args_v) + + def s_popfirstarg(self): + "Return and discard the first argument." + self.nb_popped += 1 + self.nb_args -= 1 + return self.args_s.pop(0) + +# ____________________________________________________________ + +class LowLevelOpList(list): + """A list with gen*() methods to build and append low-level + operations to it. """ - v = TLS.currentoperation.args[arg] - if isinstance(v, Constant): - return receiveconst(s_requested, v.value) - - s_binding = TLS.rtyper.annotator.binding(v, True) - if s_binding is None: - s_binding = annmodel.SomeObject() - if s_binding.is_constant(): - return receiveconst(s_requested, s_binding.const) - - s_requested, lowleveltype = _requestedtype(s_requested) - return convertvar(v, s_binding, s_requested) - -def convertvar(v, s_from, s_to): - if s_from != s_to: - v = pair(s_from, s_to).rtype_convert_from_to(v) - return v - - -def peek_at_result_annotation(): - return TLS.rtyper.annotator.binding(TLS.currentoperation.result) - - -def direct_call(ll_function, *args_v): - annotator = TLS.rtyper.annotator - spec_key = [ll_function] - spec_name = [ll_function.func_name] - args_s = [] - for v in args_v: - s_value = annotator.binding(v, True) - if s_value is None: - s_value = annmodel.SomeObject() - if v.concretetype == Void: - if not s_value.is_constant(): - raise TyperError("non-constant variable of type Void") - key = s_value.const # specialize by constant value - args_s.append(s_value) - suffix = 'Const' - else: - key = v.concretetype # specialize by low-level type - args_s.append(annmodel.lltype_to_annotation(key)) - suffix = '' - spec_key.append(key) - spec_name.append(valid_identifier(getattr(key, '__name__', key))+suffix) - spec_key = tuple(spec_key) - try: - spec_function = TLS.rtyper.specialized_ll_functions[spec_key] - except KeyError: - name = '_'.join(spec_name) - spec_function = func_with_new_name(ll_function, name) - # flow and annotate (the copy of) the low-level function - spec_graph = annotator.translator.getflowgraph(spec_function) - annotator.build_types(spec_function, args_s) - # cache the result - TLS.rtyper.specialized_ll_functions[spec_key] = spec_function - - # build the 'direct_call' operation - f = TLS.rtyper.getfunctionptr(spec_function) - c = receiveconst(typeOf(f), f) - return direct_op('direct_call', [c]+list(args_v), - resulttype = typeOf(f).TO.RESULT) - - -def direct_op(opname, args, resulttype=None): - v = Variable() - TLS.newops.append(SpaceOperation(opname, args, v)) - if resulttype is None: - v.concretetype = Void - return None - else: - v.concretetype = resulttype + def __init__(self, rtyper): + self.rtyper = rtyper + + def convertvar(self, v, s_from, s_to): + if s_from != s_to: + v = pair(s_from, s_to).rtype_convert_from_to(v, self) return v + def genop(self, opname, args_v, resulttype=None): + vresult = Variable() + self.append(SpaceOperation(opname, args_v, vresult)) + if resulttype is None: + vresult.concretetype = Void + return None + else: + vresult.concretetype = resulttype + return vresult + + def gendirectcall(self, ll_function, *args_v): + annotator = self.rtyper.annotator + spec_key = [ll_function] + spec_name = [ll_function.func_name] + args_s = [] + for v in args_v: + s_value = annotator.binding(v, True) + if s_value is None: + s_value = annmodel.SomeObject() + if v.concretetype == Void: + if not s_value.is_constant(): + raise TyperError("non-constant variable of type Void") + key = s_value.const # specialize by constant value + args_s.append(s_value) + suffix = 'Const' + else: + key = v.concretetype # specialize by low-level type + args_s.append(annmodel.lltype_to_annotation(key)) + suffix = '' + spec_key.append(key) + spec_name.append(valid_identifier(getattr(key, '__name__', key)) + + suffix) + spec_key = tuple(spec_key) + try: + spec_function = self.rtyper.specialized_ll_functions[spec_key] + except KeyError: + name = '_'.join(spec_name) + spec_function = func_with_new_name(ll_function, name) + # flow and annotate (the copy of) the low-level function + spec_graph = annotator.translator.getflowgraph(spec_function) + annotator.build_types(spec_function, args_s) + # cache the result + self.rtyper.specialized_ll_functions[spec_key] = spec_function + + # build the 'direct_call' operation + f = self.rtyper.getfunctionptr(spec_function) + c = inputconst(typeOf(f), f) + return self.genop('direct_call', [c]+list(args_v), + resulttype = typeOf(f).TO.RESULT) + # _______________________________________________________________________ # this has the side-effect of registering the unary and binary operations From ericvrp at codespeak.net Sun May 29 11:11:43 2005 From: ericvrp at codespeak.net (ericvrp at codespeak.net) Date: Sun, 29 May 2005 11:11:43 +0200 (CEST) Subject: [pypy-svn] r12865 - pypy/dist/pypy/rpython Message-ID: <20050529091143.0D10327B7A@code1.codespeak.net> Author: ericvrp Date: Sun May 29 11:11:42 2005 New Revision: 12865 Modified: pypy/dist/pypy/rpython/rfloat.py pypy/dist/pypy/rpython/rint.py Log: fixed some typos. Tests will follow (probably tonight) Modified: pypy/dist/pypy/rpython/rfloat.py ============================================================================== --- pypy/dist/pypy/rpython/rfloat.py (original) +++ pypy/dist/pypy/rpython/rfloat.py Sun May 29 11:11:42 2005 @@ -1,6 +1,6 @@ from pypy.annotation.pairtype import pairtype from pypy.annotation.model import SomeFloat, SomeInteger, SomeBool, SomePBC -from pypy.rpython.lltype import Signed, Unsigned, Bool, Float +from pypy.rpython.lltype import Signed, Unsigned, Bool, Float, Void from pypy.rpython.rtyper import TyperError @@ -122,10 +122,10 @@ rtype_nonzero = rtype_is_true - def rtype_neg(s_int): - vlist = receive(Float) + def rtype_neg(_, hop): + vlist = hop.inputargs(Float) return hop.genop('float_neg', vlist, resulttype=Float) - def rtype_pos(s_int): - v_list = receive(Float) + def rtype_pos(_, hop): + vlist = hop.inputargs(Float) return vlist[0] Modified: pypy/dist/pypy/rpython/rint.py ============================================================================== --- pypy/dist/pypy/rpython/rint.py (original) +++ pypy/dist/pypy/rpython/rint.py Sun May 29 11:11:42 2005 @@ -1,6 +1,6 @@ from pypy.annotation.pairtype import pairtype from pypy.annotation.model import SomeFloat, SomeInteger, SomeBool, SomePBC -from pypy.rpython.lltype import Signed, Unsigned, Bool, Float +from pypy.rpython.lltype import Signed, Unsigned, Bool, Float, Void from pypy.rpython.rtyper import TyperError @@ -189,7 +189,7 @@ return hop.genop('int_neg', vlist, resulttype=Signed) def rtype_pos(_, hop): - if s_int.unsigned: + if hop.s_result.unsigned: vlist = hop.inputargs(Unsigned) else: vlist = hop.inputargs(Signed) From arigo at codespeak.net Sun May 29 16:18:56 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Sun, 29 May 2005 16:18:56 +0200 (CEST) Subject: [pypy-svn] r12867 - pypy/dist/pypy/rpython Message-ID: <20050529141856.E95BA27B56@code1.codespeak.net> Author: arigo Date: Sun May 29 16:18:56 2005 New Revision: 12867 Modified: pypy/dist/pypy/rpython/rint.py pypy/dist/pypy/rpython/robject.py pypy/dist/pypy/rpython/rtyper.py Log: - Conversions between PyObject and integers. - A general way to call functions from the CPython API. Modified: pypy/dist/pypy/rpython/rint.py ============================================================================== --- pypy/dist/pypy/rpython/rint.py (original) +++ pypy/dist/pypy/rpython/rint.py Sun May 29 16:18:56 2005 @@ -1,7 +1,9 @@ from pypy.annotation.pairtype import pairtype from pypy.annotation.model import SomeFloat, SomeInteger, SomeBool, SomePBC +from pypy.annotation.model import SomeObject from pypy.rpython.lltype import Signed, Unsigned, Bool, Float, Void from pypy.rpython.rtyper import TyperError +from pypy.rpython.robject import PyObjPtr debug = False @@ -194,3 +196,30 @@ else: vlist = hop.inputargs(Signed) return vlist[0] + +# + +class __extend__(pairtype(SomeObject, SomeInteger)): + + def rtype_convert_from_to((s_obj, s_int), v, llops): + if s_obj.lowleveltype() != PyObjPtr: + return NotImplemented + if s_int.unsigned: + return llops.gencapicall('PyLong_AsUnsignedLong', [v], + resulttype=Unsigned) + else: + return llops.gencapicall('PyInt_AsLong', [v], + resulttype=Signed) + + +class __extend__(pairtype(SomeInteger, SomeObject)): + + def rtype_convert_from_to((s_int, s_obj), v, llops): + if s_obj.lowleveltype() != PyObjPtr: + return NotImplemented + if s_int.unsigned: + return llops.gencapicall('PyLong_FromUnsignedLong', [v], + resulttype=PyObjPtr) + else: + return llops.gencapicall('PyInt_FromLong', [v], + resulttype=PyObjPtr) Modified: pypy/dist/pypy/rpython/robject.py ============================================================================== --- pypy/dist/pypy/rpython/robject.py (original) +++ pypy/dist/pypy/rpython/robject.py Sun May 29 16:18:56 2005 @@ -41,5 +41,4 @@ if PyObjPtr == FROM == TO: return v else: - raise TyperError("don't know how to convert from %r to %r" % ( - s_from, s_to)) + return NotImplemented Modified: pypy/dist/pypy/rpython/rtyper.py ============================================================================== --- pypy/dist/pypy/rpython/rtyper.py (original) +++ pypy/dist/pypy/rpython/rtyper.py Sun May 29 16:18:56 2005 @@ -271,6 +271,9 @@ def convertvar(self, v, s_from, s_to): if s_from != s_to: v = pair(s_from, s_to).rtype_convert_from_to(v, self) + if v is NotImplemented: + raise TyperError("don't know how to convert from %r to %r" % ( + s_from, s_to)) return v def genop(self, opname, args_v, resulttype=None): @@ -323,6 +326,13 @@ return self.genop('direct_call', [c]+list(args_v), resulttype = typeOf(f).TO.RESULT) + def gencapicall(self, cfnname, args_v, resulttype): + argtypes = [v.concretetype for v in args_v] + FUNCTYPE = FuncType(argtypes, resulttype) + f = functionptr(FUNCTYPE, cfnname, external="C") + cf = inputconst(typeOf(f), f) + return self.genop('direct_call', [cf]+list(args_v), resulttype) + # _______________________________________________________________________ # this has the side-effect of registering the unary and binary operations From arigo at codespeak.net Sun May 29 16:20:58 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Sun, 29 May 2005 16:20:58 +0200 (CEST) Subject: [pypy-svn] r12868 - in pypy/dist/pypy/translator/c: . test Message-ID: <20050529142058.7E0AB27B56@code1.codespeak.net> Author: arigo Date: Sun May 29 16:20:58 2005 New Revision: 12868 Added: pypy/dist/pypy/translator/c/int_include.h - copied unchanged from r12866, pypy/dist/pypy/translator/genc/int_include.h pypy/dist/pypy/translator/c/wrapper.py (contents, props changed) Modified: pypy/dist/pypy/translator/c/database.py pypy/dist/pypy/translator/c/funcgen.py pypy/dist/pypy/translator/c/g_include.h pypy/dist/pypy/translator/c/g_support.h pypy/dist/pypy/translator/c/genc.py pypy/dist/pypy/translator/c/node.py pypy/dist/pypy/translator/c/pyobj.py pypy/dist/pypy/translator/c/test/test_database.py pypy/dist/pypy/translator/c/test/test_genc.py Log: Reintroduced the PyObject wrappers for C functions. Now we can again write tests that compile and run C code. Modified: pypy/dist/pypy/translator/c/database.py ============================================================================== --- pypy/dist/pypy/translator/c/database.py (original) +++ pypy/dist/pypy/translator/c/database.py Sun May 29 16:20:58 2005 @@ -13,13 +13,13 @@ class LowLevelDatabase: - def __init__(self): + def __init__(self, rtyper=None): self.structdefnodes = {} self.structdeflist = [] self.containernodes = {} self.containerlist = [] self.namespace = CNameManager() - self.pyobjmaker = PyObjMaker(self.namespace, self.get) + self.pyobjmaker = PyObjMaker(self.namespace, self.get, rtyper) def gettypedefnode(self, T, varlength=1): if varlength <= 1: Modified: pypy/dist/pypy/translator/c/funcgen.py ============================================================================== --- pypy/dist/pypy/translator/c/funcgen.py (original) +++ pypy/dist/pypy/translator/c/funcgen.py Sun May 29 16:20:58 2005 @@ -34,6 +34,7 @@ result.extend(block.inputargs) for op in block.operations: result.extend(op.args) + result.append(op.result) for link in block.exits: result.extend(link.args) traverse(visit, self.graph) @@ -61,10 +62,6 @@ if isinstance(v, Constant): yield llvalue_from_constant(v) - def decl(self, v): - assert isinstance(v, Variable), repr(v) - return cdecl(self.typemap[v], v.name) - def expr(self, v): if isinstance(v, Variable): return v.name @@ -87,7 +84,10 @@ for v in self.allvariables(): if v not in inputargset: - yield '%s;' % self.decl(v) + result = cdecl(self.typemap[v], v.name) + ';' + if self.lltypemap[v] == Void: + result = '/*%s*/' % result + yield result # ____________________________________________________________ @@ -122,7 +122,9 @@ line += '\t' + self.cincref(a2) yield line for v in has_ref: - yield self.cdecref(v, linklocalvars[v]) + line = self.cdecref(v, linklocalvars[v]) + if line: + yield line yield 'goto block%d;' % blocknum[link.target] # collect all blocks Modified: pypy/dist/pypy/translator/c/g_include.h ============================================================================== --- pypy/dist/pypy/translator/c/g_include.h (original) +++ pypy/dist/pypy/translator/c/g_include.h Sun May 29 16:20:58 2005 @@ -14,4 +14,5 @@ #include "g_support.h" #include "g_module.h" +#include "int_include.h" #include "pyobj_include.h" Modified: pypy/dist/pypy/translator/c/g_support.h ============================================================================== --- pypy/dist/pypy/translator/c/g_support.h (original) +++ pypy/dist/pypy/translator/c/g_support.h Sun May 29 16:20:58 2005 @@ -9,8 +9,6 @@ #define MIN(a,b) (((a)<(b))?(a):(b)) #endif /* MIN */ -#define MOVE(x, y) y = x; - #define FAIL_EXCEPTION(err, exc, msg) \ { \ PyErr_SetString(exc, msg); \ @@ -336,7 +334,7 @@ } PyErr_Format(PyExc_TypeError, "%s() got only %d argument(s)", PyString_AS_STRING(fname), - position-1); + position); return NULL; } Modified: pypy/dist/pypy/translator/c/genc.py ============================================================================== --- pypy/dist/pypy/translator/c/genc.py (original) +++ pypy/dist/pypy/translator/c/genc.py Sun May 29 16:20:58 2005 @@ -44,6 +44,7 @@ # # PyObject support (strange) code # + pyobjmaker = database.pyobjmaker print >> f print >> f, '/***********************************************************/' print >> f, '/*** Table of global PyObjects ***/' @@ -52,7 +53,7 @@ for node in database.globalcontainers(): if isinstance(node, PyObjectNode): name = node.name - if not name.startswith('gfunc_'): + if name not in pyobjmaker.wrappers: print >> f, '\t{&%s, "%s"},' % (name, name) print >> f, '\t{ NULL }\t/* Sentinel */' print >> f, '};' @@ -61,7 +62,14 @@ print >> f, '/*** Table of functions ***/' print >> f print >> f, 'static globalfunctiondef_t globalfunctiondefs[] = {' - print >> f, '\t/* XXX */' + wrappers = pyobjmaker.wrappers.items() + wrappers.sort() + for globalobject_name, (base_name, wrapper_name) in wrappers: + print >> f, ('\t{&%s, {"%s", (PyCFunction)%s, ' + 'METH_VARARGS|METH_KEYWORDS}},' % ( + globalobject_name, + base_name, + wrapper_name)) print >> f, '\t{ NULL }\t/* Sentinel */' print >> f, '};' print >> f Modified: pypy/dist/pypy/translator/c/node.py ============================================================================== --- pypy/dist/pypy/translator/c/node.py (original) +++ pypy/dist/pypy/translator/c/node.py Sun May 29 16:20:58 2005 @@ -246,6 +246,41 @@ yield '}' +class CExternalFuncNode(ContainerNode): + globalcontainer = True + + def __init__(self, db, T, obj): + self.db = db + self.T = T + self.obj = obj + #self.dependencies = {} + self.typename = db.gettype(T) #, who_asks=self) + self.name = obj._name + self.ptrname = self.name + + def enum_dependencies(self): + return [] + + def implementation(self): + return [] + + def forward_declaration(self): + return [] + + def implementation(self): + return [] + + +def funcnodemaker(db, T, obj): + if hasattr(obj, 'graph'): + cls = FuncNode + elif getattr(obj, 'external', None) == 'C': + cls = CExternalFuncNode + else: + raise ValueError, "don't know about %r" % (obj,) + return cls(db, T, obj) + + class PyObjectNode(ContainerNode): globalcontainer = True typename = 'PyObject @' @@ -271,6 +306,6 @@ GcStruct: StructNode, Array: ArrayNode, GcArray: ArrayNode, - FuncType: FuncNode, + FuncType: funcnodemaker, PyObjectType: PyObjectNode, } Modified: pypy/dist/pypy/translator/c/pyobj.py ============================================================================== --- pypy/dist/pypy/translator/c/pyobj.py (original) +++ pypy/dist/pypy/translator/c/pyobj.py Sun May 29 16:20:58 2005 @@ -22,9 +22,10 @@ reconstruct them. """ - def __init__(self, namespace, getvalue): + def __init__(self, namespace, getvalue, rtyper=None): self.namespace = namespace self.getvalue = getvalue + self.rtyper = rtyper self.initcode = [ # list of lines for the module's initxxx() 'import new, types, sys', ] @@ -33,6 +34,7 @@ # for later in initxxx() -- for recursive # objects self.debugstack = () # linked list of nested nameof() + self.wrappers = {} # {'pycfunctionvariable': ('name', 'wrapperfn')} def nameof(self, obj, debug=None): if debug: @@ -141,16 +143,25 @@ self.initcode.append(' raise NotImplementedError') return name - def nameof_function(self, func, progress=['-\x08', '\\\x08', - '|\x08', '/\x08']): - funcdef = self.genc().getfuncdef(func) - if funcdef is None: - return self.skipped_function(func) - if not self.translator.frozen: - p = progress.pop(0) - sys.stderr.write(p) - progress.append(p) - return funcdef.get_globalobject() + def nameof_function(self, func): + assert self.rtyper is not None, ( + "for now, rtyper must be specified to build a PyObject " + "wrapper for %r" % (func,)) + # look for skipped functions + a = self.rtyper.annotator + if a.translator.frozen: + if func not in a.translator.flowgraphs: + return self.skipped_function(func) + else: + if (func.func_doc and + func.func_doc.lstrip().startswith('NOT_RPYTHON')): + return self.skipped_function(func) + + from pypy.translator.c.wrapper import gen_wrapper + fwrapper = gen_wrapper(func, self.rtyper) + pycfunctionobj = self.uniquename('gfunc_' + func.__name__) + self.wrappers[pycfunctionobj] = func.__name__, self.getvalue(fwrapper) + return pycfunctionobj def nameof_staticmethod(self, sm): # XXX XXX XXXX Modified: pypy/dist/pypy/translator/c/test/test_database.py ============================================================================== --- pypy/dist/pypy/translator/c/test/test_database.py (original) +++ pypy/dist/pypy/translator/c/test/test_database.py Sun May 29 16:20:58 2005 @@ -181,10 +181,15 @@ db.complete() dump_on_stdout(db) -def INPROGRESS_test_func_as_pyobject(): +def test_func_as_pyobject(): def f(x): return x+1 - db = LowLevelDatabase() + t = Translator(f) + a = t.annotate([int]) + rtyper = RPythonTyper(t.annotator) + rtyper.specialize() + + db = LowLevelDatabase(rtyper) db.get(pyobjectptr(f)) db.complete() dump_on_stdout(db) Modified: pypy/dist/pypy/translator/c/test/test_genc.py ============================================================================== --- pypy/dist/pypy/translator/c/test/test_genc.py (original) +++ pypy/dist/pypy/translator/c/test/test_genc.py Sun May 29 16:20:58 2005 @@ -1,5 +1,6 @@ -import autopath, sys, os +import autopath, sys, os, py from pypy.rpython.lltype import * +from pypy.rpython.rtyper import RPythonTyper from pypy.translator.translator import Translator from pypy.translator.c.database import LowLevelDatabase from pypy.translator.c.genc import gen_source @@ -14,8 +15,9 @@ modulename = uniquemodulename('testing') targetdir = udir.join(modulename).ensure(dir=1) gen_source(db, modulename, str(targetdir)) - make_module_from_c(targetdir.join(modulename+'.c'), - include_dirs = [os.path.dirname(autopath.this_dir)]) + m = make_module_from_c(targetdir.join(modulename+'.c'), + include_dirs = [os.path.dirname(autopath.this_dir)]) + return m def test_untyped_func(): @@ -33,3 +35,26 @@ db.get(s) db.complete() compile_db(db) + + +def test_func_as_pyobject(): + def f(x): + return x*2 + t = Translator(f) + a = t.annotate([int]) + rtyper = RPythonTyper(t.annotator) + rtyper.specialize() + + db = LowLevelDatabase(rtyper) + entrypoint = db.get(pyobjectptr(f)) + db.complete() + module = compile_db(db) + + f1 = getattr(module, entrypoint) + assert f1(5) == 10 + assert f1(x=5) == 10 + assert f1(-123) == -246 + py.test.raises(TypeError, f1, "world") # check that it's really typed + py.test.raises(TypeError, f1) + py.test.raises(TypeError, f1, 2, 3) + py.test.raises(TypeError, f1, 2, x=2) Added: pypy/dist/pypy/translator/c/wrapper.py ============================================================================== --- (empty file) +++ pypy/dist/pypy/translator/c/wrapper.py Sun May 29 16:20:58 2005 @@ -0,0 +1,112 @@ +from pypy.objspace.flow.model import Variable, Constant, SpaceOperation +from pypy.objspace.flow.model import Block, Link, FunctionGraph, checkgraph +from pypy.annotation import model as annmodel +from pypy.rpython.lltype import GcPtr, NonGcPtr, PyObject, typeOf, Signed, Void +from pypy.rpython.lltype import FuncType, functionptr +from pypy.rpython.rtyper import LowLevelOpList, inputconst +from pypy.interpreter.pycode import CO_VARARGS + + +def gen_wrapper(func, rtyper): + """generate a wrapper function for 'func' that can be put in a + PyCFunction object. The wrapper has signature + + PyObject *pyfn_xxx(PyObject *self, PyObject *args, PyObject* kw); + """ + # The basic idea is to produce a flow graph from scratch, using the + # help of the rtyper for the conversion of the arguments after they + # have been decoded. + + # get the fully typed low-level pointer to the function, if available + nb_positional_args = func.func_code.co_argcount + vararg = bool(func.func_code.co_flags & CO_VARARGS) + f = rtyper.getfunctionptr(func) + FUNCTYPE = typeOf(f).TO + assert len(FUNCTYPE.ARGS) == nb_positional_args + vararg + + newops = LowLevelOpList(rtyper) + + # "def wrapper(self, args, kwds)" + vself = Variable('self') + vargs = Variable('args') + vkwds = Variable('kwds') + vfname = Constant(func.func_name) + # avoid incref/decref on the arguments: 'self' and 'kwds' can be NULL + vself.concretetype = NonGcPtr(PyObject) + vargs.concretetype = NonGcPtr(PyObject) + vkwds.concretetype = NonGcPtr(PyObject) + + varguments = [] + varnames = func.func_code.co_varnames + func_defaults = func.func_defaults or () + for i in range(nb_positional_args): + # "argument_i = decode_arg(fname, i, name, vargs, vkwds)" or + # "argument_i = decode_arg_def(fname, i, name, vargs, vkwds, default)" + vlist = [vfname, + inputconst(Signed, i), + Constant(varnames[i]), + vargs, + vkwds] + try: + default_value = func_defaults[i - nb_positional_args] + except IndexError: + opname = 'decode_arg' + else: + opname = 'decode_arg_def' + vlist.append(Constant(default_value)) + + v = newops.genop(opname, vlist, resulttype=GcPtr(PyObject)) + v._name = 'a%d' % i + varguments.append(v) + + if vararg: + # "vararg = vargs[n:]" + vlist = [vargs, + Constant(nb_positional_args), + Constant(None), + ] + vararg = newops.genop('getslice', vlist, resulttype=GcPtr(PyObject)) + vararg._name = 'vararg' + varguments.append(vararg) + else: + # "check_no_more_arg(fname, n, vargs)" + vlist = [vfname, + inputconst(Signed, nb_positional_args), + vargs, + ] + newops.genop('check_no_more_arg', vlist) + + # use the rtyper to produce the conversions + inputargs = f._obj.graph.getargs() + for i in range(len(varguments)): + # "argument_i = type_conversion_operations(argument_i)" + s_arg = rtyper.annotator.binding(inputargs[i], True) + if s_arg is not None: + varguments[i] = newops.convertvar(varguments[i], + s_from = annmodel.SomeObject(), + s_to = s_arg) + + # "result = direct_call(func, argument_0, argument_1, ..)" + vlist = [inputconst(typeOf(f), f)] + varguments + vresult = newops.genop('direct_call', vlist, resulttype=FUNCTYPE.RESULT) + + # convert "result" back to a PyObject + s_result = rtyper.annotator.binding(f._obj.graph.getreturnvar(), True) + if s_result is not None: + vresult = newops.convertvar(vresult, + s_from = s_result, + s_to = annmodel.SomeObject()) + + # "return result" + block = Block([vself, vargs, vkwds]) + wgraph = FunctionGraph('pyfn_' + func.func_name, block) + block.operations[:] = newops + block.closeblock(Link([vresult], wgraph.returnblock)) + checkgraph(wgraph) + + return functionptr(FuncType([NonGcPtr(PyObject), + NonGcPtr(PyObject), + NonGcPtr(PyObject)], + GcPtr(PyObject)), + wgraph.name, + graph = wgraph) From arigo at codespeak.net Sun May 29 17:08:04 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Sun, 29 May 2005 17:08:04 +0200 (CEST) Subject: [pypy-svn] r12869 - pypy/dist/pypy/documentation Message-ID: <20050529150804.4E7BD27B56@code1.codespeak.net> Author: arigo Date: Sun May 29 17:08:04 2005 New Revision: 12869 Modified: pypy/dist/pypy/documentation/objspace.txt Log: Typo. Modified: pypy/dist/pypy/documentation/objspace.txt ============================================================================== --- pypy/dist/pypy/documentation/objspace.txt (original) +++ pypy/dist/pypy/documentation/objspace.txt Sun May 29 17:08:04 2005 @@ -269,7 +269,7 @@ ->> _`flow object space`: +.. _`flow object space`: The Flow Object Space ===================== From arigo at codespeak.net Sun May 29 19:40:45 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Sun, 29 May 2005 19:40:45 +0200 (CEST) Subject: [pypy-svn] r12870 - in pypy/dist/pypy/rpython: . test Message-ID: <20050529174045.5E42F27B4A@code1.codespeak.net> Author: arigo Date: Sun May 29 19:40:45 2005 New Revision: 12870 Modified: pypy/dist/pypy/rpython/rtyper.py pypy/dist/pypy/rpython/test/test_rtyper.py Log: Constants along links not properly typed. A fix and a test. Modified: pypy/dist/pypy/rpython/rtyper.py ============================================================================== --- pypy/dist/pypy/rpython/rtyper.py (original) +++ pypy/dist/pypy/rpython/rtyper.py Sun May 29 19:40:45 2005 @@ -86,8 +86,11 @@ ##if a1 in (link.last_exception, link.last_exc_value):# treated specially in gen_link ## continue a2 = link.target.inputargs[i] - s_a1 = self.annotator.binding(a1) s_a2 = self.annotator.binding(a2) + if isinstance(a1, Constant): + link.args[i] = inputconst(s_a2.lowleveltype(), a1.value) + continue # the Constant was typed, done + s_a1 = self.annotator.binding(a1) if s_a1 == s_a2: continue # no conversion needed newops = LowLevelOpList(self) @@ -269,6 +272,7 @@ self.rtyper = rtyper def convertvar(self, v, s_from, s_to): + assert isinstance(v, Variable) if s_from != s_to: v = pair(s_from, s_to).rtype_convert_from_to(v, self) if v is NotImplemented: Modified: pypy/dist/pypy/rpython/test/test_rtyper.py ============================================================================== --- pypy/dist/pypy/rpython/test/test_rtyper.py (original) +++ pypy/dist/pypy/rpython/test/test_rtyper.py Sun May 29 19:40:45 2005 @@ -27,3 +27,30 @@ typer.specialize() #t.view() t.checkgraphs() + + +def test_retval(): + def f(x): + return x + t = Translator(f) + t.annotate([int]) + typer = RPythonTyper(t.annotator) + typer.specialize() + #t.view() + t.checkgraphs() + graph = t.getflowgraph(f) + assert graph.getreturnvar().concretetype == Signed + assert graph.startblock.exits[0].args[0].concretetype == Signed + +def test_retval_None(): + def f(x): + pass + t = Translator(f) + t.annotate([int]) + typer = RPythonTyper(t.annotator) + typer.specialize() + #t.view() + t.checkgraphs() + graph = t.getflowgraph(f) + assert graph.getreturnvar().concretetype == Void + assert graph.startblock.exits[0].args[0].concretetype == Void From arigo at codespeak.net Sun May 29 20:14:45 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Sun, 29 May 2005 20:14:45 +0200 (CEST) Subject: [pypy-svn] r12872 - in pypy/dist/pypy/translator/c: . test Message-ID: <20050529181445.C9A4A27B56@code1.codespeak.net> Author: arigo Date: Sun May 29 20:14:45 2005 New Revision: 12872 Added: pypy/dist/pypy/translator/c/ll_include.h Modified: pypy/dist/pypy/translator/c/funcgen.py pypy/dist/pypy/translator/c/g_include.h pypy/dist/pypy/translator/c/node.py pypy/dist/pypy/translator/c/pyobj.py pypy/dist/pypy/translator/c/support.py pypy/dist/pypy/translator/c/test/test_genc.py Log: Successful compilation and execution of a small rlist example. This mainly involved supporting the low-level pointerish operations. Triggered a lot of bugs... Modified: pypy/dist/pypy/translator/c/funcgen.py ============================================================================== --- pypy/dist/pypy/translator/c/funcgen.py (original) +++ pypy/dist/pypy/translator/c/funcgen.py Sun May 29 20:14:45 2005 @@ -1,10 +1,10 @@ from __future__ import generators -from pypy.translator.gensupp import ordered_blocks from pypy.translator.c.support import cdecl, ErrorValue from pypy.translator.c.support import llvalue_from_constant from pypy.objspace.flow.model import Variable, Constant, Block -from pypy.objspace.flow.model import traverse, uniqueitems +from pypy.objspace.flow.model import traverse, uniqueitems, last_exception from pypy.rpython.lltype import GcPtr, NonGcPtr, PyObject, Void, Primitive +from pypy.rpython.lltype import pyobjectptr, Struct, Array PyObjGcPtr = GcPtr(PyObject) @@ -17,13 +17,13 @@ from a flow graph. """ - def __init__(self, graph, gettype, getvalue): + def __init__(self, graph, db): self.graph = graph - self.getvalue = getvalue + self.db = db self.lltypemap = self.collecttypes() self.typemap = {} for v, T in self.lltypemap.items(): - self.typemap[v] = gettype(T) + self.typemap[v] = db.gettype(T) def collecttypes(self): # collect all variables and constants used in the body, @@ -64,15 +64,18 @@ def expr(self, v): if isinstance(v, Variable): - return v.name + if self.lltypemap[v] == Void: + return '/* nothing */' + else: + return v.name elif isinstance(v, Constant): - return self.getvalue(llvalue_from_constant(v)) + return self.db.get(llvalue_from_constant(v)) else: raise TypeError, "expr(%r)" % (v,) def error_return_value(self): returnlltype = self.lltypemap[self.graph.getreturnvar()] - return self.getvalue(ErrorValue(returnlltype)) + return self.db.get(ErrorValue(returnlltype)) # ____________________________________________________________ @@ -94,6 +97,9 @@ def cfunction_body(self): graph = self.graph + blocknum = {} + allblocks = [] + # generate an incref for each input argument for a in self.graph.getargs(): line = self.cincref(a) @@ -108,6 +114,8 @@ linklocalvars[v] = self.expr(v) has_ref = linklocalvars.copy() for a1, a2 in zip(link.args, link.target.inputargs): + if self.lltypemap[a2] == Void: + continue if a1 in linklocalvars: src = linklocalvars[a1] else: @@ -116,9 +124,7 @@ if a1 in has_ref: del has_ref[a1] else: - ct1 = self.ctypeof(a1) - ct2 = self.ctypeof(a2) - assert ct1 == ct2 + assert self.lltypemap[a1] == self.lltypemap[a2] line += '\t' + self.cincref(a2) yield line for v in has_ref: @@ -128,10 +134,13 @@ yield 'goto block%d;' % blocknum[link.target] # collect all blocks - allblocks = ordered_blocks(graph) - blocknum = {} - for block in allblocks: - blocknum[block] = len(blocknum) + def visit(block): + if isinstance(block, Block): + allblocks.append(block) + blocknum[block] = len(blocknum) + traverse(visit, graph) + + assert graph.startblock is allblocks[0] # generate the body of each block for block in allblocks: @@ -186,7 +195,7 @@ for link in block.exits[1:]: assert issubclass(link.exitcase, Exception) yield 'if (PyErr_ExceptionMatches(%s)) {' % ( - self.genc.nameofvalue(link.exitcase),) + self.db.get(pyobjectptr(link.exitcase)),) yield '\tPyObject *exc_cls, *exc_value, *exc_tb;' yield '\tPyErr_Fetch(&exc_cls, &exc_value, &exc_tb);' yield '\tif (exc_value == NULL) {' @@ -202,18 +211,20 @@ err_reachable = True else: # block ending in a switch on a value - ct = self.ctypeof(block.exitswitch) + TYPE = self.lltypemap[block.exitswitch] for link in block.exits[:-1]: assert link.exitcase in (False, True) - yield 'if (%s == %s) {' % (self.expr(block.exitswitch), - self.genc.nameofvalue(link.exitcase, ct)) + expr = self.expr(block.exitswitch) + if not link.exitcase: + expr = '!' + expr + yield 'if (%s) {' % expr for op in gen_link(link): yield '\t' + op yield '}' link = block.exits[-1] assert link.exitcase in (False, True) - yield 'assert(%s == %s);' % (self.expr(block.exitswitch), - self.genc.nameofvalue(link.exitcase, ct)) + #yield 'assert(%s == %s);' % (self.expr(block.exitswitch), + # self.genc.nameofvalue(link.exitcase, ct)) for op in gen_link(block.exits[-1]): yield op yield '' @@ -269,41 +280,83 @@ return 'OP_CALL_ARGS((%s), %s, %s)' % (', '.join(args), r, err) def OP_DIRECT_CALL(self, op, err): - args = [self.expr(v) for v in op.args] - r = self.expr(op.result) - return '%s = %s(%s); if (PyErr_Occurred()) FAIL(%s)' % ( - r, args[0], ', '.join(args[1:]), err) - - def OP_INST_GETATTR(self, op, err): - return '%s = INST_ATTR_%s__%s(%s);' % ( - self.expr(op.result), - op.args[0].concretetype.typename, - op.args[1].value, - self.expr(op.args[0])) - - def OP_INST_SETATTR(self, op, err): - return 'INST_ATTR_%s__%s(%s) = %s;' % ( - op.args[0].concretetype.typename, - op.args[1].value, - self.expr(op.args[0]), - self.expr(op.args[2])) - - def OP_CONV_TO_OBJ(self, op, err): - v = op.args[0] - return '%s = CONV_TO_OBJ_%s(%s); if (PyErr_Occurred()) FAIL(%s)' % ( - self.expr(op.result), self.ctypeof(v).typename, self.expr(v), err) - - def OP_CONV_FROM_OBJ(self, op, err): - v = op.args[0] - return '%s = CONV_FROM_OBJ_%s(%s); if (PyErr_Occurred()) FAIL(%s)' %( - self.expr(op.result), self.ctypeof(op.result).typename, - self.expr(v), err) - - def OP_INCREF(self, op, err): - return self.cincref(op.args[0]) - - def OP_DECREF(self, op, err): - return self.cdecref(op.args[0]) + # skip 'void' arguments + args = [self.expr(v) for v in op.args if self.lltypemap[v] != Void] + if self.lltypemap[op.result] == Void: + # skip assignment of 'void' return value + return '%s(%s); if (PyErr_Occurred()) FAIL(%s)' % ( + args[0], ', '.join(args[1:]), err) + else: + r = self.expr(op.result) + return '%s = %s(%s); if (PyErr_Occurred()) FAIL(%s)' % ( + r, args[0], ', '.join(args[1:]), err) + + # low-level operations + def OP_GETFIELD(self, op, err): + assert isinstance(op.args[1], Constant) + STRUCT = self.lltypemap[op.args[0]].TO + structdef = self.db.gettypedefnode(STRUCT) + fieldname = structdef.c_struct_field_name(op.args[1].value) + return '%s = %s->%s;' % (self.expr(op.result), + self.expr(op.args[0]), + fieldname) + + def OP_SETFIELD(self, op, err): + assert isinstance(op.args[1], Constant) + STRUCT = self.lltypemap[op.args[0]].TO + structdef = self.db.gettypedefnode(STRUCT) + fieldname = structdef.c_struct_field_name(op.args[1].value) + return '%s->%s = %s;' % (self.expr(op.args[0]), + fieldname, + self.expr(op.args[2])) + + def OP_GETSUBSTRUCT(self, op, err): + assert isinstance(op.args[1], Constant) + STRUCT = self.lltypemap[op.args[0]].TO + structdef = self.db.gettypedefnode(STRUCT) + fieldname = structdef.c_struct_field_name(op.args[1].value) + return '%s = &%s->%s;' % (self.expr(op.result), + self.expr(op.args[0]), + fieldname) + + def OP_GETARRAYITEM(self, op, err): + return '%s = %s->items + %s;' % (self.expr(op.result), + self.expr(op.args[0]), + self.expr(op.args[1])) + + def OP_GETARRAYSIZE(self, op, err): + return '%s = %s->length;' % (self.expr(op.result), + self.expr(op.args[0])) + + def OP_MALLOC(self, op, err): + TYPE = self.lltypemap[op.result].TO + typename = self.db.gettype(TYPE) + eresult = self.expr(op.result) + result = ['OP_ZERO_MALLOC(sizeof(%s), %s, %s)' % (cdecl(typename, ''), + eresult, + err), + self.cincref(op.result)] + return '\t'.join(result) + + def OP_MALLOC_VARSIZE(self, op, err): + TYPE = self.lltypemap[op.result].TO + typename = self.db.gettype(TYPE) + if isinstance(TYPE, Struct): + TYPE = TYPE._arrayfld + assert isinstance(TYPE, Array) + itemtypename = self.db.gettype(TYPE.OF) + elength = self.expr(op.args[1]) + eresult = self.expr(op.result) + size = 'sizeof(%s)+((%s-1)*sizeof(%s))' % (cdecl(typename, ''), + elength, + cdecl(itemtypename, '')) + result = ['OP_ZERO_MALLOC(%s, %s, %s)' % (size, + eresult, + err), + '%s->length = %s;' % (eresult, + elength), + self.cincref(op.result)] + return '\t'.join(result) def cincref(self, v): T = self.lltypemap[v] @@ -311,7 +364,7 @@ if T.TO == PyObject: return 'Py_INCREF(%s);' % v.name else: - return '/*XXX INCREF*/' + return '/*XXX INCREF %s*/' % v.name else: return '' @@ -321,6 +374,6 @@ if T.TO == PyObject: return 'Py_DECREF(%s);' % v.name else: - return '/*XXX DECREF*/' + return '/*XXX DECREF %s*/' % v.name else: return '' Modified: pypy/dist/pypy/translator/c/g_include.h ============================================================================== --- pypy/dist/pypy/translator/c/g_include.h (original) +++ pypy/dist/pypy/translator/c/g_include.h Sun May 29 20:14:45 2005 @@ -15,4 +15,5 @@ #include "g_module.h" #include "int_include.h" +#include "ll_include.h" #include "pyobj_include.h" Added: pypy/dist/pypy/translator/c/ll_include.h ============================================================================== --- (empty file) +++ pypy/dist/pypy/translator/c/ll_include.h Sun May 29 20:14:45 2005 @@ -0,0 +1,10 @@ + +/************************************************************/ + /*** C header subsection: operations on LowLevelTypes ***/ + + +#define OP_ZERO_MALLOC(size, r, err) { \ + r = (void*) PyObject_Malloc(size); \ + if (r == NULL) { PyErr_NoMemory(); FAIL(err) } \ + memset((void*) r, 0, size); \ + } Modified: pypy/dist/pypy/translator/c/node.py ============================================================================== --- pypy/dist/pypy/translator/c/node.py (original) +++ pypy/dist/pypy/translator/c/node.py Sun May 29 20:14:45 2005 @@ -185,7 +185,7 @@ def __init__(self, db, T, obj): graph = obj.graph # only user-defined functions with graphs for now - self.funcgen = FunctionCodeGenerator(graph, db.gettype, db.get) + self.funcgen = FunctionCodeGenerator(graph, db) self.db = db self.T = T self.obj = obj Modified: pypy/dist/pypy/translator/c/pyobj.py ============================================================================== --- pypy/dist/pypy/translator/c/pyobj.py (original) +++ pypy/dist/pypy/translator/c/pyobj.py Sun May 29 20:14:45 2005 @@ -79,6 +79,17 @@ self.initcode_python(name, "object()") return name + def nameof_NoneType(self, value): + assert value is None + return 'Py_None' + + def nameof_bool(self, value): + assert value is False or value is True + if value: + return 'Py_True' + else: + return 'Py_False' + def nameof_module(self, value): assert value is os or not hasattr(value, "__file__") or \ not (value.__file__.endswith('.pyc') or Modified: pypy/dist/pypy/translator/c/support.py ============================================================================== --- pypy/dist/pypy/translator/c/support.py (original) +++ pypy/dist/pypy/translator/c/support.py Sun May 29 20:14:45 2005 @@ -36,8 +36,11 @@ except AttributeError: return lltype.pyobjectptr(c.value) else: - assert lltype.typeOf(c.value) == T - return c.value + if T == lltype.Void: + return None + else: + assert lltype.typeOf(c.value) == T + return c.value class CNameManager(NameManager): Modified: pypy/dist/pypy/translator/c/test/test_genc.py ============================================================================== --- pypy/dist/pypy/translator/c/test/test_genc.py (original) +++ pypy/dist/pypy/translator/c/test/test_genc.py Sun May 29 20:14:45 2005 @@ -10,6 +10,10 @@ from pypy.translator.tool.buildpyxmodule import make_module_from_c from pypy.translator.gensupp import uniquemodulename +# XXX this tries to make compiling faster for full-scale testing +from pypy.translator.tool import buildpyxmodule +buildpyxmodule.enable_fast_compilation() + def compile_db(db): modulename = uniquemodulename('testing') @@ -58,3 +62,24 @@ py.test.raises(TypeError, f1) py.test.raises(TypeError, f1, 2, 3) py.test.raises(TypeError, f1, 2, x=2) + + +def test_rlist(): + def f(x): + l = [x] + l.append(x+1) + return l[0] * l[-1] + t = Translator(f) + a = t.annotate([int]) + rtyper = RPythonTyper(t.annotator) + rtyper.specialize() + + db = LowLevelDatabase(rtyper) + entrypoint = db.get(pyobjectptr(f)) + db.complete() + #t.view() + module = compile_db(db) + + f1 = getattr(module, entrypoint) + assert f1(5) == 30 + assert f1(x=5) == 30 From ale at codespeak.net Mon May 30 00:38:23 2005 From: ale at codespeak.net (ale at codespeak.net) Date: Mon, 30 May 2005 00:38:23 +0200 (CEST) Subject: [pypy-svn] r12876 - pypy/dist/lib-python/modified-2.3.4/encodings Message-ID: <20050529223823.64BD527BCE@code1.codespeak.net> Author: ale Date: Mon May 30 00:38:23 2005 New Revision: 12876 Modified: pypy/dist/lib-python/modified-2.3.4/encodings/string_escape.py Log: Use staticmethod when calling functions in the _codecs module. Modified: pypy/dist/lib-python/modified-2.3.4/encodings/string_escape.py ============================================================================== --- pypy/dist/lib-python/modified-2.3.4/encodings/string_escape.py (original) +++ pypy/dist/lib-python/modified-2.3.4/encodings/string_escape.py Mon May 30 00:38:23 2005 @@ -9,8 +9,8 @@ class Codec(codecs.Codec): - encode = codecs.escape_encode - decode = codecs.escape_decode + encode = staticmethod(codecs.escape_encode) + decode = staticmethod(codecs.escape_decode) class StreamWriter(Codec,codecs.StreamWriter): pass From ericvrp at codespeak.net Mon May 30 13:36:02 2005 From: ericvrp at codespeak.net (ericvrp at codespeak.net) Date: Mon, 30 May 2005 13:36:02 +0200 (CEST) Subject: [pypy-svn] r12878 - pypy/dist/pypy/rpython/test Message-ID: <20050530113602.01CE427B88@code1.codespeak.net> Author: ericvrp Date: Mon May 30 13:36:02 2005 New Revision: 12878 Added: pypy/dist/pypy/rpython/test/snippet.py pypy/dist/pypy/rpython/test/test_rbool.py pypy/dist/pypy/rpython/test/test_rfloat.py pypy/dist/pypy/rpython/test/test_rint.py Log: tests, tests and more tests (3 are known to fail at this time!) Added: pypy/dist/pypy/rpython/test/snippet.py ============================================================================== --- (empty file) +++ pypy/dist/pypy/rpython/test/snippet.py Mon May 30 13:36:02 2005 @@ -0,0 +1,130 @@ +# generic + +def not1(n): + return not n + + +def not2(n): + t = not n + if not n: + t += 1 + return t + + +# bools + +def bool1(n): + if n: + return 3 + return 5 + + +def bool_cast1(n): + n += bool(False) + n += bool(True) + n += bool(0) + n += bool(1) + n += bool(6) + n += bool(7.8) + n += bool(n) + + +#ints + +def int1(n): + i = 0 + + i += n<<3 + i <<= 3 + + i += n>>3 + i >>= 3 + + i += n%3 + i %= n + + i += n^3 + i ^= n + + i += n&3 + i &= n + + i += n^3 + i ^= n + + i += n|3 + i |= n + + i += ~n + + n += False + n += True + n += bool(False) + n += bool(True) + + i += abs(i) + i &= 255 + + i **= n + i += n**3 + + i += -n + i += +n + i += not n + + if n < 12.5: + n += 666 + + while n: + i = i + n + n = n - 1 + return i + + +def int_cast1(n): + n += int(False) + n += int(True) + n += int(0) + n += int(1) + n += int(8) + n += int(5.7) + n += int(n) + + +# floats + +def float1(n): + i = 0 + + n += False + n += True + n += bool(False) + n += bool(True) + + i += abs(i) + i &= 255 + + i **= n + i += n**3 + + i += -n + i += +n + i += not n + + if n < 12.5: + n += 666 + + while n: + i = i + n + n = n - 1 + return i + + +def float_cast1(n): + n += float(False) + n += float(True) + n += float(0) + n += float(1) + n += float(6) + n += float(7.8) + n += float(n) Added: pypy/dist/pypy/rpython/test/test_rbool.py ============================================================================== --- (empty file) +++ pypy/dist/pypy/rpython/test/test_rbool.py Mon May 30 13:36:02 2005 @@ -0,0 +1,36 @@ +from pypy.translator.translator import Translator +from pypy.rpython.rtyper import RPythonTyper +from pypy.annotation import model as annmodel +from pypy.rpython.test import snippet + + +class TestSnippet(object): + + def _test(self, func, types): + t = Translator(func) + t.annotate(types) + typer = RPythonTyper(t.annotator) + typer.specialize() + t.checkgraphs() + + def test_not1(self): + self._test(snippet.not1, [int]) + + def test_not2(self): + self._test(snippet.not2, [int]) + + def test_bool1(self): + self._test(snippet.bool1, [bool]) + + def test_bool_cast1(self): + self._test(snippet.bool_cast1, [bool]) + + def DONTtest_unary_operations(self): + # XXX TODO test if all unary operations are implemented + for opname in annmodel.UNARY_OPERATIONS: + print 'UNARY_OPERATIONS:', opname + + def DONTtest_binary_operations(self): + # XXX TODO test if all binary operations are implemented + for opname in annmodel.BINARY_OPERATIONS: + print 'BINARY_OPERATIONS:', opname Added: pypy/dist/pypy/rpython/test/test_rfloat.py ============================================================================== --- (empty file) +++ pypy/dist/pypy/rpython/test/test_rfloat.py Mon May 30 13:36:02 2005 @@ -0,0 +1,36 @@ +from pypy.translator.translator import Translator +from pypy.rpython.rtyper import RPythonTyper +from pypy.annotation import model as annmodel +from pypy.rpython.test import snippet + + +class TestSnippet(object): + + def _test(self, func, types): + t = Translator(func) + t.annotate(types) + typer = RPythonTyper(t.annotator) + typer.specialize() + t.checkgraphs() + + def test_not1(self): + self._test(snippet.not1, [int]) + + def test_not2(self): + self._test(snippet.not2, [int]) + + def test_float1(self): + self._test(snippet.float1, [float]) + + def test_float_cast1(self): + self._test(snippet.float_cast1, [float]) + + def DONTtest_unary_operations(self): + # XXX TODO test if all unary operations are implemented + for opname in annmodel.UNARY_OPERATIONS: + print 'UNARY_OPERATIONS:', opname + + def DONTtest_binary_operations(self): + # XXX TODO test if all binary operations are implemented + for opname in annmodel.BINARY_OPERATIONS: + print 'BINARY_OPERATIONS:', opname Added: pypy/dist/pypy/rpython/test/test_rint.py ============================================================================== --- (empty file) +++ pypy/dist/pypy/rpython/test/test_rint.py Mon May 30 13:36:02 2005 @@ -0,0 +1,36 @@ +from pypy.translator.translator import Translator +from pypy.rpython.rtyper import RPythonTyper +from pypy.annotation import model as annmodel +from pypy.rpython.test import snippet + + +class TestSnippet(object): + + def _test(self, func, types): + t = Translator(func) + t.annotate(types) + typer = RPythonTyper(t.annotator) + typer.specialize() + t.checkgraphs() + + def test_not1(self): + self._test(snippet.not1, [int]) + + def test_not2(self): + self._test(snippet.not2, [int]) + + def test_int1(self): + self._test(snippet.int1, [int]) + + def test_int_cast1(self): + self._test(snippet.int_cast1, [int]) + + def DONTtest_unary_operations(self): + # XXX TODO test if all unary operations are implemented + for opname in annmodel.UNARY_OPERATIONS: + print 'UNARY_OPERATIONS:', opname + + def DONTtest_binary_operations(self): + # XXX TODO test if all binary operations are implemented + for opname in annmodel.BINARY_OPERATIONS: + print 'BINARY_OPERATIONS:', opname From arigo at codespeak.net Mon May 30 14:04:58 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Mon, 30 May 2005 14:04:58 +0200 (CEST) Subject: [pypy-svn] r12881 - in pypy/dist/pypy/translator/c: . test Message-ID: <20050530120458.AF8D427B88@code1.codespeak.net> Author: arigo Date: Mon May 30 14:04:58 2005 New Revision: 12881 Modified: pypy/dist/pypy/translator/c/database.py pypy/dist/pypy/translator/c/funcgen.py pypy/dist/pypy/translator/c/ll_include.h pypy/dist/pypy/translator/c/node.py pypy/dist/pypy/translator/c/test/test_database.py Log: Reference counting and deallocators. Modified: pypy/dist/pypy/translator/c/database.py ============================================================================== --- pypy/dist/pypy/translator/c/database.py (original) +++ pypy/dist/pypy/translator/c/database.py Mon May 30 14:04:58 2005 @@ -102,6 +102,28 @@ else: raise Exception("don't know about %r" % (obj,)) + def cincrefstmt(self, expr, T): + if isinstance(T, _PtrType) and 'gc' in T.flags: + if T.TO == PyObject: + return 'Py_INCREF(%s);' % expr + else: + defnode = self.gettypedefnode(T.TO) + if defnode.refcount is not None: + return '%s->%s++;' % (expr, defnode.refcount) + return '' + + def cdecrefstmt(self, expr, T): + if isinstance(T, _PtrType) and 'gc' in T.flags: + if T.TO == PyObject: + return 'Py_DECREF(%s);' % expr + else: + defnode = self.gettypedefnode(T.TO) + if defnode.refcount is not None: + return 'if (!--%s->%s) %s(%s);' % (expr, defnode.refcount, + defnode.deallocator or 'OP_FREE', + expr) + return '' + def complete(self): i = 0 while True: Modified: pypy/dist/pypy/translator/c/funcgen.py ============================================================================== --- pypy/dist/pypy/translator/c/funcgen.py (original) +++ pypy/dist/pypy/translator/c/funcgen.py Mon May 30 14:04:58 2005 @@ -3,7 +3,7 @@ from pypy.translator.c.support import llvalue_from_constant from pypy.objspace.flow.model import Variable, Constant, Block from pypy.objspace.flow.model import traverse, uniqueitems, last_exception -from pypy.rpython.lltype import GcPtr, NonGcPtr, PyObject, Void, Primitive +from pypy.rpython.lltype import GcPtr, NonGcPtr, PyObject, Void from pypy.rpython.lltype import pyobjectptr, Struct, Array @@ -292,32 +292,49 @@ r, args[0], ', '.join(args[1:]), err) # low-level operations - def OP_GETFIELD(self, op, err): + def OP_GETFIELD(self, op, err, ampersand=''): assert isinstance(op.args[1], Constant) STRUCT = self.lltypemap[op.args[0]].TO structdef = self.db.gettypedefnode(STRUCT) fieldname = structdef.c_struct_field_name(op.args[1].value) - return '%s = %s->%s;' % (self.expr(op.result), - self.expr(op.args[0]), - fieldname) + newvalue = self.expr(op.result) + result = ['%s = %s%s->%s;' % (newvalue, + ampersand, + self.expr(op.args[0]), + fieldname)] + # need to adjust the refcount of the result + T = self.lltypemap[op.result] + increfstmt = self.db.cincrefstmt(newvalue, T) + if increfstmt: + result.append(increfstmt) + return '\t'.join(result) def OP_SETFIELD(self, op, err): assert isinstance(op.args[1], Constant) STRUCT = self.lltypemap[op.args[0]].TO structdef = self.db.gettypedefnode(STRUCT) fieldname = structdef.c_struct_field_name(op.args[1].value) - return '%s->%s = %s;' % (self.expr(op.args[0]), - fieldname, - self.expr(op.args[2])) + oldvalue = '%s->%s' % (self.expr(op.args[0]), + fieldname) + newvalue = self.expr(op.args[2]) + result = ['%s = %s;' % (oldvalue, newvalue)] + + # need to adjust some refcounts + T = structdef.c_struct_field_type(op.args[1].value) + decrefstmt = self.db.cdecrefstmt('prev', T) + increfstmt = self.db.cincrefstmt(newvalue, T) + if increfstmt: + result.append(increfstmt) + if decrefstmt: + result.insert(0, '{ %s = %s;' % ( + cdecl(self.typemap[op.args[2]], 'prev'), + oldvalue)) + result.append('if (prev) ' + decrefstmt) + result.append('}') + return '\t'.join(result) def OP_GETSUBSTRUCT(self, op, err): - assert isinstance(op.args[1], Constant) - STRUCT = self.lltypemap[op.args[0]].TO - structdef = self.db.gettypedefnode(STRUCT) - fieldname = structdef.c_struct_field_name(op.args[1].value) - return '%s = &%s->%s;' % (self.expr(op.result), - self.expr(op.args[0]), - fieldname) + return self.OP_GETFIELD(op, err, ampersand='&') def OP_GETARRAYITEM(self, op, err): return '%s = %s->items + %s;' % (self.expr(op.result), @@ -335,7 +352,9 @@ result = ['OP_ZERO_MALLOC(sizeof(%s), %s, %s)' % (cdecl(typename, ''), eresult, err), - self.cincref(op.result)] + '%s->%s = 1;' % (eresult, + self.db.gettypedefnode(TYPE).refcount), + ] return '\t'.join(result) def OP_MALLOC_VARSIZE(self, op, err): @@ -355,25 +374,15 @@ err), '%s->length = %s;' % (eresult, elength), - self.cincref(op.result)] + '%s->%s = 1;' % (eresult, + self.db.gettypedefnode(TYPE).refcount), + ] return '\t'.join(result) def cincref(self, v): T = self.lltypemap[v] - if not isinstance(T, Primitive) and 'gc' in T.flags: - if T.TO == PyObject: - return 'Py_INCREF(%s);' % v.name - else: - return '/*XXX INCREF %s*/' % v.name - else: - return '' + return self.db.cincrefstmt(v.name, T) def cdecref(self, v, expr=None): T = self.lltypemap[v] - if not isinstance(T, Primitive) and 'gc' in T.flags: - if T.TO == PyObject: - return 'Py_DECREF(%s);' % v.name - else: - return '/*XXX DECREF %s*/' % v.name - else: - return '' + return self.db.cdecrefstmt(expr or v.name, T) Modified: pypy/dist/pypy/translator/c/ll_include.h ============================================================================== --- pypy/dist/pypy/translator/c/ll_include.h (original) +++ pypy/dist/pypy/translator/c/ll_include.h Mon May 30 14:04:58 2005 @@ -8,3 +8,5 @@ if (r == NULL) { PyErr_NoMemory(); FAIL(err) } \ memset((void*) r, 0, size); \ } + +#define OP_FREE(p) PyObject_Free(p); Modified: pypy/dist/pypy/translator/c/node.py ============================================================================== --- pypy/dist/pypy/translator/c/node.py (original) +++ pypy/dist/pypy/translator/c/node.py Mon May 30 14:04:58 2005 @@ -1,7 +1,7 @@ from __future__ import generators from pypy.rpython.lltype import Struct, Array, FuncType, PyObjectType, typeOf from pypy.rpython.lltype import GcStruct, GcArray, GC_CONTAINER, ContainerType -from pypy.rpython.lltype import parentlink +from pypy.rpython.lltype import parentlink, _PtrType from pypy.translator.c.funcgen import FunctionCodeGenerator from pypy.translator.c.support import cdecl, somelettersfrom @@ -11,13 +11,16 @@ return False if isinstance(T, GcStruct): if T._names and isinstance(T._flds[T._names[0]], GC_CONTAINER): - return False # refcount already in the first first + return False # refcount already in the first field return True class StructDefNode: + refcount = None + deallocator = None def __init__(self, db, STRUCT, varlength=1): + self.db = db self.STRUCT = STRUCT if varlength == 1: basename = STRUCT._name @@ -29,16 +32,34 @@ self.fields = [] self.prefix = somelettersfrom(STRUCT._name) + '_' for name in STRUCT._names: - T = STRUCT._flds[name] + T = self.c_struct_field_type(name) if name == STRUCT._arrayfld: typename = db.gettype(T, varlength=varlength, who_asks=self) else: typename = db.gettype(T, who_asks=self) self.fields.append((self.c_struct_field_name(name), typename)) + # look up the reference counter field + if needs_refcount(STRUCT): + self.refcount = 'refcount' + elif isinstance(STRUCT, GcStruct): + # refcount in the first field + T = self.c_struct_field_type(STRUCT._names[0]) + assert isinstance(T, GC_CONTAINER) + firstfieldname, firstfieldtype = self.fields[0] + firstdefnode = db.gettypedefnode(T) + self.refcount = '%s.%s' % (firstfieldname, firstdefnode.refcount) + + # is a specific deallocator needed? + if self.refcount and varlength == 1 and list(self.deallocator_lines('')): + self.deallocator = db.namespace.uniquename('dealloc_'+self.name) + def c_struct_field_name(self, name): return self.prefix + name + def c_struct_field_type(self, name): + return self.STRUCT._flds[name] + def access_expr(self, baseexpr, fldname): fldname = self.c_struct_field_name(fldname) return '%s.%s' % (baseexpr, fldname) @@ -50,11 +71,35 @@ for name, typename in self.fields: yield '\t%s;' % cdecl(typename, name) yield '};' + if self.deallocator: + yield 'void %s(struct %s *p) {' % (self.deallocator, self.name) + for line in self.deallocator_lines('p->'): + yield '\t' + line + yield '\tOP_FREE(p);' + yield '}' + + def deallocator_lines(self, prefix): + STRUCT = self.STRUCT + for name in STRUCT._names: + FIELD_T = self.c_struct_field_type(name) + if isinstance(FIELD_T, _PtrType) and 'gc' in FIELD_T.flags: + cname = self.c_struct_field_name(name) + line = self.db.cdecrefstmt('%s%s' % (prefix, cname), FIELD_T) + if line: + yield line + elif isinstance(FIELD_T, ContainerType): + defnode = self.db.gettypedefnode(FIELD_T) + cname = self.c_struct_field_name(name) + for line in defnode.deallocator_lines('%s%s.' %(prefix, cname)): + yield line class ArrayDefNode: + refcount = None + deallocator = None def __init__(self, db, ARRAY, varlength=1): + self.db = db self.ARRAY = ARRAY if varlength == 1: basename = 'array' @@ -66,6 +111,14 @@ self.structname = db.gettype(ARRAY.OF, who_asks=self) self.varlength = varlength + # look up the reference counter field + if needs_refcount(ARRAY): + self.refcount = 'refcount' + + # is a specific deallocator needed? + if self.refcount and varlength == 1 and list(self.deallocator_lines('')): + self.deallocator = db.namespace.uniquename('dealloc_'+self.name) + def access_expr(self, baseexpr, index): return '%s.items[%d]' % (baseexpr, index) @@ -76,6 +129,33 @@ yield '\tlong length;' yield '\t%s;' % cdecl(self.structname, 'items[%d]' % self.varlength) yield '};' + if self.deallocator: + yield 'void %s(struct %s *a) {' % (self.deallocator, self.name) + for line in self.deallocator_lines('a->'): + yield '\t' + line + yield '\tOP_FREE(a);' + yield '}' + + def deallocator_lines(self, prefix): + ARRAY = self.ARRAY + defnode = self.db.gettypedefnode(ARRAY.OF) + varname = 'p%d' % len(prefix) + body = list(defnode.deallocator_lines('%s->' % varname)) + if body: + yield '{' + yield '\tstruct %s *%s = %sitems;' % (defnode.name, + varname, + prefix) + yield '\tstruct %s *%s_end = %s + %slength;' % (defnode.name, + varname, + varname, + prefix) + yield '\twhile (%s != %s_end) {' % (varname, varname) + for line in body: + yield '\t\t' + line + yield '\t\t%s++;' % varname + yield '\t}' + yield '}' # ____________________________________________________________ Modified: pypy/dist/pypy/translator/c/test/test_database.py ============================================================================== --- pypy/dist/pypy/translator/c/test/test_database.py (original) +++ pypy/dist/pypy/translator/c/test/test_database.py Mon May 30 14:04:58 2005 @@ -193,3 +193,72 @@ db.get(pyobjectptr(f)) db.complete() dump_on_stdout(db) + + +def test_malloc(): + S = GcStruct('testing', ('x', Signed), ('y', Signed)) + def ll_f(x): + p = malloc(S) + p.x = x + p.y = x+1 + return p.x * p.y + t = Translator(ll_f) + a = t.annotate([int]) + rtyper = RPythonTyper(t.annotator) + rtyper.specialize() + db = LowLevelDatabase(rtyper) + db.get(rtyper.getfunctionptr(ll_f)) + db.complete() + dump_on_stdout(db) + +def test_multiple_malloc(): + S1 = GcStruct('testing1', ('x', Signed), ('y', Signed)) + S = GcStruct('testing', ('ptr1', GcPtr(S1)), + ('ptr2', GcPtr(S1)), + ('z', Signed)) + def ll_f(x): + ptr1 = malloc(S1) + ptr1.x = x + ptr2 = malloc(S1) + ptr2.x = x+1 + s = malloc(S) + s.ptr1 = ptr1 + s.ptr2 = ptr2 + return s.ptr1.x * s.ptr2.x + t = Translator(ll_f) + a = t.annotate([int]) + rtyper = RPythonTyper(t.annotator) + rtyper.specialize() + db = LowLevelDatabase(rtyper) + db.get(rtyper.getfunctionptr(ll_f)) + db.complete() + dump_on_stdout(db) + +def test_nested_gcstruct(): + S1 = GcStruct('inlined', ('x', Signed), ('y', GcPtr(PyObject))) + S = GcStruct('testing', ('head', S1), + ('ptr2', GcPtr(S1)), + ('z', Signed)) + def ll_f(x): + ptr2 = malloc(S1) + ptr2.x = x+1 + s = malloc(S) + s.head.x = x + s.ptr2 = ptr2 + return s.head.x * s.ptr2.x + t = Translator(ll_f) + a = t.annotate([int]) + rtyper = RPythonTyper(t.annotator) + rtyper.specialize() + db = LowLevelDatabase(rtyper) + db.get(rtyper.getfunctionptr(ll_f)) + db.complete() + dump_on_stdout(db) + +def test_array(): + A = GcArray(('obj', GcPtr(PyObject))) + a = malloc(A, 10) + db = LowLevelDatabase() + db.get(a) + db.complete() + dump_on_stdout(db) From ac at codespeak.net Mon May 30 14:52:16 2005 From: ac at codespeak.net (ac at codespeak.net) Date: Mon, 30 May 2005 14:52:16 +0200 (CEST) Subject: [pypy-svn] r12883 - pypy/dist/pypy/objspace/std Message-ID: <20050530125216.F309127B60@code1.codespeak.net> Author: ac Date: Mon May 30 14:52:16 2005 New Revision: 12883 Modified: pypy/dist/pypy/objspace/std/inttype.py Log: Only guard the operation that can generate an exception Modified: pypy/dist/pypy/objspace/std/inttype.py ============================================================================== --- pypy/dist/pypy/objspace/std/inttype.py (original) +++ pypy/dist/pypy/objspace/std/inttype.py Mon May 30 14:52:16 2005 @@ -29,9 +29,10 @@ except ParseStringOverflowError, e: w_longval = retry_to_w_long(space, e.parser) elif space.is_true(space.isinstance(w_value, space.w_unicode)): + from unicodeobject import unicode_to_decimal_w + string = unicode_to_decimal_w(space, w_value) try: - from unicodeobject import unicode_to_decimal_w - value = string_to_int(space, unicode_to_decimal_w(space, w_value)) + value = string_to_int(space, string) except ParseStringError, e: raise OperationError(space.w_ValueError, space.wrap(e.msg)) From arigo at codespeak.net Mon May 30 15:33:40 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Mon, 30 May 2005 15:33:40 +0200 (CEST) Subject: [pypy-svn] r12887 - in pypy/dist/pypy/translator/c: . test Message-ID: <20050530133340.DDF9327B64@code1.codespeak.net> Author: arigo Date: Mon May 30 15:33:40 2005 New Revision: 12887 Modified: pypy/dist/pypy/translator/c/g_module.h pypy/dist/pypy/translator/c/genc.py pypy/dist/pypy/translator/c/ll_include.h pypy/dist/pypy/translator/c/test/test_genc.py Log: Leak detection: count the mallocs and the frees and verify that they match. Modified: pypy/dist/pypy/translator/c/g_module.h ============================================================================== --- pypy/dist/pypy/translator/c/g_module.h (original) +++ pypy/dist/pypy/translator/c/g_module.h Mon May 30 15:33:40 2005 @@ -3,12 +3,20 @@ /*** C header subsection: CPython-extension-module-ness ***/ -#define MODULE_INITFUNC(modname) \ - static PyMethodDef no_methods[] = { (char *)NULL, (PyCFunction)NULL }; \ +#ifndef COUNT_OP_MALLOCS +# define MODULE_INITFUNC(modname) \ + static PyMethodDef my_methods[] = { (char *)NULL, (PyCFunction)NULL }; \ PyMODINIT_FUNC init##modname(void) +#else +# define MODULE_INITFUNC(modname) \ + static PyMethodDef my_methods[] = { \ + { "malloc_counters", malloc_counters }, \ + { (char *)NULL, (PyCFunction)NULL } }; \ + PyMODINIT_FUNC init##modname(void) +#endif #define SETUP_MODULE(modname) \ - PyObject *m = Py_InitModule(#modname, no_methods); \ + PyObject *m = Py_InitModule(#modname, my_methods); \ PyModule_AddStringConstant(m, "__sourcefile__", __FILE__); \ this_module_globals = PyModule_GetDict(m); \ PyGenCFunction_Type.tp_base = &PyCFunction_Type; \ Modified: pypy/dist/pypy/translator/c/genc.py ============================================================================== --- pypy/dist/pypy/translator/c/genc.py (original) +++ pypy/dist/pypy/translator/c/genc.py Mon May 30 15:33:40 2005 @@ -3,13 +3,15 @@ from pypy.translator.c.node import PyObjectNode -def gen_source(database, modulename, targetdir): +def gen_source(database, modulename, targetdir, defines={}): filename = os.path.join(targetdir, modulename + '.c') f = open(filename, 'w') # # Header # + for key, value in defines.items(): + print >> f, '#define %s %s' % (key, value) print >> f, '#include "g_include.h"' # Modified: pypy/dist/pypy/translator/c/ll_include.h ============================================================================== --- pypy/dist/pypy/translator/c/ll_include.h (original) +++ pypy/dist/pypy/translator/c/ll_include.h Mon May 30 15:33:40 2005 @@ -7,6 +7,33 @@ r = (void*) PyObject_Malloc(size); \ if (r == NULL) { PyErr_NoMemory(); FAIL(err) } \ memset((void*) r, 0, size); \ + COUNT_MALLOC \ } -#define OP_FREE(p) PyObject_Free(p); +#define OP_FREE(p) { PyObject_Free(p); COUNT_FREE } + + +/*------------------------------------------------------------*/ +#ifndef COUNT_OP_MALLOCS +/*------------------------------------------------------------*/ + +#define COUNT_MALLOC /* nothing */ +#define COUNT_FREE /* nothing */ + +/*------------------------------------------------------------*/ +#else /*COUNT_OP_MALLOCS*/ +/*------------------------------------------------------------*/ + +static int count_mallocs=0, count_frees=0; + +#define COUNT_MALLOC count_mallocs++; +#define COUNT_FREE count_frees++; + +PyObject* malloc_counters(PyObject* self, PyObject* args) +{ + return Py_BuildValue("ii", count_mallocs, count_frees); +} + +/*------------------------------------------------------------*/ +#endif /*COUNT_OP_MALLOCS*/ +/*------------------------------------------------------------*/ Modified: pypy/dist/pypy/translator/c/test/test_genc.py ============================================================================== --- pypy/dist/pypy/translator/c/test/test_genc.py (original) +++ pypy/dist/pypy/translator/c/test/test_genc.py Mon May 30 15:33:40 2005 @@ -18,7 +18,7 @@ def compile_db(db): modulename = uniquemodulename('testing') targetdir = udir.join(modulename).ensure(dir=1) - gen_source(db, modulename, str(targetdir)) + gen_source(db, modulename, str(targetdir), defines={'COUNT_OP_MALLOCS': 1}) m = make_module_from_c(targetdir.join(modulename+'.c'), include_dirs = [os.path.dirname(autopath.this_dir)]) return m @@ -62,6 +62,7 @@ py.test.raises(TypeError, f1) py.test.raises(TypeError, f1, 2, 3) py.test.raises(TypeError, f1, 2, x=2) + assert module.malloc_counters() == (0, 0) def test_rlist(): @@ -83,3 +84,5 @@ f1 = getattr(module, entrypoint) assert f1(5) == 30 assert f1(x=5) == 30 + mallocs, frees = module.malloc_counters() + assert mallocs == frees From ludal at codespeak.net Mon May 30 16:50:36 2005 From: ludal at codespeak.net (ludal at codespeak.net) Date: Mon, 30 May 2005 16:50:36 +0200 (CEST) Subject: [pypy-svn] r12890 - in pypy/branch/pycompiler: annotation annotation/test documentation documentation/image interpreter lib module/unicodedata objspace/flow objspace/std rpython rpython/test tool translator translator/c translator/c/test translator/genc translator/genc/test translator/goal translator/llvm translator/llvm/test translator/pickle translator/pickle/attic translator/test Message-ID: <20050530145036.DCBE627B82@code1.codespeak.net> Author: ludal Date: Mon May 30 16:50:36 2005 New Revision: 12890 Added: pypy/branch/pycompiler/documentation/image/ - copied from r12888, pypy/dist/pypy/documentation/image/ pypy/branch/pycompiler/documentation/image/translation.sxd (props changed) - copied unchanged from r12888, pypy/dist/pypy/documentation/image/translation.sxd pypy/branch/pycompiler/rpython/lltype.py (props changed) - copied unchanged from r12888, pypy/dist/pypy/rpython/lltype.py pypy/branch/pycompiler/rpython/rbool.py - copied unchanged from r12888, pypy/dist/pypy/rpython/rbool.py pypy/branch/pycompiler/rpython/rbuiltin.py (props changed) - copied unchanged from r12888, pypy/dist/pypy/rpython/rbuiltin.py pypy/branch/pycompiler/rpython/rfloat.py - copied unchanged from r12888, pypy/dist/pypy/rpython/rfloat.py pypy/branch/pycompiler/rpython/rint.py (props changed) - copied unchanged from r12888, pypy/dist/pypy/rpython/rint.py pypy/branch/pycompiler/rpython/robject.py (props changed) - copied unchanged from r12888, pypy/dist/pypy/rpython/robject.py pypy/branch/pycompiler/rpython/rpbc.py (props changed) - copied unchanged from r12888, pypy/dist/pypy/rpython/rpbc.py pypy/branch/pycompiler/rpython/rptr.py (props changed) - copied unchanged from r12888, pypy/dist/pypy/rpython/rptr.py pypy/branch/pycompiler/rpython/rtyper.py (props changed) - copied unchanged from r12888, pypy/dist/pypy/rpython/rtyper.py pypy/branch/pycompiler/rpython/test/snippet.py - copied unchanged from r12888, pypy/dist/pypy/rpython/test/snippet.py pypy/branch/pycompiler/rpython/test/test_lltype.py (props changed) - copied unchanged from r12888, pypy/dist/pypy/rpython/test/test_lltype.py pypy/branch/pycompiler/rpython/test/test_rbool.py - copied unchanged from r12888, pypy/dist/pypy/rpython/test/test_rbool.py pypy/branch/pycompiler/rpython/test/test_rfloat.py - copied unchanged from r12888, pypy/dist/pypy/rpython/test/test_rfloat.py pypy/branch/pycompiler/rpython/test/test_rint.py - copied unchanged from r12888, pypy/dist/pypy/rpython/test/test_rint.py pypy/branch/pycompiler/rpython/test/test_rtyper.py (props changed) - copied unchanged from r12888, pypy/dist/pypy/rpython/test/test_rtyper.py pypy/branch/pycompiler/translator/c/genc.py (props changed) - copied unchanged from r12888, pypy/dist/pypy/translator/c/genc.py pypy/branch/pycompiler/translator/c/int_include.h (props changed) - copied unchanged from r12888, pypy/dist/pypy/translator/c/int_include.h pypy/branch/pycompiler/translator/c/ll_include.h - copied unchanged from r12888, pypy/dist/pypy/translator/c/ll_include.h pypy/branch/pycompiler/translator/c/test/test_genc.py (props changed) - copied unchanged from r12888, pypy/dist/pypy/translator/c/test/test_genc.py pypy/branch/pycompiler/translator/c/wrapper.py (props changed) - copied unchanged from r12888, pypy/dist/pypy/translator/c/wrapper.py pypy/branch/pycompiler/translator/llvm/reprmap.py - copied unchanged from r12888, pypy/dist/pypy/translator/llvm/reprmap.py pypy/branch/pycompiler/translator/pickle/ - copied from r12888, pypy/dist/pypy/translator/pickle/ pypy/branch/pycompiler/translator/pickle/__init__.py - copied unchanged from r12888, pypy/dist/pypy/translator/pickle/__init__.py pypy/branch/pycompiler/translator/pickle/attic/ - copied from r12888, pypy/dist/pypy/translator/pickle/attic/ pypy/branch/pycompiler/translator/pickle/attic/genpickle.py (props changed) - copied unchanged from r12888, pypy/dist/pypy/translator/pickle/attic/genpickle.py pypy/branch/pycompiler/translator/pickle/genpickle.py - copied unchanged from r12888, pypy/dist/pypy/translator/pickle/genpickle.py Removed: pypy/branch/pycompiler/rpython/lltypes.py pypy/branch/pycompiler/rpython/test/test_lltypes.py pypy/branch/pycompiler/rpython/test/test_typer.py pypy/branch/pycompiler/rpython/typer.py Modified: pypy/branch/pycompiler/annotation/binaryop.py pypy/branch/pycompiler/annotation/bookkeeper.py pypy/branch/pycompiler/annotation/builtin.py pypy/branch/pycompiler/annotation/model.py pypy/branch/pycompiler/annotation/test/test_model.py pypy/branch/pycompiler/annotation/unaryop.py pypy/branch/pycompiler/documentation/_ref.txt pypy/branch/pycompiler/documentation/coding-guide.txt pypy/branch/pycompiler/documentation/objspace.txt pypy/branch/pycompiler/documentation/redirections pypy/branch/pycompiler/documentation/translation.txt pypy/branch/pycompiler/interpreter/compiler.py pypy/branch/pycompiler/lib/inprogress__codecs.py pypy/branch/pycompiler/lib/unicodecodec.py pypy/branch/pycompiler/module/unicodedata/CompositionExclusions-3.2.0.txt (props changed) pypy/branch/pycompiler/module/unicodedata/CompositionExclusions-4.1.0.txt (props changed) pypy/branch/pycompiler/module/unicodedata/UnicodeData-3.2.0.txt (props changed) pypy/branch/pycompiler/module/unicodedata/UnicodeData-4.1.0.txt (props changed) pypy/branch/pycompiler/objspace/flow/model.py pypy/branch/pycompiler/objspace/std/inttype.py pypy/branch/pycompiler/objspace/std/unicodetype.py pypy/branch/pycompiler/rpython/rlist.py pypy/branch/pycompiler/rpython/test/test_llann.py pypy/branch/pycompiler/rpython/test/test_rlist.py pypy/branch/pycompiler/tool/sourcetools.py pypy/branch/pycompiler/translator/annrpython.py pypy/branch/pycompiler/translator/c/database.py pypy/branch/pycompiler/translator/c/funcgen.py pypy/branch/pycompiler/translator/c/g_include.h pypy/branch/pycompiler/translator/c/g_module.h pypy/branch/pycompiler/translator/c/g_support.h pypy/branch/pycompiler/translator/c/node.py pypy/branch/pycompiler/translator/c/primitive.py pypy/branch/pycompiler/translator/c/pyobj.py pypy/branch/pycompiler/translator/c/support.py pypy/branch/pycompiler/translator/c/test/test_database.py pypy/branch/pycompiler/translator/genc/ctyper.py pypy/branch/pycompiler/translator/genc/lltype.py pypy/branch/pycompiler/translator/genc/test/test_lltyped.py pypy/branch/pycompiler/translator/goal/translate_pypy.py pypy/branch/pycompiler/translator/llvm/build_llvm_module.py pypy/branch/pycompiler/translator/llvm/classrepr.py pypy/branch/pycompiler/translator/llvm/funcrepr.py pypy/branch/pycompiler/translator/llvm/genllvm.py pypy/branch/pycompiler/translator/llvm/llvmbc.py pypy/branch/pycompiler/translator/llvm/pbcrepr.py pypy/branch/pycompiler/translator/llvm/representation.py pypy/branch/pycompiler/translator/llvm/test/test_class.py pypy/branch/pycompiler/translator/llvm/test/test_genllvm.py pypy/branch/pycompiler/translator/llvm/test/test_seq.py pypy/branch/pycompiler/translator/llvm/test/test_snippet.py pypy/branch/pycompiler/translator/llvm/typerepr.py pypy/branch/pycompiler/translator/test/test_annrpython.py Log: * merge modifications from trunk: 12758:12888 Modified: pypy/branch/pycompiler/annotation/binaryop.py ============================================================================== --- pypy/branch/pycompiler/annotation/binaryop.py (original) +++ pypy/branch/pycompiler/annotation/binaryop.py Mon May 30 16:50:36 2005 @@ -84,7 +84,8 @@ def inplace_floordiv((obj1, obj2)): return pair(obj1, obj2).floordiv() def inplace_div((obj1, obj2)): return pair(obj1, obj2).div() def inplace_mod((obj1, obj2)): return pair(obj1, obj2).mod() - def inplace_pow((obj1, obj2), obj3):return pair(obj1, obj2).pow(obj3) + def inplace_pow((obj1, obj2)): return pair(obj1, obj2).pow( + SomePBC({None: True})) def inplace_lshift((obj1, obj2)): return pair(obj1, obj2).lshift() def inplace_rshift((obj1, obj2)): return pair(obj1, obj2).rshift() def inplace_and((obj1, obj2)): return pair(obj1, obj2).and_() @@ -477,7 +478,6 @@ return pair(s, pbc).union() # annotation of low-level types -from pypy.rpython import lltypes from pypy.annotation.model import SomePtr, ll_to_annotation class __extend__(pairtype(SomePtr, SomePtr)): Modified: pypy/branch/pycompiler/annotation/bookkeeper.py ============================================================================== --- pypy/branch/pycompiler/annotation/bookkeeper.py (original) +++ pypy/branch/pycompiler/annotation/bookkeeper.py Mon May 30 16:50:36 2005 @@ -16,7 +16,6 @@ from pypy.interpreter.pycode import cpython_code_signature from pypy.interpreter.argument import ArgErr from pypy.rpython.rarithmetic import r_uint -from pypy.rpython import lltypes from pypy.tool.unionfind import UnionFind import inspect, new @@ -224,8 +223,6 @@ def valueoftype(self, t): """The most precise SomeValue instance that contains all objects of type t.""" - if isinstance(t, lltypes.LowLevelType): - return ll_to_annotation(t._example()) assert isinstance(t, (type, ClassType)) if t is bool: return SomeBool() @@ -411,10 +408,12 @@ except KeyError: if isinstance(thing, FunctionType): # XXX XXX XXX HAAAAAAAAAAAACK - # xxx we need a way to let know subsequent phases (the generator) about the specialized function - # the caller flowgraph as it is doesn't. - # This line just avoids that the flowgraph of the original function, which is what will be considered - # and compiled for now will be computed during generation itself + # xxx we need a way to let know subsequent phases (the + # generator) about the specialized function. + # The caller flowgraph, as it is, doesn't know. + # This line just avoids that the flowgraph of the original + # function (which is what will be considered and compiled for + # now) will be computed during generation itself. self.annotator.translator.getflowgraph(thing) # thing = func_with_new_name(thing, name or thing.func_name) Modified: pypy/branch/pycompiler/annotation/builtin.py ============================================================================== --- pypy/branch/pycompiler/annotation/builtin.py (original) +++ pypy/branch/pycompiler/annotation/builtin.py Mon May 30 16:50:36 2005 @@ -9,6 +9,7 @@ from pypy.annotation.model import SomeList, SomeString, SomeTuple, SomeSlice from pypy.annotation.model import SomeUnicodeCodePoint from pypy.annotation.model import SomeFloat, unionof +from pypy.annotation.model import annotation_to_lltype from pypy.annotation.bookkeeper import getbookkeeper from pypy.objspace.flow.model import Constant import pypy.rpython.rarithmetic @@ -247,15 +248,15 @@ # annotation of low-level types from pypy.annotation.model import SomePtr -from pypy.rpython import lltypes +from pypy.rpython import lltype def malloc(T, n=None): assert n is None or n.knowntype == int assert T.is_constant() if n is not None: n = 1 - p = lltypes.malloc(T.const, n) - r = SomePtr(lltypes.typeOf(p)) + p = lltype.malloc(T.const, n) + r = SomePtr(lltype.typeOf(p)) #print "MALLOC", r return r @@ -263,7 +264,7 @@ #print "CAST", s_p assert isinstance(s_p, SomePtr), "casting of non-pointer: %r" % s_p assert PtrT.is_constant() - return SomePtr(ll_ptrtype=lltypes.typeOf(lltypes.cast_flags(PtrT.const, s_p.ll_ptrtype._example()))) + return SomePtr(ll_ptrtype=lltype.typeOf(lltype.cast_flags(PtrT.const, s_p.ll_ptrtype._example()))) def cast_parent(PtrT, s_p): assert isinstance(s_p, SomePtr), "casting of non-pointer: %r" % s_p @@ -272,9 +273,14 @@ parent_p = PtrT._example() candidate_p = s_p.ll_ptrtype._example() parent_p._setfirst(candidate_p) - return SomePtr(ll_ptrtype=lltypes.typeOf(lltypes.cast_parent(PtrT, candidate_p))) + return SomePtr(ll_ptrtype=lltype.typeOf(lltype.cast_parent(PtrT, candidate_p))) -BUILTIN_ANALYZERS[lltypes.malloc] = malloc -BUILTIN_ANALYZERS[lltypes.cast_flags] = cast_flags -BUILTIN_ANALYZERS[lltypes.cast_parent] = cast_parent +def typeOf(s_val): + lltype = annotation_to_lltype(s_val, info="in typeOf(): ") + return immutablevalue(lltype) + +BUILTIN_ANALYZERS[lltype.malloc] = malloc +BUILTIN_ANALYZERS[lltype.cast_flags] = cast_flags +BUILTIN_ANALYZERS[lltype.cast_parent] = cast_parent +BUILTIN_ANALYZERS[lltype.typeOf] = typeOf Modified: pypy/branch/pycompiler/annotation/model.py ============================================================================== --- pypy/branch/pycompiler/annotation/model.py (original) +++ pypy/branch/pycompiler/annotation/model.py Mon May 30 16:50:36 2005 @@ -303,9 +303,10 @@ class SomeBuiltin(SomeObject): "Stands for a built-in function or method with special-cased analysis." knowntype = BuiltinFunctionType # == BuiltinMethodType - def __init__(self, analyser, s_self=None): + def __init__(self, analyser, s_self=None, methodname=None): self.analyser = analyser self.s_self = s_self + self.methodname = methodname class SomeImpossibleValue(SomeObject): @@ -320,14 +321,15 @@ self.ll_ptrtype = ll_ptrtype -from pypy.rpython import lltypes +from pypy.rpython import lltype annotation_to_ll_map = [ - (SomeBool(), lltypes.Bool), - (SomeInteger(), lltypes.Signed), - (SomeInteger(nonneg=True, unsigned=True), lltypes.Unsigned), - (SomeChar(), lltypes.Char), - (SomePBC({None: True}), lltypes.Void), + (SomeBool(), lltype.Bool), + (SomeInteger(), lltype.Signed), + (SomeInteger(nonneg=True, unsigned=True), lltype.Unsigned), + (SomeFloat(), lltype.Float), + (SomeChar(), lltype.Char), + (SomePBC({None: True}), lltype.Void), ] def annotation_to_lltype(s_val, info=None): @@ -348,13 +350,16 @@ def ll_to_annotation(v): if v is None: raise ValueError, "cannot retrieve Void low-level type value" - typ = lltypes.typeOf(v) + typ = lltype.typeOf(v) s = ll_to_annotation_map.get(typ) if s is None: return SomePtr(typ) else: return s +def lltype_to_annotation(T): + return ll_to_annotation(T._example()) + # ____________________________________________________________ Modified: pypy/branch/pycompiler/annotation/test/test_model.py ============================================================================== --- pypy/branch/pycompiler/annotation/test/test_model.py (original) +++ pypy/branch/pycompiler/annotation/test/test_model.py Mon May 30 16:50:36 2005 @@ -103,21 +103,21 @@ assert s1 != s2 def test_ll_to_annotation(): - s_z = ll_to_annotation(lltypes.Signed._defl()) + s_z = ll_to_annotation(lltype.Signed._defl()) s_s = SomeInteger() s_u = SomeInteger(nonneg=True, unsigned=True) assert s_z.contains(s_s) assert not s_z.contains(s_u) - s_uz = ll_to_annotation(lltypes.Unsigned._defl()) + s_uz = ll_to_annotation(lltype.Unsigned._defl()) assert s_uz.contains(s_u) - assert ll_to_annotation(lltypes.Bool._defl()).contains(SomeBool()) - assert ll_to_annotation(lltypes.Char._defl()).contains(SomeChar()) - S = lltypes.GcStruct('s') - A = lltypes.GcArray() - s_p = ll_to_annotation(lltypes.malloc(S)) - assert isinstance(s_p, SomePtr) and s_p.ll_ptrtype == lltypes.GcPtr(S) - s_p = ll_to_annotation(lltypes.malloc(A, 0)) - assert isinstance(s_p, SomePtr) and s_p.ll_ptrtype == lltypes.GcPtr(A) + assert ll_to_annotation(lltype.Bool._defl()).contains(SomeBool()) + assert ll_to_annotation(lltype.Char._defl()).contains(SomeChar()) + S = lltype.GcStruct('s') + A = lltype.GcArray() + s_p = ll_to_annotation(lltype.malloc(S)) + assert isinstance(s_p, SomePtr) and s_p.ll_ptrtype == lltype.GcPtr(S) + s_p = ll_to_annotation(lltype.malloc(A, 0)) + assert isinstance(s_p, SomePtr) and s_p.ll_ptrtype == lltype.GcPtr(A) def test_annotation_to_lltype(): from pypy.rpython.rarithmetic import r_uint @@ -128,25 +128,25 @@ s_u = SomeInteger(nonneg=True, unsigned=True); s_u1 = SomeInteger(nonneg=True, unsigned=True); s_u1.const = r_uint(1) - assert annotation_to_lltype(s_i) == lltypes.Signed - assert annotation_to_lltype(s_pos) == lltypes.Signed - assert annotation_to_lltype(s_1) == lltypes.Signed - assert annotation_to_lltype(s_m1) == lltypes.Signed - assert annotation_to_lltype(s_u) == lltypes.Unsigned - assert annotation_to_lltype(s_u1) == lltypes.Unsigned - assert annotation_to_lltype(SomeBool()) == lltypes.Bool - assert annotation_to_lltype(SomeChar()) == lltypes.Char - PS = lltypes.GcPtr(lltypes.GcStruct('s')) + assert annotation_to_lltype(s_i) == lltype.Signed + assert annotation_to_lltype(s_pos) == lltype.Signed + assert annotation_to_lltype(s_1) == lltype.Signed + assert annotation_to_lltype(s_m1) == lltype.Signed + assert annotation_to_lltype(s_u) == lltype.Unsigned + assert annotation_to_lltype(s_u1) == lltype.Unsigned + assert annotation_to_lltype(SomeBool()) == lltype.Bool + assert annotation_to_lltype(SomeChar()) == lltype.Char + PS = lltype.GcPtr(lltype.GcStruct('s')) s_p = SomePtr(ll_ptrtype=PS) assert annotation_to_lltype(s_p) == PS py.test.raises(ValueError, "annotation_to_lltype(si0)") def test_ll_union(): - PS1 = lltypes.GcPtr(lltypes.GcStruct('s')) - PS2 = lltypes.GcPtr(lltypes.GcStruct('s')) - PS3 = lltypes.GcPtr(lltypes.GcStruct('s3')) - PA1 = lltypes.GcPtr(lltypes.GcArray()) - PA2 = lltypes.GcPtr(lltypes.GcArray()) + PS1 = lltype.GcPtr(lltype.GcStruct('s')) + PS2 = lltype.GcPtr(lltype.GcStruct('s')) + PS3 = lltype.GcPtr(lltype.GcStruct('s3')) + PA1 = lltype.GcPtr(lltype.GcArray()) + PA2 = lltype.GcPtr(lltype.GcArray()) assert unionof(SomePtr(PS1),SomePtr(PS1)) == SomePtr(PS1) assert unionof(SomePtr(PS1),SomePtr(PS2)) == SomePtr(PS2) Modified: pypy/branch/pycompiler/annotation/unaryop.py ============================================================================== --- pypy/branch/pycompiler/annotation/unaryop.py (original) +++ pypy/branch/pycompiler/annotation/unaryop.py Mon May 30 16:50:36 2005 @@ -102,7 +102,7 @@ def find_method(obj, name): "Look for a special-case implementation for the named method." analyser = getattr(obj.__class__, 'method_' + name) - return SomeBuiltin(analyser, obj) + return SomeBuiltin(analyser, obj, name) def getattr(obj, s_attr): # get a SomeBuiltin if the SomeObject has @@ -435,7 +435,6 @@ pass # annotation of low-level types -from pypy.rpython import lltypes from pypy.annotation.model import SomePtr, ll_to_annotation, annotation_to_lltype class __extend__(SomePtr): Modified: pypy/branch/pycompiler/documentation/_ref.txt ============================================================================== --- pypy/branch/pycompiler/documentation/_ref.txt (original) +++ pypy/branch/pycompiler/documentation/_ref.txt Mon May 30 16:50:36 2005 @@ -1,8 +1,8 @@ -.. _`issue40`: http://codespeak.net/issue/pypy-dev/issue40 .. _`demo/`: http://codespeak.net/svn/pypy/dist/demo .. _`lib-python/`: http://codespeak.net/svn/pypy/dist/lib-python .. _`pypy/annotation`: .. _`annotation/`: http://codespeak.net/svn/pypy/dist/pypy/annotation +.. _`annotation/binaryop.py`: http://codespeak.net/svn/pypy/dist/pypy/annotation/binaryop.py .. _`documentation/`: http://codespeak.net/svn/pypy/dist/pypy/documentation .. _`documentation/revreport/`: http://codespeak.net/svn/pypy/dist/pypy/documentation/revreport .. _`documentation/website/`: http://codespeak.net/svn/pypy/dist/pypy/documentation/website @@ -26,9 +26,11 @@ .. _`pypy/objspace/std`: .. _`objspace/std/`: http://codespeak.net/svn/pypy/dist/pypy/objspace/std .. _`objspace/thunk.py`: http://codespeak.net/svn/pypy/dist/pypy/objspace/thunk.py -.. _`objspace/trace.py`: -.. _`pypy/objspace/trace.py`: http://codespeak.net/svn/pypy/dist/pypy/objspace/trace.py +.. _`pypy/objspace/trace.py`: +.. _`objspace/trace.py`: http://codespeak.net/svn/pypy/dist/pypy/objspace/trace.py .. _`rpython/`: http://codespeak.net/svn/pypy/dist/pypy/rpython +.. _`rpython/lltype.py`: http://codespeak.net/svn/pypy/dist/pypy/rpython/lltype.py +.. _`rpython/rlist.py`: http://codespeak.net/svn/pypy/dist/pypy/rpython/rlist.py .. _`pypy/test_all.py`: http://codespeak.net/svn/pypy/dist/pypy/test_all.py .. _`tool/`: http://codespeak.net/svn/pypy/dist/pypy/tool .. _`tool/pytest/`: http://codespeak.net/svn/pypy/dist/pypy/tool/pytest Modified: pypy/branch/pycompiler/documentation/coding-guide.txt ============================================================================== --- pypy/branch/pycompiler/documentation/coding-guide.txt (original) +++ pypy/branch/pycompiler/documentation/coding-guide.txt Mon May 30 16:50:36 2005 @@ -732,8 +732,8 @@ includes w_self. Don't use ``w_`` in application level python only code. -Committing ----------- +Committing & Branching to the repository +----------------------------------------------------- - write good log messages because several people are reading the diffs. @@ -743,6 +743,19 @@ that the property 'svn:eol-style' is set to native which allows checkin/checkout in native line-ending format. +- branching (aka "svn copy") of source code should usually + happen at ``svn/pypy/dist`` level in order to have a full + self-contained pypy checkout for each branch. For branching + a ``try1`` branch you would for example do:: + + svn cp http://codespeak.net/svn/pypy/dist \ + http://codespeak.net/svn/pypy/branch/try1 + + This allows to checkout the ``try1`` branch and receive a + self-contained working-copy for the branch. Note that + branching/copying is a cheap operation with subversion, as it + takes constant time irrespective of the size of the tree. + - To learn more about how to use subversion read `this document`_. .. _`this document`: svn-help.html Modified: pypy/branch/pycompiler/documentation/objspace.txt ============================================================================== --- pypy/branch/pycompiler/documentation/objspace.txt (original) +++ pypy/branch/pycompiler/documentation/objspace.txt Mon May 30 16:50:36 2005 @@ -269,7 +269,7 @@ ->> _`flow object space`: +.. _`flow object space`: The Flow Object Space ===================== Modified: pypy/branch/pycompiler/documentation/redirections ============================================================================== --- pypy/branch/pycompiler/documentation/redirections (original) +++ pypy/branch/pycompiler/documentation/redirections Mon May 30 16:50:36 2005 @@ -25,5 +25,7 @@ 'basicblock.asc' : 'objspace.html#the-flow-model', 'coding-style.html' : 'coding-guide.html', + + 'controlflow.html' : 'objspace.html#the-flow-model', } Modified: pypy/branch/pycompiler/documentation/translation.txt ============================================================================== --- pypy/branch/pycompiler/documentation/translation.txt (original) +++ pypy/branch/pycompiler/documentation/translation.txt Mon May 30 16:50:36 2005 @@ -384,7 +384,7 @@ +++++++++++++++++++++++++++++++++++++++ Constants in the flowgraph are annotated with a corresponding -``SomeXxx`` instance with 'const' attribute set to the their value. +``SomeXxx`` instance with 'const' attribute set to their value. Constant instances of user-defined classes, callables (which include functions but also class types themself) and staticmethod are treated @@ -465,35 +465,85 @@ v3 = int_add(v1, v2) -where -- in C notation -- all three variables v1, v2 and v3 are typed ``int``. This is done by attaching an attribute ``concretetype`` to v1, v2 and v3 (which might be instances of Variable or possibly Constant). In our model, this ``concretetype`` is ``pypy.rpython.lltypes.Signed``. Of course, the purpose of replacing the operation called ``add`` with ``int_add`` is that code generators no longer have to worry about what kind of addition (or concatenation maybe?) it means. +where -- in C notation -- all three variables v1, v2 and v3 are typed ``int``. This is done by attaching an attribute ``concretetype`` to v1, v2 and v3 (which might be instances of Variable or possibly Constant). In our model, this ``concretetype`` is ``pypy.rpython.lltype.Signed``. Of course, the purpose of replacing the operation called ``add`` with ``int_add`` is that code generators no longer have to worry about what kind of addition (or concatenation maybe?) it means. The process in more details --------------------------- -The RPython Typer does the following transformations for each block of all the annotated flow graphs (each block is processed independently, by assuming that the already-computed annotations are globally correct): +The RPython Typer has a structure similar to that of the Annotator_: both consider each block of the flow graphs in turn, and perform some analysis on each operation. In both cases the analysis of an operation depends on the annotations of its input arguments. This is reflected in the usage of the same ``__extend__`` syntax in the source files (compare e.g. `annotation/binaryop.py`_ and `rpython/rlist.py`_). -* We first replace all Variables that have constant annotations with real Constants in the flow graph. +The analogy stops here, though: while it runs, the Annotator is in the middle of computing the annotations, so it might need to reflow and generalize until a fixpoint is reached. The Typer, by contrast, works on the final annotations that the Annotator computed, without changing them, assuming that they are globally consistent. There is no need to reflow: the Typer considers each block only once. And unlike the Annotator, the Typer completely modifies the flow graph, by replacing each operation with some low-level operations. -* For the time being, we assume that each SomeXxx annotation has a canonical low-level representation. For example, all variables annotated with SomeInteger() will correspond to the ``Signed`` low-level type. Each input argument of the block are tagged with the canonical low-level representation (this is done by attaching an attribute ``concretetype`` to each Variable). - -* Each operation, with its argument's annotation, is looked up in a table which specifies with which low-level operation(s) it should be substituted. If needed, the arguments are first converted (with extra operations) from their current ``concretetype`` to the required low-level types. For constant arguments, we just attach the ``concretetype`` to the Constant instance; as for Variables, this tells the code generator of which type the constant really is. Finally, the substitution rules specify the ``concretetype`` of the result. It is attached to the result Variable, and will be used further down the block to detect when conversions are needed. - -* When a block has been transformed in this way, all the links are considered; if the concrete types of the Variables that exit do not match the canonical low-level types expected by the target block, conversions are inserted -- they are put in a new block inserted along the link, as they are of no concern to the other exit links. - -This may look like flowing, similar to what the annotator does, but it is limited to a single block; for global coherency it trusts the more involved fixpoint-based algorithm run by the annotator. +The main assumption of the RTyper, for the time being, is that each SomeXxx annotation has a canonical low-level representation. For example, all variables annotated with SomeInteger() will correspond to the ``Signed`` low-level type. The RTyper computes the canonical low-level type for each Variable based on its annotation, and stores it in the attribute ``concretetype``. It also computes a ``concretetype`` for Constants, to match the way they are used in the low-level operations (for example, ``int_add(x, 1)`` requires a ``Constant(1)`` with ``concretetype=Signed``, but an untyped ``add(x, 1)`` works with a ``Constant(1)`` that must actually be a PyObject at run-time). Low-Level Types --------------- -For now, the RPython Typer uses a standard low-level model which we believe can correspond rather directly to various target languages from C to LLVM to Java. This model is implemented in the first part of `lltypes.py`_. +The RPython Typer uses a standard low-level model which we believe can correspond rather directly to various target languages from C to LLVM to Java. This model is implemented in the first part of `rpython/lltype.py`_. -The second part of `lltypes.py`_ is a runnable implementation of these types, for testing purposes. It allows us to write and test plain Python code using a malloc() function to obtain and manipulate structures and arrays. This is useful for example to implement RPython types like 'list' with its operations and methods. +The second part of `rpython/lltype.py`_ is a runnable implementation of these types, for testing purposes. It allows us to write and test plain Python code using a malloc() function to obtain and manipulate structures and arrays. This is useful for example to implement RPython types like 'list' with its operations and methods. The basic assumption is that Variables (i.e. local variables and function arguments and return value) all contain "simple" values: basically, just integers or pointers. All the "container" data structures (struct and array) are allocated in the heap, and they are always manipulated via pointers. (There is no equivalent to the C notion of local variable of a ``struct`` type.) -.. _`lltypes.py`: http://codespeak.net/svn/pypy/dist/pypy/rpython/lltypes.py +Here is a quick tour:: + + >>> from pypy.rpython.lltype import * + +(The module is called ``lltypes`` in PyPy release 0.6.) + +Here are a few primitive low-level types, and the typeOf() function to figure them out:: + + >>> Signed + + >>> typeOf(5) + + >>> typeOf(r_uint(12)) + + >>> typeOf('x') + + +Let's say that we want to build a type "point", which is a structure with two integer fields "x" and "y":: + + >>> POINT = GcStruct('point', ('x', Signed), ('y', Signed)) + >>> POINT + + +The structure is a ``GcStruct``, which means a structure that can be allocated in the heap and eventually freed by some garbage collector. (For platforms where we use reference counting, think about ``GcStruct`` as a struct with an additional reference counter field.) (NB. in PyPy release 0.6, GcStruct and GcArray don't exist; you must use Struct and Array instead.) + +Giving a name ('point') to the GcStruct is only for clarity: it is used in the representation. + + >>> p = malloc(POINT) + >>> p + <_ptrtype to struct point { x=0, y=0 }> + >>> p.x = 5 + >>> p.x + 5 + >>> p + <_ptrtype to struct point { x=5, y=0 }> + +``malloc()`` allocates a structure from the heap, initalizes it to 0 (currently), and returns a pointer to it. The point of all this is to work with a very limited, easily controllable set of types, and define implementations of types like list in this elementary world. The ``malloc()`` function is a kind of placeholder, which must eventually be provided by the code generator for the target platform; but as we have just seen its Python implementation in `rpython/lltype.py`_ works too, which is primarily useful for testing, interactive exploring, etc. + +The argument to ``malloc()`` is the structure type directly, but it returns a pointer to the structure, as ``typeOf()`` tells you:: + + >>> typeOf(p) + + +For the purpose of creating structures with pointers to other structures, we can declare pointer types explicitely:: + + >>> typeOf(p) == GcPtr(POINT) + True + >>> BIZARRE = GcStruct('bizarre', ('p1', GcPtr(POINT)), ('p2', GcPtr(POINT))) + >>> b = malloc(BIZARRE) + >>> b.p1 + <_ptrtype to None> + >>> b.p1 = b.p2 = p + >>> b.p1.y = 42 + >>> b.p2.y + 42 + +The world of low-level types is more complicated than integers and GcStructs, though. The next pages are a reference guide. Primitive Types @@ -519,9 +569,10 @@ Structure Types +++++++++++++++ -Structure types are built as instances of ``pypy.rpython.lltypes.Struct``:: +Structure types are built as instances of ``pypy.rpython.lltype.Struct``:: MyStructType = Struct('somename', ('field1', Type1), ('field2', Type2)...) + MyStructType = GcStruct('somename', ('field1', Type1), ('field2', Type2)...) This declares a structure (or a Pascal ``record``) containing the specified named fields with the given types. The field names cannot start with an underscore. As noted above, you cannot directly manipulate structure objects, but only pointer to structures living in the heap. @@ -529,18 +580,23 @@ A structure can also contain an inlined array (see below), but only as its last field: in this case it is a "variable-sized" structure, whose memory layout starts with the non-variable fields and ends with a variable number of array items. This number is determined when a structure is allocated in the heap. Variable-sized structures cannot be inlined in other structures. +GcStructs have a platform-specific GC header (e.g. a reference counter); only these can be malloc()ed. Structs have no header, and are suitable for being embedded ("inlined") inside other structures. As an exception, a GcStruct can be embedded as the first field of a GcStruct: the parent structure uses the same GC header as the substructure. + Array Types +++++++++++ -An array type is built as an instance of ``pypy.rpython.lltypes.Array``:: +An array type is built as an instance of ``pypy.rpython.lltype.Array``:: MyArrayType = Array(('field1', Type1), ('field2', Type2)...) + MyArrayType = GcArray(('field1', Type1), ('field2', Type2)...) The items of an array are always structures; the arguments to Array() give the fields of these structures (it can of course be a single field). The allowed field types follow the same rules as for Struct(), but this particular structure cannot be variable-sized. For now, each array stores its length explicitely in a header. An array can never be resized: it occupies a fixed amount of bytes determined when it is allocated. +GcArrays can be malloc()ed (the length must be specified when malloc() is called, and arrays cannot be resized). Plain Arrays cannot be malloc()ed but can be used as the last field of a structure, to make a variable-sized structure. The whole structure can then be malloc()ed, and the length of the array is specified at this time. + Pointer Types +++++++++++++ @@ -550,7 +606,7 @@ GcPtr(T, **flags) NonGcPtr(T, **flags) -The so-called GC pointers are the ones that hold a reference to the object they point to. Typically, the malloc() operation allocates and returns a GcPtr to a new structure or array. In a refcounting implementation, malloc() would allocate enough space for a reference counter before the actual structure, and initialize it to 1. Actually, GC pointers can only point to a malloc()ed structure or array. Non-GC pointers are used when you know that a pointer doesn't hold a (counted) reference to an object, usually because the object has no reference counter at all: for example, functions don't have one; more importantly, inlined substructures don't have one either. For them, care must be taken to ensure that the bigger structure of which they are part of isn't freed while the NonGcPtr to the substructure is still in use. +The so-called GC pointers are the ones that hold a reference to the object they point to. Only GcStruct, GcArray and PyObject can have GcPtrs to them. Typically, the malloc() operation allocates and returns a GcPtr to a new structure or array. In a refcounting implementation, malloc() would allocate enough space for a reference counter before the actual structure, and initialize it to 1. Actually, GC pointers can only point to a malloc()ed structure or array. Non-GC pointers are used when you know that a pointer doesn't hold a (counted) reference to an object, usually because the object has no reference counter at all: for example, functions don't have one; more importantly, inlined substructures don't have one either. For them, care must be taken to ensure that the bigger structure of which they are part of isn't freed while the NonGcPtr to the substructure is still in use. All pointer types can also have additional flags, whose meaning is unspecified at this level (apart from the flag ``gc=True`` which GcPtrs have and NonGcPtrs miss). Types with different flags are incompatible, but the cast_flags() operation is provided to perform explicit casts. The intention is for example to represent the high-level object "the method append() of this list" as the type ``GcPtr(ListType, method='append')`` -- i.e. a pointer to the list in question with an additional flag specifying that the pointer represents the method append() of that list, as opposed to the list itself. @@ -578,7 +634,7 @@ This list concatenation flow graph is then annotated as usual, with one difference: the annotator has to be taught about malloc() and the way the pointer thus obtained can be manipulated. This generates a flow graph which is hopefully completely annotated with the SomePtr annotation. Introduced just for this case, SomePtr maps directly to a low-level pointer type. This is the only change needed to the Annotator to allow it to perform type inferrence of our very-low-level snippets of code. -See for example http://codespeak.net/svn/pypy/dist/pypy/rpython/rlist.py. +See for example `rpython/rlist.py`_. @@ -858,15 +914,15 @@ space.setitem(g3dict, gs_g, gfunc_g) return g3dict -You see that actually a single function is produced: 'initapp2interpexec'. This is the +You see that actually a single function is produced: ``initapp2interpexec``. This is the function that you will call with a space as argument. It defines a few functions and then does a number of initialization steps, builds the global objects the function need, -and produces the interface function gfunc_g to be called from interpreter level. +and produces the interface function ``gfunc_g`` to be called from interpreter level. The return value is ``g3dict``, which contains a module name and the function we asked for. Let's have a look at the body of this code: The first definition of ``g`` is just -for the argument parsing and is used as ``f_g`` in the gateway.interp2app. +for the argument parsing and is used as ``f_g`` in the ``gateway.interp2app``. We look at the second definition, ``fastf_g``, which does the actual computation. Comparing to the flowgraph from above_, you see a code block for every block in the graph. @@ -913,9 +969,36 @@ give a bit more speed. But this is a temporary format and will get optimized anyway when we produce the executable. +Interplevel Snippets in the Sources +----------------------------------- + +.. _`_exceptions.py`: http://codespeak.net/svn/pypy/dist/pypy/lib/_exceptions.py +.. _`_classobj.py`: http://codespeak.net/svn/pypy/dist/pypy/lib/_classobj.py + +Code written in application space can consist of complete files +to be translated (`_exceptions.py`_, `_classobj.py`_), or they +can be tiny snippets scattered all over a source file, similar +to our example from above. + +Translation of these snippets is done automatically and cached +in pypy/_cache with the modulename and the md5 checksum appended +to it as file name. If you have run your copy of pypy already, +this folder should exist and have some generated files in it. +These files consist of the generated code plus a little code +that auto-destructs the cached file (plus .pyc/.pyo versions) +if it is executed as __main__. On windows this means you can wipe +a cached code snippet clear by double-clicking it. Note also that +the auto-generated __init__.py file wipes the whole directory +when executed. + +XXX this should go into some interpreter.doc, where gateway should be explained + How it works ------------ XXX to be added later + + +.. include:: _ref.txt Modified: pypy/branch/pycompiler/interpreter/compiler.py ============================================================================== --- pypy/branch/pycompiler/interpreter/compiler.py (original) +++ pypy/branch/pycompiler/interpreter/compiler.py Mon May 30 16:50:36 2005 @@ -246,7 +246,8 @@ def compile_module(self, source, filename, mode ): pass - def compile_interactive + def compile_interactive(self): + pass Compiler = PythonCompiler Modified: pypy/branch/pycompiler/lib/inprogress__codecs.py ============================================================================== --- pypy/branch/pycompiler/lib/inprogress__codecs.py (original) +++ pypy/branch/pycompiler/lib/inprogress__codecs.py Mon May 30 16:50:36 2005 @@ -34,8 +34,7 @@ Copyright (c) Corporation for National Research Initiatives. """ -from unicodecodec_ import * - +from unicodecodec import * #/* --- Registry ----------------------------------------------------------- */ codec_search_path = [] codec_search_cache = {} @@ -61,12 +60,24 @@ result = codec_search_cache.get(encoding,None) if not result: + if len(codec_search_path) == 0: + import encodings + if len(codec_search_path) == 0: + raise LookupError("no codec search functions registered: can't find encoding") + if not isinstance(encoding,str): + raise TypeError("Encoding must be a string") for search in codec_search_path: result=search(encoding) if result : - codec_search_cache[encoding] = result - break + if not( type(result) == tuple and len(result) == 4): + raise TypeError("codec search functions must return 4-tuples") + else: + codec_search_cache[encoding] = result + return result + if not result: + raise LookupError( "unknown encoding: %s" % encoding) return result + lookup = codec_lookup @@ -80,11 +91,15 @@ 'xmlcharrefreplace' as well as any other name registered with codecs.register_error that can handle ValueErrors. """ - - encoder = lookup(encoding)[0] - if encoder : - res = encoder(v,errors) - return res[0] + if isinstance(encoding,str): + encoder = lookup(encoding)[0] + if encoder and isinstance(errors,str): + res = encoder(v,errors) + return res[0] + else: + raise TypeError("Errors must be a string") + else: + raise TypeError("Encoding must be a string") def decode(obj,encoding='defaultencoding',errors='strict'): """decode(obj, [encoding[,errors]]) -> object @@ -96,12 +111,17 @@ as well as any other name registerd with codecs.register_error that is able to handle ValueErrors. """ - decoder = lookup(encoding)[1] - if decoder: - res = decoder(obj,errors) + if isinstance(encoding,str): + decoder = lookup(encoding)[1] + if decoder and isinstance(errors,str): + res = decoder(v,errors) + if not isinstance(res,tuple) or len(res) != 2: + raise TypeError("encoder must return a tuple (object,integer)") + return res[0] + else: + raise TypeError("Errors must be a string") else: - raise LookupError("No such encoding") - return res[0] + raise TypeError("Encoding must be a string") def latin_1_encode( obj,errors='strict'): """None @@ -132,7 +152,7 @@ """None """ res = PyUnicode_DecodeUTF8Stateful(data, len(data), errors, final) - res = ''.join(res) + res = u''.join(res) return res,len(res) def raw_unicode_escape_decode( data,errors='strict'): @@ -145,7 +165,7 @@ def utf_7_decode( data,errors='strict'): """None """ - res = PyUnicode_DecodeUTF7(data,errors='strict') + res = PyUnicode_DecodeUTF7(data,len(data),errors='strict') res = ''.join(res) return res,len(res) @@ -160,7 +180,7 @@ """None """ res = PyUnicode_DecodeLatin1(data,len(data),errors) - res = ''.join(res) + res = u''.join(res) return res, len(res) def utf_16_decode( data,errors='strict',final=None): @@ -182,7 +202,7 @@ """None """ res = PyUnicode_DecodeASCII(data,len(data),errors) - res = ''.join(res) + res = u''.join(res) return res, len(res) def charmap_encode(obj,errors='strict',mapping='latin-1'): Modified: pypy/branch/pycompiler/lib/unicodecodec.py ============================================================================== --- pypy/branch/pycompiler/lib/unicodecodec.py (original) +++ pypy/branch/pycompiler/lib/unicodecodec.py Mon May 30 16:50:36 2005 @@ -190,8 +190,8 @@ i+=1 if (inShift) : - outpos = p-PyUnicode_AS_UNICODE(unicode); - endinpos = size; + #XXX This aint right + endinpos = size raise UnicodeDecodeError, "unterminated shift sequence" return p @@ -232,8 +232,8 @@ else: bitsleft += 16 charsleft += ch #((ord(charsleft) << 16) | ord(ch)) - out, charsleft, bitsleft = ENCODE(out, charsleft, bitsleft) - + p, bitsleft = ENCODE(charsleft, bitsleft) + out += p ## /* If the next character is special then we dont' need to terminate ## the shift sequence. If the next character is not a BASE64 character ## or '-' then the shift sequence will be terminated implicitly and we @@ -401,22 +401,22 @@ # /* ASCII is equivalent to the first 128 ordinals in Unicode. */ if (size == 1 and ord(s) < 128) : - return PyUnicode_FromUnicode(unicode(s), 1) + return [unichr(ord(s))] if (size == 0): - return unicode('') + return [u''] #unicode('') p = [] pos = 0 while pos < len(s): c = s[pos] if ord(c) < 128: - p += c + p += unichr(ord(c)) pos += 1 else: res = unicode_call_errorhandler( errors, "ascii", "ordinal not in range(128)", s, pos, pos+1) - p += res[0] + p += unicode(res[0]) pos = res[1] return p @@ -565,7 +565,7 @@ p = [] bom = sys.byteorder - if (byteorder == 0): + if (byteorder == 'native'): bom = sys.byteorder p += STORECHAR(0xFEFF,bom) @@ -573,12 +573,12 @@ if (size == 0): return "" - if (byteorder == -1): + if (byteorder == 'little' ): bom = 'little' - elif (byteorder == 1): + elif (byteorder == 'big'): bom = 'big' - + for c in s: ch = ord(c) ch2 = 0 @@ -845,7 +845,7 @@ def PyUnicode_EncodeUTF8(s,size,errors): - assert(s != None) + #assert(s != None) assert(size >= 0) p = [] i = 0 @@ -892,12 +892,12 @@ def PyUnicode_DecodeLatin1(s, size, errors): #/* Latin-1 is equivalent to the first 256 ordinals in Unicode. */ - if (size == 1): - return [PyUnicode_FromUnicode(s, 1)] +## if (size == 1): +## return [PyUnicode_FromUnicode(s, 1)] pos = 0 p = [] while (pos < size): - p += s[pos] + p += unichr(ord(s[pos])) pos += 1 return p @@ -911,16 +911,13 @@ encoding = "ascii" if (size == 0): - return '' + return [''] res = [] pos=0 while pos < len(p): #for ch in p: ch = p[pos] - try: - ord(ch) - except TypeError: - print "Typeerror",ch,type(ch) + if ord(ch) < limit: res += chr(ord(ch)) pos += 1 @@ -933,6 +930,7 @@ x = unicode_call_errorhandler(errors,encoding,reason,p,collstart,collend,False) res += str(x[0]) pos = x[1] + return res def PyUnicode_EncodeLatin1(p,size,errors): @@ -983,7 +981,7 @@ if (size == 0): return u'' - + p = [] pos = 0 while (pos < size): @@ -1044,7 +1042,7 @@ # /* \UXXXXXXXX */ elif ch == 'U': - digits = 8; + digits = 8 message = "truncated \\UXXXXXXXX escape"; x = hexescape(s,pos+1,digits,message,errors) p += x[0] @@ -1052,6 +1050,7 @@ ## /* \N{name} */ elif ch == 'N': message = "malformed \\N character escape" + pos += 1 try: import unicodedata except ImportError: @@ -1068,8 +1067,9 @@ look += 1 try: chr = unicodedata.lookup(s[pos:look]) + #x = hexescape(chr,pos+1,8,message,errors) except KeyError: - x=unicode_call_errorhandler(errors,"unicodeescape",message,s,pos-1,size) + x=unicode_call_errorhandler(errors,"unicodeescape",message,s,pos-1,look) else: x = hexescape(s,pos+1,look-pos,message,errors) p += x[0] @@ -1115,15 +1115,13 @@ rep = mapping[c] - if not rep: - raise UnicodeError if isinstance(rep,(int,long)): if rep<256: return chr(rep) else: raise TypeError - elif isinstance(rep,unicode): - raise TypeError +## elif isinstance(rep,unicode): +## raise TypeError else: return rep Modified: pypy/branch/pycompiler/objspace/flow/model.py ============================================================================== --- pypy/branch/pycompiler/objspace/flow/model.py (original) +++ pypy/branch/pycompiler/objspace/flow/model.py Mon May 30 16:50:36 2005 @@ -367,7 +367,7 @@ if isinstance(v, Variable): assert v in vars else: - assert v.value != last_exception + assert v.value is not last_exception #assert v.value != last_exc_value exc_links = {} if block.exitswitch is None: @@ -402,7 +402,7 @@ assert v != block.operations[-1].result else: if not exc_link: - assert v.value != last_exception + assert v.value is not last_exception #assert v.value != last_exc_value vars_previous_blocks.update(vars) Modified: pypy/branch/pycompiler/objspace/std/inttype.py ============================================================================== --- pypy/branch/pycompiler/objspace/std/inttype.py (original) +++ pypy/branch/pycompiler/objspace/std/inttype.py Mon May 30 16:50:36 2005 @@ -29,9 +29,10 @@ except ParseStringOverflowError, e: w_longval = retry_to_w_long(space, e.parser) elif space.is_true(space.isinstance(w_value, space.w_unicode)): + from unicodeobject import unicode_to_decimal_w + string = unicode_to_decimal_w(space, w_value) try: - from unicodeobject import unicode_to_decimal_w - value = string_to_int(space, unicode_to_decimal_w(space, w_value)) + value = string_to_int(space, string) except ParseStringError, e: raise OperationError(space.w_ValueError, space.wrap(e.msg)) Modified: pypy/branch/pycompiler/objspace/std/unicodetype.py ============================================================================== --- pypy/branch/pycompiler/objspace/std/unicodetype.py (original) +++ pypy/branch/pycompiler/objspace/std/unicodetype.py Mon May 30 16:50:36 2005 @@ -53,7 +53,7 @@ encoding = sys.getdefaultencoding() decoder = codecs.getdecoder(encoding) if errors is None: - retval, lenght = decoder(obj) + retval, length = decoder(obj) else: retval, length = decoder(obj, errors) if not isinstance(retval, unicode): Deleted: /pypy/branch/pycompiler/rpython/lltypes.py ============================================================================== --- /pypy/branch/pycompiler/rpython/lltypes.py Mon May 30 16:50:36 2005 +++ (empty file) @@ -1,583 +0,0 @@ -import weakref -import py -from pypy.rpython.rarithmetic import r_uint -from pypy.tool.uid import Hashable - -class frozendict(dict): - - def __hash__(self): - items = self.items() - items.sort() - return hash(tuple(items)) - - -class LowLevelType(object): - def __eq__(self, other): - return self.__class__ is other.__class__ and self.__dict__ == other.__dict__ - def __ne__(self, other): - return not (self == other) - - def __hash__(self): - items = self.__dict__.items() - items.sort() - return hash((self.__class__,) + tuple(items)) - - def __repr__(self): - return '<%s>' % (self,) - - def __str__(self): - return self.__class__.__name__ - - def _defl(self, parent=None, parentindex=None): - raise NotImplementedError - - def _freeze_(self): - return True - - def _inline_is_varsize(self, last): - return False - - -class ContainerType(LowLevelType): - def _inline_is_varsize(self, last): - raise TypeError, "%r cannot be inlined in structure" % self - - -class Struct(ContainerType): - def __init__(self, name, *fields): - self._name = name - flds = {} - names = [] - self._arrayfld = None - for name, typ in fields: - if name.startswith('_'): - raise NameError, ("%s: field name %r should not start with " - "an underscore" % (self._name, name,)) - names.append(name) - if name in flds: - raise TypeError("%s: repeated field name" % self._name) - flds[name] = typ - if isinstance(typ, GC_CONTAINER): - if name == fields[0][0] and isinstance(self, GC_CONTAINER): - pass # can inline a GC_CONTAINER as 1st field of GcStruct - else: - raise TypeError("%s: cannot inline GC container %r" % ( - self._name, typ)) - - # look if we have an inlined variable-sized array as the last field - if fields: - for name, typ in fields[:-1]: - typ._inline_is_varsize(False) - first = False - name, typ = fields[-1] - if typ._inline_is_varsize(True): - self._arrayfld = name - self._flds = frozendict(flds) - self._names = tuple(names) - - def _inline_is_varsize(self, last): - if self._arrayfld: - raise TypeError("cannot inline a var-sized struct " - "inside another struct") - return False - - def __getattr__(self, name): - try: - return self._flds[name] - except KeyError: - raise AttributeError, 'struct %s has no field %r' % (self._name, - name) - - def _str_fields(self): - return ', '.join(['%s: %s' % (name, self._flds[name]) - for name in self._names]) - - def __str__(self): - return "%s %s { %s }" % (self.__class__.__name__, - self._name, self._str_fields()) - - def _defl(self, parent=None, parentindex=None): - return _struct(self, parent=parent, parentindex=parentindex) - - def _container_example(self): - if self._arrayfld is None: - n = None - else: - n = 1 - return _struct(self, n) - -class GcStruct(Struct): - pass - -class Array(ContainerType): - def __init__(self, *fields): - self.OF = Struct("", *fields) - if self.OF._arrayfld is not None: - raise TypeError("array cannot contain an inlined array") - - def _inline_is_varsize(self, last): - if not last: - raise TypeError("array field must be last") - return True - - def __str__(self): - return "%s of { %s }" % (self.__class__.__name__, - self.OF._str_fields(),) - - def _container_example(self): - return _array(self, 1) - -class GcArray(Array): - def _inline_is_varsize(self, last): - raise TypeError("cannot inline a GC array inside a structure") - -class FuncType(ContainerType): - def __init__(self, args, result): - for arg in args: - if isinstance(arg, ContainerType): - raise TypeError, "function arguments can only be primitives or pointers" - self.ARGS = tuple(args) - if isinstance(result, ContainerType): - raise TypeError, "function result can only be primitive or pointer" - self.RESULT = result - - def __str__(self): - args = ', '.join(map(str, self.ARGS)) - return "Func ( %s ) -> %s" % (args, self.RESULT) - - def _container_example(self): - def ex(*args): - return self.RESULT._example() - return _func(self, _callable=ex) - -class PyObjectType(ContainerType): - def __str__(self): - return "PyObject" -PyObject = PyObjectType() - -class ForwardReference(ContainerType): - def become(self, realcontainertype): - if not isinstance(realcontainertype, GC_CONTAINER): - raise TypeError("ForwardReference can only be to GcStruct or " - "GcArray, not %r" % (realcontainertype,)) - self.__class__ = realcontainertype.__class__ - self.__dict__ = realcontainertype.__dict__ - -GC_CONTAINER = (GcStruct, GcArray, PyObjectType, ForwardReference) - - -class Primitive(LowLevelType): - def __init__(self, name, default): - self._name = name - self._default = default - - def __str__(self): - return self._name - - def _defl(self, parent=None, parentindex=None): - return self._default - - _example = _defl - - -Signed = Primitive("Signed", 0) -Unsigned = Primitive("Unsigned", r_uint(0)) -Char = Primitive("Char", '\x00') -Bool = Primitive("Bool", False) -Void = Primitive("Void", None) - - -class _PtrType(LowLevelType): - def __init__(self, TO, **flags): - if not isinstance(TO, ContainerType): - raise TypeError, ("can only point to a Struct or an Array or a FuncType, " - "not to %s" % (TO,)) - if 'gc' in flags: - if not isinstance(TO, GC_CONTAINER): - raise TypeError, ("GcPtr can only point to GcStruct, GcArray or" - " PyObject, not to %s" % (TO,)) - self.TO = TO - self.flags = frozendict(flags) - - def _str_flags(self): - flags = self.flags.keys() - flags.sort() - result = [] - for flag in flags: - if self.flags[flag] is not True: - flag = '%s=%r' % (flag, self.flags[flag]) - result.append(flag) - return ', '.join(result) - - def __str__(self): - return 'ptr(%s) to %s' % (self._str_flags(), self.TO) - - def _defl(self, parent=None, parentindex=None): - return _ptr(self, None) - - def _example(self): - o = self.TO._container_example() - return _ptr(self, o) - - def withflags(self, **flags): - newflags = self.flags.copy() - newflags.update(flags) - return _PtrType(self.TO, **newflags) - -def GcPtr(TO, **flags): - return _PtrType(TO, gc=True, **flags) - -def NonGcPtr(TO, **flags): - return _PtrType(TO, **flags) - - -# ____________________________________________________________ - - -def typeOf(val): - if isinstance(val, bool): - return Bool - if isinstance(val, r_uint): - return Unsigned - if isinstance(val, int): - return Signed - if isinstance(val, str): - assert len(val) == 1 - return Char - if val is None: - return Void # maybe - return val._TYPE - -class InvalidCast(TypeError): - pass - -def cast_flags(PTRTYPE, ptr): - if not isinstance(ptr, _ptr) or not isinstance(PTRTYPE, _PtrType): - raise TypeError, "can only cast pointers to other pointers" - CURTYPE = ptr._TYPE - if CURTYPE.TO != PTRTYPE.TO: - raise TypeError, "cast_flags only between pointers to the same type" - # allowed direct casts (for others, you need several casts): - # * adding one flag - curflags = CURTYPE.flags - newflags = PTRTYPE.flags - if len(curflags) + 1 == len(newflags): - for key in curflags: - if key not in newflags or curflags[key] != newflags[key]: - raise InvalidCast(CURTYPE, PTRTYPE) - # * removing one flag - elif len(curflags) - 1 == len(newflags): - for key in newflags: - if key not in curflags or curflags[key] != newflags[key]: - raise InvalidCast(CURTYPE, PTRTYPE) - # end - else: - raise InvalidCast(CURTYPE, PTRTYPE) - return _ptr(PTRTYPE, ptr._obj) - -def cast_parent(PTRTYPE, ptr): - if not isinstance(ptr, _ptr) or not isinstance(PTRTYPE, _PtrType): - raise TypeError, "can only cast pointers to other pointers" - CURTYPE = ptr._TYPE - if CURTYPE.flags != PTRTYPE.flags: - raise TypeError("cast_parent() cannot change the flags (%s) to (%s)" - % (CURTYPE._str_flags(), PTRTYPE._str_flags())) - # * converting from TO-structure to a parent TO-structure whose first - # field is the original structure - if (not isinstance(CURTYPE.TO, Struct) or - not isinstance(PTRTYPE.TO, Struct) or - len(PTRTYPE.TO._names) == 0 or - PTRTYPE.TO._flds[PTRTYPE.TO._names[0]] != CURTYPE.TO): - raise InvalidCast(CURTYPE, PTRTYPE) - ptr._check() - parent = ptr._obj._wrparent() - PARENTTYPE = ptr._obj._wrparent_type - if getattr(parent, PARENTTYPE._names[0]) is not ptr._obj: - raise InvalidCast(CURTYPE, PTRTYPE) - return _ptr(PTRTYPE, parent) - - -def _TmpPtr(TO): - return _PtrType(TO, _tmp=True) - -def _expose(val, can_have_gc=False): - """XXX A nice docstring here""" - T = typeOf(val) - if isinstance(T, ContainerType): - assert not isinstance(T, FuncType), "functions cannot be substructures" - if can_have_gc and isinstance(T, GcStruct): - val = _ptr(GcPtr(T), val) - else: - val = _ptr(_TmpPtr(T), val) - return val - -def parentlink(container): - parent = container._parentstructure() - if parent is not None: - return parent, container._wrparent_index -## if isinstance(parent, _struct): -## for name in parent._TYPE._names: -## if getattr(parent, name) is container: -## return parent, name -## raise RuntimeError("lost ourselves") -## if isinstance(parent, _array): -## raise TypeError("cannot fish a pointer to an array item or an " -## "inlined substructure of it") -## raise AssertionError("don't know about %r" % (parent,)) - else: - return None, None - - -class _ptr(object): - - def __init__(self, TYPE, pointing_to): - self.__dict__['_TYPE'] = TYPE - self.__dict__['_T'] = TYPE.TO - self.__dict__['_obj'] = pointing_to - - def __eq__(self, other): - if not isinstance(other, _ptr): - raise TypeError("comparing pointer with %r object" % ( - type(other).__name__,)) - if self._TYPE != other._TYPE: - raise TypeError("comparing %r and %r" % (self._TYPE, other._TYPE)) - return self._obj is other._obj - - def __ne__(self, other): - return not (self == other) - - def __nonzero__(self): - return self._obj is not None - - def _check(self): - if self._obj is None: - raise RuntimeError("dereferencing 'NULL' pointer to %r" % (self._T,)) - self._obj._check() - - def __getattr__(self, field_name): # ! can only return basic or ptr ! - if isinstance(self._T, Struct): - if field_name in self._T._flds: - self._check() - o = getattr(self._obj, field_name) - can_have_gc = (field_name == self._T._names[0] and - 'gc' in self._TYPE.flags) - return _expose(o, can_have_gc) - raise AttributeError("%r instance has no field %r" % (self._T, - field_name)) - - def _setfirst(self, p): - if isinstance(self._T, Struct) and self._T._names: - if not isinstance(p, _ptr) or not isinstance(p._obj, _struct): - raise InvalidCast(typeOf(p), typeOf(self)) - field_name = self._T._names[0] - T1 = self._T._flds[field_name] - T2 = typeOf(p._obj) - if T1 != T2: - raise InvalidCast(typeOf(p), typeOf(self)) - self._check() - setattr(self._obj, field_name, p._obj) - p._obj._wrparent = weakref.ref(self._obj) - p._obj._wrparent_type = typeOf(self._obj) - return - raise TypeError("%r instance has no first field" % (self._T,)) - - def __setattr__(self, field_name, val): - if isinstance(self._T, Struct): - if field_name in self._T._flds: - T1 = self._T._flds[field_name] - T2 = typeOf(val) - if T1 != T2: - raise TypeError("%r instance field %r:\n" - "expects %r\n" - " got %r" % (self._T, field_name, T1, T2)) - self._check() - setattr(self._obj, field_name, val) - return - raise AttributeError("%r instance has no field %r" % (self._T, - field_name)) - - def __getitem__(self, i): # ! can only return basic or ptr ! - if isinstance(self._T, Array): - self._check() - if not (0 <= i < len(self._obj.items)): - raise IndexError("array index out of bounds") - o = self._obj.items[i] - return _expose(o) - raise TypeError("%r instance is not an array" % (self._T,)) - - def __setitem__(self, i, val): # ! not allowed ! - if isinstance(self._T, Array): - raise TypeError("cannot directly assign to array items") - raise TypeError("%r instance is not an array" % (self._T,)) - - def __len__(self): - if isinstance(self._T, Array): - self._check() - return len(self._obj.items) - raise TypeError("%r instance is not an array" % (self._T,)) - - def __repr__(self): - return '<%s>' % (self,) - - def __str__(self): - return '%s to %s' % (self._TYPE.__class__.__name__.lower(), self._obj) - - def __call__(self, *args): - if isinstance(self._T, FuncType): - self._check() - if len(args) != len(self._T.ARGS): - raise TypeError,"calling %r with wrong argument number: %r" % (self._T, args) - for a, ARG in zip(args, self._T.ARGS): - if typeOf(a) != ARG: - raise TypeError,"calling %r with wrong argument types: %r" % (self._T, args) - return self._obj._callable(*args) - raise TypeError("%r instance is not a function" % (self._T,)) - - -class _struct(object): - _wrparent = None - - def __init__(self, TYPE, n=None, parent=None, parentindex=None): - self._TYPE = TYPE - if n is not None and TYPE._arrayfld is None: - raise TypeError("%r is not variable-sized" % (TYPE,)) - if n is None and TYPE._arrayfld is not None: - raise TypeError("%r is variable-sized" % (TYPE,)) - for fld, typ in TYPE._flds.items(): - if isinstance(typ, Struct): - value = _struct(typ, parent=self, parentindex=fld) - elif fld == TYPE._arrayfld: - value = _array(typ, n, parent=self, parentindex=fld) - else: - value = typ._defl() - setattr(self, fld, value) - if parent is not None: - self._wrparent_type = typeOf(parent) - self._wrparent = weakref.ref(parent) - self._wrparent_index = parentindex - - def _parentstructure(self): - if self._wrparent is not None: - parent = self._wrparent() - if parent is None: - raise RuntimeError("accessing substructure %r,\n" - "but already garbage collected parent %r" - % (self, self._wrparent_type)) - return parent - return None - - def _check(self): - parent = self._parentstructure() - if parent is not None: - parent._check() - - def __repr__(self): - return '<%s>' % (self,) - - def _str_fields(self): - fields = [] - for name in self._TYPE._names: - T = self._TYPE._flds[name] - if isinstance(T, Primitive): - reprvalue = repr(getattr(self, name)) - else: - reprvalue = '...' - fields.append('%s=%s' % (name, reprvalue)) - return ', '.join(fields) - - def __str__(self): - return 'struct %s { %s }' % (self._TYPE._name, self._str_fields()) - -class _array(object): - _wrparent = None - - def __init__(self, TYPE, n, parent=None, parentindex=None): - if not isinstance(n, int): - raise TypeError, "array length must be an int" - if n < 0: - raise ValueError, "negative array length" - self._TYPE = TYPE - self.items = [TYPE.OF._defl(parent=self, parentindex=j) - for j in range(n)] - if parent is not None: - self._wrparent_type = typeOf(parent) - self._wrparent = weakref.ref(parent) - self._wrparent_index = parentindex - - def _parentstructure(self): - if self._wrparent is not None: - parent = self._wrparent() - if parent is None: - raise RuntimeError("accessing subarray %r,\n" - "but already garbage collected parent %r" - % (self, self._wrparent_type)) - return parent - return None - - def _check(self): - parent = self._parentstructure() - if parent is not None: - parent._check() - - def __repr__(self): - return '<%s>' % (self,) - - def __str__(self): - return 'array [ %s ]' % (', '.join(['{%s}' % item._str_fields() - for item in self.items]),) - -class _func(object): - def __init__(self, TYPE, **attrs): - self._TYPE = TYPE - self._name = "?" - self._callable = None - self.__dict__.update(attrs) - - def _parentstructure(self): - return None - - def _check(self): - if self._callable is None: - raise RuntimeError,"calling undefined function" - - def __repr__(self): - return '<%s>' % (self,) - - def __str__(self): - return "func %s" % self._name - -class _pyobject(Hashable): - _TYPE = PyObject - - def _parentstructure(self): - return None - - def _check(self): - pass - - def __repr__(self): - return '<%s>' % (self,) - - def __str__(self): - return "pyobject %s" % (super(_pyobject, self).__str__(),) - - -def malloc(T, n=None): - if isinstance(T, Struct): - o = _struct(T, n) - elif isinstance(T, Array): - o = _array(T, n) - else: - raise TypeError, "malloc for Structs and Arrays only" - return _ptr(GcPtr(T), o) - -def function(TYPE, name, **attrs): - if not isinstance(TYPE, FuncType): - raise TypeError, "function() for FuncTypes only" - o = _func(TYPE, _name=name, **attrs) - return _ptr(NonGcPtr(TYPE), o) - -def pyobject(obj, **flags): - T = _PtrType(PyObject, **flags) - o = _pyobject(obj) - return _ptr(T, o) Modified: pypy/branch/pycompiler/rpython/rlist.py ============================================================================== --- pypy/branch/pycompiler/rpython/rlist.py (original) +++ pypy/branch/pycompiler/rpython/rlist.py Mon May 30 16:50:36 2005 @@ -1,67 +1,97 @@ -import py -from pypy.annotation.model import * -from pypy.rpython.lltypes import * -from pypy.tool.sourcetools import compile_template - - -class ListType: - - def __init__(self, s_list): - assert isinstance(s_list, SomeList) - self.s_list = s_list - self.s_item = s_list.listdef.listitem.s_value - self.LIST = ForwardReference() - self.LISTPTR = GcPtr(self.LIST) - #self.ITEM = ... see below - - def define(self, typer): - self.ITEM = typer.annotation2concretetype(self.s_item) - LISTPTR = self.LISTPTR - LIST = self.LIST - ITEM = self.ITEM - LIST.become(GcStruct("list", - ("items", GcPtr(GcArray(('item', ITEM)))))) - - def getitem(l, i): - return l.items[i].item - - typer['getitem', self.s_list, SomeInteger()] = ( - getitem, LISTPTR, Signed, ITEM) - - def append(l, newitem): - length = len(l.items) - newitems = malloc(LIST.items.TO, length+1) - i = 0 - while i v1 = cast_flags(self) - # v2 = simple_call(v1, ...) --> v2 = simple_call(meth, v1, ...) - # - # where 'v1' becomes a pointer with the (method='method_name') flag. - # It points to 'self', but the flag modifies its meaning to - # "pointer to the method 'method_name' of self" instead of just - # "pointer to self". - # - method_name = pattern[0] - s_self = pattern[1] - method = substitution[0] - SELFPTR = substitution[1] - METHODPTR = SELFPTR.withflags(method=method_name) - s_method_name = self.annotator.bookkeeper.immutablevalue(method_name) - - self['getattr', s_self, s_method_name] = ( - 'cast_flags', SELFPTR, None, METHODPTR) - - s_method = s_self.find_method(method_name) - self[('simple_call', s_method) + pattern[2:]] = ( - method, SELFPTR) + substitution[2:] - - def maketype(self, cls, s_annotation): - try: - return self.typecache[cls, s_annotation] - except KeyError: - newtype = cls(s_annotation) - self.typecache[cls, s_annotation] = newtype - newtype.define(self) - return newtype - - def annotation2concretetype(self, s_value): - try: - return annotation_to_lltype(s_value) - except ValueError: - if isinstance(s_value, SomeList): - return self.maketype(ListType, s_value).LISTPTR - return PyObjPtr - - def convertvar(self, v, concretetype): - """Get the operation(s) needed to convert 'v' to the given type.""" - ops = [] - v_concretetype = getattr(v, 'concretetype', PyObjPtr) - if isinstance(v, Constant): - # we should never modify a Constant in-place - v = Constant(v.value) - v.concretetype = concretetype - - elif v_concretetype != concretetype: - try: - subst = self.concreteconversions[v_concretetype, concretetype] - except KeyError: - raise TyperError("cannot convert from %r\n" - "to %r" % (v_concretetype, concretetype)) - vresult = Variable() - op = SpaceOperation('?', [v], vresult) - flatten_ops(self.substitute_op(op, subst), ops) - v = vresult - - return v, ops - - def specialized_op(self, op, bindings): - assert len(op.args) == len(bindings) - - # first check for direct low-level operations on pointers - if op.args and isinstance(bindings[0], SomePtr): - PTR = bindings[0].ll_ptrtype - - if op.opname == 'getitem': - s_result = self.annotator.binding(op.result) - T = annotation_to_lltype(s_result, 'getitem') - return self.typed_op(op, [PTR, Signed], T, - newopname='getarrayitem') - - if op.opname == 'len': - return self.typed_op(op, [PTR], Signed, - newopname='getarraysize') - - if op.opname == 'getattr': - assert isinstance(op.args[1], Constant) - s_result = self.annotator.binding(op.result) - FIELD_TYPE = PTR.TO._flds[op.args[1].value] - T = annotation_to_lltype(s_result, 'getattr') - if isinstance(FIELD_TYPE, ContainerType): - newopname = 'getsubstruct' - else: - newopname = 'getfield' - return self.typed_op(op, [PTR, Void], T, newopname=newopname) - - if op.opname == 'setattr': - assert isinstance(op.args[1], Constant) - FIELD_TYPE = PTR.TO._flds[op.args[1].value] - assert not isinstance(FIELD_TYPE, ContainerType) - return self.typed_op(op, [PTR, Void, FIELD_TYPE], Void, - newopname='setfield') - - if op.opname == 'eq': - return self.typed_op(op, [PTR, PTR], Bool, - newopname='ptr_eq') - if op.opname == 'ne': - return self.typed_op(op, [PTR, PTR], Bool, - newopname='ptr_ne') - - # generic specialization based on the registration table - patternlist = self.registry.get(op.opname, []) - for pattern, substitution in patternlist: - if pattern and pattern[-1] is Ellipsis: - pattern = pattern[:-1] - if len(pattern) > len(op.args): - continue - elif len(pattern) != len(op.args): - continue - for s_match, s_value in zip(pattern, bindings): - if not s_match.contains(s_value): - break - else: - # match! - try: - return self.substitute_op(op, substitution) - except Retry: - return self.specialized_op(op, bindings) - - # specialization not found - argtypes = [self.defaultconcretetype] * len(op.args) - return self.typed_op(op, argtypes, self.defaultconcretetype) - - def substitute_op(self, op, substitution): - if isinstance(substitution, tuple): - newopname = substitution[0] - argtypes = substitution[1:-1] - resulttype = substitution[-1] - assert len(argtypes) == len(op.args) - # None in the substitution list means "remove this argument" - while None in argtypes: - argtypes = list(argtypes) - i = argtypes.index(None) - del argtypes[i] - args = list(op.args) - del args[i] - op = SpaceOperation(op.opname, args, op.result) - return self.typed_op(op, argtypes, resulttype, - newopname = newopname) - else: - assert callable(substitution), "type error in the registry tables" - return substitution(self, op) - - def typed_op(self, op, argtypes, restype, newopname=None): - if isinstance(newopname, types.FunctionType): - python_function = newopname - newargs = [Constant(python_function)] + op.args - op = SpaceOperation('simple_call', newargs, op.result) - try: - functyp = python_function.TYPE - except AttributeError: - s_returnvalue = self.annotator.build_types(python_function, - argtypes) - inferred_type = annotation_to_lltype(s_returnvalue, - info=python_function) - if inferred_type != restype: - raise TyperError("%r return type mismatch:\n" - "declared %r\n" - "inferred %r" % (python_function, - inferred_type, restype)) - functyp = NonGcPtr(FuncType(argtypes, restype)) - python_function.TYPE = functyp - argtypes = [functyp] + list(argtypes) - newopname = None - return Specializer.typed_op(self, op, argtypes, restype, newopname) - - -def substitute_malloc(typer, op): - s_result = typer.annotator.binding(op.result) - T = annotation_to_lltype(s_result, 'malloc') - if len(op.args) == 2: - substitution = 'malloc', None, Void, T - else: - substitution = 'malloc_varsize', None, Void, Signed, T - return typer.substitute_op(op, substitution) Modified: pypy/branch/pycompiler/tool/sourcetools.py ============================================================================== --- pypy/branch/pycompiler/tool/sourcetools.py (original) +++ pypy/branch/pycompiler/tool/sourcetools.py Mon May 30 16:50:36 2005 @@ -221,5 +221,17 @@ f.func_dict.update(func.func_dict) return f else: - def func_with_new_name(func, newname): - return func + raise Exception("sorry, Python 2.2 not supported") + # because we need to return a new function object -- impossible in 2.2, + # cannot create functions with closures without using veeeery strange code + +PY_IDENTIFIER = ''.join([(('0' <= chr(i) <= '9' or + 'a' <= chr(i) <= 'z' or + 'A' <= chr(i) <= 'Z') and chr(i) or '_') + for i in range(256)]) + +def valid_identifier(stuff): + stuff = str(stuff).translate(PY_IDENTIFIER) + if not stuff or ('0' <= stuff[0] <= '9'): + stuff = '_' + stuff + return stuff Modified: pypy/branch/pycompiler/translator/annrpython.py ============================================================================== --- pypy/branch/pycompiler/translator/annrpython.py (original) +++ pypy/branch/pycompiler/translator/annrpython.py Mon May 30 16:50:36 2005 @@ -435,6 +435,7 @@ if isinstance(link.exitcase, (types.ClassType, type)) \ and issubclass(link.exitcase, Exception): + assert last_exception_var and last_exc_value_var last_exception_object = annmodel.SomeObject() last_exception_object.knowntype = type if isinstance(last_exception_var, Constant): @@ -454,10 +455,10 @@ for a,v in zip(link.args,link.target.inputargs): renaming.setdefault(a, []).append(v) for a,v in zip(link.args,link.target.inputargs): - if a is last_exception_var: + if a == last_exception_var: assert in_except_block cells.append(last_exception_object) - elif a is last_exc_value_var: + elif a == last_exc_value_var: assert in_except_block cells.append(last_exc_value_object) last_exc_value_vars.append(v) Modified: pypy/branch/pycompiler/translator/c/database.py ============================================================================== --- pypy/branch/pycompiler/translator/c/database.py (original) +++ pypy/branch/pycompiler/translator/c/database.py Mon May 30 16:50:36 2005 @@ -1,7 +1,6 @@ -from pypy.rpython.lltypes import Primitive, _PtrType, typeOf -from pypy.rpython.lltypes import Struct, Array, FuncType, PyObject, Void -from pypy.rpython.lltypes import ContainerType -from pypy.rpython.typer import PyObjPtr +from pypy.rpython.lltype import Primitive, _PtrType, typeOf +from pypy.rpython.lltype import Struct, Array, FuncType, PyObject, Void +from pypy.rpython.lltype import ContainerType from pypy.objspace.flow.model import Constant from pypy.translator.c.primitive import PrimitiveName, PrimitiveType from pypy.translator.c.primitive import PrimitiveErrorValue @@ -14,13 +13,13 @@ class LowLevelDatabase: - def __init__(self): + def __init__(self, rtyper=None): self.structdefnodes = {} self.structdeflist = [] self.containernodes = {} self.containerlist = [] self.namespace = CNameManager() - self.pyobjmaker = PyObjMaker(self.namespace, self.get) + self.pyobjmaker = PyObjMaker(self.namespace, self.get, rtyper) def gettypedefnode(self, T, varlength=1): if varlength <= 1: @@ -103,6 +102,28 @@ else: raise Exception("don't know about %r" % (obj,)) + def cincrefstmt(self, expr, T): + if isinstance(T, _PtrType) and 'gc' in T.flags: + if T.TO == PyObject: + return 'Py_INCREF(%s);' % expr + else: + defnode = self.gettypedefnode(T.TO) + if defnode.refcount is not None: + return '%s->%s++;' % (expr, defnode.refcount) + return '' + + def cdecrefstmt(self, expr, T): + if isinstance(T, _PtrType) and 'gc' in T.flags: + if T.TO == PyObject: + return 'Py_DECREF(%s);' % expr + else: + defnode = self.gettypedefnode(T.TO) + if defnode.refcount is not None: + return 'if (!--%s->%s) %s(%s);' % (expr, defnode.refcount, + defnode.deallocator or 'OP_FREE', + expr) + return '' + def complete(self): i = 0 while True: Modified: pypy/branch/pycompiler/translator/c/funcgen.py ============================================================================== --- pypy/branch/pycompiler/translator/c/funcgen.py (original) +++ pypy/branch/pycompiler/translator/c/funcgen.py Mon May 30 16:50:36 2005 @@ -1,10 +1,10 @@ from __future__ import generators -from pypy.translator.gensupp import ordered_blocks from pypy.translator.c.support import cdecl, ErrorValue from pypy.translator.c.support import llvalue_from_constant from pypy.objspace.flow.model import Variable, Constant, Block -from pypy.objspace.flow.model import traverse, uniqueitems -from pypy.rpython.lltypes import GcPtr, NonGcPtr, PyObject +from pypy.objspace.flow.model import traverse, uniqueitems, last_exception +from pypy.rpython.lltype import GcPtr, NonGcPtr, PyObject, Void +from pypy.rpython.lltype import pyobjectptr, Struct, Array PyObjGcPtr = GcPtr(PyObject) @@ -17,12 +17,15 @@ from a flow graph. """ - def __init__(self, graph, gettype, getvalue): + def __init__(self, graph, db): self.graph = graph - self.getvalue = getvalue - self.typemap, self.returntype = self.collecttypes(gettype) + self.db = db + self.lltypemap = self.collecttypes() + self.typemap = {} + for v, T in self.lltypemap.items(): + self.typemap[v] = db.gettype(T) - def collecttypes(self, gettype): + def collecttypes(self): # collect all variables and constants used in the body, # and get their types now result = [] @@ -31,21 +34,19 @@ result.extend(block.inputargs) for op in block.operations: result.extend(op.args) + result.append(op.result) for link in block.exits: result.extend(link.args) traverse(visit, self.graph) - typemap = {} - returnvar = self.graph.getreturnvar() - result.append(returnvar) + resultvar = self.graph.getreturnvar() + lltypemap = {resultvar: Void} # default value, normally overridden for v in uniqueitems(result): if isinstance(v, Variable): T = getattr(v, 'concretetype', PyObjGcPtr) else: T = getattr(v, 'concretetype', PyObjNonGcPtr) - typemap[v] = gettype(T) - if v is returnvar: - returntype = T - return typemap, returntype + lltypemap[v] = T + return lltypemap def argnames(self): return [v.name for v in self.graph.getargs()] @@ -57,24 +58,24 @@ return [v for v in self.typemap if isinstance(v, Constant)] def allconstantvalues(self): - for v, T in self.typemap.iteritems(): + for v in self.typemap: if isinstance(v, Constant): yield llvalue_from_constant(v) - def decl(self, v): - assert isinstance(v, Variable), repr(v) - return cdecl(self.typemap[v], v.name) - def expr(self, v): if isinstance(v, Variable): - return v.name + if self.lltypemap[v] == Void: + return '/* nothing */' + else: + return v.name elif isinstance(v, Constant): - return self.getvalue(llvalue_from_constant(v)) + return self.db.get(llvalue_from_constant(v)) else: raise TypeError, "expr(%r)" % (v,) def error_return_value(self): - return self.getvalue(ErrorValue(self.returntype)) + returnlltype = self.lltypemap[self.graph.getreturnvar()] + return self.db.get(ErrorValue(returnlltype)) # ____________________________________________________________ @@ -86,16 +87,24 @@ for v in self.allvariables(): if v not in inputargset: - yield '%s;' % self.decl(v) + result = cdecl(self.typemap[v], v.name) + ';' + if self.lltypemap[v] == Void: + result = '/*%s*/' % result + yield result # ____________________________________________________________ def cfunction_body(self): graph = self.graph + blocknum = {} + allblocks = [] + # generate an incref for each input argument for a in self.graph.getargs(): - yield self.cincref(a) + line = self.cincref(a) + if line: + yield line def gen_link(link, linklocalvars=None): "Generate the code to jump across the given Link." @@ -105,6 +114,8 @@ linklocalvars[v] = self.expr(v) has_ref = linklocalvars.copy() for a1, a2 in zip(link.args, link.target.inputargs): + if self.lltypemap[a2] == Void: + continue if a1 in linklocalvars: src = linklocalvars[a1] else: @@ -113,20 +124,23 @@ if a1 in has_ref: del has_ref[a1] else: - ct1 = self.ctypeof(a1) - ct2 = self.ctypeof(a2) - assert ct1 == ct2 + assert self.lltypemap[a1] == self.lltypemap[a2] line += '\t' + self.cincref(a2) yield line for v in has_ref: - yield self.cdecref(v, linklocalvars[v]) + line = self.cdecref(v, linklocalvars[v]) + if line: + yield line yield 'goto block%d;' % blocknum[link.target] # collect all blocks - allblocks = ordered_blocks(graph) - blocknum = {} - for block in allblocks: - blocknum[block] = len(blocknum) + def visit(block): + if isinstance(block, Block): + allblocks.append(block) + blocknum[block] = len(blocknum) + traverse(visit, graph) + + assert graph.startblock is allblocks[0] # generate the body of each block for block in allblocks: @@ -143,7 +157,7 @@ lst = [self.expr(v) for v in op.args] lst.append(self.expr(op.result)) lst.append(err) - yield '%s(%s);' % (macro, ', '.join(lst)) + yield '%s(%s)' % (macro, ', '.join(lst)) to_release.append(op.result) err_reachable = False @@ -181,7 +195,7 @@ for link in block.exits[1:]: assert issubclass(link.exitcase, Exception) yield 'if (PyErr_ExceptionMatches(%s)) {' % ( - self.genc.nameofvalue(link.exitcase),) + self.db.get(pyobjectptr(link.exitcase)),) yield '\tPyObject *exc_cls, *exc_value, *exc_tb;' yield '\tPyErr_Fetch(&exc_cls, &exc_value, &exc_tb);' yield '\tif (exc_value == NULL) {' @@ -197,18 +211,20 @@ err_reachable = True else: # block ending in a switch on a value - ct = self.ctypeof(block.exitswitch) + TYPE = self.lltypemap[block.exitswitch] for link in block.exits[:-1]: assert link.exitcase in (False, True) - yield 'if (%s == %s) {' % (self.expr(block.exitswitch), - self.genc.nameofvalue(link.exitcase, ct)) + expr = self.expr(block.exitswitch) + if not link.exitcase: + expr = '!' + expr + yield 'if (%s) {' % expr for op in gen_link(link): yield '\t' + op yield '}' link = block.exits[-1] assert link.exitcase in (False, True) - yield 'assert(%s == %s);' % (self.expr(block.exitswitch), - self.genc.nameofvalue(link.exitcase, ct)) + #yield 'assert(%s == %s);' % (self.expr(block.exitswitch), + # self.genc.nameofvalue(link.exitcase, ct)) for op in gen_link(block.exits[-1]): yield op yield '' @@ -264,44 +280,109 @@ return 'OP_CALL_ARGS((%s), %s, %s)' % (', '.join(args), r, err) def OP_DIRECT_CALL(self, op, err): - args = [self.expr(v) for v in op.args] - r = self.expr(op.result) - return '%s = %s(%s); if (PyErr_Occurred()) FAIL(%s)' % ( - r, args[0], ', '.join(args[1:]), err) - - def OP_INST_GETATTR(self, op, err): - return '%s = INST_ATTR_%s__%s(%s);' % ( - self.expr(op.result), - op.args[0].concretetype.typename, - op.args[1].value, - self.expr(op.args[0])) - - def OP_INST_SETATTR(self, op, err): - return 'INST_ATTR_%s__%s(%s) = %s;' % ( - op.args[0].concretetype.typename, - op.args[1].value, - self.expr(op.args[0]), - self.expr(op.args[2])) - - def OP_CONV_TO_OBJ(self, op, err): - v = op.args[0] - return '%s = CONV_TO_OBJ_%s(%s); if (PyErr_Occurred()) FAIL(%s)' % ( - self.expr(op.result), self.ctypeof(v).typename, self.expr(v), err) - - def OP_CONV_FROM_OBJ(self, op, err): - v = op.args[0] - return '%s = CONV_FROM_OBJ_%s(%s); if (PyErr_Occurred()) FAIL(%s)' %( - self.expr(op.result), self.ctypeof(op.result).typename, - self.expr(v), err) - - def OP_INCREF(self, op, err): - return self.cincref(op.args[0]) - - def OP_DECREF(self, op, err): - return self.cdecref(op.args[0]) + # skip 'void' arguments + args = [self.expr(v) for v in op.args if self.lltypemap[v] != Void] + if self.lltypemap[op.result] == Void: + # skip assignment of 'void' return value + return '%s(%s); if (PyErr_Occurred()) FAIL(%s)' % ( + args[0], ', '.join(args[1:]), err) + else: + r = self.expr(op.result) + return '%s = %s(%s); if (PyErr_Occurred()) FAIL(%s)' % ( + r, args[0], ', '.join(args[1:]), err) + + # low-level operations + def OP_GETFIELD(self, op, err, ampersand=''): + assert isinstance(op.args[1], Constant) + STRUCT = self.lltypemap[op.args[0]].TO + structdef = self.db.gettypedefnode(STRUCT) + fieldname = structdef.c_struct_field_name(op.args[1].value) + newvalue = self.expr(op.result) + result = ['%s = %s%s->%s;' % (newvalue, + ampersand, + self.expr(op.args[0]), + fieldname)] + # need to adjust the refcount of the result + T = self.lltypemap[op.result] + increfstmt = self.db.cincrefstmt(newvalue, T) + if increfstmt: + result.append(increfstmt) + return '\t'.join(result) + + def OP_SETFIELD(self, op, err): + assert isinstance(op.args[1], Constant) + STRUCT = self.lltypemap[op.args[0]].TO + structdef = self.db.gettypedefnode(STRUCT) + fieldname = structdef.c_struct_field_name(op.args[1].value) + oldvalue = '%s->%s' % (self.expr(op.args[0]), + fieldname) + newvalue = self.expr(op.args[2]) + result = ['%s = %s;' % (oldvalue, newvalue)] + + # need to adjust some refcounts + T = structdef.c_struct_field_type(op.args[1].value) + decrefstmt = self.db.cdecrefstmt('prev', T) + increfstmt = self.db.cincrefstmt(newvalue, T) + if increfstmt: + result.append(increfstmt) + if decrefstmt: + result.insert(0, '{ %s = %s;' % ( + cdecl(self.typemap[op.args[2]], 'prev'), + oldvalue)) + result.append('if (prev) ' + decrefstmt) + result.append('}') + return '\t'.join(result) + + def OP_GETSUBSTRUCT(self, op, err): + return self.OP_GETFIELD(op, err, ampersand='&') + + def OP_GETARRAYITEM(self, op, err): + return '%s = %s->items + %s;' % (self.expr(op.result), + self.expr(op.args[0]), + self.expr(op.args[1])) + + def OP_GETARRAYSIZE(self, op, err): + return '%s = %s->length;' % (self.expr(op.result), + self.expr(op.args[0])) + + def OP_MALLOC(self, op, err): + TYPE = self.lltypemap[op.result].TO + typename = self.db.gettype(TYPE) + eresult = self.expr(op.result) + result = ['OP_ZERO_MALLOC(sizeof(%s), %s, %s)' % (cdecl(typename, ''), + eresult, + err), + '%s->%s = 1;' % (eresult, + self.db.gettypedefnode(TYPE).refcount), + ] + return '\t'.join(result) + + def OP_MALLOC_VARSIZE(self, op, err): + TYPE = self.lltypemap[op.result].TO + typename = self.db.gettype(TYPE) + if isinstance(TYPE, Struct): + TYPE = TYPE._arrayfld + assert isinstance(TYPE, Array) + itemtypename = self.db.gettype(TYPE.OF) + elength = self.expr(op.args[1]) + eresult = self.expr(op.result) + size = 'sizeof(%s)+((%s-1)*sizeof(%s))' % (cdecl(typename, ''), + elength, + cdecl(itemtypename, '')) + result = ['OP_ZERO_MALLOC(%s, %s, %s)' % (size, + eresult, + err), + '%s->length = %s;' % (eresult, + elength), + '%s->%s = 1;' % (eresult, + self.db.gettypedefnode(TYPE).refcount), + ] + return '\t'.join(result) def cincref(self, v): - return '/*XXX INCREF*/' + T = self.lltypemap[v] + return self.db.cincrefstmt(v.name, T) def cdecref(self, v, expr=None): - return '/*XXX DECREF*/' + T = self.lltypemap[v] + return self.db.cdecrefstmt(expr or v.name, T) Modified: pypy/branch/pycompiler/translator/c/g_include.h ============================================================================== --- pypy/branch/pycompiler/translator/c/g_include.h (original) +++ pypy/branch/pycompiler/translator/c/g_include.h Mon May 30 16:50:36 2005 @@ -14,4 +14,6 @@ #include "g_support.h" #include "g_module.h" +#include "int_include.h" +#include "ll_include.h" #include "pyobj_include.h" Modified: pypy/branch/pycompiler/translator/c/g_module.h ============================================================================== --- pypy/branch/pycompiler/translator/c/g_module.h (original) +++ pypy/branch/pycompiler/translator/c/g_module.h Mon May 30 16:50:36 2005 @@ -3,12 +3,20 @@ /*** C header subsection: CPython-extension-module-ness ***/ -#define MODULE_INITFUNC(modname) \ - static PyMethodDef no_methods[] = { (char *)NULL, (PyCFunction)NULL }; \ +#ifndef COUNT_OP_MALLOCS +# define MODULE_INITFUNC(modname) \ + static PyMethodDef my_methods[] = { (char *)NULL, (PyCFunction)NULL }; \ PyMODINIT_FUNC init##modname(void) +#else +# define MODULE_INITFUNC(modname) \ + static PyMethodDef my_methods[] = { \ + { "malloc_counters", malloc_counters }, \ + { (char *)NULL, (PyCFunction)NULL } }; \ + PyMODINIT_FUNC init##modname(void) +#endif #define SETUP_MODULE(modname) \ - PyObject *m = Py_InitModule(#modname, no_methods); \ + PyObject *m = Py_InitModule(#modname, my_methods); \ PyModule_AddStringConstant(m, "__sourcefile__", __FILE__); \ this_module_globals = PyModule_GetDict(m); \ PyGenCFunction_Type.tp_base = &PyCFunction_Type; \ Modified: pypy/branch/pycompiler/translator/c/g_support.h ============================================================================== --- pypy/branch/pycompiler/translator/c/g_support.h (original) +++ pypy/branch/pycompiler/translator/c/g_support.h Mon May 30 16:50:36 2005 @@ -9,8 +9,6 @@ #define MIN(a,b) (((a)<(b))?(a):(b)) #endif /* MIN */ -#define MOVE(x, y) y = x; - #define FAIL_EXCEPTION(err, exc, msg) \ { \ PyErr_SetString(exc, msg); \ @@ -336,7 +334,7 @@ } PyErr_Format(PyExc_TypeError, "%s() got only %d argument(s)", PyString_AS_STRING(fname), - position-1); + position); return NULL; } Modified: pypy/branch/pycompiler/translator/c/node.py ============================================================================== --- pypy/branch/pycompiler/translator/c/node.py (original) +++ pypy/branch/pycompiler/translator/c/node.py Mon May 30 16:50:36 2005 @@ -1,7 +1,7 @@ from __future__ import generators -from pypy.rpython.lltypes import Struct, Array, FuncType, PyObjectType, typeOf -from pypy.rpython.lltypes import GcStruct, GcArray, GC_CONTAINER, ContainerType -from pypy.rpython.lltypes import parentlink +from pypy.rpython.lltype import Struct, Array, FuncType, PyObjectType, typeOf +from pypy.rpython.lltype import GcStruct, GcArray, GC_CONTAINER, ContainerType +from pypy.rpython.lltype import parentlink, _PtrType from pypy.translator.c.funcgen import FunctionCodeGenerator from pypy.translator.c.support import cdecl, somelettersfrom @@ -11,13 +11,16 @@ return False if isinstance(T, GcStruct): if T._names and isinstance(T._flds[T._names[0]], GC_CONTAINER): - return False # refcount already in the first first + return False # refcount already in the first field return True class StructDefNode: + refcount = None + deallocator = None def __init__(self, db, STRUCT, varlength=1): + self.db = db self.STRUCT = STRUCT if varlength == 1: basename = STRUCT._name @@ -29,16 +32,34 @@ self.fields = [] self.prefix = somelettersfrom(STRUCT._name) + '_' for name in STRUCT._names: - T = STRUCT._flds[name] + T = self.c_struct_field_type(name) if name == STRUCT._arrayfld: typename = db.gettype(T, varlength=varlength, who_asks=self) else: typename = db.gettype(T, who_asks=self) self.fields.append((self.c_struct_field_name(name), typename)) + # look up the reference counter field + if needs_refcount(STRUCT): + self.refcount = 'refcount' + elif isinstance(STRUCT, GcStruct): + # refcount in the first field + T = self.c_struct_field_type(STRUCT._names[0]) + assert isinstance(T, GC_CONTAINER) + firstfieldname, firstfieldtype = self.fields[0] + firstdefnode = db.gettypedefnode(T) + self.refcount = '%s.%s' % (firstfieldname, firstdefnode.refcount) + + # is a specific deallocator needed? + if self.refcount and varlength == 1 and list(self.deallocator_lines('')): + self.deallocator = db.namespace.uniquename('dealloc_'+self.name) + def c_struct_field_name(self, name): return self.prefix + name + def c_struct_field_type(self, name): + return self.STRUCT._flds[name] + def access_expr(self, baseexpr, fldname): fldname = self.c_struct_field_name(fldname) return '%s.%s' % (baseexpr, fldname) @@ -50,11 +71,35 @@ for name, typename in self.fields: yield '\t%s;' % cdecl(typename, name) yield '};' + if self.deallocator: + yield 'void %s(struct %s *p) {' % (self.deallocator, self.name) + for line in self.deallocator_lines('p->'): + yield '\t' + line + yield '\tOP_FREE(p);' + yield '}' + + def deallocator_lines(self, prefix): + STRUCT = self.STRUCT + for name in STRUCT._names: + FIELD_T = self.c_struct_field_type(name) + if isinstance(FIELD_T, _PtrType) and 'gc' in FIELD_T.flags: + cname = self.c_struct_field_name(name) + line = self.db.cdecrefstmt('%s%s' % (prefix, cname), FIELD_T) + if line: + yield line + elif isinstance(FIELD_T, ContainerType): + defnode = self.db.gettypedefnode(FIELD_T) + cname = self.c_struct_field_name(name) + for line in defnode.deallocator_lines('%s%s.' %(prefix, cname)): + yield line class ArrayDefNode: + refcount = None + deallocator = None def __init__(self, db, ARRAY, varlength=1): + self.db = db self.ARRAY = ARRAY if varlength == 1: basename = 'array' @@ -66,6 +111,14 @@ self.structname = db.gettype(ARRAY.OF, who_asks=self) self.varlength = varlength + # look up the reference counter field + if needs_refcount(ARRAY): + self.refcount = 'refcount' + + # is a specific deallocator needed? + if self.refcount and varlength == 1 and list(self.deallocator_lines('')): + self.deallocator = db.namespace.uniquename('dealloc_'+self.name) + def access_expr(self, baseexpr, index): return '%s.items[%d]' % (baseexpr, index) @@ -76,6 +129,33 @@ yield '\tlong length;' yield '\t%s;' % cdecl(self.structname, 'items[%d]' % self.varlength) yield '};' + if self.deallocator: + yield 'void %s(struct %s *a) {' % (self.deallocator, self.name) + for line in self.deallocator_lines('a->'): + yield '\t' + line + yield '\tOP_FREE(a);' + yield '}' + + def deallocator_lines(self, prefix): + ARRAY = self.ARRAY + defnode = self.db.gettypedefnode(ARRAY.OF) + varname = 'p%d' % len(prefix) + body = list(defnode.deallocator_lines('%s->' % varname)) + if body: + yield '{' + yield '\tstruct %s *%s = %sitems;' % (defnode.name, + varname, + prefix) + yield '\tstruct %s *%s_end = %s + %slength;' % (defnode.name, + varname, + varname, + prefix) + yield '\twhile (%s != %s_end) {' % (varname, varname) + for line in body: + yield '\t\t' + line + yield '\t\t%s++;' % varname + yield '\t}' + yield '}' # ____________________________________________________________ @@ -185,7 +265,7 @@ def __init__(self, db, T, obj): graph = obj.graph # only user-defined functions with graphs for now - self.funcgen = FunctionCodeGenerator(graph, db.gettype, db.get) + self.funcgen = FunctionCodeGenerator(graph, db) self.db = db self.T = T self.obj = obj @@ -246,6 +326,41 @@ yield '}' +class CExternalFuncNode(ContainerNode): + globalcontainer = True + + def __init__(self, db, T, obj): + self.db = db + self.T = T + self.obj = obj + #self.dependencies = {} + self.typename = db.gettype(T) #, who_asks=self) + self.name = obj._name + self.ptrname = self.name + + def enum_dependencies(self): + return [] + + def implementation(self): + return [] + + def forward_declaration(self): + return [] + + def implementation(self): + return [] + + +def funcnodemaker(db, T, obj): + if hasattr(obj, 'graph'): + cls = FuncNode + elif getattr(obj, 'external', None) == 'C': + cls = CExternalFuncNode + else: + raise ValueError, "don't know about %r" % (obj,) + return cls(db, T, obj) + + class PyObjectNode(ContainerNode): globalcontainer = True typename = 'PyObject @' @@ -271,6 +386,6 @@ GcStruct: StructNode, Array: ArrayNode, GcArray: ArrayNode, - FuncType: FuncNode, + FuncType: funcnodemaker, PyObjectType: PyObjectNode, } Modified: pypy/branch/pycompiler/translator/c/primitive.py ============================================================================== --- pypy/branch/pycompiler/translator/c/primitive.py (original) +++ pypy/branch/pycompiler/translator/c/primitive.py Mon May 30 16:50:36 2005 @@ -1,4 +1,4 @@ -from pypy.rpython.lltypes import * +from pypy.rpython.lltype import * # ____________________________________________________________ # Modified: pypy/branch/pycompiler/translator/c/pyobj.py ============================================================================== --- pypy/branch/pycompiler/translator/c/pyobj.py (original) +++ pypy/branch/pycompiler/translator/c/pyobj.py Mon May 30 16:50:36 2005 @@ -3,10 +3,10 @@ from types import FunctionType, CodeType, InstanceType, ClassType from pypy.objspace.flow.model import Variable, Constant -from pypy.translator.gensupp import builtin_base, NameManager +from pypy.translator.gensupp import builtin_base from pypy.rpython.rarithmetic import r_int, r_uint -from pypy.rpython.lltypes import pyobject +from pypy.rpython.lltype import pyobjectptr # XXX maybe this can be done more elegantly: # needed to convince should_translate_attr @@ -22,9 +22,10 @@ reconstruct them. """ - def __init__(self, namespace, getvalue): + def __init__(self, namespace, getvalue, rtyper=None): self.namespace = namespace self.getvalue = getvalue + self.rtyper = rtyper self.initcode = [ # list of lines for the module's initxxx() 'import new, types, sys', ] @@ -33,6 +34,7 @@ # for later in initxxx() -- for recursive # objects self.debugstack = () # linked list of nested nameof() + self.wrappers = {} # {'pycfunctionvariable': ('name', 'wrapperfn')} def nameof(self, obj, debug=None): if debug: @@ -41,7 +43,7 @@ stackentry = obj self.debugstack = (self.debugstack, stackentry) try: - return self.getvalue(pyobject(obj)) + return self.getvalue(pyobjectptr(obj)) finally: self.debugstack, x = self.debugstack assert x is stackentry @@ -77,6 +79,17 @@ self.initcode_python(name, "object()") return name + def nameof_NoneType(self, value): + assert value is None + return 'Py_None' + + def nameof_bool(self, value): + assert value is False or value is True + if value: + return 'Py_True' + else: + return 'Py_False' + def nameof_module(self, value): assert value is os or not hasattr(value, "__file__") or \ not (value.__file__.endswith('.pyc') or @@ -116,14 +129,11 @@ def nameof_str(self, value): name = self.uniquename('gstr_' + value[:32]) -## if [c for c in value if c<' ' or c>'~' or c=='"' or c=='\\']: -## # non-printable string -## s = 'chr_%s' % name -## self.globaldecl.append('static char %s[] = { %s };' % ( -## s, ', '.join(['%d' % ord(c) for c in value]))) -## else: -## # printable string -## s = '"%s"' % value + self.initcode_python(name, repr(value)) + return name + + def nameof_unicode(self, value): + name = self.uniquename('guni_' + str(value[:32])) self.initcode_python(name, repr(value)) return name @@ -144,16 +154,25 @@ self.initcode.append(' raise NotImplementedError') return name - def nameof_function(self, func, progress=['-\x08', '\\\x08', - '|\x08', '/\x08']): - funcdef = self.genc().getfuncdef(func) - if funcdef is None: - return self.skipped_function(func) - if not self.translator.frozen: - p = progress.pop(0) - sys.stderr.write(p) - progress.append(p) - return funcdef.get_globalobject() + def nameof_function(self, func): + assert self.rtyper is not None, ( + "for now, rtyper must be specified to build a PyObject " + "wrapper for %r" % (func,)) + # look for skipped functions + a = self.rtyper.annotator + if a.translator.frozen: + if func not in a.translator.flowgraphs: + return self.skipped_function(func) + else: + if (func.func_doc and + func.func_doc.lstrip().startswith('NOT_RPYTHON')): + return self.skipped_function(func) + + from pypy.translator.c.wrapper import gen_wrapper + fwrapper = gen_wrapper(func, self.rtyper) + pycfunctionobj = self.uniquename('gfunc_' + func.__name__) + self.wrappers[pycfunctionobj] = func.__name__, self.getvalue(fwrapper) + return pycfunctionobj def nameof_staticmethod(self, sm): # XXX XXX XXXX Modified: pypy/branch/pycompiler/translator/c/support.py ============================================================================== --- pypy/branch/pycompiler/translator/c/support.py (original) +++ pypy/branch/pycompiler/translator/c/support.py Mon May 30 16:50:36 2005 @@ -1,4 +1,4 @@ -from pypy.rpython import lltypes +from pypy.rpython import lltype from pypy.translator.gensupp import NameManager class ErrorValue: @@ -34,10 +34,13 @@ try: T = c.concretetype except AttributeError: - return lltypes.pyobject(c.value) + return lltype.pyobjectptr(c.value) else: - assert lltypes.typeOf(c.value) == T - return c.value + if T == lltype.Void: + return None + else: + assert lltype.typeOf(c.value) == T + return c.value class CNameManager(NameManager): Modified: pypy/branch/pycompiler/translator/c/test/test_database.py ============================================================================== --- pypy/branch/pycompiler/translator/c/test/test_database.py (original) +++ pypy/branch/pycompiler/translator/c/test/test_database.py Mon May 30 16:50:36 2005 @@ -1,10 +1,10 @@ import autopath, sys -from pypy.rpython.lltypes import * +from pypy.rpython.lltype import * +from pypy.rpython.rtyper import RPythonTyper from pypy.translator.translator import Translator from pypy.translator.c.database import LowLevelDatabase from pypy.objspace.flow.model import Constant, Variable, SpaceOperation from pypy.objspace.flow.model import Block, Link, FunctionGraph -from pypy.rpython.lltypes import Struct, Array, malloc def dump_on_stdout(database): @@ -130,7 +130,7 @@ # -------------------- end -------------------- F = FuncType([Signed], Signed) - f = function(F, "f", graph=graph) + f = functionptr(F, "f", graph=graph) db = LowLevelDatabase() db.get(f) db.complete() @@ -151,7 +151,7 @@ graph = t.getflowgraph() F = FuncType([GcPtr(PyObject)], GcPtr(PyObject)) - f = function(F, "f", graph=graph) + f = functionptr(F, "f", graph=graph) db = LowLevelDatabase() db.get(f) db.complete() @@ -164,3 +164,101 @@ db.get(s) db.complete() dump_on_stdout(db) + +def test_function_call(): + def g(x, y): + return x-y + def f(x): + return g(1, x) + t = Translator(f) + a = t.annotate([int]) + RPythonTyper(t.annotator).specialize() + + F = FuncType([Signed], Signed) + f = functionptr(F, "f", graph=t.getflowgraph()) + db = LowLevelDatabase() + db.get(f) + db.complete() + dump_on_stdout(db) + +def test_func_as_pyobject(): + def f(x): + return x+1 + t = Translator(f) + a = t.annotate([int]) + rtyper = RPythonTyper(t.annotator) + rtyper.specialize() + + db = LowLevelDatabase(rtyper) + db.get(pyobjectptr(f)) + db.complete() + dump_on_stdout(db) + + +def test_malloc(): + S = GcStruct('testing', ('x', Signed), ('y', Signed)) + def ll_f(x): + p = malloc(S) + p.x = x + p.y = x+1 + return p.x * p.y + t = Translator(ll_f) + a = t.annotate([int]) + rtyper = RPythonTyper(t.annotator) + rtyper.specialize() + db = LowLevelDatabase(rtyper) + db.get(rtyper.getfunctionptr(ll_f)) + db.complete() + dump_on_stdout(db) + +def test_multiple_malloc(): + S1 = GcStruct('testing1', ('x', Signed), ('y', Signed)) + S = GcStruct('testing', ('ptr1', GcPtr(S1)), + ('ptr2', GcPtr(S1)), + ('z', Signed)) + def ll_f(x): + ptr1 = malloc(S1) + ptr1.x = x + ptr2 = malloc(S1) + ptr2.x = x+1 + s = malloc(S) + s.ptr1 = ptr1 + s.ptr2 = ptr2 + return s.ptr1.x * s.ptr2.x + t = Translator(ll_f) + a = t.annotate([int]) + rtyper = RPythonTyper(t.annotator) + rtyper.specialize() + db = LowLevelDatabase(rtyper) + db.get(rtyper.getfunctionptr(ll_f)) + db.complete() + dump_on_stdout(db) + +def test_nested_gcstruct(): + S1 = GcStruct('inlined', ('x', Signed), ('y', GcPtr(PyObject))) + S = GcStruct('testing', ('head', S1), + ('ptr2', GcPtr(S1)), + ('z', Signed)) + def ll_f(x): + ptr2 = malloc(S1) + ptr2.x = x+1 + s = malloc(S) + s.head.x = x + s.ptr2 = ptr2 + return s.head.x * s.ptr2.x + t = Translator(ll_f) + a = t.annotate([int]) + rtyper = RPythonTyper(t.annotator) + rtyper.specialize() + db = LowLevelDatabase(rtyper) + db.get(rtyper.getfunctionptr(ll_f)) + db.complete() + dump_on_stdout(db) + +def test_array(): + A = GcArray(('obj', GcPtr(PyObject))) + a = malloc(A, 10) + db = LowLevelDatabase() + db.get(a) + db.complete() + dump_on_stdout(db) Modified: pypy/branch/pycompiler/translator/genc/ctyper.py ============================================================================== --- pypy/branch/pycompiler/translator/genc/ctyper.py (original) +++ pypy/branch/pycompiler/translator/genc/ctyper.py Mon May 30 16:50:36 2005 @@ -16,7 +16,7 @@ from pypy.translator.genc.classtype import CClassPtrType from pypy.translator.genc.instancetype import CInstanceType from pypy.translator.genc.lltype import CPtrType, CLiteralTypeName -from pypy.rpython import lltypes +from pypy.rpython import lltype import types from pypy.interpreter.pycode import CO_VARARGS @@ -131,7 +131,7 @@ if op.opname == 'simple_call' and isinstance(op.args[0], Constant): # XXX move me elsewhere func = op.args[0].value - if func is lltypes.malloc: + if func is lltype.malloc: s_result = self.annotator.binding(op.result) ctliteral = self.annotator.translator.getconcretetype( CLiteralTypeName) @@ -142,12 +142,12 @@ [ctliteral], self.annotation2concretetype(s_result)) ] else: - if isinstance(ct, lltypes.Struct): + if isinstance(ct, lltype.Struct): assert ct._arrayfld is not None sizefield = ct._arrayfld + '.size' varstruct = ct._flds[ct._arrayfld].OF else: - assert isinstance(ct, lltypes.Array) + assert isinstance(ct, lltype.Array) sizefield = 'size' varstruct = ct.OF Modified: pypy/branch/pycompiler/translator/genc/lltype.py ============================================================================== --- pypy/branch/pycompiler/translator/genc/lltype.py (original) +++ pypy/branch/pycompiler/translator/genc/lltype.py Mon May 30 16:50:36 2005 @@ -2,7 +2,7 @@ from pypy.translator.genc.basetype import CType from pypy.translator.gensupp import C_IDENTIFIER from pypy.objspace.flow.model import SpaceOperation, Constant, Variable -from pypy.rpython import lltypes +from pypy.rpython import lltype class CLiteral(CType): # HACK! TEMPORARY @@ -12,7 +12,7 @@ class CLiteralTypeName(CType): # HACK! TEMPORARY def nameof(self, obj, debug=None): - assert isinstance(obj, lltypes.LowLevelType) + assert isinstance(obj, lltype.LowLevelType) ct = ll2concretetype(self.translator, obj) return ct.typename @@ -69,7 +69,7 @@ cliteral = typer.annotator.translator.getconcretetype(CLiteral) s_result = typer.annotator.binding(op.result) ctresult = typer.annotation2concretetype(s_result) - if isinstance(attrtype, lltypes.ContainerType): + if isinstance(attrtype, lltype.ContainerType): yield typer.typed_op(op, [self, cliteral], ctresult, newopname='getsubstruct') else: @@ -87,7 +87,7 @@ attrname = v_attrname.value attrtype = self.lltype.TO._flds[attrname] cliteral = typer.annotator.translator.getconcretetype(CLiteral) - if isinstance(attrtype, lltypes.ContainerType): + if isinstance(attrtype, lltype.ContainerType): raise AssertionError("cannot setattr to a substructure") ctinput = ll2concretetype(typer.annotator.translator, attrtype) yield typer.typed_op(op, [self, cliteral, ctinput], typer.TNone, @@ -190,11 +190,11 @@ from pypy.translator.genc import inttype, nonetype primitivetypemap = { - lltypes.Signed: inttype.CIntType, - lltypes.Unsigned: inttype.CUnsignedType, - #lltypes.Char: ... - lltypes.Bool: inttype.CIntType, - lltypes.Void: nonetype.CNoneType, + lltype.Signed: inttype.CIntType, + lltype.Unsigned: inttype.CUnsignedType, + #lltype.Char: ... + lltype.Bool: inttype.CIntType, + lltype.Void: nonetype.CNoneType, } def get_primitive_type(translator, lltype): @@ -202,12 +202,12 @@ return translator.getconcretetype(cls) ll2concretetypemap = { - lltypes.Struct: CStructType, - lltypes.GcStruct: CStructType, - lltypes.Array: CArrayType, - lltypes.GcArray: CArrayType, - lltypes._PtrType: CPtrType, - lltypes.Primitive: get_primitive_type, + lltype.Struct: CStructType, + lltype.GcStruct: CStructType, + lltype.Array: CArrayType, + lltype.GcArray: CArrayType, + lltype._PtrType: CPtrType, + lltype.Primitive: get_primitive_type, } def ll2concretetype(translator, lltype): Modified: pypy/branch/pycompiler/translator/genc/test/test_lltyped.py ============================================================================== --- pypy/branch/pycompiler/translator/genc/test/test_lltyped.py (original) +++ pypy/branch/pycompiler/translator/genc/test/test_lltyped.py Mon May 30 16:50:36 2005 @@ -1,4 +1,4 @@ -from pypy.rpython.lltypes import * +from pypy.rpython.lltype import * from pypy.translator.tool.buildpyxmodule import skip_missing_compiler from pypy.translator.translator import Translator from pypy.translator.genc.ctyper import GenCSpecializer Modified: pypy/branch/pycompiler/translator/goal/translate_pypy.py ============================================================================== --- pypy/branch/pycompiler/translator/goal/translate_pypy.py (original) +++ pypy/branch/pycompiler/translator/goal/translate_pypy.py Mon May 30 16:50:36 2005 @@ -56,6 +56,7 @@ run_async_server() if not options['-no-a']: a = t.annotate(inputtypes, overrides=pypy_overrides) + sanity_check_exceptblocks(t) worstblocks_topten(a) if not options['-no-s']: a.simplify() @@ -66,6 +67,25 @@ options['-no-mark-some-objects'] = True # Do not do this again find_someobjects(t) +def sanity_check_exceptblocks(translator): + annotator = translator.annotator + irreg = 0 + for graph in translator.flowgraphs.itervalues(): + et, ev = graph.exceptblock.inputargs + s_et = annotator.binding(et, extquery=True) + s_ev = annotator.binding(ev, extquery=True) + if s_et: + if s_et.knowntype == type: + if s_et.__class__ == SomeObject: + if hasattr(s_et, 'is_type_of') and s_et.is_type_of == [ev]: + continue + else: + if s_et.__class__ == annmodel.SomePBC: + continue + print "*****", graph.name, "exceptblock is not completely sane" + irreg += 1 + if irreg == 0: + print "*** All exceptblocks seem sane." def find_someobjects(translator, quiet=False): """Find all functions in that have SomeObject in their signature.""" Modified: pypy/branch/pycompiler/translator/llvm/build_llvm_module.py ============================================================================== --- pypy/branch/pycompiler/translator/llvm/build_llvm_module.py (original) +++ pypy/branch/pycompiler/translator/llvm/build_llvm_module.py Mon May 30 16:50:36 2005 @@ -14,7 +14,7 @@ from pypy.translator.tool.buildpyxmodule import make_c_from_pyxfile from pypy.translator.tool import stdoutcapture -debug = 1 +debug = False class CompileError(exceptions.Exception): pass @@ -27,22 +27,31 @@ lastdir = path.local() os.chdir(str(dirpath)) modname = pyxfile.purebasename - ops1 = ["llvm-as %s -f -o %s.bc" % (llvmfile, llvmfile.purebasename), - "opt %s -f %s.bc -o %s_optimized.bc" % (OPTIMIZATION_SWITCHES, - llvmfile.purebasename, - llvmfile.purebasename), - "llc -enable-correct-eh-support %s_optimized.bc -f -o %s.s" % \ - (llvmfile.purebasename, llvmfile.purebasename), - "as %s.s -o %s.o" % (llvmfile.purebasename, llvmfile.purebasename)] - if not optimize: - ops1 = ["llvm-as %s -f" % llvmfile, - "llc -enable-correct-eh-support %s.bc -f -o %s.s" % \ - (llvmfile.purebasename, llvmfile.purebasename), - "as %s.s -o %s.o" % (llvmfile.purebasename, - llvmfile.purebasename)] - ops2 = ["gcc -c -fPIC -I/usr/include/python2.3 %s.c" % pyxfile.purebasename, - "gcc -shared %s.o %s.o -o %s.so" % (llvmfile.purebasename, - modname, modname)] + b = llvmfile.purebasename + + if sys.maxint == 2147483647: #32 bit platform + if optimize: + ops1 = ["llvm-as %s.ll -f -o %s.bc" % (b, b), + "opt %s -f %s.bc -o %s_optimized.bc" % (OPTIMIZATION_SWITCHES, b, b), + "llc -enable-correct-eh-support %s_optimized.bc -f -o %s.s" % (b, b), + "as %s.s -o %s.o" % (b, b)] + else: + ops1 = ["llvm-as %s.ll -f -o %s.bc" % (b, b), + "llc -enable-correct-eh-support %s.bc -f -o %s.s" % (b, b), + "as %s.s -o %s.o" % (b, b)] + ops2 = ["gcc -c -shared -I/usr/include/python2.3 %s.c" % pyxfile.purebasename, + "gcc -shared %s.o %s.o -o %s.so" % (b, modname, modname)] + else: #assume 64 bit platform (x86-64?) + #this special case for x86-64 (called ia64 in llvm) can go as soon as llc supports ia64 assembly output! + if optimize: + ops1 = ["llvm-as %s.ll -f -o %s.bc" % (b, b), + "opt %s -f %s.bc -o %s_optimized.bc" % (OPTIMIZATION_SWITCHES, b, b), + "llc -enable-correct-eh-support %s_optimized.bc -march=c -f -o %s.c" % (b, b)] + else: + ops1 = ["llvm-as %s.ll -f -o %s.bc" % (b, b), + "llc -enable-correct-eh-support %s.bc -march=c -f -o %s.c" % (b, b)] + ops2 = ["gcc -shared -fPIC -I/usr/include/python2.3 %s.c %s.c -o %s.so" % (b, modname, modname)] + try: if debug: print "modname", modname c = stdoutcapture.Capture(mixed_out_err = True) @@ -50,11 +59,11 @@ try: try: for op in ops1: - print op + if debug: print op cmdexec(op) make_c_from_pyxfile(pyxfile) for op in ops2: - print op + if debug: print op cmdexec(op) finally: foutput, foutput = c.done() Modified: pypy/branch/pycompiler/translator/llvm/classrepr.py ============================================================================== --- pypy/branch/pycompiler/translator/llvm/classrepr.py (original) +++ pypy/branch/pycompiler/translator/llvm/classrepr.py Mon May 30 16:50:36 2005 @@ -21,8 +21,8 @@ from pypy.translator.llvm.funcrepr import VirtualMethodRepr from pypy.translator.llvm.memorylayout import MemoryLayout -debug = True -lazy_debug = True +debug = False +lazy_debug = False class ClassRepr(TypeRepr): l_classes = {} @@ -122,7 +122,7 @@ def get_globals(self): s = "\n%s = internal global %%std.class {%%std.class* null, uint %i}" - s = s % (self.objectname, abs(id(self))) + s = s % (self.objectname, abs(id(self)) & 0xFFFFFFF) return self.definition + s def collect_init_code(self, lblock, l_func): @@ -247,7 +247,7 @@ self.objectname = gen.get_global_tmp("class.%s.object" % self.exception.__name__) s = "%s = internal global %%std.class {%%std.class* null, uint %i}" - self.definition = s % (self.objectname, abs(id(exception))) + self.definition = s % (self.objectname, abs(id(exception)) & 0xFFFFFFF) self.dependencies = sets.Set() lazy_attributes = ['l_base', 'memlayout'] Modified: pypy/branch/pycompiler/translator/llvm/funcrepr.py ============================================================================== --- pypy/branch/pycompiler/translator/llvm/funcrepr.py (original) +++ pypy/branch/pycompiler/translator/llvm/funcrepr.py Mon May 30 16:50:36 2005 @@ -250,15 +250,22 @@ l_op = getattr(l_arg0, "op_" + op.opname, None) if l_op is not None: l_op(l_target, op.args, self.lblock, self.l_func) - elif op.opname in INTRINSIC_OPS: + return + try: + l_arg0.op(op.opname, l_target, op.args, self.lblock, self.l_func) + except NotImplementedError: + pass + except CompileError: + pass + if op.opname in INTRINSIC_OPS: l_args = [self.gen.get_repr(arg) for arg in op.args[1:]] self.l_func.dependencies.update(l_args) self.lblock.spaceop(l_target, op.opname, [l_arg0] + l_args) - else: - s = "SpaceOperation %s not supported. Target: %s " \ - "Args: %s " % (op.opname, l_target, op.args) + \ - "Dispatched on: %s" % l_arg0 - raise CompileError, s + return + s = "SpaceOperation %s not supported. Target: %s " \ + "Args: %s " % (op.opname, l_target, op.args) + \ + "Dispatched on: %s" % l_arg0 + raise CompileError, s def create_terminator_instr(self): if debug: @@ -342,7 +349,7 @@ if len(l_exits) == 1 and self.pyblock.exits[1].exitcase == Exception: lexcblock.uncond_branch("%" + l_exits[0].toblock) else: - sw = [(str(abs(id(ex.exitcase))), "%" + l_l.toblock) + sw = [(str(abs(id(ex.exitcase)) & 0xFFFFFFF), "%" + l_l.toblock) for ex, l_l in zip(self.pyblock.exits[1:], l_exits)] lexcblock.switch(l_ui, "%" + self.lblock.label + ".unwind", sw) lunwindblock = llvmbc.BasicBlock(self.lblock.label + ".unwind") @@ -628,7 +635,7 @@ entryblock.getelementptr(l_uip, l_cl, [0, 1]) entryblock.load(l_ui, l_uip) entryblock.switch(l_ui, "%" + self.l_commonbase.classdef.cls.__name__, - [(str(abs(id(l_c))), "%" + l_c.classdef.cls.__name__) + [(str(abs(id(l_c)) & 0xFFFFFFF), "%" + l_c.classdef.cls.__name__) for l_c in self.l_classes]) lfunc = llvmbc.Function(self.llvmfuncdef(), entryblock) for i, l_cls in enumerate(self.l_classes): Modified: pypy/branch/pycompiler/translator/llvm/genllvm.py ============================================================================== --- pypy/branch/pycompiler/translator/llvm/genllvm.py (original) +++ pypy/branch/pycompiler/translator/llvm/genllvm.py Mon May 30 16:50:36 2005 @@ -13,8 +13,11 @@ import autopath import sets, StringIO -from pypy.objspace.flow.model import Constant +from pypy.objspace.flow.model import Constant, Variable from pypy.annotation import model as annmodel + +from pypy.rpython import rtyper, lltype + from pypy.translator import transform from pypy.translator.translator import Translator from pypy.translator.llvm import llvmbc @@ -29,7 +32,9 @@ from pypy.translator.llvm.representation import CompileError from pypy.translator.llvm.funcrepr import EntryFunctionRepr -debug = False +from pypy.translator.llvm import reprmap + +debug = True def llvmcompile(transl, optimize=False): @@ -37,6 +42,9 @@ return gen.compile(optimize) def get_key(obj): + if isinstance(obj, list): + return id(obj) + return obj #XXX Get rid of this: #LLVMGenerator should only cache gen_repr requestes, #the Repr classes should be responsible for deciding which queries @@ -60,6 +68,8 @@ def __init__(self, transl): self.translator = transl self.annotator = self.translator.annotator + self.rtyper = rtyper.RPythonTyper(self.annotator) + self.rtyper.specialize() self.global_counts = {} self.local_counts = {} self.repr_classes = [] @@ -75,8 +85,8 @@ self.l_entrypoint = EntryFunctionRepr("%__entry__" + self.entryname, self.translator.functions[0], self) - classrepr.create_builtin_exceptions(self, - self.l_entrypoint.dependencies) +## classrepr.create_builtin_exceptions( +## self, self.l_entrypoint.get_dependencies()) self.local_counts[self.l_entrypoint] = 0 self.l_entrypoint.setup() @@ -107,11 +117,12 @@ def get_local_tmp(self, type, l_function): self.local_counts[l_function] += 1 - return TmpVariableRepr("tmp_%i" % self.local_counts[l_function], type, + return TmpVariableRepr("tmp.%i" % self.local_counts[l_function], type, self) def get_repr(self, obj): self.depth += 1 + key = get_key(obj) if debug: print " " * self.depth, print "looking for object", obj, type(obj).__name__, @@ -119,24 +130,44 @@ if isinstance(obj, LLVMRepr): self.depth -= 1 return obj - if get_key(obj) in self.llvm_reprs: + if key in self.llvm_reprs: self.depth -= 1 if debug: - print "->exists already:", self.llvm_reprs[get_key(obj)] - return self.llvm_reprs[get_key(obj)] + print "->exists already:", self.llvm_reprs[key] + return self.llvm_reprs[key] + elif isinstance(obj, Variable): + try: + obj.concretetype + except AttributeError: + self.rtyper.setconcretetype(obj) + result = representation.VariableRepr(obj, self) + self.llvm_reprs[result] = result + self.depth -= 1 + return result + elif isinstance(obj, lltype.Primitive): + result = reprmap.PRIMITIVE_TYPES[obj](self) + self.llvm_reprs[key] = result + self.depth -= 1 + return result + if isinstance(obj, Constant): + try: + T = lltype.typeOf(obj) + if isinstance(T, lltype.Primitive): + result = reprmap.PRIMITIVE_REPRS[concretetype](obj, self) + self.llvm_reprs[key] = result + self.depth -= 1 + return result + #XXX find the right type if it is not a Primitive + except AttributeError: + pass for cl in self.repr_classes: try: g = cl.get(obj, self) except AttributeError: continue if g is not None: - self.llvm_reprs[get_key(obj)] = g + self.llvm_reprs[key] = g self.local_counts[g] = 0 -## if not hasattr(g.__class__, "lazy_attributes"): -## if debug: -## print " " * self.depth, -## print "calling setup of %s, repr of %s" % (g, obj) -## g.setup() self.depth -= 1 return g raise CompileError, "Can't get repr of %s, %s" % (obj, obj.__class__) @@ -182,7 +213,7 @@ def unlazyify(self): if debug: print - print "$$$$$$$$$$$$$$ unlazyify" + print "unlazyify" while len(self.lazy_objects): obj = self.lazy_objects.pop() if debug: @@ -226,3 +257,11 @@ remove_loops(l_dep, seen_repr.union(sets.Set([l_repr]))) deps.difference_update(remove) +## def f(): +## l = [10,20,30] +## return l[2] + +## t = Translator(f) +## a = t.annotate([]) + +## flg = t.getflowgraph() Modified: pypy/branch/pycompiler/translator/llvm/llvmbc.py ============================================================================== --- pypy/branch/pycompiler/translator/llvm/llvmbc.py (original) +++ pypy/branch/pycompiler/translator/llvm/llvmbc.py Mon May 30 16:50:36 2005 @@ -86,6 +86,14 @@ self.phi_done = True self.instructions.append("unwind") + #Arithmetic instructions + def binary_instruction(self, instr, l_target, l_a, l_b): + self.phi_done = True + assert l_a.llvmtype() == l_b.llvmtype() + s = "%s = %s %s, %s" % (l_target.llvmname(), instr, + l_a.typed_name(), l_b.llvmname()) + self.instructions.append(s) + #Memory access instructions def load(self, l_target, l_pter): self.phi_done = True Modified: pypy/branch/pycompiler/translator/llvm/pbcrepr.py ============================================================================== --- pypy/branch/pycompiler/translator/llvm/pbcrepr.py (original) +++ pypy/branch/pycompiler/translator/llvm/pbcrepr.py Mon May 30 16:50:36 2005 @@ -85,7 +85,7 @@ self.memlayout = MemoryLayout(attribs, l_types, self.gen) self.definition = "%s = %s" % (self.name, self.memlayout.definition()) s = "\n%s = internal global %%std.class {%%std.class* null, uint %i}" - self.definition += s % (self.objectname, abs(id(self))) + self.definition += s % (self.objectname, abs(id(self)) & 0xFFFFFFF) def llvmtype(self): return "%std.class*" Modified: pypy/branch/pycompiler/translator/llvm/representation.py ============================================================================== --- pypy/branch/pycompiler/translator/llvm/representation.py (original) +++ pypy/branch/pycompiler/translator/llvm/representation.py Mon May 30 16:50:36 2005 @@ -21,15 +21,20 @@ from pypy.objspace.flow.model import Variable, Constant from pypy.objspace.flow.model import last_exception -# this is only used as a token for the pointer to the last exception object -last_exc_value = object() + +from pypy.rpython import lltype from pypy.annotation import model as annmodel from pypy.translator.llvm.lazyattribute import MetaLazyRepr + LLVM_SIMPLE_TYPES = {annmodel.SomeChar: "sbyte", annmodel.SomeBool: "bool", annmodel.SomeFloat: "double"} +# this is only used as a token for the pointer to the last exception object +last_exc_value = object() + + debug = False @@ -65,6 +70,14 @@ def llvmtype(self): return self.type.typename() + def llvmsize(self): + raise NotImplementedError, "This object has no size!" + + def op(self, opname, l_target, args, lblock, l_func): + if hasattr(self, "type") and hasattr(self.type, "t_op"): + return self.type.t_op(opname, l_target, args, lblock, l_func) + raise CompileError, "op '%s' not supported" % opname + def typed_name(self): return self.llvmtype() + " " + self.llvmname() @@ -74,7 +87,68 @@ except AttributeError: return sets.Set() +class SignedRepr(LLVMRepr): + def __init__(self, value, gen): + if debug: + print "SignedRepr: %d" % value + self.value = value + self.gen = gen + self.type = self.gen.get_repr(lltype.Signed) + + def llvmname(self): + return str(self.value) + + def get_dependencies(self): + return [self.type] + +class UnsignedRepr(LLVMRepr): + def __init__(self, value, gen): + if debug: + print "UnsignedRepr: %d" % value + self.value = value + self.gen = gen + self.type = self.gen.get_repr(lltype.Unsigned) + def llvmname(self): + return str(self.value) + + def get_dependencies(self): + return [self.type] + +class BoolRepr(LLVMRepr): + def __init__(self, value, gen): + if debug: + print "BoolRepr: %d" % value + self.value = bool(value) + self.gen = gen + self.type = self.gen.get_repr(lltype.Bool) + + def llvmname(self): + return str(self.value).lower() + + def get_dependencies(self): + return [self.type] + +class CharRepr(LLVMRepr): + def __init__(self, value, gen): + if debug: + print "CharRepr: %d" % value + assert len(value) == 1 + self.value = value + self.gen = gen + self.type = self.gen.get_repr(lltype.Char) + + def llvmname(self): + value = value + if ' ' <= value < '\x7f': + return "'%s'" % (value.replace("'", r"\'"),) + else: + return '%d' % ord(value) + + def get_dependencies(self): + return [self.type] + + class SimpleRepr(LLVMRepr): """Representation of values that only need simple representation: bool, char (string of length 1), last_exception, last_exc_value""" @@ -163,14 +237,19 @@ if debug: print "VariableRepr: %s" % (var.name) self.var = var - type_ = gen.annotator.binding(var) + try: + type_ = var.concretetype + except AttributeError: + type_ = gen.annotator.binding(var.c) self.type = gen.get_repr(type_) + print "XXXXXXXXXXXXXXXX", self.type self.dependencies = sets.Set([self.type]) def llvmname(self): return "%" + self.var.name def __getattr__(self, name): + print "$%%%%%%%%%%%%%%%%%getattr called", name, self.type.typename() if name.startswith("op_"): return getattr(self.type, "t_" + name, None) elif name.startswith("cast_"): Modified: pypy/branch/pycompiler/translator/llvm/test/test_class.py ============================================================================== --- pypy/branch/pycompiler/translator/llvm/test/test_class.py (original) +++ pypy/branch/pycompiler/translator/llvm/test/test_class.py Mon May 30 16:50:36 2005 @@ -14,6 +14,7 @@ class TestClass(object): def setup_method(self, method): + py.test.skip("nothing works for now") if not llvm_found: py.test.skip("llvm-as not found on path.") @@ -71,6 +72,6 @@ assert f(True) == -36 assert f(False) == 14 - def test_circular_classdef(self): + def DONOTtest_circular_classdef(self): f = compile_function(llvmsnippet.circular_classdef, []) assert f() == 10 Modified: pypy/branch/pycompiler/translator/llvm/test/test_genllvm.py ============================================================================== --- pypy/branch/pycompiler/translator/llvm/test/test_genllvm.py (original) +++ pypy/branch/pycompiler/translator/llvm/test/test_genllvm.py Mon May 30 16:50:36 2005 @@ -62,7 +62,7 @@ f = compile_function(llvmsnippet.simple2, []) assert f() == 0 - def test_simple4(self): + def DONOTtest_simple4(self): f = compile_function(llvmsnippet.simple4, []) assert f() == 4 @@ -71,7 +71,7 @@ assert f(1) == 12 assert f(0) == 13 - def test_ackermann(self): + def DONOTtest_ackermann(self): f = compile_function(llvmsnippet.ackermann, [int, int]) for i in range(10): assert f(0, i) == i + 1 @@ -79,26 +79,27 @@ assert f(2, i) == 2 * i + 3 assert f(3, i) == 2 ** (i + 3) - 3 - def test_calling(self): + def DONOTtest_calling(self): f = compile_function(llvmsnippet.calling1, [int]) assert f(10) == 1 - def test_call_default_arguments(self): + def DONOTtest_call_default_arguments(self): f = compile_function(llvmsnippet.call_default_arguments, [int, int]) for i in range(3): assert f(i + 3, i) == llvmsnippet.call_default_arguments(i + 3, i) - def test_call_list_default_argument(self): + def DONOTtest_call_list_default_argument(self): f = compile_function(llvmsnippet.call_list_default_argument, [int]) for i in range(20): assert f(i) == llvmsnippet.call_list_default_argument(i) - def test_return_none(self): + def DONOTtest_return_none(self): f = compile_function(llvmsnippet.return_none, []) assert f() is None class TestFloat(object): def setup_method(self, method): + py.test.skip("nothing works for now") if not llvm_found: py.test.skip("llvm-as not found on path.") @@ -113,6 +114,7 @@ class TestString(object): def setup_method(self, method): + py.test.skip("nothing works for now") if not llvm_found: py.test.skip("llvm-as not found on path.") @@ -123,6 +125,7 @@ class TestException(object): def setup_method(self,method): + py.test.skip("nothing works for now") if not llvm_found: py.test.skip("llvm-as not found on path") @@ -159,6 +162,7 @@ class TestPBC(object): def setup_method(self, method): + py.test.skip("nothing works for now") if not llvm_found: py.test.skip("llvm-as not found on path.") @@ -169,7 +173,7 @@ assert f(2) == 6 assert f(3) == 8 - def test_pbc_function2(self): + def DONOTtest_pbc_function2(self): f = compile_function(llvmsnippet.pbc_function2, [int]) assert f(0) == 13 assert f(1) == 15 Modified: pypy/branch/pycompiler/translator/llvm/test/test_seq.py ============================================================================== --- pypy/branch/pycompiler/translator/llvm/test/test_seq.py (original) +++ pypy/branch/pycompiler/translator/llvm/test/test_seq.py Mon May 30 16:50:36 2005 @@ -14,6 +14,7 @@ class TestLLVMArray(object): def setup_method(self, method): + py.test.skip("nothing works for now") if not llvm_found: py.test.skip("llvm-as not found on path.") @@ -107,6 +108,7 @@ class TestTuple(object): def setup_method(self, method): + py.test.skip("nothing works for now") if not llvm_found: py.test.skip("llvm-as not found on path.") Modified: pypy/branch/pycompiler/translator/llvm/test/test_snippet.py ============================================================================== --- pypy/branch/pycompiler/translator/llvm/test/test_snippet.py (original) +++ pypy/branch/pycompiler/translator/llvm/test/test_snippet.py Mon May 30 16:50:36 2005 @@ -14,6 +14,7 @@ class TestSnippet(object): def setup_method(self, method): + py.test.skip("nothing works for now") if not llvm_found: py.test.skip("llvm-as not found on path.") Modified: pypy/branch/pycompiler/translator/llvm/typerepr.py ============================================================================== --- pypy/branch/pycompiler/translator/llvm/typerepr.py (original) +++ pypy/branch/pycompiler/translator/llvm/typerepr.py Mon May 30 16:50:36 2005 @@ -16,6 +16,12 @@ from pypy.translator.llvm.representation import LLVM_SIMPLE_TYPES +import sys +if 2147483647 == sys.maxint: + BYTES_IN_INT = 4 +else: + BYTES_IN_INT = 8 + class TypeRepr(LLVMRepr): def get(obj, gen): @@ -56,10 +62,92 @@ return self.name def llvmname(self): - raise CompileError, "This type is not an object." + raise NotImplementedError, "This type is not an object." def llvmtype(self): - raise CompileError, "This type is not an object." + raise NotImplementedError, \ + "This type is not an object. %s" % self.__class__ + + def llvmsize(self): + raise NotImplementedError, "This type does not have a size." + + +class SignedTypeRepr(TypeRepr): + directly_supported_ops = { + "int_add": "add", + "int_sub": "sub", + "int_mul": "mul", + "int_div": "div", + "int_mod": "rem", + "int_xor": "xor", + "int_and_": "and", + "int_eq": "seteq", + "int_ne": "setne", + "int_gt": "setgt", + "int_ge": "setge", + "int_lt": "setlt", + "int_le": "setle"} + + def __init__(self, gen): + if debug: + print "SignedTypeRepr" + self.gen = gen + + def t_op(self, opname, l_target, args, lblock, l_func): + if opname in SignedTypeRepr.directly_supported_ops: + assert len(args) == 2 + l_args = [self.gen.get_repr(arg) for arg in args] + l_func.dependencies.update(l_args) + lblock.binary_instruction( + SignedTypeRepr.directly_supported_ops[opname], l_target, + l_args[0], l_args[1]) + + def t_op_int_is_true(self, l_target, args, lblock, l_func): + l_arg = self.gen.get_repr(args[0]) + l_func.dependencies.add(l_arg) + lblock.cast(l_target, l_arg) + + def typename(self): + return "int" + + def llvmsize(self): + return BYTES_IN_INT + +class UnsignedTypeRepr(TypeRepr): + def __init__(self, gen): + if debug: + print "UnsignedTypeRepr" + self.gen = gen + + def typename(self): + return "uint" + + def llvmsize(self): + return BYTES_IN_INT + +class BoolTypeRepr(TypeRepr): + def __init__(self, gen): + if debug: + print "BoolTypeRepr" + self.gen = gen + + def typename(self): + return "bool" + + def llvmsize(self): + return 1 + +class CharTypeRepr(TypeRepr): + def __init__(self, gen): + if debug: + print "CharTypeRepr" + self.gen = gen + + def typename(self): + return "sbyte" + + def llvmsize(self): + return 1 class StringTypeRepr(TypeRepr): Modified: pypy/branch/pycompiler/translator/test/test_annrpython.py ============================================================================== --- pypy/branch/pycompiler/translator/test/test_annrpython.py (original) +++ pypy/branch/pycompiler/translator/test/test_annrpython.py Mon May 30 16:50:36 2005 @@ -1037,7 +1037,15 @@ finally: sys.argv = oldvalue assert s is not None - + + def test_pow(self): + def f(n): + n **= 2 + return 2 ** n + a = self.RPythonAnnotator() + s = a.build_types(f, [int]) + # result should be an integer + assert s.knowntype == int def g(n): From ale at codespeak.net Mon May 30 22:46:45 2005 From: ale at codespeak.net (ale at codespeak.net) Date: Mon, 30 May 2005 22:46:45 +0200 (CEST) Subject: [pypy-svn] r12903 - pypy/dist/pypy/lib Message-ID: <20050530204645.302B227B60@code1.codespeak.net> Author: ale Date: Mon May 30 22:46:44 2005 New Revision: 12903 Modified: pypy/dist/pypy/lib/inprogress__codecs.py pypy/dist/pypy/lib/unicodecodec.py (contents, props changed) Log: fixed some bugs. It seems that the python implementation wont add new errors to the python regression tests. If someone would be so kind as to run the tests for me (just rename inprogress__codecs.py to _codecs.py), I will try to implement Armin's suggested solution for not modifying the encodings module. Test_unicode.py should also work (a part from two failures which should be fixed in unicodetype.py) Modified: pypy/dist/pypy/lib/inprogress__codecs.py ============================================================================== --- pypy/dist/pypy/lib/inprogress__codecs.py (original) +++ pypy/dist/pypy/lib/inprogress__codecs.py Mon May 30 22:46:44 2005 @@ -165,14 +165,14 @@ def utf_7_decode( data,errors='strict'): """None """ - res = PyUnicode_DecodeUTF7(data,len(data),errors='strict') + res = PyUnicode_DecodeUTF7(data,len(data),errors) res = ''.join(res) return res,len(res) def unicode_escape_encode( obj,errors='strict'): """None """ - res = PyUnicode_EncodeUnicodeEscape(data,len(data),errors) + res = unicodeescape_string(obj,len(obj),0) res = ''.join(res) return res, len(res) Modified: pypy/dist/pypy/lib/unicodecodec.py ============================================================================== --- pypy/dist/pypy/lib/unicodecodec.py (original) +++ pypy/dist/pypy/lib/unicodecodec.py Mon May 30 22:46:44 2005 @@ -1,1268 +1,1246 @@ -import sys -""" Python implementation of CPythons builtin unicode codecs. - - Generally the functions in this module take a list of characters an returns - a list of characters. - - For use in the PyPy project""" - - -## indicate whether a UTF-7 character is special i.e. cannot be directly -## encoded: -## 0 - not special -## 1 - special -## 2 - whitespace (optional) -## 3 - RFC2152 Set O (optional) - -utf7_special = [ - 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 1, 1, 2, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 2, 3, 3, 3, 3, 3, 3, 0, 0, 0, 3, 1, 0, 0, 0, 1, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 0, - 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 1, 3, 3, 3, - 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 1, 1, -] -unicode_latin1=[None]*256 - -codec_error_registry = {} -def lookup_error(errors): - """lookup_error(errors) -> handler - - Return the error handler for the specified error handling name - or raise a LookupError, if no handler exists under this name. - """ - - try: - err_handler = codec_error_registry[errors] - except KeyError: - raise LookupError("unknown error handler name %s"%errors) - return err_handler - -def register_error(errors, handler): - """register_error(errors, handler) - - Register the specified error handler under the name - errors. handler must be a callable object, that - will be called with an exception instance containing - information about the location of the encoding/decoding - error and must return a (replacement, new position) tuple. - """ - if callable(handler): - codec_error_registry[errors] = handler - else: - raise TypeError("handler must be callable") - - -def PyUnicode_Check(op): - return type(op) == unicode -def PyUnicode_CheckExact(op): - return (type(op) == unicode) - - -def PyUnicode_GET_SIZE(op): - return len(unicode(op)) -def PyUnicode_GET_DATA_SIZE(op): - return len(unicode(op)) * len(u' ') -def PyUnicode_AS_UNICODE(op): - unicode(op) -def PyUnicode_AS_DATA(op): - buffer(unicode(op)) #XXX This is a read only buffer - -def SPECIAL(c, encodeO, encodeWS): - c = ord(c) - return (c>127 or utf7_special[c] == 1) or \ - (encodeWS and (utf7_special[(c)] == 2)) or \ - (encodeO and (utf7_special[(c)] == 3)) -def B64(n): - return ("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[(n) & 0x3f]) -def B64CHAR(c): - return (c.isalnum() or (c) == '+' or (c) == '/') -def UB64(c): - if (c) == '+' : - return 62 - elif (c) == '/': - return 63 - elif (c) >= 'a': - return ord(c) - 71 - elif (c) >= 'A': - return ord(c) - 65 - else: - return ord(c) + 4 - -def ENCODE( ch, bits) : - charvalue = 0 - out = [] - for c in ch: - charvalue <<= 16 - charvalue += ord(c) - while (bits >= 6): - out += B64(charvalue >> (bits-6)) - bits -= 6; - return out,bits - -def DECODE( ch, bits, surrogate): - out = [] - while (bits >= 16): - outCh = unicode (chr((ord(ch) >> (bits-16)) & 0xffff)) - bits -= 16 - if (surrogate): - ## We have already generated an error for the high surrogate - ## so let's not bother seeing if the low surrogate is correct or not - surrogate = 0 - elif (0xDC00 <= outCh and outCh <= 0xDFFF): -## This is a surrogate pair. Unfortunately we can't represent -## it in a 16-bit character - surrogate = 1 - raise UnicodeDecodeError,"code pairs are not supported" - else: - out += outCh - return out,bits,surrogate - -def PyUnicode_DecodeUTF7(s, size, errors): - - starts = s - errmsg = "" - inShift = 0 - bitsleft = 0 - charsleft = 0 - surrogate = 0 - p = [] - errorHandler = None - exc = None - - if (size == 0): - return unicode('') - i = 0 - while i < size: - - ch = s[i] - if (inShift): - if ((ch == '-') or not B64CHAR(ch)): - inShift = 0 - i += 1 - out, bitsleft, surrogate = DECODE(charsleft, bitsleft, surrogate) - p += out - if (bitsleft >= 6): -## /* The shift sequence has a partial character in it. If -## bitsleft < 6 then we could just classify it as padding -## but that is not the case here */ - - raise UnicodeDecodeError, "partial character in shift sequence" -## /* According to RFC2152 the remaining bits should be zero. We -## choose to signal an error/insert a replacement character -## here so indicate the potential of a misencoded character. */ - -## /* On x86, a << b == a << (b%32) so make sure that bitsleft != 0 */ - if (bitsleft and (charsleft << (sizeof(charsleft) * 8 - bitsleft))): - raise UnicodeDecodeError, "non-zero padding bits in shift sequence" - if (ch == '-') : - if ((i < size) and (s[i] == '-')) : - p += '-' - inShift = 1 - - elif SPECIAL(ch,0,0) : - raise UnicodeDecodeError,"unexpected special character" - - else: - p += ch - else: - charsleft = (charsleft << 6) | UB64(ch) - bitsleft += 6 - i+=1 -## /* p, charsleft, bitsleft, surrogate = */ DECODE(p, charsleft, bitsleft, surrogate); - elif ( ch == '+' ): - startinpos = i - i+=1 - if (i 0 - else: - out += ch - else: - if (not SPECIAL(ch, encodeSetO, encodeWhiteSpace)): - out += B64(ord(charsleft) << (6-bitsleft)) - charsleft = '' - bitsleft = 0 -## /* Characters not in the BASE64 set implicitly unshift the sequence -## so no '-' is required, except if the character is itself a '-' */ - if (B64CHAR(ch) or ch == '-'): - out += '-' - inShift = 0 - out += ch - else: - bitsleft += 16 - charsleft += ch #((ord(charsleft) << 16) | ord(ch)) - p, bitsleft = ENCODE(charsleft, bitsleft) - out += p -## /* If the next character is special then we dont' need to terminate -## the shift sequence. If the next character is not a BASE64 character -## or '-' then the shift sequence will be terminated implicitly and we -## don't have to insert a '-'. */ - - if (bitsleft == 0): - if (i + 1 < size): - ch2 = s[i+1] - - if (SPECIAL(ch2, encodeSetO, encodeWhiteSpace)): - pass - elif (B64CHAR(ch2) or ch2 == '-'): - out += '-' - inShift = 0 - else: - inShift = 0 - else: - out += '-' - inShift = 0 - i+=1 - - if (bitsleft): - out += [B64(ord(cc) << (6-bitsleft) ) for cc in charsleft] - out += '-' - - return out - -def PyUnicode_FromOrdinal(ordinal): - - if (ordinal < 0 or ordinal > 0x10ffff): - raise ValueError, "unichr() arg not in range(0x110000) (wide Python build)" - -## if (ordinal < 0 or ordinal > 0xffff): -## raise ValueError, "unichr() arg not in range(0x1000) (narrow Python build)" - - s = unichr(ordinal) - return s,1 - -def PyUnicode_FromObject(obj): - -## /* XXX Perhaps we should make this API an alias of -## PyObject_Unicode() instead ?! */ - if (PyUnicode_CheckExact(obj)): - return obj - - if (PyUnicode_Check(obj)): -## /* For a Unicode subtype that's not a Unicode object, -## return a true Unicode object with the same data. */ - return PyUnicode_FromUnicode(PyUnicode_AS_UNICODE(obj),PyUnicode_GET_SIZE(obj)) - return PyUnicode_FromEncodedObject(obj, None, "strict") - -unicode_empty=u'' - -def PyUnicode_FromUnicode(u, size): - -## /* If the Unicode data is known at construction time, we can apply -## some optimizations which share commonly used objects. */ - if (u): - -## /* Optimization for empty strings */ - if (size == 0 and unicode_empty != None) : - return unicode_empty - - ## /* Single character Unicode objects in the Latin-1 range are - ## shared when using this constructor */ - return unicode(u) - -def PyUnicode_Decode(s,size,encoding,errors): - - if (encoding == None): - encoding = PyUnicode_GetDefaultEncoding() - -## /* Shortcuts for common default encodings */ - decoder = encodings.get(encoding,None) - if decoder: - return decoder(s,encoding,errors) -## /* Decode via the codec registry */ - buf = buffer(s) - result = PyCodec_Decode(buf, encoding, errors); - if (not PyUnicode_Check(result)): - raise UnicodeDecodeError, "decoder did not return an unicode object (type=%.400s)"%type(result) - return result - -def PyUnicode_FromEncodedObject(obj, encoding,errors): - - s = str(obj) - v = PyUnicode_Decode(s, len(s), encoding, errors) - return v - -def unicodeescape_string(s, size, quotes): - - - p = [] - if (quotes) : - p += 'u' - if (s.find('\'')!=-1 and s.find('"')==-1): - p += '"' - else: - p += '\'' - pos = 0 - while (pos < size): - ch = s[pos] - #/* Escape quotes */ - if (quotes and (ch == p[1] or ch == '\\')): - p += '\\' - p += ch - continue - -#ifdef Py_UNICODE_WIDE - #/* Map 21-bit characters to '\U00xxxxxx' */ - elif (ord(ch) >= 0x10000): - p += '\\' - p += 'U' - p += '%08x'%ord(ch) - continue -#endif - #/* Map UTF-16 surrogate pairs to Unicode \UXXXXXXXX escapes */ - elif (ord(ch) >= 0xD800 and ord(ch) < 0xDC00): - pos += 1 - ch2 = s[pos] - - if (ord(ch2) >= 0xDC00 and ord(ch2) <= 0xDFFF): - ucs = (((ord(ch) & 0x03FF) << 10) | (ord(ch2) & 0x03FF)) + 0x00010000 - p += '\\' - p += 'U' - p += '%08x'%ucs - continue - - #/* Fall through: isolated surrogates are copied as-is */ - pos -= 1 - - #/* Map 16-bit characters to '\uxxxx' */ - if (ord(ch) >= 256): - p += '\\' - p += 'u' - p += '%04x'%ord(ch) - - #/* Map special whitespace to '\t', \n', '\r' */ - elif (ch == '\t'): - p += '\\' - p += 't' - - elif (ch == '\n'): - p += '\\' - p += 'n' - - elif (ch == '\r'): - p += '\\' - p += 'r' - - #/* Map non-printable US ASCII to '\xhh' */ - elif (ch < ' ' or ch >= 0x7F) : - p += '\\' - p += 'x' - p += '%02x'%ord(ch) - #/* Copy everything else as-is */ - else: - p += ch - - if (quotes): - p += p[1] - return p - -def PyUnicode_DecodeASCII(s, size, errors): - -# /* ASCII is equivalent to the first 128 ordinals in Unicode. */ - if (size == 1 and ord(s) < 128) : - return [unichr(ord(s))] - if (size == 0): - return [u''] #unicode('') - p = [] - pos = 0 - while pos < len(s): - c = s[pos] - if ord(c) < 128: - p += unichr(ord(c)) - pos += 1 - else: - - res = unicode_call_errorhandler( - errors, "ascii", "ordinal not in range(128)", - s, pos, pos+1) - p += unicode(res[0]) - pos = res[1] - return p - -def PyUnicode_EncodeASCII(p,size,errors): - - return unicode_encode_ucs1(p, size, errors, 128) - -def PyUnicode_AsASCIIString(unistr): - - if not type(unistr) == unicode: - raise BadArgumnentError - return PyUnicode_EncodeASCII(PyUnicode_AS_UNICODE(unistr), - len(unicode), - None) - -def PyUnicode_DecodeUTF16Stateful(s,size,errors,byteorder='native',consumed=None): - - bo = 0 #/* assume native ordering by default */ - errmsg = "" - - if sys.byteorder == 'little': - ihi = 1 - ilo = 0 - else: - ihi = 0 - ilo = 1 - - if (size == 0): - return [u''] - - #/* Unpack UTF-16 encoded data */ - -## /* Check for BOM marks (U+FEFF) in the input and adjust current -## byte order setting accordingly. In native mode, the leading BOM -## mark is skipped, in all other modes, it is copied to the output -## stream as-is (giving a ZWNBSP character). */ - q = 0 - if byteorder == 'native': - if (size >= 2): - bom = (ord(s[ihi]) << 8) | ord(s[ilo]) -#ifdef BYTEORDER_IS_LITTLE_ENDIAN - if sys.byteorder == 'little': - if (bom == 0xFEFF): - q += 2 - bo = -1 - elif bom == 0xFFFE: - q += 2 - bo = 1 - else: - if bom == 0xFEFF: - q += 2 - bo = 1 - elif bom == 0xFFFE: - q += 2 - bo = -1 - elif byteorder == 'little': - bo = -1 - else: - bo = 1 - - if (bo == -1): - #/* force LE */ - ihi = 1 - ilo = 0 - - elif (bo == 1): - #/* force BE */ - ihi = 0 - ilo = 1 - - while (q < len(s)): - - #/* remaining bytes at the end? (size should be even) */ - if (len(s)-q<2): - if (consumed): - break - errmsg = "truncated data"; - startinpos = q - endinpos = len(s) - unicode_call_errorhandler() -## /* The remaining input chars are ignored if the callback -## chooses to skip the input */ - - ch = (s[q+ihi] << 8) | s[q+ilo] - q += 2 - - if (ch < 0xD800 or ch > 0xDFFF): - p += unichr(ch) - continue - - #/* UTF-16 code pair: */ - if (q >= e): - errmsg = "unexpected end of data"; - startinpos = q-2 - endinpos = len(s) - unicode_call_errorhandler - - if (0xD800 <= ch and ch <= 0xDBFF): - ch2 = (s[q+ihi] << 8) | s[q+ilo] - q += 2 - if (0xDC00 <= ch2 and ch2 <= 0xDFFF): - #ifndef Py_UNICODE_WIDE - if sys.maxunicode < 65536: - p += unichr(ch) - p += unichr(ch2) - else: - p += unichr((((ch & 0x3FF)<<10) | (ch2 & 0x3FF)) + 0x10000) - #endif - continue - - else: - errmsg = "illegal UTF-16 surrogate"; - startinpos = q-4 - endinpos = startinpos+2 - unicode_call_errorhandler - - errmsg = "illegal encoding"; - startinpos = q-2 - endinpos = startinpos+2 - unicode_call_errorhandler - - -## if (byteorder): -## byteorder = bo -## -## if (consumed): -## consumed = (const char *)q-starts; - return p - -def PyUnicode_EncodeUTF16(s,size,errors,byteorder='little'): - -# /* Offsets from p for storing byte pairs in the right order. */ -###ifdef BYTEORDER_IS_LITTLE_ENDIAN -## int ihi = 1, ilo = 0; -###else -## int ihi = 0, ilo = 1; -###endif - - def STORECHAR(CH,byteorder): - hi = chr(((CH) >> 8) & 0xff) - lo = chr((CH) & 0xff) - if byteorder == 'little': - return [lo,hi] - else: - return [hi,lo] - - p = [] - bom = sys.byteorder - if (byteorder == 'native'): - - bom = sys.byteorder - p += STORECHAR(0xFEFF,bom) - - if (size == 0): - return "" - - if (byteorder == 'little' ): - bom = 'little' - elif (byteorder == 'big'): - bom = 'big' - - - for c in s: - ch = ord(c) - ch2 = 0 - if (ch >= 0x10000) : - ch2 = 0xDC00 | ((ch-0x10000) & 0x3FF) - ch = 0xD800 | ((ch-0x10000) >> 10) - - p += STORECHAR(ch,bom) - if (ch2): - p +=STORECHAR(ch2,bom) - - return p - - -def PyUnicode_DecodeMBCS(s, size, errors): - pass -##{ -## PyUnicodeObject *v; -## Py_UNICODE *p; -## -## /* First get the size of the result */ -## DWORD usize = MultiByteToWideChar(CP_ACP, 0, s, size, NULL, 0); -## if (size > 0 && usize==0) -## return PyErr_SetFromWindowsErrWithFilename(0, NULL); -## -## v = _PyUnicode_New(usize); -## if (v == NULL) -## return NULL; -## if (usize == 0) -## return (PyObject *)v; -## p = PyUnicode_AS_UNICODE(v); -## if (0 == MultiByteToWideChar(CP_ACP, 0, s, size, p, usize)) { -## Py_DECREF(v); -## return PyErr_SetFromWindowsErrWithFilename(0, NULL); -## } -## -## return (PyObject *)v; -##} - -def PyUnicode_EncodeMBCS(p, size, errors): - pass -#### /* If there are no characters, bail now! */ -## if (size==0) -## return "" -## from ctypes import * -## WideCharToMultiByte = windll.kernel32.WideCharToMultiByte -#### /* First get the size of the result */ -## mbcssize = WideCharToMultiByte(CP_ACP, 0, p, size, s, 0, None, None); -## if (mbcssize==0) -## raise UnicodeEncodeError, "Windows cannot decode the string %s" %p -### More error handling required (check windows errors and such) -## -### /* Do the conversion */ -#### s = ' '*mbcssize -#### if (0 == WideCharToMultiByte(CP_ACP, 0, p, size, s, mbcssize, NULL, NULL)): -#### raise UnicodeEncodeError, "Windows cannot decode the string %s" %p -## return s -def unicode_call_errorhandler(errors, encoding, - reason, input, startinpos, endinpos,decode=True): - - errorHandler = lookup_error(errors) - if decode: - exceptionObject = UnicodeDecodeError(encoding, input, startinpos, endinpos, reason) - else: - exceptionObject = UnicodeEncodeError(encoding, input, startinpos, endinpos, reason) - res = errorHandler(exceptionObject) - if isinstance(res,tuple) and isinstance(res[0],unicode) and isinstance(res[1],int): - newpos = res[1] - if (newpos<0): - newpos = len(input)+newpos - if newpos<0 or newpos>len(input): - raise IndexError( "position %d from error handler out of bounds", newpos) - return res[0],newpos - else: - raise TypeError("encoding error handler must return (unicode, int) tuple") - -def PyUnicode_DecodeUTF8(s, size, errors): - - return PyUnicode_DecodeUTF8Stateful(s, size, errors, None); - -## /* Map UTF-8 encoded prefix byte to sequence length. zero means -## illegal prefix. see RFC 2279 for details */ -utf8_code_length = [ - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 0, 0 -] - -def PyUnicode_DecodeUTF8Stateful(s,size,errors,consumed): - - if (size == 0): - if (consumed): - consumed = 0 - return u'' - - p = [] - pos = 0 - while pos < size: - ch = s[pos] - if ord(ch) < 0x80: - p += ch - pos += 1 - continue - - n = utf8_code_length[ord(ch)] - startinpos = pos - if (startinpos + n > size): - if (consumed): - break - else: - errmsg = "unexpected end of data" - endinpos = size - res = unicode_call_errorhandler( - errors, "utf8", errmsg, - s, startinpos, endinpos) - p += res[0] - pos = res[1] - if n == 0: - errmsg = "unexpected code byte" - endinpos = startinpos+1 - res = unicode_call_errorhandler( - errors, "utf8", errmsg, - s, startinpos, endinpos) - p += res[0] - pos = res[1] - elif n == 1: - errmsg = "internal error" - endinpos = startinpos+1 - res = unicode_call_errorhandler( - errors, "utf8", errmsg, - s, startinpos, endinpos) - p += res[0] - pos = res[1] - elif n == 2: - if ((ord(s[pos+1]) & 0xc0) != 0x80): - errmsg = "invalid data" - endinpos = startinpos+2 - res = unicode_call_errorhandler( - errors, "utf8", errmsg, - s, startinpos, endinpos) - p += res[0] - pos = res[1] - else: - c = ((ord(s[pos]) & 0x1f) << 6) + (ord(s[pos+1]) & 0x3f) - if c<0x80: - errmsg = "illegal encoding" - endinpos = startinpos+2 - res = unicode_call_errorhandler( - errors, "utf8", errmsg, - s, startinpos, endinpos) - p += res[0] - pos = res[1] - else: - p += unichr(c) - pos += n - #break - elif n == 3: - if ((ord(s[pos+1]) & 0xc0) != 0x80 or - (ord(s[pos+2]) & 0xc0) != 0x80): - errmsg = "invalid data" - endinpos = startinpos+3 - res = unicode_call_errorhandler( - errors, "utf8", errmsg, - s, startinpos, endinpos) - p += res[0] - pos = res[1] - else: - c = ((ord(s[pos]) & 0x0f) << 12) + \ - ((ord(s[pos+1]) & 0x3f) << 6) +\ - (ord(s[pos+2]) & 0x3f) -## /* Note: UTF-8 encodings of surrogates are considered -## legal UTF-8 sequences; -## -## XXX For wide builds (UCS-4) we should probably try -## to recombine the surrogates into a single code -## unit. -## */ - if c < 0x8000: - errmsg = "illegal encoding" - endinpos = startinpos+3 - res = unicode_call_errorhandler( - errors, "utf8", errmsg, - s, startinpos, endinpos) - p += res[0] - pos = res[1] - else: - p += unichr(c) - pos += n - if n == 4: - -## case 4: - if ((ord(s[1]) & 0xc0) != 0x80 or - (ord(s[2]) & 0xc0) != 0x80 or - (ord(s[3]) & 0xc0) != 0x80): - - errmsg = "invalid data" - startinpos = pos - endinpos = startinpos+4 - res = unicode_call_errorhandler( - errors, "utf8", errmsg, - s, startinpos, endinpos) - p += res[0] - pos = res[1] - else: - c = ((ord(s[0]) & 0x7) << 18) + ((ord(s[1]) & 0x3f) << 12) +\ - ((ord(s[2]) & 0x3f) << 6) + (ord(s[3]) & 0x3f) - #/* validate and convert to UTF-16 */ - if ((c < 0x10000) or (c > 0x10ffff)): - #/* minimum value allowed for 4 byte encoding */ - #/* maximum value allowed for UTF-16 */ - - errmsg = "illegal encoding" - startinpos = pos - endinpos = startinpos+4 - res = unicode_call_errorhandler( - errors, "utf8", errmsg, - s, startinpos, endinpos) - p += res[0] - pos = res[1] - else: - #ifdef Py_UNICODE_WIDE - if c> 10)) - #/* low surrogate = bottom 10 bits added to DC00 */ - p += unichr(0xDC00 + (c & 0x03FF)) - pos += n - else: -## default: -## /* Other sizes are only needed for UCS-4 */ - errmsg = "unsupported Unicode code range"; - startinpos = pos - endinpos = startinpos+n - res = unicode_call_errorhandler( - errors, "utf8", errmsg, - s, startinpos, endinpos) - p += res[0] - pos = res[1] - - #continue - - if (consumed): - consumed = pos - return p - -def PyUnicode_EncodeUTF8(s,size,errors): - - #assert(s != None) - assert(size >= 0) - p = [] - i = 0 - while i> 6))) - p += chr((0x80 | (ord(ch) & 0x3f))) - else: -## /* Encode UCS2 Unicode ordinals */ - if (ord(ch) < 0x10000): -## /* Special case: check for high surrogate */ - if (0xD800 <=ord(ch) and ord(ch) <= 0xDBFF and i != size) : - ch2 = s[i] -## /* Check for low surrogate and combine the two to -## form a UCS4 value */ - if (0xDC00 <= ord(ch2) and ord(ch2) <= 0xDFFF) : - ch3 = ((ord(ch) - 0xD800) << 10 | (ord(ch2) - 0xDC00)) + 0x10000 - i+=1 - p.extend(encodeUCS4(ch3)) - continue -## /* Fall through: handles isolated high surrogates */ - p += (chr((0xe0 | (ord(ch) >> 12)))) - p += (chr((0x80 | ((ord(ch) >> 6) & 0x3f)))) - p += (chr((0x80 | (ord(ch) & 0x3f)))) - continue - return p - -def encodeUCS4(ch): -## /* Encode UCS4 Unicode ordinals */ - p=[] - p += (chr((0xf0 | (ch >> 18)))) - p += (chr((0x80 | ((ch >> 12) & 0x3f)))) - p += (chr((0x80 | ((ch >> 6) & 0x3f)))) - p += (chr((0x80 | (ch & 0x3f)))) - return p - -#/* --- Latin-1 Codec ------------------------------------------------------ */ - -def PyUnicode_DecodeLatin1(s, size, errors): - #/* Latin-1 is equivalent to the first 256 ordinals in Unicode. */ -## if (size == 1): -## return [PyUnicode_FromUnicode(s, 1)] - pos = 0 - p = [] - while (pos < size): - p += unichr(ord(s[pos])) - pos += 1 - return p - -def unicode_encode_ucs1(p,size,errors,limit): - - if limit == 256: - reason = "ordinal not in range(256)" - encoding = "latin-1" - else: - reason = "ordinal not in range(128)" - encoding = "ascii" - - if (size == 0): - return [''] - res = [] - pos=0 - while pos < len(p): - #for ch in p: - ch = p[pos] - - if ord(ch) < limit: - res += chr(ord(ch)) - pos += 1 - else: - #/* startpos for collecting unencodable chars */ - collstart = pos - collend = pos+1 - while collend < len(p) and ord(p[collend]) >= limit: - collend += 1 - x = unicode_call_errorhandler(errors,encoding,reason,p,collstart,collend,False) - res += str(x[0]) - pos = x[1] - - return res - -def PyUnicode_EncodeLatin1(p,size,errors): - res=unicode_encode_ucs1(p, size, errors, 256) - return res - -hexdigits = [hex(i)[-1] for i in range(16)]+[hex(i)[-1].upper() for i in range(10,16)] -def hexescape(s,pos,digits,message,errors): - chr = 0 - p = [] - if (pos+digits>len(s)): - message = "end of string in escape sequence" - x = unicode_call_errorhandler(errors,"unicodeescape",message,s,pos-2,len(s)) - p += x[0] - pos = x[1] - else: - try: - chr = int(s[pos:pos+digits],16) - except ValueError: - endinpos = pos - while s[endinpos] in hexdigits: - endinpos +=1 - x = unicode_call_errorhandler(errors,"unicodeescape",message,s,pos-2, - endinpos+1) - p += x[0] - pos = x[1] - #/* when we get here, chr is a 32-bit unicode character */ - else: - if chr < sys.maxunicode: - p += [unichr(chr)] - pos += digits - - elif (chr <= 0x10ffff): - chr -= 0x10000L - p += unichr(0xD800 + (chr >> 10)) - p += unichr(0xDC00 + (chr & 0x03FF)) - pos += digits - else: - message = "illegal Unicode character" - x = unicode_call_errorhandler(errors,"unicodeescape",message,s,pos-2, - pos+1) - p += x[0] - pos = x[1] - res = p - return res,pos - -def PyUnicode_DecodeUnicodeEscape(s, size, errors): - - if (size == 0): - return u'' - - p = [] - pos = 0 - while (pos < size): -## /* Non-escape characters are interpreted as Unicode ordinals */ - if (s[pos] != '\\') : - p += s[pos] - pos += 1 - continue -## /* \ - Escapes */ - else: - pos +=1 - if pos>=len(s): - errmessage = "\\ at end of string" - unicode_call_errorhandler(errors,"unicodeescape",errmessage,s,pos-1,size) - ch = s[pos] - - ## /* \x escapes */ - #if ch == '\n': break; - if ch == '\\': p += '\\' - elif ch == '\'': p += '\'' - elif ch == '\"': p += '\"' - elif ch == 'b': p += '\b' - elif ch == 'f': p += '\014' #/* FF */ - elif ch == 't': p += '\t' - elif ch == 'n': p += '\n' - elif ch == 'r': p += '\r' - elif ch == 'v': p += '\013' #break; /* VT */ - elif ch == 'a': p += '\007' # break; /* BEL, not classic C */ - - ## /* \OOO (octal) escapes */ - elif ch in [ '0','1', '2', '3','4', '5', '6','7']: - x = ord(ch) - ord('0') - ch = s[pos+1] - if ('0' <= ch and ch <= '7'): - x = (x<<3) + ord(ch) - ord('0') - ch = s[pos+2] - if ('0' <= ch and ch <= '7'): - x = (x<<3) + ord(ch) - ord('0') - pos += 3 - - p += unichr(x) - ## /* hex escapes */ - ## /* \xXX */ - elif ch == 'x': - digits = 2; - message = "truncated \\xXX escape"; - x = hexescape(s,pos+1,digits,message,errors) - p += x[0] - pos = x[1] - - # /* \uXXXX */ - elif ch == 'u': - digits = 4; - message = "truncated \\uXXXX escape"; - x = hexescape(s,pos+1,digits,message,errors) - p += x[0] - pos = x[1] - - # /* \UXXXXXXXX */ - elif ch == 'U': - digits = 8 - message = "truncated \\UXXXXXXXX escape"; - x = hexescape(s,pos+1,digits,message,errors) - p += x[0] - pos = x[1] -## /* \N{name} */ - elif ch == 'N': - message = "malformed \\N character escape" - pos += 1 - try: - import unicodedata - except ImportError: - message = "\\N escapes not supported (can't load unicodedata module)" - unicode_call_errorhandler(errors,"unicodeescape",message,s,pos-1,size) - if (s[pos] == '{'): - look = pos+1 - #/* look for the closing brace */ - while (s[look] != '}' and look < size): - look += 1 - if (look > pos+1 and look < size and s[look] == '}'): - #/* found a name. look it up in the unicode database */ - message = "unknown Unicode character name" - look += 1 - try: - chr = unicodedata.lookup(s[pos:look]) - #x = hexescape(chr,pos+1,8,message,errors) - except KeyError: - x=unicode_call_errorhandler(errors,"unicodeescape",message,s,pos-1,look) - else: - x = hexescape(s,pos+1,look-pos,message,errors) - p += x[0] - pos = x[1] - else: - if (pos > size): - message = "\\ at end of string" - handler = lookup_error(errors) - x = handler(UnicodeDecodeError("unicodeescape",s,pos, - pos+digits,message)) - p += x[0] - pos = x[1] - else: - p += '\\' - p += s[pos] - return p - -def PyUnicode_EncodeRawUnicodeEscape(s,size): - - if (size == 0): - return u'' - - p = [] - for ch in s: -# /* Map 32-bit characters to '\Uxxxxxxxx' */ - if (ord(ch) >= 0x10000): - p += '\\' - p += 'U' - p += hex(ord(ch)) - elif (ord(ch) >= 256) : -# /* Map 16-bit characters to '\uxxxx' */ - p += '\\' - p += 'u' - p += hex(ord(ch)) -# /* Copy everything else as-is */ - else: - p += ch - - p += '\0' - return p - -def charmapencode_output(c,mapping): - - - rep = mapping[c] - if isinstance(rep,(int,long)): - if rep<256: - return chr(rep) - else: - raise TypeError -## elif isinstance(rep,unicode): -## raise TypeError - else: - return rep - -def PyUnicode_EncodeCharmap(p,size,mapping='latin-1',errors='strict'): - -## /* the following variable is used for caching string comparisons -## * -1=not initialized, 0=unknown, 1=strict, 2=replace, -## * 3=ignore, 4=xmlcharrefreplace */ - -# /* Default to Latin-1 */ - if mapping == 'latin-1': - return PyUnicode_EncodeLatin1(p, size, errors) - if (size == 0): - return '' - inpos = 0 - res = [] - while (inpos",p,inpos,inpos+1,False) - try: - res += [charmapencode_output(ord(y),mapping) for y in x[0]] - except KeyError: - raise UnicodeEncodeError("charmap",p,inpos,inpos+1, - "character maps to ") - - #/* done with this character => adjust input position */ - inpos+=1 - return res - -def PyUnicode_DecodeCharmap(s, size, mapping, errors): - -## /* Default to Latin-1 */ - if (mapping == None): - return PyUnicode_DecodeLatin1(s, size, errors) - - if (size == 0): - return u'' - p = [] - inpos = 0 - while (inpos< len(s)): - - #/* Get mapping (char ordinal -> integer, Unicode char or None) */ - ch = s[inpos] - try: - x = mapping[ord(ch)] - if isinstance(x,int): - if x<65536: - p += unichr(x) - else: - raise TypeError("character mapping must be in range(65536)") - elif isinstance(x,unicode): - p += x - elif not x: - raise KeyError - else: - raise TypeError - except KeyError: - x = unicode_call_errorhandler(errors,"charmap", - "character maps to ",s,inpos,inpos+1) - p += x[0] -## except TypeError: -## x = unicode_call_errorhandler(errors,"charmap", -## "character mapping must return integer, None or unicode", -## s,inpos,inpos+1) -## p += x[0] - inpos +=1 - return p - -def PyUnicode_DecodeRawUnicodeEscape(s, size,errors): - - if (size == 0): - return u'' - pos = 0 - p = [] - while (pos < len(s)): - ch = s[pos] - #/* Non-escape characters are interpreted as Unicode ordinals */ - if (ch != '\\'): - p += ch - - startinpos = pos - -## /* \u-escapes are only interpreted iff the number of leading -## backslashes is odd */ - bs = pos - while pos < size: - if (s[pos] != '\\'): - break; - p += s[pos] - pos += 1 - - if (((pos - bs) & 1) == 0 or - pos >= size or - (s[pos] != 'u' and s[pos] != 'U')) : - pos += 1 - continue - - p.pop(-1) - if s[pos] == 'u': - count = 4 - else: - count = 8 - pos += 1 - - #/* \uXXXX with 4 hex digits, \Uxxxxxxxx with 8 */ - - i = 0 - x = 0 - try: - x = int(s[pos:pos+count],16) - except ValueError: - res = unicode_call_errorhandler( - errors, "rawunicodeescape", "truncated \\uXXXX", - s, size, pos, pos+count) - p += res[0] - pos = res[1] - else: - #ifndef Py_UNICODE_WIDE - if sys.maxunicode > 0xffff: - if (x > 0x10000): - res = unicode_call_errorhandler( - errors, "rawunicodeescape", "\\Uxxxxxxxx out of range", - s, size, pos, pos+1) - pos = i = res[1] - p += res[0] - i += 1 - else: - if (x > 0x10000): - res = unicode_call_errorhandler( - errors, "rawunicodeescape", "\\Uxxxxxxxx out of range", - s, size, pos, pos+1) - pos = i = res[1] - p += res[0] - - #endif - else: - p += unichr(x) - +import sys +""" Python implementation of CPythons builtin unicode codecs. + + Generally the functions in this module take a list of characters an returns + a list of characters. + + For use in the PyPy project""" + + +## indicate whether a UTF-7 character is special i.e. cannot be directly +## encoded: +## 0 - not special +## 1 - special +## 2 - whitespace (optional) +## 3 - RFC2152 Set O (optional) + +utf7_special = [ + 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 1, 1, 2, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 2, 3, 3, 3, 3, 3, 3, 0, 0, 0, 3, 1, 0, 0, 0, 1, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 0, + 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 1, 3, 3, 3, + 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 1, 1, +] +unicode_latin1=[None]*256 + +codec_error_registry = {} +def lookup_error(errors): + """lookup_error(errors) -> handler + + Return the error handler for the specified error handling name + or raise a LookupError, if no handler exists under this name. + """ + + try: + err_handler = codec_error_registry[errors] + except KeyError: + raise LookupError("unknown error handler name %s"%errors) + return err_handler + +def register_error(errors, handler): + """register_error(errors, handler) + + Register the specified error handler under the name + errors. handler must be a callable object, that + will be called with an exception instance containing + information about the location of the encoding/decoding + error and must return a (replacement, new position) tuple. + """ + if callable(handler): + codec_error_registry[errors] = handler + else: + raise TypeError("handler must be callable") + + +def PyUnicode_Check(op): + return type(op) == unicode +def PyUnicode_CheckExact(op): + return (type(op) == unicode) + + +def PyUnicode_GET_SIZE(op): + return len(unicode(op)) +def PyUnicode_GET_DATA_SIZE(op): + return len(unicode(op)) * len(u' ') +def PyUnicode_AS_UNICODE(op): + unicode(op) +def PyUnicode_AS_DATA(op): + buffer(unicode(op)) #XXX This is a read only buffer + +def SPECIAL(c, encodeO, encodeWS): + c = ord(c) + return (c>127 or utf7_special[c] == 1) or \ + (encodeWS and (utf7_special[(c)] == 2)) or \ + (encodeO and (utf7_special[(c)] == 3)) +def B64(n): + return ("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[(n) & 0x3f]) +def B64CHAR(c): + return (c.isalnum() or (c) == '+' or (c) == '/') +def UB64(c): + if (c) == '+' : + return 62 + elif (c) == '/': + return 63 + elif (c) >= 'a': + return ord(c) - 71 + elif (c) >= 'A': + return ord(c) - 65 + else: + return ord(c) + 4 + +def ENCODE( ch, bits) : + charvalue = 0 + out = [] +## for c in ch: +## charvalue <<= 16 +## charvalue += ord(c) + while (bits >= 6): + out += B64(ch >> (bits-6)) + bits -= 6; + return out,bits + + +def PyUnicode_DecodeUTF7(s, size, errors): + + starts = s + errmsg = "" + inShift = 0 + bitsleft = 0 + charsleft = 0 + surrogate = 0 + p = [] + errorHandler = None + exc = None + + if (size == 0): + return unicode('') + i = 0 + while i < size: + + ch = s[i] + if (inShift): + if ((ch == '-') or not B64CHAR(ch)): + inShift = 0 + i += 1 + + while (bitsleft >= 16): + outCh = ((charsleft) >> (bitsleft-16)) & 0xffff + bitsleft -= 16 + + if (surrogate): + ## We have already generated an error for the high surrogate + ## so let's not bother seeing if the low surrogate is correct or not + surrogate = 0 + elif (0xDC00 <= (outCh) and (outCh) <= 0xDFFF): + ## This is a surrogate pair. Unfortunately we can't represent + ## it in a 16-bit character + surrogate = 1 + msg = "code pairs are not supported" + out,x = unicode_call_errorhandler(errors,'utf-7',msg,s,i-1,i) + bitsleft = 0 + break + else: + out += unichr(outCh ) + p += out + if (bitsleft >= 6): +## /* The shift sequence has a partial character in it. If +## bitsleft < 6 then we could just classify it as padding +## but that is not the case here */ + print errors, s, bitsleft,p,i + raise UnicodeDecodeError, "partial character in shift sequence" +## /* According to RFC2152 the remaining bits should be zero. We +## choose to signal an error/insert a replacement character +## here so indicate the potential of a misencoded character. */ + +## /* On x86, a << b == a << (b%32) so make sure that bitsleft != 0 */ +## if (bitsleft and (charsleft << (sizeof(charsleft) * 8 - bitsleft))): +## raise UnicodeDecodeError, "non-zero padding bits in shift sequence" + if (ch == '-') : + if ((i < size) and (s[i] == '-')) : + p += '-' + inShift = 1 + + elif SPECIAL(ch,0,0) : + raise UnicodeDecodeError,"unexpected special character" + + else: + p += ch + else: + charsleft = (charsleft << 6) | UB64(ch) + bitsleft += 6 + i+=1 +## /* p, charsleft, bitsleft, surrogate = */ DECODE(p, charsleft, bitsleft, surrogate); + elif ( ch == '+' ): + startinpos = i + i+=1 + if (i 0 + else: + out += ch + else: + if (not SPECIAL(ch, encodeSetO, encodeWhiteSpace)): + out += B64((charsleft) << (6-bitsleft)) + charsleft = 0 + bitsleft = 0 +## /* Characters not in the BASE64 set implicitly unshift the sequence +## so no '-' is required, except if the character is itself a '-' */ + if (B64CHAR(ch) or ch == '-'): + out += '-' + inShift = False + out += ch + else: + bitsleft += 16 + charsleft = (((charsleft) << 16) | ord(ch)) + p, bitsleft = ENCODE(charsleft, bitsleft) + out += p +## /* If the next character is special then we dont' need to terminate +## the shift sequence. If the next character is not a BASE64 character +## or '-' then the shift sequence will be terminated implicitly and we +## don't have to insert a '-'. */ + + if (bitsleft == 0): + if (i + 1 < size): + ch2 = s[i+1] + + if (SPECIAL(ch2, encodeSetO, encodeWhiteSpace)): + pass + elif (B64CHAR(ch2) or ch2 == '-'): + out += '-' + inShift = False + else: + inShift = False + else: + out += '-' + inShift = False + i+=1 + + if (bitsleft): + out += B64(charsleft << (6-bitsleft) ) + out += '-' + + return out + +def PyUnicode_FromOrdinal(ordinal): + + if (ordinal < 0 or ordinal > 0x10ffff): + raise ValueError, "unichr() arg not in range(0x110000) (wide Python build)" + +## if (ordinal < 0 or ordinal > 0xffff): +## raise ValueError, "unichr() arg not in range(0x1000) (narrow Python build)" + + s = unichr(ordinal) + return s,1 + +def PyUnicode_FromObject(obj): + +## /* XXX Perhaps we should make this API an alias of +## PyObject_Unicode() instead ?! */ + if (PyUnicode_CheckExact(obj)): + return obj + + if (PyUnicode_Check(obj)): +## /* For a Unicode subtype that's not a Unicode object, +## return a true Unicode object with the same data. */ + return PyUnicode_FromUnicode(PyUnicode_AS_UNICODE(obj),PyUnicode_GET_SIZE(obj)) + return PyUnicode_FromEncodedObject(obj, None, "strict") + +unicode_empty=u'' + +def PyUnicode_FromUnicode(u, size): + +## /* If the Unicode data is known at construction time, we can apply +## some optimizations which share commonly used objects. */ + if (u): + +## /* Optimization for empty strings */ + if (size == 0 and unicode_empty != None) : + return unicode_empty + + ## /* Single character Unicode objects in the Latin-1 range are + ## shared when using this constructor */ + return unicode(u) + +def PyUnicode_Decode(s,size,encoding,errors): + + if (encoding == None): + encoding = PyUnicode_GetDefaultEncoding() + +## /* Shortcuts for common default encodings */ + decoder = encodings.get(encoding,None) + if decoder: + return decoder(s,encoding,errors) +## /* Decode via the codec registry */ + buf = buffer(s) + result = PyCodec_Decode(buf, encoding, errors); + if (not PyUnicode_Check(result)): + raise UnicodeDecodeError, "decoder did not return an unicode object (type=%.400s)"%type(result) + return result + +def PyUnicode_FromEncodedObject(obj, encoding,errors): + + s = str(obj) + v = PyUnicode_Decode(s, len(s), encoding, errors) + return v + +def unicodeescape_string(s, size, quotes): + + + p = [] + if (quotes) : + p += 'u' + if (s.find('\'')!=-1 and s.find('"')==-1): + p += '"' + else: + p += '\'' + pos = 0 + while (pos < size): + ch = s[pos] + #/* Escape quotes */ + if (quotes and (ch == p[1] or ch == '\\')): + p += '\\' + p += ch + continue + +#ifdef Py_UNICODE_WIDE + #/* Map 21-bit characters to '\U00xxxxxx' */ + elif (ord(ch) >= 0x10000): + p += '\\' + p += 'U' + p += '%08x'%ord(ch) + continue +#endif + #/* Map UTF-16 surrogate pairs to Unicode \UXXXXXXXX escapes */ + elif (ord(ch) >= 0xD800 and ord(ch) < 0xDC00): + pos += 1 + ch2 = s[pos] + + if (ord(ch2) >= 0xDC00 and ord(ch2) <= 0xDFFF): + ucs = (((ord(ch) & 0x03FF) << 10) | (ord(ch2) & 0x03FF)) + 0x00010000 + p += '\\' + p += 'U' + p += '%08x'%ucs + continue + + #/* Fall through: isolated surrogates are copied as-is */ + pos -= 1 + + #/* Map 16-bit characters to '\uxxxx' */ + if (ord(ch) >= 256): + p += '\\' + p += 'u' + p += '%04x'%ord(ch) + + #/* Map special whitespace to '\t', \n', '\r' */ + elif (ch == '\t'): + p += '\\' + p += 't' + + elif (ch == '\n'): + p += '\\' + p += 'n' + + elif (ch == '\r'): + p += '\\' + p += 'r' + + #/* Map non-printable US ASCII to '\xhh' */ + elif (ch < ' ' or ch >= 0x7F) : + p += '\\' + p += 'x' + p += '%02x'%ord(ch) + #/* Copy everything else as-is */ + else: + p += ch + + if (quotes): + p += p[1] + return p + +def PyUnicode_DecodeASCII(s, size, errors): + +# /* ASCII is equivalent to the first 128 ordinals in Unicode. */ + if (size == 1 and ord(s) < 128) : + return [unichr(ord(s))] + if (size == 0): + return [u''] #unicode('') + p = [] + pos = 0 + while pos < len(s): + c = s[pos] + if ord(c) < 128: + p += unichr(ord(c)) + pos += 1 + else: + + res = unicode_call_errorhandler( + errors, "ascii", "ordinal not in range(128)", + s, pos, pos+1) + p += [unichr(ord(x)) for x in res[0]] + pos = res[1] + return p + +def PyUnicode_EncodeASCII(p,size,errors): + + return unicode_encode_ucs1(p, size, errors, 128) + +def PyUnicode_AsASCIIString(unistr): + + if not type(unistr) == unicode: + raise BadArgumnentError + return PyUnicode_EncodeASCII(PyUnicode_AS_UNICODE(unistr), + len(unicode), + None) + +def PyUnicode_DecodeUTF16Stateful(s,size,errors,byteorder='native',consumed=None): + + bo = 0 #/* assume native ordering by default */ + errmsg = "" + + if sys.byteorder == 'little': + ihi = 1 + ilo = 0 + else: + ihi = 0 + ilo = 1 + + if (size == 0): + return [u''] + + #/* Unpack UTF-16 encoded data */ + +## /* Check for BOM marks (U+FEFF) in the input and adjust current +## byte order setting accordingly. In native mode, the leading BOM +## mark is skipped, in all other modes, it is copied to the output +## stream as-is (giving a ZWNBSP character). */ + q = 0 + if byteorder == 'native': + if (size >= 2): + bom = (ord(s[ihi]) << 8) | ord(s[ilo]) +#ifdef BYTEORDER_IS_LITTLE_ENDIAN + if sys.byteorder == 'little': + if (bom == 0xFEFF): + q += 2 + bo = -1 + elif bom == 0xFFFE: + q += 2 + bo = 1 + else: + if bom == 0xFEFF: + q += 2 + bo = 1 + elif bom == 0xFFFE: + q += 2 + bo = -1 + elif byteorder == 'little': + bo = -1 + else: + bo = 1 + + if (bo == -1): + #/* force LE */ + ihi = 1 + ilo = 0 + + elif (bo == 1): + #/* force BE */ + ihi = 0 + ilo = 1 + + while (q < len(s)): + + #/* remaining bytes at the end? (size should be even) */ + if (len(s)-q<2): + if (consumed): + break + errmsg = "truncated data"; + startinpos = q + endinpos = len(s) + unicode_call_errorhandler() +## /* The remaining input chars are ignored if the callback +## chooses to skip the input */ + + ch = (s[q+ihi] << 8) | s[q+ilo] + q += 2 + + if (ch < 0xD800 or ch > 0xDFFF): + p += unichr(ch) + continue + + #/* UTF-16 code pair: */ + if (q >= e): + errmsg = "unexpected end of data"; + startinpos = q-2 + endinpos = len(s) + unicode_call_errorhandler + + if (0xD800 <= ch and ch <= 0xDBFF): + ch2 = (s[q+ihi] << 8) | s[q+ilo] + q += 2 + if (0xDC00 <= ch2 and ch2 <= 0xDFFF): + #ifndef Py_UNICODE_WIDE + if sys.maxunicode < 65536: + p += unichr(ch) + p += unichr(ch2) + else: + p += unichr((((ch & 0x3FF)<<10) | (ch2 & 0x3FF)) + 0x10000) + #endif + continue + + else: + errmsg = "illegal UTF-16 surrogate"; + startinpos = q-4 + endinpos = startinpos+2 + unicode_call_errorhandler + + errmsg = "illegal encoding"; + startinpos = q-2 + endinpos = startinpos+2 + unicode_call_errorhandler + + return p + +def PyUnicode_EncodeUTF16(s,size,errors,byteorder='little'): + +# /* Offsets from p for storing byte pairs in the right order. */ + + def STORECHAR(CH,byteorder): + hi = chr(((CH) >> 8) & 0xff) + lo = chr((CH) & 0xff) + if byteorder == 'little': + return [lo,hi] + else: + return [hi,lo] + + p = [] + bom = sys.byteorder + if (byteorder == 'native'): + + bom = sys.byteorder + p += STORECHAR(0xFEFF,bom) + + if (size == 0): + return "" + + if (byteorder == 'little' ): + bom = 'little' + elif (byteorder == 'big'): + bom = 'big' + + + for c in s: + ch = ord(c) + ch2 = 0 + if (ch >= 0x10000) : + ch2 = 0xDC00 | ((ch-0x10000) & 0x3FF) + ch = 0xD800 | ((ch-0x10000) >> 10) + + p += STORECHAR(ch,bom) + if (ch2): + p +=STORECHAR(ch2,bom) + + return p + + +def PyUnicode_DecodeMBCS(s, size, errors): + pass + +def PyUnicode_EncodeMBCS(p, size, errors): + pass +#### /* If there are no characters, bail now! */ +## if (size==0) +## return "" +## from ctypes import * +## WideCharToMultiByte = windll.kernel32.WideCharToMultiByte +#### /* First get the size of the result */ +## mbcssize = WideCharToMultiByte(CP_ACP, 0, p, size, s, 0, None, None); +## if (mbcssize==0) +## raise UnicodeEncodeError, "Windows cannot decode the string %s" %p +### More error handling required (check windows errors and such) +## +### /* Do the conversion */ +#### s = ' '*mbcssize +#### if (0 == WideCharToMultiByte(CP_ACP, 0, p, size, s, mbcssize, NULL, NULL)): +#### raise UnicodeEncodeError, "Windows cannot decode the string %s" %p +## return s +def unicode_call_errorhandler(errors, encoding, + reason, input, startinpos, endinpos,decode=True): + + errorHandler = lookup_error(errors) + if decode: + exceptionObject = UnicodeDecodeError(encoding, input, startinpos, endinpos, reason) + else: + exceptionObject = UnicodeEncodeError(encoding, input, startinpos, endinpos, reason) + res = errorHandler(exceptionObject) + if isinstance(res,tuple) and isinstance(res[0],unicode) and isinstance(res[1],int): + newpos = res[1] + if (newpos<0): + newpos = len(input)+newpos + if newpos<0 or newpos>len(input): + raise IndexError( "position %d from error handler out of bounds" % newpos) + return res[0],newpos + else: + raise TypeError("encoding error handler must return (unicode, int) tuple") + +def PyUnicode_DecodeUTF8(s, size, errors): + + return PyUnicode_DecodeUTF8Stateful(s, size, errors, None); + +## /* Map UTF-8 encoded prefix byte to sequence length. zero means +## illegal prefix. see RFC 2279 for details */ +utf8_code_length = [ + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 0, 0 +] + +def PyUnicode_DecodeUTF8Stateful(s,size,errors,consumed): + + if (size == 0): + if (consumed): + consumed = 0 + return u'' + + p = [] + pos = 0 + while pos < size: + ch = s[pos] + if ord(ch) < 0x80: + p += ch + pos += 1 + continue + + n = utf8_code_length[ord(ch)] + startinpos = pos + if (startinpos + n > size): + if (consumed): + break + else: + errmsg = "unexpected end of data" + endinpos = size + res = unicode_call_errorhandler( + errors, "utf8", errmsg, + s, startinpos, endinpos) + p += res[0] + pos = res[1] + if n == 0: + errmsg = "unexpected code byte" + endinpos = startinpos+1 + res = unicode_call_errorhandler( + errors, "utf8", errmsg, + s, startinpos, endinpos) + p += res[0] + pos = res[1] + elif n == 1: + errmsg = "internal error" + endinpos = startinpos+1 + res = unicode_call_errorhandler( + errors, "utf8", errmsg, + s, startinpos, endinpos) + p += res[0] + pos = res[1] + elif n == 2: + if ((ord(s[pos+1]) & 0xc0) != 0x80): + errmsg = "invalid data" + endinpos = startinpos+2 + res = unicode_call_errorhandler( + errors, "utf8", errmsg, + s, startinpos, endinpos) + p += res[0] + pos = res[1] + else: + c = ((ord(s[pos]) & 0x1f) << 6) + (ord(s[pos+1]) & 0x3f) + if c<0x80: + errmsg = "illegal encoding" + endinpos = startinpos+2 + res = unicode_call_errorhandler( + errors, "utf8", errmsg, + s, startinpos, endinpos) + p += res[0] + pos = res[1] + else: + p += unichr(c) + pos += n + #break + elif n == 3: + if ((ord(s[pos+1]) & 0xc0) != 0x80 or + (ord(s[pos+2]) & 0xc0) != 0x80): + errmsg = "invalid data" + endinpos = startinpos+3 + res = unicode_call_errorhandler( + errors, "utf8", errmsg, + s, startinpos, endinpos) + p += res[0] + pos = res[1] + else: + c = ((ord(s[pos]) & 0x0f) << 12) + \ + ((ord(s[pos+1]) & 0x3f) << 6) +\ + (ord(s[pos+2]) & 0x3f) + +## /* Note: UTF-8 encodings of surrogates are considered +## legal UTF-8 sequences; +## +## XXX For wide builds (UCS-4) we should probably try +## to recombine the surrogates into a single code +## unit. +## */ + if c < 0x0800: + errmsg = "illegal encoding" + endinpos = startinpos+3 + res = unicode_call_errorhandler( + errors, "utf8", errmsg, + s, startinpos, endinpos) + p += res[0] + pos = res[1] + else: + p += unichr(c) + pos += n + elif n == 4: + +## case 4: + if ((ord(s[1]) & 0xc0) != 0x80 or + (ord(s[2]) & 0xc0) != 0x80 or + (ord(s[3]) & 0xc0) != 0x80): + + errmsg = "invalid data" + startinpos = pos + endinpos = startinpos+4 + res = unicode_call_errorhandler( + errors, "utf8", errmsg, + s, startinpos, endinpos) + p += res[0] + pos = res[1] + else: + c = ((ord(s[0]) & 0x7) << 18) + ((ord(s[1]) & 0x3f) << 12) +\ + ((ord(s[2]) & 0x3f) << 6) + (ord(s[3]) & 0x3f) + #/* validate and convert to UTF-16 */ + if ((c < 0x10000) or (c > 0x10ffff)): + #/* minimum value allowed for 4 byte encoding */ + #/* maximum value allowed for UTF-16 */ + + errmsg = "illegal encoding" + startinpos = pos + endinpos = startinpos+4 + res = unicode_call_errorhandler( + errors, "utf8", errmsg, + s, startinpos, endinpos) + p += res[0] + pos = res[1] + else: +#ifdef Py_UNICODE_WIDE + if c> 10)) + #/* low surrogate = bottom 10 bits added to DC00 */ + p += unichr(0xDC00 + (c & 0x03FF)) + pos += n + else: +## default: +## /* Other sizes are only needed for UCS-4 */ + errmsg = "unsupported Unicode code range"; + startinpos = pos + endinpos = startinpos+n + res = unicode_call_errorhandler( + errors, "utf8", errmsg, + s, startinpos, endinpos) + p += res[0] + pos = res[1] + + #continue + + if (consumed): + consumed = pos + return p + +def PyUnicode_EncodeUTF8(s,size,errors): + + #assert(s != None) + assert(size >= 0) + p = [] + i = 0 + while i> 6))) + p += chr((0x80 | (ord(ch) & 0x3f))) + else: +## /* Encode UCS2 Unicode ordinals */ + if (ord(ch) < 0x10000): +## /* Special case: check for high surrogate */ + if (0xD800 <=ord(ch) and ord(ch) <= 0xDBFF and i != size) : + ch2 = s[i] +## /* Check for low surrogate and combine the two to +## form a UCS4 value */ + if (0xDC00 <= ord(ch2) and ord(ch2) <= 0xDFFF) : + ch3 = ((ord(ch) - 0xD800) << 10 | (ord(ch2) - 0xDC00)) + 0x10000 + i+=1 + p.extend(encodeUCS4(ch3)) + continue +## /* Fall through: handles isolated high surrogates */ + p += (chr((0xe0 | (ord(ch) >> 12)))) + p += (chr((0x80 | ((ord(ch) >> 6) & 0x3f)))) + p += (chr((0x80 | (ord(ch) & 0x3f)))) + continue + return p + +def encodeUCS4(ch): +## /* Encode UCS4 Unicode ordinals */ + p=[] + p += (chr((0xf0 | (ch >> 18)))) + p += (chr((0x80 | ((ch >> 12) & 0x3f)))) + p += (chr((0x80 | ((ch >> 6) & 0x3f)))) + p += (chr((0x80 | (ch & 0x3f)))) + return p + +#/* --- Latin-1 Codec ------------------------------------------------------ */ + +def PyUnicode_DecodeLatin1(s, size, errors): + #/* Latin-1 is equivalent to the first 256 ordinals in Unicode. */ +## if (size == 1): +## return [PyUnicode_FromUnicode(s, 1)] + pos = 0 + p = [] + while (pos < size): + p += unichr(ord(s[pos])) + pos += 1 + return p + +def unicode_encode_ucs1(p,size,errors,limit): + + if limit == 256: + reason = "ordinal not in range(256)" + encoding = "latin-1" + else: + reason = "ordinal not in range(128)" + encoding = "ascii" + + if (size == 0): + return [''] + res = [] + pos=0 + while pos < len(p): + #for ch in p: + ch = p[pos] + + if ord(ch) < limit: + res += chr(ord(ch)) + pos += 1 + else: + #/* startpos for collecting unencodable chars */ + collstart = pos + collend = pos+1 + while collend < len(p) and ord(p[collend]) >= limit: + collend += 1 + x = unicode_call_errorhandler(errors,encoding,reason,p,collstart,collend,False) + res += str(x[0]) + pos = x[1] + + return res + +def PyUnicode_EncodeLatin1(p,size,errors): + res=unicode_encode_ucs1(p, size, errors, 256) + return res + +hexdigits = [hex(i)[-1] for i in range(16)]+[hex(i)[-1].upper() for i in range(10,16)] +def hexescape(s,pos,digits,message,errors): + chr = 0 + p = [] + if (pos+digits>len(s)): + message = "end of string in escape sequence" + x = unicode_call_errorhandler(errors,"unicodeescape",message,s,pos-2,len(s)) + p += x[0] + pos = x[1] + else: + try: + chr = int(s[pos:pos+digits],16) + except ValueError: + endinpos = pos + while s[endinpos] in hexdigits: + endinpos +=1 + x = unicode_call_errorhandler(errors,"unicodeescape",message,s,pos-2, + endinpos+1) + p += x[0] + pos = x[1] + #/* when we get here, chr is a 32-bit unicode character */ + else: + if chr <= sys.maxunicode: + p += [unichr(chr)] + pos += digits + + elif (chr <= 0x10ffff): + chr -= 0x10000L + p += unichr(0xD800 + (chr >> 10)) + p += unichr(0xDC00 + (chr & 0x03FF)) + pos += digits + else: + message = "illegal Unicode character" + x = unicode_call_errorhandler(errors,"unicodeescape",message,s,pos-2, + pos+1) + p += x[0] + pos = x[1] + res = p + return res,pos + +def PyUnicode_DecodeUnicodeEscape(s, size, errors): + + if (size == 0): + return u'' + + p = [] + pos = 0 + while (pos < size): +## /* Non-escape characters are interpreted as Unicode ordinals */ + if (s[pos] != '\\') : + p += s[pos] + pos += 1 + continue +## /* \ - Escapes */ + else: + pos +=1 + if pos>=len(s): + errmessage = "\\ at end of string" + unicode_call_errorhandler(errors,"unicodeescape",errmessage,s,pos-1,size) + ch = s[pos] + + ## /* \x escapes */ + #if ch == '\n': break; + if ch == '\\': p += '\\' + elif ch == '\'': p += '\'' + elif ch == '\"': p += '\"' + elif ch == 'b': p += '\b' + elif ch == 'f': p += '\014' #/* FF */ + elif ch == 't': p += '\t' + elif ch == 'n': p += '\n' + elif ch == 'r': p += '\r' + elif ch == 'v': p += '\013' #break; /* VT */ + elif ch == 'a': p += '\007' # break; /* BEL, not classic C */ + + ## /* \OOO (octal) escapes */ + elif ch in [ '0','1', '2', '3','4', '5', '6','7']: + x = ord(ch) - ord('0') + ch = s[pos+1] + if ('0' <= ch and ch <= '7'): + x = (x<<3) + ord(ch) - ord('0') + ch = s[pos+2] + if ('0' <= ch and ch <= '7'): + x = (x<<3) + ord(ch) - ord('0') + pos += 3 + + p += unichr(x) + ## /* hex escapes */ + ## /* \xXX */ + elif ch == 'x': + digits = 2; + message = "truncated \\xXX escape"; + x = hexescape(s,pos+1,digits,message,errors) + p += x[0] + pos = x[1] + + # /* \uXXXX */ + elif ch == 'u': + digits = 4; + message = "truncated \\uXXXX escape"; + x = hexescape(s,pos+1,digits,message,errors) + p += x[0] + pos = x[1] + + # /* \UXXXXXXXX */ + elif ch == 'U': + digits = 8 + message = "truncated \\UXXXXXXXX escape"; + x = hexescape(s,pos+1,digits,message,errors) + p += x[0] + pos = x[1] +## /* \N{name} */ + elif ch == 'N': + message = "malformed \\N character escape" + pos += 1 + try: + import unicodedata + except ImportError: + message = "\\N escapes not supported (can't load unicodedata module)" + unicode_call_errorhandler(errors,"unicodeescape",message,s,pos-1,size) + if (s[pos] == '{'): + look = pos+1 + #/* look for the closing brace */ + while (s[look] != '}' and look < size): + look += 1 + if (look > pos+1 and look < size and s[look] == '}'): + #/* found a name. look it up in the unicode database */ + message = "unknown Unicode character name" + look += 1 + try: + chr = unicodedata.lookup(s[pos:look]) + #x = hexescape(chr,pos+1,8,message,errors) + except KeyError: + x=unicode_call_errorhandler(errors,"unicodeescape",message,s,pos-1,look) + else: + x = hexescape(s,pos+1,look-pos,message,errors) + p += x[0] + pos = x[1] + else: + if (pos > size): + message = "\\ at end of string" + handler = lookup_error(errors) + x = handler(UnicodeDecodeError("unicodeescape",s,pos, + pos+digits,message)) + p += x[0] + pos = x[1] + else: + p += '\\' + p += s[pos] + return p + +def PyUnicode_EncodeRawUnicodeEscape(s,size): + + if (size == 0): + return u'' + + p = [] + for ch in s: +# /* Map 32-bit characters to '\Uxxxxxxxx' */ + if (ord(ch) >= 0x10000): + p += '\\' + p += 'U' + p += hex(ord(ch)) + elif (ord(ch) >= 256) : +# /* Map 16-bit characters to '\uxxxx' */ + p += '\\' + p += 'u' + p += hex(ord(ch)) +# /* Copy everything else as-is */ + else: + p += ch + + p += '\0' + return p + +def charmapencode_output(c,mapping): + + + rep = mapping[c] + if isinstance(rep,(int,long)): + if rep<256: + return chr(rep) + else: + raise TypeError("character mapping must be in range(256)") + elif isinstance(rep,str) or rep == None: + return rep + else: + raise TypeError("character mapping must return integer, None or str") + +def PyUnicode_EncodeCharmap(p,size,mapping='latin-1',errors='strict'): + +## /* the following variable is used for caching string comparisons +## * -1=not initialized, 0=unknown, 1=strict, 2=replace, +## * 3=ignore, 4=xmlcharrefreplace */ + +# /* Default to Latin-1 */ + if mapping == 'latin-1': + return PyUnicode_EncodeLatin1(p, size, errors) + if (size == 0): + return '' + inpos = 0 + res = [] + while (inpos",p,inpos,inpos+1,False) + try: + res += [charmapencode_output(ord(y),mapping) for y in x[0]] + except KeyError: + raise UnicodeEncodeError("charmap",p,inpos,inpos+1, + "character maps to ") + except TypeError,err: + x = unicode_call_errorhandler(errors,"charmap", + err,p,inpos,inpos+1,False) + try: + res += [charmapencode_output(ord(y),mapping) for y in x[0]] + except KeyError: + raise UnicodeEncodeError("charmap",p,inpos,inpos+1, + "character maps to ") + + #/* done with this character => adjust input position */ + inpos+=1 + return res + +def PyUnicode_DecodeCharmap(s, size, mapping, errors): + +## /* Default to Latin-1 */ + if (mapping == None): + return PyUnicode_DecodeLatin1(s, size, errors) + + if (size == 0): + return u'' + p = [] + inpos = 0 + while (inpos< len(s)): + + #/* Get mapping (char ordinal -> integer, Unicode char or None) */ + ch = s[inpos] + try: + x = mapping[ord(ch)] + if isinstance(x,int): + if x<65536: + p += unichr(x) + else: + raise TypeError("character mapping must be in range(65536)") + elif isinstance(x,unicode): + p += x + elif not x: + raise KeyError + else: + raise TypeError + except KeyError: + x = unicode_call_errorhandler(errors,"charmap", + "character maps to ",s,inpos,inpos+1) + p += x[0] +## except TypeError: +## x = unicode_call_errorhandler(errors,"charmap", +## "character mapping must return integer, None or unicode", +## s,inpos,inpos+1) +## p += x[0] + inpos +=1 + return p + +def PyUnicode_DecodeRawUnicodeEscape(s, size,errors): + + if (size == 0): + return u'' + pos = 0 + p = [] + while (pos < len(s)): + ch = s[pos] + #/* Non-escape characters are interpreted as Unicode ordinals */ + if (ch != '\\'): + p += ch + + startinpos = pos + +## /* \u-escapes are only interpreted iff the number of leading +## backslashes is odd */ + bs = pos + while pos < size: + if (s[pos] != '\\'): + break; + p += s[pos] + pos += 1 + + if (((pos - bs) & 1) == 0 or + pos >= size or + (s[pos] != 'u' and s[pos] != 'U')) : + pos += 1 + continue + + p.pop(-1) + if s[pos] == 'u': + count = 4 + else: + count = 8 + pos += 1 + + #/* \uXXXX with 4 hex digits, \Uxxxxxxxx with 8 */ + + i = 0 + x = 0 + try: + x = int(s[pos:pos+count],16) + except ValueError: + res = unicode_call_errorhandler( + errors, "rawunicodeescape", "truncated \\uXXXX", + s, size, pos, pos+count) + p += res[0] + pos = res[1] + else: + #ifndef Py_UNICODE_WIDE + if sys.maxunicode > 0xffff: + if (x > 0x10000): + res = unicode_call_errorhandler( + errors, "rawunicodeescape", "\\Uxxxxxxxx out of range", + s, size, pos, pos+1) + pos = i = res[1] + p += res[0] + i += 1 + else: + if (x > 0x10000): + res = unicode_call_errorhandler( + errors, "rawunicodeescape", "\\Uxxxxxxxx out of range", + s, size, pos, pos+1) + pos = i = res[1] + p += res[0] + + #endif + else: + p += unichr(x) + pos += count + return p \ No newline at end of file From ale at codespeak.net Tue May 31 01:28:13 2005 From: ale at codespeak.net (ale at codespeak.net) Date: Tue, 31 May 2005 01:28:13 +0200 (CEST) Subject: [pypy-svn] r12904 - pypy/dist/pypy/lib Message-ID: <20050530232813.967CB27B58@code1.codespeak.net> Author: ale Date: Tue May 31 01:28:13 2005 New Revision: 12904 Modified: pypy/dist/pypy/lib/unicodecodec.py Log: test_codeccallbacks.py passes too ! Modified: pypy/dist/pypy/lib/unicodecodec.py ============================================================================== --- pypy/dist/pypy/lib/unicodecodec.py (original) +++ pypy/dist/pypy/lib/unicodecodec.py Tue May 31 01:28:13 2005 @@ -143,14 +143,16 @@ bitsleft = 0 break else: - out += unichr(outCh ) - p += out + p += unichr(outCh ) + #p += out if (bitsleft >= 6): ## /* The shift sequence has a partial character in it. If ## bitsleft < 6 then we could just classify it as padding ## but that is not the case here */ print errors, s, bitsleft,p,i - raise UnicodeDecodeError, "partial character in shift sequence" + msg = "partial character in shift sequence" + out,x = unicode_call_errorhandler(errors,'utf-7',msg,s,i-1,i) + ## /* According to RFC2152 the remaining bits should be zero. We ## choose to signal an error/insert a replacement character ## here so indicate the potential of a misencoded character. */ @@ -1089,8 +1091,10 @@ return chr(rep) else: raise TypeError("character mapping must be in range(256)") - elif isinstance(rep,str) or rep == None: + elif isinstance(rep,str): return rep + elif rep == None: + raise KeyError("character maps to ") else: raise TypeError("character mapping must return integer, None or str") @@ -1120,15 +1124,15 @@ except KeyError: raise UnicodeEncodeError("charmap",p,inpos,inpos+1, "character maps to ") - except TypeError,err: - x = unicode_call_errorhandler(errors,"charmap", - err,p,inpos,inpos+1,False) - try: - res += [charmapencode_output(ord(y),mapping) for y in x[0]] - except KeyError: - raise UnicodeEncodeError("charmap",p,inpos,inpos+1, - "character maps to ") - +## except TypeError,err: +## x = unicode_call_errorhandler(errors,"charmap", +## err,p,inpos,inpos+1,False) +## try: +## res += [charmapencode_output(ord(y),mapping) for y in x[0]] +## except KeyError: +## raise UnicodeEncodeError("charmap",p,inpos,inpos+1, +## "character maps to ") +## #/* done with this character => adjust input position */ inpos+=1 return res From ale at codespeak.net Tue May 31 13:44:12 2005 From: ale at codespeak.net (ale at codespeak.net) Date: Tue, 31 May 2005 13:44:12 +0200 (CEST) Subject: [pypy-svn] r12916 - pypy/dist/pypy/lib Message-ID: <20050531114412.7BA0827B8A@code1.codespeak.net> Author: ale Date: Tue May 31 13:44:12 2005 New Revision: 12916 Modified: pypy/dist/pypy/lib/inprogress__codecs.py pypy/dist/pypy/lib/unicodecodec.py Log: fixed some errors in utf-7, utf-8, utf-16, unicode_escape Modified: pypy/dist/pypy/lib/inprogress__codecs.py ============================================================================== --- pypy/dist/pypy/lib/inprogress__codecs.py (original) +++ pypy/dist/pypy/lib/inprogress__codecs.py Tue May 31 13:44:12 2005 @@ -166,7 +166,7 @@ """None """ res = PyUnicode_DecodeUTF7(data,len(data),errors) - res = ''.join(res) + res = u''.join(res) return res,len(res) def unicode_escape_encode( obj,errors='strict'): Modified: pypy/dist/pypy/lib/unicodecodec.py ============================================================================== --- pypy/dist/pypy/lib/unicodecodec.py (original) +++ pypy/dist/pypy/lib/unicodecodec.py Tue May 31 13:44:12 2005 @@ -125,7 +125,7 @@ if ((ch == '-') or not B64CHAR(ch)): inShift = 0 i += 1 - + while (bitsleft >= 16): outCh = ((charsleft) >> (bitsleft-16)) & 0xffff bitsleft -= 16 @@ -140,6 +140,7 @@ surrogate = 1 msg = "code pairs are not supported" out,x = unicode_call_errorhandler(errors,'utf-7',msg,s,i-1,i) + p += out bitsleft = 0 break else: @@ -149,7 +150,6 @@ ## /* The shift sequence has a partial character in it. If ## bitsleft < 6 then we could just classify it as padding ## but that is not the case here */ - print errors, s, bitsleft,p,i msg = "partial character in shift sequence" out,x = unicode_call_errorhandler(errors,'utf-7',msg,s,i-1,i) @@ -328,7 +328,6 @@ def unicodeescape_string(s, size, quotes): - p = [] if (quotes) : p += 'u' @@ -363,6 +362,7 @@ p += '\\' p += 'U' p += '%08x'%ucs + pos += 1 continue #/* Fall through: isolated surrogates are copied as-is */ @@ -457,6 +457,7 @@ ## mark is skipped, in all other modes, it is copied to the output ## stream as-is (giving a ZWNBSP character). */ q = 0 + p = [] if byteorder == 'native': if (size >= 2): bom = (ord(s[ihi]) << 8) | ord(s[ilo]) @@ -503,7 +504,7 @@ ## /* The remaining input chars are ignored if the callback ## chooses to skip the input */ - ch = (s[q+ihi] << 8) | s[q+ilo] + ch = (ord(s[q+ihi]) << 8) | ord(s[q+ilo]) q += 2 if (ch < 0xD800 or ch > 0xDFFF): @@ -511,14 +512,14 @@ continue #/* UTF-16 code pair: */ - if (q >= e): + if (q >= len(s)): errmsg = "unexpected end of data"; startinpos = q-2 endinpos = len(s) unicode_call_errorhandler if (0xD800 <= ch and ch <= 0xDBFF): - ch2 = (s[q+ihi] << 8) | s[q+ilo] + ch2 = (ord(s[q+ihi]) << 8) | ord(s[q+ilo]) q += 2 if (0xDC00 <= ch2 and ch2 <= 0xDFFF): #ifndef Py_UNICODE_WIDE @@ -752,11 +753,10 @@ p += unichr(c) pos += n elif n == 4: - ## case 4: - if ((ord(s[1]) & 0xc0) != 0x80 or - (ord(s[2]) & 0xc0) != 0x80 or - (ord(s[3]) & 0xc0) != 0x80): + if ((ord(s[pos+1]) & 0xc0) != 0x80 or + (ord(s[pos+2]) & 0xc0) != 0x80 or + (ord(s[pos+3]) & 0xc0) != 0x80): errmsg = "invalid data" startinpos = pos @@ -767,8 +767,8 @@ p += res[0] pos = res[1] else: - c = ((ord(s[0]) & 0x7) << 18) + ((ord(s[1]) & 0x3f) << 12) +\ - ((ord(s[2]) & 0x3f) << 6) + (ord(s[3]) & 0x3f) + c = ((ord(s[pos+0]) & 0x7) << 18) + ((ord(s[pos+1]) & 0x3f) << 12) +\ + ((ord(s[pos+2]) & 0x3f) << 6) + (ord(s[pos+3]) & 0x3f) #/* validate and convert to UTF-16 */ if ((c < 0x10000) or (c > 0x10ffff)): #/* minimum value allowed for 4 byte encoding */ From arigo at codespeak.net Tue May 31 14:12:47 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Tue, 31 May 2005 14:12:47 +0200 (CEST) Subject: [pypy-svn] r12917 - in pypy/dist/pypy/rpython: . test Message-ID: <20050531121247.0694827B90@code1.codespeak.net> Author: arigo Date: Tue May 31 14:12:46 2005 New Revision: 12917 Modified: pypy/dist/pypy/rpython/rbuiltin.py pypy/dist/pypy/rpython/robject.py pypy/dist/pypy/rpython/rtyper.py pypy/dist/pypy/rpython/test/test_rtyper.py Log: Debugging help for the rtyper: - try hard to raise a TyperError when there is a problem - TyperErrors no longer interrupt the whole process, but are recorded as a 'TYPER ERROR' operation in the graph for inspection - the first TyperError is re-raised at the end. Modified: pypy/dist/pypy/rpython/rbuiltin.py ============================================================================== --- pypy/dist/pypy/rpython/rbuiltin.py (original) +++ pypy/dist/pypy/rpython/rbuiltin.py Tue May 31 14:12:46 2005 @@ -19,12 +19,20 @@ if s_blt.s_self is None: if not s_blt.is_constant(): raise TyperError("non-constant built-in") - bltintyper = BUILTIN_TYPER[s_blt.const] + try: + bltintyper = BUILTIN_TYPER[s_blt.const] + except KeyError: + raise TyperError("don't know about built-in function %r" % ( + s_blt.const,)) hop.s_popfirstarg() else: # methods: look up the rtype_method_xxx() name = 'rtype_method_' + s_blt.methodname - bltintyper = getattr(s_blt.s_self, name) + try: + bltintyper = getattr(s_blt.s_self, name) + except AttributeError: + raise TyperError("missing %s.%s" % ( + s_blt.s_self.__class__.__name__, name)) return bltintyper(hop) Modified: pypy/dist/pypy/rpython/robject.py ============================================================================== --- pypy/dist/pypy/rpython/robject.py (original) +++ pypy/dist/pypy/rpython/robject.py Tue May 31 14:12:46 2005 @@ -1,5 +1,6 @@ from pypy.annotation.pairtype import pair, pairtype from pypy.annotation.model import SomeObject, annotation_to_lltype +from pypy.annotation import model as annmodel from pypy.rpython.lltype import PyObject, GcPtr, Void from pypy.rpython.rtyper import TyperError @@ -7,6 +8,17 @@ PyObjPtr = GcPtr(PyObject) +def missing_rtype_operation(args, hop): + raise TyperError("unimplemented operation: '%s' on %r" % ( + hop.spaceop.opname, args)) + +for opname in annmodel.UNARY_OPERATIONS: + setattr(SomeObject, 'rtype_' + opname, missing_rtype_operation) +for opname in annmodel.BINARY_OPERATIONS: + setattr(pairtype(SomeObject, SomeObject), + 'rtype_' + opname, missing_rtype_operation) + + class __extend__(SomeObject): def lowleveltype(s_obj): Modified: pypy/dist/pypy/rpython/rtyper.py ============================================================================== --- pypy/dist/pypy/rpython/rtyper.py (original) +++ pypy/dist/pypy/rpython/rtyper.py Tue May 31 14:12:46 2005 @@ -1,3 +1,4 @@ +import sys from pypy.annotation.pairtype import pair from pypy.annotation import model as annmodel from pypy.objspace.flow.model import Variable, Constant, Block, Link @@ -25,6 +26,7 @@ def __init__(self, annotator): self.annotator = annotator self.specialized_ll_functions = {} + self.typererror = None def specialize(self): """Main entry point: specialize all annotated blocks of the program.""" @@ -38,6 +40,11 @@ already_seen[block] = True pending = [block for block in self.annotator.annotated if block not in already_seen] + if self.typererror: + exc, value, tb = self.typererror + self.typererror = None + #self.annotator.translator.view() + raise exc, value, tb def setconcretetype(self, v): assert isinstance(v, Variable) @@ -60,8 +67,7 @@ hop = HighLevelOp(self, op, newops) self.translate_hl_to_ll(hop, varmapping) except TyperError, e: - e.where = (block, op) - raise + self.gottypererror(e, block, op, newops) block.operations[:] = newops # multiple renamings (v1->v2->v3->...) are possible @@ -80,40 +86,41 @@ # insert the needed conversions on the links can_insert_here = block.exitswitch is None and len(block.exits) == 1 for link in block.exits: - try: - for i in range(len(link.args)): - a1 = link.args[i] - ##if a1 in (link.last_exception, link.last_exc_value):# treated specially in gen_link - ## continue - a2 = link.target.inputargs[i] - s_a2 = self.annotator.binding(a2) - if isinstance(a1, Constant): - link.args[i] = inputconst(s_a2.lowleveltype(), a1.value) - continue # the Constant was typed, done - s_a1 = self.annotator.binding(a1) - if s_a1 == s_a2: - continue # no conversion needed - newops = LowLevelOpList(self) + for i in range(len(link.args)): + a1 = link.args[i] + ##if a1 in (link.last_exception, link.last_exc_value):# treated specially in gen_link + ## continue + a2 = link.target.inputargs[i] + s_a2 = self.annotator.binding(a2) + if isinstance(a1, Constant): + link.args[i] = inputconst(s_a2.lowleveltype(), a1.value) + continue # the Constant was typed, done + s_a1 = self.annotator.binding(a1) + if s_a1 == s_a2: + continue # no conversion needed + newops = LowLevelOpList(self) + try: a1 = newops.convertvar(a1, s_a1, s_a2) - if newops and not can_insert_here: - # cannot insert conversion operations around a single - # link, unless it is the only exit of this block. - # create a new block along the link... - newblock = insert_empty_block(self.annotator.translator, - link) - # ...and do the conversions there. - self.insert_link_conversions(newblock) - break # done with this link - else: - block.operations.extend(newops) - link.args[i] = a1 - except TyperError, e: - e.where = (block, link) - raise + except TyperError, e: + self.gottypererror(e, block, link, newops) + + if newops and not can_insert_here: + # cannot insert conversion operations around a single + # link, unless it is the only exit of this block. + # create a new block along the link... + newblock = insert_empty_block(self.annotator.translator, + link) + # ...and do the conversions there. + self.insert_link_conversions(newblock) + break # done with this link + else: + block.operations.extend(newops) + link.args[i] = a1 def translate_hl_to_ll(self, hop, varmapping): op = hop.spaceop - translate_meth = getattr(self, 'translate_op_'+op.opname) + translate_meth = getattr(self, 'translate_op_'+op.opname, + self.missing_operation) resultvar = translate_meth(hop) if resultvar is None: # no return value @@ -146,6 +153,16 @@ resultvar.value, hop.s_result.const)) op.result.concretetype = hop.s_result.lowleveltype() + def gottypererror(self, e, block, position, llops): + """Record a TyperError without crashing immediately. + Put a 'TyperError' operation in the graph instead. + """ + e.where = (block, position) + if self.typererror is None: + self.typererror = sys.exc_info() + c1 = inputconst(Void, Exception.__str__(e)) + llops.genop('TYPER ERROR', [c1], resulttype=Void) + # __________ regular operations __________ def _registeroperations(loc): @@ -173,6 +190,9 @@ def translate_op_newlist(self, hop): return rlist.rtype_newlist(hop) + def missing_operation(self, hop): + raise TyperError("unimplemented operation: '%s'" % hop.spaceop.opname) + # __________ utilities __________ def getfunctionptr(self, func): Modified: pypy/dist/pypy/rpython/test/test_rtyper.py ============================================================================== --- pypy/dist/pypy/rpython/test/test_rtyper.py (original) +++ pypy/dist/pypy/rpython/test/test_rtyper.py Tue May 31 14:12:46 2005 @@ -1,3 +1,4 @@ +from pypy.annotation import model as annmodel from pypy.translator.translator import Translator from pypy.rpython.lltype import * from pypy.rpython.rtyper import RPythonTyper From arigo at codespeak.net Tue May 31 14:37:45 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Tue, 31 May 2005 14:37:45 +0200 (CEST) Subject: [pypy-svn] r12918 - in pypy/dist/pypy: annotation rpython Message-ID: <20050531123745.F2A9A27B96@code1.codespeak.net> Author: arigo Date: Tue May 31 14:37:45 2005 New Revision: 12918 Modified: pypy/dist/pypy/annotation/builtin.py pypy/dist/pypy/rpython/rbool.py pypy/dist/pypy/rpython/rbuiltin.py pypy/dist/pypy/rpython/rfloat.py pypy/dist/pypy/rpython/rint.py Log: Support for int(), float() and bool() built-in functions. Modified: pypy/dist/pypy/annotation/builtin.py ============================================================================== --- pypy/dist/pypy/annotation/builtin.py (original) +++ pypy/dist/pypy/annotation/builtin.py Tue May 31 14:37:45 2005 @@ -18,34 +18,51 @@ def immutablevalue(x): return getbookkeeper().immutablevalue(x) +def constpropagate(func, args_s, s_result): + """Returns s_result unless all args are constants, in which case the + func() is called and a constant result is returned (it must be contained + in s_result). + """ + args = [] + for s in args_s: + if not s.is_constant(): + return s_result + args.append(s.const) + realresult = func(*args) + s_realresult = immutablevalue(realresult) + if not s_result.contains(s_realresult): + raise Exception("%s%r returned %r, which is not contained in %s" % ( + func, args, realresult, s_result)) + return s_realresult + +# ____________________________________________________________ + def builtin_range(*args): return getbookkeeper().newlist(SomeInteger()) # XXX nonneg=... builtin_xrange = builtin_range # xxx for now allow it def builtin_bool(s_obj): - r = SomeBool() - if s_obj.is_constant(): - r.const = bool(s_obj.const) - return r + return constpropagate(bool, [s_obj], SomeBool()) def builtin_int(s_obj): - return SomeInteger() + return constpropagate(int, [s_obj], SomeInteger()) def restricted_uint(s_obj): # for r_uint - return SomeInteger(nonneg=True, unsigned=True) + return constpropagate(r_uint, [s_obj], + SomeInteger(nonneg=True, unsigned=True)) def builtin_float(s_obj): - return SomeFloat() + return constpropagate(float, [s_obj], SomeFloat()) def builtin_long(s_obj): - return SomeObject() + return SomeObject() # XXX go away def builtin_chr(s_int): - return SomeChar() + return constpropagate(chr, [s_int], SomeChar()) def builtin_unichr(s_int): - return SomeUnicodeCodePoint() + return constpropagate(unichr, [s_int], SomeUnicodeCodePoint()) def builtin_unicode(s_obj): raise TypeError, "unicode() calls should not happen at interp-level" Modified: pypy/dist/pypy/rpython/rbool.py ============================================================================== --- pypy/dist/pypy/rpython/rbool.py (original) +++ pypy/dist/pypy/rpython/rbool.py Tue May 31 14:37:45 2005 @@ -29,3 +29,11 @@ def rtype_is_true(_, hop): vlist = hop.inputargs(Bool) return vlist[0] + + def rtype_int(_, hop): + vlist = hop.inputargs(Signed) + return vlist[0] + + def rtype_float(_, hop): + vlist = hop.inputargs(Float) + return vlist[0] Modified: pypy/dist/pypy/rpython/rbuiltin.py ============================================================================== --- pypy/dist/pypy/rpython/rbuiltin.py (original) +++ pypy/dist/pypy/rpython/rbuiltin.py Tue May 31 14:37:45 2005 @@ -1,5 +1,5 @@ from pypy.annotation.pairtype import pair, pairtype -from pypy.annotation.model import SomeBuiltin, SomeObject +from pypy.annotation.model import SomeBuiltin, SomeObject, SomeString from pypy.rpython.lltype import malloc, typeOf, Void, Signed from pypy.rpython.rtyper import TyperError @@ -45,6 +45,31 @@ # ____________________________________________________________ +def rtype_builtin_bool(hop): + assert hop.nb_args == 1 + return hop.args_s[0].rtype_is_true(hop) + +def rtype_builtin_int(hop): + if isinstance(hop.args_s[0], SomeString): + raise TyperError('int("string") not supported') + assert hop.nb_args == 1 + return hop.args_s[0].rtype_int(hop) + +def rtype_builtin_float(hop): + assert hop.nb_args == 1 + return hop.args_s[0].rtype_float(hop) + + +# collect all functions +import __builtin__ +BUILTIN_TYPER = {} +for name, value in globals().items(): + if name.startswith('rtype_builtin_'): + original = getattr(__builtin__, name[14:]) + BUILTIN_TYPER[original] = value + +# annotation of low-level types + def rtype_malloc(hop): assert hop.args_s[0].is_constant() if hop.nb_args == 1: @@ -60,7 +85,5 @@ return hop.inputconst(Void, hop.s_result.const) -BUILTIN_TYPER = { - malloc: rtype_malloc, - typeOf: rtype_typeOf, - } +BUILTIN_TYPER[malloc] = rtype_malloc +BUILTIN_TYPER[typeOf] = rtype_typeOf Modified: pypy/dist/pypy/rpython/rfloat.py ============================================================================== --- pypy/dist/pypy/rpython/rfloat.py (original) +++ pypy/dist/pypy/rpython/rfloat.py Tue May 31 14:37:45 2005 @@ -129,3 +129,9 @@ def rtype_pos(_, hop): vlist = hop.inputargs(Float) return vlist[0] + + def rtype_int(_, hop): + vlist = hop.inputargs(Float) + return hop.genop('cast_float_to_int', vlist, resulttype=Signed) + + rtype_float = rtype_pos Modified: pypy/dist/pypy/rpython/rint.py ============================================================================== --- pypy/dist/pypy/rpython/rint.py (original) +++ pypy/dist/pypy/rpython/rint.py Tue May 31 14:37:45 2005 @@ -197,6 +197,16 @@ vlist = hop.inputargs(Signed) return vlist[0] + def rtype_int(s_int, hop): + if s_int.unsigned: + raise TyperError("use intmask() instead of int(r_uint(...))") + vlist = hop.inputargs(Signed) + return vlist[0] + + def rtype_float(_, hop): + vlist = hop.inputargs(Float) + return vlist[0] + # class __extend__(pairtype(SomeObject, SomeInteger)): From pedronis at codespeak.net Tue May 31 14:51:06 2005 From: pedronis at codespeak.net (pedronis at codespeak.net) Date: Tue, 31 May 2005 14:51:06 +0200 (CEST) Subject: [pypy-svn] r12919 - pypy/dist/pypy/annotation Message-ID: <20050531125106.2066127B9A@code1.codespeak.net> Author: pedronis Date: Tue May 31 14:51:05 2005 New Revision: 12919 Modified: pypy/dist/pypy/annotation/builtin.py Log: fix r_uint referencing. Modified: pypy/dist/pypy/annotation/builtin.py ============================================================================== --- pypy/dist/pypy/annotation/builtin.py (original) +++ pypy/dist/pypy/annotation/builtin.py Tue May 31 14:51:05 2005 @@ -49,7 +49,7 @@ return constpropagate(int, [s_obj], SomeInteger()) def restricted_uint(s_obj): # for r_uint - return constpropagate(r_uint, [s_obj], + return constpropagate(pypy.rpython.rarithmetic.r_uint, [s_obj], SomeInteger(nonneg=True, unsigned=True)) def builtin_float(s_obj): From arigo at codespeak.net Tue May 31 14:55:35 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Tue, 31 May 2005 14:55:35 +0200 (CEST) Subject: [pypy-svn] r12920 - in pypy/dist/pypy/rpython: . test Message-ID: <20050531125535.CF22527B9E@code1.codespeak.net> Author: arigo Date: Tue May 31 14:55:35 2005 New Revision: 12920 Modified: pypy/dist/pypy/rpython/rfloat.py pypy/dist/pypy/rpython/rint.py pypy/dist/pypy/rpython/rlist.py pypy/dist/pypy/rpython/robject.py pypy/dist/pypy/rpython/test/test_rlist.py Log: - bug fix - write a generic rtype_nonzero() that calls rtype_is_true() - rtype_is_true() defaults to checking the length Modified: pypy/dist/pypy/rpython/rfloat.py ============================================================================== --- pypy/dist/pypy/rpython/rfloat.py (original) +++ pypy/dist/pypy/rpython/rfloat.py Tue May 31 14:55:35 2005 @@ -120,8 +120,6 @@ vlist = hop.inputargs(Float) return hop.genop('float_is_true', vlist, resulttype=Bool) - rtype_nonzero = rtype_is_true - def rtype_neg(_, hop): vlist = hop.inputargs(Float) return hop.genop('float_neg', vlist, resulttype=Float) Modified: pypy/dist/pypy/rpython/rint.py ============================================================================== --- pypy/dist/pypy/rpython/rint.py (original) +++ pypy/dist/pypy/rpython/rint.py Tue May 31 14:55:35 2005 @@ -154,8 +154,6 @@ vlist = hop.inputargs(Signed) return hop.genop('int_is_true', vlist, resulttype=Bool) - rtype_nonzero = rtype_is_true - #Unary arithmetic operations def rtype_abs(_, hop): Modified: pypy/dist/pypy/rpython/rlist.py ============================================================================== --- pypy/dist/pypy/rpython/rlist.py (original) +++ pypy/dist/pypy/rpython/rlist.py Tue May 31 14:55:35 2005 @@ -25,7 +25,7 @@ return s_list.listdef.listitem.s_value def rtype_len(s_lst, hop): - v_lst = hop.inputargs(s_lst) + v_lst, = hop.inputargs(s_lst) return hop.gendirectcall(ll_len, v_lst) def rtype_method_append(s_lst, hop): Modified: pypy/dist/pypy/rpython/robject.py ============================================================================== --- pypy/dist/pypy/rpython/robject.py (original) +++ pypy/dist/pypy/rpython/robject.py Tue May 31 14:55:35 2005 @@ -1,7 +1,7 @@ from pypy.annotation.pairtype import pair, pairtype from pypy.annotation.model import SomeObject, annotation_to_lltype from pypy.annotation import model as annmodel -from pypy.rpython.lltype import PyObject, GcPtr, Void +from pypy.rpython.lltype import PyObject, GcPtr, Void, Bool from pypy.rpython.rtyper import TyperError @@ -44,6 +44,16 @@ else: raise TyperError("getattr() with a non-constant attribute name") + def rtype_is_true(s_obj, hop): + if hasattr(s_obj, "rtype_len"): + vlen = s_obj.rtype_len(hop) + return hop.genop('int_is_true', [vlen], resulttype=Bool) + else: + return hop.inputconst(Bool, True) + + def rtype_nonzero(s_obj, hop): + return s_obj.rtype_is_true(hop) # can call a subclass' rtype_is_true() + class __extend__(pairtype(SomeObject, SomeObject)): Modified: pypy/dist/pypy/rpython/test/test_rlist.py ============================================================================== --- pypy/dist/pypy/rpython/test/test_rlist.py (original) +++ pypy/dist/pypy/rpython/test/test_rlist.py Tue May 31 14:55:35 2005 @@ -29,3 +29,16 @@ typer.specialize() #t.view() t.checkgraphs() + + +def test_len(): + def dummyfn(): + l = [5,10] + return len(l) + + t = Translator(dummyfn) + t.annotate([]) + typer = RPythonTyper(t.annotator) + typer.specialize() + t.view() + t.checkgraphs() From pedronis at codespeak.net Tue May 31 15:02:07 2005 From: pedronis at codespeak.net (pedronis at codespeak.net) Date: Tue, 31 May 2005 15:02:07 +0200 (CEST) Subject: [pypy-svn] r12921 - pypy/dist/pypy/rpython Message-ID: <20050531130207.8454627B9F@code1.codespeak.net> Author: pedronis Date: Tue May 31 15:02:07 2005 New Revision: 12921 Modified: pypy/dist/pypy/rpython/lltype.py Log: more sensible repr for pointers Modified: pypy/dist/pypy/rpython/lltype.py ============================================================================== --- pypy/dist/pypy/rpython/lltype.py (original) +++ pypy/dist/pypy/rpython/lltype.py Tue May 31 15:02:07 2005 @@ -215,8 +215,11 @@ result.append(flag) return ', '.join(result) + def _str_flavor(self): + return 'ptr(%s)' % self._str_flags() + def __str__(self): - return 'ptr(%s) to %s' % (self._str_flags(), self.TO) + return '%s to %s' % (self._str_flavor(), self.TO) def _defl(self, parent=None, parentindex=None): return _ptr(self, None) @@ -428,7 +431,7 @@ return '<%s>' % (self,) def __str__(self): - return '%s to %s' % (self._TYPE.__class__.__name__.lower(), self._obj) + return '%s to %s' % (self._TYPE._str_flavor(), self._obj) def __call__(self, *args): if isinstance(self._T, FuncType): From ericvrp at codespeak.net Tue May 31 15:02:30 2005 From: ericvrp at codespeak.net (ericvrp at codespeak.net) Date: Tue, 31 May 2005 15:02:30 +0200 (CEST) Subject: [pypy-svn] r12922 - pypy/dist/pypy/rpython/test Message-ID: <20050531130230.235E527BA2@code1.codespeak.net> Author: ericvrp Date: Tue May 31 15:02:29 2005 New Revision: 12922 Modified: pypy/dist/pypy/rpython/test/test_rbool.py pypy/dist/pypy/rpython/test/test_rfloat.py pypy/dist/pypy/rpython/test/test_rint.py Log: fixed typos in tests Modified: pypy/dist/pypy/rpython/test/test_rbool.py ============================================================================== --- pypy/dist/pypy/rpython/test/test_rbool.py (original) +++ pypy/dist/pypy/rpython/test/test_rbool.py Tue May 31 15:02:29 2005 @@ -11,13 +11,15 @@ t.annotate(types) typer = RPythonTyper(t.annotator) typer.specialize() - t.checkgraphs() + t.checkgraphs() + #if func == snippet.bool_cast1: + # t.view() def test_not1(self): - self._test(snippet.not1, [int]) + self._test(snippet.not1, [bool]) def test_not2(self): - self._test(snippet.not2, [int]) + self._test(snippet.not2, [bool]) def test_bool1(self): self._test(snippet.bool1, [bool]) Modified: pypy/dist/pypy/rpython/test/test_rfloat.py ============================================================================== --- pypy/dist/pypy/rpython/test/test_rfloat.py (original) +++ pypy/dist/pypy/rpython/test/test_rfloat.py Tue May 31 15:02:29 2005 @@ -12,12 +12,14 @@ typer = RPythonTyper(t.annotator) typer.specialize() t.checkgraphs() + #if func == snippet.float_cast1: + # t.view() def test_not1(self): - self._test(snippet.not1, [int]) + self._test(snippet.not1, [float]) def test_not2(self): - self._test(snippet.not2, [int]) + self._test(snippet.not2, [float]) def test_float1(self): self._test(snippet.float1, [float]) Modified: pypy/dist/pypy/rpython/test/test_rint.py ============================================================================== --- pypy/dist/pypy/rpython/test/test_rint.py (original) +++ pypy/dist/pypy/rpython/test/test_rint.py Tue May 31 15:02:29 2005 @@ -12,6 +12,8 @@ typer = RPythonTyper(t.annotator) typer.specialize() t.checkgraphs() + #if func == snippet.int_cast1: + # t.view() def test_not1(self): self._test(snippet.not1, [int]) From pedronis at codespeak.net Tue May 31 15:16:49 2005 From: pedronis at codespeak.net (pedronis at codespeak.net) Date: Tue, 31 May 2005 15:16:49 +0200 (CEST) Subject: [pypy-svn] r12923 - in pypy/dist/pypy/rpython: . test Message-ID: <20050531131649.025C027BA7@code1.codespeak.net> Author: pedronis Date: Tue May 31 15:16:49 2005 New Revision: 12923 Modified: pypy/dist/pypy/rpython/lltype.py pypy/dist/pypy/rpython/test/test_lltype.py Log: function to construct NULL-pointers Modified: pypy/dist/pypy/rpython/lltype.py ============================================================================== --- pypy/dist/pypy/rpython/lltype.py (original) +++ pypy/dist/pypy/rpython/lltype.py Tue May 31 15:16:49 2005 @@ -588,6 +588,10 @@ o = _func(TYPE, _name=name, **attrs) return _ptr(NonGcPtr(TYPE), o) +def nullptr(T, **flags): + T = _PtrType(T, **flags) + return _ptr(T, None) + def pyobjectptr(obj, **flags): T = _PtrType(PyObject, **flags) o = _pyobject(obj) Modified: pypy/dist/pypy/rpython/test/test_lltype.py ============================================================================== --- pypy/dist/pypy/rpython/test/test_lltype.py (original) +++ pypy/dist/pypy/rpython/test/test_lltype.py Tue May 31 15:16:49 2005 @@ -257,3 +257,9 @@ F.become(S) assert S.x == GcPtr(S) py.test.raises(TypeError, "ForwardReference().become(Struct('abc'))") + + +def test_nullptr(): + S = Struct('s') + p0 = nullptr(S) + assert not p0 From pedronis at codespeak.net Tue May 31 15:29:06 2005 From: pedronis at codespeak.net (pedronis at codespeak.net) Date: Tue, 31 May 2005 15:29:06 +0200 (CEST) Subject: [pypy-svn] r12924 - pypy/dist/pypy/annotation Message-ID: <20050531132906.A632D27BAC@code1.codespeak.net> Author: pedronis Date: Tue May 31 15:29:06 2005 New Revision: 12924 Modified: pypy/dist/pypy/annotation/unaryop.py Log: is_true for pointers Modified: pypy/dist/pypy/annotation/unaryop.py ============================================================================== --- pypy/dist/pypy/annotation/unaryop.py (original) +++ pypy/dist/pypy/annotation/unaryop.py Tue May 31 15:29:06 2005 @@ -456,3 +456,6 @@ llargs = [annotation_to_lltype(arg_s)._example() for arg_s in args_s] v = p.ll_ptrtype._example()(*llargs) return ll_to_annotation(v) + + def is_true(p): + return SomeBool() From arigo at codespeak.net Tue May 31 15:36:56 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Tue, 31 May 2005 15:36:56 +0200 (CEST) Subject: [pypy-svn] r12925 - in pypy/dist/pypy/rpython: . test Message-ID: <20050531133656.74D2127BB6@code1.codespeak.net> Author: arigo Date: Tue May 31 15:36:56 2005 New Revision: 12925 Added: pypy/dist/pypy/rpython/rstr.py (contents, props changed) pypy/dist/pypy/rpython/test/test_rstr.py (contents, props changed) Modified: pypy/dist/pypy/rpython/rptr.py pypy/dist/pypy/rpython/rtyper.py Log: - First try at implementing strings. - is_true(), eq(), ne() operations on pointers. Modified: pypy/dist/pypy/rpython/rptr.py ============================================================================== --- pypy/dist/pypy/rpython/rptr.py (original) +++ pypy/dist/pypy/rpython/rptr.py Tue May 31 15:36:56 2005 @@ -1,6 +1,6 @@ from pypy.annotation.pairtype import pair, pairtype from pypy.annotation.model import SomePtr, SomeInteger -from pypy.rpython.lltype import ContainerType, Void, Signed +from pypy.rpython.lltype import ContainerType, Void, Signed, Bool class __extend__(SomePtr): @@ -31,6 +31,10 @@ return hop.genop('getarraysize', vlist, resulttype = hop.s_result.lowleveltype()) + def rtype_is_true(s_ptr, hop): + vlist = hop.inputargs(s_ptr) + return hop.genop('ptr_nonzero', vlist, resulttype=Bool) + class __extend__(pairtype(SomePtr, SomeInteger)): @@ -38,3 +42,14 @@ vlist = hop.inputargs(s_ptr, Signed) return hop.genop('getarrayitem', vlist, resulttype = hop.s_result.lowleveltype()) + + +class __extend__(pairtype(SomePtr, SomePtr)): + + def rtype_eq(_, hop): + vlist = hop.inputargs(SomePtr(), SomePtr()) + return hop.genop('ptr_eq', vlist, resulttype=Bool) + + def rtype_ne(_, hop): + vlist = hop.inputargs(SomePtr(), SomePtr()) + return hop.genop('ptr_ne', vlist, resulttype=Bool) Added: pypy/dist/pypy/rpython/rstr.py ============================================================================== --- (empty file) +++ pypy/dist/pypy/rpython/rstr.py Tue May 31 15:36:56 2005 @@ -0,0 +1,104 @@ +from pypy.annotation.pairtype import pair, pairtype +from pypy.annotation.model import SomeString, SomeChar, SomeInteger, SomeObject +from pypy.rpython.lltype import * + +# ____________________________________________________________ +# +# Concrete implementation of RPython strings: +# +# struct str { +# hash: Unsigned +# chars: array { +# item { +# Char ch +# } +# } +# } + +STR = GcStruct('str', ('hash', Unsigned), + ('chars', Array(('ch', Char)))) +STRPTR = GcPtr(STR) + + +class __extend__(SomeString): + + def lowleveltype(self): + return STRPTR + + def rtype_len(_, hop): + v_str, = hop.inputargs(SomeString()) + return hop.gendirectcall(ll_strlen, v_str) + + def rtype_is_true(s_str, hop): + if s_str.can_be_None: + v_str, = hop.inputargs(SomeString()) + return hop.gendirectcall(ll_str_is_true, v_str) + else: + # defaults to checking the length + return SomeObject.rtype_is_true(s_str, hop) + + +class __extend__(pairtype(SomeString, SomeInteger)): + + def rtype_getitem((_, s_int), hop): + v_str, v_index = hop.inputargs(SomeString(), Signed) + if s_int.nonneg: + llfn = ll_stritem_nonneg + else: + llfn = ll_stritem + return hop.gendirectcall(llfn, v_str, v_index) + + +class __extend__(SomeChar): + + def lowleveltype(self): + return Char + + def rtype_len(_, hop): + return hop.inputconst(Signed, 1) + + def rtype_is_true(s_chr, hop): + assert not s_chr.can_be_None + return hop.inputconst(Bool, True) + + +class __extend__(pairtype(SomeChar, SomeString)): + + def rtype_convert_from_to((s_chr, s_str), v, llops): + return hop.gendirectcall(ll_chr2str, v) + + +class __extend__(pairtype(SomeString, SomeString)): + + def rtype_convert_from_to((s_str1, s_str2), v, llops): + # converting between SomeString(can_be_None=False) + # and SomeString(can_be_None=True) + assert s_str1.__class__ is s_str2.__class__ is SomeString + return v + + +# ____________________________________________________________ +# +# Low-level methods. These can be run for testing, but are meant to +# be direct_call'ed from rtyped flow graphs, which means that they will +# get flowed and annotated, mostly with SomePtr. + +def ll_strlen(s): + return len(s.chars) + +def ll_stritem_nonneg(s, i): + return s.chars[i].ch + +def ll_stritem(s, i): + if i<0: + i += len(s.chars) + return s.chars[i].ch + +def ll_str_is_true(s): + # check if a string is True, allowing for None + return bool(s) and len(s.chars) != 0 + +def ll_chr2str(ch): + s = malloc(STR, 1) + s.chars[0].ch = ch + return s Modified: pypy/dist/pypy/rpython/rtyper.py ============================================================================== --- pypy/dist/pypy/rpython/rtyper.py (original) +++ pypy/dist/pypy/rpython/rtyper.py Tue May 31 15:36:56 2005 @@ -361,4 +361,4 @@ # _______________________________________________________________________ # this has the side-effect of registering the unary and binary operations from pypy.rpython import robject, rlist, rptr, rbuiltin, rint, rbool, rfloat -from pypy.rpython import rpbc +from pypy.rpython import rpbc, rstr Added: pypy/dist/pypy/rpython/test/test_rstr.py ============================================================================== --- (empty file) +++ pypy/dist/pypy/rpython/test/test_rstr.py Tue May 31 15:36:56 2005 @@ -0,0 +1,33 @@ +from pypy.translator.translator import Translator +from pypy.rpython.lltype import * +from pypy.rpython.rtyper import RPythonTyper + + +def test_simple(): + def dummyfn(i): + s = 'hello' + return s[i] + + t = Translator(dummyfn) + t.annotate([int]) + typer = RPythonTyper(t.annotator) + typer.specialize() + #t.view() + t.checkgraphs() + + +def test_nonzero(): + def dummyfn(i, s): + if i < 0: + s = None + if i > -2: + return bool(s) + else: + return False + + t = Translator(dummyfn) + t.annotate([int, str]) + typer = RPythonTyper(t.annotator) + typer.specialize() + t.view() + t.checkgraphs() From arigo at codespeak.net Tue May 31 15:46:44 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Tue, 31 May 2005 15:46:44 +0200 (CEST) Subject: [pypy-svn] r12926 - pypy/dist/pypy/rpython/test Message-ID: <20050531134644.54EC027BB2@code1.codespeak.net> Author: arigo Date: Tue May 31 15:46:44 2005 New Revision: 12926 Modified: pypy/dist/pypy/rpython/test/test_rlist.py pypy/dist/pypy/rpython/test/test_rstr.py Log: Checked in tests that open a Pygame window... Modified: pypy/dist/pypy/rpython/test/test_rlist.py ============================================================================== --- pypy/dist/pypy/rpython/test/test_rlist.py (original) +++ pypy/dist/pypy/rpython/test/test_rlist.py Tue May 31 15:46:44 2005 @@ -40,5 +40,5 @@ t.annotate([]) typer = RPythonTyper(t.annotator) typer.specialize() - t.view() + #t.view() t.checkgraphs() Modified: pypy/dist/pypy/rpython/test/test_rstr.py ============================================================================== --- pypy/dist/pypy/rpython/test/test_rstr.py (original) +++ pypy/dist/pypy/rpython/test/test_rstr.py Tue May 31 15:46:44 2005 @@ -29,5 +29,5 @@ t.annotate([int, str]) typer = RPythonTyper(t.annotator) typer.specialize() - t.view() + #t.view() t.checkgraphs() From arigo at codespeak.net Tue May 31 15:47:23 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Tue, 31 May 2005 15:47:23 +0200 (CEST) Subject: [pypy-svn] r12927 - pypy/dist/pypy/rpython Message-ID: <20050531134723.1B38527BB9@code1.codespeak.net> Author: arigo Date: Tue May 31 15:47:22 2005 New Revision: 12927 Modified: pypy/dist/pypy/rpython/lltype.py Log: New functions nullptr() and nullgcptr() instead of a single nullptr(**flags), and similarily pyobjectptr() and pyobjectgcptr(). Modified: pypy/dist/pypy/rpython/lltype.py ============================================================================== --- pypy/dist/pypy/rpython/lltype.py (original) +++ pypy/dist/pypy/rpython/lltype.py Tue May 31 15:47:22 2005 @@ -588,11 +588,16 @@ o = _func(TYPE, _name=name, **attrs) return _ptr(NonGcPtr(TYPE), o) -def nullptr(T, **flags): - T = _PtrType(T, **flags) - return _ptr(T, None) +def nullptr(T): + return _ptr(NonGcPtr(T), None) -def pyobjectptr(obj, **flags): - T = _PtrType(PyObject, **flags) +def nullgcptr(T): + return _ptr(GcPtr(T), None) + +def pyobjectptr(obj): + o = _pyobject(obj) + return _ptr(NonGcPtr(PyObject), o) + +def pyobjectgcptr(obj): o = _pyobject(obj) - return _ptr(T, o) + return _ptr(GcPtr(PyObject), o) From arigo at codespeak.net Tue May 31 15:58:17 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Tue, 31 May 2005 15:58:17 +0200 (CEST) Subject: [pypy-svn] r12929 - in pypy/dist/pypy: annotation rpython Message-ID: <20050531135817.08BCB27BBC@code1.codespeak.net> Author: arigo Date: Tue May 31 15:58:16 2005 New Revision: 12929 Modified: pypy/dist/pypy/annotation/builtin.py pypy/dist/pypy/rpython/rbuiltin.py pypy/dist/pypy/rpython/robject.py pypy/dist/pypy/rpython/rptr.py Log: Support the nullptr() and nullgcptr() functions in the annotator and typer. Some improved conversions. Modified: pypy/dist/pypy/annotation/builtin.py ============================================================================== --- pypy/dist/pypy/annotation/builtin.py (original) +++ pypy/dist/pypy/annotation/builtin.py Tue May 31 15:58:16 2005 @@ -296,8 +296,23 @@ lltype = annotation_to_lltype(s_val, info="in typeOf(): ") return immutablevalue(lltype) +def nullptr(T): + assert T.is_constant() + p = lltype.nullptr(T.const) + r = SomePtr(lltype.typeOf(p)) + r.const = p + return r + +def nullgcptr(T): + assert T.is_constant() + p = lltype.nullgcptr(T.const) + r = SomePtr(lltype.typeOf(p)) + r.const = p + return r + BUILTIN_ANALYZERS[lltype.malloc] = malloc BUILTIN_ANALYZERS[lltype.cast_flags] = cast_flags BUILTIN_ANALYZERS[lltype.cast_parent] = cast_parent BUILTIN_ANALYZERS[lltype.typeOf] = typeOf - +BUILTIN_ANALYZERS[lltype.nullptr] = nullptr +BUILTIN_ANALYZERS[lltype.nullgcptr] = nullgcptr Modified: pypy/dist/pypy/rpython/rbuiltin.py ============================================================================== --- pypy/dist/pypy/rpython/rbuiltin.py (original) +++ pypy/dist/pypy/rpython/rbuiltin.py Tue May 31 15:58:16 2005 @@ -1,6 +1,7 @@ from pypy.annotation.pairtype import pair, pairtype from pypy.annotation.model import SomeBuiltin, SomeObject, SomeString -from pypy.rpython.lltype import malloc, typeOf, Void, Signed +from pypy.rpython.lltype import malloc, typeOf, nullptr, nullgcptr +from pypy.rpython.lltype import Void, Signed from pypy.rpython.rtyper import TyperError @@ -81,9 +82,11 @@ return hop.genop('malloc_varsize', vlist, resulttype = hop.s_result.lowleveltype()) -def rtype_typeOf(hop): +def rtype_const_result(hop): return hop.inputconst(Void, hop.s_result.const) BUILTIN_TYPER[malloc] = rtype_malloc -BUILTIN_TYPER[typeOf] = rtype_typeOf +BUILTIN_TYPER[typeOf] = rtype_const_result +BUILTIN_TYPER[nullptr] = rtype_const_result +BUILTIN_TYPER[nullgcptr] = rtype_const_result Modified: pypy/dist/pypy/rpython/robject.py ============================================================================== --- pypy/dist/pypy/rpython/robject.py (original) +++ pypy/dist/pypy/rpython/robject.py Tue May 31 15:58:16 2005 @@ -2,7 +2,7 @@ from pypy.annotation.model import SomeObject, annotation_to_lltype from pypy.annotation import model as annmodel from pypy.rpython.lltype import PyObject, GcPtr, Void, Bool -from pypy.rpython.rtyper import TyperError +from pypy.rpython.rtyper import TyperError, inputconst PyObjPtr = GcPtr(PyObject) @@ -62,5 +62,8 @@ TO = s_to.lowleveltype() if PyObjPtr == FROM == TO: return v + elif FROM == Void and s_from.is_constant() and s_to.contains(s_from): + # convert from a constant to a non-constant + return inputconst(TO, s_from.const) else: return NotImplemented Modified: pypy/dist/pypy/rpython/rptr.py ============================================================================== --- pypy/dist/pypy/rpython/rptr.py (original) +++ pypy/dist/pypy/rpython/rptr.py Tue May 31 15:58:16 2005 @@ -6,7 +6,10 @@ class __extend__(SomePtr): def lowleveltype(s_ptr): - return s_ptr.ll_ptrtype + if s_ptr.is_constant(): # constant NULL + return Void + else: + return s_ptr.ll_ptrtype def rtype_getattr(s_ptr, hop): attr = hop.args_s[1].const From arigo at codespeak.net Tue May 31 16:10:50 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Tue, 31 May 2005 16:10:50 +0200 (CEST) Subject: [pypy-svn] r12930 - in pypy/dist/pypy/translator/c: . test Message-ID: <20050531141050.CA9F027BB7@code1.codespeak.net> Author: arigo Date: Tue May 31 16:10:50 2005 New Revision: 12930 Modified: pypy/dist/pypy/translator/c/database.py pypy/dist/pypy/translator/c/funcgen.py pypy/dist/pypy/translator/c/test/test_genc.py Log: Support for low-level nonzero, == and != operations in translator/c. All pointers can be NULL for now without crashing the incref/decref code. Modified: pypy/dist/pypy/translator/c/database.py ============================================================================== --- pypy/dist/pypy/translator/c/database.py (original) +++ pypy/dist/pypy/translator/c/database.py Tue May 31 16:10:50 2005 @@ -105,23 +105,24 @@ def cincrefstmt(self, expr, T): if isinstance(T, _PtrType) and 'gc' in T.flags: if T.TO == PyObject: - return 'Py_INCREF(%s);' % expr + return 'Py_XINCREF(%s);' % expr else: defnode = self.gettypedefnode(T.TO) if defnode.refcount is not None: - return '%s->%s++;' % (expr, defnode.refcount) + return 'if (%s) %s->%s++;' % (expr, expr, defnode.refcount) return '' def cdecrefstmt(self, expr, T): if isinstance(T, _PtrType) and 'gc' in T.flags: if T.TO == PyObject: - return 'Py_DECREF(%s);' % expr + return 'Py_XDECREF(%s);' % expr else: defnode = self.gettypedefnode(T.TO) if defnode.refcount is not None: - return 'if (!--%s->%s) %s(%s);' % (expr, defnode.refcount, + return 'if (%s && !--%s->%s) %s(%s);' % (expr, expr, + defnode.refcount, defnode.deallocator or 'OP_FREE', - expr) + expr) return '' def complete(self): Modified: pypy/dist/pypy/translator/c/funcgen.py ============================================================================== --- pypy/dist/pypy/translator/c/funcgen.py (original) +++ pypy/dist/pypy/translator/c/funcgen.py Tue May 31 16:10:50 2005 @@ -329,7 +329,7 @@ result.insert(0, '{ %s = %s;' % ( cdecl(self.typemap[op.args[2]], 'prev'), oldvalue)) - result.append('if (prev) ' + decrefstmt) + result.append(decrefstmt) result.append('}') return '\t'.join(result) @@ -345,6 +345,20 @@ return '%s = %s->length;' % (self.expr(op.result), self.expr(op.args[0])) + def OP_PTR_NONZERO(self, op, err): + return '%s = (%s != NULL);' % (self.expr(op.result), + self.expr(op.args[0])) + + def OP_PTR_EQ(self, op, err): + return '%s = (%s == %s);' % (self.expr(op.result), + self.expr(op.args[0]), + self.expr(op.args[1])) + + def OP_PTR_NE(self, op, err): + return '%s = (%s != %s);' % (self.expr(op.result), + self.expr(op.args[0]), + self.expr(op.args[1])) + def OP_MALLOC(self, op, err): TYPE = self.lltypemap[op.result].TO typename = self.db.gettype(TYPE) Modified: pypy/dist/pypy/translator/c/test/test_genc.py ============================================================================== --- pypy/dist/pypy/translator/c/test/test_genc.py (original) +++ pypy/dist/pypy/translator/c/test/test_genc.py Tue May 31 16:10:50 2005 @@ -62,6 +62,7 @@ py.test.raises(TypeError, f1) py.test.raises(TypeError, f1, 2, 3) py.test.raises(TypeError, f1, 2, x=2) + #py.test.raises(TypeError, f1, 2, y=2) XXX missing a check at the moment assert module.malloc_counters() == (0, 0) @@ -86,3 +87,37 @@ assert f1(x=5) == 30 mallocs, frees = module.malloc_counters() assert mallocs == frees + + +def test_rptr(): + S = GcStruct('testing', ('x', Signed), ('y', Signed)) + def f(i): + if i < 0: + p = nullgcptr(S) + else: + p = malloc(S) + p.x = i*2 + if i > 0: + return p.x + else: + return -42 + t = Translator(f) + a = t.annotate([int]) + rtyper = RPythonTyper(t.annotator) + rtyper.specialize() + + db = LowLevelDatabase(rtyper) + entrypoint = db.get(pyobjectptr(f)) + db.complete() + #t.view() + module = compile_db(db) + + f1 = getattr(module, entrypoint) + assert f1(5) == 10 + assert f1(i=5) == 10 + assert f1(1) == 2 + assert f1(0) == -42 + assert f1(-1) == -42 + assert f1(-5) == -42 + mallocs, frees = module.malloc_counters() + assert mallocs == frees From arigo at codespeak.net Tue May 31 16:43:07 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Tue, 31 May 2005 16:43:07 +0200 (CEST) Subject: [pypy-svn] r12931 - in pypy/dist/pypy/rpython: . test Message-ID: <20050531144307.4E85927BBF@code1.codespeak.net> Author: arigo Date: Tue May 31 16:43:07 2005 New Revision: 12931 Modified: pypy/dist/pypy/rpython/rstr.py pypy/dist/pypy/rpython/test/test_rstr.py Log: ord() and hash(). Modified: pypy/dist/pypy/rpython/rstr.py ============================================================================== --- pypy/dist/pypy/rpython/rstr.py (original) +++ pypy/dist/pypy/rpython/rstr.py Tue May 31 16:43:07 2005 @@ -7,7 +7,7 @@ # Concrete implementation of RPython strings: # # struct str { -# hash: Unsigned +# hash: Signed # chars: array { # item { # Char ch @@ -15,7 +15,7 @@ # } # } -STR = GcStruct('str', ('hash', Unsigned), +STR = GcStruct('str', ('hash', Signed), ('chars', Array(('ch', Char)))) STRPTR = GcPtr(STR) @@ -37,6 +37,16 @@ # defaults to checking the length return SomeObject.rtype_is_true(s_str, hop) + def rtype_ord(_, hop): + v_str, = hop.inputargs(SomeString()) + c_zero = inputconst(Signed, 0) + v_chr = hop.gendirectcall(ll_stritem_nonneg, v_str, c_zero) + return hop.genop('cast_char_to_int', [v_chr], resulttype=Signed) + + def rtype_hash(_, hop): + v_str, = hop.inputargs(SomeString()) + return hop.gendirectcall(ll_strhash, v_str) + class __extend__(pairtype(SomeString, SomeInteger)): @@ -61,6 +71,10 @@ assert not s_chr.can_be_None return hop.inputconst(Bool, True) + def rtype_ord(_, hop): + vlist = hop.inputargs(Char) + return hop.genop('cast_char_to_int', vlist, resulttype=Signed) + class __extend__(pairtype(SomeChar, SomeString)): @@ -102,3 +116,24 @@ s = malloc(STR, 1) s.chars[0].ch = ch return s + +def ll_strhash(s): + # unlike CPython, there is no reason to avoid to return -1 + # but our malloc initializes the memory to zero, so we use zero as the + # special non-computed-yet value. + x = s.hash + if x == 0: + length = len(s.chars) + if length == 0: + x = -1 + else: + x = ord(s.chars[0].ch) << 7 + i = 1 + while i < length: + x = (1000003*x) ^ ord(s.chars[i].ch) + i += 1 + x ^= length + if x == 0: + x = -1 + s.hash = x + return x Modified: pypy/dist/pypy/rpython/test/test_rstr.py ============================================================================== --- pypy/dist/pypy/rpython/test/test_rstr.py (original) +++ pypy/dist/pypy/rpython/test/test_rstr.py Tue May 31 16:43:07 2005 @@ -31,3 +31,14 @@ typer.specialize() #t.view() t.checkgraphs() + +def test_hash(): + def dummyfn(s): + return hash(s) + + t = Translator(dummyfn) + t.annotate([str]) + typer = RPythonTyper(t.annotator) + typer.specialize() + t.view() + t.checkgraphs() From arigo at codespeak.net Tue May 31 16:43:25 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Tue, 31 May 2005 16:43:25 +0200 (CEST) Subject: [pypy-svn] r12932 - pypy/dist/pypy/rpython/test Message-ID: <20050531144325.007B027BC9@code1.codespeak.net> Author: arigo Date: Tue May 31 16:43:25 2005 New Revision: 12932 Modified: pypy/dist/pypy/rpython/test/test_rstr.py Log: Again. Modified: pypy/dist/pypy/rpython/test/test_rstr.py ============================================================================== --- pypy/dist/pypy/rpython/test/test_rstr.py (original) +++ pypy/dist/pypy/rpython/test/test_rstr.py Tue May 31 16:43:25 2005 @@ -40,5 +40,5 @@ t.annotate([str]) typer = RPythonTyper(t.annotator) typer.specialize() - t.view() + #t.view() t.checkgraphs() From arigo at codespeak.net Tue May 31 17:35:42 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Tue, 31 May 2005 17:35:42 +0200 (CEST) Subject: [pypy-svn] r12934 - in pypy/dist/pypy: annotation translator/test Message-ID: <20050531153542.99E3E27BCB@code1.codespeak.net> Author: arigo Date: Tue May 31 17:35:42 2005 New Revision: 12934 Modified: pypy/dist/pypy/annotation/binaryop.py pypy/dist/pypy/annotation/listdef.py pypy/dist/pypy/annotation/unaryop.py pypy/dist/pypy/translator/test/test_annrpython.py Log: The annotator tracks modifications and resizes of lists. Modified: pypy/dist/pypy/annotation/binaryop.py ============================================================================== --- pypy/dist/pypy/annotation/binaryop.py (original) +++ pypy/dist/pypy/annotation/binaryop.py Tue May 31 17:35:42 2005 @@ -282,11 +282,13 @@ class __extend__(pairtype(SomeList, SomeObject)): def inplace_add((lst1, obj2)): + lst1.listdef.resize() s_iter = obj2.iter() pair(lst1, SomeInteger()).setitem(s_iter.next()) return lst1 def inplace_mul((lst1, obj2)): + lst1.listdef.resize() return lst1 @@ -342,19 +344,22 @@ class __extend__(pairtype(SomeList, SomeInteger)): def mul((lst1, int2)): - return lst1 + # NB. return a new SomeList instead of lst1 in case lst1 is a SomeRange + return SomeList(lst1.listdef) def getitem((lst1, int2)): return lst1.listdef.read_item() def setitem((lst1, int2), s_value): + lst1.listdef.mutate() lst1.listdef.generalize(s_value) class __extend__(pairtype(SomeList, SomeSlice)): def getitem((lst, slic)): - return lst + # NB. return a new SomeList instead of lst in case lst is a SomeRange + return SomeList(lst.listdef) class __extend__(pairtype(SomeString, SomeSlice)): @@ -378,7 +383,8 @@ class __extend__(pairtype(SomeInteger, SomeList)): def mul((int1, lst2)): - return lst2 + # NB. return a new SomeList instead of lst2 in case lst2 is a SomeRange + return SomeList(lst2.listdef) class __extend__(pairtype(SomeInstance, SomeInstance)): Modified: pypy/dist/pypy/annotation/listdef.py ============================================================================== --- pypy/dist/pypy/annotation/listdef.py (original) +++ pypy/dist/pypy/annotation/listdef.py Tue May 31 17:35:42 2005 @@ -3,6 +3,8 @@ class ListItem: + mutated = False # True for lists mutated after creation + resized = False # True for lists resized after creation def __init__(self, bookkeeper, s_value): self.s_value = s_value @@ -14,6 +16,8 @@ if self is not other: if getattr(TLS, 'no_side_effects_in_union', 0): raise UnionError("merging list/dict items") + self.mutated |= other.mutated + self.resized |= other.resized self.itemof.update(other.itemof) self.read_locations.update(other.read_locations) self.patch() # which should patch all refs to 'other' @@ -69,5 +73,12 @@ def __repr__(self): return '<%r>' % (self.listitem.s_value,) + def mutate(self): + self.listitem.mutated = True + + def resize(self): + self.listitem.mutated = True + self.listitem.resized = True + MOST_GENERAL_LISTDEF = ListDef(None, SomeObject()) Modified: pypy/dist/pypy/annotation/unaryop.py ============================================================================== --- pypy/dist/pypy/annotation/unaryop.py (original) +++ pypy/dist/pypy/annotation/unaryop.py Tue May 31 17:35:42 2005 @@ -199,19 +199,23 @@ class __extend__(SomeList): def method_append(lst, s_value): + lst.listdef.resize() pair(lst, SomeInteger()).setitem(s_value) def method_extend(lst, s_iterable): + lst.listdef.resize() s_iter = s_iterable.iter() pair(lst, SomeInteger()).setitem(s_iter.next()) def method_reverse(lst): - pass + lst.listdef.mutate() def method_insert(lst, s_index, s_value): + lst.listdef.resize() pair(lst, SomeInteger()).setitem(s_value) def method_pop(lst, s_index=None): + lst.listdef.resize() return lst.listdef.read_item() def method_index(lst, el): Modified: pypy/dist/pypy/translator/test/test_annrpython.py ============================================================================== --- pypy/dist/pypy/translator/test/test_annrpython.py (original) +++ pypy/dist/pypy/translator/test/test_annrpython.py Tue May 31 17:35:42 2005 @@ -731,6 +731,11 @@ a = self.RPythonAnnotator() s = a.build_types(snippet.harmonic, [int]) assert s.knowntype == float + # check that the list produced by range() is not mutated or resized + for s_value in a.bindings.values(): + if isinstance(s_value, annmodel.SomeList): + assert not s_value.listdef.listitem.resized + assert not s_value.listdef.listitem.mutated def test_bool(self): def f(a,b): @@ -1047,6 +1052,11 @@ # result should be an integer assert s.knowntype == int + def test_prime(self): + a = self.RPythonAnnotator() + s = a.build_types(snippet.prime, [int]) + assert s == annmodel.SomeBool() + def g(n): return [0,1,2,n] From pedronis at codespeak.net Tue May 31 17:55:08 2005 From: pedronis at codespeak.net (pedronis at codespeak.net) Date: Tue, 31 May 2005 17:55:08 +0200 (CEST) Subject: [pypy-svn] r12935 - in pypy/dist/pypy/translator: . test Message-ID: <20050531155508.EEE7F27BCD@code1.codespeak.net> Author: pedronis Date: Tue May 31 17:55:08 2005 New Revision: 12935 Modified: pypy/dist/pypy/translator/simplify.py pypy/dist/pypy/translator/test/test_annrpython.py Log: coalesce chained is_true with some tests Modified: pypy/dist/pypy/translator/simplify.py ============================================================================== --- pypy/dist/pypy/translator/simplify.py (original) +++ pypy/dist/pypy/translator/simplify.py Tue May 31 17:55:08 2005 @@ -472,12 +472,59 @@ consider_blocks[link.target] = True break +def coalesce_is_true(graph): + """coalesce paths that go through an is_true and a directly successive + is_true both on the same value, transforming the link into the + second is_true from the first to directly jump to the correct + target out of the second.""" + candidates = [] + + def has_is_true_exitpath(block): + tgts = [] + start_op = block.operations[-1] + cond_v = start_op.args[0] + if block.exitswitch == start_op.result: + for exit in block.exits: + tgt = exit.target + if tgt == block: + continue + rrenaming = dict(zip(tgt.inputargs,exit.args)) + if len(tgt.operations) == 1 and tgt.operations[0].opname == 'is_true': + tgt_op = tgt.operations[0] + if tgt.exitswitch == tgt_op.result and rrenaming.get(tgt_op.args[0]) == cond_v: + tgts.append((exit.exitcase, tgt)) + return tgts + + def visit(block): + if isinstance(block, Block) and block.operations and block.operations[-1].opname == 'is_true': + tgts = has_is_true_exitpath(block) + if tgts: + candidates.append((block, tgts)) + traverse(visit, graph) + + while candidates: + cand, tgts = candidates.pop() + newexits = list(cand.exits) + for case, tgt in tgts: + exit = cand.exits[case] + rrenaming = dict(zip(tgt.inputargs,exit.args)) + rrenaming[tgt.operations[0].result] = cand.operations[-1].result + def rename(v): + return rrenaming.get(v,v) + newlink = tgt.exits[case].copy(rename) + newexits[case] = newlink + cand.recloseblock(*newexits) + newtgts = has_is_true_exitpath(cand) + if newtgts: + candidates.append((cand, newtgts)) + # ____ all passes & simplify_graph all_passes = [ eliminate_empty_blocks, remove_assertion_errors, join_blocks, + coalesce_is_true, transform_dead_op_vars, remove_identical_vars, transform_ovfcheck, Modified: pypy/dist/pypy/translator/test/test_annrpython.py ============================================================================== --- pypy/dist/pypy/translator/test/test_annrpython.py (original) +++ pypy/dist/pypy/translator/test/test_annrpython.py Tue May 31 17:55:08 2005 @@ -1057,6 +1057,36 @@ s = a.build_types(snippet.prime, [int]) assert s == annmodel.SomeBool() + def test_and_is_true_coalesce(self): + def f(a,b,c,d,e): + x = a and b + if x: + return d,c + return e,c + a = self.RPythonAnnotator() + s = a.build_types(f, [int, str, a.bookkeeper.immutablevalue(1.0), a.bookkeeper.immutablevalue('d'), a.bookkeeper.immutablevalue('e')]) + assert s == annmodel.SomeTuple([annmodel.SomeChar(), a.bookkeeper.immutablevalue(1.0)]) + assert not [b for b in a.bindings.itervalues() if b.__class__ == annmodel.SomeObject] + + def test_is_true_coalesce2(self): + def f(a,b,a1,b1,c,d,e): + x = (a or b) and (a1 or b1) + if x: + return d,c + return e,c + a = self.RPythonAnnotator() + s = a.build_types(f, [int, str, float, list, a.bookkeeper.immutablevalue(1.0), a.bookkeeper.immutablevalue('d'), a.bookkeeper.immutablevalue('e')]) + assert s == annmodel.SomeTuple([annmodel.SomeChar(), a.bookkeeper.immutablevalue(1.0)]) + assert not [b for b in a.bindings.itervalues() if b.__class__ == annmodel.SomeObject] + a.translator.view() + + def test_is_true_coalesce_sanity(self): + def f(a): + while a: + pass + a = self.RPythonAnnotator() + s = a.build_types(f, [int]) + assert s == a.bookkeeper.immutablevalue(None) def g(n): return [0,1,2,n] From arigo at codespeak.net Tue May 31 17:56:56 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Tue, 31 May 2005 17:56:56 +0200 (CEST) Subject: [pypy-svn] r12936 - pypy/dist/pypy/annotation Message-ID: <20050531155656.E20BC27BCE@code1.codespeak.net> Author: arigo Date: Tue May 31 17:56:56 2005 New Revision: 12936 Modified: pypy/dist/pypy/annotation/binaryop.py Log: Create a new listdef for operations that create a new list. Modified: pypy/dist/pypy/annotation/binaryop.py ============================================================================== --- pypy/dist/pypy/annotation/binaryop.py (original) +++ pypy/dist/pypy/annotation/binaryop.py Tue May 31 17:56:56 2005 @@ -344,8 +344,7 @@ class __extend__(pairtype(SomeList, SomeInteger)): def mul((lst1, int2)): - # NB. return a new SomeList instead of lst1 in case lst1 is a SomeRange - return SomeList(lst1.listdef) + return getbookkeeper().newlist(lst1.listdef.read_item()) def getitem((lst1, int2)): return lst1.listdef.read_item() @@ -358,8 +357,7 @@ class __extend__(pairtype(SomeList, SomeSlice)): def getitem((lst, slic)): - # NB. return a new SomeList instead of lst in case lst is a SomeRange - return SomeList(lst.listdef) + return getbookkeeper().newlist(lst.listdef.read_item()) class __extend__(pairtype(SomeString, SomeSlice)): @@ -383,8 +381,7 @@ class __extend__(pairtype(SomeInteger, SomeList)): def mul((int1, lst2)): - # NB. return a new SomeList instead of lst2 in case lst2 is a SomeRange - return SomeList(lst2.listdef) + return getbookkeeper().newlist(lst2.listdef.read_item()) class __extend__(pairtype(SomeInstance, SomeInstance)): From pedronis at codespeak.net Tue May 31 18:36:18 2005 From: pedronis at codespeak.net (pedronis at codespeak.net) Date: Tue, 31 May 2005 18:36:18 +0200 (CEST) Subject: [pypy-svn] r12937 - pypy/dist/pypy/translator/test Message-ID: <20050531163618.E93F827BCF@code1.codespeak.net> Author: pedronis Date: Tue May 31 18:36:18 2005 New Revision: 12937 Modified: pypy/dist/pypy/translator/test/test_annrpython.py Log: remove .view call Modified: pypy/dist/pypy/translator/test/test_annrpython.py ============================================================================== --- pypy/dist/pypy/translator/test/test_annrpython.py (original) +++ pypy/dist/pypy/translator/test/test_annrpython.py Tue May 31 18:36:18 2005 @@ -1078,7 +1078,6 @@ s = a.build_types(f, [int, str, float, list, a.bookkeeper.immutablevalue(1.0), a.bookkeeper.immutablevalue('d'), a.bookkeeper.immutablevalue('e')]) assert s == annmodel.SomeTuple([annmodel.SomeChar(), a.bookkeeper.immutablevalue(1.0)]) assert not [b for b in a.bindings.itervalues() if b.__class__ == annmodel.SomeObject] - a.translator.view() def test_is_true_coalesce_sanity(self): def f(a): From pedronis at codespeak.net Tue May 31 18:45:14 2005 From: pedronis at codespeak.net (pedronis at codespeak.net) Date: Tue, 31 May 2005 18:45:14 +0200 (CEST) Subject: [pypy-svn] r12938 - in pypy/dist/pypy: annotation translator Message-ID: <20050531164514.02EA327BD8@code1.codespeak.net> Author: pedronis Date: Tue May 31 18:45:14 2005 New Revision: 12938 Modified: pypy/dist/pypy/annotation/binaryop.py pypy/dist/pypy/translator/annrpython.py Log: - the annotator now raises an exception on completely unknown ops instead of defaulting to SomeObject as result - implemented delitem annotation Modified: pypy/dist/pypy/annotation/binaryop.py ============================================================================== --- pypy/dist/pypy/annotation/binaryop.py (original) +++ pypy/dist/pypy/annotation/binaryop.py Tue May 31 18:45:14 2005 @@ -23,7 +23,7 @@ 'truediv', 'floordiv', 'divmod', 'pow', 'and_', 'or_', 'xor', 'lshift', 'rshift', - 'getitem', 'setitem', + 'getitem', 'setitem', 'delitem', 'inplace_add', 'inplace_sub', 'inplace_mul', 'inplace_truediv', 'inplace_floordiv', 'inplace_div', 'inplace_mod', 'inplace_pow', @@ -320,6 +320,9 @@ dic1.dictdef.generalize_key(obj2) dic1.dictdef.generalize_value(s_value) + def delitem((dic1, obj1)): + pass + class __extend__(pairtype(SomeSlice, SomeSlice)): @@ -353,12 +356,16 @@ lst1.listdef.mutate() lst1.listdef.generalize(s_value) + def delitem((lst1, int2)): + lst1.listdef.resize() class __extend__(pairtype(SomeList, SomeSlice)): def getitem((lst, slic)): return getbookkeeper().newlist(lst.listdef.read_item()) + def delitem((lst1, slic)): + lst1.listdef.resize() class __extend__(pairtype(SomeString, SomeSlice)): Modified: pypy/dist/pypy/translator/annrpython.py ============================================================================== --- pypy/dist/pypy/translator/annrpython.py (original) +++ pypy/dist/pypy/translator/annrpython.py Tue May 31 18:45:14 2005 @@ -493,10 +493,13 @@ #___ creating the annotations based on operations ______ - def consider_op(self,op): + def consider_op(self, op): argcells = [self.binding(a) for a in op.args] consider_meth = getattr(self,'consider_op_'+op.opname, - self.default_consider_op) + None) + if not consider_meth: + raise Exception,"unknown op: %r" % op + # let's be careful about avoiding propagated SomeImpossibleValues # to enter an op; the latter can result in violations of the # more general results invariant: e.g. if SomeImpossibleValue enters is_ @@ -515,9 +518,6 @@ assert isinstance(op.result, Variable) self.setbinding(op.result, resultcell) # bind resultcell to op.result - def default_consider_op(self, *args): - return annmodel.SomeObject() - def _registeroperations(loc): # All unary operations for opname in annmodel.UNARY_OPERATIONS: From arigo at codespeak.net Tue May 31 19:13:21 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Tue, 31 May 2005 19:13:21 +0200 (CEST) Subject: [pypy-svn] r12939 - in pypy/dist/pypy: annotation rpython rpython/test translator/test Message-ID: <20050531171321.A888227BD3@code1.codespeak.net> Author: arigo Date: Tue May 31 19:13:21 2005 New Revision: 12939 Modified: pypy/dist/pypy/annotation/bookkeeper.py pypy/dist/pypy/annotation/builtin.py pypy/dist/pypy/annotation/listdef.py pypy/dist/pypy/rpython/rbuiltin.py pypy/dist/pypy/rpython/rint.py pypy/dist/pypy/rpython/rlist.py pypy/dist/pypy/rpython/test/test_rlist.py pypy/dist/pypy/translator/test/test_annrpython.py Log: Support for range objects in the rtyper, based on the annotator's deduction of whether a variable can only contain a list which is a range with a known step. Modified: pypy/dist/pypy/annotation/bookkeeper.py ============================================================================== --- pypy/dist/pypy/annotation/bookkeeper.py (original) +++ pypy/dist/pypy/annotation/bookkeeper.py Tue May 31 19:13:21 2005 @@ -87,18 +87,19 @@ self.userclasseslist.append(cdef) return self.userclasses[cls] - def getlistdef(self): + def getlistdef(self, **flags): """Get the ListDef associated with the current position.""" try: listdef = self.listdefs[self.position_key] except KeyError: listdef = self.listdefs[self.position_key] = ListDef(self) + listdef.listitem.__dict__.update(flags) return listdef - def newlist(self, *s_values): + def newlist(self, *s_values, **flags): """Make a SomeList associated with the current position, general enough to contain the s_values as items.""" - listdef = self.getlistdef() + listdef = self.getlistdef(**flags) for s_value in s_values: listdef.generalize(s_value) return SomeList(listdef) Modified: pypy/dist/pypy/annotation/builtin.py ============================================================================== --- pypy/dist/pypy/annotation/builtin.py (original) +++ pypy/dist/pypy/annotation/builtin.py Tue May 31 19:13:21 2005 @@ -38,7 +38,27 @@ # ____________________________________________________________ def builtin_range(*args): - return getbookkeeper().newlist(SomeInteger()) # XXX nonneg=... + s_step = immutablevalue(1) + if len(args) == 1: + s_start = immutablevalue(0) + s_stop = args[0] + elif len(args) == 2: + s_start, s_stop = args + elif len(args) == 3: + s_start, s_stop = args[:2] + s_step = args[2] + else: + raise Exception, "range() takes 1 to 3 arguments" + if not s_step.is_constant(): + raise Exception, "range() step argument should be a constant" + step = s_step.const + if step == 0: + raise Exception, "range() with step zero" + elif step > 0: + nonneg = s_start.nonneg + else: + nonneg = s_stop.nonneg or (s_stop.is_constant() and s_stop.const >= -1) + return getbookkeeper().newlist(SomeInteger(nonneg=nonneg), range_step=step) builtin_xrange = builtin_range # xxx for now allow it Modified: pypy/dist/pypy/annotation/listdef.py ============================================================================== --- pypy/dist/pypy/annotation/listdef.py (original) +++ pypy/dist/pypy/annotation/listdef.py Tue May 31 19:13:21 2005 @@ -5,6 +5,7 @@ class ListItem: mutated = False # True for lists mutated after creation resized = False # True for lists resized after creation + range_step = None # the step -- only for lists only created by a range() def __init__(self, bookkeeper, s_value): self.s_value = s_value @@ -18,6 +19,8 @@ raise UnionError("merging list/dict items") self.mutated |= other.mutated self.resized |= other.resized + if other.range_step != self.range_step: + self.range_step = None self.itemof.update(other.itemof) self.read_locations.update(other.read_locations) self.patch() # which should patch all refs to 'other' Modified: pypy/dist/pypy/rpython/rbuiltin.py ============================================================================== --- pypy/dist/pypy/rpython/rbuiltin.py (original) +++ pypy/dist/pypy/rpython/rbuiltin.py Tue May 31 19:13:21 2005 @@ -3,6 +3,7 @@ from pypy.rpython.lltype import malloc, typeOf, nullptr, nullgcptr from pypy.rpython.lltype import Void, Signed from pypy.rpython.rtyper import TyperError +from pypy.rpython.rlist import rtype_builtin_range class __extend__(SomeBuiltin): @@ -60,6 +61,8 @@ assert hop.nb_args == 1 return hop.args_s[0].rtype_float(hop) +#def rtype_builtin_range(hop): see rlist.py + # collect all functions import __builtin__ Modified: pypy/dist/pypy/rpython/rint.py ============================================================================== --- pypy/dist/pypy/rpython/rint.py (original) +++ pypy/dist/pypy/rpython/rint.py Tue May 31 19:13:21 2005 @@ -46,6 +46,10 @@ return _rtype_template(hop, 'div') rtype_inplace_div = rtype_div + def rtype_floordiv(_, hop): + return _rtype_template(hop, 'floordiv') + rtype_inplace_floordiv = rtype_floordiv + def rtype_mod(_, hop): return _rtype_template(hop, 'mod') rtype_inplace_mod = rtype_mod Modified: pypy/dist/pypy/rpython/rlist.py ============================================================================== --- pypy/dist/pypy/rpython/rlist.py (original) +++ pypy/dist/pypy/rpython/rlist.py Tue May 31 19:13:21 2005 @@ -1,5 +1,6 @@ from pypy.annotation.pairtype import pair, pairtype from pypy.annotation.model import SomeList, SomeInteger +from pypy.objspace.flow.model import Constant from pypy.rpython.lltype import * # ____________________________________________________________ @@ -13,22 +14,45 @@ # 'items' points to a C-like array in memory preceded by a 'length' header, # where each item contains a primitive value or pointer to the actual list # item. +# +# Lists returned by range() and never mutated use a simpler implementation: +# +# struct range { +# Signed start, stop; // step is always constant +# } + +RANGE = GcStruct("range", ("start", Signed), ("stop", Signed)) + class __extend__(SomeList): + def ll_range_step(s_list): + return (not s_list.listdef.listitem.mutated + and s_list.listdef.listitem.range_step) + def lowleveltype(s_list): - ITEM = s_list.get_s_items().lowleveltype() - LIST = GcStruct("list", ("items", GcPtr(GcArray(("item", ITEM))))) - return GcPtr(LIST) + if s_list.ll_range_step(): + assert isinstance(s_list.get_s_items(), SomeInteger) + return GcPtr(RANGE) + else: + ITEM = s_list.get_s_items().lowleveltype() + LIST = GcStruct("list", ("items", GcPtr(GcArray(("item", ITEM))))) + return GcPtr(LIST) def get_s_items(s_list): return s_list.listdef.listitem.s_value def rtype_len(s_lst, hop): v_lst, = hop.inputargs(s_lst) - return hop.gendirectcall(ll_len, v_lst) + step = s_lst.ll_range_step() + if step: + cstep = hop.inputconst(Signed, step) + return hop.gendirectcall(ll_rangelen, v_lst, cstep) + else: + return hop.gendirectcall(ll_len, v_lst) def rtype_method_append(s_lst, hop): + assert not s_lst.ll_range_step() v_lst, v_value = hop.inputargs(s_lst, s_lst.get_s_items()) hop.gendirectcall(ll_append, v_lst, v_value) @@ -37,11 +61,16 @@ def rtype_getitem((s_lst1, s_int2), hop): v_lst, v_index = hop.inputargs(s_lst1, Signed) - if s_int2.nonneg: - llfn = ll_getitem_nonneg + step = s_lst1.ll_range_step() + if step: + cstep = hop.inputconst(Signed, step) + return hop.gendirectcall(ll_rangeitem, v_lst, v_index, cstep) else: - llfn = ll_getitem - return hop.gendirectcall(llfn, v_lst, v_index) + if s_int2.nonneg: + llfn = ll_getitem_nonneg + else: + llfn = ll_getitem + return hop.gendirectcall(llfn, v_lst, v_index) # ____________________________________________________________ @@ -71,9 +100,36 @@ i += len(l.items) return l.items[i].item +def ll_setitem(l, i, newitem): + if i<0: + i += len(l.items) + l.items[i].item = newitem + def ll_setitem_nonneg(l, i, newitem): l.items[i].item = newitem +# __________ range __________ + +def ll_rangelen(l, step): + if step > 0: + result = (l.stop - l.start + (step-1)) // step + else: + result = (l.start - l.stop - (step+1)) // (-step) + if result < 0: + result = 0 + return result + +def ll_rangeitem(l, i, step): + if i<0: + # XXX ack. cannot call ll_rangelen() here for now :-( + if step > 0: + length = (l.stop - l.start + (step-1)) // step + else: + length = (l.start - l.stop - (step+1)) // (-step) + #assert length >= 0 + i += length + return l.start + i*step + # ____________________________________________________________ # # Irregular operations. @@ -95,3 +151,24 @@ v_item = hop.inputarg(s_listitem, arg=i) hop.gendirectcall(ll_setitem_nonneg, v_result, ci, v_item) return v_result + +def ll_newrange(start, stop): + l = malloc(RANGE) + l.start = start + l.stop = stop + return l + +def rtype_builtin_range(hop): + s_range = hop.s_result + step = s_range.listdef.listitem.range_step + if step is None: # cannot build a RANGE object, needs a real list + raise TyperError("range() list used too dynamically") + if hop.nb_args == 1: + vstart = hop.inputconst(Signed, 0) + vstop, = hop.inputargs(Signed) + elif hop.nb_args == 2: + vstart, vstop = hop.inputargs(Signed, Signed) + else: + vstart, vstop, vstep = hop.inputargs(Signed, Signed, Signed) + assert isinstance(vstep, Constant) and vstep.value == step + return hop.gendirectcall(ll_newrange, vstart, vstop) Modified: pypy/dist/pypy/rpython/test/test_rlist.py ============================================================================== --- pypy/dist/pypy/rpython/test/test_rlist.py (original) +++ pypy/dist/pypy/rpython/test/test_rlist.py Tue May 31 19:13:21 2005 @@ -1,8 +1,42 @@ from pypy.translator.translator import Translator +from pypy.annotation.listdef import ListDef from pypy.rpython.lltype import * from pypy.rpython.rtyper import RPythonTyper +from pypy.rpython.rlist import * +def test_rlist(): + s = SomeList(ListDef(None, SomeInteger())) + l = ll_newlist(s.lowleveltype(), 3) + ll_setitem(l, 0, 42) + ll_setitem(l, -2, 43) + ll_setitem_nonneg(l, 2, 44) + ll_append(l, 45) + assert ll_getitem(l, -4) == 42 + assert ll_getitem_nonneg(l, 1) == 43 + assert ll_getitem(l, 2) == 44 + assert ll_getitem(l, 3) == 45 + assert ll_len(l) == 4 + +def test_rlist_range(): + def test1(start, stop, step): + expected = range(start, stop, step) + length = len(expected) + l = ll_newrange(start, stop) + assert ll_rangelen(l, step) == length + lst = [ll_rangeitem(l, i, step) for i in range(length)] + assert lst == expected + lst = [ll_rangeitem(l, i-length, step) for i in range(length)] + assert lst == expected + + for start in (-10, 0, 1, 10): + for stop in (-8, 0, 4, 8, 25): + for step in (1, 2, 3, -1, -2): + test1(start, stop, step) + + +# ____________________________________________________________ + def test_simple(): def dummyfn(): l = [10,20,30] @@ -42,3 +76,19 @@ typer.specialize() #t.view() t.checkgraphs() + + +def test_range(): + def dummyfn(N): + total = 0 + total = len(range(N)) + #for i in : + # total += i + return total + + t = Translator(dummyfn) + t.annotate([]) + typer = RPythonTyper(t.annotator) + typer.specialize() + #t.view() + t.checkgraphs() Modified: pypy/dist/pypy/translator/test/test_annrpython.py ============================================================================== --- pypy/dist/pypy/translator/test/test_annrpython.py (original) +++ pypy/dist/pypy/translator/test/test_annrpython.py Tue May 31 19:13:21 2005 @@ -736,6 +736,7 @@ if isinstance(s_value, annmodel.SomeList): assert not s_value.listdef.listitem.resized assert not s_value.listdef.listitem.mutated + assert s_value.listdef.listitem.is_range def test_bool(self): def f(a,b): From arigo at codespeak.net Tue May 31 19:24:40 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Tue, 31 May 2005 19:24:40 +0200 (CEST) Subject: [pypy-svn] r12940 - pypy/dist/pypy/translator/test Message-ID: <20050531172440.42E4F27BC5@code1.codespeak.net> Author: arigo Date: Tue May 31 19:24:40 2005 New Revision: 12940 Modified: pypy/dist/pypy/translator/test/test_annrpython.py Log: Typo. Modified: pypy/dist/pypy/translator/test/test_annrpython.py ============================================================================== --- pypy/dist/pypy/translator/test/test_annrpython.py (original) +++ pypy/dist/pypy/translator/test/test_annrpython.py Tue May 31 19:24:40 2005 @@ -736,7 +736,7 @@ if isinstance(s_value, annmodel.SomeList): assert not s_value.listdef.listitem.resized assert not s_value.listdef.listitem.mutated - assert s_value.listdef.listitem.is_range + assert s_value.listdef.listitem.range_step def test_bool(self): def f(a,b): From arigo at codespeak.net Tue May 31 19:25:04 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Tue, 31 May 2005 19:25:04 +0200 (CEST) Subject: [pypy-svn] r12941 - pypy/dist/pypy/annotation Message-ID: <20050531172504.D374927BD9@code1.codespeak.net> Author: arigo Date: Tue May 31 19:25:04 2005 New Revision: 12941 Modified: pypy/dist/pypy/annotation/binaryop.py Log: pairtype(SomeList, SomeSlice).setitem(iterable) Modified: pypy/dist/pypy/annotation/binaryop.py ============================================================================== --- pypy/dist/pypy/annotation/binaryop.py (original) +++ pypy/dist/pypy/annotation/binaryop.py Tue May 31 19:25:04 2005 @@ -364,6 +364,11 @@ def getitem((lst, slic)): return getbookkeeper().newlist(lst.listdef.read_item()) + def setitem((lst, slic), s_iterable): + lst.listdef.resize() + s_iter = s_iterable.iter() + pair(lst, SomeInteger()).setitem(s_iter.next()) + def delitem((lst1, slic)): lst1.listdef.resize() From arigo at codespeak.net Tue May 31 19:33:26 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Tue, 31 May 2005 19:33:26 +0200 (CEST) Subject: [pypy-svn] r12942 - pypy/dist/pypy/annotation Message-ID: <20050531173326.62EF027BDD@code1.codespeak.net> Author: arigo Date: Tue May 31 19:33:26 2005 New Revision: 12942 Modified: pypy/dist/pypy/annotation/binaryop.py pypy/dist/pypy/annotation/model.py pypy/dist/pypy/annotation/unaryop.py Log: Changed SomeIterator() to record the container instead of the items it enumerates. Allows a consistently rtyped implementation to be chosen based on what kind of container it iterates over. Modified: pypy/dist/pypy/annotation/binaryop.py ============================================================================== --- pypy/dist/pypy/annotation/binaryop.py (original) +++ pypy/dist/pypy/annotation/binaryop.py Tue May 31 19:33:26 2005 @@ -408,7 +408,7 @@ class __extend__(pairtype(SomeIterator, SomeIterator)): def union((iter1, iter2)): - return SomeIterator(unionof(iter1.s_item, iter2.s_item)) + return SomeIterator(unionof(iter1.s_container, iter2.s_container)) class __extend__(pairtype(SomeBuiltin, SomeBuiltin)): Modified: pypy/dist/pypy/annotation/model.py ============================================================================== --- pypy/dist/pypy/annotation/model.py (original) +++ pypy/dist/pypy/annotation/model.py Tue May 31 19:33:26 2005 @@ -225,10 +225,10 @@ class SomeIterator(SomeObject): - "Stands for an iterator returning objects of a known type." + "Stands for an iterator returning objects from a given container." knowntype = type(iter([])) # arbitrarily chose seqiter as the type - def __init__(self, s_item=SomeObject()): - self.s_item = s_item + def __init__(self, s_container): + self.s_container = s_container class SomeInstance(SomeObject): Modified: pypy/dist/pypy/annotation/unaryop.py ============================================================================== --- pypy/dist/pypy/annotation/unaryop.py (original) +++ pypy/dist/pypy/annotation/unaryop.py Tue May 31 19:33:26 2005 @@ -193,7 +193,10 @@ return immutablevalue(len(tup.items)) def iter(tup): - return SomeIterator(unionof(*tup.items)) + return SomeIterator(tup) + + def getanyitem(tup): + return unionof(*tup.items) class __extend__(SomeList): @@ -230,7 +233,10 @@ return SomeObject.len(lst) def iter(lst): - return SomeIterator(lst.listdef.read_item()) + return SomeIterator(lst) + + def getanyitem(lst): + return lst.listdef.read_item() class __extend__(SomeDict): @@ -244,7 +250,10 @@ return SomeObject.len(dct) def iter(dct): - return SomeIterator(dct.dictdef.read_key()) + return SomeIterator(dct) + + def getanyitem(dct): + return dct.dictdef.read_key() def method_get(dct, key, dfl): return unionof(dct.dictdef.read_value(), dfl) @@ -279,7 +288,10 @@ return SomeString() def iter(str): - return SomeIterator(SomeChar()) + return SomeIterator(str) + + def getanyitem(str): + return SomeChar() def ord(str): return SomeInteger(nonneg=True) @@ -302,7 +314,7 @@ class __extend__(SomeIterator): def next(itr): - return itr.s_item + return itr.s_container.getanyitem() class __extend__(SomeInstance): From pedronis at codespeak.net Tue May 31 19:34:26 2005 From: pedronis at codespeak.net (pedronis at codespeak.net) Date: Tue, 31 May 2005 19:34:26 +0200 (CEST) Subject: [pypy-svn] r12943 - pypy/dist/pypy/annotation Message-ID: <20050531173426.B9C5F27BDF@code1.codespeak.net> Author: pedronis Date: Tue May 31 19:34:26 2005 New Revision: 12943 Modified: pypy/dist/pypy/annotation/model.py Log: warn and block before defaulting to SomeObject for operation with all non-SomeObject arguments Modified: pypy/dist/pypy/annotation/model.py ============================================================================== --- pypy/dist/pypy/annotation/model.py (original) +++ pypy/dist/pypy/annotation/model.py Tue May 31 19:34:26 2005 @@ -415,9 +415,16 @@ def missing_operation(cls, name): def default_op(*args): - #print '* warning, no type available for %s(%s)' % ( - # name, ', '.join([repr(a) for a in args])) - return SomeObject() + if args and isinstance(args[0], tuple): + flattened = tuple(args[0]) + args[1:] + else: + flattened = args + for arg in flattened: + if arg.__class__ == SomeObject and arg.knowntype == object: + return SomeObject() + bookkeeper = pypy.annotation.bookkeeper.getbookkeeper() + bookkeeper.warning("no precise annotation supplied for %s%r" % (name, args)) + return SomeImpossibleValue() setattr(cls, name, default_op) # this has the side-effect of registering the unary and binary operations From pedronis at codespeak.net Tue May 31 19:57:54 2005 From: pedronis at codespeak.net (pedronis at codespeak.net) Date: Tue, 31 May 2005 19:57:54 +0200 (CEST) Subject: [pypy-svn] r12944 - pypy/dist/pypy/annotation Message-ID: <20050531175754.8EE8F27BE2@code1.codespeak.net> Author: pedronis Date: Tue May 31 19:57:54 2005 New Revision: 12944 Modified: pypy/dist/pypy/annotation/unaryop.py Log: iter for iterators Modified: pypy/dist/pypy/annotation/unaryop.py ============================================================================== --- pypy/dist/pypy/annotation/unaryop.py (original) +++ pypy/dist/pypy/annotation/unaryop.py Tue May 31 19:57:54 2005 @@ -313,6 +313,9 @@ class __extend__(SomeIterator): + def iter(itr): + return itr + def next(itr): return itr.s_container.getanyitem() From arigo at codespeak.net Tue May 31 20:33:29 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Tue, 31 May 2005 20:33:29 +0200 (CEST) Subject: [pypy-svn] r12945 - in pypy/dist/pypy/rpython: . test Message-ID: <20050531183329.381E827BE6@code1.codespeak.net> Author: arigo Date: Tue May 31 20:33:28 2005 New Revision: 12945 Added: pypy/dist/pypy/rpython/riter.py (contents, props changed) Modified: pypy/dist/pypy/rpython/rlist.py pypy/dist/pypy/rpython/rtyper.py pypy/dist/pypy/rpython/test/test_rlist.py Log: Intermediate check-in. Stuck in how to implement "raise StopIteration". This requires exceptions, which requires classes and instances... Added: pypy/dist/pypy/rpython/riter.py ============================================================================== --- (empty file) +++ pypy/dist/pypy/rpython/riter.py Tue May 31 20:33:28 2005 @@ -0,0 +1,57 @@ +from pypy.annotation.pairtype import pair, pairtype +from pypy.annotation.model import SomeIterator, SomeList +from pypy.rpython.lltype import * + + +class __extend__(SomeIterator): + + def getiteratorkind(s_itr): + s_cont = s_itr.s_container + if isinstance(s_cont, SomeList): + if not s_cont.ll_range_step(): + return PlainListIterator + else: + return RangeIterator + else: + raise TyperError("not implemented yet") + + def lowleveltype(s_itr): + kind = s_itr.getiteratorkind() + return kind.lowlevelitertype(s_itr.s_container) + + def rtype_next(s_itr, hop): + v_itr, = hop.inputargs(s_itr) + kind = s_itr.getiteratorkind() + return kind.next(v_itr, hop) + +# ____________________________________________________________ + +class Namespace(object): + def __init__(self, name, bases, dict): + assert not bases + self.__dict__.update(dict) + + +class PlainListIterator: + """__________ regular list iterator __________""" + __metaclass__ = Namespace + + def lowlevelitertype(s_lst): + return GcPtr(GcStruct('listiter', ('list', s_lst.lowleveltype()), + ('index', Signed))) + + def ll_listiter(ITERPTR, lst): + iter = malloc(ITERPTR.TO) + iter.list = lst + iter.index = 0 + return iter + + def rtype_new_iter(hop): + s_lst, = hop.args_s + v_lst, = hop.inputargs(s_lst) + ITERPTR = PlainListIterator.lowlevelitertype(s_lst) + citerptr = hop.inputconst(Void, ITERPTR) + return hop.gendirectcall(PlainListIterator.ll_listiter, citerptr, v_lst) + + def next(v_itr, hop): + XXX - NotImplementedYet Modified: pypy/dist/pypy/rpython/rlist.py ============================================================================== --- pypy/dist/pypy/rpython/rlist.py (original) +++ pypy/dist/pypy/rpython/rlist.py Tue May 31 20:33:28 2005 @@ -56,6 +56,10 @@ v_lst, v_value = hop.inputargs(s_lst, s_lst.get_s_items()) hop.gendirectcall(ll_append, v_lst, v_value) + def rtype_iter(s_lst): + s_itr = hop.s_result + return s_itr.getiteratorkind().rtype_new_iter(hop) + class __extend__(pairtype(SomeList, SomeInteger)): Modified: pypy/dist/pypy/rpython/rtyper.py ============================================================================== --- pypy/dist/pypy/rpython/rtyper.py (original) +++ pypy/dist/pypy/rpython/rtyper.py Tue May 31 20:33:28 2005 @@ -361,4 +361,4 @@ # _______________________________________________________________________ # this has the side-effect of registering the unary and binary operations from pypy.rpython import robject, rlist, rptr, rbuiltin, rint, rbool, rfloat -from pypy.rpython import rpbc, rstr +from pypy.rpython import rpbc, rstr, riter Modified: pypy/dist/pypy/rpython/test/test_rlist.py ============================================================================== --- pypy/dist/pypy/rpython/test/test_rlist.py (original) +++ pypy/dist/pypy/rpython/test/test_rlist.py Tue May 31 20:33:28 2005 @@ -78,17 +78,16 @@ t.checkgraphs() -def test_range(): +def DONT_YET_test_range(): def dummyfn(N): total = 0 - total = len(range(N)) - #for i in : - # total += i + for i in range(N): + total += i return total t = Translator(dummyfn) t.annotate([]) typer = RPythonTyper(t.annotator) typer.specialize() - #t.view() + t.view() t.checkgraphs() From arigo at codespeak.net Tue May 31 23:32:20 2005 From: arigo at codespeak.net (arigo at codespeak.net) Date: Tue, 31 May 2005 23:32:20 +0200 (CEST) Subject: [pypy-svn] r12953 - in pypy/dist/pypy/rpython: . test Message-ID: <20050531213220.5192E27BE8@code1.codespeak.net> Author: arigo Date: Tue May 31 23:32:20 2005 New Revision: 12953 Modified: pypy/dist/pypy/rpython/lltype.py pypy/dist/pypy/rpython/test/test_lltype.py Log: - split ForwardReference into a Gc and a non-gc version - malloc(..., immortal=True) to get some non-gc'ed static storage Modified: pypy/dist/pypy/rpython/lltype.py ============================================================================== --- pypy/dist/pypy/rpython/lltype.py (original) +++ pypy/dist/pypy/rpython/lltype.py Tue May 31 23:32:20 2005 @@ -160,13 +160,21 @@ class ForwardReference(ContainerType): def become(self, realcontainertype): + if not isinstance(realcontainertype, ContainerType): + raise TypeError("ForwardReference can only be to a container, " + "not %r" % (realcontainertype,)) + self.__class__ = realcontainertype.__class__ + self.__dict__ = realcontainertype.__dict__ + +class GcForwardReference(ForwardReference): + def become(self, realcontainertype): if not isinstance(realcontainertype, GC_CONTAINER): - raise TypeError("ForwardReference can only be to GcStruct or " + raise TypeError("GcForwardReference can only be to GcStruct or " "GcArray, not %r" % (realcontainertype,)) self.__class__ = realcontainertype.__class__ self.__dict__ = realcontainertype.__dict__ -GC_CONTAINER = (GcStruct, GcArray, PyObjectType, ForwardReference) +GC_CONTAINER = (GcStruct, GcArray, PyObjectType, GcForwardReference) class Primitive(LowLevelType): @@ -573,14 +581,18 @@ return "pyobject %s" % (super(_pyobject, self).__str__(),) -def malloc(T, n=None): +def malloc(T, n=None, immortal=False): if isinstance(T, Struct): o = _struct(T, n) elif isinstance(T, Array): o = _array(T, n) else: raise TypeError, "malloc for Structs and Arrays only" - return _ptr(GcPtr(T), o) + if immortal: + T = NonGcPtr(T) + else: + T = GcPtr(T) + return _ptr(T, o) def functionptr(TYPE, name, **attrs): if not isinstance(TYPE, FuncType): Modified: pypy/dist/pypy/rpython/test/test_lltype.py ============================================================================== --- pypy/dist/pypy/rpython/test/test_lltype.py (original) +++ pypy/dist/pypy/rpython/test/test_lltype.py Tue May 31 23:32:20 2005 @@ -252,11 +252,12 @@ py.test.raises(TypeError, "GcStruct('a', ('x', A))") def test_forward_reference(): - F = ForwardReference() + F = GcForwardReference() S = GcStruct('abc', ('x', GcPtr(F))) F.become(S) assert S.x == GcPtr(S) - py.test.raises(TypeError, "ForwardReference().become(Struct('abc'))") + py.test.raises(TypeError, "GcForwardReference().become(Struct('abc'))") + ForwardReference().become(Struct('abc')) def test_nullptr(): From pedronis at codespeak.net Tue May 31 23:35:19 2005 From: pedronis at codespeak.net (pedronis at codespeak.net) Date: Tue, 31 May 2005 23:35:19 +0200 (CEST) Subject: [pypy-svn] r12955 - in pypy/dist/pypy/rpython: . test Message-ID: <20050531213519.19CFA27BE9@code1.codespeak.net> Author: pedronis Date: Tue May 31 23:35:18 2005 New Revision: 12955 Modified: pypy/dist/pypy/rpython/lltype.py pypy/dist/pypy/rpython/test/test_lltype.py Log: support recursive lltype Modified: pypy/dist/pypy/rpython/lltype.py ============================================================================== --- pypy/dist/pypy/rpython/lltype.py (original) +++ pypy/dist/pypy/rpython/lltype.py Tue May 31 23:35:18 2005 @@ -2,6 +2,25 @@ import py from pypy.rpython.rarithmetic import r_uint from pypy.tool.uid import Hashable +from pypy.tool.tls import tlsobject + +TLS = tlsobject() + +def saferecursive(func, defl): + def safe(*args): + try: + seeing = TLS.seeing + except AttributeError: + seeing = TLS.seeing = {} + seeingkey = tuple([func] + [id(arg) for arg in args]) + if seeingkey in seeing: + return defl + seeing[seeingkey] = True + try: + return func(*args) + finally: + del seeing[seeingkey] + return safe class frozendict(dict): @@ -9,11 +28,14 @@ items = self.items() items.sort() return hash(tuple(items)) + __hash__ = saferecursive(__hash__, 0) class LowLevelType(object): def __eq__(self, other): return self.__class__ is other.__class__ and self.__dict__ == other.__dict__ + __eq__ = saferecursive(__eq__, True) + def __ne__(self, other): return not (self == other) @@ -21,6 +43,7 @@ items = self.__dict__.items() items.sort() return hash((self.__class__,) + tuple(items)) + __hash__ = saferecursive(__hash__, 0) def __repr__(self): return '<%s>' % (self,) @@ -91,6 +114,7 @@ def _str_fields(self): return ', '.join(['%s: %s' % (name, self._flds[name]) for name in self._names]) + _str_fields = saferecursive(_str_fields, '...') def __str__(self): return "%s %s { %s }" % (self.__class__.__name__, Modified: pypy/dist/pypy/rpython/test/test_lltype.py ============================================================================== --- pypy/dist/pypy/rpython/test/test_lltype.py (original) +++ pypy/dist/pypy/rpython/test/test_lltype.py Tue May 31 23:35:18 2005 @@ -258,7 +258,7 @@ assert S.x == GcPtr(S) py.test.raises(TypeError, "GcForwardReference().become(Struct('abc'))") ForwardReference().become(Struct('abc')) - + hash(S) def test_nullptr(): S = Struct('s')