stchris / untangle

Converts XML to Python objects
MIT License
612 stars 83 forks source link

__hasattribute__ doesn't work with 3.6 (Pull Request #57) #58

Closed CarlosSolrac closed 4 years ago

CarlosSolrac commented 6 years ago

When "__hasattribute__" executes the line "return any(self.children, lambda x: x._name == name)" it fails with the error message: TypeError: any() takes exactly one argument (2 given)

My suggested fix is in pull request #57. https://github.com/stchris/untangle/pull/57

Thank you in advance.

The issue can be reproduced with the following code snippet when running Python 3.6:

import untangle
o = untangle.parse('''
                    <root>
                     <child name="child1">
                        <subchild name="sub1"/>
                     </child>
                     <child name="child2"/>
                     <child name="child3">
                        <subchild name="sub2"/>
                        <subchild name="sub3"/>
                     </child>
                    </root>
                     ''')               
o.__hasattribute__('child') 

Error message TypeError: any() takes exactly one argument (2 given)

stchris commented 4 years ago

Thank you so much for your submission and your fix. I merged the PR and will include it in the next release.