Skip to content

gh-150406: check result of PyThread_allocate_lock for netdb_lock#150407

Open
KowalskiThomas wants to merge 3 commits into
python:mainfrom
KowalskiThomas:kowalski/fix-check-result-of-pythread_allocate_lock-for-netdb_lock
Open

gh-150406: check result of PyThread_allocate_lock for netdb_lock#150407
KowalskiThomas wants to merge 3 commits into
python:mainfrom
KowalskiThomas:kowalski/fix-check-result-of-pythread_allocate_lock-for-netdb_lock

Conversation

@KowalskiThomas
Copy link
Copy Markdown
Contributor

@KowalskiThomas KowalskiThomas commented May 25, 2026

@KowalskiThomas KowalskiThomas marked this pull request as ready for review May 25, 2026 19:55
Comment on lines +1 to +3
Fix crash in :mod:`socket` module initialization when :func:`PyThread_allocate_lock`
fails to allocate ``netdb_lock``: the ``NULL`` return value is now checked and a
:exc:`MemoryError` is raised instead of dereferencing a null pointer. Patch by
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should remove the mention to netdb_lock, it's an implementation detail. Just mention that a possible crash when importing socket is fixed.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for taking a look; I fixed it. 🙇

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

socket is missing a null pointer check on PyThread_allocate_lock return value

2 participants