Skip to content

Instantly share code, notes, and snippets.

@charettes
Created December 23, 2015 23:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save charettes/8c1cc2e5e5e9b3eda4e8 to your computer and use it in GitHub Desktop.
Save charettes/8c1cc2e5e5e9b3eda4e8 to your computer and use it in GitHub Desktop.
Python 3.5 OrderedDict bug
import collections
import gc
import weakref
def create_reference():
class A(object):
pass
class B(A):
parents = collections.OrderedDict([
(A, A.__name__),
])
return weakref.ref(A)
reference = create_reference()
gc.collect()
assert reference() is None
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment