summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarius Gedminas <marius@gedmin.as>2013-03-08 10:18:17 +0200
committerMarius Gedminas <marius@gedmin.as>2013-03-08 10:38:56 +0200
commit21bedd54cead429a36545ab4107cd7b1b1b08417 (patch)
tree5c237965e699164d5742a45b0d4e757087f780f0
parente814c7d9ccf59f3eeff47f91a1e4490e591d4c00 (diff)
downloadzope-security-21bedd54cead429a36545ab4107cd7b1b1b08417.tar.gz
Fix ImportError: cannot import name _checkers
The problem was a local variable `m` was being clobbered by importing 3rd party modules between the new location of MOD_DEF() and actual use.
-rw-r--r--src/zope/security/_zope_security_checker.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/zope/security/_zope_security_checker.c b/src/zope/security/_zope_security_checker.c
index 25b6eeb..e5a2528 100644
--- a/src/zope/security/_zope_security_checker.c
+++ b/src/zope/security/_zope_security_checker.c
@@ -589,10 +589,11 @@ module_functions[] = {
MOD_INIT(_zope_security_checker)
{
PyObject* m;
+ PyObject* mod;
- MOD_DEF(m, "_zope_security_checker", module___doc__, module_functions)
+ MOD_DEF(mod, "_zope_security_checker", module___doc__, module_functions)
- if (m == NULL)
+ if (mod == NULL)
{
return MOD_ERROR_VAL;
}
@@ -680,7 +681,7 @@ if((str_##S = INTERN(#S)) == NULL) return MOD_ERROR_VAL
return MOD_ERROR_VAL;
}
-#define EXPORT(N) Py_INCREF(N); PyModule_AddObject(m, #N, N)
+#define EXPORT(N) Py_INCREF(N); PyModule_AddObject(mod, #N, N)
EXPORT(_checkers);
EXPORT(NoProxy);
@@ -688,7 +689,7 @@ if((str_##S = INTERN(#S)) == NULL) return MOD_ERROR_VAL
EXPORT(_available_by_default);
Py_INCREF(&CheckerType);
- PyModule_AddObject(m, "Checker", (PyObject *)&CheckerType);
+ PyModule_AddObject(mod, "Checker", (PyObject *)&CheckerType);
- return MOD_SUCCESS_VAL(m);
+ return MOD_SUCCESS_VAL(mod);
}