[issue8256] TypeError: bad argument type for built-in operation

2010-05-12 Thread STINNER Victor
STINNER Victor added the comment: This issue is directly related to issue #6697. The first problem is that the builtin input() function doesn't check that _PyUnicode_AsString() result is not NULL. The second problem is that io.StringIO().encoding is None. I don't understand why it is None wh

[issue8256] TypeError: bad argument type for built-in operation

2010-05-11 Thread Filip Gruszczyński
Filip Gruszczyński added the comment: Amaury, could you elaborate a little more on this? I am pretty new to all this and I would happily write the patch, if only you could give me some clue on how I should approach this. -- ___ Python tracker

[issue8256] TypeError: bad argument type for built-in operation

2010-05-11 Thread Alexander Belopolsky
Changes by Alexander Belopolsky : -- nosy: +belopolsky ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://ma

[issue8256] TypeError: bad argument type for built-in operation

2010-05-10 Thread Amaury Forgeot d'Arc
Amaury Forgeot d'Arc added the comment: The patch is wrong: _PyUnicode_AsString(Py_None) should not return "utf8"! I suggest that since PyOS_Readline() write the prompt to stderr, the conversion uses the encoding of stderr. -- nosy: +amaury.forgeotdarc ___

[issue8256] TypeError: bad argument type for built-in operation

2010-05-10 Thread Filip Gruszczyński
Filip Gruszczyński added the comment: I'll try to code a small test this evening. -- ___ Python tracker ___ ___ Python-bugs-list maili

[issue8256] TypeError: bad argument type for built-in operation

2010-05-10 Thread R. David Murray
R. David Murray added the comment: Victor, you've been dealing with Python's default encoding lately, care to render an opinion on the correct fix for this bug? @Filip: the patch will need a unit test, which will also help with assessing the validity of the fix. -- nosy: +haypo

[issue8256] TypeError: bad argument type for built-in operation

2010-05-09 Thread Filip Gruszczyński
Filip Gruszczyński added the comment: Bump! Is there anything happening about this bug? Is my patch any good or should I try to work on something different? -- ___ Python tracker __

[issue8256] TypeError: bad argument type for built-in operation

2010-03-30 Thread Filip Gruszczyński
Changes by Filip Gruszczyński : Removed file: http://bugs.python.org/file16689/8256_2.patch ___ Python tracker ___ ___ Python-bugs-list mailing

[issue8256] TypeError: bad argument type for built-in operation

2010-03-30 Thread Filip Gruszczyński
Changes by Filip Gruszczyński : Removed file: http://bugs.python.org/file16688/8256_1.patch ___ Python tracker ___ ___ Python-bugs-list mailing

[issue8256] TypeError: bad argument type for built-in operation

2010-03-30 Thread Filip Gruszczyński
Filip Gruszczyński added the comment: I have read, that I shouldn't directly use Py_FileSystemDefaultEncoding and rather use PyUnicode_GetDefaultEncoding, so I have changed the code a little. -- Added file: http://bugs.python.org/file16700/8256_3.patch

[issue8256] TypeError: bad argument type for built-in operation

2010-03-29 Thread Filip Gruszczyński
Filip Gruszczyński added the comment: Ok, I have found Py_FileDefaultSystemEncoding and use it, however I had to cast it to (char *), because it's a const char *. Maybe I could do it better? -- Added file: http://bugs.python.org/file16689/8256_2.patch _

[issue8256] TypeError: bad argument type for built-in operation

2010-03-29 Thread Filip Gruszczyński
Filip Gruszczyński added the comment: I have written a small patch, that solves the problem, but is disgusting. Could anyone tell me, how I can get some default encoding from Python internals (I have no idea where to look) and return it inside _PyUnicode_AsStringAndSize? Anyway, now when the

[issue8256] TypeError: bad argument type for built-in operation

2010-03-29 Thread R. David Murray
R. David Murray added the comment: Whatever the solution to this issue is, it certainly looks like a bug that the return value of that function isn't being checked for errors. -- nosy: +r.david.murray ___ Python tracker

[issue8256] TypeError: bad argument type for built-in operation

2010-03-29 Thread Filip Gruszczyński
Filip Gruszczyński added the comment: The problem occurs in line in bltinmodule.c: po = PyUnicode_AsEncodedString(stringpo, _PyUnicode_AsString(stdout_encoding), NULL); Where _PyUnicode_AsString returns NULL, since stdout_encoding is Py_None and that wo

[issue8256] TypeError: bad argument type for built-in operation

2010-03-28 Thread Florent Xicluna
Florent Xicluna added the comment: Right. It does not involve doctest. # import io, sys original_stdout = sys.stdout try: sys.stdout = io.StringIO() input("prompt:") print() finally: sys.stdout = original_stdout -- ___ Python track

[issue8256] TypeError: bad argument type for built-in operation

2010-03-28 Thread Florent Xicluna
Changes by Florent Xicluna : Removed file: http://bugs.python.org/file16682/issue8256_case.py ___ Python tracker ___ ___ Python-bugs-list maili

[issue8256] TypeError: bad argument type for built-in operation

2010-03-28 Thread Filip Gruszczyński
Filip Gruszczyński added the comment: The bug is triggered by input, not by print. The exact place is _PyUnicode_AsStringAndSize, where unicode check happens. Then print checks PyError_Occured and catches this error. Either this error should not be raised or should be cleared input finishes.

[issue8256] TypeError: bad argument type for built-in operation

2010-03-28 Thread Florent Xicluna
Florent Xicluna added the comment: Confirmed. There's something wrong around the doctest._SpoofOut class. This script triggers the same bug (both 3.x and 3.1). Output: $ ./python issue8256_case.py prompt: Traceback (most recent call last): File "issue8256_case.py", line 13, in foo()

[issue8256] TypeError: bad argument type for built-in operation

2010-03-28 Thread Bruce Frederiksen
New submission from Bruce Frederiksen : I'm getting a "TypeError: bad argument type for built-in operation" on a print() with no arguments. This seems to be a problem in both 3.1 and 3.1.2 (haven't tried 3.1.1). I've narrowed the problem down in a very small demo program that you can run to