Commit Graph

172 Commits

Author SHA1 Message Date
Victor Stinner b64049183c Issue #18203: Replace malloc() with PyMem_Malloc() in Python modules
Replace malloc() with PyMem_Malloc() when the GIL is held, or with
PyMem_RawMalloc() otherwise.
2013-07-07 16:21:41 +02:00
Christian Heimes 721724270d Fix segfault in pyexpat.c caused by 84375
u can be NULL, use XDECREF
2013-06-29 21:49:27 +02:00
Christian Heimes b582155789 Fix memory leak in pyexpat PyUnknownEncodingHandler
CID 1040367 (#1 of 1): Resource leak (RESOURCE_LEAK)
leaked_storage: Variable u going out of scope leaks the storage it points to.
2013-06-29 20:43:13 +02:00
Eli Bendersky 6dc32b34dd Issue #13612: handle unknown encodings without a buffer overflow.
This affects pyexpat and _elementtree. PyExpat_CAPI now exposes a new
function - DefaultUnknownEncodingHandler.

Based on a patch by Serhiy Storchaka.
2013-05-25 05:25:48 -07:00
Serhiy Storchaka 66d53fa9ad Issue #16986: ElementTree now correctly parses a string input not only when
an internal XML encoding is UTF-8 or US-ASCII.
2013-05-22 17:07:51 +03:00
Serhiy Storchaka 36b365ccff Issue #17089: Expat parser now correctly works with string input not only when
an internal XML encoding is UTF-8 or US-ASCII.  It now accepts bytes and
strings larger than 2 GiB.
2013-02-04 18:28:01 +02:00
Serhiy Storchaka 43536e9e37 Issue #17089: Expat parser now correctly works with string input not only when
an internal XML encoding is UTF-8 or US-ASCII.  It now accepts bytes and
strings larger than 2 GiB.
2013-02-04 18:26:15 +02:00
Georg Brandl d37b9d7e1b Port #16012 fix: parameter parsing regression in pyexpat parser UseForeignDTD() method. 2012-09-24 13:41:52 +02:00
Antoine Pitrou 721738fbee Issue #15604: Update uses of PyObject_IsTrue() to check for and handle errors correctly.
Patch by Serhiy Storchaka.
2012-08-15 23:20:39 +02:00
Antoine Pitrou 6f430e4963 Issue #15604: Update uses of PyObject_IsTrue() to check for and handle errors correctly.
Patch by Serhiy Storchaka.
2012-08-15 23:18:25 +02:00
Christian Heimes e26d3af7ee Issue #16012: Fix a regression in pyexpat. The parser's UseForeignDTD()
method doesn't require an argument again.
2012-09-24 13:17:08 +02:00
Eli Bendersky 2b6b73e7e1 Issue #14007: implement doctype() method calling in XMLParser of _elementtree.
Includes exposing a doctype handler from expat through pyexpat.
2012-06-01 11:32:34 +03:00
Gregory P. Smith c362cbda97 Fixes Issue 14234: fix for the previous commit, keep compilation when
using --with-system-expat working when the system expat does not have
salted hash support.
2012-03-14 18:11:46 -07:00
Gregory P. Smith 2522771e47 Fixes Issue 14234: fix for the previous commit, keep compilation when
using --with-system-expat working when the system expat does not have
salted hash support.
2012-03-14 18:10:37 -07:00
Gregory P. Smith 70c9c4dca6 Fixes Issue #14234: CVE-2012-0876: Randomize hashes of xml attributes
in the hash table internal to the pyexpat module's copy of the expat
library to avoid a denial of service due to hash collisions.
Patch by David Malcolm with some modifications by the expat project.
2012-03-14 15:00:39 -07:00
Gregory P. Smith 373c740924 Fixes Issue #14234: CVE-2012-0876: Randomize hashes of xml attributes
in the hash table internal to the pyexpat module's copy of the expat
library to avoid a denial of service due to hash collisions.
Patch by David Malcolm with some modifications by the expat project.
2012-03-14 14:41:00 -07:00
Gregory P. Smith 8e91cf6a5e Fixes issue #14234: CVE-2012-0876: Randomize hashes of xml attributes
in the hash table internal to the pyexpat module's copy of the expat
library to avoid a denial of service due to hash collisions.
Patch by David Malcolm with some modifications by the expat project.
2012-03-14 14:26:55 -07:00
Martin v. Löwis bd928fef42 Rename _Py_identifier to _Py_IDENTIFIER. 2011-10-14 10:20:37 +02:00
Martin v. Löwis 1ee1b6fe0d Use identifier API for PyObject_GetAttrString. 2011-10-10 18:11:30 +02:00
Victor Stinner 9e5bd6c544 pyexat uses the new Unicode API 2011-10-01 01:05:40 +02:00
Martin v. Löwis d63a3b8beb Implement PEP 393. 2011-09-28 07:41:54 +02:00
Benjamin Peterson fdb2d909a4 merge 3.1 2011-05-31 21:38:49 -05:00
Benjamin Peterson 52e61449e3 return NULL on error 2011-05-31 21:38:15 -05:00
Benjamin Peterson 8c6f88efa2 remove __version__s dependent on subversion keyword expansion (closes #12221) 2011-05-31 20:52:17 -05:00
Benjamin Peterson 9e3e1c6e4e merge 3.2 (#12221) 2011-05-31 19:07:45 -05:00
Benjamin Peterson 0aa71f7982 merge 3.1 (#12221) 2011-05-31 19:06:17 -05:00
Benjamin Peterson a22c98de85 simply use the Python version for pyexpat.__version__ #12221 2011-05-31 18:59:49 -05:00
Ezio Melotti d60b74cb66 Merge with 3.2. 2011-04-11 03:51:14 +03:00
Ezio Melotti fdb2df49bd Remove unnecessary call to PyErr_Clear. 2011-04-11 03:48:57 +03:00
Victor Stinner 499dfcf29d Issue #10833: Use PyUnicode_FromFormat() and PyErr_Format() instead of
PyOS_snprintf().
2011-03-21 13:26:24 +01:00
Victor Stinner 95f1dfc955 Issue #9566: Fix pyparse.xmlparser.ParseFile()
Fix readinst() if file.read(n) returns a bytes object longer than n:
return -1 instead of the the buffer size to raise an exception.
Simplify also the function code.
2011-01-10 23:00:36 +00:00
Victor Stinner 9d6f9367ea Issue #9566: PyUnicode_FromFormatV() doesn't support %zi, use %zd instead 2011-01-04 22:00:04 +00:00
Victor Stinner ed7e222454 Issue #9566: explain why (int)len cannot underflow 2011-01-04 21:58:10 +00:00
Victor Stinner 0fcab4a3ed Issue #9566: use Py_ssize_t instead of int 2011-01-04 12:59:15 +00:00
Antoine Pitrou 23683ef26d Issue #10333: Remove ancient GC API, which has been deprecated since
Python 2.2.
2011-01-04 00:00:31 +00:00
Alexander Belopolsky e239d23e8c Issue #6697: Fixed instances of _PyUnicode_AsString() result not checked for NULL 2010-12-08 23:31:48 +00:00
Georg Brandl 5bbbf1d9f9 Merged revisions 85536 via svnmerge from
svn+ssh://svn.python.org/python/branches/py3k

........
  r85536 | georg.brandl | 2010-10-15 18:26:08 +0200 (Fr, 15 Okt 2010) | 1 line

  #9054: fix crash when using pyexpat with a system expat lib version 2.0.1.
........
2010-10-24 14:20:36 +00:00
Georg Brandl c01537f742 #9054: fix crash when using pyexpat with a system expat lib version 2.0.1. 2010-10-15 16:26:08 +00:00
Georg Brandl b4dac71a87 #5355: Provide mappings from Expat error numbers to string descriptions and backwards, in order to actually make it possible to analyze error codes provided by ExpatError. 2010-10-15 14:46:48 +00:00
Georg Brandl 5e1fdacc36 Remove compatibility code for Python < 2.1, < 2.2 and < 2.4. 2010-09-11 06:41:30 +00:00
Victor Stinner b4ba986a71 Issue #9402: pyexpat uses Py_DECREF() instead of PyObject_DEL()
Fix a crash if Python is compiled in pydebug mode.
2010-09-10 22:25:19 +00:00
Benjamin Peterson 4e7f285252 remove dead code #9292 2010-08-08 16:54:58 +00:00
Antoine Pitrou 7f14f0d8a0 Recorded merge of revisions 81032 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k

................
  r81032 | antoine.pitrou | 2010-05-09 17:52:27 +0200 (dim., 09 mai 2010) | 9 lines

  Recorded merge of revisions 81029 via svnmerge from
  svn+ssh://pythondev@svn.python.org/python/trunk

  ........
    r81029 | antoine.pitrou | 2010-05-09 16:46:46 +0200 (dim., 09 mai 2010) | 3 lines

    Untabify C files. Will watch buildbots.
  ........
................
2010-05-09 16:14:21 +00:00
Antoine Pitrou f95a1b3c53 Recorded merge of revisions 81029 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r81029 | antoine.pitrou | 2010-05-09 16:46:46 +0200 (dim., 09 mai 2010) | 3 lines

  Untabify C files. Will watch buildbots.
........
2010-05-09 15:52:27 +00:00
Alexandre Vassalotti 7b82b40a47 Merged revisions 72487-72488,72879 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r72487 | jeffrey.yasskin | 2009-05-08 17:51:06 -0400 (Fri, 08 May 2009) | 7 lines

  PyCode_NewEmpty:
  Most uses of PyCode_New found by http://www.google.com/codesearch?q=PyCode_New
  are trying to build an empty code object, usually to put it in a dummy frame
  object. This patch adds a PyCode_NewEmpty wrapper which lets the user specify
  just the filename, function name, and first line number, instead of also
  requiring lots of code internals.
........
  r72488 | jeffrey.yasskin | 2009-05-08 18:23:21 -0400 (Fri, 08 May 2009) | 13 lines

  Issue 5954, PyFrame_GetLineNumber:
  Most uses of PyCode_Addr2Line
  (http://www.google.com/codesearch?q=PyCode_Addr2Line) are just trying to get
  the line number of a specified frame, but there's no way to do that directly.
  Forcing people to go through the code object makes them know more about the
  guts of the interpreter than they should need.

  The remaining uses of PyCode_Addr2Line seem to be getting the line from a
  traceback (for example,
  http://www.google.com/codesearch/p?hl=en#u_9_nDrchrw/pygame-1.7.1release/src/base.c&q=PyCode_Addr2Line),
  which is replaced by the tb_lineno field.  So we may be able to deprecate
  PyCode_Addr2Line entirely for external use.
........
  r72879 | jeffrey.yasskin | 2009-05-23 19:23:01 -0400 (Sat, 23 May 2009) | 14 lines

  Issue #6042:
  lnotab-based tracing is very complicated and isn't documented very well.  There
  were at least 3 comment blocks purporting to document co_lnotab, and none did a
  very good job. This patch unifies them into Objects/lnotab_notes.txt which
  tries to completely capture the current state of affairs.

  I also discovered that we've attached 2 layers of patches to the basic tracing
  scheme. The first layer avoids jumping to instructions that don't start a line,
  to avoid problems in if statements and while loops.  The second layer
  discovered that jumps backward do need to trace at instructions that don't
  start a line, so it added extra lnotab entries for 'while' and 'for' loops, and
  added a special case for backward jumps within the same line. I replaced these
  patches by just treating forward and backward jumps differently.
........
2009-07-21 04:30:03 +00:00
Matthias Klose ab2b7559e2 - Issue #5590: Remove unused global variable in pyexpat extension. 2009-06-22 13:05:52 +00:00
Benjamin Peterson b173f7853e add a replacement API for PyCObject, PyCapsule #5630
All stdlib modules with C-APIs now use this.

Patch by Larry Hastings
2009-05-05 22:31:58 +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
Mark Dickinson 211c625829 Issue #1717, stage 2: remove uses of tp_compare in Modules and most
Objects.
2009-02-01 10:28:51 +00:00
Marc-André Lemburg 4cc0f24857 Rename PyUnicode_AsString -> _PyUnicode_AsString and
PyUnicode_AsStringAndSize -> _PyUnicode_AsStringAndSize to mark
them for interpreter internal use only.

We'll have to rework these APIs or create new ones for the
purpose of accessing the UTF-8 representation of Unicode objects
for 3.1.
2008-08-07 18:54:33 +00:00