Commit 606f866a authored by Marius Wachtler's avatar Marius Wachtler

compile: allow empty filename

parent 3b0e42ea
......@@ -116,7 +116,7 @@ SourceInfo::SourceInfo(BoxedModule* m, ScopingAnalysis* scoping, FutureFlags fut
ast(ast),
cfg(NULL),
body(std::move(body)) {
assert(fn->size());
assert(fn);
// TODO: we should track this reference correctly rather than making it a root
gc::registerPermanentRoot(fn, true);
this->fn = fn;
......
......@@ -2642,7 +2642,7 @@ extern "C" bool nonzero(Box* obj) {
|| obj->cls == capifunc_cls || obj->cls == builtin_function_or_method_cls
|| obj->cls == method_cls || obj->cls == frame_cls || obj->cls == generator_cls
|| obj->cls == capi_getset_cls || obj->cls == pyston_getset_cls || obj->cls == wrapperdescr_cls
|| obj->cls == wrapperobject_cls,
|| obj->cls == wrapperobject_cls || obj->cls == code_cls,
"%s.__nonzero__", getTypeName(obj)); // TODO
if (rewriter.get()) {
......
......@@ -20,6 +20,9 @@ exec compile('print(1, 2)', 'test.py', 'exec')
tree = compile('print(1, 2)', 'test.py', 'exec', _ast.PyCF_ONLY_AST)
exec compile(tree, '<tree>', 'exec')
c = compile('print(1, 2)', '', 'exec')
exec c
print(c.co_name, c.co_filename)
# test bad syntax which should not raise in compile time:
try:
......
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