This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Document best practice for including and linking python framework
Type: enhancement Stage: needs patch
Components: Documentation, macOS Versions: Python 3.11, Python 3.10
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: docs@python Nosy List: docs@python, ned.deily, ronaldoussoren
Priority: normal Keywords:

Created on 2021-12-06 15:00 by ronaldoussoren, last changed 2022-04-11 14:59 by admin.

Messages (1)
msg407821 - (view) Author: Ronald Oussoren (ronaldoussoren) * (Python committer) Date: 2021-12-06 15:00
There are two ways to develop against a Python.framework on MacOS:

1. Use the regular Unix pattern with "#include "Python.h", using compiler flags to select the right headers and libraries.

2. Using the native framework pattern with "#import <Python/Python.h>" and "-framework Python"

Both works, but the latter has the disadvantage of loosing control over which version of Python is used when multiple versions are installed.  The version is selected by the "Current" link in the framework, which is overwritten to point to whatever version was last installed or updated.

IMHO we should document this pitfall in the C API documentation.
History
Date User Action Args
2022-04-11 14:59:53adminsetgithub: 90156
2021-12-06 15:00:33ronaldoussorencreate