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,

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(

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>
Python-bugs-list mailing list

Reply via email to