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
3ade66c2
Kaydet (Commit)
3ade66c2
authored
Agu 03, 2013
tarafından
Serhiy Storchaka
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #17998: Fix an internal error in regular expression engine.
üst
e8e31214
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
20 additions
and
8 deletions
+20
-8
test_re.py
Lib/test/test_re.py
+10
-0
NEWS
Misc/NEWS
+2
-0
_sre.c
Modules/_sre.c
+6
-6
sre.h
Modules/sre.h
+2
-2
No files found.
Lib/test/test_re.py
Dosyayı görüntüle @
3ade66c2
...
...
@@ -897,6 +897,16 @@ class ReTests(unittest.TestCase):
with
self
.
assertRaisesRegexp
(
sre_constants
.
error
,
'
\
?foo'
):
re
.
compile
(
'(?P<?foo>)'
)
def
test_issue17998
(
self
):
for
reps
in
'*'
,
'+'
,
'?'
,
'{1}'
:
for
mod
in
''
,
'?'
:
pattern
=
'.'
+
reps
+
mod
+
'yz'
self
.
assertEqual
(
re
.
compile
(
pattern
,
re
.
S
)
.
findall
(
'xyz'
),
[
'xyz'
],
msg
=
pattern
)
pattern
=
pattern
.
encode
()
self
.
assertEqual
(
re
.
compile
(
pattern
,
re
.
S
)
.
findall
(
b
'xyz'
),
[
b
'xyz'
],
msg
=
pattern
)
def
run_re_tests
():
from
test.re_tests
import
tests
,
SUCCEED
,
FAIL
,
SYNTAX_ERROR
...
...
Misc/NEWS
Dosyayı görüntüle @
3ade66c2
...
...
@@ -26,6 +26,8 @@ Core and Builtins
Library
-------
- Issue #17998: Fix an internal error in regular expression engine.
- Issue #17557: Fix os.getgroups() to work with the modified behavior of
getgroups(2) on OS X 10.8. Original patch by Mateusz Lenik.
...
...
Modules/_sre.c
Dosyayı görüntüle @
3ade66c2
...
...
@@ -1028,7 +1028,7 @@ entrance:
TRACE
((
"|%p|%p|REPEAT_ONE %d %d
\n
"
,
ctx
->
pattern
,
ctx
->
ptr
,
ctx
->
pattern
[
1
],
ctx
->
pattern
[
2
]));
if
(
ctx
->
pattern
[
1
]
>
end
-
ctx
->
ptr
)
if
(
(
Py_ssize_t
)
ctx
->
pattern
[
1
]
>
end
-
ctx
->
ptr
)
RETURN_FAILURE
;
/* cannot match */
state
->
ptr
=
ctx
->
ptr
;
...
...
@@ -1111,7 +1111,7 @@ entrance:
TRACE
((
"|%p|%p|MIN_REPEAT_ONE %d %d
\n
"
,
ctx
->
pattern
,
ctx
->
ptr
,
ctx
->
pattern
[
1
],
ctx
->
pattern
[
2
]));
if
(
ctx
->
pattern
[
1
]
>
end
-
ctx
->
ptr
)
if
(
(
Py_ssize_t
)
ctx
->
pattern
[
1
]
>
end
-
ctx
->
ptr
)
RETURN_FAILURE
;
/* cannot match */
state
->
ptr
=
ctx
->
ptr
;
...
...
@@ -1210,7 +1210,7 @@ entrance:
TRACE
((
"|%p|%p|MAX_UNTIL %d
\n
"
,
ctx
->
pattern
,
ctx
->
ptr
,
ctx
->
count
));
if
(
ctx
->
count
<
ctx
->
u
.
rep
->
pattern
[
1
])
{
if
(
ctx
->
count
<
(
Py_ssize_t
)
ctx
->
u
.
rep
->
pattern
[
1
])
{
/* not enough matches */
ctx
->
u
.
rep
->
count
=
ctx
->
count
;
DO_JUMP
(
JUMP_MAX_UNTIL_1
,
jump_max_until_1
,
...
...
@@ -1224,7 +1224,7 @@ entrance:
RETURN_FAILURE
;
}
if
((
ctx
->
count
<
ctx
->
u
.
rep
->
pattern
[
2
]
||
if
((
ctx
->
count
<
(
Py_ssize_t
)
ctx
->
u
.
rep
->
pattern
[
2
]
||
ctx
->
u
.
rep
->
pattern
[
2
]
==
SRE_MAXREPEAT
)
&&
state
->
ptr
!=
ctx
->
u
.
rep
->
last_ptr
)
{
/* we may have enough matches, but if we can
...
...
@@ -1273,7 +1273,7 @@ entrance:
TRACE
((
"|%p|%p|MIN_UNTIL %d %p
\n
"
,
ctx
->
pattern
,
ctx
->
ptr
,
ctx
->
count
,
ctx
->
u
.
rep
->
pattern
));
if
(
ctx
->
count
<
ctx
->
u
.
rep
->
pattern
[
1
])
{
if
(
ctx
->
count
<
(
Py_ssize_t
)
ctx
->
u
.
rep
->
pattern
[
1
])
{
/* not enough matches */
ctx
->
u
.
rep
->
count
=
ctx
->
count
;
DO_JUMP
(
JUMP_MIN_UNTIL_1
,
jump_min_until_1
,
...
...
@@ -1302,7 +1302,7 @@ entrance:
LASTMARK_RESTORE
();
if
((
ctx
->
count
>=
ctx
->
u
.
rep
->
pattern
[
2
]
if
((
ctx
->
count
>=
(
Py_ssize_t
)
ctx
->
u
.
rep
->
pattern
[
2
]
&&
ctx
->
u
.
rep
->
pattern
[
2
]
!=
SRE_MAXREPEAT
)
||
state
->
ptr
==
ctx
->
u
.
rep
->
last_ptr
)
RETURN_FAILURE
;
...
...
Modules/sre.h
Dosyayı görüntüle @
3ade66c2
...
...
@@ -20,14 +20,14 @@
# if SIZEOF_SIZE_T > 4
# define SRE_MAXREPEAT (~(SRE_CODE)0)
# else
# define SRE_MAXREPEAT ((SRE_CODE)PY_SSIZE_T_MAX
+ 1u
)
# define SRE_MAXREPEAT ((SRE_CODE)PY_SSIZE_T_MAX)
# endif
#else
# define SRE_CODE unsigned int
# if SIZEOF_SIZE_T > SIZEOF_INT
# define SRE_MAXREPEAT (~(SRE_CODE)0)
# else
# define SRE_MAXREPEAT ((SRE_CODE)PY_SSIZE_T_MAX
+ 1u
)
# define SRE_MAXREPEAT ((SRE_CODE)PY_SSIZE_T_MAX)
# endif
#endif
...
...
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