Message179080
| Author |
coderforlife |
| Recipients |
coderforlife |
| Date |
2013年01月04日.21:28:18 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1357334898.38.0.395259266999.issue16865@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
The environment is Windows 8 Pro 64-bit running Python 64-bit in the WinPython distribution. Python is v2.7.3 built on Apr 10 2012. I first found this with create_string_buffer however I found out that it happens with an even simpler example.
The following code throws an AttributeException: class must define a _length_ attribute, which must be a positive integer.
import ctypes
c_char * int(2*1024*1024*1024) # 2GB, also fails with long() instead of int()
However the following works
import ctypes
c_char * int(2*1024*1024*1024-1) # 1 byte less than 2GB
This is the same with the other c_ types (not limited to size of memory since c_int * int(2*1024*1024*1024-1) works and would be nearly 4 times the size of the failed c_char one). |
|
History
|
|---|
| Date |
User |
Action |
Args |
| 2013年01月04日 21:28:18 | coderforlife | set | recipients:
+ coderforlife |
| 2013年01月04日 21:28:18 | coderforlife | set | messageid: <1357334898.38.0.395259266999.issue16865@psf.upfronthosting.co.za> |
| 2013年01月04日 21:28:18 | coderforlife | link | issue16865 messages |
| 2013年01月04日 21:28:18 | coderforlife | create |
|