Debugging asyncio code in PyCharm causes absolutely crazy unrepeatable errors

ε祈祈猫儿з 提交于 2019-12-10 21:18:05

问题


In my project that based on asyncio and asyncio tcp connections that debugs with PyCharm debugger I got very and very very absurd errors.

If I put breakpoint on code after running, the breakpoint never fires. But breakpoints fires if breakpoint has been put before starting program.

But in some cases the firing on breakpoints causes strange errors (if paused on breakpoint and resumed).

The next exceptions I remarked:

  1. TypeError: 'coroutine' object not callable
  2. SystemError: unknown opcode

First exception is very rare. Can be raised in any place on code and unrepeatable. Second exception I remarked the first time recently. This is repeatable in my code. The function where I put breakpoint is function in async task (asyncio.Task). I can't repeat from scratch. But I think the type of exception (unknown opcode??? O_O) should make you think. Besides! The exception vanished if I change the code: for example I added the a = 0 line. Exception not raised after. The deleting a = 0 will return this exception again.

Is this error of kind of esoteric errors?

I think the PyCharm debugger conflicts with asnycio. Or maybe I doing something wrong?


Unknown opcode can be any line of code in the function where breakpoint put. Repeats in specific places in code.


This exception also can be at line, but also inside another function. Very rare and unreproducible


回答1:


which version of python you use? There is new debugger for python3.6 based on inserting opcodes before starting process. You can find some more info in this repo https://github.com/Elizaveta239/frame-eval



来源:https://stackoverflow.com/questions/45936199/debugging-asyncio-code-in-pycharm-causes-absolutely-crazy-unrepeatable-errors

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!