Issue #13848: open() and the FileIO constructor now check for NUL characters in the file name.
Patch by Hynek Schlawack.
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
index 20528b9..f51d4d0 100644
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -1867,6 +1867,19 @@
int
+_PyUnicode_HasNULChars(PyObject* s)
+{
+ static PyObject *nul = NULL;
+
+ if (nul == NULL)
+ nul = PyUnicode_FromStringAndSize("\0", 1);
+ if (nul == NULL)
+ return -1;
+ return PyUnicode_Contains(s, nul);
+}
+
+
+int
PyUnicode_FSConverter(PyObject* arg, void* addr)
{
PyObject *output = NULL;