Commit fb38ed5a authored by Jason Madden's avatar Jason Madden

Improve error message and comment. Add change note.

parent ec739210
......@@ -559,11 +559,14 @@ module_init(void)
"persistent.cPersistence", "CAPI");
#endif
if (cPersistenceCAPI == NULL) {
/* At least some versions of Python 3.5 raise an AttribteError
* an ImportError here: re-map as an ImportError for compatibility.
/* The Capsule API attempts to import 'persistent' and then
* walk down to the specified attribute using getattr. If the C
* extensions aren't available, this can result in an
* AttributeError being raised. Let that percolate up as an
* ImportError so it can be caught in the expected way.
*/
if (PyErr_Occurred() && !PyErr_ExceptionMatches(PyExc_ImportError)) {
PyErr_SetString(PyExc_ImportError, "<No CPersistence>");
PyErr_SetString(PyExc_ImportError, "persistent C extension unavailable");
}
return NULL;
}
......
......@@ -5,6 +5,10 @@
------------------
- Add support for Python 3.6.
- Raise an ``ImportError`` consistently on Python 3 if the C extension for
BTrees is used but the ``persistent`` C extension is not available.
Previously this could result in an odd ``AttributeError``. See
https://github.com/zopefoundation/BTrees/pull/55
4.4.0 (2017-01-11)
------------------
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment