From: R David Murray <rdmurray@bitdance.com>
Date: Tue, 19 Feb 2013 02:39:18 +0000 (-0500)
Subject: #7963: fix error message when 'object' called with arguments.
X-Git-Tag: v3.3.1rc1~160
X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=702a5dc1ed7907c4017106388329db73c038345c;p=python

#7963: fix error message when 'object' called with arguments.
---

702a5dc1ed7907c4017106388329db73c038345c
diff --cc Objects/typeobject.c
index 413c7da9df,bbf03a102f..aab83e1920
--- a/Objects/typeobject.c
+++ b/Objects/typeobject.c
@@@ -3057,13 -2836,28 +3057,13 @@@ object_init(PyObject *self, PyObject *a
  static PyObject *
  object_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
  {
 -    int err = 0;
 -    if (excess_args(args, kwds)) {
 -        if (type->tp_new != object_new &&
 -            type->tp_init != object_init)
 -        {
 -            err = PyErr_WarnEx(PyExc_DeprecationWarning,
 -                       "object() takes no parameters",
 -                       1);
 -        }
 -        else if (type->tp_new != object_new ||
 -                 type->tp_init == object_init)
 -        {
 -            PyErr_SetString(PyExc_TypeError,
 -                "object() takes no parameters");
 -            err = -1;
 -        }
 -    }
 -    if (err < 0)
 +    if (excess_args(args, kwds) &&
 +        (type->tp_init == object_init || type->tp_new != object_new)) {
-         PyErr_SetString(PyExc_TypeError, "object.__new__() takes no parameters");
++        PyErr_SetString(PyExc_TypeError, "object() takes no parameters");
          return NULL;
 +    }
  
      if (type->tp_flags & Py_TPFLAGS_IS_ABSTRACT) {
 -        static PyObject *comma = NULL;
          PyObject *abstract_methods = NULL;
          PyObject *builtins;
          PyObject *sorted;