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;