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
477ba919
Kaydet (Commit)
477ba919
authored
Ock 12, 2011
tarafından
Benjamin Peterson
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
don't segfault on deleting __abstractmethods__ #10892
üst
5e8dada4
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
3 deletions
+19
-3
test_descr.py
Lib/test/test_descr.py
+5
-1
NEWS
Misc/NEWS
+3
-0
typeobject.c
Objects/typeobject.c
+11
-2
No files found.
Lib/test/test_descr.py
Dosyayı görüntüle @
477ba919
...
@@ -4224,12 +4224,16 @@ order (MRO) for bases """
...
@@ -4224,12 +4224,16 @@ order (MRO) for bases """
self
.
assertRaises
(
AttributeError
,
getattr
,
EvilGetattribute
(),
"attr"
)
self
.
assertRaises
(
AttributeError
,
getattr
,
EvilGetattribute
(),
"attr"
)
def
test_
type_has_no_
abstractmethods
(
self
):
def
test_abstractmethods
(
self
):
# type pretends not to have __abstractmethods__.
# type pretends not to have __abstractmethods__.
self
.
assertRaises
(
AttributeError
,
getattr
,
type
,
"__abstractmethods__"
)
self
.
assertRaises
(
AttributeError
,
getattr
,
type
,
"__abstractmethods__"
)
class
meta
(
type
):
class
meta
(
type
):
pass
pass
self
.
assertRaises
(
AttributeError
,
getattr
,
meta
,
"__abstractmethods__"
)
self
.
assertRaises
(
AttributeError
,
getattr
,
meta
,
"__abstractmethods__"
)
class
X
(
object
):
pass
with
self
.
assertRaises
(
AttributeError
):
del
X
.
__abstractmethods__
class
DictProxyTests
(
unittest
.
TestCase
):
class
DictProxyTests
(
unittest
.
TestCase
):
...
...
Misc/NEWS
Dosyayı görüntüle @
477ba919
...
@@ -8,6 +8,9 @@ What's New in Python 3.2 Release Candidate 1
...
@@ -8,6 +8,9 @@ What's New in Python 3.2 Release Candidate 1
Core and Builtins
Core and Builtins
-----------------
-----------------
- Issue #10892: Don't segfault when trying to delete __abstractmethods__ from a
class.
- Issue #8020: Avoid a crash where the small objects allocator would read
- Issue #8020: Avoid a crash where the small objects allocator would read
non-Python managed memory while it is being modified by another thread.
non-Python managed memory while it is being modified by another thread.
Patch by Matt Bandy.
Patch by Matt Bandy.
...
...
Objects/typeobject.c
Dosyayı görüntüle @
477ba919
...
@@ -340,8 +340,17 @@ type_set_abstractmethods(PyTypeObject *type, PyObject *value, void *context)
...
@@ -340,8 +340,17 @@ type_set_abstractmethods(PyTypeObject *type, PyObject *value, void *context)
abc.ABCMeta.__new__, so this function doesn't do anything
abc.ABCMeta.__new__, so this function doesn't do anything
special to update subclasses.
special to update subclasses.
*/
*/
int
res
=
PyDict_SetItemString
(
type
->
tp_dict
,
int
res
;
"__abstractmethods__"
,
value
);
if
(
value
!=
NULL
)
{
res
=
PyDict_SetItemString
(
type
->
tp_dict
,
"__abstractmethods__"
,
value
);
}
else
{
res
=
PyDict_DelItemString
(
type
->
tp_dict
,
"__abstractmethods__"
);
if
(
res
&&
PyErr_ExceptionMatches
(
PyExc_KeyError
))
{
PyErr_Format
(
PyExc_AttributeError
,
"__abstractmethods__"
,
value
);
return
-
1
;
}
}
if
(
res
==
0
)
{
if
(
res
==
0
)
{
PyType_Modified
(
type
);
PyType_Modified
(
type
);
if
(
value
&&
PyObject_IsTrue
(
value
))
{
if
(
value
&&
PyObject_IsTrue
(
value
))
{
...
...
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