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

unittest.skipUnless(time._STRUCT_TM_ITEMS == 11, "needs tm_zone support") doesn't work #79922

Open
jianxu3 mannequin opened this issue Jan 15, 2019 · 2 comments
Open
Labels
3.8 only security fixes tests Tests in the Lib/test dir type-bug An unexpected behavior, bug, or error

Comments

@jianxu3
Copy link
Mannequin

jianxu3 mannequin commented Jan 15, 2019

BPO 35741
Nosy @malemburg, @abalkin, @serhiy-storchaka, @pganssle, @jianxu3

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = None
closed_at = None
created_at = <Date 2019-01-15.09:32:07.739>
labels = ['3.8', 'type-bug', 'tests']
title = 'unittest.skipUnless(time._STRUCT_TM_ITEMS == 11, "needs tm_zone support") doesn\'t work'
updated_at = <Date 2021-09-05.18:55:50.491>
user = 'https://github.com/jianxu3'

bugs.python.org fields:

activity = <Date 2021-09-05.18:55:50.491>
actor = 'serhiy.storchaka'
assignee = 'none'
closed = False
closed_date = None
closer = None
components = ['Tests']
creation = <Date 2019-01-15.09:32:07.739>
creator = 'jianxu3'
dependencies = []
files = []
hgrepos = []
issue_num = 35741
keywords = []
message_count = 2.0
messages = ['333654', '401104']
nosy_count = 5.0
nosy_names = ['lemburg', 'belopolsky', 'serhiy.storchaka', 'p-ganssle', 'jianxu3']
pr_nums = []
priority = 'normal'
resolution = None
stage = None
status = 'open'
superseder = None
type = 'behavior'
url = 'https://bugs.python.org/issue35741'
versions = ['Python 3.8']

@jianxu3
Copy link
Mannequin Author

jianxu3 mannequin commented Jan 15, 2019

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.

@jianxu3 jianxu3 mannequin added 3.8 only security fixes tests Tests in the Lib/test dir type-bug An unexpected behavior, bug, or error labels Jan 15, 2019
@serhiy-storchaka
Copy link
Member

_STRUCT_TM_ITEMS was always set to 11 since bpo-25283.

On what platform test_localtime_timezone fails now?

@ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.8 only security fixes tests Tests in the Lib/test dir type-bug An unexpected behavior, bug, or error
Projects
Status: No status
Development

No branches or pull requests

1 participant