[issue44379] Pickling recursion error, did not import pickle

2021-06-10 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

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.

--
assignee: terry.reedy -> 
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed
versions: +Python 3.10

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44379] Pickling recursion error, did not import pickle

2021-06-10 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

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.

--
nosy: +serhiy.storchaka

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44379] Pickling recursion error, did not import pickle

2021-06-10 Thread Violet Godfrey


New submission from Violet Godfrey :

I accidentally created an infinite recursion. The error referenced pickling but 
I did not import pickle. 

To reproduce: 
def permute(inputList):
'''permute(inputList) -> list
returns list of all permutations of inputList
CURRENTLY DOESN'T ACTUALLLY WORK PROPERLY'''
for i in range(len(inputList)-1):
tempList = inputList[:-i-2]
tempList.append(inputList[-1])
for num in inputList[-i-2:-1]:
tempList.append(num)
print(tempList)
permute(tempList)  # runs infinitely (whoops)
print()

permute([1,2,3,4])

Error thrown: 
Traceback (most recent call last):
  File "C:\Users\Violet\Documents\Python Files\test.py", line 14, in 
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

--
assignee: terry.reedy
components: IDLE
messages: 395542
nosy: Octopi, terry.reedy
priority: normal
severity: normal
status: open
title: Pickling recursion error, did not import pickle
type: behavior
versions: Python 3.8

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com