From bfb9f5dcfe575b9baee771612e6c197c7544e945 Mon Sep 17 00:00:00 2001 From: Boris Staletic Date: Thu, 1 Apr 2021 12:09:27 -0600 Subject: Use importlib instead of imp module on python 3.4+ Python 3.4 has deprecated the imp module in favour of importlib. This patch avoids the DeprecationWarning. This warning is visible to users whose libpython.so has been compiled with --with-pydebug. Considering that even python 3.5 has reached end of life, would it be better to just use importlib and drop support for python 3.0 to 3.3? 2021-02-28 Boris Staletic * gdb/python/lib/gdb/__init__.py: Use importlib on python 3.4+ to avoid deprecation warnings. --- gdb/python/lib/gdb/__init__.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'gdb/python') diff --git a/gdb/python/lib/gdb/__init__.py b/gdb/python/lib/gdb/__init__.py index 84ec728..9a0e989 100644 --- a/gdb/python/lib/gdb/__init__.py +++ b/gdb/python/lib/gdb/__init__.py @@ -18,8 +18,10 @@ import os import sys import _gdb -if sys.version_info[0] > 2: - # Python 3 moved "reload" +# Python 3 moved "reload" +if sys.version_info >= (3, 4): + from importlib import reload +elif sys.version_info[0] > 2: from imp import reload from _gdb import * -- cgit v1.1