diff options
| author | Brandt Bucher <brandtbucher@microsoft.com> | 2022-03-11 16:31:50 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-03-11 16:31:50 -0800 |
| commit | a89c29fbcc7e7e85848499443d819c3fab68c78a (patch) | |
| tree | 76acc3e4a6d197b98e96cf74ac4b04a917e1bb5b /Include/cpython/code.h | |
| parent | 882d8096c262a5945e0cfdd706e5db3ad2b73543 (diff) | |
| download | cpython-git-a89c29fbcc7e7e85848499443d819c3fab68c78a.tar.gz | |
bpo-46841: Add a _Py_SET_OPCODE macro (GH-31780)
Diffstat (limited to 'Include/cpython/code.h')
| -rw-r--r-- | Include/cpython/code.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/Include/cpython/code.h b/Include/cpython/code.h index f3e0761d95..ab827c5ae8 100644 --- a/Include/cpython/code.h +++ b/Include/cpython/code.h @@ -23,6 +23,9 @@ typedef uint16_t _Py_CODEUNIT; # define _Py_MAKECODEUNIT(opcode, oparg) ((opcode)|((oparg)<<8)) #endif +// Use "unsigned char" instead of "uint8_t" here to avoid illegal aliasing: +#define _Py_SET_OPCODE(word, opcode) (((unsigned char *)&(word))[0] = (opcode)) + /* Bytecode object */ struct PyCodeObject { |
