New submission from jianxu3 <sunshone0...@163.com>:
Whether or not the HAVE_STRUCT_TM_TM_ZONE is defined, _STRUCT_TM_ITEMS always equal to 11. It is initialized at PyInit_time(void). PyModule_AddIntConstant(m, "_STRUCT_TM_ITEMS", 11); If I modify it like this: #ifdef HAVE_STRUCT_TM_TM_ZONE PyModule_AddIntConstant(m, "_STRUCT_TM_ITEMS", 11) #else PyModule_AddIntConstant(m, "_STRUCT_TM_ITEMS", 9) #endif Then test_fields at test_structseq.py will fail. def test_fields(self): self.assertEqual(t.n_fields, time._STRUCT_TM_ITEMS) What I hope is that if HAVE_STRUCT_TM_TM_ZONE is not defined, test_localtime_timezone will be skipped. ---------- components: Tests messages: 333654 nosy: jianxu3 priority: normal severity: normal status: open title: unittest.skipUnless(time._STRUCT_TM_ITEMS == 11, "needs tm_zone support") doesn't work type: behavior versions: Python 3.8 _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue35741> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com