Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork33.7k
Closed
Description
Crash report
What happened?
Using a byte string for the encoding parameter ofstr() results in a crash (instead of the expected TypeError):
str(b"hello",b"ascii")
Here is the output I get on macos, 3.13.0b4:
% pythonPython 3.13.0b4 (main, Jul 24 2024, 12:21:52) [Clang 15.0.0 (clang-1500.3.9.4)] on darwinType"help","copyright","credits" or"license"for more information.>>> str(b"hello", b"ascii")Fatal Python error: _Py_CheckFunctionResult: afunctionreturned a result with an exceptionsetPython runtime state: initializedTypeError:str() argument'encoding' must be str, not bytesThe above exception was the direct cause of the following exception:SystemError:<class'str'> returned a result with an exceptionsetCurrent thread 0x00000002064b0c00 (most recent call first): File"<python-input-0>", line 1in<module> File"/Users/phillipschanely/.pyenv/versions/3.13.0b4-debug/lib/python3.13/code.py", line 91in runcode File"/Users/phillipschanely/.pyenv/versions/3.13.0b4-debug/lib/python3.13/_pyrepl/console.py", line 200in runsource File"/Users/phillipschanely/.pyenv/versions/3.13.0b4-debug/lib/python3.13/code.py", line 303in push File"/Users/phillipschanely/.pyenv/versions/3.13.0b4-debug/lib/python3.13/_pyrepl/simple_interact.py", line 156in run_multiline_interactive_console File"/Users/phillipschanely/.pyenv/versions/3.13.0b4-debug/lib/python3.13/_pyrepl/main.py", line 57in interactive_console File"/Users/phillipschanely/.pyenv/versions/3.13.0b4-debug/lib/python3.13/_pyrepl/__main__.py", line 6in<module> File"/Users/phillipschanely/.pyenv/versions/3.13.0b4-debug/lib/python3.13/runpy.py", line 88in _run_code File"/Users/phillipschanely/.pyenv/versions/3.13.0b4-debug/lib/python3.13/runpy.py", line 198in _run_module_as_mainzsh: abort python
CPython versions tested on:
CPython main branch
Operating systems tested on:
macOS
Output from running 'python -VV' on the command line:
Python 3.13.0b4 (main, Jul 24 2024, 12:21:52) [Clang 15.0.0 (clang-1500.3.9.4)]
Linked PRs
Metadata
Metadata
Assignees
Projects
Status
Done