Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KeyError: 'PyString_Type' traceback #171

Open
dvarrazzo opened this issue Feb 4, 2019 · 0 comments
Open

KeyError: 'PyString_Type' traceback #171

dvarrazzo opened this issue Feb 4, 2019 · 0 comments

Comments

@dvarrazzo
Copy link
Contributor

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;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant