Commit 804760bf authored by Damien George's avatar Damien George
Browse files

py: Fix bug in compiler for empty class bases.

Eg class A(): pass would fail an assertion.
parent 0997af93
......@@ -955,8 +955,13 @@ qstr compile_classdef_helper(compiler_t *comp, mp_parse_node_struct_t *pns, uint
EMIT_ARG(load_const_id, cscope->simple_name);
// nodes[1] has parent classes, if any
// empty parenthesis (eg class C():) gets here as an empty PN_classdef_2 and needs special handling
mp_parse_node_t parents = pns->nodes[1];
if (MP_PARSE_NODE_IS_STRUCT_KIND(parents, PN_classdef_2)) {
comp->func_arg_is_super = false;
compile_trailer_paren_helper(comp, pns->nodes[1], false, 2);
compile_trailer_paren_helper(comp, parents, false, 2);
// return its name (the 'C' in class C(...):")
return cscope->simple_name;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment