Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

locale.getpreferredencoding fails on AIX #37882

Closed
nnorwitz mannequin opened this issue Jan 31, 2003 · 6 comments
Closed

locale.getpreferredencoding fails on AIX #37882

nnorwitz mannequin opened this issue Jan 31, 2003 · 6 comments
Assignees
Labels
extension-modules C modules in the Modules dir

Comments

@nnorwitz
Copy link
Mannequin

nnorwitz mannequin commented Jan 31, 2003

BPO 678259
Nosy @loewis

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = 'https://github.com/loewis'
closed_at = <Date 2003-03-30.15:57:59.000>
created_at = <Date 2003-01-31.18:01:33.000>
labels = ['extension-modules']
title = 'locale.getpreferredencoding fails on AIX'
updated_at = <Date 2003-03-30.15:57:59.000>
user = 'https://bugs.python.org/nnorwitz'

bugs.python.org fields:

activity = <Date 2003-03-30.15:57:59.000>
actor = 'loewis'
assignee = 'loewis'
closed = True
closed_date = None
closer = None
components = ['Extension Modules']
creation = <Date 2003-01-31.18:01:33.000>
creator = 'nnorwitz'
dependencies = []
files = []
hgrepos = []
issue_num = 678259
keywords = []
message_count = 6.0
messages = ['14336', '14337', '14338', '14339', '14340', '14341']
nosy_count = 2.0
nosy_names = ['loewis', 'nnorwitz']
pr_nums = []
priority = 'normal'
resolution = 'fixed'
stage = None
status = 'closed'
superseder = None
type = None
url = 'https://bugs.python.org/issue678259'
versions = []

@nnorwitz
Copy link
Mannequin Author

nnorwitz mannequin commented Jan 31, 2003

The problem is setting LC_CTYPE to an empty string:

>>> locale.setlocale(locale.LC_CTYPE, '')
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "/home/neal/python/dist/aix/Lib/locale.py", line 
381, in setlocale
    return _setlocale(category, locale)
locale.Error: locale setting not supported

Putting a try/except around the setlocale call in
getpreferredencoding allows the test to pass. I don't
know if this is correct.

@nnorwitz nnorwitz mannequin closed this as completed Jan 31, 2003
@nnorwitz nnorwitz mannequin assigned loewis Jan 31, 2003
@nnorwitz nnorwitz mannequin added the extension-modules C modules in the Modules dir label Jan 31, 2003
@nnorwitz nnorwitz mannequin closed this as completed Jan 31, 2003
@nnorwitz nnorwitz mannequin assigned loewis Jan 31, 2003
@nnorwitz nnorwitz mannequin added the extension-modules C modules in the Modules dir label Jan 31, 2003
@loewis
Copy link
Mannequin

loewis mannequin commented Mar 3, 2003

Logged In: YES
user_id=21627

What are the relevant environment settings? According to

http://nscp.upenn.edu/aix4.3html/libs/basetrf2/setlocale.htm

specifying "" as the second argument of setlocale is
supported, and means the same thing as it does on all other
systems: take locale settings from the user preferences.

@nnorwitz
Copy link
Mannequin Author

nnorwitz mannequin commented Mar 21, 2003

Logged In: YES
user_id=33168

The problem was that the setlocale in Lib/locale.py was
being used, not from Modules/_localemodule.c. In the python
version, it does not allow an empty string. Seems like this
should be changed, do you agree?

@loewis
Copy link
Mannequin

loewis mannequin commented Mar 21, 2003

Logged In: YES
user_id=21627

I don't understand. In the traceback, it says that
_setlocale is invoked, which is the function from
_localemodule. Since the locale argument is still an empty
string, it still seems to be a flaw in the AIX
implementation, or else the user has environment settings
which are not supported by AIX.

@nnorwitz
Copy link
Mannequin Author

nnorwitz mannequin commented Mar 21, 2003

Logged In: YES
user_id=33168

The traceback from the original report was not the same as
my last comment. The original problem seems to be gone. I
don't know what changed, but the localemodule builds and
tests correctly. However, before getting the module to
build, I was using the python version. The python version
of setlocale() doesn't support setting a value to an empty
string. Based on your first comment, it seems the python
version (line 72 of locale.py) should allow the value to be
either '' or 'C'.

@loewis
Copy link
Mannequin

loewis mannequin commented Mar 30, 2003

Logged In: YES
user_id=21627

I guess the empty string should be accepted (although this
is debatable: it won't honor the user preferences if the
user had some).

Fixed in locale.py 1.25.

@ezio-melotti ezio-melotti transferred this issue from another repository Apr 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
extension-modules C modules in the Modules dir
Projects
None yet
Development

No branches or pull requests

0 participants