Skip to content

Commit 66c7b90

Browse files
committed
Resolve unused function warning
1 parent bec62dc commit 66c7b90

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

Python/sysmodule.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,8 @@ module sys
7474
#include "clinic/sysmodule.c.h"
7575

7676

77+
#ifndef ABIFLAGS
78+
7779
// XXX: remove this and related code after set sys.abiflags on Windows in 3.16.
7880
static int
7981
_warn_incoming_sys_abiflags_change()
@@ -89,6 +91,8 @@ _warn_incoming_sys_abiflags_change()
8991
/*stack_level=*/1);
9092
}
9193

94+
#endif
95+
9296
PyObject *
9397
_PySys_GetRequiredAttr(PyObject *name)
9498
{
@@ -163,6 +167,8 @@ _PySys_GetOptionalAttr(PyObject *name, PyObject **value)
163167
#ifndef ABIFLAGS
164168
if (ret == 0 && _PyUnicode_EqualToASCIIString(name, "abiflags")) {
165169
if (_warn_incoming_sys_abiflags_change() < 0) {
170+
Py_XDECREF(*value);
171+
*value = NULL;
166172
return -1;
167173
}
168174
}
@@ -183,6 +189,8 @@ _PySys_GetOptionalAttrString(const char *name, PyObject **value)
183189
#ifndef ABIFLAGS
184190
if (ret == 0 && strcmp(name, "abiflags") == 0) {
185191
if (_warn_incoming_sys_abiflags_change() < 0) {
192+
Py_XDECREF(*value);
193+
*value = NULL;
186194
return -1;
187195
}
188196
}

0 commit comments

Comments
 (0)