File: 0002-Fix-compatibility-of-linecache-with-Python-3.13.12-a.patch

package info (click to toggle)
bpython 0.26-2
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,180 kB
  • sloc: python: 11,599; xml: 53; makefile: 5; sh: 2
file content (24 lines) | stat: -rw-r--r-- 834 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
From: Sebastian Ramacher <sebastian@ramacher.at>
Date: Thu, 26 Mar 2026 14:53:38 +0100
Subject: Fix compatibility of linecache with Python 3.13.12 and Python 3.14.3

---
 bpython/patch_linecache.py | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/bpython/patch_linecache.py b/bpython/patch_linecache.py
index fa8e172..78b3568 100644
--- a/bpython/patch_linecache.py
+++ b/bpython/patch_linecache.py
@@ -36,6 +36,11 @@ class BPythonLinecache(dict):
         )
         return filename
 
+    def get(self, key: Any, default: Any | None = None) -> Any:
+        if self.is_bpython_filename(key):
+            return self.get_bpython_history(key)
+        return super().get(key, default)
+
     def __getitem__(self, key: Any) -> Any:
         if self.is_bpython_filename(key):
             return self.get_bpython_history(key)