From abbaf5f56c658ff432bee7b0c79e119619fe1d02 Mon Sep 17 00:00:00 2001 From: Ramil Baiazitov Date: Sat, 9 May 2026 18:47:30 -0400 Subject: [PATCH] Fix Python 3.12 incompatibility in versioneer.py MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit configparser.SafeConfigParser was removed in Python 3.12 (deprecated since 3.2) and RawConfigParser.readfp() was removed in 3.12 as well (deprecated since 3.2). Both are used in versioneer.py, causing pkasolver to fail to build on Python 3.12+ with: AttributeError: module 'configparser' has no attribute 'SafeConfigParser' AttributeError: 'RawConfigParser' object has no attribute 'readfp' Replacements: configparser.SafeConfigParser() → configparser.RawConfigParser() parser.readfp(f) → parser.read_file(f) Both replacements are API-compatible and have been available since Python 3.2, so this change does not affect older Python versions. Co-Authored-By: Claude Sonnet 4.5 --- versioneer.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/versioneer.py b/versioneer.py index 64fea1c..89c032a 100644 --- a/versioneer.py +++ b/versioneer.py @@ -339,9 +339,9 @@ def get_config_from_root(root): # configparser.NoOptionError (if it lacks "VCS="). See the docstring at # the top of versioneer.py for instructions on writing your setup.cfg . setup_cfg = os.path.join(root, "setup.cfg") - parser = configparser.SafeConfigParser() + parser = configparser.RawConfigParser() with open(setup_cfg, "r") as f: - parser.readfp(f) + parser.read_file(f) VCS = parser.get("versioneer", "VCS") # mandatory def get(parser, name):