[Python-bugs-list] [ python-Bugs-804543 ] invalid use of setlocale

SourceForge.net noreply at sourceforge.net
Thu Sep 11 09:46:23 EDT 2003


Bugs item #804543, was opened at 2003-09-11 17:46
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=804543&group_id=5470

Category: Python Interpreter Core
Group: Python 2.3
Status: Open
Resolution: None
Priority: 5
Submitted By: Stanislav Brabec (sbrabec)
Assigned to: Nobody/Anonymous (nobody)
Summary: invalid use of setlocale

Initial Comment:
char *oldloc=setlocale(LC_CTYPE,NULL);

setlocale(LC_CTYPE, "C");

setlocale(LC_CTYPE, oldloc);



can cause strange problems.



The glibc documentation clearly states, that you must

make your own copy of the string.



>From glibc docs:

setlocale()



RETURN VALUE

       ... This  string  may  be allocated  in static

storage. ...



It means, that subsequent call of setlocale can

overwrite this string. And since glibc-2.3 it does.



There is a fix.



----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=804543&group_id=5470



More information about the Python-bugs-list mailing list