Skip to content

Commit 7b91da6

Browse files
committed
Rename variables to _PY_IMPL_NAME and _PY_IMPL_CACHE_TAG
1 parent e3c8c57 commit 7b91da6

2 files changed

Lines changed: 14 additions & 11 deletions

File tree

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
Enables patching the ``TAG`` preprocessor definition to override
2-
:data:`sys.implementation.cache_tag <sys.implementation>` at build time.
3-
Setting it to ``NULL`` has the effect of completely disabling automatic
4-
creation and use of ``.pyc`` files.
1+
Enables defining the ``_PY_IMPL_NAME`` and ``_PY_IMPL_CACHE_TAG`` preprocessor
2+
definitions to override :data:`sys.implementation` at build time. Definitions
3+
need to include quotes when setting to a string literal. Setting the cache tag
4+
to ``NULL`` has the effect of completely disabling automatic creation and use of
5+
``.pyc`` files.

Python/sysmodule.c

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3568,18 +3568,20 @@ make_version_info(PyThreadState *tstate)
35683568
}
35693569

35703570
/* sys.implementation values */
3571-
#define NAME "cpython"
3572-
const char *_PySys_ImplName = NAME;
3571+
#ifndef _PY_IMPL_NAME
3572+
#define _PY_IMPL_NAME "cpython"
3573+
#endif
3574+
const char *_PySys_ImplName = _PY_IMPL_NAME;
3575+
#ifndef _PY_IMPL_CACHE_TAG
35733576
#define MAJOR Py_STRINGIFY(PY_MAJOR_VERSION)
35743577
#define MINOR Py_STRINGIFY(PY_MINOR_VERSION)
3575-
#ifndef TAG
3576-
#define TAG NAME "-" MAJOR MINOR
3578+
#define _PY_IMPL_CACHE_TAG NAME "-" MAJOR MINOR
35773579
#endif
3578-
const char *_PySys_ImplCacheTag = TAG;
3579-
#undef NAME
3580+
const char *_PySys_ImplCacheTag = _PY_IMPL_CACHE_TAG;
3581+
#ifndef _PY_IMPL_CACHE_TAG
35803582
#undef MAJOR
35813583
#undef MINOR
3582-
#undef TAG
3584+
#endif
35833585

35843586
static PyObject *
35853587
make_impl_info(PyObject *version_info)

0 commit comments

Comments
 (0)