summaryrefslogtreecommitdiff
path: root/pyuno
diff options
context:
space:
mode:
authorThomas Viehmann <tv@beamnet.de>2019-04-01 09:34:20 +0200
committerSamuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>2019-04-02 09:22:03 +0200
commitdbbf20a4b40916ca4f5c98f18827ede39ad7a828 (patch)
tree9df010fe3478864e0d19f409c4b6b5763062c450 /pyuno
parent671912cc941620551ef85f00a679df884e0cfaab (diff)
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: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
Diffstat (limited to 'pyuno')
-rw-r--r--pyuno/source/loader/pythonloader.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/pyuno/source/loader/pythonloader.py b/pyuno/source/loader/pythonloader.py
index ddb9001fc0e6..268cb168fe3c 100644
--- a/pyuno/source/loader/pythonloader.py
+++ b/pyuno/source/loader/pythonloader.py
@@ -100,8 +100,8 @@ class Loader( XImplementationLoader, XServiceInfo, unohelper.Base ):
# compile and execute the module
codeobject = compile( src, encfile(filename), "exec" )
+ mod.__file__ = filename
exec(codeobject, mod.__dict__)
- mod.__file__ = encfile(filename)
g_loadedComponents[url] = mod
return mod
elif "vnd.openoffice.pymodule" == protocol: