Commit e6826689 authored by scoder's avatar scoder

Merge pull request #188 from pv/pyxbuild-fixes

pyximport: fix a bug crashing other processes
parents 7845d15b e2f2580a
...@@ -124,6 +124,17 @@ def pyx_to_dll(filename, ext = None, force_rebuild = 0, ...@@ -124,6 +124,17 @@ def pyx_to_dll(filename, ext = None, force_rebuild = 0,
basename + '.reload%s'%count) basename + '.reload%s'%count)
try: try:
import shutil # late import / reload_support is: debugging import shutil # late import / reload_support is: debugging
try:
# Try to unlink first --- if the .so file
# is mmapped by another process,
# overwriting its contents corrupts the
# loaded image (on Linux) and crashes the
# other process. On Windows, unlinking an
# open file just fails.
if os.path.isfile(r_path):
os.unlink(r_path)
except OSError:
continue
shutil.copy2(org_path, r_path) shutil.copy2(org_path, r_path)
so_path = r_path so_path = r_path
except IOError: except IOError:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment