Skip to content

Commit 16eea45

Browse files
authored
[3.8] bpo-41302: Support system libmpdec 2.5 for Python 3.8 (GH-21488)
Define UNUSED only when mpdecimal.h doesn't define it. This would support building with system libmpdec 2.5 while retaining compatibility with system libmpdec 2.4 or the vendored copy. Tested to build fine with either system libmpdec or the vendored one.
1 parent f8055fb commit 16eea45

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Enable building Python 3.8 with libmpdec-2.5.0 to ease maintenance for Linux distributions. Patch by Felix Yan.

Modules/_decimal/_decimal.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,13 @@
5858

5959
#define BOUNDS_CHECK(x, MIN, MAX) x = (x < MIN || MAX < x) ? MAX : x
6060

61+
#ifndef UNUSED
62+
#if defined(__GNUC__) && !defined(__INTEL_COMPILER)
63+
#define UNUSED __attribute__((unused))
64+
#else
65+
#define UNUSED
66+
#endif
67+
#endif
6168

6269
/* _Py_DEC_MINALLOC >= MPD_MINALLOC */
6370
#define _Py_DEC_MINALLOC 4

0 commit comments

Comments
 (0)