pycharm如何工作?他们是如何迷上口译员的? [英] How does pycharm work? How did they hook into the interpreter?

查看:110
本文介绍了pycharm如何工作?他们是如何迷上口译员的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道如何使用PyCharm的调试器,但这只是加深了我对它如何完成与Python解释器如此紧密耦合的好奇心。

I know how to use PyCharm's debugger but that has only deepened my curiosity of how it accomplishes the task of being so tightly coupled to the Python interpreter.

cPython可以吗?

Does cPython have some sort of intrepreter hooks buried in itself or does PyCharm somehow copy the source code, instrument the code, and then exec it?

推荐答案

感谢@unholySheep,我能够从PyDev.Debugger上的github src转到 sys.settrace 导致在本周的Python模块上发布 settrace

Thanks to @unholySheep I was able to go from the github src on PyDev.Debugger back to sys.settrace which lead to a post on Python Module of the week on settrace.

一旦跟踪脚本具有堆栈框架,检查框架的堆栈内容和/或使用 code / exec / eval 在上下文中运行监视语句。至于断点,这是微不足道的,因为这只是匹配框架的行号和文件路径的任务。

Once the tracing script has the stack frame, it is likely a non-trivial task of inspecting the frame's stack content and or using code/exec/eval to run "watch" statements in context. As for break points, that would be trivial as it is just a task of matching the frame's line number and filepath.

这篇关于pycharm如何工作?他们是如何迷上口译员的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆