From 9da33ab193803922141f654f6d3cccdaed6b4866 Mon Sep 17 00:00:00 2001 From: Serhiy Storchaka Date: Thu, 24 Oct 2013 23:59:28 +0300 Subject: Issue #19287: Fixed the "in" operator of dbm.ndbm databases for string argument. Original patch by Arfrever Frehtes Taifersar Arahesis. --- Modules/_dbmmodule.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Modules/_dbmmodule.c') 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; } -- cgit v1.2.1