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.

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:10vinay.sajipsetrecipients: + vinay.sajip, terry.reedy, bgilbert
2011-08-29 16:15:10vinay.sajipsetmessageid: <1314634510.72.0.783215324591.issue12836@psf.upfronthosting.co.za>
2011-08-29 16:15:10vinay.sajiplinkissue12836 messages
2011-08-29 16:15:09vinay.sajipcreate