mirror of
https://github.com/python/cpython.git
synced 2025-08-22 09:45:06 +00:00
Add sys.getandroidapilevel()
Issue #28740: Add sys.getandroidapilevel(): return the build time API version of Android as an integer. Function only available on Android.
This commit is contained in:
parent
edfe8869c8
commit
d6958ac6c0
5 changed files with 44 additions and 2 deletions
|
@ -1363,6 +1363,20 @@ PyDoc_STRVAR(is_finalizing_doc,
|
|||
Return True if Python is exiting.");
|
||||
|
||||
|
||||
#ifdef ANDROID_API_LEVEL
|
||||
PyDoc_STRVAR(getandroidapilevel_doc,
|
||||
"getandroidapilevel()\n\
|
||||
\n\
|
||||
Return the build time API version of Android as an integer.");
|
||||
|
||||
static PyObject *
|
||||
sys_getandroidapilevel(PyObject *self)
|
||||
{
|
||||
return PyLong_FromLong(ANDROID_API_LEVEL);
|
||||
}
|
||||
#endif /* ANDROID_API_LEVEL */
|
||||
|
||||
|
||||
static PyMethodDef sys_methods[] = {
|
||||
/* Might as well keep this in alphabetic order */
|
||||
{"callstats", (PyCFunction)sys_callstats, METH_NOARGS,
|
||||
|
@ -1447,6 +1461,10 @@ static PyMethodDef sys_methods[] = {
|
|||
METH_VARARGS | METH_KEYWORDS, set_asyncgen_hooks_doc},
|
||||
{"get_asyncgen_hooks", sys_get_asyncgen_hooks, METH_NOARGS,
|
||||
get_asyncgen_hooks_doc},
|
||||
#ifdef ANDROID_API_LEVEL
|
||||
{"getandroidapilevel", (PyCFunction)sys_getandroidapilevel, METH_NOARGS,
|
||||
getandroidapilevel_doc},
|
||||
#endif
|
||||
{NULL, NULL} /* sentinel */
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue