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

add tzinfo constructor (fixes #319) #338

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

miguelgrinberg
Copy link
Contributor

This patch addresses the following datetime error:

AttributeError: type object 'tzinfo' has no attribute 'new'

@agners
Copy link

agners commented Jun 23, 2019

This fixes #319 for me nicely, thx!

@@ -914,6 +914,11 @@ class tzinfo:
Subclasses must override the name(), utcoffset() and dst() methods.
"""
__slots__ = ()

def __new__(cls):
Copy link

Choose a reason for hiding this comment

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

If you run the test suite this will fail at some point because more arguments are passed. I'd suggest you go with

    def __new__(cls, *args, **kwargs):
        return object.__new__(cls)

Choose a reason for hiding this comment

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

thank you ,that works

@stinos
Copy link

stinos commented Mar 18, 2020

@dpgeorge this is low-hanging fruit to get more CPython compatibility. Even though with a fix the test suite doesn't pass completely (on CPython nor on MicroPython) can we this fix in so it's at least possible to import datetime?

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.

None yet

4 participants