(self)
| 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'): |