Skip to content

gh-115119: remove TEST_COVERAGE private macro (_decimal module) - #149756

Merged
zware merged 1 commit into
python:mainfrom
skirpichev:amend-pr133964
Jun 1, 2026
Merged

gh-115119: remove TEST_COVERAGE private macro (_decimal module)#149756
zware merged 1 commit into
python:mainfrom
skirpichev:amend-pr133964

Conversation

@skirpichev

@skirpichevskirpichev commented May 13, 2026

Copy link
Copy Markdown
Member

This amends 9eb3b14. Use unstead Py_DEBUG.

@skirpichev

Copy link
Copy Markdown
MemberAuthor

CC @zware, @vstinner

@vstinnervstinner left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please change PR title to explain the change rather than referring to a commit sha1. Please elaborate also on why you made this change and what is its purpose.

@skirpichevskirpichev changed the title gh-115119: amend 9eb3b146686, remove TEST_COVERAGE private macrogh-115119: TEST_COVERAGE private macro (_decimal module)Jun 1, 2026
@skirpichevskirpichev changed the title gh-115119: TEST_COVERAGE private macro (_decimal module)gh-115119: remove TEST_COVERAGE private macro (_decimal module)Jun 1, 2026
@skirpichev
skirpichev requested a review from vstinnerJune 1, 2026 13:35
@vstinner

Copy link
Copy Markdown
Member

So, I had to reverse engineer your change...

This change no longer defines TEST_COVERAGE macro when building the _decimal extension with a Python debug build (--with-pydebug).

It seems like the TEST_COVERAGE macro was introduced by the commit 97b4121 (issue gh-94847 and PR gh-94848) to fix building the _decimal with --with-pydebug --with-lto (debug mode with LTO).

In the libmpdec-2.5.1 copy embedded in Python 3.15, I can see that the TEST_COVERAGE macro has an effect on inlining:

#if defined(_MSC_VER)
#defineALWAYS_INLINE __forceinline
#elif defined (__IBMC__) || defined(LEGACY_COMPILER)
#defineALWAYS_INLINE#undef inline
#defineinline#else#ifdefTEST_COVERAGE#defineALWAYS_INLINE#else#defineALWAYS_INLINE inline __attribute__ ((always_inline))
#endif#endif

The bundled copy of the libmpdec decimal library has been removed in the main branch. So it's no longer needed to define the TEST_COVERAGE variable.

@vstinnervstinner left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

*/

#ifdef TEST_COVERAGE
#ifdef Py_DEBUG

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we should go so far as to do this in Include/pyport.h, but that's not a decision I will be making.

@zware
zware merged commit 59abdf8 into python:mainJun 1, 2026
61 checks passed
@skirpichev
skirpichev deleted the amend-pr133964 branch June 1, 2026 21:49
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@skirpichev@vstinner@zware