New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pickling recursion error, did not import pickle #88545
Comments
I accidentally created an infinite recursion. The error referenced pickling but I did not import pickle. To reproduce: permute([1,2,3,4]) Error thrown:
Traceback (most recent call last):
File "C:\Users\Violet\Documents\Python Files\test.py", line 14, in <module>
permute([1,2,3,4])
File "C:\Users\Violet\Documents\Python Files\test.py", line 11, in permute
permute(tempList) # runs infinitely (whoops)
File "C:\Users\Violet\Documents\Python Files\test.py", line 11, in permute
permute(tempList) # runs infinitely (whoops)
File "C:\Users\Violet\Documents\Python Files\test.py", line 11, in permute
permute(tempList) # runs infinitely (whoops)
[Previous line repeated 1009 more times]
File "C:\Users\Violet\Documents\Python Files\test.py", line 10, in permute
print(tempList)
RecursionError: maximum recursion depth exceeded while pickling an object |
It is because you run the code in IDLE. print(tempList) converts argument to string and write it to sys.stdout. In IDLE sys.stdout is a proxy object which uses RPC to communicate with the IDLE process which should insert the written text in the console text widget. Pickle is used for encoding command and arguments. Here you get a recursion error in pickle because when print(tempList) is executed the recursion depth almost reached the limit. |
The 'while pickling' part of the message is specific to running in IDLE, as Serhiy explained, but the recursion error itself is due to writing a program with infinite recursion. The program switches the last two items back and forth indefinitely. When run directly in Python, it gives the same error, with a different 'while' part. Violet, this tracker is for patching Python docs and the CPython interpreter. Please ask questions about program behavior elsewhere, such as python-list. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: