diff options
author | Fred Drake <fdrake@acm.org> | 2000-10-29 04:57:53 (GMT) |
---|---|---|
committer | Fred Drake <fdrake@acm.org> | 2000-10-29 04:57:53 (GMT) |
commit | 4ba298c3253d5c4d11cf822619457701b7b248c0 (patch) | |
tree | 5b8b00d7b91a5a4f15c11a92a20532e7be7486a3 /Modules/pyexpat.c | |
parent | 5f739befe5bab99950ee6fdcb635f7d3b2b57f5a (diff) | |
download | cpython-4ba298c3253d5c4d11cf822619457701b7b248c0.zip cpython-4ba298c3253d5c4d11cf822619457701b7b248c0.tar.gz cpython-4ba298c3253d5c4d11cf822619457701b7b248c0.tar.bz2 |
ParserCreate(): Added test that the namespace_separator value, if given,
has the required length.
initpyexpat(): Provide the type object for the ParserCreate() return
value as XMLParserType.
Diffstat (limited to 'Modules/pyexpat.c')
-rw-r--r-- | Modules/pyexpat.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/Modules/pyexpat.c b/Modules/pyexpat.c index 543648b..35530cf 100644 --- a/Modules/pyexpat.c +++ b/Modules/pyexpat.c @@ -826,6 +826,13 @@ pyexpat_ParserCreate(PyObject *notused, PyObject *args, PyObject *kw) if (!PyArg_ParseTupleAndKeywords(args, kw, "|zz:ParserCreate", kwlist, &encoding, &namespace_separator)) return NULL; + if (namespace_separator != NULL + && strlen(namespace_separator) != 1) { + PyErr_SetString(PyExc_ValueError, + "namespace_separator must be one character," + " omitted, or None"); + return NULL; + } return (PyObject *)newxmlparseobject(encoding, namespace_separator); } @@ -913,6 +920,8 @@ initpyexpat(void) ErrorObject = PyErr_NewException("xml.parsers.expat.error", NULL, NULL); PyModule_AddObject(m, "error", ErrorObject); + Py_INCREF(&Xmlparsetype); + PyModule_AddObject(m, "XMLParserType", (PyObject *) &Xmlparsetype); PyModule_AddObject(m, "__version__", PyString_FromStringAndSize(rev+11, strlen(rev+11)-2)); |