mirror of
https://github.com/python/cpython.git
synced 2024-12-14 12:26:47 +08:00
bpo-19468: delete unnecessary instance check in importlib.reload() (GH-19424)
Automerge-Triggered-By: @brettcannon
This commit is contained in:
parent
087d612efe
commit
fef1fae9df
@ -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:
|
||||
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"
|
||||
|
@ -0,0 +1,2 @@
|
||||
Delete unnecessary instance check in importlib.reload().
|
||||
Patch by Furkan Önder.
|
Loading…
Reference in New Issue
Block a user