I am a bit confused:
I am using Python 3.4 and py2exe compiling a program to a standalone which is used by another person. I installed the PyOpenSSL Package via pip but I didn't use it in the program. When I tried to compile the program after the installation of the PyOpenSSL I get the maximum recursion depth exceeded in comparison
error. As soon as I unistalled the PyOpenSSL package the error was gone.
How can I fix this?
I know that Python 3.4 is outdated. I will move to Python 3.6 soon.
1 Answers
When we go into a recursion, there is a risk of stack overflow and the Cpython working under the hood does not take it upon itself to optimize tail recursion, so if you go too deep, you will move closer towards a stack overflow. Generally different Cpython/python flavors have different recursion permit depth, So when you use PyOpenSSL, it changes(Overrides) the sys.setrecursionlimit to an even more lower value, hence the python stack you can grow becomes even more constrained.
You can read a bit more and also how to change it (Not recommended) here. https://docs.python.org/3/library/sys.html#sys.setrecursionlimit
And it would be better if you replace it with an iterative version if possible, Python stackframe tend to grow very huge which is no fun for the memory management routines.
Hope that helps.