[4/7] libstdc++: Remove unused locals from printers.py

Message ID 20230928174630.4004388-5-tromey@adacore.com
State Unresolved
Headers
Series libstdc++: Use gdb.ValuePrinter in pretty-printers |

Checks

Context Check Description
snail/gcc-patch-check warning Git am fail log

Commit Message

Tom Tromey Sept. 28, 2023, 5:46 p.m. UTC
  flake8 pointed out some unused local variables in the libstdc++
pretty-printers.  This removes them.

libstdc++-v3/ChangeLog:

        * python/libstdcxx/v6/printers.py
	(StdExpOptionalPrinter.__init__, lookup_node_type):
	Remove unused variables.
---
 libstdc++-v3/python/libstdcxx/v6/printers.py | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
  

Comments

Jonathan Wakely Sept. 28, 2023, 6:53 p.m. UTC | #1
On Thu, 28 Sept 2023, 18:50 Tom Tromey via Libstdc++, <libstdc++@gcc.gnu.org>
wrote:

> flake8 pointed out some unused local variables in the libstdc++
> pretty-printers.  This removes them.
>

OK, thanks.



> libstdc++-v3/ChangeLog:
>
>         * python/libstdcxx/v6/printers.py
>         (StdExpOptionalPrinter.__init__, lookup_node_type):
>         Remove unused variables.
> ---
>  libstdc++-v3/python/libstdcxx/v6/printers.py | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/libstdc++-v3/python/libstdcxx/v6/printers.py
> b/libstdc++-v3/python/libstdcxx/v6/printers.py
> index 8d44244afb0..6bf4fe891fd 100644
> --- a/libstdc++-v3/python/libstdcxx/v6/printers.py
> +++ b/libstdc++-v3/python/libstdcxx/v6/printers.py
> @@ -169,7 +169,7 @@ def lookup_node_type(nodename, containertype):
>      valtype = valtype.strip_typedefs()
>      try:
>          return lookup_templ_spec(nodename, valtype)
> -    except gdb.error as e:
> +    except gdb.error:
>          # For debug mode containers the node is in std::__cxx1998.
>          if is_member_of_namespace(nodename, 'std'):
>              if is_member_of_namespace(containertype, 'std::__cxx1998',
> @@ -1423,7 +1423,6 @@ class
> StdExpOptionalPrinter(SingleObjContainerPrinter):
>      "Print a std::optional or std::experimental::optional"
>
>      def __init__(self, typename, val):
> -        valtype = self._recognize(val.type.template_argument(0))
>          typename = strip_versioned_namespace(typename)
>          self._typename = re.sub(
>              '^std::(experimental::|)(fundamentals_v\d::|)(.*)',
> r'std::\1\3', typename, 1)
> --
> 2.40.1
>
>
  

Patch

diff --git a/libstdc++-v3/python/libstdcxx/v6/printers.py b/libstdc++-v3/python/libstdcxx/v6/printers.py
index 8d44244afb0..6bf4fe891fd 100644
--- a/libstdc++-v3/python/libstdcxx/v6/printers.py
+++ b/libstdc++-v3/python/libstdcxx/v6/printers.py
@@ -169,7 +169,7 @@  def lookup_node_type(nodename, containertype):
     valtype = valtype.strip_typedefs()
     try:
         return lookup_templ_spec(nodename, valtype)
-    except gdb.error as e:
+    except gdb.error:
         # For debug mode containers the node is in std::__cxx1998.
         if is_member_of_namespace(nodename, 'std'):
             if is_member_of_namespace(containertype, 'std::__cxx1998',
@@ -1423,7 +1423,6 @@  class StdExpOptionalPrinter(SingleObjContainerPrinter):
     "Print a std::optional or std::experimental::optional"
 
     def __init__(self, typename, val):
-        valtype = self._recognize(val.type.template_argument(0))
         typename = strip_versioned_namespace(typename)
         self._typename = re.sub(
             '^std::(experimental::|)(fundamentals_v\d::|)(.*)', r'std::\1\3', typename, 1)