Author: Matti Picus <matti.pi...@gmail.com>
Branch: py3.5
Changeset: r94324:1be242f4be56
Date: 2018-04-14 20:47 +0300
http://bitbucket.org/pypy/pypy/changeset/1be242f4be56/

Log:    merge default into py3.5

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
@@ -40,6 +40,8 @@
   sure things are ported back to the trunk and to the branch as
   necessary.
 
+* Make sure the RPython builds on the buildbot pass with no failures
+
 * Maybe bump the SOABI number in module/imp/importing. This has many
   implications, so make sure the PyPy community agrees to the change.
 
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,16 +3,6 @@
 ==========================
 
 .. this is a revision shortly after release-pypy-6.0.0
-.. startrev: 2e04adf1b89f
+.. startrev: f22145c34985
 
-.. branch: cpyext-subclass-setattr
 
-Fix for python-level classes that inherit from C-API types, previously the
-`w_obj` was not necessarily preserved throughout the lifetime of the `pyobj`
-which led to cases where instance attributes were lost. Fixes issue #2793
-
-
-.. branch: pyparser-improvements-2
-
-Improve line offsets that are reported by SyntaxError. Improve error messages
-for a few situations, including mismatched parenthesis.
diff --git a/pypy/doc/whatsnew-pypy2-6.0.0.rst 
b/pypy/doc/whatsnew-pypy2-6.0.0.rst
--- a/pypy/doc/whatsnew-pypy2-6.0.0.rst
+++ b/pypy/doc/whatsnew-pypy2-6.0.0.rst
@@ -101,3 +101,15 @@
 Work around possible bugs in upstream ioctl users, like CPython allocate at
 least 1024 bytes for the arg in calls to ``ioctl(fd, request, arg)``. Fixes
 issue #2776
+
+.. branch: cpyext-subclass-setattr
+
+Fix for python-level classes that inherit from C-API types, previously the
+`w_obj` was not necessarily preserved throughout the lifetime of the `pyobj`
+which led to cases where instance attributes were lost. Fixes issue #2793
+
+
+.. branch: pyparser-improvements-2
+
+Improve line offsets that are reported by SyntaxError. Improve error messages
+for a few situations, including mismatched parenthesis.
diff --git a/pypy/module/cpyext/setobject.py b/pypy/module/cpyext/setobject.py
--- a/pypy/module/cpyext/setobject.py
+++ b/pypy/module/cpyext/setobject.py
@@ -1,4 +1,4 @@
-from pypy.interpreter.error import oefmt
+from pypy.interpreter.error import OperationError, oefmt
 from rpython.rtyper.lltypesystem import rffi, lltype
 from pypy.module.cpyext.api import (cpython_api, Py_ssize_t, CANNOT_FAIL,
                                     build_type_checkers)
@@ -64,8 +64,13 @@
     instance of set or its subtype."""
     if not PySet_Check(space, w_s):
         PyErr_BadInternalCall(space)
-    space.call_method(space.w_set, 'discard', w_s, w_obj)
-    return 0
+    try:
+        space.call_method(space.w_set, 'remove', w_s, w_obj)
+    except OperationError as e:
+        if e.match(space, space.w_KeyError):
+            return 0
+        raise
+    return 1
 
 
 @cpython_api([PyObject], PyObject)
diff --git a/pypy/module/cpyext/test/test_setobject.py 
b/pypy/module/cpyext/test/test_setobject.py
--- a/pypy/module/cpyext/test/test_setobject.py
+++ b/pypy/module/cpyext/test/test_setobject.py
@@ -28,7 +28,11 @@
         assert api.PySet_Size(w_set) == 4
         api.PySet_Add(w_set, space.wrap(6))
         assert api.PySet_Size(w_set) == 5
-        api.PySet_Discard(w_set, space.wrap(6))
+        res = api.PySet_Discard(w_set, space.wrap(6))
+        assert res == 1
+        assert api.PySet_Size(w_set) == 4
+        res = api.PySet_Discard(w_set, space.wrap(6))
+        assert res == 0
         assert api.PySet_Size(w_set) == 4
 
     def test_set_contains(self, space, api):
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
@@ -31,6 +31,9 @@
     'pypy-c-jit-linux-s390x',
     'build-pypy-c-jit-linux-armhf-raspbian',
     'build-pypy-c-jit-linux-armel',
+    'rpython-linux-x86-32',
+    'rpython-linux-x86-64'
+    'rpython-win-x86-32'
 ]
 
 def get_user():
diff --git a/rpython/rlib/rgc.py b/rpython/rlib/rgc.py
--- a/rpython/rlib/rgc.py
+++ b/rpython/rlib/rgc.py
@@ -644,7 +644,10 @@
 def get_rpy_type_index(gcref):
     from rpython.rlib.rarithmetic import intmask
     Class = gcref._x.__class__
-    return intmask(id(Class))
+    i = intmask(id(Class))
+    if i < 0:
+        i = ~i    # always return a positive number, at least
+    return i
 
 def cast_gcref_to_int(gcref):
     # This is meant to be used on cast_instance_to_gcref results.
diff --git a/rpython/rlib/rvmprof/src/shared/_vmprof.c 
b/rpython/rlib/rvmprof/src/shared/_vmprof.c
--- a/rpython/rlib/rvmprof/src/shared/_vmprof.c
+++ b/rpython/rlib/rvmprof/src/shared/_vmprof.c
@@ -36,6 +36,8 @@
     register PY_STACK_FRAME_T * callee_saved asm("rbx");
 #elif defined(X86_32)
     register PY_STACK_FRAME_T * callee_saved asm("edi");
+#elif defined(__arm__)
+    register PY_STACK_FRAME_T * callee_saved asm("r4");
 #else
 #    error "platform not supported"
 #endif
@@ -45,6 +47,8 @@
         "movq %1, %0\t\n"
 #elif defined(X86_32)
         "mov %1, %0\t\n"
+#elif defined(__arm__)
+       "mov %1, %0\t\n"
 #else
 #    error "platform not supported"
 #endif
diff --git a/rpython/rlib/rvmprof/src/shared/vmp_stack.c 
b/rpython/rlib/rvmprof/src/shared/vmp_stack.c
--- a/rpython/rlib/rvmprof/src/shared/vmp_stack.c
+++ b/rpython/rlib/rvmprof/src/shared/vmp_stack.c
@@ -16,7 +16,7 @@
 
 #ifdef VMP_SUPPORTS_NATIVE_PROFILING
 
-#ifdef VMPROF_LINUX
+#if defined(VMPROF_LINUX) || defined(VMPROF_BSD)
 #include "unwind/vmprof_unwind.h"
 typedef mcontext_t unw_context_t;
 
@@ -510,13 +510,15 @@
 static const char * vmprof_error = NULL;
 static void * libhandle = NULL;
 
-
 #ifdef VMPROF_LINUX
+#include <link.h>
 #define LIBUNWIND "libunwind.so"
 #ifdef __i386__
 #define PREFIX "x86"
+#define LIBUNWIND_SUFFIX ""
 #elif __x86_64__
 #define PREFIX "x86_64"
+#define LIBUNWIND_SUFFIX "-x86_64"
 #endif
 #define U_PREFIX "_U"
 #define UL_PREFIX "_UL"
@@ -524,10 +526,41 @@
 
 int vmp_native_enable(void) {
 #ifdef VMPROF_LINUX
+    void * oldhandle = NULL;
+    struct link_map * map = NULL;
     if (libhandle == NULL) {
+        // on linux, the wheel includes the libunwind shared object.
+        libhandle = dlopen(NULL, RTLD_NOW);
+        if (libhandle != NULL) {
+            // load the link map, it will contain an entry to
+            // .libs_vmprof/libunwind-...so, this is the file that is
+            // distributed with the wheel.
+            if (dlinfo(libhandle, RTLD_DI_LINKMAP, &map) != 0) {
+                (void)dlclose(libhandle);
+                libhandle = NULL;
+                goto bail_out;
+            }
+            // grab the new handle
+            do {
+                if (strstr(map->l_name, ".libs_vmprof/libunwind" 
LIBUNWIND_SUFFIX) != NULL) {
+                    oldhandle = libhandle;
+                    libhandle = dlopen(map->l_name, RTLD_LAZY|RTLD_LOCAL);
+                    (void)dlclose(oldhandle);
+                    oldhandle = NULL;
+                    goto loaded_libunwind;
+                }
+                map = map->l_next;
+            } while (map != NULL);
+            // did not find .libs_vmprof/libunwind...
+            (void)dlclose(libhandle);
+            libhandle = NULL;
+        }
+
+        // fallback! try to load the system's libunwind.so
         if ((libhandle = dlopen(LIBUNWIND, RTLD_LAZY | RTLD_LOCAL)) == NULL) {
             goto bail_out;
         }
+loaded_libunwind:
         if ((unw_get_reg = dlsym(libhandle, UL_PREFIX PREFIX "_get_reg")) == 
NULL) {
             goto bail_out;
         }
diff --git a/rpython/rlib/rvmprof/src/shared/vmprof_common.h 
b/rpython/rlib/rvmprof/src/shared/vmprof_common.h
--- a/rpython/rlib/rvmprof/src/shared/vmprof_common.h
+++ b/rpython/rlib/rvmprof/src/shared/vmprof_common.h
@@ -23,6 +23,10 @@
 #include <syscall.h>
 #endif
 
+#ifdef VMPROF_BSD
+#include <sys/syscall.h>
+#endif
+
 #define MAX_FUNC_NAME 1024
 
 #ifdef VMPROF_UNIX
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to