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
80016c95
Kaydet (Commit)
80016c95
authored
Ara 19, 2007
tarafından
Raymond Hettinger
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fix issue 1661: Flags argument silently ignored in re functions with compiled regexes.
üst
0f5e7bf3
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
0 deletions
+10
-0
re.py
Lib/re.py
+2
-0
test_re.py
Lib/test/test_re.py
+8
-0
No files found.
Lib/re.py
Dosyayı görüntüle @
80016c95
...
@@ -224,6 +224,8 @@ def _compile(*key):
...
@@ -224,6 +224,8 @@ def _compile(*key):
return
p
return
p
pattern
,
flags
=
key
pattern
,
flags
=
key
if
isinstance
(
pattern
,
_pattern_type
):
if
isinstance
(
pattern
,
_pattern_type
):
if
flags
:
raise
ValueError
(
'Cannot process flags argument with a compiled pattern'
)
return
pattern
return
pattern
if
not
sre_compile
.
isstring
(
pattern
):
if
not
sre_compile
.
isstring
(
pattern
):
raise
TypeError
,
"first argument must be string or compiled pattern"
raise
TypeError
,
"first argument must be string or compiled pattern"
...
...
Lib/test/test_re.py
Dosyayı görüntüle @
80016c95
...
@@ -108,6 +108,14 @@ class ReTests(unittest.TestCase):
...
@@ -108,6 +108,14 @@ class ReTests(unittest.TestCase):
self
.
assertEqual
(
z
,
y
)
self
.
assertEqual
(
z
,
y
)
self
.
assertEqual
(
type
(
z
),
type
(
y
))
self
.
assertEqual
(
type
(
z
),
type
(
y
))
def
test_bug_1661
(
self
):
# Verify that flags do not get silently ignored with compiled patterns
pattern
=
re
.
compile
(
'.'
)
self
.
assertRaises
(
ValueError
,
re
.
match
,
pattern
,
'A'
,
re
.
I
)
self
.
assertRaises
(
ValueError
,
re
.
search
,
pattern
,
'A'
,
re
.
I
)
self
.
assertRaises
(
ValueError
,
re
.
findall
,
pattern
,
'A'
,
re
.
I
)
self
.
assertRaises
(
ValueError
,
re
.
compile
,
pattern
,
re
.
I
)
def
test_sub_template_numeric_escape
(
self
):
def
test_sub_template_numeric_escape
(
self
):
# bug 776311 and friends
# bug 776311 and friends
self
.
assertEqual
(
re
.
sub
(
'x'
,
r'\0'
,
'x'
),
'
\0
'
)
self
.
assertEqual
(
re
.
sub
(
'x'
,
r'\0'
,
'x'
),
'
\0
'
)
...
...
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