diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2013-10-24 23:59:28 +0300 |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2013-10-24 23:59:28 +0300 |
commit | 5564b9e3d1febb6fbbde466cc7727240b4ddd412 (patch) | |
tree | 0af5e3fd5ecdfbf73600bcc8f70a704ddb0aa9db | |
parent | 212b9b196c88787a5736233fcb254f4f30d15e64 (diff) | |
download | cpython-5564b9e3d1febb6fbbde466cc7727240b4ddd412.tar.gz |
Issue #19287: Fixed the "in" operator of dbm.ndbm databases for string
argument. Original patch by Arfrever Frehtes Taifersar Arahesis.
-rwxr-xr-x | Lib/test/test_dbm_ndbm.py | 1 | ||||
-rw-r--r-- | Misc/NEWS | 3 | ||||
-rw-r--r-- | Modules/_dbmmodule.c | 4 |
3 files changed, 6 insertions, 2 deletions
diff --git a/Lib/test/test_dbm_ndbm.py b/Lib/test/test_dbm_ndbm.py index f9d3befde9..b57e1f0653 100755 --- a/Lib/test/test_dbm_ndbm.py +++ b/Lib/test/test_dbm_ndbm.py @@ -24,6 +24,7 @@ class DbmTestCase(unittest.TestCase): 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() @@ -81,6 +81,9 @@ Core and Builtins Library ------- +- Issue #19287: Fixed the "in" operator of dbm.ndbm databases for string + argument. Original patch by Arfrever Frehtes Taifersar Arahesis. + - Issue #19327: Fixed the working of regular expressions with too big charset. - Issue #19350: Increasing the test coverage of macurl2path. Patch by Colin diff --git a/Modules/_dbmmodule.c b/Modules/_dbmmodule.c index 327b8730c2..83c051c505 100644 --- a/Modules/_dbmmodule.c +++ b/Modules/_dbmmodule.c @@ -225,9 +225,9 @@ dbm_contains(PyObject *self, PyObject *arg) 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; } |