Ah, actually this is that unlikely case, when code needs to be generated and saved to a file (I need to follow up some generated structures).
I thought that there might be some flag, which disables this behavior, but filter_lineno solves the problem, thanks! Btw, why do you use esc(), isn’t it redundant?