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
remove (destructor) cast in bltinmodule and longobject
  • Loading branch information
sweeneyde committed Jan 29, 2022
commit 05b050bac598a663353699107cf4a73f8ffa32ab
3 changes: 1 addition & 2 deletions Objects/longobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,7 @@ static inline void
_Py_DECREF_INT(PyLongObject *op)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this ultimately equivalent to

#define _Py_DECREF_INT(op) _Py_DECREF_SPECIALIZED(op, PyObject_Free)

?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed _PyLongExactDealloc, but I'd like to keep the assertion around to make sure we're never accidentally calling this on int subclasses.

{
assert(PyLong_CheckExact(op));
_Py_DECREF_SPECIALIZED((PyObject *)op,
(destructor)_PyLong_ExactDealloc);
_Py_DECREF_SPECIALIZED((PyObject *)op, _PyLong_ExactDealloc);
}

static inline int
Expand Down
2 changes: 1 addition & 1 deletion Python/bltinmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -2520,7 +2520,7 @@ builtin_sum_impl(PyObject *module, PyObject *iterable, PyObject *start)
}
if (PyFloat_CheckExact(item)) {
f_result += PyFloat_AS_DOUBLE(item);
_Py_DECREF_SPECIALIZED(item, (destructor)_PyFloat_ExactDealloc);
_Py_DECREF_SPECIALIZED(item, _PyFloat_ExactDealloc);
continue;
}
if (PyLong_Check(item)) {
Expand Down