Serhiy Storchaka added the comment:
Shouldn't this be applied to 3.3?
As for optimization, I made some benchmarks and didn't saw any significant
difference. Usually this function used to check short ASCII heads and tails and
any optimization will not be seen even under a microscope.
STINNER Victor added the comment:
Shouldn't this be applied to 3.3?
It's just a cleanup, it doesn't fix any real bug. I prefer to not
pollute old versions with cleanup.
As for optimization, I made some benchmarks and didn't saw any significant
difference. Usually this function used to
Roundup Robot added the comment:
New changeset 49eb2488145d by Victor Stinner in branch 'default':
Close #16281: handle tailmatch() failure and remove useless comment
http://hg.python.org/cpython/rev/49eb2488145d
--
nosy: +python-dev
resolution: - fixed
stage: needs patch -
STINNER Victor added the comment:
Here I see a one obvious opportunity for optimization: ...
@Serhiy: Can you please open a new issue for this? I consider the issue as
fixed: I just removed the TODO (for the reason explained in the changeset).
--
Changes by Serhiy Storchaka storch...@gmail.com:
--
components: +Interpreter Core
stage: - needs patch
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue16281
___
Serhiy Storchaka added the comment:
Oh, PyUnicode_Tailmatch() documentation doesn't mention that the function
can fail.
But it does.
.. c:function:: int PyUnicode_Tailmatch(PyObject *str, PyObject *substr, \
Py_ssize_t start, Py_ssize_t end, int direction)
Return
STINNER Victor added the comment:
Oh, PyUnicode_Tailmatch() documentation doesn't mention that the function
can fail.
But it does.
.. c:function:: int PyUnicode_Tailmatch(PyObject *str, PyObject *substr, \
Py_ssize_t start, Py_ssize_t end, int direction)
STINNER Victor added the comment:
Oh, PyUnicode_Tailmatch() documentation doesn't mention that the function can
fail.
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue16281
___
Serhiy Storchaka added the comment:
The result does not depend on the direction of comparison. This only affects
speed. But who can to say in which direction comparison will be faster?
Here I see a one obvious opportunity for optimization:
if (kind_self kind_sub)
return 0;
After
New submission from STINNER Victor:
Oh oh, it looks like the implementation of tailmatch() was not finished:
/* If both are of the same kind, memcmp is sufficient */
if (kind_self == kind_sub) {
return ...;
}
/* otherwise we have to compare each
10 matches
Mail list logo