The struct member requires a name, as only anonymous structs are currently permitted in standard C++.
(And since the original issue invokes PEP 7, I'll do the same and point out that "The public C API should be compatible with C++". The intention of this clause is that standard C++ can #include <Python.h>, which is currently broken.)
Activity
pythongh-101907: Removes use of non-standard C++ extension from Inclu…
markshannon commented on Feb 14, 2023
Rather than replace all the .opcode and .oparg with SHOUTY MACROS, how about:
typedef union { uint16_t cache; struct { uint8_t code; uint8_t arg; } op; } _Py_CODEUNIT;Then i.oparg becomes i.op.arg which is still readable.
zooba commented on Feb 14, 2023
Do we want that to be the API then? And so we should remove the macros entirely?
If we're going to have macros, I'd rather they be the only place we have to make a change like this.
markshannon commented on Feb 14, 2023
Personally, I'd say get rid of the macros.
At least the uses of them. We should probably keep the declarations in case any third-party code is using them.
Merge remote-tracking branch 'cpython/main' into pythongh-101907-2
gh-101907: Stop using `_Py_OPCODE` and `_Py_OPARG` macros (GH-101912)
pythongh-101907: Stop using `_Py_OPCODE` and `_Py_OPARG` macros (pyth…
Merge branch 'main' into inlinecomp2
Merge branch 'main' into inlinecomp
pythongh-101907: Stop using `_Py_OPCODE` and `_Py_OPARG` macros (pyth…
pythongh-101907: Stop using `_Py_OPCODE` and `_Py_OPARG` macros (pyth…