Skip to content

Commit

Permalink
Remove redundant check in dbm.open() (pythonGH-111844)
Browse files Browse the repository at this point in the history
PyUnicode_FSConverter() already checks for embedded null characters.
  • Loading branch information
serhiy-storchaka committed Nov 8, 2023
1 parent a3903c8 commit 804575b
Showing 1 changed file with 0 additions and 5 deletions.
5 changes: 0 additions & 5 deletions Modules/_dbmmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -557,11 +557,6 @@ dbmopen_impl(PyObject *module, PyObject *filename, const char *flags,
}

const char *name = PyBytes_AS_STRING(filenamebytes);
if (strlen(name) != (size_t)PyBytes_GET_SIZE(filenamebytes)) {
Py_DECREF(filenamebytes);
PyErr_SetString(PyExc_ValueError, "embedded null character");
return NULL;
}
PyObject *self = newdbmobject(state, name, iflags, mode);
Py_DECREF(filenamebytes);
return self;
Expand Down

0 comments on commit 804575b

Please sign in to comment.