Skip to content

Commit

Permalink
Fix Python 2.7 mac on Travis.
Browse files Browse the repository at this point in the history
See pypa/virtualenv#1555

Also fix 64-bit windows Python 2; apparently the documentation I read was outdated.
  • Loading branch information
jamadden committed Feb 15, 2020
1 parent 8f73390 commit 68e194a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,10 @@ script:
# coverage makes PyPy run about 3x slower, but the tests only take
# .4s to begin with (the whole process takes about 1.5), so that's
# still only 4.5s, which is maneagable.
- coverage run -m zope.testrunner --test-path=. --auto-color --auto-progress
- python -m coverage run -m zope.testrunner --test-path=. --auto-color --auto-progress

after_success:
- coveralls
- python -m coveralls
- |
if [[ $TRAVIS_TAG && "$TRAVIS_OS_NAME" == "osx" ]]; then
pip install twine
Expand Down
13 changes: 11 additions & 2 deletions persistent/list.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
# The slice object you get when you write list[:]
_SLICE_ALL = slice(None, None, None)


class PersistentList(UserList, persistent.Persistent):
"""A persistent wrapper for list objects.
Expand Down Expand Up @@ -72,8 +73,16 @@ def __setslice__(self, i, j, other):
self._p_changed = 1

def __delslice__(self, i, j):
# For list[:], i and j become 0 and sys.maxint
needs_changed = i == 0 and j == sys.maxint and bool(self)
# On Python 2, the slice dunders, like ``__delslice__``,
# are documented as getting ``(0, sys.maxsize)`` as the
# arguments for list[:]. Prior to 2.7.10, it was
# incorrectly documented as ``(0, sys.maxint)``, but that
# usually worked because ``sys.maxsize`` and
# ``sys.maxint`` are usually the same. But on 64-bit
# Windown, where ``sizeof(int) == sizeof(long) == 4``,
# they're different (``sys.maxsize`` is bigger). See
# https://bugs.python.org/issue23645
needs_changed = i == 0 and j == sys.maxsize and bool(self)
self.__super_delslice(i, j)
if needs_changed:
self._p_changed = 1
Expand Down

0 comments on commit 68e194a

Please sign in to comment.