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/ENH: Improve output for structured non-void types#10612

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
charris merged 3 commits intonumpy:maintenance/1.14.xfromcharris:backport-10381
Feb 17, 2018
Merged
Show file tree
Hide file tree
Changes from1 commit
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
NextNext commit
BUG: Show the base of a compound dtype even when it doesn't subclass …
…void
  • Loading branch information
@eric-wieser@charris
eric-wieser authored andcharris committedFeb 16, 2018
commit453bf655b94d936dd17f3f29974698716548641d
4 changes: 2 additions & 2 deletionsnumpy/core/src/multiarray/descriptor.c
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -3340,8 +3340,8 @@ arraydescr_struct_str(PyArray_Descr *dtype, int includealignflag)
sub = arraydescr_struct_dict_str(dtype, includealignflag);
}

/* If the data typehas a non-void (subclassed) type, show it */
if (dtype->type_num == NPY_VOID && dtype->typeobj != &PyVoidArrType_Type) {
/* If the data typeisn't the default, void, show it */
if (dtype->typeobj != &PyVoidArrType_Type) {
/*
* Note: We cannot get the type name from dtype->typeobj->tp_name
* because its value depends on whether the type is dynamically or
Expand Down
5 changes: 5 additions & 0 deletionsnumpy/core/tests/test_multiarray.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -478,6 +478,11 @@ def test_byteorders(self):
assert_(np.dtype('<i4') != np.dtype('>i4'))
assert_(np.dtype([('a', '<i4')]) != np.dtype([('a', '>i4')]))

def test_structured_non_void(self):
fields = [('a', '<i2'), ('b', '<i2')]
dt_int = np.dtype(('i4', fields))
assert_equal(str(dt_int), "(numpy.int32, [('a', '<i2'), ('b', '<i2')])")


class TestZeroRank(object):
def setup(self):
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp