Henry Precheur <[EMAIL PROTECTED]> added the comment: I removed my previous patch. It was not dealing with all broken mbstowcs cases and yours is much better.
Some comments on the other patch: I don't think the macro HAVE_BROKEN_MBSTOWCS alone is a perfect idea. It won't fix the problem in the long run: Most contributors won't be aware of this problem and might be using mbstowcs without putting the #ifdef's. Then the problem will come back and bite us again. I would rather do something like this: #ifdef HAVE_BROKEN_MBSTOWCS size_t __non_broken_mbstowcs(wchar_t* pwcs, const char* s, size_t n) { if (pwcs == NULL) return strlen(s); else return mbstowcs(pwcs, s, n); } #define mbstowcs __non_broken_mbstowcs #endif It would fix the problem everywhere, and people won't have to worry about putting #ifdef everywhere in the future. I attached a test program, run it on cygwin to make sure this approach works on your side. Another small remark; #ifdef is better then #ifndef when doing #ifdef ... ... #else ... #endif Simply because it easier to get "Be positive" than "Don't be negative". The negative form is generally harder to get whether your are programming, writing or talking. Use the positive form and you will have more impact and will make things clearer. Added file: http://bugs.python.org/file11279/test.c _______________________________________ Python tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue3696> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com