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
25c869ed
Unverified
Kaydet (Commit)
25c869ed
authored
Mar 31, 2018
tarafından
Serhiy Storchaka
Kaydeden (comit)
GitHub
Mar 31, 2018
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
[3.6] bpo-33132: Fix reference counting issues in the compiler. (GH-6209). (GH-6321)
(cherry picked from commit
a95d9860
)
üst
ddc99713
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
20 deletions
+11
-20
compile.c
Python/compile.c
+11
-20
No files found.
Python/compile.c
Dosyayı görüntüle @
25c869ed
...
@@ -2599,8 +2599,7 @@ compiler_import_as(struct compiler *c, identifier name, identifier asname)
...
@@ -2599,8 +2599,7 @@ compiler_import_as(struct compiler *c, identifier name, identifier asname)
PyUnicode_GET_LENGTH
(
name
));
PyUnicode_GET_LENGTH
(
name
));
if
(
!
attr
)
if
(
!
attr
)
return
0
;
return
0
;
ADDOP_O
(
c
,
LOAD_ATTR
,
attr
,
names
);
ADDOP_N
(
c
,
LOAD_ATTR
,
attr
,
names
);
Py_DECREF
(
attr
);
pos
=
dot
+
1
;
pos
=
dot
+
1
;
}
}
}
}
...
@@ -2628,8 +2627,7 @@ compiler_import(struct compiler *c, stmt_ty s)
...
@@ -2628,8 +2627,7 @@ compiler_import(struct compiler *c, stmt_ty s)
if
(
level
==
NULL
)
if
(
level
==
NULL
)
return
0
;
return
0
;
ADDOP_O
(
c
,
LOAD_CONST
,
level
,
consts
);
ADDOP_N
(
c
,
LOAD_CONST
,
level
,
consts
);
Py_DECREF
(
level
);
ADDOP_O
(
c
,
LOAD_CONST
,
Py_None
,
consts
);
ADDOP_O
(
c
,
LOAD_CONST
,
Py_None
,
consts
);
ADDOP_NAME
(
c
,
IMPORT_NAME
,
alias
->
name
,
names
);
ADDOP_NAME
(
c
,
IMPORT_NAME
,
alias
->
name
,
names
);
...
@@ -2662,9 +2660,7 @@ static int
...
@@ -2662,9 +2660,7 @@ static int
compiler_from_import
(
struct
compiler
*
c
,
stmt_ty
s
)
compiler_from_import
(
struct
compiler
*
c
,
stmt_ty
s
)
{
{
Py_ssize_t
i
,
n
=
asdl_seq_LEN
(
s
->
v
.
ImportFrom
.
names
);
Py_ssize_t
i
,
n
=
asdl_seq_LEN
(
s
->
v
.
ImportFrom
.
names
);
PyObject
*
level
,
*
names
;
PyObject
*
names
=
PyTuple_New
(
n
);
PyObject
*
level
;
static
PyObject
*
empty_string
;
static
PyObject
*
empty_string
;
if
(
!
empty_string
)
{
if
(
!
empty_string
)
{
...
@@ -2673,14 +2669,15 @@ compiler_from_import(struct compiler *c, stmt_ty s)
...
@@ -2673,14 +2669,15 @@ compiler_from_import(struct compiler *c, stmt_ty s)
return
0
;
return
0
;
}
}
if
(
!
names
)
return
0
;
level
=
PyLong_FromLong
(
s
->
v
.
ImportFrom
.
level
);
level
=
PyLong_FromLong
(
s
->
v
.
ImportFrom
.
level
);
if
(
!
level
)
{
if
(
!
level
)
{
Py_DECREF
(
names
);
return
0
;
return
0
;
}
}
ADDOP_N
(
c
,
LOAD_CONST
,
level
,
consts
);
names
=
PyTuple_New
(
n
);
if
(
!
names
)
return
0
;
/* build up the names */
/* build up the names */
for
(
i
=
0
;
i
<
n
;
i
++
)
{
for
(
i
=
0
;
i
<
n
;
i
++
)
{
...
@@ -2691,16 +2688,12 @@ compiler_from_import(struct compiler *c, stmt_ty s)
...
@@ -2691,16 +2688,12 @@ compiler_from_import(struct compiler *c, stmt_ty s)
if
(
s
->
lineno
>
c
->
c_future
->
ff_lineno
&&
s
->
v
.
ImportFrom
.
module
&&
if
(
s
->
lineno
>
c
->
c_future
->
ff_lineno
&&
s
->
v
.
ImportFrom
.
module
&&
_PyUnicode_EqualToASCIIString
(
s
->
v
.
ImportFrom
.
module
,
"__future__"
))
{
_PyUnicode_EqualToASCIIString
(
s
->
v
.
ImportFrom
.
module
,
"__future__"
))
{
Py_DECREF
(
level
);
Py_DECREF
(
names
);
Py_DECREF
(
names
);
return
compiler_error
(
c
,
"from __future__ imports must occur "
return
compiler_error
(
c
,
"from __future__ imports must occur "
"at the beginning of the file"
);
"at the beginning of the file"
);
}
}
ADDOP_N
(
c
,
LOAD_CONST
,
names
,
consts
);
ADDOP_O
(
c
,
LOAD_CONST
,
level
,
consts
);
Py_DECREF
(
level
);
ADDOP_O
(
c
,
LOAD_CONST
,
names
,
consts
);
Py_DECREF
(
names
);
if
(
s
->
v
.
ImportFrom
.
module
)
{
if
(
s
->
v
.
ImportFrom
.
module
)
{
ADDOP_NAME
(
c
,
IMPORT_NAME
,
s
->
v
.
ImportFrom
.
module
,
names
);
ADDOP_NAME
(
c
,
IMPORT_NAME
,
s
->
v
.
ImportFrom
.
module
,
names
);
}
}
...
@@ -2723,7 +2716,6 @@ compiler_from_import(struct compiler *c, stmt_ty s)
...
@@ -2723,7 +2716,6 @@ compiler_from_import(struct compiler *c, stmt_ty s)
store_name
=
alias
->
asname
;
store_name
=
alias
->
asname
;
if
(
!
compiler_nameop
(
c
,
store_name
,
Store
))
{
if
(
!
compiler_nameop
(
c
,
store_name
,
Store
))
{
Py_DECREF
(
names
);
return
0
;
return
0
;
}
}
}
}
...
@@ -3101,8 +3093,7 @@ compiler_nameop(struct compiler *c, identifier name, expr_context_ty ctx)
...
@@ -3101,8 +3093,7 @@ compiler_nameop(struct compiler *c, identifier name, expr_context_ty ctx)
"param invalid for local variable"
);
"param invalid for local variable"
);
return
0
;
return
0
;
}
}
ADDOP_O
(
c
,
op
,
mangled
,
varnames
);
ADDOP_N
(
c
,
op
,
mangled
,
varnames
);
Py_DECREF
(
mangled
);
return
1
;
return
1
;
case
OP_GLOBAL
:
case
OP_GLOBAL
:
switch
(
ctx
)
{
switch
(
ctx
)
{
...
@@ -4552,11 +4543,11 @@ compiler_annassign(struct compiler *c, stmt_ty s)
...
@@ -4552,11 +4543,11 @@ compiler_annassign(struct compiler *c, stmt_ty s)
if
(
s
->
v
.
AnnAssign
.
simple
&&
if
(
s
->
v
.
AnnAssign
.
simple
&&
(
c
->
u
->
u_scope_type
==
COMPILER_SCOPE_MODULE
||
(
c
->
u
->
u_scope_type
==
COMPILER_SCOPE_MODULE
||
c
->
u
->
u_scope_type
==
COMPILER_SCOPE_CLASS
))
{
c
->
u
->
u_scope_type
==
COMPILER_SCOPE_CLASS
))
{
VISIT
(
c
,
expr
,
s
->
v
.
AnnAssign
.
annotation
);
mangled
=
_Py_Mangle
(
c
->
u
->
u_private
,
targ
->
v
.
Name
.
id
);
mangled
=
_Py_Mangle
(
c
->
u
->
u_private
,
targ
->
v
.
Name
.
id
);
if
(
!
mangled
)
{
if
(
!
mangled
)
{
return
0
;
return
0
;
}
}
VISIT
(
c
,
expr
,
s
->
v
.
AnnAssign
.
annotation
);
/* ADDOP_N decrefs its argument */
/* ADDOP_N decrefs its argument */
ADDOP_N
(
c
,
STORE_ANNOTATION
,
mangled
,
names
);
ADDOP_N
(
c
,
STORE_ANNOTATION
,
mangled
,
names
);
}
}
...
...
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