Skip to content

Commit 301956c

Browse files
author
Doug Blank
committed
Summary of changes:
1) IPython/core/compilerop.py: IronPython __future__ flags are non-standard, Solution try/except; comment added 2) IPython/core/completer.py: __main__ was undefined, due to local mistake in creating IronPython scope; removed this tweak 3) IPython/core/prompts.py: os.getuid() is not defined (IronPython bug; see: https://mail.python.org/pipermail/ironpython-users/2014-February/016812.html) 4) IPython/lib/inputhook.py: ctypes SystemError; comment added 5) IPython/utils/process.py and IPython/utils/_process_cli.py: adds a new _process_cli.py which would handle the processes under cli; fixed os.pathsep 6) IPython/utils/io.py: devnull opened in append mode; changed to "w" 7) New issue: IPython/external/decorator/_decorator.py: IronPython doesn't have _getframes, unless FullFrames is set to true; comment added
1 parent 1694592 commit 301956c

6 files changed

Lines changed: 15 additions & 14 deletions

File tree

IPython/core/compilerop.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,12 @@
4343

4444
# Roughtly equal to PyCF_MASK | PyCF_MASK_OBSOLETE as defined in pythonrun.h,
4545
# this is used as a bitmask to extract future-related code flags.
46-
PyCF_MASK = functools.reduce(operator.or_,
47-
(getattr(__future__, fname).compiler_flag
48-
for fname in __future__.all_feature_names
49-
if (hasattr(__future__, fname) and
50-
hasattr(getattr(__future__, fname), "compiler_flag"))),
51-
0)
46+
try:
47+
PyCF_MASK = functools.reduce(operator.or_,
48+
(getattr(__future__, fname).compiler_flag
49+
for fname in __future__.all_feature_names))
50+
except AttributeError: # IronPython __future__'s are non-standard, 2/8/2014
51+
PyCF_MASK = 0
5252

5353
#-----------------------------------------------------------------------------
5454
# Local utilities

IPython/core/completer.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,7 @@
6666
# Imports
6767
#-----------------------------------------------------------------------------
6868

69-
try:
70-
import __main__
71-
except ImportError:
72-
pass
69+
import __main__
7370
import glob
7471
import inspect
7572
import itertools

IPython/core/prompts.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,8 @@ def multiple_replace(dict, text):
148148
HOSTNAME = py3compat.str_to_unicode(socket.gethostname())
149149
HOSTNAME_SHORT = HOSTNAME.split(".")[0]
150150

151+
# IronPython doesn't currently have os.getuid() even if
152+
# os.name == 'posix'; 2/8/2014
151153
ROOT_SYMBOL = "#" if (os.name=='nt' or sys.platform=='cli' or os.getuid()==0) else "$"
152154

153155
prompt_abbreviations = {

IPython/external/decorator/_decorator.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,10 @@ def update(self, func, **kw):
139139
func.__defaults__ = getattr(self, 'defaults', ())
140140
func.__kwdefaults__ = getattr(self, 'kwonlydefaults', None)
141141
func.__annotations__ = getattr(self, 'annotations', None)
142-
callermodule = sys._getframe(3).f_globals.get('__name__', '?')
142+
try:
143+
callermodule = sys._getframe(3).f_globals.get('__name__', '?')
144+
except AttributeError: # IronPython _getframe only exists with FullFrames
145+
callermodule = '?'
143146
func.__module__ = getattr(self, 'module', callermodule)
144147
func.__dict__.update(kw)
145148

IPython/lib/inputhook.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
import ctypes
1919
except ImportError:
2020
ctypes = None
21-
except SystemError:
21+
except SystemError: # IronPython issue, 2/8/2014
2222
ctypes = None
2323
import os
2424
import sys

IPython/utils/_process_cli.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,7 @@
2121

2222
def _find_cmd(cmd):
2323
"""Find the full path to a command using which."""
24-
os_path_sep = ":" if os.name == "posix" else ";"
25-
paths = System.Environment.GetEnvironmentVariable("PATH").Split(os_path_sep)
24+
paths = System.Environment.GetEnvironmentVariable("PATH").Split(os.pathsep)
2625
for path in paths:
2726
filename = os.path.join(path, cmd)
2827
if System.IO.File.Exists(filename):

0 commit comments

Comments
 (0)