aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Schneider <asn@samba.org>2015-12-10 17:36:09 +0100
committerMichael Adam <obnox@samba.org>2015-12-10 23:49:39 +0100
commit7267de3e692d4e07645488cde7f54c2d4ffa426d (patch)
treee6f9db48827b4e73b66317806fc4c47d199fb177
parent7505e1c7f93fae556bb92b19922791bc703b6be1 (diff)
downloadpam_wrapper-7267de3e692d4e07645488cde7f54c2d4ffa426d.tar.gz
pam_wrapper-7267de3e692d4e07645488cde7f54c2d4ffa426d.tar.xz
pam_wrapper-7267de3e692d4e07645488cde7f54c2d4ffa426d.zip
py: Fix strict aliasing rules in initpypamtest()
Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Michael Adam <obnox@samba.org>
-rw-r--r--src/python/pypamtest.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/src/python/pypamtest.c b/src/python/pypamtest.c
index d453c6c..a773733 100644
--- a/src/python/pypamtest.c
+++ b/src/python/pypamtest.c
@@ -1013,6 +1013,10 @@ PyMODINIT_FUNC initpypamtest(void)
#endif
{
PyObject *m;
+ union {
+ PyTypeObject *type_obj;
+ PyObject *obj;
+ } pypam_object;
int ret;
#if IS_PYTHON3
@@ -1074,18 +1078,19 @@ PyMODINIT_FUNC initpypamtest(void)
RETURN_ON_ERROR;
}
- if (PyType_Ready(&pypamtest_test_case) < 0) {
+ pypam_object.type_obj = &pypamtest_test_case;
+ if (PyType_Ready(pypam_object.type_obj) < 0) {
RETURN_ON_ERROR;
}
- Py_INCREF(&pypamtest_test_case);
- PyModule_AddObject(m, "TestCase", (PyObject *) &pypamtest_test_case);
+ Py_INCREF(pypam_object.obj);
+ PyModule_AddObject(m, "TestCase", pypam_object.obj);
- if (PyType_Ready(&pypamtest_test_result) < 0) {
+ pypam_object.type_obj = &pypamtest_test_result;
+ if (PyType_Ready(pypam_object.type_obj) < 0) {
RETURN_ON_ERROR;
}
- Py_INCREF(&pypamtest_test_result);
- PyModule_AddObject(m, "TestResult",
- (PyObject *) &pypamtest_test_result);
+ Py_INCREF(pypam_object.obj);
+ PyModule_AddObject(m, "TestResult", pypam_object.obj);
#if IS_PYTHON3
return m;