From 5aff27aec18e08365891c4bc1d81cca87d9d49fd Mon Sep 17 00:00:00 2001 From: R David Murray Date: Mon, 18 Feb 2013 22:04:59 -0500 Subject: [PATCH] #7963: fix error message when 'object' called with arguments. Patch by Alexander Belopolsky. --- Misc/NEWS | 3 +++ Objects/typeobject.c | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS index ef3d053109c..79e350a497e 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -9,6 +9,9 @@ What's New in Python 2.7.4 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 with size >= 2**31), instead of producing illegal marshal data. diff --git a/Objects/typeobject.c b/Objects/typeobject.c index 0a79f8bef82..518d6e8e052 100644 --- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -2897,14 +2897,14 @@ object_new(PyTypeObject *type, PyObject *args, PyObject *kwds) type->tp_init != object_init) { err = PyErr_WarnEx(PyExc_DeprecationWarning, - "object.__new__() takes no parameters", + "object() takes no parameters", 1); } else if (type->tp_new != object_new || type->tp_init == object_init) { PyErr_SetString(PyExc_TypeError, - "object.__new__() takes no parameters"); + "object() takes no parameters"); err = -1; } }