Author: Armin Rigo <[email protected]>
Branch: stmgc-c7
Changeset: r74600:68acf29aeeae
Date: 2014-11-19 12:19 +0100
http://bitbucket.org/pypy/pypy/changeset/68acf29aeeae/
Log: hg merge default
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']:
+ 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 1: Simple redirection: Get process list
diff --git a/rpython/flowspace/flowcontext.py b/rpython/flowspace/flowcontext.py
--- a/rpython/flowspace/flowcontext.py
+++ b/rpython/flowspace/flowcontext.py
@@ -856,14 +856,9 @@
def WITH_CLEANUP(self, oparg):
# Note: RPython context managers receive None in lieu of tracebacks
# and cannot suppress the exception.
- # This opcode changed a lot between CPython versions
- if sys.version_info >= (2, 6):
- unroller = self.popvalue()
- w_exitfunc = self.popvalue()
- self.pushvalue(unroller)
- else:
- w_exitfunc = self.popvalue()
- unroller = self.peekvalue(0)
+ unroller = self.popvalue()
+ w_exitfunc = self.popvalue()
+ self.pushvalue(unroller)
if isinstance(unroller, Raise):
w_exc = unroller.w_exc
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
@@ -466,17 +466,18 @@
annmodel.SomeInteger(nonneg=True)],
annmodel.s_None)
- self.pin_ptr = getfn(GCClass.pin,
- [s_gc, SomeAddress()],
- annmodel.SomeBool())
+ if GCClass.can_usually_pin_objects:
+ self.pin_ptr = getfn(GCClass.pin,
+ [s_gc, SomeAddress()],
+ annmodel.SomeBool())
- self.unpin_ptr = getfn(GCClass.unpin,
- [s_gc, SomeAddress()],
- annmodel.s_None)
+ self.unpin_ptr = getfn(GCClass.unpin,
+ [s_gc, SomeAddress()],
+ annmodel.s_None)
- self._is_pinned_ptr = getfn(GCClass._is_pinned,
- [s_gc, SomeAddress()],
- annmodel.SomeBool())
+ self._is_pinned_ptr = getfn(GCClass._is_pinned,
+ [s_gc, SomeAddress()],
+ annmodel.SomeBool())
self.write_barrier_ptr = None
self.write_barrier_from_array_ptr = None
@@ -1089,6 +1090,10 @@
v_size])
def gct_gc_pin(self, hop):
+ if not hasattr(self, 'pin_ptr'):
+ c_false = rmodel.inputconst(lltype.Bool, False)
+ hop.genop("same_as", [c_false], resultvar=hop.spaceop.result)
+ return
op = hop.spaceop
v_addr = hop.genop('cast_ptr_to_adr', [op.args[0]],
resulttype=llmemory.Address)
@@ -1096,6 +1101,8 @@
resultvar=op.result)
def gct_gc_unpin(self, hop):
+ if not hasattr(self, 'unpin_ptr'):
+ return
op = hop.spaceop
v_addr = hop.genop('cast_ptr_to_adr', [op.args[0]],
resulttype=llmemory.Address)
@@ -1103,6 +1110,10 @@
resultvar=op.result)
def gct_gc__is_pinned(self, hop):
+ if not hasattr(self, '_is_pinned_ptr'):
+ c_false = rmodel.inputconst(lltype.Bool, False)
+ hop.genop("same_as", [c_false], resultvar=hop.spaceop.result)
+ return
op = hop.spaceop
v_addr = hop.genop('cast_ptr_to_adr', [op.args[0]],
resulttype=llmemory.Address)
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit