在PyCharm中调试异步代码会导致绝对疯狂的不可重复的错误 [英] Debugging asyncio code in PyCharm causes absolutely crazy unrepeatable errors

查看:191
本文介绍了在PyCharm中调试异步代码会导致绝对疯狂的不可重复的错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的基于PyCharm调试器进行调试的基于asyncio和asyncio tcp连接的项目中,我遇到了非常非常荒谬的错误。

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).

下一个例外:


  1. TypeError:协程对象不可调用

  2. SystemError:未知操作码

第一个异常非常罕见。可以在代码上的任何地方提出并且不可重复。
我最近第一次评论过第二个例外。这在我的代码中是可重复的。我放置断点的函数是异步任务( asyncio.Task )中的函数。我不能从头开始重复。但是我认为异常的类型(未知的操作码?O_O)应该让您思考。
此外!如果更改代码,该异常消失:例如,我添加了 a = 0 行。之后未引发异常。删除 a = 0 会再次返回此异常。

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?

我认为PyCharm调试器与asnycio冲突。
还是我做错了什么?

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

推荐答案

您使用的是哪个版本的python用?有一个新的python3.6调试器,该调试器基于在开始过程之前插入操作码。您可以在此仓库中找到更多信息 https://github.com/Elizaveta239/frame-eval

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

这篇关于在PyCharm中调试异步代码会导致绝对疯狂的不可重复的错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆