[Python-bugs-list] [Bug #113803] [2.0b1 NT4.0] printing non asci char causes idle to abort

noreply@sourceforge.net noreply@sourceforge.net
Sat, 30 Sep 2000 21:32:37 -0700


Bug #113803, was updated on 2000-Sep-07 08:33
Here is a current snapshot of the bug.

Project: Python
Category: IDLE
Status: Open
Resolution: None
Bug Group: Platform-specific
Priority: 7
Summary: [2.0b1 NT4.0] printing non asci char causes idle to abort

Details: try:

alef = u'\u05d0'
print alef.encode('utf-8')

any enter after the last statement will cause idle to abort

on 'bare' python this does not cause any problem.

[tebeka@lycosmail.com]

Follow-Ups:

Date: 2000-Sep-07 15:04
By: jhylton

Comment:
Please do triage on this bug.
-------------------------------------------------------

Date: 2000-Sep-12 15:13
By: gvanrossum

Comment:
Crash confirmed in IDLE on Win98SE.
Prints (expected) garbage and doesn't crash in command line on Win98SE.
No crash in IDLE or command line on Linux.

Tim, can you take a look with the VC debugger?

-------------------------------------------------------

Date: 2000-Sep-12 19:45
By: tim_one

Comment:
Changed group to platform-specific.

Note that this is a simpler test case w/ the same symptom:

print "\327\220"

Don't know why, do know that _tkinter.pyd and tk83.dll crap out w/ page faults at the end, assigned to Fredrik on the chance he's bumped into this before.  /F, bounce it back at me if it's unclear to you.
-------------------------------------------------------

Date: 2000-Sep-12 23:38
By: tim_one

Comment:
Bad news:  this doesn't always fail in the debugger (sometimes it just prints an alef glyph and nothing odd happens at all).

Better news:  it usually fails, and when it does it dies here (_tkinter.c):

static char *
AsString(PyObject *value, PyObject *tmp)
{
	if (PyString_Check(value))
		return PyString_AsString(value);
	else {
		PyObject *v = PyObject_Str(value);
		PyList_Append(tmp, v);
		Py_DECREF(v);
		return PyString_AsString(v);
	}
}

It's in the "else" branch, v is NULL, and the Py_DECREF expansion blows up with an access violation.  Py_ObjectStr certainly *can* return NULL, and I don't understand the intent of this code well enough to know why it believes that needn't be guarded against.

"value" at this point has type PyUnicode_Type.  For whatever reason, the debugger won't let me cast it to a PyUnicodeObject*.
-------------------------------------------------------

Date: 2000-Sep-20 00:30
By: micpro

Comment:
Crash confirmed for python 2.0 on Linux.
Segfault in _tkinter:267 when called from _tkinter.c:1260
Reason: string object expected, but unicode is given.
AsObj does treat this correctly, so this gets better after
changing line 1260
   Tcl_SetResult(Tkapp_Interp(self), AsString(res, tmp),
                 TCL_VOLATILE);

to
   Tcl_SetObjResult(Tkapp_Interp(self), AsObj(res));

After this change, idle does not segfault anymore and prints
alef correctly, but it still behaves strange after printing. it.
-------------------------------------------------------

Date: 2000-Sep-30 21:32
By: gvanrossum

Comment:
This looks kinda important, so I've raised the priority.
-------------------------------------------------------

For detailed info, follow this link:
http://sourceforge.net/bugs/?func=detailbug&bug_id=113803&group_id=5470