summaryrefslogtreecommitdiff
path: root/Python/errors.c
Commit message (Collapse)AuthorAgeFilesLines
* Issue #25677: Merge SyntaxError caret positioning from 3.6Martin Panter2016-12-191-12/+6
|\
| * Issue #28512: Fixed setting the offset attribute of SyntaxError bySerhiy Storchaka2016-12-111-12/+6
| |\ | | | | | | | | | PyErr_SyntaxLocationEx() and PyErr_SyntaxLocationObject().
| | * Issue #28858: Remove _PyObject_CallArg1() macroVictor Stinner2016-12-051-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Replace _PyObject_CallArg1(func, arg) with PyObject_CallFunctionObjArgs(func, arg, NULL) Using the _PyObject_CallArg1() macro increases the usage of the C stack, which was unexpected and unwanted. PyObject_CallFunctionObjArgs() doesn't have this issue.
| | * Issue #19569: Compiler warnings are now emitted if use most of deprecatedSerhiy Storchaka2016-11-201-9/+3
| | | | | | | | | | | | functions.
| | * Issue #28701: Replace _PyUnicode_CompareWithId with _PyUnicode_EqualToASCIIId.Serhiy Storchaka2016-11-161-2/+2
| | |\ | | | | | | | | | | | | | | | | | | | | The latter function is more readable, faster and doesn't raise exceptions. Based on patch by Xiang Zhang.
| | | * Issue #28618: Make hot functions using __attribute__((hot))Victor Stinner2016-11-111-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When Python is not compiled with PGO, the performance of Python on call_simple and call_method microbenchmarks depend highly on the code placement. In the worst case, the performance slowdown can be up to 70%. The GCC __attribute__((hot)) attribute helps to keep hot code close to reduce the risk of such major slowdown. This attribute is ignored when Python is compiled with PGO. The following functions are considered as hot according to statistics collected by perf record/perf report: * _PyEval_EvalFrameDefault() * call_function() * _PyFunction_FastCall() * PyFrame_New() * frame_dealloc() * PyErr_Occurred()
| | | * Use PyThreadState_GET() in performance critical codeVictor Stinner2016-11-111-1/+1
| | | | | | | | | | | | | | | | | | | | It seems like _PyThreadState_UncheckedGet() is not inlined as expected, even when using gcc -O3.
* | | | Issue #25677: Merge SyntaxError caret positioning from 3.5Martin Panter2016-12-191-4/+1
|\ \ \ \ | |/ / / |/| | |
| * | | Issue #25677: Correct syntax error caret for indented blocks.Martin Panter2016-12-111-4/+1
| | | | | | | | | | | | | | | | Based on patch by Michael Layzell.
* | | | Issue #28512: Fixed setting the offset attribute of SyntaxError bySerhiy Storchaka2016-12-111-47/+97
|\ \ \ \ | |/ / / |/| / / | |/ / PyErr_SyntaxLocationEx() and PyErr_SyntaxLocationObject().
| * | Issue #28701: Replace _PyUnicode_CompareWithId with _PyUnicode_EqualToASCIIId.Serhiy Storchaka2016-11-161-47/+97
| |\ \ | | |/ | | | | | | | | | | | | The latter function is more readable, faster and doesn't raise exceptions. Based on patch by Xiang Zhang.
| | * Issue #28410: Added _PyErr_FormatFromCause() -- the helper for raisingSerhiy Storchaka2016-10-211-0/+41
| | | | | | | | | | | | | | | | | | | | | | | | new exception with setting current exception as __cause__. _PyErr_FormatFromCause(exception, format, args...) is equivalent to Python raise exception(format % args) from sys.exc_info()[1]
| | * Issue #28410: Keep the traceback of original exception in ↵Serhiy Storchaka2016-10-211-47/+56
| | |\ | | | | | | | | | | | | _PyErr_ChainExceptions().
| | | * Issue #15767: Use ModuleNotFoundError.Eric Snow2016-09-071-6/+22
| | | |
| | | * Issue #27809: PyErr_SetImportError() uses fast callVictor Stinner2016-08-231-14/+8
| | | |
| | | * Add _PyErr_CreateException()Victor Stinner2016-08-221-30/+29
| | | | | | | | | | | | | | | | | | | | Issue #27809: Helper function optimized to create an exception: use fastcall whenever possible.
* | | | Issue #28512: Fixed setting the offset attribute of SyntaxError bySerhiy Storchaka2016-12-111-8/+4
|/ / / | | | | | | | | | PyErr_SyntaxLocationEx() and PyErr_SyntaxLocationObject().
* | | Issue #28701: Replace _PyUnicode_CompareWithId with _PyUnicode_EqualToASCIIId.Serhiy Storchaka2016-11-161-1/+1
|/ / | | | | | | | | | | The latter function is more readable, faster and doesn't raise exceptions. Based on patch by Xiang Zhang.
* | Issue #28410: Keep the traceback of original exception in ↵Serhiy Storchaka2016-10-211-1/+4
|/ | | | _PyErr_ChainExceptions().
* Issue #23960: Cleanup args and kwargs on error in PyErr_SetImportErrorBerker Peksag2016-05-011-3/+3
| | | | Patch by Ofer Schwarz.
* Issue #26200: Added Py_SETREF and replaced Py_XSETREF with Py_SETREFSerhiy Storchaka2016-04-101-2/+2
| | | | in places where Py_DECREF was used.
* Issue #22570: Renamed Py_SETREF to Py_XSETREF.Serhiy Storchaka2016-04-061-2/+2
|
* Issue #22836: Keep exception reports sensible despite errorsMartin Panter2016-02-281-4/+12
|
* Add _PyThreadState_UncheckedGet()Victor Stinner2016-01-201-7/+1
| | | | | | | | | | | | | | | | | | | Issue #26154: Add a new private _PyThreadState_UncheckedGet() function which gets the current thread state, but don't call Py_FatalError() if it is NULL. Python 3.5.1 removed the _PyThreadState_Current symbol from the Python C API to no more expose complex and private atomic types. Atomic types depends on the compiler or can even depend on compiler options. The new function _PyThreadState_UncheckedGet() allows to get the variable value without having to care of the exact implementation of atomic types. Changes: * Replace direct usage of the _PyThreadState_Current variable with a call to _PyThreadState_UncheckedGet(). * In pystate.c, replace direct usage of the _PyThreadState_Current variable with the PyThreadState_GET() macro for readability. * Document also PyThreadState_Get() in pystate.h
* Issue #20440: More use of Py_SETREF.Serhiy Storchaka2015-12-271-8/+5
| | | | | This patch is manually crafted and contains changes that couldn't be handled automatically.
* Issue #19235: Add new RecursionError exception. Patch by Georg Brandl.Yury Selivanov2015-07-031-1/+1
|
* Issue #22977: Fixed formatting Windows error messages on Wine.Serhiy Storchaka2015-04-021-2/+2
|\ | | | | | | Patch by Martin Panter.
| * Issue #22977: Fixed formatting Windows error messages on Wine.Serhiy Storchaka2015-04-021-2/+2
| | | | | | | | Patch by Martin Panter.
* | Issue #23571: PyErr_FormatV() and PyErr_SetObject() now always clear theVictor Stinner2015-03-241-8/+7
| | | | | | | | | | current exception because they can run arbitrary Python code and so no exception must be set.
* | Issue #23694: Enhance _Py_fopen(), it now raises an exception on errorVictor Stinner2015-03-181-0/+4
| | | | | | | | | | * If fopen() fails, OSError is raised with the original filename object. * The GIL is now released while calling fopen()
* | Issue #21715: Extracted shared complicated code in the _io module to newSerhiy Storchaka2014-10-081-0/+24
|\ \ | |/ | | | | _PyErr_ChainExceptions() function.
| * Issue #21715: Extracted shared complicated code in the _io module to newSerhiy Storchaka2014-10-081-0/+24
| | | | | | | | _PyErr_ChainExceptions() function.
* | Issue #18711: Add a new `PyErr_FormatV` function, similar to `PyErr_Format` ↵Antoine Pitrou2014-09-301-10/+15
|/ | | | but accepting a `va_list` argument.
* Issue #20517: Removed unnecessary new (short-lived) functions from PyErr.Larry Hastings2014-02-101-101/+3
|
* Issue #20517: Functions in the os module that accept two filenamesLarry Hastings2014-02-091-22/+147
| | | | | | now register both filenames in the exception on failure. This required adding new C API functions allowing OSError exceptions to reference two filenames instead of one.
* Issue #19512, #19515: remove shared identifiers, move identifiers where theyVictor Stinner2013-11-071-2/+5
| | | | | | | are used. Move also _Py_IDENTIFIER() defintions to the top in modified files to remove identifiers duplicated in the same file.
* Issue #19512: add _PyUnicode_CompareWithId() functionVictor Stinner2013-11-071-1/+1
| | | | | | | _PyUnicode_CompareWithId() is faster than PyUnicode_CompareWithASCIIString() when both strings are equal and interned. Add also _PyId_builtins identifier for "builtins" common string.
* Issue #19512: add some common identifiers to only create common strings once,Victor Stinner2013-11-061-1/+1
| | | | | | | instead of creating temporary Unicode string objects Add also more identifiers in pythonrun.c to avoid temporary Unicode string objets for the interactive interpreter.
* Don't export internal symbols ("make smelly")Antoine Pitrou2013-10-121-1/+1
|
* Factor-out the common code for setting a KeyError.Raymond Hettinger2013-09-021-0/+14
|
* Issue #18571: Implementation of the PEP 446: file descriptors and file handlesVictor Stinner2013-08-281-2/+2
| | | | | 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-15/+41
| | | | filenames anymore on Windows.
* Issue #18664, #18408: Rewrite PyErr_WriteUnraisable() to handle errorsVictor Stinner2013-08-261-40/+62
| | | | | | | | * Catch PyFile_WriteString() and PyFile_WriteObject() errors * Clear the current exception on _PyObject_GetAttrId() failure * Use PyUnicode_CompareWithASCIIString() and PyFile_WriteObject() instead of _PyUnicode_AsString() and strcmp() to avoid Unicode encoding error. stderr has a more tolerant error handler than utf-8/strict.
* Issue #18520: PyErr_NoMemory() now fails with a fatal error if it is calledVictor Stinner2013-07-221-0/+6
| | | | before PyExc_MemoryError has been initialized by _PyExc_Init()
* Issue #18408: PyEval_EvalFrameEx() and PyEval_CallObjectWithKeywords() now failVictor Stinner2013-07-181-0/+11
| | | | | | | | | | | | with an assertion error if they are called with an exception set (PyErr_Occurred()). If these functions are called with an exception set, the exception may be cleared and so the caller looses its exception. Add also assertions to PyEval_CallObjectWithKeywords() and call_function() to check if the function succeed with no exception set, or the function failed with an exception set.
* Issue #18408: Fix PyErr_SetImportError(), handle PyDict_SetItemString() failureVictor Stinner2013-07-171-2/+5
|
* Issue #18408: Fix PyErr_NormalizeException(), handle PyObject_IsSubclass() ↵Victor Stinner2013-07-171-1/+10
| | | | | | failure PyObject_IsSubclass() can fail and raise a new exception!
* Issue #18408: errors.c: in debug mode, calling PyErr_BadInternalCall() nowVictor Stinner2013-07-121-0/+1
| | | | fails with an assertion error
* Issue #15767: Revert 3a50025f1900 for ModuleNotFoundErrorBrett Cannon2013-07-041-22/+3
|
* Issue #15767: Touch up ModuleNotFoundError usage by import.Brett Cannon2013-06-121-3/+22
| | | | | | | | | | | | | Forgot to raise ModuleNotFoundError when None is found in sys.modules. This led to introducing the C function PyErr_SetImportErrorSubclass() to make setting ModuleNotFoundError easier. Also updated the reference docs to mention ModuleNotFoundError appropriately. Updated the docs for ModuleNotFoundError to mention the None in sys.modules case. Lastly, it was noticed that PyErr_SetImportError() was not setting an exception when returning None in one case. That issue is now fixed.