Fix: Accept lists in gen_preprocess_options for TOML compatibility#5188
Open
realMelTuc wants to merge 2 commits intopypa:mainfrom
Open
Fix: Accept lists in gen_preprocess_options for TOML compatibility#5188realMelTuc wants to merge 2 commits intopypa:mainfrom
realMelTuc wants to merge 2 commits intopypa:mainfrom
Conversation
added 2 commits
February 19, 2026 18:41
- Change distutils reference in extension.rst to point to setuptools.pypa.io - Remove workaround in docs/conf.py that pinned Python docs to 3.11 - This resolves the issue where docs builds were failing due to broken references to distutils in CPython docs for Python 3.12+.
- Convert lists to tuples to support pyproject.toml format - Fixes issue pypa#4810 where define-macros in TOML format caused TypeError - Added test to verify list-to-tuple conversion works correctly - Maintains backward compatibility with tuple format
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR fixes issue #4810 by modifying the gen_preprocess_options function to accept lists (as provided by TOML/pyproject.toml format) and convert them to tuples before processing.
Problem
When defining define-macros in pyproject.toml using the array syntax, the build would fail with TypeError because the function only accepted tuples, not lists.
Solution
Added list-to-tuple conversion before validation in the gen_preprocess_options function. This maintains backward compatibility while supporting TOML format.
Testing
Added comprehensive test coverage to verify both lists and tuples work correctly.