Mercurial > public > mercurial-scm > hg
comparison mercurial/cffi/osutil.py @ 49601:8009a89bc18b
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.
author | Matt Harbison <matt_harbison@yahoo.com> |
---|---|
date | Tue, 08 Nov 2022 18:05:19 -0500 |
parents | 642e31cb55f0 |
children | ecc3a893979d |
comparison
equal
deleted
inserted
replaced
49600:b6fc602e074a | 49601:8009a89bc18b |
---|---|
55 lgt = cur.length | 55 lgt = cur.length |
56 assert lgt == ffi.cast(b'uint32_t*', cur)[0] | 56 assert lgt == ffi.cast(b'uint32_t*', cur)[0] |
57 ofs = cur.name_info.attr_dataoffset | 57 ofs = cur.name_info.attr_dataoffset |
58 str_lgt = cur.name_info.attr_length | 58 str_lgt = cur.name_info.attr_length |
59 base_ofs = ffi.offsetof(b'val_attrs_t', b'name_info') | 59 base_ofs = ffi.offsetof(b'val_attrs_t', b'name_info') |
60 name = str( | 60 name = bytes( |
61 ffi.buffer( | 61 ffi.buffer( |
62 ffi.cast(b"char*", cur) + base_ofs + ofs, str_lgt - 1 | 62 ffi.cast(b"char*", cur) + base_ofs + ofs, str_lgt - 1 |
63 ) | 63 ) |
64 ) | 64 ) |
65 tp = attrkinds[cur.obj_type] | 65 tp = attrkinds[cur.obj_type] |