Skip to content

Commit f475d9d

Browse files
committed
Rename Py_TPFLAGS_INLINE_VALUES as _Py_TPFLAGS_INLINE_VALUES as it should not be used by third-party code.
1 parent 8f93dd8 commit f475d9d

File tree

13 files changed

+46
-46
lines changed

13 files changed

+46
-46
lines changed

Include/internal/pycore_object.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -944,7 +944,7 @@ _PyObject_InlineValues(PyObject *obj)
944944
{
945945
PyTypeObject *tp = Py_TYPE(obj);
946946
assert(tp->tp_basicsize > 0 && (size_t)tp->tp_basicsize % sizeof(PyObject *) == 0);
947-
assert(Py_TYPE(obj)->tp_flags & Py_TPFLAGS_INLINE_VALUES);
947+
assert(Py_TYPE(obj)->tp_flags & _Py_TPFLAGS_INLINE_VALUES);
948948
assert(Py_TYPE(obj)->tp_flags & Py_TPFLAGS_MANAGED_DICT);
949949
return (PyDictValues *)((char *)obj + tp->tp_basicsize);
950950
}

Include/object.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -513,7 +513,7 @@ given type object has a specified feature.
513513
/* The values array is placed inline directly after the rest of
514514
* the object. Implies Py_TPFLAGS_HAVE_GC.
515515
*/
516-
#define Py_TPFLAGS_INLINE_VALUES (1 << 2)
516+
#define _Py_TPFLAGS_INLINE_VALUES (1 << 2)
517517

518518
/* Placement of weakref pointers are managed by the VM, not by the type.
519519
* The VM will automatically set tp_weaklistoffset.

Modules/_testinternalcapi.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1322,7 +1322,7 @@ static PyObject *
13221322
get_object_dict_values(PyObject *self, PyObject *obj)
13231323
{
13241324
PyTypeObject *type = Py_TYPE(obj);
1325-
if (!_PyType_HasFeature(type, Py_TPFLAGS_INLINE_VALUES)) {
1325+
if (!_PyType_HasFeature(type, _Py_TPFLAGS_INLINE_VALUES)) {
13261326
Py_RETURN_NONE;
13271327
}
13281328
PyDictValues *values = _PyObject_InlineValues(obj);
@@ -1982,7 +1982,7 @@ get_tlbc_id(PyObject *Py_UNUSED(module), PyObject *obj)
19821982
static PyObject *
19831983
has_inline_values(PyObject *self, PyObject *obj)
19841984
{
1985-
if ((Py_TYPE(obj)->tp_flags & Py_TPFLAGS_INLINE_VALUES) &&
1985+
if ((Py_TYPE(obj)->tp_flags & _Py_TPFLAGS_INLINE_VALUES) &&
19861986
_PyObject_InlineValues(obj)->valid) {
19871987
Py_RETURN_TRUE;
19881988
}

Objects/dictobject.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6677,7 +6677,7 @@ void
66776677
_PyObject_InitInlineValues(PyObject *obj, PyTypeObject *tp)
66786678
{
66796679
assert(tp->tp_flags & Py_TPFLAGS_HEAPTYPE);
6680-
assert(tp->tp_flags & Py_TPFLAGS_INLINE_VALUES);
6680+
assert(tp->tp_flags & _Py_TPFLAGS_INLINE_VALUES);
66816681
assert(tp->tp_flags & Py_TPFLAGS_MANAGED_DICT);
66826682
PyDictKeysObject *keys = CACHED_KEYS(tp);
66836683
assert(keys != NULL);
@@ -6798,7 +6798,7 @@ store_instance_attr_lock_held(PyObject *obj, PyDictValues *values,
67986798
PyDictKeysObject *keys = CACHED_KEYS(Py_TYPE(obj));
67996799
assert(keys != NULL);
68006800
assert(values != NULL);
6801-
assert(Py_TYPE(obj)->tp_flags & Py_TPFLAGS_INLINE_VALUES);
6801+
assert(Py_TYPE(obj)->tp_flags & _Py_TPFLAGS_INLINE_VALUES);
68026802
Py_ssize_t ix = DKIX_EMPTY;
68036803
PyDictObject *dict = _PyObject_GetManagedDict(obj);
68046804
assert(dict == NULL || ((PyDictObject *)dict)->ma_values == values);
@@ -7069,7 +7069,7 @@ _PyObject_IsInstanceDictEmpty(PyObject *obj)
70697069
return 1;
70707070
}
70717071
PyDictObject *dict;
7072-
if (tp->tp_flags & Py_TPFLAGS_INLINE_VALUES) {
7072+
if (tp->tp_flags & _Py_TPFLAGS_INLINE_VALUES) {
70737073
PyDictValues *values = _PyObject_InlineValues(obj);
70747074
if (FT_ATOMIC_LOAD_UINT8(values->valid)) {
70757075
PyDictKeysObject *keys = CACHED_KEYS(tp);
@@ -7102,7 +7102,7 @@ PyObject_VisitManagedDict(PyObject *obj, visitproc visit, void *arg)
71027102
if((tp->tp_flags & Py_TPFLAGS_MANAGED_DICT) == 0) {
71037103
return 0;
71047104
}
7105-
if (tp->tp_flags & Py_TPFLAGS_INLINE_VALUES) {
7105+
if (tp->tp_flags & _Py_TPFLAGS_INLINE_VALUES) {
71067106
PyDictValues *values = _PyObject_InlineValues(obj);
71077107
if (values->valid) {
71087108
for (Py_ssize_t i = 0; i < values->capacity; i++) {
@@ -7219,7 +7219,7 @@ set_or_clear_managed_dict(PyObject *obj, PyObject *new_dict, bool clear)
72197219
#endif
72207220
int err = 0;
72217221
PyTypeObject *tp = Py_TYPE(obj);
7222-
if (tp->tp_flags & Py_TPFLAGS_INLINE_VALUES) {
7222+
if (tp->tp_flags & _Py_TPFLAGS_INLINE_VALUES) {
72237223
#ifdef Py_GIL_DISABLED
72247224
PyDictObject *prev_dict;
72257225
if (!try_set_dict_inline_only_or_other_dict(obj, new_dict, &prev_dict)) {
@@ -7335,7 +7335,7 @@ _PyDict_DetachFromObject(PyDictObject *mp, PyObject *obj)
73357335
ASSERT_WORLD_STOPPED_OR_OBJ_LOCKED(mp);
73367336
assert(mp->ma_values->embedded == 1);
73377337
assert(mp->ma_values->valid == 1);
7338-
assert(Py_TYPE(obj)->tp_flags & Py_TPFLAGS_INLINE_VALUES);
7338+
assert(Py_TYPE(obj)->tp_flags & _Py_TPFLAGS_INLINE_VALUES);
73397339

73407340
PyDictValues *values = copy_values(mp->ma_values);
73417341

@@ -7358,7 +7358,7 @@ ensure_managed_dict(PyObject *obj)
73587358
PyDictObject *dict = _PyObject_GetManagedDict(obj);
73597359
if (dict == NULL) {
73607360
PyTypeObject *tp = Py_TYPE(obj);
7361-
if ((tp->tp_flags & Py_TPFLAGS_INLINE_VALUES) &&
7361+
if ((tp->tp_flags & _Py_TPFLAGS_INLINE_VALUES) &&
73627362
FT_ATOMIC_LOAD_UINT8(_PyObject_InlineValues(obj)->valid)) {
73637363
dict = _PyObject_MaterializeManagedDict(obj);
73647364
}
@@ -7402,7 +7402,7 @@ ensure_nonmanaged_dict(PyObject *obj, PyObject **dictptr)
74027402
PyTypeObject *tp = Py_TYPE(obj);
74037403
if (_PyType_HasFeature(tp, Py_TPFLAGS_HEAPTYPE) && (cached = CACHED_KEYS(tp))) {
74047404
PyInterpreterState *interp = _PyInterpreterState_GET();
7405-
assert(!_PyType_HasFeature(tp, Py_TPFLAGS_INLINE_VALUES));
7405+
assert(!_PyType_HasFeature(tp, _Py_TPFLAGS_INLINE_VALUES));
74067406
dict = new_dict_with_shared_keys(interp, cached);
74077407
}
74087408
else {
@@ -7624,7 +7624,7 @@ _PyDict_SendEvent(int watcher_bits,
76247624
static int
76257625
_PyObject_InlineValuesConsistencyCheck(PyObject *obj)
76267626
{
7627-
if ((Py_TYPE(obj)->tp_flags & Py_TPFLAGS_INLINE_VALUES) == 0) {
7627+
if ((Py_TYPE(obj)->tp_flags & _Py_TPFLAGS_INLINE_VALUES) == 0) {
76287628
return 1;
76297629
}
76307630
assert(Py_TYPE(obj)->tp_flags & Py_TPFLAGS_MANAGED_DICT);

Objects/object.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1518,7 +1518,7 @@ _PyObject_GetDictPtr(PyObject *obj)
15181518
return _PyObject_ComputedDictPointer(obj);
15191519
}
15201520
PyDictObject *dict = _PyObject_GetManagedDict(obj);
1521-
if (dict == NULL && Py_TYPE(obj)->tp_flags & Py_TPFLAGS_INLINE_VALUES) {
1521+
if (dict == NULL && Py_TYPE(obj)->tp_flags & _Py_TPFLAGS_INLINE_VALUES) {
15221522
dict = _PyObject_MaterializeManagedDict(obj);
15231523
if (dict == NULL) {
15241524
PyErr_Clear();
@@ -1594,7 +1594,7 @@ _PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method)
15941594
}
15951595
}
15961596
PyObject *dict, *attr;
1597-
if ((tp->tp_flags & Py_TPFLAGS_INLINE_VALUES) &&
1597+
if ((tp->tp_flags & _Py_TPFLAGS_INLINE_VALUES) &&
15981598
_PyObject_TryGetInstanceAttribute(obj, name, &attr)) {
15991599
if (attr != NULL) {
16001600
*method = attr;
@@ -1696,7 +1696,7 @@ _PyObject_GenericGetAttrWithDict(PyObject *obj, PyObject *name,
16961696
}
16971697
}
16981698
if (dict == NULL) {
1699-
if ((tp->tp_flags & Py_TPFLAGS_INLINE_VALUES)) {
1699+
if ((tp->tp_flags & _Py_TPFLAGS_INLINE_VALUES)) {
17001700
if (PyUnicode_CheckExact(name) &&
17011701
_PyObject_TryGetInstanceAttribute(obj, name, &res)) {
17021702
if (res != NULL) {
@@ -1812,7 +1812,7 @@ _PyObject_GenericSetAttrWithDict(PyObject *obj, PyObject *name,
18121812
if (dict == NULL) {
18131813
PyObject **dictptr;
18141814

1815-
if ((tp->tp_flags & Py_TPFLAGS_INLINE_VALUES)) {
1815+
if ((tp->tp_flags & _Py_TPFLAGS_INLINE_VALUES)) {
18161816
res = _PyObject_StoreInstanceAttribute(obj, name, value);
18171817
goto error_check;
18181818
}
@@ -1883,7 +1883,7 @@ PyObject_GenericSetDict(PyObject *obj, PyObject *value, void *context)
18831883
{
18841884
PyObject **dictptr = _PyObject_GetDictPtr(obj);
18851885
if (dictptr == NULL) {
1886-
if (_PyType_HasFeature(Py_TYPE(obj), Py_TPFLAGS_INLINE_VALUES) &&
1886+
if (_PyType_HasFeature(Py_TYPE(obj), _Py_TPFLAGS_INLINE_VALUES) &&
18871887
_PyObject_GetManagedDict(obj) == NULL
18881888
) {
18891889
/* Was unable to convert to dict */

Objects/typeobject.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2197,7 +2197,7 @@ type_call(PyObject *self, PyObject *args, PyObject *kwds)
21972197
PyObject *
21982198
_PyType_NewManagedObject(PyTypeObject *type)
21992199
{
2200-
assert(type->tp_flags & Py_TPFLAGS_INLINE_VALUES);
2200+
assert(type->tp_flags & _Py_TPFLAGS_INLINE_VALUES);
22012201
assert(_PyType_IS_GC(type));
22022202
assert(type->tp_new == PyBaseObject_Type.tp_new);
22032203
assert(type->tp_alloc == PyType_GenericAlloc);
@@ -2222,7 +2222,7 @@ _PyType_AllocNoTrack(PyTypeObject *type, Py_ssize_t nitems)
22222222
size_t size = _PyObject_VAR_SIZE(type, nitems+1);
22232223

22242224
const size_t presize = _PyType_PreHeaderSize(type);
2225-
if (type->tp_flags & Py_TPFLAGS_INLINE_VALUES) {
2225+
if (type->tp_flags & _Py_TPFLAGS_INLINE_VALUES) {
22262226
assert(type->tp_itemsize == 0);
22272227
size += _PyInlineValuesSize(type);
22282228
}
@@ -2246,7 +2246,7 @@ _PyType_AllocNoTrack(PyTypeObject *type, Py_ssize_t nitems)
22462246
else {
22472247
_PyObject_InitVar((PyVarObject *)obj, type, nitems);
22482248
}
2249-
if (type->tp_flags & Py_TPFLAGS_INLINE_VALUES) {
2249+
if (type->tp_flags & _Py_TPFLAGS_INLINE_VALUES) {
22502250
_PyObject_InitInlineValues(obj, type);
22512251
}
22522252
return obj;
@@ -2399,8 +2399,8 @@ subtype_clear(PyObject *self)
23992399
PyObject_ClearManagedDict(self);
24002400
}
24012401
else {
2402-
assert((base->tp_flags & Py_TPFLAGS_INLINE_VALUES) ==
2403-
(type->tp_flags & Py_TPFLAGS_INLINE_VALUES));
2402+
assert((base->tp_flags & _Py_TPFLAGS_INLINE_VALUES) ==
2403+
(type->tp_flags & _Py_TPFLAGS_INLINE_VALUES));
24042404
}
24052405
}
24062406
else if (type->tp_dictoffset != base->tp_dictoffset) {
@@ -5953,7 +5953,7 @@ type_setattro(PyObject *self, PyObject *name, PyObject *value)
59535953
}
59545954

59555955
PyTypeObject *metatype = Py_TYPE(type);
5956-
assert(!_PyType_HasFeature(metatype, Py_TPFLAGS_INLINE_VALUES));
5956+
assert(!_PyType_HasFeature(metatype, _Py_TPFLAGS_INLINE_VALUES));
59575957
assert(!_PyType_HasFeature(metatype, Py_TPFLAGS_MANAGED_DICT));
59585958

59595959
PyObject *old_value = NULL;
@@ -6769,8 +6769,8 @@ compatible_for_assignment(PyTypeObject* oldto, PyTypeObject* newto, const char*
67696769
!same_slots_added(newbase, oldbase))) {
67706770
goto differs;
67716771
}
6772-
if ((oldto->tp_flags & Py_TPFLAGS_INLINE_VALUES) !=
6773-
((newto->tp_flags & Py_TPFLAGS_INLINE_VALUES)))
6772+
if ((oldto->tp_flags & _Py_TPFLAGS_INLINE_VALUES) !=
6773+
((newto->tp_flags & _Py_TPFLAGS_INLINE_VALUES)))
67746774
{
67756775
goto differs;
67766776
}
@@ -6859,7 +6859,7 @@ object_set_class_world_stopped(PyObject *self, PyTypeObject *newto)
68596859
if (compatible_for_assignment(oldto, newto, "__class__")) {
68606860
/* Changing the class will change the implicit dict keys,
68616861
* so we must materialize the dictionary first. */
6862-
if (oldto->tp_flags & Py_TPFLAGS_INLINE_VALUES) {
6862+
if (oldto->tp_flags & _Py_TPFLAGS_INLINE_VALUES) {
68636863
PyDictObject *dict = _PyObject_GetManagedDict(self);
68646864
if (dict == NULL) {
68656865
dict = _PyObject_MaterializeManagedDict_LockHeld(self);
@@ -8543,7 +8543,7 @@ type_ready_managed_dict(PyTypeObject *type)
85438543
}
85448544
}
85458545
if (type->tp_itemsize == 0) {
8546-
type->tp_flags |= Py_TPFLAGS_INLINE_VALUES;
8546+
type->tp_flags |= _Py_TPFLAGS_INLINE_VALUES;
85478547
}
85488548
return 0;
85498549
}

Python/bytecodes.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2162,7 +2162,7 @@ dummy_func(
21622162
op(_CHECK_MANAGED_OBJECT_HAS_VALUES, (owner -- owner)) {
21632163
PyObject *owner_o = PyStackRef_AsPyObjectBorrow(owner);
21642164
assert(Py_TYPE(owner_o)->tp_dictoffset < 0);
2165-
assert(Py_TYPE(owner_o)->tp_flags & Py_TPFLAGS_INLINE_VALUES);
2165+
assert(Py_TYPE(owner_o)->tp_flags & _Py_TPFLAGS_INLINE_VALUES);
21662166
DEOPT_IF(!_PyObject_InlineValues(owner_o)->valid);
21672167
}
21682168

@@ -2362,7 +2362,7 @@ dummy_func(
23622362
PyObject *owner_o = PyStackRef_AsPyObjectBorrow(owner);
23632363

23642364
assert(Py_TYPE(owner_o)->tp_dictoffset < 0);
2365-
assert(Py_TYPE(owner_o)->tp_flags & Py_TPFLAGS_INLINE_VALUES);
2365+
assert(Py_TYPE(owner_o)->tp_flags & _Py_TPFLAGS_INLINE_VALUES);
23662366
if (_PyObject_GetManagedDict(owner_o) ||
23672367
!FT_ATOMIC_LOAD_UINT8(_PyObject_InlineValues(owner_o)->valid)) {
23682368
UNLOCK_OBJECT(owner_o);
@@ -3254,7 +3254,7 @@ dummy_func(
32543254

32553255
op(_GUARD_DORV_VALUES_INST_ATTR_FROM_DICT, (owner -- owner)) {
32563256
PyObject *owner_o = PyStackRef_AsPyObjectBorrow(owner);
3257-
assert(Py_TYPE(owner_o)->tp_flags & Py_TPFLAGS_INLINE_VALUES);
3257+
assert(Py_TYPE(owner_o)->tp_flags & _Py_TPFLAGS_INLINE_VALUES);
32583258
DEOPT_IF(!_PyObject_InlineValues(owner_o)->valid);
32593259
}
32603260

Python/executor_cases.c.h

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Python/gc.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2269,15 +2269,15 @@ _PyObject_GC_New(PyTypeObject *tp)
22692269
{
22702270
size_t presize = _PyType_PreHeaderSize(tp);
22712271
size_t size = _PyObject_SIZE(tp);
2272-
if (_PyType_HasFeature(tp, Py_TPFLAGS_INLINE_VALUES)) {
2272+
if (_PyType_HasFeature(tp, _Py_TPFLAGS_INLINE_VALUES)) {
22732273
size += _PyInlineValuesSize(tp);
22742274
}
22752275
PyObject *op = gc_alloc(tp, size, presize);
22762276
if (op == NULL) {
22772277
return NULL;
22782278
}
22792279
_PyObject_Init(op, tp);
2280-
if (tp->tp_flags & Py_TPFLAGS_INLINE_VALUES) {
2280+
if (tp->tp_flags & _Py_TPFLAGS_INLINE_VALUES) {
22812281
_PyObject_InitInlineValues(op, tp);
22822282
}
22832283
return op;

Python/gc_free_threading.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1839,15 +1839,15 @@ _PyObject_GC_New(PyTypeObject *tp)
18391839
{
18401840
size_t presize = _PyType_PreHeaderSize(tp);
18411841
size_t size = _PyObject_SIZE(tp);
1842-
if (_PyType_HasFeature(tp, Py_TPFLAGS_INLINE_VALUES)) {
1842+
if (_PyType_HasFeature(tp, _Py_TPFLAGS_INLINE_VALUES)) {
18431843
size += _PyInlineValuesSize(tp);
18441844
}
18451845
PyObject *op = gc_alloc(tp, size, presize);
18461846
if (op == NULL) {
18471847
return NULL;
18481848
}
18491849
_PyObject_Init(op, tp);
1850-
if (tp->tp_flags & Py_TPFLAGS_INLINE_VALUES) {
1850+
if (tp->tp_flags & _Py_TPFLAGS_INLINE_VALUES) {
18511851
_PyObject_InitInlineValues(op, tp);
18521852
}
18531853
return op;

0 commit comments

Comments
 (0)