Cheryl Sabella <chek...@gmail.com> added the comment:

New issue:

find_good_parse_start() call in editor.py has the wrong signature.  There's 
actually a few things going on here.  Here's the section in editor:
```
            if not self.context_use_ps1:
                for context in self.num_context_lines:
                    startat = max(lno - context, 1)
                    startatindex = repr(startat) + ".0"
                    rawtext = text.get(startatindex, "insert")
                    y.set_code(rawtext)
                    bod = y.find_good_parse_start(
                              self.context_use_ps1, 
self._build_char_in_string_func(startatindex))
                    if bod is not None or startat == 1:
                        break
                y.set_lo(bod or 0)
            else:
                r = text.tag_prevrange("console", "insert")
                if r:
                    startatindex = r[1]
                else:
                    startatindex = "1.0"
                rawtext = text.get(startatindex, "insert")
                y.set_code(rawtext)
                y.set_lo(0)
```

1. self.context_use_ps1 is always False.  There's no where in IDLE that it can 
be set to True.  I'll open an another issue for this since it's really not 
pyparse.

2. The call to find_good_parse_start:
```
bod = y.find_good_parse_start(
                              self.context_use_ps1, 
self._build_char_in_string_func(startatindex))
```
sends 3 parameters.  And in pyparse, the signature allows 3.  However, the 
signature is:
```
    def find_good_parse_start(self, is_char_in_string=None,
                              _synchre=_synchre):
```

This means that the False self.use_context_ps1 is the first value instead of 
the function, so pyparse is always executing:
```
        if not is_char_in_string:
            # no clue -- make the caller pass everything
            return None
```
In the test, I had assumed this was for the default of None.  Bad assumption.  
:-(

Here's the commit that changed the signature:
https://github.com/python/cpython/commit/b17544551fc8dfd1304d5679c6e444cad4d34d97

----------

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

Reply via email to