Fix -Wint-in-bool-context warnings

This commit is contained in:
Petr Viktorin 2018-02-23 13:48:07 +01:00
parent 528a444ab6
commit 5316098666
2 changed files with 38 additions and 1 deletions

View File

@ -0,0 +1,24 @@
commit fd39e2a6845f33a74fbb0671c434c0d84a5ec2f3
Author: Christian Heimes <christian@python.org>
Date: Fri Sep 15 20:27:23 2017 +0200
bpo-31474: Fix -Wint-in-bool-context warnings (#3581)
Signed-off-by: Christian Heimes <christian@python.org>
diff --git a/Include/pymem.h b/Include/pymem.h
index 10b5bea5eb..2c239df590 100644
--- a/Include/pymem.h
+++ b/Include/pymem.h
@@ -72,9 +72,9 @@ PyAPI_FUNC(void) PyMem_Free(void *);
/* Returns NULL to indicate error if a negative size or size larger than
Py_ssize_t can represent is supplied. Helps prevents security holes. */
#define PyMem_MALLOC(n) ((size_t)(n) > (size_t)PY_SSIZE_T_MAX ? NULL \
- : malloc((n) ? (n) : 1))
+ : malloc(((n) != 0) ? (n) : 1))
#define PyMem_REALLOC(p, n) ((size_t)(n) > (size_t)PY_SSIZE_T_MAX ? NULL \
- : realloc((p), (n) ? (n) : 1))
+ : realloc((p), ((n) != 0) ? (n) : 1))
#define PyMem_FREE free
#endif /* PYMALLOC_DEBUG */

View File

@ -112,7 +112,7 @@ Summary: An interpreted, interactive, object-oriented programming language
Name: %{python}
# Remember to also rebase python-docs when changing this:
Version: 2.7.14
Release: 12%{?dist}
Release: 13%{?dist}
License: Python
Group: Development/Languages
Requires: %{python}-libs%{?_isa} = %{version}-%{release}
@ -773,6 +773,14 @@ Patch289: 00289-disable-nis-detection.patch
# See https://bugzilla.redhat.com/show_bug.cgi?id=1540316
Patch293: 00293-fix-gc-alignment.patch
# 00297 #
# Fix -Wint-in-bool-context warnings that show up when compiling Python
# (and, more importantly, Python libraries) with newer GCC.
# See https://bugzilla.redhat.com/show_bug.cgi?id=1473425
# Fixed upstream: https://github.com/python/cpython/pull/3581
Patch297: 00297-fix-int-in-bool-context-warnings.patch
# (New patches go here ^^^)
#
# When adding new patches to "python2" and "python3" in Fedora, EL, etc.,
@ -1098,6 +1106,7 @@ mv Modules/cryptmodule.c Modules/_cryptmodule.c
%patch288 -p1
%patch289 -p1
%patch293 -p1
%patch297 -p1
%if 0%{?_module_build}
@ -1976,6 +1985,10 @@ CheckPython \
# ======================================================
%changelog
* Mon Feb 26 2018 Petr Viktorin <pviktori@redhat.com> - 2.7.14-13
- Fix -Wint-in-bool-context warnings
Resolves: rhbz#1473425
* Sat Feb 24 2018 Florian Weimer <fweimer@redhat.com> - 2.7.14-12
- Rebuild with new LDFLAGS from redhat-rpm-config