Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Python: Dev

ElementTree.tostring() returning str by default in Py3.2

 

 

Python dev RSS feed   Index | Next | Previous | View Threaded


stefan_ml at behnel

Mar 2, 2010, 1:06 AM

Post #1 of 3 (714 views)
Permalink
ElementTree.tostring() returning str by default in Py3.2

Hi,

I just noticed that the xml.etree.ElementTree.tostring() function in Py3.2
returns a str object by default, unless an encoding is specified. This is a
backwards incompatible change compared to ET 1.2. For one, it breaks tons
of tests in lxml's compatibility test suite. Previously, the default
encoding was 'ASCII', and tostring() was guaranteed to always return a byte
string.

According to svn blame, this was changed by GvR in rev. 56841.

Is there any reasoning behind this?

Stefan

_______________________________________________
Python-Dev mailing list
Python-Dev [at] python
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: http://mail.python.org/mailman/options/python-dev/list-python-dev%40lists.gossamer-threads.com


stefan_ml at behnel

Mar 2, 2010, 1:47 AM

Post #2 of 3 (675 views)
Permalink
Re: ElementTree.tostring() returning str by default in Py3.2 [In reply to]

Stefan Behnel, 02.03.2010 10:06:
> I just noticed that the xml.etree.ElementTree.tostring() function in Py3.2
> returns a str object by default, unless an encoding is specified. This is a
> backwards incompatible change compared to ET 1.2. For one, it breaks tons
> of tests in lxml's compatibility test suite. Previously, the default
> encoding was 'ASCII', and tostring() was guaranteed to always return a byte
> string.
>
> According to svn blame, this was changed by GvR in rev. 56841.
>
> Is there any reasoning behind this?

BTW, sorry for not reporting this earlier (the change is from 2007). It
seems that bug 7173 (or some other bug) prevented me from running lxml's
test suite in Py3 for quite a while now. This is the first time in ages
that I get a complete run in Py3.x (x>0).

Stefan

_______________________________________________
Python-Dev mailing list
Python-Dev [at] python
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: http://mail.python.org/mailman/options/python-dev/list-python-dev%40lists.gossamer-threads.com


stefan_ml at behnel

Mar 2, 2010, 11:18 PM

Post #3 of 3 (656 views)
Permalink
Re: ElementTree.tostring() returning str by default in Py3.2 [In reply to]

Stefan Behnel, 02.03.2010 10:06:
> I just noticed that the xml.etree.ElementTree.tostring() function in Py3.2
> returns a str object by default, unless an encoding is specified. This is a
> backwards incompatible change compared to ET 1.2. For one, it breaks tons
> of tests in lxml's compatibility test suite. Previously, the default
> encoding was 'ASCII', and tostring() was guaranteed to always return a byte
> string.
>
> According to svn blame, this was changed by GvR in rev. 56841.
>
> Is there any reasoning behind this?

I filed a bug report for now.

http://bugs.python.org/issue8047

Stefan

_______________________________________________
Python-Dev mailing list
Python-Dev [at] python
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: http://mail.python.org/mailman/options/python-dev/list-python-dev%40lists.gossamer-threads.com

Python dev RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.