From 677cc696435b41570a84951fd35fa373b4cd167c Mon Sep 17 00:00:00 2001 From: whitequark Date: Fri, 28 Aug 2015 02:22:16 -0500 Subject: [PATCH] compiler.embedding: actually use qualified name when embedding methods. Previous commit 6b55e3b only did this for embedded types. --- artiq/compiler/embedding.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/artiq/compiler/embedding.py b/artiq/compiler/embedding.py index 199c98f0b..1476dce4a 100644 --- a/artiq/compiler/embedding.py +++ b/artiq/compiler/embedding.py @@ -420,7 +420,7 @@ class Stitcher: embedded_function = function.artiq_embedded.function source_code = textwrap.dedent(inspect.getsource(embedded_function)) filename = embedded_function.__code__.co_filename - module_name, _ = os.path.splitext(os.path.basename(filename)) + module_name = embedded_function.__globals__['__name__'] first_line = embedded_function.__code__.co_firstlineno # Extract function environment. @@ -436,7 +436,7 @@ class Stitcher: function_node = parsetree.body[0] # Mangle the name, since we put everything into a single module. - function_node.name = "{}.{}".format(module_name, function_node.name) + function_node.name = "{}.{}".format(module_name, function.__qualname__) # Normally, LocalExtractor would populate the typing environment # of the module with the function name. However, since we run