Skip to content

Conversation

@CookStar
Copy link
Contributor

No description provided.

@Ayuto
Copy link
Member

Ayuto commented Apr 28, 2020

Which issue does this solve? Could you please add a few steps to reproduce the issue?

@jordanbriere
Copy link
Contributor

Which issue does this solve? Could you please add a few steps to reproduce the issue?

It cause an error if it is set to False and wasn't overwritten by a ConVar on plugin load. Basically, it will never explicitely be None, either False or a ConVar if it was True when the plugin was loaded (which should always be the case for iterated plugins by sp plugin list). If you have the following in your info.ini:

public_convar = 0

Then the following error will raise when using sp plugin list:

AttributeError: 'bool' object has no attribute 'name'

However, a proper fix should rather be:

            if isinstance(info.public_convar, ConVar):

Because we implemented ConVar.__bool__ which will evaluates to False if the value cannot be interpreted as 1/0 resulting into the variables no longer be listed in the output. For example, this would prints False, although is a valid versioning variable:

print(bool(ConVar('foo', '0.1')))

@CookStar
Copy link
Contributor Author

Which issue does this solve? Could you please add a few steps to reproduce the issue?

I apologize for the lack of explanation.

It cause an error if it is set to False and wasn't overwritten by a ConVar on plugin load. Basically, it will never explicitely be None, either False or a ConVar if it was True when the plugin was loaded (which should always be the case for iterated plugins by sp plugin list). If you have the following in your info.ini:

public_convar = 0

Then the following error will raise when using sp plugin list:

AttributeError: 'bool' object has no attribute 'name'

As jordanbriere wrote above, that's the problem.

However, a proper fix should rather be:

            if isinstance(info.public_convar, ConVar):

Because we implemented ConVar.__bool__ which will evaluates to False if the value cannot be interpreted as 1/0 resulting into the variables no longer be listed in the output. For example, this would prints False, although is a valid versioning variable:

print(bool(ConVar('foo', '0.1')))

Oh, I didn't know about ConVar's behavior.
Changed to check PublicConVar's classinfo.

@jordanbriere jordanbriere merged commit 3661726 into Source-Python-Dev-Team:master Apr 29, 2020
@CookStar CookStar deleted the pluginlist_fix branch May 8, 2020 04:55
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.

3 participants