Fix some problems introduced by the str8 repr change.
This commit is contained in:
parent
a092947d26
commit
aa588c4699
|
@ -501,7 +501,8 @@ class Pickler:
|
|||
else:
|
||||
self.write(BINSTRING + pack("<i", n) + bytes(obj))
|
||||
else:
|
||||
self.write(STRING + bytes(repr(obj)) + b'\n')
|
||||
# Strip leading 's' due to repr() of str8() returning s'...'
|
||||
self.write(STRING + bytes(repr(obj).lstrip("s")) + b'\n')
|
||||
self.memoize(obj)
|
||||
dispatch[str8] = save_string
|
||||
|
||||
|
|
|
@ -18,8 +18,10 @@ if ' ' in python:
|
|||
python = '"' + python + '"' # quote embedded space for cmdline
|
||||
|
||||
class PopenTest(unittest.TestCase):
|
||||
|
||||
def _do_test_commandline(self, cmdline, expected):
|
||||
cmd = '%s -c "import sys; print(sys.argv)" %s' % (python, cmdline)
|
||||
cmd = '%s -c "import sys; print(list(map(str, sys.argv)))" %s'
|
||||
cmd = cmd % (python, cmdline)
|
||||
data = os.popen(cmd).read()
|
||||
got = eval(data)[1:] # strip off argv[0]
|
||||
self.assertEqual(got, expected)
|
||||
|
|
|
@ -1085,6 +1085,10 @@ save_string(Picklerobject *self, PyObject *args, int doput)
|
|||
goto err;
|
||||
repr_str = PyString_AS_STRING((PyStringObject *)repr);
|
||||
|
||||
/* Strip leading 's' due to repr() of str8() returning s'...' */
|
||||
if (repr_str[0] == 's')
|
||||
repr_str++;
|
||||
|
||||
if (self->write_func(self, &string, 1) < 0)
|
||||
goto err;
|
||||
|
||||
|
|
Loading…
Reference in New Issue