summaryrefslogtreecommitdiffstats
path: root/Modules/pyexpat.c
Commit message (Collapse)AuthorAgeFilesLines
* This reverts r63675 based on the discussion in this thread:Gregory P. Smith2008-06-091-14/+14
| | | | | | | 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.
* Renamed PyString to PyBytesChristian Heimes2008-05-261-14/+14
|
* Patch 1137: allow assigning to .buffer_size attribute of PyExpat.parser objectsAndrew M. Kuchling2008-01-081-0/+44
|
* #1629: Renamed Py_Size, Py_Type and Py_Refcnt to Py_SIZE, Py_TYPE and ↵Christian Heimes2007-12-191-2/+2
| | | | Py_REFCNT. Macros for b/w compatibility are available.
* PEP 3123: Provide forward compatibility with Python 3.0, while keepingMartin v. Löwis2007-07-211-4/+3
| | | | | backwards compatibility. Add Py_Refcnt, Py_Type, Py_Size, and PyVarObject_HEAD_INIT.
* - back out Expat change; the final fix to Expat will be differentFred Drake2006-07-061-1/+31
| | | | | - change the pyexpat wrapper to not be so sensitive to this detail of the Expat implementation (the ex-crasher test still passes)
* Make use of METH_O and METH_NOARGS where possible.Georg Brandl2006-05-291-34/+19
| | | | Use Py_UnpackTuple instead of PyArg_ParseTuple where possible.
* err is no longer usedNeal Norwitz2006-04-161-1/+1
|
* Use Py_VISIT in all tp_traverse methods, instead of traversing manually orThomas Wouters2006-04-151-7/+2
| | | | | | | | using a custom, nearly-identical macro. This probably changes how some of these functions are compiled, which may result in fractionally slower (or faster) execution. Considering the nature of traversal, visiting much of the address space in unpredictable patterns, I'd argue the code readability and maintainability is well worth it ;P
* Use Py_CLEAR instead of in-place DECREF/XDECREF or custom macros, forThomas Wouters2006-04-151-2/+1
| | | | tp_clear methods.
* Fix some missing checks after PyTuple_New, PyList_New, PyDict_NewGeorg Brandl2006-03-171-0/+2
|
* Fix logic error and DECREF reported by Coverity.Neal Norwitz2006-03-081-4/+4
|
* Revert backwards-incompatible const changes.Martin v. Löwis2006-02-271-1/+1
|
* Check return result from Py_InitModule*(). This API can fail.Neal Norwitz2006-01-191-0/+2
| | | | Probably should be backported.
* Fix SF bug #1072182, problems with signed characters.Neal Norwitz2005-12-191-1/+1
| | | | Most of these can be backported.
* moved magic into structure (mainly to simplify the client code)Fredrik Lundh2005-12-131-5/+5
| | | | added missing API hooks
* renamed dispatch -> capi to match other CAPI implementationsFredrik Lundh2005-12-131-24/+24
| | | | (e.g. cStringIO, ucnhash, etc)
* added cobject-based expat dispatch mechanism to pyexpatFredrik Lundh2005-12-131-0/+31
|
* Add const to several API functions that take char *.Jeremy Hylton2005-12-101-2/+2
| | | | | | | | | | | | | | | | | | | In C++, it's an error to pass a string literal to a char* function without a const_cast(). Rather than require every C++ extension module to put a cast around string literals, fix the API to state the const-ness. I focused on parts of the API where people usually pass literals: PyArg_ParseTuple() and friends, Py_BuildValue(), PyMethodDef, the type slots, etc. Predictably, there were a large set of functions that needed to be fixed as a result of these changes. The most pervasive change was to make the keyword args list passed to PyArg_ParseTupleAndKewords() to be a const char *kwlist[]. One cast was required as a result of the changes: A type object mallocs the memory for its tp_doc slot and later frees it. PyTypeObject says that tp_doc is const char *; but if the type was created by type_new(), we know it is safe to cast to char *.
* Fix a bunch of imports to use code.h instead of compile.h.Jeremy Hylton2005-10-211-1/+0
| | | | Remove duplicate declarations from compile.h
* Patch #1309009, Fix segfault in pyexpat when the XML document isNeal Norwitz2005-09-301-1/+6
| | | | | | in latin_1, but Python incorrectly assumes it is in UTF-8 format Will backport.
* Patches #925152, #1118602: Avoid reading after the end of the bufferMartin v. Löwis2005-03-041-1/+1
| | | | in pyexpat.GetInputContext. Will backport to 2.4.
* Synchronize with PyXML 1.79:Martin v. Löwis2004-10-131-1/+10
| | | | | | 73: Restore support for Python 2.1. 74: Factor the previous change differently 79: Conditionalize usage of PyTuple_Pack.
* Patch #1014930. Expose current parse location to XMLParser.Dave Cole2004-08-261-0/+14
|
* make exception propogation more efficient; this avoids having Expat parseFred Drake2004-08-131-5/+7
| | | | | | | the remaining data in the buffer (which it had done happily without reporting any results) this depends on a new feature in Expat added in 1.95.8
* add constants for many error values added over the past couple ofFred Drake2004-08-041-0/+17
| | | | years
* Fix the reference count errors revealed by the test suite...Michael W. Hudson2004-08-031-1/+3
|
* 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)
* Repair mis-application of Jeremy's patch. Thanks, Neal!Fred Drake2003-07-211-1/+1
|
* Fix memory leak reported & discussed on the Python XML-SIG mailing list.Fred Drake2003-07-211-5/+13
| | | | | This patch was provided by Jeremy Kloth, and corresponds to pyexpat.c 1.77 in the PyXML CVS.
* Fix several bugs in handling of exceptions with trace function enabled.Jeremy Hylton2003-06-271-15/+48
| | | | | | | | | | | | | | | | | | | If the callback raised an exception but did not set curexc_traceback, the trace function was called with PyTrace_RETURN. That is, the trace function was called with an exception set. The main loop detected the exception when the trace function returned; it complained and disabled tracing. Fix the logic error so that PyTrace_RETURN only occurs if the callback returned normally. The trace function must be called for exceptions, too. So we had to add new functionality to call with PyTrace_EXCEPTION. (Leads to a rather ugly ifdef / else block that contains only a '}'.) Reverse the logic and name of NOFIX_TRACE to FIX_TRACE. Joint work with Fred.
* Fix memory leak: free memory storing the content model passed to theFred Drake2003-02-021-24/+48
| | | | | ElementDeclHandler by Expat. Fixes SF bug #676990.
* Conditionalize features not found in PyXML 1.95.2.Martin v. Löwis2003-01-211-0/+15
|
* Merge with PyXML 1.71:Martin v. Löwis2003-01-211-16/+136
| | | | | | | | | | | | | | | | | | | | | | 60: Added support for the SkippedEntityHandler, new in Expat 1.95.4. 61: Added support for namespace prefixes, which can be enabled by setting the "namespace_prefixes" attribute on the parser object. 65: Disable profiling changes for Python 2.0 and 2.1. 66: Update pyexpat to export the Expat 1.95.5 XML_GetFeatureList() information, and tighten up a type declaration now that Expat is using an incomplete type rather than a void * for the XML_Parser type. 67: Clarified a comment. Added support for XML_UseForeignDTD(), new in Expat 1.95.5. 68: Refactor to avoid partial duplication of the code to construct an ExpatError instance, and actually conform to the API for the exception instance as well. 69: Remove some spurious trailing whitespace. Add a special external-entity-ref handler that gets installed once a handler has raised a Python exception; this can cancel actual parsing earlier if there's an external entity reference in the input data after the the Python excpetion has been raised. 70: Untabify APPEND. 71: Backport PyMODINIT_FUNC for 2.2 and earlier.
* SF # 669553, fix memory (ref) leaksNeal Norwitz2003-01-191-13/+25
| | | | Will backport.
* Assorted patches from Armin Rigo:Michael W. Hudson2002-11-081-1/+1
| | | | | | | | [ 617309 ] getframe hook (Psyco #1) [ 617311 ] Tiny profiling info (Psyco #2) [ 617312 ] debugger-controlled jumps (Psyco #3) These are forward ports from 2.2.2.
* Be more careful with the type of the xmlhandlersetter; it takes anFred Drake2002-09-241-1/+1
| | | | | | XML_Parser, which happens to be a pointer type, not an XML_Parser*. This generated warnings when compiled with Expat 1.95.5, which no longer defines XML_Parser to be void*.
* Minor change for symmetry with PyXML: PyDoc_STR should not includeFred Drake2002-09-021-1/+1
| | | | | | | | | the "safety" parentheses since some older compilers refuse to compile the module then, claiming that static initializers are non-constant. This doesn't actually make any difference for Python, since these definitions are not used when compiling with a version of Python that already defines the PyDoc_* macros.
* Squash a few calls to the hideously expensive PyObject_CallObject(o,a)Guido van Rossum2002-08-161-1/+1
| | | | | | | -- replace then with slightly faster PyObject_Call(o,a,NULL). (The difference is that the latter requires a to be a tuple; the former allows other values and wraps them in a tuple if necessary; it involves two more levels of C function calls to accomplish all that.)
* Add trace_frame. Fixes #534864. Backported to 2.2.Martin v. Löwis2002-08-041-0/+38
|
* Return NULL instead of 0 from function with a pointer return value.Fred Drake2002-07-191-1/+1
|
* Land Patch [ 566100 ] Rationalize DL_IMPORT and DL_EXPORT.Mark Hammond2002-07-191-3/+2
|
* Removed more stray instances of statichere, but left _sre.c alone.Tim Peters2002-07-171-1/+1
|
* staticforward bites the dust.Jeremy Hylton2002-07-171-2/+2
| | | | | | | | | | | | | | | The staticforward define was needed to support certain broken C compilers (notably SCO ODT 3.0, perhaps early AIX as well) botched the static keyword when it was used with a forward declaration of a static initialized structure. Standard C allows the forward declaration with static, and we've decided to stop catering to broken C compilers. (In fact, we expect that the compilers are all fixed eight years later.) I'm leaving staticforward and statichere defined in object.h as static. This is only for backwards compatibility with C extensions that might still use it. XXX I haven't updated the documentation.
* Do not depend on pymemcompat.h (was only used for PyXML); Martin likesFred Drake2002-07-021-4/+6
| | | | it all inline.
* Bring this back into sync with PyXML revision 1.58.Fred Drake2002-07-011-3/+10
|
* Define PyDoc_STRVAR if it is not available (PyXML 1.54).Martin v. Löwis2002-06-301-63/+11
| | | | Remove support for Python 1.5 (PyXML 1.55).
* Undo usage of PyOS_snprintf (rev. 1.51 of PyXML).Martin v. Löwis2002-06-301-1/+3
|
* Added character data buffering to pyexpat parser objects.Fred Drake2002-06-281-20/+157
| | | | | | | | | Setting the buffer_text attribute to true causes the parser to collect character data, waiting as long as possible to report it to the Python callback. This can save an enormous number of callbacks from C to Python, which can be a substantial performance improvement. buffer_text defaults to false.
* pyexpat code cleanup and minor refactorings:Fred Drake2002-06-281-221/+176
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The handlers array on each parser now has the invariant that None will never be set as a handler; it will always be NULL or a Python-level value passed in for the specific handler. have_handler(): Return true if there is a Python handler for a particular event. get_handler_name(): Return a string object giving the name of a particular handler. This caches the string object so it doesn't need to be created more than once. get_parse_result(): Helper to allow the Parse() and ParseFile() methods to share the same logic for determining the return value or exception state. PyUnknownEncodingHandler(), PyModule_AddIntConstant(): Made these helpers static. (The later is only defined for older versions of Python.) pyxml_UpdatePairedHandlers(), pyxml_SetStartElementHandler(), pyxml_SetEndElementHandler(), pyxml_SetStartNamespaceDeclHandler(), pyxml_SetEndNamespaceDeclHandler(), pyxml_SetStartCdataSection(), pyxml_SetEndCdataSection(), pyxml_SetStartDoctypeDeclHandler(), pyxml_SetEndDoctypeDeclHandler(): Removed. These are no longer needed with Expat 1.95.x. handler_info: Use the setter functions provided by Expat 1.95.x instead of the pyxml_Set*Handler() functions which have been removed. Minor code formatting changes for consistency. Trailing whitespace removed.