Skip to content

Commit

Permalink
bpo-19468: delete unnecessary instance check in importlib.reload() (p…
Browse files Browse the repository at this point in the history
…ythonGH-19424)

Automerge-Triggered-By: @brettcannon
  • Loading branch information
furkanonder authored Jun 5, 2020
1 parent 087d612 commit fef1fae
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
8 changes: 4 additions & 4 deletions Lib/importlib/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@
# Fully bootstrapped at this point, import whatever you like, circular
# dependencies and startup overhead minimisation permitting :)

import types
import warnings


Expand Down Expand Up @@ -136,12 +135,13 @@ def reload(module):
The module must have been successfully imported before.
"""
if not module or not isinstance(module, types.ModuleType):
raise TypeError("reload() argument must be a module")
try:
name = module.__spec__.name
except AttributeError:
name = module.__name__
try:
name = module.__name__
except AttributeError:
raise TypeError("reload() argument must be a module")

if sys.modules.get(name) is not module:
msg = "module {} not in sys.modules"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Delete unnecessary instance check in importlib.reload().
Patch by Furkan Önder.

0 comments on commit fef1fae

Please sign in to comment.