Show More
@@ -6,14 +6,7 b' ip = IPython.ipapi.get()' | |||||
6 | def call_pydb(self, args): |
|
6 | def call_pydb(self, args): | |
7 | argl = arg_split(args) |
|
7 | argl = arg_split(args) | |
8 | # print argl # dbg |
|
8 | # print argl # dbg | |
9 | if ip.IP.has_readline: |
|
9 | ip.IP.history_saving_wrapper( lambda : pydb.runl(*argl) )() | |
10 | ip.IP.savehist() |
|
|||
11 | try: |
|
|||
12 | pydb.runl(*argl) |
|
|||
13 | finally: |
|
|||
14 |
|
||||
15 | if ip.IP.has_readline: |
|
|||
16 | ip.IP.readline.read_history_file(self.shell.histfile) |
|
|||
17 |
|
10 | |||
18 | ip.expose_magic("pydb",call_pydb) |
|
11 | ip.expose_magic("pydb",call_pydb) | |
19 |
|
12 |
@@ -6,7 +6,7 b' Requires Python 2.3 or newer.' | |||||
6 |
|
6 | |||
7 | This file contains all the classes and helper functions specific to IPython. |
|
7 | This file contains all the classes and helper functions specific to IPython. | |
8 |
|
8 | |||
9 |
$Id: iplib.py 18 |
|
9 | $Id: iplib.py 1868 2006-11-02 15:29:10Z vivainio $ | |
10 | """ |
|
10 | """ | |
11 |
|
11 | |||
12 | #***************************************************************************** |
|
12 | #***************************************************************************** | |
@@ -1211,6 +1211,24 b' want to merge them back into the new files.""" % locals()' | |||||
1211 | print 'Unable to save IPython command history to file: ' + \ |
|
1211 | print 'Unable to save IPython command history to file: ' + \ | |
1212 | `self.histfile` |
|
1212 | `self.histfile` | |
1213 |
|
1213 | |||
|
1214 | def history_saving_wrapper(self, func): | |||
|
1215 | """ Wrap func for readline history saving | |||
|
1216 | ||||
|
1217 | Convert func into callable that saves & restores | |||
|
1218 | history around the call """ | |||
|
1219 | ||||
|
1220 | if not self.has_readline: | |||
|
1221 | return func | |||
|
1222 | ||||
|
1223 | def wrapper(): | |||
|
1224 | self.savehist() | |||
|
1225 | try: | |||
|
1226 | func() | |||
|
1227 | finally: | |||
|
1228 | readline.read_history_file(self.histfile) | |||
|
1229 | return wrapper | |||
|
1230 | ||||
|
1231 | ||||
1214 | def pre_readline(self): |
|
1232 | def pre_readline(self): | |
1215 | """readline hook to be used at the start of each line. |
|
1233 | """readline hook to be used at the start of each line. | |
1216 |
|
1234 | |||
@@ -1392,7 +1410,7 b' want to merge them back into the new files.""" % locals()' | |||||
1392 | pass |
|
1410 | pass | |
1393 | if not have_pydb: |
|
1411 | if not have_pydb: | |
1394 | from pdb import pm |
|
1412 | from pdb import pm | |
1395 | pm() |
|
1413 | self.history_saving_wrapper(pm)() | |
1396 |
|
1414 | |||
1397 | def showtraceback(self,exc_tuple = None,filename=None,tb_offset=None): |
|
1415 | def showtraceback(self,exc_tuple = None,filename=None,tb_offset=None): | |
1398 | """Display the exception that just occurred. |
|
1416 | """Display the exception that just occurred. |
@@ -8,6 +8,10 b'' | |||||
8 |
|
8 | |||
9 | * UserConfig/ipy_user_conf.py: install stock completers as default |
|
9 | * UserConfig/ipy_user_conf.py: install stock completers as default | |
10 |
|
10 | |||
|
11 | * iplib.py (history_saving_wrapper), debugger(), ipy_pydb.py: | |||
|
12 | simplified readline history save / restore through a wrapper | |||
|
13 | function | |||
|
14 | ||||
11 |
|
15 | |||
12 | 2006-10-31 Ville Vainio <vivainio@gmail.com> |
|
16 | 2006-10-31 Ville Vainio <vivainio@gmail.com> | |
13 |
|
17 |
General Comments 0
You need to be logged in to leave comments.
Login now