Skip to content

gh-157495: Avoid Py_MIN()/Py_MAX() side effects - #157591

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

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

Conversation

@vstinner

@vstinner vstinner commented Sep 15, 2026

Copy link
Copy Markdown
Member

Avoid calling Py_MIN() or Py_MAX() with non-trivial functions/expressions since these macros evaluate their arguments twice.

Avoid calling Py_MIN() or Py_MAX() with non-trivial
functions/expressions since these macros evaluate their arguments
twice.
@vstinner

vstinner commented Sep 15, 2026

Copy link
Copy Markdown
Member Author

@skirpichev: I checked Py_MIN/MAX/ABS calls in the Python code base and I found a few calls which are inefficient. I wrote this PR to fix them.

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