generate_packets.py: generate_stats doesn't work
The attached fix is relatively simple and generates compiling code that works as usual without issues. However, because of #43988, the resulting stats generation cannot easily be tested in its natural environment yet.
Update: I tested it with a temporary, ad-hoc fix for #43988, and everything seems to be in order.
The generate_stats option, which, prior to #43938, can only be set by changing the code, and which has never been enabled, doesn't work (crashes with an AttributeError). It can't ever have worked, even in the original version of the script.
Since the option has apparently never been used in its over eighteen years of existing, the question is whether it's worth fixing, or should be removed entirely.