From 0e7a4bfb3ccacca1fcde9a131e76e520cb1a8029 2014-09-29 16:03:07
From: Thomas Kluyver <takowl@gmail.com>
Date: 2014-09-29 16:03:07
Subject: [PATCH] Merge pull request #6571 from Carreau/jsonable

cast unicode to allow json dump
---

diff --git a/IPython/core/magics/basic.py b/IPython/core/magics/basic.py
index 6e39335..827f72c 100644
--- a/IPython/core/magics/basic.py
+++ b/IPython/core/magics/basic.py
@@ -362,9 +362,6 @@ Currently the magic system has the following functions:""",
 Proper color support under MS Windows requires the pyreadline library.
 You can find it at:
 http://ipython.org/pyreadline.html
-Gary's readline needs the ctypes module, from:
-http://starship.python.net/crew/theller/ctypes
-(Note that ctypes is already part of Python versions 2.5 and newer).
 
 Defaulting color scheme to 'NoColor'"""
             new_scheme = 'NoColor'
diff --git a/IPython/utils/_sysinfo.py b/IPython/utils/_sysinfo.py
index 2e58242..a80b029 100644
--- a/IPython/utils/_sysinfo.py
+++ b/IPython/utils/_sysinfo.py
@@ -1,2 +1,2 @@
 # GENERATED BY setup.py
-commit = ""
+commit = u""
diff --git a/IPython/utils/sysinfo.py b/IPython/utils/sysinfo.py
index e3d40c0..db7f291 100644
--- a/IPython/utils/sysinfo.py
+++ b/IPython/utils/sysinfo.py
@@ -61,8 +61,8 @@ def pkg_commit_hash(pkg_path):
                             cwd=pkg_path, shell=True)
     repo_commit, _ = proc.communicate()
     if repo_commit:
-        return 'repository', repo_commit.strip()
-    return '(none found)', '<not found>'
+        return 'repository', repo_commit.strip().decode('ascii')
+    return '(none found)', u'<not found>'
 
 
 def pkg_info(pkg_path):
@@ -152,10 +152,7 @@ def num_cpus():
 
    ncpufuncs = {'Linux':_num_cpus_unix,
                 'Darwin':_num_cpus_darwin,
-                'Windows':_num_cpus_windows,
-                # On Vista, python < 2.5.2 has a bug and returns 'Microsoft'
-                # See http://bugs.python.org/issue1082 for details.
-                'Microsoft':_num_cpus_windows,
+                'Windows':_num_cpus_windows
                 }
 
    ncpufunc = ncpufuncs.get(platform.system(),
diff --git a/IPython/utils/tests/test_sysinfo.py b/IPython/utils/tests/test_sysinfo.py
new file mode 100644
index 0000000..c4f9c3c
--- /dev/null
+++ b/IPython/utils/tests/test_sysinfo.py
@@ -0,0 +1,17 @@
+# coding: utf-8
+"""Test suite for our sysinfo utilities."""
+
+# Copyright (c) IPython Development Team.
+# Distributed under the terms of the Modified BSD License.
+
+import json
+import nose.tools as nt
+
+from IPython.utils import sysinfo
+
+
+def test_json_getsysinfo():
+    """
+    test that it is easily jsonable and don't return bytes somewhere. 
+    """
+    json.dumps(sysinfo.get_sys_info())
diff --git a/setupbase.py b/setupbase.py
index f2f20d1..d0495be 100644
--- a/setupbase.py
+++ b/setupbase.py
@@ -579,7 +579,7 @@ def git_prebuild(pkg_dir, build_cmd=build_py):
             with open(out_pth, 'w') as out_file:
                 out_file.writelines([
                     '# GENERATED BY setup.py\n',
-                    'commit = "%s"\n' % repo_commit,
+                    'commit = u"%s"\n' % repo_commit,
                 ])
     return require_submodules(MyBuildPy)