summaryrefslogtreecommitdiffstats
path: root/Python/_warnings.c
Commit message (Collapse)AuthorAgeFilesLines
* Fix miscellaneous typos (#4275)luzpaz2017-11-051-1/+1
|
* bpo-31285: Remove splitlines identifier from Python/_warnings.c (#3803)Oren Milman2017-09-291-3/+0
| | | (forgot to remove it in #3219)
* bpo-31566: Fix an assertion failure in _warnings.warn() in case of a bad ↵Oren Milman2017-09-241-3/+4
| | | | __name__ global. (#3717)
* bpo-31285: Fix an assertion failure and a SystemError in ↵Oren Milman2017-09-241-3/+1
| | | | warnings.warn_explicit. (#3219)
* bpo-28411: Support other mappings in PyInterpreterState.modules. (#3593)Eric Snow2017-09-151-6/+1
| | | | | The concrete PyDict_* API is used to interact with PyInterpreterState.modules in a number of places. This isn't compatible with all dict subclasses, nor with other Mapping implementations. This patch switches the concrete API usage to the corresponding abstract API calls. We also add a PyImport_GetModule() function (and some other helpers) to reduce a bunch of code duplication.
* bpo-31404: Revert "remove modules from Py_InterpreterState (#1638)" (#3565)Eric Snow2017-09-141-1/+4
| | | PR #1638, for bpo-28411, causes problems in some (very) edge cases. Until that gets sorted out, we're reverting the merge. PR #3506, a fix on top of #1638, is also getting reverted.
* bpo-31416: Fix assertion failures in case of a bad warnings.filters or ↵Oren Milman2017-09-111-3/+16
| | | | | warnings.defaultaction. (#3496) Patch by Oren Milman.
* bpo-31411: Prevent raising a SystemError in case warnings.onceregistry is ↵Oren Milman2017-09-111-1/+7
| | | | not a dictionary. (#3485)
* bpo-30860: Consolidate stateful runtime globals. (#3397)Eric Snow2017-09-081-41/+39
| | | | | | | * group the (stateful) runtime globals into various topical structs * consolidate the topical structs under a single top-level _PyRuntimeState struct * add a check-c-globals.py script that helps identify runtime globals Other globals are excluded (see globals.txt and check-c-globals.py).
* Revert "bpo-30860: Consolidate stateful runtime globals." (#3379)Eric Snow2017-09-061-38/+41
| | | Windows buildbots started failing due to include-related errors.
* bpo-30860: Consolidate stateful runtime globals. (#2594)Eric Snow2017-09-061-41/+38
| | | | | | | | | * group the (stateful) runtime globals into various topical structs * consolidate the topical structs under a single top-level _PyRuntimeState struct * add a check-c-globals.py script that helps identify runtime globals Other globals are excluded (see globals.txt and check-c-globals.py).
* bpo-28411: Remove "modules" field from Py_InterpreterState. (#1638)Eric Snow2017-09-041-4/+1
| | | sys.modules is the one true source.
* bpo-29878: Add global instances of int for 0 and 1. (#852)Serhiy Storchaka2017-03-301-15/+4
|
* 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.