diff options
author | Brandt Bucher <brandtbucher@microsoft.com> | 2022-03-12 00:31:50 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-12 00:31:50 (GMT) |
commit | a89c29fbcc7e7e85848499443d819c3fab68c78a (patch) | |
tree | 76acc3e4a6d197b98e96cf74ac4b04a917e1bb5b /Include | |
parent | 882d8096c262a5945e0cfdd706e5db3ad2b73543 (diff) | |
download | cpython-a89c29fbcc7e7e85848499443d819c3fab68c78a.zip cpython-a89c29fbcc7e7e85848499443d819c3fab68c78a.tar.gz cpython-a89c29fbcc7e7e85848499443d819c3fab68c78a.tar.bz2 |
bpo-46841: Add a _Py_SET_OPCODE macro (GH-31780)
Diffstat (limited to 'Include')
-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 f3e0761..ab827c5 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 { |