◐ Shell
clean mode source ↗

Py_DECREF: only pass filename if Py_REF_DEBUG is defined by vstinner · Pull Request #17870 · python/cpython

Conversation

@vstinner

Filename and line numbers are not needed when Py_REF_DEBUG are not
defined.

The static inline _Py_DECREF() function was introduced by
commit 2aaf0c1.

Filename and line numbers are not needed when Py_REF_DEBUG are not
defined.

The static inline _Py_DECREF() function was introduced by
commit 2aaf0c1.

@vstinner

See PR #16781 for my first attempt.

@vstinner

@vstinner

Yhg1s

Choose a reason for hiding this comment

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

Yes, this looks better to me. The ifdef dance isn't too bad, and it's no longer duplicating logic.

#endif
PyObject *op)
{
(void)filename; /* may be unused, shut up -Wunused-parameter */

Choose a reason for hiding this comment

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

These suppressions shouldn't be necessary anymore, but if they are, they should be conditional.

Choose a reason for hiding this comment

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

The suppression are needed with the current code, since filename & fileno are not used for a release build. It's the purpose of my change: don't pass them if we don't need them ;-)

shihai1991 pushed a commit to shihai1991/cpython that referenced this pull request

Jan 31, 2020
)

Filename and line numbers are not needed when Py_REF_DEBUG are not
defined.

The static inline _Py_DECREF() function was introduced by
commit 2aaf0c1.

Labels