Opened 7 years ago

Closed 7 years ago

#291 closed defect (fixed)

make embedded mode handle errors better

Reported by: robertwb Owned by: robertwb
Priority: major Milestone: 0.11.2
Component: Python Semantics Keywords:


On Apr 21, 2009, at 6:17 AM, Lisandro Dalcin wrote:

Robert, your main() implementation needs more work IMHO.

Thanks for the feedback. 

1) For Py2, you need to if(PyErr_Occurred())

Actually, it might be nice to dump the whole traceback here. 

2) In Py3, you have to save the return of PyInit_<modname>, if NULL,
report error (WriteUnraisable again?), if not, decref it.

Is PyErr_Occurred not a good enough check here? Yes, I should probably get and decref the module (though it won't matter much as I call Py_Finalize next. 

3) In case of errors, process return value should match what core
CPython returns en case of unhandled execptions.

Do you know of a good list? (Otherwise, I'll just try some.) 

3) However, a SystemExit exceptions should need some special
consideration, as you should extract the process return value from it,
as it could be 0 (zero).

Good point. 

Change History (2)

comment:2 Changed 7 years ago by robertwb

  • Resolution set to fixed
  • Status changed from new to closed
  • Summary changed from make embedded mode act more like python -m to make embedded mode handle errors better
Note: See TracTickets for help on using tickets.