mirror of
https://github.com/ankitects/anki.git
synced 2025-09-18 14:02:21 -04:00
Pass dict for locals and globals to exec() (#2590)
This commit is contained in:
parent
bceffd96c6
commit
543f391096
1 changed files with 7 additions and 5 deletions
|
@ -282,14 +282,16 @@ class DebugConsole(QDialog):
|
|||
import traceback
|
||||
|
||||
text = self._text.toPlainText()
|
||||
card = self._debugCard
|
||||
bcard = self._debugBrowserCard
|
||||
mw = aqt.mw
|
||||
pp = pprint.pprint
|
||||
vars = {
|
||||
"card": self._debugCard,
|
||||
"bcard": self._debugBrowserCard,
|
||||
"mw": aqt.mw,
|
||||
"pp": pprint.pprint,
|
||||
}
|
||||
self._captureOutput(True)
|
||||
try:
|
||||
# pylint: disable=exec-used
|
||||
exec(text)
|
||||
exec(text, vars)
|
||||
except:
|
||||
self._output += traceback.format_exc()
|
||||
self._captureOutput(False)
|
||||
|
|
Loading…
Reference in a new issue