Page MenuHome

New-file causes Python assert with negative reference count
Closed, ResolvedPublic

Description

When Blender is built against a debug Python library the following steps cause a negative reference count and asserts.

This can be redone with the following steps:

  • Run Blender with factory settings.
  • Press W once (to set the circle select tool).
  • Ctrl-N, Enter (to make a new file).

Blender exits with the following error.

source/blender/python/intern/bpy_rna_callback.c:267: _Py_NegativeRefcount: Assertion failed: object has negative ref count
Enable tracemalloc to get the memory block allocation traceback

object address  : 0x7fda4ad5dcc0
object refcount : -1
object type     : 0x55a5d0f754a0
object type name: tuple
object repr     : <refcnt -1 at 0x7fda4ad5dcc0>

Fatal Python error: _PyObject_AssertFailed: _PyObject_AssertFailed
Python runtime state: initialized

Current thread 0x00007fda712548c0 (most recent call first):
  File "/src/cmake_debug/bin/3.1/scripts/startup/bl_ui/space_toolsystem_common.py", line 1073 in _activate_by_item
  File "/src/cmake_debug/bin/3.1/scripts/startup/bl_ui/space_toolsystem_common.py", line 1091 in activate_by_id
  File "/src/cmake_debug/bin/3.1/scripts/startup/bl_operators/wm.py", line 2119 in execute

Extension modules: bpy.props, bpy.app.icons, bpy.app.timers, bpy.utils.units, bpy.types, mathutils.geometry, mathutils.interpolate, mathutils.noise, mathutils, idprop, gpu.capabilities, gpu.matrix, gpu.platform, gpu.select, gpu.shader, gpu.state, gpu.texture (total: 17)

Reporting this for reference.