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

[WIP] Python 3 support #51

Merged
merged 55 commits into from
May 16, 2018
Merged

[WIP] Python 3 support #51

merged 55 commits into from
May 16, 2018

Conversation

davisagli
Copy link
Member

@davisagli davisagli commented Jan 24, 2018

I took the existing py3 branch and made some changes to get tests passing on Python 2.7 and 3.6.

The overall approach is:

  • I/O for files in GenericSetup contexts is done as bytes
  • In Python 3, XML is decoded before parsing and encoded after serializing. In Python 2 the file contents are passed on to the parser without decoding. This means that by default, import/export handlers should be working with native strings in both Pythons. If a handler needs bytes in Python 3 or text in Python 2 for a particular case it would need to handle that conversion itself.

I'm not sure if this approach is right so it may be best to try using this to port more of CMF before blessing it.

Looks like some more work may be needed to support 3.4. Zope itself no longer supports Python 3.4.

Closes #51.

tomgross and others added 28 commits August 9, 2017 19:04
python36 still does not work
  $ tox -- --test=test_empty --pdb
This way we don't need to encode strings for every node, which
breaks with Python 3.
This way any changes made there will also apply to all tox environments.
They need to be fed with bytes as their "magic header" is written
as bytes (in the `gzip` module) and the `generateXML` methods also
"return a round-trippable XML representation".
This fixes a number of "a bytes-like object is required, not 'str'"
and "Must be bytes" errors.
@davisagli davisagli requested review from witsch and gotcha January 24, 2018 15:09
Copy link
Member

@dataflake dataflake left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From my point of view the branch is now ready for merging.

@dataflake
Copy link
Member

@icemac you're right, just did that

@dataflake
Copy link
Member

@icemac Please don't merge to master until I have fixed the CMFCore failures with this branch

@dataflake dataflake self-assigned this May 15, 2018
@icemac
Copy link
Member

icemac commented May 15, 2018

@dataflake Don't worry, I'll keep my hands away from this PR. 😁

@dataflake dataflake merged commit 6d67f02 into master May 16, 2018
@davilima6 davilima6 deleted the davisagli-py3 branch June 7, 2018 18:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants