From b5fcdc3c07efb2c1175503b9c70e6d7336aa1452 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Thu, 14 May 2020 12:56:56 +0200 Subject: fix python 3.8 deprecation warnings the logo changes were caused by > Support of nested sets and set operations as in Unicode Technical Standard > #18 might be added in the future. This would change the syntax, so to facilitate > this change a FutureWarning will be raised in ambiguous cases for the time being. > That includes sets starting with a literal '[' or containing literal character > sequences '--', '&&', '~~', and '||'. > To avoid a warning escape them with a backslash. Change-Id: I4d48be3df2eaadf03a9d1f5750c0c94b3abbf674 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94191 Tested-by: Noel Grandin Reviewed-by: Noel Grandin --- scripting/source/pyprov/pythonscript.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'scripting/source') diff --git a/scripting/source/pyprov/pythonscript.py b/scripting/source/pyprov/pythonscript.py index 5e14a863e8b8..4955c8c54888 100644 --- a/scripting/source/pyprov/pythonscript.py +++ b/scripting/source/pyprov/pythonscript.py @@ -21,7 +21,7 @@ import uno import unohelper import sys import os -import imp +import types import time import ast import platform @@ -341,7 +341,7 @@ class ScriptContext(unohelper.Base): # code = readTextFromStream( sfa.openFileRead( url ) ) # execute the module -# entry = ModuleEntry( lastRead, imp.new_module("ooo_script_framework") ) +# entry = ModuleEntry( lastRead, types.ModuleType("ooo_script_framework") ) # entry.module.__dict__[GLOBAL_SCRIPTCONTEXT_NAME] = g_scriptContext # entry.module.__file__ = url # exec code in entry.module.__dict__ @@ -483,7 +483,7 @@ class ProviderContext: src = ensureSourceState( src ) # execute the module - entry = ModuleEntry( lastRead, imp.new_module("ooo_script_framework") ) + entry = ModuleEntry( lastRead, types.ModuleType("ooo_script_framework") ) entry.module.__dict__[GLOBAL_SCRIPTCONTEXT_NAME] = self.scriptContext code = None @@ -577,7 +577,7 @@ class ScriptBrowseNode( unohelper.Base, XBrowseNode , XPropertySet, XInvocation, if event.ActionCommand == "Run": code = self.editor.getControl("EditorTextField").getText() code = ensureSourceState( code ) - mod = imp.new_module("ooo_script_framework") + mod = types.ModuleType("ooo_script_framework") mod.__dict__[GLOBAL_SCRIPTCONTEXT_NAME] = self.provCtx.scriptContext exec(code, mod.__dict__) values = mod.__dict__.get( CALLABLE_CONTAINER_NAME , None ) -- cgit