mirror of https://github.com/go-python/gopy.git
gopy: dont reload C-extension module
While waiting for #27 to be handled upstream, prevent users from crashing their interpreter by not allowing to reload a C-extension module if already wrapped and compiled. Fixes #46. Change-Id: Ic9624beae3061b286d09aca71882915923bd6298
This commit is contained in:
parent
41f904d5cc
commit
be74c37022
4
gopy.py
4
gopy.py
|
@ -30,6 +30,10 @@ def load(pkg, output=""):
|
|||
|
||||
print("gopy> inferring package name...")
|
||||
pkg = check_output(["go", "list", pkg]).strip()
|
||||
if pkg in sys.modules:
|
||||
print("gopy> package '%s' already wrapped and loaded!" % (pkg,))
|
||||
print("gopy> NOT recompiling it again (see issue #27)")
|
||||
return sys.modules[pkg]
|
||||
print("gopy> loading '%s'..." % pkg)
|
||||
|
||||
check_call(["gopy","bind", "-output=%s" % output, pkg])
|
||||
|
|
Loading…
Reference in New Issue