summaryrefslogtreecommitdiffstats
path: root/Modules/main.c
Commit message (Collapse)AuthorAgeFilesLines
* #16306: report only the first unknown option and add more tests. Patch by ↵Ezio Melotti2012-11-231-0/+1
| | | | Serhiy Storchaka.
* Fix for issue 15716: interpreter could crash when PYTHONEXECUTABLE was set ↵Ronald Oussoren2012-08-221-1/+1
| | | | | | | on Mac OS X. This is due to an off-by-one error: the allocated buffer didn't have room for a NUL character at the end of the mbstowcs result.
* Fix issue # 15033 - Return the proper exitcode for failure when modules are ↵Senthil Kumaran2012-07-051-1/+1
| | | | invoked using -m switch. Patch contributed by Jeff Knupp
* merge with 3.2Georg Brandl2012-02-211-3/+3
|\
| * Remove reST markup from --help output. Also: O(n**2) is dict construction, ↵Georg Brandl2012-02-211-3/+3
| | | | | | | | not single insertion.
* | Fix test failure in test_cmd_line by initializing the hash secret at the ↵Antoine Pitrou2012-02-211-2/+28
| | | | | | | | earliest point.
* | Merge from 3.1: Issue #13703: add a way to randomize the hash values of ↵Georg Brandl2012-02-201-3/+17
|\ \ | |/ | | | | | | | | | | | | | | basic types (str, bytes, datetime) in order to make algorithmic complexity attacks on (e.g.) web apps much more complicated. The environment variable PYTHONHASHSEED and the new command line flag -R control this behavior.
| * Issue #13703: add a way to randomize the hash values of basic types (str, ↵Georg Brandl2012-02-201-1/+15
| | | | | | | | | | | | | | | | | | bytes, datetime) in order to make algorithmic complexity attacks on (e.g.) web apps much more complicated. The environment variable PYTHONHASHSEED and the new command line flag -R control this behavior.
| * Merged revisions 87991 via svnmerge fromEli Bendersky2011-01-141-1/+0
| | | | | | | | | | | | | | | | | | | | svn+ssh://pythondev@svn.python.org/python/branches/py3k ........ r87991 | eli.bendersky | 2011-01-14 09:31:14 +0200 (Fri, 14 Jan 2011) | 2 lines Remove call to nonexisting function (relic from Python 2.x) under #ifdef __INSURE__. Issue 9844 ........
| * Merged revisions 81250-81253 via svnmerge fromVictor Stinner2010-05-171-4/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | svn+ssh://pythondev@svn.python.org/python/branches/py3k ........ r81250 | victor.stinner | 2010-05-17 03:13:37 +0200 (lun., 17 mai 2010) | 2 lines Issue #6697: Fix a crash if code of "python -c code" contains surrogates ........ r81251 | victor.stinner | 2010-05-17 03:26:01 +0200 (lun., 17 mai 2010) | 3 lines PyObject_Dump() encodes unicode objects to utf8 with backslashreplace (instead of strict) error handler to escape surrogates ........ r81252 | victor.stinner | 2010-05-17 10:58:51 +0200 (lun., 17 mai 2010) | 6 lines handle_system_exit() flushs files to warranty the output order PyObject_Print() writes into the C object stderr, whereas PySys_WriteStderr() writes into the Python object sys.stderr. Each object has its own buffer, so call sys.stderr.flush() and fflush(stderr). ........ r81253 | victor.stinner | 2010-05-17 11:33:42 +0200 (lun., 17 mai 2010) | 6 lines Fix refleak in internal_print() introduced by myself in r81251 _PyUnicode_AsDefaultEncodedString() uses a magical PyUnicode attribute to automatically destroy PyUnicode_EncodeUTF8() result when the unicode string is destroyed. ........
| * Recorded merge of revisions 81032 via svnmerge fromAntoine Pitrou2010-05-091-483/+483
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | svn+ssh://pythondev@svn.python.org/python/branches/py3k ................ r81032 | antoine.pitrou | 2010-05-09 17:52:27 +0200 (dim., 09 mai 2010) | 9 lines Recorded merge of revisions 81029 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r81029 | antoine.pitrou | 2010-05-09 16:46:46 +0200 (dim., 09 mai 2010) | 3 lines Untabify C files. Will watch buildbots. ........ ................
| * Merged revisions 78872 via svnmerge fromVictor Stinner2010-03-211-4/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | svn+ssh://pythondev@svn.python.org/python/branches/py3k ................ r78872 | victor.stinner | 2010-03-12 15:45:56 +0100 (ven., 12 mars 2010) | 12 lines Merged revisions 78826 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r78826 | victor.stinner | 2010-03-10 23:30:19 +0100 (mer., 10 mars 2010) | 5 lines Issue #3137: Don't ignore errors at startup, especially a keyboard interrupt (SIGINT). If an error occurs while importing the site module, the error is printed and Python exits. Initialize the GIL before importing the site module. ........ ................
| * Merged revisions 75571,75576-75577 via svnmerge fromAntoine Pitrou2009-10-201-29/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | svn+ssh://pythondev@svn.python.org/python/branches/py3k ................ r75571 | antoine.pitrou | 2009-10-20 23:52:47 +0200 (mar., 20 oct. 2009) | 11 lines Merged revisions 75570 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r75570 | antoine.pitrou | 2009-10-20 23:29:37 +0200 (mar., 20 oct. 2009) | 6 lines Issue #1722344: threading._shutdown() is now called in Py_Finalize(), which fixes the problem of some exceptions being thrown at shutdown when the interpreter is killed. Patch by Adam Olsen. ........ ................ r75576 | antoine.pitrou | 2009-10-21 00:02:29 +0200 (mer., 21 oct. 2009) | 10 lines Merged revisions 75574 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r75574 | antoine.pitrou | 2009-10-20 23:59:25 +0200 (mar., 20 oct. 2009) | 4 lines Test wouldn't work in debug mode. We probably need a function in test_support to handle this. ........ ................ r75577 | antoine.pitrou | 2009-10-21 00:05:38 +0200 (mer., 21 oct. 2009) | 3 lines Another futile error in the previous commit :-( ................
| * Merged revisions 74010,74034,74054 via svnmerge fromGeorg Brandl2009-08-131-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | svn+ssh://svn.python.org/python/branches/py3k ................ r74010 | r.david.murray | 2009-07-15 16:16:54 +0200 (Mi, 15 Jul 2009) | 2 lines PEP-8-ify r73389. ................ r74034 | alexandre.vassalotti | 2009-07-17 07:35:59 +0200 (Fr, 17 Jul 2009) | 2 lines The output() function takes only one string argument. ................ r74054 | alexandre.vassalotti | 2009-07-17 10:31:44 +0200 (Fr, 17 Jul 2009) | 14 lines Merged revisions 74051-74052 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r74051 | alexandre.vassalotti | 2009-07-17 03:54:23 -0400 (Fri, 17 Jul 2009) | 2 lines Initialize variables in PyCurses_getsyx() to avoid compiler warnings. ........ r74052 | alexandre.vassalotti | 2009-07-17 04:09:04 -0400 (Fri, 17 Jul 2009) | 3 lines Fix GCC warning about fprintf used without a string literal and without format arguments. ........ ................
* | Issue #10350: Read and save errno before calling a function which might ↵Antoine Pitrou2011-12-161-1/+2
| | | | | | | | | | | | overwrite it. Original patch by Hallvard B Furuseth.
* | Remove call to nonexisting function (relic from Python 2.x) under #ifdef ↵Eli Bendersky2011-01-141-1/+0
| | | | | | | | __INSURE__. Issue 9844
* | Issue #10841: set binary mode on files; the parser translates newlinesVictor Stinner2011-01-071-3/+6
| | | | | | | | | | | | On Windows, set the binary mode on stdin, stdout, stderr and all io.FileIO objects (to not translate newlines, \r\n <=> \n). The Python parser translates newlines (\r\n => \n).
* | Add sys.flags.quiet attribute for the new -q option, as noted missing by ↵Georg Brandl2010-12-281-3/+2
| | | | | | | | Eric in #1772833.
* | #1772833: add -q command line option.Georg Brandl2010-12-041-3/+10
| |
* | Remove redundant includes of headers that are already included by Python.h.Georg Brandl2010-11-301-1/+0
| |
* | PyUnicode_EncodeFS() raises an exception if _Py_wchar2char() failsVictor Stinner2010-11-081-1/+1
| | | | | | | | | | | | * Add error_pos optional argument to _Py_wchar2char() * PyUnicode_EncodeFS() raises a UnicodeEncodeError or MemoryError if _Py_wchar2char() fails
* | Issue #10089: Add support for arbitrary -X options on the command-line.Antoine Pitrou2010-10-211-3/+6
| | | | | | | | They can be retrieved through a new attribute `sys._xoptions`.
* | run_file(): encode the filename with PyUnicode_EncodeFSDefault() instead ofVictor Stinner2010-10-171-2/+2
| | | | | | | | PyUnicode_AsUTF8String()
* | Add an optional size argument to _Py_char2wchar()Victor Stinner2010-10-161-2/+4
| | | | | | | | | | | | _Py_char2wchar() callers usually need the result size in characters. Since it's trivial to compute it in _Py_char2wchar() (O(1) whereas wcslen() is O(n)), add an option to get it.
* | Py_Main() uses _Py_wchar2char() to encode the filename in error messagesVictor Stinner2010-10-141-11/+11
| |
* | Issue #9992: Remove PYTHONFSENCODING environment variable.Victor Stinner2010-10-131-3/+0
| |
* | Create fileutils.c/.hVictor Stinner2010-10-071-208/+0
| | | | | | | | | | | | | | * _Py_fopen() and _Py_stat() come from Python/import.c * (_Py)_wrealpath() comes from Python/sysmodule.c * _Py_char2wchar(), _Py_wchar2char() and _Py_wfopen() come from Modules/main.c * (_Py)_wstat(), (_Py)_wgetcwd(), _Py_wreadlink() come from Modules/getpath.c
* | Rewrite RunMainFromImporter()Victor Stinner2010-10-061-25/+35
| | | | | | | | | | | | | | | | | | * fix argv0 reference counter if PyList_SetItem() fails * don't use complex if conditions, but a simple indentation and "goto error" * simplify error handling (remove Py_XDECREF(importer) from the error label) * don't set sys_path to NULL (it's useless, sys_path is a borrowed reference and sys_path is not a static variable) * try to write only one instruction per line for better readability
* | Isse #8589: Decode PYTHONWARNINGS from utf-8 on Mac OS XVictor Stinner2010-09-121-2/+6
| | | | | | | | Instead of the locale encoding.
* | Issue #8589: surrogateescape error handler is not available at startupVictor Stinner2010-09-101-6/+11
| | | | | | | | | | Py_Main() uses _Py_wchar2char() + PyUnicode_FromWideChar() instead of PyUnicode_DecodeFSDefault(), because the PyCodec machinery is not ready yet.
* | PYTHONFSENCODING is not available on Windows or Mac OS XVictor Stinner2010-08-191-7/+9
| |
* | Improve error message if the command is not decodableVictor Stinner2010-08-181-0/+1
| |
* | Issue #8622: Add PYTHONFSENCODING environment variable to override theVictor Stinner2010-08-181-0/+1
| | | | | | | | | | | | filesystem encoding. initfsencoding() displays also a better error message if get_codeset() failed.
* | Issue #8202: Set sys.argv[0] to -m rather than -c while searching for the ↵Nick Coghlan2010-08-171-3/+2
| | | | | | | | module to execute. Also updates all the cmd_line_script tests to validate the setting of sys.path[0] and the current working directory
* | Create _Py_wchar2char() function, reverse of _Py_char2wchar()Victor Stinner2010-08-131-7/+87
| | | | | | | | | | * Use _Py_wchar2char() in _wstat() and _Py_wfopen() * Document _Py_char2wchar()
* | Reimplement addbuilddir() in C inside getpath.c, so as to execute itAntoine Pitrou2010-08-131-5/+7
| | | | | | | | | | at interpreter startup before importing any non-builtin modules. Should fix #9589.
* | Issue #9425: Create run_file() subfunctionVictor Stinner2010-08-071-24/+36
| | | | | | | | | | | | * Call Py_MakePendingCalls() before converting the filename from wchar_t* to char* * Use PyUnicode_AsUTF8String() instead of _PyUnicode_AsString()
* | Issue #9425: Create run_command() subfunctionVictor Stinner2010-08-071-15/+23
| | | | | | | | Use PyUnicode_AsUTF8String() instead of _PyUnicode_AsString()
* | Issue #8589: Decode PYTHONWARNINGS environment variable with the file systemVictor Stinner2010-05-191-4/+5
| | | | | | | | | | encoding and surrogateespace error handler instead of the locale encoding to be consistent with os.environ. Add PySys_AddWarnOptionUnicode() function.
* | Issue #6697: Fix a crash if code of "python -c code" contains surrogatesVictor Stinner2010-05-171-4/+8
| |
* | Recorded merge of revisions 81029 via svnmerge fromAntoine Pitrou2010-05-091-610/+610
| | | | | | | | | | | | | | | | | | | | svn+ssh://pythondev@svn.python.org/python/trunk ........ r81029 | antoine.pitrou | 2010-05-09 16:46:46 +0200 (dim., 09 mai 2010) | 3 lines Untabify C files. Will watch buildbots. ........
* | Move _Py_char2wchar from python.c to main.c.Ronald Oussoren2010-04-181-0/+104
| | | | | | | | | | | | | | This fixes issue #8441: python.c is not included in the framework while main.c is and without this patch you get a link error when building Python.framework on OSX.
* | strings from _Py_char2wchar need PyMem_FreePhilip Jenvey2010-04-141-1/+1
| |
* | #7301: decode $PYTHONWARNINGS in the same way as argv, test non-ascii valuesPhilip Jenvey2010-04-141-13/+35
| |
* | Merged revisions 79936 via svnmerge fromBenjamin Peterson2010-04-111-13/+18
| | | | | | | | | | | | | | | | | | | | | | svn+ssh://pythondev@svn.python.org/python/trunk ........ r79936 | philip.jenvey | 2010-04-10 15:27:15 -0500 (Sat, 10 Apr 2010) | 3 lines fix PYTHONWARNINGS handling to not modify the original env value and improve its tests ........
* | woops these strings aren't kept around, free themPhilip Jenvey2010-04-071-0/+1
| |
* | Merged revisions 79878-79880 via svnmerge fromPhilip Jenvey2010-04-071-0/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | svn+ssh://pythondev@svn.python.org/python/trunk ........ r79878 | philip.jenvey | 2010-04-06 16:24:45 -0700 (Tue, 06 Apr 2010) | 4 lines #7301: add the environment variable $PYTHONWARNINGS to supplement the -W command line option patch from Brian Curtin ........ r79879 | benjamin.peterson | 2010-04-06 16:32:27 -0700 (Tue, 06 Apr 2010) | 1 line tell people to update python.man, too ........ r79880 | philip.jenvey | 2010-04-06 16:38:57 -0700 (Tue, 06 Apr 2010) | 1 line document new PYTHONWARNINGS env var ........
* | Merged revisions 78826 via svnmerge fromVictor Stinner2010-03-121-4/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | svn+ssh://pythondev@svn.python.org/python/trunk ........ r78826 | victor.stinner | 2010-03-10 23:30:19 +0100 (mer., 10 mars 2010) | 5 lines Issue #3137: Don't ignore errors at startup, especially a keyboard interrupt (SIGINT). If an error occurs while importing the site module, the error is printed and Python exits. Initialize the GIL before importing the site module. ........
* | Merged revisions 75570 via svnmerge fromAntoine Pitrou2009-10-201-29/+0
| | | | | | | | | | | | | | | | | | | | | | | | svn+ssh://pythondev@svn.python.org/python/trunk ........ r75570 | antoine.pitrou | 2009-10-20 23:29:37 +0200 (mar., 20 oct. 2009) | 6 lines Issue #1722344: threading._shutdown() is now called in Py_Finalize(), which fixes the problem of some exceptions being thrown at shutdown when the interpreter is killed. Patch by Adam Olsen. ........
* | Merged revisions 74051-74052 via svnmerge fromAlexandre Vassalotti2009-07-171-3/+3
|/ | | | | | | | | | | | | | | svn+ssh://pythondev@svn.python.org/python/trunk ........ r74051 | alexandre.vassalotti | 2009-07-17 03:54:23 -0400 (Fri, 17 Jul 2009) | 2 lines Initialize variables in PyCurses_getsyx() to avoid compiler warnings. ........ r74052 | alexandre.vassalotti | 2009-07-17 04:09:04 -0400 (Fri, 17 Jul 2009) | 3 lines Fix GCC warning about fprintf used without a string literal and without format arguments. ........