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
332cd5ee
Kaydet (Commit)
332cd5ee
authored
Ock 30, 2018
tarafından
Mark Shannon
Kaydeden (comit)
Raymond Hettinger
Ock 30, 2018
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
bpo-32550. Remove the STORE_ANNOTATION bytecode. (GH-5181)
üst
b6e43af6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
37 additions
and
89 deletions
+37
-89
dis.rst
Doc/library/dis.rst
+0
-7
3.7.rst
Doc/whatsnew/3.7.rst
+2
-0
opcode.h
Include/opcode.h
+0
-1
_bootstrap_external.py
Lib/importlib/_bootstrap_external.py
+2
-1
opcode.py
Lib/opcode.py
+0
-1
test_dis.py
Lib/test/test_dis.py
+21
-17
2018-01-14-12-42-17.bpo-32550.k0EK-4.rst
...ore and Builtins/2018-01-14-12-42-17.bpo-32550.k0EK-4.rst
+1
-0
ceval.c
Python/ceval.c
+0
-55
compile.c
Python/compile.c
+10
-6
importlib_external.h
Python/importlib_external.h
+0
-0
opcode_targets.h
Python/opcode_targets.h
+1
-1
No files found.
Doc/library/dis.rst
Dosyayı görüntüle @
332cd5ee
...
@@ -993,13 +993,6 @@ All of the following opcodes use their arguments.
...
@@ -993,13 +993,6 @@ All of the following opcodes use their arguments.
Deletes local ``co_varnames[var_num]``.
Deletes local ``co_varnames[var_num]``.
.. opcode:: STORE_ANNOTATION (namei)
Stores TOS as ``locals()['__annotations__'][co_names[namei]] = TOS``.
.. versionadded:: 3.6
.. opcode:: LOAD_CLOSURE (i)
.. opcode:: LOAD_CLOSURE (i)
Pushes a reference to the cell contained in slot *i* of the cell and free
Pushes a reference to the cell contained in slot *i* of the cell and free
...
...
Doc/whatsnew/3.7.rst
Dosyayı görüntüle @
332cd5ee
...
@@ -1173,6 +1173,8 @@ CPython bytecode changes
...
@@ -1173,6 +1173,8 @@ CPython bytecode changes
* Added two new opcodes: :opcode:`LOAD_METHOD` and :opcode:`CALL_METHOD`.
* Added two new opcodes: :opcode:`LOAD_METHOD` and :opcode:`CALL_METHOD`.
(Contributed by Yury Selivanov and INADA Naoki in :issue:`26110`.)
(Contributed by Yury Selivanov and INADA Naoki in :issue:`26110`.)
* Removed the STORE_ANNOTATION opcode.
Other CPython implementation changes
Other CPython implementation changes
------------------------------------
------------------------------------
...
...
Include/opcode.h
Dosyayı görüntüle @
332cd5ee
...
@@ -99,7 +99,6 @@ extern "C" {
...
@@ -99,7 +99,6 @@ extern "C" {
#define LOAD_FAST 124
#define LOAD_FAST 124
#define STORE_FAST 125
#define STORE_FAST 125
#define DELETE_FAST 126
#define DELETE_FAST 126
#define STORE_ANNOTATION 127
#define RAISE_VARARGS 130
#define RAISE_VARARGS 130
#define CALL_FUNCTION 131
#define CALL_FUNCTION 131
#define MAKE_FUNCTION 132
#define MAKE_FUNCTION 132
...
...
Lib/importlib/_bootstrap_external.py
Dosyayı görüntüle @
332cd5ee
...
@@ -242,6 +242,7 @@ _code_type = type(_write_atomic.__code__)
...
@@ -242,6 +242,7 @@ _code_type = type(_write_atomic.__code__)
# Python 3.7a0 3390 (add LOAD_METHOD and CALL_METHOD opcodes)
# Python 3.7a0 3390 (add LOAD_METHOD and CALL_METHOD opcodes)
# Python 3.7a0 3391 (update GET_AITER #31709)
# Python 3.7a0 3391 (update GET_AITER #31709)
# Python 3.7a0 3392 (PEP 552: Deterministic pycs)
# Python 3.7a0 3392 (PEP 552: Deterministic pycs)
# Python 3.7a0 3393 (remove STORE_ANNOTATION opcode)
#
#
# MAGIC must change whenever the bytecode emitted by the compiler may no
# MAGIC must change whenever the bytecode emitted by the compiler may no
# longer be understood by older implementations of the eval loop (usually
# longer be understood by older implementations of the eval loop (usually
...
@@ -250,7 +251,7 @@ _code_type = type(_write_atomic.__code__)
...
@@ -250,7 +251,7 @@ _code_type = type(_write_atomic.__code__)
# Whenever MAGIC_NUMBER is changed, the ranges in the magic_values array
# Whenever MAGIC_NUMBER is changed, the ranges in the magic_values array
# in PC/launcher.c must also be updated.
# in PC/launcher.c must also be updated.
MAGIC_NUMBER
=
(
339
2
)
.
to_bytes
(
2
,
'little'
)
+
b
'
\r\n
'
MAGIC_NUMBER
=
(
339
3
)
.
to_bytes
(
2
,
'little'
)
+
b
'
\r\n
'
_RAW_MAGIC_NUMBER
=
int
.
from_bytes
(
MAGIC_NUMBER
,
'little'
)
# For import.c
_RAW_MAGIC_NUMBER
=
int
.
from_bytes
(
MAGIC_NUMBER
,
'little'
)
# For import.c
_PYCACHE
=
'__pycache__'
_PYCACHE
=
'__pycache__'
...
...
Lib/opcode.py
Dosyayı görüntüle @
332cd5ee
...
@@ -169,7 +169,6 @@ def_op('STORE_FAST', 125) # Local variable number
...
@@ -169,7 +169,6 @@ def_op('STORE_FAST', 125) # Local variable number
haslocal
.
append
(
125
)
haslocal
.
append
(
125
)
def_op
(
'DELETE_FAST'
,
126
)
# Local variable number
def_op
(
'DELETE_FAST'
,
126
)
# Local variable number
haslocal
.
append
(
126
)
haslocal
.
append
(
126
)
name_op
(
'STORE_ANNOTATION'
,
127
)
# Index in name list
def_op
(
'RAISE_VARARGS'
,
130
)
# Number of raise arguments (1, 2, or 3)
def_op
(
'RAISE_VARARGS'
,
130
)
# Number of raise arguments (1, 2, or 3)
def_op
(
'CALL_FUNCTION'
,
131
)
# #args
def_op
(
'CALL_FUNCTION'
,
131
)
# #args
...
...
Lib/test/test_dis.py
Dosyayı görüntüle @
332cd5ee
...
@@ -226,23 +226,27 @@ dis_annot_stmt_str = """\
...
@@ -226,23 +226,27 @@ dis_annot_stmt_str = """\
2 LOAD_CONST 0 (1)
2 LOAD_CONST 0 (1)
4 STORE_NAME 0 (x)
4 STORE_NAME 0 (x)
6 LOAD_NAME 1 (int)
6 LOAD_NAME 1 (int)
8 STORE_ANNOTATION 0 (x)
8 LOAD_NAME 2 (__annotations__)
10 LOAD_CONST 1 ('x')
3 10 LOAD_NAME 2 (fun)
12 STORE_SUBSCR
12 LOAD_CONST 0 (1)
14 CALL_FUNCTION 1
3 14 LOAD_NAME 3 (fun)
16 STORE_ANNOTATION 3 (y)
16 LOAD_CONST 0 (1)
18 CALL_FUNCTION 1
4 18 LOAD_CONST 0 (1)
20 LOAD_NAME 2 (__annotations__)
20 LOAD_NAME 4 (lst)
22 LOAD_CONST 2 ('y')
22 LOAD_NAME 2 (fun)
24 STORE_SUBSCR
24 LOAD_CONST 1 (0)
26 CALL_FUNCTION 1
4 26 LOAD_CONST 0 (1)
28 STORE_SUBSCR
28 LOAD_NAME 4 (lst)
30 LOAD_NAME 1 (int)
30 LOAD_NAME 3 (fun)
32 POP_TOP
32 LOAD_CONST 3 (0)
34 LOAD_CONST 2 (None)
34 CALL_FUNCTION 1
36 RETURN_VALUE
36 STORE_SUBSCR
38 LOAD_NAME 1 (int)
40 POP_TOP
42 LOAD_CONST 4 (None)
44 RETURN_VALUE
"""
"""
compound_stmt_str
=
"""
\
compound_stmt_str
=
"""
\
...
...
Misc/NEWS.d/next/Core and Builtins/2018-01-14-12-42-17.bpo-32550.k0EK-4.rst
0 → 100644
Dosyayı görüntüle @
332cd5ee
Remove the STORE_ANNOTATION bytecode.
Python/ceval.c
Dosyayı görüntüle @
332cd5ee
...
@@ -1574,61 +1574,6 @@ _PyEval_EvalFrameDefault(PyFrameObject *f, int throwflag)
...
@@ -1574,61 +1574,6 @@ _PyEval_EvalFrameDefault(PyFrameObject *f, int throwflag)
DISPATCH
();
DISPATCH
();
}
}
TARGET
(
STORE_ANNOTATION
)
{
_Py_IDENTIFIER
(
__annotations__
);
PyObject
*
ann_dict
;
PyObject
*
ann
=
POP
();
PyObject
*
name
=
GETITEM
(
names
,
oparg
);
int
err
;
if
(
f
->
f_locals
==
NULL
)
{
PyErr_Format
(
PyExc_SystemError
,
"no locals found when storing annotation"
);
Py_DECREF
(
ann
);
goto
error
;
}
/* first try to get __annotations__ from locals... */
if
(
PyDict_CheckExact
(
f
->
f_locals
))
{
ann_dict
=
_PyDict_GetItemId
(
f
->
f_locals
,
&
PyId___annotations__
);
if
(
ann_dict
==
NULL
)
{
PyErr_SetString
(
PyExc_NameError
,
"__annotations__ not found"
);
Py_DECREF
(
ann
);
goto
error
;
}
Py_INCREF
(
ann_dict
);
}
else
{
PyObject
*
ann_str
=
_PyUnicode_FromId
(
&
PyId___annotations__
);
if
(
ann_str
==
NULL
)
{
Py_DECREF
(
ann
);
goto
error
;
}
ann_dict
=
PyObject_GetItem
(
f
->
f_locals
,
ann_str
);
if
(
ann_dict
==
NULL
)
{
if
(
PyErr_ExceptionMatches
(
PyExc_KeyError
))
{
PyErr_SetString
(
PyExc_NameError
,
"__annotations__ not found"
);
}
Py_DECREF
(
ann
);
goto
error
;
}
}
/* ...if succeeded, __annotations__[name] = ann */
if
(
PyDict_CheckExact
(
ann_dict
))
{
err
=
PyDict_SetItem
(
ann_dict
,
name
,
ann
);
}
else
{
err
=
PyObject_SetItem
(
ann_dict
,
name
,
ann
);
}
Py_DECREF
(
ann_dict
);
Py_DECREF
(
ann
);
if
(
err
!=
0
)
{
goto
error
;
}
DISPATCH
();
}
TARGET
(
DELETE_SUBSCR
)
{
TARGET
(
DELETE_SUBSCR
)
{
PyObject
*
sub
=
TOP
();
PyObject
*
sub
=
TOP
();
PyObject
*
container
=
SECOND
();
PyObject
*
container
=
SECOND
();
...
...
Python/compile.c
Dosyayı görüntüle @
332cd5ee
...
@@ -213,7 +213,7 @@ static int compiler_async_comprehension_generator(
...
@@ -213,7 +213,7 @@ static int compiler_async_comprehension_generator(
expr_ty
elt
,
expr_ty
val
,
int
type
);
expr_ty
elt
,
expr_ty
val
,
int
type
);
static
PyCodeObject
*
assemble
(
struct
compiler
*
,
int
addNone
);
static
PyCodeObject
*
assemble
(
struct
compiler
*
,
int
addNone
);
static
PyObject
*
__doc__
;
static
PyObject
*
__doc__
,
*
__annotations__
;
#define CAPSULE_NAME "compile.c compiler unit"
#define CAPSULE_NAME "compile.c compiler unit"
...
@@ -311,7 +311,11 @@ PyAST_CompileObject(mod_ty mod, PyObject *filename, PyCompilerFlags *flags,
...
@@ -311,7 +311,11 @@ PyAST_CompileObject(mod_ty mod, PyObject *filename, PyCompilerFlags *flags,
if
(
!
__doc__
)
if
(
!
__doc__
)
return
NULL
;
return
NULL
;
}
}
if
(
!
__annotations__
)
{
__annotations__
=
PyUnicode_InternFromString
(
"__annotations__"
);
if
(
!
__annotations__
)
return
NULL
;
}
if
(
!
compiler_init
(
&
c
))
if
(
!
compiler_init
(
&
c
))
return
NULL
;
return
NULL
;
Py_INCREF
(
filename
);
Py_INCREF
(
filename
);
...
@@ -1056,8 +1060,6 @@ stack_effect(int opcode, int oparg, int jump)
...
@@ -1056,8 +1060,6 @@ stack_effect(int opcode, int oparg, int jump)
return
-
1
;
return
-
1
;
case
DELETE_FAST
:
case
DELETE_FAST
:
return
0
;
return
0
;
case
STORE_ANNOTATION
:
return
-
1
;
case
RAISE_VARARGS
:
case
RAISE_VARARGS
:
return
-
oparg
;
return
-
oparg
;
...
@@ -4711,8 +4713,10 @@ compiler_annassign(struct compiler *c, stmt_ty s)
...
@@ -4711,8 +4713,10 @@ compiler_annassign(struct compiler *c, stmt_ty s)
else
{
else
{
VISIT
(
c
,
expr
,
s
->
v
.
AnnAssign
.
annotation
);
VISIT
(
c
,
expr
,
s
->
v
.
AnnAssign
.
annotation
);
}
}
/* ADDOP_N decrefs its argument */
ADDOP_NAME
(
c
,
LOAD_NAME
,
__annotations__
,
names
);
ADDOP_N
(
c
,
STORE_ANNOTATION
,
mangled
,
names
);
ADDOP_O
(
c
,
LOAD_CONST
,
mangled
,
consts
);
Py_DECREF
(
mangled
);
ADDOP
(
c
,
STORE_SUBSCR
);
}
}
break
;
break
;
case
Attribute_kind
:
case
Attribute_kind
:
...
...
Python/importlib_external.h
Dosyayı görüntüle @
332cd5ee
This diff is collapsed.
Click to expand it.
Python/opcode_targets.h
Dosyayı görüntüle @
332cd5ee
...
@@ -126,7 +126,7 @@ static void *opcode_targets[256] = {
...
@@ -126,7 +126,7 @@ static void *opcode_targets[256] = {
&&
TARGET_LOAD_FAST
,
&&
TARGET_LOAD_FAST
,
&&
TARGET_STORE_FAST
,
&&
TARGET_STORE_FAST
,
&&
TARGET_DELETE_FAST
,
&&
TARGET_DELETE_FAST
,
&&
TARGET_STORE_ANNOTATION
,
&&
_unknown_opcode
,
&&
_unknown_opcode
,
&&
_unknown_opcode
,
&&
_unknown_opcode
,
&&
_unknown_opcode
,
&&
TARGET_RAISE_VARARGS
,
&&
TARGET_RAISE_VARARGS
,
...
...
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