[Libreoffice-commits] core.git: Branch 'libreoffice-6-2' - pyuno/source

Thomas Viehmann (via logerrit) logerrit at kemper.freedesktop.org
Tue Apr 2 10:15:23 UTC 2019


 pyuno/source/loader/pythonloader.py |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 71295a9d41a4e0f8b01c74ebf586fc2c15babfd2
Author:     Thomas Viehmann <tv at beamnet.de>
AuthorDate: Mon Apr 1 09:34:20 2019 +0200
Commit:     Thorsten Behrens <Thorsten.Behrens at CIB.de>
CommitDate: Tue Apr 2 12:15:01 2019 +0200

    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 at cib.de>
    (cherry picked from commit dbbf20a4b40916ca4f5c98f18827ede39ad7a828)
    Reviewed-on: https://gerrit.libreoffice.org/70119
    Reviewed-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>

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:


More information about the Libreoffice-commits mailing list