bpo-45848: Allow the parser to get error lines from encoded files#29646
Conversation
e5f98dd to
d97d5d8
Compare
| error_line = PyErr_ProgramTextObject(p->tok->filename, (int) lineno); | ||
| else if (p->start_rule == Py_file_input) { | ||
| error_line = _PyErr_ProgramDecodedTextObject(p->tok->filename, | ||
| (int) lineno, p->tok->encoding); |
|
Thanks @pablogsal for the PR, and @ambv for merging it 🌮🎉.. I'm working now to backport this PR to: 3.9, 3.10. |
|
Sorry, @pablogsal and @ambv, I could not cleanly backport this to |
|
Sorry @pablogsal and @ambv, I had trouble checking out the |
…les (pythonGH-29646). (cherry picked from commit fdcc46d) Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
|
GH-29661 is a backport of this pull request to the 3.10 branch. |
|
@pablogsal, backporting this to 3.9 is more involved as the parser is much simpler in this case, see: Lines 424 to 434 in e8d41ee There is no Let me know if you'd like me to still proceed with the backport. The current 3.11 crasher doesn't produce too terrible of a result under 3.9: |
Thanks @ambv ! I will give it a go but as this doesn't crash in 3.9 I'm ok to just leave as is, as in this way we can also avoid potential unintended side effects in 3.9. |
https://bugs.python.org/issue45848