record array: passing formats as tuple raises error (Trac #1139)
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 45/100
Research direction
Start in numpy/core/records.py at format_parser._parseFormats, using the traceback as the entry point. Reproduce rec.fromarrays with a tuple and with a list passed to formats; done means the tuple form is accepted consistently with the list form.
Written by the indexing model from the issue text.
Description
Original ticket http://projects.scipy.org/numpy/ticket/1139 on 2009-06-17 by @huard, assigned to unknown.
If a tuple is passed to the formats argument to rec.fromarrays for example, the following error is raised:
/usr/local/lib/python2.5/site-packages/numpy-1.4.0.dev7045-py2.5-linux-x86_64.egg/numpy/core/records.pyc in fromarrays(arrayList, dtype, shape, formats, names, titles, aligned, byteorder)
506 _names = descr.names
507 else:
--> 508 parsed = format_parser(formats, names, titles, aligned, byteorder)
509 _names = parsed._names
510 descr = parsed._descr
/usr/local/lib/python2.5/site-packages/numpy-1.4.0.dev7045-py2.5-linux-x86_64.egg/numpy/core/records.pyc in __init__(self, formats, names, titles, aligned, byteorder)
110 """
111 def __init__(self, formats, names, titles, aligned=False, byteorder=None):
--> 112 self._parseFormats(formats, aligned)
113 self._setfieldnames(names, titles)
114 self._createdescr(byteorder)
/usr/local/lib/python2.5/site-packages/numpy-1.4.0.dev7045-py2.5-linux-x86_64.egg/numpy/core/records.pyc in _parseFormats(self, formats, aligned)
124 formats.append('')
125 formats = ','.join(formats)
--> 126 dtype = sb.dtype(formats, aligned)
127 fields = dtype.fields
128 if fields is None:
TypeError: data type not understood
WARNING: Failure executing file: <load.py>
If the tuple is converted into a list, then everything works fine.
- Dominant language
- Python
- Stars
- 32.8k
- Forks
- 12.8k
- Avg merge
- 1d 7h
- Merged PRs (30d)
- 197
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from numpy/numpy
-
00 - Bug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
04 - Documentation sustain-2026
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
04 - Documentation
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Similar issues
-
area/auth bug comp/agent P3 platform/discord type/security
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
NousResearch/hermes-agent#117848 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
bancolombia/sentinel#23 ·
-
test md OpenCI
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
-
integration:quickjs org:external priority:backlog topic:code-interpreter topic:middleware type:feature
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
langchain-ai/deepagents#6450 ·
-
bug client
Difficulty 2/5 1-3 hours Newbie friendliness 88/100