We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 4d4371c commit 4f3cd02Copy full SHA for 4f3cd02
Python/_warnings.c
@@ -935,13 +935,15 @@ setup_context(Py_ssize_t stack_level,
935
if (rc < 0) {
936
goto handle_error;
937
}
938
- if (rc == 0) {
939
- *module = PyUnicode_FromString("<string>");
940
- if (*module == NULL)
941
- goto handle_error;
+ if (rc > 0) {
+ if (Py_IsNone(*module) || PyUnicode_Check(*module)) {
+ return 1;
+ }
942
+ Py_DECREF(*module);
943
- else {
944
- assert(Py_IsNone(*module) || PyUnicode_Check(*module));
+ *module = PyUnicode_FromString("<string>");
945
+ if (*module == NULL) {
946
+ goto handle_error;
947
948
949
return 1;
0 commit comments