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

@ -1299,7 +1299,7 @@ ast_for_atom(struct compiling *c, const node *n)
if (errstr) {
char *s = "";
char buf[128];
s = PyString_AsString(errstr);
s = PyUnicode_AsString(errstr);
PyOS_snprintf(buf, sizeof(buf), "(unicode error) %s", s);
ast_error(n, buf);
} else {