This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author henry.precheur
Recipients amaury.forgeotdarc, henry.precheur, pitrou
Date 2008-08-28.02:36:17
SpamBayes Score 2.1160851e-13
Marked as misclassified No
Message-id <[email protected]>
In-reply-to
Content
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.
History
Date User Action Args
2008-08-28 02:36:22henry.precheursetrecipients: + henry.precheur, amaury.forgeotdarc, pitrou
2008-08-28 02:36:21henry.precheursetmessageid: <[email protected]>
2008-08-28 02:36:19henry.precheurlinkissue3696 messages
2008-08-28 02:36:18henry.precheurcreate