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
4887b1c0
Kaydet (Commit)
4887b1c0
authored
Tem 27, 2012
tarafından
Richard Oudkerk
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #6056: Make multiprocessing use setblocking(True) on the sockets it uses.
Original patch by J Derek Wilson.
üst
a58d668f
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
44 additions
and
1 deletion
+44
-1
connection.py
Lib/multiprocessing/connection.py
+5
-0
test_multiprocessing.py
Lib/test/test_multiprocessing.py
+35
-1
ACKS
Misc/ACKS
+1
-0
NEWS
Misc/NEWS
+3
-0
No files found.
Lib/multiprocessing/connection.py
Dosyayı görüntüle @
4887b1c0
...
@@ -199,6 +199,8 @@ if sys.platform != 'win32':
...
@@ -199,6 +199,8 @@ if sys.platform != 'win32':
'''
'''
if
duplex
:
if
duplex
:
s1
,
s2
=
socket
.
socketpair
()
s1
,
s2
=
socket
.
socketpair
()
s1
.
setblocking
(
True
)
s2
.
setblocking
(
True
)
c1
=
_multiprocessing
.
Connection
(
os
.
dup
(
s1
.
fileno
()))
c1
=
_multiprocessing
.
Connection
(
os
.
dup
(
s1
.
fileno
()))
c2
=
_multiprocessing
.
Connection
(
os
.
dup
(
s2
.
fileno
()))
c2
=
_multiprocessing
.
Connection
(
os
.
dup
(
s2
.
fileno
()))
s1
.
close
()
s1
.
close
()
...
@@ -264,6 +266,7 @@ class SocketListener(object):
...
@@ -264,6 +266,7 @@ class SocketListener(object):
self
.
_socket
=
socket
.
socket
(
getattr
(
socket
,
family
))
self
.
_socket
=
socket
.
socket
(
getattr
(
socket
,
family
))
try
:
try
:
self
.
_socket
.
setsockopt
(
socket
.
SOL_SOCKET
,
socket
.
SO_REUSEADDR
,
1
)
self
.
_socket
.
setsockopt
(
socket
.
SOL_SOCKET
,
socket
.
SO_REUSEADDR
,
1
)
self
.
_socket
.
setblocking
(
True
)
self
.
_socket
.
bind
(
address
)
self
.
_socket
.
bind
(
address
)
self
.
_socket
.
listen
(
backlog
)
self
.
_socket
.
listen
(
backlog
)
self
.
_address
=
self
.
_socket
.
getsockname
()
self
.
_address
=
self
.
_socket
.
getsockname
()
...
@@ -282,6 +285,7 @@ class SocketListener(object):
...
@@ -282,6 +285,7 @@ class SocketListener(object):
def
accept
(
self
):
def
accept
(
self
):
s
,
self
.
_last_accepted
=
self
.
_socket
.
accept
()
s
,
self
.
_last_accepted
=
self
.
_socket
.
accept
()
s
.
setblocking
(
True
)
fd
=
duplicate
(
s
.
fileno
())
fd
=
duplicate
(
s
.
fileno
())
conn
=
_multiprocessing
.
Connection
(
fd
)
conn
=
_multiprocessing
.
Connection
(
fd
)
s
.
close
()
s
.
close
()
...
@@ -299,6 +303,7 @@ def SocketClient(address):
...
@@ -299,6 +303,7 @@ def SocketClient(address):
'''
'''
family
=
address_type
(
address
)
family
=
address_type
(
address
)
with
socket
.
socket
(
getattr
(
socket
,
family
)
)
as
s
:
with
socket
.
socket
(
getattr
(
socket
,
family
)
)
as
s
:
s
.
setblocking
(
True
)
t
=
_init_timeout
()
t
=
_init_timeout
()
while
1
:
while
1
:
...
...
Lib/test/test_multiprocessing.py
Dosyayı görüntüle @
4887b1c0
...
@@ -2395,9 +2395,43 @@ class TestInvalidFamily(unittest.TestCase):
...
@@ -2395,9 +2395,43 @@ class TestInvalidFamily(unittest.TestCase):
with
self
.
assertRaises
(
ValueError
):
with
self
.
assertRaises
(
ValueError
):
multiprocessing
.
connection
.
Listener
(
'/var/test.pipe'
)
multiprocessing
.
connection
.
Listener
(
'/var/test.pipe'
)
#
# Test interaction with socket timeouts - see Issue #6056
#
class
TestTimeouts
(
unittest
.
TestCase
):
@classmethod
def
_test_timeout
(
cls
,
child
,
address
):
time
.
sleep
(
1
)
child
.
send
(
123
)
child
.
close
()
conn
=
multiprocessing
.
connection
.
Client
(
address
)
conn
.
send
(
456
)
conn
.
close
()
def
test_timeout
(
self
):
old_timeout
=
socket
.
getdefaulttimeout
()
try
:
socket
.
setdefaulttimeout
(
0.1
)
parent
,
child
=
multiprocessing
.
Pipe
(
duplex
=
True
)
l
=
multiprocessing
.
connection
.
Listener
(
family
=
'AF_INET'
)
p
=
multiprocessing
.
Process
(
target
=
self
.
_test_timeout
,
args
=
(
child
,
l
.
address
))
p
.
start
()
child
.
close
()
self
.
assertEqual
(
parent
.
recv
(),
123
)
parent
.
close
()
conn
=
l
.
accept
()
self
.
assertEqual
(
conn
.
recv
(),
456
)
conn
.
close
()
l
.
close
()
p
.
join
(
10
)
finally
:
socket
.
setdefaulttimeout
(
old_timeout
)
testcases_other
=
[
OtherTest
,
TestInvalidHandle
,
TestInitializers
,
testcases_other
=
[
OtherTest
,
TestInvalidHandle
,
TestInitializers
,
TestStdinBadfiledescriptor
,
TestInvalidFamily
]
TestStdinBadfiledescriptor
,
TestInvalidFamily
,
TestTimeouts
]
#
#
#
#
...
...
Misc/ACKS
Dosyayı görüntüle @
4887b1c0
...
@@ -1021,6 +1021,7 @@ Sue Williams
...
@@ -1021,6 +1021,7 @@ Sue Williams
Gerald S. Williams
Gerald S. Williams
Frank Willison
Frank Willison
Greg V. Wilson
Greg V. Wilson
J Derek Wilson
Jody Winston
Jody Winston
Collin Winter
Collin Winter
Dik Winter
Dik Winter
...
...
Misc/NEWS
Dosyayı görüntüle @
4887b1c0
...
@@ -98,6 +98,9 @@ Core and Builtins
...
@@ -98,6 +98,9 @@ Core and Builtins
Library
Library
-------
-------
- Issue #6056: Make multiprocessing use setblocking(True) on the
sockets it uses. Original patch by J Derek Wilson.
- Issue #15041: update "see also" list in tkinter documentation.
- Issue #15041: update "see also" list in tkinter documentation.
- Issue #15402: An issue in the struct module that caused sys.getsizeof to
- Issue #15402: An issue in the struct module that caused sys.getsizeof to
...
...
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