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
85530aa1
Kaydet (Commit)
85530aa1
authored
Ara 22, 2011
tarafından
Michael Foord
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Sade Fark
Merge
üst
059226b8
3ba95f8b
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
4 deletions
+25
-4
inspect.py
Lib/inspect.py
+5
-4
test_inspect.py
Lib/test/test_inspect.py
+17
-0
NEWS
Misc/NEWS
+3
-0
No files found.
Lib/inspect.py
Dosyayı görüntüle @
85530aa1
...
...
@@ -1186,10 +1186,11 @@ def getattr_static(obj, attr, default=_sentinel):
if
obj
is
klass
:
# for types we check the metaclass too
for
entry
in
_static_getmro
(
type
(
klass
)):
try
:
return
entry
.
__dict__
[
attr
]
except
KeyError
:
pass
if
_shadowed_dict
(
type
(
entry
))
is
_sentinel
:
try
:
return
entry
.
__dict__
[
attr
]
except
KeyError
:
pass
if
default
is
not
_sentinel
:
return
default
raise
AttributeError
(
attr
)
...
...
Lib/test/test_inspect.py
Dosyayı görüntüle @
85530aa1
...
...
@@ -1088,6 +1088,23 @@ class TestGetattrStatic(unittest.TestCase):
self
.
assertIsNot
(
inspect
.
getattr_static
(
sys
,
"version"
,
sentinel
),
sentinel
)
def
test_metaclass_with_metaclass_with_dict_as_property
(
self
):
class
MetaMeta
(
type
):
@property
def
__dict__
(
self
):
self
.
executed
=
True
return
dict
(
spam
=
42
)
class
Meta
(
type
,
metaclass
=
MetaMeta
):
executed
=
False
class
Thing
(
metaclass
=
Meta
):
pass
with
self
.
assertRaises
(
AttributeError
):
inspect
.
getattr_static
(
Thing
,
"spam"
)
self
.
assertFalse
(
Thing
.
executed
)
class
TestGetGeneratorState
(
unittest
.
TestCase
):
def
setUp
(
self
):
...
...
Misc/NEWS
Dosyayı görüntüle @
85530aa1
...
...
@@ -422,6 +422,9 @@ Library
-
Issue
#
13620
:
Support
for
Chrome
browser
in
webbrowser
.
py
Patch
contributed
by
Arnaud
Calmettes
.
-
Issue
#
11829
:
Fix
code
execution
holes
in
inspect
.
getattr_static
for
metaclasses
with
metaclasses
.
Patch
by
Andreas
St
ü
hrk
.
-
Issue
#
12708
:
Add
starmap
()
and
starmap_async
()
methods
(
similar
to
itertools
.
starmap
())
to
multiprocessing
.
Pool
.
Patch
by
Hynek
Schlawack
.
...
...
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