[issue32880] IDLE: Fix and update and cleanup pyparse

Terry J. Reedy report at bugs.python.org
Mon Feb 19 23:16:22 EST 2018


Terry J. Reedy <tjreedy at udel.edu> added the comment:

set_str sets self.str and self.study_level.  After the first call, attempts to access unset instance parse attributes from other modules will raise AttributeError.  Removing the unneeded class setting will just add 2 more names to the list of things that should not be called directly.  The get_xyz functions (get_continuation_type is another) avoid AttributeError (unless self.str is not set) and ensure validity.

If set_str is called more than once, instance parse attributes will initially be set but invalid.  So it seems they should be either deleted or set to None.  In the latter case, they should also be set to None initially.  I will look more at how the module is used.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue32880>
_______________________________________


More information about the Python-bugs-list mailing list