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 2009年01月27日 03:02 by pooryorick, last changed 2022年04月11日 14:56 by admin. This issue is now closed.
| Messages (3) | |||
|---|---|---|---|
| msg80611 - (view) | Author: Poor Yorick (pooryorick) * | Date: 2009年01月27日 03:02 | |
the following script causes python3 to crash on my Windows XP Pro Machine:
import ctypes
b = ctypes.windll.Kernel32
var1 = 'TEMP'
out = ctypes.create_string_buffer(40)
c = b.GetEnvironmentVariableW(var1,out,40)
print('ones', c, out, out.raw)
print('two: ', dir(out))
|
|||
| msg80628 - (view) | Author: Gabriel Genellina (ggenellina) | Date: 2009年01月27日 07:01 | |
3rd argument to GetEnvironmentVariableW is the buffer size in *characters*, not bytes. Your buffer has room for 20 characters only, not 40. You should use create_unicode_buffer instead. Probably the names create_unicode_buffer/create_string_buffer should be revised in 3.x |
|||
| msg80629 - (view) | Author: Martin v. Löwis (loewis) * (Python committer) | Date: 2009年01月27日 07:19 | |
Why do you think this is a bug in ctypes? *Of course* it is possible to crash Python by using ctypes incorrectly. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:56:44 | admin | set | github: 49324 |
| 2009年01月27日 07:19:54 | loewis | set | status: open -> closed nosy: + loewis resolution: not a bug messages: + msg80629 |
| 2009年01月27日 07:01:48 | ggenellina | set | nosy:
+ ggenellina messages: + msg80628 |
| 2009年01月27日 03:02:24 | pooryorick | create | |