zopefoundation / Products.PythonScripts

Provides support for restricted execution of Python scripts in Zope.
Other
6 stars 10 forks source link

Show Python Script source code in tracebacks #65

Closed perrinjerome closed 3 weeks ago

perrinjerome commented 5 months ago

Expose a __loader__ in globals so that linecache module is able to use it to display the source code.

This requires changing the "filename" used when compiling function, because linecache uses code.co_filename as a cache key, so it's necessary that each python script use a different filename.

Fixes #64

perrinjerome commented 5 months ago

tests depend on https://github.com/zopefoundation/zope.exceptions/pull/33 because zope.testrunner monkey patches traceback module to use zope.exceptions, see https://github.com/zopefoundation/zope.testrunner/blob/f6c62d331487538b5035d0e4b33d0bc864a291ea/src/zope/testrunner/tb_format.py#L90-L94

perrinjerome commented 4 weeks ago

Now that zope.exceptions is released and zope versions are updated, test should pass

dataflake commented 3 weeks ago

@perrinjerome Is this ready to go? You never asked for reviews.

perrinjerome commented 3 weeks ago

Ah yes, it's ready to go, thanks. I was not sure if marking "ready for review" was enough.

dataflake commented 3 weeks ago

If you add reviewers they will get email. If you don't no one will feel responsible unless they have an existing high interest.

perrinjerome commented 3 weeks ago

Thanks !

dataflake commented 3 weeks ago

Version 5.1 is now up on PyPI.