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 — bpo-46364: Use sockets only for stdin of asyncio on AIX by xopham · Pull Request #30596 · python/cpython

Conversation

@xopham

@xopham xopham commented Jan 14, 2022 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown
Contributor

The use of sockets for stdin of asyncio is restricted to AIX platform only to support reading from /dev/stdin using ascynio.create_subprocess_exec and asycio.create_subprocess_shell.

https://bugs.python.org/issue46364

Sorry, something went wrong.

Uh oh!

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

masteinhauser and tifv reacted with thumbs up emoji
All reactions
  • 👍 2 reactions
@the-knights-who-say-ni the-knights-who-say-ni added the CLA not signed label Jan 14, 2022
@the-knights-who-say-ni

the-knights-who-say-ni commented Jan 14, 2022

Copy link
Copy Markdown

Hello, and thanks for your contribution!

I'm a bot set up to make sure that the project can legally accept this contribution by verifying everyone involved has signed the PSF contributor agreement (CLA).

CLA Missing

Our records indicate the following people have not signed the CLA:

@xopham

For legal reasons we need all the people listed to sign the CLA before we can look at your contribution. Please follow the steps outlined in the CPython devguide to rectify this issue.

If you have recently signed the CLA, please wait at least one business day
before our records are updated.

You can check yourself to see if the CLA has been received.

Thanks again for the contribution, we look forward to reviewing it!

All reactions

Sorry, something went wrong.

Uh oh!

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

@bedevere-bot bedevere-bot added the awaiting review label Jan 14, 2022
@xopham

xopham commented Jan 14, 2022

Copy link
Copy Markdown
Contributor Author

@asvetlov I am uncertain how to test this. Would you be able to point me in the right direction (code and test idea)?

All reactions

Sorry, something went wrong.

Uh oh!

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

@xopham
xopham force-pushed the fix-issue-46364 branch 2 times, most recently from ca4e918 to 3afa104 Compare January 14, 2022 13:00
@xopham
xopham marked this pull request as ready for review January 14, 2022 14:45
@xopham
xopham requested review from 1st1 and asvetlov as code owners January 14, 2022 14:45
@the-knights-who-say-ni the-knights-who-say-ni added CLA signed and removed CLA not signed labels Jan 15, 2022
@asvetlov

asvetlov commented Feb 2, 2022

Copy link
Copy Markdown
Contributor

It could be an async subprocess that reads 16 bytes of data from stdin and writes them back to stdout.
Use /dev/zero to don't interact with the real terminal in tests.
Check the returned data, should be 16 zeroes.
Skip the test on AIX.

The test may use unittest.IsolatedAsyncioTestCase and asyncio.create_subprocess_exec, streaming API is easier to use than protocol-based.
An example of IsolatedAsyncioTestCase is here: https://github.com/python/cpython/blob/main/Lib/test/test_asyncio/test_locks.py
tearDownModule is crucial for CPython self-test runner.

All reactions

Sorry, something went wrong.

Uh oh!

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

@xopham xopham mannequin mentioned this pull request Apr 10, 2022
asyncio subprocess cannot read from /dev/stdin #90522
Closed
@ezio-melotti ezio-melotti removed the CLA signed label Jul 13, 2022
@tifv

tifv commented Jul 18, 2022

Copy link
Copy Markdown
Contributor

I have written some kind of test: tifv@6477c7e
On my Linux system it fails; until you add the changes in this pull request and then it succeeds.

Notes

  1. I have conditioned the test to run on Linux only because I have little idea of what platforms are supposed to have /dev/stdin.
  2. I didn't understand @asvetlov's suggestions about /dev/zero. Some existing tests in test_subprocess.py looked like a perfect fit instead, so I have copied and edited one of them.
All reactions

Sorry, something went wrong.

Uh oh!

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

@xopham

xopham commented Jul 29, 2022

Copy link
Copy Markdown
Contributor Author

@tifv I also tried around with the /dev/zero idea, but that does not create the reported error when reading from /dev/stdin does. Thanks for sharing the tests here 🙏 they seem good to me. Would be happy to join this and move forward. Has been at the back of my head for long enough 😉
@asvetlov can we merge the two separately or will they have to become one pull request? Happy for any input.

All reactions

Sorry, something went wrong.

Uh oh!

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

@xopham

xopham commented Aug 12, 2022

Copy link
Copy Markdown
Contributor Author

@tifv I have cherry-picked your commit.

@asvetlov I think this PR is complete and ready for review/merging.

tifv reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

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

@xopham

xopham commented Aug 12, 2022

Copy link
Copy Markdown
Contributor Author

@1st1 any feedback on this?

All reactions

Sorry, something went wrong.

Uh oh!

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

@kumaraditya303 kumaraditya303 added topic-asyncio needs backport to 3.10 needs backport to 3.11 only security fixes labels Oct 13, 2022
kumaraditya303
kumaraditya303 approved these changes Oct 13, 2022
View reviewed changes

@kumaraditya303 kumaraditya303 left a comment •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

LGTM I'll schedule a buildbot run after you have fixed the news entry.

Sorry, something went wrong.

Uh oh!

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

All reactions
Comment thread Misc/NEWS.d/next/Library/2022-01-14-10-49-20.bpo-46364.SzhlU9.rst Resolved

Uh oh!

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

@bedevere-bot bedevere-bot added awaiting core review and removed awaiting review labels Oct 13, 2022
@kumaraditya303 kumaraditya303 added the type-bug An unexpected behavior, bug, or error label Oct 13, 2022
xopham and others added 2 commits October 13, 2022 13:35
@xopham
bpo-46364: only use socket for stdin on AIX
a0a38c1
Signed-off-by: Christoph Hamsen <[email protected]>
@tifv @xopham
pythongh-90522: add test
0ac3aed
Subprocess opening /dev/stdin fails if it is a socketpair.
@xopham
xopham force-pushed the fix-issue-46364 branch from ef62e67 to 0ac3aed Compare October 13, 2022 11:35
@xopham
xopham requested a review from gvanrossum as a code owner October 13, 2022 11:35
@xopham

xopham commented Oct 13, 2022

Copy link
Copy Markdown
Contributor Author

@kumaraditya303 fixed the news entry as requested. Let me know if anything else is needed.

All reactions

Sorry, something went wrong.

Uh oh!

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

@kumaraditya303 kumaraditya303 added the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Oct 13, 2022
@bedevere-bot

bedevere-bot commented Oct 13, 2022

Copy link
Copy Markdown

🤖 New build scheduled with the buildbot fleet by @kumaraditya303 for commit 0ac3aed 🤖

If you want to schedule another build, you need to add the ":hammer: test-with-buildbots" label again.

All reactions

Sorry, something went wrong.

Uh oh!

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

@bedevere-bot bedevere-bot removed the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Oct 13, 2022
gvanrossum
gvanrossum approved these changes Oct 13, 2022
View reviewed changes

@gvanrossum gvanrossum left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Seems okay.

Sorry, something went wrong.

Uh oh!

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

xopham reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
@bedevere-bot bedevere-bot added awaiting merge and removed awaiting core review labels Oct 13, 2022
@gvanrossum
gvanrossum merged commit c9ed032 into python:main Oct 13, 2022
@miss-islington

miss-islington commented Oct 13, 2022

Copy link
Copy Markdown
Contributor

Thanks @xopham for the PR, and @gvanrossum for merging it 🌮🎉.. I'm working now to backport this PR to: 3.10, 3.11.
🐍🍒⛏🤖

xopham reacted with heart emoji
All reactions
  • ❤️ 1 reaction

Sorry, something went wrong.

Uh oh!

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

@bedevere-bot bedevere-bot removed the awaiting merge label Oct 13, 2022
@bedevere-bot

bedevere-bot commented Oct 13, 2022

Copy link
Copy Markdown

GH-98243 is a backport of this pull request to the 3.11 branch.

All reactions

Sorry, something went wrong.

Uh oh!

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

@bedevere-bot bedevere-bot removed the needs backport to 3.11 only security fixes label Oct 13, 2022
@bedevere-bot

bedevere-bot commented Oct 13, 2022

Copy link
Copy Markdown

GH-98244 is a backport of this pull request to the 3.10 branch.

All reactions

Sorry, something went wrong.

Uh oh!

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

@bedevere-bot bedevere-bot removed the needs backport to 3.10 label Oct 13, 2022
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Oct 13, 2022
@xopham @miss-islington
bpo-46364: Use sockets for stdin of asyncio only on AIX (pythonGH-30596)
c482e9a
Signed-off-by: Christoph Hamsen <[email protected]>
Co-authored-by: July Tikhonov <[email protected]>
(cherry picked from commit c9ed032)

Co-authored-by: Christoph Hamsen <[email protected]>
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Oct 13, 2022
@xopham @miss-islington
bpo-46364: Use sockets for stdin of asyncio only on AIX (pythonGH-30596)
1b9eb4d
Signed-off-by: Christoph Hamsen <[email protected]>
Co-authored-by: July Tikhonov <[email protected]>
(cherry picked from commit c9ed032)

Co-authored-by: Christoph Hamsen <[email protected]>
miss-islington added a commit that referenced this pull request Oct 13, 2022
@miss-islington @xopham
bpo-46364: Use sockets for stdin of asyncio only on AIX (GH-30596)
fa9f65e
Signed-off-by: Christoph Hamsen <[email protected]>
Co-authored-by: July Tikhonov <[email protected]>
(cherry picked from commit c9ed032)

Co-authored-by: Christoph Hamsen <[email protected]>
miss-islington added a commit that referenced this pull request Oct 13, 2022
@miss-islington @xopham
bpo-46364: Use sockets for stdin of asyncio only on AIX (GH-30596)
595ef03
Signed-off-by: Christoph Hamsen <[email protected]>
Co-authored-by: July Tikhonov <[email protected]>
(cherry picked from commit c9ed032)

Co-authored-by: Christoph Hamsen <[email protected]>
carljm added a commit to carljm/cpython that referenced this pull request Oct 14, 2022
@carljm
Merge branch 'main' into typewatch
6e53514
* main: (38 commits)
  pythongh-98251: Allow venv to pass along PYTHON* variables to pip and ensurepip when they do not impact path resolution (pythonGH-98259)
  Bpo-41246: IOCP Proactor avoid callback code duplication (python#21399)
  bpo-46364: Use sockets for stdin of asyncio only on AIX (python#30596)
  pythongh-98178: syslog() is not thread-safe on macOS (python#98213)
  Mark all targets in `Doc/Makefile` as `PHONY` (pythonGH-98189)
  pythongh-97982: Factorize PyUnicode_Count() and unicode_count() code (python#98025)
  pythongh-96265: Formatting changes for faq/general (python#98129)
  tutorial: remove "with single quotes" (python#98204)
  pythongh-97669: Remove Tools/scripts/startuptime.py (python#98214)
  signalmodule.c uses _PyErr_WriteUnraisableMsg() (python#98217)
  pythongh-97669: Fix test_tools reference leak (python#98216)
  pythongh-97669: Create Tools/patchcheck/ directory (python#98186)
  pythongh-65046: Link to logging cookbook from asyncio docs (python#98207)
  Formatting fixes in contextlib docs (python#98111)
  pythongh-95276: Add callable entry to the glossary (python#95738)
  pythongh-96130: Rephrase use of "typecheck" verb for clarity (python#98144)
  Fix some incorrect indentation around the main switch (python#98177)
  pythongh-98172: Fix formatting in `except*` docs (python#98173)
  pythongh-97982: Remove asciilib_count() (python#98164)
  pythongh-95756: Free and NULL-out code caches when needed (pythonGH-98181)
  ...
carljm added a commit to carljm/cpython that referenced this pull request Oct 14, 2022
@carljm
Merge branch 'main' into cached_property
0bb0c69
* main: (37 commits)
  pythongh-98251: Allow venv to pass along PYTHON* variables to pip and ensurepip when they do not impact path resolution (pythonGH-98259)
  Bpo-41246: IOCP Proactor avoid callback code duplication (python#21399)
  bpo-46364: Use sockets for stdin of asyncio only on AIX (python#30596)
  pythongh-98178: syslog() is not thread-safe on macOS (python#98213)
  Mark all targets in `Doc/Makefile` as `PHONY` (pythonGH-98189)
  pythongh-97982: Factorize PyUnicode_Count() and unicode_count() code (python#98025)
  pythongh-96265: Formatting changes for faq/general (python#98129)
  tutorial: remove "with single quotes" (python#98204)
  pythongh-97669: Remove Tools/scripts/startuptime.py (python#98214)
  signalmodule.c uses _PyErr_WriteUnraisableMsg() (python#98217)
  pythongh-97669: Fix test_tools reference leak (python#98216)
  pythongh-97669: Create Tools/patchcheck/ directory (python#98186)
  pythongh-65046: Link to logging cookbook from asyncio docs (python#98207)
  Formatting fixes in contextlib docs (python#98111)
  pythongh-95276: Add callable entry to the glossary (python#95738)
  pythongh-96130: Rephrase use of "typecheck" verb for clarity (python#98144)
  Fix some incorrect indentation around the main switch (python#98177)
  pythongh-98172: Fix formatting in `except*` docs (python#98173)
  pythongh-97982: Remove asciilib_count() (python#98164)
  pythongh-95756: Free and NULL-out code caches when needed (pythonGH-98181)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@gvanrossum gvanrossum gvanrossum approved these changes
@kumaraditya303 kumaraditya303 kumaraditya303 approved these changes
@1st1 1st1 Awaiting requested review from 1st1 1st1 is a code owner
@asvetlov asvetlov Awaiting requested review from asvetlov asvetlov is a code owner

Uh oh!

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

Assignees

No one assigned

Labels

topic-asyncio type-bug An unexpected behavior, bug, or error

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

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

9 participants

@xopham @the-knights-who-say-ni @asvetlov @tifv @bedevere-bot @miss-islington @gvanrossum @kumaraditya303 @ezio-melotti
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.