py: Fix bug in compiler for empty class bases.

Eg class A(): pass would fail an assertion.
This commit is contained in:
Damien George 2014-03-30 23:06:37 +01:00
parent 0997af932f
commit 804760bfca

View file

@ -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)) {
parents = MP_PARSE_NODE_NULL;
}
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;