diff options
author | Victor Stinner <vstinner@python.org> | 2020-11-20 13:44:02 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-20 13:44:02 (GMT) |
commit | 3be8e220ede7764a403b74eb2051aa703dde2626 (patch) | |
tree | 6e518107c32a37adf642f1ebf35a98eb1e191f30 /Lib/importlib/_bootstrap.py | |
parent | a6109ef68d421712ba368ef502c4789e8de113e0 (diff) | |
download | cpython-3be8e220ede7764a403b74eb2051aa703dde2626.zip cpython-3be8e220ede7764a403b74eb2051aa703dde2626.tar.gz cpython-3be8e220ede7764a403b74eb2051aa703dde2626.tar.bz2 |
bpo-42403: Use @staticmethod in importlib (GH-23395)
Use @staticmethod on methods using @classmethod but don't use their
cls parameter on the following classes:
* BuiltinImporter
* FrozenImporter
* WindowsRegistryFinder
* PathFinder
Leave methods using @_requires_builtin or @_requires_frozen unchanged,
since this decorator requires the wrapped method to have an extra parameter
(cls or self).
Diffstat (limited to 'Lib/importlib/_bootstrap.py')
-rw-r--r-- | Lib/importlib/_bootstrap.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/Lib/importlib/_bootstrap.py b/Lib/importlib/_bootstrap.py index 854b603..9b7335b 100644 --- a/Lib/importlib/_bootstrap.py +++ b/Lib/importlib/_bootstrap.py @@ -761,16 +761,16 @@ class BuiltinImporter: spec = cls.find_spec(fullname, path) return spec.loader if spec is not None else None - @classmethod - def create_module(self, spec): + @staticmethod + def create_module(spec): """Create a built-in module""" if spec.name not in sys.builtin_module_names: raise ImportError('{!r} is not a built-in module'.format(spec.name), name=spec.name) return _call_with_frames_removed(_imp.create_builtin, spec) - @classmethod - def exec_module(self, module): + @staticmethod + def exec_module(module): """Exec a built-in module""" _call_with_frames_removed(_imp.exec_builtin, module) @@ -831,8 +831,8 @@ class FrozenImporter: """ return cls if _imp.is_frozen(fullname) else None - @classmethod - def create_module(cls, spec): + @staticmethod + def create_module(spec): """Use default semantics for module creation.""" @staticmethod |