[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-05-01 Thread Jesús Cea Avión
Jesús Cea Avión added the comment: OK, you did your homework. I checked PyObject_Is_True() function and I agree. This actually looks like a leak when True/False were added to Python. Python3 is inheriting it :-). OK. I see three issues in the code: a) You are getting a key from the

[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

[issue2159] dbmmodule inquiry function is performance prohibitive

2014-04-30 Thread Jesús Cea Avión
Jesús Cea Avión added the comment: I would like a bit more comfortable if you return True/False. Maybe I am missing something, I am not familiar with this either, but looks like more... sensible, instead of counting on implicit and magical 0/1 - False/True conversion. What do you think?.

[issue2159] dbmmodule inquiry function is performance prohibitive

2014-04-30 Thread Jesús Cea Avión
Jesús Cea Avión added the comment: BTW, would you mind to sign a contributor form?. https://www.python.org/psf/contrib/ -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue2159 ___

[issue2159] dbmmodule inquiry function is performance prohibitive

2014-04-30 Thread Jesús Cea Avión
Jesús Cea Avión added the comment: Oh, I see that your already did. Sorry for the noise. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue2159 ___

[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 Jesús Cea Avión
Jesús Cea Avión added the comment: Eric, would you mind to clarify the points I raised in the last message?. Lets move this forward. -- ___ 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: 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

[issue2159] dbmmodule inquiry function is performance prohibitive

2014-04-23 Thread Jesús Cea Avión
Jesús Cea Avión added the comment: First, Python 2.4 has been out of support for a really long time. Deleting. Eric, let me clarify the situation, because this report is old and I forgot the details. I think current situation is this, when doing something like if db : DO_SOMETHING: a) If

[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:

[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 this

[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:

[issue2159] dbmmodule inquiry function is performance prohibitive

2011-02-22 Thread Ray.Allen
Changes by Ray.Allen ysj@gmail.com: -- nosy: +ysj.ray ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue2159 ___ ___ Python-bugs-list mailing list

[issue2159] dbmmodule inquiry function is performance prohibitive

2009-01-28 Thread johansen
johansen johan...@sun.com added the comment: I haven't been able to find any of the patches listed in the comments, but it does look like providing a nb_nonzero method in the module would solve our issue. PyObject_IsTrue checks the tp_as_number methods before the sequence and mapping methods.

[issue2159] dbmmodule inquiry function is performance prohibitive

2009-01-28 Thread Guido van Rossum
Changes by Guido van Rossum gu...@python.org: -- nosy: -gvanrossum ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue2159 ___ ___ Python-bugs-list

[issue2159] dbmmodule inquiry function is performance prohibitive

2008-06-12 Thread Jesús Cea Avión
Jesús Cea Avión [EMAIL PROTECTED] added the comment: johansen, could you be happy returning True of False according to database being open/closed?. ___ Python tracker [EMAIL PROTECTED] http://bugs.python.org/issue2159 ___

[issue2159] dbmmodule inquiry function is performance prohibitive

2008-06-12 Thread johansen
johansen [EMAIL PROTECTED] added the comment: Yes, True/False should be sufficient for our purposes. IIRC, we were trying to determine if we had a stale handle to the database and needed to open it again. ___ Python tracker [EMAIL PROTECTED]

[issue2159] dbmmodule inquiry function is performance prohibitive

2008-04-07 Thread Jesús Cea Avión
Jesús Cea Avión [EMAIL PROTECTED] added the comment: Somebody posted a similar issue in pybsddb. The patch I proposed would be consistent with current __len__ *internal* use, but the real intention, I think, is to return True or False if the database is open or closed, not if the database is

[issue2159] dbmmodule inquiry function is performance prohibitive

2008-04-07 Thread Guido van Rossum
Guido van Rossum [EMAIL PROTECTED] added the comment: Assigning anything not related to Py3k design to me is a mistake; I don't have the bandwidth to handle this, sorry. -- assignee: gvanrossum - __ Tracker [EMAIL PROTECTED]

[issue2159] dbmmodule inquiry function is performance prohibitive

2008-03-24 Thread Jesús Cea Avión
Changes by Jesús Cea Avión [EMAIL PROTECTED]: -- nosy: +jcea __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue2159 __ ___ Python-bugs-list mailing list Unsubscribe:

[issue2159] dbmmodule inquiry function is performance prohibitive

2008-03-24 Thread Benjamin Peterson
Changes by Benjamin Peterson [EMAIL PROTECTED]: -- type: resource usage - performance __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue2159 __ ___ Python-bugs-list

[issue2159] dbmmodule inquiry function is performance prohibitive

2008-03-24 Thread Jesús Cea Avión
Jesús Cea Avión [EMAIL PROTECTED] added the comment: I think that -1 is a sanity check. If the count is updated in the database, but it is not transactional (or there are bugs, or the DB is updated by a not up-to-date library, and so on), the cached counter and the real data can diverge.

[issue2159] dbmmodule inquiry function is performance prohibitive

2008-02-21 Thread johansen
New submission from johansen: We've been using Python 2.4 to build the new package management software for OpenSolaris. We use a ndbm database to hold keywords about packages, and found that each time we added a new OpenSolaris build to our package repository, the time to import would increase