[Python-checkins] r51322 - in python/trunk: Lib/test/test_xml_etree_c.py Modules/_elementtree.c

Neal Norwitz nnorwitz at gmail.com
Wed Aug 16 19:12:54 CEST 2006


Can you add a NEWS entry too? -- n

On 8/16/06, fredrik.lundh <python-checkins at python.org> wrote:
> Author: fredrik.lundh
> Date: Wed Aug 16 18:47:07 2006
> New Revision: 51322
>
> Modified:
>    python/trunk/Lib/test/test_xml_etree_c.py
>    python/trunk/Modules/_elementtree.c
> Log:
> SF#1534630
>
> ignore data that arrives before the opening start tag
>
>
>
> Modified: python/trunk/Lib/test/test_xml_etree_c.py
> ==============================================================================
> --- python/trunk/Lib/test/test_xml_etree_c.py   (original)
> +++ python/trunk/Lib/test/test_xml_etree_c.py   Wed Aug 16 18:47:07 2006
> @@ -204,6 +204,17 @@
>          "<?xml version='1.0' encoding='%s'?><xml />" % encoding
>          )
>
> +def bug_1534630():
> +    """
> +    >>> bob = ET.TreeBuilder()
> +    >>> e = bob.data("data")
> +    >>> e = bob.start("tag", {})
> +    >>> e = bob.end("tag")
> +    >>> e = bob.close()
> +    >>> serialize(ET, e)
> +    '<tag />'
> +    """
> +
>  def test_main():
>      from test import test_xml_etree_c
>      test_support.run_doctest(test_xml_etree_c, verbosity=True)
>
> Modified: python/trunk/Modules/_elementtree.c
> ==============================================================================
> --- python/trunk/Modules/_elementtree.c (original)
> +++ python/trunk/Modules/_elementtree.c Wed Aug 16 18:47:07 2006
> @@ -48,7 +48,7 @@
>
>  #include "Python.h"
>
> -#define VERSION "1.0.6-snapshot"
> +#define VERSION "1.0.6"
>
>  /* -------------------------------------------------------------------- */
>  /* configuration */
> @@ -1599,6 +1599,10 @@
>  treebuilder_handle_data(TreeBuilderObject* self, PyObject* data)
>  {
>      if (!self->data) {
> +        if (self->last == (ElementObject*) Py_None) {
> +            /* ignore calls to data before the first call to start */
> +            Py_RETURN_NONE;
> +        }
>          /* store the first item as is */
>          Py_INCREF(data); self->data = data;
>      } else {
> _______________________________________________
> Python-checkins mailing list
> Python-checkins at python.org
> http://mail.python.org/mailman/listinfo/python-checkins
>


More information about the Python-checkins mailing list