1

I am trying to find my way around some inherited code. I have found a complied file called:

filename.cpython-35m-x86_64-linux-gnu.so

From what file type (.py, .cpp, .pdx) this file was complied from? Is there also any documentation around the meaning of each part of cpython-35m-x86_64-linux-gnu.so?

halfer
  • 19,824
  • 17
  • 99
  • 186
Stacey
  • 4,825
  • 17
  • 58
  • 99

1 Answers1

4

This file is a cpython extension (from the conventional name). Depending on the technologies at play it could be generated from nearly any type of file with the correct tooling, though it most commonly is a .c extension. Common others are .cpp (for c++ code) and .pyx (for cython modules). As an example of an uncommon file type that could produce a c extensions, I've written setuptools-golang which produces such files from .go source.

The second part of your question is what each of those portions of the extension mean. This is outlined in PEP 3149 though I'll explain each part here. Each is separated by dashes (-), I'll explain each of them separately:

  • cpython: this is the "implementation". in this case it means you're using the most popular implementation of python that is implemented in C python/cpython. Another example "implementation" you might see here is pypy3 (for the 3.x flavor of pypy)
  • 35m: this is the first part of the "application binary interface" marker, in this case it is saying this is python3.5 and the m is indicating that python was compiled using pymalloc
  • x86_64: this part of the abi is indicating it was compiled for a 64 bit architecture, also known as amd64
  • linux-gnu: this indicates that the shared object targets linux
anthony sottile
  • 61,815
  • 15
  • 148
  • 207