@@ -2246,11 +2246,8 @@ compiler_lookup_arg(PyObject *dict, PyObject *name)
2246
2246
2247
2247
static int
2248
2248
compiler_make_closure (struct compiler * c , location loc ,
2249
- PyCodeObject * co , Py_ssize_t flags , PyObject * qualname )
2249
+ PyCodeObject * co , Py_ssize_t flags )
2250
2250
{
2251
- if (qualname == NULL )
2252
- qualname = co -> co_name ;
2253
-
2254
2251
if (co -> co_nfreevars ) {
2255
2252
int i = PyCode_GetFirstFree (co );
2256
2253
for (; i < co -> co_nlocalsplus ; ++ i ) {
@@ -2605,7 +2602,7 @@ static int
2605
2602
compiler_function (struct compiler * c , stmt_ty s , int is_async )
2606
2603
{
2607
2604
PyCodeObject * co ;
2608
- PyObject * qualname , * docstring = NULL ;
2605
+ PyObject * docstring = NULL ;
2609
2606
arguments_ty args ;
2610
2607
expr_ty returns ;
2611
2608
identifier name ;
@@ -2682,19 +2679,15 @@ compiler_function(struct compiler *c, stmt_ty s, int is_async)
2682
2679
}
2683
2680
}
2684
2681
co = assemble (c , 1 );
2685
- qualname = Py_NewRef (c -> u -> u_qualname );
2686
2682
compiler_exit_scope (c );
2687
2683
if (co == NULL ) {
2688
- Py_XDECREF (qualname );
2689
2684
Py_XDECREF (co );
2690
2685
return ERROR ;
2691
2686
}
2692
- if (compiler_make_closure (c , loc , co , funcflags , qualname ) < 0 ) {
2693
- Py_DECREF (qualname );
2687
+ if (compiler_make_closure (c , loc , co , funcflags ) < 0 ) {
2694
2688
Py_DECREF (co );
2695
2689
return ERROR ;
2696
2690
}
2697
- Py_DECREF (qualname );
2698
2691
Py_DECREF (co );
2699
2692
2700
2693
RETURN_IF_ERROR (compiler_apply_decorators (c , decos ));
@@ -2794,7 +2787,7 @@ compiler_class(struct compiler *c, stmt_ty s)
2794
2787
ADDOP (c , loc , LOAD_BUILD_CLASS );
2795
2788
2796
2789
/* 3. load a function (or closure) made from the code object */
2797
- if (compiler_make_closure (c , loc , co , 0 , NULL ) < 0 ) {
2790
+ if (compiler_make_closure (c , loc , co , 0 ) < 0 ) {
2798
2791
Py_DECREF (co );
2799
2792
return ERROR ;
2800
2793
}
@@ -3015,7 +3008,6 @@ static int
3015
3008
compiler_lambda (struct compiler * c , expr_ty e )
3016
3009
{
3017
3010
PyCodeObject * co ;
3018
- PyObject * qualname ;
3019
3011
Py_ssize_t funcflags ;
3020
3012
arguments_ty args = e -> v .Lambda .args ;
3021
3013
assert (e -> kind == Lambda_kind );
@@ -3049,19 +3041,15 @@ compiler_lambda(struct compiler *c, expr_ty e)
3049
3041
ADDOP_IN_SCOPE (c , loc , RETURN_VALUE );
3050
3042
co = assemble (c , 1 );
3051
3043
}
3052
- qualname = Py_NewRef (c -> u -> u_qualname );
3053
3044
compiler_exit_scope (c );
3054
3045
if (co == NULL ) {
3055
- Py_DECREF (qualname );
3056
3046
return ERROR ;
3057
3047
}
3058
3048
3059
- if (compiler_make_closure (c , loc , co , funcflags , qualname ) < 0 ) {
3060
- Py_DECREF (qualname );
3049
+ if (compiler_make_closure (c , loc , co , funcflags ) < 0 ) {
3061
3050
Py_DECREF (co );
3062
3051
return ERROR ;
3063
3052
}
3064
- Py_DECREF (qualname );
3065
3053
Py_DECREF (co );
3066
3054
3067
3055
return SUCCESS ;
@@ -5392,7 +5380,6 @@ compiler_comprehension(struct compiler *c, expr_ty e, int type,
5392
5380
{
5393
5381
PyCodeObject * co = NULL ;
5394
5382
comprehension_ty outermost ;
5395
- PyObject * qualname = NULL ;
5396
5383
int scope_type = c -> u -> u_scope_type ;
5397
5384
int is_async_generator = 0 ;
5398
5385
int is_top_level_await = IS_TOP_LEVEL_AWAIT (c );
@@ -5453,7 +5440,6 @@ compiler_comprehension(struct compiler *c, expr_ty e, int type,
5453
5440
}
5454
5441
5455
5442
co = assemble (c , 1 );
5456
- qualname = Py_NewRef (c -> u -> u_qualname );
5457
5443
compiler_exit_scope (c );
5458
5444
if (is_top_level_await && is_async_generator ){
5459
5445
c -> u -> u_ste -> ste_coroutine = 1 ;
@@ -5463,10 +5449,9 @@ compiler_comprehension(struct compiler *c, expr_ty e, int type,
5463
5449
}
5464
5450
5465
5451
loc = LOC (e );
5466
- if (compiler_make_closure (c , loc , co , 0 , qualname ) < 0 ) {
5452
+ if (compiler_make_closure (c , loc , co , 0 ) < 0 ) {
5467
5453
goto error ;
5468
5454
}
5469
- Py_DECREF (qualname );
5470
5455
Py_DECREF (co );
5471
5456
5472
5457
VISIT (c , expr , outermost -> iter );
@@ -5490,7 +5475,6 @@ compiler_comprehension(struct compiler *c, expr_ty e, int type,
5490
5475
error_in_scope :
5491
5476
compiler_exit_scope (c );
5492
5477
error :
5493
- Py_XDECREF (qualname );
5494
5478
Py_XDECREF (co );
5495
5479
return ERROR ;
5496
5480
}
@@ -8671,7 +8655,7 @@ opcode_metadata_is_sane(cfg_builder *g) {
8671
8655
for (int i = 0 ; i < b -> b_iused ; i ++ ) {
8672
8656
struct instr * instr = & b -> b_instr [i ];
8673
8657
int opcode = instr -> i_opcode ;
8674
- assert (opcode <= MAX_REAL_OPCODE );
8658
+ assert (opcode <= MAX_REAL_OPCODE );
8675
8659
int pushed = _PyOpcode_opcode_metadata [opcode ].n_pushed ;
8676
8660
int popped = _PyOpcode_opcode_metadata [opcode ].n_popped ;
8677
8661
assert ((pushed < 0 ) == (popped < 0 ));
0 commit comments