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

conditional in in _parse_rfc meant to error when "empty property name", can't ever trigger #1306

Open
drocta opened this issue Sep 20, 2023 · 0 comments

Comments

@drocta
Copy link

drocta commented Sep 20, 2023

In the method _parse_rfc, lines 1668-1670 of rrule.py (as of commit da9ecd0 , the latest to touch that file as of this writing (not that it changed these particular lines)) read:

                parms = name.split(';')
                if not parms:
                    raise ValueError("empty property name")

Where name is a string. parms here will therefore always be a list of one or more strings. Such a list is never false-y, even if the only entry is the empty string.
It looks to me like that conditional is meant to be checking if the string line looks like ;PARM1;PARM2:MORESTUFF rather than like PROPERTYNAME;PARM1;PARM2:MORESTUFF or PROPERTYNAME:MORESTUFF or etc.
As such, I think the conditional should read, if not parms[0]: instead?
As is, the only way I can see this condition triggering is if name was of some type other than str, such that name.split(';') might return something other than a list of one or more strings.

(If I'm wrong about all this, sorry. I think I'm right though?)

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

No branches or pull requests

1 participant