Mercurial > cpython-lru_cache-weakref
comparison Python/pythonrun.c @ 86979:e9a865620788
print_exception(): don't encode the module name to UTF-8
Replace _PyUnicode_AsString()+strcmp() with PyUnicode_CompareWithASCIIString().
| author | Victor Stinner <victor.stinner@gmail.com> |
|---|---|
| date | Thu, 07 Nov 2013 00:12:30 +0100 |
| parents | 954167ce92a3 |
| children | 77bebcf5c4cf |
comparison
equal
deleted
inserted
replaced
| 86978:6a1ce1fd1fc0 | 86979:e9a865620788 |
|---|---|
| 1926 { | 1926 { |
| 1927 Py_XDECREF(moduleName); | 1927 Py_XDECREF(moduleName); |
| 1928 err = PyFile_WriteString("<unknown>", f); | 1928 err = PyFile_WriteString("<unknown>", f); |
| 1929 } | 1929 } |
| 1930 else { | 1930 else { |
| 1931 char* modstr = _PyUnicode_AsString(moduleName); | 1931 if (PyUnicode_CompareWithASCIIString(moduleName, "builtins") != 0) |
| 1932 if (modstr && strcmp(modstr, "builtins")) | |
| 1933 { | 1932 { |
| 1934 err = PyFile_WriteString(modstr, f); | 1933 err = PyFile_WriteObject(moduleName, f, Py_PRINT_RAW); |
| 1935 err += PyFile_WriteString(".", f); | 1934 err += PyFile_WriteString(".", f); |
| 1936 } | 1935 } |
| 1937 Py_DECREF(moduleName); | 1936 Py_DECREF(moduleName); |
| 1938 } | 1937 } |
| 1939 if (err == 0) { | 1938 if (err == 0) { |
