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
tempfile crashes #37324
Comments
tempfile.NamedTemporaryFile(".zip") crashes with an |
Logged In: YES Note: You probably want: I tried this under Linux and get: OSError: [Errno 22] So this appears to be windows specific. Exactly which line |
Logged In: YES It crashes in fdopen - looks like a bug in MS runtime library: (in file vc98\crt\src\fdopen.c) |
Logged In: YES We don't check anywhere else for valid mode chars. We would |
Logged In: YES IMO we should check for a valid mode. There is a large |
Logged In: YES Sounds good to me. Care to work on a patch with tests? |
Logged In: YES We generally don't check for valid mode characters It would be OK by me if we insisted that the first character >>> f = open('example.txt', 'what a crock this mode string
is!')
>>> f
<open file 'example.txt', mode 'what a crock this mode
string is!' at 0x00651870
>
>>> That was the same as passing "w". |
Logged In: YES Here's a patch for Modules/posixmodule.c, which fixes this |
Logged In: YES Cool! One thing: drop the Windows #ifdef. I asked Guido, |
Logged In: YES Great, will do this tomorrow. What about socketmodule.c, |
Logged In: YES If socketmodule isn't crashing, I'd leave it alone. |
Logged In: YES Thomas, I belivee the code below will check if the other # test posixmodule.popen(),
# would need check around line 2835
# as first code in popen()
import posix
# you may need a command that works,
# I'm guessing cmd.exe is ok
posix.popen('cmd.exe', '.zip')
# test socketmodule.sock_makefile(),
# would need check around line 1572
# after PyArg_ParseTuple
from socket import *
s = socket(AF_INET, SOCK_STREAM)
s.makefile('.zip') |
Logged In: YES I couldn't get it to crash with Neil's code, so I checked it in BTW: I always assume we don't need NEWS entries for bug |
Logged In: YES Thanks! You certainly need a NEWS item for this, and |
Logged In: YES Sigh, even more work. |
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: