hoffstadt / hoffstadt/DearPyGui

Debug build only: C functions that raise Python exceptions must return nullptr

Open
#2,097 1 comment 0 reactions 0 assignees View on GitHub
state: pending type: bug
Dominant language
C++
Stars
15.6k
Forks
783
PR merge metrics
No merged PRs in 30d

Description

## Version of Dear PyGui

Version: 1.8.0 (a debug version built myself)
Operating System: Windows 10

## My Issue/Question

When I was debugging DPG (a debug build, of course), I noticed that sometimes Python hits the same debug assertion in various DPG calls. The following causes it to happen:

- a C function in DPG calls `mvThrowPythonError` or PyErr_SetStringand, effectively raising a Python exception,
- that function then returns `Py_None` (typically via `GetPyNone()`).

Upon returning from a C function, Python expects to get **either** an exception **or** a `PyObject*`, but not both. A function that raised an exception must return `NULL`.

This issue does not occur in the release version but might substantially hinder the use of the debug build if DPG throws exceptions for some reason (e.g. a missing UUID).

## To Reproduce

_TBD. I still need to create a minimal example._

## Expected behavior

No debug assertions in such cases.

## Screenshots/Video

_TBD_

## Standalone, minimal, complete and verifiable example

_TBD_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.