File tree 4 files changed +10
-16
lines changed
4 files changed +10
-16
lines changed Original file line number Diff line number Diff line change @@ -131,14 +131,14 @@ check by comparing the reference count field to the immortality reference count.
131
131
#define PyObject_HEAD_INIT (type ) \
132
132
{ \
133
133
_PyObject_EXTRA_INIT \
134
- { _Py_IMMORTAL_REFCNT }, \
134
+ _Py_IMMORTAL_REFCNT, \
135
135
(type) \
136
136
},
137
137
#else
138
138
#define PyObject_HEAD_INIT (type ) \
139
139
{ \
140
140
_PyObject_EXTRA_INIT \
141
- { 1 }, \
141
+ 1, \
142
142
(type) \
143
143
},
144
144
#endif /* Py_BUILD_CORE */
@@ -165,12 +165,7 @@ check by comparing the reference count field to the immortality reference count.
165
165
*/
166
166
struct _object {
167
167
_PyObject_HEAD_EXTRA
168
- union {
169
- Py_ssize_t ob_refcnt ;
170
- #if SIZEOF_VOID_P > 4
171
- PY_UINT32_T ob_refcnt_split [2 ];
172
- #endif
173
- };
168
+ Py_ssize_t ob_refcnt ;
174
169
PyTypeObject * ob_type ;
175
170
};
176
171
@@ -624,12 +619,11 @@ static inline Py_ALWAYS_INLINE void Py_INCREF(PyObject *op)
624
619
// directly PyObject.ob_refcnt.
625
620
#if SIZEOF_VOID_P > 4
626
621
// Portable saturated add, branching on the carry flag and set low bits
627
- PY_UINT32_T cur_refcnt = op -> ob_refcnt_split [PY_BIG_ENDIAN ];
628
- PY_UINT32_T new_refcnt = cur_refcnt + 1 ;
629
- if (new_refcnt == 0 ) {
622
+ Py_ssize_t new_refcnt = op -> ob_refcnt + 1 ;
623
+ if ((PY_UINT32_T )new_refcnt == 0 ) {
630
624
return ;
631
625
}
632
- op -> ob_refcnt_split [ PY_BIG_ENDIAN ] = new_refcnt ;
626
+ op -> ob_refcnt = new_refcnt ;
633
627
#else
634
628
// Explicitly check immortality against the immortal value
635
629
if (_Py_IsImmortal (op )) {
Original file line number Diff line number Diff line change @@ -1876,7 +1876,7 @@ PyTypeObject _PyNone_Type = {
1876
1876
1877
1877
PyObject _Py_NoneStruct = {
1878
1878
_PyObject_EXTRA_INIT
1879
- { _Py_IMMORTAL_REFCNT } ,
1879
+ _Py_IMMORTAL_REFCNT ,
1880
1880
& _PyNone_Type
1881
1881
};
1882
1882
@@ -1979,7 +1979,7 @@ PyTypeObject _PyNotImplemented_Type = {
1979
1979
1980
1980
PyObject _Py_NotImplementedStruct = {
1981
1981
_PyObject_EXTRA_INIT
1982
- { _Py_IMMORTAL_REFCNT } ,
1982
+ _Py_IMMORTAL_REFCNT ,
1983
1983
& _PyNotImplemented_Type
1984
1984
};
1985
1985
Original file line number Diff line number Diff line change @@ -2544,6 +2544,6 @@ static PyTypeObject _PySetDummy_Type = {
2544
2544
2545
2545
static PyObject _dummy_struct = {
2546
2546
_PyObject_EXTRA_INIT
2547
- { _Py_IMMORTAL_REFCNT } ,
2547
+ _Py_IMMORTAL_REFCNT ,
2548
2548
& _PySetDummy_Type
2549
2549
};
Original file line number Diff line number Diff line change @@ -99,7 +99,7 @@ PyTypeObject PyEllipsis_Type = {
99
99
100
100
PyObject _Py_EllipsisObject = {
101
101
_PyObject_EXTRA_INIT
102
- { _Py_IMMORTAL_REFCNT } ,
102
+ _Py_IMMORTAL_REFCNT ,
103
103
& PyEllipsis_Type
104
104
};
105
105
You can’t perform that action at this time.
0 commit comments