Show More
@@ -74,11 +74,76 b' and is thus native to CPython in Python 3.13+ Though ipdb should support this' | |||||
74 | feature in older version of Python. I invite you to look at the `CPython changes |
|
74 | feature in older version of Python. I invite you to look at the `CPython changes | |
75 | and docs <https://github.com/python/cpython/pull/106676>`__ for more details. |
|
75 | and docs <https://github.com/python/cpython/pull/106676>`__ for more details. | |
76 |
|
76 | |||
|
77 | In short, once in post-mortem debuger (``%debug``), you can use the ipdb | |||
|
78 | ``exceptions`` command to switch exceptions, for example: | |||
77 |
|
79 | |||
|
80 | .. code-block:: ipython | |||
|
81 | ||||
|
82 | In [1]: def foo(x): | |||
|
83 | ...: try: | |||
|
84 | ...: bar(x) | |||
|
85 | ...: except Exception as e: | |||
|
86 | ...: raise ValueError("foo (): bar failed") from e | |||
|
87 | ...: | |||
|
88 | ...: def bar(x): | |||
|
89 | ...: 1 / X | |||
|
90 | ...: | |||
|
91 | ||||
|
92 | In [2]: foo(0) | |||
|
93 | --------------------------------------------------------------------------- | |||
|
94 | NameError Traceback (most recent call last) | |||
|
95 | Cell In[1], line 3, in foo(x) | |||
|
96 | 2 try: | |||
|
97 | ----> 3 bar(x) | |||
|
98 | 4 except Exception as e: | |||
|
99 | ||||
|
100 | Cell In[1], line 9, in bar(x) | |||
|
101 | 8 def bar(x): | |||
|
102 | ----> 9 1 / X | |||
|
103 | ||||
|
104 | NameError: name 'X' is not defined | |||
|
105 | ||||
|
106 | The above exception was the direct cause of the following exception: | |||
|
107 | ||||
|
108 | ValueError Traceback (most recent call last) | |||
|
109 | Cell In[2], line 1 | |||
|
110 | ----> 1 foo(0) | |||
|
111 | ||||
|
112 | Cell In[1], line 5, in foo(x) | |||
|
113 | 3 bar(x) | |||
|
114 | 4 except Exception as e: | |||
|
115 | ----> 5 raise ValueError("foo (): bar failed") from e | |||
|
116 | ||||
|
117 | ValueError: foo (): bar failed | |||
|
118 | ||||
|
119 | In [3]: %debug | |||
|
120 | > <ipython-input-1-b0bbdc271ffb>(5)foo() | |||
|
121 | 3 bar(x) | |||
|
122 | 4 except Exception as e: | |||
|
123 | ----> 5 raise ValueError("foo (): bar failed") from e | |||
|
124 | ||||
|
125 | In previous ipdb you could not go into the bar error, now from within pdb you | |||
|
126 | can use ``exceptions``: | |||
|
127 | ||||
|
128 | .. code-block:: ipython | |||
|
129 | ||||
|
130 | ipdb> exceptions | |||
|
131 | 0 NameError("name 'X' is not defined") | |||
|
132 | > 1 ValueError('foo (): bar failed') | |||
|
133 | ||||
|
134 | ipdb> exceptions 0 | |||
|
135 | > <ipython-input-1-b0bbdc271ffb>(9)bar() | |||
|
136 | 6 | |||
|
137 | 7 | |||
|
138 | 8 def bar(x): | |||
|
139 | ----> 9 1 / X | |||
|
140 | 10 | |||
|
141 | ||||
|
142 | ipdb> | |||
78 |
|
143 | |||
79 | In particular I want to thank the `D.E. Shaw group |
|
144 | In particular I want to thank the `D.E. Shaw group <https://www.deshaw.com/>`__ | |
80 |
|
|
145 | for suggesting and funding the two largest feature as well as many bug fixes of | |
81 | as well as many bug fixes of this release. |
|
146 | this release. | |
82 |
|
147 | |||
83 | As usual you can find the full list of PRs on GitHub under `the 8.15 milestone |
|
148 | As usual you can find the full list of PRs on GitHub under `the 8.15 milestone | |
84 | <https://github.com/ipython/ipython/milestone/120?closed=1>`__. |
|
149 | <https://github.com/ipython/ipython/milestone/120?closed=1>`__. |
General Comments 0
You need to be logged in to leave comments.
Login now