Kaynağa Gözat

Fixed #36057 -- Enabled test runner to debug chained exceptions with `--pdb` on Python 3.13+.

Adam Johnson 2 ay önce
ebeveyn
işleme
51df0dff3c
1 değiştirilmiş dosya ile 5 ekleme ve 2 silme
  1. 5 2
      django/test/runner.py

+ 5 - 2
django/test/runner.py

@@ -30,7 +30,7 @@ from django.test.utils import setup_test_environment
 from django.test.utils import teardown_databases as _teardown_databases
 from django.test.utils import teardown_test_environment
 from django.utils.datastructures import OrderedSet
-from django.utils.version import PY312
+from django.utils.version import PY312, PY313
 
 try:
     import ipdb as pdb
@@ -126,7 +126,10 @@ class PDBDebugResult(unittest.TextTestResult):
         self.buffer = False
         exc_type, exc_value, traceback = error
         print("\nOpening PDB: %r" % exc_value)
-        pdb.post_mortem(traceback)
+        if PY313:
+            pdb.post_mortem(exc_value)
+        else:
+            pdb.post_mortem(traceback)
 
 
 class DummyList: