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
a63cc212
Kaydet (Commit)
a63cc212
authored
Nis 13, 2015
tarafından
Antoine Pitrou
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #23726: Don't enable GC for user subclasses of non-GC types that don't add any new fields.
Patch by Eugene Toder.
üst
56452eea
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
27 additions
and
5 deletions
+27
-5
test_descr.py
Lib/test/test_descr.py
+0
-2
test_gc.py
Lib/test/test_gc.py
+20
-0
NEWS
Misc/NEWS
+3
-0
typeobject.c
Objects/typeobject.c
+4
-3
No files found.
Lib/test/test_descr.py
Dosyayı görüntüle @
a63cc212
...
@@ -3020,8 +3020,6 @@ order (MRO) for bases """
...
@@ -3020,8 +3020,6 @@ order (MRO) for bases """
cant
(
object
(),
list
)
cant
(
object
(),
list
)
cant
(
list
(),
object
)
cant
(
list
(),
object
)
class
Int
(
int
):
__slots__
=
[]
class
Int
(
int
):
__slots__
=
[]
cant
(
2
,
Int
)
cant
(
Int
(),
int
)
cant
(
True
,
int
)
cant
(
True
,
int
)
cant
(
2
,
bool
)
cant
(
2
,
bool
)
o
=
object
()
o
=
object
()
...
...
Lib/test/test_gc.py
Dosyayı görüntüle @
a63cc212
...
@@ -546,11 +546,31 @@ class GCTests(unittest.TestCase):
...
@@ -546,11 +546,31 @@ class GCTests(unittest.TestCase):
class
UserClass
:
class
UserClass
:
pass
pass
class
UserInt
(
int
):
pass
# Base class is object; no extra fields.
class
UserClassSlots
:
__slots__
=
()
# Base class is fixed size larger than object; no extra fields.
class
UserFloatSlots
(
float
):
__slots__
=
()
# Base class is variable size; no extra fields.
class
UserIntSlots
(
int
):
__slots__
=
()
self
.
assertTrue
(
gc
.
is_tracked
(
gc
))
self
.
assertTrue
(
gc
.
is_tracked
(
gc
))
self
.
assertTrue
(
gc
.
is_tracked
(
UserClass
))
self
.
assertTrue
(
gc
.
is_tracked
(
UserClass
))
self
.
assertTrue
(
gc
.
is_tracked
(
UserClass
()))
self
.
assertTrue
(
gc
.
is_tracked
(
UserClass
()))
self
.
assertTrue
(
gc
.
is_tracked
(
UserInt
()))
self
.
assertTrue
(
gc
.
is_tracked
([]))
self
.
assertTrue
(
gc
.
is_tracked
([]))
self
.
assertTrue
(
gc
.
is_tracked
(
set
()))
self
.
assertTrue
(
gc
.
is_tracked
(
set
()))
self
.
assertFalse
(
gc
.
is_tracked
(
UserClassSlots
()))
self
.
assertFalse
(
gc
.
is_tracked
(
UserFloatSlots
()))
self
.
assertFalse
(
gc
.
is_tracked
(
UserIntSlots
()))
def
test_bug1055820b
(
self
):
def
test_bug1055820b
(
self
):
# Corresponds to temp2b.py in the bug report.
# Corresponds to temp2b.py in the bug report.
...
...
Misc/NEWS
Dosyayı görüntüle @
a63cc212
...
@@ -10,6 +10,9 @@ Release date: XXX
...
@@ -10,6 +10,9 @@ Release date: XXX
Core and Builtins
Core and Builtins
-----------------
-----------------
- Issue #23726: Don'
t
enable
GC
for
user
subclasses
of
non
-
GC
types
that
don
't add any new fields. Patch by Eugene Toder.
- Issue #23309: Avoid a deadlock at shutdown if a daemon thread is aborted
- Issue #23309: Avoid a deadlock at shutdown if a daemon thread is aborted
while it is holding a lock to a buffered I/O object, and the main thread
while it is holding a lock to a buffered I/O object, and the main thread
tries to use the same I/O object (typically stdout or stderr). A fatal
tries to use the same I/O object (typically stdout or stderr). A fatal
...
...
Objects/typeobject.c
Dosyayı görüntüle @
a63cc212
...
@@ -2645,9 +2645,10 @@ type_new(PyTypeObject *metatype, PyObject *args, PyObject *kwds)
...
@@ -2645,9 +2645,10 @@ type_new(PyTypeObject *metatype, PyObject *args, PyObject *kwds)
}
}
type
->
tp_dealloc
=
subtype_dealloc
;
type
->
tp_dealloc
=
subtype_dealloc
;
/* Enable GC unless there are really no instance variables possible */
/* Enable GC unless this class is not adding new instance variables and
if
(
!
(
type
->
tp_basicsize
==
sizeof
(
PyObject
)
&&
the base class did not use GC. */
type
->
tp_itemsize
==
0
))
if
((
base
->
tp_flags
&
Py_TPFLAGS_HAVE_GC
)
||
type
->
tp_basicsize
>
base
->
tp_basicsize
)
type
->
tp_flags
|=
Py_TPFLAGS_HAVE_GC
;
type
->
tp_flags
|=
Py_TPFLAGS_HAVE_GC
;
/* Always override allocation strategy to use regular heap */
/* Always override allocation strategy to use regular heap */
...
...
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