Skip to content

Conversation

serhiy-storchaka
Copy link
Member

@serhiy-storchaka serhiy-storchaka commented Sep 30, 2025

@vstinner
Copy link
Member

vstinner commented Sep 30, 2025

Two tests are failing:

======================================================================
FAIL: test_nul_in_first_coding_line (test.test_source_encoding.FileSourceEncodingTest.test_nul_in_first_coding_line)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/runner/work/cpython/cpython-ro-srcdir/Lib/test/test_source_encoding.py", line 316, in test_nul_in_first_coding_line
    self.check_script_error(src, br"source code (string )?cannot contain null bytes")
    ~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/runner/work/cpython/cpython-ro-srcdir/Lib/test/test_source_encoding.py", line 425, in check_script_error
    self.assertRegex(res.err.rstrip().splitlines()[-1], b'SyntaxError: ' + expected)
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: Regex didn't match: b'SyntaxError: source code (string )?cannot contain null bytes' not found in b'\x1b[1;35mSyntaxError\x1b[0m: \x1b[35msource code cannot contain null bytes\x1b[0m'

======================================================================
FAIL: test_nul_in_second_coding_line (test.test_source_encoding.FileSourceEncodingTest.test_nul_in_second_coding_line)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/runner/work/cpython/cpython-ro-srcdir/Lib/test/test_source_encoding.py", line 323, in test_nul_in_second_coding_line
    self.check_script_error(src, br"source code (string )?cannot contain null bytes")
    ~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/runner/work/cpython/cpython-ro-srcdir/Lib/test/test_source_encoding.py", line 425, in check_script_error
    self.assertRegex(res.err.rstrip().splitlines()[-1], b'SyntaxError: ' + expected)
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: Regex didn't match: b'SyntaxError: source code (string )?cannot contain null bytes' not found in b'\x1b[1;35mSyntaxError\x1b[0m: \x1b[35msource code cannot contain null bytes\x1b[0m'

@serhiy-storchaka serhiy-storchaka merged commit b2f5ad0 into python:main Sep 30, 2025
43 checks passed
@miss-islington-app
Copy link

Thanks @serhiy-storchaka for the PR 🌮🎉.. I'm working now to backport this PR to: 3.13, 3.14.
🐍🍒⛏🤖

@serhiy-storchaka serhiy-storchaka deleted the test_source_encoding2 branch September 30, 2025 09:20
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Sep 30, 2025
(cherry picked from commit b2f5ad0)

Co-authored-by: Serhiy Storchaka <[email protected]>
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Sep 30, 2025
(cherry picked from commit b2f5ad0)

Co-authored-by: Serhiy Storchaka <[email protected]>
@bedevere-app
Copy link

bedevere-app bot commented Sep 30, 2025

GH-139442 is a backport of this pull request to the 3.14 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.14 bugs and security fixes label Sep 30, 2025
@bedevere-app
Copy link

bedevere-app bot commented Sep 30, 2025

GH-139443 is a backport of this pull request to the 3.13 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.13 bugs and security fixes label Sep 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
skip news tests Tests in the Lib/test dir
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants