Skip to content

Commit

Permalink
Under Py3k, 'binary' is an alias for 'bytes'.
Browse files Browse the repository at this point in the history
Also, update changelog to show changes merged from the 'py2_explicit_bytes'
branch.
  • Loading branch information
tseaver committed Apr 26, 2013
1 parent 4da0f4e commit 320af06
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
8 changes: 8 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@ CHANGES
0.4 (unreleased)
----------------

- Added a fork of the Python 2.7 ``_pickle.c``, for use under Python2.
The fork adds support for the Py3k ``protocol 3`` opcodes.

- Added a custom ``binary`` type for use in Python2 apps.
Derived from ``bytes``, the ``binary`` type allows Python2 apps to pickle
binary data using opcodes which will cause it to be unpickled as ``bytes``
on Py3k. Under Py3k, the ``binary`` type is just an alias for ``bytes``.

0.3 (2013-03-18)
----------------

Expand Down
15 changes: 9 additions & 6 deletions src/zodbpickle/__init__.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
# Make a package.
import sys

class binary(bytes):
"""Mark a given string as explicitly binary
if sys.version_info[0] < 3:
class binary(bytes):
"""Mark a given string as explicitly binary
I.e., it should be unpickled as bytes on Py3k, rather than being
forcibly promoted to unicode.
"""
I.e., it should be unpickled as bytes on Py3k, rather than being
forcibly promoted to unicode.
"""
else:
binary = bytes

0 comments on commit 320af06

Please sign in to comment.