From 0c413a7a8b8649f1cc59a959b92fa88cd88357d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Filip=20Pobo=C5=99il?= Date: Fri, 5 Jun 2020 20:20:37 +0200 Subject: [PATCH] Add builtin breakpoint (PEP 553) Python 3.7 introduced new builtin function `breakpoint()` (PEP 553) that can be used to insert breakpoints. --- autoload/pymode/breakpoint.vim | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/autoload/pymode/breakpoint.vim b/autoload/pymode/breakpoint.vim index 2692ca34..98639b57 100644 --- a/autoload/pymode/breakpoint.vim +++ b/autoload/pymode/breakpoint.vim @@ -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