@@ -89,6 +89,30 @@ def test_match_by_msg(self):
8989 ids , _ = self ._match (FATAL_0022 )
9090 self .assertEqual (ids , {"OOM-0022" })
9191
92+ def test_msg_match_distinguishes_by_type (self ):
93+ # Two type-specific "Deallocator of type 'X'" msg keys must not be conflated by their
94+ # shared prefix: each known type maps to its own bug, and a NEW type matches neither
95+ # (a too-short prefix slice used to ignore the type and collide the whole family).
96+ snap = oom_dedup .load_snapshot (
97+ [
98+ "OOM-0007\t fatal\t msg\t "
99+ "_Py_Dealloc: Deallocator of type 'Context' cleared the curre" ,
100+ "OOM-0023\t fatal\t msg\t "
101+ "_Py_Dealloc: Deallocator of type '_StoreAction' cleared the " ,
102+ ]
103+ )
104+
105+ def decide_type (t ):
106+ text = (
107+ "Fatal Python error: _Py_Dealloc: Deallocator of type '%s' "
108+ "cleared the current exception" % t
109+ )
110+ return oom_dedup .match (oom_dedup .classify (text ), snap )[0 ]
111+
112+ self .assertEqual (decide_type ("Context" ), {"OOM-0007" })
113+ self .assertEqual (decide_type ("_StoreAction" ), {"OOM-0023" })
114+ self .assertEqual (decide_type ("collections.deque" ), set ()) # new type -> no match
115+
92116 def test_near_line (self ):
93117 ids , how = self ._match (ABORT_NEAR )
94118 self .assertEqual (ids , {"OOM-0004" })
0 commit comments