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
265fcc5f
Kaydet (Commit)
265fcc5f
authored
Agu 29, 2017
tarafından
Serhiy Storchaka
Kaydeden (comit)
GitHub
Agu 29, 2017
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
bpo-31286, bpo-30024: Fixed stack usage in absolute imports with (#3217)
binding a submodule to a name.
üst
ba7d7365
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
10 deletions
+33
-10
__init__.py
Lib/test/test_import/__init__.py
+17
-0
compile.c
Python/compile.c
+16
-10
No files found.
Lib/test/test_import/__init__.py
Dosyayı görüntüle @
265fcc5f
...
...
@@ -237,6 +237,23 @@ class ImportTests(unittest.TestCase):
import
test.support
as
y
self
.
assertIs
(
y
,
test
.
support
,
y
.
__name__
)
def
test_issue31286
(
self
):
# import in a 'finally' block resulted in SystemError
try
:
x
=
...
finally
:
import
test.support.script_helper
as
x
# import in a 'while' loop resulted in stack overflow
i
=
0
while
i
<
10
:
import
test.support.script_helper
as
x
i
+=
1
# import in a 'for' loop resulted in segmentation fault
for
i
in
range
(
2
):
import
test.support.script_helper
as
x
def
test_failing_reload
(
self
):
# A failing reload should leave the module object in sys.modules.
source
=
TESTFN
+
os
.
extsep
+
"py"
...
...
Python/compile.c
Dosyayı görüntüle @
265fcc5f
...
...
@@ -2673,28 +2673,34 @@ compiler_import_as(struct compiler *c, identifier name, identifier asname)
If there is a dot in name, we need to split it and emit a
IMPORT_FROM for each name.
*/
Py_ssize_t
dot
=
PyUnicode_FindChar
(
name
,
'.'
,
0
,
PyUnicode_GET_LENGTH
(
name
)
,
1
);
Py_ssize_t
len
=
PyUnicode_GET_LENGTH
(
name
);
Py_ssize_t
dot
=
PyUnicode_FindChar
(
name
,
'.'
,
0
,
len
,
1
);
if
(
dot
==
-
2
)
return
0
;
if
(
dot
!=
-
1
)
{
/* Consume the base module name to get the first attribute */
Py_ssize_t
pos
=
dot
+
1
;
while
(
dot
!=
-
1
)
{
while
(
1
)
{
Py_ssize_t
pos
=
dot
+
1
;
PyObject
*
attr
;
dot
=
PyUnicode_FindChar
(
name
,
'.'
,
pos
,
PyUnicode_GET_LENGTH
(
name
),
1
);
dot
=
PyUnicode_FindChar
(
name
,
'.'
,
pos
,
len
,
1
);
if
(
dot
==
-
2
)
return
0
;
attr
=
PyUnicode_Substring
(
name
,
pos
,
(
dot
!=
-
1
)
?
dot
:
PyUnicode_GET_LENGTH
(
name
));
attr
=
PyUnicode_Substring
(
name
,
pos
,
(
dot
!=
-
1
)
?
dot
:
len
);
if
(
!
attr
)
return
0
;
ADDOP_O
(
c
,
IMPORT_FROM
,
attr
,
names
);
Py_DECREF
(
attr
);
pos
=
dot
+
1
;
if
(
dot
==
-
1
)
{
break
;
}
ADDOP
(
c
,
ROT_TWO
);
ADDOP
(
c
,
POP_TOP
);
}
if
(
!
compiler_nameop
(
c
,
asname
,
Store
))
{
return
0
;
}
ADDOP
(
c
,
POP_TOP
);
return
1
;
}
return
compiler_nameop
(
c
,
asname
,
Store
);
}
...
...
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