Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv22540 Modified Files: pythonrun.c Log Message: If we have a filename and __main__.__file__ hasn't already been set, set it. Closes SF issue #624729. Index: pythonrun.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/pythonrun.c,v retrieving revision 2.167 retrieving revision 2.168 diff -C2 -d -r2.167 -r2.168 *** pythonrun.c 5 Oct 2002 01:47:34 -0000 2.167 --- pythonrun.c 17 Oct 2002 21:24:58 -0000 2.168 *************** *** 676,679 **** --- 676,689 ---- return -1; d = PyModule_GetDict(m); + if (PyDict_GetItemString(d, "__file__") == NULL) { + PyObject *f = PyString_FromString(filename); + if (f == NULL) + return -1; + if (PyDict_SetItemString(d, "__file__", f) < 0) { + Py_DECREF(f); + return -1; + } + Py_DECREF(f); + } ext = filename + strlen(filename) - 4; if (maybe_pyc_file(fp, filename, ext, closeit)) { *************** *** 681,685 **** if (closeit) fclose(fp); ! if( (fp = fopen(filename, "rb")) == NULL ) { fprintf(stderr, "python: Can't reopen .pyc file\n"); return -1; --- 691,695 ---- if (closeit) fclose(fp); ! if ((fp = fopen(filename, "rb")) == NULL) { fprintf(stderr, "python: Can't reopen .pyc file\n"); return -1;
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4