Skip to content
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

Closed
DavidEdelsohn mannequin opened this issue May 7, 2013 · 8 comments
Closed

PowerLinux dbm failure in 2.7 #62126

DavidEdelsohn mannequin opened this issue May 7, 2013 · 8 comments
Labels
interpreter-core (Objects, Python, Grammar, and Parser dirs) type-bug An unexpected behavior, bug, or error

Comments

@DavidEdelsohn
Copy link
Mannequin

DavidEdelsohn mannequin commented May 7, 2013

BPO 17926
Nosy @pitrou, @serhiy-storchaka

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:

assignee = None
closed_at = <Date 2013-05-07.23:52:12.950>
created_at = <Date 2013-05-07.15:30:25.140>
labels = ['interpreter-core', 'type-bug']
title = 'PowerLinux dbm failure in 2.7'
updated_at = <Date 2013-05-10.09:44:46.322>
user = 'https://bugs.python.org/DavidEdelsohn'

bugs.python.org fields:

activity = <Date 2013-05-10.09:44:46.322>
actor = 'serhiy.storchaka'
assignee = 'none'
closed = True
closed_date = <Date 2013-05-07.23:52:12.950>
closer = 'pitrou'
components = ['Interpreter Core']
creation = <Date 2013-05-07.15:30:25.140>
creator = 'David.Edelsohn'
dependencies = []
files = []
hgrepos = []
issue_num = 17926
keywords = []
message_count = 8.0
messages = ['188666', '188669', '188671', '188674', '188675', '188693', '188694', '188824']
nosy_count = 4.0
nosy_names = ['pitrou', 'python-dev', 'serhiy.storchaka', 'David.Edelsohn']
pr_nums = []
priority = 'normal'
resolution = 'fixed'
stage = 'resolved'
status = 'closed'
superseder = None
type = 'behavior'
url = 'https://bugs.python.org/issue17926'
versions = ['Python 2.7']

@DavidEdelsohn
Copy link
Mannequin Author

DavidEdelsohn mannequin commented May 7, 2013

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

@DavidEdelsohn DavidEdelsohn mannequin added interpreter-core (Objects, Python, Grammar, and Parser dirs) type-bug An unexpected behavior, bug, or error labels May 7, 2013
@pitrou
Copy link
Member

pitrou commented May 7, 2013

Can you try the other dbm methods? e.g. has_key(), get()...

@pitrou
Copy link
Member

pitrou commented May 7, 2013

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) {

@DavidEdelsohn
Copy link
Mannequin Author

DavidEdelsohn mannequin commented May 7, 2013

My example and test_dbm succeeds on Python2.7 with your patch applied.
Thanks!

@pitrou
Copy link
Member

pitrou commented May 7, 2013

Ok. This is a classic example of why a big-endian buildbot is useful :)

@python-dev
Copy link
Mannequin

python-dev mannequin commented May 7, 2013

New changeset 53da3bad8554 by Antoine Pitrou in branch '2.7':
Issue bpo-17926: Fix dbm.__contains__ on 64-bit big-endian machines.
http://hg.python.org/cpython/rev/53da3bad8554

@pitrou
Copy link
Member

pitrou commented May 7, 2013

Committed, thank you.

@pitrou pitrou closed this as completed May 7, 2013
@serhiy-storchaka
Copy link
Member

See also bpo-9687.

@ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
interpreter-core (Objects, Python, Grammar, and Parser dirs) type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

2 participants