[Python-Dev] [Python-checkins] cpython: Issue #19209: fix structseq test

Victor Stinner victor.stinner at gmail.com
Sat Oct 12 03:16:36 CEST 2013


2013/10/12 Nick Coghlan <ncoghlan at gmail.com>:
>> summary:
>>   Issue #19209: fix structseq test
>>
>> diff --git a/Lib/test/test_structseq.py b/Lib/test/test_structseq.py
>> --- a/Lib/test/test_structseq.py
>> +++ b/Lib/test/test_structseq.py
>> @@ -38,7 +38,7 @@
>>          # os.stat() gives a complicated struct sequence.
>>          st = os.stat(__file__)
>>          rep = repr(st)
>> -        self.assertTrue(rep.startswith(os.name + ".stat_result"))
>> +        self.assertTrue(rep.startswith("os.stat_result"))
>
> If stat results can be pickled, this suggests a possible issue with
> unpickling pickles generated with older versions of Python.

This change should not break the backward compatibility. The os module
was using a copyreg "hack" (is it the good name?) to replace "posix"
with "os" when a os.stat or os.statvfs object was serialized with
pickle. See the issue for information.

Victor


More information about the Python-Dev mailing list