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
74176226
Kaydet (Commit)
74176226
authored
Ock 18, 2019
tarafından
Anthony Sottile
Kaydeden (comit)
Serhiy Storchaka
Ock 18, 2019
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
bpo-35733: Make isinstance(ast.Constant(boolean), ast.Num) be false. (GH-11547)
üst
39ed289a
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
1 deletion
+13
-1
ast.py
Lib/ast.py
+7
-1
test_ast.py
Lib/test/test_ast.py
+4
-0
2019-01-13-18-42-41.bpo-35733.eFfLiv.rst
...S.d/next/Library/2019-01-13-18-42-41.bpo-35733.eFfLiv.rst
+2
-0
No files found.
Lib/ast.py
Dosyayı görüntüle @
74176226
...
@@ -346,7 +346,10 @@ class _ABC(type):
...
@@ -346,7 +346,10 @@ class _ABC(type):
except
AttributeError
:
except
AttributeError
:
return
False
return
False
else
:
else
:
return
isinstance
(
value
,
_const_types
[
cls
])
return
(
isinstance
(
value
,
_const_types
[
cls
])
and
not
isinstance
(
value
,
_const_types_not
.
get
(
cls
,
()))
)
return
type
.
__instancecheck__
(
cls
,
inst
)
return
type
.
__instancecheck__
(
cls
,
inst
)
def
_new
(
cls
,
*
args
,
**
kwargs
):
def
_new
(
cls
,
*
args
,
**
kwargs
):
...
@@ -384,3 +387,6 @@ _const_types = {
...
@@ -384,3 +387,6 @@ _const_types = {
NameConstant
:
(
type
(
None
),
bool
),
NameConstant
:
(
type
(
None
),
bool
),
Ellipsis
:
(
type
(
...
),),
Ellipsis
:
(
type
(
...
),),
}
}
_const_types_not
=
{
Num
:
(
bool
,),
}
Lib/test/test_ast.py
Dosyayı görüntüle @
74176226
...
@@ -411,12 +411,16 @@ class AST_Tests(unittest.TestCase):
...
@@ -411,12 +411,16 @@ class AST_Tests(unittest.TestCase):
self
.
assertFalse
(
isinstance
(
ast
.
Str
(
'42'
),
ast
.
Bytes
))
self
.
assertFalse
(
isinstance
(
ast
.
Str
(
'42'
),
ast
.
Bytes
))
self
.
assertFalse
(
isinstance
(
ast
.
Num
(
42
),
ast
.
NameConstant
))
self
.
assertFalse
(
isinstance
(
ast
.
Num
(
42
),
ast
.
NameConstant
))
self
.
assertFalse
(
isinstance
(
ast
.
Num
(
42
),
ast
.
Ellipsis
))
self
.
assertFalse
(
isinstance
(
ast
.
Num
(
42
),
ast
.
Ellipsis
))
self
.
assertFalse
(
isinstance
(
ast
.
NameConstant
(
True
),
ast
.
Num
))
self
.
assertFalse
(
isinstance
(
ast
.
NameConstant
(
False
),
ast
.
Num
))
self
.
assertFalse
(
isinstance
(
ast
.
Constant
(
'42'
),
ast
.
Num
))
self
.
assertFalse
(
isinstance
(
ast
.
Constant
(
'42'
),
ast
.
Num
))
self
.
assertFalse
(
isinstance
(
ast
.
Constant
(
42
),
ast
.
Str
))
self
.
assertFalse
(
isinstance
(
ast
.
Constant
(
42
),
ast
.
Str
))
self
.
assertFalse
(
isinstance
(
ast
.
Constant
(
'42'
),
ast
.
Bytes
))
self
.
assertFalse
(
isinstance
(
ast
.
Constant
(
'42'
),
ast
.
Bytes
))
self
.
assertFalse
(
isinstance
(
ast
.
Constant
(
42
),
ast
.
NameConstant
))
self
.
assertFalse
(
isinstance
(
ast
.
Constant
(
42
),
ast
.
NameConstant
))
self
.
assertFalse
(
isinstance
(
ast
.
Constant
(
42
),
ast
.
Ellipsis
))
self
.
assertFalse
(
isinstance
(
ast
.
Constant
(
42
),
ast
.
Ellipsis
))
self
.
assertFalse
(
isinstance
(
ast
.
Constant
(
True
),
ast
.
Num
))
self
.
assertFalse
(
isinstance
(
ast
.
Constant
(
False
),
ast
.
Num
))
self
.
assertFalse
(
isinstance
(
ast
.
Constant
(),
ast
.
Num
))
self
.
assertFalse
(
isinstance
(
ast
.
Constant
(),
ast
.
Num
))
self
.
assertFalse
(
isinstance
(
ast
.
Constant
(),
ast
.
Str
))
self
.
assertFalse
(
isinstance
(
ast
.
Constant
(),
ast
.
Str
))
...
...
Misc/NEWS.d/next/Library/2019-01-13-18-42-41.bpo-35733.eFfLiv.rst
0 → 100644
Dosyayı görüntüle @
74176226
``ast.Constant(boolean)`` no longer an instance of :class:`ast.Num`. Patch by Anthony
Sottile.
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