Mercurial > cpython-lru_cache-weakref
changeset 86605:cb82b4efa67b
Issue #19287: Fixed the "in" operator of dbm.ndbm databases for string
argument. Original patch by Arfrever Frehtes Taifersar Arahesis.
| author | Serhiy Storchaka <storchaka@gmail.com> |
|---|---|
| date | Fri, 25 Oct 2013 00:01:25 +0300 |
| parents | 8939c0196990 (current diff) 61ab0c6907f9 (diff) |
| children | 379372612f6d |
| files | Misc/NEWS Modules/_dbmmodule.c |
| diffstat | 3 files changed, 6 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/Lib/test/test_dbm_ndbm.py Thu Oct 24 22:23:42 2013 +0200 +++ b/Lib/test/test_dbm_ndbm.py Fri Oct 25 00:01:25 2013 +0300 @@ -24,6 +24,7 @@ self.d[b'bytes'] = b'data' self.d['12345678910'] = '019237410982340912840198242' self.d.keys() + self.assertIn('a', self.d) self.assertIn(b'a', self.d) self.assertEqual(self.d[b'bytes'], b'data') self.d.close()
--- a/Misc/NEWS Thu Oct 24 22:23:42 2013 +0200 +++ b/Misc/NEWS Fri Oct 25 00:01:25 2013 +0300 @@ -10,6 +10,9 @@ Core and Builtins ----------------- +- Issue #19287: Fixed the "in" operator of dbm.ndbm databases for string + argument. Original patch by Arfrever Frehtes Taifersar Arahesis. + - Issue #19369: Optimized the usage of __length_hint__(). - Issue #18603: Ensure that PyOS_mystricmp and PyOS_mystrnicmp are in the
--- a/Modules/_dbmmodule.c Thu Oct 24 22:23:42 2013 +0200 +++ b/Modules/_dbmmodule.c Fri Oct 25 00:01:25 2013 +0300 @@ -221,9 +221,9 @@ if (key.dptr == NULL) return -1; } - if (!PyBytes_Check(arg)) { + else if (!PyBytes_Check(arg)) { PyErr_Format(PyExc_TypeError, - "dbm key must be string, not %.100s", + "dbm key must be bytes or string, not %.100s", arg->ob_type->tp_name); return -1; }
