Skip to content

isinf() causes problem #165

Open
Open
@dvarrazzo

Description

@dvarrazzo

The function:

static PyObject *
pfloat_getquoted(pfloatObject *self, PyObject *args)
{
    PyObject *rv;
    double n = 3.14;
    if (isnan(n))
        rv = PyString_FromString("'NaN'::float");
    else if (isinf(n)) {
        if (n > 0)
            rv = PyString_FromString("'Infinity'::float");
        else
            rv = PyString_FromString("'-Infinity'::float");
    }
    else {
        rv = Py_None;
        Py_INCREF(rv);
    }

exit:
    return rv;
}

crashes the checker with the following traceback:

psycopg/adapter_pfloat.c:45:14: error: Unhandled Python exception raised calling 'execute' method
     else if (isinf(n)) {
              ^
Traceback (most recent call last):
  File "/home/piro/dev/fs/gcc-python-plugin/libcpychecker/__init__.py", line 95, in execute
    self._check_refcounts(fun)
  File "/home/piro/dev/fs/gcc-python-plugin/libcpychecker/__init__.py", line 101, in _check_refcounts
    dump_json=self.dump_json)
  File "/home/piro/dev/fs/gcc-python-plugin/libcpychecker/refcounts.py", line 4414, in check_refcounts
    maxtrans)
  File "/home/piro/dev/fs/gcc-python-plugin/libcpychecker/refcounts.py", line 4267, in impl_check_refcounts
    limits=limits)
  File "/home/piro/dev/fs/gcc-python-plugin/libcpychecker/absinterp.py", line 3047, in iter_traces
    depth + 1):
  File "/home/piro/dev/fs/gcc-python-plugin/libcpychecker/absinterp.py", line 3047, in iter_traces
    depth + 1):
  File "/home/piro/dev/fs/gcc-python-plugin/libcpychecker/absinterp.py", line 3047, in iter_traces
    depth + 1):
  File "/home/piro/dev/fs/gcc-python-plugin/libcpychecker/absinterp.py", line 3047, in iter_traces
    depth + 1):
  File "/home/piro/dev/fs/gcc-python-plugin/libcpychecker/absinterp.py", line 3011, in iter_traces
    transitions = curstate.get_transitions()
  File "/home/piro/dev/fs/gcc-python-plugin/libcpychecker/absinterp.py", line 2049, in get_transitions
    return self._get_transitions_for_stmt(stmt)
  File "/home/piro/dev/fs/gcc-python-plugin/libcpychecker/absinterp.py", line 2076, in _get_transitions_for_stmt
    return self._get_transitions_for_GimpleAssign(stmt)
  File "/home/piro/dev/fs/gcc-python-plugin/libcpychecker/absinterp.py", line 2595, in _get_transitions_for_GimpleAssign
    value = self.eval_rhs(stmt)
  File "/home/piro/dev/fs/gcc-python-plugin/libcpychecker/absinterp.py", line 2587, in eval_rhs
    % (stmt.exprcode, stmt.exprcode, stmt.loc))
NotImplementedError: Don't know how to cope with exprcode: <type 'gcc.UnleExpr'> (<type 'gcc.UnleExpr'>) at psycopg/adapter_pfloat.c:45

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions