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-89756: make SpooledTemporaryFile.truncate return new file size and improve documentation by rooterkyberian · Pull Request #29197 · python/cpython

Conversation

@rooterkyberian

@rooterkyberian rooterkyberian commented Oct 23, 2021 •
edited by serhiy-storchaka
Loading

Uh oh!

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

Copy link
Copy Markdown

https://bugs.python.org/issue45593

Currently SpooledTemporaryFile.truncate doesn't return anything.
This seems to be an old issue common for some SpooledTemporaryFile methods; most recently .seek(...) has been fixed in similar fashion.

https://bugs.python.org/issue45593

  • Issue: SpooledTemporaryFile.truncate returns None #89756

Sorry, something went wrong.

Uh oh!

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

All reactions
@bedevere-bot bedevere-bot added the awaiting review label Oct 23, 2021
@the-knights-who-say-ni the-knights-who-say-ni added the CLA signed label Oct 23, 2021
@rooterkyberian rooterkyberian changed the title pbo-45593: make SpooledTemporaryFile.truncate return new file size and improve documentation bpo-45593: make SpooledTemporaryFile.truncate return new file size and improve documentation Oct 23, 2021
@github-actions

github-actions Bot commented Nov 23, 2021

Copy link
Copy Markdown

This PR is stale because it has been open for 30 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 23, 2021
MaxwellDupre
MaxwellDupre approved these changes Mar 3, 2022
View reviewed changes

@MaxwellDupre MaxwellDupre left a comment

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.

Ran 99 tests in 1.041s

OK (skipped=2)

== Tests result: SUCCESS ==
Looks ok to me.

Sorry, something went wrong.

Uh oh!

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

All reactions
@bedevere-bot bedevere-bot added awaiting core review and removed awaiting review labels Mar 3, 2022
@ezio-melotti ezio-melotti removed the CLA signed label Jul 13, 2022
furkanonder
furkanonder approved these changes May 9, 2023
View reviewed changes
@furkanonder

furkanonder commented May 9, 2023

Copy link
Copy Markdown
Contributor

LGTM. @rooterkyberian Can you resolve the conflict?

rooterkyberian 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.

@rooterkyberian
rooterkyberian force-pushed the pbo-45593 branch from 7f8e5b5 to 233eda9 Compare May 13, 2023 21:10
@rooterkyberian

rooterkyberian commented May 13, 2023

Copy link
Copy Markdown
Author

@furkanonder done - rebased to current main and resolved conflicts

furkanonder 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.

@rooterkyberian
pbo-45593: make SpooledTemporaryFile.truncate return new file size
717a927
@rooterkyberian
rooterkyberian force-pushed the pbo-45593 branch from 233eda9 to 717a927 Compare May 28, 2023 18:56
@rooterkyberian
Merge branch 'main' into pbo-45593
5ebc370
@rooterkyberian rooterkyberian mannequin mentioned this pull request Aug 1, 2023
SpooledTemporaryFile.truncate returns None #89756
Closed
methane
methane reviewed Aug 9, 2023
View reviewed changes
Comment thread Doc/library/tempfile.rst Resolved

Uh oh!

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

@rooterkyberian @methane
fix versionchanged in Doc/library/tempfile.rst
fa3b08f
Co-authored-by: Inada Naoki <[email protected]>
methane
methane reviewed Aug 10, 2023
View reviewed changes
Comment thread Doc/library/tempfile.rst
>>> fp.write(b'Hello world!')
# read data from file
>>> fp.seek(0)
0

@methane methane Aug 10, 2023

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.

If we add 0 here, we should add 12 after fp.write(b'Hello world!') too.

Sorry, something went wrong.

Uh oh!

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

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

@methane methane Aug 10, 2023

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.

And later,

    >>> with tempfile.TemporaryFile() as fp:
    ...     fp.write(b'Hello world!')
    ...     fp.seek(0)
    ...     fp.read()
    b'Hello world!'

This output should be:

12
0
b'Hello world!'

Sorry, something went wrong.

Uh oh!

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

rooterkyberian reacted with thumbs down emoji
All reactions
  • 👎 1 reaction

@methane methane Aug 10, 2023

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.

It seems this file is not tested by doctest.

Please leave it. Otherwise, we need to fix all output and remove all comments in sample code.

Sorry, something went wrong.

Uh oh!

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

All reactions
@github-actions github-actions Bot removed the stale Stale PR or inactive for long period of time. label Apr 10, 2026
@github-actions

github-actions Bot commented May 11, 2026

Copy link
Copy Markdown

This PR is stale because it has been open for 30 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 May 11, 2026
@methane
Merge branch 'main' into pbo-45593
a1455f6
@read-the-docs-community

read-the-docs-community Bot commented May 11, 2026 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown

Documentation build overview

📚 cpython-previews | 🛠️ Build #32633580 | 📁 Comparing 1c40e9f against main (f23a183)

  🔍 Preview build  

3 files changed
± c-api/slots.html
± library/tempfile.html
± whatsnew/changelog.html
All reactions

Sorry, something went wrong.

Uh oh!

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

@rooterkyberian
fix SpooledTemporaryFile docs
1c40e9f
@github-actions github-actions Bot removed the stale Stale PR or inactive for long period of time. label May 20, 2026
@serhiy-storchaka serhiy-storchaka changed the title bpo-45593: make SpooledTemporaryFile.truncate return new file size and improve documentation gh-89756: make SpooledTemporaryFile.truncate return new file size and improve documentation Aug 12, 2026
@methane

methane commented Sep 2, 2026

Copy link
Copy Markdown
Member

fixed in #29560

All reactions

Sorry, something went wrong.

Uh oh!

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

@methane methane closed this Sep 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@methane methane methane left review comments
@furkanonder furkanonder furkanonder approved these changes
+1 more reviewer
@MaxwellDupre MaxwellDupre MaxwellDupre approved these changes
Reviewers whose approvals may not affect merge requirements

Uh oh!

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

Assignees

No one assigned

Labels

awaiting core review

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.

7 participants

@rooterkyberian @furkanonder @methane @MaxwellDupre @the-knights-who-say-ni @ezio-melotti @bedevere-bot
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.