[pypy-commit] pypy py3k: pop defaults off in the correct place

gutworth noreply at buildbot.pypy.org
Thu Mar 15 04:35:41 CET 2012


Author: Benjamin Peterson <benjamin at python.org>
Branch: py3k
Changeset: r53658:1d378696c97e
Date: 2012-03-14 22:19 -0500
http://bitbucket.org/pypy/pypy/changeset/1d378696c97e/

Log:	pop defaults off in the correct place

diff --git a/pypy/interpreter/pyopcode.py b/pypy/interpreter/pyopcode.py
--- a/pypy/interpreter/pyopcode.py
+++ b/pypy/interpreter/pyopcode.py
@@ -1000,13 +1000,13 @@
         posdefaults = oparg & 0xFF
         kwdefaults = (oparg >> 8) & 0xFF
         num_annotations = (oparg >> 16) & 0xFF
-        defaultarguments = self.popvalues(posdefaults)
         w_ann = None
         if num_annotations:
             names_w = space.fixedview(self.popvalue())
             w_ann = space.newdict(strdict=True)
             for i in range(len(names_w) - 1, -1, -1):
                 space.setitem(w_ann, names_w[i], self.popvalue())
+        defaultarguments = self.popvalues(posdefaults)
         w_kw_defs = None
         if kwdefaults:
             w_kw_defs = space.newdict(strdict=True)
diff --git a/pypy/interpreter/test/test_syntax.py b/pypy/interpreter/test/test_syntax.py
--- a/pypy/interpreter/test/test_syntax.py
+++ b/pypy/interpreter/test/test_syntax.py
@@ -616,6 +616,8 @@
 
     def test_simple(self):
         """
+        def f(e:3=4): pass
+        assert f.__annotations__ == {"e" : 3}
         def f(a : 1, b : 2, *var : 3, hi : 4, bye : 5=0, **kw : 6) -> 42: pass
         assert f.__annotations__ == {"a" : 1, "b" : 2, "var" : 3, "hi" : 4,
                                     "bye" : 5, "kw" : 6, "return" : 42}


More information about the pypy-commit mailing list