[pypy-commit] pypy cpyext-pickle: Backed out changeset 7819376524b2 wrong branch
pjenvey
pypy.commits at gmail.com
Sat May 21 18:11:25 EDT 2016
Author: Philip Jenvey <pjenvey at underboss.org>
Branch: cpyext-pickle
Changeset: r84558:2b9ca2acb895
Date: 2016-05-21 15:09 -0700
http://bitbucket.org/pypy/pypy/changeset/2b9ca2acb895/
Log: Backed out changeset 7819376524b2 wrong branch
diff --git a/pypy/objspace/std/objectobject.py b/pypy/objspace/std/objectobject.py
--- a/pypy/objspace/std/objectobject.py
+++ b/pypy/objspace/std/objectobject.py
@@ -84,23 +84,23 @@
'object()' call."""
-def _excess_args(__args__):
- return bool(__args__.arguments_w) or bool(__args__.keywords)
-
def descr__new__(space, w_type, __args__):
+ from pypy.objspace.std.objectobject import W_ObjectObject
from pypy.objspace.std.typeobject import _precheck_for_new
- w_type = _precheck_for_new(space, w_type)
-
# don't allow arguments if the default object.__init__() is about
# to be called
- if _excess_args(__args__):
- w_parent_init, _ = space.lookup_in_type_where(w_type, '__init__')
- if w_parent_init is space.w_object:
+ w_type = _precheck_for_new(space, w_type)
+ w_parentinit, _ = w_type.lookup_where('__init__')
+ if w_parentinit is space.w_object:
+ try:
+ __args__.fixedunpack(0)
+ except ValueError:
raise oefmt(space.w_TypeError,
- "object() takes no parameters")
+ "default __new__ takes no parameters")
if w_type.is_abstract():
_abstract_method_error(space, w_type)
- return space.allocate_instance(W_ObjectObject, w_type)
+ w_obj = space.allocate_instance(W_ObjectObject, w_type)
+ return w_obj
def descr___subclasshook__(space, __args__):
@@ -109,10 +109,12 @@
def descr__init__(space, w_obj, __args__):
# don't allow arguments unless __new__ is overridden
- if _excess_args(__args__):
- w_type = space.type(w_obj)
- w_parent_new, _ = space.lookup_in_type_where(w_type, '__new__')
- if w_parent_new is space.w_object:
+ w_type = space.type(w_obj)
+ w_parent_new, _ = space.lookup_in_type_where(w_type, '__new__')
+ if w_parent_new is space.w_object:
+ try:
+ __args__.fixedunpack(0)
+ except ValueError:
raise oefmt(space.w_TypeError,
"object.__init__() takes no parameters")
More information about the pypy-commit
mailing list