Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IntelliJ/PyCharm Debugging with Conditional Breakpoint: Function parameter not defined

I am observing the following weird behavior in IntelliJ 2020.03 with Python 3.9 on a Mac (but this also occurrs on another IntelliJ Version on an Ubuntu system).

If we consider the following minimal example:

def foo(bar):
   pass

foo(False)

Now I set a conditional breakpoint in IntelliJ in line 2 that conditions on:

[bar for _ in range(1)]

When I now run the script in debug mode, I get an error:

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

So my question is simple: Why is bar not defined in the generator? (The crucial point to reproduce is to reference bar in some generator, otherwise it is defined (of course?)

like image 800
BSL Avatar asked Mar 13 '26 22:03

BSL


1 Answers

Regrettably, it has been confirmed as a bug https://youtrack.jetbrains.com/issue/PY-47695.

I apologize for the inconvenience.

like image 80
Antonina Belianskaya Avatar answered Mar 16 '26 11:03

Antonina Belianskaya



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!