Message 111844 - Python tracker
Antoine asked me why not using a buffer of MAX_PATH+1 (instead of a dynamic buffer size). I don't know, I just copied/pasted the code from Python2. Extract of getcwd() manpage: Note that on some systems, PATH_MAX may not be a compile-time constant; furthermore, its value may depend on the file system, see pathconf(3). It's maybe to support strange OS like Hurd :-) (Hurd has no hardcoded limits). Most of the time, the first realloc() should be enough.