(self)
| 138 | self.close() |
| 139 | |
| 140 | def close(self): |
| 141 | if self.dict is None: |
| 142 | return |
| 143 | try: |
| 144 | self.sync() |
| 145 | try: |
| 146 | self.dict.close() |
| 147 | except AttributeError: |
| 148 | pass |
| 149 | finally: |
| 150 | # Catch errors that may happen when close is called from __del__ |
| 151 | # because CPython is in interpreter shutdown. |
| 152 | try: |
| 153 | self.dict = _ClosedDict() |
| 154 | except: |
| 155 | self.dict = None |
| 156 | |
| 157 | def __del__(self): |
| 158 | if not hasattr(self, 'writeback'): |