diff options
Diffstat (limited to 'Python/sysmodule.c')
| -rw-r--r-- | Python/sysmodule.c | 103 | 
1 files changed, 3 insertions, 100 deletions
| diff --git a/Python/sysmodule.c b/Python/sysmodule.c index 5664646..fdf361f 100644 --- a/Python/sysmodule.c +++ b/Python/sysmodule.c @@ -1177,7 +1177,6 @@ PySys_AddXOption(const wchar_t *s)      PyObject *opts;      PyObject *name = NULL, *value = NULL;      const wchar_t *name_end; -    int r;      opts = get_xoptions();      if (opts == NULL) @@ -1195,7 +1194,7 @@ PySys_AddXOption(const wchar_t *s)      }      if (name == NULL || value == NULL)          goto error; -    r = PyDict_SetItem(opts, name, value); +    PyDict_SetItem(opts, name, value);      Py_DECREF(name);      Py_DECREF(value);      return; @@ -1257,7 +1256,6 @@ int_info -- a struct sequence with information about the int implementation.\n\  maxsize -- the largest supported length of containers.\n\  maxunicode -- the largest supported character\n\  builtin_module_names -- tuple of module names built into this interpreter\n\ -subversion -- subversion information of the build as tuple\n\  version -- the version of this interpreter as a string\n\  version_info -- version information as a named tuple\n\  hexversion -- version information encoded as a single integer\n\ @@ -1305,95 +1303,6 @@ settrace() -- set the global debug tracing function\n\  )  /* end of sys_doc */ ; -/* Subversion branch and revision management */ -static const char _patchlevel_revision[] = PY_PATCHLEVEL_REVISION; -static const char headurl[] = "$HeadURL$"; -static int svn_initialized; -static char patchlevel_revision[50]; /* Just the number */ -static char branch[50]; -static char shortbranch[50]; -static const char *svn_revision; - -static void -svnversion_init(void) -{ -    const char *python, *br_start, *br_end, *br_end2, *svnversion; -    Py_ssize_t len; -    int istag = 0; - -    if (svn_initialized) -        return; - -    python = strstr(headurl, "/python/"); -    if (!python) { -        strcpy(branch, "unknown branch"); -        strcpy(shortbranch, "unknown"); -    } -    else { -        br_start = python + 8; -        br_end = strchr(br_start, '/'); -        assert(br_end); - -        /* Works even for trunk, -           as we are in trunk/Python/sysmodule.c */ -        br_end2 = strchr(br_end+1, '/'); - -        istag = strncmp(br_start, "tags", 4) == 0; -        if (strncmp(br_start, "trunk", 5) == 0) { -            strcpy(branch, "trunk"); -            strcpy(shortbranch, "trunk"); -        } -        else if (istag || strncmp(br_start, "branches", 8) == 0) { -            len = br_end2 - br_start; -            strncpy(branch, br_start, len); -            branch[len] = '\0'; - -            len = br_end2 - (br_end + 1); -            strncpy(shortbranch, br_end + 1, len); -            shortbranch[len] = '\0'; -        } -        else { -            Py_FatalError("bad HeadURL"); -            return; -        } -    } - - -    svnversion = _Py_svnversion(); -    if (strcmp(svnversion, "Unversioned directory") != 0 && strcmp(svnversion, "exported") != 0) -        svn_revision = svnversion; -    else if (istag) { -        len = strlen(_patchlevel_revision); -        assert(len >= 13); -        assert(len < (sizeof(patchlevel_revision) + 13)); -        strncpy(patchlevel_revision, _patchlevel_revision + 11, -            len - 13); -        patchlevel_revision[len - 13] = '\0'; -        svn_revision = patchlevel_revision; -    } -    else -        svn_revision = ""; - -    svn_initialized = 1; -} - -/* Return svnversion output if available. -   Else return Revision of patchlevel.h if on branch. -   Else return empty string */ -const char* -Py_SubversionRevision() -{ -    svnversion_init(); -    return svn_revision; -} - -const char* -Py_SubversionShortBranch() -{ -    svnversion_init(); -    return shortbranch; -} -  PyDoc_STRVAR(flags__doc__,  "sys.flags\n\ @@ -1404,7 +1313,6 @@ static PyTypeObject FlagsType;  static PyStructSequence_Field flags_fields[] = {      {"debug",                   "-d"}, -    {"division_warning",        "-Q"},      {"inspect",                 "-i"},      {"interactive",             "-i"},      {"optimize",                "-O or -OO"}, @@ -1428,9 +1336,9 @@ static PyStructSequence_Desc flags_desc = {      flags__doc__,       /* doc */      flags_fields,       /* fields */  #ifdef RISCOS -    13 -#else      12 +#else +    11  #endif  }; @@ -1448,7 +1356,6 @@ make_flags(void)      PyStructSequence_SET_ITEM(seq, pos++, PyLong_FromLong(flag))      SetFlag(Py_DebugFlag); -    SetFlag(Py_DivisionWarningFlag);      SetFlag(Py_InspectFlag);      SetFlag(Py_InteractiveFlag);      SetFlag(Py_OptimizeFlag); @@ -1597,10 +1504,6 @@ _PySys_Init(void)                           PyUnicode_FromString(Py_GetVersion()));      SET_SYS_FROM_STRING("hexversion",                           PyLong_FromLong(PY_VERSION_HEX)); -    svnversion_init(); -    SET_SYS_FROM_STRING("subversion", -                        Py_BuildValue("(sss)", "CPython", branch, -                                      svn_revision));      SET_SYS_FROM_STRING("_mercurial",                          Py_BuildValue("(szz)", "CPython", _Py_hgidentifier(),                                        _Py_hgversion())); | 
