Skip to content

BUG: implement flush() and isatty() on _DummyFile - #19594

Merged
astrofrog merged 2 commits into
astropy:mainfrom
astrofrog:fix-dummyfile-isatty
Apr 24, 2026
Merged

astrofrog merged 2 commits into
astropy:mainfrom
astrofrog:fix-dummyfile-isatty

Conversation

@astrofrog

Copy link
Copy Markdown
Member

IPython now expects isatty() on sys.stdout – hopefully this should fix the RTD build

The dummy stream object used by astropy.utils.misc.silence() to replace
sys.stdout and sys.stderr only implemented write(). Libraries that probe
the stream at import time (IPython 9.13's IPython.core.kitty calls
sys.stdout.isatty() at module import) therefore raised AttributeError
when imported under silence() -- which is the case during
astropy.config.generate_config, triggering Sphinx build failures on RTD.

Make _DummyFile satisfy more of the file protocol so it is a safe drop-in
for real streams. The changelog fragment uses a placeholder name; rename
to the PR number before merge.
@github-actions github-actions Bot added the utils label Apr 24, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Thank you for your contribution to Astropy! 🌌 This checklist is meant to remind the package maintainers who will review this pull request of some common things to look for.

  • Do the proposed changes actually accomplish desired goals?
  • Do the proposed changes follow the Astropy coding guidelines?
  • Are tests added/updated as required? If so, do they follow the Astropy testing guidelines?
  • Are docs added/updated as required? If so, do they follow the Astropy documentation guidelines?
  • Is rebase and/or squash necessary? If so, please provide the author with appropriate instructions. Also see instructions for rebase and squash.
  • Did the CI pass? If no, are the failures related? If you need to run daily and weekly cron jobs as part of the PR, please apply the "Extra CI" label. Codestyle issues can be fixed by the bot.
  • Is a change log needed? If yes, did the change log check pass? If no, add the "no-changelog-entry-needed" label. If this is a manual backport, use the "skip-changelog-checks" label unless special changelog handling is necessary.
  • Is this a big PR that makes a "What's new?" entry worthwhile and if so, is (1) a "what's new" entry included in this PR and (2) the "whatsnew-needed" label applied?
  • At the time of adding the milestone, if the milestone set requires a backport to release branch(es), apply the appropriate "backport-X.Y.x" label(s) before merge.

@astrofrog astrofrog added this to the v7.2.1 milestone Apr 24, 2026
@astrofrog astrofrog added Bug backport-v7.2.x on-merge: backport to v7.2.x 🔥 Critical labels Apr 24, 2026
@astrofrog
astrofrog marked this pull request as ready for review April 24, 2026 22:29
@astrofrog

Copy link
Copy Markdown
Member Author

In order to get RTD building again, I am going to merge this

@astrofrog
astrofrog merged commit e07193b into astropy:main Apr 24, 2026
59 of 63 checks passed
astrofrog added a commit that referenced this pull request Apr 24, 2026
…594-on-v7.2.x

Backport PR #19594 on branch v7.2.x (BUG: implement flush() and isatty() on _DummyFile)
@pllim

pllim commented Apr 27, 2026

Copy link
Copy Markdown
Member

Thanks for handling this!

Belatedly... could the original problem be related to #18153 ?

@astrofrog

Copy link
Copy Markdown
Member Author

I’m not sure, it looks similar but the issue here would have happened anyway even without that other PR

@pllim

pllim commented May 5, 2026

Copy link
Copy Markdown
Member

Upstream patch is merged. Do we have to follow-up here?

@astrofrog

Copy link
Copy Markdown
Member Author

No I think we can just keep as is here

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

Labels

backport-v7.2.x on-merge: backport to v7.2.x Bug 🔥 Critical utils

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants