【问题标题】:IntelliJ/PyCharm Debugging with Conditional Breakpoint: Function parameter not defined使用条件断点进行 IntelliJ/PyCharm 调试:未定义函数参数
【发布时间】:2021-06-09 11:53:56
【问题描述】:

我在 Mac 上使用 Python 3.9 在 IntelliJ 2020.03 中观察到以下奇怪行为(但这也发生在 Ubuntu 系统上的另一个 IntelliJ 版本上)。

如果我们考虑以下最小示例:

def foo(bar):
   pass

foo(False)

现在我在 IntelliJ 的第 2 行中设置了一个 条件 断点,条件是:

[bar for _ in range(1)]

当我现在在调试模式下运行脚本时,出现错误:

Error while evaluating expression: [bar for _ in range(1)]
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "<string>", line 1, in <listcomp>
NameError: name 'bar' is not defined

所以我的问题很简单:为什么 bar 没有在生成器中定义? (复现的关键点是在某些生成器中引用bar,否则它被定义(当然?)

【问题讨论】:

    标签: python debugging intellij-idea pycharm conditional-breakpoint


    【解决方案1】:

    很遗憾,已确认为错误https://youtrack.jetbrains.com/issue/PY-47695

    对于给您带来的不便,我深表歉意。

    【讨论】:

      猜你喜欢
      • 2018-10-09
      • 2015-03-13
      • 1970-01-01
      • 2016-04-22
      • 1970-01-01
      • 2019-08-30
      • 2010-09-22
      • 2015-12-22
      • 1970-01-01
      相关资源
      最近更新 更多