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
Setting default multiconstructor results in an TypeError #317
Comments
Maybe this line But another way to add a multi constructor for unknown tags is:
So you can use this for now. But if If I change this line then your code |
Loader.add_multi_constructor(None, myconstructor) Also add test for add_multi_constructor('!', ...) etc. See issue #317
Loader.add_multi_constructor(None, myconstructor) Also add test for add_multi_constructor('!', ...) etc. See issue #317
I created #358 which will hopefully released soon with 5.3 |
Loader.add_multi_constructor(None, myconstructor) Also add test for add_multi_constructor('!', ...) etc. See issue #317
released https://pypi.org/project/PyYAML/5.3/ |
The issue is about the following lines in
construct_object
method ofBaseConstructor
classpyyaml/lib/yaml/constructor.py
Lines 76 to 84 in 5986257
I wanted to set up a multiconstructor for unknows tags. It seems like these lines are responsible for picking a default multiconstructor and therefore to define one I had to add a multiconstructor for
None
value as atag_prefix
pyyaml/lib/yaml/constructor.py
Lines 82 to 84 in 5986257
At the very least the lines hint that
None
is considered a valid key forself.yaml_multi_constructors
. But the only way the execution can reach these lines is by traversing all the keys inself.yaml_multi_constructors
first.Now, if None is one of the keys, we get an exception
TypeError: startswith first arg must be str, unicode, or tuple, not NoneType
on line 77 making lines 83-84 effectively unreachablepyyaml/lib/yaml/constructor.py
Line 77 in 5986257
Minimal non-working example:
The text was updated successfully, but these errors were encountered: