summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorƁukasz Langa <lukasz@langa.pl>2022-05-03 16:27:38 (GMT)
committerGitHub <noreply@github.com>2022-05-03 16:27:38 (GMT)
commit6c25bf07e86b6d8d5e50488835f70539f382d7e0 (patch)
tree1ba0b23ccfc45a397eb510de520995d080fbef1e /Modules
parentfeca9bbd1f6489f2b6d2783bfc22fdb96e45b69f (diff)
downloadcpython-6c25bf07e86b6d8d5e50488835f70539f382d7e0.zip
cpython-6c25bf07e86b6d8d5e50488835f70539f382d7e0.tar.gz
cpython-6c25bf07e86b6d8d5e50488835f70539f382d7e0.tar.bz2
gh-89452: Prefer gdbm-compat over ndbm (#92208)
This makes macOS gdbm provided by Homebrew not segfault through correct selection of the linked library (-lgdbm_compat) *AND* the correct ndbm-style header (gdbm-ndbm.h instead of the invalid ndbm.h).
Diffstat (limited to 'Modules')
-rw-r--r--Modules/_dbmmodule.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/Modules/_dbmmodule.c b/Modules/_dbmmodule.c
index de8b230..5913b03 100644
--- a/Modules/_dbmmodule.c
+++ b/Modules/_dbmmodule.c
@@ -12,10 +12,7 @@
/* Some Linux systems install gdbm/ndbm.h, but not ndbm.h. This supports
* whichever configure was able to locate.
*/
-#if defined(USE_NDBM)
- #include <ndbm.h>
- static const char which_dbm[] = "GNU gdbm"; /* EMX port of GDBM */
-#elif defined(USE_GDBM_COMPAT)
+#if defined(USE_GDBM_COMPAT)
#ifdef HAVE_GDBM_NDBM_H
#include <gdbm/ndbm.h>
#elif HAVE_GDBM_DASH_NDBM_H
@@ -24,6 +21,9 @@
#error "No gdbm/ndbm.h or gdbm-ndbm.h available"
#endif
static const char which_dbm[] = "GNU gdbm";
+#elif defined(USE_NDBM)
+ #include <ndbm.h>
+ static const char which_dbm[] = "GNU gdbm";
#elif defined(USE_BERKDB)
#ifndef DB_DBM_HSEARCH
#define DB_DBM_HSEARCH 1