mongodb / winkerberos

A native Kerberos client implementation for Python on Windows
Apache License 2.0
54 stars 15 forks source link

Use PyCapsule with Python 2.7 #29

Closed behackett closed 5 years ago

behackett commented 5 years ago

Now that we've dropped Python 2.6, let's switch 2.7 over to PyCapsule. That way we can name the objects which should make development and debugging easier for users.

behackett commented 5 years ago

It would appear we can't add names to the capsules, since that forces PyCapsule_GetPointer calls to pass the correct name. That won't work for mech oids, since there are two now and could conceivably be more later. This won't keep us from switching to PyCapsule for 2.7 (which will eliminate some confusing aliases), but defeats one of the reasons to do it.

https://github.com/python/cpython/blame/v3.7.2/Objects/capsule.c#L32

behackett commented 5 years ago

Actually, we can just pass the value of PyCapsule_GetName in the mechoid case.

https://docs.python.org/2/c-api/capsule.html#c.PyCapsule_GetName