Issue 7576: Avoid warnings in PyModuleDef_HEAD_INIT (original) (raw)

Issue7576

Created on 2009-12-25 12:40 by ronaldoussoren, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
moduleobject-init-warnings.patch ronaldoussoren,2009-12-25 12:40
Messages (4)
msg96881 - (view) Author: Ronald Oussoren (ronaldoussoren) * (Python committer) Date: 2009-12-25 12:40
When running GCC with warnings the compiler can warn about incomplete structure initializers. This gives spurious warnings when initializing a PyModuleDef structure using PyModuleDef_HEAD_INIT The attached patchs changes PyModuleDef_HEAD_INIT to explicitly initialize all fields in PyModuleDef_Base. An example warning that is silenced by this patch: Modules/objc/test/structpointer2.m:19: warning: missing initializer Modules/objc/test/structpointer2.m:19: warning: (near initialization for ‘mod_module.m_base.m_init’)
msg109441 - (view) Author: Mark Lawrence (BreamoreBoy) * Date: 2010-07-06 23:05
This is a miniscule patch to moduleobject.h could someone with the relevant knowledge please review it, thanks.
msg110001 - (view) Author: Reid Kleckner (rnk) (Python committer) Date: 2010-07-11 12:38
This patch looks good to me, after digging through the relevant module code. I was confused though for a bit as to why PyModuleDef is a PyObject with a NULL type. It turns out that import.c wants to keep them in a dictionary, so it needs to be able to cast to PyObject* and to access the refcount. It never needs the type, though, so it's safe to leave it NULL. I think it might be worth adding comments explaining that in this patch or another.
msg180744 - (view) Author: Stefan Behnel (scoder) * (Python committer) Date: 2013-01-27 05:36
This is a duplicate of issue 9518 (or the other way round) and should be closed as fixed in 3.2.
History
Date User Action Args
2022-04-11 14:56:55 admin set github: 51825
2013-01-27 10:57:19 serhiy.storchaka set status: open -> closedsuperseder: PyModuleDef_HEAD_INIT does not explicitly initialize all fields of m_baseresolution: duplicatestage: patch review -> resolved
2013-01-27 05:36:03 scoder set nosy: + scodermessages: + components: + Extension Modules
2010-07-11 12:39:00 rnk set nosy: + rnkmessages: +
2010-07-06 23:05:36 BreamoreBoy set keywords:patch, patch, needs reviewnosy: + BreamoreBoymessages: +
2009-12-25 12:40:18 ronaldoussoren create