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 — gh-133158: Adjust c-analyzer max_sizes for typeobject.c by sergey-miryanov · Pull Request #133159 · python/cpython

gh-133158: Adjust c-analyzer max_sizes for typeobject.c #133159

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.

Sign up for GitHub

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

Merged
ZeroIntensity merged 13 commits into python:main from sergey-miryanov:gh-133158-adjust-c-analyzer-limits
Sep 2, 2025

Uh oh!

There was an error while loading. Please reload this page.

Merged

gh-133158: Adjust c-analyzer max_sizes for typeobject.c #133159

Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
13 commits
Select commit Hold shift + click to select a range
cec1f7a
Adjust c-analyzer max_sizes for typeobject.c
sergey-miryanov Apr 25, 2025
45be756
Extend error messages if too much code to c-analyzer
sergey-miryanov Apr 30, 2025
ce4b06c
Make linter happy
sergey-miryanov Apr 30, 2025
01d2a21
Merge branch 'main' into gh-133158-adjust-c-analyzer-limits
sergey-miryanov Jun 13, 2025
e492c49
Merge branch 'main' into gh-133158-adjust-c-analyzer-limits
sergey-miryanov Jul 22, 2025
c514255
Address review comments
sergey-miryanov Jul 22, 2025
4369d2d
Fix dedent usage
sergey-miryanov Jul 22, 2025
e60d28c
Update Tools/c-analyzer/c_parser/parser/__init__.py
sergey-miryanov Jul 23, 2025
3c40c29
Merge branch 'main' into gh-133158-adjust-c-analyzer-limits
sergey-miryanov Aug 1, 2025
278f4d3
Rename too_much_lines to too_many_lines
sergey-miryanov Aug 1, 2025
8fc1349
Merge branch 'gh-133158-adjust-c-analyzer-limits' of github.com:serge…
sergey-miryanov Aug 1, 2025
639e005
Move textwrap import to the top
sergey-miryanov Aug 2, 2025
ff1d028
Merge branch 'main' into gh-133158-adjust-c-analyzer-limits
ZeroIntensity Sep 2, 2025
File filter
Filter by extension

Clear filters
Conversations
Failed to load comments.
Loading

Uh oh!

There was an error while loading. Please reload this page.

Jump to
Jump to file
Failed to load files.
Loading

Uh oh!

There was an error while loading. Please reload this page.

Diff view
Diff view

There are no files selected for viewing

24 changes: 22 additions & 2 deletions 24 Tools/c-analyzer/c_parser/parser/__init__.py
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,27 @@ def _iter_source(lines, *, maxtext=11_000, maxlines=200, showtext=False):
return
# At this point either the file ended prematurely
# or there's "too much" text.
filename, lno, text = srcinfo.filename, srcinfo._start, srcinfo.text
filename, lno_from, lno_to = srcinfo.filename, srcinfo.start, srcinfo.end
text = srcinfo.text
if len(text) > 500:
text = text[:500] + '...'
raise Exception(f'unmatched text ({filename} starting at line {lno}):\n{text}')

if srcinfo.too_much_text(maxtext):
msg = [
'too much text, try to increase MAX_SIZES[MAXTEXT] in cpython/_parser.py',
f'{filename} starting at line {lno_from} to {lno_to}',
f'has code with length {len(text)} greater than {maxtext}:',
text
]
Comment thread
sergey-miryanov marked this conversation as resolved.
Resolved

Uh oh!

There was an error while loading. Please reload this page.

raise Exception('\n'.join(msg))
Comment thread
sergey-miryanov marked this conversation as resolved.
Resolved

Uh oh!

There was an error while loading. Please reload this page.


if srcinfo.too_much_lines(maxlines):
msg = [
'too much lines, try to increase MAX_SIZES[MAXLINES] in cpython/_parser.py',
f'{filename} starting at line {lno_from} to {lno_to}',
f'has code with number of lines {lno_to - lno_from} greater than {maxlines}:',
text
]
raise Exception('\n'.join(msg))

raise Exception(f'unmatched text ({filename} starting at line {lno_from}):\n{text}')
10 changes: 8 additions & 2 deletions 10 Tools/c-analyzer/c_parser/parser/_info.py
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,16 @@ def resolve(self, kind, data, name, parent=None):
def done(self):
self._set_ready()

def too_much_text(self, maxtext):
return maxtext and len(self.text) > maxtext

def too_much_lines(self, maxlines):
return maxlines and self.end - self.start > maxlines

def too_much(self, maxtext, maxlines):
if maxtext and len(self.text) > maxtext:
if self.too_much_text(maxtext):
pass
elif maxlines and self.end - self.start > maxlines:
elif self.too_much_lines(maxlines):
Comment thread
sergey-miryanov marked this conversation as resolved.
Resolved

Uh oh!

There was an error while loading. Please reload this page.

pass
else:
return False
Expand Down
2 changes: 1 addition & 1 deletion 2 Tools/c-analyzer/cpython/_parser.py
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ def clean_lines(text):
_abs('Modules/_testcapimodule.c'): (20_000, 400),
_abs('Modules/expat/expat.h'): (10_000, 400),
_abs('Objects/stringlib/unicode_format.h'): (10_000, 400),
_abs('Objects/typeobject.c'): (35_000, 200),
_abs('Objects/typeobject.c'): (380_000, 13_000),
Comment thread
ZeroIntensity marked this conversation as resolved.
Resolved

Uh oh!

There was an error while loading. Please reload this page.

_abs('Python/compile.c'): (20_000, 500),
_abs('Python/optimizer.c'): (100_000, 5_000),
_abs('Python/parking_lot.c'): (40_000, 1000),
Expand Down
Add this suggestion to a batch that can be applied as a single commit. This suggestion is invalid because no changes were made to the code. Suggestions cannot be applied while the pull request is closed. Suggestions cannot be applied while viewing a subset of changes. Only one suggestion per line can be applied in a batch. Add this suggestion to a batch that can be applied as a single commit. Applying suggestions on deleted lines is not supported. You must change the existing code in this line in order to create a valid suggestion. Outdated suggestions cannot be applied. This suggestion has been applied or marked resolved. Suggestions cannot be applied from pending reviews. Suggestions cannot be applied on multi-line comments. Suggestions cannot be applied while the pull request is queued to merge. Suggestion cannot be applied right now. Please check back later.
You are visitor 01402520 — 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.