[Python-modules-commits] [python-regex] 01/04: Import python-regex_0.1.20160922.orig.tar.gz
Sandro Tosi
morph at moszumanska.debian.org
Sun Oct 2 20:08:16 UTC 2016
This is an automated email from the git hooks/post-receive script.
morph pushed a commit to branch master
in repository python-regex.
commit ca1ef2edd148e7f76a846f733f621028c5996243
Author: Sandro Tosi <morph at debian.org>
Date: Sun Oct 2 16:04:36 2016 -0400
Import python-regex_0.1.20160922.orig.tar.gz
---
PKG-INFO | 3 ++-
Python2/_regex.c | 14 ++++++++++++--
Python2/_regex_core.py | 3 +++
Python2/regex.py | 2 +-
Python2/test_regex.py | 4 ++++
Python3/_regex.c | 14 ++++++++++++--
Python3/_regex_core.py | 3 +++
Python3/regex.py | 2 +-
Python3/test_regex.py | 4 ++++
README | 2 +-
setup.py | 3 ++-
11 files changed, 45 insertions(+), 9 deletions(-)
diff --git a/PKG-INFO b/PKG-INFO
index 2eae981..419362f 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,6 +1,6 @@
Metadata-Version: 1.1
Name: regex
-Version: 2016.07.21
+Version: 2016.09.22
Summary: Alternative regular expression module, to replace re.
Home-page: https://bitbucket.org/mrabarnett/mrab-regex
Author: Matthew Barnett
@@ -1057,6 +1057,7 @@ Classifier: Programming Language :: Python :: 3.2
Classifier: Programming Language :: Python :: 3.3
Classifier: Programming Language :: Python :: 3.4
Classifier: Programming Language :: Python :: 3.5
+Classifier: Programming Language :: Python :: 3.6
Classifier: Topic :: Scientific/Engineering :: Information Analysis
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: Text Processing
diff --git a/Python2/_regex.c b/Python2/_regex.c
index bd8a84d..3b23892 100644
--- a/Python2/_regex.c
+++ b/Python2/_regex.c
@@ -1547,6 +1547,15 @@ Py_LOCAL_INLINE(BOOL) is_unicode_vowel(Py_UCS4 ch) {
}
}
+/* Checks whether a character is a Unicode apostrophe.
+ *
+ * This could be U+0027 (APOSTROPHE) or U+2019 (RIGHT SINGLE QUOTATION MARK /
+ * curly apostrophe).
+ */
+static BOOL is_unicode_apostrophe(Py_UCS4 ch) {
+ return ch == 0x27 || ch == 0x2019;
+}
+
/* Checks whether a position is on a default word boundary.
*
* The rules are defined here:
@@ -1667,7 +1676,7 @@ static BOOL unicode_at_default_boundary(RE_State* state, Py_ssize_t text_pos) {
/* Break between apostrophe and vowels (French, Italian). */
/* WB5a */
- if (pos_m1 >= 0 && char_at(state->text, pos_m1) == '\'' &&
+ if (pos_m1 >= 0 && is_unicode_apostrophe(char_at(state->text, pos_m1)) &&
is_unicode_vowel(char_at(state->text, text_pos)))
return TRUE;
@@ -1849,7 +1858,8 @@ Py_LOCAL_INLINE(BOOL) unicode_at_default_word_start_or_end(RE_State* state,
if (prop_m1 == RE_BREAK_ALETTER && prop == RE_BREAK_ALETTER)
return FALSE;
- if (pos_m1 >= 0 && char_m1 == '\'' && is_unicode_vowel(char_0))
+ if (pos_m1 >= 0 && is_unicode_apostrophe(char_m1) &&
+ is_unicode_vowel(char_0))
return TRUE;
pos_p1 = text_pos + 1;
diff --git a/Python2/_regex_core.py b/Python2/_regex_core.py
index 1b3f005..9a79e08 100644
--- a/Python2/_regex_core.py
+++ b/Python2/_regex_core.py
@@ -2838,6 +2838,9 @@ class GreedyRepeat(RegexBase):
def is_atomic(self):
return self.min_count == self.max_count and self.subpattern.is_atomic()
+ def can_be_affix(self):
+ return False
+
def contains_group(self):
return self.subpattern.contains_group()
diff --git a/Python2/regex.py b/Python2/regex.py
index 03c71dd..edaec00 100644
--- a/Python2/regex.py
+++ b/Python2/regex.py
@@ -239,7 +239,7 @@ __all__ = ["compile", "escape", "findall", "finditer", "fullmatch", "match",
"U", "UNICODE", "V0", "VERSION0", "V1", "VERSION1", "X", "VERBOSE", "W",
"WORD", "error", "Regex"]
-__version__ = "2.4.106"
+__version__ = "2.4.108"
# --------------------------------------------------------------------
# Public interface.
diff --git a/Python2/test_regex.py b/Python2/test_regex.py
index 9b459f3..01be01e 100644
--- a/Python2/test_regex.py
+++ b/Python2/test_regex.py
@@ -3692,6 +3692,10 @@ thing
self.assertEqual(bool(regex.match(r'(?(?=.*\!.*)(?P<true>.*\!\w*\:.*)|(?P<false>.*))',
'!')), False)
+ # Hg issue 220: Misbehavior of group capture with OR operand
+ self.assertEqual(regex.match(r'\w*(ea)\w*|\w*e(?!a)\w*',
+ 'easier').groups(), ('ea', ))
+
def test_subscripted_captures(self):
self.assertEqual(regex.match(r'(?P<x>.)+',
'abc').expandf('{0} {0[0]} {0[-1]}'), 'abc abc abc')
diff --git a/Python3/_regex.c b/Python3/_regex.c
index 320777f..70a2ad8 100644
--- a/Python3/_regex.c
+++ b/Python3/_regex.c
@@ -1536,6 +1536,15 @@ Py_LOCAL_INLINE(BOOL) is_unicode_vowel(Py_UCS4 ch) {
}
}
+/* Checks whether a character is a Unicode apostrophe.
+ *
+ * This could be U+0027 (APOSTROPHE) or U+2019 (RIGHT SINGLE QUOTATION MARK /
+ * curly apostrophe).
+ */
+static BOOL is_unicode_apostrophe(Py_UCS4 ch) {
+ return ch == 0x27 || ch == 0x2019;
+}
+
/* Checks whether a position is on a default word boundary.
*
* The rules are defined here:
@@ -1656,7 +1665,7 @@ static BOOL unicode_at_default_boundary(RE_State* state, Py_ssize_t text_pos) {
/* Break between apostrophe and vowels (French, Italian). */
/* WB5a */
- if (pos_m1 >= 0 && char_at(state->text, pos_m1) == '\'' &&
+ if (pos_m1 >= 0 && is_unicode_apostrophe(char_at(state->text, pos_m1)) &&
is_unicode_vowel(char_at(state->text, text_pos)))
return TRUE;
@@ -1838,7 +1847,8 @@ Py_LOCAL_INLINE(BOOL) unicode_at_default_word_start_or_end(RE_State* state,
if (prop_m1 == RE_BREAK_ALETTER && prop == RE_BREAK_ALETTER)
return FALSE;
- if (pos_m1 >= 0 && char_m1 == '\'' && is_unicode_vowel(char_0))
+ if (pos_m1 >= 0 && is_unicode_apostrophe(char_m1) &&
+ is_unicode_vowel(char_0))
return TRUE;
pos_p1 = text_pos + 1;
diff --git a/Python3/_regex_core.py b/Python3/_regex_core.py
index 40cb636..33a99e4 100644
--- a/Python3/_regex_core.py
+++ b/Python3/_regex_core.py
@@ -2828,6 +2828,9 @@ class GreedyRepeat(RegexBase):
def is_atomic(self):
return self.min_count == self.max_count and self.subpattern.is_atomic()
+ def can_be_affix(self):
+ return False
+
def contains_group(self):
return self.subpattern.contains_group()
diff --git a/Python3/regex.py b/Python3/regex.py
index a63c5fc..7524fa0 100644
--- a/Python3/regex.py
+++ b/Python3/regex.py
@@ -239,7 +239,7 @@ __all__ = ["compile", "escape", "findall", "finditer", "fullmatch", "match",
"U", "UNICODE", "V0", "VERSION0", "V1", "VERSION1", "X", "VERBOSE", "W",
"WORD", "error", "Regex"]
-__version__ = "2.4.106"
+__version__ = "2.4.108"
# --------------------------------------------------------------------
# Public interface.
diff --git a/Python3/test_regex.py b/Python3/test_regex.py
index c2a0242..6c45734 100644
--- a/Python3/test_regex.py
+++ b/Python3/test_regex.py
@@ -3796,6 +3796,10 @@ thing
self.assertEqual(bool(regex.match(r'(?(?=.*\!.*)(?P<true>.*\!\w*\:.*)|(?P<false>.*))',
'!')), False)
+ # Hg issue 220: Misbehavior of group capture with OR operand
+ self.assertEqual(regex.match(r'\w*(ea)\w*|\w*e(?!a)\w*',
+ 'easier').groups(), ('ea', ))
+
def test_subscripted_captures(self):
self.assertEqual(regex.match(r'(?P<x>.)+',
'abc').expandf('{0} {0[0]} {0[-1]}'), 'abc abc abc')
diff --git a/README b/README
index 21081e4..f83fd1f 100644
--- a/README
+++ b/README
@@ -1,6 +1,6 @@
regex is an alternative to the re package in the Python standard library. It is
intended to act as a drop in replacement, and one day to replace re. regex is
-supported on Python v2.5 to v2.7 and v3.1 to v3.5.
+supported on Python v2.5 to v2.7 and v3.1 to v3.6.
For a full list of features see Python2/Features.rst or Python3/Features.rst.
diff --git a/setup.py b/setup.py
index 752cb6c..1375fad 100644
--- a/setup.py
+++ b/setup.py
@@ -13,7 +13,7 @@ DOCS_DIR = os.path.join(BASE_DIR, 'docs')
setup(
name='regex',
- version='2016.07.21',
+ version='2016.09.22',
description='Alternative regular expression module, to replace re.',
long_description=open(os.path.join(DOCS_DIR, 'Features.rst')).read(),
@@ -38,6 +38,7 @@ setup(
'Programming Language :: Python :: 3.3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
+ 'Programming Language :: Python :: 3.6',
'Topic :: Scientific/Engineering :: Information Analysis',
'Topic :: Software Development :: Libraries :: Python Modules',
'Topic :: Text Processing',
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/python-regex.git
More information about the Python-modules-commits
mailing list