1. Tobias Oberstein
  2. pypy

Commits

Benjamin Peterson  committed 1d37869

pop defaults off in the correct place

  • Participants
  • Parent commits cb5461b
  • Branches py3k

Comments (0)

Files changed (2)

File pypy/interpreter/pyopcode.py

View file
         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)

File pypy/interpreter/test/test_syntax.py

View file
 
     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}