GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — gh-115159: Add SOCK_RAW regression tests by Taeknology · Pull Request #154939 · python/cpython

Conversation

@Taeknology

@Taeknology Taeknology commented Jul 30, 2026 •
edited by bedevere-app Bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Closes #115159.

Add an explicit netraw test resource for tests that create raw sockets. The resource is excluded from --use=all so potentially privileged operations remain opt-in.

test_socket now covers raw-socket creation when netraw is enabled. The asyncio tests always cover raw datagram endpoints, using a datagram-backed FakeRawSocket when the resource is disabled.

Tests: test_regrtest, test_socket, and test_asyncio.

  • Issue: Missing regression tests for SOCK_RAW support in standard library #115159

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@Taeknology
pythongh-115159: Add SOCK_RAW regression tests
bb84fc7
Signed-off-by: Taeknology <[email protected]>
@bedevere-app bedevere-app Bot mentioned this pull request Jul 30, 2026
Missing regression tests for SOCK_RAW support in standard library #115159
Open
@Taeknology
Taeknology marked this pull request as ready for review July 30, 2026 21:45
@Taeknology
Taeknology requested review from 1st1, asvetlov, kumaraditya303 and willingc as code owners July 30, 2026 21:45
@bedevere-app bedevere-app Bot added the awaiting review label Jul 30, 2026
@Taeknology
pythongh-115159: Add Tests NEWS entry
89c6fd9
@github-actions

github-actions Bot commented Nov 6, 2026

Copy link
Copy Markdown

This PR is stale because it has been open for 90 days with no activity.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@github-actions github-actions Bot added the stale Stale PR or inactive for long period of time. label Nov 6, 2026
@Taeknology

Taeknology commented Nov 8, 2026

Copy link
Copy Markdown
Contributor Author

Following up after the inactivity reminder: I rechecked this against gh-115159 and the original regression/fix in gh-114887 / gh-114893. The implementation follows the combined approach described on the issue: explicitly opt-in netraw, plus unprivileged FakeRawSocket coverage for asyncio.

Revalidated commit 89c6fd977f82861fdf28cc13781a6b8e23ae0188 with a freshly rebuilt debug interpreter on Linux (WSL2):

  • Without netraw, the real socket creation test skips as intended; the asyncio fallback passes on epoll, poll, and select (3 cases).
  • With explicit -u netraw, real raw socket creation and all three asyncio loop cases pass (4 cases). These ran as UID 1000 in a temporary network namespace with only loopback and CAP_NET_RAW; no persistent permission changes were needed.
  • Both fallback and real-raw targeted tests also pass -R 3:3 --fail-env-changed checks.
  • The resource argument parsing test passes. A targeted -u all run also confirms that real raw socket creation still skips while all three fallback cases pass.
  • As a negative control, temporarily restoring the pre-fix sock.type != SOCK_DGRAM check in memory makes all three fallback cases fail with the expected ValueError. The checked-out source was not modified for this check.

Targeted reproduction commands (run the explicit netraw command only in an environment allowed to create raw sockets):

./python -I -m test test_asyncio.test_events -m '*test_create_datagram_endpoint_sock_raw*' --fail-env-changed
./python -I -m test -u netraw test_socket -m '*test_create_raw_socket*' --fail-env-changed
./python -I -m test -u netraw test_asyncio.test_events -m '*test_create_datagram_endpoint_sock_raw*' --fail-env-changed

Full validation: ./python -I -m test -j4 test_regrtest test_socket test_asyncio succeeds (3,694 tests, 94 skipped; 35 test files OK, 2 Windows-only files skipped).

@ncoghlan, if you have time, could you review whether this is a suitable implementation of the combined approach you proposed? This keeps privileged raw-socket coverage opt-in; configuring CI/buildbots to opt in remains outside this PR. I have not locally validated the actual raw path on Windows or macOS.

This follow-up investigation and validation were prepared with AI assistance. No code changes were made in this follow-up.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@github-actions github-actions Bot removed the stale Stale PR or inactive for long period of time. label Nov 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@1st1 1st1 Awaiting requested review from 1st1 1st1 is a code owner
@asvetlov asvetlov Awaiting requested review from asvetlov asvetlov is a code owner
@kumaraditya303 kumaraditya303 Awaiting requested review from kumaraditya303 kumaraditya303 is a code owner
@willingc willingc Awaiting requested review from willingc willingc is a code owner

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

awaiting review

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Missing regression tests for SOCK_RAW support in standard library

Uh oh!

There was an error while loading. Please reload this page.

1 participant

@Taeknology
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.