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
a4e4e357
Kaydet (Commit)
a4e4e357
authored
Mar 22, 2012
tarafından
Benjamin Peterson
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
check by equality for __future__ not identity (closes #14378)
üst
e1121537
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
8 deletions
+11
-8
test_ast.py
Lib/test/test_ast.py
+6
-0
NEWS
Misc/NEWS
+3
-0
future.c
Python/future.c
+2
-8
No files found.
Lib/test/test_ast.py
Dosyayı görüntüle @
a4e4e357
...
...
@@ -218,6 +218,12 @@ class AST_Tests(unittest.TestCase):
im
=
ast
.
parse
(
"from . import y"
)
.
body
[
0
]
self
.
assertIsNone
(
im
.
module
)
def
test_non_interned_future_from_ast
(
self
):
mod
=
ast
.
parse
(
"from __future__ import division"
)
self
.
assertIsInstance
(
mod
.
body
[
0
],
ast
.
ImportFrom
)
mod
.
body
[
0
]
.
module
=
" __future__ "
.
strip
()
compile
(
mod
,
"<test>"
,
"exec"
)
def
test_base_classes
(
self
):
self
.
assertTrue
(
issubclass
(
ast
.
For
,
ast
.
stmt
))
self
.
assertTrue
(
issubclass
(
ast
.
Name
,
ast
.
expr
))
...
...
Misc/NEWS
Dosyayı görüntüle @
a4e4e357
...
...
@@ -10,6 +10,9 @@ What's New in Python 3.2.4
Core and Builtins
-----------------
- Issue #14378: Fix compiling ast.ImportFrom nodes with a "__future__" string as
the module name that was not interned.
- Issue #14331: Use significantly less stack space when importing modules by
allocating path buffers on the heap instead of the stack.
...
...
Python/future.c
Dosyayı görüntüle @
a4e4e357
...
...
@@ -60,13 +60,6 @@ future_parse(PyFutureFeatures *ff, mod_ty mod, const char *filename)
{
int
i
,
found_docstring
=
0
,
done
=
0
,
prev_line
=
0
;
static
PyObject
*
future
;
if
(
!
future
)
{
future
=
PyUnicode_InternFromString
(
"__future__"
);
if
(
!
future
)
return
0
;
}
if
(
!
(
mod
->
kind
==
Module_kind
||
mod
->
kind
==
Interactive_kind
))
return
1
;
...
...
@@ -93,7 +86,8 @@ future_parse(PyFutureFeatures *ff, mod_ty mod, const char *filename)
*/
if
(
s
->
kind
==
ImportFrom_kind
)
{
if
(
s
->
v
.
ImportFrom
.
module
==
future
)
{
PyObject
*
modname
=
s
->
v
.
ImportFrom
.
module
;
if
(
!
PyUnicode_CompareWithASCIIString
(
modname
,
"__future__"
))
{
if
(
done
)
{
PyErr_SetString
(
PyExc_SyntaxError
,
ERR_LATE_FUTURE
);
...
...
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