Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork32k
Closed
Description
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:
- Removing one
、
character from the first string (foo
): No error. - Removing all
、
characters from the first string:SystemError: Negative size passed to PyUnicode_New
. - Removing
foo=
(i.e., not passingfoo
by keyword): No error. - Removing
lambda:
(i.e., makingeither argument orboth into astr
type instead of aCallable[[], str]
): No error. - 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