Skip to content

Commit 04cbb1c

Browse files
committed
Refactor string concatination
1 parent 4729f76 commit 04cbb1c

File tree

1 file changed

+8
-15
lines changed

1 file changed

+8
-15
lines changed

Modules/_sysconfig.c

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -57,28 +57,21 @@ _sysconfig_config_vars_impl(PyObject *module)
5757
}
5858

5959
// On Unix, the `ABIFLAGS` key is defined via a different logic.
60+
//
61+
// Emulate `sys.abiflags` value on Unix for Windows. ABIFLAGS here is only
62+
// an emulated value. It is not present during build on Windows.
63+
if (add_string_value(config, "ABIFLAGS",
6064
# ifdef Py_GIL_DISABLED
61-
# define _SYSCONFIG_ABI_THREAD "t"
62-
# else
63-
# define _SYSCONFIG_ABI_THREAD ""
65+
"t"
6466
# endif
6567
# ifdef _DEBUG
66-
# define _SYSCONFIG_ABI_DEBUG "d"
67-
# else
68-
# define _SYSCONFIG_ABI_DEBUG ""
68+
"d"
6969
# endif
70-
# define _SYSCONFIG_ABIFLAGS (_SYSCONFIG_ABI_THREAD _SYSCONFIG_ABI_DEBUG)
71-
72-
// Emulate `sys.abiflags` value on Unix for Windows. ABIFLAGS here is only
73-
// an emulated value. It is not present during build on Windows.
74-
if (add_string_value(config, "ABIFLAGS", _SYSCONFIG_ABIFLAGS) < 0) {
70+
"")
71+
< 0) {
7572
Py_DECREF(config);
7673
return NULL;
7774
}
78-
79-
# undef _SYSCONFIG_ABI_THREAD
80-
# undef _SYSCONFIG_ABI_DEBUG
81-
# undef _SYSCONFIG_ABIFLAGS
8275
#endif
8376

8477
#ifdef Py_GIL_DISABLED

0 commit comments

Comments
 (0)