[PyQt] "Assertion failed: object has negative ref count" when running sip-build with python3.8-dbg

Dmitry Shachnev mitya57 at ubuntu.com
Sun Mar 8 17:55:09 GMT 2020


Hi,

I am working on switching Debian packages from sip v4 to v5 + pyqt-builder.

In Debian we build extensions for both the normal interpreter and the debug
one. However with sip v5 the latter fails.

When I run the following command:

python3.8-dbg -X tracemalloc /usr/bin/sip-build --confirm-license --debug

in PyQt v5.14.1 source root, I get the following error:

-----------------------------------------------------------------------------
Generating the Qt bindings...
Generating the QtCore bindings...
Generating the QtNetwork bindings...
/usr/include/python3.8d/object.h:541: _Py_NegativeRefcount: Assertion failed: object has negative ref count
Memory block allocated at (most recent call first):
  File "/usr/lib/python3/dist-packages/sipbuild/bindings.py", line 147

object address  : 0x7ffff7054eb0
object refcount : -1
object type     : 0x8e9ac0
object type name: list
object repr     : <refcnt -1 at 0x7ffff7054eb0>

Fatal Python error: _PyObject_AssertFailed
Python runtime state: initialized

Current thread 0x00007ffff7c28740 (most recent call first):
  File "/usr/lib/python3/dist-packages/sipbuild/bindings.py", line 147 in generate
  File "/usr/lib/python3/dist-packages/sipbuild/builder.py", line 278 in _generate_bindings
  File "/usr/lib/python3/dist-packages/sipbuild/builder.py", line 48 in build
  File "/usr/lib/python3/dist-packages/sipbuild/project.py", line 210 in build
  File "/usr/lib/python3/dist-packages/sipbuild/tools/build.py", line 34 in main
  File "/usr/bin/sip-build", line 11 in <module>

Program received signal SIGABRT, Aborted.
------------------------------------------------------------------------------

The relevant part of the stack trace is:

------------------------------------------------------------------------------
#5  0x000000000046e09c in _Py_NegativeRefcount (filename=filename at entry=0x7ffff7127ca8 "/usr/include/python3.8d/object.h", lineno=lineno at entry=541, op=op at entry=0x7ffff7054eb0)
    at ../Objects/object.c:235
#6  0x00007ffff7105814 in _Py_DECREF (op=0x7ffff7054eb0, lineno=541, filename=0x7ffff7127ca8 "/usr/include/python3.8d/object.h") at /usr/include/python3.8d/object.h:473
#7  _Py_XDECREF (op=0x7ffff7054eb0) at /usr/include/python3.8d/object.h:541
#8  get_bindings_configuration (sip_file=sip_file at entry=0x62af810 "QtCore/QtCoremod.sip", tags=tags at entry=0x7ffff71317d0 <neededQualifiers>, 
    disabled=disabled at entry=0x7ffff71317c8 <excludedQualifiers>) at code_generator/pybinding.c:558
#9  0x00007ffff7103988 in newImport (filename=0x62af810 "QtCore/QtCoremod.sip") at code_generator/metasrc/parser.y:8405
#10 yyparse () at code_generator/metasrc/parser.y:2012
#11 0x00007ffff71045f5 in parse (spec=spec at entry=0x634dd50, fp=fp at entry=0x0, filename=0x7ffff6374560 "/home/dmitry/python-team/pyqt5/sip/QtNetwork/QtNetworkmod.sip", strict=1, 
    tsl=0x634dd30, bsl=0x0, xfl=<optimized out>, protHack=<optimized out>, sip_files=<optimized out>) at code_generator/metasrc/parser.y:4343
#12 0x00007ffff71051b4 in py_parse (self=<optimized out>, args=<optimized out>) at code_generator/pybinding.c:157
#13 0x00000000004344fb in cfunction_call_varargs (func=0x7ffff6cf42f0, args=0x7ffff757be50, kwargs=0x0) at ../Objects/call.c:757
#14 0x000000000043712e in PyCFunction_Call (func=<optimized out>, args=<optimized out>, kwargs=<optimized out>) at ../Objects/call.c:772
#15 0x0000000000435001 in _PyObject_MakeTpCall (callable=callable at entry=0x7ffff6cf42f0, args=args at entry=0x1474b60, nargs=<optimized out>, keywords=keywords at entry=0x0)
    at ../Objects/call.c:159
#16 0x00000000004e8131 in _PyObject_Vectorcall (kwnames=0x0, nargsf=9223372036854775814, args=0x1474b60, callable=0x7ffff6cf42f0) at ../Include/cpython/abstract.h:125
#17 call_function (kwnames=0x0, oparg=<optimized out>, pp_stack=<synthetic pointer>, tstate=0x94e520) at ../Python/ceval.c:4987
------------------------------------------------------------------------------

This is with sip v5.1.1, Python v3.8.2rc2.

--
Dmitry Shachnev


More information about the PyQt mailing list