-
-
Notifications
You must be signed in to change notification settings - Fork 33.3k
Open
Labels
Description
Documentation
When I looked at the docs of the shutil module, I noticed that it doesn't mention that shutil.Error is a subclass of OSError. running shutil.Error.mro() reveals that indeed shutil.Error subclasses OSError and it can also be seen in the code. I think it would be nice to document this fact, so I know that if I do multiple operations which could raise other subclasses of OSError like shutil.copy, then I can use:
try:
... # Use shutil.copytree which raises shutil.Error and/or shutil.copy/shutil.copy2 which raises OSError
except OSError as e:
... # Handle any error that occured.instead of:
try:
...
except (OSError, shutil.Error) as e: # The docs don't mention that shutil.Error and OSError are related, so I need to catch both of them
...If it's intentionally not documented since it's an implementation detail, then I still think the docs should mention that and say that it could change, and users shouldn't rely on shutil.Error being a subclass of OSError.
Metadata
Metadata
Assignees
Labels
Projects
Status
Todo