PyString_AsString is permissive and accepts unicode strings.

Replace it with PyUnicode_AsString when the argument is known to be a str.
This commit is contained in:
Amaury Forgeot d'Arc 2007-11-22 02:48:12 +00:00
parent 484fcd4521
commit 39599dca9d
5 changed files with 9 additions and 9 deletions

View file

@ -2303,7 +2303,7 @@ test_c_api(PySetObject *so)
/* Exercise direct iteration */
i = 0, count = 0;
while (_PySet_Next((PyObject *)dup, &i, &x)) {
s = PyString_AsString(x);
s = PyUnicode_AsString(x);
assert(s && (s[0] == 'a' || s[0] == 'b' || s[0] == 'c'));
count++;
}