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-103092: Ensure `_ctypes.c` static types are accessed via global state by neonene · Pull Request #113857 · python/cpython

Conversation

@neonene

@neonene neonene commented Jan 9, 2024 •
edited by bedevere-app Bot
Loading

Uh oh!

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

Copy link
Copy Markdown
Contributor

This sets in place the ctypes_state *st = GLOBAL_STATE() statements to make the coming PRs smaller. Suggested by @encukou: #113630 (comment)

cc @erlend-aasland

  • Issue: Isolate Stdlib Extension Modules #103092

Sorry, something went wrong.

Uh oh!

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

All reactions
@bedevere-app bedevere-app Bot added the awaiting review label Jan 9, 2024
@bedevere-app bedevere-app Bot mentioned this pull request Jan 9, 2024
Isolate Stdlib Extension Modules #103092
Closed
24 of 25 tasks
@neonene neonene changed the title gh-103092: Ensure '_ctypes.c' static types are accessed via global state gh-103092: Ensure _ctypes.c static types are accessed via global state Jan 9, 2024
@erlend-aasland

erlend-aasland commented Jan 9, 2024

Copy link
Copy Markdown
Contributor

See also ongoing work by @aisk in #113620. Perhaps you could coordinate your efforts?

All reactions

Sorry, something went wrong.

Uh oh!

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

@erlend-aasland
erlend-aasland requested review from encukou and erlend-aasland January 9, 2024 21:05
@encukou

encukou commented Jan 10, 2024

Copy link
Copy Markdown
Member

@erlend-aasland, do you want to review these two PRs?
If you merge one I'll be happy to resolve the conflicts on the other one.

erlend-aasland reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

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

@erlend-aasland

erlend-aasland commented Jan 10, 2024

Copy link
Copy Markdown
Contributor

@erlend-aasland, do you want to review these two PRs? If you merge one I'll be happy to resolve the conflicts on the other one.

Sure, I'll get to it later today.

All reactions

Sorry, something went wrong.

Uh oh!

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

@erlend-aasland erlend-aasland self-assigned this Jan 10, 2024
erlend-aasland
erlend-aasland reviewed Jan 17, 2024
View reviewed changes
Comment thread Modules/_ctypes/callbacks.c Resolved

Uh oh!

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

@neonene

neonene commented Jan 17, 2024

Copy link
Copy Markdown
Contributor Author

Done. I'll update this after #113620 is merged.

erlend-aasland reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

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

@neonene neonene closed this Jan 18, 2024
@neonene neonene changed the title gh-103092: Ensure _ctypes.c static types are accessed via global state Ensure _ctypes.c static types are accessed via global state Jan 18, 2024
@neonene
Add pointers to ctypes_state
401685c
@neonene neonene reopened this Jan 18, 2024
@neonene neonene changed the title Ensure _ctypes.c static types are accessed via global state gh-103092: Ensure _ctypes.c static types are accessed via global state Jan 18, 2024
@neonene
Merge branch 'python:main' into ctypes_ready
2564bc1
@neonene

neonene commented Jan 18, 2024

Copy link
Copy Markdown
Contributor Author

I think this is ready for review. Sorry for mistakenly wiping out old commits (from web).

Actual diff with a1ade06:

Details
--- Modules/_ctypes/_ctypes.c
+++ Modules/_ctypes/_ctypes.c
@@ -128,13 +128,6 @@
-static PyTypeObject UnionType_Type;
 static PyTypeObject Union_Type;
 static PyTypeObject Struct_Type;
 static PyTypeObject Simple_Type;
 
 ctypes_state global_state = {
     .PyCStgDict_Type = &PyCStgDict_Type,
-    .PyCStructType_Type = &PyCStructType_Type,
-    .UnionType_Type = &UnionType_Type,
-    .PyCPointerType_Type = &PyCPointerType_Type,
-    .PyCArrayType_Type = &PyCArrayType_Type,
-    .PyCSimpleType_Type = &PyCSimpleType_Type,
-    .PyCFuncPtrType_Type = &PyCFuncPtrType_Type,
All reactions

Sorry, something went wrong.

Uh oh!

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

neonene added 2 commits January 19, 2024 10:39
@neonene
curly brackets in *Type_new()
7aa65d6
@neonene
follow a1ade06 (remove brackets)
b8d43e1
aisk
aisk reviewed Jan 19, 2024
View reviewed changes
Comment thread Modules/_ctypes/ctypes.h Resolved

Uh oh!

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

@neonene
move PyComError_Type to bottom
93aa060
@neonene neonene mentioned this pull request Jan 20, 2024
gh-114314: Move types to ctypes_state #114316
Closed
@vstinner vstinner added the skip news label Jan 22, 2024
@vstinner
vstinner merged commit 9f7176d into python:main Jan 22, 2024
@bedevere-app bedevere-app Bot removed the awaiting review label Jan 22, 2024
@vstinner vstinner mentioned this pull request Jan 22, 2024
Convert _ctypes static types (and the "meta class") to heap types #114314
Closed
@erlend-aasland

erlend-aasland commented Jan 22, 2024

Copy link
Copy Markdown
Contributor

Thanks, Victor!

All reactions

Sorry, something went wrong.

Uh oh!

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

@vstinner

vstinner commented Jan 22, 2024

Copy link
Copy Markdown
Member

I merged this change which is a good start for futher work. I closed my similar duplicated (less complete) PR.

All reactions

Sorry, something went wrong.

Uh oh!

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

@neonene
neonene deleted the ctypes_ready branch January 22, 2024 17:49
aisk pushed a commit to aisk/cpython that referenced this pull request Feb 11, 2024
@neonene @aisk
pythongh-103092: Ensure _ctypes.c static types are accessed via glo…
0e7f840
…bal state (python#113857)
Glyphack pushed a commit to Glyphack/cpython that referenced this pull request Sep 2, 2024
@neonene @Glyphack
pythongh-103092: Ensure _ctypes.c static types are accessed via glo…
6df0164
…bal state (python#113857)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@aisk aisk aisk left review comments
@erlend-aasland erlend-aasland erlend-aasland left review comments
@encukou encukou Awaiting requested review from encukou

Uh oh!

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

Assignees

@erlend-aasland erlend-aasland

Labels

skip news

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

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

5 participants

@neonene @erlend-aasland @encukou @vstinner @aisk
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.