Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make embedded mode handle errors better #852

Closed
robertwb opened this issue Apr 21, 2009 · 2 comments
Closed

make embedded mode handle errors better #852

robertwb opened this issue Apr 21, 2009 · 2 comments

Comments

@robertwb
Copy link
Contributor

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())
PyErr_WriteUnraisable(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. 

Migrated from http://trac.cython.org/ticket/291

@robertwb
Copy link
Contributor Author

@robertwb changed owner to robertwb
commented

http://hg.cython.org/cython-devel/rev/b550ee890c72

@robertwb
Copy link
Contributor Author

@robertwb changed resolution to fixed
status from new to closed
summary from

make embedded mode act more like python -m

to

make embedded mode handle errors better
commented

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant