classification
Title: _decimal failed to build with system libmpdec 2.5
Type: compile error Stage: resolved
Components: Extension Modules Versions: Python 3.10, Python 3.9, Python 3.8
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: skrah Nosy List: doko, felixonmars, miss-islington, skrah
Priority: normal Keywords: patch

Created on 2020-07-15 10:54 by felixonmars, last changed 2020-07-15 20:30 by skrah. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 21481 merged felixonmars, 2020-07-15 11:05
PR 21486 merged miss-islington, 2020-07-15 12:15
PR 21488 merged felixonmars, 2020-07-15 15:05
Messages (9)
msg373676 - (view) Author: Felix Yan (felixonmars) * Date: 2020-07-15 10:54
In bpo-40874, mpdecimal.h in the vendored libmpdec has defines of UNUSED while the standalone released version of mpdecimal 2.5.0 doesn't. This breaks _decimal module build with system libmpdec due to UNUSED is undefined.

Errors are like:

cpython/Modules/_decimal/_decimal.c:277:36: error: expected ‘;’, ‘,’ or ‘)’ before ‘UNUSED’
  277 | dec_traphandler(mpd_context_t *ctx UNUSED) /* GCOV_NOT_REACHED */
      |                                    ^~~~~~

Reproducible in both 3.8 branch and master (didn't test 3.9, but should be affected too).
msg373677 - (view) Author: Stefan Krah (skrah) * (Python committer) Date: 2020-07-15 11:03
Thank you for the report, I'll add the define or remove UNUSED in 3.9
and 3.10.


3.8 is still supposed to use libmpdec-2.4.2, though it would be
harmless to use libmpdec-2.5.0.

Are you planning to use libmpdec-2.5.0 with 3.8?
msg373679 - (view) Author: Felix Yan (felixonmars) * Date: 2020-07-15 11:07
Yes, I am currently defining it manually as a workaround for building 3.8.4 in Arch.

Also opened GH-21481 for this :)
msg373682 - (view) Author: Stefan Krah (skrah) * (Python committer) Date: 2020-07-15 12:14
New changeset 015efdbef7454a522e88cd79ba2b4cd77a5fb2a2 by Felix Yan in branch 'master':
bpo-41302: Fix build with system libmpdec (GH-21481)
https://github.com/python/cpython/commit/015efdbef7454a522e88cd79ba2b4cd77a5fb2a2
msg373691 - (view) Author: miss-islington (miss-islington) Date: 2020-07-15 13:01
New changeset 8ca63f95f769c31f65a996fe065ff6dcfb490bbe by Miss Islington (bot) in branch '3.9':
bpo-41302: Fix build with system libmpdec (GH-21481)
https://github.com/python/cpython/commit/8ca63f95f769c31f65a996fe065ff6dcfb490bbe
msg373692 - (view) Author: Stefan Krah (skrah) * (Python committer) Date: 2020-07-15 13:18
Thanks for the patch!

The integrated libmpdec-2.4.2 in Python 3.8 still has a couple of
UNUSED, so the simple approach of moving the define would not work.
It would be easy to replace the few instances of UNUSED with void
casts like in 2.5.0.


Strictly speaking though, this would be a feature for 3.8 and not
a build fix.


On the other hand, if Debian also plans to use 2.5.0 with 3.8,
there would be a stronger case for this build feature.
msg373721 - (view) Author: Stefan Krah (skrah) * (Python committer) Date: 2020-07-15 20:04
I'm going to reclassify this as a build fix for 3.8. 3.8 promises:

#if !defined(MPD_VERSION_HEX) || MPD_VERSION_HEX < 0x02040100
  #error "libmpdec version >= 2.4.1 required"
#endif

So it seems reasonable to support at least two or three consecutive
system libmpdec versions, otherwise the >= is pointless.
msg373722 - (view) Author: Stefan Krah (skrah) * (Python committer) Date: 2020-07-15 20:22
New changeset 16eea45fbd3b7c3d1b222b7eb7a5d7ee427f70bd by Felix Yan in branch '3.8':
[3.8] bpo-41302: Support system libmpdec 2.5 for Python 3.8 (GH-21488)
https://github.com/python/cpython/commit/16eea45fbd3b7c3d1b222b7eb7a5d7ee427f70bd
msg373723 - (view) Author: Stefan Krah (skrah) * (Python committer) Date: 2020-07-15 20:30
Closing, thanks for all the patches!
History
Date User Action Args
2020-07-15 20:30:40skrahsetstatus: open -> closed

stage: resolved
messages: + msg373723
versions: + Python 3.8
2020-07-15 20:22:30skrahsetmessages: + msg373722
2020-07-15 20:04:21skrahsetmessages: + msg373721
2020-07-15 15:05:37felixonmarssetstatus: pending -> open
pull_requests: + pull_request20631
2020-07-15 13:19:38skrahsetstatus: open -> pending
resolution: fixed
stage: patch review -> (no value)
2020-07-15 13:18:27skrahsetnosy: + doko
messages: + msg373692
2020-07-15 13:01:14miss-islingtonsetmessages: + msg373691
2020-07-15 12:15:11miss-islingtonsetnosy: + miss-islington
pull_requests: + pull_request20630
2020-07-15 12:14:15skrahsetmessages: + msg373682
2020-07-15 11:07:59felixonmarssetmessages: + msg373679
2020-07-15 11:05:59felixonmarssetkeywords: + patch
stage: needs patch -> patch review
pull_requests: + pull_request20624
2020-07-15 11:03:31skrahsetassignee: skrah
stage: needs patch
messages: + msg373677
versions: - Python 3.8
2020-07-15 10:54:56felixonmarscreate