(file)
| 45 | |
| 46 | |
| 47 | def _close_file(file): |
| 48 | try: |
| 49 | if hasattr(file, 'close'): |
| 50 | file.close() |
| 51 | else: |
| 52 | os.close(file) |
| 53 | except OSError as exc: |
| 54 | if exc.errno != 9: |
| 55 | raise # re-raise |
| 56 | # It was closed already. |
| 57 | |
| 58 | |
| 59 | def pack_exception(exc=None): |