Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

BUG: repr fails on structured array with non-void base #9821

Closed
@toslunar

Description

@toslunar

I run the following code, which is the example of "2) Tuple argument" inhttps://docs.scipy.org/doc/numpy-1.13.0/user/basics.rec.html

>>> import numpy as np>>> x = np.zeros(3, dtype=('i4',[('r','u1'), ('g','u1'), ('b','u1'), ('a','u1')]))>>> xTraceback (most recent call last):  File "<stdin>", line 1, in <module>  File "/Users/tos/py3npy/lib/python3.6/site-packages/numpy-1.14.0.dev0+1f4ed32-py3.6-macosx-10.12-x86_64.egg/numpy/core/arrayprint.py", line 955, in array_repr    ', ', class_name + "(")  File "/Users/tos/py3npy/lib/python3.6/site-packages/numpy-1.14.0.dev0+1f4ed32-py3.6-macosx-10.12-x86_64.egg/numpy/core/arrayprint.py", line 521, in array2string    lst = _array2string(a, options, separator, prefix)  File "/Users/tos/py3npy/lib/python3.6/site-packages/numpy-1.14.0.dev0+1f4ed32-py3.6-macosx-10.12-x86_64.egg/numpy/core/arrayprint.py", line 363, in wrapper    return f(self, *args, **kwargs)  File "/Users/tos/py3npy/lib/python3.6/site-packages/numpy-1.14.0.dev0+1f4ed32-py3.6-macosx-10.12-x86_64.egg/numpy/core/arrayprint.py", line 392, in _array2string    options['edgeitems'], summary_insert)[:-1]  File "/Users/tos/py3npy/lib/python3.6/site-packages/numpy-1.14.0.dev0+1f4ed32-py3.6-macosx-10.12-x86_64.egg/numpy/core/arrayprint.py", line 565, in _formatArray    word = format_function(a[-i]) + separator  File "/Users/tos/py3npy/lib/python3.6/site-packages/numpy-1.14.0.dev0+1f4ed32-py3.6-macosx-10.12-x86_64.egg/numpy/core/arrayprint.py", line 886, in __call__    for field, format_function in zip(x, self.format_functions):TypeError: zip argument #1 must support iteration

Then I printed some local variables:

>>> pdb.pm()> /Users/tos/py3npy/lib/python3.6/site-packages/numpy-1.14.0.dev0+1f4ed32-py3.6-macosx-10.12-x86_64.egg/numpy/core/arrayprint.py(886)__call__()-> for field, format_function in zip(x, self.format_functions):(Pdb) p x0(Pdb) u> /Users/tos/py3npy/lib/python3.6/site-packages/numpy-1.14.0.dev0+1f4ed32-py3.6-macosx-10.12-x86_64.egg/numpy/core/arrayprint.py(565)_formatArray()-> word = format_function(a[-i]) + separator(Pdb) p a.dtypedtype([('r', 'u1'), ('g', 'u1'), ('b', 'u1'), ('a', 'u1')])(Pdb) p a['r']array([0, 0, 0], dtype=uint8)(Pdb) p a[0]0

Environment:

  • OS: macOS 10.12.6
  • Python: 3.6 on Homebrew
  • Numpy: 1.12, 1.13.3, and1f4ed32
    • This error didn't occur with numpy==1.11.3

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp