Skip to content

gh-108765: pystrhex: Replace stdlib.h abs() with Py_ABS() #108830

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 2, 2023
Merged
Changes from all commits
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
3 changes: 1 addition & 2 deletions Python/pystrhex.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
#include "Python.h"
#include "pycore_strhex.h" // _Py_strhex_with_sep()
#include "pycore_unicodeobject.h" // _PyUnicode_CheckConsistency()
#include <stdlib.h> // abs()

static PyObject *_Py_strhex_impl(const char* argbuf, const Py_ssize_t arglen,
PyObject* sep, int bytes_per_sep_group,
Expand Down Expand Up @@ -44,7 +43,7 @@ static PyObject *_Py_strhex_impl(const char* argbuf, const Py_ssize_t arglen,
bytes_per_sep_group = 0;
}

unsigned int abs_bytes_per_sep = abs(bytes_per_sep_group);
unsigned int abs_bytes_per_sep = Py_ABS(bytes_per_sep_group);
Py_ssize_t resultlen = 0;
if (bytes_per_sep_group && arglen > 0) {
/* How many sep characters we'll be inserting. */
Expand Down