Debian Codegraph @

pypy/module/_collections/interp_defaultdict.py

raw symbols SCIP
1 from pypy.interpreter.error import OperationError
2
3 def missing(space, w_self, w_key):
4 # An interp-level version of this method. This is mostly only
5 # useful because it can be executed atomically in the presence of
6 # threads.
7 w_default_factory = space.getattr(w_self, space.newtext('default_factory'))
8 if space.is_w(w_default_factory, space.w_None):
9 raise OperationError(space.w_KeyError, space.newtuple([w_key]))
10 w_value = space.call_function(w_default_factory)
11 space.setitem(w_self, w_key, w_value)
12 return w_value