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
e3c4fd9c
Kaydet (Commit)
e3c4fd9c
authored
Eyl 10, 2008
tarafından
Guido van Rossum
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
- Issue #3629: Fix sre "bytecode" validator for an end case.
Reviewed by Amaury.
üst
24329ba1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
3 deletions
+10
-3
test_re.py
Lib/test/test_re.py
+4
-0
NEWS
Misc/NEWS
+2
-0
_sre.c
Modules/_sre.c
+4
-3
No files found.
Lib/test/test_re.py
Dosyayı görüntüle @
e3c4fd9c
...
...
@@ -116,6 +116,10 @@ class ReTests(unittest.TestCase):
self
.
assertRaises
(
ValueError
,
re
.
findall
,
pattern
,
'A'
,
re
.
I
)
self
.
assertRaises
(
ValueError
,
re
.
compile
,
pattern
,
re
.
I
)
def
test_bug_3629
(
self
):
# A regex that triggered a bug in the sre-code validator
re
.
compile
(
"(?P<quote>)(?(quote))"
)
def
test_sub_template_numeric_escape
(
self
):
# bug 776311 and friends
self
.
assertEqual
(
re
.
sub
(
'x'
,
r'\0'
,
'x'
),
'
\0
'
)
...
...
Misc/NEWS
Dosyayı görüntüle @
e3c4fd9c
...
...
@@ -68,6 +68,8 @@ C-API
Library
-------
- Issue #3629: Fix sre "bytecode" validator for an end case.
- Issue #3811: The Unicode database was updated to 5.1.
- Issue #3809: Fixed spurious 'test.blah' file left behind by test_logging.
...
...
Modules/_sre.c
Dosyayı görüntüle @
e3c4fd9c
...
...
@@ -2781,17 +2781,18 @@ _compile(PyObject* self_, PyObject* args)
arg = *code++; \
VTRACE(("%lu (arg)\n", (unsigned long)arg)); \
} while (0)
#define GET_SKIP
\
#define GET_SKIP
_ADJ(adj)
\
do { \
VTRACE(("%p= ", code)); \
if (code >= end) FAIL; \
skip = *code; \
VTRACE(("%lu (skip to %p)\n", \
(unsigned long)skip, code+skip)); \
if (code+skip
< code || code+skip > end)
\
if (code+skip
-adj < code || code+skip-adj > end)
\
FAIL; \
code++; \
} while (0)
#define GET_SKIP GET_SKIP_ADJ(0)
static
int
_validate_charset
(
SRE_CODE
*
code
,
SRE_CODE
*
end
)
...
...
@@ -3098,7 +3099,7 @@ _validate_inner(SRE_CODE *code, SRE_CODE *end, Py_ssize_t groups)
GET_ARG
;
if
(
arg
>=
groups
)
FAIL
;
GET_SKIP
;
GET_SKIP
_ADJ
(
1
)
;
code
--
;
/* The skip is relative to the first arg! */
/* There are two possibilities here: if there is both a 'then'
part and an 'else' part, the generated code looks like:
...
...
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