Terry J. Reedy <tjre...@udel.edu> added the comment:

To be clear, the signature that got changed in 2005 is the signature for 
find_good_parse_start ('fgps'), which was previously

def find_good_parse_start(self, use_ps1, is_char_in_string=None,
 _synchre=_synchre)

When the use_ps1 parameter was removed, the 'if use_ps1' code was moved to the 
else: branch of the new 'if not use_ps1: ... else: ' in the editor method, but 
the call in question, moved into the 'if not use_ps1' branch, was not changed.  
The immediate fix is to remove the extra argument.

The similar call in the then new hyperparser module is correct.

 bod = parser.find_good_parse_start(
     editwin._build_char_in_string_func(startatindex))

The erroneous call has not been detected in execution because of this bug:
  not is_char_in_string
is too general.  It should have been specifically
  is_char_in_string is None
so False does not trigger the early return, but gets called, raising TypeError. 
 We should add a test that find_good_parse_start(False, lambda: True) does so, 
with reference to this issue.

Both calls to fgps (editor and hyperparser) pass 
_build_char_in_string_func(initial_start), which unconditionally returns a 
function.  So I think we can delete '=None' and the early return, rather than 
changing the early return condition.

----------
stage:  -> test needed

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

Reply via email to