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-81057: Add a CI Check for New Unsupported C Global Variables by ericsnowcurrently · Pull Request #102506 · python/cpython

Conversation

@ericsnowcurrently

@ericsnowcurrently ericsnowcurrently commented Mar 7, 2023 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown
Member

This will keep us from adding new unsupported (i.e. non-const) C global variables, which would break interpreter isolation.

FYI, historically it is very uncommon for new global variables to get added. Furthermore, it is rare for new code to break the c-analyzer. So the check should almost always pass unnoticed.

Note that I've removed test_check_c_globals. A test wasn't a great fit conceptually and was super slow on debug builds. A CI check is a better fit.

(I'm going to sit on this PR for a few days in case there are any concerns with the new CI check. I'll also do a quick double-check with the core team but don't anticipate any real opposition.)

This also resolves gh-100237.

  • Issue: [subinterpreters] Global C variables are a problem #81057

Sorry, something went wrong.

Uh oh!

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

arhadthedev, Eclips4, and erlend-aasland reacted with thumbs up emoji
All reactions
  • 👍 3 reactions
ericsnowcurrently added 5 commits March 7, 2023 10:26
@ericsnowcurrently
Print a helpful message when the globals check fails.
3651ee7
@ericsnowcurrently
Print the explanation even when the parser breaks.
1c1e0b0
@ericsnowcurrently
Enable the CI globals check.
aa08d9d
@ericsnowcurrently
Add the globals check to CI.
94db0e4
@ericsnowcurrently
Drop the test.
68db07f
@ericsnowcurrently ericsnowcurrently added the skip news label Mar 7, 2023
@ericsnowcurrently
ericsnowcurrently requested a review from ezio-melotti as a code owner March 7, 2023 17:33
@bedevere-bot bedevere-bot mentioned this pull request Mar 7, 2023
[subinterpreters] Global C variables are a problem #81057
Closed
@bedevere-bot bedevere-bot added the awaiting core review label Mar 7, 2023
ericsnowcurrently added 13 commits March 7, 2023 10:55
@ericsnowcurrently
Fix the command.
9ed998a
@ericsnowcurrently
Add some temporary debugging code.
5ee7611
@ericsnowcurrently
Accommodate newer GCC versions.
bb1463e
@ericsnowcurrently
Fix the "ignored" filename.
d9f45a8
@ericsnowcurrently
Emit the message from the right script.
f1e5827
@ericsnowcurrently
Print the traceback.
d59e2af
@ericsnowcurrently
Let lineno be 0 for meta files.
a959ccd
@ericsnowcurrently
Allow meta files with flags.
3390014
@ericsnowcurrently
Special-case <command-line>.
8f93550
@ericsnowcurrently
Flush stdout/stderr around the explanation.
76039c0
@ericsnowcurrently
Print preprocessor errors by default.
dc4ee3a
@ericsnowcurrently
Add a possible include dir for uuid.
4c03fd0
@ericsnowcurrently
Add other possible include dirs.
863e152
This was referenced Mar 8, 2023
Update test_check_c_globals to not need distutils & reenable it #100237
Closed
PEP 632: Remove the distutils package (Python 3.12) #92584
Closed
@ericsnowcurrently
ericsnowcurrently removed the request for review from ezio-melotti March 8, 2023 17:37
erlend-aasland
erlend-aasland approved these changes Mar 10, 2023
View reviewed changes

@erlend-aasland erlend-aasland left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM (but patchcheck has white-space complaints)

Sorry, something went wrong.

Uh oh!

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

All reactions
@bedevere-bot bedevere-bot added awaiting merge and removed awaiting core review labels Mar 10, 2023
@ericsnowcurrently

ericsnowcurrently commented Mar 10, 2023

Copy link
Copy Markdown
Member Author

Yeah, it never likes the tabs in the TSV strings in Tools/c-analyzer/cpython/_parser.py.

All reactions

Sorry, something went wrong.

Uh oh!

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

@ericsnowcurrently

ericsnowcurrently commented Mar 10, 2023

Copy link
Copy Markdown
Member Author

I started a thread: https://discuss.python.org/t/adding-a-ci-check-to-detect-new-c-global-variables/24731.

All reactions

Sorry, something went wrong.

Uh oh!

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

CAM-Gerlach
CAM-Gerlach reviewed Mar 11, 2023
View reviewed changes

@CAM-Gerlach CAM-Gerlach left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A couple minor comments; I reviewed the check explanation and didn't find any non-trivial copyediting/proofreading issues.

Sorry, something went wrong.

Uh oh!

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

All reactions
Comment thread .github/workflows/build.yml Resolved

Uh oh!

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

Comment thread .github/workflows/build.yml Resolved

Uh oh!

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

kumaraditya303
kumaraditya303 approved these changes Mar 11, 2023
View reviewed changes
ericsnowcurrently and others added 4 commits March 14, 2023 08:13
@ericsnowcurrently @CAM-Gerlach
Use Same Capitalization as Other Jobs
f230d79
Co-authored-by: C.A.M. Gerlach <[email protected]>
@ericsnowcurrently
Add a make target.
08f9279
@ericsnowcurrently
Merge branch 'main' into enable-globals-ci-check
c220d54
@ericsnowcurrently
Ignore a global that snuck in.
9cc170c
@ericsnowcurrently
ericsnowcurrently merged commit 1ff81c0 into python:main Mar 14, 2023
@bedevere-bot bedevere-bot removed the awaiting merge label Mar 14, 2023
@ericsnowcurrently
ericsnowcurrently deleted the enable-globals-ci-check branch March 14, 2023 16:05
@sobolevn sobolevn mentioned this pull request Mar 14, 2023
gh-102033: Fix syntax error in Tools/c-analyzer #102066
Merged
carljm added a commit to carljm/cpython that referenced this pull request Mar 14, 2023
@carljm
Merge branch 'main' into inlinecomp2
6c5f269
* main: (50 commits)
  pythongh-102674: Remove _specialization_stats from Lib/opcode.py (python#102685)
  pythongh-102660: Handle m_copy Specially for the sys and builtins Modules (pythongh-102661)
  pythongh-102354: change python3 to python in docs examples (python#102696)
  pythongh-81057: Add a CI Check for New Unsupported C Global Variables (pythongh-102506)
  pythonGH-94851: check unicode consistency of static strings in debug mode (python#102684)
  pythongh-100315: clarification to `__slots__` docs. (python#102621)
  pythonGH-100227: cleanup initialization of global interned dict (python#102682)
  doc: Remove a duplicate 'versionchanged' in library/asyncio-task (pythongh-102677)
  pythongh-102013: Add PyUnstable_GC_VisitObjects (python#102014)
  pythonGH-102670: Use sumprod() to simplify, speed up, and improve accuracy of statistics functions (pythonGH-102649)
  pythongh-102627: Replace address pointing toward malicious web page (python#102630)
  pythongh-98831: Use DECREF_INPUTS() more (python#102409)
  pythongh-101659: Avoid Allocation for Shared Exceptions in the _xxsubinterpreters Module (pythongh-102659)
  pythongh-101524: Fix the ChannelID tp_name (pythongh-102655)
  pythongh-102069: Fix `__weakref__` descriptor generation for custom dataclasses (python#102075)
  pythongh-98169 dataclasses.astuple support DefaultDict (python#98170)
  pythongh-102650: Remove duplicate include directives from multiple source files (python#102651)
  pythonGH-100987: Don't cache references to the names and consts array in `_PyEval_EvalFrameDefault`. (python#102640)
  pythongh-87092: refactor assemble() to a number of separate functions, which do not need the compiler struct (python#102562)
  pythongh-102192: Replace PyErr_Fetch/Restore etc by more efficient alternatives (python#102631)
  ...
Fidget-Spinner pushed a commit to Fidget-Spinner/cpython that referenced this pull request Mar 27, 2023
@ericsnowcurrently @Fidget-Spinner
pythongh-81057: Add a CI Check for New Unsupported C Global Variables (…
038b67c
…pythongh-102506)

This will keep us from adding new unsupported (i.e. non-const) C global variables, which would break interpreter isolation.

FYI, historically it is very uncommon for new global variables to get added. Furthermore, it is rare for new code to break the c-analyzer. So the check should almost always pass unnoticed.

Note that I've removed test_check_c_globals. A test wasn't a great fit conceptually and was super slow on debug builds. A CI check is a better fit.

This also resolves pythongh-100237.

python#81057
warsaw pushed a commit to warsaw/cpython that referenced this pull request Apr 11, 2023
@ericsnowcurrently @warsaw
pythongh-81057: Add a CI Check for New Unsupported C Global Variables (…
e20008f
…pythongh-102506)

This will keep us from adding new unsupported (i.e. non-const) C global variables, which would break interpreter isolation.

FYI, historically it is very uncommon for new global variables to get added. Furthermore, it is rare for new code to break the c-analyzer. So the check should almost always pass unnoticed.

Note that I've removed test_check_c_globals. A test wasn't a great fit conceptually and was super slow on debug builds. A CI check is a better fit.

This also resolves pythongh-100237.

python#81057
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@CAM-Gerlach CAM-Gerlach CAM-Gerlach left review comments
@erlend-aasland erlend-aasland erlend-aasland approved these changes
@kumaraditya303 kumaraditya303 kumaraditya303 approved these changes

Uh oh!

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

Assignees

No one assigned

Labels

skip news

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Update test_check_c_globals to not need distutils & reenable it

Uh oh!

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

5 participants

@ericsnowcurrently @erlend-aasland @CAM-Gerlach @kumaraditya303 @bedevere-bot
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 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.