diff options
author | Furkan Önder <furkantahaonder@gmail.com> | 2020-06-05 19:56:32 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-05 19:56:32 (GMT) |
commit | fef1fae9df3b03510f9defb25bd0388135b4c591 (patch) | |
tree | b2f2163c6e641d303b4570cc1951311857034b5c /Lib/importlib | |
parent | 087d612efebe7c64e5f079b07e0454111859830e (diff) | |
download | cpython-fef1fae9df3b03510f9defb25bd0388135b4c591.zip cpython-fef1fae9df3b03510f9defb25bd0388135b4c591.tar.gz cpython-fef1fae9df3b03510f9defb25bd0388135b4c591.tar.bz2 |
bpo-19468: delete unnecessary instance check in importlib.reload() (GH-19424)
Automerge-Triggered-By: @brettcannon
Diffstat (limited to 'Lib/importlib')
-rw-r--r-- | Lib/importlib/__init__.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/Lib/importlib/__init__.py b/Lib/importlib/__init__.py index 0c73c50..bea37d7 100644 --- a/Lib/importlib/__init__.py +++ b/Lib/importlib/__init__.py @@ -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" |