I am running code on my command-line interface with python 3. However, I am confused about why dis.distb()
does not give me an assembly language code for an error in print("Hello World)
with missing quotes.
C:\Users\jarvis>python
Python 3.7.2 (tags/v3.7.2:9a3ffc0492, Dec 23 2018, 22:20:52) [MSC v.1916 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import dis
>>> print("Hello World)
File "<stdin>", line 1
print("Hello World)
^
SyntaxError: EOL while scanning string literal
>>> dis.distb()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\jarvis\AppData\Local\Programs\Python\Python37-32\lib\dis.py", line 86, in distb
while tb.tb_next: tb = tb.tb_next
AttributeError: 'NoneType' object has no attribute 'tb_next'
This code gives me an assembly code for the print function that misses the letter 't'
>>> prin("Hello World")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'prin' is not defined
>>> dis.distb()
1 --> 0 LOAD_NAME 0 (prin)
2 LOAD_CONST 0 ('Hello World')
4 CALL_FUNCTION 1
6 PRINT_EXPR
8 LOAD_CONST 1 (None)
10 RETURN_VALUE
>>>
What is the difference in the error types above? I am trying to understand how python works in this situation.