Modify

Ticket #154 (new defect)

Opened 4 years ago

Last modified 2 days ago

libyaml parser does not recognise custom tags

Reported by: smichalske@… Owned by: xi
Priority: normal Component: pyyaml
Severity: normal Keywords:
Cc:

Description (last modified by xi) (diff)

/usr/bin/python /Users/hardkrash/Desktop/libyaml_custom_class_broken.py 
Monster(name='Cave spider', hp=[2, 6], ac=16, attacks=['BITE', 'HURT'])




Traceback (most recent call last):
  File "/Users/hardkrash/Desktop/libyaml_custom_class_broken.py", line 32, in <module>
    """, Loader=yaml.CLoader)
  File "/Library/Python/2.5/site-packages/PyYAML-3.09-py2.5-macosx-10.5-i386.egg/yaml/__init__.py", line 58, in load
  File "/Library/Python/2.5/site-packages/PyYAML-3.09-py2.5-macosx-10.5-i386.egg/yaml/constructor.py", line 44, in get_single_data
  File "/Library/Python/2.5/site-packages/PyYAML-3.09-py2.5-macosx-10.5-i386.egg/yaml/constructor.py", line 48, in construct_document
  File "/Library/Python/2.5/site-packages/PyYAML-3.09-py2.5-macosx-10.5-i386.egg/yaml/constructor.py", line 93, in construct_object
  File "/Library/Python/2.5/site-packages/PyYAML-3.09-py2.5-macosx-10.5-i386.egg/yaml/constructor.py", line 419, in construct_undefined
yaml.constructor.ConstructorError: could not determine a constructor for the tag '!Monster'
  in "<byte string>", line 2, column 5

Attachments

libyaml_custom_class_broken.py Download (675 bytes) - added by smichalske@… 4 years ago.
0001-Fix-custom-tags-in-pyyaml-interface.patch Download (2.4 KB) - added by smichalske@… 4 years ago.
Patch that makes the cloades construct custom tags.

Change History

Changed 4 years ago by smichalske@…

Changed 4 years ago by smichalske@…

Patch that makes the cloades construct custom tags.

comment:1 Changed 4 years ago by anonymous

This patch makes custom yaml objects constructors and representers, register themselves with all known loaders and dumpers

One defect, the structure test now has 4 failures.... I can not determine why.

comment:2 Changed 4 years ago by xi

  • Description modified (diff)

comment:3 Changed 2 days ago by maskodok <galihadiputro87@…>

The only thing more I could hope for is documentation of all these features (other than reading through the code).  Cipto Junaedy Is this in process? Can I help? About  Unit Link Terbaik di Indonesia Commonwealth Life Investra Link

View

Add a comment

Modify Ticket

Change Properties
<Author field>
Action
as new
as The resolution will be set. Next status will be 'closed'
to The owner will be changed from xi. Next status will be 'new'
The owner will be changed from xi to anonymous. Next status will be 'assigned'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.