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

TypeError: __init__() got an unexpected keyword argument 'locale' #630

Closed
charlax opened this issue Aug 7, 2019 · 4 comments · Fixed by #631
Closed

TypeError: __init__() got an unexpected keyword argument 'locale' #630

charlax opened this issue Aug 7, 2019 · 4 comments · Fixed by #631
Labels

Comments

@charlax
Copy link
Contributor

charlax commented Aug 7, 2019

Happens with latest (0.14.4) version:

In [1]: import arrow

In [2]: arrow.get("2010", "YYYY", locale="fr_FR")
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-2-a09819f3b7b0> in <module>
----> 1 arrow.get("2010", "YYYY", locale="fr_FR")

lib/python3.6/site-packages/arrow/api.py in get(*args, **kwargs)
     19     """
     20
---> 21     return _factory.get(*args, **kwargs)
     22
     23

lib/python3.6/site-packages/arrow/factory.py in get(self, *args, **kwargs)
    261         # 3+ args -> datetime-like via constructor.
    262         else:
--> 263             return self.type(*args, **kwargs)
    264
    265     def utcnow(self):

TypeError: __init__() got an unexpected keyword argument 'locale'

In [3]: arrow.__version__
Out[3]: '0.14.4'

Used to work with previous version. This is not mentioned in the breaking changes, so I assume it's a bug?

@charlax
Copy link
Contributor Author

charlax commented Aug 7, 2019

Offending line:

https://github.com/crsmithdev/arrow/blob/master/arrow/factory.py#L153

locale = kwargs.get("locale", "en_us")

You probably want to pop instead. And you probably want a regression test for this too :)

@charlax
Copy link
Contributor Author

charlax commented Aug 7, 2019

Let me write a PR for that.

@charlax
Copy link
Contributor Author

charlax commented Aug 7, 2019

Done, let me know if this looks good to merge?

@jadchaar
Copy link
Member

jadchaar commented Aug 8, 2019

We have pushed 0.14.5 to fix this regression. Thanks!

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

Successfully merging a pull request may close this issue.

2 participants