]> granicus.if.org Git - python/commitdiff
#7963: fix error message when 'object' called with arguments.
authorR David Murray <rdmurray@bitdance.com>
Tue, 19 Feb 2013 02:39:18 +0000 (21:39 -0500)
committerR David Murray <rdmurray@bitdance.com>
Tue, 19 Feb 2013 02:39:18 +0000 (21:39 -0500)
1  2 
Misc/NEWS
Objects/typeobject.c

diff --cc Misc/NEWS
Simple merge
index 413c7da9df8609050805af1ea651453a47f07b7e,bbf03a102f78af769cbe6a0aee5fe3db290a9123..aab83e1920daa536446bc0e141dfcad41c42cab2
@@@ -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;