Skip to content

Commit fbe0393

Browse files
author
Kenneth Reitz
committed
cstring io fix for py3
1 parent b82e72e commit fbe0393

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

test_requests.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
11
#!/usr/bin/env python
22
# -*- coding: utf-8 -*-
33

4+
import sys
45
import unittest
56

6-
try:
7-
from cStringIO import StringIO
8-
except ImportError:
9-
from StringIO import StringIO
7+
if sys.version_info >= (3,0):
8+
from io import StringIO
9+
else:
10+
try:
11+
from cStringIO import StringIO
12+
except ImportError:
13+
from StringIO import StringIO
1014

1115
import requests
1216

0 commit comments

Comments
 (0)