Add comment explaining to_native usage.

This commit is contained in:
Matt Clay 2019-01-16 11:16:54 -08:00
parent 53a640f2cc
commit 54867b4add

View file

@ -351,6 +351,7 @@ class PluginLoader:
with warnings.catch_warnings(): with warnings.catch_warnings():
warnings.simplefilter("ignore", RuntimeWarning) warnings.simplefilter("ignore", RuntimeWarning)
with open(to_bytes(path), 'rb') as module_file: with open(to_bytes(path), 'rb') as module_file:
# to_native is used here because imp.load_source's path is for tracebacks and python's traceback formatting uses native strings
module = imp.load_source(full_name, to_native(path), module_file) module = imp.load_source(full_name, to_native(path), module_file)
return module return module