This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author cheryl.sabella
Recipients cheryl.sabella, serhiy.storchaka, terry.reedy
Date 2018-02-24.15:38:34
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1519486714.15.0.467229070634.issue32880@psf.upfronthosting.co.za>
In-reply-to
Content
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
History
Date User Action Args
2018-02-24 15:38:34cheryl.sabellasetrecipients: + cheryl.sabella, terry.reedy, serhiy.storchaka
2018-02-24 15:38:34cheryl.sabellasetmessageid: <1519486714.15.0.467229070634.issue32880@psf.upfronthosting.co.za>
2018-02-24 15:38:34cheryl.sabellalinkissue32880 messages
2018-02-24 15:38:34cheryl.sabellacreate