-
-
Notifications
You must be signed in to change notification settings - Fork 11.1k
Fix invalid typestring size #2797
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 1 commit
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
9340dd4
Fix invalid typestring size
jayvius d288e39
Refactor to cover more cases; modify unit tests
jayvius ab2d5d2
Modify unit tests for 32 bit support
jayvius 6209e3e
Refactor unit tests and add DECREF
jayvius d0aca0e
Add debug logging to figure out why unit test fails on Travis
jayvius 5de0b6e
Add fix to unit test; remove debug logging
jayvius File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Refactor to cover more cases; modify unit tests
- Loading branch information
commit d288e39ff895504649a990318dbb9496edcc794a
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -47,13 +47,16 @@ def test_equivalent_dtype_hashing(self): | |
self.assertTrue(hash(left) == hash(right)) | ||
|
||
def test_invalid_types(self): | ||
# Make sure invalid type strings raise exceptions | ||
for typestr in ['O3', 'O5', 'O7', 'b3', 'h4', 'I5', 'l4', 'l8', | ||
'L4', 'L8', 'q8', 'q16', 'Q8', 'Q16', 'e3', | ||
'f5', 'd8', 't8', 'g12', 'g16', | ||
'NA[u4,0xffffffff]']: | ||
# Make sure invalid type strings raise exceptions. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This comment is contradicted directly below... please keep comments consistent with each other and with code :-) |
||
# For now, display a deprecation warning for invalid | ||
# type sizes. In the future this should be changed | ||
# to an exception. | ||
for typestr in ['O3', 'O5', 'O7', 'b3', 'h4', 'I5', 'l4', | ||
'L4', 'q16', 'Q16', 'e3', 'f5', 'g12']: | ||
#print typestr | ||
assert_raises(TypeError, np.dtype, typestr) | ||
assert_warns(DeprecationWarning, np.dtype, typestr) | ||
|
||
assert_raises(TypeError, np.dtype, 't8', 'NA[u4,0xffffffff]') | ||
|
||
def test_bad_param(self): | ||
# Can't give a size that's too small | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order
2CD7
to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing a
Py_DECREF(temp)
here.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oops...good catch :)