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
a655075d
Kaydet (Commit)
a655075d
authored
Mar 24, 2013
tarafından
Charles-François Natali
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #17025: Add dumps() and loads() to ForkingPickler.
üst
89e6b318
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
5 deletions
+13
-5
connection.py
Lib/multiprocessing/connection.py
+2
-5
forking.py
Lib/multiprocessing/forking.py
+11
-0
No files found.
Lib/multiprocessing/connection.py
Dosyayı görüntüle @
a655075d
...
...
@@ -12,7 +12,6 @@ __all__ = [ 'Client', 'Listener', 'Pipe', 'wait' ]
import
io
import
os
import
sys
import
pickle
import
select
import
socket
import
struct
...
...
@@ -202,9 +201,7 @@ class _ConnectionBase:
"""Send a (picklable) object"""
self
.
_check_closed
()
self
.
_check_writable
()
buf
=
io
.
BytesIO
()
ForkingPickler
(
buf
,
pickle
.
HIGHEST_PROTOCOL
)
.
dump
(
obj
)
self
.
_send_bytes
(
buf
.
getbuffer
())
self
.
_send_bytes
(
ForkingPickler
.
dumps
(
obj
))
def
recv_bytes
(
self
,
maxlength
=
None
):
"""
...
...
@@ -249,7 +246,7 @@ class _ConnectionBase:
self
.
_check_closed
()
self
.
_check_readable
()
buf
=
self
.
_recv_bytes
()
return
pickle
.
loads
(
buf
.
getbuffer
())
return
ForkingPickler
.
loads
(
buf
.
getbuffer
())
def
poll
(
self
,
timeout
=
0.0
):
"""Whether there is any input available to be read"""
...
...
Lib/multiprocessing/forking.py
Dosyayı görüntüle @
a655075d
...
...
@@ -7,7 +7,9 @@
# Licensed to PSF under a Contributor Agreement.
#
import
io
import
os
import
pickle
import
sys
import
signal
import
errno
...
...
@@ -44,6 +46,15 @@ class ForkingPickler(Pickler):
def
register
(
cls
,
type
,
reduce
):
cls
.
_extra_reducers
[
type
]
=
reduce
@staticmethod
def
dumps
(
obj
):
buf
=
io
.
BytesIO
()
ForkingPickler
(
buf
,
pickle
.
HIGHEST_PROTOCOL
)
.
dump
(
obj
)
return
buf
.
getbuffer
()
loads
=
pickle
.
loads
def
_reduce_method
(
m
):
if
m
.
__self__
is
None
:
return
getattr
,
(
m
.
__class__
,
m
.
__func__
.
__name__
)
...
...
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