Skip to content

Conversation

@AT0myks
Copy link
Contributor

@AT0myks AT0myks commented Nov 28, 2024

There were already a few type hints in the code so here's the rest. While testing that on 3.6 I found that in this version seek() was not added yet to ZipExtFile so you'd get an io.UnsupportedOperation: seek error when using pakler with a ZIP file which isn't very helpful. Exiting with a nicer error message is more meaningful to the user. Last change was mostly to get rid of the type checker errors after adding the type hints, but it will also show a nicer error message if there is an attempt to use the file after it's been closed. Allowing close() to be called more than once and the closed property bring the functionality closer to file-related objects of the standard library like io.IOBase.

- add a proxy `_fd` property that will raise a
ValueError if the file is closed. This gives a
better error message than an AttributeError
- allow calling `close()` more than once
- add `closed` property
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant