[pypy-commit] pypy default: Fix issue #1801
arigo
noreply at buildbot.pypy.org
Tue Jun 24 09:46:46 CEST 2014
Author: Armin Rigo <arigo at tunes.org>
Branch:
Changeset: r72183:1b8316ceb9e6
Date: 2014-06-24 09:45 +0200
http://bitbucket.org/pypy/pypy/changeset/1b8316ceb9e6/
Log: Fix issue #1801
diff --git a/pypy/interpreter/gateway.py b/pypy/interpreter/gateway.py
--- a/pypy/interpreter/gateway.py
+++ b/pypy/interpreter/gateway.py
@@ -895,7 +895,7 @@
"use unwrap_spec(...=WrappedDefault(default))" % (
self._code.identifier, name, defaultval))
defs_w.append(None)
- else:
+ elif name != '__args__' and name != 'args_w':
defs_w.append(space.wrap(defaultval))
if self._code._unwrap_spec:
UNDEFINED = object()
diff --git a/pypy/interpreter/test/test_gateway.py b/pypy/interpreter/test/test_gateway.py
--- a/pypy/interpreter/test/test_gateway.py
+++ b/pypy/interpreter/test/test_gateway.py
@@ -726,6 +726,22 @@
never_called
py.test.raises(AssertionError, space.wrap, gateway.interp2app_temp(g))
+ def test_unwrap_spec_default_applevel_bug2(self):
+ space = self.space
+ def g(space, w_x, w_y=None, __args__=None):
+ return w_x
+ w_g = space.wrap(gateway.interp2app_temp(g))
+ w_42 = space.call_function(w_g, space.wrap(42))
+ assert space.int_w(w_42) == 42
+ py.test.raises(gateway.OperationError, space.call_function, w_g)
+ #
+ def g(space, w_x, w_y=None, args_w=None):
+ return w_x
+ w_g = space.wrap(gateway.interp2app_temp(g))
+ w_42 = space.call_function(w_g, space.wrap(42))
+ assert space.int_w(w_42) == 42
+ py.test.raises(gateway.OperationError, space.call_function, w_g)
+
def test_interp2app_doc(self):
space = self.space
def f(space, w_x):
diff --git a/pypy/module/_weakref/test/test_weakref.py b/pypy/module/_weakref/test/test_weakref.py
--- a/pypy/module/_weakref/test/test_weakref.py
+++ b/pypy/module/_weakref/test/test_weakref.py
@@ -15,6 +15,10 @@
gc.collect()
assert ref() is None
+ def test_missing_arg(self):
+ import _weakref
+ raises(TypeError, _weakref.ref)
+
def test_callback(self):
import _weakref, gc
class A(object):
More information about the pypy-commit
mailing list