Coverage Report

Created: 2026-06-14 06:25

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/Python-3.8.3/Modules/getbuildinfo.c
Line
Count
Source
1
#include "Python.h"
2
3
#ifndef DONT_HAVE_STDIO_H
4
#include <stdio.h>
5
#endif
6
7
#ifndef DATE
8
#ifdef __DATE__
9
13
#define DATE __DATE__
10
#else
11
#define DATE "xx/xx/xx"
12
#endif
13
#endif
14
15
#ifndef TIME
16
#ifdef __TIME__
17
13
#define TIME __TIME__
18
#else
19
#define TIME "xx:xx:xx"
20
#endif
21
#endif
22
23
/* XXX Only unix build process has been tested */
24
#ifndef GITVERSION
25
#define GITVERSION ""
26
#endif
27
#ifndef GITTAG
28
#define GITTAG ""
29
#endif
30
#ifndef GITBRANCH
31
#define GITBRANCH ""
32
#endif
33
34
const char *
35
Py_GetBuildInfo(void)
36
13
{
37
13
    static char buildinfo[50 + sizeof(GITVERSION) +
38
13
                          ((sizeof(GITTAG) > sizeof(GITBRANCH)) ?
39
13
                           sizeof(GITTAG) : sizeof(GITBRANCH))];
40
13
    const char *revision = _Py_gitversion();
41
13
    const char *sep = *revision ? ":" : "";
42
13
    const char *gitid = _Py_gitidentifier();
43
13
    if (!(*gitid))
44
13
        gitid = "default";
45
13
    PyOS_snprintf(buildinfo, sizeof(buildinfo),
46
13
                  "%s%s%s, %.20s, %.9s", gitid, sep, revision,
47
13
                  DATE, TIME);
48
13
    return buildinfo;
49
13
}
50
51
const char *
52
_Py_gitversion(void)
53
26
{
54
26
    return GITVERSION;
55
26
}
56
57
const char *
58
_Py_gitidentifier(void)
59
26
{
60
26
    const char *gittag, *gitid;
61
26
    gittag = GITTAG;
62
26
    if ((*gittag) && strcmp(gittag, "undefined") != 0)
63
0
        gitid = gittag;
64
26
    else
65
26
        gitid = GITBRANCH;
66
26
    return gitid;
67
26
}