Skip to content

Remove conditionally-compiled debug C code - #9915

Open
akx wants to merge 6 commits into
python-pillow:mainfrom
akx:ndebug
Open

Remove conditionally-compiled debug C code#9915
akx wants to merge 6 commits into
python-pillow:mainfrom
akx:ndebug

Conversation

@akx

@akx akx commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

I was looking at Mode.c and noticed 0567f06 had gotten the semantics of NDEBUG wrong; NDEBUG is true when not debugging, so these checks were running all the time in release builds. That said, those checks weren't really necessary anyway; we can see that all of the constant ModeData in that file has a non-NULL mode string. It's not worth testing at runtime.

Following that, I took a look at other #ifdef'd code to get rid of other debug-like code that was never compiled in... and on top of that, there's a fun commit that removes an exit(1); from an unlikely error branch of Quant.c. I suppose Quant.c was ported from some application code in 1998 and no one noticed all of the exit()s.

@akx
akx marked this pull request as ready for review August 27, 2026 13:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant