summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDwayne Litzenberger <dlitz@dlitz.net>2013-07-14 18:48:59 -0700
committerDwayne Litzenberger <dlitz@dlitz.net>2013-07-14 19:14:35 -0700
commit385830424043c81945a21ca14e051e3b4c282829 (patch)
tree8f7e9a1bb2dbaeff926026002b4aee83701f52c7
parentf5a862ea2db39dbebe27ba7f8e17a2bcbbd18ef2 (diff)
downloadpycrypto-385830424043c81945a21ca14e051e3b4c282829.tar.gz
Py3k cleanup: Remove PyModule_GetDict
Also rename _fastmath_module -> m for consistency
-rw-r--r--src/_fastmath.c18
1 files changed, 8 insertions, 10 deletions
diff --git a/src/_fastmath.c b/src/_fastmath.c
index 565d2aa..063ad70 100644
--- a/src/_fastmath.c
+++ b/src/_fastmath.c
@@ -1598,36 +1598,34 @@ PyInit__fastmath (void)
init_fastmath (void)
#endif
{
- PyObject *_fastmath_module;
- PyObject *_fastmath_dict;
-
+ PyObject *m;
+
#ifdef IS_PY3K
if (PyType_Ready(&rsaKeyType) < 0)
return NULL;
if (PyType_Ready(&dsaKeyType) < 0)
return NULL;
- _fastmath_module = PyModule_Create(&moduledef);
- if (_fastmath_module == NULL)
+ m = PyModule_Create(&moduledef);
+ if (m == NULL)
return NULL;
#else
if (PyType_Ready(&rsaKeyType) < 0)
return;
if (PyType_Ready(&dsaKeyType) < 0)
return;
- _fastmath_module = Py_InitModule ("_fastmath", _fastmath__methods__);
+ m = Py_InitModule ("_fastmath", _fastmath__methods__);
#endif
- _fastmath_dict = PyModule_GetDict (_fastmath_module);
fastmathError = PyErr_NewException ("_fastmath.error", NULL, NULL);
#ifdef IS_PY3K
if (fastmathError == NULL) return NULL;
#endif
- PyDict_SetItemString (_fastmath_dict, "error", fastmathError);
+ PyObject_SetAttrString(m, "error", fastmathError);
- PyModule_AddIntConstant(_fastmath_module, "HAVE_DECL_MPZ_POWM_SEC", HAVE_DECL_MPZ_POWM_SEC);
+ PyModule_AddIntConstant(m, "HAVE_DECL_MPZ_POWM_SEC", HAVE_DECL_MPZ_POWM_SEC);
#ifdef IS_PY3K
- return _fastmath_module;
+ return m;
#endif
}