Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #188 from pv/pyxbuild-fixes

pyximport: fix a bug crashing other processes
  • Loading branch information...
commit e68266894c83ab697d80ed568d44018b394b11e5 2 parents 7845d15 + e2f2580
@scoder scoder authored
Showing with 11 additions and 0 deletions.
  1. +11 −0 pyximport/pyxbuild.py
View
11 pyximport/pyxbuild.py
@@ -124,6 +124,17 @@ def pyx_to_dll(filename, ext = None, force_rebuild = 0,
basename + '.reload%s'%count)
try:
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)
so_path = r_path
except IOError:
Please sign in to comment.
Something went wrong with that request. Please try again.