Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix explicit attrib defaults being overridden by inherited values #258

Merged
merged 6 commits into from
Dec 15, 2021

Conversation

anthrotype
Copy link
Member

Fixes #224 and #257

@anthrotype anthrotype force-pushed the fix-inherited-defaults-issue-224 branch from 653b4dd to 5f85fe1 Compare December 14, 2021 17:13
the rectangle must be black, not red
@@ -1320,11 +1333,25 @@ def _swap_elements(swaps: Iterable[Tuple[etree.Element, Sequence[etree.Element]]
raise ValueError("Lost parent!")
parent.remove(old_el)

@lru_cache(maxsize=None)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't the unbounded cache dangerous?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think so, because I always call cache_clear() at the beginning of _update_etree()
https://github.com/googlefonts/picosvg/pull/258/files#diff-613582736f235e34aeab2643a59d44fb26bfa66e5bcba5f4c6fa195d74b0e7b9R1349

functools.lru_cache(None) is the same as functools.cache(), but the latter is only available for 3.9+
https://docs.python.org/3/library/functools.html#functools.cache

src/picosvg/svg_meta.py Outdated Show resolved Hide resolved
@anthrotype anthrotype merged commit 425de70 into main Dec 15, 2021
@anthrotype anthrotype deleted the fix-inherited-defaults-issue-224 branch December 15, 2021 12:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

No setting and explicit default are indistinguishable
2 participants