0

I am trying to modify the source code for the eval() function, in my own file, so I need the source code.

I have tried writing eval with an error, but that just says error in . I tried using the inspect function, but that said "TypeError: is a built-in class ".

This is what I did for inspect:

import inspect
print(inspect.getsource(eval))

Can you tell me how to find it, or even just give me a link to github file?

1
  • Why do you want to modify eval? What are you trying to accomplish? Commented May 24, 2019 at 3:19

1 Answer 1

3

Even though some python functions are written in python, most core functions are actually implemented in C.

Here is the source code for the eval() function.

Sign up to request clarification or add additional context in comments.

3 Comments

Too bad I can't use it, since it is written in C
At the end of call chain, it finally uses PyEval_EvalCode or PyRun_StringFlags functions.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.