summaryrefslogtreecommitdiffstats
path: root/Modules/pyexpat.c
Commit message (Collapse)AuthorAgeFilesLines
* 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.
* Integrate the changes from PyXML's version of pyexpat.c revisionsFred Drake2002-06-271-46/+109
| | | | 1.47, 1.48, 1.49 (name interning support).
* Patch #568124: Add doc string macros.Martin v. Löwis2002-06-131-22/+21
|
* Remove compiler warnings on Solaris 8.Neal Norwitz2002-03-201-1/+1
| | | | Can go into 2.2.x, but not necessary.
* Use included Expat library. Drop support for older expat versions.Martin v. Löwis2002-02-111-171/+0
|
* 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.
* sprintf -> PyOS_snprintf in some "obviously safe" cases.Tim Peters2001-11-281-1/+1
| | | | | Also changed <>-style #includes to ""-style in some places where the former didn't make sense.
* assert.h was not always included by Python.h; make sure we import it forFred Drake2001-11-181-0/+3
| | | | older versions. (Thanks to Martijn Faassen.)
* Patch #473265: UpdatePairedHandlers nonsensical.Martin v. Löwis2001-11-101-3/+3
|
* Merge 1.42 from PyXML: Flag errors resulting from argument conversion problems.Martin v. Löwis2001-11-101-2/+1
| | | | Fixes problem with not detecting UTF-8 errors.
* Change clear_handlers argument to indicate whether this is an initialization.Martin v. Löwis2001-10-211-9/+10
| | | | Do not set the Expat handlers if it is. Fixes PyXML bug #473195.
* Reactivate participation of expat parsers in GC. Fixes bug #462710.Martin v. Löwis2001-09-231-2/+33
|
* Include ctype.h after Python.h.Martin v. Löwis2001-09-191-1/+1
|
* Patch to bug #461753: Allow None in ExternalEntityParserCreate.Martin v. Löwis2001-09-191-1/+1
|
* Patch #445762: Support --disable-unicodeMartin v. Löwis2001-08-171-12/+15
| | | | | | | | - Do not compile unicodeobject, unicodectype, and unicodedata if Unicode is disabled - check for Py_USING_UNICODE in all places that use Unicode functions - disables unicode literals, and the builtin functions - add the types.StringTypes list - remove Unicode literals from most tests.
* Squash compiler wng about mixing signed and unsigned in comparison.Tim Peters2001-07-281-1/+2
|
* ParserCreate(): Allow an empty string for the namespace_separator argument;Fred Drake2001-04-251-68/+82
| | | | | | | | | | | | while not generally a good idea, this is used by RDF users, and works to implement RDF-style namespace+localname concatenation as defined in the RDF specifications. (This also corrects a backwards-compatibility bug.) Be more conservative while clearing out handlers; set the slot in the self->handlers array to NULL before DECREFing the callback. Still more adjustments to make the code style internally consistent.
* get_version_string(): New function -- returns a Python string object thatFred Drake2001-03-241-3/+24
| | | | | | | | gives the CVS revision of this file even if it does not include the extra RCS "$Revision: " cruft. initpyexpat(): Use get_version_string() instead of hard-coding magic indexes into the RCS string (which may be affected by export options).
* Variety of small INC/DECREF patches that fix reported memory leaksJeremy Hylton2001-03-131-3/+0
| | | | | | | | | | | | | | | | | | | | | with free variables. Thanks to Martin v. Loewis for finding two of the problems. This fixes SF buf 405583. There is also a C API change: PyFrame_New() is reverting to its pre-2.1 signature. The change introduced by nested scopes was a mistake. XXX Is this okay between beta releases? cell_clear(), the GC helper, must decref its reference to break cycles. frame_dealloc() must dealloc all cell vars and free vars in addition to locals. eval_code2() setup code must INCREF cells it copies out of the closure. The STORE_DEREF opcode implementation must DECREF the object it passes to PyCell_Set().
* Wrap some long lines, use only C89 /* */ comments, and add spaces aroundFred Drake2001-03-011-14/+15
| | | | some operators (style guide conformance).
* Bug #132816: Compiler warning in PYEXPAT.C for extra ';'Tim Peters2001-02-171-5/+5
| | | | Removed trailing ";" in instances of "};" closing code blocks.
* Remove the old version of my_StartElementHandler(). This was conditionallyFred Drake2001-02-161-17/+0
| | | | | | compiled only for some versions of Expat, but was no longer needed as the new implementation works for all versions. Keeping it created multiple definitions for Expat 1.2, which caused compilation to fail.
* xmlparseobject: Remove the unused conv_attrs field, added anFred Drake2001-02-141-87/+156
| | | | | | | | | | | | | | | | | | | | | | | | in_callback field that's set to true whenever a callback into an event handler is true. Needed for: set_error(): Add line number of offset information to the exception as attributes, so users don't need to parse the text of the message. set_error_attr(): New helper function for set_error(). xmlparse_GetInputContext(): New function of the parser object; returns the document source for an event during a callback, None at all other times. xmlparse_SetParamEntityParsing(): Make the signature consistent with the other parser methods (use xmlparseobject* for self instead of PyObject*). initpyexpat(): Don't lose the reference to the exception class! call_with_frame(), getcode(): Re-indent to be consistent with the rest of the file.
* set_error(): Handle construction of pyexpat.error exceptions. TheyFred Drake2001-02-081-153/+456
| | | | | | | | | | | | | | now carry a 'code' attribute that gives the Expat error number. Added support for additional handlers for Expat 1.95.*, including XmlDeclHandler, EntityDeclHandler, ElementDeclHandler, and AttlistDeclHandler. Associated constants are in the 'model' sub-object. Added two new attributes to the parser object: ordered_attributes and specified_attributes. These are used to control how attributes are reported and which attributes are reported.
* Support older PYTHON_API_VERSIONs for backwards compatibility.Martin v. Löwis2001-02-061-2/+7
|
* Fix arguments for PyFrame_New(). The previous checkin used the wrongJeremy Hylton2001-01-251-1/+0
| | | | arguments, which were based on an interim development API.
* PEP 227 implementationJeremy Hylton2001-01-251-1/+5
| | | | Track changes to PyFrame_New() and PyFuntion_New().
* Fix off-by-one error in array size.Martin v. Löwis2001-01-221-1/+1
|
* Fixed teensy memory leak, but doesn't help test_sax on Windows.Tim Peters2001-01-221-0/+1
|
* Fix typo: MICRO instead of MINOR.Martin v. Löwis2001-01-211-1/+1
|
* Merge with 1.25 of PyXML:Martin v. Löwis2001-01-211-40/+355
| | | | | | | | | | | | Participate in garbage collection if available. Potentially decref handlers in clear_handlers. Partially reindent. Put synthetic frame object on the stack to support better error output. Expose Python codecs to pyexpat. Add new Expat 1.2 handlers and API. Fix memory leak: release self->handlers. Do not expect PyModule_AddObject and PyModule_AddStringConstant in 2.0b1. Raise exception in ParseFile.
* Mark the "encoding" parameter to ExternalEntityParserCreate() as optionalFred Drake2001-01-031-1/+1
| | | | in the docstring.
* When using the latest & greatest version of Expat (currently in the ExpatFred Drake2000-12-211-0/+7
| | | | CVS repository), provide the library version information.
* Add returns_unicode to the __members__ list.Fred Drake2000-12-161-1/+2
| | | | Fix a small style consistency nit.
* ParserCreate(): Added test that the namespace_separator value, if given,Fred Drake2000-10-291-0/+9
| | | | | | | has the required length. initpyexpat(): Provide the type object for the ParserCreate() return value as XMLParserType.
* PyModule_AddStringConstant(): Make this static since it isn't usedFred Drake2000-09-291-1/+5
| | | | elsewhere in 1.5.2.