diff --git a/_distutils_hack/__init__.py b/_distutils_hack/__init__.py index 75bc4463bb..cc62dcf68c 100644 --- a/_distutils_hack/__init__.py +++ b/_distutils_hack/__init__.py @@ -118,7 +118,9 @@ def create_module(self, spec): def exec_module(self, module): pass - return importlib.util.spec_from_loader('distutils', DistutilsLoader()) + return importlib.util.spec_from_loader( + 'distutils', DistutilsLoader(), origin=mod.__file__ + ) def spec_for_pip(self): """ diff --git a/changelog.d/2990.change.rst b/changelog.d/2990.change.rst new file mode 100644 index 0000000000..bb6e6032f4 --- /dev/null +++ b/changelog.d/2990.change.rst @@ -0,0 +1 @@ +Set the ``.origin`` attribute of the ``distutils`` module to the module's ``__file__``.