Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
22628c4d
Kaydet (Commit)
22628c4d
authored
Tem 22, 2008
tarafından
Antoine Pitrou
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
#3231: re.compile fails with some bytes patterns
üst
943f3391
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
27 deletions
+26
-27
sre_parse.py
Lib/sre_parse.py
+1
-1
re_tests.py
Lib/test/re_tests.py
+2
-6
test_re.py
Lib/test/test_re.py
+23
-20
No files found.
Lib/sre_parse.py
Dosyayı görüntüle @
22628c4d
...
...
@@ -200,7 +200,7 @@ class Tokenizer:
except
IndexError
:
raise
error
(
"bogus escape (end of line)"
)
if
isinstance
(
self
.
string
,
bytes
):
c
har
=
chr
(
c
)
c
=
chr
(
c
)
char
=
char
+
c
self
.
index
=
self
.
index
+
len
(
char
)
self
.
next
=
char
...
...
Lib/test/re_tests.py
Dosyayı görüntüle @
22628c4d
...
...
@@ -661,12 +661,8 @@ xyzabc
(
'^([ab]*?)(?<!(a))c'
,
'abc'
,
SUCCEED
,
'g1+"-"+g2'
,
'ab-None'
),
]
try
:
u
=
eval
(
"u'
\N{LATIN CAPITAL LETTER A WITH DIAERESIS}
'"
)
except
SyntaxError
:
pass
else
:
tests
.
extend
([
u
=
'
\N{LATIN CAPITAL LETTER A WITH DIAERESIS}
'
tests
.
extend
([
# bug 410271: \b broken under locales
(
r'\b.\b'
,
'a'
,
SUCCEED
,
'found'
,
'a'
),
(
r'(?u)\b.\b'
,
u
,
SUCCEED
,
'found'
,
u
),
...
...
Lib/test/test_re.py
Dosyayı görüntüle @
22628c4d
...
...
@@ -732,23 +732,25 @@ def run_re_tests():
else
:
print
(
'=== Failed incorrectly'
,
t
)
# Try the match
on a unicode string, and check that it
# still succeeds.
# Try the match
with both pattern and string converted to
#
bytes, and check that it
still succeeds.
try
:
result
=
obj
.
search
(
str
(
s
,
"latin-1"
))
if
result
is
None
:
print
(
'=== Fails on unicode match'
,
t
)
except
NameError
:
continue
# 1.5.2
except
TypeError
:
continue
# unicode test case
# Try the match on a unicode pattern, and check that it
# still succeeds.
obj
=
re
.
compile
(
str
(
pattern
,
"latin-1"
))
result
=
obj
.
search
(
s
)
if
result
is
None
:
print
(
'=== Fails on unicode pattern match'
,
t
)
bpat
=
bytes
(
pattern
,
"ascii"
)
bs
=
bytes
(
s
,
"ascii"
)
except
UnicodeEncodeError
:
# skip non-ascii tests
pass
else
:
try
:
bpat
=
re
.
compile
(
bpat
)
except
Exception
:
print
(
'=== Fails on bytes pattern compile'
,
t
)
if
verbose
:
traceback
.
print_exc
(
file
=
sys
.
stdout
)
else
:
bytes_result
=
bpat
.
search
(
bs
)
if
bytes_result
is
None
:
print
(
'=== Fails on bytes pattern match'
,
t
)
# Try the match with the search area limited to the extent
# of the match and see if it still succeeds. \B will
...
...
@@ -771,10 +773,11 @@ def run_re_tests():
# Try the match with LOCALE enabled, and check that it
# still succeeds.
obj
=
re
.
compile
(
pattern
,
re
.
LOCALE
)
result
=
obj
.
search
(
s
)
if
result
is
None
:
print
(
'=== Fails on locale-sensitive match'
,
t
)
if
'(?u)'
not
in
pattern
:
obj
=
re
.
compile
(
pattern
,
re
.
LOCALE
)
result
=
obj
.
search
(
s
)
if
result
is
None
:
print
(
'=== Fails on locale-sensitive match'
,
t
)
# Try the match with UNICODE locale enabled, and check
# that it still succeeds.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment