8000 bpo-46841: Add a `_Py_SET_OPCODE` macro by brandtbucher · Pull Request #31780 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

bpo-46841: Add a _Py_SET_OPCODE macro #31780

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 12, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Fix illegal aliasing
  • Loading branch information
brandtbucher committed Mar 12, 2022
commit ca98da7c532c4c12f670a1a521b17f7e77e6a11d
3 changes: 2 additions & 1 deletion Include/cpython/code.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ typedef uint16_t _Py_CODEUNIT;
# define _Py_MAKECODEUNIT(opcode, oparg) ((opcode)|((oparg)<<8))
#endif

#define _Py_SET_OPCODE(word, opcode) (((uint8_t *)&(word))[0] = (opcode))
// 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 */
Expand Down
0