Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit d612585

Browse filesBrowse files
committed
respond to PR comment
1 parent 6c4ece6 commit d612585
Copy full SHA for d612585

File tree

1 file changed

+20
-9
lines changed
Filter options

1 file changed

+20
-9
lines changed

‎Modules/unicodedata.c

Copy file name to clipboardExpand all lines: Modules/unicodedata.c
+20-9Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1436,7 +1436,8 @@ static PyMethodDef unicodedata_functions[] = {
14361436
};
14371437

14381438
static void
1439-
ucd_dealloc(PreviousDBVersion *self) {
1439+
ucd_dealloc(PreviousDBVersion *self)
1440+
{
14401441
PyTypeObject *tp = Py_TYPE(self);
14411442
PyObject_Del(self);
14421443
Py_DECREF(tp);
@@ -1447,7 +1448,7 @@ static PyType_Slot unicodedata_ucd_type_slots[] = {
14471448
{Py_tp_getattro, PyObject_GenericGetAttr},
14481449
{Py_tp_methods, unicodedata_functions},
14491450
{Py_tp_members, DB_members},
1450-
{0,0}
1451+
{0, 0}
14511452
};
14521453

14531454
static PyType_Spec unicodedata_ucd_type_spec = {
@@ -1492,37 +1493,47 @@ PyInit_unicodedata(void)
14921493
state->ucd_type = (PyTypeObject *)PyType_FromSpec(
14931494
&unicodedata_ucd_type_spec);
14941495
if (state->ucd_type == NULL) {
1495-
return NULL;
1496+
goto error;
14961497
}
14971498
}
14981499

1499-
PyModule_AddStringConstant(mod, "unidata_version", UNIDATA_VERSION);
1500-
Py_INCREF(state->ucd_type);
15011500
PyModule_AddObject(mod, "UCD", (PyObject*)state->ucd_type);
15021501

1502+
if (PyModule_AddStringConstant(
1503+
mod, "unidata_version", UNIDATA_VERSION) < 0) {
1504+
goto error;
1505+
}
1506+
1507+
if (PyModule_AddType(mod, state->ucd_type) < 0) {
1508+
goto error;
1509+
}
15031510

15041511
/* Previous versions */
15051512
PyObject *v;
15061513
v = new_previous_version(state, "3.2.0", get_change_3_2_0, normalization_3_2_0);
15071514
if (v == NULL) {
1508-
return NULL;
1515+
goto error;
15091516
}
15101517

15111518
if (PyModule_AddObject(mod, "ucd_3_2_0", v) < 0) {
15121519
Py_DECREF(v);
1513-
return NULL;
1520+
goto error;
15141521
}
15151522

15161523
/* Export C API */
15171524
v = PyCapsule_New((void *)&hashAPI, PyUnicodeData_CAPSULE_NAME, NULL);
15181525
if (v == NULL) {
1519-
return NULL;
1526+
goto error;
15201527
}
15211528
if (PyModule_AddObject(mod, "ucnhash_CAPI", v) < 0) {
15221529
Py_DECREF(v);
1523-
return NULL;
1530+
goto error;
15241531
}
15251532
return mod;
1533+
1534+
error:
1535+
Py_DECREF(mod);
1536+
return NULL;
15261537
}
15271538

15281539
/*

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.