Python SystemError: bad BUILD_CONST_KEY_MAP keys argument

755 Views Asked by At

I have some code running in python3.10 and about 80% of the time I get this error

SystemError: bad BUILD_CONST_KEY_MAP keys argument

the error is thrown on a line which sets a value in a map

a_map= defaultdict(lambda: defaultdict(lambda: {}))
a_map[key1][key2] = {...}

The project is fairly large so its hard to share code, although the main issue is that when I place a breakpoint on the line that sets the value in the map (this is the line which the backtrace points to is the cause), no error is thrown. The error only seems to occur when no breakpoint is set.

I am not really sure how to debug this any further, I have put prints in the code to output the map and keys and everything looks valid and fine.

Any pointers on what to check or how to gather more debug information?

0

There are 0 best solutions below