PyUnicode_EncodeFSDefault() and os.fsencode() should decompose the filename (NFD) before encoding it to utf-8.
PyUnicode_DecodeFSDefault(AndSize)() and os.fsdecode() should precompose the filename (NFC) after decoding it from utf-8.
Qt library does this on Mac: see locale_encode()/locale_decode() (filename encoder/decoder) functions in src/corelib/io/qfile.cpp.
It should fix some issues of test_pep277 on Mac OS X (see #8423).
(I used the nosy list from issues #4388 and #8423).
Q: I'm writing a file system (VFS) plug-in for Mac OS X. How do I handle text encodings correctly?