GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — `patchcheck.py` raises `SystemError` on `main` · Issue #105820 · python/cpython

patchcheck.py raises SystemError on main #105820

New issue
Copy link
New issue
Copy link
Closed
Closed
patchcheck.py raises SystemError on main#105820
Copy link
Assignees
pablogsallysnikolaou
Labels
type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

Description

@AlexWaygood
AlexWaygood
opened on Jun 15, 2023
Issue body actions

Bug report

Following #105801, running python Tools/patchcheck/patchcheck.py now results in SystemError being raised.

To reproduce

  1. Make any change to a .py file, e.g.:
--- a/Lib/test/test_fstring.py
+++ b/Lib/test/test_fstring.py
@@ -19,6 +19,7 @@

 a_global = 'global variable'

+
  1. Run python Tools/patchcheck/patchcheck.py:
C:\Users\alexw\coding\cpython>python Tools/patchcheck/patchcheck.py
Running Release|x64 interpreter...
Getting base branch for PR ... upstream/main
Getting the list of files that have been added/changed ... 1 file
Fixing Python file whitespace ... Traceback (most recent call last):
  File "C:\Users\alexw\coding\cpython\Tools\patchcheck\patchcheck.py", line 325, in <module>
    main()
  File "C:\Users\alexw\coding\cpython\Tools\patchcheck\patchcheck.py", line 293, in main
    normalize_whitespace(python_files)
  File "C:\Users\alexw\coding\cpython\Tools\patchcheck\patchcheck.py", line 35, in call_fxn
    result = fxn(*args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\alexw\coding\cpython\Tools\patchcheck\patchcheck.py", line 188, in normalize_whitespace
    and reindent.check(os.path.join(SRCDIR, path))
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\alexw\coding\cpython\Tools\patchcheck\reindent.py", line 138, in check
    if r.run():
       ^^^^^^^
  File "C:\Users\alexw\coding\cpython\Tools\patchcheck\reindent.py", line 203, in run
    for _token in tokens:
  File "C:\Users\alexw\coding\cpython\Lib\tokenize.py", line 537, in _generate_tokens_from_c_tokenizer
    for info in it:
SystemError: Negative size passed to PyUnicode_New

This failure was visible on the Azure Pipelines job on the PR FYI: https://dev.azure.com/Python/cpython/_build/results?buildId=130389&view=logs&j=256d7e09-002a-52d7-8661-29ee3960640e&t=3d7276d3-4e8d-5309-55ad-fb0b172d9925

Your environment

Python 3.13.0a0 (heads/main:c5111aec2b, Jun 15 2023, 10:53:37) [MSC v.1932 64 bit (AMD64)] on win32

Linked PRs

  • gh-105820: Fix tok_mode expression buffer in file & readline tokenizer #105828
  • [3.12] gh-105820: Fix tok_mode expression buffer in file & readline tokenizer (GH-105828) #105832

Activity

  1. AlexWaygood
    added
    type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
    on Jun 15, 2023
  2. AlexWaygood
    assigned
    pablogsal
    on Jun 15, 2023
  3. pablogsal commented on Jun 15, 2023

    @pablogsal
    pablogsal
    on Jun 15, 2023
    Member
    More actions

    This failure was visible on the Azure Pipelines job on the PR FYI: https://dev.azure.com/Python/cpython/_build/results?buildId=130389&view=logs&j=256d7e09-002a-52d7-8661-29ee3960640e&t=3d7276d3-4e8d-5309-55ad-fb0b172d9925

    Same comment as #105821 (comment)

  4. AlexWaygood commented on Jun 15, 2023

    @AlexWaygood
    AlexWaygood
    on Jun 15, 2023
    MemberAuthor
    More actions

    Unlike the "hypothesis checks on Ubuntu" job, though, Azure Pipelines is incredibly flaky, it fails all the time for random reasons. So it's not realistic to make that one "required" in CI.

  5. pablogsal commented on Jun 15, 2023

    @pablogsal
    pablogsal
    on Jun 15, 2023
    Member
    More actions

    So it's not realistic to make that one "required" in CI.

    Then we should move the parts we care about to some other check and just remove IMHO because nobody looks at it when merging because is constantly failing.

  6. AlexWaygood commented on Jun 15, 2023

    @AlexWaygood
    AlexWaygood
    on Jun 15, 2023
    MemberAuthor
    More actions

    nobody looks at it when merging

    "nobody" isn't accurate — I generally check failures to see if they're relevant before merging a PR. But I agree with:

    Then we should move the parts we care about to some other check and just remove

    And we've actually started doing that already; the new "lint" job in CI is basically meant to be a replacement for patchcheck.py, for example. Personally I don't care about patchcheck.py; I only opened this issue because I worried this might be indicative of other breakages :)

  7. lysnikolaou
    self-assigned this
    on Jun 15, 2023
  8. pablogsal commented on Jun 15, 2023

    @pablogsal
    pablogsal
    on Jun 15, 2023
    Member
    More actions

    I only opened this issue because I worried this might be indicative of other breakages

    Thanks a lot @AlexWaygood, this is certainly the case and we are investigating. Thanks for all the gray work 🖤

    Reacted by Alex Waygood
  9. hugovk commented on Jun 15, 2023

    @hugovk
    hugovk
    on Jun 15, 2023
    Member
    More actions

    Similarly, see #105823 to remove some duplicated docs building from Azure Pipelines.

    Reacted by Alex Waygood
  10. lysnikolaou commented on Jun 15, 2023

    @lysnikolaou
    lysnikolaou
    on Jun 15, 2023
    Member
    More actions

    I don't really know why we're seeng this just now, but git bisecting shows that this is the first bad commit:

    9216e69a87d16d871625721ed5a8aa302511f367 is the first bad commit
    commit 9216e69a87d16d871625721ed5a8aa302511f367
    Author: Pablo Galindo Salgado <[email protected]>
    Date:   Tue May 30 22:43:34 2023 +0100
    
        gh-105069: Add a readline-like callable to the tokenizer to consume input iteratively (#105070)
    

    The reproducer I used was (the good case):

    cpython (2ea34cf) (BISECTING) via C v14.0.3-clang via 🐍 pyenv 3.11.3 
    ❯ cat tmp/t.py         
    self.assertEqual(f'''{
    3
    =}''', '\n3\n=3')%                                                                                                                                                                                                                                                                                                                                                                                                                  
    
    cpython (2ea34cf) (BISECTING) via C v14.0.3-clang via 🐍 pyenv 3.11.3 
    ❯ ./python.exe -m tokenize tmp/t.py
    0,0-0,0:            ENCODING       'utf-8'        
    1,0-1,4:            NAME           'self'         
    1,4-1,5:            OP             '.'            
    1,5-1,16:           NAME           'assertEqual'  
    1,16-1,17:          OP             '('            
    1,17-1,21:          FSTRING_START  "f'''"         
    1,21-1,22:          OP             '{'            
    1,22-1,23:          NL             '\n'           
    2,0-2,1:            NUMBER         '3'            
    2,1-2,2:            NL             '\n'           
    3,0-3,1:            OP             '='            
    3,1-3,2:            OP             '}'            
    3,2-3,5:            FSTRING_END    "'''"          
    3,5-3,6:            OP             ','            
    3,7-3,16:           STRING         "'\\n3\\n=3'"  
    3,16-3,17:          OP             ')'            
    3,17-3,18:          NEWLINE        '\n'           
    4,0-4,0:            ENDMARKER      ''             

    I'm working on a fix.

    Reacted by Alex Waygood, Pablo Galindo Salgado and Hugo van Kemenade
  11. lysnikolaou
    added 2 commits that reference this issue on Jun 15, 2023

    pythongh-105820: Fix tok_mode expression buffer in file & readline to…

    1ebf46b

    gh-105820: Fix tok_mode expression buffer in file & readline tokenizer (

    d382ad4
  12. miss-islington
    added a commit that references this issue on Jun 15, 2023

    pythongh-105820: Fix tok_mode expression buffer in file & readline to…

    c958269
  13. lysnikolaou commented on Jun 15, 2023

    @lysnikolaou
    lysnikolaou
    on Jun 15, 2023
    Member
    More actions

    Fixed.

    Reacted by Alex Waygood
  14. lysnikolaou
    closed this as completedon Jun 15, 2023
  15. lysnikolaou
    added a commit that references this issue on Jun 15, 2023

    [3.12] gh-105820: Fix tok_mode expression buffer in file & readline t…

    e9cf5a3
  16. carljm
    added a commit that references this issue on Jun 15, 2023

    Merge branch 'main' into modulelocals

    166aca9
  17. gvanrossum
    added a commit that references this issue on Jun 18, 2023

    pythongh-105820: Fix tok_mode expression buffer in file & readline to…

    5862c96
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @lysnikolaou
    lysnikolaou
  • @pablogsal
    pablogsal

Labels

type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402503 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.