gh-119180: Add LOAD_COMMON_CONSTANT opcode (#119321)

The PEP 649 implementation will require a way to load NotImplementedError
from the bytecode. @markshannon suggested implementing this by converting
LOAD_ASSERTION_ERROR into a more general mechanism for loading constants.

This PR adds this new opcode. I will work on the rest of the implementation
of the PEP separately.

Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
This commit is contained in:
Jelle Zijlstra 2024-05-21 20:46:39 -04:00 committed by GitHub
parent 506b1a3ff6
commit 98e855fcc1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
22 changed files with 337 additions and 288 deletions

View file

@ -2,16 +2,16 @@
unsigned char M_test_frozenmain[] = {
227,0,0,0,0,0,0,0,0,0,0,0,0,8,0,0,
0,0,0,0,0,243,166,0,0,0,149,0,83,0,83,1,
75,0,114,0,83,0,83,1,75,1,114,1,92,2,34,0,
83,2,53,1,0,0,0,0,0,0,32,0,92,2,34,0,
83,3,92,0,82,6,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,53,2,0,0,0,0,0,0,
32,0,92,1,82,8,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,34,0,53,0,0,0,0,0,
0,0,83,4,5,0,0,0,114,5,83,5,19,0,72,20,
0,0,114,6,92,2,34,0,83,6,92,6,14,0,83,7,
92,5,92,6,5,0,0,0,14,0,51,4,53,1,0,0,
0,0,0,0,32,0,77,22,0,0,11,0,32,0,103,1,
74,0,114,0,83,0,83,1,74,1,114,1,92,2,33,0,
83,2,52,1,0,0,0,0,0,0,31,0,92,2,33,0,
83,3,92,0,81,6,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,52,2,0,0,0,0,0,0,
31,0,92,1,81,8,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,33,0,52,0,0,0,0,0,
0,0,83,4,5,0,0,0,114,5,83,5,19,0,71,20,
0,0,114,6,92,2,33,0,83,6,92,6,14,0,83,7,
92,5,92,6,5,0,0,0,14,0,50,4,52,1,0,0,
0,0,0,0,31,0,76,22,0,0,11,0,31,0,103,1,
41,8,233,0,0,0,0,78,122,18,70,114,111,122,101,110,
32,72,101,108,108,111,32,87,111,114,108,100,122,8,115,121,
115,46,97,114,103,118,218,6,99,111,110,102,105,103,41,5,