From be84e4b51bc93b6e60c43759233a983eabdd0146 2024-12-08 10:45:15
From: M Bussonnier <bussonniermatthias@gmail.com>
Date: 2024-12-08 10:45:15
Subject: [PATCH] Fix pdb issues in Python 3.13.1 (#14598)

For some reason it is not always set, it was/is a bug in IPython to not
check.
---

diff --git a/IPython/core/debugger.py b/IPython/core/debugger.py
index 1f0d7b2..76c42e0 100644
--- a/IPython/core/debugger.py
+++ b/IPython/core/debugger.py
@@ -550,7 +550,7 @@ class Pdb(OldPdb):
         So if frame is self.current_frame we instead return self.curframe_locals
 
         """
-        if frame is self.curframe:
+        if frame is getattr(self, "curframe", None):
             return self.curframe_locals
         else:
             return frame.f_locals