[pypy-commit] pypy win32-cleanup2: merge from default

mattip noreply at buildbot.pypy.org
Mon Apr 9 18:41:28 CEST 2012


Author: Matti Picus <matti.picus at gmail.com>
Branch: win32-cleanup2
Changeset: r54267:94df3eb8e759
Date: 2012-04-08 20:08 +0300
http://bitbucket.org/pypy/pypy/changeset/94df3eb8e759/

Log:	merge from default

diff --git a/pypy/doc/tool/makecontributor.py b/pypy/doc/tool/makecontributor.py
new file mode 100644
--- /dev/null
+++ b/pypy/doc/tool/makecontributor.py
@@ -0,0 +1,133 @@
+import py
+import sys
+from collections import defaultdict
+import operator
+import re
+import mercurial.localrepo
+import mercurial.ui
+
+ROOT = py.path.local(__file__).join('..', '..', '..', '..')
+author_re = re.compile('(.*) <.*>')
+pair_programming_re = re.compile(r'^\((.*?)\)')
+excluded = set(["pypy", "convert-repo"])
+
+alias = {
+    'Anders Chrigstrom': ['arre'],
+    'Antonio Cuni': ['antocuni', 'anto'],
+    'Armin Rigo': ['arigo', 'arfigo', 'armin', 'arigato'],
+    'Maciej Fijalkowski': ['fijal'],
+    'Carl Friedrich Bolz': ['cfbolz', 'cf'],
+    'Samuele Pedroni': ['pedronis', 'samuele', 'samule'],
+    'Michael Hudson': ['mwh'],
+    'Holger Krekel': ['hpk', 'holger krekel', 'holger', 'hufpk'],
+    "Amaury Forgeot d'Arc": ['afa'],
+    'Alex Gaynor': ['alex', 'agaynor'],
+    'David Schneider': ['bivab', 'david'],
+    'Christian Tismer': ['chris', 'christian', 'tismer',
+                         'tismer at christia-wjtqxl.localdomain'],
+    'Benjamin Peterson': ['benjamin'],
+    'Hakan Ardo': ['hakan', 'hakanardo'],
+    'Niklaus Haldimann': ['nik'],
+    'Alexander Schremmer': ['xoraxax'],
+    'Anders Hammarquist': ['iko'],
+    'David Edelsohn': ['edelsoh', 'edelsohn'],
+    'Niko Matsakis': ['niko'],
+    'Jakub Gustak': ['jlg'],
+    'Guido Wesdorp': ['guido'],
+    'Michael Foord': ['mfoord'],
+    'Mark Pearse': ['mwp'],
+    'Toon Verwaest': ['tverwaes'],
+    'Eric van Riet Paap': ['ericvrp'],
+    'Jacob Hallen': ['jacob', 'jakob'],
+    'Anders Lehmann': ['ale', 'anders'],
+    'Bert Freudenberg': ['bert'],
+    'Boris Feigin': ['boris', 'boria'],
+    'Valentino Volonghi': ['valentino', 'dialtone'],
+    'Aurelien Campeas': ['aurelien', 'aureliene'],
+    'Adrien Di Mascio': ['adim'],
+    'Jacek Generowicz': ['Jacek', 'jacek'],
+    'Jim Hunziker': ['landtuna at gmail.com'],
+    'Kristjan Valur Jonsson': ['kristjan at kristjan-lp.ccp.ad.local'],
+    'Laura Creighton': ['lac'],
+    'Aaron Iles': ['aliles'],
+    'Ludovic Aubry': ['ludal', 'ludovic'],
+    'Lukas Diekmann': ['l.diekmann', 'ldiekmann'],
+    'Matti Picus': ['Matti Picus matti.picus at gmail.com',
+                    'matthp', 'mattip', 'mattip>'],
+    'Michael Cheng': ['mikefc'],
+    'Richard Emslie': ['rxe'],
+    'Roberto De Ioris': ['roberto at goyle'],
+    'Roberto De Ioris': ['roberto at mrspurr'],
+    'Sven Hager': ['hager'],
+    'Tomo Cocoa': ['cocoatomo'],
+    }
+
+alias_map = {}
+for name, nicks in alias.iteritems():
+    for nick in nicks:
+        alias_map[nick] = name
+
+def get_canonical_author(name):
+    match = author_re.match(name)
+    if match:
+        name = match.group(1)
+    return alias_map.get(name, name)
+
+ignored_nicknames = defaultdict(int)
+
+def get_more_authors(log):
+    match = pair_programming_re.match(log)
+    if not match:
+        return set()
+    ignore_words = ['around', 'consulting', 'yesterday', 'for a bit', 'thanks',
+                    'in-progress', 'bits of', 'even a little', 'floating',]
+    sep_words = ['and', ';', '+', '/', 'with special  by']
+    nicknames = match.group(1)
+    for word in ignore_words:
+        nicknames = nicknames.replace(word, '')
+    for word in sep_words:
+        nicknames = nicknames.replace(word, ',')
+    nicknames = [nick.strip().lower() for nick in nicknames.split(',')]
+    authors = set()
+    for nickname in nicknames:
+        author = alias_map.get(nickname)
+        if not author:
+            ignored_nicknames[nickname] += 1
+        else:
+            authors.add(author)
+    return authors
+
+def main(show_numbers):
+    ui = mercurial.ui.ui()
+    repo = mercurial.localrepo.localrepository(ui, str(ROOT))
+    authors_count = defaultdict(int)
+    for i in repo:
+        ctx = repo[i]
+        authors = set()
+        authors.add(get_canonical_author(ctx.user()))
+        authors.update(get_more_authors(ctx.description()))
+        for author in authors:
+            if author not in excluded:
+                authors_count[author] += 1
+
+    # uncomment the next lines to get the list of nicknamed which could not be
+    # parsed from commit logs
+    ## items = ignored_nicknames.items()
+    ## items.sort(key=operator.itemgetter(1), reverse=True)
+    ## for name, n in items:
+    ##     if show_numbers:
+    ##         print '%5d %s' % (n, name)
+    ##     else:
+    ##         print name
+                
+    items = authors_count.items()
+    items.sort(key=operator.itemgetter(1), reverse=True)
+    for name, n in items:
+        if show_numbers:
+            print '%5d %s' % (n, name)
+        else:
+            print name
+
+if __name__ == '__main__':
+    show_numbers = '-n' in sys.argv
+    main(show_numbers)
diff --git a/pypy/interpreter/typedef.py b/pypy/interpreter/typedef.py
--- a/pypy/interpreter/typedef.py
+++ b/pypy/interpreter/typedef.py
@@ -321,7 +321,7 @@
             
             def user_setup(self, space, w_subtype):
                 self.w__dict__ = space.newdict(
-                    instance=True, classofinstance=w_subtype)
+                    instance=True)
                 base_user_setup(self, space, w_subtype)
 
             def setclass(self, space, w_subtype):
diff --git a/pypy/module/cpyext/include/patchlevel.h b/pypy/module/cpyext/include/patchlevel.h
--- a/pypy/module/cpyext/include/patchlevel.h
+++ b/pypy/module/cpyext/include/patchlevel.h
@@ -29,7 +29,7 @@
 #define PY_VERSION		"2.7.2"
 
 /* PyPy version as a string */
-#define PYPY_VERSION "1.8.1"
+#define PYPY_VERSION "1.9.1"
 
 /* Subversion Revision number of this file (not of the repository).
  * Empty since Mercurial migration. */
diff --git a/pypy/module/micronumpy/test/test_ufuncs.py b/pypy/module/micronumpy/test/test_ufuncs.py
--- a/pypy/module/micronumpy/test/test_ufuncs.py
+++ b/pypy/module/micronumpy/test/test_ufuncs.py
@@ -597,9 +597,8 @@
 
     def test_shift(self):
         from _numpypy import left_shift, right_shift
-        import sys
 
-        assert (left_shift([5, 1], [2, 31]) == [20, 2**31]).all()
+        assert (left_shift([5, 1], [2, 13]) == [20, 2**13]).all()
         assert (right_shift(10, range(5)) == [10, 5, 2, 1, 0]).all()
 
     def test_comparisons(self):
diff --git a/pypy/module/sys/version.py b/pypy/module/sys/version.py
--- a/pypy/module/sys/version.py
+++ b/pypy/module/sys/version.py
@@ -10,7 +10,7 @@
 CPYTHON_VERSION            = (2, 7, 2, "final", 42)   #XXX # sync patchlevel.h
 CPYTHON_API_VERSION        = 1013   #XXX # sync with include/modsupport.h
 
-PYPY_VERSION               = (1, 8, 1, "dev", 0)    #XXX # sync patchlevel.h
+PYPY_VERSION               = (1, 9, 1, "dev", 0)    #XXX # sync patchlevel.h
 
 if platform.name == 'msvc':
     COMPILER_INFO = 'MSC v.%d 32 bit' % (platform.version * 10 + 600)
diff --git a/pypy/objspace/fake/objspace.py b/pypy/objspace/fake/objspace.py
--- a/pypy/objspace/fake/objspace.py
+++ b/pypy/objspace/fake/objspace.py
@@ -110,7 +110,7 @@
         "NOT_RPYTHON"
         raise NotImplementedError
 
-    def newdict(self, module=False, instance=False, classofinstance=None,
+    def newdict(self, module=False, instance=False,
                 strdict=False):
         return w_some_obj()
 
diff --git a/pypy/objspace/std/dictmultiobject.py b/pypy/objspace/std/dictmultiobject.py
--- a/pypy/objspace/std/dictmultiobject.py
+++ b/pypy/objspace/std/dictmultiobject.py
@@ -33,8 +33,7 @@
 
     @staticmethod
     def allocate_and_init_instance(space, w_type=None, module=False,
-                                   instance=False, classofinstance=None,
-                                   strdict=False):
+                                   instance=False, strdict=False):
 
         if space.config.objspace.std.withcelldict and module:
             from pypy.objspace.std.celldict import ModuleDictStrategy
@@ -563,10 +562,7 @@
     def listview_int(self, w_dict):
         return self.unerase(w_dict.dstorage).keys()
 
-    def w_keys(self, w_dict):
-        # XXX there is no space.newlist_int yet
-        space = self.space
-        return space.call_function(space.w_list, w_dict)
+    # XXX there is no space.newlist_int yet to implement w_keys more efficiently
 
 class IntIteratorImplementation(_WrappedIteratorMixin, IteratorImplementation):
     pass
diff --git a/pypy/objspace/std/identitydict.py b/pypy/objspace/std/identitydict.py
--- a/pypy/objspace/std/identitydict.py
+++ b/pypy/objspace/std/identitydict.py
@@ -1,5 +1,5 @@
 ## ----------------------------------------------------------------------------
-## dict strategy (see dict_multiobject.py)
+## dict strategy (see dictmultiobject.py)
 
 from pypy.rlib import rerased
 from pypy.rlib.debug import mark_dict_non_null
@@ -80,8 +80,8 @@
     def iter(self, w_dict):
         return IdentityDictIteratorImplementation(self.space, self, w_dict)
 
-    def keys(self, w_dict):
-        return self.unerase(w_dict.dstorage).keys()
+    def w_keys(self, w_dict):
+        return self.space.newlist(self.unerase(w_dict.dstorage).keys())
 
 
 class IdentityDictIteratorImplementation(_UnwrappedIteratorMixin, IteratorImplementation):
diff --git a/pypy/objspace/std/objspace.py b/pypy/objspace/std/objspace.py
--- a/pypy/objspace/std/objspace.py
+++ b/pypy/objspace/std/objspace.py
@@ -313,11 +313,10 @@
     def newlist_str(self, list_s):
         return W_ListObject.newlist_str(self, list_s)
 
-    def newdict(self, module=False, instance=False, classofinstance=None,
+    def newdict(self, module=False, instance=False,
                 strdict=False):
         return W_DictMultiObject.allocate_and_init_instance(
                 self, module=module, instance=instance,
-                classofinstance=classofinstance,
                 strdict=strdict)
 
     def newset(self):
diff --git a/pypy/objspace/std/test/test_dictmultiobject.py b/pypy/objspace/std/test/test_dictmultiobject.py
--- a/pypy/objspace/std/test/test_dictmultiobject.py
+++ b/pypy/objspace/std/test/test_dictmultiobject.py
@@ -885,10 +885,9 @@
     def newtuple(self, l):
         return tuple(l)
 
-    def newdict(self, module=False, instance=False, classofinstance=None):
+    def newdict(self, module=False, instance=False):
         return W_DictMultiObject.allocate_and_init_instance(
-                self, module=module, instance=instance,
-                classofinstance=classofinstance)
+                self, module=module, instance=instance)
 
     def finditem_str(self, w_dict, s):
         return w_dict.getitem_str(s) # assume it's a multidict
@@ -968,6 +967,20 @@
         assert type(self.impl.strategy) is self.StrategyClass
         #assert self.impl.r_dict_content is None
 
+    def test_popitem(self):
+        self.fill_impl()
+        assert self.impl.length() == 2
+        a, b = self.impl.popitem()
+        assert self.impl.length() == 1
+        if a == self.string:
+            assert b == 1000
+            assert self.impl.getitem(self.string2) == 2000
+        else:
+            assert a == self.string2
+            assert b == 2000
+            assert self.impl.getitem_str(self.string) == 1000
+        self.check_not_devolved()
+
     def test_setitem(self):
         self.impl.setitem(self.string, 1000)
         assert self.impl.length() == 1
diff --git a/pypy/translator/c/gcc/trackgcroot.py b/pypy/translator/c/gcc/trackgcroot.py
--- a/pypy/translator/c/gcc/trackgcroot.py
+++ b/pypy/translator/c/gcc/trackgcroot.py
@@ -847,6 +847,10 @@
                 if sources:
                     target, = sources
 
+        if target.endswith('@PLT'):
+            # In -fPIC mode, all functions calls have this suffix
+            target = target[:-4]
+
         if target in self.FUNCTIONS_NOT_RETURNING:
             return [InsnStop(target)]
         if self.format == 'mingw32' and target == '__alloca':
@@ -1137,7 +1141,7 @@
     r_jump_rel_label = re.compile(r"\tj\w+\s+"+"(\d+)f"+"\s*$")
 
     r_unaryinsn_star= re.compile(r"\t[a-z]\w*\s+[*]("+OPERAND+")\s*$")
-    r_jmptable_item = re.compile(r"\t.quad\t"+LABEL+"(-\"[A-Za-z0-9$]+\")?\s*$")
+    r_jmptable_item = re.compile(r"\t.(?:quad|long)\t"+LABEL+"(-\"[A-Za-z0-9$]+\"|-"+LABEL+")?\s*$")
     r_jmptable_end  = re.compile(r"\t.text|\t.section\s+.text|\t\.align|"+LABEL)
 
     r_gcroot_marker = re.compile(r"\t/[*] GCROOT ("+LOCALVARFP+") [*]/")


More information about the pypy-commit mailing list