This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Title: `Dis` module doesn't know how to disassemble generators
Type: enhancement Stage: resolved
Components: Extension Modules Versions: Python 3.5
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: hakril, ncoghlan, pitrou, python-dev, rhettinger, vstinner
Priority: normal Keywords: patch

Created on 2014-07-09 14:28 by hakril, last changed 2022-04-11 14:58 by admin. This issue is now closed.

File name Uploaded Description Edit
dis_generator.patch hakril, 2014-07-09 14:28 patch for Lib/ for generator disassembling review
dis_generator2.patch hakril, 2014-07-09 21:31 patch with unit test and doc update review
dis_generator3.patch hakril, 2014-07-14 14:04 Updated the docstrings of modified functions review
Messages (7)
msg222619 - (view) Author: Clement Rouault (hakril) * Date: 2014-07-09 14:28
The `dis` module doesn't know how to disassemble generator object because it has no idea about the `gi_code` attribute.
I made a (very) little patch to change this behavior.

If there is a valid reason to not let the `dis` module disassemble generator, I would be glad to know it.
msg222637 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2014-07-09 20:33
That sounds like a good idea. The patch lacks a unit test, though.
msg222642 - (view) Author: Clement Rouault (hakril) * Date: 2014-07-09 21:31
Here is a try for a better patch.
Added a unit test and updated the doc.
msg222650 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2014-07-10 05:22
msg223030 - (view) Author: Clement Rouault (hakril) * Date: 2014-07-14 14:04
Updated some docstrings in the new patch after the review comments.
Thanks kushou for the code review.
msg223943 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2014-07-25 13:04
New changeset 2ae5709692ef by Nick Coghlan in branch 'default':
Issue #21947: handle generator-iterator objects in dis
msg223944 - (view) Author: Nick Coghlan (ncoghlan) * (Python committer) Date: 2014-07-25 13:08
Thanks for the patch Clement!

Could I also please request that you sign the Contributor License Agreement at

While we have some discretion to accept "small" patches without one, a signed CLA helps assure that we have the necessary rights to incorporate and redistribute contributions worldwide.
Date User Action Args
2022-04-11 14:58:05adminsetgithub: 66146
2014-07-25 13:09:09ncoghlansetstatus: open -> closed
resolution: fixed
stage: resolved
2014-07-25 13:08:53ncoghlansetmessages: + msg223944
2014-07-25 13:04:50python-devsetnosy: + python-dev
messages: + msg223943
2014-07-14 14:04:32hakrilsetfiles: + dis_generator3.patch

messages: + msg223030
2014-07-10 05:22:16rhettingersetnosy: + rhettinger
messages: + msg222650
2014-07-09 21:32:44vstinnersetnosy: + vstinner
2014-07-09 21:31:47hakrilsetfiles: + dis_generator2.patch

messages: + msg222642
2014-07-09 20:33:48pitrousetnosy: + pitrou
messages: + msg222637
2014-07-09 14:30:53zach.waresetnosy: + ncoghlan
2014-07-09 14:28:29hakrilcreate