[issue2159] dbmmodule inquiry function is performance prohibitive

2014-05-04 Thread Eric Olson
Eric Olson added the comment: Hi, Thanks for finding those issues. I attached a new patch. a) Good find, I added the free() for gdbm. ndbm doesn't need free(). b) Added the error check. I don't know if a test can be made for this. If there was a common way to patch C libraries in CPython

[issue2159] dbmmodule inquiry function is performance prohibitive

2014-04-30 Thread Eric Olson
Eric Olson added the comment: Also, I'm happy to allow the code to be ported to pybsddb. As long as it doesn't cause any problems with CPython licensing - and I can't think of any way it could. -- ___ Python tracker rep...@bugs.python.org http

[issue2159] dbmmodule inquiry function is performance prohibitive

2014-04-30 Thread Eric Olson
Eric Olson added the comment: I did try the suggestion to return Py_False, but that gives the wrong result since Py_False is not 0 and gets returned as Py_True. I looked for similar code, and this looks like the convention for handling if obj. PyObject_IsTrue() is called on the object. What

[issue2159] dbmmodule inquiry function is performance prohibitive

2014-04-29 Thread Eric Olson
Eric Olson added the comment: Thank you for the feedback. Sorry I didn't see your previous response until today. I will take a look and respond tonight. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue2159

[issue2159] dbmmodule inquiry function is performance prohibitive

2014-04-29 Thread Eric Olson
Eric Olson added the comment: Hi Jesús, I believe the patch should have this behavior: a) If the database is closed, raise an exception. b) If database is empty, return False. c) If database has any entry, return True. Fast and simply checking if the database has at least a single record

[issue2159] dbmmodule inquiry function is performance prohibitive

2014-04-16 Thread Eric Olson
Eric Olson added the comment: New patch with Pep 7 fix - no c++ // style comments. -Thanks johansen. -- Added file: http://bugs.python.org/file34916/dbm_bool_d.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue2159

[issue2159] dbmmodule inquiry function is performance prohibitive

2014-04-15 Thread Eric Olson
Eric Olson added the comment: The performance is still an issue in python 3. Attaching a patch for python 3, performance numbers are below. Measuring ndbm time for a falsey check on an open db with 100 entries. gdbm performance is similar. Before patch: db is not None: 6.9141387939453125e

[issue2159] dbmmodule inquiry function is performance prohibitive

2014-04-15 Thread Eric Olson
Eric Olson added the comment: Uploading patch with minor test changes (dbm_bool_b.patch). Backwards compatibility note: Result of running bool(db) on a db that has been closed: Old: _dbm.error: DBM object has already been closed With patch: returns False instead of raising. I think

[issue2159] dbmmodule inquiry function is performance prohibitive

2014-04-15 Thread Eric Olson
Eric Olson added the comment: Make the changes backward compatible after getting input on possible problems from r.david.murray patch: dbm_bool_c.patch Now, the only change should be faster performance for bool(db). -- versions: +Python 3.5 Added file: http://bugs.python.org