From 13f1c331a5dd5b4ff3b1e4c9e47d6d3ae75e0f8f Mon Sep 17 00:00:00 2001
From: Xavier de Gaye <xdegaye@users.sourceforge.net>
Date: Sat, 10 Dec 2016 16:45:53 +0100
Subject: Issue #28918: Fix the cross compilation of xxlimited when Python has
 been built with Py_DEBUG defined.

---
 Misc/NEWS | 3 +++
 setup.py  | 2 +-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/Misc/NEWS b/Misc/NEWS
index ef0d960..587c4d2 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -10,6 +10,9 @@ What's New in Python 3.6.1 release candidate 1
 Core and Builtins
 -----------------
 
+- Issue #28918: Fix the cross compilation of xxlimited when Python has been
+  built with Py_DEBUG defined.
+
 - Issue #28731: Optimize _PyDict_NewPresized() to create correct size dict.
   Improve speed of dict literal with constant keys up to 30%.
 
diff --git a/setup.py b/setup.py
index af9a414..116f06f 100644
--- a/setup.py
+++ b/setup.py
@@ -1630,7 +1630,7 @@ class PyBuildExt(build_ext):
 ##         ext = Extension('xx', ['xxmodule.c'])
 ##         self.extensions.append(ext)
 
-        if 'd' not in sys.abiflags:
+        if 'd' not in sysconfig.get_config_var('ABIFLAGS'):
             ext = Extension('xxlimited', ['xxlimited.c'],
                             define_macros=[('Py_LIMITED_API', '0x03050000')])
             self.extensions.append(ext)
-- 
cgit v0.12

