[Python-bugs-list] [ python-Feature Requests-419153 ] Issue warning when LC_NUMERIC is not "C"

SourceForge.net noreply@sourceforge.net
Mon, 12 May 2003 16:34:15 -0700


Feature Requests item #419153, was opened at 2001-04-26 08:08
Message generated for change (Comment added) made by bcannon
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=355470&aid=419153&group_id=5470

Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Jürgen Hermann (jhermann)
Assigned to: Nobody/Anonymous (nobody)
Summary: Issue warning when LC_NUMERIC is not "C"

Initial Comment:
In Py_Initialize(), check that the locale setting for 
LC_NUMERIC is "C" (and issue some sort of warning if 
not, e.g. assert() that setting), as required by 
section 6.22.2 of the Python 2.0 library reference.

I'd rather have my embedded interpreter exit() than 
having VERY strange or even unnoticed problems with 
floating point constants.

The problem I had and that triggered this request was 
this:

Traceback (most recent call last):
  File "cgi-bin/test.py", line 7, in ?
    import random
  File "./random.py", line 93, in ?
    verify('NV_MAGICCONST', 1.71552776992141)
  File "./random.py", line 78, in verify
    raise ValueError, \
ValueError: computed value for NV_MAGICCONST deviates 
too much (computed 2.82843, expected 1)


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

>Comment By: Brett Cannon (bcannon)
Date: 2003-05-12 16:34

Message:
Logged In: YES 
user_id=357491

As of Python 2.3b1, the section is now 6.26.2 (locale: For extension writers 
and programs that embed Python) and it actually says "that the LC_NUMERIC 
locale should always be "C" ".  There is no explicit requirement.

Couldn't you do your own check for LC_NUMERIC's value in your own code 
and raise SystemExit if it isn't set to "C"?

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

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