jroesch commented on a change in pull request #9130:
URL: https://github.com/apache/tvm/pull/9130#discussion_r717066921



##########
File path: python/tvm/parser/__init__.py
##########
@@ -26,8 +26,10 @@ def add(self, name, content):
         return _ffi.get_global_func("SourceMapAdd")(self, name, content)
 
 
-def parse(source, source_name="from_string"):
-    return _ffi_api.ParseModule(source_name, source)
+def parse(source, source_name="from_string", init_module=None, 
init_meta_table=None):
+    if init_meta_table is None:

Review comment:
       You can't default Python arguments to anything but atomic values. If you 
use an object or other aggregate data structure the default will be allocated a 
single time, and only a single time. If you happen to mutate it you will 
observe the entire history of mutations across all invocations of the function 
inside the process. 

##########
File path: python/tvm/parser/__init__.py
##########
@@ -26,8 +26,10 @@ def add(self, name, content):
         return _ffi.get_global_func("SourceMapAdd")(self, name, content)
 
 
-def parse(source, source_name="from_string"):
-    return _ffi_api.ParseModule(source_name, source)
+def parse(source, source_name="from_string", init_module=None, 
init_meta_table=None):
+    if init_meta_table is None:

Review comment:
       > I'd suggest the language behaviour is the silly part? 👍
   
   Yeah its not a good design, but alas you gotta love the Python you are with 
😆 it has burned many people many times, super sharp edge.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to