8 Sep
2021
8 Sep
'21
10:46 a.m.
08.09.21 08:19, David Mertz, Ph.D. пише:
I attempted to do this today, as my first actual contribution to CPython itself. I think the prior attempt went down a wrong path, which is why neither PR could actually pass tests.
I've been looking at `posixmodule.c` for comparison, specifically.
The code in posixmodule.c is a bad example, because it is too general and supports many options. It gives the patch as char* and wchat_t* (on Windows), supports file descriptors and None, and format error messages for functions supporting multiple types. But if you only need a path as char*, you can just use PyUnicode_FSConverter(). There is an existing PR for this issue. It looks correct in general, but I left some comments.