diff options
Diffstat (limited to 'Modules/posixmodule.c')
-rw-r--r-- | Modules/posixmodule.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c index 194a2b5..0c6723f 100644 --- a/Modules/posixmodule.c +++ b/Modules/posixmodule.c @@ -1037,6 +1037,8 @@ path_converter(PyObject *o, void *p) Py_INCREF(bytes); } else if (is_buffer) { + /* XXX Replace PyObject_CheckBuffer with PyBytes_Check in other code + after removing suport of non-bytes buffer objects. */ if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1, "%s%s%s should be %s, not %.200s", path->function_name ? path->function_name : "", @@ -3588,8 +3590,8 @@ _posix_listdir(path_t *path, PyObject *list) const char *name; if (path->narrow) { name = path->narrow; - /* only return bytes if they specified a bytes object */ - return_str = !(PyBytes_Check(path->object)); + /* only return bytes if they specified a bytes-like object */ + return_str = !PyObject_CheckBuffer(path->object); } else { name = "."; @@ -11842,7 +11844,7 @@ DirEntry_from_posix_info(path_t *path, const char *name, Py_ssize_t name_len, goto error; } - if (!path->narrow || !PyBytes_Check(path->object)) { + if (!path->narrow || !PyObject_CheckBuffer(path->object)) { entry->name = PyUnicode_DecodeFSDefaultAndSize(name, name_len); if (joined_path) entry->path = PyUnicode_DecodeFSDefault(joined_path); |