Imported Upstream version 60.0.3 upstream/60.0.3
authorJinWang An <jinwang.an@samsung.com>
Mon, 27 Mar 2023 08:02:41 +0000 (17:02 +0900)
committerJinWang An <jinwang.an@samsung.com>
Mon, 27 Mar 2023 08:02:41 +0000 (17:02 +0900)
.bumpversion.cfg
CHANGES.rst
_distutils_hack/__init__.py
setup.cfg

index aff2d44482cd458806459643dba4b89d1618041a..bb1c47a5ce35dbfe4f9ad74f4ec82f3b77909494 100644 (file)
@@ -1,5 +1,5 @@
 [bumpversion]
-current_version = 60.0.2
+current_version = 60.0.3
 commit = True
 tag = True
 
index 4d66fa19514989039d041ba08314275b8e6c9328..4fab510f734b39b61c2cf19697a8e30561681685 100644 (file)
@@ -1,3 +1,12 @@
+v60.0.3
+-------
+
+
+Misc
+^^^^
+* #2940: Avoid KeyError in distutils hack when pip is imported during ensurepip.
+
+
 v60.0.2
 -------
 
index ae97a0b2b1eceaf7bbd2e2ec0a4184576c0e7c40..22bc9ed6e8ead9e9a23e4587006f14a21bce3e14 100644 (file)
@@ -106,17 +106,25 @@ class DistutilsMetaFinder:
         clear_distutils()
         self.spec_for_distutils = lambda: None
 
-    @staticmethod
-    def pip_imported_during_build():
+    @classmethod
+    def pip_imported_during_build(cls):
         """
         Detect if pip is being imported in a build script. Ref #2355.
         """
         import traceback
         return any(
-            frame.f_globals['__file__'].endswith('setup.py')
+            cls.frame_file_is_setup(frame)
             for frame, line in traceback.walk_stack(None)
         )
 
+    @staticmethod
+    def frame_file_is_setup(frame):
+        """
+        Return True if the indicated frame suggests a setup.py file.
+        """
+        # some frames may not have __file__ (#2940)
+        return frame.f_globals.get('__file__', '').endswith('setup.py')
+
 
 DISTUTILS_FINDER = DistutilsMetaFinder()
 
index d6a59e18c8533813f6d88157dcc9d46ab79237ef..77095b645e96ae6740b7e111222d553c7c90aca4 100644 (file)
--- a/setup.cfg
+++ b/setup.cfg
@@ -1,6 +1,6 @@
 [metadata]
 name = setuptools
-version = 60.0.2
+version = 60.0.3
 author = Python Packaging Authority
 author_email = distutils-sig@python.org
 description = Easily download, build, install, upgrade, and uninstall Python packages