Commit Graph

299 Commits

Author SHA1 Message Date
Eli Bendersky f90fc68db4 fix whitespace woes 2012-07-17 15:09:56 +03:00
Eli Bendersky 43cc5f29a8 Optimize tostringlist by taking the stream class outside the function. It's now 2x faster on short calls. Related to #1767933 2012-07-17 15:09:12 +03:00
Eli Bendersky 426e248feb Preserve the invariant tostring(elem) == b''.join(tostringlist(elem)) and add a test to make sure it keeps working 2012-07-17 05:45:11 +03:00
Eli Bendersky 00f402bfcb Close #1767933: Badly formed XML using etree and utf-16. Patch by Serhiy Storchaka, with some minor fixes by me 2012-07-15 06:02:22 +03:00
Eli Bendersky 8a80502d2c Issue #15296: Fix minidom.toxml/toprettyxml for non-unicode encodings. Patch by Serhiy Storchaka, with some minor style adjustments by me. 2012-07-13 09:52:39 +03:00
Florent Xicluna a1c974a66d Minor refactoring in xml.etree.ElementTree doctype parser. 2012-07-07 13:16:44 +02:00
Eli Bendersky 27cbb19ae5 Removed _SimpleElementPath and its flaky test. The test monkey-patches the module, which causes other failures and fails itself depending on the order tests are run. 2012-06-15 09:03:19 +03:00
Eli Bendersky 64d11e60f2 Replace the iter/itertext methods of Element in _elementtree with true C implementations, instead of the bootstrapped Python code. In addition to being cleaner (removing the last remains of the bootstrapping code in _elementtree), this gives a 10x performance boost for iter() on large documents.
Also reorganized the tests a bit to be more robust.
2012-06-15 07:42:50 +03:00
Eli Bendersky 737b173355 Issue 14814: Add namespaces keyword arg to find(*) methods in _elementtree.
Add attrib keyword to Element and SubElement in _elementtree.
Patch developed with Ezio Melotti.
2012-05-29 06:02:56 +03:00
Eli Bendersky 396e8fcf36 Issue #13782: streamline argument type-checking in ET.Element
append, extend and insert now consistently type-check their argument in both
the C and Python implementations, and raise TypeError for non-Element
argument.

Added tests
2012-03-23 14:24:20 +02:00
Florent Xicluna 8cf4b51fa4 xml.dom.minidom: add more __slots__ to limit resource usage. 2012-03-05 12:37:02 +01:00
Florent Xicluna 6c75301eb6 xml.dom: fix typo, drop unused imports. 2012-03-05 12:35:15 +01:00
Florent Xicluna fb06746852 Flatten nested try ... finally, try ... except. 2012-03-05 11:42:49 +01:00
Florent Xicluna 75b5e7ee15 Issue #14007: accept incomplete TreeBuilder objects (missing start/end/data/close) for the Python implementation as well. Add disabled tests for the doctype() method. 2012-03-05 10:42:19 +01:00
Martin v. Löwis 67245a6ed4 Issue #14168: Check for presence of _attrs before accessing it. 2012-03-05 07:01:49 +01:00
Eli Bendersky 092af1fc5c Issue #14128: Exposing Element as an actual type from _elementtree, rather than a factory function.
This makes the C implementation more aligned with the Python implementation.
Also added some tests to ensure that Element is now a type and that it can
be subclassed.
2012-03-04 07:14:03 +02:00
Martin v. Löwis 7b77188e89 Create _attr/_attrNS lazily. 2012-02-19 20:55:05 +01:00
Martin v. Löwis 14aa280de2 Use __slots__ throughout instead of __dict__, to reduce the memory usage. 2012-02-19 20:25:12 +01:00
Florent Xicluna 1639505c38 fix the _namespace_map cleanup for cElementTree tests. 2012-02-16 23:28:35 +01:00
Florent Xicluna a72a98f24a Issue #13988: cElementTree is deprecated and the _elementtree accelerator is automatically used whenever available. 2012-02-13 11:03:30 +01:00
Florent Xicluna f4bdf4e478 Issue #13988: move the python bootstrap code to cElementTree.py, and remove obsolete code for Python 2.4 and 2.5. 2012-02-11 11:28:16 +01:00
Florent Xicluna 313b2ad1a8 Fix imports in xml.dom. 2011-12-10 21:14:53 +01:00
Ezio Melotti def4728fd6 #4147: merge with 3.2. 2011-11-18 17:36:07 +02:00
Ezio Melotti 8008f2aba0 #4147: minidom's toprettyxml no longer adds whitespace around a text node when it is the only child of an element. Initial patch by Dan Kenigsberg. 2011-11-18 17:34:26 +02:00
Florent Xicluna 91d5193b3a Closes #2892: preserve iterparse events in case of SyntaxError. 2011-11-01 23:31:09 +01:00
Florent Xicluna f24e7e6c41 Merge 3.2: issue #2892 2011-11-01 23:33:14 +01:00
R David Murray 1d30db459d merge #4147: minidom's toprettyxml no longer adds whitespace to text nodes. 2011-10-01 16:22:35 -04:00
R David Murray 791744b070 #4147: minidom's toprettyxml no longer adds whitespace to text nodes.
Patch by Dan Kenigsberg.
2011-10-01 16:19:51 -04:00
Victor Stinner 3663abab59 (merge 3.2) Issue #12451: xml.dom.pulldom: parse() now opens files in binary
mode instead of the text mode (using the locale encoding) to avoid encoding
issues.
2011-07-04 01:27:37 +02:00
Victor Stinner bbdc08ea6e Issue #12451: xml.dom.pulldom: parse() now opens files in binary mode instead
of the text mode (using the locale encoding) to avoid encoding issues.
2011-07-04 01:25:55 +02:00
Victor Stinner 3909da7fca (merge 3.2) Issue #12451: The XInclude default loader of xml.etree now decodes
files from UTF-8 instead of the locale encoding if the encoding is not
specified. It now also opens XML files for the parser in binary mode instead of
the text mode to avoid encoding issues.
2011-06-30 18:11:18 +02:00
Victor Stinner eaf399e335 Issue #12451: The XInclude default loader of xml.etree now decodes files from
UTF-8 instead of the locale encoding if the encoding is not specified. It now
also opens XML files for the parser in binary mode instead of the text mode to
avoid encoding issues.
2011-06-30 18:10:14 +02:00
Benjamin Peterson 8c6f88efa2 remove __version__s dependent on subversion keyword expansion (closes #12221) 2011-05-31 20:52:17 -05:00
Martin v. Löwis 867754e3e3 merge 11164 2011-05-09 08:10:38 +02:00
Martin v. Löwis 2f48d892d4 Stop trying to use _xmlplus in the xml module. Closes #11164.
Patch by Arfrever Frehtes Taifersar Arahesis.
2011-05-09 08:05:43 +02:00
Ezio Melotti 3b3499ba69 #11565: Merge with 3.1. 2011-03-16 11:35:38 +02:00
Ezio Melotti 13925008dc #11565: Fix several typos. Patch by Piotr Kasprzyk. 2011-03-16 11:05:33 +02:00
Ezio Melotti 4969f709cc #11515: Merge with 3.1. 2011-03-15 05:59:46 +02:00
Ezio Melotti 42da663e6f #11515: fix several typos. Patch by Piotr Kasprzyk. 2011-03-15 05:18:48 +02:00
Georg Brandl 90b20675bd #10777: fix iteration over dict keys while mutating the dict. 2010-12-28 10:38:33 +00:00
Georg Brandl c95c91880a Guard against rogue tuples. 2010-12-09 18:26:02 +00:00
Georg Brandl b56c0e24d6 #10661: give QName a nicer repr. 2010-12-09 18:10:27 +00:00
Georg Brandl c524cff3d3 Merged revisions 85530,85532-85534,85538-85543,85546-85548 via svnmerge from
svn+ssh://svn.python.org/python/branches/py3k

........
  r85530 | georg.brandl | 2010-10-15 17:32:05 +0200 (Fr, 15 Okt 2010) | 1 line

  Refrain from using inline suites.
........
  r85532 | georg.brandl | 2010-10-15 18:03:02 +0200 (Fr, 15 Okt 2010) | 1 line

  #7771: reference to documentation of dictview methods and operations.
........
  r85533 | georg.brandl | 2010-10-15 18:07:41 +0200 (Fr, 15 Okt 2010) | 1 line

  #9683: remove broken dead code dealing with nested arguments removed from Py3k, and update the docs and docstrings accordingly.
........
  r85534 | georg.brandl | 2010-10-15 18:19:43 +0200 (Fr, 15 Okt 2010) | 1 line

  #9801: document how list and dict proxies created by Managers behave w.r.t. mutable items.
........
  r85538 | georg.brandl | 2010-10-15 18:35:46 +0200 (Fr, 15 Okt 2010) | 1 line

  #7303: add documentation for useful pkgutil functions and classes.
........
  r85539 | georg.brandl | 2010-10-15 18:42:14 +0200 (Fr, 15 Okt 2010) | 1 line

  Fix issue references.
........
  r85540 | georg.brandl | 2010-10-15 18:42:37 +0200 (Fr, 15 Okt 2010) | 1 line

  #6798: fix wrong docs for the arguments to several trace events.
........
  r85541 | georg.brandl | 2010-10-15 18:53:24 +0200 (Fr, 15 Okt 2010) | 1 line

  #4968: updates to inspect.is* function docs.
........
  r85542 | georg.brandl | 2010-10-15 19:01:15 +0200 (Fr, 15 Okt 2010) | 1 line

  #7790: move table of struct_time members to the actual description of struct_time.
........
  r85543 | georg.brandl | 2010-10-15 19:03:02 +0200 (Fr, 15 Okt 2010) | 1 line

  #4785: document strict argument of JSONDecoder, plus add object_pairs_hook in the docstrings.
........
  r85546 | georg.brandl | 2010-10-15 19:58:45 +0200 (Fr, 15 Okt 2010) | 1 line

  #5762: fix handling of empty namespace in minidom, which would result in AttributeError on toxml().
........
  r85547 | georg.brandl | 2010-10-15 20:00:35 +0200 (Fr, 15 Okt 2010) | 1 line

  #6098: Refrain from claiming DOM level 3 conformance in minidom.
........
  r85548 | georg.brandl | 2010-10-15 21:46:19 +0200 (Fr, 15 Okt 2010) | 1 line

  #10072: assume a bit less knowledge of the FTP protocol in the ftplib docs.
........
2010-11-26 08:42:45 +00:00
Senthil Kumaran ec30b3dd8c Fix Issue10205 - XML QName error when different tags have same QName. 2010-11-09 02:36:59 +00:00
Benjamin Peterson 90b60a61d8 close the source's byte stream 2010-10-31 20:03:32 +00:00
Antoine Pitrou e033e06db0 Issue #10093: ResourceWarnings are now issued when files and sockets are
deallocated without explicit closing.  These warnings are silenced by
default, except in pydebug mode.
2010-10-29 10:38:18 +00:00
Antoine Pitrou 0619ae798d Merged revisions 85858 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k

........
  r85858 | antoine.pitrou | 2010-10-27 20:33:30 +0200 (mer., 27 oct. 2010) | 5 lines

  Issue #5027: The standard `xml` namespace is now understood by
  xml.sax.saxutils.XMLGenerator as being bound to
  http://www.w3.org/XML/1998/namespace.  Patch by Troy J. Farrell.
........
2010-10-27 18:37:51 +00:00
Antoine Pitrou 6b03ee6033 Issue #5027: The standard `xml` namespace is now understood by
xml.sax.saxutils.XMLGenerator as being bound to
http://www.w3.org/XML/1998/namespace.  Patch by Troy J. Farrell.
2010-10-27 18:33:30 +00:00
R. David Murray a90032a3fb #1343: Add short_empty_elements option to XMLGenerator.
Patch and tests by Neil Muller.
2010-10-17 22:46:45 +00:00
Georg Brandl 3844f0d7cd #6098: Refrain from claiming DOM level 3 conformance in minidom. 2010-10-15 18:00:35 +00:00