[issue8963] test_urllibnet failure

2012-03-14 Thread Senthil Kumaran

Senthil Kumaran sent...@uthcode.com added the comment:

Closing this based on - msg155387. The upstream bug is unfortunately closed 
as OLD. We can reopen if this stumble upon this again.

--
resolution:  - invalid
stage: needs patch - committed/rejected
status: open - closed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue8963
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8963] test_urllibnet failure

2012-03-11 Thread Ross Lagerwall

Ross Lagerwall rosslagerw...@gmail.com added the comment:

I tested the code from msg107484 on Fedora 16 with no change in locale.

Probably OK to close?

--
nosy: +rosslagerwall

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue8963
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8963] test_urllibnet failure

2010-06-10 Thread Alexander Belopolsky

Alexander Belopolsky belopol...@users.sourceforge.net added the comment:

BTW, looking at test_bad_address(), I wonder why it puts extra dots in the url? 
 The comment above it suggests that the intent is to use a name within RFC 2606 
.invalid TLD.  Not likely to be a problem in your case, but using made up TLD 
is not a good idea.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue8963
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8963] test_urllibnet failure

2010-06-10 Thread Martin v . Löwis

Martin v. Löwis mar...@v.loewis.de added the comment:

This looks like a glibc bug to me. I suspect an unauthorized redhat change; I 
hope Ulrich Drepper would have never accepted a glibc that causes getaddrinfo 
to implicitly call setlocale - see

http://sources.redhat.com/ml/libc-alpha/2004-03/msg00161.html

You might experiment with disabling IDN support in getaddrinfo.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue8963
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8963] test_urllibnet failure

2010-06-10 Thread Antoine Pitrou

New submission from Antoine Pitrou pit...@free.fr:

This test failure just happened to me on a py3k checkout:

test test_urllibnet failed -- Traceback (most recent call last):
  File /home/antoine/py3k/debug/Lib/test/test_urllibnet.py, line 191, in 
test_data_header
time.strptime(datevalue, dateformat)
  File /home/antoine/py3k/debug/Lib/_strptime.py, line 461, in _strptime_time
return _strptime(data_string, format)[0]
  File /home/antoine/py3k/debug/Lib/_strptime.py, line 332, in _strptime
(data_string, format))
ValueError: time data 'Thu, 10 Jun 2010 19:03:39 GMT' does not match format 
'%a, %d %b %Y %H:%M:%S GMT'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File /home/antoine/py3k/debug/Lib/test/test_urllibnet.py, line 193, in 
test_data_header
self.fail('Date value not in %r format', dateformat)
TypeError: fail() takes at most 2 arguments (3 given)

--
assignee: orsenthil
components: Library (Lib), Tests
messages: 107470
nosy: belopolsky, orsenthil, pitrou
priority: normal
severity: normal
stage: needs patch
status: open
title: test_urllibnet failure
type: behavior
versions: Python 3.2

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue8963
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8963] test_urllibnet failure

2010-06-10 Thread Alexander Belopolsky

Alexander Belopolsky belopol...@users.sourceforge.net added the comment:

How do I enable `network' resource?

I am getting

$ ./python.exe -m test.regrtest test_urllibnet
test_urllibnet
test_urllibnet skipped -- Use of the `network' resource not enabled
1 test skipped:
test_urllibnet
Those skips are all expected on darwin.


Same on Linux ...

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue8963
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8963] test_urllibnet failure

2010-06-10 Thread Antoine Pitrou

Antoine Pitrou pit...@free.fr added the comment:

 How do I enable `network' resource?

Use the -unetwork flag to regrtest.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue8963
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8963] test_urllibnet failure

2010-06-10 Thread Alexander Belopolsky

Alexander Belopolsky belopol...@users.sourceforge.net added the comment:

What is your locale?

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue8963
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8963] test_urllibnet failure

2010-06-10 Thread Antoine Pitrou

Antoine Pitrou pit...@free.fr added the comment:

I've reported the bug upstream at Mandriva:
https://qa.mandriva.com/show_bug.cgi?id=59736

It would be nice to know whether other distributions with a Redhat lineage are 
affected. Can someone with such a distribution the code in msg107484?

In the end, I'm not sure it's Python's task to workaround such bug.
However, the bug in error reporting should be fixed.

--
assignee: orsenthil - 
nosy: +dmalcolm

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue8963
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8963] test_urllibnet failure

2010-06-10 Thread Antoine Pitrou

Antoine Pitrou pit...@free.fr added the comment:

Strangely, it also works here from the prompt:

 import time
 time.strptime('Thu, 10 Jun 2010 19:03:39 GMT', '%a, %d %b %Y %H:%M:%S GMT')
time.struct_time(tm_year=2010, tm_mon=6, tm_mday=10, tm_hour=19, tm_min=3, 
tm_sec=39, tm_wday=3, tm_yday=161, tm_isdst=-1)
 import locale
 locale.getlocale(locale.LC_TIME)
(None, None)

Apparently, something sets the locale before running the test.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue8963
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8963] test_urllibnet failure

2010-06-10 Thread Alexander Belopolsky

Alexander Belopolsky belopol...@users.sourceforge.net added the comment:

I still cannot reproduce the failure, but please, try the attached patch.

--
keywords: +patch
Added file: http://bugs.python.org/file17608/issue8963.diff

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue8963
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8963] test_urllibnet failure

2010-06-10 Thread Antoine Pitrou

Antoine Pitrou pit...@free.fr added the comment:

The patch is not sufficient, since other failures can then occur if 
test_strptime gets run after test_urllibnet:

==
ERROR: test_twelve_noon_midnight (test.test_strptime.Strptime12AMPMTests)
--
Traceback (most recent call last):
  File /home/antoine/py3k/debug/Lib/test/test_strptime.py, line 389, in 
test_twelve_noon_midnight
eq(time.strptime('12 PM', '%I %p')[3], 12)
  File /home/antoine/py3k/debug/Lib/_strptime.py, line 461, in _strptime_time
return _strptime(data_string, format)[0]
  File /home/antoine/py3k/debug/Lib/_strptime.py, line 335, in _strptime
data_string[found.end():])
ValueError: unconverted data remains: PM

==
FAIL: test_pattern (test.test_strptime.TimeRETests)
--
Traceback (most recent call last):
  File /home/antoine/py3k/debug/Lib/test/test_strptime.py, line 124, in 
test_pattern
pattern_string)
AssertionError: did not find abbreviated weekday in pattern string 
'(?Palun\.|mar\.|mer\.|jeu\.|ven\.|sam\.|dim\.)\s+(?PAmercredi|vendredi|dimanche|samedi|lundi|mardi|jeudi)\s+(?Pd3[0-1]|[1-2]\d|0[1-9]|[1-9]|
 [1-9])'

==
FAIL: test_hour (test.test_strptime.StrptimeTests)
--
Traceback (most recent call last):
  File /home/antoine/py3k/debug/Lib/test/test_strptime.py, line 266, in 
test_hour
(strf_output, strp_output[3], self.time_tuple[3]))
AssertionError: testing of '%I %p' directive failed; '08 ' - 8 != 20

--

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue8963
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8963] test_urllibnet failure

2010-06-10 Thread Alexander Belopolsky

Alexander Belopolsky belopol...@users.sourceforge.net added the comment:

 The patch is not sufficient, since other
 failures can then occur if test_strptime gets
 run after test_urllibnet

This looks like a bug in support.run_with_locale decorator.  

It is described as
#===

 
# Decorator for running a function in a different locale, correctly resetting   

 
# it afterwards.

but apparently does not.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue8963
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8963] test_urllibnet failure

2010-06-10 Thread Antoine Pitrou

Changes by Antoine Pitrou pit...@free.fr:


--
versions: +Python 2.6, Python 2.7, Python 3.1

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue8963
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8963] test_urllibnet failure

2010-06-10 Thread Antoine Pitrou

Antoine Pitrou pit...@free.fr added the comment:

In setipaddr() in socketmodule.c, the following line appears to change the 
current locale when DNS lookup fails:

error = getaddrinfo(name, NULL, hints, res);

This is checked by making a call to setlocale(LC_TIME, NULL) before and after 
the aforementioned line.

This is with the following libc:
$ rpm -qv glibc
glibc-2.11.1-8mnb2

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue8963
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8963] test_urllibnet failure

2010-06-10 Thread Antoine Pitrou

Antoine Pitrou pit...@free.fr added the comment:

 Would s/LC_TIME/LC_ALL/ in my patch fix your problem?

As I explained, this wouldn't fix the later failures in test_strptime.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue8963
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8963] test_urllibnet failure

2010-06-10 Thread Alexander Belopolsky

Alexander Belopolsky belopol...@users.sourceforge.net added the comment:

Antoine,

Would s/LC_TIME/LC_ALL/ in my patch fix your problem?  I could not find an 
affected system, but I simulated the problem by adding 
locale.setlocale(locale.LC_ALL, ) call in the test.

I think the patch is worth applying. It fixes the typo in the except clause and 
makes the test independent of the locale settings.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue8963
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8963] test_urllibnet failure

2010-06-10 Thread Antoine Pitrou

Antoine Pitrou pit...@free.fr added the comment:

 What is your locale?

$ locale
LANG=fr_FR.utf8
LC_CTYPE=fr_FR.utf8
LC_NUMERIC=fr_FR.utf8
LC_TIME=fr_FR.utf8
LC_COLLATE=fr_FR.utf8
LC_MONETARY=fr_FR.utf8
LC_MESSAGES=fr_FR.utf8
LC_PAPER=fr_FR.utf8
LC_NAME=fr_FR.utf8
LC_ADDRESS=fr_FR.utf8
LC_TELEPHONE=fr_FR.utf8
LC_MEASUREMENT=fr_FR.utf8
LC_IDENTIFICATION=fr_FR.utf8
LC_ALL=

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue8963
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8963] test_urllibnet failure

2010-06-10 Thread Alexander Belopolsky

Alexander Belopolsky belopol...@users.sourceforge.net added the comment:

$ ./python.exe -m test.regrtest -unetwork test_urllibnet
test_urllibnet
1 test OK.

Also the arguments to strptime from reported error message work fine:

 import time
 time.strptime('Thu, 10 Jun 2010 19:03:39 GMT', '%a, %d %b %Y %H:%M:%S GMT')
time.struct_time(tm_year=2010, tm_mon=6, tm_mday=10, tm_hour=19, tm_min=3, 
tm_sec=39, tm_wday=3, tm_yday=161, tm_isdst=-1)
 from datetime import *
 datetime.strptime('Thu, 10 Jun 2010 19:03:39 GMT', '%a, %d %b %Y %H:%M:%S 
 GMT')
datetime.datetime(2010, 6, 10, 19, 3, 39)

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue8963
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8963] test_urllibnet failure

2010-06-10 Thread Antoine Pitrou

Antoine Pitrou pit...@free.fr added the comment:

Ok, so what it boils down to is the following behaviour:

 import locale, socket
 sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
 locale.getlocale(locale.LC_TIME)
(None, None)
 sock.connect((invalidhost, 80))
Traceback (most recent call last):
  File stdin, line 1, in module
socket.gaierror: [Errno -2] Nom ou service inconnu
 locale.getlocale(locale.LC_TIME)
('fr_FR', 'UTF8')

--
nosy: +loewis

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue8963
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8963] test_urllibnet failure

2010-06-10 Thread Antoine Pitrou

Antoine Pitrou pit...@free.fr added the comment:

The culprit seems to be test_bad_address. If I disable this test, or replace 
the bad URL by a good one, everything works fine. It seems that failing to 
resolve the domain name changes the current locale...

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue8963
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8963] test_urllibnet failure

2010-06-10 Thread Alexander Belopolsky

Alexander Belopolsky belopol...@users.sourceforge.net added the comment:

It looks like your libc calls setlocale(LC_ALL, ) on error.  This may or may 
not be right and not python's problem in any case.  What is worth to 
investigate, however is why @run_with_locale decorator fails to restore the 
locale after it was modified by libc.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue8963
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com