Skip to content

Commit a30bd53

Browse files
committed
Make emlink.py import-safe. Fixes an issue where python multiprocessing.py enters an infinite loop throwing errors 'Attempt to start a new process before the current process has finished its bootstrapping phase.' when running other.test_static_link. See http://stackoverflow.com/questions/18204782/runtimeerror-on-windows-trying-python-multiprocessing .
1 parent 149b9ea commit a30bd53

File tree

1 file changed

+16
-13
lines changed

1 file changed

+16
-13
lines changed

emlink.py

+16-13
Original file line numberDiff line numberDiff line change
@@ -10,21 +10,24 @@
1010
from tools import shared
1111
from tools.asm_module import AsmModule
1212

13-
try:
14-
me, main, side, out = sys.argv[:4]
15-
except:
16-
print >> sys.stderr, 'usage: emlink.py [main module] [side module] [output name]'
17-
sys.exit(1)
13+
def run():
14+
try:
15+
me, main, side, out = sys.argv[:4]
16+
except:
17+
print >> sys.stderr, 'usage: emlink.py [main module] [side module] [output name]'
18+
sys.exit(1)
1819

19-
print 'Main module:', main
20-
print 'Side module:', side
21-
print 'Output:', out
20+
print 'Main module:', main
21+
print 'Side module:', side
22+
print 'Output:', out
2223

23-
shared.try_delete(out)
24+
shared.try_delete(out)
2425

25-
main = AsmModule(main)
26-
side = AsmModule(side)
26+
main = AsmModule(main)
27+
side = AsmModule(side)
2728

28-
side.relocate_into(main)
29-
main.write(out)
29+
side.relocate_into(main)
30+
main.write(out)
3031

32+
if __name__ == '__main__':
33+
run()

0 commit comments

Comments
 (0)