Commit 7d5baac8 authored by Guido van Rossum's avatar Guido van Rossum

posix.confname(): enforce that names as str instances.

parent 26d95c3d
......@@ -5455,11 +5455,15 @@ conv_confname(PyObject *arg, int *valuep, struct constdef *table,
int cmp;
const char *confname;
Py_ssize_t namelen;
if (PyObject_AsCharBuffer(arg, &confname, &namelen) < 0) {
if (!PyUnicode_Check(arg)) {
PyErr_SetString(PyExc_TypeError,
"configuration names must be strings or integers");
return 0;
}
confname = PyUnicode_AsString(arg);
if (confname == NULL)
return 0;
namelen = strlen(confname);
while (lo < hi) {
mid = (lo + hi) / 2;
cmp = strcmp(confname, table[mid].name);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment