New submission from Stefan Behnel <stefan...@behnel.de>:

Following up on issue 25658, it was found that the current definition of 
Py_tss_NEEDS_INIT restricts its use to initialisers in C and cannot be used for 
arbitrary assignments. It is currently declared as follows:

    #define Py_tss_NEEDS_INIT   {0}

which results in a C compiler error for assignments like "x = 
Py_tss_NEEDS_INIT".

I proposed to change this to

    #define Py_tss_NEEDS_INIT   ((Py_tss_t) {0})

in compliance with GCC and C99, but that fails to compile in MSVC and probably 
other old C++-ish compilers.

I'm not sure how to improve this declaration, but given that it's a public 
header file, restricting its applicability seems really unfortunate.

----------
components: Extension Modules, Interpreter Core
messages: 304661
nosy: masamoto, ncoghlan, scoder
priority: normal
pull_requests: 4031
severity: normal
status: open
title: Support Py_tss_NEEDS_INIT outside of static initialisation
type: enhancement
versions: Python 3.7

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue31828>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to