Kaydet (Commit) dbbf20a4 authored tarafından Thomas Viehmann's avatar Thomas Viehmann Kaydeden (comit) Samuel Mehrbrodt

For Python extensions, set __file__ before executing the module

Previously __file__ was set after executing the module. This meant,
however that it was not available during execution.
This patch moves setting __file__ before the execution.

As __file__ is a string (and not bytes), we remove the encoding.

Change-Id: I63fe34b6f5d30f53aab16627d413c87b9de81992
Reviewed-on: https://gerrit.libreoffice.org/70048
Tested-by: Jenkins
Reviewed-by: 's avatarSamuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
üst 671912cc
...@@ -100,8 +100,8 @@ class Loader( XImplementationLoader, XServiceInfo, unohelper.Base ): ...@@ -100,8 +100,8 @@ class Loader( XImplementationLoader, XServiceInfo, unohelper.Base ):
# compile and execute the module # compile and execute the module
codeobject = compile( src, encfile(filename), "exec" ) codeobject = compile( src, encfile(filename), "exec" )
mod.__file__ = filename
exec(codeobject, mod.__dict__) exec(codeobject, mod.__dict__)
mod.__file__ = encfile(filename)
g_loadedComponents[url] = mod g_loadedComponents[url] = mod
return mod return mod
elif "vnd.openoffice.pymodule" == protocol: elif "vnd.openoffice.pymodule" == protocol:
......
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