Skip to content

Compile error in decimal when EXTRA_FUNCTIONALITY enabled #152870

Closed

Description

@weixlu

Bug report

Bug description:

When building CPython with libmpdec, enabling the EXTRA_FUNCTIONALITY option fails to compile:

./Modules/_decimal/_decimal.c:6996:12: error: too few arguments to function '_decimal_Context__apply'
  6996 |     return _decimal_Context__apply(context, x);
      |            ^~~~~~~~~~~~~~~~~~~~~~~

Steps to reproduce

  1. Install libmpdec.
  2. CFLAGS="-DEXTRA_FUNCTIONALITY" ./configure --with-pydebug
  3. make -j

Proposed fix

The wrapper should call the implementation function directly: _decimal_Context__apply_impl(context, cls, x).
If acceptable, I plan to open a PR for this.

CPython versions tested on:

CPython main branch

Operating systems tested on:

Linux

Linked PRs

Activity

  1. added
    type-bug
    on Jul 2, 2026
  2. added
    extension-modules
    on Jul 2, 2026
  3. skirpichev commented on Jul 2, 2026

    @skirpichev
    Member

    I would prefer to drop EXTRA_FUNCTIONALITY flag.

  4. added 2 commits that reference this issue on Jul 3, 2026
  5. weixlu commented on Jul 3, 2026

    @weixlu
    ContributorAuthor

    I would prefer to drop EXTRA_FUNCTIONALITY flag.

    Hi, I looked into the EXTRA_FUNCTIONALITY flag a bit. You're right — it is not covered by CI, and has regressed several times, so dropping it altogether is quite reasonable.

    That said, it guards a lot more than Context.apply — there's also MallocError and more (about 14 #ifdef blocks in total). So it's a fairly big task.

    I'd prefer to keep #152871 focused on just the compile fix. If OK, we can leave this issue open for further discussion on removing the flag.

  6. added a commit that references this issue on Jul 3, 2026
  7. self-assigned this
    on Jul 3, 2026
  8. added a commit that references this issue on Jul 3, 2026
  9. skirpichev commented on Jul 3, 2026

    @skirpichev
    Member

    I'd prefer to keep #152871 focused on just the compile fix.

    Fair enough. Here a new issue: #152939

  10. removed their assignment
    on Jul 3, 2026
  11. added a commit that references this issue on Jul 3, 2026
  12. weixlu commented on Jul 3, 2026

    @weixlu
    ContributorAuthor

    Here a new issue: #152939

    Sure, then let me close this issue as complete

  13. skirpichev commented on Jul 3, 2026

    @skirpichev
    Member

    Thanks for the fix!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    extension-modulestype-bug

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions