[issue28118] type-limits warning in PyMem_New() _ssl_locks_count

2016-09-13 Thread Christian Heimes
New submission from Christian Heimes: Since last week I'm getting a compiler warning in _ssl.c. The compiler warning is related to the type of _ssl_locks_count. It's an unsigned. When I cast it to an int like PyMem_New(PyThread_type_lock, (int)_ssl_locks_count), the warning goes away. gcc -pt

[issue28118] type-limits warning in PyMem_New() _ssl_locks_count

2016-09-13 Thread STINNER Victor
STINNER Victor added the comment: It's related to new enabled GCC warnings: see issue #23545 where the warning was already reported. The code is fine. It's just hard to compute the limits of a data type in a C macro :-/ -- ___ Python tracker

[issue28118] type-limits warning in PyMem_New() _ssl_locks_count

2016-09-13 Thread SilentGhost
SilentGhost added the comment: It seems to be also related to #23545 (Martin saw a similar warning about a month ago). -- nosy: +SilentGhost, martin.panter, serhiy.storchaka ___ Python tracker

[issue28118] type-limits warning in PyMem_New() _ssl_locks_count

2016-09-13 Thread Christian Heimes
Christian Heimes added the comment: I'm going to add a workaround. _ssl_locks_count is an unsigned int because CRYPTO_num_locks() returns an unsigned int. We can safely use a signed int here. OpenSSL needs about 20, 30 locks or so. -- ___ Python tr

[issue28118] type-limits warning in PyMem_New() _ssl_locks_count

2016-09-13 Thread Martin Panter
Martin Panter added the comment: As Serhiy suggested in the other bug, one workaround is just to disable the warning with -Wno-type-limits. It would depend if the benefits of the warning outweigh the annoyance of coming up with a more complicated workaround for this specific case. --

[issue28118] type-limits warning in PyMem_New() _ssl_locks_count

2016-09-13 Thread Christian Heimes
Christian Heimes added the comment: The code is going to go away with OpenSSL 1.1.0. -- ___ Python tracker ___ ___ Python-bugs-list ma

[issue28118] type-limits warning in PyMem_New() _ssl_locks_count

2016-09-13 Thread Martin Panter
Martin Panter added the comment: Perhaps another way to defeat the warning is to make PyMem_New() an inline function? I haven’t tried, but this way would make all the data types involved more explicit. -- ___ Python tracker

[issue28118] type-limits warning in PyMem_New() _ssl_locks_count

2016-09-13 Thread STINNER Victor
STINNER Victor added the comment: Martin: "Perhaps another way to defeat the warning is to make PyMem_New() an inline function?" See the issue #28092 for compilation issues of inline functions. We should decide if inline functions are ok or not. -- ___

[issue28118] type-limits warning in PyMem_New() _ssl_locks_count

2016-09-13 Thread Martin Panter
Martin Panter added the comment: I was thinking of “static inline” for PyMem_New(). I understand the Centos and OS X Tiger problem is only related “extern inline” vs plain “inline”, and “static inline” should not be affected. -- ___ Python tracker

[issue28118] type-limits warning in PyMem_New() _ssl_locks_count

2016-09-13 Thread Christian Heimes
Christian Heimes added the comment: I have an even better solution that gets rid of the warning and the extra memset() call: diff -r bedce61ae0a0 Modules/_ssl.c --- a/Modules/_ssl.cTue Sep 13 20:22:02 2016 +0200 +++ b/Modules/_ssl.cTue Sep 13 20:45:46 2016 +0200 @@ -5073,13 +5073,12 @@

[issue28118] type-limits warning in PyMem_New() _ssl_locks_count

2016-09-13 Thread Christian Heimes
Christian Heimes added the comment: Fixed in 9e8e15993aae -- resolution: -> fixed stage: needs patch -> resolved status: open -> closed ___ Python tracker ___ __

[issue28118] type-limits warning in PyMem_New() _ssl_locks_count

2016-09-13 Thread Martin Panter
Martin Panter added the comment: Thanks that works well Christian -- ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscr