Skip to content

Do not perform type check on NULL pointer - #1439

Merged
mkleehammer merged 1 commit into
mkleehammer:masterfrom
shramov:master
Oct 17, 2025
Merged

mkleehammer merged 1 commit into
mkleehammer:masterfrom
shramov:master

Conversation

@shramov

@shramov shramov commented Aug 29, 2025

Copy link
Copy Markdown
Contributor

When NDEBUG is not defined PyUnicode_Check was called on argument that can be NULL.

Fixes #1438

When NDEBUG is not defined PyUnicode_Check was called on argument
that can be NULL.

Fixes mkleehammer#1438
@shramov

shramov commented Aug 29, 2025

Copy link
Copy Markdown
Contributor Author

Root of the problem is that there are some assertions in the code but it is always built with -DNDEBUG

Default compiler flags are obtained from sysconfig module, for example for ubuntu20.04:

$ python3 --version
Python 3.8.10
$ python3 -c 'import sysconfig; print(sysconfig.get_config_var("CFLAGS"))'
-Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g   -fstack-protector-strong -Wformat -Werror=format-security  -g -fwrapv -O2

And for Debian:

$ python3 --version
Python 3.13.7
$ python3 -c 'import sysconfig; print(sysconfig.get_config_var("CFLAGS"))'
-fno-strict-overflow -Wsign-compare -DNDEBUG -g -O2 -Wall

I can provide patch for CI that enables assertion for test builds

@mkleehammer

Copy link
Copy Markdown
Owner

Thanks for finding and fixing this!

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.

[Debian 13] Segmentation fault on attempt to obtain a connection

2 participants