Skip to content

Commit

Permalink
Merge pull request #82 from zopefoundation/issue81
Browse files Browse the repository at this point in the history
 Remove unneeded _compat._b/_u/_native.
  • Loading branch information
jamadden authored Aug 1, 2018
2 parents de8680b + 66d6eab commit 1c7ade5
Show file tree
Hide file tree
Showing 5 changed files with 176 additions and 274 deletions.
5 changes: 4 additions & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
- Reach and maintain 100% test coverage.

- Simplify ``__init__.py``, including removal of an attempted legacy
import of ``persistent.TimeStamp``.
import of ``persistent.TimeStamp``. See `PR 80
<https://github.com/zopefoundation/persistent/pull/80>`_.

- Add support for Python 3.7 and drop support for Python 3.3.

Expand All @@ -27,6 +28,8 @@
- Fix deleting special (``_p``) attributes of a pure-Python persistent
object that overrides ``__delattr__`` and correctly calls ``_p_delattr``.

- Remove some internal compatibility shims that are no longer
necessary. See `PR 82 <https://github.com/zopefoundation/persistent/pull/82>`_.

4.3.0 (2018-07-30)
------------------
Expand Down
25 changes: 1 addition & 24 deletions persistent/_compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,25 +17,12 @@

PURE_PYTHON = os.environ.get('PURE_PYTHON')

if sys.version_info[0] > 2: # pragma: no cover
if sys.version_info[0] > 2:
import copyreg as copy_reg
from collections import UserDict as IterableUserDict
from collections import UserList
from sys import intern

def _u(s):
return s

def _b(s):
if isinstance(s, str):
return s.encode('unicode_escape')
return s

def _native(s):
if isinstance(s, bytes):
return s.decode('unicode_escape')
return s

PYTHON3 = True
PYTHON2 = False

Expand All @@ -44,16 +31,6 @@ def _native(s):
from UserDict import IterableUserDict
from UserList import UserList

def _u(s):
return unicode(s, 'unicode_escape')

def _native(s):
if isinstance(s, unicode):
return s.encode('unicode_escape')
return s

_b = _native

PYTHON3 = False
PYTHON2 = True

Expand Down
4 changes: 1 addition & 3 deletions persistent/tests/test_persistence.py
Original file line number Diff line number Diff line change
Expand Up @@ -1735,7 +1735,6 @@ def test_accessed_with_jar_and_oid_but_not_in_cache(self):
# but because they are newly created, they aren't in the
# pickle cache yet.
# Nothing should blow up when this happens
from persistent._compat import _b
KEY = b'123'
jar = self._makeJar()
c1 = self._makeOne()
Expand All @@ -1753,8 +1752,7 @@ def mru(oid):

def test_accessed_invalidated_with_jar_and_oid_but_no_cache(self):
# This scenario arises in ZODB tests where the jar is faked
from persistent._compat import _b
KEY = _b('123')
KEY = b'123'
class Jar(object):
accessed = False
def __getattr__(self, name):
Expand Down
Loading

0 comments on commit 1c7ade5

Please sign in to comment.