summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2005-08-26 06:42:30 (GMT)
committerGeorg Brandl <georg@python.org>2005-08-26 06:42:30 (GMT)
commit02c42871cf73365dc5b6915cac2b017b2b90c81f (patch)
treea85d3fb2fc3682c2a149d213f5cf9a378868abea /Python
parentbd77da6dab9d41ef246febf54c7928ce4496dd49 (diff)
downloadcpython-02c42871cf73365dc5b6915cac2b017b2b90c81f.zip
cpython-02c42871cf73365dc5b6915cac2b017b2b90c81f.tar.gz
cpython-02c42871cf73365dc5b6915cac2b017b2b90c81f.tar.bz2
Disallow keyword arguments for type constructors that don't use them.
(fixes bug #1119418)
Diffstat (limited to 'Python')
-rw-r--r--Python/getargs.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/Python/getargs.c b/Python/getargs.c
index e89f0d5..483fda7 100644
--- a/Python/getargs.c
+++ b/Python/getargs.c
@@ -1595,3 +1595,29 @@ PyArg_UnpackTuple(PyObject *args, char *name, int min, int max, ...)
va_end(vargs);
return 1;
}
+
+
+/* For type constructors that don't take keyword args
+ *
+ * Sets a TypeError and returns 0 if the kwds dict is
+ * not emtpy, returns 1 otherwise
+ */
+int
+_PyArg_NoKeywords(char *funcname, PyObject *kw)
+{
+ if (kw == NULL)
+ return 1;
+ if (!PyDict_CheckExact(kw)) {
+ PyErr_BadInternalCall();
+ return 0;
+ }
+ if (PyDict_Size(kw) == 0)
+ return 1;
+
+ PyErr_Format(PyExc_TypeError, "%s does not take keyword arguments",
+ funcname);
+ return 0;
+}
+
+
+
e='bug_3613609'>bug_3613609 Tcl is a high-level, general-purpose, interpreted, dynamic programming language. It was designed with the goal of being very simple but powerful.
summaryrefslogtreecommitdiffstats
path: root/mac
diff options
context:
space:
mode:
authorwelch <welch>1999-08-10 02:42:36 (GMT)
committerwelch <welch>1999-08-10 02:42:36 (GMT)
commit24e9f11aa2c7e32ed6e8a0e6a2c7ae4f0ff12bac (patch)
tree3dda6d8125f2a42360c01e1206096b0d0bd753f3 /mac
parent3a26c6d4498ad6fad866d54c7b23cb221fe21898 (diff)
downloadtcl-24e9f11aa2c7e32ed6e8a0e6a2c7ae4f0ff12bac.zip
tcl-24e9f11aa2c7e32ed6e8a0e6a2c7ae4f0ff12bac.tar.gz
tcl-24e9f11aa2c7e32ed6e8a0e6a2c7ae4f0ff12bac.tar.bz2
Added Tcl_GetAllocMutex for use by tclAlloc.c and tclCkalloc.c
Diffstat (limited to 'mac')