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
43fb54cd
Kaydet (Commit)
43fb54cd
authored
Ara 02, 2012
tarafından
Antoine Pitrou
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #10182: The re module doesn't truncate indices to 32 bits anymore.
Patch by Serhiy Storchaka.
üst
56379c0d
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
6 deletions
+24
-6
test_re.py
Lib/test/test_re.py
+16
-1
NEWS
Misc/NEWS
+3
-0
_sre.c
Modules/_sre.c
+5
-5
No files found.
Lib/test/test_re.py
Dosyayı görüntüle @
43fb54cd
from
test.support
import
verbose
,
run_unittest
,
gc_collect
from
test.support
import
verbose
,
run_unittest
,
gc_collect
,
bigmemtest
,
_2G
import
io
import
io
import
re
import
re
from
re
import
Scanner
from
re
import
Scanner
...
@@ -854,6 +854,21 @@ class ReTests(unittest.TestCase):
...
@@ -854,6 +854,21 @@ class ReTests(unittest.TestCase):
# Test behaviour when not given a string or pattern as parameter
# Test behaviour when not given a string or pattern as parameter
self
.
assertRaises
(
TypeError
,
re
.
compile
,
0
)
self
.
assertRaises
(
TypeError
,
re
.
compile
,
0
)
# The huge memuse is because of re.sub() using a list and a join()
# to create the replacement result.
@bigmemtest
(
size
=
_2G
,
memuse
=
20
)
def
test_large
(
self
,
size
):
# Issue #10182: indices were 32-bit-truncated.
s
=
'a'
*
size
m
=
re
.
search
(
'$'
,
s
)
self
.
assertIsNotNone
(
m
)
self
.
assertEqual
(
m
.
start
(),
size
)
self
.
assertEqual
(
m
.
end
(),
size
)
r
,
n
=
re
.
subn
(
''
,
''
,
s
)
self
.
assertEqual
(
r
,
s
)
self
.
assertEqual
(
n
,
size
+
1
)
def
run_re_tests
():
def
run_re_tests
():
from
test.re_tests
import
tests
,
SUCCEED
,
FAIL
,
SYNTAX_ERROR
from
test.re_tests
import
tests
,
SUCCEED
,
FAIL
,
SYNTAX_ERROR
if
verbose
:
if
verbose
:
...
...
Misc/NEWS
Dosyayı görüntüle @
43fb54cd
...
@@ -169,6 +169,9 @@ Core and Builtins
...
@@ -169,6 +169,9 @@ Core and Builtins
Library
Library
-------
-------
- Issue #10182: The re module doesn't truncate indices to 32 bits anymore.
Patch by Serhiy Storchaka.
- Issue #16573: In 2to3, treat enumerate() like a consuming call, so superfluous
- Issue #16573: In 2to3, treat enumerate() like a consuming call, so superfluous
list() calls aren't added to filter(), map(), and zip() which are directly
list() calls aren't added to filter(), map(), and zip() which are directly
passed enumerate().
passed enumerate().
...
...
Modules/_sre.c
Dosyayı görüntüle @
43fb54cd
...
@@ -1629,7 +1629,7 @@ static PyObject*pattern_scanner(PatternObject*, PyObject*);
...
@@ -1629,7 +1629,7 @@ static PyObject*pattern_scanner(PatternObject*, PyObject*);
static
PyObject
*
static
PyObject
*
sre_codesize
(
PyObject
*
self
,
PyObject
*
unused
)
sre_codesize
(
PyObject
*
self
,
PyObject
*
unused
)
{
{
return
Py
_BuildValue
(
"l"
,
sizeof
(
SRE_CODE
));
return
Py
Long_FromSize_t
(
sizeof
(
SRE_CODE
));
}
}
static
PyObject
*
static
PyObject
*
...
@@ -2467,7 +2467,7 @@ next:
...
@@ -2467,7 +2467,7 @@ next:
return
NULL
;
return
NULL
;
if
(
subn
)
if
(
subn
)
return
Py_BuildValue
(
"N
i
"
,
item
,
n
);
return
Py_BuildValue
(
"N
n
"
,
item
,
n
);
return
item
;
return
item
;
...
@@ -3423,7 +3423,7 @@ match_start(MatchObject* self, PyObject* args)
...
@@ -3423,7 +3423,7 @@ match_start(MatchObject* self, PyObject* args)
}
}
/* mark is -1 if group is undefined */
/* mark is -1 if group is undefined */
return
Py
_BuildValue
(
"i"
,
self
->
mark
[
index
*
2
]);
return
Py
Long_FromSsize_t
(
self
->
mark
[
index
*
2
]);
}
}
static
PyObject
*
static
PyObject
*
...
@@ -3446,7 +3446,7 @@ match_end(MatchObject* self, PyObject* args)
...
@@ -3446,7 +3446,7 @@ match_end(MatchObject* self, PyObject* args)
}
}
/* mark is -1 if group is undefined */
/* mark is -1 if group is undefined */
return
Py
_BuildValue
(
"i"
,
self
->
mark
[
index
*
2
+
1
]);
return
Py
Long_FromSsize_t
(
self
->
mark
[
index
*
2
+
1
]);
}
}
LOCAL
(
PyObject
*
)
LOCAL
(
PyObject
*
)
...
@@ -3596,7 +3596,7 @@ static PyObject *
...
@@ -3596,7 +3596,7 @@ static PyObject *
match_lastindex_get
(
MatchObject
*
self
)
match_lastindex_get
(
MatchObject
*
self
)
{
{
if
(
self
->
lastindex
>=
0
)
if
(
self
->
lastindex
>=
0
)
return
Py_BuildValue
(
"i"
,
self
->
lastindex
);
return
PyLong_FromSsize_t
(
self
->
lastindex
);
Py_INCREF
(
Py_None
);
Py_INCREF
(
Py_None
);
return
Py_None
;
return
Py_None
;
}
}
...
...
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