-
-
Notifications
You must be signed in to change notification settings - Fork 33.5k
Open
Labels
interpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)type-featureA feature request or enhancementA feature request or enhancement
Description
Bug report
Bug description:
>>> "%.f"%(1+1j)
Traceback (most recent call last):
File "<python-input-27>", line 1, in <module>
"%.f"%(1+1j)
~~~~~^^~~~~~
TypeError: must be real number, not complex
>>> "%.d"%(1+1j)
Traceback (most recent call last):
File "<python-input-28>", line 1, in <module>
"%.d"%(1+1j)
~~~~~^^~~~~~
TypeError: %d format: a real number is required, not complexAs you can see, trying to format a complex 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
Assignees
Labels
interpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)type-featureA feature request or enhancementA feature request or enhancement