New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PowerLinux dbm failure in 2.7 #62126
Comments
The PowerLinux buildslave fails in test_dbm:test_keys() because of a problem with the "in" operator. >>> import dbm
>>> d = dbm.open('t','c')
>>> a = [('a', 'b'), ('12345678910', '019237410982340912840198242')]
>>> for k,v in a:
... d[k] = v
...
>>> print d
<dbm.dbm object at 0x3fff93073110>
>>> print d.keys()
['a', '12345678910']
>>> print 'a' in d
False <--- This apparently should be True
>>> print 'a' in d.keys()
True |
Can you try the other dbm methods? e.g. has_key(), get()... |
Forget it, can you just try the following patch? diff --git a/Modules/dbmmodule.c b/Modules/dbmmodule.c
--- a/Modules/dbmmodule.c
+++ b/Modules/dbmmodule.c
@@ -168,11 +168,13 @@
dbm_contains(register dbmobject *dp, PyObject *v)
{
datum key, val;
+ char *ptr;
+ Py_ssize_t size;
- if (PyString_AsStringAndSize(v, (char **)&key.dptr,
- (Py_ssize_t *)&key.dsize)) {
+ if (PyString_AsStringAndSize(v, &ptr, &size))
return -1;
- }
+ key.dptr = ptr;
+ key.dsize = size;
/* Expand check_dbmobject_open to return -1 */
if (dp->di_dbm == NULL) { |
My example and test_dbm succeeds on Python2.7 with your patch applied. |
Ok. This is a classic example of why a big-endian buildbot is useful :) |
New changeset 53da3bad8554 by Antoine Pitrou in branch '2.7': |
Committed, thank you. |
See also bpo-9687. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: