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.

classification
Title: test_logging warning on 2.7
Type: behavior Stage: resolved
Components: Library (Lib), Unicode Versions: Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: vinay.sajip Nosy List: ezio.melotti, flox, python-dev, vinay.sajip
Priority: normal Keywords: patch

Created on 2011-11-06 17:53 by ezio.melotti, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
issue13356_logging.diff flox, 2011-11-06 23:24
Messages (5)
msg147165 - (view) Author: Ezio Melotti (ezio.melotti) * (Python committer) Date: 2011-11-06 17:53
$ ./python -Wd -3 -m test.regrtest -v test_logging
== CPython 2.7.2+ (2.7:39573be48b4a, Nov 6 2011, 17:13:44) [GCC 4.6.1]
==   Linux-3.0.0-12-generic-i686-with-debian-wheezy-sid little-endian
==   /home/wolf/dev/py/wide-2.7/build/test_python_6508
Testing with flags: sys.flags(debug=0, py3k_warning=1, division_warning=1, division_new=0, inspect=0, interactive=0, optimize=0, dont_write_bytecode=0, no_user_site=0, no_site=0, ignore_environment=0, tabcheck=1, verbose=0, unicode=0, bytes_warning=0)
test_logging
[...]
test_listen_config_10_ok (test.test_logging.ConfigDictTest) ... /home/wolf/dev/py/wide-2.7/Lib/logging/config.py:599: UnicodeWarning: Unicode equal comparison failed to convert both arguments to Unicode - interpreting them as being unequal
  if name in existing:
ok
[...]

----------------------------------------------------------------------
Ran 43 tests in 2.328s

OK
1 test OK.
msg147186 - (view) Author: Florent Xicluna (flox) * (Python committer) Date: 2011-11-06 21:23
This is the expression which raises the warning.

>>> u'compiler.parser' in ['\xab\xd7\xbb', u'\u013f\xd6G']
__main__:1: UnicodeWarning: Unicode equal comparison failed to convert both arguments to Unicode - interpreting them as being unequal
False


See also issue #13360
msg147194 - (view) Author: Vinay Sajip (vinay.sajip) * (Python committer) Date: 2011-11-06 23:12
Thanks, Florent. This patch was by you in response to issue #8201 - do you have any suggestion as to the best way to resolve this? I tried changing the non-ASCII logger to '\xc3\xb4\xc3\xbc', which decodes cleanly to u'\xf4\xfc' (o-circumflex u-umlaut), but it apparently still fails to convert to Unicode when doing the comparison, and so still raises the warning. Is there any byte-string sequence which won't give the error in this circumstance? Obviously I could convert it to Unicode, but then the test is checking correct operation when you have a non-ASCII (byte-)string name as well as a Unicode name for loggers.
msg147195 - (view) Author: Florent Xicluna (flox) * (Python committer) Date: 2011-11-06 23:24
I suggest to use encoded string as keys in loggerDict.
It should solve both issue #8201 and this one.
Moreover, it seems in line with msg147191 from Martin on issue #13360.

Patch attached.
msg147210 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2011-11-07 08:55
New changeset 8726ad774cf0 by Vinay Sajip in branch '2.7':
Closes #13356. Thanks to Florent Xicluna for the patch.
http://hg.python.org/cpython/rev/8726ad774cf0
History
Date User Action Args
2022-04-11 14:57:23adminsetgithub: 57565
2011-11-07 08:55:13python-devsetstatus: open -> closed

nosy: + python-dev
messages: + msg147210

resolution: fixed
stage: patch review -> resolved
2011-11-06 23:24:45floxsetfiles: + issue13356_logging.diff
messages: + msg147195

dependencies: - UnicodeWarning raised on sequence and set comparisons
components: + Unicode
keywords: + patch
stage: needs patch -> patch review
2011-11-06 23:12:22vinay.sajipsetmessages: + msg147194
2011-11-06 21:23:02floxsetmessages: + msg147186
2011-11-06 20:27:12floxsetnosy: + flox
dependencies: + UnicodeWarning raised on sequence and set comparisons
2011-11-06 17:53:01ezio.melotticreate