[issue14168] minidom behaves differently in 3.3 compared to 3.2

2012-03-02 Thread Vinay Sajip

Vinay Sajip  added the comment:

Upon inspection, _ensure_attributes() is only called in _get_attributes(), 
setAttributeNode() and _set_attribute_node(). The last of these is only called 
by setAttributeNode(), and it would appear that setAttributeNode() is only 
called if there *are* attributes.

_get_attributes() is only called by writexml().

So, calls to public methods getAttribute(), getAttributeNS() and a few others 
are likely to fail because, if there are no attributes in the XML being 
processed, _ensure_attributes() wouldn't get called.

It looks like a bug to me! ;-)

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14168] minidom behaves differently in 3.3 compared to 3.2

2012-03-02 Thread Vinay Sajip

Vinay Sajip  added the comment:

The error which prompted this issue was not caused by external code peeking 
into the internals - it was just my toy test script which did that. The error 
came up in Django testing:

==
ERROR: test_secure_urls (regressiontests.syndication.tests.SyndicationFeedTest)
--
Traceback (most recent call last):
  File 
"/Users/vinay/projects/django3/tests/regressiontests/syndication/tests.py", 
line 255, in test_secure_urls
if link.getAttribute('rel') == 'self':
  File 
"/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/xml/dom/minidom.py",
 line 727, in getAttribute
return self._attrs[attname].value
TypeError: 'NoneType' object is not subscriptable

So, perhaps there is a missing _ensure_attributes() call somewhere.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14168] minidom behaves differently in 3.3 compared to 3.2

2012-03-01 Thread Éric Araujo

Éric Araujo  added the comment:

That would be caused by Martin’s change in 5d27a32ebbcc.  I don’t see the docs 
marking _attrs public, so I think this is not a bug.

--
nosy: +eric.araujo

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14168] minidom behaves differently in 3.3 compared to 3.2

2012-03-01 Thread Vinay Sajip

New submission from Vinay Sajip :

The following script, minidom_test.py,

from xml.dom import minidom

data = b'''
http://www.w3.org/2005/Atom"; version="2.0">
  
https://example.com/blog/
https://example.com/rss2/"; rel="self">

  https://example.com/blog/1/

  
'''

doc = minidom.parseString(data)
for link in doc.getElementsByTagName('link'):
print(link._attrs)

produces different results in Python 3.2 and 3.3:

vinay@eta-oneiric64:~/projects/scratch$ python3.2 minidom_test.py 
{}
{}
vinay@eta-oneiric64:~/projects/scratch$ python3.3 minidom_test.py 
None
None

--
components: Library (Lib), XML
keywords: 3.2regression
messages: 154705
nosy: loewis, r.david.murray, vinay.sajip
priority: normal
severity: normal
status: open
title: minidom behaves differently in 3.3 compared to 3.2
type: behavior
versions: Python 3.3

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com