Skip to content

Commit 80d4008

Browse files
committed
Error on signed-compare / possible loss of data.
1 parent 89c61d5 commit 80d4008

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

setup.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,12 +129,18 @@ def build_extension(self, ext):
129129
if isinstance(self.compiler, MSVCCompiler) or getattr(self.compiler, 'compiler_type', '') == 'msvc':
130130
# set flags only available when using MSVC
131131
ext.extra_link_args.append('/MANIFEST')
132+
# conversion from '__int64' to 'Py_ssize_t', possible loss of data
133+
ext.extra_compile_args.append('/we4244')
134+
# conversion from 'size_t' to 'int', possible loss of data
135+
ext.extra_compile_args.append('/we4267')
132136
if COMPILE_DEBUG:
133137
ext.extra_compile_args.append('/Zi')
134138
ext.extra_compile_args.append('/MTd')
135139
ext.extra_link_args.append('/DEBUG')
136140
else:
137141
ext.extra_compile_args.append('/MT')
142+
else:
143+
ext.extra_compile_args.append('-Werror=sign-compare')
138144

139145
_build_ext.build_extension(self, ext)
140146

0 commit comments

Comments
 (0)