Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
aa588c46
Commit
aa588c46
authored
Jun 15, 2007
by
Guido van Rossum
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix some problems introduced by the str8 repr change.
parent
a092947d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
2 deletions
+9
-2
Lib/pickle.py
Lib/pickle.py
+2
-1
Lib/test/test_popen.py
Lib/test/test_popen.py
+3
-1
Modules/cPickle.c
Modules/cPickle.c
+4
-0
No files found.
Lib/pickle.py
View file @
aa588c46
...
@@ -501,7 +501,8 @@ class Pickler:
...
@@ -501,7 +501,8 @@ class Pickler:
else
:
else
:
self
.
write
(
BINSTRING
+
pack
(
"<i"
,
n
)
+
bytes
(
obj
))
self
.
write
(
BINSTRING
+
pack
(
"<i"
,
n
)
+
bytes
(
obj
))
else
:
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
)
self
.
memoize
(
obj
)
dispatch
[
str8
]
=
save_string
dispatch
[
str8
]
=
save_string
...
...
Lib/test/test_popen.py
View file @
aa588c46
...
@@ -18,8 +18,10 @@ if ' ' in python:
...
@@ -18,8 +18,10 @@ if ' ' in python:
python
=
'"'
+
python
+
'"'
# quote embedded space for cmdline
python
=
'"'
+
python
+
'"'
# quote embedded space for cmdline
class
PopenTest
(
unittest
.
TestCase
):
class
PopenTest
(
unittest
.
TestCase
):
def
_do_test_commandline
(
self
,
cmdline
,
expected
):
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
()
data
=
os
.
popen
(
cmd
).
read
()
got
=
eval
(
data
)[
1
:]
# strip off argv[0]
got
=
eval
(
data
)[
1
:]
# strip off argv[0]
self
.
assertEqual
(
got
,
expected
)
self
.
assertEqual
(
got
,
expected
)
...
...
Modules/cPickle.c
View file @
aa588c46
...
@@ -1085,6 +1085,10 @@ save_string(Picklerobject *self, PyObject *args, int doput)
...
@@ -1085,6 +1085,10 @@ save_string(Picklerobject *self, PyObject *args, int doput)
goto
err
;
goto
err
;
repr_str
=
PyString_AS_STRING
((
PyStringObject
*
)
repr
);
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
)
if
(
self
->
write_func
(
self
,
&
string
,
1
)
<
0
)
goto
err
;
goto
err
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment