summaryrefslogtreecommitdiffstats
path: root/Include
diff options
context:
space:
mode:
authorTim Peters <tim.peters@gmail.com>2001-10-27 19:37:48 (GMT)
committerTim Peters <tim.peters@gmail.com>2001-10-27 19:37:48 (GMT)
commit3abca127fe1565ec80f6b0a1ae48d65186ad887d (patch)
treead9da6a32fe9956cba5d804939f345b85ad85259 /Include
parent4d85953fe609197c54827826963eabaf6418024c (diff)
downloadcpython-3abca127fe1565ec80f6b0a1ae48d65186ad887d.zip
cpython-3abca127fe1565ec80f6b0a1ae48d65186ad887d.tar.gz
cpython-3abca127fe1565ec80f6b0a1ae48d65186ad887d.tar.bz2
SF bug #475327: type() produces incorrect error msg
object.h: Added PyType_CheckExact macro. typeobject.c, type_new(): + Use the new macro. + Assert that the arguments have the right types rather than do incomplete runtime checks "sometimes". + If this isn't the 1-argument flavor() of type, and there aren't 3 args total, produce a "types() takes 1 or 3 args" msg before PyArg_ParseTupleAndKeywords produces a "takes exactly 3" msg.
Diffstat (limited to 'Include')
-rw-r--r--Include/object.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/Include/object.h b/Include/object.h
index c565fbe..52d6dbf 100644
--- a/Include/object.h
+++ b/Include/object.h
@@ -312,6 +312,7 @@ extern DL_IMPORT(PyTypeObject) PyBaseObject_Type; /* built-in 'object' */
extern DL_IMPORT(PyTypeObject) PySuper_Type; /* built-in 'super' */
#define PyType_Check(op) PyObject_TypeCheck(op, &PyType_Type)
+#define PyType_CheckExact(op) ((op)->ob_type == &PyType_Type)
extern DL_IMPORT(int) PyType_Ready(PyTypeObject *);
extern DL_IMPORT(PyObject *) PyType_GenericAlloc(PyTypeObject *, int);