From 5767da3b493025b4f64750519126359cdf93999b Mon Sep 17 00:00:00 2001 From: Jeroen Bakker Date: Thu, 21 Aug 2025 11:52:24 +0200 Subject: [PATCH] Fix #144758: Python: Inversed unicode comparison in GPUFramebuffer Regression introduced by d9f38fca5ffe29136cd6f390e318ad8455864582 Pull Request: https://projects.blender.org/blender/blender/pulls/144908 --- source/blender/python/generic/py_capi_utils.cc | 1 - source/blender/python/gpu/gpu_py_framebuffer.cc | 6 +++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/source/blender/python/generic/py_capi_utils.cc b/source/blender/python/generic/py_capi_utils.cc index cfa6a6369de..29b0dff2511 100644 --- a/source/blender/python/generic/py_capi_utils.cc +++ b/source/blender/python/generic/py_capi_utils.cc @@ -33,7 +33,6 @@ #if PY_VERSION_HEX < 0x030d0000 /* <3.13 */ # define PyLong_AsInt _PyLong_AsInt -# define PyUnicode_CompareWithASCIIString _PyUnicode_EqualToASCIIString #endif /* -------------------------------------------------------------------- */ diff --git a/source/blender/python/gpu/gpu_py_framebuffer.cc b/source/blender/python/gpu/gpu_py_framebuffer.cc index aa08d0b6bb5..106ace3ff87 100644 --- a/source/blender/python/gpu/gpu_py_framebuffer.cc +++ b/source/blender/python/gpu/gpu_py_framebuffer.cc @@ -295,14 +295,14 @@ static bool pygpu_framebuffer_new_parse_arg(PyObject *o, GPUAttachment *r_attach return false; } - if (c_texture && PyUnicode_CompareWithASCIIString(key, c_texture)) { + if (c_texture && PyUnicode_CompareWithASCIIString(key, c_texture) == 0) { /* Compare only once. */ c_texture = nullptr; if (!bpygpu_ParseTexture(value, &tmp_attach.tex)) { return false; } } - else if (c_layer && PyUnicode_CompareWithASCIIString(key, c_layer)) { + else if (c_layer && PyUnicode_CompareWithASCIIString(key, c_layer) == 0) { /* Compare only once. */ c_layer = nullptr; tmp_attach.layer = PyLong_AsLong(value); @@ -310,7 +310,7 @@ static bool pygpu_framebuffer_new_parse_arg(PyObject *o, GPUAttachment *r_attach return false; } } - else if (c_mip && PyUnicode_CompareWithASCIIString(key, c_mip)) { + else if (c_mip && PyUnicode_CompareWithASCIIString(key, c_mip) == 0) { /* Compare only once. */ c_mip = nullptr; tmp_attach.mip = PyLong_AsLong(value);