bpo-19468: delete unnecessary instance check in importlib.reload() (GH-19424)

Automerge-Triggered-By: @brettcannon
This commit is contained in:
Furkan Önder 2020-06-05 22:56:32 +03:00 committed by GitHub
parent 087d612efe
commit fef1fae9df
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 4 deletions

View File

@ -54,7 +54,6 @@ _unpack_uint32 = _bootstrap_external._unpack_uint32
# Fully bootstrapped at this point, import whatever you like, circular
# dependencies and startup overhead minimisation permitting :)
import types
import warnings
@ -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"

View File

@ -0,0 +1,2 @@
Delete unnecessary instance check in importlib.reload().
Patch by Furkan Önder.