Skip to content

Commit df49db5

Browse files
committed
Merging everyones bug fixes into trunk.
This is a host of bug fixes done by in various branches that fix IPython on Python 2.4.
2 parents 46a1cb3 + 82252d1 commit df49db5

26 files changed

+516
-446
lines changed

IPython/Release.py

Lines changed: 47 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
# bdist_deb does not accept underscores (a Debian convention).
2222

2323
development = False # change this to False to do a release
24-
version_base = '0.9'
24+
version_base = '0.9.1'
2525
branch = 'ipython'
2626
revision = '1143'
2727

@@ -34,45 +34,69 @@
3434
version = version_base
3535

3636

37-
description = "Tools for interactive development in Python."
37+
description = "An interactive computing environment for Python"
3838

3939
long_description = \
4040
"""
41-
IPython provides a replacement for the interactive Python interpreter with
42-
extra functionality.
41+
The goal of IPython is to create a comprehensive environment for
42+
interactive and exploratory computing. To support this goal, IPython
43+
has two main components:
4344
44-
Main features:
45+
* An enhanced interactive Python shell.
4546
46-
* Comprehensive object introspection.
47+
* An architecture for interactive parallel computing.
4748
48-
* Input history, persistent across sessions.
49+
The enhanced interactive Python shell has the following main features:
4950
50-
* Caching of output results during a session with automatically generated
51-
references.
51+
* Comprehensive object introspection.
5252
53-
* Readline based name completion.
53+
* Input history, persistent across sessions.
5454
55-
* Extensible system of 'magic' commands for controlling the environment and
56-
performing many tasks related either to IPython or the operating system.
55+
* Caching of output results during a session with automatically generated
56+
references.
5757
58-
* Configuration system with easy switching between different setups (simpler
59-
than changing $PYTHONSTARTUP environment variables every time).
58+
* Readline based name completion.
6059
61-
* Session logging and reloading.
60+
* Extensible system of 'magic' commands for controlling the environment and
61+
performing many tasks related either to IPython or the operating system.
6262
63-
* Extensible syntax processing for special purpose situations.
63+
* Configuration system with easy switching between different setups (simpler
64+
than changing $PYTHONSTARTUP environment variables every time).
6465
65-
* Access to the system shell with user-extensible alias system.
66+
* Session logging and reloading.
6667
67-
* Easily embeddable in other Python programs.
68+
* Extensible syntax processing for special purpose situations.
6869
69-
* Integrated access to the pdb debugger and the Python profiler.
70+
* Access to the system shell with user-extensible alias system.
7071
71-
The latest development version is always available at the IPython subversion
72-
repository_.
72+
* Easily embeddable in other Python programs and wxPython GUIs.
7373
74-
.. _repository: http://ipython.scipy.org/svn/ipython/ipython/trunk#egg=ipython-dev
75-
"""
74+
* Integrated access to the pdb debugger and the Python profiler.
75+
76+
The parallel computing architecture has the following main features:
77+
78+
* Quickly parallelize Python code from an interactive Python/IPython session.
79+
80+
* A flexible and dynamic process model that be deployed on anything from
81+
multicore workstations to supercomputers.
82+
83+
* An architecture that supports many different styles of parallelism, from
84+
message passing to task farming.
85+
86+
* Both blocking and fully asynchronous interfaces.
87+
88+
* High level APIs that enable many things to be parallelized in a few lines
89+
of code.
90+
91+
* Share live parallel jobs with other users securely.
92+
93+
* Dynamically load balanced task farming system.
94+
95+
* Robust error handling in parallel code.
96+
97+
The latest development version is always available from IPython's `Launchpad
98+
site <http://launchpad.net/ipython>`_.
99+
"""
76100

77101
license = 'BSD'
78102

IPython/config/api.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,6 @@
2121
from IPython.genutils import get_home_dir, get_ipython_dir
2222
from IPython.external.configobj import ConfigObj
2323

24-
# Traitlets config imports
25-
from IPython.config import traitlets
26-
from IPython.config.config import *
27-
from traitlets import *
2824

2925
class ConfigObjManager(object):
3026

IPython/frontend/asyncfrontendbase.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
#-------------------------------------------------------------------------------
1515
# Imports
1616
#-------------------------------------------------------------------------------
17-
import uuid
17+
from IPython.external import guid
1818

1919

2020
from zope.interface import Interface, Attribute, implements, classProvides
@@ -59,7 +59,7 @@ def execute(self, block, blockID=None):
5959
return Failure(Exception("Block is not compilable"))
6060

6161
if(blockID == None):
62-
blockID = uuid.uuid4() #random UUID
62+
blockID = guid.generate()
6363

6464
d = self.engine.execute(block)
6565
d.addCallback(self._add_history, block=block)

IPython/frontend/cocoa/cocoa_frontend.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626

2727
import sys
2828
import objc
29-
import uuid
29+
from IPython.external import guid
3030

3131
from Foundation import NSObject, NSMutableArray, NSMutableDictionary,\
3232
NSLog, NSNotificationCenter, NSMakeRange,\
@@ -361,7 +361,7 @@ def start_new_block(self):
361361

362362
def next_block_ID(self):
363363

364-
return uuid.uuid4()
364+
return guid.generate()
365365

366366
def new_cell_block(self):
367367
"""A new CellBlock at the end of self.textView.textStorage()"""

IPython/frontend/frontendbase.py

Lines changed: 9 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,13 @@
2121
# Imports
2222
#-------------------------------------------------------------------------------
2323
import string
24-
import uuid
25-
import _ast
24+
import codeop
25+
from IPython.external import guid
26+
2627

2728
from IPython.frontend.zopeinterface import (
2829
Interface,
2930
Attribute,
30-
implements,
31-
classProvides
3231
)
3332
from IPython.kernel.core.history import FrontEndHistory
3433
from IPython.kernel.core.util import Bunch
@@ -134,11 +133,7 @@ def is_complete(block):
134133

135134
pass
136135

137-
def compile_ast(block):
138-
"""Compiles block to an _ast.AST"""
139-
140-
pass
141-
136+
142137
def get_history_previous(current_block):
143138
"""Returns the block previous in the history. Saves currentBlock if
144139
the history_cursor is currently at the end of the input history"""
@@ -220,28 +215,14 @@ def is_complete(self, block):
220215
"""
221216

222217
try:
223-
ast = self.compile_ast(block)
218+
is_complete = codeop.compile_command(block.rstrip() + '\n\n',
219+
"<string>", "exec")
224220
except:
225221
return False
226222

227223
lines = block.split('\n')
228-
return (len(lines)==1 or str(lines[-1])=='')
229-
230-
231-
def compile_ast(self, block):
232-
"""Compile block to an AST
233-
234-
Parameters:
235-
block : str
236-
237-
Result:
238-
AST
239-
240-
Throws:
241-
Exception if block cannot be compiled
242-
"""
243-
244-
return compile(block, "<string>", "exec", _ast.PyCF_ONLY_AST)
224+
return ((is_complete is not None)
225+
and (len(lines)==1 or str(lines[-1])==''))
245226

246227

247228
def execute(self, block, blockID=None):
@@ -261,7 +242,7 @@ def execute(self, block, blockID=None):
261242
raise Exception("Block is not compilable")
262243

263244
if(blockID == None):
264-
blockID = uuid.uuid4() #random UUID
245+
blockID = guid.generate()
265246

266247
try:
267248
result = self.shell.execute(block)

IPython/frontend/linefrontendbase.py

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -182,16 +182,29 @@ def execute(self, python_string, raw_string=None):
182182
raw_string = python_string
183183
# Create a false result, in case there is an exception
184184
self.last_result = dict(number=self.prompt_number)
185+
186+
## try:
187+
## self.history.input_cache[-1] = raw_string.rstrip()
188+
## result = self.shell.execute(python_string)
189+
## self.last_result = result
190+
## self.render_result(result)
191+
## except:
192+
## self.show_traceback()
193+
## finally:
194+
## self.after_execute()
195+
185196
try:
186-
self.history.input_cache[-1] = raw_string.rstrip()
187-
result = self.shell.execute(python_string)
188-
self.last_result = result
189-
self.render_result(result)
190-
except:
191-
self.show_traceback()
197+
try:
198+
self.history.input_cache[-1] = raw_string.rstrip()
199+
result = self.shell.execute(python_string)
200+
self.last_result = result
201+
self.render_result(result)
202+
except:
203+
self.show_traceback()
192204
finally:
193205
self.after_execute()
194206

207+
195208
#--------------------------------------------------------------------------
196209
# LineFrontEndBase interface
197210
#--------------------------------------------------------------------------

IPython/frontend/prefilterfrontend.py

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -196,17 +196,33 @@ def prefilter_input(self, input_string):
196196
# capture it.
197197
self.capture_output()
198198
self.last_result = dict(number=self.prompt_number)
199+
200+
## try:
201+
## for line in input_string.split('\n'):
202+
## filtered_lines.append(
203+
## self.ipython0.prefilter(line, False).rstrip())
204+
## except:
205+
## # XXX: probably not the right thing to do.
206+
## self.ipython0.showsyntaxerror()
207+
## self.after_execute()
208+
## finally:
209+
## self.release_output()
210+
211+
199212
try:
200-
for line in input_string.split('\n'):
201-
filtered_lines.append(
202-
self.ipython0.prefilter(line, False).rstrip())
203-
except:
204-
# XXX: probably not the right thing to do.
205-
self.ipython0.showsyntaxerror()
206-
self.after_execute()
213+
try:
214+
for line in input_string.split('\n'):
215+
filtered_lines.append(
216+
self.ipython0.prefilter(line, False).rstrip())
217+
except:
218+
# XXX: probably not the right thing to do.
219+
self.ipython0.showsyntaxerror()
220+
self.after_execute()
207221
finally:
208222
self.release_output()
209223

224+
225+
210226
# Clean up the trailing whitespace, to avoid indentation errors
211227
filtered_string = '\n'.join(filtered_lines)
212228
return filtered_string

0 commit comments

Comments
 (0)