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

Fix startup and syntax in python3 #3

Merged
merged 21 commits into from
Jun 5, 2018
Merged

Fix startup and syntax in python3 #3

merged 21 commits into from
Jun 5, 2018

Conversation

pbauer
Copy link
Member

@pbauer pbauer commented Jan 29, 2018

Currently Travis CI is allowed to fail the Python 3 tests. They should be fixed before merging this PR.

@tseaver
Copy link
Member

tseaver commented Jan 31, 2018

FWIW, I just verified that the tests pass on the current tip of master.

@@ -25,6 +25,9 @@
from Products.TemporaryFolder.TemporaryFolder import MountedTemporaryFolder
from ZODB.POSException import ConflictError, \
ReadConflictError, BTreesConflictError

from __future__ import print_function

Choose a reason for hiding this comment

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

from __future__ must be first line of code in the script (except for module docstring, comments, blank lines etc)

@@ -20,7 +20,7 @@
import os
import random
import sys
import thread
from six.moves import _thread as thread
Copy link

@davilima6 davilima6 Feb 5, 2018

Choose a reason for hiding this comment

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

minor: should be sorted before raw 'import's

values = list(self._data[key].values())
DEBUG and TLOG('_do_finalize_work: values to notify from ts %s '
'are %s' % (key, `list(values)`))
'are %r' % (key, list(values)))

Choose a reason for hiding this comment

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

values is already a list, no need to coerce again.

@@ -17,15 +17,15 @@
import os
import random
import sys
import thread
from six.moves import _thread as thread

Choose a reason for hiding this comment

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

should be sorted before imports

return "id: %s, token: %s, content keys: %s" % (
self.id, self.token, `self.keys()`
return "id: %s, token: %s, content keys: %r" % (
self.id, self.token, self.keys()
Copy link

@davilima6 davilima6 Feb 5, 2018

Choose a reason for hiding this comment

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

self.keys() needs to be converted to a list in Python 3, otherwise the repr contains a dict_keys() wrapper string

@@ -322,7 +324,7 @@ def _move_item(self, k, current_ts, default=None):
DEBUG and TLOG(
'_move_item: keys for found_ts %s (bucket %s): %s' % (
found_ts, id(self._data[found_ts]),
`list(self._data[found_ts].keys())`)
repr(list(self._data[found_ts].keys())))

Choose a reason for hiding this comment

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

you can probably drop the repr here.

Copy link
Member

Choose a reason for hiding this comment

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

Maybe by changing the last %s to %r in the string.

Copy link
Member

@icemac icemac left a comment

Choose a reason for hiding this comment

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

As Tres pointed out: The tests are running fine on master and should run here, too.

Michael Howitz and others added 3 commits March 22, 2018 10:53
Temporarily allow TravisCI failures for Python 3.
Copy link
Member

@icemac icemac left a comment

Choose a reason for hiding this comment

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

Now Python 3 creates invalid browser IDs.

t = time()
stamp = TimeStamp(*gmtime(t)[:5]+(t % 60,))
ts = b2a(stamp.raw()).split(b'=')[:-1][0]
return ts.replace(b'+/', b'-.')
Copy link
Member

Choose a reason for hiding this comment

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

This method now returns bytes. This breaks getNewBrowserId which now created invalid browser ids on Python 3 because they contain the b of the bytes object. But maybe getNewBrowserId should return bytes to fix this.

rbu and others added 3 commits May 16, 2018 10:40
Fixes
BrowserIdManager.py:51: DeprecationWarning: invalid escape sequence \?
and similar warnings.
@rbu rbu force-pushed the python3 branch 2 times, most recently from 440c517 to d9a027a Compare May 17, 2018 09:22
The Python 3 variant of the "maketrans" logic was faulty (it would not
replace "+" by "-" and "/" by ".") causing sporadic test failures.
Copy link
Member

@icemac icemac left a comment

Choose a reason for hiding this comment

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

LGTM. I changes the things myself I want to have changed.

@icemac icemac merged commit ad2aee9 into master Jun 5, 2018
@rbu rbu deleted the python3 branch June 5, 2018 09:11
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

Successfully merging this pull request may close these issues.

6 participants