Skip to content

Commit

Permalink
pythongh-112451: Make C-extension datetime.timezone acceptable as a b…
Browse files Browse the repository at this point in the history
…ase class.
  • Loading branch information
felixxm committed Nov 29, 2023
1 parent f9e6ce0 commit c689f7c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions Lib/test/test_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -640,6 +640,11 @@ def test_traceback_and_frame_types(self):
def test_capsule_type(self):
self.assertIsInstance(_datetime.datetime_CAPI, types.CapsuleType)

def test_timezone_base_type(self):
class MyTimezone(_datetime.timezone):
pass

self.assertIs(issubclass(MyTimezone, _datetime.timezone), True)

class UnionTests(unittest.TestCase):

Expand Down
2 changes: 1 addition & 1 deletion Modules/_datetimemodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -4107,7 +4107,7 @@ static PyTypeObject PyDateTime_TimeZoneType = {
0, /* tp_getattro */
0, /* tp_setattro */
0, /* tp_as_buffer */
Py_TPFLAGS_DEFAULT, /* tp_flags */
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
timezone_doc, /* tp_doc */
0, /* tp_traverse */
0, /* tp_clear */
Expand Down

0 comments on commit c689f7c

Please sign in to comment.