diff -pruN 0.13.1+dfsg-2/debian/changelog 0.13.1+dfsg-3/debian/changelog
--- 0.13.1+dfsg-2/debian/changelog	2021-10-16 18:25:34.000000000 +0000
+++ 0.13.1+dfsg-3/debian/changelog	2023-05-22 19:35:39.000000000 +0000
@@ -1,3 +1,10 @@
+pyocd (0.13.1+dfsg-3) unstable; urgency=medium
+
+  * QA upload.
+  * Backport upstream fixes for recent Python. (Closes: #1034399)
+
+ -- Adrian Bunk <bunk@debian.org>  Mon, 22 May 2023 22:35:39 +0300
+
 pyocd (0.13.1+dfsg-2) unstable; urgency=medium
 
   * QA upload.
diff -pruN 0.13.1+dfsg-2/debian/patches/0001-Fix-syntax-warning-raised-by-Python-3.8.patch 0.13.1+dfsg-3/debian/patches/0001-Fix-syntax-warning-raised-by-Python-3.8.patch
--- 0.13.1+dfsg-2/debian/patches/0001-Fix-syntax-warning-raised-by-Python-3.8.patch	1970-01-01 00:00:00.000000000 +0000
+++ 0.13.1+dfsg-3/debian/patches/0001-Fix-syntax-warning-raised-by-Python-3.8.patch	2023-05-22 19:35:39.000000000 +0000
@@ -0,0 +1,25 @@
+From 91af66349ecc745dce93f6b9584c8698600fb405 Mon Sep 17 00:00:00 2001
+From: Chris Reed <flit@me.com>
+Date: Wed, 6 Nov 2019 10:08:18 -0600
+Subject: Fix syntax warning raised by Python 3.8.
+
+---
+ pyocd/gdbserver/syscall.py | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/pyocd/gdbserver/syscall.py b/pyocd/gdbserver/syscall.py
+index 6263d407..b5aac27d 100644
+--- a/pyocd/gdbserver/syscall.py
++++ b/pyocd/gdbserver/syscall.py
+@@ -102,7 +102,7 @@ class GDBSyscallIOHandler(SemihostIOHandler):
+     def seek(self, fd, pos):
+         fd -= FD_OFFSET
+         result, self._errno = self._server.syscall('lseek,%x,%x,0' % (fd, pos))
+-        return 0 if result is not -1 else -1
++        return 0 if result != -1 else -1
+ 
+     def flen(self, fd):
+         fd -= FD_OFFSET
+-- 
+2.30.2
+
diff -pruN 0.13.1+dfsg-2/debian/patches/0001-Using-or-importing-the-ABCs-from-collections-instead.patch 0.13.1+dfsg-3/debian/patches/0001-Using-or-importing-the-ABCs-from-collections-instead.patch
--- 0.13.1+dfsg-2/debian/patches/0001-Using-or-importing-the-ABCs-from-collections-instead.patch	1970-01-01 00:00:00.000000000 +0000
+++ 0.13.1+dfsg-3/debian/patches/0001-Using-or-importing-the-ABCs-from-collections-instead.patch	2023-05-22 19:35:39.000000000 +0000
@@ -0,0 +1,36 @@
+From 796993f12d1fadf7b4158e3ea120c3b91521e3f5 Mon Sep 17 00:00:00 2001
+From: Chris Reed <flit@me.com>
+Date: Fri, 15 Nov 2019 14:41:54 -0600
+Subject: =?UTF-8?q?-=20Using=20or=20importing=20the=20ABCs=20from=20'colle?=
+ =?UTF-8?q?ctions'=20instead=20of=20from=0A=20=20'collections.abc'=20is=20?=
+ =?UTF-8?q?deprecated=20since=20Python=203.3,=20and=20in=203.9=20it=20will?=
+ =?UTF-8?q?=0A=20=20stop=20working.?=
+
+---
+ pyocd/utility/sequencer.py | 9 ++++++++-
+ 1 file changed, 8 insertions(+), 1 deletion(-)
+
+diff --git a/pyocd/utility/sequencer.py b/pyocd/utility/sequencer.py
+index bcb34449..1e5b5a43 100644
+--- a/pyocd/utility/sequencer.py
++++ b/pyocd/utility/sequencer.py
+@@ -14,8 +14,15 @@
+ # See the License for the specific language governing permissions and
+ # limitations under the License.
+ 
+-from collections import (OrderedDict, Callable)
+ import logging
++from collections import OrderedDict
++
++# Collection ABCs accessible directly from collections are deprecated and will be removed in
++# Python 3.9.
++try:
++    from collections.abc import Callable
++except ImportError:
++    from collections import Callable
+ 
+ log = logging.getLogger("sequencer")
+ 
+-- 
+2.30.2
+
diff -pruN 0.13.1+dfsg-2/debian/patches/series 0.13.1+dfsg-3/debian/patches/series
--- 0.13.1+dfsg-2/debian/patches/series	2021-10-16 18:25:34.000000000 +0000
+++ 0.13.1+dfsg-3/debian/patches/series	2023-05-22 19:35:39.000000000 +0000
@@ -1 +1,3 @@
 0001-Update-setup.py-to-work-with-Python3.patch
+0001-Using-or-importing-the-ABCs-from-collections-instead.patch
+0001-Fix-syntax-warning-raised-by-Python-3.8.patch
