-
-
Notifications
You must be signed in to change notification settings - Fork 31.6k
truncate() changes current stream position #76409
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
See attached file. As documentation about "truncate" says, "The current stream position isn’t changed." This is true for most cases. But this is not true for "wtf1.py" example. If you run it with Linux (Tested Debian 8 and Arch; Windows was not tested by me) and Python 3.3+ (or with Python 2.7 using backported "io" module), then these lines: print('tell:', fp.tell())
print('truncate:', fp.truncate())
print('tell again:', fp.tell()) prints this: tell: 4098 As you can see, "tell" before truncate and "tell" after truncate are different. Looks like bug. This bug will not reproduce with Python 2.7 and builtin "open" function; it affects only "io.open". |
I've now pushed Nitish's fix to 3.7 and 3.6. I have no interest in backporting to 2.7 at this point. Closing! |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: