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
5046e974
Kaydet (Commit)
5046e974
authored
Eki 08, 2012
tarafından
Richard Oudkerk
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Make __mp_main__ an alias for __main__ in all processes to simplify
pickling of classes defined in main module.
üst
c3c6fe5b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
16 deletions
+13
-16
__init__.py
Lib/multiprocessing/__init__.py
+7
-0
forking.py
Lib/multiprocessing/forking.py
+6
-16
No files found.
Lib/multiprocessing/__init__.py
Dosyayı görüntüle @
5046e974
...
...
@@ -39,6 +39,13 @@ import sys
from
multiprocessing.process
import
Process
,
current_process
,
active_children
from
multiprocessing.util
import
SUBDEBUG
,
SUBWARNING
#
# Alias for main module -- will be reset by bootstrapping child processes
#
if
'__main__'
in
sys
.
modules
:
sys
.
modules
[
'__mp_main__'
]
=
sys
.
modules
[
'__main__'
]
#
# Exceptions
#
...
...
Lib/multiprocessing/forking.py
Dosyayı görüntüle @
5046e974
...
...
@@ -441,27 +441,17 @@ def prepare(data):
dirs
=
[
os
.
path
.
dirname
(
main_path
)]
assert
main_name
not
in
sys
.
modules
,
main_name
sys
.
modules
.
pop
(
'__mp_main__'
,
None
)
file
,
path_name
,
etc
=
imp
.
find_module
(
main_name
,
dirs
)
try
:
# We
would like to do "imp.load_module('__main__', ...)"
#
here. However, that would cause 'if __name__ ==
#
"__main__"' clauses to be executed
.
# We
should not do 'imp.load_module("__main__", ...)'
#
since that would execute 'if __name__ == "__main__"'
#
clauses, potentially causing a psuedo fork bomb
.
main_module
=
imp
.
load_module
(
'__
parents
_main__'
,
file
,
path_name
,
etc
'__
mp
_main__'
,
file
,
path_name
,
etc
)
finally
:
if
file
:
file
.
close
()
sys
.
modules
[
'__main__'
]
=
main_module
main_module
.
__name__
=
'__main__'
# Try to make the potentially picklable objects in
# sys.modules['__main__'] realize they are in the main
# module -- somewhat ugly.
for
obj
in
list
(
main_module
.
__dict__
.
values
()):
try
:
if
obj
.
__module__
==
'__parents_main__'
:
obj
.
__module__
=
'__main__'
except
Exception
:
pass
sys
.
modules
[
'__main__'
]
=
sys
.
modules
[
'__mp_main__'
]
=
main_module
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