summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNikita Sobolev <mail@sobolevn.me>2023-02-06 21:05:41 (GMT)
committerGitHub <noreply@github.com>2023-02-06 21:05:41 (GMT)
commit262003fd3297f7f4ee09cebd1abb225066412ce7 (patch)
tree90e439c8ea384759c8f257013fbdae06c6b07147
parentb96b344f251954bb64aeb13c3e0c460350565c2a (diff)
downloadcpython-262003fd3297f7f4ee09cebd1abb225066412ce7.zip
cpython-262003fd3297f7f4ee09cebd1abb225066412ce7.tar.gz
cpython-262003fd3297f7f4ee09cebd1abb225066412ce7.tar.bz2
gh-101609: Fix "‘state’ may be used uninitialized" warning in `_xxinterpchannelsmodule` (GH-101610)
I went with the easiest solution: just removing the offending line. See the issue description with my reasoning. https://github.com/python/cpython/issues/101609
-rw-r--r--Modules/_xxinterpchannelsmodule.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/Modules/_xxinterpchannelsmodule.c b/Modules/_xxinterpchannelsmodule.c
index 8601a18..60538c3 100644
--- a/Modules/_xxinterpchannelsmodule.c
+++ b/Modules/_xxinterpchannelsmodule.c
@@ -174,7 +174,9 @@ static int
clear_module_state(module_state *state)
{
/* heap types */
- (void)_PyCrossInterpreterData_UnregisterClass(state->ChannelIDType);
+ if (state->ChannelIDType != NULL) {
+ (void)_PyCrossInterpreterData_UnregisterClass(state->ChannelIDType);
+ }
Py_CLEAR(state->ChannelIDType);
/* exceptions */
@@ -2269,7 +2271,6 @@ module_exec(PyObject *mod)
return 0;
error:
- (void)_PyCrossInterpreterData_UnregisterClass(state->ChannelIDType);
_globals_fini();
return -1;
}