[Python-Dev] When to use EOFError? (original) (raw)
Serhiy Storchaka storchaka at gmail.com
Tue Jun 21 16:48:09 EDT 2016
- Previous message (by thread): [Python-Dev] Compact ordered dict is not ordered for split table. (was: PEP XXX: Compact ordered dict
- Next message (by thread): [Python-Dev] When to use EOFError?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
There is a design question. If you read file in some format or with some protocol, and the data is ended unexpectedly, when to use general EOFError exception and when to use format/protocol specific exception?
For example when load truncated pickle data, an unpickler can raise EOFError, UnpicklingError, ValueError or AttributeError. It is possible to avoid ValueError or AttributeError, but what exception should be raised instead, EOFError or UnpicklingError? Maybe convert all EOFError to UnpicklingError? Or all UnpicklingError caused by unexpectedly ended input to EOFError? Or raise EOFError if the input is ended after completed opcode, and UnpicklingError if it contains truncated opcode?
http://bugs.python.org/issue25761
- Previous message (by thread): [Python-Dev] Compact ordered dict is not ordered for split table. (was: PEP XXX: Compact ordered dict
- Next message (by thread): [Python-Dev] When to use EOFError?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]