New submission from Inada Naoki <[email protected]>:
Python 3.10 compiler adds None to co_consts even when None is not used at all.
```
$ cat x1.py
def foo():
"docstring"
return 42
import dis
dis.dis(foo)
print(foo.__code__.co_consts)
$ python3.9 x1.py
3 0 LOAD_CONST 1 (42)
2 RETURN_VALUE
('docstring', 42)
$ python3.10 x1.py
3 0 LOAD_CONST 1 (42)
2 RETURN_VALUE
('docstring', 42, None)
```
----------
components: Interpreter Core
keywords: 3.10regression
messages: 400683
nosy: methane
priority: normal
severity: normal
status: open
title: compiler: Unnecessary None in co_consts
versions: Python 3.10
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue45056>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com