Commit Graph

182 Commits

Author SHA1 Message Date
Serhiy Storchaka ccdf352370 Issue #20283: RE pattern methods now accept the string keyword parameters
as documented.  The pattern and source keyword parameters are left as
deprecated aliases.
2014-03-06 11:28:32 +02:00
Serhiy Storchaka efa5a39fa5 Issue #19405: Fixed outdated comments in the _sre module. 2013-10-27 08:04:58 +02:00
Serhiy Storchaka be80fc9a84 Issue #19327: Fixed the working of regular expressions with too big charset. 2013-10-24 22:02:58 +03:00
Serhiy Storchaka 134f0de66d Issue #18672: Fixed format specifiers for Py_ssize_t in debugging output in
the _sre moduel.
2013-09-05 18:01:15 +03:00
Serhiy Storchaka 1f35ae0a3c Issue #17998: Fix an internal error in regular expression engine. 2013-08-03 19:18:38 +03:00
Serhiy Storchaka 4bb17348f5 Issue #17016: Get rid of possible pointer wraparounds and integer overflows
in the re module.  Patch by Nickolai Zeldovich.
2013-04-13 21:15:47 +03:00
Serhiy Storchaka b0c75a7dec Issue #9669: Protect re against infinite loops on zero-width matching in
non-greedy repeat.  Patch by Matthew Barnett.
2013-02-16 21:25:05 +02:00
Serhiy Storchaka fa46816915 Issue #9669: Protect re against infinite loops on zero-width matching in
non-greedy repeat.  Patch by Matthew Barnett.
2013-02-16 21:23:53 +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
Serhiy Storchaka c1b59d4552 Issue #16688: Fix backreferences did make case-insensitive regex fail on non-ASCII strings.
Patch by Matthew Barnett.
2012-12-29 23:38:48 +02:00
Andrew Svetlov 41dc9f3cd1 rename MathcObject to match object in doctrings for re module (#16760) 2012-12-25 18:49:08 +02:00
Andrew Svetlov 0b64c1415e rename MathcObject to match object in doctrings for re module (#16760) 2012-12-25 18:48:54 +02:00
Andrew Svetlov 70dcef4789 Issue #16443: Add docstrings to regular expression match objects.
Patch by Anton Kasyanov.
2012-12-23 19:59:27 +02:00
Andrew Svetlov 56ad5ed5ad Issue #16443: Add docstrings to regular expression match objects.
Patch by Anton Kasyanov.
2012-12-23 19:23:07 +02:00
Gregory P. Smith c0dd80e439 1 << 31 is invalid for signed integers, fix it by making 1 unsigned.
Found by Clang trunk's Undefined-Behavior Sanitizer.  [more to come]
2012-12-10 17:45:03 -08:00
Gregory P. Smith 90555d0f0d 1 << 31 is invalid for signed integers, fix it by making 1 unsigned.
Found by Clang trunk's Undefined-Behavior Sanitizer.  [more to come]
2012-12-10 17:44:44 -08:00
Antoine Pitrou 9a2b26748b Issue #10182: The re module doesn't truncate indices to 32 bits anymore.
Patch by Serhiy Storchaka.
2012-12-02 12:54:28 +01:00
Antoine Pitrou 43fb54cd4f Issue #10182: The re module doesn't truncate indices to 32 bits anymore.
Patch by Serhiy Storchaka.
2012-12-02 12:52:36 +01:00
Antoine Pitrou 39bdad813a Issue #1160: Fix compiling large regular expressions on UCS2 builds.
Patch by Serhiy Storchaka.
2012-11-20 22:30:42 +01:00
Sean Reifschneider 7b3c975aaf closes #14259 re.finditer() now takes keyword arguments: pos, endpos.
Contrary to the documentation, finditer() did not take pos and endpos
keyword arguments.
2012-03-12 18:22:38 -06:00
Benjamin Peterson 33d21a24fa merge 3.2 (#14212) 2012-03-07 14:59:13 -06:00
Benjamin Peterson e48944b69c keep the buffer object around while we're using it (closes #14212) 2012-03-07 14:50:25 -06:00
Ross Lagerwall 88748d7bfe Issue #10951: Fix compiler warnings in _sre.c 2012-03-06 21:48:57 +02:00
Victor Stinner 63ab875cfe Remove "#ifdef Py_UNICODE_WIDE": Python is now always wide 2011-11-22 03:31:20 +01:00
Senthil Kumaran c6b4ef105e default - Fix closes Issue 12604 - Use a proper no-op macro expansion for VTRACE macro in _sre.c
Patch by Petri Lehtinen and Josh Triplett.
2011-10-20 02:16:59 +08:00
Senthil Kumaran 202a3c422b 3.2 - Fix Issue 12604 - Use a proper no-op macro expansion for VTRACE macro in _sre.c 2011-10-20 02:15:36 +08:00
Martin v. Löwis c47adb04b3 Change PyUnicode_KIND to 1,2,4. Drop _KIND_SIZE and _CHARACTER_SIZE. 2011-10-07 20:55:35 +02:00
Victor Stinner 0058b8603f _sre: don't use Py_UNICODE anymore
* Downcasting from Py_UCS4 to Py_UNICODE is wrong is Py_UNICODE is 16-bit
   wchar_t
 * Remove old special case in getstring(), unicode is now handled separetely
2011-09-29 03:27:47 +02:00
Ezio Melotti 7c8c1ea3ec Fix whitespace. 2011-09-29 01:00:19 +03:00
Ezio Melotti 2aa2b3b4d5 Clean up a few tabs that went in with PEP393. 2011-09-29 00:58:57 +03:00
Martin v. Löwis d63a3b8beb Implement PEP 393. 2011-09-28 07:41:54 +02:00
Daniel Stutzbach a606faa491 Issue 5553: Improved Py_LOCAL_INLINE to actually inline under compilers other than MSC 2010-08-31 19:51:07 +00:00
Benjamin Peterson 08bf91c041 Merged revisions 79307,79408,79430,79533,79542,79579-79580,79585-79587,79607-79608,79622,79717,79820,79822,79828,79862,79875,79923-79924,79941-79943,79945,79947,79951-79952 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r79307 | florent.xicluna | 2010-03-22 17:45:50 -0500 (Mon, 22 Mar 2010) | 2 lines

  #7667: Fix doctest failures with non-ASCII paths.
........
  r79408 | victor.stinner | 2010-03-24 20:18:38 -0500 (Wed, 24 Mar 2010) | 2 lines

  Fix a gcc warning introduced by r79397.
........
  r79430 | brian.curtin | 2010-03-25 18:48:54 -0500 (Thu, 25 Mar 2010) | 2 lines

  Fix #6538. Markup RegexObject and MatchObject as classes. Patch by Ryan Arana.
........
  r79533 | barry.warsaw | 2010-03-31 16:07:16 -0500 (Wed, 31 Mar 2010) | 6 lines

  - Issue #8233: When run as a script, py_compile.py optionally takes a single
    argument `-` which tells it to read files to compile from stdin.  Each line
    is read on demand and the named file is compiled immediately.  (Original
    patch by Piotr O?\197?\188arowski).
........
  r79542 | r.david.murray | 2010-03-31 20:28:39 -0500 (Wed, 31 Mar 2010) | 3 lines

  A couple small grammar fixes in test.rst, and rewrite the
  check_warnings docs to be clearer.
........
  r79579 | georg.brandl | 2010-04-02 03:34:41 -0500 (Fri, 02 Apr 2010) | 1 line

  Add 2.6.5.
........
  r79580 | georg.brandl | 2010-04-02 03:39:09 -0500 (Fri, 02 Apr 2010) | 1 line

  #2768: add a note on how to get a file descriptor.
........
  r79585 | georg.brandl | 2010-04-02 04:03:18 -0500 (Fri, 02 Apr 2010) | 1 line

  Remove col-spanning cells in logging docs.
........
  r79586 | georg.brandl | 2010-04-02 04:07:42 -0500 (Fri, 02 Apr 2010) | 1 line

  Document PyImport_ExecCodeModuleEx().
........
  r79587 | georg.brandl | 2010-04-02 04:11:49 -0500 (Fri, 02 Apr 2010) | 1 line

  #8012: clarification in generator glossary entry.
........
  r79607 | andrew.kuchling | 2010-04-02 12:48:23 -0500 (Fri, 02 Apr 2010) | 1 line

  #6647: document that catch_warnings is not thread-safe
........
  r79608 | andrew.kuchling | 2010-04-02 12:54:26 -0500 (Fri, 02 Apr 2010) | 1 line

  #6647: add note to two examples
........
  r79622 | tarek.ziade | 2010-04-02 16:34:19 -0500 (Fri, 02 Apr 2010) | 1 line

  removed documentation on code that was reverted and pushed into distutils2
........
  r79717 | antoine.pitrou | 2010-04-03 16:22:38 -0500 (Sat, 03 Apr 2010) | 4 lines

  Fix wording / typography, and a slightly misleading statement
  (memoryviews don't support complex structures right now)
........
  r79820 | benjamin.peterson | 2010-04-05 22:34:09 -0500 (Mon, 05 Apr 2010) | 1 line

  ready _sre types
........
  r79822 | georg.brandl | 2010-04-06 03:18:15 -0500 (Tue, 06 Apr 2010) | 1 line

  #8320: document return value of recv_into().
........
  r79828 | georg.brandl | 2010-04-06 09:33:44 -0500 (Tue, 06 Apr 2010) | 1 line

  Add JP.
........
  r79862 | georg.brandl | 2010-04-06 15:27:59 -0500 (Tue, 06 Apr 2010) | 1 line

  Fix syntax.
........
  r79875 | mark.dickinson | 2010-04-06 17:18:23 -0500 (Tue, 06 Apr 2010) | 1 line

  More NaN consistency doc fixes.
........
  r79923 | georg.brandl | 2010-04-10 06:15:24 -0500 (Sat, 10 Apr 2010) | 1 line

  #8360: skipTest was added in 2.7.
........
  r79924 | georg.brandl | 2010-04-10 06:16:59 -0500 (Sat, 10 Apr 2010) | 1 line

  #8346: update version.
........
  r79941 | andrew.kuchling | 2010-04-10 20:39:36 -0500 (Sat, 10 Apr 2010) | 1 line

  Two grammar fixes
........
  r79942 | andrew.kuchling | 2010-04-10 20:40:06 -0500 (Sat, 10 Apr 2010) | 1 line

  Punctuation fix
........
  r79943 | andrew.kuchling | 2010-04-10 20:40:30 -0500 (Sat, 10 Apr 2010) | 1 line

  Add various items
........
  r79945 | andrew.kuchling | 2010-04-10 20:40:49 -0500 (Sat, 10 Apr 2010) | 1 line

  name correct
........
  r79947 | andrew.kuchling | 2010-04-10 20:44:13 -0500 (Sat, 10 Apr 2010) | 1 line

  Remove distutils section
........
  r79951 | andrew.kuchling | 2010-04-11 07:48:08 -0500 (Sun, 11 Apr 2010) | 1 line

  Two typo fixes
........
  r79952 | andrew.kuchling | 2010-04-11 07:49:37 -0500 (Sun, 11 Apr 2010) | 1 line

  Add two items
........
2010-04-11 16:12:57 +00:00
Victor Stinner 5abeafbb0f Issue #3299: replace PyObject_DEL() by Py_DECREF() in _sre module to fix a
crash in pydebug mode.
2010-03-04 21:59:53 +00:00
Antoine Pitrou 82feb1f360 Merged revisions 77499 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r77499 | antoine.pitrou | 2010-01-14 18:25:24 +0100 (jeu., 14 janv. 2010) | 4 lines

  Issue #3299: Fix possible crash in the _sre module when given bad
  argument values in debug mode.  Patch by Victor Stinner.
........
2010-01-14 17:34:48 +00:00
Mark Dickinson 1f268285ff Issue #6561: '\d' in a regular expression should match only Unicode
character category [Nd],  not [No].
2009-07-28 17:22:36 +00:00
Mark Dickinson e94c679df0 Issue #1717: rename tp_compare to tp_reserved. I'll change the
type of tp_compare in a separate commit, for ease of reversion
should things go wrong.
2009-02-02 20:36:42 +00:00
Guido van Rossum 92f8f3e013 Merged revisions 66364 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r66364 | guido.van.rossum | 2008-09-10 07:27:00 -0700 (Wed, 10 Sep 2008) | 3 lines

  Issue #3629: Fix sre "bytecode" validator for an end case.
  Reviewed by Amaury.
........
2008-09-10 14:30:50 +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
Martin v. Löwis 423be95dcf Merged revisions 65654 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r65654 | martin.v.loewis | 2008-08-12 16:49:50 +0200 (Tue, 12 Aug 2008) | 6 lines

  Issue #3139: Make buffer-interface thread-safe wrt. PyArg_ParseTuple,
  by denying s# to parse objects that have a releasebuffer procedure,
  and introducing s*.

  More module might need to get converted to use s*.
........
2008-08-13 15:53:07 +00:00
Guido van Rossum 10faf6a0a3 Merged revisions 65544 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r65544 | guido.van.rossum | 2008-08-04 20:39:21 -0700 (Mon, 04 Aug 2008) | 28 lines

  Tracker issue 3487: sre "bytecode" verifier.

  This is a verifier for the binary code used by the _sre module (this
  is often called bytecode, though to distinguish it from Python bytecode
  I put it in quotes).

  I wrote this for Google App Engine, and am making the patch available as
  open source under the Apache 2 license.  Below are the copyright
  statement and license, for completeness.

  # Copyright 2008 Google Inc.
  #
  # Licensed under the Apache License, Version 2.0 (the "License");
  # you may not use this file except in compliance with the License.
  # You may obtain a copy of the License at
  #
  #     http://www.apache.org/licenses/LICENSE-2.0
  #
  # Unless required by applicable law or agreed to in writing, software
  # distributed under the License is distributed on an "AS IS" BASIS,
  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  # See the License for the specific language governing permissions and
  # limitations under the License.

  It's not necessary to include these copyrights and bytecode in the
  source file.  Google has signed a contributor's agreement with the PSF
  already.
........
2008-08-06 19:29:14 +00:00
Amaury Forgeot d'Arc e43d33a4db #3247 Get rid of Py_FindMethod; use tp_members instead.
Otherwise dir(_sre.SRE_Match) returns an empty list.

First step: handle most occurrences, remove tp_getattr and fill the tp_methods and tp_members slots.
Add some test about attribute access.
2008-07-02 20:50:16 +00:00
Martin v. Löwis 1a21451b1d Implement PEP 3121: new module initialization and finalization API. 2008-06-11 05:26:20 +00:00
Christian Heimes 72b710a596 Renamed PyString to PyBytes 2008-05-26 13:28:38 +00:00
Christian Heimes 587c2bfede Merged revisions 60053-60078 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r60054 | christian.heimes | 2008-01-18 20:12:56 +0100 (Fri, 18 Jan 2008) | 1 line

  Silence Coverity false alerts with CIDs #172, #183, #184
........
  r60057 | guido.van.rossum | 2008-01-18 21:56:30 +0100 (Fri, 18 Jan 2008) | 3 lines

  Fix an edge case whereby the __del__() method of a classic class could
  create a new weakref to the object.
........
  r60058 | raymond.hettinger | 2008-01-18 22:14:58 +0100 (Fri, 18 Jan 2008) | 1 line

  Better variable name in an example.
........
  r60063 | guido.van.rossum | 2008-01-19 00:05:40 +0100 (Sat, 19 Jan 2008) | 3 lines

  This got fixed for classic classes in r60057,
  and backported to 2.5.2 in 60056.
........
  r60068 | jeffrey.yasskin | 2008-01-19 10:56:06 +0100 (Sat, 19 Jan 2008) | 4 lines

  Several tweaks: add construction from strings and .from_decimal(), change
  __init__ to __new__ to enforce immutability, and remove "rational." from repr
  and the parens from str.
........
  r60069 | georg.brandl | 2008-01-19 11:11:27 +0100 (Sat, 19 Jan 2008) | 2 lines

  Fix markup.
........
  r60070 | georg.brandl | 2008-01-19 11:16:09 +0100 (Sat, 19 Jan 2008) | 3 lines

  Amend curses docs by info how to write non-ascii characters.
  Thanks to Jeroen Ruigrok van der Werven.
........
  r60071 | georg.brandl | 2008-01-19 11:18:07 +0100 (Sat, 19 Jan 2008) | 2 lines

  Indentation normalization.
........
  r60073 | facundo.batista | 2008-01-19 13:32:27 +0100 (Sat, 19 Jan 2008) | 5 lines


  Fix issue #1822: MIMEMultipart.is_multipart() behaves correctly for a
  just-created (and empty) instance.  Added tests for this. Thanks
  Jonathan Share.
........
  r60074 | andrew.kuchling | 2008-01-19 14:33:20 +0100 (Sat, 19 Jan 2008) | 1 line

  Polish sentence
........
  r60075 | christian.heimes | 2008-01-19 14:46:06 +0100 (Sat, 19 Jan 2008) | 1 line

  Added unit test to verify that threading.local doesn't cause ref leaks. It seems that the thread local storage always keeps the storage of the last stopped thread alive. Can anybody comment on it, please?
........
  r60076 | christian.heimes | 2008-01-19 16:06:09 +0100 (Sat, 19 Jan 2008) | 1 line

  Update for threading.local test.
........
  r60077 | andrew.kuchling | 2008-01-19 16:16:37 +0100 (Sat, 19 Jan 2008) | 1 line

  Polish sentence
........
  r60078 | georg.brandl | 2008-01-19 16:22:16 +0100 (Sat, 19 Jan 2008) | 2 lines

  Fix typos.
........
2008-01-19 16:21:02 +00:00
Christian Heimes 2380ac740e Merged revisions 59843-59863 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r59844 | raymond.hettinger | 2008-01-07 21:56:05 +0100 (Mon, 07 Jan 2008) | 1 line

  Use get() instead of pop() for the optimized version of _replace().
........
  r59847 | raymond.hettinger | 2008-01-07 22:33:51 +0100 (Mon, 07 Jan 2008) | 1 line

  Documentation nits.
........
  r59849 | raymond.hettinger | 2008-01-08 03:02:05 +0100 (Tue, 08 Jan 2008) | 1 line

  Expand comment.
........
  r59850 | raymond.hettinger | 2008-01-08 03:24:15 +0100 (Tue, 08 Jan 2008) | 1 line

  Docs on named tuple's naming conventions and limits of subclassing
........
  r59851 | christian.heimes | 2008-01-08 04:40:04 +0100 (Tue, 08 Jan 2008) | 1 line

  It's verbose, not debug
........
  r59852 | facundo.batista | 2008-01-08 13:25:20 +0100 (Tue, 08 Jan 2008) | 4 lines


  Issue #1757: The hash of a Decimal instance is no longer affected
  by the current context.  Thanks Mark Dickinson.
........
  r59853 | andrew.kuchling | 2008-01-08 15:30:55 +0100 (Tue, 08 Jan 2008) | 1 line

  Patch 1137: allow assigning to .buffer_size attribute of PyExpat.parser objects
........
  r59854 | andrew.kuchling | 2008-01-08 15:56:02 +0100 (Tue, 08 Jan 2008) | 1 line

  Patch 1114: fix compilation of curses module on 64-bit AIX, and any other LP64 platforms where attr_t isn't a C long
........
  r59856 | thomas.heller | 2008-01-08 16:15:09 +0100 (Tue, 08 Jan 2008) | 5 lines

  Use relative instead of absolute filenames in the C-level tracebacks.
  This prevents traceback prints pointing to files in this way:

    File "\loewis\25\python\Modules\_ctypes\callbacks.c", line 206, in 'calling callback function'
........
  r59857 | christian.heimes | 2008-01-08 16:46:10 +0100 (Tue, 08 Jan 2008) | 2 lines

  Added __enter__ and __exit__ functions to HKEY object
  Added ExpandEnvironmentStrings to the _winreg module.
........
  r59858 | georg.brandl | 2008-01-08 17:18:26 +0100 (Tue, 08 Jan 2008) | 2 lines

  Fix markup errors from r59857 and clarify key.__enter__/__exit__ docs
........
  r59860 | georg.brandl | 2008-01-08 20:42:30 +0100 (Tue, 08 Jan 2008) | 2 lines

  Better method for associating .py files with the interpreter.
........
  r59862 | facundo.batista | 2008-01-08 22:10:12 +0100 (Tue, 08 Jan 2008) | 9 lines


  Issue 846388. Adds a call to PyErr_CheckSignals to
  SRE_MATCH so that signal handlers can be invoked during
  long regular expression matches.  It also adds a new
  error return value indicating that an exception
  occurred in a signal handler during the match, allowing
  exceptions in the signal handler to propagate up to the
  main loop.  Thanks Josh Hoyt and Ralf Schmitt.
........
2008-01-09 00:17:24 +00:00
Christian Heimes 90aa7646af #1629: Renamed Py_Size, Py_Type and Py_Refcnt to Py_SIZE, Py_TYPE and Py_REFCNT. 2007-12-19 02:45:37 +00:00
Christian Heimes 217cfd1c86 Cleanup: Replaced most PyInt_ aliases with PyLong_ and disabled the aliases in intobject.h 2007-12-02 14:31:20 +00:00
Alexandre Vassalotti 70a237179f Remove the buffer API from PyUnicode as specified by PEP 3137. Also,
fix the error message of the 't' format unit, in getargs.c, so that it
asks for bytes, instead of string.
2007-10-14 02:05:51 +00:00