##// END OF EJS Templates
Merge pull request #9156 from Carreau/buildwn...
Thomas Kluyver -
r21978:34d3170d merge
parent child Browse files
Show More
@@ -0,0 +1,3 b''
1 IPython debugger (IPdb) now supports the number of context lines for the
2 ``where`` (and ``w``) commands. The `context` keyword is also available in various APIs.
3 See PR :ghpull:`9097`
@@ -724,6 +724,69 b' how to control where pdb will stop execution first.'
724 For more information on the use of the pdb debugger, see :ref:`debugger-commands`
724 For more information on the use of the pdb debugger, see :ref:`debugger-commands`
725 in the Python documentation.
725 in the Python documentation.
726
726
727 IPython extends the debugger with a few useful additions, like coloring of
728 tracebacks. The debugger will adopt the color scheme selected for IPython.
729
730 The ``where`` command has also been extended to take as argument the number of
731 context line to show. This allows to a many line of context on shallow stack trace:
732
733 .. code::
734 In [5]: def foo(x):
735 ...: 1
736 ...: 2
737 ...: 3
738 ...: return 1/x+foo(x-1)
739 ...: 5
740 ...: 6
741 ...: 7
742 ...:
743
744 In[6]: foo(1)
745 # ...
746 ipdb> where 8
747 <ipython-input-6-9e45007b2b59>(1)<module>()
748 ----> 1 foo(1)
749
750 <ipython-input-5-7baadc3d1465>(5)foo()
751 1 def foo(x):
752 2 1
753 3 2
754 4 3
755 ----> 5 return 1/x+foo(x-1)
756 6 5
757 7 6
758 8 7
759
760 > <ipython-input-5-7baadc3d1465>(5)foo()
761 1 def foo(x):
762 2 1
763 3 2
764 4 3
765 ----> 5 return 1/x+foo(x-1)
766 6 5
767 7 6
768 8 7
769
770
771 And less context on shallower Stack Trace:
772
773 .. code::
774 ipdb> where 1
775 <ipython-input-13-afa180a57233>(1)<module>()
776 ----> 1 foo(7)
777
778 <ipython-input-5-7baadc3d1465>(5)foo()
779 ----> 5 return 1/x+foo(x-1)
780
781 <ipython-input-5-7baadc3d1465>(5)foo()
782 ----> 5 return 1/x+foo(x-1)
783
784 <ipython-input-5-7baadc3d1465>(5)foo()
785 ----> 5 return 1/x+foo(x-1)
786
787 <ipython-input-5-7baadc3d1465>(5)foo()
788 ----> 5 return 1/x+foo(x-1)
789
727
790
728 Post-mortem debugging
791 Post-mortem debugging
729 ---------------------
792 ---------------------
@@ -10,6 +10,7 b' This document describes in-flight development work.'
10 conflicts for other Pull Requests). Instead, create a new file in the
10 conflicts for other Pull Requests). Instead, create a new file in the
11 `docs/source/whatsnew/pr` folder
11 `docs/source/whatsnew/pr` folder
12
12
13
13 .. DO NOT EDIT THIS LINE BEFORE RELEASE. FEATURE INSERTION POINT.
14 .. DO NOT EDIT THIS LINE BEFORE RELEASE. FEATURE INSERTION POINT.
14
15
15
16
@@ -18,4 +19,3 b' Backwards incompatible changes'
18
19
19
20
20 .. DO NOT EDIT THIS LINE BEFORE RELEASE. INCOMPAT INSERTION POINT.
21 .. DO NOT EDIT THIS LINE BEFORE RELEASE. INCOMPAT INSERTION POINT.
21
@@ -7,6 +7,7 b' whatsnew/development.rst (chronologically ordered), and deletes the snippets.'
7
7
8 import io
8 import io
9 import os
9 import os
10 from glob import glob
10 from os.path import dirname, basename, abspath, join as pjoin
11 from os.path import dirname, basename, abspath, join as pjoin
11 from subprocess import check_call, check_output
12 from subprocess import check_call, check_output
12
13
@@ -20,15 +21,13 b' INCOMPAT_MARK = ".. DO NOT EDIT THIS LINE BEFORE RELEASE. INCOMPAT INSERTION POI'
20
21
21 # 1. Collect the whatsnew snippet files ---------------------------------------
22 # 1. Collect the whatsnew snippet files ---------------------------------------
22
23
23 files = set(os.listdir(pr_dir))
24 files = set(glob(pjoin(pr_dir, '*.rst')))
24 # Ignore explanatory and example files
25 # Ignore explanatory and example files
25 files.difference_update({'README.md',
26 files.difference_update({pjoin(pr_dir, f) for f in {
26 'incompat-switching-to-perl.rst',
27 'incompat-switching-to-perl.rst',
27 'antigravity-feature.rst'}
28 'antigravity-feature.rst'}
28 )
29 })
29
30
30 # Absolute paths
31 files = {pjoin(pr_dir, f) for f in files}
32
31
33 def getmtime(f):
32 def getmtime(f):
34 return check_output(['git', 'log', '-1', '--format="%ai"', '--', f])
33 return check_output(['git', 'log', '-1', '--format="%ai"', '--', f])
@@ -38,7 +37,11 b' files = sorted(files, key=getmtime)'
38 features, incompats = [], []
37 features, incompats = [], []
39 for path in files:
38 for path in files:
40 with io.open(path, encoding='utf-8') as f:
39 with io.open(path, encoding='utf-8') as f:
41 content = f.read().rstrip()
40 try:
41 content = f.read().rstrip()
42 except Exception as e:
43 raise Exception('Error reading "{}"'.format(f)) from e
44
42 if basename(path).startswith('incompat-'):
45 if basename(path).startswith('incompat-'):
43 incompats.append(content)
46 incompats.append(content)
44 else:
47 else:
@@ -72,4 +75,4 b' for file in files:'
72
75
73 check_call(['git', 'add', target])
76 check_call(['git', 'add', target])
74
77
75 print("Merged what's new changes. Check the diff and commit the change.") No newline at end of file
78 print("Merged what's new changes. Check the diff and commit the change.")
General Comments 0
You need to be logged in to leave comments. Login now