[issue10335] tokenize.open_python(): open a Python file with the right encoding

2010-11-07 Thread STINNER Victor

STINNER Victor  added the comment:

> what about open(.., encoding="fromcookie")?

Please don't do that. It remembers me the magical str.encode() method of 
Python2. I prefer simple API with limited features: if you want to open a 
Python script, use tokenize.open(), if you want to open an XML document use 
any XML library, etc. It remembers me also the discussion about detecting BOM 
in text files: issue #7651. There was no consensus, and so the issue is still 
open.

For this particular issue, I prefer a specific function tokenize..

--

___
Python tracker 

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



[issue10335] tokenize.open_python(): open a Python file with the right encoding

2010-11-07 Thread STINNER Victor

STINNER Victor  added the comment:

On Saturday 06 November 2010 17:00:15 you wrote:
> Note that it is useful for opening any text file with an encoding cookie,
> not only python source code, so "tokenize.open()" sounds attractive.

Ok, the new patch (tokenize_open-2.patch) uses tokenize.open() name and adds a 
test for BOM without coding cookie (test utf-8-sig encoding).

--
Added file: http://bugs.python.org/file19529/tokenize_open-2.patch

___
Python tracker 

___Index: Doc/library/tokenize.rst
===
--- Doc/library/tokenize.rst(révision 86167)
+++ Doc/library/tokenize.rst(copie de travail)
@@ -101,16 +101,18 @@
 If no encoding is specified, then the default of ``'utf-8'`` will be
 returned.
 
-:func:`detect_encoding` is useful for robustly reading Python source files.
-A common pattern for this follows::
+Use :func:`open` to open Python script: it uses :func:`detect_encoding` to
+detect the file encoding.
 
-def read_python_source(file_name):
-with open(file_name, "rb") as fp:
-encoding = tokenize.detect_encoding(fp.readline)[0]
-with open(file_name, "r", encoding=encoding) as fp:
-return fp.read()
 
+.. function:: open(filename)
 
+   Open a Python script in read mode using the encoding detected by
+   :func:`detect_encoding`.
+
+   .. versionadded:: 3.2
+
+
 Example of a script rewriter that transforms float literals into Decimal
 objects::
 
@@ -153,4 +155,3 @@
 result.append((toknum, tokval))
 return untokenize(result).decode('utf-8')
 
-
Index: Lib/py_compile.py
===
--- Lib/py_compile.py   (révision 86167)
+++ Lib/py_compile.py   (copie de travail)
@@ -104,9 +104,7 @@
 byte-compile all installed files (or all files in selected
 directories).
 """
-with open(file, "rb") as f:
-encoding = tokenize.detect_encoding(f.readline)[0]
-with open(file, encoding=encoding) as f:
+with tokenize.open(file) as f:
 try:
 timestamp = int(os.fstat(f.fileno()).st_mtime)
 except AttributeError:
Index: Lib/tabnanny.py
===
--- Lib/tabnanny.py (révision 86167)
+++ Lib/tabnanny.py (copie de travail)
@@ -93,11 +93,8 @@
 check(fullname)
 return
 
-with open(file, 'rb') as f:
-encoding, lines = tokenize.detect_encoding(f.readline)
-
 try:
-f = open(file, encoding=encoding)
+f = tokenize.open(file)
 except IOError as msg:
 errprint("%r: I/O Error: %s" % (file, msg))
 return
Index: Lib/tokenize.py
===
--- Lib/tokenize.py (révision 86167)
+++ Lib/tokenize.py (copie de travail)
@@ -29,6 +29,7 @@
 from token import *
 from codecs import lookup, BOM_UTF8
 import collections
+from io import TextIOWrapper
 cookie_re = re.compile("coding[:=]\s*([-\w.]+)")
 
 import token
@@ -335,6 +336,20 @@
 return default, [first, second]
 
 
+_builtin_open = open
+
+def open(filename):
+"""
+Open a Python script in read mode with the right encoding.
+"""
+buffer = _builtin_open(filename, 'rb')
+encoding, line = detect_encoding(buffer.readline)
+buffer.seek(0)
+text = TextIOWrapper(buffer, encoding, line_buffering=True)
+text.mode = 'r'
+return text
+
+
 def tokenize(readline):
 """
 The tokenize() generator requires one argment, readline, which
Index: Lib/trace.py
===
--- Lib/trace.py(révision 86167)
+++ Lib/trace.py(copie de travail)
@@ -419,10 +419,9 @@
 def find_executable_linenos(filename):
 """Return dict where keys are line numbers in the line number table."""
 try:
-with io.FileIO(filename, 'r') as file:
-encoding, lines = tokenize.detect_encoding(file.readline)
-with open(filename, "r", encoding=encoding) as f:
+with tokenize.open_python(filename) as f:
 prog = f.read()
+encoding = f.encoding
 except IOError as err:
 print(("Not printing coverage data for %r: %s"
   % (filename, err)), file=sys.stderr)
Index: Lib/linecache.py
===
--- Lib/linecache.py(révision 86167)
+++ Lib/linecache.py(copie de travail)
@@ -123,9 +123,7 @@
 else:
 return []
 try:
-with open(fullname, 'rb') as fp:
-coding, line = tokenize.detect_encoding(fp.readline)
-with open(fullname, 'r', encoding=coding) as fp:
+with tokenize.open(fullname) as fp:
 lines = fp

[issue6317] winsound.PlaySound doesn't accept non-unicode string

2010-11-07 Thread Hirokazu Yamamoto

Hirokazu Yamamoto  added the comment:

I've committed in r86283(py3k). I'll merge this into
release31-maint and release27-maint.

--
resolution:  -> fixed
stage:  -> committed/rejected
status: open -> closed
versions:  -Python 2.6, Python 3.0

___
Python tracker 

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



[issue6317] winsound.PlaySound doesn't accept non-unicode string

2010-11-07 Thread Martin v . Löwis

Martin v. Löwis  added the comment:

As for back-porting: I'm not sure this is a bug in 2.7. It just doesn't support 
Unicode filenames, but that's not (inherently) a bug. In 3.1, I can agree that 
it's a bug - but we need to preserve the bytes support for compatibility.

For 3.2, dropping the bytes support is fine with me.

--

___
Python tracker 

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



[issue10346] strange arithmetic behaviour

2010-11-07 Thread Alexey Radkov

New submission from Alexey Radkov :

The following excerpt will show the issue:

$ python
Python 2.7 (r27:82500, Sep 16 2010, 18:02:00) 
[GCC 4.5.1 20100907 (Red Hat 4.5.1-3)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> 8 * 4 / ( 2 - 7 ) * 6 / 3
-14
>>>

Why it is evaluated to -14 ?? In floating point arithmetic it should be -12.8, 
in integer arithmetic i believe it should be -12 (at least bc and a small 
dedicated C program evaluate it to -12). Perhaps i do not understand some 
specific python arithmetic priority or associativity rules, anyway i cannot 
find a specific combinations of them to yield -14 in this expression.

--
components: None
messages: 120665
nosy: alexey.radkov
priority: normal
severity: normal
status: open
title: strange arithmetic behaviour
type: behavior
versions: Python 2.7

___
Python tracker 

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



[issue6317] winsound.PlaySound doesn't accept non-unicode string

2010-11-07 Thread Hirokazu Yamamoto

Hirokazu Yamamoto  added the comment:

> As for back-porting: I'm not sure this is a bug in 2.7. It just
> doesn't support Unicode filenames, but that's not (inherently)
> a bug.

> In 3.1, I can agree that it's a bug - but we need to preserve the
> bytes support for compatibility.

I agree.

> For 3.2, dropping the bytes support is fine with me.

Is this also applied to *all* ANSI Win32 API
in other sources?

--

___
Python tracker 

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



[issue10346] strange arithmetic behaviour

2010-11-07 Thread Mark Dickinson

Mark Dickinson  added the comment:

It's not a bug:  you're seeing Python's rules for integer division, which do 
indeed differ from those of (some) other languages when either the divisor or 
the dividend is negative.  For integers x and y, in Python 2.x, x / y gives the 
floor of the exact quotient.

>>> -32 / 5
-7
>>> 32 / -5
-7

In Python 3.x, the '/' operator does 'true division', giving you (a 
floating-point approximation to) the true result:

>>> -32 / 5
-6.4
>>> 32 / -5
-6.4

You can also get this behaviour in Python 2.x if you start your script with 
'from __future__ import division'.

See the documentation at:

http://docs.python.org/reference/expressions.html#binary-arithmetic-operations

for more.

--
nosy: +mark.dickinson
resolution:  -> invalid
status: open -> closed

___
Python tracker 

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



[issue10336] test_xmlrpc fails if gzip is not supported by client

2010-11-07 Thread Hirokazu Yamamoto

Hirokazu Yamamoto  added the comment:

Sorry, I cannot. I don't know HTTP.

--

___
Python tracker 

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



[issue10337] testTanh() of test_math fails on "NetBSD 5 i386 3.x"

2010-11-07 Thread Mark Dickinson

Mark Dickinson  added the comment:

I'm not sure what can reasonably be done about these failures.  The Python test 
is failing because of a deficiency in the system math library.

Adding extra code to Python to handle this (making use of 
TANH_PRESERVES_ZERO_SIGN) is an option, but it seems like overkill to me.

I definitely don't want to remove these tests---they're valuable.  If there's a 
way of marking the test as an expected failure on NetBSD 5 then that would be 
fine, I guess.

We should also report the problem upstream.

--

___
Python tracker 

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



[issue10297] decimal module documentation is misguiding

2010-11-07 Thread Mark Dickinson

Changes by Mark Dickinson :


--
nosy: +rhettinger

___
Python tracker 

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



[issue10297] decimal module documentation is misguiding

2010-11-07 Thread Mark Dickinson

Mark Dickinson  added the comment:

Fixed in r86286, r86287, r86288.

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

___
Python tracker 

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



[issue6317] winsound.PlaySound doesn't accept non-unicode string

2010-11-07 Thread Hirokazu Yamamoto

Hirokazu Yamamoto  added the comment:

I've committed in r86291(release31-maint).

--

___
Python tracker 

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



[issue10325] PY_LLONG_MAX & co - preprocessor constants or not?

2010-11-07 Thread Mark Dickinson

Mark Dickinson  added the comment:

Here's a patch (against py3k) incorporating your suggestions.  Would you be 
willing to review?

[Removing Python 2.6 from versions since it's no longer maintained for 
non-security issues.)

--
keywords: +patch
versions:  -Python 2.6
Added file: http://bugs.python.org/file19530/issue10325.patch

___
Python tracker 

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



[issue10325] PY_LLONG_MAX & co - preprocessor constants or not?

2010-11-07 Thread Mark Dickinson

Changes by Mark Dickinson :


Added file: http://bugs.python.org/file19531/issue10325.patch

___
Python tracker 

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



[issue10325] PY_LLONG_MAX & co - preprocessor constants or not?

2010-11-07 Thread Mark Dickinson

Changes by Mark Dickinson :


Removed file: http://bugs.python.org/file19530/issue10325.patch

___
Python tracker 

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



[issue9873] urllib.parse: Allow bytes in some APIs that use string literals internally

2010-11-07 Thread Nick Coghlan

Nick Coghlan  added the comment:

Just a note for myself when I next update the patch: the 2-tuple returned by 
defrag needs to be turned into a real result type of its own, and the 
decode/encode methods on result objects should be tested explicitly.

--

___
Python tracker 

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



[issue7652] Merge C version of decimal into py3k.

2010-11-07 Thread Mark Dickinson

Mark Dickinson  added the comment:

On Wed, Nov 3, 2010 at 3:28 AM, Case Van Horsen  wrote:
> Has the cdecimal branch kept up with the hash value changes in 3.2?

Not sure;  that's a question for Stefan.

> Is there a still a chance that cdecimal could be merged into 3.2?

A chance, yes;  the major need is for someone with time to do a full
review.  (I'm afraid that's not me, right now.)

--

___
Python tracker 

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



[issue10027] os.lstat/os.stat don't set st_nlink on Windows

2010-11-07 Thread Hirokazu Yamamoto

Hirokazu Yamamoto  added the comment:

I found Win32 FileID API. With this library, it seems
we can use GetFileInformationByHandleEx before Vista.
We can get real file name and hard link count from handle.

http://www.microsoft.com/downloads/en/details.aspx?FamilyID=1DECC547-AB00-4963-A360-E4130EC079B8&displaylang=en

I don't have a patch, but maybe it is worth to implement it.

--

___
Python tracker 

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



[issue10145] float.is_integer is undocumented

2010-11-07 Thread Mark Dickinson

Mark Dickinson  added the comment:

Fixed in r86293, r86394, r86295.

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

___
Python tracker 

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



[issue10052] Python/dtoa.c:158: #error "Failed to find an exact-width 32-bit integer type" (FreeBSD 4.11 + gcc 2.95.4)

2010-11-07 Thread Mark Dickinson

Mark Dickinson  added the comment:

Thanks for the patch.  This looks fine, in principle.

A couple of comments and questions:

(1) I think the patch should provide *MIN values alongside the *MAX values (for 
signed types only, of course).

(2) Are we sure that these values are valid on all FreeBSD 4 platforms, or 
should these definitions be further restricted to Free BSD 4 / x86?

(3) Are the types of the constants definitely correct?  E.g., UINT64_MAX should 
have type uint64_t.  That gets a bit tricky, since we can't use casts (which 
would prevent these constants being used in preprocessor #ifs), so we need to 
determine exactly what basic types uint32_t and uint64_t match, and make sure 
to use the correct suffix (e.g., ULL, LL, UL, L).  For uint32_t I guess this is 
easy:  it'll almost certainly be the same type as unsigned int.  Is uint64_t 
defined as unsigned long long, or as unsigned long?

--

___
Python tracker 

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



[issue10226] urlparse example is wrong

2010-11-07 Thread Senthil Kumaran

Senthil Kumaran  added the comment:

Fixed the wordings in r86296(py3k), r86297(release31-maint) and 
r86298(release27-maint).

David, for the examples you mentioned, the first one's parsing logic follows 
the explanation that is written. It is correct.

For the second example, the port value not being a DIGIT exhibits such a 
behavior.  I am unable to recollect the reason for this behavior. 
Either the URL is invalid (PORT is not a DIGIT, and parse module is simply 
ignoring to raise an error - it's okay, given the input is invalid) or it needs 
to distinguish the ':' as a port separator from path separator for some valid 
urls.

I think, if we find a better reason to change something for the second 
scenario, we shall address that.

--
resolution:  -> fixed
stage:  -> committed/rejected
status: open -> closed
type:  -> behavior

___
Python tracker 

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



[issue10337] testTanh() of test_math fails on "NetBSD 5 i386 3.x"

2010-11-07 Thread STINNER Victor

STINNER Victor  added the comment:

Here is a patch skipping math and cmath tests if TANH_PRESERVES_ZERO_SIGN is 0.

--
keywords: +patch
Added file: http://bugs.python.org/file19532/skip_tanh_sign.patch

___
Python tracker 

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



[issue10337] testTanh() of test_math fails on "NetBSD 5 i386 3.x"

2010-11-07 Thread STINNER Victor

Changes by STINNER Victor :


Added file: http://bugs.python.org/file19533/skip_tanh_sign-2.patch

___
Python tracker 

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



[issue10337] testTanh() of test_math fails on "NetBSD 5 i386 3.x"

2010-11-07 Thread STINNER Victor

STINNER Victor  added the comment:

Commited to Python 3.2 (r86299) after a review of Mark Dickson on IRC. Thanks 
Mark ;-)

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

___
Python tracker 

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



[issue2001] Pydoc interactive browsing enhancement

2010-11-07 Thread Nick Coghlan

Nick Coghlan  added the comment:

I'd actually started typing out the command to commit this before it finally 
clicked that the patch changes public APIs of the pydoc module in incompatible 
ways. Sure, they aren't documented, but the fact they aren't protected by an 
underscore means I'm not comfortable with the idea of removing them or 
radically change their functionality without going through a deprecation period 
first.

I've attached my version of the patch which includes some additional 
documentation cleanups and a tweak to test_pyclbr (since the pydoc changes 
broke that test through no fault of their own).

However, the public (albeit undocumented) nature of the APIs implementing the 
old Tk GUI means I'm not comfortable committing the patch in a form that simply 
drops them without going through a deprecation period first.

So, the way forward from here:
1. The good news is beta 1 has been pushed back to December 4 for other 
reasons, so there's still more time to work on this
2. The gui() function should still open the Tkinter GUI, and the -g option 
should be retained with its old functionality. Invoking this function should 
trigger DeprecationWarning.
3. A serve() function to start the web server component should be added back in
4. The new behaviour of opening the web client can be provided as a "browse()" 
function (that accepts the port number the server is listening on as an 
argument).

--

___
Python tracker 

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



[issue10337] testTanh() of test_math fails on "NetBSD 5 i386 3.x"

2010-11-07 Thread Mark Dickinson

Mark Dickinson  added the comment:

Nice fix!  Thanks.

--

___
Python tracker 

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



[issue2001] Pydoc interactive browsing enhancement

2010-11-07 Thread Nick Coghlan

Changes by Nick Coghlan :


Added file: http://bugs.python.org/file19534/issue2001_ncoghlan_cleanup.diff

___
Python tracker 

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



[issue10337] testTanh() of test_math fails on "NetBSD 5 i386 3.x"

2010-11-07 Thread Mark Dickinson

Mark Dickinson  added the comment:

P.S. Greg, as the owner of the buildbot, do you feel like reporting this 
upstream?  I get the impression that it's easier to do the reporting directly 
from the NetBSD machine in question...

--

___
Python tracker 

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



[issue10347] regrtest progress counter makes -f option less useful

2010-11-07 Thread Antoine Pitrou

New submission from Antoine Pitrou :

The regrtest progress counter ("[  1/350]") is very nice but makes it less 
practical to use the "-f" option to regrtest.

--
components: Tests
messages: 120684
nosy: georg.brandl, pitrou
priority: low
severity: normal
status: open
title: regrtest progress counter makes -f option less useful
type: behavior
versions: Python 3.2

___
Python tracker 

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



[issue10337] testTanh() of test_math fails on "NetBSD 5 i386 3.x"

2010-11-07 Thread STINNER Victor

STINNER Victor  added the comment:

> P.S. Greg, as the owner of the buildbot, do you feel like reporting this
> upstream?  I get the impression that it's easier to do the reporting
> directly from the NetBSD machine in question...

I already reported the bug upstream: "Thank you for your problem report. You 
should receive confirmation of your problem report and an internal 
identification number by electronic mail in less than 24 hours."

--

___
Python tracker 

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



[issue10347] regrtest progress counter makes -f option less useful

2010-11-07 Thread Georg Brandl

Georg Brandl  added the comment:

Right. Let's make -f ignore leading [...] in the file :)

--

___
Python tracker 

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



[issue10329] trace.py and unicode in Python 3

2010-11-07 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

For the record, the test failure can reproduced by the following:

$ LANG=C ./python -m test.regrtest test_imp test_trace
[1/2] test_imp
[2/2] test_trace
/home/antoine/py3k/__svn__/Lib/unittest/case.py:402: ResourceWarning: unclosed 
file <_io.TextIOWrapper name='@test_11986_tmp/os.cover' 
encoding='ANSI_X3.4-1968'>
  result.addError(self, sys.exc_info())
test test_trace failed -- Traceback (most recent call last):
  File "/home/antoine/py3k/__svn__/Lib/test/test_trace.py", line 296, in 
test_coverage
self._coverage(tracer)
  File "/home/antoine/py3k/__svn__/Lib/test/test_trace.py", line 291, in 
_coverage
r.write_results(show_missing=True, summary=True, coverdir=TESTFN)
  File "/home/antoine/py3k/__svn__/Lib/trace.py", line 334, in write_results
lnotab, count)
  File "/home/antoine/py3k/__svn__/Lib/trace.py", line 384, in 
write_results_file
outfile.write(line.expandtabs(8))
UnicodeEncodeError: 'ascii' codec can't encode character '\xa0' in position 5: 
ordinal not in range(128)

1 test OK.
1 test failed:
test_trace


There's a strange interaction between test_imp and test_trace, it seems. Not 
sure why.

--
stage: unit test needed -> needs patch

___
Python tracker 

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



[issue10337] testTanh() of test_math fails on "NetBSD 5 i386 3.x"

2010-11-07 Thread STINNER Victor

STINNER Victor  added the comment:

NetBSD bug report: 
http://gnats.netbsd.org/cgi-bin/query-pr-single.pl?number=44057

--

___
Python tracker 

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



[issue9561] distutils: set encoding to utf-8 for input and output files

2010-11-07 Thread STINNER Victor

STINNER Victor  added the comment:

This issue might be splitted in multiple issue: one issue per file type (eg. 
Makefile, RPM spec file, etc.).

--

___
Python tracker 

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



[issue10329] trace.py and unicode in Python 3

2010-11-07 Thread STINNER Victor

STINNER Victor  added the comment:

$ LANG=C ./python -m test.regrtest test_imp test_trace
[1/2] test_imp
[2/2] test_trace
...
UnicodeEncodeError: 'ascii' codec can't encode character '\xa0' in position 5: 
ordinal not in range(128)

issue10329.diff fixes this failure. The failure comes from a nonbreaking space 
introduced by myself by error in Lib/os.py, which is the only non-ASCII 
character in this file. r86302 removes it.

I commited issue10329.diff to Python 3.2 as r86303: thanks Alex ;-)

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

___
Python tracker 

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



[issue10342] trace module cannot produce coverage reports for zipped modules

2010-11-07 Thread STINNER Victor

STINNER Victor  added the comment:

I commited Alexander's fix for #10329: r86303. The trace module now uses the 
input Python script encoding, instead of the locale encoding.

--

___
Python tracker 

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



[issue2001] Pydoc interactive browsing enhancement

2010-11-07 Thread René Liebscher

René Liebscher  added the comment:

What about http://bugs.python.org/issue2001#msg114326 ?

--

___
Python tracker 

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



[issue6317] winsound.PlaySound doesn't accept non-unicode string

2010-11-07 Thread Martin v . Löwis

Martin v. Löwis  added the comment:

> Is this also applied to *all* ANSI Win32 API
> in other sources?

No. I think there are backwards compatibility concerns in some of the
APIs, so this must be discussed on python-dev.

--

___
Python tracker 

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



[issue10329] trace.py and unicode in Python 3

2010-11-07 Thread Alexander Belopolsky

Alexander Belopolsky  added the comment:

Reopening as a reminder to add a unit test for this case.

--
stage: needs patch -> unit test needed
status: closed -> open

___
Python tracker 

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



[issue775964] fix test_grp failing when NIS entries present

2010-11-07 Thread Bobby Impollonia

Bobby Impollonia  added the comment:

Martin, are you able to check in this fix? If not, what should I do and whom 
should I talk to so this can be checked in?

Thanks.

--

___
Python tracker 

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



[issue775964] fix test_grp failing when NIS entries present

2010-11-07 Thread Martin v . Löwis

Martin v. Löwis  added the comment:

I'm able to, but I may not find time. Ask on python-dev; if you feel you need 
to push this, offer to review issues in return.

--

___
Python tracker 

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



[issue10347] regrtest progress counter makes -f option less useful

2010-11-07 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

Fixed in r86307.

--
resolution:  -> fixed
stage:  -> committed/rejected
status: open -> closed

___
Python tracker 

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



[issue5066] IDLE documentation for Unix obsolete/incorrect

2010-11-07 Thread Jessica McKellar

Jessica McKellar  added the comment:

Attached is a patch updating the IDLE web documentation as well as the help 
file displayed when you click the Help -> Idle Help menu item in IDLE. It looks 
like the IDLE web documentation was lifted directly from the help file at some 
point and they have gotten out of sync.

The section of the document describing starting IDLE was updated in March of 
2009, so I've left that alone. I've updated the Menu option descriptions in 
both files, including: adding missing items, making the help file and web 
document descriptions the same, and using a consistent format.

The patch is against release27-maint.

--
keywords: +patch
nosy: +jesstess
versions: +Python 2.7, Python 3.2 -Python 2.6, Python 3.0
Added file: http://bugs.python.org/file19535/issue5066.patch

___
Python tracker 

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



[issue10303] small inconsistency in tutorial

2010-11-07 Thread Kent Johnson

Kent Johnson  added the comment:

Attached patch deletes the referenced sentence.

--
keywords: +patch
nosy: +kjohnson
Added file: http://bugs.python.org/file19536/issue10303.diff

___
Python tracker 

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



[issue1602] windows console doesn't print utf8 (Py30a2)

2010-11-07 Thread STINNER Victor

STINNER Victor  added the comment:

I don't understand exactly the goal of this issue. Different people described 
various bugs of the Windows console, but I don't see any problem with Python 
here. It looks like it's just not possible to display correctly unicode with 
the Windows console (the whole unicode charset, not the current code page 
subset).

- 65001 code page: it's not the same encoding than utf-8 and so it cannot be 
set as an alias to utf-8 (see #6058) => nothing to do, or maybe document that 
PYTHONIOENCODING=utf-8 workaround... But if you do that, you may get strange 
errors when writing to stdout or stderr like "IOError: [Errno 13] Permission 
denied" or "IOError: [Errno 2] No such file or directory" ...
- chcp command sets the console encoding, which is stupid because the console 
still expects text encoded to the previous code page => Windows (chcp command) 
bug, chcp command should not be used (it doesn't solve any problem, it just 
makes the situation worse)
- use the console API instead of read()/write() to fix this issue: it doesn't 
work, the console is completly buggy (msg120414) => Windows (console) bug
- use "Lucida Console" font avoids some issue => I don't think that the Python 
interpreter should configure the console (using SetCurrentConsoleFontEx?), it's 
not the role of Python

To me, there is nothing to do, and so I close the bug.

If you would like to fix a particular Python bug, open a new specific issue. If 
you consider that I'm wrong, Python should fix this issue and you know how, 
please reopen it.

--
resolution:  -> invalid
status: open -> closed

___
Python tracker 

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



[issue10342] trace module cannot produce coverage reports for zipped modules

2010-11-07 Thread Alexander Belopolsky

Alexander Belopolsky  added the comment:

I am attaching a "proof of concept" patch.  The trace code is in a dire need of 
restructuring to eliminate repeated reading of source files.

--
keywords: +needs review, patch
nosy: +eli.bendersky, terry.reedy
stage: unit test needed -> patch review
Added file: http://bugs.python.org/file19537/issue10342.diff

___
Python tracker 

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



[issue10316] tkFileDialog.askopenfilenames scrambling multiple file selection

2010-11-07 Thread Ned Deily

Ned Deily  added the comment:

Postscript: I've subsequently noticed Issue5712 in which somewhat similar 
symptoms are reported but, so far, only on Windows systems.  If your problem is 
not yet resolved, you might want to chime in there.

--

___
Python tracker 

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



[issue10342] trace module cannot produce coverage reports for zipped modules

2010-11-07 Thread Alexander Belopolsky

Changes by Alexander Belopolsky :


--
nosy: +brett.cannon

___
Python tracker 

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



[issue10342] trace module cannot produce coverage reports for zipped modules

2010-11-07 Thread STINNER Victor

STINNER Victor  added the comment:

+try:
+with open(filename, 'rb') as fp:
+encoding, _ = tokenize.detect_encoding(fp.readline)
+except IOError:
+encoding = None

You should use 'utf-8' instead of None (which will fall back to the locale 
encoding) here.

--

___
Python tracker 

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



[issue10342] trace module cannot produce coverage reports for zipped modules

2010-11-07 Thread Alexander Belopolsky

Alexander Belopolsky  added the comment:

On Sun, Nov 7, 2010 at 8:47 PM, STINNER Victor  wrote:
>
> STINNER Victor  added the comment:
>
> +            try:
> +                with open(filename, 'rb') as fp:
> +                    encoding, _ = tokenize.detect_encoding(fp.readline)
> +            except IOError:
> +                encoding = None
>
> You should use 'utf-8' instead of None (which will fall back to the locale 
> encoding) here.
>

I know.  I was too lazy to look up the correct spelling for the proof
of concept.  I am really posting this patch to show how this bug can
be fixed in theory and discuss how much of refactoring is acceptable.
For example, do we need to preserve trace.find_strings() function?
What is the best way to pass around source code? - file-like objects,
line iterators, readline-like function?  Also compile(prog, filename,
"exec") to find module's bytecode is a hack.  There must be a standard
way to achieve that which would use a .pyc file if available.

--

___
Python tracker 

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



[issue10348] multiprocessing: use SYSV semaphores on FreeBSD

2010-11-07 Thread STINNER Victor

New submission from STINNER Victor :

Support POSIX semaphore on FreeBSD is recent, optional (eg. disabled by default 
in FreeBSD 7) and limited (30 semaphores). SYSV should be used instead because 
they are less limited or more adjustable (at runtime: POSIX semaphore requires 
to recompile the kernel!).

This issue should fix test_concurrent_futures on FreeBSD 7.2 and 8.0: many 
tests use more than 30 semaphores. The maximum is 
test_all_completed_some_already_completed: 52 semaphores.

--
components: Library (Lib)
keywords: buildbot
messages: 120705
nosy: db3l, haypo
priority: normal
severity: normal
status: open
title: multiprocessing: use SYSV semaphores on FreeBSD
versions: Python 3.2

___
Python tracker 

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



[issue10303] small inconsistency in tutorial

2010-11-07 Thread Senthil Kumaran

Senthil Kumaran  added the comment:

Fixed in r86310. print was used in some examples following its mention, so a 
simple introduction to it was okay. It is introduced properly further down in 
the tutorial.

--
nosy: +orsenthil
resolution:  -> fixed
stage: needs patch -> committed/rejected
status: open -> closed
type:  -> behavior

___
Python tracker 

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



[issue10342] trace module cannot produce coverage reports for zipped modules

2010-11-07 Thread Brett Cannon

Brett Cannon  added the comment:

The handling of __loader__ looks fine to me, although I don't quite see the 
point of the get_source call as it isn't returned or used.

--

___
Python tracker 

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



[issue10342] trace module cannot produce coverage reports for zipped modules

2010-11-07 Thread Alexander Belopolsky

Alexander Belopolsky  added the comment:

On Sun, Nov 7, 2010 at 8:59 PM, Brett Cannon  wrote:

> .. I don't quite see the point of the get_source call as it isn't returned or 
> used.

It is passed to find_docstrings() to produce the "strs" dictionary.

--

___
Python tracker 

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



[issue10348] multiprocessing: use SysV semaphores on FreeBSD

2010-11-07 Thread STINNER Victor

STINNER Victor  added the comment:

It looks like SysV semaphores are also preferred on Darwin. So I suppose that 
Mac OS X would also benefit of this issue. Maybe also other OSes (Solaris?).

See also issue #7272.

--
nosy: +jnoller
title: multiprocessing: use SYSV semaphores on FreeBSD -> multiprocessing: use 
SysV semaphores on FreeBSD

___
Python tracker 

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



[issue10226] urlparse example is wrong

2010-11-07 Thread R. David Murray

R. David Murray  added the comment:

Senthil, no it isn't.  There is no way to know a priori that ':80' represents a 
port number rather than a path, absent the // introducer for the netloc.

This bug is fixed; I ought to open a new one for the path thing but perhaps I 
will wait for a user report instead :)

--

___
Python tracker 

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



[issue10308] Modules/getpath.c bugs

2010-11-07 Thread STINNER Victor

STINNER Victor  added the comment:

3.2a3 chunk#2 cannot fail because PyUnicode_AsWideChar() only returns -1 if the 
first argument is NULL, whereas we just checked that decoded is not NULL. But 
it would be better to fix the variable type to avoid future bugs.

--

___
Python tracker 

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



[issue6058] Add cp65001 to encodings/aliases.py

2010-11-07 Thread STINNER Victor

STINNER Victor  added the comment:

Different tests proved that cp65001 can *not* be set as an alias to utf-8, and 
that's why I'm closing this issue.

Anyway, I don't think that cp65001 is configured by default on any Windows 
setup. It is only set by the user, using the chcp command, to try to display 
unicode characters in the Windows console: but it is not possible to display 
any unicode character in this console (see issue #1602). And chcp command 
should not be used in the Windows console because it does not only change the 
ANSI code page: it changes also the console code page, which is wrong (the 
console still expect text encoded to the previous code page).

It is possible to implement a codec for cp65001 using utf-8 existing codec in 
surrogatepass mode, or by using MultiByteToWideChar() / WideCharToMultiByte() 
with codepage=CP_UTF8. But I don't think that we need cp65001 at all.

If you need cp65001 for a good reason and you would like to implement a cp65001 
Python codec, open a new issue.

If you consider that we should use _O_U8TEXT or  _O_U16TEXT, open another new 
issue.

_O_U8TEXT or  _O_U16TEXT might improve unicode support if Python output is 
redirected to a pipe, but I don't think that it would help to display unicode 
character in the Windows console. I also fear that it breaks existing code and 
any function not aware of this special mode.

--
resolution:  -> invalid
status: open -> closed

___
Python tracker 

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



[issue2986] difflib.SequenceMatcher not matching long sequences

2010-11-07 Thread Eli Bendersky

Eli Bendersky  added the comment:

Adding a documentation patch for 3.1 which is similar to the 2.6 documentation 
patch that's been committed by Georg into 2.6

--
Added file: http://bugs.python.org/file19538/issue2986.docs31.1.patch

___
Python tracker 

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



[issue1195] Problems on Linux with Ctrl-D and Ctrl-C during raw_input

2010-11-07 Thread Jeong-Min Lee

Changes by Jeong-Min Lee :


--
nosy: +falsetru

___
Python tracker 

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



[issue10349] Error in Module/python.c when building on OpenBSD 4.8

2010-11-07 Thread Prabhu Gurumurthy

New submission from Prabhu Gurumurthy :

When manually building on OpenBSD 4.8 using gcc 4.2.1, I got the following 
error:

g++ -pthread -c -fno-strict-aliasing -DNDEBUG -g -fwrapv -O3 -Wall 
-Wstrict-prototypes  -I. -IInclude 
-I/usr/home/pgurumur/temp/Python-3.1.2/Include -DTHREAD_STACK_SIZE=0x2 
-fPIC -I/usr/include  -DPy_BUILD_CORE -o Modules/python.o 
/usr/home/pgurumur/temp/Python-3.1.2/Modules/python.ccc1plus: warning: command 
line option "-Wstrict-prototypes" is valid for C/ObjC but not for 
C++/usr/home/pgurumur/temp/Python-3.1.2/Modules/python.c: In function 'wchar_t* 
char2wchar(char*)':/usr/home/pgurumur/temp/Python-3.1.2/Modules/python.c:60: 
error: invalid conversion from 'void*' to 'wchar_t*'*** Error code 1

I changed line 60 from:
res = PyMem_Malloc(argsize*sizeof(wchar_t));

to:
res = (wchar_t *)PyMem_Malloc(argsize*sizeof(wchar_t));

I was able to compile it successfully, another thing you would notice is that, 
-Wstrict-prototypes is not a valid option with g++, (just a warning though)

My configure options:

 /usr/home/pgurumur/temp/Python-3.1.2/configure --with-fpectl --with-threads 
--srcdir=/usr/home/pgurumur/temp/Python-3.1.2 --enable-ipv6 --enable-shared 
--with-cxx_main --with-signal-module --prefix=/opt/local

--
components: Build
messages: 120714
nosy: pgurumur
priority: normal
severity: normal
status: open
title: Error in Module/python.c when building on OpenBSD 4.8
versions: Python 3.1

___
Python tracker 

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



[issue10217] python-2.7.amd64.msi install fails

2010-11-07 Thread Bill Barrett

Bill Barrett  added the comment:

Same problem here. I also tried command line launch and get the same warning 
dialog as I got by clicking Firefox Download.  My install "seems" to basically 
work however.  I used Task Manager to kill the Install Application to avoid 
unrolling the installation.

--
nosy: +Bill.Barrett
versions:  -Python 2.6

___
Python tracker 

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



[issue10349] Error in Module/python.c when building on OpenBSD 4.8

2010-11-07 Thread Martin v . Löwis

Martin v. Löwis  added the comment:

Out of curiosity: why are you building with --with-cxx_main?

--
nosy: +loewis

___
Python tracker 

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