Fix Python – Difference between python3 and python3m executables

Question

Asked By – James Mishra

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.

Now we will see solution for issue: Difference between python3 and python3m executables


Answer

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.

This question is answered By – James Mishra

This answer is collected from stackoverflow and reviewed by FixPython community admins, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0