Browse Source
bpo-31183: `dis` now handles coroutines & async generators (GH-3077)
bpo-31183: `dis` now handles coroutines & async generators (GH-3077)
Coroutines and async generators use a distinct attribute name for their code objects, so this updates the `dis` module to correctly disassemble objects with those attributes. Due to the increase in the test module length, it also fixes some latent defects in the tests related to how the displayed source line numbers are extracted. https://bugs.python.org/issue31230 is a follow-up issue suggesting we may want to solve this a different way, by instead giving all these object types a common `__code__` attribute, avoiding the need for special casing in the `dis` module.pull/3130/head
committed by
Nick Coghlan
4 changed files with 80 additions and 26 deletions
-
30Doc/library/dis.rst
-
42Lib/dis.py
-
32Lib/test/test_dis.py
-
2Misc/NEWS.d/next/Library/2017-08-13-09-17-01.bpo-31183.-2_YGj.rst
@ -0,0 +1,2 @@ |
|||
`dis` now works with asynchronous generator and coroutine objects. Patch by |
|||
George Collins based on diagnosis by Luciano Ramalho. |
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue