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

BUG: Fix TypeError when raising TypeError #7609

Merged
merged 1 commit into from
May 9, 2016
Merged

Conversation

eric-wieser
Copy link
Member

Fixes "TypeError: pop expected at least 1 arguments, got 0"

Fixes "TypeError: pop expected at least 1 arguments, got 0"
@@ -244,7 +244,7 @@ def broadcast_arrays(*args, **kwargs):
subok = kwargs.pop('subok', False)
if kwargs:
raise TypeError('broadcast_arrays() got an unexpected keyword '
'argument {}'.format(kwargs.pop()))
'argument {!r}'.format(kwargs.keys()[0]))
Copy link
Member

Choose a reason for hiding this comment

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

Any particular reason for !r instead of !s?

Copy link
Member

Choose a reason for hiding this comment

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

!r (= repr) will put quotes around the key and escape any weird junk that might be in it, both of which seem like good things to me in this context

Copy link
Member Author

Choose a reason for hiding this comment

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

!r is what a normal TypeError due to extra kwargs seems to do

@charris
Copy link
Member

charris commented May 9, 2016

Should add a test in numpy/lib/test/test_stride_tricks. I don't see an obvious place, just make a test function and check that it raises correctly. Otherwise, looks good.

@charris
Copy link
Member

charris commented May 9, 2016

Thanks @eric-wieser .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants