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
3cb90241
Kaydet (Commit)
3cb90241
authored
Eki 31, 2012
tarafından
Benjamin Peterson
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Sade Fark
merge 3.3
üst
42124a72
2c05a2e0
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
9 deletions
+24
-9
test_descr.py
Lib/test/test_descr.py
+12
-4
NEWS
Misc/NEWS
+6
-0
typeobject.c
Objects/typeobject.c
+6
-5
No files found.
Lib/test/test_descr.py
Dosyayı görüntüle @
3cb90241
...
...
@@ -4502,11 +4502,19 @@ order (MRO) for bases """
self
.
assertEqual
(
float
.
real
.
__qualname__
,
'float.real'
)
self
.
assertEqual
(
int
.
__add__
.
__qualname__
,
'int.__add__'
)
class
X
:
pass
with
self
.
assertRaises
(
TypeError
):
del
X
.
__qualname__
self
.
assertRaises
(
TypeError
,
type
.
__dict__
[
'__qualname__'
]
.
__set__
,
str
,
'Oink'
)
def
test_qualname_dict
(
self
):
ns
=
{
'__qualname__'
:
'some.name'
}
tp
=
type
(
'Foo'
,
(),
ns
)
self
.
assertEqual
(
tp
.
__qualname__
,
'some.name'
)
self
.
assert
Equal
(
tp
.
__dict__
[
'__qualname__'
],
'some.name'
)
self
.
assert
NotIn
(
'__qualname__'
,
tp
.
__dict__
)
self
.
assertEqual
(
ns
,
{
'__qualname__'
:
'some.name'
})
ns
=
{
'__qualname__'
:
1
}
...
...
@@ -4564,7 +4572,7 @@ class DictProxyTests(unittest.TestCase):
keys
=
list
(
it
)
keys
.
sort
()
self
.
assertEqual
(
keys
,
[
'__dict__'
,
'__doc__'
,
'__module__'
,
'__
qualname__'
,
'__
weakref__'
,
'meth'
])
'__weakref__'
,
'meth'
])
@unittest.skipIf
(
hasattr
(
sys
,
'gettrace'
)
and
sys
.
gettrace
(),
'trace function introduces __local__'
)
...
...
@@ -4573,7 +4581,7 @@ class DictProxyTests(unittest.TestCase):
it
=
self
.
C
.
__dict__
.
values
()
self
.
assertNotIsInstance
(
it
,
list
)
values
=
list
(
it
)
self
.
assertEqual
(
len
(
values
),
6
)
self
.
assertEqual
(
len
(
values
),
5
)
@unittest.skipIf
(
hasattr
(
sys
,
'gettrace'
)
and
sys
.
gettrace
(),
'trace function introduces __local__'
)
...
...
@@ -4584,7 +4592,7 @@ class DictProxyTests(unittest.TestCase):
keys
=
[
item
[
0
]
for
item
in
it
]
keys
.
sort
()
self
.
assertEqual
(
keys
,
[
'__dict__'
,
'__doc__'
,
'__module__'
,
'__
qualname__'
,
'__
weakref__'
,
'meth'
])
'__weakref__'
,
'meth'
])
def
test_dict_type_with_metaclass
(
self
):
# Testing type of __dict__ when metaclass set...
...
...
Misc/NEWS
Dosyayı görüntüle @
3cb90241
...
...
@@ -15,9 +15,15 @@ Core and Builtins
Py_TPFLAGS_TYPE_SUBCLASS ((1 << 31). PyType_GetFlags() result type is
now unsigned too (unsigned long, instead of long).
- Fix segfaults on setting __qualname__ on builtin types and attempting to
delete it on any type.
- Issue #14625: Rewrite the UTF-32 decoder. It is now 3x to 4x faster. Patch
written by Serhiy Storchaka.
- Issue #16271: Fix strange bugs that resulted from __qualname__ appearing in a
class'
s
__dict__
and
on
type
.
-
Issue
#
16197
:
Update
winreg
docstrings
and
documentation
to
match
code
.
Patch
by
Zachary
Ware
.
...
...
Objects/typeobject.c
Dosyayı görüntüle @
3cb90241
...
...
@@ -311,6 +311,8 @@ type_set_qualname(PyTypeObject *type, PyObject *value, void *context)
{
PyHeapTypeObject
*
et
;
if
(
!
check_set_special_type_attr
(
type
,
value
,
"__qualname__"
))
return
-
1
;
if
(
!
PyUnicode_Check
(
value
))
{
PyErr_Format
(
PyExc_TypeError
,
"can only assign string to %s.__qualname__, not '%s'"
,
...
...
@@ -2250,11 +2252,10 @@ type_new(PyTypeObject *metatype, PyObject *args, PyObject *kwds)
goto
error
;
}
}
else
{
qualname
=
et
->
ht_name
;
}
Py_INCREF
(
qualname
);
et
->
ht_qualname
=
qualname
;
et
->
ht_qualname
=
qualname
?
qualname
:
et
->
ht_name
;
Py_INCREF
(
et
->
ht_qualname
);
if
(
qualname
!=
NULL
&&
PyDict_DelItem
(
dict
,
PyId___qualname__
.
object
)
<
0
)
goto
error
;
/* Set tp_doc to a copy of dict['__doc__'], if the latter is there
and is a string. The __doc__ accessor will first look for tp_doc;
...
...
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