[pypy-commit] pypy stmgc-c7: Updates

arigo noreply at buildbot.pypy.org
Sat May 3 17:05:29 CEST 2014


Author: Armin Rigo <arigo at tunes.org>
Branch: stmgc-c7
Changeset: r71231:aa05911400e3
Date: 2014-05-03 13:55 +0200
http://bitbucket.org/pypy/pypy/changeset/aa05911400e3/

Log:	Updates

diff --git a/lib_pypy/atomic.py b/lib_pypy/atomic.py
--- a/lib_pypy/atomic.py
+++ b/lib_pypy/atomic.py
@@ -5,7 +5,7 @@
 
 try:
     from __pypy__ import thread as _thread
-    from __pypy__.thread import atomic
+    from __pypy__.thread import atomic, getsegmentlimit
 except ImportError:
     # Not a STM-enabled PyPy.  We can still provide a version of 'atomic'
     # that is good enough for our purposes.  With this limited version,
@@ -13,6 +13,9 @@
     # thread Y is not within an atomic block at all.
     atomic = thread.allocate_lock()
 
+    def getsegmentlimit():
+        return 1
+
     def print_abort_info(mintime=0.0):
         pass
 
@@ -37,52 +40,53 @@
         "'major gc'",
         "'sync pause'",
         ]
-    _r_line = re.compile(r'File "(.*?)", line (\d+), in ')
+    _r_line = re.compile(r'File "(.*?)[co]?", line (\d+), in ')
     _fullfilenames = {}
 
     def print_abort_info(mintime=0.0):
         info = _thread.longest_abort_info(mintime)
         if info is None:
             return
-        print >> sys.stderr, "Conflict",
-        a, b, c, d = info
-        try:
-            reason = _timing_reasons[a]
-        except IndexError:
-            reason = "'%s'" % (a,)
-        print >> sys.stderr, reason,
-        def show(line):
-            print >> sys.stderr, " ", line
-            match = _r_line.match(line)
-            if match:
-                filename = match.group(1)
-                lineno = int(match.group(2))
-                if filename.startswith('...'):
-                    if filename not in _fullfilenames:
-                        partial = filename[3:]
-                        found = set()
-                        for module in sys.modules.values():
-                            try:
-                                modfile = object.__getattribute__(module, '__file__')
-                            except Exception:
-                                modfile = None
-                            if type(modfile) is str and modfile.endswith(partial):
-                                found.add(modfile)
-                        if len(found) == 1:
-                            _fullfilenames[filename], = found
-                        else:
-                            _fullfilenames[filename] = None
-                    filename = _fullfilenames[filename]
-                line = linecache.getline(filename, lineno)
-                if line:
-                    print >> sys.stderr, "   ", line.strip()
-        if d:
-            print >> sys.stderr, "between two threads:"
-            show(c)
-            show(d)
-        else:
-            print >> sys.stderr, "in this thread:"
-            show(c)
-        print >> sys.stderr, 'Lost %.6f seconds.' % (b,)
-        print >> sys.stderr
-        _thread.reset_longest_abort_info()
+        with atomic:
+            print >> sys.stderr, "Conflict",
+            a, b, c, d = info
+            try:
+                reason = _timing_reasons[a]
+            except IndexError:
+                reason = "'%s'" % (a,)
+            print >> sys.stderr, reason,
+            def show(line):
+                print >> sys.stderr, " ", line
+                match = _r_line.match(line)
+                if match and match.group(1) != '?':
+                    filename = match.group(1)
+                    lineno = int(match.group(2))
+                    if filename.startswith('...'):
+                        if filename not in _fullfilenames:
+                            partial = filename[3:]
+                            found = set()
+                            for module in sys.modules.values():
+                                try:
+                                    modfile = object.__getattribute__(module, '__file__')
+                                except Exception:
+                                    modfile = None
+                                if type(modfile) is str and modfile.endswith(partial):
+                                    found.add(modfile)
+                            if len(found) == 1:
+                                _fullfilenames[filename], = found
+                            else:
+                                _fullfilenames[filename] = None
+                        filename = _fullfilenames[filename]
+                    line = linecache.getline(filename, lineno)
+                    if line:
+                        print >> sys.stderr, "   ", line.strip()
+            if d:
+                print >> sys.stderr, "between two threads:"
+                show(c)
+                show(d)
+            else:
+                print >> sys.stderr, "in this thread:"
+                show(c)
+            print >> sys.stderr, 'Lost %.6f seconds.' % (b,)
+            print >> sys.stderr
+            _thread.reset_longest_abort_info()


More information about the pypy-commit mailing list