diff --git a/gdb-port/top-level-parse.py b/gdb-port/top-level-parse.py
index 77df431c623179b7ee2a20958731b141cac3abe4..ee592cc7c41fcf8f7d0a201a97d0a51f610c6f5e 100644
--- a/gdb-port/top-level-parse.py
+++ b/gdb-port/top-level-parse.py
@@ -84,9 +84,6 @@ class TopLevelParse:
 	def return_from_h_do_parse(self, parse_state, parser, ret_val):
 		parser_stack = self.peek_parserstack()
 		parser_obj = self.parser_by_address(parser) # We don't try to make a new Parser() object here, because it has to have been done in the corresponding enter_h_do_parse() call
-		previous_parser = parser_stack.pop()
-		top_of_stack = parser_stack.peek()
-		assert top_of_stack == parser_obj, "parser function argument is different from parser on top of stack"
 		# The rationale for handling the "current" parser separately from stack:
 		# Parsers are only pushed on the stack in perform_lowlevel_parse, which doesn't get called when h_do_parse() gets the result from cache.
 		# If other backends are supported, this might change to pushing/popping the stack in h_do_parse()
@@ -106,6 +103,8 @@ class TopLevelParse:
 			parser_obj.add_mem_use(int(parser_stack.arena), allocated_bytes)
 			# TODO: allocations can be attributed to individual h_do_parse(parser) calls, thus the same per-parser per-arena stats tracking can be done
 
+		previous_parser = parser_stack.pop()
+
 	# Called from h_do_parse()'s handler, at which point we know the addresses of the state and arena
 	def first_h_do_parse_after_packrat_parse(self, parse_state, arena):
 		parser_stack = self.peek_parserstack()