public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
* [binutils-gdb] Suppress some "undefined" warnings from flake8
@ 2024-04-02 17:09 Tom Tromey
0 siblings, 0 replies; only message in thread
From: Tom Tromey @ 2024-04-02 17:09 UTC (permalink / raw)
To: gdb-cvs
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=34b0776fd7385fcf1108981307d6d625f3565779
commit 34b0776fd7385fcf1108981307d6d625f3565779
Author: Tom Tromey <tromey@adacore.com>
Date: Tue Mar 19 11:08:34 2024 -0600
Suppress some "undefined" warnings from flake8
flake8 warns about some identifiers in __init__.py, because it does
not realize these come from the star-imported _gdb module. This patch
suppresses these warnings.
Diff:
---
gdb/python/lib/gdb/__init__.py | 17 +++++++++--------
1 file changed, 9 insertions(+), 8 deletions(-)
diff --git a/gdb/python/lib/gdb/__init__.py b/gdb/python/lib/gdb/__init__.py
index 2ff1f95c8fd..611d725af58 100644
--- a/gdb/python/lib/gdb/__init__.py
+++ b/gdb/python/lib/gdb/__init__.py
@@ -26,6 +26,8 @@ if sys.version_info >= (3, 4):
else:
from imp import reload
+import _gdb
+
# Note that two indicators are needed here to silence flake8.
from _gdb import * # noqa: F401,F403
@@ -56,15 +58,14 @@ class _GdbFile(object):
self.write(line)
def flush(self):
- flush(stream=self.stream)
+ _gdb.flush(stream=self.stream)
def write(self, s):
- write(s, stream=self.stream)
-
+ _gdb.write(s, stream=self.stream)
-sys.stdout = _GdbFile(STDOUT)
-sys.stderr = _GdbFile(STDERR)
+sys.stdout = _GdbFile(_gdb.STDOUT)
+sys.stderr = _GdbFile(_gdb.STDERR)
# Default prompt hook does nothing.
prompt_hook = None
@@ -185,7 +186,7 @@ def GdbSetPythonDirectory(dir):
def current_progspace():
"Return the current Progspace."
- return selected_inferior().progspace
+ return _gdb.selected_inferior().progspace
def objfiles():
@@ -222,14 +223,14 @@ def set_parameter(name, value):
value = "on"
else:
value = "off"
- execute("set " + name + " " + str(value), to_string=True)
+ _gdb.execute("set " + name + " " + str(value), to_string=True)
@contextmanager
def with_parameter(name, value):
"""Temporarily set the GDB parameter NAME to VALUE.
Note that this is a context manager."""
- old_value = parameter(name)
+ old_value = _gdb.parameter(name)
set_parameter(name, value)
try:
# Nothing that useful to return.
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2024-04-02 17:09 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-02 17:09 [binutils-gdb] Suppress some "undefined" warnings from flake8 Tom Tromey
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).