dict.clear() make the dict to empty key-sharing dict to reduce it's size.
New dict can use same technique.
$ ./python.default
Python 3.7.0a0 (heads/master:6dfcc81, Apr 10 2017, 19:55:52)
[GCC 6.2.0 20161005] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> d = {}
>>> sys.getsizeof(d)
240
>>> d.clear()
>>> sys.getsizeof(d)
72
$ ./python.patched
Python 3.7.0a0 (heads/master-dirty:6dfcc81, Apr 11 2017, 18:11:02)
[GCC 6.2.0 20161005] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.getsizeof({})
72 |