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 Ivan.Pozdeev
Recipients Ivan.Pozdeev, amaury.forgeotdarc, belopolsky, eryksun, meador.inge, r.david.murray
Date 2014-10-05.01:33:10
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1412472791.72.0.883410748003.issue22552@psf.upfronthosting.co.za>
In-reply-to
Content
@R. David Murray: haha, the reverse change that introduced this problem in the first place! issue 14201's problem is exactly why I was going to suggest to also make _FuncPtr's compare equal if they point to the same function.

@eryksun: Packages do this because it's the natural thing to do - there's no apparent way to clone a pointer, there's not even a notion they _need_ to be cloned. https://docs.python.org/2/library/ctypes.html#loading-shared-libraries only documents __getattr__() and behavior of a LibraryLoader, not of a CDLL . 

Bottom line: ctypes currently leaves a trap for users to fall into. While Python's paradigm is "make right things easy, make wrong things hard".

So, he optimal way seems to require to clone function pointers to set attributes. I'm going to add a guard attribute and a `clone' method to _FuncPtr. It's discussable whether to make cloned/altered pointers compare equal to the originals.
History
Date User Action Args
2014-10-05 01:33:11Ivan.Pozdeevsetrecipients: + Ivan.Pozdeev, amaury.forgeotdarc, belopolsky, r.david.murray, meador.inge, eryksun
2014-10-05 01:33:11Ivan.Pozdeevsetmessageid: <1412472791.72.0.883410748003.issue22552@psf.upfronthosting.co.za>
2014-10-05 01:33:11Ivan.Pozdeevlinkissue22552 messages
2014-10-05 01:33:10Ivan.Pozdeevcreate