Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix issues
  • Loading branch information
koubaa committed Aug 29, 2020
commit 1fe0fa2983149170f6c6514714f294eceeadde31
4 changes: 1 addition & 3 deletions Modules/_blake2/blake2b_impl.c
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ py_blake2b_dealloc(PyObject *self)
obj->lock = NULL;
}

PyObject *type = Py_TYPE(self);
PyTypeObject *type = Py_TYPE(self);
PyObject_Del(self);
Py_DECREF(type);
}
Expand All @@ -406,8 +406,6 @@ static PyType_Slot blake2b_type_slots[] = {
{0,0}
};

// Using PyType_GetModuleState() on this type is safe since
// it cannot be subclassed: it does not have the Py_TPFLAGS_BASETYPE flag.
PyType_Spec blake2b_type_spec = {
.name = "_blake2.blake2b",
.basicsize = sizeof(BLAKE2bObject),
Expand Down
11 changes: 5 additions & 6 deletions Modules/_blake2/blake2module.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ typedef struct {
PyTypeObject* blake2s_type;
} Blake2State;

static inline Blake2State* blake2_get_state(PyObject *module)
static inline Blake2State*
blake2_get_state(PyObject *module)
{
void *state = PyModule_GetState(module);
assert(state != NULL);
Expand Down Expand Up @@ -61,19 +62,17 @@ _blake2_free(void *module)

#define ADD_INT(d, name, value) do { \
PyObject *x = PyLong_FromLong(value); \
if (!x) { \
Py_DECREF(x); \
if (!x) \
return -1; \
} \
if (PyDict_SetItemString(d, name, x) < 0) { \
Py_DECREF(x); \
return -1; \
} \
Py_DECREF(x); \
} while(0)


static int blake2_exec(PyObject *m)
static int
blake2_exec(PyObject *m)
{
Blake2State* st = blake2_get_state(m);

Expand Down
4 changes: 1 addition & 3 deletions Modules/_blake2/blake2s_impl.c
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,7 @@ py_blake2s_dealloc(PyObject *self)
obj->lock = NULL;
}

PyObject *type = Py_TYPE(self);
PyTypeObject *type = Py_TYPE(self);
PyObject_Del(self);
Py_DECREF(type);
}
Expand All @@ -405,8 +405,6 @@ static PyType_Slot blake2s_type_slots[] = {
{0,0}
};

// Using PyType_GetModuleState() on this type is safe since
// it cannot be subclassed: it does not have the Py_TPFLAGS_BASETYPE flag.
PyType_Spec blake2s_type_spec = {
.name = "_blake2.blake2s",
.basicsize = sizeof(BLAKE2sObject),
Expand Down