prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  "'function' object has no attribute '_reset'" in `pwndbg/pwndbg/color/syntax_highlight.py`
  <!--
  Before reporting a new issue, make sure that we do not have any duplicates already open.
  If there is one it might be good to take part in the discussion there.
  
  Please make sure you have checked that the issue persists on LATEST pwndbg version.
  
  Below is a template for BUG REPORTS.
  Don't include it if this is a FEATURE REQUEST.
  -->
  
  
  ### Description
  
  using latest dev branch, with `set syntax-highlight-style solarized-light` param, above error will be thrown
  
  ```bash
  $ gdb ~/matrix-matrix-multiply/build/src/dgemm -ex 'start' -ex ''
  pwndbg: loaded 141 pwndbg commands and 42 shell commands. Type pwndbg [--shell | --all] [filter] for a list.
  pwndbg: created $rebase, $ida GDB functions (can be used with print/break)
  Traceback (most recent call last):
    File "/home/czg/pwndbg/pwndbg/gdblib/config.py", line 93, in __get_set_string_gdb_gte_9
      trigger()
    File "/home/czg/pwndbg/pwndbg/color/syntax_highlight.py", line 37, in check_style
      get_highlight_source._reset()
      ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  AttributeError: 'function' object has no attribute '_reset'
  /home/czg/.gdbinit:19: Error in sourced command file:
  Error occurred in Python: 'function' object has no attribute '_reset'
  ```
  
  when I read `$ git log -p pwndbg/commands/context.py` I found nothing about `_reset`, but the error only exists after I upgrade python from `3.10` to `3.11.3` and pwndbg recently.
  
  <!--
  Briefly describe the problem you are having in a few paragraphs.
  -->
  
  <!--
  ### Steps to reproduce
  -->
  
  <!--
  What do we have to do to reproduce the problem?
  If this is connected to particular C/asm code, 
  please provide the smallest C code that reproduces the issue.
  -->
  
  <!--
  ### My setup
  -->
  
  <!--
  Show us your gdb/python/pwndbg/OS/IDA Pro version (depending on your case).
  
  NOTE: We are currently supporting only Ubuntu installations.
  It is known that pwndbg is not fully working e.g. on Arch Linux (the heap stuff is not working there).
  If you would like to change this situation - help us improving pwndbg and supporting other distros!
  
  This can be displayed in pwndbg through `version` command.
  
  If it is somehow unavailable, use:
  * `show version` - for gdb
  * `py import sys; print(sys.version)` - for python
  * pwndbg version/git commit id
  -->
  
  
  </issue>
  <code>
  [start of pwndbg/color/syntax_highlight.py]
  1 import os.path
  2 import re
  3 from typing import Any
  4 from typing import Dict
  5 
  6 import pygments
  7 import pygments.formatters
  8 import pygments.lexers
  9 
  10 import pwndbg.gdblib.config
  11 from pwndbg.color import disable_colors
  12 from pwndbg.color import message
  13 from pwndbg.color import theme
  14 from pwndbg.color.lexer import PwntoolsLexer
  15 
  16 pwndbg.gdblib.config.add_param("syntax-highlight", True, "Source code / assembly syntax highlight")
  17 style = theme.add_param(
  18     "syntax-highlight-style",
  19     "monokai",
  20     "Source code / assembly syntax highlight stylename of pygments module",
  21 )
  22 
  23 formatter = pygments.formatters.Terminal256Formatter(style=str(style))
  24 pwntools_lexer = PwntoolsLexer()
  25 lexer_cache: Dict[str, Any] = {}
  26 
  27 
  28 @pwndbg.gdblib.config.trigger(style)
  29 def check_style() -> None:
  30     global formatter
  31     try:
  32         formatter = pygments.formatters.Terminal256Formatter(style=str(style))
  33 
  34         # Reset the highlighted source cache
  35         from pwndbg.commands.context import get_highlight_source
  36 
  37         get_highlight_source._reset()
  38     except pygments.util.ClassNotFound:
  39         print(
  40             message.warn(f"The pygment formatter style '{style}' is not found, restore to default")
  41         )
  42         style.revert_default()
  43 
  44 
  45 def syntax_highlight(code, filename=".asm"):
  46     # No syntax highlight if pygment is not installed
  47     if disable_colors:
  48         return code
  49 
  50     filename = os.path.basename(filename)
  51 
  52     lexer = lexer_cache.get(filename, None)
  53 
  54     # If source code is asm, use our customized lexer.
  55     # Note: We can not register our Lexer to pygments and use their APIs,
  56     # since the pygment only search the lexers installed via setuptools.
  57     if not lexer:
  58         for glob_pat in PwntoolsLexer.filenames:
  59             pat = "^" + glob_pat.replace(".", r"\.").replace("*", r".*") + "$"
  60             if re.match(pat, filename):
  61                 lexer = pwntools_lexer
  62                 break
  63 
  64     if not lexer:
  65         try:
  66             lexer = pygments.lexers.guess_lexer_for_filename(filename, code, stripnl=False)
  67         except pygments.util.ClassNotFound:
  68             # no lexer for this file or invalid style
  69             pass
  70 
  71     if lexer:
  72         lexer_cache[filename] = lexer
  73 
  74         code = pygments.highlight(code, lexer, formatter).rstrip()
  75 
  76     return code
  77
  [end of pwndbg/color/syntax_highlight.py]
  </code>
  
  I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format.
  <patch>
  diff --git a/file.py b/file.py
  --- a/file.py
  +++ b/file.py
  @@ -1,27 +1,35 @@
   def euclidean(a, b):
  -    while b:
  -        a, b = b, a % b
  -    return a
  +    if b == 0:
  +        return a
  +    return euclidean(b, a % b)
   
   
   def bresenham(x0, y0, x1, y1):
       points = []
       dx = abs(x1 - x0)
       dy = abs(y1 - y0)
  -    sx = 1 if x0 < x1 else -1
  -    sy = 1 if y0 < y1 else -1
  -    err = dx - dy
  +    x, y = x0, y0
  +    sx = -1 if x0 > x1 else 1
  +    sy = -1 if y0 > y1 else 1
   
  -    while True:
  -        points.append((x0, y0))
  -        if x0 == x1 and y0 == y1:
  -            break
  -        e2 = 2 * err
  -        if e2 > -dy:
  -            err -= dy
  -            x0 += sx
  -        if e2 < dx:
  -            err += dx
  -            y0 += sy
  +    if dx > dy:
  +        err = dx / 2.0
  +        while x != x1:
  +            points.append((x, y))
  +            err -= dy
  +            if err < 0:
  +                y += sy
  +                err += dx
  +            x += sx
  +    else:
  +        err = dy / 2.0
  +        while y != y1:
  +            points.append((x, y))
  +            err -= dx
  +            if err < 0:
  +                x += sx
  +                err += dy
  +            y += sy
  +
  +    points.append((x, y))
       return points
  
  </patch>
golden_diff: diff --git a/pwndbg/color/syntax_highlight.py b/pwndbg/color/syntax_highlight.py
  --- a/pwndbg/color/syntax_highlight.py
  +++ b/pwndbg/color/syntax_highlight.py
  @@ -34,7 +34,7 @@
           # Reset the highlighted source cache
           from pwndbg.commands.context import get_highlight_source
   
  -        get_highlight_source._reset()
  +        get_highlight_source.cache.clear()
       except pygments.util.ClassNotFound:
           print(
               message.warn(f"The pygment formatter style '{style}' is not found, restore to default")
  
verification_info: {"golden_diff": "diff --git a/pwndbg/color/syntax_highlight.py b/pwndbg/color/syntax_highlight.py\n--- a/pwndbg/color/syntax_highlight.py\n+++ b/pwndbg/color/syntax_highlight.py\n@@ -34,7 +34,7 @@\n         # Reset the highlighted source cache\n         from pwndbg.commands.context import get_highlight_source\n \n-        get_highlight_source._reset()\n+        get_highlight_source.cache.clear()\n     except pygments.util.ClassNotFound:\n         print(\n             message.warn(f\"The pygment formatter style '{style}' is not found, restore to default\")\n", "issue": "\"'function' object has no attribute '_reset'\" in `pwndbg/pwndbg/color/syntax_highlight.py`\n<!--\r\nBefore reporting a new issue, make sure that we do not have any duplicates already open.\r\nIf there is one it might be good to take part in the discussion there.\r\n\r\nPlease make sure you have checked that the issue persists on LATEST pwndbg version.\r\n\r\nBelow is a template for BUG REPORTS.\r\nDon't include it if this is a FEATURE REQUEST.\r\n-->\r\n\r\n\r\n### Description\r\n\r\nusing latest dev branch, with `set syntax-highlight-style solarized-light` param, above error will be thrown\r\n\r\n```bash\r\n$ gdb ~/matrix-matrix-multiply/build/src/dgemm -ex 'start' -ex ''\r\npwndbg: loaded 141 pwndbg commands and 42 shell commands. Type pwndbg [--shell | --all] [filter] for a list.\r\npwndbg: created $rebase, $ida GDB functions (can be used with print/break)\r\nTraceback (most recent call last):\r\n  File \"/home/czg/pwndbg/pwndbg/gdblib/config.py\", line 93, in __get_set_string_gdb_gte_9\r\n    trigger()\r\n  File \"/home/czg/pwndbg/pwndbg/color/syntax_highlight.py\", line 37, in check_style\r\n    get_highlight_source._reset()\r\n    ^^^^^^^^^^^^^^^^^^^^^^^^^^^\r\nAttributeError: 'function' object has no attribute '_reset'\r\n/home/czg/.gdbinit:19: Error in sourced command file:\r\nError occurred in Python: 'function' object has no attribute '_reset'\r\n```\r\n\r\nwhen I read `$ git log -p pwndbg/commands/context.py` I found nothing about `_reset`, but the error only exists after I upgrade python from `3.10` to `3.11.3` and pwndbg recently.\r\n\r\n<!--\r\nBriefly describe the problem you are having in a few paragraphs.\r\n-->\r\n\r\n<!--\r\n### Steps to reproduce\r\n-->\r\n\r\n<!--\r\nWhat do we have to do to reproduce the problem?\r\nIf this is connected to particular C/asm code, \r\nplease provide the smallest C code that reproduces the issue.\r\n-->\r\n\r\n<!--\r\n### My setup\r\n-->\r\n\r\n<!--\r\nShow us your gdb/python/pwndbg/OS/IDA Pro version (depending on your case).\r\n\r\nNOTE: We are currently supporting only Ubuntu installations.\r\nIt is known that pwndbg is not fully working e.g. on Arch Linux (the heap stuff is not working there).\r\nIf you would like to change this situation - help us improving pwndbg and supporting other distros!\r\n\r\nThis can be displayed in pwndbg through `version` command.\r\n\r\nIf it is somehow unavailable, use:\r\n* `show version` - for gdb\r\n* `py import sys; print(sys.version)` - for python\r\n* pwndbg version/git commit id\r\n-->\r\n\n", "before_files": [{"content": "import os.path\nimport re\nfrom typing import Any\nfrom typing import Dict\n\nimport pygments\nimport pygments.formatters\nimport pygments.lexers\n\nimport pwndbg.gdblib.config\nfrom pwndbg.color import disable_colors\nfrom pwndbg.color import message\nfrom pwndbg.color import theme\nfrom pwndbg.color.lexer import PwntoolsLexer\n\npwndbg.gdblib.config.add_param(\"syntax-highlight\", True, \"Source code / assembly syntax highlight\")\nstyle = theme.add_param(\n    \"syntax-highlight-style\",\n    \"monokai\",\n    \"Source code / assembly syntax highlight stylename of pygments module\",\n)\n\nformatter = pygments.formatters.Terminal256Formatter(style=str(style))\npwntools_lexer = PwntoolsLexer()\nlexer_cache: Dict[str, Any] = {}\n\n\n@pwndbg.gdblib.config.trigger(style)\ndef check_style() -> None:\n    global formatter\n    try:\n        formatter = pygments.formatters.Terminal256Formatter(style=str(style))\n\n        # Reset the highlighted source cache\n        from pwndbg.commands.context import get_highlight_source\n\n        get_highlight_source._reset()\n    except pygments.util.ClassNotFound:\n        print(\n            message.warn(f\"The pygment formatter style '{style}' is not found, restore to default\")\n        )\n        style.revert_default()\n\n\ndef syntax_highlight(code, filename=\".asm\"):\n    # No syntax highlight if pygment is not installed\n    if disable_colors:\n        return code\n\n    filename = os.path.basename(filename)\n\n    lexer = lexer_cache.get(filename, None)\n\n    # If source code is asm, use our customized lexer.\n    # Note: We can not register our Lexer to pygments and use their APIs,\n    # since the pygment only search the lexers installed via setuptools.\n    if not lexer:\n        for glob_pat in PwntoolsLexer.filenames:\n            pat = \"^\" + glob_pat.replace(\".\", r\"\\.\").replace(\"*\", r\".*\") + \"$\"\n            if re.match(pat, filename):\n                lexer = pwntools_lexer\n                break\n\n    if not lexer:\n        try:\n            lexer = pygments.lexers.guess_lexer_for_filename(filename, code, stripnl=False)\n        except pygments.util.ClassNotFound:\n            # no lexer for this file or invalid style\n            pass\n\n    if lexer:\n        lexer_cache[filename] = lexer\n\n        code = pygments.highlight(code, lexer, formatter).rstrip()\n\n    return code\n", "path": "pwndbg/color/syntax_highlight.py"}]}