Skip to content
Prev Previous commit
Next Next commit
Apply suggestions from code review
Co-authored-by: Erlend Egeberg Aasland <erlend.aasland@protonmail.com>
  • Loading branch information
kumaraditya303 and erlend-aasland authored Jun 28, 2022
commit 4e71aac7f5d12d468966c6fece4b4148a1d9cdd9
11 changes: 7 additions & 4 deletions Modules/_multiprocessing/multiprocessing.c
Original file line number Diff line number Diff line change
Expand Up @@ -194,20 +194,23 @@ multiprocessing_exec(PyObject *module)
if (semlock_type == NULL) {
return -1;
}
if (PyModule_AddType(module, semlock_type) < 0) {
int rc = PyModule_AddType(module, semlock_type);
Py_DECREF(semlock_type);
if (rc < 0) {
return -1;
}
Comment thread
kumaraditya303 marked this conversation as resolved.
Py_DECREF(semlock_type);
PyObject *py_sem_value_max;
/* Some systems define SEM_VALUE_MAX as an unsigned value that
* causes it to be negative when used as an int (NetBSD).
*
* Issue #28152: Use (0) instead of 0 to fix a warning on dead code
* when using clang -Wunreachable-code. */
if ((int)(SEM_VALUE_MAX) < (0))
if ((int)(SEM_VALUE_MAX) < (0)) {
py_sem_value_max = PyLong_FromLong(INT_MAX);
else
}
else {
py_sem_value_max = PyLong_FromLong(SEM_VALUE_MAX);
}
if (py_sem_value_max == NULL) {
return -1;
}
Expand Down