| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
| value = decltype(value)(ival); \ | ||
| Py_DECREF(tmp); \ | ||
| return !(ival == -1 && !PyErr_Occurred()); \ | ||
| return !(ival == -1 && PyErr_Occurred()); \ |
There was a problem hiding this comment.
Kinda think return (ival !=-1 || !PyErr_Occurred()); is more readable - is there a reason we can't do this?
Sorry, something went wrong.
…556-on-v3.10.x Backport PR #31556 on branch v3.10.x (FIX: Inverted PyErr_Occurred check in enum type caster (_enums.h))
| Back | FazBrowse Home | New Git URL |
PR summary
Fix an inverted error-check in the pybind11 enum type caster in src/_enums.h. PyLong_AsLong signals failure by returning -1 and setting a Python exception. The correct way to check for failure should be: return !(ival == -1 && PyErr_Occurred());
Part of #31424
this is my first PR here; I just wanted to get the flow down of contributing here before making any larger changes :)
AI Disclosure
I used Claude Code to help understand the codebase. The fix itself is a one-character change I applied.
PR checklist