[Python-Dev] RE: test_sax failing (Windows)

Tim Peters tim.one@home.com
Sun, 21 Jan 2001 17:09:30 -0500


FYI, under the debug-build Python, running test_sax.py under the debugger
dies like so:

Passed test_attrs_empty
Passed test_attrs_wattr
Passed test_escape_all
Passed test_escape_basic
Passed test_escape_extra
Passed test_expat_attrs_empty
Passed test_expat_attrs_wattr
Passed test_expat_dtdhandler
Passed test_expat_entityresolver
Passed test_expat_file
Traceback (most recent call last):
  File "../lib/test/test_sax.py", line 603, in ?
    confirm(value(), name)
  File "../lib/test/test_sax.py", line 435, in test_expat_incomplete
    parser.parse(StringIO("<foo>"))
  File "c:\code\python\dist\src\lib\xml\sax\expatreader.py", line 42, in
parse
    xmlreader.IncrementalParser.parse(self, source)
  File "c:\code\python\dist\src\lib\xml\sax\xmlreader.py", line 122, in
parse
    self.close()
  File "c:\code\python\dist\src\lib\xml\sax\expatreader.py", line 91, in
close
    self.feed("", isFinal = 1)
  File "c:\code\python\dist\src\lib\xml\sax\expatreader.py", line 82, in
feed
    except expat.error:
SystemError: 'finally' pops bad exception

Running it from a command line instead produces the same output up to but
not including the traceback, and Python crashes with a memory fault then.
Attaching to the process with a debugger at that point shows it trying to do
_Py_Dealloc on an op whose op->op_type member is NULL.  Here's the call
stack at that point:

_Py_Dealloc(_object * 0x007af100) line 1304 + 6 bytes
insertdict(dictobject * 0x007637ec, _object * 0x007a8270,
           long -1601350627, _object * 0x1e1eff18 __Py_NoneStruct)
           line 364 + 48 bytes
PyDict_SetItem(_object * 0x007637ec, _object * 0x007a8270,
          _object * 0x1e1eff18 __Py_NoneStruct) line 498 + 21 bytes
PyDict_SetItemString(_object * 0x007637ec, char * 0x1e1d84fc,
          _object * 0x1e1eff18 __Py_NoneStruct) line 1272 + 17 bytes
PySys_SetObject(char * 0x1e1d84fc, _object * 0x1e1eff18 __Py_NoneStruct)
          line 67 + 17 bytes
reset_exc_info(_ts * 0x00760630) line 2207 + 17 bytes
eval_code2(PyCodeObject * 0x00993df0, _object * 0x0098794c,
          _object * 0x00000000, _object * * 0x007a9d28, int 2,
          _object * * 0x007a9d30, int 1, _object * * 0x009a0b60,
          int 1) line 2125 + 9 bytes
fast_function(_object * 0x009a4f6c, _object * * * 0x0063f5a0, int 4,
          int 2, int 1) line 2817 + 61 bytes
eval_code2(PyCodeObject * 0x00993910, _object * 0x0098794c,
          _object * 0x00000000, _object * * 0x007a05e8, int 1,
          _object * * 0x007a05ec, int 0, _object * * 0x00000000,
         int 0) line 1860 + 37 bytes
fast_function(_object * 0x009a549c, _object * * * 0x0063f738, int 1,
         int 1, int 0) line 2817 + 61 bytes
eval_code2(PyCodeObject * 0x007b35e0, _object * 0x0098110c,
          _object * 0x00000000, _object * * 0x009beb10, int 2,
          _object * * 0x00000000, int 0, _object * * 0x00000000,
          int 0) line 1860 + 37 bytes
call_eval_code2(_object * 0x0098a97c, _object * 0x009beafc,
         _object * 0x00000000) line 2765 + 57 bytes
call_object(_object * 0x0098a97c, _object * 0x009beafc,
         _object * 0x00000000) line 2594 + 17 bytes
call_method(_object * 0x0098a97c, _object * 0x009beafc,
         _object * 0x00000000) line 2717 + 17 bytes
call_object(_object * 0x007e125c, _object * 0x009beafc,
         _object * 0x00000000) line 2592 + 17 bytes
do_call(_object * 0x007e125c, _object * * * 0x0063f96c, int 2,
        int 0) line 2915 + 17 bytes
eval_code2(PyCodeObject * 0x00991560, _object * 0x0098794c,
        _object * 0x00000000, _object * * 0x009bce98, int 2,
        _object * * 0x009bcea0, int 0, _object * * 0x00000000,
        int 0) line 1863 + 30 bytes
fast_function(_object * 0x009a7dfc, _object * * * 0x0063fb04, int 2,
        int 2, int 0) line 2817 + 61 bytes
eval_code2(PyCodeObject * 0x009f7e00, _object * 0x0076f14c,
       _object * 0x00000000, _object * * 0x00775904, int 0,
       _object * * 0x00775904, int 0, _object * * 0x00000000,
       int 0) line 1860 + 37 bytes
fast_function(_object * 0x009bc8ac, _object * * * 0x0063fc9c, int 0,
       int 0, int 0) line 2817 + 61 bytes
eval_code2(PyCodeObject * 0x009f86d0, _object * 0x0076f14c,
      _object * 0x0076f14c, _object * * 0x00000000, int 0,
      _object * * 0x00000000, int 0, _object * * 0x00000000,
      int 0) line 1860 + 37 bytes
PyEval_EvalCode(PyCodeObject * 0x009f86d0, _object * 0x0076f14c,
      _object * 0x0076f14c) line 338 + 29 bytes
run_node(_node * 0x007aa740, char * 0x00760dd9, _object * 0x0076f14c,
     _object * 0x0076f14c) line 919 + 17 bytes
run_err_node(_node * 0x007aa740, char * 0x00760dd9, _object * 0x0076f14c,
     _object * 0x0076f14c) line 907 + 21 bytes
PyRun_FileEx(_iobuf * 0x10261888, char * 0x00760dd9, int 257,
     _object * 0x0076f14c, _object * 0x0076f14c, int 1) line 899 + 21 bytes
PyRun_SimpleFileEx(_iobuf * 0x10261888, char * 0x00760dd9, int 1)
      line 612 + 30 bytes
PyRun_AnyFileEx(_iobuf * 0x10261888, char * 0x00760dd9, int 1)
      line 466 + 17 bytes
Py_Main(int 2, char * * 0x00760da0) line 295 + 44 bytes
main(int 2, char * * 0x00760da0) line 10 + 13 bytes

insertdict is doing

    Py_DECREF(old_value);

reset_exc_info is doing

    PySys_SetObject("exc_type", frame->f_exc_type);

Bet that's as helpful to you as it was to me <wink>.