summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2018-04-29 09:38:06 (GMT)
committerGitHub <noreply@github.com>2018-04-29 09:38:06 (GMT)
commit2e38cc39330bd7f3003652869b644110a97a78d8 (patch)
tree5f1a63d9c23d486cdbf8a588e442d3c307917b07 /Modules
parent577948329976985ea9bef23d9a6c3dd7108211bf (diff)
downloadcpython-2e38cc39330bd7f3003652869b644110a97a78d8.zip
cpython-2e38cc39330bd7f3003652869b644110a97a78d8.tar.gz
cpython-2e38cc39330bd7f3003652869b644110a97a78d8.tar.bz2
bpo-33383: Fix crash in get() of the dbm.ndbm database object. (#6630)
Diffstat (limited to 'Modules')
-rw-r--r--Modules/_dbmmodule.c4
-rw-r--r--Modules/clinic/_dbmmodule.c.h6
2 files changed, 5 insertions, 5 deletions
diff --git a/Modules/_dbmmodule.c b/Modules/_dbmmodule.c
index 8afd92c..65761d8 100644
--- a/Modules/_dbmmodule.c
+++ b/Modules/_dbmmodule.c
@@ -274,7 +274,7 @@ static PySequenceMethods dbm_as_sequence = {
_dbm.dbm.get
key: str(accept={str, robuffer}, zeroes=True)
- default: object(c_default="NULL") = b''
+ default: object = None
/
Return the value for key if present, otherwise default.
@@ -283,7 +283,7 @@ Return the value for key if present, otherwise default.
static PyObject *
_dbm_dbm_get_impl(dbmobject *self, const char *key,
Py_ssize_clean_t key_length, PyObject *default_value)
-/*[clinic end generated code: output=b44f95eba8203d93 input=a3a279957f85eb6d]*/
+/*[clinic end generated code: output=b44f95eba8203d93 input=b788eba0ffad2e91]*/
/*[clinic end generated code: output=4f5c0e523eaf1251 input=9402c0af8582dc69]*/
{
datum dbm_key, val;
diff --git a/Modules/clinic/_dbmmodule.c.h b/Modules/clinic/_dbmmodule.c.h
index 0f831c9..574cc5e 100644
--- a/Modules/clinic/_dbmmodule.c.h
+++ b/Modules/clinic/_dbmmodule.c.h
@@ -39,7 +39,7 @@ _dbm_dbm_keys(dbmobject *self, PyObject *Py_UNUSED(ignored))
}
PyDoc_STRVAR(_dbm_dbm_get__doc__,
-"get($self, key, default=b\'\', /)\n"
+"get($self, key, default=None, /)\n"
"--\n"
"\n"
"Return the value for key if present, otherwise default.");
@@ -57,7 +57,7 @@ _dbm_dbm_get(dbmobject *self, PyObject *const *args, Py_ssize_t nargs)
PyObject *return_value = NULL;
const char *key;
Py_ssize_clean_t key_length;
- PyObject *default_value = NULL;
+ PyObject *default_value = Py_None;
if (!_PyArg_ParseStack(args, nargs, "s#|O:get",
&key, &key_length, &default_value)) {
@@ -141,4 +141,4 @@ dbmopen(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
exit:
return return_value;
}
-/*[clinic end generated code: output=5c858b4080a011a4 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=1cba297bc8d7c2c2 input=a9049054013a1b77]*/