This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Title: uses _warn without importing it
Type: behavior Stage: resolved
Components: Library (Lib) Versions: Python 3.3, Python 3.4
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: ezio.melotti Nosy List: Dmitry.Jemerov, berker.peksag, eric.araujo, ezio.melotti, flox, pitrou, python-dev
Priority: normal Keywords: patch

Created on 2013-02-06 15:14 by Dmitry.Jemerov, last changed 2022-04-11 14:57 by admin. This issue is now closed.

File name Uploaded Description Edit
issue17143.diff berker.peksag, 2013-02-06 17:36 review
Messages (10)
msg181531 - (view) Author: Dmitry Jemerov (Dmitry.Jemerov) Date: 2013-02-06 15:14 in Python 3.3 standard library uses the _warn function without importing it. As a result, an attempt to use a now-deprecated function fails with a NameError:

> python3
Python 3.3.0 (v3.3.0:bd8afb90ebf2, Sep 29 2012, 01:25:11) 
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import trace
>>> trace.modname('')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/", line 827, in modname
    _warn("The trace.modname() function is deprecated",
NameError: global name '_warn' is not defined
msg181533 - (view) Author: Dmitry Jemerov (Dmitry.Jemerov) Date: 2013-02-06 15:45
Workaround: "import warnings; trace._warn = warnings.warn" after importing trace
msg181542 - (view) Author: Berker Peksag (berker.peksag) * (Python committer) Date: 2013-02-06 17:36
Patch attached with tests.
msg181698 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2013-02-08 20:55
Great patch with tests.
msg182099 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2013-02-14 15:13
Eric, do you want to commit?
msg182158 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2013-02-15 19:22
New changeset 3f8b5fcbf07e by Ezio Melotti in branch '3.3':
#17143: fix a missing import in the trace module.  Initial patch by Berker Peksag.

New changeset 46e9f668aea9 by Ezio Melotti in branch 'default':
#17143: merge with 3.3.
msg182159 - (view) Author: Ezio Melotti (ezio.melotti) * (Python committer) Date: 2013-02-15 19:26
Fixed, thanks for the report and the patch!

I changed a couple of things:
1) test_deprecated_usage was printing the usage on stderr while running the tests -- I changed it to use a StringIO and added a minimal test to check that the usage is actually written;
2) there was an unnecessary "import warnings" that I removed;

FTR this bug was introduced in f1604371240a.
msg182161 - (view) Author: Ezio Melotti (ezio.melotti) * (Python committer) Date: 2013-02-15 19:50
The windows buildbots are failing with the following error:
ERROR: test_deprecated_find_strings (test.test_trace.TestDeprecatedMethods)
Traceback (most recent call last):
  File "C:\\3.x.kloth-win64\build\lib\test\", line 401, in test_deprecated_find_strings
  File "C:\\3.x.kloth-win64\build\lib\", line 850, in find_strings
    return _find_strings(filename, encoding=None)
  File "C:\\3.x.kloth-win64\build\lib\", line 422, in _find_strings
    with open(filename, encoding=encoding) as f:
PermissionError: [Errno 13] Permission denied: 'c:\\users\\buildbot\\appdata\\local\\temp\\tmp_08yph'


The problem seems to be related to the use of NamedTemporaryFile in test_deprecated_find_strings, but doesn't seem to affect test_deprecated_find_executable_linenos.

There's also a warning for test_ignored:
test_ignored (test.test_trace.Test_Ignore) ... Not printing coverage data for 'c:\\users\\buildbot\\appdata\\local\\temp\\tmpwrqs7_': [Errno 13] Permission denied: 'c:\\users\\buildbot\\appdata\\local\\temp\\tmpwrqs7_'

This was probably here already, but went unnoticed because it doesn't cause failures and it's probably printed in verbose mode only.
msg182457 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2013-02-20 00:55
New changeset 662f97427acf by Ezio Melotti in branch '3.3':
#17143: fix buildbot failures on Windows.

New changeset 1bf0ff7db856 by Ezio Melotti in branch 'default':
#17143: merge with 3.3.
msg182462 - (view) Author: Ezio Melotti (ezio.melotti) * (Python committer) Date: 2013-02-20 01:51
This should be fixed now.
Date User Action Args
2022-04-11 14:57:41adminsetgithub: 61345
2013-02-20 01:51:31ezio.melottisetstatus: open -> closed

messages: + msg182462
2013-02-20 00:55:05python-devsetmessages: + msg182457
2013-02-15 19:50:35ezio.melottisetstatus: closed -> open

messages: + msg182161
2013-02-15 19:26:11ezio.melottisetstatus: open -> closed

assignee: ezio.melotti

nosy: + flox
messages: + msg182159
resolution: fixed
stage: patch review -> resolved
2013-02-15 19:22:39python-devsetnosy: + python-dev
messages: + msg182158
2013-02-14 15:13:33pitrousetnosy: + pitrou
messages: + msg182099
2013-02-14 14:33:30floxsetnosy: - Ronald.Chapman
2013-02-14 14:29:49ezio.melottisethgrepos: - hgrepo174
2013-02-14 14:29:42ezio.melottisetmessages: - msg182097
2013-02-14 14:10:12Ronald.Chapmansethgrepos: + hgrepo174

messages: + msg182097
nosy: + Ronald.Chapman
2013-02-14 13:33:09ezio.melottisetnosy: + ezio.melotti
2013-02-08 20:55:25eric.araujosetnosy: + eric.araujo
messages: + msg181698
2013-02-07 09:57:32pitrousetstage: patch review
type: behavior
versions: + Python 3.4
2013-02-06 17:36:45berker.peksagsetfiles: + issue17143.diff

nosy: + berker.peksag
messages: + msg181542

keywords: + patch
2013-02-06 15:45:51Dmitry.Jemerovsetmessages: + msg181533
2013-02-06 15:14:41Dmitry.Jemerovcreate