Skip to content

gh-158942: Use more unique variable names in Py_MIN/MAX/ABS() - #158969

Open
vstinner wants to merge 1 commit into
python:mainfrom
vstinner:pymin_var_name
Open

vstinner wants to merge 1 commit into
python:mainfrom
vstinner:pymin_var_name

Conversation

@vstinner

@vstinner vstinner commented Oct 7, 2026 •

Copy link
Copy Markdown
Member

If Py_MIN/MAX/ABS() macros are called on an existing "_x" or "_y" variable name, the macro local variables may be overriden by the external variables. So use more unique names in the macros.

Add test_min_max_abs_macros() to _testlimitedcapi.

If Py_MIN/MAX/ABS() macros are called on an existing "_x" or "_y"
variable name, the macro local variables may be overriden by the
external variables. So use more unique names in the macros.

Add test_min_max_abs_macros() to _testlimitedcapi.
@vstinner

vstinner commented Oct 7, 2026

Copy link
Copy Markdown
Member Author

cc @lpyu001 @ZeroIntensity

@lpyu001

lpyu001 commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

If the other compatibility changes are considered acceptable, I have no objection to this change.

For reference, I also used an LLM to scan 1,561 PyPI packages with C extensions and found only one case of nested Py_MIN() usage, in librt.

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