I am considering creating a coding puzzle where the point would be that different versions of python behave differently. For this, I would like to prevent the player-provided python script from trivially figuring out the python version.
I consider approaches like these trivial :
- Calling a function or reading a variable to get the version. E.g. from
sys
- Reading the version from an environment variable
- Figuring out the path of the python installation and finding the version there
I would be surprised if it is possible to really completely hide it, because the python interpreter necessarily needs to be able to access its own files. But for my purposes it would be enough to make reading the version harder than determining different version behaviours. How could I do this with reasonable effort?
I am willing to monkey-patch the distributions, completely messing up some files in the machine, maybe even building the python source myself with a different version number, or perhaps audit hooks could be helpful (in newer versions). But I am not clear on what exactly I would need to be aware of.