Commit 34f6211d authored by Stefan Behnel's avatar Stefan Behnel

do not reject invalid module names when embedding - the result may still be executable

parent 6b1b8ed9
......@@ -116,7 +116,7 @@ class Context(object):
return Errors.report_error(exc)
def find_module(self, module_name,
relative_to = None, pos = None, need_pxd = 1):
relative_to = None, pos = None, need_pxd = 1, check_module_name = True):
# Finds and returns the module scope corresponding to
# the given relative or absolute module name. If this
# is the first time the module has been requested, finds
......@@ -131,7 +131,7 @@ class Context(object):
scope = None
pxd_pathname = None
if not module_name_pattern.match(module_name):
if check_module_name and not module_name_pattern.match(module_name):
if pos is None:
pos = (module_name, 0, 0)
raise CompileError(pos,
......
......@@ -26,7 +26,8 @@ def parse_stage_factory(context):
full_module_name = compsrc.full_module_name
initial_pos = (source_desc, 1, 0)
saved_cimport_from_pyx, Options.cimport_from_pyx = Options.cimport_from_pyx, False
scope = context.find_module(full_module_name, pos = initial_pos, need_pxd = 0)
scope = context.find_module(full_module_name, pos = initial_pos, need_pxd = 0,
check_module_name = not Options.embed)
Options.cimport_from_pyx = saved_cimport_from_pyx
tree = context.parse(source_desc, scope, pxd = 0, full_module_name = full_module_name)
tree.compilation_source = compsrc
......
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