Skip to content

Commit 416c6d8

Browse files
committed
Move constants
1 parent d77049c commit 416c6d8

2 files changed

Lines changed: 14 additions & 9 deletions

File tree

Modules/_multiprocessing/posixshmem.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,8 +182,22 @@ static PyMethodDef module_methods[ ] = {
182182
{NULL} /* Sentinel */
183183
};
184184

185+
static int
186+
posixshmem_exec(PyObject *m)
187+
{
188+
#ifdef HAVE_SHM_RENAME
189+
#ifdef SHM_RENAME_EXCHANGE
190+
if (PyModule_AddIntMacro(m, SHM_RENAME_EXCHANGE)) return -1;
191+
#endif
192+
#ifdef SHM_RENAME_NOREPLACE
193+
if (PyModule_AddIntMacro(m, SHM_RENAME_NOREPLACE)) return -1;
194+
#endif
195+
#endif /* HAVE_SHM_RENAME */
196+
return 0;
197+
}
185198

186199
static PyModuleDef_Slot module_slots[] = {
200+
{Py_mod_exec, posixshmem_exec},
187201
{Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED},
188202
{Py_mod_gil, Py_MOD_GIL_NOT_USED},
189203
{0, NULL}

Modules/posixmodule.c

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17762,15 +17762,6 @@ all_ins(PyObject *m)
1776217762
#endif
1776317763
#endif /* HAVE_MEMFD_CREATE */
1776417764

17765-
#ifdef HAVE_SHM_RENAME
17766-
#ifdef SHM_RENAME_EXCHANGE
17767-
if (PyModule_AddIntMacro(m, SHM_RENAME_EXCHANGE)) return -1;
17768-
#endif
17769-
#ifdef SHM_RENAME_NOREPLACE
17770-
if (PyModule_AddIntMacro(m, SHM_RENAME_NOREPLACE)) return -1;
17771-
#endif
17772-
#endif /* HAVE_SHM_RENAME */
17773-
1777417765
#if defined(HAVE_EVENTFD) && defined(EFD_CLOEXEC)
1777517766
if (PyModule_AddIntMacro(m, EFD_CLOEXEC)) return -1;
1777617767
#ifdef EFD_NONBLOCK

0 commit comments

Comments
 (0)