New submission from Nick Coghlan:

In reviewing the PR for issue 31183, I noticed that the criteria for deciding 
which values to disassemble when disassembling a namespace (objects with a 
__dict__ attribute) has gotten out of sync with the criteria used by the dis() 
itself.

The problem is that dis() checks for particular attributes that may contain 
code objects, while the recursive descent when processing a __dict__ attribute 
is based on isinstance() and a predefined list of types.

My proposed remedy for this would be:

1. Factor out a dis._get_code() helper function that returns either None or a 
compiled code object
2. Base the recursive descent in __dict__ processing on the value either having 
a __dict__ attribute, or else _get_code() returning a non-None result (in the 
latter case, the code object itself would be passed to the recursive call, 
rather than the original value from the namespace)

----------
messages: 300234
nosy: ncoghlan
priority: normal
severity: normal
status: open
title: Namespace disassembly omits some compiled objects
versions: Python 3.7

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue31197>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to