Skip to content

Remove colordict, rework parsing color from string #3461

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

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

MightyJosip
Copy link
Member

@MightyJosip MightyJosip commented Jun 2, 2025

This commit removes colordict module, moves parsing color from string to C code, didn't check for the speed, but this should improve memory usage. Also need to find the right way to test this change

Fix #1664

@MightyJosip MightyJosip requested a review from a team as a code owner June 2, 2025 16:26
@damusss
Copy link
Member

damusss commented Jun 2, 2025

Hi, while on the surface it doesn't seem bad, I don't think this change is available in the way you are proposing it fully. You are effectively removing a documented and type-hinted constant, breaking compatibility. A github search shows that a very big chunk of people's code use that constant, check for yourself:
https://github.com/search?q=THECOLORS+language%3APython+&type=code
Not sure if I'm wrong, but I doubt so.

@ankith26
Copy link
Member

ankith26 commented Jun 7, 2025

This PR cannot be merged as it is for reasons damus stated. Though it would be fine if you also implement some "dict proxy" class that can compat the existing dict.

In my opinion this is too much work though, it would be instead better to wait for a breaking release and do this PR then

@ankith26 ankith26 marked this pull request as draft June 7, 2025 10:25
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.

Move colordict.py into C (3367)
3 participants