Python Forum
How to recognize, what functions are filled in of the Python interpreter stack?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to recognize, what functions are filled in of the Python interpreter stack?
#1
Python 3.7.2

I wrote a program using the asyncio library. If I run it, then after a short time I get the error "maximum recursion depth exceeded while calling a Python object". In the code, I never use recursion anywhere, so I want to know the names of the functions that occupied the entire of Python's stack.

How to do it?
Reply
#2
Currently I try to debug my own program. I use for this pudb, which is a curses version of pdb.
https://pypi.org/project/pudb/

Instead of continue, you can step in and watch what happens on the stack and what is called.
Here a screencast

It's nice to see, that the German Python community has also cool projects online.
Almost dead, but too lazy to die: https://sourceserver.info
All humans together. We don't need politicians!
Reply
#3
Thank you!
But my program consists of about two hundred files and the error does not appear immediately. I think it is almost impossible to trace this error with the help of such a simplified tool.
Reply
#4
Thanks to all!
It turned out that the error was that the events were not reusable.
import asyncio, time

async def waiter(event, index_corrutine, start):
    print('start: ' + str(index_corrutine) + '\ttime=' + str(round(time.time()-start)))
    await event.wait()
    print('end: ' + str(index_corrutine) + '\ttime=' + str(round(time.time()-start)))

async def main():
    # Create an Event object.
    event = asyncio.Event()

    start = time.time()
    waiter_task1 = asyncio.create_task(waiter(event, 1, start))
    await asyncio.sleep(3)
    event.set()
    waiter_task2 = asyncio.create_task(waiter(event, 2, start))
    await asyncio.sleep(1)
    event.set()

    # Wait until the waiters of tasks is finished.
    await waiter_task1, waiter_task2

asyncio.run(main())
exit(1)
Output:
start: 1 time=0 end: 1 time=3 start: 2 time=3 end: 2 time=3
That is, after the event is set, it stops doing something, but does not throw an exception. Therefore, it seems that everything works correctly.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  python cant recognize PIP siubikYT 2 705 Jul-19-2023, 06:30 PM
Last Post: Lahearle
  Mac default python interpreter Viewpoint8455 2 874 Oct-13-2022, 06:25 AM
Last Post: perfringo
  Python Interpreter ankitdixit 4 2,620 Jun-10-2022, 12:37 PM
Last Post: katy1234
Photo Visual studio code unable to color syntax on python interpreter tomtom 4 6,681 Mar-02-2022, 01:23 AM
Last Post: tomtom
  Is it possible to make a program recognize how many clicks it has had on the monitor? jao 0 1,126 Feb-25-2022, 06:31 PM
Last Post: jao
  How to set Tab size to 4 in Python interpreter? zzzhhh 1 1,795 Jan-18-2022, 12:11 PM
Last Post: snippsat
  readline.parse_and_bind() does not work in start-up script of Python interpreter zzzhhh 0 1,473 Jan-18-2022, 11:05 AM
Last Post: zzzhhh
  Find last filled column in openpyxl Irv1n 2 12,554 Jan-16-2022, 11:05 AM
Last Post: Pedroski55
  Making a hotel filled with people categorizing them lucasrohr 3 1,412 Jan-09-2022, 05:13 PM
Last Post: lucasrohr
  My program won't recognize the filename. braingoblins 1 1,095 Jan-07-2022, 06:18 PM
Last Post: deanhystad

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020