Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
e2732d3e
Unverified
Kaydet (Commit)
e2732d3e
authored
Mar 11, 2018
tarafından
Serhiy Storchaka
Kaydeden (comit)
GitHub
Mar 11, 2018
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
bpo-32970: Improve disassembly of the MAKE_FUNCTION instruction. (GH-5937)
üst
3f7e9aa2
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
6 deletions
+19
-6
dis.py
Lib/dis.py
+14
-2
test_dis.py
Lib/test/test_dis.py
+4
-4
2018-02-28-18-39-48.bpo-32970.IPWtbS.rst
...S.d/next/Library/2018-02-28-18-39-48.bpo-32970.IPWtbS.rst
+1
-0
No files found.
Lib/dis.py
Dosyayı görüntüle @
e2732d3e
...
...
@@ -17,6 +17,15 @@ _have_code = (types.MethodType, types.FunctionType, types.CodeType,
classmethod
,
staticmethod
,
type
)
FORMAT_VALUE
=
opmap
[
'FORMAT_VALUE'
]
FORMAT_VALUE_CONVERTERS
=
(
(
None
,
''
),
(
str
,
'str'
),
(
repr
,
'repr'
),
(
ascii
,
'ascii'
),
)
MAKE_FUNCTION
=
opmap
[
'MAKE_FUNCTION'
]
MAKE_FUNCTION_FLAGS
=
(
'defaults'
,
'kwdefaults'
,
'annotations'
,
'closure'
)
def
_try_compile
(
source
,
name
):
"""Attempts to compile the given source, first as an expression and
...
...
@@ -339,12 +348,15 @@ def _get_instructions_bytes(code, varnames=None, names=None, constants=None,
elif
op
in
hasfree
:
argval
,
argrepr
=
_get_name_info
(
arg
,
cells
)
elif
op
==
FORMAT_VALUE
:
argval
=
((
None
,
str
,
repr
,
ascii
)[
arg
&
0x3
],
bool
(
arg
&
0x4
))
arg
repr
=
(
''
,
'str'
,
'repr'
,
'ascii'
)[
arg
&
0x3
]
argval
,
argrepr
=
FORMAT_VALUE_CONVERTERS
[
arg
&
0x3
]
arg
val
=
(
argval
,
bool
(
arg
&
0x4
))
if
argval
[
1
]:
if
argrepr
:
argrepr
+=
', '
argrepr
+=
'with format'
elif
op
==
MAKE_FUNCTION
:
argrepr
=
', '
.
join
(
s
for
i
,
s
in
enumerate
(
MAKE_FUNCTION_FLAGS
)
if
arg
&
(
1
<<
i
))
yield
Instruction
(
opname
[
op
],
op
,
arg
,
argval
,
argrepr
,
offset
,
starts_line
,
is_jump_target
)
...
...
Lib/test/test_dis.py
Dosyayı görüntüle @
e2732d3e
...
...
@@ -348,7 +348,7 @@ dis_nested_0 = """\
2 BUILD_TUPLE 1
4 LOAD_CONST 1 (<code object foo at 0x..., file "
%
s", line
%
d>)
6 LOAD_CONST 2 ('_h.<locals>.foo')
8 MAKE_FUNCTION 8
8 MAKE_FUNCTION 8
(closure)
10 STORE_FAST 1 (foo)
%3
d 12 LOAD_FAST 1 (foo)
...
...
@@ -365,7 +365,7 @@ Disassembly of <code object foo at 0x..., file "%s", line %d>:
2 BUILD_TUPLE 1
4 LOAD_CONST 1 (<code object <listcomp> at 0x..., file "
%
s", line
%
d>)
6 LOAD_CONST 2 ('_h.<locals>.foo.<locals>.<listcomp>')
8 MAKE_FUNCTION 8
8 MAKE_FUNCTION 8
(closure)
10 LOAD_DEREF 1 (y)
12 GET_ITER
14 CALL_FUNCTION 1
...
...
@@ -862,7 +862,7 @@ expected_opinfo_outer = [
Instruction
(
opname
=
'BUILD_TUPLE'
,
opcode
=
102
,
arg
=
2
,
argval
=
2
,
argrepr
=
''
,
offset
=
6
,
starts_line
=
None
,
is_jump_target
=
False
),
Instruction
(
opname
=
'LOAD_CONST'
,
opcode
=
100
,
arg
=
3
,
argval
=
code_object_f
,
argrepr
=
repr
(
code_object_f
),
offset
=
8
,
starts_line
=
None
,
is_jump_target
=
False
),
Instruction
(
opname
=
'LOAD_CONST'
,
opcode
=
100
,
arg
=
4
,
argval
=
'outer.<locals>.f'
,
argrepr
=
"'outer.<locals>.f'"
,
offset
=
10
,
starts_line
=
None
,
is_jump_target
=
False
),
Instruction
(
opname
=
'MAKE_FUNCTION'
,
opcode
=
132
,
arg
=
9
,
argval
=
9
,
argrepr
=
''
,
offset
=
12
,
starts_line
=
None
,
is_jump_target
=
False
),
Instruction
(
opname
=
'MAKE_FUNCTION'
,
opcode
=
132
,
arg
=
9
,
argval
=
9
,
argrepr
=
'
defaults, closure
'
,
offset
=
12
,
starts_line
=
None
,
is_jump_target
=
False
),
Instruction
(
opname
=
'STORE_FAST'
,
opcode
=
125
,
arg
=
2
,
argval
=
'f'
,
argrepr
=
'f'
,
offset
=
14
,
starts_line
=
None
,
is_jump_target
=
False
),
Instruction
(
opname
=
'LOAD_GLOBAL'
,
opcode
=
116
,
arg
=
0
,
argval
=
'print'
,
argrepr
=
'print'
,
offset
=
16
,
starts_line
=
7
,
is_jump_target
=
False
),
Instruction
(
opname
=
'LOAD_DEREF'
,
opcode
=
136
,
arg
=
0
,
argval
=
'a'
,
argrepr
=
'a'
,
offset
=
18
,
starts_line
=
None
,
is_jump_target
=
False
),
...
...
@@ -887,7 +887,7 @@ expected_opinfo_f = [
Instruction
(
opname
=
'BUILD_TUPLE'
,
opcode
=
102
,
arg
=
4
,
argval
=
4
,
argrepr
=
''
,
offset
=
10
,
starts_line
=
None
,
is_jump_target
=
False
),
Instruction
(
opname
=
'LOAD_CONST'
,
opcode
=
100
,
arg
=
3
,
argval
=
code_object_inner
,
argrepr
=
repr
(
code_object_inner
),
offset
=
12
,
starts_line
=
None
,
is_jump_target
=
False
),
Instruction
(
opname
=
'LOAD_CONST'
,
opcode
=
100
,
arg
=
4
,
argval
=
'outer.<locals>.f.<locals>.inner'
,
argrepr
=
"'outer.<locals>.f.<locals>.inner'"
,
offset
=
14
,
starts_line
=
None
,
is_jump_target
=
False
),
Instruction
(
opname
=
'MAKE_FUNCTION'
,
opcode
=
132
,
arg
=
9
,
argval
=
9
,
argrepr
=
''
,
offset
=
16
,
starts_line
=
None
,
is_jump_target
=
False
),
Instruction
(
opname
=
'MAKE_FUNCTION'
,
opcode
=
132
,
arg
=
9
,
argval
=
9
,
argrepr
=
'
defaults, closure
'
,
offset
=
16
,
starts_line
=
None
,
is_jump_target
=
False
),
Instruction
(
opname
=
'STORE_FAST'
,
opcode
=
125
,
arg
=
2
,
argval
=
'inner'
,
argrepr
=
'inner'
,
offset
=
18
,
starts_line
=
None
,
is_jump_target
=
False
),
Instruction
(
opname
=
'LOAD_GLOBAL'
,
opcode
=
116
,
arg
=
0
,
argval
=
'print'
,
argrepr
=
'print'
,
offset
=
20
,
starts_line
=
5
,
is_jump_target
=
False
),
Instruction
(
opname
=
'LOAD_DEREF'
,
opcode
=
136
,
arg
=
2
,
argval
=
'a'
,
argrepr
=
'a'
,
offset
=
22
,
starts_line
=
None
,
is_jump_target
=
False
),
...
...
Misc/NEWS.d/next/Library/2018-02-28-18-39-48.bpo-32970.IPWtbS.rst
0 → 100644
Dosyayı görüntüle @
e2732d3e
Improved disassembly of the MAKE_FUNCTION instruction.
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