[issue13074] Improve documentation of locale encoding functions
New submission from Geoffrey Bache
Changes by Ezio Melotti
Changes by Éric Araujo
Mark Lawrence added the comment:
Hopefully the patch speaks for itself.
----------
keywords: +patch
nosy: +BreamoreBoy
versions: +Python 3.4, Python 3.5 -Python 2.7, Python 3.2, Python 3.3
Added file: http://bugs.python.org/file35782/Issue13074.diff
_______________________________________
Python tracker
Marc-Andre Lemburg added the comment:
The two functions serve a different purpose.
getdefautltlocale() specifically avoids calling setlocale() and is thread-safe on Unix. It's purpose is to return the default locale string, not only the encoding.
getpreferredencoding() only returns the encoding, but on Unix has to call setlocale() to return correct results and thus is not thread-safe.
Martin's comment doesn't address this difference and I don't agree with it.
Regarding the different results, I guess this could be solved by having both function pass the data obtained from the system through _parse_localname() before returning it, but that would have to be a handled in a new issue report.
----------
_______________________________________
Python tracker
Change by Mark Lawrence
participants (5)
-
Ezio Melotti
-
Geoffrey Bache
-
Marc-Andre Lemburg
-
Mark Lawrence
-
Éric Araujo