DebugClientBase: changed code to get rid of the use of the deprecated imp module.

Fri, 09 Oct 2020 17:17:21 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Fri, 09 Oct 2020 17:17:21 +0200
changeset 7769
c9f64088224b
parent 7768
6aec9032afad
child 7770
49f3377aebf1

DebugClientBase: changed code to get rid of the use of the deprecated imp module.

eric6/DebugClients/Python/DebugClientBase.py file | annotate | diff | comparison | revisions
--- a/eric6/DebugClients/Python/DebugClientBase.py	Thu Oct 08 19:07:33 2020 +0200
+++ b/eric6/DebugClients/Python/DebugClientBase.py	Fri Oct 09 17:17:21 2020 +0200
@@ -15,11 +15,12 @@
 import traceback
 import os
 import json
-import imp
 import re
 import atexit
 import signal
 import time
+import types
+import importlib
 
 
 import DebugClientCapabilities
@@ -162,7 +163,7 @@
         self.framenr = 0
         
         # The context to run the debugged program in.
-        self.debugMod = imp.new_module('__main__')
+        self.debugMod = types.ModuleType('__main__')
         self.debugMod.__dict__['__builtins__'] = __builtins__
 
         # The list of complete lines to execute.
@@ -834,8 +835,9 @@
                             discoveryStart, top_level_dir=top_level_dir)
                 else:
                     if params["filename"]:
-                        utModule = imp.load_source(
+                        spec = importlib.util.spec_from_file_location(
                             params["testname"], params["filename"])
+                        utModule = importlib.util.module_from_spec(spec)
                     else:
                         utModule = None
                     if params["failed"]:

eric ide

mercurial