-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Django app behaves differently when debugging #204
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
From @albertinix on October 19, 2017 8:2 At a glance, this might be also linked to https://github.com/DonJayamanne/pythonVSCode/issues/1310 |
@albertinix checked #1310, I doubt that's related to this issue. Will look into this and keep you posted. |
Thanks, I will investigate if the issue is still present in the newly released VSCode 1.18. |
I'm closing this as it has been over a month since we requested more info. If we do get the info at a later date we can re-open this issue. |
Sorry for not following up earlier. It took a while - but I have now identified the exact steps needed to reproduce the problem. However, it is very specific. I'm not sure it belongs here or if it's related to the VSCode debugger. I will write here all the details and let's discuss afterwards. Environment: Python 3.6, Django 1.11 (or 2.0), VSCode 1.19.1, Python extension: 0.9.1
If all was good so far, let's start reproducing the issue:
It seems that the breakpoint on line 9 somehow inhibits Django to do some more processing in order to populate the "request.POST" dictionary. Normally, this member variable should already be populated when the breakpoint on that first line is hit. I'm not entirely sure this is related to the VSCode debugger. But the fact is that without debugging the code works correctly and PyCharm does not exhibit this functionality (breakpoint on first line, "request.POST" populated correctly). Note that in order for this behaviour to be reproduced, line 7 "@csrf_exempt" must be present. If we delete this annotation (which means that Django must do some more processing for the CSRF token), then the "request.POST" dictionary is always populated, no matter where the breakpoint is set. Please test and let me know your thoughts. |
I can confirm that this behavior is also present on Visual Studio 2017 with Python tools. So maybe this bug should also be put on PTVS. Visual Studio 2017 Community Edition (version 15.4.1) |
Thanks for confirming this. |
@DonJayamanne This issue still persists. |
@Taitalus the issue has not yet been fixed. Please monitor the status ( |
Duplicate of #170 |
From @albertinix on October 19, 2017 8:1
Environment data
VS Code version: 1.17.2
Python Extension version: 0.7.0
Python Version: 3.6.0
OS and version: Windows 7 64-bit
Actual behavior
I have a Django app, with a view and a form.
The interesting part is here:
If I set a breakpoint at that line and then skip over it (with F10), then the loginForm object will not be bound (the is_bound property of the form is false).
If however I set the breakpoint one line after that, the loginForm object will be bound.
This is just one example. It happens multiple times over various objects and functions: if I set the breakpoint at one line when calling a function, the result will be "a" (not expected), while if I set the breakpoint after that line, the result is the expected "b".
The debugger seems, in some cases, to introduce some kind of mistakes in code execution.
P.S.: I checked the same app in PyCharm Community and it behaves as it should, debugger or no debugger.
Copied from original issue: DonJayamanne/pythonVSCode#1327
The text was updated successfully, but these errors were encountered: