Skip to content

Commit b38b8b8

Browse files
Clean up.
1 parent cfa6fe9 commit b38b8b8

File tree

4 files changed

+12
-7
lines changed

4 files changed

+12
-7
lines changed

Include/descrobject.h

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -80,11 +80,14 @@ struct PyMemberDef {
8080
#define _Py_T_NONE 20 // Deprecated. Value is always None.
8181

8282
/* Flags */
83-
#define Py_READONLY 1
84-
#define Py_AUDIT_READ 2 // Added in 3.10, harmless no-op before that
85-
#define _Py_WRITE_RESTRICTED 4 // Deprecated, no-op. Do not reuse the value.
86-
#define Py_RELATIVE_OFFSET 8
87-
#define _Py_AFTER_ITEMS 16
83+
#define Py_READONLY (1 << 0)
84+
#define Py_AUDIT_READ (1 << 1) // Added in 3.10, harmless no-op before that
85+
#define _Py_WRITE_RESTRICTED (1 << 2) // Deprecated, no-op. Do not reuse the value.
86+
#define Py_RELATIVE_OFFSET (1 << 3)
87+
88+
#ifndef Py_LIMITED_API
89+
# define _Py_AFTER_ITEMS (1 << 4) // For internal use.
90+
#endif
8891

8992
PyAPI_FUNC(PyObject *) PyMember_GetOne(const char *, PyMemberDef *);
9093
PyAPI_FUNC(int) PyMember_SetOne(char *, PyMemberDef *, PyObject *);

Include/internal/pycore_descrobject.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ typedef propertyobject _PyPropertyObject;
2222

2323
extern PyTypeObject _PyMethodWrapper_Type;
2424

25+
extern void *_PyMember_GetOffset(PyObject *, PyMemberDef *);
26+
2527
#ifdef __cplusplus
2628
}
2729
#endif

Objects/typeobject.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
#include "pycore_abstract.h" // _PySequence_IterSearch()
55
#include "pycore_call.h" // _PyObject_VectorcallTstate()
66
#include "pycore_code.h" // CO_FAST_FREE
7+
#include "pycore_descrobject.h" // _PyMember_GetOffset()
78
#include "pycore_dict.h" // _PyDict_KeysSize()
89
#include "pycore_function.h" // _PyFunction_GetVersionForCurrentState()
910
#include "pycore_interpframe.h" // _PyInterpreterFrame
@@ -2568,8 +2569,6 @@ _PyHeapType_GET_MEMBERS(PyHeapTypeObject* type)
25682569
return PyObject_GetItemData((PyObject *)type);
25692570
}
25702571

2571-
void *_PyMember_GetOffset(PyObject *obj, PyMemberDef *l);
2572-
25732572
static int
25742573
traverse_slots(PyTypeObject *type, PyObject *self, visitproc visit, void *arg)
25752574
{

Python/structmember.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
#include "Python.h"
55
#include "pycore_abstract.h" // _PyNumber_Index()
6+
#include "pycore_descrobject.h" // _PyMember_GetOffset()
67
#include "pycore_long.h" // _PyLong_IsNegative()
78
#include "pycore_object.h" // _Py_TryIncrefCompare(), FT_ATOMIC_*()
89
#include "pycore_critical_section.h"

0 commit comments

Comments
 (0)