2013年4月16日
摘要: Py***_Type这些都是结构体PyTypeObject的实例。以PyLong_Type为例来说明:(1)变量声明在Include/longobject.h中:PyAPI_DATA(PyTypeObject) PyLong_Type;注意:PyAPI_DATA是一个宏,定义在Include/pyport.h,用来隐藏动态库平台的差异,片段如下:#define PyAPI_FUNC(RTYPE) __declspec(dllexport) RTYPE#define PyAPI_DATA(RTYPE) extern __declspec(dllexport) RTYPE(2)变量定义在Objec 阅读全文
posted @ 2013-04-16 21:34 101010 阅读(1170) 评论(1) 推荐(0) 编辑
摘要: Include/object.h:摘录 1 /* Object and type object interface */ 2 3 /* 4 Objects are structures allocated on the heap. Special rules apply to 5 the use of objects to ensure they are properly garbage-collected. 6 Objects are never allocated statically or on the stack; they must be 7 accessed through sp. 阅读全文
posted @ 2013-04-16 18:33 101010 阅读(2886) 评论(0) 推荐(0) 编辑
摘要: 地址:http://docs.python.org/3.3/c-api/structures.htmlThere are a large number of structures which are used in the definition of object types for Python. This section describes these structures and how they are used.All Python objects ultimately share a small number of fields at the beginning of the ob 阅读全文
posted @ 2013-04-16 17:40 101010 阅读(362) 评论(0) 推荐(0) 编辑
摘要: 阅读全文
posted @ 2013-04-16 14:21 101010 阅读(967) 评论(0) 推荐(0) 编辑
摘要: 本文以Python3为例说明:下载后的Python-3.3.1.tar.bz2,解压缩后,可以看到的源码的目录结构:目录的含义如下:Include:该目录中包含了Python提供的所有头文件。如果自己要用C或者C++来编写自定义模块扩展Python,那么就需要用到这里提供的头文件。Lib:该目录包中含了Python自带的所有标准库。Lib中的库都是用Python语言编写的。Modules:该目录中包含了所有用C编写的模块,比如random等。Modules中的模块是那些对速度要求非常严格的模块,而一些对速度没有太严格要求的模块,比如os,就是用Python编写的,并且放在Lib目录下。Pars 阅读全文
posted @ 2013-04-16 13:53 101010 阅读(4283) 评论(0) 推荐(0) 编辑
摘要: 1.首先从python.org上:http://www.python.org/download/,下载python源码压缩包:Python-3.3.1.tar.bz22.解压后目录结构大致如下:3.进入PCbuild目录,打开pcbuild.sln文件4.设置属性,首先设置“普通属性”中的“启动项目”,选择“单一启动项目”为“python”:然后,再设置“配置属性”,只编译python和pythoncore两项,其他的去除掉,并且依据你具体的平台选择是W32还是X64的:5.编译make_buildinfo和make_versioninfo:6.最后编译此解决方案,然后依据你的编译配置(Deb 阅读全文
posted @ 2013-04-16 13:11 101010 阅读(6679) 评论(0) 推荐(0) 编辑