Serhiy Storchaka added the comment:

This issue is related to parsing of "et#" format which is used only in 
listdir() and _getfullpathname() under Windows. PyArg_ParseTuple() throws 
TypeError exception for multiple conversion errors (in this case it is an 
overflow of a static buffer). There are several ways to solve this issue:

1. Do nothing, close the issue as "wont fix".  This is just the wrong exception 
in a very rare case only on 2.7 and only under Windows.  The issue will go away 
with 2.7.

2. Use under Windows dynamic buffer as under other platforms.  This will 
require not only dynamic memory allocation, but also reallocation for "\*.*" 

3. Do not use PyArg_ParseTuple().  Parse the singular argument manually.

4. If PyArg_ParseTuple() fails then check if the raised exception is TypeError 
and the error message matches "(buffer overflow)".  In this case raise the 
right exception.

5. Rewrite PyArg_ParseTuple() so that it will raise an appropriate type of 
exception (this will have to do anyway, but maybe later, in other issue).  In 
this case it will be OverflowError.  Then we can catch this error and raise the 
right exception.

Martin, what is your decision?

versions: +Python 2.7 -Python 2.6, Python 3.1

Python tracker <>
Python-bugs-list mailing list

Reply via email to