Commit Graph

115 Commits

Author SHA1 Message Date
Serhiy Storchaka 485407ce1e Issue #24580: Symbolic group references to open group in re patterns now are
explicitly forbidden as well as numeric group references.
2015-07-18 23:27:00 +03:00
Serhiy Storchaka 07360df481 Issue #14260: The groupindex attribute of regular expression pattern object
now is non-modifiable mapping.
2015-03-30 01:01:48 +03:00
Serhiy Storchaka 632a77e6a3 Issue #22364: Improved some re error messages using regex for hints. 2015-03-25 21:03:47 +02:00
Serhiy Storchaka 15fa1c4ade Fixed using deprecated escaping in regular expression in _strptime.py (issue23622). 2015-03-25 01:21:50 +02:00
Serhiy Storchaka a54aae0683 Issue #23622: Unknown escapes in regular expressions that consist of ``'\'``
and ASCII letter now raise a deprecation warning and will be forbidden in
Python 3.6.
2015-03-24 22:58:14 +02:00
Serhiy Storchaka 4eea62fd2e Issues #814253, #9179: Group references and conditional group references now
work in lookbehind assertions in regular expressions.
2015-02-21 10:07:35 +02:00
Serhiy Storchaka 22a309a434 Issue #21032: Deprecated the use of re.LOCALE flag with str patterns or
re.ASCII. It was newer worked.
2014-12-01 11:50:07 +02:00
Benjamin Peterson 16e802f4ae merge 3.4 (#9179) 2014-11-30 11:51:16 -05:00
Benjamin Peterson 66323415c7 backout 9fcf4008b626 (#9179) for further consideration 2014-11-30 11:49:00 -05:00
Serhiy Storchaka ab14088141 Minor code clean up and improvements in the re module. 2014-11-11 21:13:28 +02:00
Serhiy Storchaka 1b2004f059 Fixed error position for the backslash at the end of regex pattern. 2014-11-10 18:28:53 +02:00
Serhiy Storchaka b99c132bd9 Fixed AttributeError when the regular expression starts from illegal escape. 2014-11-10 14:38:16 +02:00
Serhiy Storchaka ad446d57a9 Issue #22578: Added attributes to the re.error class. 2014-11-10 13:49:00 +02:00
Serhiy Storchaka 5f33677219 Merge heads 2014-11-10 10:21:03 +02:00
Raymond Hettinger df1b699447 Issue #22823: Use set literals instead of creating a set from a list 2014-11-09 15:56:33 -08:00
Serhiy Storchaka c7f7d3897e Issue #22434: Constants in sre_constants are now named constants (enum-like). 2014-11-09 20:48:36 +02:00
Serhiy Storchaka 6276b32799 Issues #814253, #9179: Group references and conditional group references now
work in lookbehind assertions in regular expressions.
2014-11-07 21:45:17 +02:00
Serhiy Storchaka 84df7fe6a2 Issues #814253, #9179: Group references and conditional group references now
work in lookbehind assertions in regular expressions.
2014-11-07 21:43:57 +02:00
Serhiy Storchaka e2ccf5608c Issue #19380: Optimized parsing of regular expressions. 2014-10-10 11:14:49 +03:00
Serhiy Storchaka 7438e4b56f Issue 1519638: Now unmatched groups are replaced with empty strings in re.sub()
and re.subn().
2014-10-10 11:06:31 +03:00
Serhiy Storchaka 9baa5b2de2 Issue #22437: Number of capturing groups in regular expression is no longer
limited by 100.
2014-09-29 22:49:23 +03:00
Serhiy Storchaka c563caf3a2 Issue #22362: Forbidden ambiguous octal escapes out of range 0-0o377 in
regular expressions.
2014-09-23 23:22:41 +03:00
Serhiy Storchaka 44dae8bde3 Issue #22423: Fixed debugging output of the GROUPREF_EXISTS opcode in the re
module.
2014-09-21 22:47:55 +03:00
Raymond Hettinger 1c99bc84bd Issue #8343: Named group error msgs did not show the group name. 2014-06-22 19:47:22 -07:00
Victor Stinner 7fa767e517 Issue #20976: pyflakes: Remove unused imports 2014-03-20 09:16:38 +01:00
Serhiy Storchaka 9c15ec1ce6 Issue #19365: Optimized the parsing of long replacement string in re.sub*()
functions.
2013-10-23 22:27:52 +03:00
Serhiy Storchaka 9d96542b6d Issue #18647: Correctly bound calculated min/max width of a subexpression.
Now max width is MAXREPEAT on 32- and 64-bit platforms when one of
subexpressions is unbounded repetition.
2013-08-19 22:50:54 +03:00
R David Murray 26dfaac9ac #17341: Include name in re error message about invalid group name.
Patch by Jason Michalski.
2013-04-14 13:00:54 -04:00
Georg Brandl 1d472b74cb Closes #14462: allow any valid Python identifier in sre group names, as documented. 2013-04-14 11:40:00 +02:00
Serhiy Storchaka a0eb809995 Issue #13169: The maximal repetition number in a regular expression has been
increased from 65534 to 2147483647 (on 32-bit platform) or 4294967294 (on
64-bit).
2013-02-16 16:54:33 +02:00
Serhiy Storchaka 70ca0210e8 Issue #13169: The maximal repetition number in a regular expression has been
increased from 65534 to 2147483647 (on 32-bit platform) or 4294967294 (on
64-bit).
2013-02-16 16:47:47 +02:00
Ezio Melotti adfbb8e8ec #13899: merge with 3.2. 2013-01-11 08:43:53 +02:00
Ezio Melotti fe8e6e7414 #13899: \A, \Z, and \B now correctly match the A, Z, and B literals when used inside character classes (e.g. [A]). Patch by Matthew Barnett. 2013-01-11 08:32:01 +02:00
Ezio Melotti 68600aff3a #12759: merge with 3.2. 2012-11-03 20:33:38 +02:00
Ezio Melotti 0941d9fc64 #12759: sre_parse now raises a proper error when the name of the group is missing. Initial patch by Serhiy Storchaka. 2012-11-03 20:33:08 +02:00
Antoine Pitrou 463badf06c Issue #3665: \u and \U escapes are now supported in unicode regular expressions.
Patch by Serhiy Storchaka.
2012-06-23 13:29:19 +02:00
Marc-André Lemburg 8f36af7a4c Normalize the encoding names for Latin-1 and UTF-8 to
'latin-1' and 'utf-8'.

These are optimized in the Python Unicode implementation
to result in more direct processing, bypassing the codec
registry.

Also see issue11303.
2011-02-25 15:42:01 +00:00
Ezio Melotti b92ed7cf36 #6509: fix re.sub to work properly when the pattern, the string, and the replacement were all bytes. Patch by Antoine Pitrou. 2010-03-06 15:24:08 +00:00
Benjamin Peterson 6c940d6159 Merged revisions 66894 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r66894 | benjamin.peterson | 2008-10-14 17:37:18 -0500 (Tue, 14 Oct 2008) | 1 line

  remove set compat cruft
........
2008-10-14 23:07:40 +00:00
Antoine Pitrou fd036451bf #2834: Change re module semantics, so that str and bytes mixing is forbidden,
and str (unicode) patterns get full unicode matching by default. The re.ASCII
flag is also introduced to ask for ASCII matching instead.
2008-08-19 17:56:33 +00:00
Antoine Pitrou 22628c4d6a #3231: re.compile fails with some bytes patterns 2008-07-22 17:53:22 +00:00
Thomas Wouters 40a088dc27 Fix 're' to work on bytes. It could do with a few more tests, though. 2008-03-18 20:19:54 +00:00
Christian Heimes a37d4c693a Removed PyInt_GetMax and sys.maxint
I replaced sys.maxint with sys.maxsize in Lib/*.py. Does anybody see a problem with the change on Win 64bit platforms? Win 64's long is just 32bit but the sys.maxsize is now 2**63-1 on every 64bit platform.
Also added docs for sys.maxsize.
2007-12-04 23:02:19 +00:00
Guido van Rossum 98297ee781 Merging the py3k-pep3137 branch back into the py3k branch.
No detailed change log; just check out the change log for the py3k-pep3137
branch.  The most obvious changes:

  - str8 renamed to bytes (PyString at the C level);
  - bytes renamed to buffer (PyBytes at the C level);
  - PyString and PyUnicode are no longer compatible.

I.e. we now have an immutable bytes type and a mutable bytes type.

The behavior of PyString was modified quite a bit, to make it more
bytes-like.  Some changes are still on the to-do list.
2007-11-06 21:34:58 +00:00
Guido van Rossum 75a902db78 Patch 1280, by Alexandre Vassalotti.
Make PyString's indexing and iteration return integers.
(I changed a few of Alexandre's decisions -- GvR.)
2007-10-19 22:06:24 +00:00
Thomas Wouters d2cf20eea2 Remove the simple slicing API. All slicing is now done with slice objects. 2007-08-30 22:57:53 +00:00
Collin Winter ce36ad8a46 Raise statement normalization in Lib/. 2007-08-30 01:19:48 +00:00
Guido van Rossum 1325790b93 Merged revisions 55795-55816 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/p3yk

........
  r55797 | neal.norwitz | 2007-06-07 00:00:57 -0700 (Thu, 07 Jun 2007) | 3 lines

  Get rid of some remnants of classic classes.  types.ClassType == type.
  Also get rid of almost all uses of the types module and use the builtin name.
........
  r55798 | neal.norwitz | 2007-06-07 00:12:36 -0700 (Thu, 07 Jun 2007) | 1 line

  Remove a use of types, verify commit hook works
........
  r55809 | guido.van.rossum | 2007-06-07 11:11:29 -0700 (Thu, 07 Jun 2007) | 2 lines

  Fix syntax error introduced by Neal in last checkin.
........
2007-06-07 23:15:56 +00:00
Guido van Rossum 84fc66dd02 Rename 'unicode' to 'str' in its tp_name field. Rename 'str' to 'str8'.
Change all occurrences of unichr to chr.
2007-05-03 17:18:26 +00:00
Guido van Rossum be19ed77dd Fix most trivially-findable print statements.
There's one major and one minor category still unfixed:
doctests are the major category (and I hope to be able to augment the
refactoring tool to refactor bona fide doctests soon);
other code generating print statements in strings is the minor category.

(Oh, and I don't know if the compiler package works.)
2007-02-09 05:37:30 +00:00