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.
This commit is contained in:
Brett Cannon 2007-10-22 20:24:51 +00:00
parent 6464d47195
commit 4043001f5d
11 changed files with 167 additions and 203 deletions

View file

@ -24,7 +24,7 @@ else:
# shutdown time. That frustrates tests trying to check stderr produced
# from a spawned Python process.
def remove_stderr_debug_decorations(stderr):
return re.sub(r"\[\d+ refs\]\r?\n?$", "", str8(stderr))
return re.sub(r"\[\d+ refs\]\r?\n?$", "", str(stderr))
class ProcessTestCase(unittest.TestCase):
def setUp(self):