Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Objects/bytearrayobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ PyByteArray_Resize(PyObject *self, Py_ssize_t requested_size)
return -1;
}
memcpy(sval, PyByteArray_AS_STRING(self),
Py_MIN(requested_size, Py_SIZE(self)));
Py_MIN((size_t)requested_size, (size_t)Py_SIZE(self)));
PyObject_Free(obj->ob_bytes);
}
else {
Expand Down
9 changes: 9 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -1526,6 +1526,7 @@ class db_found(Exception): pass
if '--with-system-expat' in sysconfig.get_config_var("CONFIG_ARGS"):
expat_inc = []
define_macros = []
extra_compile_args = []
expat_lib = ['expat']
expat_sources = []
expat_depends = []
Expand All @@ -1537,6 +1538,7 @@ class db_found(Exception): pass
# call XML_SetHashSalt(), expat entropy sources are not needed
('XML_POOR_ENTROPY', '1'),
]
extra_compile_args = []
expat_lib = []
expat_sources = ['expat/xmlparse.c',
'expat/xmlrole.c',
Expand All @@ -1554,8 +1556,15 @@ class db_found(Exception): pass
'expat/xmltok_impl.h'
]

cc = sysconfig.get_config_var('CC').split()[0]
ret = os.system(
'"%s" -Werror -Wimplicit-fallthrough -E -xc /dev/null >/dev/null 2>&1' % cc)
if ret >> 8 == 0:
extra_compile_args.append('-Wno-implicit-fallthrough')

exts.append(Extension('pyexpat',
define_macros = define_macros,
extra_compile_args = extra_compile_args,
include_dirs = expat_inc,
libraries = expat_lib,
sources = ['pyexpat.c'] + expat_sources,
Expand Down