[Python-checkins] python/dist/src/Modules _bsddb.c,1.8,1.9

greg@users.sourceforge.net greg@users.sourceforge.net
Thu, 27 Mar 2003 09:23:31 -0800


Update of /cvsroot/python/python/dist/src/Modules
In directory sc8-pr-cvs1:/tmp/cvs-serv31887/extsrc

Modified Files:
	_bsddb.c 
Log Message:
Adds support for the DBEnv->set_timeout() method.


Index: _bsddb.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Modules/_bsddb.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** _bsddb.c	3 Feb 2003 04:28:26 -0000	1.8
--- _bsddb.c	27 Mar 2003 17:23:25 -0000	1.9
***************
*** 3164,3167 ****
--- 3164,3190 ----
  #endif /* DBVER >= 41 */
  
+ #if (DBVER >= 40)
+ static PyObject*
+ DBEnv_set_timeout(DBEnvObject* self, PyObject* args, PyObject* kwargs)
+ {
+     int err;
+     u_int32_t flags=0;
+     u_int32_t timeout = 0;
+     char* kwnames[] = { "timeout", "flags", NULL };
+ 
+     if (!PyArg_ParseTupleAndKeywords(args, kwargs, "ii:set_timeout", kwnames,
+ 		&timeout, &flags)) {
+ 	return NULL;
+     }
+ 
+     MYDB_BEGIN_ALLOW_THREADS;
+     err = self->db_env->set_timeout(self->db_env, (db_timeout_t)timeout, flags);
+     MYDB_END_ALLOW_THREADS;
+ 
+     RETURN_IF_ERR();
+     RETURN_NONE();
+ }
+ #endif /* DBVER >= 40 */
+ 
  static PyObject*
  DBEnv_set_cachesize(DBEnvObject* self, PyObject* args)
***************
*** 3956,3959 ****
--- 3979,3985 ----
      {"dbrename",        (PyCFunction)DBEnv_dbrename,         METH_VARARGS|METH_KEYWORDS},
      {"set_encrypt",     (PyCFunction)DBEnv_set_encrypt,      METH_VARARGS|METH_KEYWORDS},
+ #endif
+ #if (DBVER >= 40)
+     {"set_timeout",     (PyCFunction)DBEnv_set_timeout,      METH_VARARGS|METH_KEYWORDS},
  #endif
      {"set_cachesize",   (PyCFunction)DBEnv_set_cachesize,    METH_VARARGS},