STINNER Victor added the comment: Steve Dower added the comment: > It's not clear to me that Py_UNICODE is guaranteed to be wchar_t for all > time, that's all. If it is, go ahead.
Right now, it's the case and path_converter() leaks memory, so I proposed a simple and obvious fix :-) On Windows, it makes sense to continue to use the UTF-16 encoded string cached in Unicode objects, because this conversion is common, and it's convenient to not have to release the memory explicitly. The side effect is that we may waste memory in some cases. > Otherwise the path_t object has the ability to clean up after itself, so > perhaps it should be used here? Maybe, but I'm not interested to write a more complex patch for Windows :-) Try to just call PyMem_Free(path->wide) (do nothing it's NULL). The advantage of the old code (and my patch) is to only convert a filename once to UTF-16 and then use the cached result. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue28200> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com