[3.7] bpo-33383: Fix crash in get() of the dbm.ndbm database object. … · python/cpython@ee95feb (original) (raw)

Original file line number Diff line number Diff line change
@@ -39,7 +39,7 @@ _dbm_dbm_keys(dbmobject *self, PyObject *Py_UNUSED(ignored))
39 39 }
40 40
41 41 PyDoc_STRVAR(_dbm_dbm_get__doc__,
42 -"get($self, key, default=b\'\', /)\n"
42 +"get($self, key, default=None, /)\n"
43 43 "--\n"
44 44 "\n"
45 45 "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)
57 57 PyObject *return_value = NULL;
58 58 const char *key;
59 59 Py_ssize_clean_t key_length;
60 -PyObject *default_value = NULL;
60 +PyObject *default_value = Py_None;
61 61
62 62 if (!_PyArg_ParseStack(args, nargs, "s#|O:get",
63 63 &key, &key_length, &default_value)) {
@@ -141,4 +141,4 @@ dbmopen(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
141 141 exit:
142 142 return return_value;
143 143 }
144 -/*[clinic end generated code: output=5c858b4080a011a4 input=a9049054013a1b77]*/
144 +/*[clinic end generated code: output=1cba297bc8d7c2c2 input=a9049054013a1b77]*/