[pywin32-bugs] [ pywin32-Bugs-828151 ] various external libraries change the C locale
OLD project page for the Python extensions for Windows
Brought to you by:
mhammond
From: SourceForge.net <no...@so...> - 2004-04-22 09:19:49
|
Bugs item #828151, was opened at 2003-10-22 21:17 Message generated for change (Comment added) made by mhammond You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=551954&aid=828151&group_id=78018 Category: win32 Group: None >Status: Closed >Resolution: Wont Fix Priority: 5 Submitted By: Johan Fredrik Öhman (johanfo) Assigned to: Nobody/Anonymous (nobody) >Summary: various external libraries change the C locale Initial Comment: This bug caused me some major headache. On some machines (not all) the win32pdh.AddCounter(base, path) causes some trouble with the Locale so that the decimal is changed from "." to "," This has to be a bug? BTW What is the easiste way to check what version number of your win32 extentions I am running? print "wgetCpu1 (0.3):", float(0.3) counter = win32pdh.AddCounter(base, path) print "wgetCpu2 (0.3):", float(0.3) ============================== wgetCpu1 (0.3): 0.3 wgetCpu2 (0.3): 0,3 ---------------------------------------------------------------------- >Comment By: Mark Hammond (mhammond) Date: 2004-04-22 19:19 Message: Logged In: YES user_id=14198 This isn't really a bug in these extensions. There really are 2 potential bugs here: 1) that the pdh library changes the C locale. This is pretty nasty, and the SpamBayes project found MAPI does the same thing. Our solution there was to call 'locale.setlocale(locale.LC_NUMERIC, "C")' after any MAPI function that may change the locale. 2) That Python screws up when the locale is changed underneath is. Specifically, future imports may well fail, along with other obscure stuff. There is a bug in the main Python bug database on this. I'm not convinced the pywin32 extensions should go to lengths to work around these problems (eg, resetting the locale to solve this bug may end up creating others, even possibly in the PDH libraries themself!) ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=551954&aid=828151&group_id=78018 |