Skip to content

Commit 900ed91

Browse files
committed
Version bump to v2.0.0-rc.2
+ Environment fixed for Python 2 + Windows
1 parent 296df71 commit 900ed91

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

codeintel/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = '2.0.0-rc.1'
1+
__version__ = '2.0.0-rc.2'

codeintel/process.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,11 @@
4545
import threading
4646
import warnings
4747

48-
if sys.version_info[0] == 3:
49-
string_types = str
50-
else:
48+
PY2 = sys.version_info[0] == 2
49+
if PY2:
5150
string_types = basestring
51+
else:
52+
string_types = str
5253

5354
#-------- Globals -----------#
5455

@@ -491,17 +492,22 @@ def __init__(self, cmd, cwd=None, env=None, flags=None,
491492
# http://bugs.activestate.com/show_bug.cgi?id=75467
492493
cmd = '"%s"' % (cmd, )
493494

495+
# Environment variables on Python 2 + Windows must be str.
494496
# XXX - subprocess needs to be updated to use the wide string API.
495497
# subprocess uses a Windows API that does not accept unicode, so
496498
# we need to convert all the environment variables to strings
497499
# before we make the call. Temporary fix to bug:
498500
# http://bugs.activestate.com/show_bug.cgi?id=72311
499-
if env:
501+
if env and PY2:
500502
encoding = sys.getfilesystemencoding()
501503
_enc_env = {}
502504
for key, value in env.items():
503505
try:
504-
_enc_env[key.encode(encoding)] = value.encode(encoding)
506+
if not isinstance(key, str):
507+
key = key.encode(encoding)
508+
if not isinstance(value, str):
509+
value = value.encode(encoding)
510+
_enc_env[key] = value
505511
except UnicodeEncodeError:
506512
# Could not encode it, warn we are dropping it.
507513
log.warn("Could not encode environment variable %r "

0 commit comments

Comments
 (0)