Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pylint crashes with "'\U00010000' == '\ud800\udc00'" #8736

Open
xiaxinmeng opened this issue Jun 6, 2023 · 0 comments
Open

Pylint crashes with "'\U00010000' == '\ud800\udc00'" #8736

xiaxinmeng opened this issue Jun 6, 2023 · 0 comments
Labels
Crash 💥 A bug that makes pylint crash Needs PR This issue is accepted, sufficiently specified and now needs an implementation

Comments

@xiaxinmeng
Copy link

The following code cause pylint crashing with a UnicodeEncodeError.

pylint_example.py:
assert "\U00010000" == "\ud800\udc00"

The expected behavior:

This code can work normally.

The actual output:

>> pylint pylint_example.py
************* Module pylint_example
Desktop/pylint_example.py:10:8: C0303: Trailing whitespace (trailing-whitespace)
Desktop/pylint_example.py:11:0: C0304: Final newline missing (missing-final-newline)
Desktop/pylint_example.py:1:0: C0114: Missing module docstring (missing-module-docstring)
Desktoppylint_example.py:11:0: W0104: Statement seems to have no effect (pointless-statement)
Exception on node <Compare l.11 at 0x7f13363f0750> in file '/home/xxm/Desktop/pylint_example.py'
Traceback (most recent call last):
  File "/home/xxm/.local/lib/python3.11/site-packages/pylint/utils/ast_walker.py", line 91, in walk
    callback(astroid)
  File "/home/xxm/.local/lib/python3.11/site-packages/pylint/checkers/base/comparison_checker.py", line 301, in visit_compare
    self._check_constants_comparison(node)
  File "/home/xxm/.local/lib/python3.11/site-packages/pylint/checkers/base/comparison_checker.py", line 258, in _check_constants_comparison
    self.add_message(
  File "/home/xxm/.local/lib/python3.11/site-packages/pylint/checkers/base_checker.py", line 152, in add_message
    self.linter.add_message(
  File "/home/xxm/.local/lib/python3.11/site-packages/pylint/lint/pylinter.py", line 1257, in add_message
    self._add_one_message(
  File "/home/xxm/.local/lib/python3.11/site-packages/pylint/lint/pylinter.py", line 1215, in _add_one_message
    self.reporter.handle_message(
  File "/home/xxm/.local/lib/python3.11/site-packages/pylint/reporters/text.py", line 161, in handle_message
    self.write_message(msg)
  File "/home/xxm/.local/lib/python3.11/site-packages/pylint/reporters/text.py", line 154, in write_message
    self.writeln(self._fixed_template.format(**self_dict))
  File "/home/xxm/.local/lib/python3.11/site-packages/pylint/reporters/base_reporter.py", line 45, in writeln
    print(string, file=self.out)
UnicodeEncodeError: 'utf-8' codec can't encode characters in position 109-110: surrogates not allowed
Desktop/pylint_example.py:1:0: F0002: /home/xxm/Desktop/pylint_example.py: Fatal error while checking '/home/xxm/Desktop/pylint_example.py'. Please open an issue in our bug tracker so we address this. There is a pre-filled template that you can use in '/home/xxm/.cache/pylint/pylint-crash-2023-06-06-16-17-51.txt'. (astroid-error)

------------------------------------------------------------------
Your code has been rated at 0.00/10 (previous run: 0.00/10, +0.00)

Test Environment:

Ubuntu 18.04,
CPython 3.11.3
Pylint: 3.0.0b1
astroid 3.0.0a3

@Pierre-Sassoulas Pierre-Sassoulas added Crash 💥 A bug that makes pylint crash Needs PR This issue is accepted, sufficiently specified and now needs an implementation labels Jun 6, 2023
Pierre-Sassoulas added a commit to Pierre-Sassoulas/pylint that referenced this issue Jun 14, 2024
Pierre-Sassoulas added a commit to Pierre-Sassoulas/pylint that referenced this issue Sep 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Crash 💥 A bug that makes pylint crash Needs PR This issue is accepted, sufficiently specified and now needs an implementation
Projects
None yet
Development

No branches or pull requests

2 participants