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

Python 3 #46

Open
mnot opened this issue Jul 1, 2021 · 1 comment
Open

Python 3 #46

mnot opened this issue Jul 1, 2021 · 1 comment

Comments

@mnot
Copy link
Collaborator

mnot commented Jul 1, 2021

I looked into what it would take to convert to 3, since 2 is no longer supported.

The short list is:

  • Run 2to3 -wn .
  • Add #!/usr/bin/env python3 where appropriate
  • change rfc822 to email.utils in src/feedvalidator/validators.py
  • change new.instgancemethod to types.methodType in src/validtest.py
  • explicitly set encoding for the XML file when opening in src/validtest.py's getDescription
  • change UnicodeError to UnicodeDecodeError or UnicodeEncodeError as appropriate
  • explicitly convert the result of .encode('idna') back to a string (various places)
  • in src/tests/testXmlEncoding.py, change many things to binary literals
  • avoid using xmlEncoding.asUTF8 in src/feedvalidator/__init__.py

Where I got stuck was in how the code uses object inheritance so extensively; thanks to the switch to new-style objects, this doesn't work any more, and the trivial fix (removing things like validatorBase to avoid duplication) seems to mess with the processing model, causing many errors. E.g.,

TypeError: Cannot create a consistent method resolution
order (MRO) for bases text, rfc2396_full

Fixing this looks pretty invasive, and I'm not confident enough in this codebase to make the necessary changes. If someone is interested in helping out, I can do a PR for the things above and work with them on the solution.

@rubys
Copy link
Owner

rubys commented Jul 1, 2021

Go for it! I will try to answer any questions, and may even make some fixes.

@mnot mnot mentioned this issue Jul 19, 2021
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

2 participants