Project

General

Profile

Actions

Bug #4411

closed

Python 2.6 string issue

Added by Alexander Pyhalov over 7 years ago. Updated over 7 years ago.

Status:
Closed
Priority:
Normal
Category:
OI-Userland
Target version:
-
Start date:
2013-12-21
Due date:
2014-01-24
% Done:

100%

Estimated time:
Difficulty:
Medium
Tags:
needs-triage

Description

On latest /hipster with Python 2.6 I receive:

Python 2.6.9 (unknown, Nov 12 2013, 13:54:48) 
[GCC 4.7.3] on sunos5
Type "help", "copyright", "credits" or "license" for more information.
>>> import string
>>> string.lowercase
'abcdefghijklmnopqrstuvwxyz\\xaa\\xb5\\xba\\xdf\\xe0\\xe1\\xe2\\xe3\\xe4\\xe5\\xe6\\xe7\\xe8\\xe9\\xea\\xeb\\xec\\xed\\xee\\xef\\xf0\\xf1\\xf2\\xf3\\xf4\\xf5\\xf6\\xf8\\xf9\\xfa\\xfb\\xfc\\xfd\\xfe\\xff'
>>> string.uppercase
'ABCDEFGHIJKLMNOPQRSTUVWXYZ\\xc0\\xc1\\xc2\\xc3\\xc4\\xc5\\xc6\\xc7\\xc8\\xc9\\xca\\xcb\\xcc\\xcd\\xce\\xcf\\xd0\\xd1\\xd2\\xd3\\xd4\\xd5\\xd6\\xd8\\xd9\\xda\\xdb\\xdc\\xdd\\xde'
>>>

Python 2.7 doesn't have this issue.

python2.7
Python 2.7.3 (default, Dec  7 2013, 10:54:04) 
[GCC 4.7.3] on sunos5
Type "help", "copyright", "credits" or "license" for more information.
>>> import string
>>> string.lowercase
'abcdefghijklmnopqrstuvwxyz'
>>> string.uppercase
'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
>>>

Actions #1

Updated by Alexander Pyhalov over 7 years ago

Something is wrong with strop.so. If I recompile it by hand, it works as expected.

Actions #2

Updated by Alexander Pyhalov over 7 years ago

-D_XOPEN_SOURCE=600 during module compilation causes this

Actions #3

Updated by Alexander Pyhalov over 7 years ago

  • Status changed from New to In Progress
  • % Done changed from 0 to 100

The real cause was in invalid manipulation with non-ascii symbols in this module. Setting _XOPEN_SOURCE=600 only revealed this. Code called islower/isupper and freinds on symbols with codes > 127. So, it received positives which it didn't expect.
Fixed in https://github.com/OpenIndiana/oi-userland/commit/bf6508bf15502c8de01e9f4132ea9b512ace1b74 .

Actions #4

Updated by Alexander Pyhalov over 7 years ago

Actions #5

Updated by Garrett D'Amore over 7 years ago

Note that isupper(), and islower() should return false for non-ASCII characters in the C locale. In other locales YMMV. If Python wants portable handling of this in a non-locale sensitive way, then it should restrict itself to ASCII. That may or may not be the desired behavior.

Actions #6

Updated by Alexander Pyhalov over 7 years ago

They consider this to be illumos libc bug. After reading http://pubs.opengroup.org/onlinepubs/7999959899/functions/islower.html I'm inclined to agree with them (see bug #4412).

Actions #7

Updated by Ken Mays over 7 years ago

  • Due date set to 2014-01-24
  • Category set to 10
  • Status changed from In Progress to Closed
Actions

Also available in: Atom PDF