Skip to content
Snippets Groups Projects

Nicer warning behavior for PersistentDict

Merged Matt Wala requested to merge persistent-dict-warnings into master
  • Add a CacheCollision warning subclass.
  • Track stack level so that warnings show user code line numbers.

Example:

Modifying line 287 of test_persistent_dict.py so that the warning isn't captured by the test, we get this:

test_persistent_dict.py:287: CollisionWarning: pytools-test: key collision in cache at '/tmp/tmpq9p3i0b9' -- these are sufficiently unlikely that they're often indicative of a broken implementation of equality comparison
  pdict[key2]  # user code

The old behavior was:

/home/matt/src/pytools/pytools/persistent_dict.py:466: UserWarning: pytools-test: key collision in cache at '/tmp/tmpuk8js9jw' -- these are sufficiently unlikely that they're often indicative of a broken implementation of equality comparison
  % (self.identifier, self.container_dir))

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
Please register or sign in to reply
Loading