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-114314: Move types to ctypes_state by vstinner · Pull Request #114316 · python/cpython

Conversation

@vstinner

@vstinner vstinner commented Jan 19, 2024 •
edited by bedevere-app Bot
Loading

Uh oh!

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

Copy link
Copy Markdown
Member

Move types to the ctypes_state structure:

  • PyCArray_Type
  • PyCData_Type
  • PyCFuncPtr_Type
  • PyCPointer_Type
  • Simple_Type

The following macros get an additional state parameter:

  • ArrayObject_Check()
  • CDataObject_Check()
  • CDataObject_CheckExact()
  • PointerObject_Check()
  • PyCFuncPtrObject_Check()

The following function gets an additional state parameter:

  • _PyCData_set()
  • Issue: Convert _ctypes static types (and the "meta class") to heap types #114314

Sorry, something went wrong.

Uh oh!

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

All reactions
@vstinner @neonene
pythongh-114314: Move types to ctypes_state
edc7e6e
Move types to the ctypes_state structure:

* PyCArray_Type
* PyCData_Type
* PyCFuncPtr_Type
* PyCPointer_Type
* Simple_Type

The following macros get an additional state parameter:

* ArrayObject_Check()
* CDataObject_Check()
* CDataObject_CheckExact()
* PointerObject_Check()
* PyCFuncPtrObject_Check()

The following function gets an additional state parameter:

* _PyCData_set()

Co-Authored-By: neonene <[email protected]>
@vstinner vstinner added the skip news label Jan 19, 2024
@bedevere-app bedevere-app Bot added the awaiting core review label Jan 19, 2024
@bedevere-app bedevere-app Bot mentioned this pull request Jan 19, 2024
Convert _ctypes static types (and the "meta class") to heap types #114314
Closed
@vstinner

vstinner commented Jan 19, 2024

Copy link
Copy Markdown
Member Author

This change only prepares the code to convert static types to heap types. It doesn't change the behavior.

It only moves references to types from global variables to the _ctypes state and pass the state to macros and functions using it.

All reactions

Sorry, something went wrong.

Uh oh!

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

@vstinner vstinner mentioned this pull request Jan 19, 2024
gh-103092: Port some _ctypes data types to heap types #113630
Closed
@vstinner

vstinner commented Jan 19, 2024

Copy link
Copy Markdown
Member Author

To keep this change as small as possible, I didn't change the following macros to add a new state parameter.

#define PyCSimpleTypeObject_CheckExact(v)       Py_IS_TYPE(v, GLOBAL_STATE()->PyCSimpleType_Type)
#define PyCSimpleTypeObject_Check(v)    PyObject_TypeCheck(v, GLOBAL_STATE()->PyCSimpleType_Type)
#define PyCArrayTypeObject_Check(v)     PyObject_TypeCheck(v, GLOBAL_STATE()->PyCArrayType_Type)
#define PyCPointerTypeObject_Check(v)   PyObject_TypeCheck(v, GLOBAL_STATE()->PyCPointerType_Type)
#define PyCFuncPtrTypeObject_Check(v)   PyObject_TypeCheck(v, GLOBAL_STATE()->PyCFuncPtrType_Type)
#define PyCStructTypeObject_Check(v)    PyObject_TypeCheck(v, GLOBAL_STATE()->PyCStructType_Type)

These macros can be changed afterwards.

All reactions

Sorry, something went wrong.

Uh oh!

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

@vstinner

vstinner commented Jan 19, 2024

Copy link
Copy Markdown
Member Author

cc @encukou @erlend-aasland @neonene

All reactions

Sorry, something went wrong.

Uh oh!

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

vstinner added 2 commits January 19, 2024 16:09
@vstinner
Fix Windows build
c90c7ae
@vstinner
Set PyCPointer_Type in state
78f9cfb
@neonene

neonene commented Jan 20, 2024

Copy link
Copy Markdown
Contributor

PR #113857, which expects fewer follow-up PRs, can be closed after this is landed.

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 Author

I merged #113857 instead.

All reactions

Sorry, something went wrong.

Uh oh!

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

@vstinner vstinner closed this Jan 22, 2024
@vstinner
vstinner deleted the ctypes_state branch January 22, 2024 13:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

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

Assignees

No one assigned

Labels

awaiting core review 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.

2 participants

@vstinner @neonene
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.