The Samba-Bugzilla – Attachment 11267 Details for
Bug 7416
python-tdb: KeyError: 'No such TDB entry' is unhelpful
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
KeyError patch
0001-tdb-python-binding-raise-KeyError-key-when-the-key-d.patch (text/plain), 1016 bytes, created by
Aurélien Aptel
on 2015-07-17 08:32:11 UTC
(
hide
)
Description:
KeyError patch
Filename:
MIME Type:
Creator:
Aurélien Aptel
Created:
2015-07-17 08:32:11 UTC
Size:
1016 bytes
patch
obsolete
>From f946083922e75f6081be535a284a0a0717b11b95 Mon Sep 17 00:00:00 2001 >From: Aurelien Aptel <aaptel@suse.com> >Date: Thu, 16 Jul 2015 16:55:28 +0200 >Subject: [PATCH] tdb python binding: raise KeyError(key) when the key doesn't > exist > >This change makes tdb dicts more consistent with Python dicts. > >BUG: https://bugzilla.samba.org/show_bug.cgi?id=7416 > >Signed-off-by: Aurelien Aptel <aaptel@suse.com> >--- > lib/tdb/pytdb.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > >diff --git a/lib/tdb/pytdb.c b/lib/tdb/pytdb.c >index 9320799..1261bf5 100644 >--- a/lib/tdb/pytdb.c >+++ b/lib/tdb/pytdb.c >@@ -598,7 +598,9 @@ static PyObject *obj_getitem(PyTdbObject *self, PyObject *key) > > val = tdb_fetch(self->ctx, tkey); > if (val.dptr == NULL) { >- PyErr_SetString(PyExc_KeyError, "No such TDB entry"); >+ /* if the key doesn't exist return KeyError(key) to be >+ consistent with python dict */ >+ PyErr_SetObject(PyExc_KeyError, key); > return NULL; > } else { > return PyString_FromTDB_DATA(val); >-- >2.1.4 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 7416
: 11267