aboutsummaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorAndrew McNulty <amcn102@gmail.com>2023-04-24 09:52:28 +0200
committerEli Schwartz <eschwartz93@gmail.com>2023-08-14 20:02:09 -0400
commitc7308076966c1c55bc117ce9f7a7f49ac96acfa6 (patch)
tree826fcf546090c3a5155c1d730d34033563038d98 /docs
parent9d323020321893093492bc7d538c311c61398a1e (diff)
downloadmeson-c7308076966c1c55bc117ce9f7a7f49ac96acfa6.zip
meson-c7308076966c1c55bc117ce9f7a7f49ac96acfa6.tar.gz
meson-c7308076966c1c55bc117ce9f7a7f49ac96acfa6.tar.bz2
Python: Add 'limited_api' kwarg to extension_module
This commit adds a new keyword arg to extension_module() that enables a user to target the Python Limited API, declaring the version of the limited API that they wish to target. Two new unittests have been added to test this functionality.
Diffstat (limited to 'docs')
-rw-r--r--docs/markdown/Builtin-options.md17
-rw-r--r--docs/markdown/Python-module.md5
-rw-r--r--docs/markdown/snippets/python_extension_module_limited_api.md5
3 files changed, 21 insertions, 6 deletions
diff --git a/docs/markdown/Builtin-options.md b/docs/markdown/Builtin-options.md
index fed893e..ca4fd14 100644
--- a/docs/markdown/Builtin-options.md
+++ b/docs/markdown/Builtin-options.md
@@ -370,12 +370,13 @@ install prefix. For example: if the install prefix is `/usr` and the
### Python module
-| Option | Default value | Possible values | Description |
-| ------ | ------------- | ----------------- | ----------- |
-| bytecompile | 0 | integer from -1 to 2 | What bytecode optimization level to use (Since 1.2.0) |
-| install_env | prefix | {auto,prefix,system,venv} | Which python environment to install to (Since 0.62.0) |
-| platlibdir | | Directory path | Directory for site-specific, platform-specific files (Since 0.60.0) |
-| purelibdir | | Directory path | Directory for site-specific, non-platform-specific files (Since 0.60.0) |
+| Option | Default value | Possible values | Description |
+| ------ | ------------- | ----------------- | ----------- |
+| bytecompile | 0 | integer from -1 to 2 | What bytecode optimization level to use (Since 1.2.0) |
+| install_env | prefix | {auto,prefix,system,venv} | Which python environment to install to (Since 0.62.0) |
+| platlibdir | | Directory path | Directory for site-specific, platform-specific files (Since 0.60.0) |
+| purelibdir | | Directory path | Directory for site-specific, non-platform-specific files (Since 0.60.0) |
+| allow_limited_api | true | true, false | Disables project-wide use of the Python Limited API (Since 1.3.0) |
*Since 0.60.0* The `python.platlibdir` and `python.purelibdir` options are used
by the python module methods `python.install_sources()` and
@@ -405,3 +406,7 @@ python bytecode. Bytecode has 3 optimization levels:
To this, Meson adds level `-1`, which is to not attempt to compile bytecode at
all.
+
+*Since 1.3.0* The `python.allow_limited_api` option affects whether the
+`limited_api` keyword argument of the `extension_module` method is respected.
+If set to `false`, the effect of the `limited_api` argument is disabled.
diff --git a/docs/markdown/Python-module.md b/docs/markdown/Python-module.md
index f67262a..05ae57d 100644
--- a/docs/markdown/Python-module.md
+++ b/docs/markdown/Python-module.md
@@ -101,6 +101,11 @@ the addition of the following:
`/usr/lib/site-packages`. When subdir is passed to this method,
it will be appended to that location. This keyword argument is
mutually exclusive with `install_dir`
+- `limited_api`: *since 1.3.0* A string containing the Python version
+ of the [Py_LIMITED_API](https://docs.python.org/3/c-api/stable.html) that
+ the extension targets. For example, '3.7' to target Python 3.7's version of
+ the limited API. This behavior can be disabled by setting the value of
+ `python.allow_limited_api`. See [Python module options](Builtin-options.md#python-module).
Additionally, the following diverge from [[shared_module]]'s default behavior:
diff --git a/docs/markdown/snippets/python_extension_module_limited_api.md b/docs/markdown/snippets/python_extension_module_limited_api.md
new file mode 100644
index 0000000..f5da969
--- /dev/null
+++ b/docs/markdown/snippets/python_extension_module_limited_api.md
@@ -0,0 +1,5 @@
+## Support targeting Python's limited C API
+
+The Python module's `extension_module` function has gained the ability
+to build extensions which target Python's limited C API via a new keyword
+argument: `limited_api`.