From: Tom Tromey <tromey@adacore.com>
To: Tom Tromey <tromey@adacore.com>
Cc: Simon Marchi <simark@simark.ca>, gdb-patches@sourceware.org
Subject: Re: [PATCH 8/9] Suppress some "undefined" warnings from flake8
Date: Wed, 20 Mar 2024 14:32:56 -0600 [thread overview]
Message-ID: <87wmpwej9j.fsf@tromey.com> (raw)
In-Reply-To: <871q84fxy8.fsf@tromey.com> (Tom Tromey's message of "Wed, 20 Mar 2024 14:30:23 -0600")
Tom> Yeah. I'll send v2 with this fixed.
Well, I did some branch shenanigans and b4 is unhappy, so here's the
updated version of just this one patch.
Tom
commit 19d1ac05202ade4d4129bbad0e277f67bfdb1aaf
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 --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.
next prev parent reply other threads:[~2024-03-20 20:32 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-19 17:33 [PATCH 0/9] Make gdb/python flake-clean Tom Tromey
2024-03-19 17:33 ` [PATCH 1/9] Remove .flake8 Tom Tromey
2024-03-19 17:33 ` [PATCH 2/9] Fix flake8 errors in dap/server.py Tom Tromey
2024-03-19 17:33 ` [PATCH 3/9] Ignore unsed import in dap/__init__.py Tom Tromey
2024-03-20 15:35 ` Tom Tromey
2024-03-19 17:33 ` [PATCH 4/9] Remove unused import from gdb/__init__.py Tom Tromey
2024-03-19 17:33 ` [PATCH 5/9] Remove bare "except" from disassembler.py Tom Tromey
2024-03-19 17:33 ` [PATCH 6/9] Suppress star import errors Tom Tromey
2024-03-19 17:33 ` [PATCH 7/9] Specify ImportError in styling.py Tom Tromey
2024-03-19 17:33 ` [PATCH 8/9] Suppress some "undefined" warnings from flake8 Tom Tromey
2024-03-20 18:58 ` Simon Marchi
2024-03-20 20:30 ` Tom Tromey
2024-03-20 20:32 ` Tom Tromey [this message]
2024-03-19 17:33 ` [PATCH 9/9] Do not use bare "except" Tom Tromey
2024-03-20 19:01 ` [PATCH 0/9] Make gdb/python flake-clean Simon Marchi
2024-04-02 17:01 ` Tom Tromey
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87wmpwej9j.fsf@tromey.com \
--to=tromey@adacore.com \
--cc=gdb-patches@sourceware.org \
--cc=simark@simark.ca \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).