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
455f7bdc
Commit
455f7bdc
authored
Jul 27, 2010
by
Alexander Belopolsky
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #9378: python -m pickle <pickle file> will now load and display
the first object in the pickle file.
parent
9a381c7a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
1 deletion
+26
-1
Lib/pickle.py
Lib/pickle.py
+23
-1
Misc/NEWS
Misc/NEWS
+3
-0
No files found.
Lib/pickle.py
View file @
455f7bdc
...
...
@@ -1322,4 +1322,26 @@ def _test():
return
doctest
.
testmod
()
if
__name__
==
"__main__"
:
_test
()
import
sys
,
argparse
parser
=
argparse
.
ArgumentParser
(
description
=
'display contents of the pickle files'
)
parser
.
add_argument
(
'pickle_file'
,
type
=
argparse
.
FileType
(
'br'
),
nargs
=
'*'
,
help
=
'the pickle file'
)
parser
.
add_argument
(
'-t'
,
'--test'
,
action
=
'store_true'
,
help
=
'run self-test suite'
)
parser
.
add_argument
(
'-v'
,
action
=
'store_true'
,
help
=
'run verbosely; only affects self-test run'
)
args
=
parser
.
parse_args
()
if
args
.
test
:
_test
()
else
:
if
not
args
.
pickle_file
:
parser
.
print_help
()
else
:
import
pprint
for
f
in
args
.
pickle_file
:
obj
=
load
(
f
)
pprint
.
pprint
(
obj
)
Misc/NEWS
View file @
455f7bdc
...
...
@@ -473,6 +473,9 @@ C-API
Library
-------
- Issue #9378: python -m pickle <pickle file> will now load and
display the first object in the pickle file.
- Issue #4770: Restrict binascii module to accept only bytes (as specified).
And fix the email package to encode to ASCII instead of
``raw-unicode-escape`` before ASCII-to-binary decoding.
...
...
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