Message143155
| Author |
vinay.sajip |
| Recipients |
bgilbert, terry.reedy, vinay.sajip |
| Date |
2011年08月29日.16:15:09 |
| SpamBayes Score |
1.8192979e-05 |
| Marked as misclassified |
No |
| Message-id |
<1314634510.72.0.783215324591.issue12836@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
I can confirm that the same behaviour occur in Python 3.3, and this appears to be by design. There's a specific line in the cast() function in in Modules/_ctypes.c:
rc = PyDict_SetItem(result->b_objects, index, src);
This adds the source object to the _objects of the cast object being returned. However, earlier in the function, the code
CDataObject *obj = (CDataObject *)src;
...
result->b_objects = obj->b_objects;
ensures that result and src are using a single dictionary. Possibly, the result's b_objects needs to be a copy of the src's b_objects; but I don't know enough about ctypes internals to say whether the present code is intentional, or whether an attempt to minimise resource usage (by not copying the dictionary) has led to unwanted consequences. |
|
History
|
|---|
| Date |
User |
Action |
Args |
| 2011年08月29日 16:15:10 | vinay.sajip | set | recipients:
+ vinay.sajip, terry.reedy, bgilbert |
| 2011年08月29日 16:15:10 | vinay.sajip | set | messageid: <1314634510.72.0.783215324591.issue12836@psf.upfronthosting.co.za> |
| 2011年08月29日 16:15:10 | vinay.sajip | link | issue12836 messages |
| 2011年08月29日 16:15:09 | vinay.sajip | create |
|