MCPcopy Index your code
hub / github.com/python/cpython / close

Method close

Lib/shelve.py:152–167  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

150 self.close()
151
152 def close(self):
153 if self.dict is None:
154 return
155 try:
156 self.sync()
157 try:
158 self.dict.close()
159 except AttributeError:
160 pass
161 finally:
162 # Catch errors that may happen when close is called from __del__
163 # because CPython is in interpreter shutdown.
164 try:
165 self.dict = _ClosedDict()
166 except:
167 self.dict = None
168
169 def __del__(self):
170 if not hasattr(self, 'writeback'):

Callers 3

__exit__Method · 0.95
__del__Method · 0.95
test_closeMethod · 0.95

Calls 2

syncMethod · 0.95
_ClosedDictClass · 0.85

Tested by 1

test_closeMethod · 0.76