Skip to content

BaseException does not take keyword arguments #2348

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 2 commits into from
Jul 27, 2018

Conversation

euresti
Copy link
Contributor

@euresti euresti commented Jul 27, 2018

Fixes #2344

@JelleZijlstra
Copy link
Member

Can you fix the CI failure?

@euresti
Copy link
Contributor Author

euresti commented Jul 27, 2018

Oops. Fixed!

@JelleZijlstra JelleZijlstra merged commit 4e40b03 into python:master Jul 27, 2018
Michael0x2a pushed a commit to Michael0x2a/typeshed that referenced this pull request Aug 8, 2018
It seems that code using HTTPError previously worked by accident
because we used to accept arbitrary keyword arguments when
instantiating BaseException, or any subclass of BaseException
(see python#2348).

This commit adds in the correct constructor (which also lets the
user specify the arguments in keyword-argument form).

Note: I'm not very familiar with the urllib libraries, so I opted
to just add the signature and leave it up to somebody else to
fill in the types.
JelleZijlstra pushed a commit that referenced this pull request Aug 9, 2018
It seems that code using HTTPError previously worked by accident
because we used to accept arbitrary keyword arguments when
instantiating BaseException, or any subclass of BaseException
(see #2348).

This commit adds in the correct constructor (which also lets the
user specify the arguments in keyword-argument form).

Note: I'm not very familiar with the urllib libraries, so I opted
to just add the signature and leave it up to somebody else to
fill in the types.
yedpodtrzitko pushed a commit to yedpodtrzitko/typeshed that referenced this pull request Jan 23, 2019
yedpodtrzitko pushed a commit to yedpodtrzitko/typeshed that referenced this pull request Jan 23, 2019
It seems that code using HTTPError previously worked by accident
because we used to accept arbitrary keyword arguments when
instantiating BaseException, or any subclass of BaseException
(see python#2348).

This commit adds in the correct constructor (which also lets the
user specify the arguments in keyword-argument form).

Note: I'm not very familiar with the urllib libraries, so I opted
to just add the signature and leave it up to somebody else to
fill in the types.
bmw added a commit to certbot/certbot that referenced this pull request Apr 2, 2021
Some are no longer needed and other's comments are out of date.

For the changes to the acme nonce errors, `Exception` doesn't take kwargs. The error message about this our own classes isn't super helpful:
```
In [2]: BadNonce('nonce', 'error', foo='bar')                                                                                                                                                                                                                                                                               
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-2-54555658ef99> in <module>
----> 1 BadNonce('nonce', 'error', foo='bar')

TypeError: __init__() got an unexpected keyword argument 'foo'
```
but if you try this on `Exception` which these classes inherit from, you get:
```
In [4]: Exception(foo='bar')                                                                                                                                                                                                                                                                                                
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-4-028b924f74c5> in <module>
----> 1 Exception(foo='bar')

TypeError: Exception() takes no keyword arguments
```
See python/typeshed#2348 for more info.

* remove outdated ignores

* update locking ignore comment

* don't accept kwargs
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.

2 participants