提交 989e153d authored 作者: Frederic's avatar Frederic

Make sure we delete the added path if the insert succeeded.

I think the insert will always succeed, but just in case.
上级 27f62bf3
...@@ -57,10 +57,10 @@ def compile_cutils(): ...@@ -57,10 +57,10 @@ def compile_cutils():
preargs=args) preargs=args)
try: try:
# Must be at the beginning to ensure no conflict with other project
# that would use the same module name.
sys.path.insert(0, config.compiledir)
try: try:
# Must be at the beginning to ensure no conflict with other project
# that would use the same module name.
sys.path.insert(0, config.compiledir)
from cutils_ext.cutils_ext import * from cutils_ext.cutils_ext import *
except ImportError: except ImportError:
import cmodule import cmodule
...@@ -85,4 +85,5 @@ try: ...@@ -85,4 +85,5 @@ try:
# Release lock on compilation directory. # Release lock on compilation directory.
release_lock() release_lock()
finally: finally:
del sys.path[0] if sys.path[0] == config.compiledir:
del sys.path[0]
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论