summaryrefslogtreecommitdiffstats
path: root/Doc/c-api
diff options
context:
space:
mode:
authorsobolevn <mail@sobolevn.me>2024-10-15 13:12:32 (GMT)
committerGitHub <noreply@github.com>2024-10-15 13:12:32 (GMT)
commitc8a1818fb01937b66b93728c11d68c9f9af688a5 (patch)
treeda4bb86f0afa69c18ce6bd19c230a9c3b43bacee /Doc/c-api
parentcc5a225cdc2a5d4e035dd08d59cef39182c10a6c (diff)
downloadcpython-c8a1818fb01937b66b93728c11d68c9f9af688a5.zip
cpython-c8a1818fb01937b66b93728c11d68c9f9af688a5.tar.gz
cpython-c8a1818fb01937b66b93728c11d68c9f9af688a5.tar.bz2
gh-125517: Fix unreachable code warnings in `_testembed.c` (#125518)
Diffstat (limited to 'Doc/c-api')
-rw-r--r--Doc/c-api/init_config.rst16
1 files changed, 10 insertions, 6 deletions
diff --git a/Doc/c-api/init_config.rst b/Doc/c-api/init_config.rst
index 66e845d..6194d74 100644
--- a/Doc/c-api/init_config.rst
+++ b/Doc/c-api/init_config.rst
@@ -1825,14 +1825,18 @@ return ``-1`` on error:
PyInitConfig_Free(config);
return 0;
- // Display the error message
- const char *err_msg;
error:
- (void)PyInitConfig_GetError(config, &err_msg);
- printf("PYTHON INIT ERROR: %s\n", err_msg);
- PyInitConfig_Free(config);
+ {
+ // Display the error message
+ // This uncommon braces style is used, because you cannot make
+ // goto targets point to variable declarations.
+ const char *err_msg;
+ (void)PyInitConfig_GetError(config, &err_msg);
+ printf("PYTHON INIT ERROR: %s\n", err_msg);
+ PyInitConfig_Free(config);
- return -1;
+ return -1;
+ }
}