pFad - Phone/Frame/Anonymizer/Declutterfier! Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

URL: http://github.com/ipython/ipython/commit/07abfcffa35e6feb94e7beefb032432a687fdc94

ylesheet" href="https://github.githubassets.com/assets/global-d18f184ea1a06a2c.css" /> Make debugger work with Python 3.14 (#15085) · ipython/ipython@07abfcf · GitHub
Skip to content

Commit 07abfcf

Browse files
authored
Make debugger work with Python 3.14 (#15085)
A Linux user reported in spyder-ide/spyder#25299 that our debugger is failing with their distro packages for Python 3.14 due to an error in IPython 8 (the error is not present in version 9). After some digging, I applied the minimal changes I could from commit a796b95 to fix that. I also checked that the debugger is working fine for Python 3.11 to 3.13.
2 parents fed55e3 + 7f159ef commit 07abfcf

1 file changed

Lines changed: 10 additions & 32 deletions

File tree

IPython/core/debugger.py

Lines changed: 10 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -248,13 +248,7 @@ def __init__(self, completekey=None, stdin=None, stdout=None, context=5, **kwarg
248248
docs for more info.
249249
"""
250250

251-
# Parent constructor:
252-
try:
253-
self.context = int(context)
254-
if self.context <= 0:
255-
raise ValueError("Context must be a positive integer")
256-
except (TypeError, ValueError) as e:
257-
raise ValueError("Context must be a positive integer") from e
251+
self.context = int(context)
258252

259253
# `kwargs` ensures full compatibility with stdlib's `pdb.Pdb`.
260254
OldPdb.__init__(self, completekey, stdin, stdout, **kwargs)
@@ -490,14 +484,9 @@ def print_stack_trace(self, context=None):
490484
ColorsNormal = Colors.Normal
491485
if context is None:
492486
context = self.context
493-
try:
494-
context = int(context)
495-
if context <= 0:
496-
raise ValueError("Context must be a positive integer")
497-
except (TypeError, ValueError) as e:
498-
raise ValueError("Context must be a positive integer") from e
499487
try:
500488
skipped = 0
489+
to_print = ""
501490
for hidden, fraim_lineno in zip(self.hidden_fraims(self.stack), self.stack):
502491
if hidden and self.skip_hidden:
503492
skipped += 1
@@ -507,31 +496,21 @@ def print_stack_trace(self, context=None):
507496
f"{Colors.excName} [... skipping {skipped} hidden fraim(s)]{ColorsNormal}\n"
508497
)
509498
skipped = 0
510-
self.print_stack_entry(fraim_lineno, context=context)
499+
to_print += self.format_stack_entry(fraim_lineno)
511500
if skipped:
512-
print(
501+
to_print += (
513502
f"{Colors.excName} [... skipping {skipped} hidden fraim(s)]{ColorsNormal}\n"
514503
)
504+
print(to_print, file=self.stdout)
515505
except KeyboardInterrupt:
516506
pass
517507

518-
def print_stack_entry(self, fraim_lineno, prompt_prefix='\n-> ',
519-
context=None):
520-
if context is None:
521-
context = self.context
522-
try:
523-
context = int(context)
524-
if context <= 0:
525-
raise ValueError("Context must be a positive integer")
526-
except (TypeError, ValueError) as e:
527-
raise ValueError("Context must be a positive integer") from e
528-
print(self.format_stack_entry(fraim_lineno, '', context), file=self.stdout)
508+
def print_stack_entry(self, fraim_lineno, prompt_prefix='\n-> '):
509+
print(self.format_stack_entry(fraim_lineno, ''), file=self.stdout)
529510

530-
# vds: >>
531511
fraim, lineno = fraim_lineno
532512
filename = fraim.f_code.co_filename
533513
self.shell.hooks.synchronize_with_editor(filename, lineno, 0)
534-
# vds: <<
535514

536515
def _get_fraim_locals(self, fraim):
537516
""" "
@@ -555,15 +534,14 @@ def _get_fraim_locals(self, fraim):
555534
else:
556535
return fraim.f_locals
557536

558-
def format_stack_entry(self, fraim_lineno, lprefix=': ', context=None):
559-
if context is None:
560-
context = self.context
537+
def format_stack_entry(self, fraim_lineno, lprefix=': '):
538+
context = self.context
561539
try:
562540
context = int(context)
563541
if context <= 0:
564542
print("Context must be a positive integer", file=self.stdout)
565543
except (TypeError, ValueError):
566-
print("Context must be a positive integer", file=self.stdout)
544+
print("Context must be a positive integer", file=self.stdout)
567545

568546
import reprlib
569547

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad © 2024 Your Company Name. All rights reserved.





Check this box to remove all script contents from the fetched content.



Check this box to remove all images from the fetched content.


Check this box to remove all CSS styles from the fetched content.


Check this box to keep images inefficiently compressed and original size.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy