[issue15398] intermittence on UnicodeFileTests.test_rename at test_pep277 on MacOS X

2012-07-19 Thread Hugo Lopes Tavares

Hugo Lopes Tavares  added the comment:

I had no problems after running for a very long time (using -F). I am using Mac 
OSX 10.6.8.

--
nosy: +hltbra

___
Python tracker 
<http://bugs.python.org/issue15398>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13592] repr(regex) doesn't include actual regex

2012-07-19 Thread Hugo Lopes Tavares

Hugo Lopes Tavares  added the comment:

Hey, I started the patch under `default` branch, and get the following working:

>>> import re
>>> re.compile("foo")
re.compile("foo", re.UNICODE)
>>> re.compile("foo", re.DOTALL)
re.compile("foo", re.DOTALL|re.UNICODE)
>>> re.compile("foo", re.DOTALL|re.MULTILINE)
re.compile("foo", re.MULTILINE|re.DOTALL|re.UNICODE)
>>>

Do you have any comments on it?

I want to adapt the patch to make it work with python 2.7 too. Do you think is 
it worthful?

The attached patch was done after commit 3fbfa61634de.

--
keywords: +patch
nosy: +hltbra
Added file: http://bugs.python.org/file26441/issue13592_add_repr_to_regex.patch

___
Python tracker 
<http://bugs.python.org/issue13592>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13592] repr(regex) doesn't include actual regex

2012-07-20 Thread Hugo Lopes Tavares

Hugo Lopes Tavares  added the comment:

Thanks for the review ezio.melotti.

He has notice a few things in my patch:
* assertEquals is deprecated; should use assertEqual
* the convention is assertEqual(result, expected), not assertEqual(expected, 
result)
* it should handle quotes correctly
* some lines were longer than 80 chars
* add tests using inline flags (re.I instead of re.IGNORECASE)

And I realized I was not covering the case where no flags are enabled (byte 
string, for instance). And I have fixed all this issues.

And now I think this patch would work against py2x and py3k anyway.

Attaching a new patch.

--
Added file: 
http://bugs.python.org/file26453/issue13592_add_repr_to_regex_v2.patch

___
Python tracker 
<http://bugs.python.org/issue13592>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13592] repr(regex) doesn't include actual regex

2012-07-20 Thread Hugo Lopes Tavares

Hugo Lopes Tavares  added the comment:

Changed two test names to avoid misunderstanding.

--
Added file: 
http://bugs.python.org/file26454/issue13592_add_repr_to_regex_v2_1.patch

___
Python tracker 
<http://bugs.python.org/issue13592>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9736] doctest.DocTestSuite doesn't handle test globs correctly

2012-07-20 Thread Hugo Lopes Tavares

Hugo Lopes Tavares  added the comment:

I see the bug was not fixed yet, and I started to investigate it.

I am attaching a test patch. I don't know if I will get it working soon, since 
I see it as a very low priority for Python.

--
keywords: +patch
nosy: +hltbra
versions: +Python 3.3, Python 3.4 -Python 3.1, Python 3.2
Added file: http://bugs.python.org/file26459/issue9736_doctestsuite_test.patch

___
Python tracker 
<http://bugs.python.org/issue9736>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13592] repr(regex) doesn't include actual regex

2012-08-23 Thread Hugo Lopes Tavares

Hugo Lopes Tavares added the comment:

Any news about this patch? Is it going to be merged?

When is next CPython release?

--

___
Python tracker 
<http://bugs.python.org/issue13592>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9409] doctest in python2.7 can't handle non-ascii characters

2010-07-28 Thread Hugo Lopes Tavares

New submission from Hugo Lopes Tavares :

When trying to run my test suite I had a problem with python2.7. My suite ran 
100% in Python2.4, Python2.5, Python2.6 and Python3.2a0, so I thought it would 
be a kind of doctest flaw.

Taking a look at the code, there is the following in doctest.py:1331:

source = example.source.encode('ascii', 'backslashreplace')

The problem is that my doctest file had non-ascii files and I got trouble.

h...@hugo-laptop:~/issue$ python2.7 example.py 
non-ascii.txt
Doctest: non-ascii.txt ... ok
ascii.txt
Doctest: ascii.txt ... ERROR

==
ERROR: ascii.txt
Doctest: ascii.txt
--
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/doctest.py", line 2148, in runTest
test, out=new.write, clear_globs=False)
  File "/usr/local/lib/python2.7/doctest.py", line 1382, in run
return self.__run(test, compileflags, out)
  File "/usr/local/lib/python2.7/doctest.py", line 1272, in __run
got += _exception_traceback(exc_info)
  File "/usr/local/lib/python2.7/doctest.py", line 244, in _exception_traceback
traceback.print_exception(exc_type, exc_val, exc_tb, file=excout)
  File "/usr/local/lib/python2.7/traceback.py", line 125, in print_exception
print_tb(tb, limit, file)
  File "/usr/local/lib/python2.7/traceback.py", line 69, in print_tb
line = linecache.getline(filename, lineno, f.f_globals)
  File "/usr/local/lib/python2.7/linecache.py", line 14, in getline
lines = getlines(filename, module_globals)
  File "/usr/local/lib/python2.7/doctest.py", line 1331, in 
__patched_linecache_getlines
source = example.source.encode('ascii', 'backslashreplace')
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 19: 
ordinal not in range(128)

--
Ran 2 tests in 0.006s

FAILED (errors=1)
h...@hugo-laptop:~/issue$ 


Taking an inner look at doctest.py in python2.6 and python2.7 I realized there 
is another inconsistency with filenames in both (I was lucky to try at first a 
filename that doesn't match the regex):

__LINECACHE_FILENAME_RE = re.compile(r'[\w\.]+)'
 r'\[(?P\d+)\]>$')

Well,  is the file name, but filenames are not only composed of alphanums 
and dots. Maybe it should be slightly different, like:

__LINECACHE_FILENAME_RE = re.compile(r'.+?)'
 r'\[(?P\d+)\]>$', 
re.UNICODE)

Because we can have several kinds of names. But it is not the top of the 
iceberg, anyaway.

To solve my problem, I propose moving back that first snippet to how it was in 
python2.6. The diff would be:

--- /usr/local/lib/python2.7/doctest.py 2010-07-28 22:07:01.272234398 -0300
+++ doctest.py  2010-07-28 22:20:42.0 -0300
@@ -1328,8 +1328,7 @@
 m = self.__LINECACHE_FILENAME_RE.match(filename)
 if m and m.group('name') == self.test.name:
 example = self.test.examples[int(m.group('examplenum'))]
-source = example.source.encode('ascii', 'backslashreplace')
-return source.splitlines(True)
+return example.source.splitlines(True)
 else:
 return self.save_linecache_getlines(filename, module_globals)

--
files: ascii.txt
messages: 111881
nosy: hugo
priority: normal
severity: normal
status: open
title: doctest in python2.7 can't handle non-ascii characters
type: behavior
versions: Python 2.7
Added file: http://bugs.python.org/file18242/ascii.txt

___
Python tracker 
<http://bugs.python.org/issue9409>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9409] doctest in python2.7 can't handle non-ascii characters

2010-07-28 Thread Hugo Lopes Tavares

Changes by Hugo Lopes Tavares :


Added file: http://bugs.python.org/file18243/non-ascii.txt

___
Python tracker 
<http://bugs.python.org/issue9409>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9409] doctest in python2.7 can't handle non-ascii characters

2010-07-28 Thread Hugo Lopes Tavares

Changes by Hugo Lopes Tavares :


Added file: http://bugs.python.org/file18244/example.py

___
Python tracker 
<http://bugs.python.org/issue9409>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4773] HTTPMessage not documented and has inconsistent API across Py2/Py3

2013-03-28 Thread Hugo Lopes Tavares

Hugo Lopes Tavares added the comment:

I just caught a bug because on Python 3 `HTTPMessage` has `get_param`, while on 
Python 2 there is `getparam`, with a different method signature. I am trying to 
figure out a solution so my code can run in both python 2 and 3 without ifs on 
python version.

--
nosy: +hltbra

___
Python tracker 
<http://bugs.python.org/issue4773>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com