Skip to content

Commit 86983e2

Browse files
committed
Add purepython fallback. (Merge branch 'purepython')
2 parents 5f55e4c + 8d6a387 commit 86983e2

File tree

5 files changed

+588
-8
lines changed

5 files changed

+588
-8
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@ install:
1212
- cython --cplus msgpack/_packer.pyx
1313
- cython --cplus msgpack/_unpacker.pyx
1414

15-
script: "tox"
15+
script: "tox && MSGPACK_PUREPYTHON=x tox"

msgpack/__init__.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,16 @@
11
# coding: utf-8
22
from msgpack._version import version
33
from msgpack.exceptions import *
4-
from msgpack._packer import pack, packb, Packer
5-
from msgpack._unpacker import unpack, unpackb, Unpacker
4+
5+
import os
6+
if os.environ.get('MSGPACK_PUREPYTHON'):
7+
from msgpack.fallback import pack, packb, Packer, unpack, unpackb, Unpacker
8+
else:
9+
try:
10+
from msgpack._packer import pack, packb, Packer
11+
from msgpack._unpacker import unpack, unpackb, Unpacker
12+
except ImportError:
13+
from msgpack.fallback import pack, packb, Packer, unpack, unpackb, Unpacker
614

715
# alias for compatibility to simplejson/marshal/pickle.
816
load = unpack

0 commit comments

Comments
 (0)