Serhiy Storchaka
48c8bf21f9
[2.7] bpo-34234: Use _PyAnyInt_Check() and _PyAnyInt_CheckExact(). (GH-8479)
2018-07-31 09:09:36 +03:00
Victor Stinner
70c3d5846a
Fix compiler warnings on Windows (GH-7729)
...
Fix comparison between signed and unsigned integers. Example of fixed
warning:
Modules\_sre.c(838): warning C4018: '<' : signed/unsigned mismatch
(cherry picked from commit 1fa174a418
)
2018-06-16 00:33:51 +02:00
Benjamin Peterson
a72d15c97f
consistently use Py_TYPE, Py_REFCNT, and correct initializer macros ( #3563 )
...
This no-op change makes 2.7 more consistent with 3.x to ease comparison and backports.
2017-09-13 21:20:29 -07:00
Serhiy Storchaka
955b6760cf
[2.7] bpo-30363: Backport warnings in the re module. ( #1577 )
...
Running Python with the -3 option now warns about regular expression
syntax that is invalid or has different semantic in Python 3
or will change the behavior in future Python versions.
2017-05-18 12:34:40 +03:00
Benjamin Peterson
0f3596a136
do not decref value borrowed from list ( closes #27774 )
2016-08-15 22:01:41 -07:00
Serhiy Storchaka
763a61ca95
Issue #26200 : Added Py_SETREF and replaced Py_XSETREF with Py_SETREF
...
in places where Py_DECREF was used.
2016-04-10 18:05:12 +03:00
Serhiy Storchaka
bc62af1bbe
Issue #22570 : Renamed Py_SETREF to Py_XSETREF.
2016-04-06 09:51:18 +03:00
Serhiy Storchaka
5951f2300f
Issue #20440 : Massive replacing unsafe attribute setting code with special
...
macro Py_SETREF.
2015-12-24 10:35:35 +02:00
Serhiy Storchaka
7865f218b4
Issue #18684 : Fixed reading out of the buffer in the re module.
2015-07-06 13:58:24 +03:00
Benjamin Peterson
bc4ece5775
allow longs as indexes to group() ( closes #22530 )
2014-09-30 22:04:28 -04:00
Serhiy Storchaka
e50fe4c9eb
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 12:24:29 +02:00
Serhiy Storchaka
fdb73ed486
Issue #19405 : Fixed outdated comments in the _sre module.
2013-10-27 08:00:57 +02:00
Serhiy Storchaka
cf29ba8cf0
Issue #18672 : Fixed format specifiers for Py_ssize_t in debugging output in
...
the _sre moduel.
2013-09-05 18:02:57 +03:00
Serhiy Storchaka
3ade66c203
Issue #17998 : Fix an internal error in regular expression engine.
2013-08-03 19:26:33 +03:00
Serhiy Storchaka
616f2fe28c
Issue #17016 : Get rid of possible pointer wraparounds and integer overflows
...
in the re module. Patch by Nickolai Zeldovich.
2013-04-13 21:15:10 +03:00
Serhiy Storchaka
6a8e2b4982
Issue #9669 : Protect re against infinite loops on zero-width matching in
...
non-greedy repeat. Patch by Matthew Barnett.
2013-02-16 21:23:01 +02:00
Serhiy Storchaka
e18e05cce9
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:15 +02:00
Benjamin Peterson
9dccb01703
use PyInt_FromSsize_t instead of PyLong_FromSsize_t ( #10182 )
2013-01-10 10:37:47 -06:00
Andrew Svetlov
c08ded9e4a
rename MathcObject to match object in doctrings for re module ( #16760 )
2012-12-25 18:50:03 +02:00
Andrew Svetlov
1c6c90fc73
Issue #16443 : Add docstrings to regular expression match objects.
...
Patch by Anton Kasyanov.
2012-12-23 20:09:01 +02:00
Gregory P. Smith
64ab35e11d
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:54 -08:00
Antoine Pitrou
b83575b0a5
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
b83ea144cc
Issue #1160 : Fix compiling large regular expressions on UCS2 builds.
...
Patch by Serhiy Storchaka.
2012-11-20 22:30:42 +01:00
Senthil Kumaran
d583068e7d
Fix Issue 12604 - Use a proper no-op macro expansion for VTRACE macro in _sre.c
2011-10-20 02:13:23 +08:00
Benjamin Peterson
6116d4a1d1
stop using the old brain-dead interface for providing attributes/methods
...
This closes #12099 .
2011-05-17 18:31:20 -05:00
Brett Cannon
8ffe7bbb72
Remove unused variables and a variable initialization.
...
Found using Clang's static analyzer.
2010-05-03 23:51:28 +00:00
Benjamin Peterson
e266d3e804
ready _sre types
2010-04-06 03:34:09 +00:00
Antoine Pitrou
efdddd3370
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:25:24 +00:00
Mark Dickinson
fe67bd9168
Issue #6561 : '\d' regular expression should not match characters of
...
category [No]; only those of category [Nd]. (Backport of r74237
from py3k.)
2009-07-28 20:35:03 +00:00
Guido van Rossum
e3c4fd9cc0
- Issue #3629 : Fix sre "bytecode" validator for an end case.
...
Reviewed by Amaury.
2008-09-10 14:27:00 +00:00
Guido van Rossum
8b762f05c7
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-05 03:39:21 +00:00
Gregory P. Smith
dd96db63f6
This reverts r63675 based on the discussion in this thread:
...
http://mail.python.org/pipermail/python-dev/2008-June/079988.html
Python 2.6 should stick with PyString_* in its codebase. The PyBytes_* names
in the spirit of 3.0 are available via a #define only. See the email thread.
2008-06-09 04:58:54 +00:00
Christian Heimes
593daf545b
Renamed PyString to PyBytes
2008-05-26 12:51:38 +00:00
Christian Heimes
4956d2b889
Silence Coverity false alerts with CIDs #172 , #183 , #184
2008-01-18 19:12:56 +00:00
Facundo Batista
4473d225a8
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-08 21:10:12 +00:00
Christian Heimes
e93237dfcc
#1629 : Renamed Py_Size, Py_Type and Py_Refcnt to Py_SIZE, Py_TYPE and Py_REFCNT. Macros for b/w compatibility are available.
2007-12-19 02:37:44 +00:00
Guido van Rossum
1ff91d95a2
Patch # 1140 (my code, approved by Effbot).
...
Make sure the type of the return value of re.sub(x, y, z) is the type
of y+x (i.e. unicode if either is unicode, str if they are both str)
even if there are no substitutions or if x==z (which triggered various
special cases in join_list()).
Could be backported to 2.5; no need to port to 3.0.
2007-09-10 22:02:25 +00:00
Martin v. Löwis
6819210b9e
PEP 3123: Provide forward compatibility with Python 3.0, while keeping
...
backwards compatibility. Add Py_Refcnt, Py_Type, Py_Size, and
PyVarObject_HEAD_INIT.
2007-07-21 06:55:02 +00:00
Andrew M. Kuchling
36126c424a
Cause a PyObject_Malloc() failure to trigger a MemoryError, and then
...
add 'if (PyErr_Occurred())' checks to various places so that NULL is
returned properly.
2.4 backport candidate.
2006-10-04 13:42:43 +00:00
Neal Norwitz
ef0de023db
Try to handle a malloc failure. I'm not entirely sure this is correct.
...
There might be something else we need to do to handle the exception.
Klocwork # 212-213
2006-08-12 01:53:28 +00:00
Neal Norwitz
a6d80faf6c
Impl ssize_t
2006-06-12 03:05:40 +00:00
Georg Brandl
96a8c3954c
Make use of METH_O and METH_NOARGS where possible.
...
Use Py_UnpackTuple instead of PyArg_ParseTuple where possible.
2006-05-29 21:04:52 +00:00
Georg Brandl
964f5978dc
METH_NOARGS functions do get called with two args.
2006-05-28 22:38:57 +00:00
Georg Brandl
fbef5888e7
Fix C function calling conventions in _sre module.
2006-05-28 22:14:04 +00:00
Jack Diederich
2d40077b4f
needforspeed: use PyObject_MALLOC instead of system malloc for small
...
allocations. Use PyMem_MALLOC for larger (1k+) chunks. 1%-2% speedup.
2006-05-27 15:44:34 +00:00
Skip Montanaro
816a162265
C++ compiler cleanup: proper casts
2006-04-18 11:53:09 +00:00
Anthony Baxter
aefd8ca701
Move constructors, add some casts to make C++ compiler happy. Still a problem
...
with the getstring() results in pattern_subx. Will come back to that.
2006-04-12 04:26:11 +00:00
Neal Norwitz
94a9c09e10
Rename sre.py -> re.py
2006-03-16 06:30:02 +00:00
Neal Norwitz
60da31660c
Thanks to Coverity, these were all reported by their Prevent tool.
...
All of these (except _lsprof.c) should be backported. Particularly
the hotshot change which validates sys.path. Can someone backport?
2006-03-07 04:48:24 +00:00
Martin v. Löwis
15e62742fa
Revert backwards-incompatible const changes.
2006-02-27 16:46:16 +00:00