Allow capsule based access to the ICU collator

This commit is contained in:
Kovid Goyal 2014-03-08 09:27:40 +05:30
parent 5816c4aaeb
commit 37ac52ad32

View File

@ -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 {{{ // Collator.sort_key {{{
static PyObject * static PyObject *
icu_Collator_sort_key(icu_Collator *self, PyObject *args, PyObject *kwargs) { 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.", (char *)"Actual locale used by this collator.",
NULL}, NULL},
{(char *)"capsule",
(getter)icu_Collator_capsule, NULL,
(char *)"A capsule enclosing the pointer to the ICU collator struct",
NULL},
{(char *)"display_name", {(char *)"display_name",
(getter)icu_Collator_display_name, NULL, (getter)icu_Collator_display_name, NULL,
(char *)"Display name of this collator in English. The name reflects the actual data source used.", (char *)"Display name of this collator in English. The name reflects the actual data source used.",