Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions erfa/core.py.templ
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ def check_errwarn(statcodes, func_name):
# <------------------------structured dtype conversion------------------------>

dt_bytes1 = np.dtype('S1')
dt_bytes12 = np.dtype('S12')

# <--------------------------Actual ERFA-wrapping code------------------------>

Expand Down Expand Up @@ -175,8 +174,8 @@ def {{ func.pyname }}({{ func.args_by_inout('in|inout')|map(attribute='name')|jo
# Any string outputs will be in structs; view them as their base type.
#}
{%- for arg in func.args_by_inout('out') -%}
{%- if 'char' in arg.ctype %}
{{ arg.name }} = {{ arg.name }}.view({{ arg.view_dtype }})
{%- if arg.ctype == "char" %}
{{ arg.name }} = {{ arg.name }}.view(dt_bytes1)
{%- endif %}
{%- endfor %}
{#-
Expand Down
15 changes: 0 additions & 15 deletions erfa_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,21 +175,6 @@ def dtype(self):
return super().dtype
raise ValueError(f"ctype {self.ctype} with shape {self.shape} not recognized.")

@property
def view_dtype(self):
"""Name of dtype corresponding to the ctype for viewing back as array.

E.g., dt_double for double, dt_double33 for double[3][3].

The types are defined in core.py, where they are used for view-casts
of structured results as regular arrays.
"""
if self.ctype == 'const char':
return 'dt_bytes12'
Comment on lines -187 to -188
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apparently self.ctype is never "const char".

if self.ctype == "char":
return 'dt_bytes1'
raise ValueError("Only char ctype should need view back!")

@property
def ndim(self):
return len(self.shape)
Expand Down
Loading