Skip to content

Conversation

Chovin
Copy link
Contributor

@Chovin Chovin commented Oct 1, 2024

Description of the changes

Fixes #6290 by raising a RuntimeError when registering config with an identifier that's already in Config/Group/Value objects

It does so using __slots__, so that changes the behavior of Config objects in that you can't set arbitrary attributes to them anymore. If that's a problem, we can add __dict__ to its __slots__ just like I do to Value. I went ahead and added it in case cog creators had set attributes on config

I don't believe using __slots__ to solve this presents any other complications, but perhaps this should be solved another way (like using class attributes). Let me know and I can adjust

Have the changes in this PR been tested?

Yes, at least through tox with a new test added, and the most common case "default"

@github-actions github-actions bot added the Category: Core - API - Config This is related to the `redbot.core.config` module and `redbot.core.drivers` package. label Oct 1, 2024
@Kreusada Kreusada added the Type: Enhancement Something meant to enhance existing Red features. label Oct 18, 2024
@Kreusada Kreusada self-assigned this Oct 18, 2024
@Kreusada Kreusada added this to the 3.5.14 milestone Nov 17, 2024
@Jackenmen Jackenmen modified the milestones: 3.5.14, 3.5.15 Dec 24, 2024
@Jackenmen Jackenmen modified the milestones: 3.5.21, 3.5.22 Aug 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Category: Core - API - Config This is related to the `redbot.core.config` module and `redbot.core.drivers` package. Type: Enhancement Something meant to enhance existing Red features.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Config] Prevent registering defaults for inaccessible identifiers

3 participants