Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

gh-114314: Move types to ctypes_state#114316

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.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Closed
vstinner wants to merge3 commits intopython:mainfromvstinner:ctypes_state

Conversation

vstinner
Copy link
Member

@vstinnervstinner commentedJan 19, 2024
edited by bedevere-appbot
Loading

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()

Move types to the ctypes_state structure:* PyCArray_Type* PyCData_Type* PyCFuncPtr_Type* PyCPointer_Type* Simple_TypeThe 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 <53406459+neonene@users.noreply.github.com>
@vstinner
Copy link
MemberAuthor

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_ctypesstate and pass the state to macros and functions using it.

@vstinner
Copy link
MemberAuthor

To keep this change as small as possible, I didn't change the following macros to add a newstate 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.

@vstinner
Copy link
MemberAuthor

@neonene
Copy link
Contributor

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

@vstinner
Copy link
MemberAuthor

I merged#113857 instead.

@vstinnervstinner deleted the ctypes_state branchJanuary 22, 2024 13:41
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers
No reviews
Assignees
No one assigned
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

2 participants
@vstinner@neonene

[8]ページ先頭

©2009-2025 Movatter.jp