Author: Manuel Jacob <[email protected]>
Branch: py3k
Changeset: r79914:865002a1287a
Date: 2015-10-01 00:51 +0200
http://bitbucket.org/pypy/pypy/changeset/865002a1287a/
Log: hg merge 5345333d8dcd (last changeset in default branch that was
merged into PyPy2 release branch).
diff --git a/LICENSE b/LICENSE
--- a/LICENSE
+++ b/LICENSE
@@ -352,8 +352,7 @@
Except when otherwise stated (look for LICENSE files or copyright/license
information at the beginning of each file) the files in the 'lib-python/2.7'
directory 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
+under the terms that you can find here: https://docs.python.org/2/license.html
License for 'pypy/module/unicodedata/'
======================================
@@ -435,4 +434,4 @@
The code is based on gperftools. You may see a copy of the License for it at
- https://code.google.com/p/gperftools/source/browse/COPYING
+ https://github.com/gperftools/gperftools/blob/master/COPYING
diff --git a/lib_pypy/cffi.egg-info/PKG-INFO b/lib_pypy/cffi.egg-info/PKG-INFO
--- a/lib_pypy/cffi.egg-info/PKG-INFO
+++ b/lib_pypy/cffi.egg-info/PKG-INFO
@@ -1,6 +1,6 @@
Metadata-Version: 1.1
Name: cffi
-Version: 1.2.1
+Version: 1.3.0
Summary: Foreign Function Interface for Python calling C code.
Home-page: http://cffi.readthedocs.org
Author: Armin Rigo, Maciej Fijalkowski
diff --git a/lib_pypy/cffi/__init__.py b/lib_pypy/cffi/__init__.py
--- a/lib_pypy/cffi/__init__.py
+++ b/lib_pypy/cffi/__init__.py
@@ -4,8 +4,8 @@
from .api import FFI, CDefError, FFIError
from .ffiplatform import VerificationError, VerificationMissing
-__version__ = "1.2.1"
-__version_info__ = (1, 2, 1)
+__version__ = "1.3.0"
+__version_info__ = (1, 3, 0)
# The verifier module file names are based on the CRC32 of a string that
# contains the following version number. It may be older than __version__
diff --git a/lib_pypy/cffi/_cffi_include.h b/lib_pypy/cffi/_cffi_include.h
--- a/lib_pypy/cffi/_cffi_include.h
+++ b/lib_pypy/cffi/_cffi_include.h
@@ -214,6 +214,12 @@
(size) == 8 ? ((sign) ? _CFFI_PRIM_INT64 : _CFFI_PRIM_UINT64) : \
_CFFI__UNKNOWN_PRIM)
+#define _cffi_prim_float(size) \
+ ((size) == sizeof(float) ? _CFFI_PRIM_FLOAT : \
+ (size) == sizeof(double) ? _CFFI_PRIM_DOUBLE : \
+ (size) == sizeof(long double) ? _CFFI__UNKNOWN_LONG_DOUBLE : \
+ _CFFI__UNKNOWN_FLOAT_PRIM)
+
#define _cffi_check_int(got, got_nonpos, expected) \
((got_nonpos) == (expected <= 0) && \
(got) == (unsigned long long)expected)
diff --git a/lib_pypy/cffi/cffi_opcode.py b/lib_pypy/cffi/cffi_opcode.py
--- a/lib_pypy/cffi/cffi_opcode.py
+++ b/lib_pypy/cffi/cffi_opcode.py
@@ -106,7 +106,9 @@
PRIM_UINTMAX = 47
_NUM_PRIM = 48
-_UNKNOWN_PRIM = -1
+_UNKNOWN_PRIM = -1
+_UNKNOWN_FLOAT_PRIM = -2
+_UNKNOWN_LONG_DOUBLE = -3
PRIMITIVE_TO_INDEX = {
'char': PRIM_CHAR,
diff --git a/lib_pypy/cffi/cparser.py b/lib_pypy/cffi/cparser.py
--- a/lib_pypy/cffi/cparser.py
+++ b/lib_pypy/cffi/cparser.py
@@ -648,10 +648,21 @@
assert typenames[-1] == '__dotdotdot__'
if len(typenames) == 1:
return model.unknown_type(decl.name)
- for t in typenames[:-1]:
- if t not in ['int', 'short', 'long', 'signed', 'unsigned', 'char']:
- raise api.FFIError(':%d: bad usage of "..."' % decl.coord.line)
+
+ if (typenames[:-1] == ['float'] or
+ typenames[:-1] == ['double']):
+ # not for 'long double' so far
+ result = model.UnknownFloatType(decl.name)
+ else:
+ for t in typenames[:-1]:
+ if t not in ['int', 'short', 'long', 'signed',
+ 'unsigned', 'char']:
+ raise api.FFIError(':%d: bad usage of "..."' %
+ decl.coord.line)
+ result = model.UnknownIntegerType(decl.name)
+
if self._uses_new_feature is None:
self._uses_new_feature = "'typedef %s... %s'" % (
' '.join(typenames[:-1]), decl.name)
- return model.UnknownIntegerType(decl.name)
+
+ return result
diff --git a/lib_pypy/cffi/model.py b/lib_pypy/cffi/model.py
--- a/lib_pypy/cffi/model.py
+++ b/lib_pypy/cffi/model.py
@@ -158,12 +158,23 @@
self.c_name_with_marker = name + '&'
def is_integer_type(self):
- return True # for now
+ return True
def build_backend_type(self, ffi, finishlist):
raise NotImplementedError("integer type '%s' can only be used after "
"compilation" % self.name)
+class UnknownFloatType(BasePrimitiveType):
+ _attrs_ = ('name', )
+
+ def __init__(self, name):
+ self.name = name
+ self.c_name_with_marker = name + '&'
+
+ def build_backend_type(self, ffi, finishlist):
+ raise NotImplementedError("float type '%s' can only be used after "
+ "compilation" % self.name)
+
class BaseFunctionType(BaseType):
_attrs_ = ('args', 'result', 'ellipsis')
diff --git a/lib_pypy/cffi/parse_c_type.h b/lib_pypy/cffi/parse_c_type.h
--- a/lib_pypy/cffi/parse_c_type.h
+++ b/lib_pypy/cffi/parse_c_type.h
@@ -79,7 +79,9 @@
#define _CFFI_PRIM_UINTMAX 47
#define _CFFI__NUM_PRIM 48
-#define _CFFI__UNKNOWN_PRIM (-1)
+#define _CFFI__UNKNOWN_PRIM (-1)
+#define _CFFI__UNKNOWN_FLOAT_PRIM (-2)
+#define _CFFI__UNKNOWN_LONG_DOUBLE (-3)
struct _cffi_global_s {
diff --git a/lib_pypy/cffi/recompiler.py b/lib_pypy/cffi/recompiler.py
--- a/lib_pypy/cffi/recompiler.py
+++ b/lib_pypy/cffi/recompiler.py
@@ -468,6 +468,10 @@
if tp.is_integer_type() and tp.name != '_Bool':
converter = '_cffi_to_c_int'
extraarg = ', %s' % tp.name
+ elif isinstance(tp, model.UnknownFloatType):
+ # don't check with is_float_type(): it may be a 'long
+ # double' here, and _cffi_to_c_double would loose precision
+ converter = '(%s)_cffi_to_c_double' % (tp.get_c_name(''),)
else:
converter = '(%s)_cffi_to_c_%s' % (tp.get_c_name(''),
tp.name.replace(' ', '_'))
@@ -522,6 +526,8 @@
if isinstance(tp, model.BasePrimitiveType):
if tp.is_integer_type():
return '_cffi_from_c_int(%s, %s)' % (var, tp.name)
+ elif isinstance(tp, model.UnknownFloatType):
+ return '_cffi_from_c_double(%s)' % (var,)
elif tp.name != 'long double':
return '_cffi_from_c_%s(%s)' % (tp.name.replace(' ', '_'), var)
else:
@@ -1107,6 +1113,12 @@
' ) <= 0)' % (tp.name, tp.name, tp.name))
self.cffi_types[index] = CffiOp(OP_PRIMITIVE, s)
+ def _emit_bytecode_UnknownFloatType(self, tp, index):
+ s = ('_cffi_prim_float(sizeof(%s) *\n'
+ ' (((%s)1) / 2) * 2 /* integer => 0, float => 1 */\n'
+ ' )' % (tp.name, tp.name))
+ self.cffi_types[index] = CffiOp(OP_PRIMITIVE, s)
+
def _emit_bytecode_RawFunctionType(self, tp, index):
self.cffi_types[index] = CffiOp(OP_FUNCTION,
self._typesdict[tp.result])
index += 1
diff --git a/lib_pypy/ctypes_support.py b/lib_pypy/ctypes_support.py
--- a/lib_pypy/ctypes_support.py
+++ b/lib_pypy/ctypes_support.py
@@ -28,7 +28,7 @@
def _where_is_errno():
return standard_c_lib.__errno_location()
-elif sys.platform in ('darwin', 'freebsd7', 'freebsd8', 'freebsd9'):
+elif sys.platform == 'darwin' or sys.platform.startswith('freebsd'):
standard_c_lib.__error.restype = ctypes.POINTER(ctypes.c_int)
standard_c_lib.__error.argtypes = None
def _where_is_errno():
diff --git a/pypy/doc/how-to-release.rst b/pypy/doc/how-to-release.rst
--- a/pypy/doc/how-to-release.rst
+++ b/pypy/doc/how-to-release.rst
@@ -31,15 +31,14 @@
and add the new file to pypy/doc/index-of-whatsnew.rst
* go to pypy/tool/release and run
``force-builds.py <release branch>``
- The following binaries should be built, however, we need more buildbots
- - JIT: windows, linux, os/x, armhf, armel
- - no JIT: windows, linux, os/x
- - sandbox: linux, os/x
+ The following JIT binaries should be built, however, we need more buildbots
+ windows, linux-32, linux-64, osx64, armhf-raring, armhf-raspberrian, armel,
+ freebsd64
* wait for builds to complete, make sure there are no failures
* download the builds, repackage binaries. Tag the release version
and download and repackage source from bitbucket. You may find it
- convenient to use the ``repackage.sh`` script in pypy/tools to do this.
+ convenient to use the ``repackage.sh`` script in pypy/tool/release to do
this.
Otherwise repackage and upload source "-src.tar.bz2" to bitbucket
and to cobra, as some packagers prefer a clearly labeled source package
diff --git a/pypy/doc/whatsnew-2.6.1.rst b/pypy/doc/whatsnew-2.6.1.rst
--- a/pypy/doc/whatsnew-2.6.1.rst
+++ b/pypy/doc/whatsnew-2.6.1.rst
@@ -70,3 +70,7 @@
.. branch: vmprof-review
Clean up of vmprof, notably to handle correctly multiple threads
+
+.. branch: no_boehm_dl
+
+Remove extra link library from Boehm GC
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
@@ -3,5 +3,5 @@
=======================
.. this is a revision shortly after release-2.6.1
-.. startrev: 83ebc73d4fcb
+.. startrev: 07769be4057b
diff --git a/pypy/module/_cffi_backend/__init__.py
b/pypy/module/_cffi_backend/__init__.py
--- a/pypy/module/_cffi_backend/__init__.py
+++ b/pypy/module/_cffi_backend/__init__.py
@@ -2,7 +2,7 @@
from pypy.interpreter.mixedmodule import MixedModule
from rpython.rlib import rdynload
-VERSION = "1.2.1"
+VERSION = "1.3.0"
class Module(MixedModule):
diff --git a/pypy/module/_cffi_backend/cffi_opcode.py
b/pypy/module/_cffi_backend/cffi_opcode.py
--- a/pypy/module/_cffi_backend/cffi_opcode.py
+++ b/pypy/module/_cffi_backend/cffi_opcode.py
@@ -9,16 +9,16 @@
assert isinstance(self.arg, str)
return '(_cffi_opcode_t)(%s)' % (self.arg,)
classname = CLASS_NAME[self.op]
- return '_CFFI_OP(_CFFI_OP_%s, %d)' % (classname, self.arg)
+ return '_CFFI_OP(_CFFI_OP_%s, %s)' % (classname, self.arg)
def as_python_bytes(self):
- if self.op is None:
- if self.arg.isdigit():
- value = int(self.arg) # non-negative: '-' not in self.arg
- if value >= 2**31:
- raise OverflowError("cannot emit %r: limited to 2**31-1"
- % (self.arg,))
- return format_four_bytes(value)
+ if self.op is None and self.arg.isdigit():
+ value = int(self.arg) # non-negative: '-' not in self.arg
+ if value >= 2**31:
+ raise OverflowError("cannot emit %r: limited to 2**31-1"
+ % (self.arg,))
+ return format_four_bytes(value)
+ if isinstance(self.arg, str):
from .ffiplatform import VerificationError
raise VerificationError("cannot emit to Python: %r" % (self.arg,))
return format_four_bytes((self.arg << 8) | self.op)
@@ -106,7 +106,9 @@
PRIM_UINTMAX = 47
_NUM_PRIM = 48
-_UNKNOWN_PRIM = -1
+_UNKNOWN_PRIM = -1
+_UNKNOWN_FLOAT_PRIM = -2
+_UNKNOWN_LONG_DOUBLE = -3
PRIMITIVE_TO_INDEX = {
'char': PRIM_CHAR,
diff --git a/pypy/module/_cffi_backend/realize_c_type.py
b/pypy/module/_cffi_backend/realize_c_type.py
--- a/pypy/module/_cffi_backend/realize_c_type.py
+++ b/pypy/module/_cffi_backend/realize_c_type.py
@@ -81,6 +81,13 @@
if num == cffi_opcode._UNKNOWN_PRIM:
raise oefmt(ffi.w_FFIError, "primitive integer type with an "
"unexpected size (or not an integer type at all)")
+ elif num == cffi_opcode._UNKNOWN_FLOAT_PRIM:
+ raise oefmt(ffi.w_FFIError, "primitive floating-point type with an
"
+ "unexpected size (or not a float type at all)")
+ elif num == cffi_opcode._UNKNOWN_LONG_DOUBLE:
+ raise oefmt(ffi.w_FFIError, "primitive floating-point type is "
+ "'long double', not supported for now with "
+ "the syntax 'typedef double... xxx;'")
else:
raise oefmt(space.w_NotImplementedError, "prim=%d", num)
realize_cache = space.fromcache(RealizeCache)
diff --git a/pypy/module/_cffi_backend/test/_backend_test_c.py
b/pypy/module/_cffi_backend/test/_backend_test_c.py
--- a/pypy/module/_cffi_backend/test/_backend_test_c.py
+++ b/pypy/module/_cffi_backend/test/_backend_test_c.py
@@ -1,6 +1,9 @@
# ____________________________________________________________
import sys
+assert __version__ == "1.3.0", ("This test_c.py file is for testing a version"
+ " of cffi that differs from the one that we"
+ " get from 'import _cffi_backend'")
if sys.version_info < (3,):
type_or_class = "type"
mandatory_b_prefix = ''
@@ -3424,7 +3427,3 @@
"be 'foo *', but the types are different (check "
"that you are not e.g. mixing up different ffi "
"instances)")
-
-def test_version():
- # this test is here mostly for PyPy
- assert __version__ == "1.2.1"
diff --git a/pypy/module/_multiprocessing/test/test_memory.py
b/pypy/module/_multiprocessing/test/test_memory.py
--- a/pypy/module/_multiprocessing/test/test_memory.py
+++ b/pypy/module/_multiprocessing/test/test_memory.py
@@ -1,8 +1,12 @@
+import sys
+
class AppTestMemory:
spaceconfig = dict(usemodules=('_multiprocessing', 'mmap',
'_rawffi',
- 'signal', 'select', 'fcntl',
+ 'signal', 'select',
'binascii'))
+ if sys.platform != 'win32':
+ spaceconfig['usemodules'] += ('fcntl',)
def test_address_of(self):
import _multiprocessing
diff --git a/pypy/module/_multiprocessing/test/test_semaphore.py
b/pypy/module/_multiprocessing/test/test_semaphore.py
--- a/pypy/module/_multiprocessing/test/test_semaphore.py
+++ b/pypy/module/_multiprocessing/test/test_semaphore.py
@@ -1,12 +1,19 @@
+import sys
+
from pypy.module._multiprocessing.interp_semaphore import (
RECURSIVE_MUTEX, SEMAPHORE)
class AppTestSemaphore:
spaceconfig = dict(usemodules=('_multiprocessing', 'thread',
- 'signal', 'select', 'fcntl',
+ 'signal', 'select',
'binascii', 'struct'))
+ if sys.platform == 'win32':
+ spaceconfig['usemodules'] += ('_rawffi',)
+ else:
+ spaceconfig['usemodules'] += ('fcntl',)
+
def setup_class(cls):
cls.w_SEMAPHORE = cls.space.wrap(SEMAPHORE)
cls.w_RECURSIVE = cls.space.wrap(RECURSIVE_MUTEX)
diff --git a/pypy/module/test_lib_pypy/cffi_tests/cffi1/test_recompiler.py
b/pypy/module/test_lib_pypy/cffi_tests/cffi1/test_recompiler.py
--- a/pypy/module/test_lib_pypy/cffi_tests/cffi1/test_recompiler.py
+++ b/pypy/module/test_lib_pypy/cffi_tests/cffi1/test_recompiler.py
@@ -1,7 +1,7 @@
# Generated by pypy/tool/import_cffi.py
import sys, os, py
-from cffi import FFI, VerificationError
+from cffi import FFI, VerificationError, FFIError
from cffi import recompiler
from pypy.module.test_lib_pypy.cffi_tests.udir import udir
from pypy.module.test_lib_pypy.cffi_tests.support import u
@@ -1057,14 +1057,54 @@
assert lib.nu == 20
def test_some_float_type():
- py.test.skip("later")
ffi = FFI()
- ffi.cdef("typedef double... foo_t; foo_t sum(foo_t[]);")
+ ffi.cdef("""
+ typedef double... foo_t;
+ typedef float... bar_t;
+ foo_t sum(foo_t[]);
+ bar_t neg(bar_t);
+ """)
lib = verify(ffi, 'test_some_float_type', """
typedef float foo_t;
static foo_t sum(foo_t x[]) { return x[0] + x[1]; }
+ typedef double bar_t;
+ static double neg(double x) { return -x; }
""")
assert lib.sum([40.0, 2.25]) == 42.25
+ assert lib.sum([12.3, 45.6]) != 12.3 + 45.6 # precision loss
+ assert lib.neg(12.3) == -12.3 # no precision loss
+ assert ffi.sizeof("foo_t") == ffi.sizeof("float")
+ assert ffi.sizeof("bar_t") == ffi.sizeof("double")
+
+def test_some_float_invalid_1():
+ ffi = FFI()
+ py.test.raises(FFIError, ffi.cdef, "typedef long double... foo_t;")
+
+def test_some_float_invalid_2():
+ ffi = FFI()
+ ffi.cdef("typedef double... foo_t; foo_t neg(foo_t);")
+ lib = verify(ffi, 'test_some_float_invalid_2', """
+ typedef unsigned long foo_t;
+ foo_t neg(foo_t x) { return -x; }
+ """)
+ e = py.test.raises(ffi.error, getattr, lib, 'neg')
+ assert str(e.value) == ("primitive floating-point type with an unexpected "
+ "size (or not a float type at all)")
+
+def test_some_float_invalid_3():
+ ffi = FFI()
+ ffi.cdef("typedef double... foo_t; foo_t neg(foo_t);")
+ lib = verify(ffi, 'test_some_float_invalid_3', """
+ typedef long double foo_t;
+ foo_t neg(foo_t x) { return -x; }
+ """)
+ if ffi.sizeof("long double") == ffi.sizeof("double"):
+ assert lib.neg(12.3) == -12.3
+ else:
+ e = py.test.raises(ffi.error, getattr, lib, 'neg')
+ assert str(e.value) == ("primitive floating-point type is "
+ "'long double', not supported for now with "
+ "the syntax 'typedef double... xxx;'")
def test_issue200():
ffi = FFI()
diff --git a/pypy/module/thread/test/test_lock.py
b/pypy/module/thread/test/test_lock.py
--- a/pypy/module/thread/test/test_lock.py
+++ b/pypy/module/thread/test/test_lock.py
@@ -175,9 +175,6 @@
class AppTestLockSignals(GenericTestThread):
pytestmark = py.test.mark.skipif("os.name != 'posix'")
- def setup_class(cls):
- cls.w_using_pthread_cond = cls.space.wrap(sys.platform == 'freebsd6')
-
def w_acquire_retries_on_intr(self, lock):
import _thread, os, signal, time
self.sig_recvd = False
@@ -222,8 +219,6 @@
raise KeyboardInterrupt
def test_lock_acquire_interruption(self):
- if self.using_pthread_cond:
- skip('POSIX condition variables cannot be interrupted')
import _thread, signal, time
# Mimic receiving a SIGINT (KeyboardInterrupt) with SIGALRM while stuck
# in a deadlock.
diff --git a/pypy/tool/release/force-builds.py
b/pypy/tool/release/force-builds.py
--- a/pypy/tool/release/force-builds.py
+++ b/pypy/tool/release/force-builds.py
@@ -28,6 +28,7 @@
# 'pypy-c-app-level-win-x86-32',
'pypy-c-jit-linux-x86-32',
'pypy-c-jit-linux-x86-64',
+ 'pypy-c-jit-freebsd-9-x86-64',
'pypy-c-jit-macosx-x86-64',
'pypy-c-jit-win-x86-32',
'build-pypy-c-jit-linux-armhf-raring',
@@ -42,7 +43,7 @@
import pwd
return pwd.getpwuid(os.getuid())[0]
-def main(branch, server):
+def main(branch, server, user):
#XXX: handle release tags
#XXX: handle validity checks
lock = defer.DeferredLock()
@@ -56,7 +57,7 @@
print 'Forcing', builder, '...'
url = "http://" + server + "/builders/" + builder + "/force"
args = [
- ('username', get_user()),
+ ('username', user),
('revision', ''),
('forcescheduler', 'Force Scheduler'),
('submit', 'Force Build'),
@@ -78,7 +79,8 @@
parser = optparse.OptionParser()
parser.add_option("-b", "--branch", help="branch to build", default='')
parser.add_option("-s", "--server", help="buildbot server",
default="buildbot.pypy.org")
+ parser.add_option("-u", "--user", help="user name to report",
default=get_user())
(options, args) = parser.parse_args()
if not options.branch:
parser.error("branch option required")
- main(options.branch, options.server)
+ main(options.branch, options.server, user=options.user)
diff --git a/pypy/tool/release/repackage.sh b/pypy/tool/release/repackage.sh
--- a/pypy/tool/release/repackage.sh
+++ b/pypy/tool/release/repackage.sh
@@ -1,12 +1,12 @@
# Edit these appropriately before running this script
maj=2
min=6
-rev=0
+rev=1
# This script will download latest builds from the buildmaster, rename the top
# level directory, and repackage ready to be uploaded to bitbucket. It will
also
# download source, assuming a tag for the release already exists, and
repackage them.
-for plat in linux linux64 linux-armhf-raspbian linux-armhf-raring linux-armel
osx64
+for plat in linux linux64 linux-armhf-raspbian linux-armhf-raring linux-armel
osx64 freebsd64
do
wget
http://buildbot.pypy.org/nightly/release-$maj.$min.x/pypy-c-jit-latest-$plat.tar.bz2
tar -xf pypy-c-jit-latest-$plat.tar.bz2
diff --git a/rpython/jit/metainterp/history.py
b/rpython/jit/metainterp/history.py
--- a/rpython/jit/metainterp/history.py
+++ b/rpython/jit/metainterp/history.py
@@ -631,9 +631,11 @@
raise Exception("TreeLoop.token is killed")
token = property(_token, _token)
- # This is the jitcell where the trace starts. Labels within the trace might
- # belong to some other jitcells in the sens that jumping to this other
- # jitcell will result in a jump to the label.
+ # This is the jitcell where the trace starts. Labels within the
+ # trace might belong to some other jitcells, i.e. they might have
+ # TargetTokens with a different value for 'targeting_jitcell_token'.
+ # But these TargetTokens also have a 'original_jitcell_token' field,
+ # which must be equal to this one.
original_jitcell_token = None
def __init__(self, name):
diff --git a/rpython/jit/metainterp/optimizeopt/test/test_optimizeopt.py
b/rpython/jit/metainterp/optimizeopt/test/test_optimizeopt.py
--- a/rpython/jit/metainterp/optimizeopt/test/test_optimizeopt.py
+++ b/rpython/jit/metainterp/optimizeopt/test/test_optimizeopt.py
@@ -8445,6 +8445,7 @@
self.optimize_loop(ops, expected)
def test_issue1080_infinitie_loop_virtual(self):
+ # Same comment as the following test_issue1080_infinitie_loop_simple
ops = """
[p10]
p52 = getfield_gc(p10, descr=nextdescr) # inst_storage
@@ -8467,6 +8468,10 @@
self.raises(InvalidLoop, self.optimize_loop, ops, ops)
def test_issue1080_infinitie_loop_simple(self):
+ # 'quasiimmutdescr' is a QuasiImmutDescr initialized with the
+ # 'quasibox' as the quasi-immutable instance. We close the loop
+ # with ConstPtr(myptr), i.e. a different pointer. The test checks
+ # that the resulting loop is invalid.
ops = """
[p69]
quasiimmut_field(p69, descr=quasiimmutdescr)
diff --git a/rpython/rlib/clibffi.py b/rpython/rlib/clibffi.py
--- a/rpython/rlib/clibffi.py
+++ b/rpython/rlib/clibffi.py
@@ -32,7 +32,6 @@
_WIN32 = _MSVC or _MINGW
_WIN64 = _WIN32 and is_emulated_long
_MAC_OS = platform.name == "darwin"
-_FREEBSD_7 = platform.name == "freebsd7"
_LITTLE_ENDIAN = sys.byteorder == 'little'
_BIG_ENDIAN = sys.byteorder == 'big'
diff --git a/rpython/rtyper/lltypesystem/ll2ctypes.py
b/rpython/rtyper/lltypesystem/ll2ctypes.py
--- a/rpython/rtyper/lltypesystem/ll2ctypes.py
+++ b/rpython/rtyper/lltypesystem/ll2ctypes.py
@@ -46,6 +46,7 @@
_POSIX = os.name == "posix"
_MS_WINDOWS = os.name == "nt"
+_FREEBSD = sys.platform.startswith('freebsd')
_64BIT = "64bit" in host_platform.architecture()[0]
@@ -1080,8 +1081,11 @@
return ctypes.util.find_library('c')
libc_name = get_libc_name() # Make sure the name is determined during
import, not at runtime
+ if _FREEBSD:
+ RTLD_DEFAULT = -2 # see <dlfcn.h>
+ rtld_default_lib = ctypes.CDLL("RTLD_DEFAULT", handle=RTLD_DEFAULT,
**load_library_kwargs)
# XXX is this always correct???
- standard_c_lib = ctypes.CDLL(get_libc_name(), **load_library_kwargs)
+ standard_c_lib = ctypes.CDLL(libc_name, **load_library_kwargs)
# ____________________________________________
@@ -1174,7 +1178,10 @@
not_found.append(libname)
if cfunc is None:
- cfunc = get_on_lib(standard_c_lib, funcname)
+ if _FREEBSD and funcname in ('dlopen', 'fdlopen', 'dlsym', 'dlfunc',
'dlerror', 'dlclose'):
+ cfunc = get_on_lib(rtld_default_lib, funcname)
+ else:
+ cfunc = get_on_lib(standard_c_lib, funcname)
# XXX magic: on Windows try to load the function from 'kernel32' too
if cfunc is None and hasattr(ctypes, 'windll'):
cfunc = get_on_lib(ctypes.windll.kernel32, funcname)
@@ -1493,18 +1500,17 @@
_where_is_errno().contents.value = TLS.errno
if ctypes:
- if sys.platform == 'win32':
+ if _MS_WINDOWS:
standard_c_lib._errno.restype = ctypes.POINTER(ctypes.c_int)
def _where_is_errno():
return standard_c_lib._errno()
- elif sys.platform.startswith('linux') or sys.platform == 'freebsd6':
+ elif sys.platform.startswith('linux'):
standard_c_lib.__errno_location.restype =
ctypes.POINTER(ctypes.c_int)
def _where_is_errno():
return standard_c_lib.__errno_location()
- elif any(plat in sys.platform
- for plat in ('darwin', 'freebsd7', 'freebsd8', 'freebsd9')):
+ elif sys.platform == 'darwin' or _FREEBSD:
standard_c_lib.__error.restype = ctypes.POINTER(ctypes.c_int)
def _where_is_errno():
return standard_c_lib.__error()
diff --git a/rpython/rtyper/tool/rffi_platform.py
b/rpython/rtyper/tool/rffi_platform.py
--- a/rpython/rtyper/tool/rffi_platform.py
+++ b/rpython/rtyper/tool/rffi_platform.py
@@ -854,7 +854,7 @@
platform = None
else:
library_dir = ''
- libraries = ['gc', 'dl']
+ libraries = ['gc']
includes=['gc/gc.h']
eci = ExternalCompilationInfo(
platform=platform,
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit