Skip to content

Commit 165c884

Browse files
bpo-43693: Silence some compiler warnings. (gh-26588)
The plan is to eventually make PyCodeObject opaque in the public C-API, with the full struct moved to Include/internal/pycore_code.h. _PyLocalsPlusKinds and _PyLocalsPlusKind started off there but were needed on PyCodeObject, hence the duplication. This led to warnings with some compilers. (Apparently it does not trigger a warning on my install of GCC.) This change eliminates the superfluous typedef. https://bugs.python.org/issue43693
1 parent 631f993 commit 165c884

File tree

2 files changed

+2
-5
lines changed

2 files changed

+2
-5
lines changed

Include/cpython/code.h

-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ typedef uint16_t _Py_CODEUNIT;
2626
typedef struct _PyOpcache _PyOpcache;
2727

2828

29-
// These are duplicated from pycore_code.h.
3029
typedef unsigned char _PyLocalsPlusKind;
3130
typedef _PyLocalsPlusKind *_PyLocalsPlusKinds;
3231

Include/internal/pycore_code.h

+2-4
Original file line numberDiff line numberDiff line change
@@ -167,17 +167,15 @@ extern Py_ssize_t _Py_QuickenedCount;
167167
* "free" kind is mutually exclusive with both.
168168
*/
169169

170-
// We would use an enum if C let us specify the storage type.
171-
typedef unsigned char _PyLocalsPlusKind;
170+
// For now _PyLocalsPlusKind and _PyLocalsPlusKinds are defined
171+
// in Include/cpython/code.h.
172172
/* Note that these all fit within _PyLocalsPlusKind, as do combinations. */
173173
// Later, we will use the smaller numbers to differentiate the different
174174
// kinds of locals (e.g. pos-only arg, varkwargs, local-only).
175175
#define CO_FAST_LOCAL 0x20
176176
#define CO_FAST_CELL 0x40
177177
#define CO_FAST_FREE 0x80
178178

179-
typedef _PyLocalsPlusKind *_PyLocalsPlusKinds;
180-
181179
static inline int
182180
_PyCode_InitLocalsPlusKinds(int num, _PyLocalsPlusKinds *pkinds)
183181
{

0 commit comments

Comments
 (0)