Whole file

gaogaotiantian/watchpoints

The author described this change as Fix comparing with None bug. It counts as a record because the check below fails on the code as it stood at 961533916 and passes on e75bd1b11, with nothing else changed between the two runs.

Fix saved2020-12-07
Sharing licenceApache-2.0 · LICENSE
Change size+4 6

What the code was meant to do, written into the code itself as a save note

Fix comparing with None bug

The change

3232 """
3333 :return (changed, exist):
3434 """
35- if frame is self.frame and self.localvar:
35+ if frame is self.frame and self.localvar is not None:
3636 if self.localvar in frame.f_locals:
3737 if frame.f_locals[self.localvar] != self.obj:
38- self.prev_obj = self.obj
3938 self.obj = frame.f_locals[self.localvar]
4039 return True, True
4140 else:
4241 return True, False
4342
44- if self.parent and self.subscr:
43+ if self.parent is not None and self.subscr is not None:
4544 try:
4645 if self.parent[self.subscr] != self.obj:
47- self.prev_obj = self.obj
4846 self.obj = self.parent[self.subscr]
4947 return True, True
5048 except (IndexError, KeyError):
5149 return True, False
52- elif self.parent and self.attr:
50+ elif self.parent is not None and self.attr is not None:
5351 try:
5452 if getattr(self.parent, self.attr) != self.obj:
55- self.prev_obj = self.obj
5653 self.obj = getattr(self.parent, self.attr)
54+ return True, True
5755 except AttributeError:
5856 return True, False
5957

The check that tells the two apart

failpass·tests/test_watch_element.py::TestWatchElement::test_changed

Check file tests/test_watch_element.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 it961533916e94dc232d1833a3ba66610b99afba43
Broken version dated2020-12-07
Modulewatchpoints.watch_element
Units changedWatchElement
Fingerprint58463fef154744c0
Checked2026-08-18 by goldset/0.1

Every field above is generated by our program. None of it is written by hand.