This is a selection of human generated buggy code that give conventional code repairing system some mini panic attack.
Dynamic attribute access and management.
Hint:
_cache = {}
needs to be instance-level, not shared;- Clear cache when updating values in set()
if name in self._cache:
del self._cache[name]
Race condition in multi threading.
Hint:
Put everything in increment()
in a threading.Lock()
.
Complex data structure.
Hint:
Follow instruction that "if a stuent has incomplete grades, they are not considered."
Unknown data structure.
Hint:
There's no Price
column, the correct key is fare
.
Boundary check.
Hint:
Line numbers are 1-based. Handle cases where head <= 0 or tail <= 0
or head > tail
.
Buggy condition.
Hint:
if self.hunger > 10:
...
elif self.hunger > 20:
...
String split.
Hint:
L6: action_str
vs action
Logic bug.
Hint:
apply_discount()
does not apply discount to future items.
Loop in data structure
Hint:
Catch loop in tree traversal.
Condition coverage.
Hint:
Feb 29 + 1
in leap years.