mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +00:00
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:
parent
ed08238327
commit
1a3faba9f1
78 changed files with 472 additions and 464 deletions
|
@ -11,7 +11,8 @@ module instead.
|
|||
#define MODULE_VERSION "1.0"
|
||||
|
||||
#include "Python.h"
|
||||
#include "structmember.h" // PyMemberDef
|
||||
|
||||
#include <stddef.h> // offsetof()
|
||||
#include <stdbool.h>
|
||||
|
||||
/*[clinic input]
|
||||
|
@ -336,9 +337,9 @@ dialect_check_quoting(int quoting)
|
|||
#define D_OFF(x) offsetof(DialectObj, x)
|
||||
|
||||
static struct PyMemberDef Dialect_memberlist[] = {
|
||||
{ "skipinitialspace", T_BOOL, D_OFF(skipinitialspace), READONLY },
|
||||
{ "doublequote", T_BOOL, D_OFF(doublequote), READONLY },
|
||||
{ "strict", T_BOOL, D_OFF(strict), READONLY },
|
||||
{ "skipinitialspace", Py_T_BOOL, D_OFF(skipinitialspace), Py_READONLY },
|
||||
{ "doublequote", Py_T_BOOL, D_OFF(doublequote), Py_READONLY },
|
||||
{ "strict", Py_T_BOOL, D_OFF(strict), Py_READONLY },
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
|
@ -970,8 +971,8 @@ static struct PyMethodDef Reader_methods[] = {
|
|||
#define R_OFF(x) offsetof(ReaderObj, x)
|
||||
|
||||
static struct PyMemberDef Reader_memberlist[] = {
|
||||
{ "dialect", T_OBJECT, R_OFF(dialect), READONLY },
|
||||
{ "line_num", T_ULONG, R_OFF(line_num), READONLY },
|
||||
{ "dialect", _Py_T_OBJECT, R_OFF(dialect), Py_READONLY },
|
||||
{ "line_num", Py_T_ULONG, R_OFF(line_num), Py_READONLY },
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
|
@ -1364,7 +1365,7 @@ static struct PyMethodDef Writer_methods[] = {
|
|||
#define W_OFF(x) offsetof(WriterObj, x)
|
||||
|
||||
static struct PyMemberDef Writer_memberlist[] = {
|
||||
{ "dialect", T_OBJECT, W_OFF(dialect), READONLY },
|
||||
{ "dialect", _Py_T_OBJECT, W_OFF(dialect), Py_READONLY },
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue