File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1919/* dummy definitions, in most cases struct fields aren't required. */
2020
2121#define NULL (void *)0
22+ #define assert (op ) /* empty */
2223typedef int sdigit ;
2324typedef long Py_ssize_t ;
25+ typedef long long PY_LONG_LONG ;
2426typedef unsigned short wchar_t ;
2527typedef struct {} PyObject ;
2628typedef struct {} grammar ;
@@ -37,17 +39,40 @@ void Py_FatalError(const char *msg) {
3739/* Objects/longobject.c
3840 * NEGATIVE_RETURNS false positive */
3941
40- static PyObject small_ints [257 + 5 ];
41-
4242static PyObject * get_small_int (sdigit ival )
4343{
44+ /* Never returns NULL */
4445 PyObject * p ;
45- if (((ival + 5 ) >= 0 ) && ((ival + 5 ) < 257 + 5 )) {
46- return & small_ints [ival + 5 ];
47- }
46+ assert (p != NULL );
4847 return p ;
4948}
5049
50+ PyObject * PyLong_FromLong (long ival )
51+ {
52+ PyObject * p ;
53+ int maybe ;
54+
55+ if ((ival >= -5 ) && (ival < 257 + 5 )) {
56+ p = get_small_int (ival );
57+ assert (p != NULL );
58+ return p ;
59+ }
60+ if (maybe )
61+ return p ;
62+ else
63+ return NULL ;
64+ }
65+
66+ PyObject * PyLong_FromLongLong (PY_LONG_LONG ival )
67+ {
68+ return PyLong_FromLong ((long )ival );
69+ }
70+
71+ PyObject * PyLong_FromSsize_t (Py_ssize_t ival )
72+ {
73+ return PyLong_FromLong ((long )ival );
74+ }
75+
5176/* tainted sinks
5277 *
5378 * Coverity considers argv, environ, read() data etc as tained.
You can’t perform that action at this time.
0 commit comments