python3和python3m可执行文件之间的区别

问题:python3和python3m可执行文件之间的区别

是什么之间的区别/usr/bin/python3/usr/bin/python3mexecutibles?

我在Ubuntu 13.04上观察到了它们,但是Google建议它们也存在于其他发行版中。

这两个文件具有相同的md5sum,但似乎不是符号链接或硬链接。这两个文件返回的索引节点号不同,ls -li并且测试find -xdev -samefile /usr/bin/python3.3不返回任何其他文件。

有人在AskUbuntu上问了类似的问题,但我想更多地了解这两个文件之间的区别。

What is the difference between the /usr/bin/python3 and /usr/bin/python3m executibles?

I am observing them on Ubuntu 13.04, but Google suggests that they exist on other distributions too.

The two files have the same md5sum, but do not seem to be symbolic links or hard links; the two files have different inode numbers returned by ls -li and testing find -xdev -samefile /usr/bin/python3.3 does not return any other files.

Someone asked a similar question on AskUbuntu, but I wanted to find out more about the difference between the two files.


回答 0

值得称赞的chepner指出我已经拥有该解决方案的链接。

Python实现可以在文件名标签中适当地包含其他标志。例如,在POSIX系统上,这些标志也将有助于文件名:

–with-pydebug(标志:d)

–with-pymalloc(标志:m)

–with-wide-unicode(标志:u)

通过PEP 3149

关于m标志,这是Pymalloc的含义:

Pymalloc是由Vladimir Marangozov编写的专用对象分配器,它是Python 2.1中新增的一项功能。Pymalloc旨在比系统malloc()更快,并且对于Python程序典型的分配模式而言,具有较少的内存开销。分配器使用C的malloc()函数获取较大的内存池,然后从这些池执行较小的内存请求。

通过Python 2.3的新功能

最后,这两个文件可能在某些系统上被硬链接。虽然两个文件在我的Ubuntu 13.04系统上具有不同的inode编号(因此是不同的文件),但两年前comp.lang.python帖子显示它们曾经被硬链接过。

Credit for this goes to chepner for pointing out that I already had the link to the solution.

Python implementations MAY include additional flags in the file name tag as appropriate. For example, on POSIX systems these flags will also contribute to the file name:

–with-pydebug (flag: d)

–with-pymalloc (flag: m)

–with-wide-unicode (flag: u)

via PEP 3149.

Regarding the m flag specifically, this is what Pymalloc is:

Pymalloc, a specialized object allocator written by Vladimir Marangozov, was a feature added to Python 2.1. Pymalloc is intended to be faster than the system malloc() and to have less memory overhead for allocation patterns typical of Python programs. The allocator uses C’s malloc() function to get large pools of memory and then fulfills smaller memory requests from these pools.

via What’s New in Python 2.3

Finally, the two files may be hardlinked on some systems. While the two files have different inode numbers on my Ubuntu 13.04 system (thus are different files), a comp.lang.python post from two years ago shows that they once were hardlinked.