Skip to content

Commit

Permalink
Restore support for Python3.6 on LTS 18.04 (#1061)
Browse files Browse the repository at this point in the history
Removed one debug print, and replaced `typing.OrderedDict` with
`typing.Dict` (brings little and breaks compat)
  • Loading branch information
hugsy committed Jan 30, 2024
1 parent e123b87 commit c17a0d2
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions gef.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
from io import StringIO, TextIOWrapper
from types import ModuleType
from typing import (Any, ByteString, Callable, Dict, Generator, Iterable,
Iterator, List, NoReturn, Optional, OrderedDict, Sequence, Set, Tuple, Type, TypeVar,
Iterator, List, NoReturn, Optional, Sequence, Set, Tuple, Type, TypeVar,
Union, cast)
from urllib.request import urlopen

Expand Down Expand Up @@ -6466,7 +6466,6 @@ def do_invoke(self, _: List[str], **kwargs: Any) -> None:
return
try:
arena_addr = parse_address(args.arena_address)
print(f"{arena_addr=:#x}")
arena = GlibcArena(f"*{arena_addr:#x}")
self.dump_chunks_arena(arena, ctx)
except gdb.error:
Expand Down Expand Up @@ -9678,8 +9677,8 @@ def __init__(self) -> None:
gef.config["gef.main_arena_offset"] = GefSetting("", str, "Offset from libc base address to main_arena symbol (int or hex). Set to empty string to disable.")
gef.config["gef.propagate_debug_exception"] = GefSetting(False, bool, "If true, when debug mode is enabled, Python exceptions will be propagated all the way.")

self.commands : OrderedDict[str, GenericCommand] = collections.OrderedDict()
self.functions : OrderedDict[str, GenericFunction] = collections.OrderedDict()
self.commands : Dict[str, GenericCommand] = collections.OrderedDict()
self.functions : Dict[str, GenericFunction] = collections.OrderedDict()
self.missing: Dict[str, Exception] = {}
return

Expand Down Expand Up @@ -10121,13 +10120,13 @@ def __init__(self) -> None:

def invoke(self, args: Any, from_tty: bool) -> None:
self.dont_repeat()
missing_commands = gef.gdb.missing
missing_commands: Dict[str, Exception] = gef.gdb.missing
if not missing_commands:
ok("No missing command")
return

for missing_command, reason in missing_commands.items():
warn(f"Command `{missing_command}` is missing, reason {RIGHT_ARROW} {reason}")
for cmd, reason in missing_commands.items():
warn(f"Missing `{cmd}`, reason: {str(reason)}")
return


Expand Down

0 comments on commit c17a0d2

Please sign in to comment.