From 37ac52ad32ef1cbd87d3bc6264e7fa4433b0a21b Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 8 Mar 2014 09:27:40 +0530 Subject: [PATCH] Allow capsule based access to the ICU collator --- src/calibre/utils/icu.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/calibre/utils/icu.c b/src/calibre/utils/icu.c index db6bdea876..93d66a20a2 100644 --- a/src/calibre/utils/icu.c +++ b/src/calibre/utils/icu.c @@ -131,6 +131,12 @@ icu_Collator_actual_locale(icu_Collator *self, void *closure) { // }}} +// Collator.capsule {{{ +static PyObject * +icu_Collator_capsule(icu_Collator *self, void *closure) { + return PyCapsule_New(self->collator, NULL, NULL); +} // }}} + // Collator.sort_key {{{ static PyObject * icu_Collator_sort_key(icu_Collator *self, PyObject *args, PyObject *kwargs) { @@ -411,6 +417,11 @@ static PyGetSetDef icu_Collator_getsetters[] = { (char *)"Actual locale used by this collator.", NULL}, + {(char *)"capsule", + (getter)icu_Collator_capsule, NULL, + (char *)"A capsule enclosing the pointer to the ICU collator struct", + NULL}, + {(char *)"display_name", (getter)icu_Collator_display_name, NULL, (char *)"Display name of this collator in English. The name reflects the actual data source used.",