Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Still doesn't work with Python 3.6 #3

Closed
AdamWill opened this issue Dec 22, 2016 · 8 comments
Closed

Still doesn't work with Python 3.6 #3

AdamWill opened this issue Dec 22, 2016 · 8 comments

Comments

@AdamWill
Copy link

1d34223 is not sufficient to make defusedxml work properly with Python 3.6. It stops defusedxml outright choking in _get_py3_cls, but it doesn't work properly. It results in common._generate_etree_functions() failing, as can be seen in the 10 failed tests from the Travis run for that commit.

I naively attempted just changing the if PY26 or PY31: condition in _generate_etree_functions() to if PY26 or PY31 or sys.version_info >= (3, 6): , but that's not good enough either because that code really is tailored to the Python 2.6 / 3.1 implementation; it doesn't work at all for the Python 3.6 implementation. It seems like we need an entirely new approach to defusing iterparse for 3.6, but I'm not smart enough to write that. At least, not at this time in the morning...

This is a bit of a problem for us (Fedora) as Python 3.6 landed in Rawhide today, and now defusedxml won't install and can't be rebuilt (unless we ignore the fact that it's broken and disable the tests...), and several things that depend on it can't install or be rebuilt either.

@AdamWill
Copy link
Author

also reported this to upstream Python, since the Python docs explicitly endorse the use of defusedxml: https://bugs.python.org/issue29050

@AdamWill
Copy link
Author

#4 should fix this, I think.

@justuswilhelm
Copy link

This seems to break my installation of python3-openid==3.0.10. If there is anything I can do to help (stack traces, debugging, testing, etc.) Please let me know.
This is what I'm seeing right now:

Traceback (most recent call last):
...
  File "/Users/justusperlwitz/mailops/env/lib/python3.6/site-packages/openid/consumer/consumer.py", line 196, in <module>
    from openid.consumer.discover import discover, OpenIDServiceEndpoint, \
  File "/Users/justusperlwitz/mailops/env/lib/python3.6/site-packages/openid/consumer/discover.py", line 22, in <module>
    from openid.yadis.etxrd import nsTag, XRDSError, XRD_NS_2_0
  File "/Users/justusperlwitz/mailops/env/lib/python3.6/site-packages/openid/yadis/etxrd.py", line 31, in <module>
    SafeElementTree = importSafeElementTree()
  File "/Users/justusperlwitz/mailops/env/lib/python3.6/site-packages/openid/oidutil.py", line 83, in importSafeElementTree
    return importElementTree(module_names)
  File "/Users/justusperlwitz/mailops/env/lib/python3.6/site-packages/openid/oidutil.py", line 106, in importElementTree
    ElementTree = __import__(mod_name, None, None, ['unused'])
  File "/Users/justusperlwitz/mailops/env/lib/python3.6/site-packages/defusedxml/cElementTree.py", line 16, in <module>
    from .ElementTree import DefusedXMLParser, _IterParseIterator
  File "/Users/justusperlwitz/mailops/env/lib/python3.6/site-packages/defusedxml/ElementTree.py", line 62, in <module>
    _XMLParser, _iterparse, _IterParseIterator, ParseError = _get_py3_cls()
  File "/Users/justusperlwitz/mailops/env/lib/python3.6/site-packages/defusedxml/ElementTree.py", line 56, in _get_py3_cls
    _IterParseIterator = pure_pymod._IterParseIterator
AttributeError: module 'xml.etree.ElementTree' has no attribute '_IterParseIterator'

@AdamWill
Copy link
Author

@justuswilhelm try with https://github.com/tiran/defusedxml/pull/4.patch .

@justuswilhelm
Copy link

Thanks so much for the patch, I was able to fix the issue until everything is merged to upstream.

jelmer added a commit to jelmer/dystros that referenced this issue Jan 15, 2017
@ThomasWaldmann
Copy link

https://travis-ci.org/nsupdate-info/nsupdate.info/jobs/193934880 having same issue, can't test nsupdate.info on py36.

@tiran
Copy link
Owner

tiran commented Feb 10, 2017

I have releases 0.5.0 yesterday.

@tiran tiran closed this as completed Feb 10, 2017
@AdamWill
Copy link
Author

Thanks a lot. I have sent 0.5.0 out for Fedora 24, 25 and Rawhide, and EPEL 7. I sent 0.4.1 to EPEL 6, as EL 6 is still on Python 2.6.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants