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

Improve TypeError hints for%-formats #142037

Closed
Assignees
serhiy-storchaka
Labels
3.15new features, bugs and security fixesinterpreter-core(Objects, Python, Grammar, and Parser dirs)type-featureA feature request or enhancement
@WFLing-seaer

Description

@WFLing-seaer

Bug report

Bug description:

>>>"%.f"%(1+1j)Traceback (mostrecentcalllast):File"<python-input-27>",line1,in<module>"%.f"%(1+1j)~~~~~^^~~~~~TypeError:mustberealnumber,notcomplex>>>"%.d"%(1+1j)Traceback (mostrecentcalllast):File"<python-input-28>",line1,in<module>"%.d"%(1+1j)~~~~~^^~~~~~TypeError:%dformat:arealnumberisrequired,notcomplex

As you can see, trying to format acomplex with.d and.f produces two outputs with the same meaning but different expressions.
Expected: same expressions for same meaning.

CPython versions tested on:

3.14

Operating systems tested on:

Windows

Linked PRs

Metadata

Metadata

Labels

3.15new features, bugs and security fixesinterpreter-core(Objects, Python, Grammar, and Parser dirs)type-featureA feature request or enhancement

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions


    [8]ページ先頭

    ©2009-2026 Movatter.jp