Skip to content

KeyError: 'PyString_Type' traceback #171

Description

@dvarrazzo

Traceback on Py3 in v0.17 with gcc 6:

/gcc-python-plugin/gcc-with-cpychecker -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION=2.8.dev0 (dt dec pq3 ext lo64) -DPG_VERSION_NUM=100006 -DHAVE_LO64=1 -I/usr/include/python3.6m -I. -I/usr/include/postgresql -I/usr/include/postgresql/10/server -c psycopg/adapter_asis.c -o build/temp.linux-x86_64-3.6/psycopg/adapter_asis.o -Wdeclaration-after-statement
psycopg/adapter_asis.c: In function 'asis_getquoted':
psycopg/adapter_asis.c:46:12: error: Unhandled Python exception raised calling 'execute' method
         rv = PyObject_Str(self->wrapped);
         ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Traceback (most recent call last):
  File "/gcc-python-plugin/libcpychecker/__init__.py", line 95, in execute
    self._check_refcounts(fun)
  File "/gcc-python-plugin/libcpychecker/__init__.py", line 101, in _check_refcounts
    dump_json=self.dump_json)
  File "/gcc-python-plugin/libcpychecker/refcounts.py", line 4414, in check_refcounts
    maxtrans)
  File "/gcc-python-plugin/libcpychecker/refcounts.py", line 4267, in impl_check_refcounts
    limits=limits)
  File "/gcc-python-plugin/libcpychecker/absinterp.py", line 3047, in iter_traces
    depth + 1):
  File "/gcc-python-plugin/libcpychecker/absinterp.py", line 3047, in iter_traces
    depth + 1):
  File "/gcc-python-plugin/libcpychecker/absinterp.py", line 3047, in iter_traces
    depth + 1):
  [Previous line repeated 1 more time]
  File "/gcc-python-plugin/libcpychecker/absinterp.py", line 3011, in iter_traces
    transitions = curstate.get_transitions()
  File "/gcc-python-plugin/libcpychecker/absinterp.py", line 2049, in get_transitions
    return self._get_transitions_for_stmt(stmt)
  File "/gcc-python-plugin/libcpychecker/absinterp.py", line 2065, in _get_transitions_for_stmt
    return self._get_transitions_for_GimpleCall(stmt)
  File "/gcc-python-plugin/libcpychecker/absinterp.py", line 2232, in _get_transitions_for_GimpleCall
    return meth(stmt, *args)
  File "/gcc-python-plugin/libcpychecker/refcounts.py", line 3047, in impl_PyObject_Str
    'PyString_Type')
  File "/gcc-python-plugin/libcpychecker/refcounts.py", line 726, in object_ctor
    typeobjregion = self.typeobjregion_by_name(typeobjname)
  File "/gcc-python-plugin/libcpychecker/refcounts.py", line 699, in typeobjregion_by_name
    typeobjdecl = compat.get_typeobject_decl_by_name(typeobjname)
  File "/gcc-python-plugin/libcpychecker/compat.py", line 89, in get_typeobject_decl_by_name
    typeobjdecl = _get_typeobject_decl_by_name(typeobjname)
  File "/gcc-python-plugin/libcpychecker/compat.py", line 70, in _get_typeobject_decl_by_name
    return global_typeobjs[typeobjname]
KeyError: 'PyString_Type'
error: command '/gcc-python-plugin/gcc-with-cpychecker' failed with exit status 1

Function definition is:

static PyObject *
asis_getquoted(asisObject *self, PyObject *args)
{
    PyObject *rv;
    if (self->wrapped == Py_None) {
        Py_INCREF(psyco_null);
        rv = psyco_null;
    }
    else {
        rv = PyObject_Str(self->wrapped);
#if PY_MAJOR_VERSION > 2
        /* unicode to bytes in Py3 */
        if (rv) {
            PyObject *tmp = PyUnicode_AsUTF8String(rv);
            Py_DECREF(rv);
            rv = tmp;
        }
#endif
    }

    return rv;
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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