Commit f05149a
committed
Correction for issue1265 (pdb bug with "with" statement).
When an unfinished generator-iterator is garbage collected, PyEval_EvalFrameEx
is called with a GeneratorExit exception set. This leads to funny results
if the sys.settrace function itself makes use of generators.
A visible effect is that the settrace function is reset to None.
Another is that the eventual "finally" block of the generator is not called.
It is necessary to save/restore the exception around the call to the trace
function.
This happens a lot with py3k: isinstance() of an ABCMeta instance runs
def __instancecheck__(cls, instance):
"""Override for isinstance(instance, cls)."""
return any(cls.__subclasscheck__(c)
for c in {instance.__class__, type(instance)})
which lets an opened generator expression each time it returns True.
Seems a backport candidate, even if the case is less frequent in 2.5.1 parent 8161a65 commit f05149a
2 files changed
Lines changed: 59 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
204 | 204 | | |
205 | 205 | | |
206 | 206 | | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
207 | 235 | | |
208 | 236 | | |
209 | 237 | | |
210 | 238 | | |
211 | 239 | | |
212 | 240 | | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
213 | 245 | | |
214 | 246 | | |
215 | 247 | | |
216 | 248 | | |
217 | 249 | | |
218 | 250 | | |
219 | 251 | | |
220 | | - | |
221 | | - | |
| 252 | + | |
| 253 | + | |
222 | 254 | | |
223 | 255 | | |
224 | 256 | | |
| |||
262 | 294 | | |
263 | 295 | | |
264 | 296 | | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
265 | 310 | | |
266 | 311 | | |
267 | 312 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
107 | 107 | | |
108 | 108 | | |
109 | 109 | | |
110 | | - | |
| 110 | + | |
111 | 111 | | |
112 | 112 | | |
113 | 113 | | |
| |||
717 | 717 | | |
718 | 718 | | |
719 | 719 | | |
720 | | - | |
721 | | - | |
| 720 | + | |
| 721 | + | |
| 722 | + | |
722 | 723 | | |
723 | 724 | | |
724 | 725 | | |
725 | 726 | | |
726 | 727 | | |
727 | 728 | | |
728 | 729 | | |
729 | | - | |
730 | | - | |
731 | | - | |
| 730 | + | |
| 731 | + | |
| 732 | + | |
732 | 733 | | |
733 | 734 | | |
734 | 735 | | |
| |||
3127 | 3128 | | |
3128 | 3129 | | |
3129 | 3130 | | |
3130 | | - | |
| 3131 | + | |
3131 | 3132 | | |
3132 | 3133 | | |
3133 | 3134 | | |
| |||
3136 | 3137 | | |
3137 | 3138 | | |
3138 | 3139 | | |
| 3140 | + | |
3139 | 3141 | | |
| 3142 | + | |
| 3143 | + | |
3140 | 3144 | | |
3141 | 3145 | | |
3142 | 3146 | | |
3143 | 3147 | | |
| 3148 | + | |
3144 | 3149 | | |
3145 | 3150 | | |
3146 | 3151 | | |
| |||
0 commit comments