summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2011-07-29 23:27:44 (GMT)
committerBenjamin Peterson <benjamin@python.org>2011-07-29 23:27:44 (GMT)
commit18d7d7a2176e169942d5764516eee6f952610884 (patch)
tree48b4881fba56ad3052be783fd5c4cefcb503ef3c /Objects
parentd83be998fcff518af95757913cd4bf071c14fbf4 (diff)
downloadcpython-18d7d7a2176e169942d5764516eee6f952610884.zip
cpython-18d7d7a2176e169942d5764516eee6f952610884.tar.gz
cpython-18d7d7a2176e169942d5764516eee6f952610884.tar.bz2
also make NotImplementedType callable
Diffstat (limited to 'Objects')
-rw-r--r--Objects/object.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/Objects/object.c b/Objects/object.c
index f2f4363..cf10f3c 100644
--- a/Objects/object.c
+++ b/Objects/object.c
@@ -1385,6 +1385,17 @@ NotImplemented_repr(PyObject *op)
return PyUnicode_FromString("NotImplemented");
}
+static PyObject *
+notimplemented_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
+{
+ if (PyTuple_GET_SIZE(args) || (kwargs && PyDict_Size(kwargs))) {
+ PyErr_SetString(PyExc_TypeError, "NotImplementedType takes no arguments");
+ return NULL;
+ }
+ Py_INCREF(Py_NotImplemented);
+ return Py_NotImplemented;
+}
+
static PyTypeObject PyNotImplemented_Type = {
PyVarObject_HEAD_INIT(&PyType_Type, 0)
"NotImplementedType",
@@ -1400,6 +1411,30 @@ static PyTypeObject PyNotImplemented_Type = {
0, /*tp_as_sequence*/
0, /*tp_as_mapping*/
0, /*tp_hash */
+ 0, /*tp_call */
+ 0, /*tp_str */
+ 0, /*tp_getattro */
+ 0, /*tp_setattro */
+ 0, /*tp_as_buffer */
+ Py_TPFLAGS_DEFAULT, /*tp_flags */
+ 0, /*tp_doc */
+ 0, /*tp_traverse */
+ 0, /*tp_clear */
+ 0, /*tp_richcompare */
+ 0, /*tp_weaklistoffset */
+ 0, /*tp_iter */
+ 0, /*tp_iternext */
+ 0, /*tp_methods */
+ 0, /*tp_members */
+ 0, /*tp_getset */
+ 0, /*tp_base */
+ 0, /*tp_dict */
+ 0, /*tp_descr_get */
+ 0, /*tp_descr_set */
+ 0, /*tp_dictoffset */
+ 0, /*tp_init */
+ 0, /*tp_alloc */
+ notimplemented_new, /*tp_new */
};
PyObject _Py_NotImplementedStruct = {