Serhiy Storchaka
f01e408c16
Issue #26200 : Added Py_SETREF and replaced Py_XSETREF with Py_SETREF
...
in places where Py_DECREF was used.
2016-04-10 18:12:01 +03:00
Serhiy Storchaka
57a01d3a0e
Issue #26200 : Added Py_SETREF and replaced Py_XSETREF with Py_SETREF
...
in places where Py_DECREF was used.
2016-04-10 18:05:40 +03:00
Serhiy Storchaka
ec39756960
Issue #22570 : Renamed Py_SETREF to Py_XSETREF.
2016-04-06 09:50:03 +03:00
Serhiy Storchaka
48842714b9
Issue #22570 : Renamed Py_SETREF to Py_XSETREF.
2016-04-06 09:45:48 +03:00
Victor Stinner
023654fa68
get_warnings_attr(): Fix coverity warning
...
Don't check if the dict key exists before getting the key. Instead get the key
and handle error.
2016-03-23 17:48:22 +01:00
Victor Stinner
e98445a4de
_warnings.warn_explicit(): try to import warnings
...
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.
2016-03-23 00:54:48 +01:00
Victor Stinner
e19558af1b
Add a source parameter to warnings.warn()
...
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
2016-03-23 00:28:08 +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
Serhiy Storchaka
ef1585eb9a
Issue #25923 : Added more const qualifiers to signatures of static and private functions.
2015-12-25 20:01:53 +02:00
Serhiy Storchaka
5a57ade58e
Issue #20440 : Massive replacing unsafe attribute setting code with special
...
macro Py_SETREF.
2015-12-24 10:35:59 +02: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
Benjamin Peterson
63a6a6fd41
merge 3.4 ( #24096 )
2015-05-03 11:29:58 -04:00
Benjamin Peterson
8c59816b70
merge 3.3 ( #24096 )
2015-05-03 11:28:46 -04:00
Benjamin Peterson
deff2b76ec
be more robust against the filters list changing under us ( closes #24096 )
2015-05-03 11:23:37 -04:00
Brett Cannon
f299abdafa
Issue #23731 : Implement PEP 488.
...
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.
2015-04-13 14:21:02 -04:00
Antoine Pitrou
87538e7bc4
Issue #4180 : The warnings registries are now reset when the filters are modified.
2014-09-18 02:42:05 +02:00
Antoine Pitrou
cb0a006fd1
Issue #4180 : The warnings registries are now reset when the filters are modified.
2014-09-18 02:40:46 +02:00
Berker Peksag
d8089e0d04
Issue #16382 : Improve exception message of warnings.warn() for bad category.
...
Initial patch by Phil Elson.
2014-07-11 19:50:25 +03:00
Victor Stinner
bd303c165b
Issue #19512 , #19515 : remove shared identifiers, move identifiers where they
...
are used.
Move also _Py_IDENTIFIER() defintions to the top in modified files to remove
identifiers duplicated in the same file.
2013-11-07 23:07:29 +01:00
Victor Stinner
090543736f
Issue #19512 : add some common identifiers to only create common strings once,
...
instead of creating temporary Unicode string objects
Add also more identifiers in pythonrun.c to avoid temporary Unicode string
objets for the interactive interpreter.
2013-11-06 22:41:44 +01:00
Victor Stinner
dcdd05b0b4
Close #19442 : warn_explicit() does nothing when called late during Python shutdown
...
After more tests, I now think that it is the safest option.
2013-11-01 00:55:30 +01:00
Victor Stinner
ae233eab5c
Issue #19437 : Fix show_warning() of _warnings, stop at the first error to not
...
call a Python function with an exception set
2013-10-31 14:51:38 +01:00
Victor Stinner
3cd04aa1b2
Issue #19437 : Fix get_filter() from _warnings, don't call PyObject_IsSubclass()
...
with an exception set
2013-10-31 14:46:00 +01:00
Victor Stinner
856f45f09c
Issue #19442 : Fix warnings emitted during Python shutdown
...
Warnings may be emitted during Python shutdown, like "unclosed file XXX".
During shutdown, globals()['__main__'] may be None.
2013-10-30 00:04:59 +01:00
Victor Stinner
a4c704b260
Issue #19424 : Fix the warnings module to accept filename containing surrogate
...
characters.
2013-10-29 23:43:41 +01:00
Victor Stinner
ce5f4fba11
Issue #19421 : fix a check in warnings.warn() to be able to use it during Python
...
finalization.
sys.argv is set to None during Python finalization: add PyList_Check() to avoid
a crash in PyList_Size().
2013-10-28 18:47:22 +01:00
Victor Stinner
14e461d5b9
Close #11619 : The parser and the import machinery do not encode Unicode
...
filenames anymore on Windows.
2013-08-26 22:28:21 +02:00
Victor Stinner
78e2c985ac
Issue #18408 : Fix show_warning(), clear also the exception raised by
...
_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.
2013-07-16 01:54:37 +02:00
Antoine Pitrou
070cb3c9be
Issue #1545463 : At shutdown, defer finalization of codec modules so that stderr remains usable.
...
(should fix Windows buildbot failures on test_gc)
2013-05-08 13:23:25 +02:00
Antoine Pitrou
aa5c5c60f1
Finally fix all test_capi refleaks
2012-01-18 21:45:15 +01:00
Benjamin Peterson
21e0da228d
remove some usage of Py_UNICODE_TOUPPER/LOWER
2012-01-11 21:00:42 -05:00
Florent Xicluna
720682efd1
Merge 3.2
2011-12-09 23:42:29 +01:00
Florent Xicluna
5126df602c
Remove obsolete py3k comment.
2011-12-09 23:41:21 +01:00
Victor Stinner
9e30aa52fd
Fix misuse of PyUnicode_GET_SIZE() => PyUnicode_GET_LENGTH()
...
And PyUnicode_GetSize() => PyUnicode_GetLength()
2011-11-21 02:49:52 +01:00
Martin v. Löwis
d10759f6ed
Make _PyUnicode_FromId return borrowed references.
...
http://mail.python.org/pipermail/python-dev/2011-November/114347.html
2011-11-07 13:00:05 +01:00
Martin v. Löwis
1c67dd9b15
Port SetAttrString/HasAttrString to SetAttrId/GetAttrId.
2011-10-14 15:16:45 +02:00
Martin v. Löwis
bd928fef42
Rename _Py_identifier to _Py_IDENTIFIER.
2011-10-14 10:20:37 +02:00
Martin v. Löwis
1ee1b6fe0d
Use identifier API for PyObject_GetAttrString.
2011-10-10 18:11:30 +02:00
Martin v. Löwis
afe55bba33
Add API for static strings, primarily good for identifiers.
...
Thanks to Konrad Schöbel and Jasper Schulz for helping with the mass-editing.
2011-10-09 10:38:36 +02:00
Victor Stinner
b62a7b268a
Fix _warnings.c: make the filename string ready
2011-10-06 02:34:51 +02:00
Martin v. Löwis
d63a3b8beb
Implement PEP 393.
2011-09-28 07:41:54 +02:00
Brett Cannon
52a7d98273
Make warnings accept a callable for showwarnings instead of
...
restricting itself to just functions and methods (which allows
built-in functions to be used, etc.).
Closes issue #10271 . Thanks to lekma for the bug report.
2011-07-17 19:17:55 -07:00
Benjamin Peterson
bb4a747b69
start out this branch always with filename NULL
2011-07-04 22:27:16 -05:00
Benjamin Peterson
a55007a620
plug refleak
2011-07-03 22:18:34 -05:00
Victor Stinner
8b0508ed4e
Issue #12467 : warnings: fix a race condition if a warning is emitted at
...
shutdown, if globals()['__file__'] is None.
2011-07-04 02:43:09 +02:00
Ezio Melotti
4969f709cc
#11515 : Merge with 3.1.
2011-03-15 05:59:46 +02:00
Ezio Melotti
42da663e6f
#11515 : fix several typos. Patch by Piotr Kasprzyk.
2011-03-15 05:18:48 +02:00
Victor Stinner
cb428f0162
Issue #10779 : PyErr_WarnExplicit() decodes the filename from the filesystem
...
encoding instead of UTF-8.
2010-12-27 20:10:36 +00:00
Georg Brandl
08be72d0aa
Add a new warning gategory, ResourceWarning, as discussed on python-dev. It is silent by default,
...
except when configured --with-pydebug.
Emit this warning from the GC shutdown procedure, rather than just printing to stderr.
2010-10-24 15:11:22 +00:00