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?

Nv7
  • 376
  • 4
  • 19
  • Why do you want to modify `eval`? What are you trying to accomplish? – blhsing May 24 '19 at 03:19
  • `eval` is implemented in C. That is why [`inspect.getsource resulting in TypeError`](https://stackoverflow.com/questions/52968628/finding-the-source-code-of-methods-implemented-in-c).You can find the [source code of `eval` here](https://github.com/python/cpython/blob/3191391515824fa7f3c573d807f1034c6a28fab3/Python/clinic/bltinmodule.c.h#L326) – Abdul Niyas P M May 24 '19 at 03:22

1 Answers1

0

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.

Alec
  • 7,110
  • 7
  • 28
  • 53