Title: AST unparsing of infinity numbers
Type: behavior Stage: patch review
Components: Interpreter Core Versions: Python 3.9, Python 3.8, Python 3.7
Status: open Resolution:
Dependencies: Superseder:
Assigned To: serhiy.storchaka Nosy List: BTaskaya, gvanrossum, lukasz.langa, mark.dickinson, serhiy.storchaka
Priority: normal Keywords: patch

Created on 2018-02-21 12:20 by serhiy.storchaka, last changed 2019-12-01 18:38 by BTaskaya.

Pull Requests
URL Status Linked Edit
PR 17426 open BTaskaya, 2019-12-01 18:38
Messages (1)
msg312492 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2018-02-21 12:20
AST unparsing of infinity numbers produces a string which can't be evaluated because inf and infj are not builtins.

>>> from __future__ import annotations
>>> def f(x: A[1e1000, 1e1000j]): pass
>>> f.__annotations__
{'x': 'A[(inf, infj)]'}

See how this problem is handled in Tools/parser/

There is similar problem with NaN. NaN can't be a result of parsing Python sources, but it can be injected manually in AST, and it can be a result of third-party AST optimizer.
Date User Action Args
2019-12-01 18:38:27BTaskayasetkeywords: + patch
stage: patch review
pull_requests: + pull_request16905
2019-12-01 18:35:53BTaskayasetnosy: + BTaskaya
2019-12-01 18:35:44BTaskayasetversions: + Python 3.9
2018-11-21 14:23:10mark.dickinsonsetnosy: + mark.dickinson
2018-11-21 08:33:49serhiy.storchakasetassignee: serhiy.storchaka
2018-02-21 12:20:59serhiy.storchakacreate