cpython: 4d5826fa77a1 (original) (raw)

Mercurial > cpython

changeset 95252:4d5826fa77a1

Issue #14260: The groupindex attribute of regular expression pattern object now is non-modifiable mapping. [#14260]

Serhiy Storchaka storchaka@gmail.com
date Mon, 30 Mar 2015 01:01:48 +0300
parents 09f22b5d6cea
children bed806c9eb4c ed40da1bcdad
files Lib/csv.py Lib/sre_parse.py Lib/test/test_re.py Misc/NEWS Modules/_sre.c
diffstat 5 files changed, 31 insertions(+), 5 deletions(-)[+] [-] Lib/csv.py 7 Lib/sre_parse.py 3 Lib/test/test_re.py 8 Misc/NEWS 3 Modules/_sre.c 15

line wrap: on

line diff

--- a/Lib/csv.py +++ b/Lib/csv.py @@ -231,20 +231,21 @@ class Sniffer: quotes = {} delims = {} spaces = 0

--- a/Lib/sre_parse.py +++ b/Lib/sre_parse.py @@ -855,6 +855,7 @@ def parse_template(source, pattern): del literal[:] groups.append((len(literals), index)) literals.append(None)

@@ -869,7 +870,7 @@ def parse_template(source, pattern): name = s.getuntil(">") if name.isidentifier(): try:

--- a/Lib/test/test_re.py +++ b/Lib/test/test_re.py @@ -577,6 +577,14 @@ class ReTests(unittest.TestCase): self.assertEqual(re.match("(a)", "a").regs, ((0, 1), (0, 1))) self.assertTrue(re.match("(a)", "a").re)

+ def test_special_escapes(self): self.assertEqual(re.search(r"\b(b.)\b", "abcd abc bcd bx").group(1), "bx")

--- a/Misc/NEWS +++ b/Misc/NEWS @@ -30,6 +30,9 @@ Core and Builtins Library ------- +- Issue #14260: The groupindex attribute of regular expression pattern object

--- a/Modules/_sre.c +++ b/Modules/_sre.c @@ -1384,12 +1384,24 @@ static PyMethodDef pattern_methods[] = { {NULL, NULL} }; +/* PatternObject's 'groupindex' method. */ +static PyObject * +pattern_groupindex(PatternObject *self) +{

+} + +static PyGetSetDef pattern_getset[] = {

+}; + #define PAT_OFF(x) offsetof(PatternObject, x) static PyMemberDef pattern_members[] = { {"pattern", T_OBJECT, PAT_OFF(pattern), READONLY}, {"flags", T_INT, PAT_OFF(flags), READONLY}, {"groups", T_PYSSIZET, PAT_OFF(groups), READONLY},

}; static int _validate(PatternObject self); / Forward */