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

UnicodeDecodeError orSystemError when usingf-string withlambda and non-ASCII characters #130618

Closed
Labels
@gaesa

Description

@gaesa

Bug report

Bug description:

When using anf-string in combination withlambda functions that return non-ASCII characters, either aUnicodeDecodeError or aSystemError is raised, depending on the specific modification made to the code. These errors do not occur consistently, but rather vary based on how the lambdas and string content are altered.

Steps to Reproduce

deftest1(foo,bar):return""deftest2():returnf"{test1(foo=lambda:'、、、、、、、、、、、、、、、、、',bar=lambda:'abcdefghijklmnopqrstuvwxyz 123456789 123456789',    )}"

Run the code withpython <file.py>, which triggers the following error:

UnicodeDecodeError: 'utf-8' codec can't decode bytes in position 28-29: unexpected end of data

Expected Behavior

The code should execute without raising any errors.

Actual Behavior

The following behaviors are observed when making the specified modifications. Each of these cases is independent:

  1. Removing one character from the first string (foo): No error.
  2. Removing all characters from the first string:SystemError: Negative size passed to PyUnicode_New.
  3. Removingfoo= (i.e., not passingfoo by keyword): No error.
  4. Removinglambda: (i.e., makingeither argument orboth into astr type instead of aCallable[[], str]): No error.
  5. Removing any character from the second string (bar): No error.

Other Relevant Information

The bug doesnot reproduce in Python 3.13.1, but itdoes reproduce in Python 3.13.2 and 3.12.9.

CPython versions tested on:

3.13

Operating systems tested on:

Linux

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp