homepage

This issue tracker has been migrated to GitHub , and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: PowerLinux dbm failure in 2.7
Type: behavior Stage: resolved
Components: Interpreter Core Versions: Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: David.Edelsohn, pitrou, python-dev, serhiy.storchaka
Priority: normal Keywords:

Created on 2013年05月07日 15:30 by David.Edelsohn, last changed 2022年04月11日 14:57 by admin. This issue is now closed.

Messages (8)
msg188666 - (view) Author: David Edelsohn (David.Edelsohn) * Date: 2013年05月07日 15:30
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
msg188669 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2013年05月07日 15:51
Can you try the other dbm methods? e.g. has_key(), get()...
msg188671 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2013年05月07日 15:59
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) {
msg188674 - (view) Author: David Edelsohn (David.Edelsohn) * Date: 2013年05月07日 16:14
My example and test_dbm succeeds on Python2.7 with your patch applied.
Thanks!
msg188675 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2013年05月07日 16:20
Ok. This is a classic example of why a big-endian buildbot is useful :)
msg188693 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2013年05月07日 23:51
New changeset 53da3bad8554 by Antoine Pitrou in branch '2.7':
Issue #17926: Fix dbm.__contains__ on 64-bit big-endian machines.
http://hg.python.org/cpython/rev/53da3bad8554 
msg188694 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2013年05月07日 23:52
Committed, thank you.
msg188824 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2013年05月10日 09:44
See also issue9687.
History
Date User Action Args
2022年04月11日 14:57:45adminsetgithub: 62126
2013年05月10日 10:09:13pitroulinkissue9687 superseder
2013年05月10日 09:44:46serhiy.storchakasetnosy: + serhiy.storchaka
messages: + msg188824
2013年05月07日 23:52:12pitrousetstatus: open -> closed
resolution: fixed
messages: + msg188694

stage: commit review -> resolved
2013年05月07日 23:51:46python-devsetnosy: + python-dev
messages: + msg188693
2013年05月07日 16:20:22pitrousetmessages: + msg188675
stage: commit review
2013年05月07日 16:14:38David.Edelsohnsetmessages: + msg188674
2013年05月07日 15:59:57pitrousetmessages: + msg188671
2013年05月07日 15:51:26pitrousetmessages: + msg188669
2013年05月07日 15:31:55David.Edelsohnsettype: behavior
2013年05月07日 15:31:28David.Edelsohnsetnosy: + pitrou
2013年05月07日 15:30:25David.Edelsohncreate

AltStyle によって変換されたページ (->オリジナル) /