Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Incorrect argument type forstr() crashes the interpreter #122888

Closed
Assignees
JelleZijlstra
Labels
release-blockertype-crashA hard crash of the interpreter, possibly with a core dump
@pschanely

Description

@pschanely

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

Labels

release-blockertype-crashA hard crash of the interpreter, possibly with a core dump

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions


    [8]ページ先頭

    ©2009-2025 Movatter.jp