diff options
Diffstat (limited to 'lisp/progmodes/python.el')
| -rw-r--r-- | lisp/progmodes/python.el | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index 2f353feb323..2cb108cc316 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el | |||
| @@ -1664,7 +1664,11 @@ uniqueness for different types of configurations." | |||
| 1664 | 1664 | ||
| 1665 | (defun python-shell-parse-command () | 1665 | (defun python-shell-parse-command () |
| 1666 | "Calculate the string used to execute the inferior Python process." | 1666 | "Calculate the string used to execute the inferior Python process." |
| 1667 | (format "%s %s" python-shell-interpreter python-shell-interpreter-args)) | 1667 | (let ((process-environment (python-shell-calculate-process-environment)) |
| 1668 | (exec-path (python-shell-calculate-exec-path))) | ||
| 1669 | (format "%s %s" | ||
| 1670 | (executable-find python-shell-interpreter) | ||
| 1671 | python-shell-interpreter-args))) | ||
| 1668 | 1672 | ||
| 1669 | (defun python-shell-calculate-process-environment () | 1673 | (defun python-shell-calculate-process-environment () |
| 1670 | "Calculate process environment given `python-shell-virtualenv-path'." | 1674 | "Calculate process environment given `python-shell-virtualenv-path'." |
| @@ -2323,15 +2327,17 @@ Argument OUTPUT is a string with the output from the comint process." | |||
| 2323 | (file-name | 2327 | (file-name |
| 2324 | (with-temp-buffer | 2328 | (with-temp-buffer |
| 2325 | (insert full-output) | 2329 | (insert full-output) |
| 2326 | (goto-char (point-min)) | 2330 | ;; When the debugger encounters a pdb.set_trace() |
| 2327 | ;; OK, this sucked but now it became a cool hack. The | 2331 | ;; command, it prints a single stack frame. Sometimes |
| 2328 | ;; stacktrace information normally is on the first line | 2332 | ;; it prints a bit of extra information about the |
| 2329 | ;; but in some cases (like when doing a step-in) it is | 2333 | ;; arguments of the present function. When ipdb |
| 2330 | ;; on the second. | 2334 | ;; encounters an exception, it prints the _entire_ stack |
| 2331 | (when (or (looking-at python-pdbtrack-stacktrace-info-regexp) | 2335 | ;; trace. To handle all of these cases, we want to find |
| 2332 | (and | 2336 | ;; the _last_ stack frame printed in the most recent |
| 2333 | (forward-line) | 2337 | ;; batch of output, then jump to the corrsponding |
| 2334 | (looking-at python-pdbtrack-stacktrace-info-regexp))) | 2338 | ;; file/line number. |
| 2339 | (goto-char (point-max)) | ||
| 2340 | (when (re-search-backward python-pdbtrack-stacktrace-info-regexp nil t) | ||
| 2335 | (setq line-number (string-to-number | 2341 | (setq line-number (string-to-number |
| 2336 | (match-string-no-properties 2))) | 2342 | (match-string-no-properties 2))) |
| 2337 | (match-string-no-properties 1))))) | 2343 | (match-string-no-properties 1))))) |