[pypy-commit] pypy llvm-translation-backend: hg merge default (+ fixes)
Author: Manuel JacobBranch: llvm-translation-backend Changeset: r82492:d01ebac8cf46 Date: 2016-02-24 10:56 +0100 http://bitbucket.org/pypy/pypy/changeset/d01ebac8cf46/ Log:hg merge default (+ fixes) diff too long, truncating to 2000 out of 11381 lines diff --git a/.hgignore b/.hgignore --- a/.hgignore +++ b/.hgignore @@ -22,6 +22,7 @@ ^pypy/module/cpyext/test/.+\.obj$ ^pypy/module/cpyext/test/.+\.manifest$ ^pypy/module/test_lib_pypy/ctypes_tests/.+\.o$ +^pypy/module/test_lib_pypy/ctypes_tests/_ctypes_test\.o$ ^pypy/module/cppyy/src/.+\.o$ ^pypy/module/cppyy/bench/.+\.so$ ^pypy/module/cppyy/bench/.+\.root$ @@ -35,7 +36,6 @@ ^pypy/module/test_lib_pypy/cffi_tests/__pycache__.+$ ^pypy/doc/.+\.html$ ^pypy/doc/config/.+\.rst$ -^pypy/doc/basicblock\.asc$ ^pypy/doc/.+\.svninfo$ ^rpython/translator/c/src/libffi_msvc/.+\.obj$ ^rpython/translator/c/src/libffi_msvc/.+\.dll$ @@ -45,53 +45,33 @@ ^rpython/translator/c/src/cjkcodecs/.+\.obj$ ^rpython/translator/c/src/stacklet/.+\.o$ ^rpython/translator/c/src/.+\.o$ -^rpython/translator/jvm/\.project$ -^rpython/translator/jvm/\.classpath$ -^rpython/translator/jvm/eclipse-bin$ -^rpython/translator/jvm/src/pypy/.+\.class$ -^rpython/translator/benchmark/docutils$ -^rpython/translator/benchmark/templess$ -^rpython/translator/benchmark/gadfly$ -^rpython/translator/benchmark/mako$ -^rpython/translator/benchmark/bench-custom\.benchmark_result$ -^rpython/translator/benchmark/shootout_benchmarks$ +^rpython/translator/llvm/.+\.so$ ^rpython/translator/goal/target.+-c$ ^rpython/translator/goal/.+\.exe$ ^rpython/translator/goal/.+\.dll$ ^pypy/goal/pypy-translation-snapshot$ ^pypy/goal/pypy-c -^pypy/goal/pypy-jvm -^pypy/goal/pypy-jvm.jar ^pypy/goal/.+\.exe$ ^pypy/goal/.+\.dll$ ^pypy/goal/.+\.lib$ ^pypy/_cache$ -^pypy/doc/statistic/.+\.html$ -^pypy/doc/statistic/.+\.eps$ -^pypy/doc/statistic/.+\.pdf$ -^rpython/translator/cli/src/pypylib\.dll$ -^rpython/translator/cli/src/query\.exe$ -^rpython/translator/cli/src/main\.exe$ +^lib-python/2.7/lib2to3/.+\.pickle$ ^lib_pypy/__pycache__$ ^lib_pypy/ctypes_config_cache/_.+_cache\.py$ ^lib_pypy/ctypes_config_cache/_.+_.+_\.py$ ^lib_pypy/_libmpdec/.+.o$ -^rpython/translator/cli/query-descriptions$ ^pypy/doc/discussion/.+\.html$ ^include/.+\.h$ ^include/.+\.inl$ ^pypy/doc/_build/.*$ ^pypy/doc/config/.+\.html$ ^pypy/doc/config/style\.css$ -^pypy/doc/jit/.+\.html$ -^pypy/doc/jit/style\.css$ ^pypy/doc/image/lattice1\.png$ ^pypy/doc/image/lattice2\.png$ ^pypy/doc/image/lattice3\.png$ ^pypy/doc/image/stackless_informal\.png$ ^pypy/doc/image/parsing_example.+\.png$ ^rpython/doc/_build/.*$ -^pypy/module/test_lib_pypy/ctypes_tests/_ctypes_test\.o$ ^compiled ^.git/ ^release/ diff --git a/LICENSE b/LICENSE --- a/LICENSE +++ b/LICENSE @@ -41,29 +41,29 @@ Amaury Forgeot d'Arc Antonio Cuni Samuele Pedroni + Matti Picus Alex Gaynor Brian Kearns - Matti Picus Philip Jenvey Michael Hudson + Ronan Lamy David Schneider + Manuel Jacob Holger Krekel Christian Tismer Hakan Ardo - Manuel Jacob - Ronan Lamy Benjamin Peterson + Richard Plangger Anders Chrigstrom Eric van Riet Paap Wim Lavrijsen - Richard Plangger Richard Emslie Alexander Schremmer Dan Villiom Podlaski Christiansen + Remi Meier Lukas Diekmann Sven Hager Anders Lehmann - Remi Meier Aurelien Campeas Niklaus Haldimann Camillo Bruni @@ -72,8 +72,8 @@ Romain Guillebert Leonardo Santagada Seo Sanghyeon + Ronny Pfannschmidt Justin Peel - Ronny Pfannschmidt David Edelsohn Anders Hammarquist Jakub Gustak @@ -95,6 +95,7 @@ Tyler Wade Michael Foord Stephan Diehl + Vincent Legoll Stefan Schwarzer Valentino Volonghi Tomek Meka @@ -105,9 +106,9 @@ Jean-Paul Calderone Timo Paulssen Squeaky + Marius Gedminas Alexandre Fayolle Simon Burton - Marius Gedminas Martin Matusiak Konstantin Lopuhin Wenzhu Man @@ -116,16 +117,20 @@ Ivan Sichmann Freitas Greg Price Dario Bertini + Stefano Rivera Mark Pearse Simon Cross Andreas Sthrk - Stefano Rivera + Edd Barrett Jean-Philippe St. Pierre Guido van Rossum Pavel Vinogradov + Jeremy Thurgood Pawe Piotr Przeradowski + Spenser Bauman Paul deGrandis Ilya Osadchiy + marky1991 Tobias Oberstein Adrian Kuhn Boris Feigin @@ -134,14 +139,12 @@ Georg Brandl Bert Freudenberg Stian Andreassen - Edd Barrett + Tobias Pape Wanja Saatkamp Gerald Klix Mike Blume - Tobias Pape Oscar Nierstrasz Stefan H. Muller - Jeremy Thurgood Rami Chowdhury Eugene Oden Henry Mason @@ -153,6 +156,8 @@ Lukas Renggli Guenter Jantzen Ned Batchelder + Tim Felgentreff + Anton Gulenko Amit Regmi Ben Young Nicolas Chauvat @@ -162,12 +167,12 @@ Nicholas Riley Jason Chu Igor Trindade Oliveira - Tim Felgentreff + Yichao Yu Rocco Moretti Gintautas Miliauskas Michael Twomey Lucian
[pypy-commit] pypy llvm-translation-backend: hg merge default (+ fixes)
Author: Manuel JacobBranch: llvm-translation-backend Changeset: r82194:eaaed1d67e19 Date: 2016-02-12 22:30 +0100 http://bitbucket.org/pypy/pypy/changeset/eaaed1d67e19/ Log:hg merge default (+ fixes) diff too long, truncating to 2000 out of 12525 lines diff --git a/.hgignore b/.hgignore --- a/.hgignore +++ b/.hgignore @@ -75,6 +75,7 @@ ^lib_pypy/__pycache__$ ^lib_pypy/ctypes_config_cache/_.+_cache\.py$ ^lib_pypy/ctypes_config_cache/_.+_.+_\.py$ +^lib_pypy/_libmpdec/.+.o$ ^rpython/translator/cli/query-descriptions$ ^pypy/doc/discussion/.+\.html$ ^include/.+\.h$ diff --git a/dotviewer/drawgraph.py b/dotviewer/drawgraph.py --- a/dotviewer/drawgraph.py +++ b/dotviewer/drawgraph.py @@ -14,12 +14,661 @@ FONT = os.path.join(this_dir, 'font', 'DroidSans.ttf') FIXEDFONT = os.path.join(this_dir, 'font', 'DroidSansMono.ttf') COLOR = { -'black': (0,0,0), -'white': (255,255,255), -'red': (255,0,0), -'green': (0,255,0), -'blue': (0,0,255), -'yellow': (255,255,0), +'aliceblue': (240, 248, 255), +'antiquewhite': (250, 235, 215), +'antiquewhite1': (255, 239, 219), +'antiquewhite2': (238, 223, 204), +'antiquewhite3': (205, 192, 176), +'antiquewhite4': (139, 131, 120), +'aquamarine': (127, 255, 212), +'aquamarine1': (127, 255, 212), +'aquamarine2': (118, 238, 198), +'aquamarine3': (102, 205, 170), +'aquamarine4': (69, 139, 116), +'azure': (240, 255, 255), +'azure1': (240, 255, 255), +'azure2': (224, 238, 238), +'azure3': (193, 205, 205), +'azure4': (131, 139, 139), +'beige': (245, 245, 220), +'bisque': (255, 228, 196), +'bisque1': (255, 228, 196), +'bisque2': (238, 213, 183), +'bisque3': (205, 183, 158), +'bisque4': (139, 125, 107), +'black': (0, 0, 0), +'blanchedalmond': (255, 235, 205), +'blue': (0, 0, 255), +'blue1': (0, 0, 255), +'blue2': (0, 0, 238), +'blue3': (0, 0, 205), +'blue4': (0, 0, 139), +'blueviolet': (138, 43, 226), +'brown': (165, 42, 42), +'brown1': (255, 64, 64), +'brown2': (238, 59, 59), +'brown3': (205, 51, 51), +'brown4': (139, 35, 35), +'burlywood': (222, 184, 135), +'burlywood1': (255, 211, 155), +'burlywood2': (238, 197, 145), +'burlywood3': (205, 170, 125), +'burlywood4': (139, 115, 85), +'cadetblue': (95, 158, 160), +'cadetblue1': (152, 245, 255), +'cadetblue2': (142, 229, 238), +'cadetblue3': (122, 197, 205), +'cadetblue4': (83, 134, 139), +'chartreuse': (127, 255, 0), +'chartreuse1': (127, 255, 0), +'chartreuse2': (118, 238, 0), +'chartreuse3': (102, 205, 0), +'chartreuse4': (69, 139, 0), +'chocolate': (210, 105, 30), +'chocolate1': (255, 127, 36), +'chocolate2': (238, 118, 33), +'chocolate3': (205, 102, 29), +'chocolate4': (139, 69, 19), +'coral': (255, 127, 80), +'coral1': (255, 114, 86), +'coral2': (238, 106, 80), +'coral3': (205, 91, 69), +'coral4': (139, 62, 47), +'cornflowerblue': (100, 149, 237), +'cornsilk': (255, 248, 220), +'cornsilk1': (255, 248, 220), +'cornsilk2': (238, 232, 205), +'cornsilk3': (205, 200, 177), +'cornsilk4': (139, 136, 120), +'crimson': (220, 20, 60), +'cyan': (0, 255, 255), +'cyan1': (0, 255, 255), +'cyan2': (0, 238, 238), +'cyan3': (0, 205, 205), +'cyan4': (0, 139, 139), +'darkgoldenrod': (184, 134, 11), +'darkgoldenrod1': (255, 185, 15), +'darkgoldenrod2': (238, 173, 14), +'darkgoldenrod3': (205, 149, 12), +'darkgoldenrod4': (139, 101, 8), +'darkgreen': (0, 100, 0), +'darkkhaki': (189, 183, 107), +'darkolivegreen': (85, 107, 47), +'darkolivegreen1': (202, 255, 112), +'darkolivegreen2': (188, 238, 104), +'darkolivegreen3': (162, 205, 90), +'darkolivegreen4': (110, 139, 61), +'darkorange': (255, 140, 0), +'darkorange1': (255, 127, 0), +'darkorange2': (238, 118, 0), +'darkorange3': (205, 102, 0), +'darkorange4': (139, 69, 0), +'darkorchid': (153, 50, 204), +'darkorchid1': (191, 62, 255), +'darkorchid2': (178, 58, 238), +'darkorchid3': (154, 50, 205), +'darkorchid4': (104, 34, 139), +'darksalmon': (233, 150, 122), +'darkseagreen': (143, 188, 143), +'darkseagreen1': (193, 255, 193), +'darkseagreen2': (180, 238, 180), +'darkseagreen3': (155, 205, 155), +'darkseagreen4': (105, 139, 105), +'darkslateblue': (72, 61, 139), +'darkslategray': (47, 79, 79), +'darkslategray1': (151, 255, 255), +'darkslategray2': (141, 238, 238), +'darkslategray3': (121, 205, 205), +'darkslategray4': (82, 139, 139), +'darkslategrey': (47, 79, 79), +'darkturquoise': (0, 206, 209), +'darkviolet': (148, 0, 211), +'deeppink': (255, 20, 147), +'deeppink1': (255, 20, 147), +'deeppink2': (238, 18, 137), +'deeppink3': (205, 16, 118), +'deeppink4': (139, 10, 80), +'deepskyblue': (0, 191,
[pypy-commit] pypy llvm-translation-backend: hg merge default
Author: Manuel JacobBranch: llvm-translation-backend Changeset: r81774:92a85579bb26 Date: 2016-01-15 04:29 +0100 http://bitbucket.org/pypy/pypy/changeset/92a85579bb26/ Log:hg merge default diff --git a/pypy/doc/whatsnew-head.rst b/pypy/doc/whatsnew-head.rst --- a/pypy/doc/whatsnew-head.rst +++ b/pypy/doc/whatsnew-head.rst @@ -110,3 +110,7 @@ short-running Python callbacks. (CFFI on CPython has a hack to achieve the same result.) This can also be seen as a bug fix: previously, thread-local objects would be reset between two such calls. + +.. branch: globals-quasiimmut + +Optimize global lookups. diff --git a/pypy/interpreter/eval.py b/pypy/interpreter/eval.py --- a/pypy/interpreter/eval.py +++ b/pypy/interpreter/eval.py @@ -9,8 +9,8 @@ class Code(W_Root): """A code is a compiled version of some source code. Abstract base class.""" -_immutable_ = True hidden_applevel = False +_immutable_fields_ = ['co_name', 'fast_natural_arity', 'hidden_applevel'] # n >= 0 : arity # FLATPYCALL = 0x100 diff --git a/pypy/interpreter/pycode.py b/pypy/interpreter/pycode.py --- a/pypy/interpreter/pycode.py +++ b/pypy/interpreter/pycode.py @@ -56,11 +56,13 @@ class PyCode(eval.Code): "CPython-style code objects." -_immutable_ = True -_immutable_fields_ = ["co_consts_w[*]", "co_names_w[*]", "co_varnames[*]", - "co_freevars[*]", "co_cellvars[*]", - "_args_as_cellvars[*]"] - +_immutable_fields_ = ["_signature", "co_argcount", "co_cellvars[*]", + "co_code", "co_consts_w[*]", "co_filename", + "co_firstlineno", "co_flags", "co_freevars[*]", + "co_lnotab", "co_names_w[*]", "co_nlocals", + "co_stacksize", "co_varnames[*]", + "_args_as_cellvars[*]", "w_globals?"] + def __init__(self, space, argcount, nlocals, stacksize, flags, code, consts, names, varnames, filename, name, firstlineno, lnotab, freevars, cellvars, @@ -84,6 +86,10 @@ self.co_name = name self.co_firstlineno = firstlineno self.co_lnotab = lnotab +# store the first globals object that the code object is run in in +# here. if a frame is run in that globals object, it does not need to +# store it at all +self.w_globals = None self.hidden_applevel = hidden_applevel self.magic = magic self._signature = cpython_code_signature(self) @@ -91,6 +97,14 @@ self._init_ready() self.new_code_hook() +def frame_stores_global(self, w_globals): +if self.w_globals is None: +self.w_globals = w_globals +return False +if self.w_globals is w_globals: +return False +return True + def new_code_hook(self): code_hook = self.space.fromcache(CodeHookCache)._code_hook if code_hook is not None: diff --git a/pypy/interpreter/pyframe.py b/pypy/interpreter/pyframe.py --- a/pypy/interpreter/pyframe.py +++ b/pypy/interpreter/pyframe.py @@ -36,6 +36,7 @@ def __init__(self, pycode): self.f_lineno = pycode.co_firstlineno +self.w_globals = pycode.w_globals class PyFrame(W_Root): """Represents a frame for a regular Python function @@ -67,7 +68,6 @@ escaped = False # see mark_as_escaped() debugdata= None -w_globals = None pycode = None # code object executed by that frame locals_cells_stack_w = None # the list of all locals, cells and the valuestack valuestackdepth = 0 # number of items on valuestack @@ -90,8 +90,9 @@ self = hint(self, access_directly=True, fresh_virtualizable=True) assert isinstance(code, pycode.PyCode) self.space = space -self.w_globals = w_globals self.pycode = code +if code.frame_stores_global(w_globals): +self.getorcreatedebug().w_globals = w_globals ncellvars = len(code.co_cellvars) nfreevars = len(code.co_freevars) size = code.co_nlocals + ncellvars + nfreevars + code.co_stacksize @@ -116,6 +117,12 @@ self.debugdata = FrameDebugData(self.pycode) return self.debugdata +def get_w_globals(self): +debugdata = self.getdebug() +if debugdata is not None: +return debugdata.w_globals +return jit.promote(self.pycode).w_globals + def get_w_f_trace(self): d = self.getdebug() if d is None: @@ -201,8 +208,9 @@ if flags & pycode.CO_NEWLOCALS: self.getorcreatedebug().w_locals = self.space.newdict(module=True) else: -assert self.w_globals is not None -self.getorcreatedebug().w_locals = self.w_globals +w_globals = self.get_w_globals() +
[pypy-commit] pypy llvm-translation-backend: hg merge default
Author: Manuel JacobBranch: llvm-translation-backend Changeset: r81680:2aff8b331a70 Date: 2016-01-12 02:44 +0100 http://bitbucket.org/pypy/pypy/changeset/2aff8b331a70/ Log:hg merge default diff --git a/rpython/translator/backendopt/graphanalyze.py b/rpython/translator/backendopt/graphanalyze.py --- a/rpython/translator/backendopt/graphanalyze.py +++ b/rpython/translator/backendopt/graphanalyze.py @@ -80,12 +80,17 @@ funcobj = op.args[0].value._obj except DelayedPointer: return self.top_result() +if funcobj is None: +# We encountered a null pointer. Calling it will crash. +# However, the call could be on a dead path, so we return the +# bottom result here. +return self.bottom_result() if getattr(funcobj, 'external', None) is not None: x = self.analyze_external_call(funcobj, seen) if self.verbose and x: self.dump_info('analyze_external_call %s: %r' % (op, x)) return x -graph = get_graph(op.args[0], self.translator) +graph = funcobj.graph assert graph is not None x = self.analyze_direct_call(graph, seen) if self.verbose and x: diff --git a/rpython/translator/backendopt/test/test_graphanalyze.py b/rpython/translator/backendopt/test/test_graphanalyze.py --- a/rpython/translator/backendopt/test/test_graphanalyze.py +++ b/rpython/translator/backendopt/test/test_graphanalyze.py @@ -65,3 +65,14 @@ op = SpaceOperation('direct_call', [c_f], None) analyzer = BoolGraphAnalyzer(t) assert analyzer.analyze(op) + + +def test_null_fnptr(): +from rpython.flowspace.model import SpaceOperation, Constant +from rpython.rtyper.lltypesystem.lltype import Void, FuncType, nullptr +from rpython.translator.translator import TranslationContext +t = TranslationContext() +fnptr = nullptr(FuncType([], Void)) +op = SpaceOperation('direct_call', [Constant(fnptr)], None) +analyzer = BoolGraphAnalyzer(t) +assert not analyzer.analyze(op) ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy llvm-translation-backend: hg merge default
Author: Manuel JacobBranch: llvm-translation-backend Changeset: r81675:768918ab952a Date: 2016-01-11 20:25 +0100 http://bitbucket.org/pypy/pypy/changeset/768918ab952a/ Log:hg merge default diff too long, truncating to 2000 out of 29542 lines diff --git a/.gitignore b/.gitignore --- a/.gitignore +++ b/.gitignore @@ -29,4 +29,4 @@ release/ !pypy/tool/release/ rpython/_cache/ -__pycache__/ +.cache/ diff --git a/LICENSE b/LICENSE --- a/LICENSE +++ b/LICENSE @@ -28,7 +28,7 @@ DEALINGS IN THE SOFTWARE. -PyPy Copyright holders 2003-2015 +PyPy Copyright holders 2003-2016 --- Except when otherwise stated (look for LICENSE files or information at diff --git a/Makefile b/Makefile --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ -all: pypy-c +all: pypy-c cffi_imports PYPY_EXECUTABLE := $(shell which pypy) URAM := $(shell python -c "import sys; print 4.5 if sys.maxint>1<<32 else 2.5") @@ -10,6 +10,8 @@ RUNINTERP = $(PYPY_EXECUTABLE) endif +.PHONY: cffi_imports + pypy-c: @echo @echo "" @@ -36,3 +38,6 @@ # replaced with an opaque --jobserver option by the time this Makefile # runs. We cannot get their original value either: # http://lists.gnu.org/archive/html/help-make/2010-08/msg00106.html + +cffi_imports: pypy-c + PYTHONPATH=. ./pypy-c pypy/tool/build_cffi_imports.py diff --git a/lib-python/2.7/collections.py b/lib-python/2.7/collections.py --- a/lib-python/2.7/collections.py +++ b/lib-python/2.7/collections.py @@ -18,9 +18,9 @@ assert '__pypy__' not in _sys.builtin_module_names newdict = lambda _ : {} try: -from __pypy__ import reversed_dict +from __pypy__ import reversed_dict as _reversed_dict except ImportError: -reversed_dict = lambda d: reversed(d.keys()) +_reversed_dict = None # don't have ordered dicts try: from thread import get_ident as _get_ident @@ -46,7 +46,7 @@ ''' def __reversed__(self): -return reversed_dict(self) +return _reversed_dict(self) def popitem(self, last=True): '''od.popitem() -> (k, v), return and remove a (key, value) pair. @@ -116,6 +116,178 @@ return ItemsView(self) +def _compat_with_unordered_dicts(): +# This returns the methods needed in OrderedDict in case the base +# 'dict' class is not actually ordered, like on top of CPython or +# old PyPy or PyPy-STM. + +# = Original comments and code follows = +# = The unmodified methods are not repeated = + +# An inherited dict maps keys to values. +# The inherited dict provides __getitem__, __len__, __contains__, and get. +# The remaining methods are order-aware. +# Big-O running times for all methods are the same as regular dictionaries. + +# The internal self.__map dict maps keys to links in a doubly linked list. +# The circular doubly linked list starts and ends with a sentinel element. +# The sentinel element never gets deleted (this simplifies the algorithm). +# Each link is stored as a list of length three: [PREV, NEXT, KEY]. + +def __init__(self, *args, **kwds): +'''Initialize an ordered dictionary. The signature is the same as +regular dictionaries, but keyword arguments are not recommended because +their insertion order is arbitrary. + +''' +if len(args) > 1: +raise TypeError('expected at most 1 arguments, got %d' % len(args)) +try: +self.__root +except AttributeError: +self.__root = root = [] # sentinel node +root[:] = [root, root, None] +self.__map = {} +self.__update(*args, **kwds) + +def __setitem__(self, key, value, dict_setitem=dict.__setitem__): +'od.__setitem__(i, y) <==> od[i]=y' +# Setting a new item creates a new link at the end of the linked list, +# and the inherited dictionary is updated with the new key/value pair. +if key not in self: +root = self.__root +last = root[0] +last[1] = root[0] = self.__map[key] = [last, root, key] +return dict_setitem(self, key, value) + +def __delitem__(self, key, dict_delitem=dict.__delitem__): +'od.__delitem__(y) <==> del od[y]' +# Deleting an existing item uses self.__map to find the link which gets +# removed by updating the links in the predecessor and successor nodes. +dict_delitem(self, key) +link_prev, link_next, _ = self.__map.pop(key) +link_prev[1] = link_next# update link_prev[NEXT] +link_next[0] = link_prev# update link_next[PREV] + +def __iter__(self): +'od.__iter__() <==> iter(od)' +# Traverse the linked list in order. +root = self.__root +curr = root[1]
[pypy-commit] pypy llvm-translation-backend: hg merge default
Author: Manuel JacobBranch: llvm-translation-backend Changeset: r80827:7557812bafd4 Date: 2015-11-20 00:22 +0100 http://bitbucket.org/pypy/pypy/changeset/7557812bafd4/ Log:hg merge default diff --git a/pypy/goal/targetpypystandalone.py b/pypy/goal/targetpypystandalone.py --- a/pypy/goal/targetpypystandalone.py +++ b/pypy/goal/targetpypystandalone.py @@ -302,7 +302,7 @@ def hack_for_cffi_modules(self, driver): # HACKHACKHACK -# ugly hack to modify target goal from compile_c to build_cffi_imports +# ugly hack to modify target goal from compile_* to build_cffi_imports # this should probably get cleaned up and merged with driver.create_exe from rpython.translator.driver import taskdef import types @@ -316,7 +316,8 @@ name = name.new(ext='exe') return name -@taskdef(['compile_c'], "Create cffi bindings for modules") +compile_goal, = driver.backend_select_goals(['compile']) +@taskdef([compile_goal], "Create cffi bindings for modules") def task_build_cffi_imports(self): from pypy.tool.build_cffi_imports import create_cffi_import_libraries ''' Use cffi to compile cffi interfaces to modules''' @@ -335,7 +336,7 @@ # if failures, they were already printed print >> sys.stderr, str(exename),'successfully built, but errors while building the above modules will be ignored' driver.task_build_cffi_imports = types.MethodType(task_build_cffi_imports, driver) -driver.tasks['build_cffi_imports'] = driver.task_build_cffi_imports, ['compile_c'] +driver.tasks['build_cffi_imports'] = driver.task_build_cffi_imports, [compile_goal] driver.default_goal = 'build_cffi_imports' # HACKHACKHACK end diff --git a/rpython/translator/platform/darwin.py b/rpython/translator/platform/darwin.py --- a/rpython/translator/platform/darwin.py +++ b/rpython/translator/platform/darwin.py @@ -28,11 +28,11 @@ # needed for cross compiling on ARM, needs fixing if relevant for darwin if len(rel_libdirs) > 0: print 'in get_rpath_flags, rel_libdirs is not fixed up',rel_libdirs -return self.rpath_flags +return self.rpath_flags def _args_for_shared(self, args): return (list(self.shared_only) -+ ['-dynamiclib', '-install_name', '@rpath/$(TARGET)', '-undefined', 'dynamic_lookup'] ++ ['-dynamiclib', '-install_name', '@rpath/$(TARGET)', '-undefined', 'dynamic_lookup', '-flat_namespace'] + args) def _include_dirs_for_libffi(self): ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy llvm-translation-backend: hg merge default
Author: Manuel Jacob m...@manueljacob.de Branch: llvm-translation-backend Changeset: r76618:2caf25f2cf22 Date: 2015-03-29 15:31 +0200 http://bitbucket.org/pypy/pypy/changeset/2caf25f2cf22/ Log:hg merge default diff too long, truncating to 2000 out of 44092 lines diff --git a/.gitignore b/.gitignore --- a/.gitignore +++ b/.gitignore @@ -7,7 +7,10 @@ bin/pypy-c include/*.h +include/numpy/ lib_pypy/ctypes_config_cache/_[^_]*_*.py +libpypy-c.* +pypy-c pypy/_cache pypy/doc/*.html pypy/doc/config/*.html @@ -18,4 +21,5 @@ pypy/translator/c/src/dtoa.o pypy/translator/goal/pypy-c pypy/translator/goal/target*-c -release/ \ No newline at end of file +release/ +rpython/_cache/ diff --git a/.hgtags b/.hgtags --- a/.hgtags +++ b/.hgtags @@ -3,11 +3,10 @@ d8ac7d23d3ec5f9a0fa1264972f74a010dbfd07f release-1.6 ff4af8f318821f7f5ca998613a60fca09aa137da release-1.7 07e08e9c885ca67d89bcc304e45a32346daea2fa release-2.0-beta-1 -9b623bc48b5950cf07184462a0e48f2c4df0d720 pypy-2.1-beta1-arm -9b623bc48b5950cf07184462a0e48f2c4df0d720 pypy-2.1-beta1-arm ab0dd631c22015ed88e583d9fdd4c43eebf0be21 pypy-2.1-beta1-arm 20e51c4389ed4469b66bb9d6289ce0ecfc82c4b9 release-2.3.0 394146e9bb673514c61f0150ab2013ccf78e8de7 release-2.3 32f35069a16d819b58c1b6efb17c44e3e53397b2 release-2.2=3.1 32f35069a16d819b58c1b6efb17c44e3e53397b2 release-2.3.1 10f1b29a2bd21f837090286174a9ca030b8680b2 release-2.5.0 +9c4588d731b7fe0b08669bd732c2b676cb0a8233 release-2.5.1 diff --git a/lib-python/2.7/CGIHTTPServer.py b/lib-python/2.7/CGIHTTPServer.py --- a/lib-python/2.7/CGIHTTPServer.py +++ b/lib-python/2.7/CGIHTTPServer.py @@ -106,16 +106,16 @@ def run_cgi(self): Execute a CGI script. dir, rest = self.cgi_info - -i = rest.find('/') +path = dir + '/' + rest +i = path.find('/', len(dir)+1) while i = 0: -nextdir = rest[:i] -nextrest = rest[i+1:] +nextdir = path[:i] +nextrest = path[i+1:] scriptdir = self.translate_path(nextdir) if os.path.isdir(scriptdir): dir, rest = nextdir, nextrest -i = rest.find('/') +i = path.find('/', len(dir)+1) else: break diff --git a/lib-python/2.7/Cookie.py b/lib-python/2.7/Cookie.py --- a/lib-python/2.7/Cookie.py +++ b/lib-python/2.7/Cookie.py @@ -56,7 +56,7 @@ C = Cookie.SmartCookie() [Note: Long-time users of Cookie.py will remember using -Cookie.Cookie() to create an Cookie object. Although deprecated, it +Cookie.Cookie() to create a Cookie object. Although deprecated, it is still supported by the code. See the Backward Compatibility notes for more information.] @@ -426,6 +426,8 @@ version : Version, } +_flags = {'secure', 'httponly'} + def __init__(self): # Set defaults self.key = self.value = self.coded_value = None @@ -529,9 +531,11 @@ _LegalCharsPatt = r[\w\d!#%'~_`@,:/\$\*\+\-\.\^\|\)\(\?\}\{\=] _CookiePattern = re.compile( r(?x) # This is a Verbose pattern +r\s*# Optional whitespace at start of cookie r(?Pkey # Start of group 'key' + _LegalCharsPatt ++? # Any word of at least one letter, nongreedy r) # End of group 'key' +r( # Optional group: there may not be a value. r\s*=\s*# Equal Sign r(?Pval # Start of group 'val' r'(?:[^\\]|\\.)*'# Any doublequoted string @@ -540,7 +544,9 @@ r|# or + _LegalCharsPatt +*# Any word or empty string r) # End of group 'val' -r\s*;? # Probably ending in a semi-colon +r)? # End of optional value group +r\s*# Any number of spaces. +r(\s+|;|$) # Ending either at space, semicolon, or EOS. ) @@ -585,8 +591,12 @@ def __setitem__(self, key, value): Dictionary style assignment. -rval, cval = self.value_encode(value) -self.__set(key, rval, cval) +if isinstance(value, Morsel): +# allow assignment of constructed Morsels (e.g. for pickling) +dict.__setitem__(self, key, value) +else: +rval, cval = self.value_encode(value) +self.__set(key, rval, cval) # end __setitem__ def output(self, attrs=None, header=Set-Cookie:, sep=\015\012): @@ -641,7 +651,7 @@ while 0 = i n: # Start looking for a cookie -match = patt.search(str, i) +match = patt.match(str, i) if not match: break # No more cookies K,V = match.group(key), match.group(val) @@ -656,8 +666,12 @@ M[ K[1:] ] = V elif K.lower() in
[pypy-commit] pypy llvm-translation-backend: hg merge default
Author: Manuel Jacob m...@manueljacob.de Branch: llvm-translation-backend Changeset: r76620:9f1f8c424c2b Date: 2015-03-29 16:01 +0200 http://bitbucket.org/pypy/pypy/changeset/9f1f8c424c2b/ Log:hg merge default diff --git a/rpython/memory/gctransform/framework.py b/rpython/memory/gctransform/framework.py --- a/rpython/memory/gctransform/framework.py +++ b/rpython/memory/gctransform/framework.py @@ -521,7 +521,6 @@ custom_trace_funcs_unrolled = unrolling_iterable( [(self.get_type_id(TP), func) for TP, func in custom_trace_funcs]) -@rgc.no_collect @specialize.arg(2) def custom_trace_dispatcher(obj, typeid, callback, arg): for type_id_exp, func in custom_trace_funcs_unrolled: ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy llvm-translation-backend: hg merge default
Author: Manuel Jacob m...@manueljacob.de Branch: llvm-translation-backend Changeset: r75743:6000e86e39ba Date: 2015-02-06 20:17 +0100 http://bitbucket.org/pypy/pypy/changeset/6000e86e39ba/ Log:hg merge default diff too long, truncating to 2000 out of 19187 lines diff --git a/.hgtags b/.hgtags --- a/.hgtags +++ b/.hgtags @@ -7,10 +7,7 @@ 9b623bc48b5950cf07184462a0e48f2c4df0d720 pypy-2.1-beta1-arm ab0dd631c22015ed88e583d9fdd4c43eebf0be21 pypy-2.1-beta1-arm 20e51c4389ed4469b66bb9d6289ce0ecfc82c4b9 release-2.3.0 -20e51c4389ed4469b66bb9d6289ce0ecfc82c4b9 release-2.3.0 - release-2.3.0 394146e9bb673514c61f0150ab2013ccf78e8de7 release-2.3 32f35069a16d819b58c1b6efb17c44e3e53397b2 release-2.2=3.1 32f35069a16d819b58c1b6efb17c44e3e53397b2 release-2.3.1 -32f35069a16d819b58c1b6efb17c44e3e53397b2 release-2.2=3.1 - release-2.2=3.1 +10f1b29a2bd21f837090286174a9ca030b8680b2 release-2.5.0 diff --git a/LICENSE b/LICENSE --- a/LICENSE +++ b/LICENSE @@ -42,19 +42,19 @@ Amaury Forgeot d'Arc Samuele Pedroni Alex Gaynor + Brian Kearns + Matti Picus + Philip Jenvey Michael Hudson David Schneider - Matti Picus - Brian Kearns - Philip Jenvey Holger Krekel Christian Tismer Hakan Ardo Benjamin Peterson Manuel Jacob + Ronan Lamy Anders Chrigstrom Eric van Riet Paap - Ronan Lamy Wim Lavrijsen Richard Emslie Alexander Schremmer @@ -68,9 +68,9 @@ Camillo Bruni Laura Creighton Toon Verwaest + Romain Guillebert Leonardo Santagada Seo Sanghyeon - Romain Guillebert Justin Peel Ronny Pfannschmidt David Edelsohn @@ -91,15 +91,16 @@ Michal Bendowski Jan de Mooij stian + Tyler Wade Michael Foord Stephan Diehl - Tyler Wade Stefan Schwarzer Valentino Volonghi Tomek Meka Patrick Maupin Bob Ippolito Bruno Gola + David Malcolm Jean-Paul Calderone Timo Paulssen Squeaky @@ -108,18 +109,19 @@ Marius Gedminas Martin Matusiak Konstantin Lopuhin + Wenzhu Man John Witulski - Wenzhu Man + Laurence Tratt + Ivan Sichmann Freitas Greg Price Dario Bertini Mark Pearse Simon Cross - Ivan Sichmann Freitas Andreas St#252;hrk + Stefano Rivera Jean-Philippe St. Pierre Guido van Rossum Pavel Vinogradov - Stefano Rivera Pawe#322; Piotr Przeradowski Paul deGrandis Ilya Osadchiy @@ -129,7 +131,6 @@ tav Taavi Burns Georg Brandl - Laurence Tratt Bert Freudenberg Stian Andreassen Wanja Saatkamp @@ -141,13 +142,12 @@ Jeremy Thurgood Rami Chowdhury Tobias Pape - David Malcolm Eugene Oden Henry Mason Vasily Kuznetsov Preston Timmons + David Ripton Jeff Terrace - David Ripton Dusty Phillips Lukas Renggli Guenter Jantzen @@ -166,13 +166,16 @@ Gintautas Miliauskas Michael Twomey Lucian Branescu Mihaila + Yichao Yu Gabriel Lavoie Olivier Dormond Jared Grubb Karl Bartel + Wouter van Heyst Brian Dorsey Victor Stinner Andrews Medina + anatoly techtonik Stuart Williams Jasper Schulz Christian Hudon @@ -182,12 +185,11 @@ Michael Cheng Justas Sadzevicius Gasper Zejn - anatoly techtonik Neil Shepperd + Stanislaw Halik Mikael Sch#246;nenberg Elmo M?ntynen Jonathan David Riehl - Stanislaw Halik Anders Qvist Corbin Simpson Chirag Jadwani @@ -196,10 +198,13 @@ Vincent Legoll Alan McIntyre Alexander Sedov + Attila Gobi Christopher Pope Christian Tismer Marc Abramowitz Dan Stromberg + Arjun Naik + Valentina Mukhamedzhanova Stefano Parmesan Alexis Daboville Jens-Uwe Mager @@ -213,8 +218,6 @@ Sylvain Thenault Nathan Taylor Vladimir Kryachko - Arjun Naik - Attila Gobi Jacek Generowicz Alejandro J. Cura Jacob Oscarson @@ -222,22 +225,23 @@ Ryan Gonzalez Ian Foote Kristjan Valur Jonsson + David Lievens Neil Blakey-Milner Lutz Paelike Lucio Torre Lars Wassermann - Valentina Mukhamedzhanova Henrik Vendelbo Dan Buch Miguel de Val Borro Artur Lisiecki Sergey Kishchenko - Yichao Yu Ignas Mikalajunas Christoph Gerum Martin Blais Lene Wagner Tomo Cocoa + Toni Mattis + Lucas Stadler roberto@goyle Yury V. Zaytsev Anna Katrina Dominguez @@ -265,23 +269,30 @@ Stephan Busemann Rafa#322; Ga#322;czy#324;ski Christian Muirhead + Berker Peksag James Lan shoma hosaka - Daniel Neuh?user - Matthew Miller + Daniel Neuh#228;user + Ben Mather + halgari + Boglarka Vezer + Chris Pressey Buck Golemon Konrad Delong Dinu Gherman Chris Lambacher coolbutusel...@gmail.com + Jim Baker Rodrigo Ara#250;jo - Jim Baker + Nikolaos-Digenis Karagiannis James Robert Armin Ronacher Brett Cannon + Donald Stufft yrttyr aliceinwire OlivierBlanvillain + Dan Sanders Zooko Wilcox-O Hearn Tomer Chachamu Christopher Groskopf @@ -295,6 +306,7 @@ Markus Unterwaditzer
[pypy-commit] pypy llvm-translation-backend: hg merge default
Author: Manuel Jacob m...@manueljacob.de Branch: llvm-translation-backend Changeset: r75422:67a005ec73ed Date: 2015-01-08 22:43 +0100 http://bitbucket.org/pypy/pypy/changeset/67a005ec73ed/ Log:hg merge default diff too long, truncating to 2000 out of 35007 lines diff --git a/LICENSE b/LICENSE --- a/LICENSE +++ b/LICENSE @@ -28,7 +28,7 @@ DEALINGS IN THE SOFTWARE. -PyPy Copyright holders 2003-2014 +PyPy Copyright holders 2003-2015 --- Except when otherwise stated (look for LICENSE files or information at diff --git a/README.rst b/README.rst --- a/README.rst +++ b/README.rst @@ -37,4 +37,4 @@ to use virtualenv with the resulting pypy-c as the interpreter; you can find more details about various installation schemes here: -http://doc.pypy.org/en/latest/getting-started.html#installing-pypy +http://doc.pypy.org/en/latest/install.html diff --git a/lib-python/2.7/distutils/unixccompiler.py b/lib-python/2.7/distutils/unixccompiler.py --- a/lib-python/2.7/distutils/unixccompiler.py +++ b/lib-python/2.7/distutils/unixccompiler.py @@ -58,7 +58,7 @@ executables = {'preprocessor' : None, 'compiler' : [cc], 'compiler_so' : [cc], - 'compiler_cxx' : [cc], + 'compiler_cxx' : [c++], # pypy: changed, 'cc' is bogus 'linker_so': [cc, -shared], 'linker_exe' : [cc], 'archiver' : [ar, -cr], diff --git a/lib-python/2.7/sqlite3/test/dbapi.py b/lib-python/2.7/sqlite3/test/dbapi.py --- a/lib-python/2.7/sqlite3/test/dbapi.py +++ b/lib-python/2.7/sqlite3/test/dbapi.py @@ -478,6 +478,29 @@ except TypeError: pass +def CheckCurDescription(self): +self.cu.execute(select * from test) + +actual = self.cu.description +expected = [ +('id', None, None, None, None, None, None), +('name', None, None, None, None, None, None), +('income', None, None, None, None, None, None), +] +self.assertEqual(expected, actual) + +def CheckCurDescriptionVoidStatement(self): +self.cu.execute(insert into test(name) values (?), (foo,)) +self.assertIsNone(self.cu.description) + +def CheckCurDescriptionWithoutStatement(self): +cu = self.cx.cursor() +try: +self.assertIsNone(cu.description) +finally: +cu.close() + + @unittest.skipUnless(threading, 'This test requires threading.') class ThreadTests(unittest.TestCase): def setUp(self): diff --git a/lib-python/2.7/subprocess.py b/lib-python/2.7/subprocess.py --- a/lib-python/2.7/subprocess.py +++ b/lib-python/2.7/subprocess.py @@ -655,6 +655,21 @@ Create new Popen instance. _cleanup() +# --- PyPy hack, see _pypy_install_libs_after_virtualenv() --- +# match arguments passed by different versions of virtualenv +if args[1:] in ( +['-c', 'import sys; print(sys.prefix)'],# 1.6 10ba3f3c +['-c', \nimport sys\nprefix = sys.prefix\n# 1.7 0e9342ce + if sys.version_info[0] == 3:\n + prefix = prefix.encode('utf8')\n + if hasattr(sys.stdout, 'detach'):\n + sys.stdout = sys.stdout.detach()\n + elif hasattr(sys.stdout, 'buffer'):\n + sys.stdout = sys.stdout.buffer\nsys.stdout.write(prefix)\n], +['-c', 'import sys;out=sys.stdout;getattr(out, buffer' + ', out).write(sys.prefix.encode(utf-8))']): # 1.7.2 a9454bce +_pypy_install_libs_after_virtualenv(args[0]) + if not isinstance(bufsize, (int, long)): raise TypeError(bufsize must be an integer) @@ -1560,6 +1575,27 @@ self.send_signal(signal.SIGKILL) +def _pypy_install_libs_after_virtualenv(target_executable): +# https://bitbucket.org/pypy/pypy/issue/1922/future-proofing-virtualenv +# +# PyPy 2.4.1 turned --shared on by default. This means the pypy binary +# depends on the 'libpypy-c.so' shared library to be able to run. +# The virtualenv code existing at the time did not account for this +# and would break. Try to detect that we're running under such a +# virtualenv in the Testing executable with phase and copy the +# library ourselves. +caller = sys._getframe(2) +if ('virtualenv_version' in caller.f_globals and + 'copyfile' in caller.f_globals): +dest_dir = sys.pypy_resolvedirof(target_executable) +src_dir = sys.pypy_resolvedirof(sys.executable) +for libname in ['libpypy-c.so', 'libpypy-c.dylib']: +dest_library = os.path.join(dest_dir, libname) +src_library = os.path.join(src_dir, libname) +if os.path.exists(src_library): +caller.f_globals['copyfile'](src_library, dest_library) + + def _demo_posix(): # # Example
[pypy-commit] pypy llvm-translation-backend: hg merge default
Author: Manuel Jacob Branch: llvm-translation-backend Changeset: r68676:a6fecf78f85c Date: 2014-01-14 17:15 +0100 http://bitbucket.org/pypy/pypy/changeset/a6fecf78f85c/ Log:hg merge default diff --git a/lib_pypy/_ctypes/array.py b/lib_pypy/_ctypes/array.py --- a/lib_pypy/_ctypes/array.py +++ b/lib_pypy/_ctypes/array.py @@ -20,10 +20,13 @@ # we don't want to have buffers here if len(val) self._length_: raise ValueError(%r too long % (val,)) -for i in range(len(val)): -self[i] = val[i] +if isinstance(val, str): +_rawffi.rawstring2charp(self._buffer.buffer, val) +else: +for i in range(len(val)): +self[i] = val[i] if len(val) self._length_: -self[len(val)] = '\x00' +self._buffer[len(val)] = '\x00' res.value = property(getvalue, setvalue) def getraw(self): @@ -33,8 +36,7 @@ def setraw(self, buffer): if len(buffer) self._length_: raise ValueError(%r too long % (buffer,)) -for i in range(len(buffer)): -self[i] = buffer[i] +_rawffi.rawstring2charp(self._buffer.buffer, buffer) res.raw = property(getraw, setraw) elif subletter == 'u': def getvalue(self): @@ -45,10 +47,14 @@ # we don't want to have buffers here if len(val) self._length_: raise ValueError(%r too long % (val,)) +if isinstance(val, unicode): +target = self._buffer +else: +target = self for i in range(len(val)): -self[i] = val[i] +target[i] = val[i] if len(val) self._length_: -self[len(val)] = '\x00' +target[len(val)] = u'\x00' res.value = property(getvalue, setvalue) if '_length_' in typedict: diff --git a/pypy/module/_rawffi/__init__.py b/pypy/module/_rawffi/__init__.py --- a/pypy/module/_rawffi/__init__.py +++ b/pypy/module/_rawffi/__init__.py @@ -19,6 +19,7 @@ 'wcharp2unicode' : 'interp_rawffi.wcharp2unicode', 'charp2rawstring': 'interp_rawffi.charp2rawstring', 'wcharp2rawunicode' : 'interp_rawffi.wcharp2rawunicode', +'rawstring2charp': 'interp_rawffi.rawstring2charp', 'CallbackPtr': 'callback.W_CallbackPtr', '_num_of_allocated_objects' : 'tracker.num_of_allocated_objects', 'get_libc' : 'interp_rawffi.get_libc', diff --git a/pypy/module/_rawffi/interp_rawffi.py b/pypy/module/_rawffi/interp_rawffi.py --- a/pypy/module/_rawffi/interp_rawffi.py +++ b/pypy/module/_rawffi/interp_rawffi.py @@ -579,6 +579,13 @@ s = rffi.wcharpsize2unicode(rffi.cast(rffi.CWCHARP, address), maxlength) return space.wrap(s) +@unwrap_spec(address=r_uint, newcontent=str) +def rawstring2charp(space, address, newcontent): +from rpython.rtyper.annlowlevel import llstr +from rpython.rtyper.lltypesystem.rstr import copy_string_to_raw +array = rffi.cast(rffi.CCHARP, address) +copy_string_to_raw(llstr(newcontent), array, 0, len(newcontent)) + if _MS_WINDOWS: @unwrap_spec(code=int) def FormatError(space, code): diff --git a/pypy/module/_rawffi/test/test__rawffi.py b/pypy/module/_rawffi/test/test__rawffi.py --- a/pypy/module/_rawffi/test/test__rawffi.py +++ b/pypy/module/_rawffi/test/test__rawffi.py @@ -323,6 +323,14 @@ assert res == u'xx' a.free() +def test_rawstring2charp(self): +import _rawffi +A = _rawffi.Array('c') +a = A(10, 'x'*10) +_rawffi.rawstring2charp(a.buffer, foobar) +assert ''.join([a[i] for i in range(10)]) == foobar +a.free() + def test_raw_callable(self): import _rawffi lib = _rawffi.CDLL(self.lib_name) diff --git a/pypy/module/test_lib_pypy/ctypes_tests/support.py b/pypy/module/test_lib_pypy/ctypes_tests/support.py --- a/pypy/module/test_lib_pypy/ctypes_tests/support.py +++ b/pypy/module/test_lib_pypy/ctypes_tests/support.py @@ -31,8 +31,10 @@ import gc for _ in range(4): gc.collect() -cls.old_num = _rawffi._num_of_allocated_objects() - +try: +cls.old_num = _rawffi._num_of_allocated_objects() +except RuntimeError: +pass def teardown_class(cls): if sys.pypy_translation_info['translation.gc'] == 'boehm': diff --git a/pypy/tool/gdb_pypy.py b/pypy/tool/gdb_pypy.py ---