mongodb / winkerberos

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

add '#define PY_SSIZE_T_CLEAN' above python.h to remove deprecation warning #38

Closed interifter closed 3 years ago

interifter commented 4 years ago

Fix to remove

requests_kerberos\kerberos_.py:385: DeprecationWarning: PY_SSIZE_T_CLEAN will be required for '#' formats
    self.cbt_struct = kerberos.channelBindings(application_data=cbt_application_data)

Issue ref: https://github.com/mongodb-labs/winkerberos/issues/37

ShaneHarvey commented 4 years ago

I believe you may also need to change the type of the *_length variables from unsigned long to Py_ssize_t here: https://github.com/mongodb-labs/winkerberos/blob/master/src/winkerberos.c#L619-L623

You may need to add an overflow check when subsequently downcasting from Py_ssize_t back to unsigned long. See this change where we fixed the same issue in PyMongo: https://github.com/mongodb/mongo-python-driver/pull/428#discussion_r341760226

behackett commented 3 years ago

Thanks for this patch. I'm going to merge it then add an additional patch to deal with the issue @ShaneHarvey mentions.

behackett commented 3 years ago

This has been merged to master. Thanks again.