Idea: emulating _locale (was Re: [Python-checkins] CVS: python/dist/src/Lib locale.py,1.4,1.5)
Hi, Marc-Andre Lemburg: [...]
Added a new locale name aliasing engine which also supports locale encodings, a feature which is used by the new default encoding support in site.py.
Index: locale.py [...] + ### C lib locale APIs + + from _locale import *
Wouldn't it be clever to provide some dummy stubs on those platforms, where the _locale module was not enabled? try: from _locale import * except: def setlocale(.... def localeconv(.... ... Especially the MacOS 1.5.2 release provided by Jack Jansen was compiled without '_locale'. And at least in Python 1.6a2 '_locale' is still disabled per default in 'Modules/Setup.in'. I didn't had a look into the current CVS though, so this may have changed. I think the name aliasing tables might be also useful on those systems lacking locale support in their C-library. Regards, Peter
Peter Funk wrote:
Hi,
Marc-Andre Lemburg: [...]
Added a new locale name aliasing engine which also supports locale encodings, a feature which is used by the new default encoding support in site.py.
Index: locale.py [...] + ### C lib locale APIs + + from _locale import *
Wouldn't it be clever to provide some dummy stubs on those platforms, where the _locale module was not enabled?
try: from _locale import * except: def setlocale(.... def localeconv(.... ...
Especially the MacOS 1.5.2 release provided by Jack Jansen was compiled without '_locale'. And at least in Python 1.6a2 '_locale' is still disabled per default in 'Modules/Setup.in'. I didn't had a look into the current CVS though, so this may have changed.
I think the name aliasing tables might be also useful on those systems lacking locale support in their C-library.
setlocale and localeconv are ANSI C and Python requires an ANSI C compiler, so there should be no problem (at least in theory). If there is a problem, adding the missing symbols would be no problem: the APIs could always report locale 'C' and its numeric settings. -- Marc-Andre Lemburg ______________________________________________________________________ Business: http://www.lemburg.com/ Python Pages: http://www.lemburg.com/python/
On Wed, Jun 07, 2000 at 12:25:08PM +0200, M.-A. Lemburg wrote:
... Peter Funk wrote: ...
+ ### C lib locale APIs + + from _locale import *
Wouldn't it be clever to provide some dummy stubs on those platforms, where the _locale module was not enabled?
try: from _locale import * except: def setlocale(.... def localeconv(.... ...
Especially the MacOS 1.5.2 release provided by Jack Jansen was compiled without '_locale'. And at least in Python 1.6a2 '_locale' is still disabled per default in 'Modules/Setup.in'. I didn't had a look into the current CVS though, so this may have changed.
I think the name aliasing tables might be also useful on those systems lacking locale support in their C-library.
setlocale and localeconv are ANSI C and Python requires an ANSI C compiler, so there should be no problem (at least in theory).
If there is a problem, adding the missing symbols would be no problem: the APIs could always report locale 'C' and its numeric settings.
An ANSI C compiler and the ANSI C library are very different. Just because Python requires an ANSI compiler (or close to it), does NOT mean that we can or should depend upon particular elements in the library. IMO, we should follow Peter's advice and have stubs for the platforms where _locale is not built. Cheers, -g -- Greg Stein, http://www.lyra.org/
Greg Stein wrote:
On Wed, Jun 07, 2000 at 12:25:08PM +0200, M.-A. Lemburg wrote:
... Peter Funk wrote: ...
+ ### C lib locale APIs + + from _locale import *
Wouldn't it be clever to provide some dummy stubs on those platforms, where the _locale module was not enabled?
try: from _locale import * except: def setlocale(.... def localeconv(.... ...
Especially the MacOS 1.5.2 release provided by Jack Jansen was compiled without '_locale'. And at least in Python 1.6a2 '_locale' is still disabled per default in 'Modules/Setup.in'. I didn't had a look into the current CVS though, so this may have changed.
I think the name aliasing tables might be also useful on those systems lacking locale support in their C-library.
setlocale and localeconv are ANSI C and Python requires an ANSI C compiler, so there should be no problem (at least in theory).
If there is a problem, adding the missing symbols would be no problem: the APIs could always report locale 'C' and its numeric settings.
An ANSI C compiler and the ANSI C library are very different. Just because Python requires an ANSI compiler (or close to it), does NOT mean that we can or should depend upon particular elements in the library.
Well, ok, it's POSIX.1 too, but...
IMO, we should follow Peter's advice and have stubs for the platforms where _locale is not built.
...ok, since it doesn't hurt, I'll add some dummies to locale.py which return the same thing as the 'C' locale. -- Marc-Andre Lemburg ______________________________________________________________________ Business: http://www.lemburg.com/ Python Pages: http://www.lemburg.com/python/
participants (3)
-
Greg Stein
-
M.-A. Lemburg
-
pf@artcom-gmbh.de