bpo-1514420: Do not attempt to open files with names in <>s when form… by iritkatriel · Pull Request #28143 · python/cpython (original) (raw)

Usually, reading the first character of a string is unsafe if the string length is not checked, but PyUnicode_READ_CHAR(filename, 0) is safe for an empty string because CPython strings always with a null character, even for the empty string ;-)