Esempio n. 1
0
def exception_storm():
    my_name = threading.current_thread().name
    my_ident = threading.current_thread().ident
    i = 0
    from weakref import WeakValueDictionary

    d = WeakValueDictionary()

    k = C()
    v = C()
    d[k] = v

    x = C()
    while not thread_abort:
        d.__contains__(x)
        i += 1
        if i % 10000 == 0: print('{} [{}] processed {} exceptions'.format(my_name, my_ident, i))
    print("Exiting")
Esempio n. 2
0
 def __contains__(self, key):
     return WeakValueDictionary.__contains__(self, freeze(key))
Esempio n. 3
0
 def __contains__(self, key):
     if isinstance(key, bytes):
         key = key.decode("utf-8")
     return WeakValueDictionary.__contains__(self, key)
Esempio n. 4
0
 def __contains__(self, key):
     return WeakValueDictionary.__contains__(self, freeze(key))