8000 Merge pull request #376 from cgohlke/patch-2 · numpy/numpy@9652574 · GitHub
[go: up one dir, main page]

Skip to content

Commit 9652574

Browse files
committed
Merge pull request #376 from cgohlke/patch-2
Allow long numbers in numpy.rec.array formats string
2 parents fab65b7 + 1e7979f commit 9652574

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

numpy/core/_internal.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ def _reconstruct(subtype, shape, dtype):
133133

134134
format_re = re.compile(asbytes(
135135
r'(?P<order1>[<>|=]?)'
136-
r'(?P<repeats> *[(]?[ ,0-9]*[)]? *)'
136+
r'(?P<repeats> *[(]?[ ,0-9L]*[)]? *)'
137137
r'(?P<order2>[<>|=]?)'
138138
r'(?P<dtype>[A-Za-z0-9.]*(?:\[[a-zA-Z0-9,.]+\])?)'))
139139
sep_re = re.compile(asbytes(r'\s*,\s*'))

numpy/core/tests/test_dtype.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -413,6 +413,11 @@ def test_complex_dtype_repr(self):
413413
assert_equal(repr(dt),
414414
"dtype([('a', '<M8[D]'), ('b', '<m8[us]')])")
415415

416+
@dec.skipif(sys.version_info[0] > 2)
417+
def test_dtype_str_with_long_in_shape(self):
418+
# Pull request #376
419+
dt = np.dtype('(1L,)i4')
420+
416421

417422
class TestDtypeAttributeDeletion(object):
418423

0 commit comments

Comments
 (0)
0