Staging
v0.5.1
https://github.com/python/cpython
Revision 7301979b23406220510dd2c7934a21b41b647119 authored by Yurii Karabas on 25 November 2020, 10:43:18 UTC, committed by GitHub on 25 November 2020, 10:43:18 UTC
Reduce memory footprint and improve performance of loading modules having many func annotations.

  >>> sys.getsizeof({"a":"int","b":"int","return":"int"})
  232
  >>> sys.getsizeof(("a","int","b","int","return","int"))
  88

The tuple is converted into dict on the fly when `func.__annotations__` is accessed first.

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Co-authored-by: Inada Naoki <songofacandy@gmail.com>
1 parent 85c8492
History
Tip revision: 7301979b23406220510dd2c7934a21b41b647119 authored by Yurii Karabas on 25 November 2020, 10:43:18 UTC
bpo-42202: Store func annotations as a tuple (GH-23316)
Tip revision: 7301979
File Mode Size
.azure-pipelines
.github
Doc
Grammar
Include
Lib
Mac
Misc
Modules
Objects
PC
PCbuild
Parser
Programs
Python
Tools
m4
.gitattributes -rw-r--r-- 1.9 KB
.gitignore -rw-r--r-- 1.8 KB
.travis.yml -rw-r--r-- 8.4 KB
CODE_OF_CONDUCT.md -rw-r--r-- 630 bytes
LICENSE -rw-r--r-- 13.6 KB
Makefile.pre.in -rw-r--r-- 67.9 KB
README.rst -rw-r--r-- 10.0 KB
aclocal.m4 -rw-r--r-- 12.8 KB
config.guess -rwxr-xr-x 43.1 KB
config.sub -rwxr-xr-x 35.4 KB
configure -rwxr-xr-x 503.1 KB
configure.ac -rw-r--r-- 170.0 KB
install-sh -rwxr-xr-x 15.0 KB
netlify.toml -rw-r--r-- 82 bytes
pyconfig.h.in -rw-r--r-- 44.9 KB
setup.py -rw-r--r-- 107.5 KB

README.rst

back to top