Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cython
Commits
17c165c5
Commit
17c165c5
authored
Sep 02, 2020
by
cf-natali
Committed by
Stefan Behnel
Sep 04, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Silence gcc diagnostics whenever -1 is cast to something user provided. (GH-3803)
Fixes GH-2749.
parent
ba258f75
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
2 deletions
+18
-2
Cython/Utility/TypeConversion.c
Cython/Utility/TypeConversion.c
+18
-2
No files found.
Cython/Utility/TypeConversion.c
View file @
17c165c5
...
...
@@ -625,9 +625,17 @@ static CYTHON_INLINE Py_UNICODE __Pyx_PyObject_AsPy_UNICODE(PyObject* x) {
static
CYTHON_INLINE
PyObject
*
{{
TO_PY_FUNCTION
}}({{
TYPE
}}
value
);
/////////////// CIntToPy ///////////////
//@requires: GCCDiagnostics
static
CYTHON_INLINE
PyObject
*
{{
TO_PY_FUNCTION
}}({{
TYPE
}}
value
)
{
const
{{
TYPE
}}
neg_one
=
({{
TYPE
}})
(({{
TYPE
}})
0
-
({{
TYPE
}})
1
),
const_zero
=
({{
TYPE
}})
0
;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
const
{{
TYPE
}}
neg_one
=
({{
TYPE
}})
-
1
,
const_zero
=
({{
TYPE
}})
0
;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
const
int
is_unsigned
=
neg_one
>
const_zero
;
if
(
is_unsigned
)
{
if
(
sizeof
({{
TYPE
}})
<
sizeof
(
long
))
{
...
...
@@ -853,11 +861,19 @@ static CYTHON_INLINE {{TYPE}} {{FROM_PY_FUNCTION}}(PyObject *);
/////////////// CIntFromPy ///////////////
//@requires: CIntFromPyVerify
//@requires: GCCDiagnostics
{{
py
:
from
Cython
.
Utility
import
pylong_join
}}
static
CYTHON_INLINE
{{
TYPE
}}
{{
FROM_PY_FUNCTION
}}(
PyObject
*
x
)
{
const
{{
TYPE
}}
neg_one
=
({{
TYPE
}})
(({{
TYPE
}})
0
-
({{
TYPE
}})
1
),
const_zero
=
({{
TYPE
}})
0
;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
const
{{
TYPE
}}
neg_one
=
({{
TYPE
}})
-
1
,
const_zero
=
({{
TYPE
}})
0
;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
const
int
is_unsigned
=
neg_one
>
const_zero
;
#if PY_MAJOR_VERSION < 3
if
(
likely
(
PyInt_Check
(
x
)))
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment