This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: unittest.skipUnless(time._STRUCT_TM_ITEMS == 11, "needs tm_zone support") doesn't work
Type: behavior Stage:
Components: Tests Versions: Python 3.8
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: belopolsky, jianxu3, lemburg, p-ganssle, serhiy.storchaka
Priority: normal Keywords:

Created on 2019-01-15 09:32 by jianxu3, last changed 2022-04-11 14:59 by admin.

Messages (2)
msg333654 - (view) Author: jianxu3 (jianxu3) * Date: 2019-01-15 09:32
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.
msg401104 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2021-09-05 18:55
_STRUCT_TM_ITEMS was always set to 11 since issue25283.

On what platform test_localtime_timezone fails now?
History
Date User Action Args
2022-04-11 14:59:10adminsetgithub: 79922
2021-09-05 18:55:50serhiy.storchakasetnosy: + serhiy.storchaka
messages: + msg401104
2021-08-30 05:55:50serhiy.storchakasetnosy: + lemburg, p-ganssle
2019-01-15 14:32:46xtreaksetnosy: + belopolsky
2019-01-15 09:32:07jianxu3create