STINNER Victor <vstin...@python.org> added the comment:

"Use strnlen instead of strlen when the size i known" rationale was "This PR 
changes strlen to strnlen so no buffer overruns are made when there's no null 
terminator", but strlen() was not called whne the string was not null 
terminated.

Serhiy wrote that strnlen() can be faster and that can be slower... If the goal 
is an optimization, a benchmark should prove it (on at least one platform).
https://github.com/python/cpython/pull/21236#issuecomment-699609949

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue41170>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to