summaryrefslogtreecommitdiffstats
path: root/Python/_warnings.c
Commit message (Collapse)AuthorAgeFilesLines
* Issue #20185: Convert _warnings.warn() to Argument ClinicVictor Stinner2016-12-091-16/+21
| | | | Fix warn_explicit(): interpret source=None as source=NULL.
* Use _PyObject_CallMethodIdObjArgs()Victor Stinner2016-12-091-1/+1
| | | | | | | | | Issue #28915: Replace _PyObject_CallMethodId() with _PyObject_CallMethodIdObjArgs() in various modules when the format string was only made of "O" formats, PyObject* arguments. _PyObject_CallMethodIdObjArgs() avoids the creation of a temporary tuple and doesn't have to parse a format string.
* 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.
* Backed out changeset b9c9691c72c5Victor Stinner2016-12-041-1/+1
| | | | | | Issue #28858: The change b9c9691c72c5 introduced a regression. It seems like _PyObject_CallArg1() uses more stack memory than PyObject_CallFunctionObjArgs().
* Replace PyObject_CallFunction() with fastcallVictor Stinner2016-12-011-1/+1
| | | | | | | | | | | | | | | | | Replace PyObject_CallFunction(func, "O", arg) and PyObject_CallFunction(func, "O", arg, NULL) with _PyObject_CallArg1(func, arg) Replace PyObject_CallFunction(func, NULL) with _PyObject_CallNoArg(func) _PyObject_CallNoArg() and _PyObject_CallArg1() are simpler and don't allocate memory on the C stack.
* Replace PyObject_CallFunctionObjArgs() with fastcallVictor Stinner2016-12-011-1/+1
| | | | | | | | | | | | | | * PyObject_CallFunctionObjArgs(func, NULL) => _PyObject_CallNoArg(func) * PyObject_CallFunctionObjArgs(func, arg, NULL) => _PyObject_CallArg1(func, arg) PyObject_CallFunctionObjArgs() allocates 40 bytes on the C stack and requires extra work to "parse" C arguments to build a C array of PyObject*. _PyObject_CallNoArg() and _PyObject_CallArg1() are simpler and don't allocate memory on the C stack. This change is part of the fastcall project. The change on listsort() is related to the issue #23507.
* Issue #28701: Replace PyUnicode_CompareWithASCIIString with ↵Serhiy Storchaka2016-11-161-7/+7
|\ | | | | | | | | | | _PyUnicode_EqualToASCIIString. The latter function is more readable, faster and doesn't raise exceptions.
| * Issue #28701: Replace PyUnicode_CompareWithASCIIString with ↵Serhiy Storchaka2016-11-161-7/+7
| | | | | | | | | | | | _PyUnicode_EqualToASCIIString. The latter function is more readable, faster and doesn't raise exceptions.
* | Issue #26200: Added Py_SETREF and replaced Py_XSETREF with Py_SETREFSerhiy Storchaka2016-04-101-1/+1
|\ \ | |/ | | | | in places where Py_DECREF was used.
| * Issue #26200: Added Py_SETREF and replaced Py_XSETREF with Py_SETREFSerhiy Storchaka2016-04-101-1/+1
| | | | | | | | in places where Py_DECREF was used.
* | Issue #22570: Renamed Py_SETREF to Py_XSETREF.Serhiy Storchaka2016-04-061-1/+1
|\ \ | |/
| * Issue #22570: Renamed Py_SETREF to Py_XSETREF.Serhiy Storchaka2016-04-061-1/+1
| |
* | get_warnings_attr(): Fix coverity warningVictor Stinner2016-03-231-4/+3
| | | | | | | | | | Don't check if the dict key exists before getting the key. Instead get the key and handle error.
* | _warnings.warn_explicit(): try to import warningsVictor Stinner2016-03-221-14/+36
| | | | | | | | | | | | Issue #26592: _warnings.warn_explicit() now tries to import the warnings module (Python implementation) if the source parameter is set to be able to log the traceback where the source was allocated.
* | Add a source parameter to warnings.warn()Victor Stinner2016-03-221-5/+6
| | | | | | | | | | | | | | | | Issue #26604: * Add a new optional source parameter to _warnings.warn() and warnings.warn() * Modify asyncore, asyncio and _pyio modules to set the source parameter when logging a ResourceWarning warning
* | On ResourceWarning, log traceback where the object was allocatedVictor Stinner2016-03-191-29/+62
| | | | | | | | | | | | | | | | | | | | Issue #26567: * Add a new function PyErr_ResourceWarning() function to pass the destroyed object * Add a source attribute to warnings.WarningMessage * Add warnings._showwarnmsg() which uses tracemalloc to get the traceback where source object was allocated.
* | Add _showwarnmsg() and _formatwarnmsg() to warningsVictor Stinner2016-03-181-25/+53
| | | | | | | | | | | | | | | | | | | | | | | | | | Issue #26568: add new _showwarnmsg() and _formatwarnmsg() functions to the warnings module. The C function warn_explicit() now calls warnings._showwarnmsg() with a warnings.WarningMessage as parameter, instead of calling warnings.showwarning() with multiple parameters. _showwarnmsg() calls warnings.showwarning() if warnings.showwarning() was replaced. Same for _formatwarnmsg(): call warnings.formatwarning() if it was replaced.
* | Issue #25923: Added more const qualifiers to signatures of static and ↵Serhiy Storchaka2015-12-251-1/+1
|/ | | | private functions.
* Issue #20440: Massive replacing unsafe attribute setting code with specialSerhiy Storchaka2015-12-241-2/+1
| | | | macro Py_SETREF.
* Issue #24305: Prevent import subsystem stack frames from being countedLarry Hastings2015-09-061-2/+70
| | | | by the warnings.warn(stacklevel=) parameter.
* merge 3.4 (#24096)Benjamin Peterson2015-05-031-10/+27
|\
| * merge 3.3 (#24096)Benjamin Peterson2015-05-031-10/+27
| |\
| | * be more robust against the filters list changing under us (closes #24096)Benjamin Peterson2015-05-031-6/+16
| | |
* | | Issue #23731: Implement PEP 488.Brett Cannon2015-04-131-3/+2
| | | | | | | | | | | | | | | | | | The concept of .pyo files no longer exists. Now .pyc files have an optional `opt-` tag which specifies if any extra optimizations beyond the peepholer were applied.
* | | Issue #4180: The warnings registries are now reset when the filters are ↵Antoine Pitrou2014-09-181-6/+35
|\ \ \ | |/ / | | | | | | modified.
| * | Issue #4180: The warnings registries are now reset when the filters are ↵Antoine Pitrou2014-09-181-6/+35
| | | | | | | | | | | | modified.
* | | Issue #16382: Improve exception message of warnings.warn() for bad category.Berker Peksag2014-07-111-6/+7
|/ / | | | | | | Initial patch by Phil Elson.
* | Issue #19512, #19515: remove shared identifiers, move identifiers where theyVictor Stinner2013-11-071-2/+4
| | | | | | | | | | | | | | are used. Move also _Py_IDENTIFIER() defintions to the top in modified files to remove identifiers duplicated in the same file.
* | Issue #19512: add some common identifiers to only create common strings once,Victor Stinner2013-11-061-2/+2
| | | | | | | | | | | | | | instead of creating temporary Unicode string objects Add also more identifiers in pythonrun.c to avoid temporary Unicode string objets for the interactive interpreter.
* | Close #19442: warn_explicit() does nothing when called late during Python ↵Victor Stinner2013-10-311-9/+9
| | | | | | | | | | | | shutdown After more tests, I now think that it is the safest option.
* | Issue #19437: Fix show_warning() of _warnings, stop at the first error to notVictor Stinner2013-10-311-10/+16
| | | | | | | | call a Python function with an exception set
* | Issue #19437: Fix get_filter() from _warnings, don't call PyObject_IsSubclass()Victor Stinner2013-10-311-2/+10
| | | | | | | | with an exception set
* | Issue #19442: Fix warnings emitted during Python shutdownVictor Stinner2013-10-291-5/+12
| | | | | | | | | | Warnings may be emitted during Python shutdown, like "unclosed file XXX". During shutdown, globals()['__main__'] may be None.
* | Issue #19424: Fix the warnings module to accept filename containing surrogateVictor Stinner2013-10-291-47/+55
| | | | | | | | characters.
* | Issue #19421: fix a check in warnings.warn() to be able to use it during PythonVictor Stinner2013-10-281-1/+3
| | | | | | | | | | | | | | finalization. sys.argv is set to None during Python finalization: add PyList_Check() to avoid a crash in PyList_Size().
* | Close #11619: The parser and the import machinery do not encode UnicodeVictor Stinner2013-08-261-11/+20
| | | | | | | | filenames anymore on Windows.
* | Issue #18408: Fix show_warning(), clear also the exception raised byVictor Stinner2013-07-151-3/+3
| | | | | | | | | | | | | | | | _Py_DisplaySourceLine() For example, _PyGC_DumpShutdownStats() calls PyErr_WarnExplicitFormat() while the import machinery does not work anymore, _Py_DisplaySourceLine() fails when trying to import the io module.
* | Issue #1545463: At shutdown, defer finalization of codec modules so that ↵Antoine Pitrou2013-05-081-2/+45
|/ | | | | | stderr remains usable. (should fix Windows buildbot failures on test_gc)
* Finally fix all test_capi refleaksAntoine Pitrou2012-01-181-9/+16
|
* remove some usage of Py_UNICODE_TOUPPER/LOWERBenjamin Peterson2012-01-121-4/+5
|
* Merge 3.2Florent Xicluna2011-12-091-1/+0
|\
| * Remove obsolete py3k comment.Florent Xicluna2011-12-091-1/+0
| |
* | Fix misuse of PyUnicode_GET_SIZE() => PyUnicode_GET_LENGTH()Victor Stinner2011-11-211-5/+5
| | | | | | | | And PyUnicode_GetSize() => PyUnicode_GetLength()
* | Make _PyUnicode_FromId return borrowed references.Martin v. Löwis2011-11-071-2/+0
| | | | | | | | http://mail.python.org/pipermail/python-dev/2011-November/114347.html
* | Port SetAttrString/HasAttrString to SetAttrId/GetAttrId.Martin v. Löwis2011-10-141-17/+15
| |
* | Rename _Py_identifier to _Py_IDENTIFIER.Martin v. Löwis2011-10-141-2/+2
| |
* | Use identifier API for PyObject_GetAttrString.Martin v. Löwis2011-10-101-1/+2
| |
* | Add API for static strings, primarily good for identifiers.Martin v. Löwis2011-10-091-1/+2
| | | | | | | | Thanks to Konrad Schöbel and Jasper Schulz for helping with the mass-editing.
* | Fix _warnings.c: make the filename string readyVictor Stinner2011-10-061-3/+10
| |
* | Implement PEP 393.Martin v. Löwis2011-09-281-7/+9
| |