[issue26604] Add optional source parameter to warnings.warn()

2016-03-22 Thread STINNER Victor

Changes by STINNER Victor :


--
resolution:  -> fixed
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue26604] Add optional source parameter to warnings.warn()

2016-03-22 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 3a57ced47459 by Victor Stinner in branch 'default':
Add a source parameter to warnings.warn()
https://hg.python.org/cpython/rev/3a57ced47459

--
nosy: +python-dev

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue26604] Add optional source parameter to warnings.warn()

2016-03-21 Thread STINNER Victor

New submission from STINNER Victor:

Follow-up of the issue #26567 which added PyErr_ResourceWarning() (C API), 
attached patch adds a new source parameter to the warnings.warn() function 
(Python API).

source is the destroyed object which emits a ResourceWarning. The source is 
used to show the traceback where the object was created (allocated) when 
tracemalloc is used.

The patch also changes _pyio, asyncio and asyncore modules to set the source 
parameter.

Note: tempfile doesn't set source because it uses a class method:

@classmethod
def _cleanup(cls, name, warn_message):
_shutil.rmtree(name)
_warnings.warn(warn_message, ResourceWarning)

--
files: warnings_warn_source.patch
keywords: patch
messages: 262137
nosy: haypo
priority: normal
severity: normal
status: open
title: Add optional source parameter to warnings.warn()
type: enhancement
versions: Python 3.6
Added file: http://bugs.python.org/file42236/warnings_warn_source.patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue26604] Add optional source parameter to warnings.warn()

2016-03-21 Thread STINNER Victor

STINNER Victor added the comment:

For asyncio, it should help to fix the ResourceWarning warnings on AIX (which 
has a broken ssl module):

http://buildbot.python.org/all/builders/PPC64%20AIX%203.x/builds/4700/steps/test/logs/stdio

test_create_server_ssl_verify_failed 
(test.test_asyncio.test_events.PollEventLoopTests) ... FAIL
/home/shager/cpython-buildarea/3.x.edelsohn-aix-ppc64/build/Lib/unittest/case.py:628:
 ResourceWarning: unclosed 
  outcome.errors.clear()

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com