# HG changeset patch # User Matt Harbison # Date 2022-11-08 23:05:19 # Node ID 8009a89bc18b4ce822e7a3f26c77c49730105363 # Parent b6fc602e074a813e8e27cf5784241b7ab39f1f32 cffi: fix a bytes vs str issue on macOS when listing directories This code hasn't been touched in recent years, and the other implementation return bytes for the filename, so I assume this is a holdover from the py2 days. I was unable to test it on mac though, because the `_osutil` import failed. diff --git a/mercurial/cffi/osutil.py b/mercurial/cffi/osutil.py --- a/mercurial/cffi/osutil.py +++ b/mercurial/cffi/osutil.py @@ -57,7 +57,7 @@ if pycompat.isdarwin: ofs = cur.name_info.attr_dataoffset str_lgt = cur.name_info.attr_length base_ofs = ffi.offsetof(b'val_attrs_t', b'name_info') - name = str( + name = bytes( ffi.buffer( ffi.cast(b"char*", cur) + base_ofs + ofs, str_lgt - 1 )