「Cython」とは異なります。
CPython
作者グイド・ヴァンロッサム
開発元Python Software Foundation
初版1991年4月 (33年前) (1991-04)
最新版3.12.3 / 2024年4月9日 (40日前) (2024-04-09)
最新評価版3.13.0a6 / 2024年4月9日 (40日前) (2024-04-09)
リポジトリ
github.com/python/cpython
CPython は、Pythonのリファレンス実装である。CPython は C言語で記述されている。CPython 以外に、製品としての品質をもつ Python 実装はJava で記述された Jython、共通言語ランタイム 用に記述された IronPython の2つがあり、またいくつかの実験的な実装もある。Classic Python というバクロニムが、'C' の別の意味として提案されている。
CPython はバイトコードインタプリタである。C を含むいくつかの言語での外部関数インターフェイスを持っており、Python 以外の言語の言語バインディングを明示的に書く場合に使用される。 PEP 11 Python Software Foundation
サポートされているプラットフォーム
UNIX / Unix系
AIX
BSD
Darwin
macOS
FreeBSD
HP-UX
IRIX 5 以上
Plan 9 from Bell Labs
NetBSD
Linux
OpenBSD
Solaris
Tru64 UNIX
その他の Unix
デスクトップオペレーティングシステム
AROS
AtheOS
BeOS
Windows
Windows NT
OS/2
RISC OS
特殊用途、組み込み
GP2X
iPodLinux
ニンテンドーDS
ニンテンドーゲームキューブ
Nokia 770 Internet Tablet
Nokia N800
Nokia N810
Palm OS
PlayStation 2
PlayStation 3 (Linux)
PSION
QNX
Sharp ザウルス
Xbox/Xbmc
VxWorks
メインフレームなど
OS/390
VMS
z/OS
かつてサポートされていたプラットフォーム
DOS (2.0以降非サポート)
IRIX 4 (2.3以降非サポート)
Mac OS 9 (2.4以降非サポート)
MINIX (2.3以降非サポート)
非公式の移植版
移植版には、PSP 用のグラフィックスやサウンド API や S60 用の SMS やカメラ API などのプラットフォーム固有の機能のための拡張モジュールが提供されることが多い。 マルチプロセッサのコンピュータで CPython を用いる際の大きな問題は、各 CPython インタプリタのプロセスが持つグローバルインタプリタロック(GIL)であり、これがプロセス内の Python スレッドの並列性を損なってしまう[1]。 マルチプロセッサ環境で完全な並列性を実現するためには別の CPython プロセスを動作させる必要がある。一般的にプロセス間の通信を実現することは困難な作業となるが、CPythonでは標準ライブラリを使い容易に実現させることが可能である[2]。CPython から GIL を取り除くことについては常に議論が行われている[3]。 Pythonにおけるバイトコード(英: bytecode)はCPythonが内部的に利用する中間表現である[4]。 CPythonではPythonコードをバイトコードへコンパイルし、このバイトコードをインタープリタによって実行する[5]。コードからバイトコードへのコンパイル結果は .pyc ファイルとしてキャッシュされ、二度目以降の実行時にはリコンパイル無しにバイトコードが実行される[6]。 バイトコードはあくまでCPythonの内部表現/実装詳細であり、CPythonのバージョン間や他Python実行環境との互換性は保証されない[7][8]。
Amiga ⇒[1]
AS/400 ⇒[2]
DOS (DJGPPを使用) ⇒[3]
PlayStation Portable ⇒[4]
Symbian OS ⇒[5]
Windows CE/Pocket PC ⇒[6]
並列性に関する問題
バイトコード
脚注[脚注の使い方]^ Python/C API Reference Manual: Thread State and the Global Interpreter Lock
^ PEP 371 -- Addition of the multiprocessing package to the standard library
^ Python Library and Extension FAQ: Can't we get rid of the Global Interpreter Lock?
^ "bytecode ... the internal representation of a Python program in the CPython interpreter." Python. bytecode - Glossary. Python 3.11.5 Documentation. 2023-09-01閲覧.
^ "Python source code is compiled into bytecode ... This 'intermediate language' is said to run on a virtual machine" Python. bytecode - Glossary. Python 3.11.5 Documentation. 2023-09-01閲覧.
^ "The bytecode is also cached in .pyc files so that executing the same file is faster the second time (recompilation from source to bytecode can be avoided)." Python. bytecode - Glossary. Python 3.11.5 Documentation. 2023-09-01閲覧.
^ "Do note that bytecodes are not expected to work between different Python virtual machines, nor to be stable between Python releases." Python. bytecode - Glossary. Python 3.11.5 Documentation. 2023-09-01閲覧.
^ "CPython implementation detail: Bytecode is an implementation detail of the CPython interpreter." Python. dis ? Disassembler for Python bytecode. Python 3.11.5 Documentation. 2023-09-01閲覧.
参考文献
Martelli, Alex (2006). Python in a Nutshell (2nd edition ed.). O'Reilly. pp. 5?7. ISBN 0-596-10046-9
表
話
編
歴
Python
実装
ChinesePython
CLPython