在SuSE 9.2中,sre被打破了 [英] sre is broken in SuSE 9.2

查看:54
本文介绍了在SuSE 9.2中,sre被打破了的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在所有平台上\ w匹配所有unicode字母与标志一起使用

re.UNICODE,但这对SuSE 9.2不起作用:


Python 2.3.4(#1,2004年12月17日,19:56:48)

[GCC 3.3.4(前3.3.5 20040809)] on linux2

键入help,copyright,credit等。或许可证或更多信息。

import re
re.compile(ur''\ + +',re.U ).match(u''\xe4'')


BTW,正确地将这个字符识别为小写字母:import unicodedata
unicodedata.category(u''\\ \\ xe4'')



''Ll''


我查看了所有SuSE补丁应用,但没有发现任何相关。

破坏行为的原因是什么?配置选项不正确?


-

Denis S. Otkidach
http://www.python.ru/ [ru]

解决方案

Denis S. Otkidach写道:

在所有的platfroms \w上匹配所有unicode字母与flag
re.UNICODE一起使用,但这对SuSE 9.2不起作用:

Python 2.3.4(#1,2004年12月17日,19:56:48)
在Linux2上的[GCC 3.3.4(前3.3.5 20040809)]
类型帮助 ,版权,信用,或许可证或更多
信息。

import re
re.compile(ur''\ + +'' ,re.U)。匹配(u''\xe4'')

BTW,正确地将这个字符识别为小写字母:import unicodedata
unicodedata.category(u'' \\ xe4'')


''Ll''

我查看了所有应用的SuSE补丁,但没有找到任何内容



相关。破坏行为的原因是什么?配置选项不正确?




如果我通过re.L

选项,我可以在RedHat的python 2.2.3上获得相同的结果,看起来这个选项隐含在Suse中。


Serge


2005年2月10日03: 59:51 -0800

" Serge Orlov" <硒********* @ gmail.com>写道:

在所有platfroms \w匹配所有unicode字母时使用标志
re.UNICODE,但这不是在SuSE 9.2上工作:
[...]

如果我通过re.L
选项,我可以在RedHat的python 2.2.3上获得相同的结果,它看起来这个选项在Suse中隐式设置。




看起来你是对的:

import re
re.compile(ur''\ + +',re.U).match(u''\xe4'')
来自locale import *
setlocale(LC_ALL,''de_DE'' )
''de_DE''re.compile(ur''\ + +',re.U).match(u''\xe4'')



< _sre.SRE_Match对象位于0x40375560>


但我看到他们的补丁中没有与隐式re.L选项相关的内容和

来源本身与其他平台相同。我希望

找到问题的根源。


-

Denis S. Otkidach
http://www.python.ru/ [ru]


Denis S. Otkidach写道:

在所有platfroms \w上匹配所有unicode字母与flag
re.UNICODE一起使用,但是这不适用于SuSE 9.2:




我认为SuSE 9.2上的Python使用UCS4作为unicode字符串(

RedHat) ,检查sys.maxunicode。


这不是解释,但也许是一个提示在哪里看。


Daniel


On all platfroms \w matches all unicode letters when used with flag
re.UNICODE, but this doesn''t work on SuSE 9.2:

Python 2.3.4 (#1, Dec 17 2004, 19:56:48)
[GCC 3.3.4 (pre 3.3.5 20040809)] on linux2
Type "help", "copyright", "credits" or "license" for more information.

import re
re.compile(ur''\w+'', re.U).match(u''\xe4'')

BTW, is correctly recognize this character as lowercase letter: import unicodedata
unicodedata.category(u''\xe4'')


''Ll''

I''ve looked through all SuSE patches applied, but found nothing related.
What is the reason for broken behavior? Incorrect configure options?

--
Denis S. Otkidach
http://www.python.ru/ [ru]

解决方案

Denis S. Otkidach wrote:

On all platfroms \w matches all unicode letters when used with flag
re.UNICODE, but this doesn''t work on SuSE 9.2:

Python 2.3.4 (#1, Dec 17 2004, 19:56:48)
[GCC 3.3.4 (pre 3.3.5 20040809)] on linux2
Type "help", "copyright", "credits" or "license" for more information.

import re
re.compile(ur''\w+'', re.U).match(u''\xe4'')

BTW, is correctly recognize this character as lowercase letter: import unicodedata
unicodedata.category(u''\xe4'')


''Ll''

I''ve looked through all SuSE patches applied, but found nothing


related. What is the reason for broken behavior? Incorrect configure options?



I can get the same results on RedHat''s python 2.2.3 if I pass re.L
option, it looks like this option is implicitly set in Suse.

Serge


On 10 Feb 2005 03:59:51 -0800
"Serge Orlov" <Se*********@gmail.com> wrote:

On all platfroms \w matches all unicode letters when used with flag
re.UNICODE, but this doesn''t work on SuSE 9.2: [...]

I can get the same results on RedHat''s python 2.2.3 if I pass re.L
option, it looks like this option is implicitly set in Suse.



Looks like you are right:

import re
re.compile(ur''\w+'', re.U).match(u''\xe4'')
from locale import *
setlocale(LC_ALL, ''de_DE'') ''de_DE'' re.compile(ur''\w+'', re.U).match(u''\xe4'')


<_sre.SRE_Match object at 0x40375560>

But I see nothing related to implicit re.L option in their patches and
the sources themselves are the same as on other platforms. I''d prefer
to find the source of problem.

--
Denis S. Otkidach
http://www.python.ru/ [ru]


Denis S. Otkidach wrote:

On all platfroms \w matches all unicode letters when used with flag
re.UNICODE, but this doesn''t work on SuSE 9.2:



I think Python on SuSE 9.2 uses UCS4 for unicode strings (as does
RedHat), check sys.maxunicode.

This is not an explanation, but perhaps a hint where to look.

Daniel


这篇关于在SuSE 9.2中,sre被打破了的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆