Skip to content

Commit

Permalink
Merge pull request #770 from PyTables/tomkooij-gh_734
Browse files Browse the repository at this point in the history
Some improvements for fixing #734
  • Loading branch information
tomkooij committed Oct 13, 2019
2 parents e4338ca + 4f8e180 commit a1623d3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
10 changes: 6 additions & 4 deletions tables/description.py
Expand Up @@ -613,12 +613,14 @@ def __init__(self, classdict, nestedlvl=-1, validate=True, ptparams=None):
# Compute the dtype with offsets or without
# print("offsets ->", cols_offsets, nestedDType, nested, valid_offsets)
if valid_offsets:
# TODO: support offsets with nested types
# TODO: support offsets within nested types
dtype_fields = {
'names': newdict['_v_names'], 'formats': nestedFormats,
'offsets': cols_offsets}
itemsize = newdict.get('_v_itemsize', None)
if itemsize is not None:
dtype = numpy.dtype({'names': newdict['_v_names'], 'formats': nestedFormats, 'offsets': cols_offsets, 'itemsize': itemsize})
else:
dtype = numpy.dtype({'names': newdict['_v_names'], 'formats': nestedFormats, 'offsets': cols_offsets})
dtype_fields['itemsize'] = itemsize
dtype = numpy.dtype(dtype_fields)
else:
dtype = numpy.dtype(nestedDType)
newdict['_v_dtype'] = dtype
Expand Down
5 changes: 3 additions & 2 deletions tables/tableextension.pyx
Expand Up @@ -411,8 +411,9 @@ cdef class Table(Leaf):
raise HDF5ExtError("Problems getting desciption for table %s", self.name)

if offset < type_size:
# Trailing padding, set the itemsize to the correct type_size
desc['_v_itemsize'] = type_size
# Trailing padding, set the itemsize to the correct type_size (see #765)
desc['_v_itemsize'] = type_size


# Return the object ID and the description
return (self.dataset_id, desc, SizeType(chunksize[0]))
Expand Down

0 comments on commit a1623d3

Please sign in to comment.