Commit Graph

23 Commits

Author SHA1 Message Date
Martin Panter e3d747496e Issue #27528: Merge warning doc and test from 3.5 2016-07-19 02:50:51 +00:00
Martin Panter 221945056d Issue #27528: Document and test warning messages must match at beginning 2016-07-19 02:26:38 +00:00
Serhiy Storchaka bae75cf3fe Issue #19527: Fixed tests with defined COUNT_ALLOCS. 2016-07-03 22:30:49 +03:00
Serhiy Storchaka a793037d80 Issue #19527: Fixed tests with defined COUNT_ALLOCS. 2016-07-03 22:27:26 +03:00
Ned Deily 6371152154 first step in backout of bad default->3.5 merge d085b4f779af. Create new head and fix whitespace. 2016-06-03 15:17:13 -07:00
Victor Stinner b69d3fea88 Merge 3.5 (test_warnings) 2016-05-26 15:22:14 +02:00
Victor Stinner 0025eb145f test_warnings: catch stderr and check warning
Check the user warning in test_error_after_default() to not pollute the output,
and check the warning logged into stderr.
2016-05-26 15:21:25 +02:00
Martin Panter b6ae2ae47c Issue #18383: Merge warnings fix from 3.5 2016-05-26 09:39:41 +00:00
Martin Panter 43593a1892 Issue #18383: Avoid adding duplicate filters when warnings is reloaded
Based on patch by Alex Shkop.
2016-05-26 09:10:55 +00:00
Victor Stinner 6c45d397a3 Issue #21925: Fix test_warnings for release mode
Use -Wd comment line option to log the ResourceWarning.
2016-03-25 09:51:14 +01:00
Victor Stinner e091d32a7a Merge 3.5
Issue #21925: warnings.formatwarning() now catches exceptions when calling
linecache.getline() and tracemalloc.get_object_traceback() to be able to log
ResourceWarning emitted late during the Python shutdown process.
2016-03-25 00:33:12 +01:00
Victor Stinner 27461683a9 warnings.formatwarning(): catch exceptions
Issue #21925: warnings.formatwarning() now catches exceptions on
linecache.getline(...) to be able to log ResourceWarning emitted late during
the Python shutdown process.
2016-03-25 00:30:32 +01:00
Victor Stinner e0511e797c Fix test_warnings.test_improper_option()
test_warnings: only run test_improper_option() and test_warnings_bootstrap()
once. The unit test doesn't depend on self.module.
2016-03-25 00:28:56 +01:00
Victor Stinner f9a71153e9 Issue #26588: remove debug traces from _tracemalloc. 2016-03-22 23:54:42 +01:00
Victor Stinner 92c21d7a7c Issue #26588: skip test_warnings.test_tracemalloc() 2016-03-22 21:26:31 +01:00
Victor Stinner 74879e4179 Try again to fix test_warnings on Windows
Issue #26567: normalize newlines in test_tracemalloc.
2016-03-19 10:00:08 +01:00
Victor Stinner bfab932971 Try to fix test_warnings on Windows
Issue #26567.
2016-03-19 02:51:45 +01:00
Victor Stinner 914cde89d4 On ResourceWarning, log traceback where the object was allocated
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.
2016-03-19 01:03:51 +01:00
Victor Stinner 1231a4615f Add _showwarnmsg() and _formatwarnmsg() to warnings
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.
2016-03-19 00:47:17 +01:00
Steve Dower 45fd95155f Merge from 3.5 2015-09-06 22:31:26 -07:00
Steve Dower 96d4943846 Reapplied change to test_warnings.py to test_warnings/__init__.py. 2015-09-06 22:30:40 -07:00
Larry Hastings 714e49371b Issue #24305: Prevent import subsystem stack frames from being counted
by the warnings.warn(stacklevel=) parameter.
2015-09-06 00:39:37 -07:00
Victor Stinner 540a81c720 Issue #21925: Fix test_warnings for release mode
Use -Wd comment line option to log the ResourceWarning.
2016-03-25 09:51:14 +01:00