Skip to content

Add PyDateTime_IMPORT to module initialization function.#18

Closed
aebruno wants to merge 1 commit intorjancewicz:masterfrom
aebruno:fix-datetime-segfault
Closed

Add PyDateTime_IMPORT to module initialization function.#18
aebruno wants to merge 1 commit intorjancewicz:masterfrom
aebruno:fix-datetime-segfault

Conversation

@aebruno
Copy link
Copy Markdown

@aebruno aebruno commented Aug 19, 2014

Was experiencing segfaults when accessing datetime fields on the
PyKAdminPrincipalObject, for example, calls to function
PyKAdminPrincipal_get_expire(..) resulted in a segfault.

Example code resulting in segfault:

import kadmin

kadm = kadmin.init_with_keytab("user@example.com", "/path/to/keytab")
princ = kadm.get_principal("user@example.com")
print princ.expire

However, if imported datetime module first, all is well:

import kadmin
import datetime

kadm = kadmin.init_with_keytab("user@example.com", "/path/to/keytab")
princ = kadm.get_principal("user@example.com")
print princ.expire

This suggested datetime wasn't being initialized properly? Adding this
patch to ensure Py_DateTime is initialized as part of the module
initialization fixed the segfaults.

Was experiencing segfaults when accessing datetime fields on the
PyKAdminPrincipalObject, for example, calls to function
PyKAdminPrincipal_get_expire(..) resulted in a segfault.

Example code resulting in segfault:

  import kadmin

  kadm = kadmin.init_with_keytab("user@example.com", "/path/to/keytab")
  princ = kadm.get_principal("user@example.com")
  print princ.expire

However, if imported datetime module first, all is well:

  import kadmin
  import datetime

  kadm = kadmin.init_with_keytab("user@example.com", "/path/to/keytab")
  princ = kadm.get_principal("user@example.com")
  print princ.expire

This suggested datetime wasn't being initialized properly. Adding this
patch to ensure Py_DateTime is initialized as part of the module
initialization fixed the segfaults.
@rjancewicz
Copy link
Copy Markdown
Owner

It would appear that you have forked from a much older branch. Please rebase off the current master and try the test again. I am unable to reproduce the error.

@aebruno
Copy link
Copy Markdown
Author

aebruno commented Aug 20, 2014

Thanks, looks like your recent commit 5e7e39f fixed my issue (not sure if it's related). I could reproduce this on ac95fa9 (which is where I forked from). Thanks for your work on this library! Feel free to close this out.

@rjancewicz rjancewicz closed this Aug 21, 2014
@aebruno aebruno deleted the fix-datetime-segfault branch August 23, 2014 14:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants