summaryrefslogtreecommitdiffstats
path: root/Modules/regexmodule.c
Commit message (Collapse)AuthorAgeFilesLines
* Merge p3yk branch with the trunk up to revision 45595. This breaks a fairThomas Wouters2006-04-211-690/+0
| | | | | | | | | | | | | | | | | | | | number of tests, all because of the codecs/_multibytecodecs issue described here (it's not a Py3K issue, just something Py3K discovers): http://mail.python.org/pipermail/python-dev/2006-April/064051.html Hye-Shik Chang promised to look for a fix, so no need to fix it here. The tests that are expected to break are: test_codecencodings_cn test_codecencodings_hk test_codecencodings_jp test_codecencodings_kr test_codecencodings_tw test_codecs test_multibytecodec This merge fixes an actual test failure (test_weakref) in this branch, though, so I believe merging is the right thing to do anyway.
* Don't DECREF a borrowed reference.Thomas Wouters2006-03-071-1/+0
|
* Thanks to Coverity, these were all reported by their Prevent tool.Neal Norwitz2006-03-071-1/+1
| | | | | All of these (except _lsprof.c) should be backported. Particularly the hotshot change which validates sys.path. Can someone backport?
* Check return result from Py_InitModule*(). This API can fail.Neal Norwitz2006-01-191-0/+2
| | | | Probably should be backported.
* Simplify and speedup uses of Py_BuildValue():Raymond Hettinger2003-10-121-1/+1
| | | | | | * Py_BuildValue("(OOO)",a,b,c) --> PyTuple_Pack(3,a,b,c) * Py_BuildValue("()",a) --> PyTuple_New(0) * Py_BuildValue("O", a) --> Py_INCREF(a)
* Excise DL_EXPORT/DL_IMPORT from Modules/*. Required adding a prototypeMark Hammond2002-08-021-1/+1
| | | | | | for Py_Main(). Thanks to Kalle Svensson and Skip Montanaro for the patches.
* Repair widespread misuse of _PyString_Resize. Since it's clear peopleTim Peters2002-04-271-5/+2
| | | | | | | | | | | | | | | | | | | | | | don't understand how this function works, also beefed up the docs. The most common usage error is of this form (often spread out across gotos): if (_PyString_Resize(&s, n) < 0) { Py_DECREF(s); s = NULL; goto outtahere; } The error is that if _PyString_Resize runs out of memory, it automatically decrefs the input string object s (which also deallocates it, since its refcount must be 1 upon entry), and sets s to NULL. So if the "if" branch ever triggers, it's an error to call Py_DECREF(s): s is already NULL! A correct way to write the above is the simpler (and intended) if (_PyString_Resize(&s, n) < 0) goto outtahere; Bugfix candidate.
* Remove METH_OLDARGS:Neal Norwitz2002-03-311-10/+8
| | | | | | | Convert METH_OLDARGS -> METH_VARARGS: also PyArg_Parse -> PyArg_ParseTuple Convert METH_OLDARGS -> METH_NOARGS: remove args parameter Please review. All tests pass, but some modules don't have tests. I spot checked various functions to try to make sure nothing broke.
* Patch #477750: Use METH_ constants in Modules.Martin v. Löwis2002-01-171-9/+9
|
* Patch supplied by Burton Radons for his own SF bug #487390: ModifyingGuido van Rossum2001-12-081-1/+1
| | | | | | | | | | | | | type.__module__ behavior. This adds the module name and a dot in front of the type name in every type object initializer, except for built-in types (and those that already had this). Note that it touches lots of Mac modules -- I have no way to test these but the changes look right. Apologies if they're not. This also touches the weakref docs, which contains a sample type object initializer. It also touches the mmap test output, because the mmap type's repr is included in that output. It touches object.h to put the correct description in a comment.
* initregex(): this function is declared void, so the recent change toTim Peters2001-07-091-1/+1
| | | | return NULL in an error case was itself an error.
* initregex(): Check return value of PyErr_Warn() and propagate the exceptionThomas Wouters2001-07-091-2/+4
| | | | (if any.)
* SF Patch #103185, by jlt63: Some more standard modules cleanup for CygwinGuido van Rossum2001-01-221-1/+4
|
* Adding a warning about the regex module. This is the first officialGuido van Rossum2000-12-191-0/+3
| | | | | use of PyErr_Warn()! This module is a good guinea pig because it's been obsolete since 1.5.0 was released.
* REMOVED all CWI, CNRI and BeOpen copyright markings.Guido van Rossum2000-09-011-9/+0
| | | | This should match the situation in the 1.6b1 tree.
* Bunch of minor ANSIfications: 'void initfunc()' -> 'void initfunc(void)',Thomas Wouters2000-07-211-1/+1
| | | | | | | | | | | | | | | | | | and a couple of functions that were missed in the previous batches. Not terribly tested, but very carefully scrutinized, three times. All these were found by the little findkrc.py that I posted to python-dev, which means there might be more lurking. Cases such as this: long func(a, b) long a; long b; /* flagword */ { and other cases where the last ; in the argument list isn't followed by a newline and an opening curly bracket. Regexps to catch all are welcome, of course ;)
* Fix mixed mallocs: re->re_patbuf.buffer is allocated with std malloc().Vladimir Marangozov2000-07-121-1/+1
|
* ANSI-ficationPeter Schneider-Kamp2000-07-101-47/+16
|
* Change copyright notice - 2nd try.Guido van Rossum2000-06-301-6/+0
|
* Change copyright notice.Guido van Rossum2000-06-301-22/+7
|
* Vladimir Marangozov's long-awaited malloc restructuring.Guido van Rossum2000-05-031-3/+4
| | | | | | | | | | For more comments, read the patches@python.org archives. For documentation read the comments in mymalloc.h and objimpl.h. (This is not exactly what Vladimir posted to the patches list; I've made a few changes, and Vladimir sent me a fix in private email for a problem that only occurs in debug mode. I'm also holding back on his change to main.c, which seems unnecessary to me.)
* Massive patch by Skip Montanaro to add ":name" to as manyGuido van Rossum2000-02-291-5/+5
| | | | PyArg_ParseTuple() format string arguments as possible.
* Add DL_EXPORT() to all modules that could possibly be usedGuido van Rossum1998-12-041-1/+1
| | | | on BeOS or Windows.
* Use the t# format where appropriate. Greg Stein.Guido van Rossum1998-10-081-3/+3
|
* Apply two changes, systematically:Guido van Rossum1997-10-011-2/+2
| | | | | | | | | | | | | | | | | (1) Use PyErr_NewException("module.class", NULL, NULL) to create the exception object. (2) Remove all calls to Py_FatalError(); instead, return or ignore the errors -- the import code now checks PyErr_Occurred() after calling a module's init function, so it's no longer a fatal error for the initialization to fail. Also did some small cleanups, e.g. removed unnecessary test for "already initialized" from initfpectl(), and unified initposix()/initnt(). I haven't checked this very thoroughly, so while the changes are pretty trivial -- beware of untested code!
* Change [_Py_]re_compile_pattern() to return a char*.Guido van Rossum1997-09-031-1/+1
| | | | | Since it only returns an error message (or NULL) there's no reason for it to be unsigned char *, and various compilers like this better.
* Casts by Jack to shut up the Mac compiler.Guido van Rossum1997-08-181-5/+5
|
* Use _Py_re_match/search instead of re_match/search; these may becomeGuido van Rossum1997-08-141-2/+3
| | | | different in a future version.
* 1.5a3 prerelease 1 from AMKGuido van Rossum1997-08-131-4/+8
|
* Fix big ineficciency in regobj.search/match (introduced by Barry in anGuido van Rossum1997-05-121-10/+12
| | | | | | | | otherwise laudible attempt to rationalize the argument parsing): it would save a copy of the original string instead of a reference to it. Go back to saving a reference, but keep the "s#" format (using a hack that involves two argument parsing steps, first using "O", then using "s#").
* regex_get_syntax(): New module function exported to Python.Barry Warsaw1997-02-181-0/+12
|
* Nailed a couple of memory leaks, caught by Purify.Barry Warsaw1997-01-091-1/+6
|
* Several changes. Test program to follow.Barry Warsaw1996-12-201-162/+267
| | | | | | | | | | | | | | | | | | | | | | | | | | | | - Where optional arguments were being used, converted to PyArg_ParseTuple() style instead of nested PyArg_Parse() style. - Check for and handle many potential error conditions that were never being tested. - internal reg_* functions renamed to regobj_* (makes it easier to figure out which are global regex functions and which are for regex objects). - reg_group (now regobj_group) was quite extensively reworked. it no longer recurses to do its job (by factoring core functionality into a separate function that knows about string and integer indexes). - some minor formatting fixes. - regex_set_syntax() now invalidates the cache. Without this change (in the example below), the second search would produce different output depending on whether the first search were performed or not (since performing the first search would cache the compiled object with RE_SYNTAX_EMACS, causing the second test to unexpectedly fail). regex.search('(a+)|(b+)', 'cdb') prev = regex.set_syntax(RE_SYNTAX_AWK) regex.search('(a+)|(b+)', 'cdb')
* Keep gcc -Wall happy.Guido van Rossum1996-12-051-0/+2
|
* New permission notice, includes CNRI.Guido van Rossum1996-10-251-13/+20
|
* Fix case where you start a new group immediately after a label.Guido van Rossum1996-10-231-1/+1
| | | | Thanks to Ka-Ping Yee.
* Speedup of makeresult() by keeping a filler of (-1, -1) around.Guido van Rossum1996-10-081-12/+25
|
* Declare initregex() as returning void, as it should be.Guido van Rossum1996-08-191-0/+1
|
* Converted to new style names by Skip MontanaroGuido van Rossum1996-07-241-192/+190
|
* Avoid core dump on symcomp("").Guido van Rossum1996-06-111-1/+5
|
* explicitly init flags in methodlistsGuido van Rossum1995-02-191-5/+5
|
* use Py_CHARMASKGuido van Rossum1995-02-101-2/+2
|
* mem leakGuido van Rossum1995-01-261-0/+1
|
* Added 1995 to copyright message.Guido van Rossum1995-01-041-2/+2
| | | | | Setup.in: clarified Tk comments somewhat. structmodule.c: use memcpy() instead of double precision assignment.
* Merge alpha100 branch back to main trunkGuido van Rossum1994-08-011-19/+191
|
* Extensive changes to regex module (group(), casefold, etc.)Guido van Rossum1993-02-231-12/+46
|
* * regexmodule.c: added use of translation table, substring() method.Guido van Rossum1993-02-211-38/+117
|
* Improve check for offset out of rangeGuido van Rossum1992-09-031-4/+8
|
* Remove redundant varsGuido van Rossum1992-03-271-2/+0
|
* Fix range error (doc and impl of re_search disagreed!)Guido van Rossum1992-01-271-29/+32
| | | | | Use getargs() function. Drop re_string from re object.