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

Patch by Alexander Belopolsky.
This commit is contained in:
R David Murray 2013-02-18 21:20:08 -05:00
parent 1548ed6698
commit 6b30759022
2 changed files with 5 additions and 2 deletions

View File

@ -10,6 +10,9 @@ What's New in Python 3.2.4
Core and Builtins Core and Builtins
----------------- -----------------
- Issue #7963: Fixed misleading error message that issued when object is
called without arguments.
- Issue #5308: Raise ValueError when marshalling too large object (a sequence - Issue #5308: Raise ValueError when marshalling too large object (a sequence
with size >= 2**31), instead of producing illegal marshal data. with size >= 2**31), instead of producing illegal marshal data.

View File

@ -2842,14 +2842,14 @@ object_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
type->tp_init != object_init) type->tp_init != object_init)
{ {
err = PyErr_WarnEx(PyExc_DeprecationWarning, err = PyErr_WarnEx(PyExc_DeprecationWarning,
"object.__new__() takes no parameters", "object() takes no parameters",
1); 1);
} }
else if (type->tp_new != object_new || else if (type->tp_new != object_new ||
type->tp_init == object_init) type->tp_init == object_init)
{ {
PyErr_SetString(PyExc_TypeError, PyErr_SetString(PyExc_TypeError,
"object.__new__() takes no parameters"); "object() takes no parameters");
err = -1; err = -1;
} }
} }