Need to find source code for print or printf in python

I am working on something that I cannot fully talk about. All I can say is that I am a student in the field of information security and computer science.

I just need to change some source code of something deep inside python. For now, I would like to change the source code inside the built-in print function. Unfortunately, I cannot find that it is defined anywhere in python source files.

Any ideas whatsoever?

Thank you very much.

EDIT: In particular, the question was asked whether the print function in Python can be overwritten by something else. This was intended to install backdoor in the Python interpreter.

+4
source share
1 answer

In cpython, the print function is implemented in C, not Python. You can find the source code here , but you will have to recompile cpython for the changes to take effect.

To implement print in Python, check out the pypy version .

+11
source

Source: https://habr.com/ru/post/1442455/


All Articles