This issue tracker has been migrated to GitHub ,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
Created on 2012年09月10日 14:16 by sbt, last changed 2022年04月11日 14:57 by admin. This issue is now closed.
| Messages (4) | |||
|---|---|---|---|
| msg170188 - (view) | Author: Richard Oudkerk (sbt) * (Python committer) | Date: 2012年09月10日 14:16 | |
With Python 2.7 on Windows the following crashes with an assertion:
>>> import os
[43042 refs]
>>> f = open("foobar", "wb")
[43048 refs]
>>> os.close(f.fileno())
[43048 refs]
>>> f.close()
<Failed assertion>
A box pops up with
Program: C:\Repos\cpython-27\PCbuild\python_d.exe
File: f:\dd\vctools\crt_bld\self_x86\crt\src\close.c
Line: 48
Expression: (_osfile(fh) & FOPEN)
Python 3.2 and 3.3 give IOError(EBADF, ...) as expected.
Compare #15261 and #15263.
|
|||
| msg170192 - (view) | Author: Amaury Forgeot d'Arc (amaury.forgeotdarc) * (Python committer) | Date: 2012年09月10日 14:44 | |
Is it also the case for other file operations? Here is a list that may use a closed FILE object:
f.write('something')
f.read(1)
print >>f, 'something'
f.seek(0)
f.tell()
f.truncate(0)
f.flush()
f.isatty()
f.readlines()
f.writelines(['x'])
list(f)
|
|||
| msg170195 - (view) | Author: Richard Oudkerk (sbt) * (Python committer) | Date: 2012年09月10日 14:57 | |
If buffering is off then they all fail the assertion except isatty(). |
|||
| msg366616 - (view) | Author: Zackery Spytz (ZackerySpytz) * (Python triager) | Date: 2020年04月16日 18:05 | |
Python 2 is EOL. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:57:35 | admin | set | github: 60108 |
| 2020年04月16日 20:29:14 | benjamin.peterson | set | status: open -> closed resolution: wont fix stage: needs patch -> resolved |
| 2020年04月16日 18:05:30 | ZackerySpytz | set | nosy:
+ ZackerySpytz messages: + msg366616 |
| 2012年09月10日 14:57:23 | sbt | set | messages: + msg170195 |
| 2012年09月10日 14:44:07 | amaury.forgeotdarc | set | nosy:
+ amaury.forgeotdarc messages: + msg170192 |
| 2012年09月10日 14:16:38 | sbt | create | |