Skip to content

Commit

Permalink
Add builtin breakpoint (PEP 553)
Browse files Browse the repository at this point in the history
Python 3.7 introduced new builtin function `breakpoint()` (PEP 553) that
can be used to insert breakpoints.
  • Loading branch information
fpob committed Jun 5, 2020
1 parent 2da50da commit 0c413a7
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions autoload/pymode/breakpoint.vim
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,14 @@ fun! pymode#breakpoint#init() "{{{

from importlib.util import find_spec

for module in ('wdb', 'pudb', 'ipdb', 'pdb'):
if find_spec(module):
vim.command('let g:pymode_breakpoint_cmd = "import %s; %s.set_trace() # XXX BREAKPOINT"' % (module, module))
break
if sys.version_info >= (3, 7):
vim.command('let g:pymode_breakpoint_cmd = "breakpoint()"')

else:
for module in ('wdb', 'pudb', 'ipdb', 'pdb'):
if find_spec(module):
vim.command('let g:pymode_breakpoint_cmd = "import %s; %s.set_trace() # XXX BREAKPOINT"' % (module, module))
break
EOF
endif

Expand Down

0 comments on commit 0c413a7

Please sign in to comment.