我在哪里可以找到pdb源代码?

时间:2015-07-22 15:03:01

标签: python debugging python-3.x pdb

我想修改Python 3.4内置调试器的源代码pdb(我假设它是用Python编写的)。我想添加一些代码,以便在我放入时:

pdb.set_trace(locals())

在我的代码中,它调用控制台中的标准pdb接口,并自动显示有关我的本地环境变量的格式化信息,类似于下表。

有人能指出我pdb的源代码吗?

-------------------- Objects: -----------------------------------[2000]
[Name: dog]     [Data type: "Dog"]          [2100]
+------+-------+-------+-------+------------+------------+
|  ID  | breed | color |  name |    size    |    uuid    |
+------+-------+-------+-------+------------+------------+
| 2110 |  lynx | black | dog-3 | large!!!!! | e30475ad-9 |
+------+-------+-------+-------+------------+------------+
[Name: cat]     [Data type: "Cat"]          [2200]
+------+-------+-------+---------+------------+
|  ID  | breed | color |   name  |    size    |
+------+-------+-------+---------+------------+
| 2210 |  lynx | black | kitty-5 | large!!!!! |
+------+-------+-------+---------+------------+

-------------------- Lists of Objects: --------------------------[3000]
[Name: cats]     [Data type: "list"]          [3100]
+------+-------+-------+---------+------------+
|  ID  | breed | color |   name  |    size    |
+------+-------+-------+---------+------------+
| 3110 |  lynx | black | kitty-1 | large!!!!! |
| 3120 |  lynx | black | kitty-2 | large!!!!! |
| 3130 |  lynx | black | kitty-3 | large!!!!! |
| 3140 |  lynx | black | kitty-4 | large!!!!! |
| 3150 |  lynx | black | kitty-5 | large!!!!! |
+------+-------+-------+---------+------------+
[Name: dogs]     [Data type: "list"]          [3200]
+------+-------+-------+-------+------------+------------+
|  ID  | breed | color |  name |    size    |    uuid    |
+------+-------+-------+-------+------------+------------+
| 3210 |  lynx | black | dog-1 | large!!!!! | e30475ad-9 |
| 3220 |  lynx | black | dog-2 | large!!!!! | e30475ad-9 |
| 3230 |  lynx | black | dog-3 | large!!!!! | e30475ad-9 |
+------+-------+-------+-------+------------+------------+

1 个答案:

答案 0 :(得分:1)

pdb只是一个普通的模块,作为标准库的一部分提供。因此,您只需查看本地lib文件夹即可找到pdb.py来源。

当然,您也可以在线查看,例如在Python source repository