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.

classification
Title: expose lowlevel setlocale
Type: Stage:
Components: Interpreter Core Versions:
process
Status: closed Resolution: out of date
Dependencies: Superseder:
Assigned To: mhammond Nosy List: loewis, mhammond
Priority: normal Keywords: patch

Created on 2003-07-24 10:17 by mhammond, last changed 2022-04-10 16:10 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
locale.patch mhammond, 2004-08-24 22:35 New patch adding the method to locale.
Messages (5)
msg44351 - (view) Author: Mark Hammond (mhammond) * (Python committer) Date: 2003-07-24 10:17
I propose (for post 2.3) we expose a lowlevel
setlocale() for diagnostic purposes.  Specifically, I
propose that release builds support only querying the
current locale, but Py_DEBUG builds be capable of
bypassing Python completely.

This is somewhat complementary to [ 774665 ] making
Python LC_NUMERIC agnostic

This would be extremely good for Windows - hence my
patch adds such a method to the "msvcrt" module. 
However, I believe it worthy of consideration for
locale itself, seeing as it is impossible to have
Python-related side effects in release builds.  For
people running debug builds (or capable of switching to
them) it provides invaluable help.

Assigning to Tim to pronounce on.  Either reject it,
accept for msvcrt (and I will check it in post 1.3) or
accept in principle for _locale, then assign back.
msg44352 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2003-07-24 18:24
Logged In: YES 
user_id=21627

I accept that in principle for _locale, unconditionally,
under a name different from "setlocale".
msg44353 - (view) Author: Mark Hammond (mhammond) * (Python committer) Date: 2004-08-24 22:34
Logged In: YES 
user_id=14198

Attached is a patch which names the new method
"locale._setlocale()"

An alternative and possibly better name would be
"getcrtlocale()" - any thoughts?
msg44354 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2004-08-25 05:51
Logged In: YES 
user_id=21627

AFAICT, the only change left between this function and
_locale.setlocale is that the latter also adjusts
string.upper etc. I wonder whether we should take this code
out of _localemodule.c, and move it into locale.py. In that
case, you could just use _locale.setlocale, right? What do
you think?
msg44355 - (view) Author: Mark Hammond (mhammond) * (Python committer) Date: 2004-08-25 22:59
Logged In: YES 
user_id=14198

Thanks Martin - so similar in fact that it is no longer
needed!  You revision 2.46 "Patch #774665: Make Python
LC_NUMERIC agnostic." provides the same basic functionality.
History
Date User Action Args
2022-04-10 16:10:12adminsetgithub: 38927
2003-07-24 10:17:37mhammondcreate