Mercurial > cpython-lru_cache-weakref
diff Modules/_sqlite/cursor.c @ 43638:b10544827af7
Make str/str8 comparisons return True/False for !=/==.
Code that has been returning str8 becomes much more apparent thanks to this
(e.g., struct module returning str8 for all string-related formats or sqlite3
passing in str8 instances when converting objects that had a __conform__
method). One also has to watch out in C code when making a key from char *
using PyString in the C code but a str instance in Python code as that will not
longer compare equal.
Once str8 gains a constructor like the current bytes type then
test_modulefinder needs a cleanup as the fix is a little messy in that file.
Thanks goes to Thomas Lee for writing the patch for the change giving an
initial run-down of why most of the tests were failing.
| author | Brett Cannon <bcannon@gmail.com> |
|---|---|
| date | Mon, 22 Oct 2007 20:24:51 +0000 |
| parents | fab4089dab9f |
| children | 0d462d789b18 |
line wrap: on
line diff
--- a/Modules/_sqlite/cursor.c Mon Oct 22 16:16:13 2007 +0000 +++ b/Modules/_sqlite/cursor.c Mon Oct 22 20:24:51 2007 +0000 @@ -182,7 +182,7 @@ if (*pos == '[') { type_start = pos + 1; } else if (*pos == ']' && type_start != (const char*)-1) { - key = PyString_FromStringAndSize(type_start, pos - type_start); + key = PyUnicode_FromStringAndSize(type_start, pos - type_start); if (!key) { /* creating a string failed, but it is too complicated * to propagate the error here, we just assume there is @@ -203,7 +203,7 @@ if (decltype) { for (pos = decltype;;pos++) { if (*pos == ' ' || *pos == 0) { - py_decltype = PyString_FromStringAndSize(decltype, pos - decltype); + py_decltype = PyUnicode_FromStringAndSize(decltype, pos - decltype); if (!py_decltype) { return -1; }
