Skip to content

[3.13] Revert "[3.13] gh-132921: Fix setuptools._distutils.dep_util deprecation (GH-132923) (#132926)" - #133004

Merged
vstinner merged 1 commit into
python:3.13from
vstinner:revert
Apr 26, 2025
Merged

vstinner merged 1 commit into
python:3.13from
vstinner:revert

Conversation

@vstinner

@vstinner vstinner commented Apr 26, 2025 •

Copy link
Copy Markdown
Member

This reverts commit 3776ade.

setuptools.modified module is not available on old setuptools versions.

…precation (pythonGH-132923) (python#132926)"

This reverts commit 3776ade.

setuptools.modified module is not available on old setuptools
versions.
@vstinner

Copy link
Copy Markdown
Member Author

Python 3.13 uses setuptools-67.6.1 which doesn't have setuptools.modified module yet :-(

@vstinner vstinner changed the title Revert "[3.13] gh-132921: Fix setuptools._distutils.dep_util deprecation (GH-132923) (#132926)" [3.13] Revert "[3.13] gh-132921: Fix setuptools._distutils.dep_util deprecation (GH-132923) (#132926)" Apr 26, 2025
@vstinner
vstinner enabled auto-merge (squash) April 26, 2025 12:31
@vstinner
vstinner merged commit 994529d into python:3.13 Apr 26, 2025
@vstinner
vstinner deleted the revert branch April 26, 2025 12:53
@kulikjak

kulikjak commented May 6, 2025

Copy link
Copy Markdown
Contributor

Hi @vstinner, do you plan to backport this change in a different way? Because while setuptools.modified is not available in setuptools delivered with Python 3.13, the deprecation warning reappears when newer setuptools is available :(.

Internally, I went with the following; it should work with both old and new:

--- Python-3.13.3/Tools/peg_generator/pegen/build.py
+++ Python-3.13.3/Tools/peg_generator/pegen/build.py
@@ -95,7 +95,10 @@ def compile_c_extension(
     import setuptools.logging
 
     from setuptools import Extension, Distribution
-    from setuptools._distutils.dep_util import newer_group
+    try:
+        from setuptools.modified import newer_group
+    except ImportError:
+        from setuptools._distutils.dep_util import newer_group
     from setuptools._distutils.ccompiler import new_compiler
     from setuptools._distutils.sysconfig import customize_compiler

@vstinner

vstinner commented May 6, 2025

Copy link
Copy Markdown
Member Author

@kulikjak: I created a PR from your comment: #133522

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants