[issue31183] `Dis` module doesn't know how to disassemble async generator or coroutine objects

2017-08-11 Thread George Collins

New submission from George Collins:

Issue 21947 informed the `dis` module about the `gi_code` attribute, which 
stores code objects for generator objects. This allows inspection of generator 
objects, not just functions which return them. However, asynchronous generator 
objects use `ag_code` and coroutine objects use `cr_code`, so dis raises a 
TypeError on them. I'm making a pull request to extend the generator behavior 
to async generators and coroutines.

Credit to Luciano Ramalho: I tripped over this at his (great) concurrency 
workshop at PyBay 2017 and he identified exactly what was happening and 
suggested a patch.

--
components: Extension Modules
messages: 300167
nosy: George Collins
priority: normal
severity: normal
status: open
title: `Dis` module doesn't know how to disassemble async generator or 
coroutine objects
type: enhancement
versions: Python 3.6, Python 3.7

___
Python tracker 
<http://bugs.python.org/issue31183>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue31183] `Dis` module doesn't know how to disassemble async generator or coroutine objects

2017-08-11 Thread George Collins

Changes by George Collins :


--
pull_requests: +3114

___
Python tracker 
<http://bugs.python.org/issue31183>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue31183] `Dis` module doesn't know how to disassemble async generator or coroutine objects

2017-08-12 Thread George Collins

George Collins added the comment:

Hm--either/both? I encountered it as a bug ("dis works on my generator object 
and my async generator function, why does it break on my async generator 
object?") but strictly speaking it's a new feature (just as issue21947 was). To 
my mind, adding this level of indirection (finding the code object) for 
generators was a bit of a design decision but once it's in for generators it 
should be in for async generators and coroutines by analogy.

--

___
Python tracker 
<http://bugs.python.org/issue31183>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue31183] `Dis` module doesn't know how to disassemble async generator or coroutine objects

2017-08-12 Thread George Collins

George Collins added the comment:

Makes sense. I'll update the PR in a bit, and if anyone is hitting this 
repeatedly and thinks it should be added to 3.6 they can advocate for a policy 
change in the maintaining-consistency-with-previous-new-features corner case.

Thanks, all!

--

___
Python tracker 
<http://bugs.python.org/issue31183>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com