securesauce/precli

UnicodeDecodeError: 'utf-8' while scanning cpython

Closed this issue · 0 comments

Describe the bug
UnicodeDecodeError: 'utf-8' while scanning cpython

To Reproduce
Steps to reproduce the behavior:

  1. git clone https://github.com/python/cpython
  2. precli --debug ../cpython/Tools/i18n/pygettext.py
Working on file: ../cpython/Tools/i18n/pygettext.py
Exception occurred when executing rules against ../cpython/Tools/i18n/pygettext.py. Run "precli --debug ../cpython/Tools/i18n/pygettext.py" to see the full traceback.
  Exception string: 'utf-8' codec can't decode byte 0xfc in position 14: invalid start byte
  Exception traceback: Traceback (most recent call last):
  File "/Users/ericwb/.pyenv/versions/3.12.2/lib/python3.12/site-packages/precli/core/run.py", line 141, in parse_file
    return parser.parse(artifact)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/ericwb/.pyenv/versions/3.12.2/lib/python3.12/site-packages/precli/parsers/__init__.py", line 111, in parse
    self.visit([tree.root_node])
  File "/Users/ericwb/.pyenv/versions/3.12.2/lib/python3.12/site-packages/precli/parsers/__init__.py", line 136, in visit
    visitor_fn(node.children)
  File "/Users/ericwb/.pyenv/versions/3.12.2/lib/python3.12/site-packages/precli/parsers/python.py", line 31, in visit_module
    self.visit(nodes)
  File "/Users/ericwb/.pyenv/versions/3.12.2/lib/python3.12/site-packages/precli/parsers/__init__.py", line 136, in visit
    visitor_fn(node.children)
  File "/Users/ericwb/.pyenv/versions/3.12.2/lib/python3.12/site-packages/precli/parsers/__init__.py", line 139, in visit_comment
    comment = self.context["node"].text.decode()
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xfc in position 14: invalid start byte

Expected behavior
Should not see unhandled exception or errors

Version

precli 0.5.5.dev7
Copyright 2024 Secure Saurce LLC
License BUSL-1.1: Business Source License 1.1 <https://spdx.org/licenses/BUSL-1.1.html>
  Python 3.12.2 (main, May 13 2024, 16:18:42) [Clang 15.0.0 (clang-1500.3.9.4)]

Additional context
n/a