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
fd99d21b
Commit
fd99d21b
authored
Aug 25, 2013
by
Nick Coghlan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Close #18538: ``python -m dis`` now uses argparse.
Patch by Michele Orrù.
parent
38d63c7e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
19 deletions
+11
-19
Lib/dis.py
Lib/dis.py
+8
-19
Misc/NEWS
Misc/NEWS
+3
-0
No files found.
Lib/dis.py
View file @
fd99d21b
...
@@ -436,25 +436,14 @@ class Bytecode:
...
@@ -436,25 +436,14 @@ class Bytecode:
def
_test
():
def
_test
():
"""Simple test program to disassemble a file."""
"""Simple test program to disassemble a file."""
if
sys
.
argv
[
1
:]:
import
argparse
if
sys
.
argv
[
2
:]:
sys
.
stderr
.
write
(
"usage: python dis.py [-|file]
\
n
"
)
parser
=
argparse
.
ArgumentParser
()
sys
.
exit
(
2
)
parser
.
add_argument
(
'infile'
,
type
=
argparse
.
FileType
(),
nargs
=
'?'
,
default
=
'-'
)
fn
=
sys
.
argv
[
1
]
args
=
parser
.
parse_args
()
if
not
fn
or
fn
==
"-"
:
with
args
.
infile
as
infile
:
fn
=
None
source
=
infile
.
read
()
else
:
code
=
compile
(
source
,
args
.
infile
.
name
,
"exec"
)
fn
=
None
if
fn
is
None
:
f
=
sys
.
stdin
else
:
f
=
open
(
fn
)
source
=
f
.
read
()
if
fn
is
not
None
:
f
.
close
()
else
:
fn
=
"<stdin>"
code
=
compile
(
source
,
fn
,
"exec"
)
dis
(
code
)
dis
(
code
)
if
__name__
==
"__main__"
:
if
__name__
==
"__main__"
:
...
...
Misc/NEWS
View file @
fd99d21b
...
@@ -40,6 +40,9 @@ Core and Builtins
...
@@ -40,6 +40,9 @@ Core and Builtins
Library
Library
-------
-------
- Issue #18538: ``python -m dis`` now uses argparse for argument processing.
Patch by Michele Orrù.
- Issue #18394: Close cgi.FieldStorage'
s
optional
file
.
- Issue #18394: Close cgi.FieldStorage'
s
optional
file
.
-
Issue
#
17702
:
On
error
,
os
.
environb
now
removes
suppress
the
except
context
-
Issue
#
17702
:
On
error
,
os
.
environb
now
removes
suppress
the
except
context
...
...
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