Whole file
vivisect/vivisect
The author described this change as “Visgraph bug older than dirt (#387)”. It counts as a record because the check below fails on the code as it stood at bed78fd01 and passes on ecc2866b3, with nothing else changed between the two runs.
Projectvivisect/vivisect
Fix saved2021-04-06
Sharing licenceApache-2.0 · LICENSE.txt
Change size+15 −9
What the code was meant to do, written into the code itself as a save note
Visgraph bug older than dirt (#387)
The change
| 320 | 320 | ''' | |
| 321 | 321 | pval = node[1].pop(prop,None) | |
| 322 | 322 | if pval is not None: | |
| 323 | - | vlist = self.nodeprops[prop][pval] | |
| 324 | - | vlist.remove(node) | |
| 325 | - | if not vlist: | |
| 326 | - | self.nodeprops[prop].pop(pval,None) | |
| 323 | + | try: | |
| 324 | + | vlist = self.nodeprops[prop][pval] | |
| 325 | + | vlist.remove(node) | |
| 326 | + | if not vlist: | |
| 327 | + | self.nodeprops[prop].pop(pval,None) | |
| 328 | + | except TypeError: | |
| 329 | + | pass # no value indexes for unhashable types | |
| 327 | 330 | return pval | |
| 328 | 331 | ||
| 329 | 332 | def delNodesProps(self, props): | |
| ⋯ | |||
| 348 | 351 | self.delEdge(edge) | |
| 349 | 352 | for edge in self.getRefsTo(node)[:]: | |
| 350 | 353 | self.delEdge(edge) | |
| 351 | - | [ self.delNodeProp(node, k) for k in node[1].keys() ] | |
| 354 | + | [ self.delNodeProp(node, k) for k in list(node[1].keys()) ] | |
| 352 | 355 | return self.nodes.pop(node[0]) | |
| 353 | 356 | ||
| 354 | 357 | def getNode(self, nid): | |
| ⋯ | |||
| 449 | 452 | ''' | |
| 450 | 453 | v = edge[3].pop(prop,None) | |
| 451 | 454 | if v is not None: | |
| 452 | - | vlist = self.edgeprops[prop][v] | |
| 453 | - | vlist.remove(edge) | |
| 454 | - | if not vlist: | |
| 455 | - | self.edgeprops[prop].pop(v,None) | |
| 455 | + | try: | |
| 456 | + | vlist = self.edgeprops[prop][v] | |
| 457 | + | vlist.remove(edge) | |
| 458 | + | if not vlist: | |
| 459 | + | self.edgeprops[prop].pop(v,None) | |
| 460 | + | except TypeError: | |
| 461 | + | pass # no value indexes for unhashable types | |
| 456 | 462 | return v | |
| 457 | 463 | ||
| 458 | 464 | def delEdgesProps(self, props): | |
The check that tells the two apart
fail→pass·visgraph/tests/test_graphcore.py::GraphCoreTest::test_visgraph_add_del_misc_properties
Check file visgraph/tests/test_graphcore.py, taken without changes from the fix and copied onto the older code, so the exact same check runs against both versions.
Origin and history
The code before itbed78fd01526db0e506af909688c4b136f70f257
Broken version dated2021-04-05
Modulevisgraph.graphcore
Units changedGraph
Fingerprint9123920d7ff1738f
Checked2026-08-18 by goldset/0.1
Every field above is generated by our program. None of it is written by hand.