# List of built-in types converted to heap types

**URL:** <https://discuss.python.org/t/list-of-built-in-types-converted-to-heap-types/8403>\
**Category:** Core Development\
**Tags:** source, heap-types, stdlib\
**Created:** [April 26, 2021, 10:18am UTC](https://discuss.python.org/t/list-of-built-in-types-converted-to-heap-types/8403 "2021-04-26T10:18:18Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![erlendaasland](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/erlendaasland/32/4378_2.png) [@erlendaasland](https://discuss.python.org/u/erlendaasland)\
**Post date:** [April 26, 2021, 10:18am UTC](https://discuss.python.org/t/list-of-built-in-types-converted-to-heap-types/8403/1 "2021-04-26T10:18:18Z")

</div>

Ref. [bpo-43908](https://bugs.python.org/issue43908): here’s a list of stdlib types that have been converted from static types (allocated on the stack) to heap allocated types.

Commits are listed chronologically.

**UPDATE** : I’ve added a checkboxes for the immutable and disallow instantiation flags, and for types with proper GC support. Ref. [msg391905](https://bugs.python.org/issue43916#msg391905) in [bpo-43916](https://bugs.python.org/issue43916) and [msg393547](https://bugs.python.org/issue42972#msg393547) in [bpo-42972](https://bugs.python.org/issue42972).

_Please edit this post if anything is missing!_

> **Commands used to compile this list**
>
> ```python
> # Find commits:
> $ git log --oneline -G"^static\s+PyType_Spec" --format=%h > commit.list
> # Manually filter out some uninteresting commits (test modules, xx modules, ...)
> # Generate markdown list (quick and dirty, could have been more compact):
> $ for REF in $(cat commit.list); do \
> git log -n 1 --format="- [%h](https://github.com/python/cpython/commit/%H) %cs " $REF | tr -d "\n" && \
> git diff-tree --no-commit-id --name-only -r $REF | grep "\.c" | grep -v clinic && \
> git log -n 1 -p $REF | gsed -n "s/^+static[]\+PyType_Spec[]\+\([a-zA-Z_0-9]\+\).*/ - [] \`\1\`/p" && \
> echo ""; \
> done > list.md
> # Manually filter some of the file references (particularly sqlite3 stuff)
> # C&P to Discourse
> 
> ```

> **Raw list of commit refs**
>
> ```python
> 0b858cdd5d
> c8a87addb1
> 75bf107c62
> dd39123970
> 6104013838
> 6a02b38475
> a6109ef68d
> 5c36da78d7
> 01c6aa43dc
> 74b4eda98b
> c8c4200b65
> 256e54acdb
> 9031bd4fa4
> cb6db8b6ae
> a937ab45d6
> 83de110dce
> 52a2df135c
> 2aabc3200b
> 63f102fe07
> 31967fd8d0
> e087f7cd43
> 1937edd376
> ec68918795
> c4862e333a
> bf69a8f99f
> d5b3f6b7f9
> 53e4c91725
> 33f15a16d4
> b3966639d2
> df69e75edc
> f919054e53
> 04f0bbfbed
> ac46eb4ad6
> a1ffad0719
> 4f384af067
> 11dc6c311d
> 3b36fb1f53
> bc07cb883e
> 
> ```

> **Types converted in Python 3.10**
>
> - [0b858cdd5d](https://github.com/python/cpython/commit/0b858cdd5d114f0890b11b6c4d6559d0ceb468ab) 2021-01-04 Modules/cjkcodecs/multibytecodec.c
> 
> - [c8a87addb1](https://github.com/python/cpython/commit/c8a87addb1fa35dec79ed8f227eba3694fc36234) 2021-01-04 Modules/pyexpat.c
> 
> - [75bf107c62](https://github.com/python/cpython/commit/75bf107c62fbdc00af51ee4f6ab69df4bd201104) 2021-01-02 Modules/arraymodule.c
> 
> - [dd39123970](https://github.com/python/cpython/commit/dd39123970892733c317f235808638ae5c0ccf04) 2020-12-29 Modules/\_functoolsmodule.c
> 
> - [6104013838](https://github.com/python/cpython/commit/6104013838e181e3c698cb07316f449a0c31ea96) 2020-12-18 Modules/\_threadmodule.c
> 
> - [6a02b38475](https://github.com/python/cpython/commit/6a02b384751dbc13979efc1185f0a7c1670dc349) 2020-12-15 Modules/\_csv.c
> 
> - [a6109ef68d](https://github.com/python/cpython/commit/a6109ef68d421712ba368ef502c4789e8de113e0) 2020-11-20 Modules/\_sre.c
> 
> - [5c36da78d7](https://github.com/python/cpython/commit/5c36da78d738d0e5fdb539a758cc15abc47c843b) 2020-11-20 Modules/\_ssl.c
> 
> - [01c6aa43dc](https://github.com/python/cpython/commit/01c6aa43dc56b3b64d584c58a49c86f816c05a91) 2020-11-07 Modules/\_queuemodule.c
> 
> - [74b4eda98b](https://github.com/python/cpython/commit/74b4eda98b650245216292ace8d7e30d3997baa7) 2020-11-03 Modules/mmapmodule.c
> 
> - [c8c4200b65](https://github.com/python/cpython/commit/c8c4200b65b2159bbb13cee10d67dfb3676fef26) 2020-10-26 Modules/unicodedata.c
> 
> - [256e54acdb](https://github.com/python/cpython/commit/256e54acdbdb26745d4bbb5cf366454151e42773) 2020-10-01 Modules/\_sqlite
> 
> - [9031bd4fa4](https://github.com/python/cpython/commit/9031bd4fa42dbb0f25aee9286154ad4bf60df3f8) 2020-10-01 Modules/\_sqlite
> 
> - [cb6db8b6ae](https://github.com/python/cpython/commit/cb6db8b6ae47dccc1aa97830d0f05d29f31e0cbc) 2020-09-29 Modules/\_sqlite
> 
> - [83de110dce](https://github.com/python/cpython/commit/83de110dce94a9196dccc01d526628615714e362) 2020-09-23 Modules/\_lsprof.c
> 
> - [52a2df135c](https://github.com/python/cpython/commit/52a2df135c0470b1dbf889edc51b7c556ae4bc80) 2020-09-08 Modules/sha256module.c
> 
> - [2aabc3200b](https://github.com/python/cpython/commit/2aabc3200bf03d2ec1aa987e1e20db704948111e) 2020-09-07 Modules/overlapped.c
> 
> - [63f102fe07](https://github.com/python/cpython/commit/63f102fe079ecb5cb7b921a1cf8bce4077a9d7e2) 2020-09-06 Modules/md5module.c Modules/sha1module.c Modules/sha512module.c
> 
> - [31967fd8d0](https://github.com/python/cpython/commit/31967fd8d0220af84e2698172d1378bffc8cd851) 2020-08-27 Modules/\_operator.c
> 
> - [e087f7cd43](https://github.com/python/cpython/commit/e087f7cd43dfa4223c55a8ecd71f4a7d685178e4) 2020-08-13 Modules/\_winapi.c
> 
> - [1937edd376](https://github.com/python/cpython/commit/1937edd376274cb26090d71253191502a9de32d6) 2020-06-23 Modules/\_lzmamodule.c
> 
> - [ec68918795](https://github.com/python/cpython/commit/ec689187957cc80af56b9a63251bbc295bafd781) 2020-06-20 Modules/\_bz2module.c
> 
> - [c4862e333a](https://github.com/python/cpython/commit/c4862e333ab405dd5789b4061222db1982147de4) 2020-06-17 Modules/\_gdbmmodule.c
> 
> - [bf69a8f99f](https://github.com/python/cpython/commit/bf69a8f99f1b0e19a59509c6c4d7015a31d881a1) 2020-06-16 Modules/\_dbmmodule.c

> **Types converted in Python 3.9**
>
> - [d5b3f6b7f9](https://github.com/python/cpython/commit/d5b3f6b7f9fc74438009af63f1de01bd77be9385) 2020-05-16 Modules/\_hashopenssl.c
> 
> - [53e4c91725](https://github.com/python/cpython/commit/53e4c91725083975598350877e2ed8e2d0194114) 2020-03-30 Modules/\_abc.c
> 
> - [33f15a16d4](https://github.com/python/cpython/commit/33f15a16d40cb8010a8c758952cbf88d7912ee2d) 2020-03-27 Modules/\_json.c
> 
> - [b3966639d2](https://github.com/python/cpython/commit/b3966639d28313809774ca3859a347b9007be8d2) 2019-11-05 Modules/posixmodule.c
> 
> - [df69e75edc](https://github.com/python/cpython/commit/df69e75edcc08475bc9a57a5a76df8a45bfc3c34) 2019-09-25 Modules/\_hashopenssl.c
> 
> - [f919054e53](https://github.com/python/cpython/commit/f919054e539a5c1afde1b31c9fd7a8f5b2313311) 2019-09-14 Modules/selectmodule.c
> 
> - [04f0bbfbed](https://github.com/python/cpython/commit/04f0bbfbedf8d2bb69b012f853de6648b1a9f27f) 2019-09-13 Modules/\_randommodule.c
> 
> - [ac46eb4ad6](https://github.com/python/cpython/commit/ac46eb4ad6662cf6d771b20d8963658b2186c48c) 2019-09-11 Python/Python-ast.c (Parser/asdl\_c.py)
> 
> - [a1ffad0719](https://github.com/python/cpython/commit/a1ffad07195b8b976f8c371a92028240946d4e76) 2019-09-10 Modules/zlibmodule.c
> 
> - [4f384af067](https://github.com/python/cpython/commit/4f384af067d05b16a554bfd976934fca9f87a1cf) 2019-09-10 Modules/\_struct.c

> **Types converted pre Python 3.9**
>
> ### Python 3.4
> 
> - [11dc6c311d](https://github.com/python/cpython/commit/11dc6c311dc9f8b01fa6a27e1bcdee4c4394d7a2) 2012-10-14 Modules/\_tkinter.c
> - `_tkinter.Tcl_Obj`
> - _need Py\_TPFLAGS\_DISALLOW\_INSTANTIATION_
> - Py\_TPFLAGS\_IMMUTABLETYPE
> - Full GC support
> 
> - `_tkinter.tktimertoken`
> - _need Py\_TPFLAGS\_DISALLOW\_INSTANTIATION_
> - Py\_TPFLAGS\_IMMUTABLETYPE
> - Full GC support
> 
> - `_tkinter.tkapp`
> - _need Py\_TPFLAGS\_DISALLOW\_INSTANTIATION_
> - Py\_TPFLAGS\_IMMUTABLETYPE
> - Full GC support
> 
> ### Python 3.1 (?)
> 
> - [3b36fb1f53](https://github.com/python/cpython/commit/3b36fb1f537a771829c9c7c9720dc040d3c87885) 2012-06-22 Modules/\_ssl.c
> 
> - [bc07cb883e](https://github.com/python/cpython/commit/bc07cb883e5c03b8c108c2c9d86bc0a158d62c27) 2012-06-14 Modules/\_curses\_panel.c

---

_[View the full topic](https://discuss.python.org/t/list-of-built-in-types-converted-to-heap-types/8403)._
