summaryrefslogtreecommitdiffstats
path: root/Python/pythonrun.c
Commit message (Collapse)AuthorAgeFilesLines
* Fix race condition in create_stdio()Victor Stinner2015-09-041-40/+35
| | | | | | | | Issue #24891: Fix a race condition at Python startup if the file descriptor of stdin (0), stdout (1) or stderr (2) is closed while Python is creating sys.stdin, sys.stdout and sys.stderr objects. These attributes are now set to None if the creation of the object failed, instead of raising an OSError exception. Initial patch written by Marco Paolini.
* Issue #24728: Fix building without threads.Berker Peksag2015-07-271-0/+4
| | | | Patch by Louis Dassy.
* Issue #23571: Fix reentrant call to Py_FatalError()Victor Stinner2015-03-251-17/+28
| | | | | | Flushing sys.stdout and sys.stderr in Py_FatalError() can call again Py_FatalError(). Add a reentrant flag to detect this case and just abort at the second call.
* Issue #23571: Py_FatalError() now tries to flush sys.stdout and sys.stderrVictor Stinner2015-03-241-4/+26
| | | | | It should help to see exceptions when stderr if buffered: PyErr_Display() calls sys.stderr.write(), it doesn't write into stderr file descriptor directly.
* Issue #23571: Enhance Py_FatalError()Victor Stinner2015-03-241-13/+60
| | | | | | | | | * Display the current Python stack if an exception was raised but the exception has no traceback * Disable faulthandler if an exception was raised (before it was only disabled if no exception was raised) * To display the current Python stack, call PyGILState_GetThisThreadState() which works even if the GIL was released
* Issue #21425: Fix flushing of standard streams in the interactive interpreter.Antoine Pitrou2014-05-111-1/+2
|
* Fixes for KFreeBSD and the Hurd:doko@ubuntu.com2014-04-171-0/+4
| | | | | | | | - Issue #21274: Define PATH_MAX for GNU/Hurd in Python/pythonrun.c. - Issue #21276: posixmodule: Don't define USE_XATTRS on KFreeBSD and the Hurd. - Issue #21275: Fix a socket test on KFreeBSD.
* Issue #20526, #19466: Revert changes of issue #19466 which introduces aVictor Stinner2014-02-131-15/+5
| | | | | regression: don't clear anymore the state of Python threads early during the Python shutdown.
* Close #20500: Don't trigger PyObject_Str assertion at shutdownNick Coghlan2014-02-091-0/+5
|
* Issue #2382: SyntaxError cursor "^" now is written at correct position in mostSerhiy Storchaka2014-01-211-2/+12
|\ | | | | | | | | cases when multibyte characters are in line (before "^"). This still not works correctly with wide East Asian characters.
| * Issue #2382: SyntaxError cursor "^" now is written at correct position in mostSerhiy Storchaka2014-01-211-2/+12
| | | | | | | | | | cases when multibyte characters are in line (before "^"). This still not works correctly with wide East Asian characters.
* | Issue #19817: Fix print_exception(), clear the exception on errorVictor Stinner2013-12-091-3/+5
| |
* | Closes #19831: Stop tracemalloc later at Python shutdown to be able to useVictor Stinner2013-12-011-0/+5
| | | | | | | | | | | | tracemalloc in objects destructor Replace atexit handler with an harcoded C function _PyTraceMalloc_Fini().
* | Issue #18874: Implement the PEP 454 (tracemalloc)Victor Stinner2013-11-231-0/+4
| |
* | ssue #19183: Implement PEP 456 'secure and interchangeable hash algorithm'.Christian Heimes2013-11-201-0/+3
| | | | | | | | Python now uses SipHash24 on all major platforms.
* | (Merge 3.3) pythonrun.c: fix Py_GetPythonHome(), use Py_ARRAY_LENGTH() to getVictor Stinner2013-11-151-2/+3
|\ \ | |/ | | | | | | the size of the env_home buffer, not PATH_MAX+1. env_home is declared using MAXPATHLEN+1, and PATH_MAX is not declared on IRIX.
| * pythonrun.c: fix Py_GetPythonHome(), use Py_ARRAY_LENGTH() to get the size ofVictor Stinner2013-11-151-2/+3
| | | | | | | | | | the env_home buffer, not PATH_MAX+1. env_home is declared using MAXPATHLEN+1, and PATH_MAX is not declared on IRIX.
* | Issue #19515: Remove identifiers duplicated in the same file.Victor Stinner2013-11-121-4/+2
| | | | | | | | Patch written by Andrei Dorian Duma.
* | Issue #19466: Fix typo. Patch written by Vajrasky Kok.Victor Stinner2013-11-121-1/+1
| |
* | Close #19466: Clear the frames of daemon threads earlier during the PythonVictor Stinner2013-11-121-5/+15
| | | | | | | | | | shutdown to call objects destructors. So "unclosed file" resource warnings are now corretly emitted for daemon threads.
* | Issue #19512, #19515: remove shared identifiers, move identifiers where theyVictor Stinner2013-11-071-25/+20
| | | | | | | | | | | | | | are used. Move also _Py_IDENTIFIER() defintions to the top in modified files to remove identifiers duplicated in the same file.
* | print_error_text() doesn't encode the filename anymoreVictor Stinner2013-11-071-27/+35
| | | | | | | | | | | | Use aslo PyUnicode_FromFormat() to format the line so only one call to PyFile_WriteObject() is needed. tb_displayline() of Python/traceback.c has similar implementation.
* | Issue #19512: add _PyUnicode_CompareWithId() functionVictor Stinner2013-11-061-1/+2
| | | | | | | | | | | | | | _PyUnicode_CompareWithId() is faster than PyUnicode_CompareWithASCIIString() when both strings are equal and interned. Add also _PyId_builtins identifier for "builtins" common string.
* | print_exception(): don't encode the module name to UTF-8Victor Stinner2013-11-061-3/+2
| | | | | | | | Replace _PyUnicode_AsString()+strcmp() with PyUnicode_CompareWithASCIIString().
* | Issue #19512: add some common identifiers to only create common strings once,Victor Stinner2013-11-061-22/+37
| | | | | | | | | | | | | | instead of creating temporary Unicode string objects Add also more identifiers in pythonrun.c to avoid temporary Unicode string objets for the interactive interpreter.
* | Issue #19512: Add PyRun_InteractiveOneObject() functionVictor Stinner2013-11-061-29/+82
| | | | | | | | | | Only decode the filename once. PyRun_InteractiveOneObject() uses an identifier for "<string>" string, so the byte string is only decoded once.
* | Issue #19512: _print_total_refs() now uses an identifier to get "showrefcount"Victor Stinner2013-11-061-6/+4
| | | | | | | | key from sys._xoptions
* | Issue #18603: Ensure that PyOS_mystricmp and PyOS_mystrnicmp are in theChristian Heimes2013-10-221-0/+4
|\ \ | |/ | | | | Python executable and not removed by the linker's optimizer.
| * Issue #18603: Ensure that PyOS_mystricmp and PyOS_mystrnicmp are in theChristian Heimes2013-10-221-0/+4
| | | | | | | | Python executable and not removed by the linker's optimizer.
* | Issue #16129: Py_SetStandardStreamEncoding cleanupsNick Coghlan2013-10-181-4/+9
| | | | | | | | | | | | | | | | | | - don't call PyErr_NoMemory with interpreter is not initialised - note that it's OK to call _PyMem_RawStrDup here - don't include this in the limited API - capitalise "IO" - be explicit that a non-zero return indicates an error - include versionadded marker in docs
* | Issue #16129: Add `Py_SetStandardStreamEncoding`Nick Coghlan2013-10-171-16/+65
| | | | | | | | | | | | | | | | | | | | | | This new pre-initialization API allows embedding applications like Blender to force a particular encoding and error handler for the standard IO streams. Also refactors Modules/_testembed.c to let us start testing multiple embedding scenarios. (Initial patch by Bastien Montagne)
* | Issue #18776: atexit callbacks now display their full traceback when they ↵Antoine Pitrou2013-10-131-0/+10
|\ \ | |/ | | | | raise an exception.
| * Issue #18776: atexit callbacks now display their full traceback when they ↵Antoine Pitrou2013-10-131-0/+10
| | | | | | | | raise an exception.
* | Issue #18818: The "encodingname" part of PYTHONIOENCODING is now optional.Serhiy Storchaka2013-09-131-8/+12
| |
* | Issue #18756: os.urandom() now uses a lazily-opened persistent file ↵Antoine Pitrou2013-08-301-0/+1
| | | | | | | | descriptor, so as to avoid using many file descriptors when run in parallel from multiple threads.
* | pythonrun.c: use MAXPATHLEN instead of PATH_MAXVictor Stinner2013-08-271-1/+1
| | | | | | | | PATH_MAX is not available on "MIPS IRIX 6.5.30 [SB] 3.x" buildbot
* | Issue #18571: Implementation of the PEP 446: file descriptors and file handlesVictor Stinner2013-08-271-1/+1
| | | | | | | | | | are now created non-inheritable; add functions os.get/set_inheritable(), os.get/set_handle_inheritable() and socket.socket.get/set_inheritable().
* | Close #11619: The parser and the import machinery do not encode UnicodeVictor Stinner2013-08-261-22/+82
| | | | | | | | filenames anymore on Windows.
* | Issue #18808: Non-daemon threads are now automatically joined when a ↵Antoine Pitrou2013-08-251-0/+3
| | | | | | | | sub-interpreter is shutdown (it would previously dump a fatal error).
* | Issue #16400: Add command line option for isolated mode.Christian Heimes2013-08-101-0/+1
| | | | | | | | | | | | | | | | | | | | -I Run Python in isolated mode. This also implies -E and -s. In isolated mode sys.path contains neither the script’s directory nor the user’s site-packages directory. All PYTHON* environment variables are ignored, too. Further restrictions may be imposed to prevent the user from injecting malicious code.
* | Fix styleAntoine Pitrou2013-07-301-2/+2
| |
* | Issue #18520: Fix initstdio(), handle PySys_SetObject() failureVictor Stinner2013-07-221-2/+8
| |
* | Issue #18520: initsite() is a little bit more verbose when import site failsVictor Stinner2013-07-221-0/+1
| |
* | Issue #18520: Add a new PyStructSequence_InitType2() function, same thanVictor Stinner2013-07-221-1/+2
| | | | | | | | | | | | | | | | PyStructSequence_InitType() except that it has a return value (0 on success, -1 on error). * PyStructSequence_InitType2() now raises MemoryError on memory allocation failure * Fix also some calls to PyDict_SetItemString(): handle error
* | Issue #18520: Fix initsigs(), handle PyOS_InitInterrupts() errorVictor Stinner2013-07-211-0/+3
| | | | | | | | PyOS_InitInterrupts() can raise error when importing the signal module
* | Close #18469: Replace PyDict_GetItemString() with _PyDict_GetItemId() in ↵Victor Stinner2013-07-161-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | structseq.c _PyDict_GetItemId() is more efficient: it only builds the Unicode string once. Identifiers (dictionary keys) are now created at Python initialization, and if the creation failed, Python does exit with a fatal error. Before, PyDict_GetItemString() failure was not handled: structseq_new() could call PyObject_GC_NewVar() with a negative size, and structseq_dealloc() could also crash.
* | Issue #18203: Add _PyMem_RawStrdup() and _PyMem_Strdup()Victor Stinner2013-07-071-9/+12
| | | | | | | | | | Replace strdup() with _PyMem_RawStrdup() or _PyMem_Strdup(), depending if the GIL is held or not.
* | Issue #18203: Fix Py_Finalize(): destroy the GIL after the last call toVictor Stinner2013-07-071-9/+9
| | | | | | | | | | | | | | PyMem_Malloc() or PyObject_Malloc(). For example, PyCFunction_Fini() calls PyObject_GC_Del() which calls PyObject_FREE().
* | Issue #1545463: Global variables caught in reference cycles are now ↵Antoine Pitrou2013-05-061-4/+1
| | | | | | | | garbage-collected at shutdown.
* | Fix crash caused by 8c1385205a35Antoine Pitrou2013-05-051-6/+8
|\ \ | |/ | | | | (thanks Arfrever for reporting).