UnicodeDecodeError: 'utf-8' codec can't decode byte 0xf0 in position 1: invalid continuation byte
Closed this issue · 0 comments
ericwb commented
Describe the bug
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xf0 in position 1: invalid continuation byte
To Reproduce
Steps to reproduce the behavior:
- git clone https://github.com/python/cpython
- precli --debug ../cpython/Lib/test/encoded_modules/module_koi8_r.py
- See error
/Users/ericwb/.pyenv/versions/3.12.2/lib/python3.12/site-packages/tree_sitter/__init__.py:36: FutureWarning: Language(path, name) is deprecated. Use Language(ptr, name) instead.
warn("{} is deprecated. Use {} instead.".format(old, new), FutureWarning)
logging initialized
Working on file: ../cpython/Lib/test/encoded_modules/module_koi8_r.py
Exception occurred when executing rules against ../cpython/Lib/test/encoded_modules/module_koi8_r.py. Run "precli --debug ../cpython/Lib/test/encoded_modules/module_koi8_r.py" to see the full traceback.
Exception string: 'utf-8' codec can't decode byte 0xf0 in position 1: invalid continuation 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 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 118, in visit_assignment
right_hand = self.resolve(nodes[2], default=nodes[2])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/ericwb/.pyenv/versions/3.12.2/lib/python3.12/site-packages/precli/parsers/python.py", line 420, in resolve
nodetext = node.utf8_text
^^^^^^^^^^^^^^
File "/Users/ericwb/.pyenv/versions/3.12.2/lib/python3.12/site-packages/precli/parsers/__init__.py", line 73, in utf8_text
return self.text.decode()
^^^^^^^^^^^^^^^^^^
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xf0 in position 1: invalid continuation byte
Expected behavior
A clear and concise description of what you expected to happen.
Version
precli 0.5.4
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