summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/python/python/python-2.7.3-berkeley-db-5.3.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-devtools/python/python/python-2.7.3-berkeley-db-5.3.patch')
-rw-r--r--meta/recipes-devtools/python/python/python-2.7.3-berkeley-db-5.3.patch1572
1 files changed, 1572 insertions, 0 deletions
diff --git a/meta/recipes-devtools/python/python/python-2.7.3-berkeley-db-5.3.patch b/meta/recipes-devtools/python/python/python-2.7.3-berkeley-db-5.3.patch
new file mode 100644
index 0000000000..3df33368ec
--- /dev/null
+++ b/meta/recipes-devtools/python/python/python-2.7.3-berkeley-db-5.3.patch
@@ -0,0 +1,1572 @@
1Upstream-Status: Inappropriate [not author]
2
3Fix to support db 5.3 for bsddb module in python 2.7.2
4
5This patch is made from the db5.1.diff in
6http://archive.ubuntu.com/ubuntu/pool/main/p/python2.7/python2.7_2.7.3-0ubuntu3.diff.gz
7
8Signed-off-by: Jackie Huang <jackie.huang@windriver.com>
9---
10 Lib/bsddb/__init__.py | 2 +-
11 Lib/bsddb/test/test_all.py | 5 +-
12 Lib/bsddb/test/test_dbenv.py | 29 +++-
13 Modules/_bsddb.c | 439 +++++++++++++++++++++++-------------------
14 Modules/bsddb.h | 20 +-
15 setup.py | 25 +++-
16 6 files changed, 307 insertions(+), 213 deletions(-)
17
18diff --git a/Lib/bsddb/__init__.py b/Lib/bsddb/__init__.py
19index ed4deea..1b1c388 100644
20--- a/Lib/bsddb/__init__.py
21+++ b/Lib/bsddb/__init__.py
22@@ -33,7 +33,7 @@
23 #----------------------------------------------------------------------
24
25
26-"""Support for Berkeley DB 4.1 through 4.8 with a simple interface.
27+"""Support for Berkeley DB 4.2 through 5.3 with a simple interface.
28
29 For the full featured object oriented interface use the bsddb.db module
30 instead. It mirrors the Oracle Berkeley DB C API.
31diff --git a/Lib/bsddb/test/test_all.py b/Lib/bsddb/test/test_all.py
32index e9fe618..6a25f4a 100644
33--- a/Lib/bsddb/test/test_all.py
34+++ b/Lib/bsddb/test/test_all.py
35@@ -484,6 +484,8 @@ def print_versions():
36 print '-=' * 38
37 print db.DB_VERSION_STRING
38 print 'bsddb.db.version(): %s' % (db.version(), )
39+ if db.version() >= (5, 0) :
40+ print 'bsddb.db.full_version(): %s' %repr(db.full_version())
41 print 'bsddb.db.__version__: %s' % db.__version__
42 print 'bsddb.db.cvsid: %s' % db.cvsid
43
44@@ -528,7 +530,8 @@ def get_new_database_path() :
45
46 # This path can be overriden via "set_test_path_prefix()".
47 import os, os.path
48-get_new_path.prefix=os.path.join(os.sep,"tmp","z-Berkeley_DB")
49+get_new_path.prefix=os.path.join(os.environ.get("TMPDIR",
50+ os.path.join(os.sep,"tmp")), "z-Berkeley_DB")
51 get_new_path.num=0
52
53 def get_test_path_prefix() :
54diff --git a/Lib/bsddb/test/test_dbenv.py b/Lib/bsddb/test/test_dbenv.py
55index 37281df..6ac1e54 100644
56--- a/Lib/bsddb/test/test_dbenv.py
57+++ b/Lib/bsddb/test/test_dbenv.py
58@@ -25,12 +25,31 @@ class DBEnv(unittest.TestCase):
59 test_support.rmtree(self.homeDir)
60
61 class DBEnv_general(DBEnv) :
62+ def test_get_open_flags(self) :
63+ flags = db.DB_CREATE | db.DB_INIT_MPOOL
64+ self.env.open(self.homeDir, flags)
65+ self.assertEqual(flags, self.env.get_open_flags())
66+
67+ def test_get_open_flags2(self) :
68+ flags = db.DB_CREATE | db.DB_INIT_MPOOL | \
69+ db.DB_INIT_LOCK | db.DB_THREAD
70+ self.env.open(self.homeDir, flags)
71+ self.assertEqual(flags, self.env.get_open_flags())
72+
73 if db.version() >= (4, 7) :
74 def test_lk_partitions(self) :
75 for i in [10, 20, 40] :
76 self.env.set_lk_partitions(i)
77 self.assertEqual(i, self.env.get_lk_partitions())
78
79+ def test_getset_intermediate_dir_mode(self) :
80+ self.assertEqual(None, self.env.get_intermediate_dir_mode())
81+ for mode in ["rwx------", "rw-rw-rw-", "rw-r--r--"] :
82+ self.env.set_intermediate_dir_mode(mode)
83+ self.assertEqual(mode, self.env.get_intermediate_dir_mode())
84+ self.assertRaises(db.DBInvalidArgError,
85+ self.env.set_intermediate_dir_mode, "abcde")
86+
87 if db.version() >= (4, 6) :
88 def test_thread(self) :
89 for i in [16, 100, 1000] :
90@@ -115,7 +134,7 @@ class DBEnv_general(DBEnv) :
91 self.assertEqual(i, self.env.get_lk_max_lockers())
92
93 def test_lg_regionmax(self) :
94- for i in [128, 256, 1024] :
95+ for i in [128, 256, 1000] :
96 i = i*1024*1024
97 self.env.set_lg_regionmax(i)
98 j = self.env.get_lg_regionmax()
99@@ -172,8 +191,12 @@ class DBEnv_general(DBEnv) :
100 self.env.open(self.homeDir, db.DB_CREATE | db.DB_INIT_MPOOL)
101 cachesize = (0, 2*1024*1024, 1)
102 self.assertRaises(db.DBInvalidArgError,
103- self.env.set_cachesize, *cachesize)
104- self.assertEqual(cachesize2, self.env.get_cachesize())
105+ self.env.set_cachesize, *cachesize)
106+ cachesize3 = self.env.get_cachesize()
107+ self.assertEqual(cachesize2[0], cachesize3[0])
108+ self.assertEqual(cachesize2[2], cachesize3[2])
109+ # In Berkeley DB 5.3, the cachesize can change when opening the Env
110+ self.assertTrue(cachesize2[1] <= cachesize3[1])
111
112 def test_set_cachesize_dbenv_db(self) :
113 # You can not configure the cachesize using
114diff --git a/Modules/_bsddb.c b/Modules/_bsddb.c
115index d2d12ff..e98e4bc 100644
116--- a/Modules/_bsddb.c
117+++ b/Modules/_bsddb.c
118@@ -187,8 +187,10 @@ static PyObject* DBOldVersionError; /* DB_OLD_VERSION */
119 static PyObject* DBRunRecoveryError; /* DB_RUNRECOVERY */
120 static PyObject* DBVerifyBadError; /* DB_VERIFY_BAD */
121 static PyObject* DBNoServerError; /* DB_NOSERVER */
122+#if (DBVER < 52)
123 static PyObject* DBNoServerHomeError; /* DB_NOSERVER_HOME */
124 static PyObject* DBNoServerIDError; /* DB_NOSERVER_ID */
125+#endif
126 static PyObject* DBPageNotFoundError; /* DB_PAGE_NOTFOUND */
127 static PyObject* DBSecondaryBadError; /* DB_SECONDARY_BAD */
128
129@@ -202,9 +204,7 @@ static PyObject* DBFileExistsError; /* EEXIST */
130 static PyObject* DBNoSuchFileError; /* ENOENT */
131 static PyObject* DBPermissionsError; /* EPERM */
132
133-#if (DBVER >= 42)
134 static PyObject* DBRepHandleDeadError; /* DB_REP_HANDLE_DEAD */
135-#endif
136 #if (DBVER >= 44)
137 static PyObject* DBRepLockoutError; /* DB_REP_LOCKOUT */
138 #endif
139@@ -696,8 +696,10 @@ static int makeDBError(int err)
140 case DB_RUNRECOVERY: errObj = DBRunRecoveryError; break;
141 case DB_VERIFY_BAD: errObj = DBVerifyBadError; break;
142 case DB_NOSERVER: errObj = DBNoServerError; break;
143+#if (DBVER < 52)
144 case DB_NOSERVER_HOME: errObj = DBNoServerHomeError; break;
145 case DB_NOSERVER_ID: errObj = DBNoServerIDError; break;
146+#endif
147 case DB_PAGE_NOTFOUND: errObj = DBPageNotFoundError; break;
148 case DB_SECONDARY_BAD: errObj = DBSecondaryBadError; break;
149 case DB_BUFFER_SMALL: errObj = DBNoMemoryError; break;
150@@ -715,9 +717,7 @@ static int makeDBError(int err)
151 case ENOENT: errObj = DBNoSuchFileError; break;
152 case EPERM : errObj = DBPermissionsError; break;
153
154-#if (DBVER >= 42)
155 case DB_REP_HANDLE_DEAD : errObj = DBRepHandleDeadError; break;
156-#endif
157 #if (DBVER >= 44)
158 case DB_REP_LOCKOUT : errObj = DBRepLockoutError; break;
159 #endif
160@@ -2132,7 +2132,7 @@ DB_get_size(DBObject* self, PyObject* args, PyObject* kwargs)
161 MYDB_BEGIN_ALLOW_THREADS;
162 err = self->db->get(self->db, txn, &key, &data, flags);
163 MYDB_END_ALLOW_THREADS;
164- if (err == DB_BUFFER_SMALL) {
165+ if ((err == DB_BUFFER_SMALL) || (err == 0)) {
166 retval = NUMBER_FromLong((long)data.size);
167 err = 0;
168 }
169@@ -2385,9 +2385,7 @@ DB_open(DBObject* self, PyObject* args, PyObject* kwargs)
170 return NULL;
171 }
172
173-#if (DBVER >= 42)
174 self->db->get_flags(self->db, &self->setflags);
175-#endif
176
177 self->flags = flags;
178
179@@ -2539,6 +2537,37 @@ DB_get_priority(DBObject* self)
180 #endif
181
182 static PyObject*
183+DB_get_dbname(DBObject* self)
184+{
185+ int err;
186+ const char *filename, *dbname;
187+
188+ CHECK_DB_NOT_CLOSED(self);
189+
190+ MYDB_BEGIN_ALLOW_THREADS;
191+ err = self->db->get_dbname(self->db, &filename, &dbname);
192+ MYDB_END_ALLOW_THREADS;
193+ RETURN_IF_ERR();
194+ /* If "dbname==NULL", it is correctly converted to "None" */
195+ return Py_BuildValue("(ss)", filename, dbname);
196+}
197+
198+static PyObject*
199+DB_get_open_flags(DBObject* self)
200+{
201+ int err;
202+ unsigned int flags;
203+
204+ CHECK_DB_NOT_CLOSED(self);
205+
206+ MYDB_BEGIN_ALLOW_THREADS;
207+ err = self->db->get_open_flags(self->db, &flags);
208+ MYDB_END_ALLOW_THREADS;
209+ RETURN_IF_ERR();
210+ return NUMBER_FromLong(flags);
211+}
212+
213+static PyObject*
214 DB_set_q_extentsize(DBObject* self, PyObject* args)
215 {
216 int err;
217@@ -2555,7 +2584,6 @@ DB_set_q_extentsize(DBObject* self, PyObject* args)
218 RETURN_NONE();
219 }
220
221-#if (DBVER >= 42)
222 static PyObject*
223 DB_get_q_extentsize(DBObject* self)
224 {
225@@ -2570,7 +2598,6 @@ DB_get_q_extentsize(DBObject* self)
226 RETURN_IF_ERR();
227 return NUMBER_FromLong(extentsize);
228 }
229-#endif
230
231 static PyObject*
232 DB_set_bt_minkey(DBObject* self, PyObject* args)
233@@ -2588,7 +2615,6 @@ DB_set_bt_minkey(DBObject* self, PyObject* args)
234 RETURN_NONE();
235 }
236
237-#if (DBVER >= 42)
238 static PyObject*
239 DB_get_bt_minkey(DBObject* self)
240 {
241@@ -2603,7 +2629,6 @@ DB_get_bt_minkey(DBObject* self)
242 RETURN_IF_ERR();
243 return NUMBER_FromLong(bt_minkey);
244 }
245-#endif
246
247 static int
248 _default_cmp(const DBT *leftKey,
249@@ -2759,7 +2784,6 @@ DB_set_cachesize(DBObject* self, PyObject* args)
250 RETURN_NONE();
251 }
252
253-#if (DBVER >= 42)
254 static PyObject*
255 DB_get_cachesize(DBObject* self)
256 {
257@@ -2777,7 +2801,6 @@ DB_get_cachesize(DBObject* self)
258
259 return Py_BuildValue("(iii)", gbytes, bytes, ncache);
260 }
261-#endif
262
263 static PyObject*
264 DB_set_flags(DBObject* self, PyObject* args)
265@@ -2797,7 +2820,6 @@ DB_set_flags(DBObject* self, PyObject* args)
266 RETURN_NONE();
267 }
268
269-#if (DBVER >= 42)
270 static PyObject*
271 DB_get_flags(DBObject* self)
272 {
273@@ -2812,6 +2834,35 @@ DB_get_flags(DBObject* self)
274 RETURN_IF_ERR();
275 return NUMBER_FromLong(flags);
276 }
277+
278+#if (DBVER >= 43)
279+static PyObject*
280+DB_get_transactional(DBObject* self)
281+{
282+ int err;
283+
284+ CHECK_DB_NOT_CLOSED(self);
285+
286+ MYDB_BEGIN_ALLOW_THREADS;
287+ err = self->db->get_transactional(self->db);
288+ MYDB_END_ALLOW_THREADS;
289+
290+ if(err == 0) {
291+ Py_INCREF(Py_False);
292+ return Py_False;
293+ } else if(err == 1) {
294+ Py_INCREF(Py_True);
295+ return Py_True;
296+ }
297+
298+ /*
299+ ** If we reach there, there was an error. The
300+ ** "return" should be unreachable.
301+ */
302+ RETURN_IF_ERR();
303+ assert(0); /* This coude SHOULD be unreachable */
304+ return NULL;
305+}
306 #endif
307
308 static PyObject*
309@@ -2830,7 +2881,6 @@ DB_set_h_ffactor(DBObject* self, PyObject* args)
310 RETURN_NONE();
311 }
312
313-#if (DBVER >= 42)
314 static PyObject*
315 DB_get_h_ffactor(DBObject* self)
316 {
317@@ -2845,7 +2895,6 @@ DB_get_h_ffactor(DBObject* self)
318 RETURN_IF_ERR();
319 return NUMBER_FromLong(ffactor);
320 }
321-#endif
322
323 static PyObject*
324 DB_set_h_nelem(DBObject* self, PyObject* args)
325@@ -2863,7 +2912,6 @@ DB_set_h_nelem(DBObject* self, PyObject* args)
326 RETURN_NONE();
327 }
328
329-#if (DBVER >= 42)
330 static PyObject*
331 DB_get_h_nelem(DBObject* self)
332 {
333@@ -2878,7 +2926,6 @@ DB_get_h_nelem(DBObject* self)
334 RETURN_IF_ERR();
335 return NUMBER_FromLong(nelem);
336 }
337-#endif
338
339 static PyObject*
340 DB_set_lorder(DBObject* self, PyObject* args)
341@@ -2896,7 +2943,6 @@ DB_set_lorder(DBObject* self, PyObject* args)
342 RETURN_NONE();
343 }
344
345-#if (DBVER >= 42)
346 static PyObject*
347 DB_get_lorder(DBObject* self)
348 {
349@@ -2911,7 +2957,6 @@ DB_get_lorder(DBObject* self)
350 RETURN_IF_ERR();
351 return NUMBER_FromLong(lorder);
352 }
353-#endif
354
355 static PyObject*
356 DB_set_pagesize(DBObject* self, PyObject* args)
357@@ -2929,7 +2974,6 @@ DB_set_pagesize(DBObject* self, PyObject* args)
358 RETURN_NONE();
359 }
360
361-#if (DBVER >= 42)
362 static PyObject*
363 DB_get_pagesize(DBObject* self)
364 {
365@@ -2944,7 +2988,6 @@ DB_get_pagesize(DBObject* self)
366 RETURN_IF_ERR();
367 return NUMBER_FromLong(pagesize);
368 }
369-#endif
370
371 static PyObject*
372 DB_set_re_delim(DBObject* self, PyObject* args)
373@@ -2967,7 +3010,6 @@ DB_set_re_delim(DBObject* self, PyObject* args)
374 RETURN_NONE();
375 }
376
377-#if (DBVER >= 42)
378 static PyObject*
379 DB_get_re_delim(DBObject* self)
380 {
381@@ -2981,7 +3023,6 @@ DB_get_re_delim(DBObject* self)
382 RETURN_IF_ERR();
383 return NUMBER_FromLong(re_delim);
384 }
385-#endif
386
387 static PyObject*
388 DB_set_re_len(DBObject* self, PyObject* args)
389@@ -2999,7 +3040,6 @@ DB_set_re_len(DBObject* self, PyObject* args)
390 RETURN_NONE();
391 }
392
393-#if (DBVER >= 42)
394 static PyObject*
395 DB_get_re_len(DBObject* self)
396 {
397@@ -3014,7 +3054,6 @@ DB_get_re_len(DBObject* self)
398 RETURN_IF_ERR();
399 return NUMBER_FromLong(re_len);
400 }
401-#endif
402
403 static PyObject*
404 DB_set_re_pad(DBObject* self, PyObject* args)
405@@ -3036,7 +3075,6 @@ DB_set_re_pad(DBObject* self, PyObject* args)
406 RETURN_NONE();
407 }
408
409-#if (DBVER >= 42)
410 static PyObject*
411 DB_get_re_pad(DBObject* self)
412 {
413@@ -3050,7 +3088,6 @@ DB_get_re_pad(DBObject* self)
414 RETURN_IF_ERR();
415 return NUMBER_FromLong(re_pad);
416 }
417-#endif
418
419 static PyObject*
420 DB_set_re_source(DBObject* self, PyObject* args)
421@@ -3069,7 +3106,6 @@ DB_set_re_source(DBObject* self, PyObject* args)
422 RETURN_NONE();
423 }
424
425-#if (DBVER >= 42)
426 static PyObject*
427 DB_get_re_source(DBObject* self)
428 {
429@@ -3084,7 +3120,6 @@ DB_get_re_source(DBObject* self)
430 RETURN_IF_ERR();
431 return PyBytes_FromString(source);
432 }
433-#endif
434
435 static PyObject*
436 DB_stat(DBObject* self, PyObject* args, PyObject* kwargs)
437@@ -3381,7 +3416,6 @@ DB_set_encrypt(DBObject* self, PyObject* args, PyObject* kwargs)
438 RETURN_NONE();
439 }
440
441-#if (DBVER >= 42)
442 static PyObject*
443 DB_get_encrypt_flags(DBObject* self)
444 {
445@@ -3396,7 +3430,6 @@ DB_get_encrypt_flags(DBObject* self)
446
447 return NUMBER_FromLong(flags);
448 }
449-#endif
450
451
452
453@@ -4987,7 +5020,6 @@ DBEnv_set_encrypt(DBEnvObject* self, PyObject* args, PyObject* kwargs)
454 RETURN_NONE();
455 }
456
457-#if (DBVER >= 42)
458 static PyObject*
459 DBEnv_get_encrypt_flags(DBEnvObject* self)
460 {
461@@ -5025,7 +5057,6 @@ DBEnv_get_timeout(DBEnvObject* self, PyObject* args, PyObject* kwargs)
462 RETURN_IF_ERR();
463 return NUMBER_FromLong(timeout);
464 }
465-#endif
466
467
468 static PyObject*
469@@ -5064,7 +5095,6 @@ DBEnv_set_shm_key(DBEnvObject* self, PyObject* args)
470 RETURN_NONE();
471 }
472
473-#if (DBVER >= 42)
474 static PyObject*
475 DBEnv_get_shm_key(DBEnvObject* self)
476 {
477@@ -5081,7 +5111,6 @@ DBEnv_get_shm_key(DBEnvObject* self)
478
479 return NUMBER_FromLong(shm_key);
480 }
481-#endif
482
483 #if (DBVER >= 46)
484 static PyObject*
485@@ -5170,7 +5199,6 @@ DBEnv_set_cachesize(DBEnvObject* self, PyObject* args)
486 RETURN_NONE();
487 }
488
489-#if (DBVER >= 42)
490 static PyObject*
491 DBEnv_get_cachesize(DBEnvObject* self)
492 {
493@@ -5188,7 +5216,6 @@ DBEnv_get_cachesize(DBEnvObject* self)
494
495 return Py_BuildValue("(iii)", gbytes, bytes, ncache);
496 }
497-#endif
498
499
500 static PyObject*
501@@ -5208,7 +5235,6 @@ DBEnv_set_flags(DBEnvObject* self, PyObject* args)
502 RETURN_NONE();
503 }
504
505-#if (DBVER >= 42)
506 static PyObject*
507 DBEnv_get_flags(DBEnvObject* self)
508 {
509@@ -5223,7 +5249,6 @@ DBEnv_get_flags(DBEnvObject* self)
510 RETURN_IF_ERR();
511 return NUMBER_FromLong(flags);
512 }
513-#endif
514
515 #if (DBVER >= 47)
516 static PyObject*
517@@ -5423,7 +5448,6 @@ DBEnv_set_data_dir(DBEnvObject* self, PyObject* args)
518 RETURN_NONE();
519 }
520
521-#if (DBVER >= 42)
522 static PyObject*
523 DBEnv_get_data_dirs(DBEnvObject* self)
524 {
525@@ -5463,7 +5487,6 @@ DBEnv_get_data_dirs(DBEnvObject* self)
526 }
527 return tuple;
528 }
529-#endif
530
531 #if (DBVER >= 44)
532 static PyObject*
533@@ -5513,7 +5536,6 @@ DBEnv_set_lg_bsize(DBEnvObject* self, PyObject* args)
534 RETURN_NONE();
535 }
536
537-#if (DBVER >= 42)
538 static PyObject*
539 DBEnv_get_lg_bsize(DBEnvObject* self)
540 {
541@@ -5528,7 +5550,6 @@ DBEnv_get_lg_bsize(DBEnvObject* self)
542 RETURN_IF_ERR();
543 return NUMBER_FromLong(lg_bsize);
544 }
545-#endif
546
547 static PyObject*
548 DBEnv_set_lg_dir(DBEnvObject* self, PyObject* args)
549@@ -5547,7 +5568,6 @@ DBEnv_set_lg_dir(DBEnvObject* self, PyObject* args)
550 RETURN_NONE();
551 }
552
553-#if (DBVER >= 42)
554 static PyObject*
555 DBEnv_get_lg_dir(DBEnvObject* self)
556 {
557@@ -5562,7 +5582,6 @@ DBEnv_get_lg_dir(DBEnvObject* self)
558 RETURN_IF_ERR();
559 return PyBytes_FromString(dirp);
560 }
561-#endif
562
563 static PyObject*
564 DBEnv_set_lg_max(DBEnvObject* self, PyObject* args)
565@@ -5580,7 +5599,6 @@ DBEnv_set_lg_max(DBEnvObject* self, PyObject* args)
566 RETURN_NONE();
567 }
568
569-#if (DBVER >= 42)
570 static PyObject*
571 DBEnv_get_lg_max(DBEnvObject* self)
572 {
573@@ -5595,8 +5613,6 @@ DBEnv_get_lg_max(DBEnvObject* self)
574 RETURN_IF_ERR();
575 return NUMBER_FromLong(lg_max);
576 }
577-#endif
578-
579
580 static PyObject*
581 DBEnv_set_lg_regionmax(DBEnvObject* self, PyObject* args)
582@@ -5614,7 +5630,6 @@ DBEnv_set_lg_regionmax(DBEnvObject* self, PyObject* args)
583 RETURN_NONE();
584 }
585
586-#if (DBVER >= 42)
587 static PyObject*
588 DBEnv_get_lg_regionmax(DBEnvObject* self)
589 {
590@@ -5629,7 +5644,6 @@ DBEnv_get_lg_regionmax(DBEnvObject* self)
591 RETURN_IF_ERR();
592 return NUMBER_FromLong(lg_regionmax);
593 }
594-#endif
595
596 #if (DBVER >= 47)
597 static PyObject*
598@@ -5680,7 +5694,6 @@ DBEnv_set_lk_detect(DBEnvObject* self, PyObject* args)
599 RETURN_NONE();
600 }
601
602-#if (DBVER >= 42)
603 static PyObject*
604 DBEnv_get_lk_detect(DBEnvObject* self)
605 {
606@@ -5695,8 +5708,6 @@ DBEnv_get_lk_detect(DBEnvObject* self)
607 RETURN_IF_ERR();
608 return NUMBER_FromLong(lk_detect);
609 }
610-#endif
611-
612
613 #if (DBVER < 45)
614 static PyObject*
615@@ -5734,7 +5745,6 @@ DBEnv_set_lk_max_locks(DBEnvObject* self, PyObject* args)
616 RETURN_NONE();
617 }
618
619-#if (DBVER >= 42)
620 static PyObject*
621 DBEnv_get_lk_max_locks(DBEnvObject* self)
622 {
623@@ -5749,7 +5759,6 @@ DBEnv_get_lk_max_locks(DBEnvObject* self)
624 RETURN_IF_ERR();
625 return NUMBER_FromLong(lk_max);
626 }
627-#endif
628
629 static PyObject*
630 DBEnv_set_lk_max_lockers(DBEnvObject* self, PyObject* args)
631@@ -5767,7 +5776,6 @@ DBEnv_set_lk_max_lockers(DBEnvObject* self, PyObject* args)
632 RETURN_NONE();
633 }
634
635-#if (DBVER >= 42)
636 static PyObject*
637 DBEnv_get_lk_max_lockers(DBEnvObject* self)
638 {
639@@ -5782,7 +5790,6 @@ DBEnv_get_lk_max_lockers(DBEnvObject* self)
640 RETURN_IF_ERR();
641 return NUMBER_FromLong(lk_max);
642 }
643-#endif
644
645 static PyObject*
646 DBEnv_set_lk_max_objects(DBEnvObject* self, PyObject* args)
647@@ -5800,7 +5807,6 @@ DBEnv_set_lk_max_objects(DBEnvObject* self, PyObject* args)
648 RETURN_NONE();
649 }
650
651-#if (DBVER >= 42)
652 static PyObject*
653 DBEnv_get_lk_max_objects(DBEnvObject* self)
654 {
655@@ -5815,9 +5821,7 @@ DBEnv_get_lk_max_objects(DBEnvObject* self)
656 RETURN_IF_ERR();
657 return NUMBER_FromLong(lk_max);
658 }
659-#endif
660
661-#if (DBVER >= 42)
662 static PyObject*
663 DBEnv_get_mp_mmapsize(DBEnvObject* self)
664 {
665@@ -5832,8 +5836,6 @@ DBEnv_get_mp_mmapsize(DBEnvObject* self)
666 RETURN_IF_ERR();
667 return NUMBER_FromLong(mmapsize);
668 }
669-#endif
670-
671
672 static PyObject*
673 DBEnv_set_mp_mmapsize(DBEnvObject* self, PyObject* args)
674@@ -5869,8 +5871,6 @@ DBEnv_set_tmp_dir(DBEnvObject* self, PyObject* args)
675 RETURN_NONE();
676 }
677
678-
679-#if (DBVER >= 42)
680 static PyObject*
681 DBEnv_get_tmp_dir(DBEnvObject* self)
682 {
683@@ -5887,8 +5887,6 @@ DBEnv_get_tmp_dir(DBEnvObject* self)
684
685 return PyBytes_FromString(dirpp);
686 }
687-#endif
688-
689
690 static PyObject*
691 DBEnv_txn_recover(DBEnvObject* self)
692@@ -5899,7 +5897,7 @@ DBEnv_txn_recover(DBEnvObject* self)
693 DBTxnObject *txn;
694 #define PREPLIST_LEN 16
695 DB_PREPLIST preplist[PREPLIST_LEN];
696-#if (DBVER < 48)
697+#if (DBVER < 48 || DBVER > 51)
698 long retp;
699 #else
700 u_int32_t retp;
701@@ -6003,8 +6001,6 @@ DBEnv_txn_checkpoint(DBEnvObject* self, PyObject* args)
702 RETURN_NONE();
703 }
704
705-
706-#if (DBVER >= 42)
707 static PyObject*
708 DBEnv_get_tx_max(DBEnvObject* self)
709 {
710@@ -6019,8 +6015,6 @@ DBEnv_get_tx_max(DBEnvObject* self)
711 RETURN_IF_ERR();
712 return PyLong_FromUnsignedLong(max);
713 }
714-#endif
715-
716
717 static PyObject*
718 DBEnv_set_tx_max(DBEnvObject* self, PyObject* args)
719@@ -6038,8 +6032,6 @@ DBEnv_set_tx_max(DBEnvObject* self, PyObject* args)
720 RETURN_NONE();
721 }
722
723-
724-#if (DBVER >= 42)
725 static PyObject*
726 DBEnv_get_tx_timestamp(DBEnvObject* self)
727 {
728@@ -6054,7 +6046,6 @@ DBEnv_get_tx_timestamp(DBEnvObject* self)
729 RETURN_IF_ERR();
730 return NUMBER_FromLong(timestamp);
731 }
732-#endif
733
734 static PyObject*
735 DBEnv_set_tx_timestamp(DBEnvObject* self, PyObject* args)
736@@ -6756,6 +6747,55 @@ DBEnv_set_private(DBEnvObject* self, PyObject* private_obj)
737 RETURN_NONE();
738 }
739
740+#if (DBVER >= 47)
741+static PyObject*
742+DBEnv_set_intermediate_dir_mode(DBEnvObject* self, PyObject* args)
743+{
744+ int err;
745+ const char *mode;
746+
747+ if (!PyArg_ParseTuple(args,"s:set_intermediate_dir_mode", &mode))
748+ return NULL;
749+
750+ CHECK_ENV_NOT_CLOSED(self);
751+
752+ MYDB_BEGIN_ALLOW_THREADS;
753+ err = self->db_env->set_intermediate_dir_mode(self->db_env, mode);
754+ MYDB_END_ALLOW_THREADS;
755+ RETURN_IF_ERR();
756+ RETURN_NONE();
757+}
758+
759+static PyObject*
760+DBEnv_get_intermediate_dir_mode(DBEnvObject* self)
761+{
762+ int err;
763+ const char *mode;
764+
765+ CHECK_ENV_NOT_CLOSED(self);
766+
767+ MYDB_BEGIN_ALLOW_THREADS;
768+ err = self->db_env->get_intermediate_dir_mode(self->db_env, &mode);
769+ MYDB_END_ALLOW_THREADS;
770+ RETURN_IF_ERR();
771+ return Py_BuildValue("s", mode);
772+}
773+#endif
774+
775+static PyObject*
776+DBEnv_get_open_flags(DBEnvObject* self)
777+{
778+ int err;
779+ unsigned int flags;
780+
781+ CHECK_ENV_NOT_CLOSED(self);
782+
783+ MYDB_BEGIN_ALLOW_THREADS;
784+ err = self->db_env->get_open_flags(self->db_env, &flags);
785+ MYDB_END_ALLOW_THREADS;
786+ RETURN_IF_ERR();
787+ return NUMBER_FromLong(flags);
788+}
789
790 #if (DBVER < 48)
791 static PyObject*
792@@ -6875,7 +6915,6 @@ DBEnv_set_verbose(DBEnvObject* self, PyObject* args)
793 RETURN_NONE();
794 }
795
796-#if (DBVER >= 42)
797 static PyObject*
798 DBEnv_get_verbose(DBEnvObject* self, PyObject* args)
799 {
800@@ -6893,7 +6932,6 @@ DBEnv_get_verbose(DBEnvObject* self, PyObject* args)
801 RETURN_IF_ERR();
802 return PyBool_FromLong(verbose);
803 }
804-#endif
805
806 #if (DBVER >= 45)
807 static void
808@@ -6975,9 +7013,7 @@ DBEnv_rep_process_message(DBEnvObject* self, PyObject* args)
809 PyObject *control_py, *rec_py;
810 DBT control, rec;
811 int envid;
812-#if (DBVER >= 42)
813 DB_LSN lsn;
814-#endif
815
816 if (!PyArg_ParseTuple(args, "OOi:rep_process_message", &control_py,
817 &rec_py, &envid))
818@@ -6994,13 +7030,8 @@ DBEnv_rep_process_message(DBEnvObject* self, PyObject* args)
819 err = self->db_env->rep_process_message(self->db_env, &control, &rec,
820 envid, &lsn);
821 #else
822-#if (DBVER >= 42)
823 err = self->db_env->rep_process_message(self->db_env, &control, &rec,
824 &envid, &lsn);
825-#else
826- err = self->db_env->rep_process_message(self->db_env, &control, &rec,
827- &envid);
828-#endif
829 #endif
830 MYDB_END_ALLOW_THREADS;
831 switch (err) {
832@@ -7029,12 +7060,10 @@ DBEnv_rep_process_message(DBEnvObject* self, PyObject* args)
833 return r;
834 break;
835 }
836-#if (DBVER >= 42)
837 case DB_REP_NOTPERM :
838 case DB_REP_ISPERM :
839 return Py_BuildValue("(i(ll))", err, lsn.file, lsn.offset);
840 break;
841-#endif
842 }
843 RETURN_IF_ERR();
844 return Py_BuildValue("(OO)", Py_None, Py_None);
845@@ -7086,20 +7115,6 @@ _DBEnv_rep_transportCallback(DB_ENV* db_env, const DBT* control, const DBT* rec,
846 return ret;
847 }
848
849-#if (DBVER <= 41)
850-static int
851-_DBEnv_rep_transportCallbackOLD(DB_ENV* db_env, const DBT* control, const DBT* rec,
852- int envid, u_int32_t flags)
853-{
854- DB_LSN lsn;
855-
856- lsn.file = -1; /* Dummy values */
857- lsn.offset = -1;
858- return _DBEnv_rep_transportCallback(db_env, control, rec, &lsn, envid,
859- flags);
860-}
861-#endif
862-
863 static PyObject*
864 DBEnv_rep_set_transport(DBEnvObject* self, PyObject* args)
865 {
866@@ -7120,13 +7135,8 @@ DBEnv_rep_set_transport(DBEnvObject* self, PyObject* args)
867 err = self->db_env->rep_set_transport(self->db_env, envid,
868 &_DBEnv_rep_transportCallback);
869 #else
870-#if (DBVER >= 42)
871 err = self->db_env->set_rep_transport(self->db_env, envid,
872 &_DBEnv_rep_transportCallback);
873-#else
874- err = self->db_env->set_rep_transport(self->db_env, envid,
875- &_DBEnv_rep_transportCallbackOLD);
876-#endif
877 #endif
878 MYDB_END_ALLOW_THREADS;
879 RETURN_IF_ERR();
880@@ -7608,6 +7618,7 @@ DBEnv_repmgr_start(DBEnvObject* self, PyObject* args, PyObject*
881 RETURN_NONE();
882 }
883
884+#if (DBVER < 52)
885 static PyObject*
886 DBEnv_repmgr_set_local_site(DBEnvObject* self, PyObject* args, PyObject*
887 kwargs)
888@@ -7654,6 +7665,7 @@ DBEnv_repmgr_add_remote_site(DBEnvObject* self, PyObject* args, PyObject*
889 RETURN_IF_ERR();
890 return NUMBER_FromLong(eidp);
891 }
892+#endif
893
894 static PyObject*
895 DBEnv_repmgr_set_ack_policy(DBEnvObject* self, PyObject* args)
896@@ -8482,65 +8494,43 @@ static PyMethodDef DB_methods[] = {
897 {"remove", (PyCFunction)DB_remove, METH_VARARGS|METH_KEYWORDS},
898 {"rename", (PyCFunction)DB_rename, METH_VARARGS},
899 {"set_bt_minkey", (PyCFunction)DB_set_bt_minkey, METH_VARARGS},
900-#if (DBVER >= 42)
901 {"get_bt_minkey", (PyCFunction)DB_get_bt_minkey, METH_NOARGS},
902-#endif
903 {"set_bt_compare", (PyCFunction)DB_set_bt_compare, METH_O},
904 {"set_cachesize", (PyCFunction)DB_set_cachesize, METH_VARARGS},
905-#if (DBVER >= 42)
906 {"get_cachesize", (PyCFunction)DB_get_cachesize, METH_NOARGS},
907-#endif
908 {"set_encrypt", (PyCFunction)DB_set_encrypt, METH_VARARGS|METH_KEYWORDS},
909-#if (DBVER >= 42)
910 {"get_encrypt_flags", (PyCFunction)DB_get_encrypt_flags, METH_NOARGS},
911-#endif
912-
913 {"set_flags", (PyCFunction)DB_set_flags, METH_VARARGS},
914-#if (DBVER >= 42)
915 {"get_flags", (PyCFunction)DB_get_flags, METH_NOARGS},
916+#if (DBVER >= 43)
917+ {"get_transactional", (PyCFunction)DB_get_transactional, METH_NOARGS},
918 #endif
919 {"set_h_ffactor", (PyCFunction)DB_set_h_ffactor, METH_VARARGS},
920-#if (DBVER >= 42)
921 {"get_h_ffactor", (PyCFunction)DB_get_h_ffactor, METH_NOARGS},
922-#endif
923 {"set_h_nelem", (PyCFunction)DB_set_h_nelem, METH_VARARGS},
924-#if (DBVER >= 42)
925 {"get_h_nelem", (PyCFunction)DB_get_h_nelem, METH_NOARGS},
926-#endif
927 {"set_lorder", (PyCFunction)DB_set_lorder, METH_VARARGS},
928-#if (DBVER >= 42)
929 {"get_lorder", (PyCFunction)DB_get_lorder, METH_NOARGS},
930-#endif
931 {"set_pagesize", (PyCFunction)DB_set_pagesize, METH_VARARGS},
932-#if (DBVER >= 42)
933 {"get_pagesize", (PyCFunction)DB_get_pagesize, METH_NOARGS},
934-#endif
935 {"set_re_delim", (PyCFunction)DB_set_re_delim, METH_VARARGS},
936-#if (DBVER >= 42)
937 {"get_re_delim", (PyCFunction)DB_get_re_delim, METH_NOARGS},
938-#endif
939 {"set_re_len", (PyCFunction)DB_set_re_len, METH_VARARGS},
940-#if (DBVER >= 42)
941 {"get_re_len", (PyCFunction)DB_get_re_len, METH_NOARGS},
942-#endif
943 {"set_re_pad", (PyCFunction)DB_set_re_pad, METH_VARARGS},
944-#if (DBVER >= 42)
945 {"get_re_pad", (PyCFunction)DB_get_re_pad, METH_NOARGS},
946-#endif
947 {"set_re_source", (PyCFunction)DB_set_re_source, METH_VARARGS},
948-#if (DBVER >= 42)
949 {"get_re_source", (PyCFunction)DB_get_re_source, METH_NOARGS},
950-#endif
951 {"set_q_extentsize",(PyCFunction)DB_set_q_extentsize, METH_VARARGS},
952-#if (DBVER >= 42)
953 {"get_q_extentsize",(PyCFunction)DB_get_q_extentsize, METH_NOARGS},
954-#endif
955 {"set_private", (PyCFunction)DB_set_private, METH_O},
956 {"get_private", (PyCFunction)DB_get_private, METH_NOARGS},
957 #if (DBVER >= 46)
958 {"set_priority", (PyCFunction)DB_set_priority, METH_VARARGS},
959 {"get_priority", (PyCFunction)DB_get_priority, METH_NOARGS},
960 #endif
961+ {"get_dbname", (PyCFunction)DB_get_dbname, METH_NOARGS},
962+ {"get_open_flags", (PyCFunction)DB_get_open_flags, METH_NOARGS},
963 {"stat", (PyCFunction)DB_stat, METH_VARARGS|METH_KEYWORDS},
964 #if (DBVER >= 43)
965 {"stat_print", (PyCFunction)DB_stat_print,
966@@ -8639,24 +8629,18 @@ static PyMethodDef DBEnv_methods[] = {
967 {"get_thread_count", (PyCFunction)DBEnv_get_thread_count, METH_NOARGS},
968 #endif
969 {"set_encrypt", (PyCFunction)DBEnv_set_encrypt, METH_VARARGS|METH_KEYWORDS},
970-#if (DBVER >= 42)
971 {"get_encrypt_flags", (PyCFunction)DBEnv_get_encrypt_flags, METH_NOARGS},
972 {"get_timeout", (PyCFunction)DBEnv_get_timeout,
973 METH_VARARGS|METH_KEYWORDS},
974-#endif
975 {"set_timeout", (PyCFunction)DBEnv_set_timeout, METH_VARARGS|METH_KEYWORDS},
976 {"set_shm_key", (PyCFunction)DBEnv_set_shm_key, METH_VARARGS},
977-#if (DBVER >= 42)
978 {"get_shm_key", (PyCFunction)DBEnv_get_shm_key, METH_NOARGS},
979-#endif
980 #if (DBVER >= 46)
981 {"set_cache_max", (PyCFunction)DBEnv_set_cache_max, METH_VARARGS},
982 {"get_cache_max", (PyCFunction)DBEnv_get_cache_max, METH_NOARGS},
983 #endif
984 {"set_cachesize", (PyCFunction)DBEnv_set_cachesize, METH_VARARGS},
985-#if (DBVER >= 42)
986 {"get_cachesize", (PyCFunction)DBEnv_get_cachesize, METH_NOARGS},
987-#endif
988 {"memp_trickle", (PyCFunction)DBEnv_memp_trickle, METH_VARARGS},
989 {"memp_sync", (PyCFunction)DBEnv_memp_sync, METH_VARARGS},
990 {"memp_stat", (PyCFunction)DBEnv_memp_stat,
991@@ -8685,33 +8669,21 @@ static PyMethodDef DBEnv_methods[] = {
992 #endif
993 #endif
994 {"set_data_dir", (PyCFunction)DBEnv_set_data_dir, METH_VARARGS},
995-#if (DBVER >= 42)
996 {"get_data_dirs", (PyCFunction)DBEnv_get_data_dirs, METH_NOARGS},
997-#endif
998-#if (DBVER >= 42)
999 {"get_flags", (PyCFunction)DBEnv_get_flags, METH_NOARGS},
1000-#endif
1001 {"set_flags", (PyCFunction)DBEnv_set_flags, METH_VARARGS},
1002 #if (DBVER >= 47)
1003 {"log_set_config", (PyCFunction)DBEnv_log_set_config, METH_VARARGS},
1004 {"log_get_config", (PyCFunction)DBEnv_log_get_config, METH_VARARGS},
1005 #endif
1006 {"set_lg_bsize", (PyCFunction)DBEnv_set_lg_bsize, METH_VARARGS},
1007-#if (DBVER >= 42)
1008 {"get_lg_bsize", (PyCFunction)DBEnv_get_lg_bsize, METH_NOARGS},
1009-#endif
1010 {"set_lg_dir", (PyCFunction)DBEnv_set_lg_dir, METH_VARARGS},
1011-#if (DBVER >= 42)
1012 {"get_lg_dir", (PyCFunction)DBEnv_get_lg_dir, METH_NOARGS},
1013-#endif
1014 {"set_lg_max", (PyCFunction)DBEnv_set_lg_max, METH_VARARGS},
1015-#if (DBVER >= 42)
1016 {"get_lg_max", (PyCFunction)DBEnv_get_lg_max, METH_NOARGS},
1017-#endif
1018 {"set_lg_regionmax",(PyCFunction)DBEnv_set_lg_regionmax, METH_VARARGS},
1019-#if (DBVER >= 42)
1020 {"get_lg_regionmax",(PyCFunction)DBEnv_get_lg_regionmax, METH_NOARGS},
1021-#endif
1022 #if (DBVER >= 44)
1023 {"set_lg_filemode", (PyCFunction)DBEnv_set_lg_filemode, METH_VARARGS},
1024 {"get_lg_filemode", (PyCFunction)DBEnv_get_lg_filemode, METH_NOARGS},
1025@@ -8721,36 +8693,24 @@ static PyMethodDef DBEnv_methods[] = {
1026 {"get_lk_partitions", (PyCFunction)DBEnv_get_lk_partitions, METH_NOARGS},
1027 #endif
1028 {"set_lk_detect", (PyCFunction)DBEnv_set_lk_detect, METH_VARARGS},
1029-#if (DBVER >= 42)
1030 {"get_lk_detect", (PyCFunction)DBEnv_get_lk_detect, METH_NOARGS},
1031-#endif
1032 #if (DBVER < 45)
1033 {"set_lk_max", (PyCFunction)DBEnv_set_lk_max, METH_VARARGS},
1034 #endif
1035 {"set_lk_max_locks", (PyCFunction)DBEnv_set_lk_max_locks, METH_VARARGS},
1036-#if (DBVER >= 42)
1037 {"get_lk_max_locks", (PyCFunction)DBEnv_get_lk_max_locks, METH_NOARGS},
1038-#endif
1039 {"set_lk_max_lockers", (PyCFunction)DBEnv_set_lk_max_lockers, METH_VARARGS},
1040-#if (DBVER >= 42)
1041 {"get_lk_max_lockers", (PyCFunction)DBEnv_get_lk_max_lockers, METH_NOARGS},
1042-#endif
1043 {"set_lk_max_objects", (PyCFunction)DBEnv_set_lk_max_objects, METH_VARARGS},
1044-#if (DBVER >= 42)
1045 {"get_lk_max_objects", (PyCFunction)DBEnv_get_lk_max_objects, METH_NOARGS},
1046-#endif
1047 #if (DBVER >= 43)
1048 {"stat_print", (PyCFunction)DBEnv_stat_print,
1049 METH_VARARGS|METH_KEYWORDS},
1050 #endif
1051 {"set_mp_mmapsize", (PyCFunction)DBEnv_set_mp_mmapsize, METH_VARARGS},
1052-#if (DBVER >= 42)
1053 {"get_mp_mmapsize", (PyCFunction)DBEnv_get_mp_mmapsize, METH_NOARGS},
1054-#endif
1055 {"set_tmp_dir", (PyCFunction)DBEnv_set_tmp_dir, METH_VARARGS},
1056-#if (DBVER >= 42)
1057 {"get_tmp_dir", (PyCFunction)DBEnv_get_tmp_dir, METH_NOARGS},
1058-#endif
1059 {"txn_begin", (PyCFunction)DBEnv_txn_begin, METH_VARARGS|METH_KEYWORDS},
1060 {"txn_checkpoint", (PyCFunction)DBEnv_txn_checkpoint, METH_VARARGS},
1061 {"txn_stat", (PyCFunction)DBEnv_txn_stat, METH_VARARGS},
1062@@ -8758,10 +8718,8 @@ static PyMethodDef DBEnv_methods[] = {
1063 {"txn_stat_print", (PyCFunction)DBEnv_txn_stat_print,
1064 METH_VARARGS|METH_KEYWORDS},
1065 #endif
1066-#if (DBVER >= 42)
1067 {"get_tx_max", (PyCFunction)DBEnv_get_tx_max, METH_NOARGS},
1068 {"get_tx_timestamp", (PyCFunction)DBEnv_get_tx_timestamp, METH_NOARGS},
1069-#endif
1070 {"set_tx_max", (PyCFunction)DBEnv_set_tx_max, METH_VARARGS},
1071 {"set_tx_timestamp", (PyCFunction)DBEnv_set_tx_timestamp, METH_VARARGS},
1072 {"lock_detect", (PyCFunction)DBEnv_lock_detect, METH_VARARGS},
1073@@ -8804,11 +8762,16 @@ static PyMethodDef DBEnv_methods[] = {
1074 {"get_mp_max_write", (PyCFunction)DBEnv_get_mp_max_write, METH_NOARGS},
1075 #endif
1076 {"set_verbose", (PyCFunction)DBEnv_set_verbose, METH_VARARGS},
1077-#if (DBVER >= 42)
1078- {"get_verbose", (PyCFunction)DBEnv_get_verbose, METH_VARARGS},
1079+ {"get_verbose", (PyCFunction)DBEnv_get_verbose, METH_VARARGS},
1080+ {"set_private", (PyCFunction)DBEnv_set_private, METH_O},
1081+ {"get_private", (PyCFunction)DBEnv_get_private, METH_NOARGS},
1082+ {"get_open_flags", (PyCFunction)DBEnv_get_open_flags, METH_NOARGS},
1083+#if (DBVER >= 47)
1084+ {"set_intermediate_dir_mode", (PyCFunction)DBEnv_set_intermediate_dir_mode,
1085+ METH_VARARGS},
1086+ {"get_intermediate_dir_mode", (PyCFunction)DBEnv_get_intermediate_dir_mode,
1087+ METH_NOARGS},
1088 #endif
1089- {"set_private", (PyCFunction)DBEnv_set_private, METH_O},
1090- {"get_private", (PyCFunction)DBEnv_get_private, METH_NOARGS},
1091 {"rep_start", (PyCFunction)DBEnv_rep_start,
1092 METH_VARARGS|METH_KEYWORDS},
1093 {"rep_set_transport", (PyCFunction)DBEnv_rep_set_transport, METH_VARARGS},
1094@@ -8855,10 +8818,12 @@ static PyMethodDef DBEnv_methods[] = {
1095 #if (DBVER >= 45)
1096 {"repmgr_start", (PyCFunction)DBEnv_repmgr_start,
1097 METH_VARARGS|METH_KEYWORDS},
1098+#if (DBVER < 52)
1099 {"repmgr_set_local_site", (PyCFunction)DBEnv_repmgr_set_local_site,
1100 METH_VARARGS|METH_KEYWORDS},
1101 {"repmgr_add_remote_site", (PyCFunction)DBEnv_repmgr_add_remote_site,
1102 METH_VARARGS|METH_KEYWORDS},
1103+#endif
1104 {"repmgr_set_ack_policy", (PyCFunction)DBEnv_repmgr_set_ack_policy,
1105 METH_VARARGS},
1106 {"repmgr_get_ack_policy", (PyCFunction)DBEnv_repmgr_get_ack_policy,
1107@@ -8922,13 +8887,9 @@ DBEnv_db_home_get(DBEnvObject* self)
1108
1109 CHECK_ENV_NOT_CLOSED(self);
1110
1111-#if (DBVER >= 42)
1112 MYDB_BEGIN_ALLOW_THREADS;
1113 self->db_env->get_home(self->db_env, &home);
1114 MYDB_END_ALLOW_THREADS;
1115-#else
1116- home=self->db_env->db_home;
1117-#endif
1118
1119 if (home == NULL) {
1120 RETURN_NONE();
1121@@ -9298,10 +9259,25 @@ bsddb_version(PyObject* self)
1122 {
1123 int major, minor, patch;
1124
1125+ /* This should be instantaneous, no need to release the GIL */
1126 db_version(&major, &minor, &patch);
1127 return Py_BuildValue("(iii)", major, minor, patch);
1128 }
1129
1130+#if (DBVER >= 50)
1131+static PyObject*
1132+bsddb_version_full(PyObject* self)
1133+{
1134+ char *version_string;
1135+ int family, release, major, minor, patch;
1136+
1137+ /* This should be instantaneous, no need to release the GIL */
1138+ version_string = db_full_version(&family, &release, &major, &minor, &patch);
1139+ return Py_BuildValue("(siiiii)",
1140+ version_string, family, release, major, minor, patch);
1141+}
1142+#endif
1143+
1144
1145 /* List of functions defined in the module */
1146 static PyMethodDef bsddb_methods[] = {
1147@@ -9311,6 +9287,9 @@ static PyMethodDef bsddb_methods[] = {
1148 {"DBSequence", (PyCFunction)DBSequence_construct, METH_VARARGS | METH_KEYWORDS },
1149 #endif
1150 {"version", (PyCFunction)bsddb_version, METH_NOARGS, bsddb_version_doc},
1151+#if (DBVER >= 50)
1152+ {"full_version", (PyCFunction)bsddb_version_full, METH_NOARGS},
1153+#endif
1154 {NULL, NULL} /* sentinel */
1155 };
1156
1157@@ -9328,6 +9307,11 @@ static BSDDB_api bsddb_api;
1158 */
1159 #define ADD_INT(dict, NAME) _addIntToDict(dict, #NAME, NAME)
1160
1161+/*
1162+** We can rename the module at import time, so the string allocated
1163+** must be big enough, and any use of the name must use this particular
1164+** string.
1165+*/
1166 #define MODULE_NAME_MAX_LEN 11
1167 static char _bsddbModuleName[MODULE_NAME_MAX_LEN+1] = "_bsddb";
1168
1169@@ -9428,16 +9412,10 @@ PyMODINIT_FUNC PyInit__bsddb(void) /* Note the two underscores */
1170 ADD_INT(d, DB_MAX_RECORDS);
1171
1172 #if (DBVER < 48)
1173-#if (DBVER >= 42)
1174 ADD_INT(d, DB_RPCCLIENT);
1175-#else
1176- ADD_INT(d, DB_CLIENT);
1177- /* allow apps to be written using DB_RPCCLIENT on older Berkeley DB */
1178- _addIntToDict(d, "DB_RPCCLIENT", DB_CLIENT);
1179-#endif
1180 #endif
1181
1182-#if (DBVER < 48)
1183+#if (DBVER < 48 || DBVER > 51)
1184 ADD_INT(d, DB_XA_CREATE);
1185 #endif
1186
1187@@ -9477,6 +9455,14 @@ PyMODINIT_FUNC PyInit__bsddb(void) /* Note the two underscores */
1188 ADD_INT(d, DB_TXN_SYNC);
1189 ADD_INT(d, DB_TXN_NOWAIT);
1190
1191+#if (DBVER >= 51)
1192+ ADD_INT(d, DB_TXN_BULK);
1193+#endif
1194+
1195+#if (DBVER >= 48)
1196+ ADD_INT(d, DB_CURSOR_BULK);
1197+#endif
1198+
1199 #if (DBVER >= 46)
1200 ADD_INT(d, DB_TXN_WAIT);
1201 #endif
1202@@ -9561,9 +9547,7 @@ PyMODINIT_FUNC PyInit__bsddb(void) /* Note the two underscores */
1203 ADD_INT(d, DB_ARCH_ABS);
1204 ADD_INT(d, DB_ARCH_DATA);
1205 ADD_INT(d, DB_ARCH_LOG);
1206-#if (DBVER >= 42)
1207 ADD_INT(d, DB_ARCH_REMOVE);
1208-#endif
1209
1210 ADD_INT(d, DB_BTREE);
1211 ADD_INT(d, DB_HASH);
1212@@ -9591,9 +9575,6 @@ PyMODINIT_FUNC PyInit__bsddb(void) /* Note the two underscores */
1213 ADD_INT(d, DB_CACHED_COUNTS);
1214 #endif
1215
1216-#if (DBVER <= 41)
1217- ADD_INT(d, DB_COMMIT);
1218-#endif
1219 ADD_INT(d, DB_CONSUME);
1220 ADD_INT(d, DB_CONSUME_WAIT);
1221 ADD_INT(d, DB_CURRENT);
1222@@ -9651,8 +9632,10 @@ PyMODINIT_FUNC PyInit__bsddb(void) /* Note the two underscores */
1223 ADD_INT(d, DB_LOCK_DEADLOCK);
1224 ADD_INT(d, DB_LOCK_NOTGRANTED);
1225 ADD_INT(d, DB_NOSERVER);
1226+#if (DBVER < 52)
1227 ADD_INT(d, DB_NOSERVER_HOME);
1228 ADD_INT(d, DB_NOSERVER_ID);
1229+#endif
1230 ADD_INT(d, DB_NOTFOUND);
1231 ADD_INT(d, DB_OLD_VERSION);
1232 ADD_INT(d, DB_RUNRECOVERY);
1233@@ -9671,6 +9654,10 @@ PyMODINIT_FUNC PyInit__bsddb(void) /* Note the two underscores */
1234 #if (DBVER >= 43)
1235 ADD_INT(d, DB_STAT_SUBSYSTEM);
1236 ADD_INT(d, DB_STAT_MEMP_HASH);
1237+ ADD_INT(d, DB_STAT_LOCK_CONF);
1238+ ADD_INT(d, DB_STAT_LOCK_LOCKERS);
1239+ ADD_INT(d, DB_STAT_LOCK_OBJECTS);
1240+ ADD_INT(d, DB_STAT_LOCK_PARAMS);
1241 #endif
1242
1243 #if (DBVER >= 48)
1244@@ -9690,7 +9677,6 @@ PyMODINIT_FUNC PyInit__bsddb(void) /* Note the two underscores */
1245 ADD_INT(d, DB_EID_INVALID);
1246 ADD_INT(d, DB_EID_BROADCAST);
1247
1248-#if (DBVER >= 42)
1249 ADD_INT(d, DB_TIME_NOTGRANTED);
1250 ADD_INT(d, DB_TXN_NOT_DURABLE);
1251 ADD_INT(d, DB_TXN_WRITE_NOSYNC);
1252@@ -9698,9 +9684,8 @@ PyMODINIT_FUNC PyInit__bsddb(void) /* Note the two underscores */
1253 ADD_INT(d, DB_INIT_REP);
1254 ADD_INT(d, DB_ENCRYPT);
1255 ADD_INT(d, DB_CHKSUM);
1256-#endif
1257
1258-#if (DBVER >= 42) && (DBVER < 47)
1259+#if (DBVER < 47)
1260 ADD_INT(d, DB_LOG_AUTOREMOVE);
1261 ADD_INT(d, DB_DIRECT_LOG);
1262 #endif
1263@@ -9733,6 +9718,20 @@ PyMODINIT_FUNC PyInit__bsddb(void) /* Note the two underscores */
1264 ADD_INT(d, DB_VERB_REPLICATION);
1265 ADD_INT(d, DB_VERB_WAITSFOR);
1266
1267+#if (DBVER >= 50)
1268+ ADD_INT(d, DB_VERB_REP_SYSTEM);
1269+#endif
1270+
1271+#if (DBVER >= 47)
1272+ ADD_INT(d, DB_VERB_REP_ELECT);
1273+ ADD_INT(d, DB_VERB_REP_LEASE);
1274+ ADD_INT(d, DB_VERB_REP_MISC);
1275+ ADD_INT(d, DB_VERB_REP_MSGS);
1276+ ADD_INT(d, DB_VERB_REP_SYNC);
1277+ ADD_INT(d, DB_VERB_REPMGR_CONNFAIL);
1278+ ADD_INT(d, DB_VERB_REPMGR_MISC);
1279+#endif
1280+
1281 #if (DBVER >= 45)
1282 ADD_INT(d, DB_EVENT_PANIC);
1283 ADD_INT(d, DB_EVENT_REP_CLIENT);
1284@@ -9748,16 +9747,25 @@ PyMODINIT_FUNC PyInit__bsddb(void) /* Note the two underscores */
1285 ADD_INT(d, DB_EVENT_WRITE_FAILED);
1286 #endif
1287
1288+#if (DBVER >= 50)
1289+ ADD_INT(d, DB_REPMGR_CONF_ELECTIONS);
1290+ ADD_INT(d, DB_EVENT_REP_MASTER_FAILURE);
1291+ ADD_INT(d, DB_EVENT_REP_DUPMASTER);
1292+ ADD_INT(d, DB_EVENT_REP_ELECTION_FAILED);
1293+#endif
1294+#if (DBVER >= 48)
1295+ ADD_INT(d, DB_EVENT_REG_ALIVE);
1296+ ADD_INT(d, DB_EVENT_REG_PANIC);
1297+#endif
1298+
1299 ADD_INT(d, DB_REP_DUPMASTER);
1300 ADD_INT(d, DB_REP_HOLDELECTION);
1301 #if (DBVER >= 44)
1302 ADD_INT(d, DB_REP_IGNORE);
1303 ADD_INT(d, DB_REP_JOIN_FAILURE);
1304 #endif
1305-#if (DBVER >= 42)
1306 ADD_INT(d, DB_REP_ISPERM);
1307 ADD_INT(d, DB_REP_NOTPERM);
1308-#endif
1309 ADD_INT(d, DB_REP_NEWSITE);
1310
1311 ADD_INT(d, DB_REP_MASTER);
1312@@ -9766,7 +9774,13 @@ PyMODINIT_FUNC PyInit__bsddb(void) /* Note the two underscores */
1313 ADD_INT(d, DB_REP_PERMANENT);
1314
1315 #if (DBVER >= 44)
1316+#if (DBVER >= 50)
1317+ ADD_INT(d, DB_REP_CONF_AUTOINIT);
1318+#else
1319 ADD_INT(d, DB_REP_CONF_NOAUTOINIT);
1320+#endif /* 5.0 */
1321+#endif /* 4.4 */
1322+#if (DBVER >= 44)
1323 ADD_INT(d, DB_REP_CONF_DELAYCLIENT);
1324 ADD_INT(d, DB_REP_CONF_BULK);
1325 ADD_INT(d, DB_REP_CONF_NOWAIT);
1326@@ -9774,9 +9788,7 @@ PyMODINIT_FUNC PyInit__bsddb(void) /* Note the two underscores */
1327 ADD_INT(d, DB_REP_REREQUEST);
1328 #endif
1329
1330-#if (DBVER >= 42)
1331 ADD_INT(d, DB_REP_NOBUFFER);
1332-#endif
1333
1334 #if (DBVER >= 46)
1335 ADD_INT(d, DB_REP_LEASE_EXPIRED);
1336@@ -9819,6 +9831,28 @@ PyMODINIT_FUNC PyInit__bsddb(void) /* Note the two underscores */
1337 ADD_INT(d, DB_STAT_ALL);
1338 #endif
1339
1340+#if (DBVER >= 51)
1341+ ADD_INT(d, DB_REPMGR_ACKS_ALL_AVAILABLE);
1342+#endif
1343+
1344+#if (DBVER >= 48)
1345+ ADD_INT(d, DB_REP_CONF_INMEM);
1346+#endif
1347+
1348+ ADD_INT(d, DB_TIMEOUT);
1349+
1350+#if (DBVER >= 50)
1351+ ADD_INT(d, DB_FORCESYNC);
1352+#endif
1353+
1354+#if (DBVER >= 48)
1355+ ADD_INT(d, DB_FAILCHK);
1356+#endif
1357+
1358+#if (DBVER >= 51)
1359+ ADD_INT(d, DB_HOTBACKUP_IN_PROGRESS);
1360+#endif
1361+
1362 #if (DBVER >= 43)
1363 ADD_INT(d, DB_BUFFER_SMALL);
1364 ADD_INT(d, DB_SEQ_DEC);
1365@@ -9856,6 +9890,10 @@ PyMODINIT_FUNC PyInit__bsddb(void) /* Note the two underscores */
1366 ADD_INT(d, DB_SET_LOCK_TIMEOUT);
1367 ADD_INT(d, DB_SET_TXN_TIMEOUT);
1368
1369+#if (DBVER >= 48)
1370+ ADD_INT(d, DB_SET_REG_TIMEOUT);
1371+#endif
1372+
1373 /* The exception name must be correct for pickled exception *
1374 * objects to unpickle properly. */
1375 #ifdef PYBSDDB_STANDALONE /* different value needed for standalone pybsddb */
1376@@ -9912,8 +9950,10 @@ PyMODINIT_FUNC PyInit__bsddb(void) /* Note the two underscores */
1377 MAKE_EX(DBRunRecoveryError);
1378 MAKE_EX(DBVerifyBadError);
1379 MAKE_EX(DBNoServerError);
1380+#if (DBVER >= 44 && DBVER < 52)
1381 MAKE_EX(DBNoServerHomeError);
1382 MAKE_EX(DBNoServerIDError);
1383+#endif
1384 MAKE_EX(DBPageNotFoundError);
1385 MAKE_EX(DBSecondaryBadError);
1386
1387@@ -9927,9 +9967,7 @@ PyMODINIT_FUNC PyInit__bsddb(void) /* Note the two underscores */
1388 MAKE_EX(DBNoSuchFileError);
1389 MAKE_EX(DBPermissionsError);
1390
1391-#if (DBVER >= 42)
1392 MAKE_EX(DBRepHandleDeadError);
1393-#endif
1394 #if (DBVER >= 44)
1395 MAKE_EX(DBRepLockoutError);
1396 #endif
1397@@ -9947,6 +9985,7 @@ PyMODINIT_FUNC PyInit__bsddb(void) /* Note the two underscores */
1398 #undef MAKE_EX
1399
1400 /* Initialise the C API structure and add it to the module */
1401+ bsddb_api.api_version = PYBSDDB_API_VERSION;
1402 bsddb_api.db_type = &DB_Type;
1403 bsddb_api.dbcursor_type = &DBCursor_Type;
1404 bsddb_api.dblogcursor_type = &DBLogCursor_Type;
1405@@ -9955,19 +9994,25 @@ PyMODINIT_FUNC PyInit__bsddb(void) /* Note the two underscores */
1406 bsddb_api.dblock_type = &DBLock_Type;
1407 #if (DBVER >= 43)
1408 bsddb_api.dbsequence_type = &DBSequence_Type;
1409+#else
1410+ bsddb_api.dbsequence_type = NULL;
1411 #endif
1412 bsddb_api.makeDBError = makeDBError;
1413
1414 /*
1415- ** Capsules exist from Python 3.1, but I
1416- ** don't want to break the API compatibility
1417- ** for already published Python versions.
1418+ ** Capsules exist from Python 2.7 and 3.1.
1419+ ** We don't support Python 3.0 anymore, so...
1420+ ** #if (PY_VERSION_HEX < ((PY_MAJOR_VERSION < 3) ? 0x02070000 : 0x03020000))
1421 */
1422-#if (PY_VERSION_HEX < 0x03020000)
1423+#if (PY_VERSION_HEX < 0x02070000)
1424 py_api = PyCObject_FromVoidPtr((void*)&bsddb_api, NULL);
1425 #else
1426 {
1427- char py_api_name[250];
1428+ /*
1429+ ** The data must outlive the call!!. So, the static definition.
1430+ ** The buffer must be big enough...
1431+ */
1432+ static char py_api_name[MODULE_NAME_MAX_LEN+10];
1433
1434 strcpy(py_api_name, _bsddbModuleName);
1435 strcat(py_api_name, ".api");
1436diff --git a/Modules/bsddb.h b/Modules/bsddb.h
1437index a3a687b..c1d862a 100644
1438--- a/Modules/bsddb.h
1439+++ b/Modules/bsddb.h
1440@@ -109,7 +109,7 @@
1441 #error "eek! DBVER can't handle minor versions > 9"
1442 #endif
1443
1444-#define PY_BSDDB_VERSION "4.8.4.2"
1445+#define PY_BSDDB_VERSION "5.3.15"
1446
1447 /* Python object definitions */
1448
1449@@ -236,7 +236,7 @@ typedef struct DBSequenceObject {
1450 /* To access the structure from an external module, use code like the
1451 following (error checking missed out for clarity):
1452
1453- // If you are using Python before 3.2:
1454+ // If you are using Python before 2.7:
1455 BSDDB_api* bsddb_api;
1456 PyObject* mod;
1457 PyObject* cobj;
1458@@ -249,7 +249,7 @@ typedef struct DBSequenceObject {
1459 Py_DECREF(mod);
1460
1461
1462- // If you are using Python 3.2 or up:
1463+ // If you are using Python 2.7 or up: (except Python 3.0, unsupported)
1464 BSDDB_api* bsddb_api;
1465
1466 // Use "bsddb3._pybsddb.api" if you're using
1467@@ -257,10 +257,14 @@ typedef struct DBSequenceObject {
1468 bsddb_api = (void **)PyCapsule_Import("bsddb._bsddb.api", 1);
1469
1470
1471+ Check "api_version" number before trying to use the API.
1472+
1473 The structure's members must not be changed.
1474 */
1475
1476+#define PYBSDDB_API_VERSION 1
1477 typedef struct {
1478+ unsigned int api_version;
1479 /* Type objects */
1480 PyTypeObject* db_type;
1481 PyTypeObject* dbcursor_type;
1482@@ -268,9 +272,7 @@ typedef struct {
1483 PyTypeObject* dbenv_type;
1484 PyTypeObject* dbtxn_type;
1485 PyTypeObject* dblock_type;
1486-#if (DBVER >= 43)
1487- PyTypeObject* dbsequence_type;
1488-#endif
1489+ PyTypeObject* dbsequence_type; /* If DBVER < 43 -> NULL */
1490
1491 /* Functions */
1492 int (*makeDBError)(int err);
1493@@ -289,9 +291,9 @@ typedef struct {
1494 #define DBEnvObject_Check(v) ((v)->ob_type == bsddb_api->dbenv_type)
1495 #define DBTxnObject_Check(v) ((v)->ob_type == bsddb_api->dbtxn_type)
1496 #define DBLockObject_Check(v) ((v)->ob_type == bsddb_api->dblock_type)
1497-#if (DBVER >= 43)
1498-#define DBSequenceObject_Check(v) ((v)->ob_type == bsddb_api->dbsequence_type)
1499-#endif
1500+#define DBSequenceObject_Check(v) \
1501+ ((bsddb_api->dbsequence_type) && \
1502+ ((v)->ob_type == bsddb_api->dbsequence_type))
1503
1504 #endif /* COMPILING_BSDDB_C */
1505
1506diff --git a/setup.py b/setup.py
1507index 6b47451..e8ac96c 100644
1508--- a/setup.py
1509+++ b/setup.py
1510@@ -799,7 +799,7 @@ class PyBuildExt(build_ext):
1511 # a release. Most open source OSes come with one or more
1512 # versions of BerkeleyDB already installed.
1513
1514- max_db_ver = (4, 8)
1515+ max_db_ver = (5, 3)
1516 min_db_ver = (4, 1)
1517 db_setup_debug = False # verbose debug prints from this script?
1518
1519@@ -821,7 +821,11 @@ class PyBuildExt(build_ext):
1520 return True
1521
1522 def gen_db_minor_ver_nums(major):
1523- if major == 4:
1524+ if major == 5:
1525+ for x in range(max_db_ver[1]+1):
1526+ if allow_db_ver((5, x)):
1527+ yield x
1528+ elif major == 4:
1529 for x in range(max_db_ver[1]+1):
1530 if allow_db_ver((4, x)):
1531 yield x
1532@@ -835,6 +839,9 @@ class PyBuildExt(build_ext):
1533 # construct a list of paths to look for the header file in on
1534 # top of the normal inc_dirs.
1535 db_inc_paths = [
1536+ '/usr/include/db5',
1537+ '/usr/local/include/db5',
1538+ '/opt/sfw/include/db5',
1539 '/usr/include/db4',
1540 '/usr/local/include/db4',
1541 '/opt/sfw/include/db4',
1542@@ -845,6 +852,16 @@ class PyBuildExt(build_ext):
1543 '/sw/include/db4',
1544 '/sw/include/db3',
1545 ]
1546+ # 5.x minor number specific paths
1547+ for x in gen_db_minor_ver_nums(5):
1548+ db_inc_paths.append('/usr/include/db5%d' % x)
1549+ db_inc_paths.append('/usr/include/db5.%d' % x)
1550+ db_inc_paths.append('/usr/local/BerkeleyDB.5.%d/include' % x)
1551+ db_inc_paths.append('/usr/local/include/db5%d' % x)
1552+ db_inc_paths.append('/pkg/db-5.%d/include' % x)
1553+ db_inc_paths.append('/opt/db-5.%d/include' % x)
1554+ # MacPorts default (http://www.macports.org/)
1555+ db_inc_paths.append('/opt/local/include/db5%d' % x)
1556 # 4.x minor number specific paths
1557 for x in gen_db_minor_ver_nums(4):
1558 db_inc_paths.append('/usr/include/db4%d' % x)
1559@@ -871,6 +888,10 @@ class PyBuildExt(build_ext):
1560 for dn in inc_dirs:
1561 std_variants.append(os.path.join(dn, 'db3'))
1562 std_variants.append(os.path.join(dn, 'db4'))
1563+ std_variants.append(os.path.join(dn, 'db5'))
1564+ for x in gen_db_minor_ver_nums(5):
1565+ std_variants.append(os.path.join(dn, "db5%d"%x))
1566+ std_variants.append(os.path.join(dn, "db5.%d"%x))
1567 for x in gen_db_minor_ver_nums(4):
1568 std_variants.append(os.path.join(dn, "db4%d"%x))
1569 std_variants.append(os.path.join(dn, "db4.%d"%x))
1570--
15711.7.7
1572