Skip to content

Commit

Permalink
Fix incorrect ValueError introduced in #537c645.
Browse files Browse the repository at this point in the history
The underlying cause is the poor API of NBT: rather than having multiple factory methods, there is just one __init__ which takes a plethora of arguments, and tries to figure out how to instantiate an object (from value, from buffer, etc.). The additional logic required to make this work is causing too much code and too much bugs.
  • Loading branch information
macfreek committed May 14, 2018
1 parent 8391005 commit d7ebe5a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions nbt/nbt.py
Original file line number Diff line number Diff line change
Expand Up @@ -358,8 +358,8 @@ def __init__(self, type=None, value=None, name=None, buffer=None):
self.tags = []
if buffer:
self._parse_buffer(buffer)
if self.tagID == None:
raise ValueError("No type specified for list: %s" % (name))
# if self.tagID == None:
# raise ValueError("No type specified for list: %s" % (name))

#Parsers and Generators
def _parse_buffer(self, buffer):
Expand Down Expand Up @@ -447,7 +447,7 @@ def _parse_buffer(self, buffer):
try:
tag = TAGLIST[type.value]()
except KeyError:
raise ValueError("Unrecognised tag type")
raise ValueError("Unrecognised tag type %d" % (type.value))
tag.name = name
self.tags.append(tag)
tag._parse_buffer(buffer)
Expand Down

0 comments on commit d7ebe5a

Please sign in to comment.