Skip to content

Two helpers that don't do what their names say: disallow_overwrites (no-op) and cache_func_outputs (default cache fails, kwargs never cached) #101

Description

@thorwhalen

Found while verifying docstring claims for the WP6 documentation sweep (#100). Docs now state the current behaviour; the code itself was left alone.

dol.trans.disallow_overwrites(store, *, error_msg=None, disable_deletes=True) defines an inner __setitem__ but never assigns it to store, ignores error_msg and disable_deletes, and returns None. So disallow_overwrites(D) is None and D still overwrites. dol.mixins.OverWritesNotAllowedMixin does the intended job. Either finish it (attach the override, honour disable_deletes, return the class) or delete it.

dol.caching.cache_func_outputs(cache=HashableDict): with the default, get_cache(HashableDict) returns the class, so the first call raises TypeError: argument of type 'type' is not iterable. With an explicit cache, kwargs are wrapped in a fresh HashableDict whose hash is id(self), so calls with keyword arguments never hit the cache. Only positional-only calls with an explicit cache cache anything.

Also worth a look, not verified as a bug: dol.paths.add_prefix_filtering(d, relativize_prefix=True)['a/'] returned the whole dict for d = {'a/b': 1, 'a/c': 2, 'd': 3} in a quick run.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions