I wouldn't be surprised if "re-write Python" is in the training set.
This is really what people conflagrate so often with these tasks, it is basically making the model do recall what could also be a "ant_ag_ds_90917_rwpy9_final" git clone
CPython is in the training data, but this was a tree walking interpreter, so it wasn't just regurgitating cpython. I capped it as 1000 lines for the first 20% of the project, it is currently 13.3kloc and 575k in a single file.
Rewrite X in Y is an ideal RL task given you have X as an oracle trivially.
You can also consider that open source version of RustPython existed 6 years ago and probably in all LLMs dataset