Skip to content

bpo-45848: Delimitate when source lines can't be located in the parser error handling functions #29626

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from

Conversation

pablogsal
Copy link
Member

@pablogsal pablogsal commented Nov 18, 2021

@pablogsal pablogsal added needs backport to 3.10 only security fixes needs backport to 3.9 only security fixes skip news labels Nov 18, 2021
@ambv ambv removed the skip issue label Nov 19, 2021
@ambv ambv changed the title Delimitate when source lines can't be located in the parser error handling functions bpo-45848: Delimitate when source lines can't be located in the parser error handling functions Nov 19, 2021
@ambv
Copy link
Contributor

ambv commented Nov 19, 2021

Running the test I added with the fix:

test_encoding_cookie (test.test_peg_generator.test_c_parser.TestCPythonParserEdgeCases) ... ok

----------------------------------------------------------------------
Ran 1 test in 0.125s

OK

== Tests result: SUCCESS ==

Running the test without the fix:

test test_peg_generator failed -- Traceback (most recent call last):
  File "/private/tmp/cpymain/Lib/test/test_peg_generator/test_c_parser.py", line 512, in test_encoding_cookie
    self.assert_python(
    ^^^^^^^^^^^^^^^^^^^
  File "/private/tmp/cpymain/Lib/test/test_peg_generator/test_c_parser.py", line 507, in assert_python
    self.assertNotIn(not_expected, output)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: 'Fatal Python error: Aborted' unexpectedly found in '\nAssertion failed: (p->tok->fp == NULL || p->tok->fp == stdin), function get_error_line, file Parser/pegen.c, line 408.\nFatal Python error: Aborted\n\nCurrent thread 0x000000010f006dc0 (most recent call first):\n  <no Python frame>\n'

test_peg_generator failed (1 failure)

== Tests result: FAILURE ==

@pablogsal
Copy link
Member Author

pablogsal commented Nov 19, 2021

@ambv I am closing this in favour of a more complete and robust version: #29646

@pablogsal pablogsal closed this Nov 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants