@@ -238,12 +238,12 @@ def base_async_def(
238238 return prepare (out , ** kwargs )
239239
240240
241- def make_py_str (str_contents , target , after_py_str_defined = False ):
242- """Get code that effectively wraps the given code in py_str."""
241+ def make_py_str (str_contents , target , after_py_str_defined ):
242+ """Get code that effectively wraps the given str in py_str."""
243243 return (
244244 repr (str_contents ) if target .startswith ("3" )
245245 else "b" + repr (str_contents ) if target .startswith ("2" )
246- else "py_str (" + repr (str_contents ) + ")" if after_py_str_defined
246+ else "_coconut_py_str (" + repr (str_contents ) + ")" if after_py_str_defined
247247 else "str(" + repr (str_contents ) + ")"
248248 )
249249
@@ -285,9 +285,12 @@ def process_header_args(which, use_hash, target, no_tco, strict, no_wrap):
285285 _coconut_ = "_coconut_" if which != "__coconut__" else "" , # only for aliases defined at the end of the header
286286 VERSION_STR = VERSION_STR ,
287287 module_docstring = '"""Built-in Coconut utilities."""\n \n ' if which == "__coconut__" else "" ,
288- __coconut__ = make_py_str ("__coconut__" , target ),
289- _coconut_cached__coconut__ = make_py_str ("_coconut_cached__coconut__" , target ),
290- coconut_cache_dir = make_py_str (coconut_cache_dir , target ),
288+ __coconut__ = make_py_str ("__coconut__" , target , after_py_str_defined = False ),
289+ _coconut_cached__coconut__ = make_py_str ("_coconut_cached__coconut__" , target , after_py_str_defined = False ),
290+ coconut_cache_dir = make_py_str (coconut_cache_dir , target , after_py_str_defined = False ),
291+ py_str_module = make_py_str ("module" , target , after_py_str_defined = True ),
292+ py_str_typing = make_py_str ("typing" , target , after_py_str_defined = True ),
293+ py_str_MatchError = make_py_str ("MatchError" , target , after_py_str_defined = True ),
291294 object = "" if target .startswith ("3" ) else "(object)" ,
292295 comma_object = "" if target .startswith ("3" ) else ", object" ,
293296 comma_slash = ", /" if target_info >= (3 , 8 ) else "" ,
0 commit comments