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
e720725c
Kaydet (Commit)
e720725c
authored
Tem 15, 2011
tarafından
Benjamin Peterson
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Sade Fark
merge heads
üst
620b2c8c
428bc6c4
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
59 additions
and
2 deletions
+59
-2
process.py
Lib/multiprocessing/process.py
+5
-0
regrtest.py
Lib/test/regrtest.py
+36
-1
test_descr.py
Lib/test/test_descr.py
+8
-0
threading.py
Lib/threading.py
+4
-0
NEWS
Misc/NEWS
+5
-0
typeobject.c
Objects/typeobject.c
+1
-1
No files found.
Lib/multiprocessing/process.py
Dosyayı görüntüle @
e720725c
...
@@ -42,6 +42,7 @@ import os
...
@@ -42,6 +42,7 @@ import os
import
sys
import
sys
import
signal
import
signal
import
itertools
import
itertools
from
_weakrefset
import
WeakSet
#
#
#
#
...
@@ -109,6 +110,7 @@ class Process(object):
...
@@ -109,6 +110,7 @@ class Process(object):
self
.
_kwargs
=
dict
(
kwargs
)
self
.
_kwargs
=
dict
(
kwargs
)
self
.
_name
=
name
or
type
(
self
)
.
__name__
+
'-'
+
\
self
.
_name
=
name
or
type
(
self
)
.
__name__
+
'-'
+
\
':'
.
join
(
str
(
i
)
for
i
in
self
.
_identity
)
':'
.
join
(
str
(
i
)
for
i
in
self
.
_identity
)
_dangling
.
add
(
self
)
def
run
(
self
):
def
run
(
self
):
'''
'''
...
@@ -344,3 +346,6 @@ _exitcode_to_name = {}
...
@@ -344,3 +346,6 @@ _exitcode_to_name = {}
for
name
,
signum
in
list
(
signal
.
__dict__
.
items
()):
for
name
,
signum
in
list
(
signal
.
__dict__
.
items
()):
if
name
[:
3
]
==
'SIG'
and
'_'
not
in
name
:
if
name
[:
3
]
==
'SIG'
and
'_'
not
in
name
:
_exitcode_to_name
[
-
signum
]
=
name
_exitcode_to_name
[
-
signum
]
=
name
# For debug and leak testing
_dangling
=
WeakSet
()
Lib/test/regrtest.py
Dosyayı görüntüle @
e720725c
...
@@ -182,6 +182,15 @@ import unittest
...
@@ -182,6 +182,15 @@ import unittest
import
warnings
import
warnings
from
inspect
import
isabstract
from
inspect
import
isabstract
try
:
import
threading
except
ImportError
:
threading
=
None
try
:
import
multiprocessing.process
except
ImportError
:
multiprocessing
=
None
# Some times __path__ and __file__ are not absolute (e.g. while running from
# Some times __path__ and __file__ are not absolute (e.g. while running from
# Lib/) and, if we change the CWD to run the tests in a temporary dir, some
# Lib/) and, if we change the CWD to run the tests in a temporary dir, some
...
@@ -930,7 +939,8 @@ class saved_test_environment:
...
@@ -930,7 +939,8 @@ class saved_test_environment:
'os.environ'
,
'sys.path'
,
'sys.path_hooks'
,
'__import__'
,
'os.environ'
,
'sys.path'
,
'sys.path_hooks'
,
'__import__'
,
'warnings.filters'
,
'asyncore.socket_map'
,
'warnings.filters'
,
'asyncore.socket_map'
,
'logging._handlers'
,
'logging._handlerList'
,
'sys.gettrace'
,
'logging._handlers'
,
'logging._handlerList'
,
'sys.gettrace'
,
'sys.warnoptions'
)
'sys.warnoptions'
,
'threading._dangling'
,
'multiprocessing.process._dangling'
)
def
get_sys_argv
(
self
):
def
get_sys_argv
(
self
):
return
id
(
sys
.
argv
),
sys
.
argv
,
sys
.
argv
[:]
return
id
(
sys
.
argv
),
sys
.
argv
,
sys
.
argv
[:]
...
@@ -1023,6 +1033,31 @@ class saved_test_environment:
...
@@ -1023,6 +1033,31 @@ class saved_test_environment:
sys
.
warnoptions
=
saved_options
[
1
]
sys
.
warnoptions
=
saved_options
[
1
]
sys
.
warnoptions
[:]
=
saved_options
[
2
]
sys
.
warnoptions
[:]
=
saved_options
[
2
]
# Controlling dangling references to Thread objects can make it easier
# to track reference leaks.
def
get_threading__dangling
(
self
):
if
not
threading
:
return
None
# This copies the weakrefs without making any strong reference
return
threading
.
_dangling
.
copy
()
def
restore_threading__dangling
(
self
,
saved
):
if
not
threading
:
return
threading
.
_dangling
.
clear
()
threading
.
_dangling
.
update
(
saved
)
# Same for Process objects
def
get_multiprocessing_process__dangling
(
self
):
if
not
multiprocessing
:
return
None
# This copies the weakrefs without making any strong reference
return
multiprocessing
.
process
.
_dangling
.
copy
()
def
restore_multiprocessing_process__dangling
(
self
,
saved
):
if
not
multiprocessing
:
return
multiprocessing
.
process
.
_dangling
.
clear
()
multiprocessing
.
process
.
_dangling
.
update
(
saved
)
def
resource_info
(
self
):
def
resource_info
(
self
):
for
name
in
self
.
resources
:
for
name
in
self
.
resources
:
method_suffix
=
name
.
replace
(
'.'
,
'_'
)
method_suffix
=
name
.
replace
(
'.'
,
'_'
)
...
...
Lib/test/test_descr.py
Dosyayı görüntüle @
e720725c
...
@@ -4247,6 +4247,14 @@ order (MRO) for bases """
...
@@ -4247,6 +4247,14 @@ order (MRO) for bases """
with
self
.
assertRaises
(
TypeError
):
with
self
.
assertRaises
(
TypeError
):
str
.
__add__
(
fake_str
,
"abc"
)
str
.
__add__
(
fake_str
,
"abc"
)
def
test_repr_as_str
(
self
):
# Issue #11603: crash or infinite loop when rebinding __str__ as
# __repr__.
class
Foo
:
pass
Foo
.
__repr__
=
Foo
.
__str__
foo
=
Foo
()
str
(
foo
)
class
DictProxyTests
(
unittest
.
TestCase
):
class
DictProxyTests
(
unittest
.
TestCase
):
def
setUp
(
self
):
def
setUp
(
self
):
...
...
Lib/threading.py
Dosyayı görüntüle @
e720725c
...
@@ -6,6 +6,7 @@ import _thread
...
@@ -6,6 +6,7 @@ import _thread
from
time
import
time
as
_time
,
sleep
as
_sleep
from
time
import
time
as
_time
,
sleep
as
_sleep
from
traceback
import
format_exc
as
_format_exc
from
traceback
import
format_exc
as
_format_exc
from
collections
import
deque
from
collections
import
deque
from
_weakrefset
import
WeakSet
# Note regarding PEP 8 compliant names
# Note regarding PEP 8 compliant names
# This threading model was originally inspired by Java, and inherited
# This threading model was originally inspired by Java, and inherited
...
@@ -608,6 +609,8 @@ _active_limbo_lock = _allocate_lock()
...
@@ -608,6 +609,8 @@ _active_limbo_lock = _allocate_lock()
_active
=
{}
# maps thread id to Thread object
_active
=
{}
# maps thread id to Thread object
_limbo
=
{}
_limbo
=
{}
# For debug and leak testing
_dangling
=
WeakSet
()
# Main class for threads
# Main class for threads
...
@@ -645,6 +648,7 @@ class Thread(_Verbose):
...
@@ -645,6 +648,7 @@ class Thread(_Verbose):
# sys.stderr is not stored in the class like
# sys.stderr is not stored in the class like
# sys.exc_info since it can be changed between instances
# sys.exc_info since it can be changed between instances
self
.
_stderr
=
_sys
.
stderr
self
.
_stderr
=
_sys
.
stderr
_dangling
.
add
(
self
)
def
_reset_internal_locks
(
self
):
def
_reset_internal_locks
(
self
):
# private! Called by _after_fork() to reset our internal locks as
# private! Called by _after_fork() to reset our internal locks as
...
...
Misc/NEWS
Dosyayı görüntüle @
e720725c
...
@@ -228,6 +228,9 @@ Core and Builtins
...
@@ -228,6 +228,9 @@ Core and Builtins
Library
Library
-------
-------
- Issue #11603: Fix a crash when __str__ is rebound as __repr__. Patch by
Andreas Stührk.
- Issue #11321: Fix a crash with multiple imports of the _pickle module when
- Issue #11321: Fix a crash with multiple imports of the _pickle module when
embedding Python. Patch by Andreas Stührk.
embedding Python. Patch by Andreas Stührk.
...
@@ -1033,6 +1036,8 @@ Extension Modules
...
@@ -1033,6 +1036,8 @@ Extension Modules
Tests
Tests
-----
-----
- Issue #12573: Add resource checks for dangling Thread and Process objects.
- Issue #12549: Correct test_platform to not fail when OS X returns '
x86_64
'
- Issue #12549: Correct test_platform to not fail when OS X returns '
x86_64
'
as the processor type on some Mac systems.
as the processor type on some Mac systems.
...
...
Objects/typeobject.c
Dosyayı görüntüle @
e720725c
...
@@ -2968,7 +2968,7 @@ object_str(PyObject *self)
...
@@ -2968,7 +2968,7 @@ object_str(PyObject *self)
unaryfunc
f
;
unaryfunc
f
;
f
=
Py_TYPE
(
self
)
->
tp_repr
;
f
=
Py_TYPE
(
self
)
->
tp_repr
;
if
(
f
==
NULL
)
if
(
f
==
NULL
||
f
==
object_str
)
f
=
object_repr
;
f
=
object_repr
;
return
f
(
self
);
return
f
(
self
);
}
}
...
...
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