Skip to content
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

Let _pcolorargs check C for consistency with X and Y; closes #1688 #2063

Merged
merged 3 commits into from May 28, 2013

Conversation

efiring
Copy link
Member

@efiring efiring commented May 24, 2013

This is a minimal change to close #1688.

@mdboom
Copy link
Member

mdboom commented May 24, 2013

Looks good. Understanding that _pcolorargs is a private method, it still might be nice to document the purpose of the allmatch kwarg in a comment.

This error was revealed by the new checking in _pcolorargs.
@efiring
Copy link
Member Author

efiring commented May 25, 2013

There is an unrelated Travis test failure on Python 3.3. I think this is ready to merge.

@@ -7339,6 +7361,15 @@ def _pcolorargs(self, funcname, *args):
raise TypeError(
'Incompatible X, Y inputs to %s; see help(%s)' % (
funcname, funcname))
if allmatch:
if not (Nx == numCols and Ny == numRows):
raise TypeError('Dimensions of C are incompatible with'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These exceptions are probably going to be quite common. I wonder if it is worth making them slightly better by providing some shape information?

I see that they are TypeErrors for consistency, but maybe they should be ValueErrors instead...

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pelson, "yes" to both of these comments. I considered the change to ValueError, but decided that was best left for a later PR, first because it could break user code, and second because I think this is not the only place where that switch should be made.

@pelson
Copy link
Member

pelson commented May 28, 2013

👍 from me.

@mdboom mdboom merged commit 9d5e9ee into matplotlib:master May 28, 2013
@mdboom
Copy link
Member

mdboom commented May 28, 2013

I have merged this manually with the additional information in the error message as suggested by @pelson.

@mdboom
Copy link
Member

mdboom commented May 28, 2013

FYI: Merge commit is 7e49a5e

@efiring efiring deleted the pcolorargs branch May 28, 2013 16:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

_pcolorargs should check consistency of argument shapes
3 participants