Check for minor version requirement

This commit is contained in:
lericson 2010-03-22 21:06:03 +01:00
parent 3702d07434
commit 61932d50b9
2 changed files with 12 additions and 0 deletions

View File

@ -55,6 +55,7 @@ New in version 1.0
- Lots of documentation fixes and other nice things like that.
- Nailed what appears to be the last outstanding memory leak.
- Explicitly require libmemcached 0.32 or newer.
New in version 0.9
------------------

View File

@ -1210,8 +1210,19 @@ PyMODINIT_FUNC init_pylibmc(void) {
PyObject *module, *exc_objs;
PylibMC_Behavior *b;
PylibMC_McErr *err;
int libmemcached_version_minor;
char name[128];
/* Check minimum requirement of libmemcached version */
libmemcached_version_minor = \
atoi(strchr(LIBMEMCACHED_VERSION_STRING, '.') + 1);
if (libmemcached_version_minor < 32) {
PyErr_Format(PyExc_RuntimeError,
"pylibmc requires >= libmemcached 0.32, was compiled with %s",
LIBMEMCACHED_VERSION_STRING);
return;
}
if (PyType_Ready(&PylibMC_ClientType) < 0) {
return;
}