Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix compiler errors and warnings. Polish the code.
  • Loading branch information
serhiy-storchaka committed Jul 18, 2023
commit cdd8908130e5f63095b744d40e7dfdd223ba7a99
6 changes: 0 additions & 6 deletions Modules/_testcapi/heaptype.c
Original file line number Diff line number Diff line change
Expand Up @@ -1174,15 +1174,9 @@ _PyTestCapi_Init_Heaptype(PyObject *m) {
ADD("HeapCTypeWithWeakref2", HeapCTypeWithWeakref2);

PyObject *HeapCTypeWithBuffer = PyType_FromSpec(&HeapCTypeWithBuffer_spec);
if (HeapCTypeWithBuffer == NULL) {
return -1;
}
ADD("HeapCTypeWithBuffer", HeapCTypeWithBuffer);

PyObject *HeapCTypeSetattr = PyType_FromSpec(&HeapCTypeSetattr_spec);
if (HeapCTypeSetattr == NULL) {
return -1;
}
ADD("HeapCTypeSetattr", HeapCTypeSetattr);

PyObject *subclass_with_finalizer_bases = PyTuple_Pack(1, HeapCTypeSubclass);
Expand Down
2 changes: 1 addition & 1 deletion Modules/_tkinter.c
Original file line number Diff line number Diff line change
Expand Up @@ -3197,7 +3197,7 @@ static struct PyModuleDef _tkintermodule = {
PyMODINIT_FUNC
PyInit__tkinter(void)
{
PyObject *m, *uexe, *cexe, *o;
PyObject *m, *uexe, *cexe;

tcl_lock = PyThread_allocate_lock();
if (tcl_lock == NULL)
Expand Down
4 changes: 2 additions & 2 deletions Modules/binascii.c
Original file line number Diff line number Diff line change
Expand Up @@ -1253,8 +1253,8 @@ static struct PyMethodDef binascii_module_methods[] = {
PyDoc_STRVAR(doc_binascii, "Conversion between binary data and ASCII");

static int
binascii_exec(PyObject *module) {
int result;
binascii_exec(PyObject *module)
{
binascii_state *state = PyModule_GetState(module);
if (state == NULL) {
return -1;
Expand Down
29 changes: 25 additions & 4 deletions Modules/xxlimited_35.c
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,8 @@ PyDoc_STRVAR(module_doc,
static int
xx_modexec(PyObject *m)
{
PyObject *o;

/* Due to cross platform compiler issues the slots must be filled
* here. It's required for portability to Windows without requiring
* C++. */
Expand All @@ -245,24 +247,43 @@ xx_modexec(PyObject *m)
/* Add some symbolic constants to the module */
if (ErrorObject == NULL) {
ErrorObject = PyErr_NewException("xxlimited_35.error", NULL, NULL);
if (ErrorObject == NULL) {
return -1;
}
}
if (PyModule_AddObjectRef(m, "error", ErrorObject) < 0) {
Py_INCREF(ErrorObject);
if (PyModule_AddObject(m, "error", ErrorObject) < 0) {
Py_DECREF(ErrorObject);
return -1;
}

/* Add Xxo */
Xxo_Type = PyType_FromSpec(&Xxo_Type_spec);
if (PyModule_Add(m, "Xxo", Xxo_Type) < 0) {
if (Xxo_Type == NULL) {
return -1;
}
if (PyModule_AddObject(m, "Xxo", Xxo_Type) < 0) {
Py_DECREF(Xxo_Type);
return -1;
}

/* Add Str */
if (PyModule_Add(m, "Str", PyType_FromSpec(&Str_Type_spec)) < 0) {
o = PyType_FromSpec(&Str_Type_spec);
if (o == NULL) {
return -1;
}
if (PyModule_AddObject(m, "Str", o) < 0) {
Py_DECREF(o);
return -1;
}

/* Add Null */
if (PyModule_Add(m, "Null", PyType_FromSpec(&Null_Type_spec)) < 0) {
o = PyType_FromSpec(&Null_Type_spec);
if (o == NULL) {
return -1;
}
if (PyModule_AddObject(m, "Null", o) < 0) {
Py_DECREF(o);
return -1;
}

Expand Down
8 changes: 5 additions & 3 deletions Modules/zlibmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -2034,7 +2034,7 @@ zlib_exec(PyObject *mod)
return -1;
}
if (PyModule_AddObjectRef(mod, "_ZlibDecompressor",
state->ZlibDecompressorType) < 0) {
(PyObject *)state->ZlibDecompressorType) < 0) {
return -1;
}

Expand Down Expand Up @@ -2076,10 +2076,12 @@ zlib_exec(PyObject *mod)
#ifdef Z_TREES // 1.2.3.4, only for inflate
ZLIB_ADD_INT_MACRO(Z_TREES);
#endif
if (PyModule_Add(mod, "ZLIB_VERSION", PyUnicode_FromString(ZLIB_VERSION)) < 0) {
if (PyModule_Add(mod, "ZLIB_VERSION",
PyUnicode_FromString(ZLIB_VERSION)) < 0) {
return -1;
}
if (PyModule_Add(mod, "ZLIB_RUNTIME_VERSION", PyUnicode_FromString(zlibVersion())) < 0) {
if (PyModule_Add(mod, "ZLIB_RUNTIME_VERSION",
PyUnicode_FromString(zlibVersion())) < 0) {
return -1;
}
if (PyModule_AddStringConstant(mod, "__version__", "1.0") < 0) {
Expand Down