MediumWORKING OF PYTHON ENGINE. When the source code is send to python… | by SHASHANK SAI RAJ | Medium
Sitemap
SHASHANK SAI RAJ

SHASHANK SAI RAJ

WORKING OF PYTHON ENGINE

2 min readAug 10, 2026
Press enter or click to view image in full size

When the source code is send to python engineer it first checks set of instructions with syntax checker whether the program is following python rules and grammar in python engine and if the program is with no syntax error it goes to next step if not it shows error and stops , if the program is not with any mistakes then it sends to compiler and compiles checks the whole and if any mistake occurs in program it shows error if the program is correct then its sends the program to interpreter by converting the program into byte code and the interpreter checks the program in line by line if any error occurs it shows the exact location where the error occurs here, in interpreter we get exception error due to logic . If all the program is correct then the interpreter sends code to Python Virtual Machine (PVM).Then the PVM execute the code and turns into low level language .

Press enter or click to view image in full size

The process from source code to byte code is called compilation.

Get SHASHANK SAI RAJ’s stories in your inbox

Join Medium for free to get updates from this writer.

The process from byte code to execution , the PVM executes the byte code this is known as runtime.

1. Syntax Error
Python first checks whether the source code follows the correct Python syntax. If something is wrong, such as a missing ( : ) , it gives a syntax error and does not continue.

2. Compiler
If the syntax is correct, the Python compiler compiles the source code into bytecode.

3. Bytecode
Bytecode is an intermediate set of instructions produced from the Python source code. It is not machine language.

4. Interpreter
The Python interpreter is the overall program that processes and executes Python code. In CPython, the interpreter includes the mechanisms that compile source code and execute bytecode.

5. PVM (Python Virtual Machine)
The PVM is the part pf CPython that executes the byte code during runtime.

--

--