gh-106869: Use new PyMemberDef constant names (#106871)

* Remove '#include "structmember.h"'.
* If needed, add <stddef.h> to get offsetof() function.
* Update Parser/asdl_c.py to regenerate Python/Python-ast.c.
* Replace:

  * T_SHORT => Py_T_SHORT
  * T_INT => Py_T_INT
  * T_LONG => Py_T_LONG
  * T_FLOAT => Py_T_FLOAT
  * T_DOUBLE => Py_T_DOUBLE
  * T_STRING => Py_T_STRING
  * T_OBJECT => _Py_T_OBJECT
  * T_CHAR => Py_T_CHAR
  * T_BYTE => Py_T_BYTE
  * T_UBYTE => Py_T_UBYTE
  * T_USHORT => Py_T_USHORT
  * T_UINT => Py_T_UINT
  * T_ULONG => Py_T_ULONG
  * T_STRING_INPLACE => Py_T_STRING_INPLACE
  * T_BOOL => Py_T_BOOL
  * T_OBJECT_EX => Py_T_OBJECT_EX
  * T_LONGLONG => Py_T_LONGLONG
  * T_ULONGLONG => Py_T_ULONGLONG
  * T_PYSSIZET => Py_T_PYSSIZET
  * T_NONE => _Py_T_NONE
  * READONLY => Py_READONLY
  * PY_AUDIT_READ => Py_AUDIT_READ
  * READ_RESTRICTED => Py_AUDIT_READ
  * PY_WRITE_RESTRICTED => _Py_WRITE_RESTRICTED
  * RESTRICTED => (READ_RESTRICTED | _Py_WRITE_RESTRICTED)
This commit is contained in:
Victor Stinner 2023-07-25 15:28:30 +02:00 committed by GitHub
parent ed08238327
commit 1a3faba9f1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
78 changed files with 472 additions and 464 deletions

View file

@ -9,7 +9,7 @@
#include "pycore_pystate.h" // _PyThreadState_SetCurrent()
#include "pycore_weakref.h" // _PyWeakref_GET_REF()
#include <stddef.h> // offsetof()
#include "structmember.h" // PyMemberDef
#ifdef HAVE_SIGNAL_H
# include <signal.h> // SIGINT
@ -293,7 +293,7 @@ unlock it. A thread attempting to lock a lock that it has already locked\n\
will block until another thread unlocks it. Deadlocks may ensue.");
static PyMemberDef lock_type_members[] = {
{"__weaklistoffset__", T_PYSSIZET, offsetof(lockobject, in_weakreflist), READONLY},
{"__weaklistoffset__", Py_T_PYSSIZET, offsetof(lockobject, in_weakreflist), Py_READONLY},
{NULL},
};
@ -575,7 +575,7 @@ static PyMethodDef rlock_methods[] = {
static PyMemberDef rlock_type_members[] = {
{"__weaklistoffset__", T_PYSSIZET, offsetof(rlockobject, in_weakreflist), READONLY},
{"__weaklistoffset__", Py_T_PYSSIZET, offsetof(rlockobject, in_weakreflist), Py_READONLY},
{NULL},
};
@ -679,7 +679,7 @@ localdummy_dealloc(localdummyobject *self)
}
static PyMemberDef local_dummy_type_members[] = {
{"__weaklistoffset__", T_PYSSIZET, offsetof(localdummyobject, weakreflist), READONLY},
{"__weaklistoffset__", Py_T_PYSSIZET, offsetof(localdummyobject, weakreflist), Py_READONLY},
{NULL},
};
@ -959,7 +959,7 @@ local_setattro(localobject *self, PyObject *name, PyObject *v)
static PyObject *local_getattro(localobject *, PyObject *);
static PyMemberDef local_type_members[] = {
{"__weaklistoffset__", T_PYSSIZET, offsetof(localobject, weakreflist), READONLY},
{"__weaklistoffset__", Py_T_PYSSIZET, offsetof(localobject, weakreflist), Py_READONLY},
{NULL},
};