From 08235187bcdd66599884f33b046cf8abcf949727 Mon Sep 17 00:00:00 2001 From: Christian Biesinger Date: Thu, 15 Aug 2019 11:29:04 -0500 Subject: Rename internal Python functions to start with an underscore I could not tell if GdbSetPythonDirectory is internal or not because I could not find any references to it, so I left it as-is. Tested by running the testsuite on gdb.python/*.exp; everything still passes. 2019-08-15 Christian Biesinger * python/lib/gdb/__init__.py (GdbOutputFile): Rename to have a leading underscore. (GdbOutputErrorFile): Likewise. (global scope): Adjust constructor calls to GdbOutput{,Error}File accordingly. (execute_unwinders): Rename to have a leading underscore. (auto_load_packages): Likewise. (global scope): Adjust call to auto_load_packages accordingly. (GdbSetPythonDirectory): Likewise. * python/py-unwind.c (pyuw_sniffer): Call _execute_unwinders instead of execute_unwinders. gdb/testsuite/ChangeLog: 2019-08-15 Christian Biesinger * gdb.python/python.exp: Expect a leading underscore on GdbOutput{,Error}File. --- gdb/python/lib/gdb/__init__.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'gdb/python/lib') diff --git a/gdb/python/lib/gdb/__init__.py b/gdb/python/lib/gdb/__init__.py index af74df8..8af9e47 100644 --- a/gdb/python/lib/gdb/__init__.py +++ b/gdb/python/lib/gdb/__init__.py @@ -43,17 +43,17 @@ class _GdbFile (object): def flush(self): flush() -class GdbOutputFile (_GdbFile): +class _GdbOutputFile (_GdbFile): def write(self, s): write(s, stream=STDOUT) -sys.stdout = GdbOutputFile() +sys.stdout = _GdbOutputFile() -class GdbOutputErrorFile (_GdbFile): +class _GdbOutputErrorFile (_GdbFile): def write(self, s): write(s, stream=STDERR) -sys.stderr = GdbOutputErrorFile() +sys.stderr = _GdbOutputErrorFile() # Default prompt hook does nothing. prompt_hook = None @@ -74,7 +74,7 @@ frame_filters = {} # Initial frame unwinders. frame_unwinders = [] -def execute_unwinders(pending_frame): +def _execute_unwinders(pending_frame): """Internal function called from GDB to execute all unwinders. Runs each currently enabled unwinder until it finds the one that @@ -124,7 +124,7 @@ packages = [ # manually iterate the list, collating the Python files in each module # path. Construct the module name, and import. -def auto_load_packages(): +def _auto_load_packages(): for package in packages: location = os.path.join(os.path.dirname(__file__), package) if os.path.exists(location): @@ -144,7 +144,7 @@ def auto_load_packages(): except: sys.stderr.write (traceback.format_exc() + "\n") -auto_load_packages() +_auto_load_packages() def GdbSetPythonDirectory(dir): """Update sys.path, reload gdb and auto-load packages.""" @@ -161,7 +161,7 @@ def GdbSetPythonDirectory(dir): # note that reload overwrites the gdb module without deleting existing # attributes reload(__import__(__name__)) - auto_load_packages() + _auto_load_packages() def current_progspace(): "Return the current Progspace." -- cgit v1.1