[issue10299] Add index with links section for built-in functions

2010-11-06 Thread Éric Araujo

Éric Araujo  added the comment:

+1 on the general idea.  I applied the patch and built the documentation to see 
what the output looks like: The hotlinks are here and work, that’s cool, but I 
think the table wastes space.  You could use five columns without damaging 
usability (that is, summoning the hateful horizontal scrollbar), even in 
800×600 with an uncollapsed sidebar.

Alternative ideas like using a special unordered list with automatic CSS 3 
flowing or replacing the manual table with a new Sphinx directive would take a 
lot of time, so consider I’m +1 on whatever you decide best.

--
nosy: +eric.araujo

___
Python tracker 

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



[issue10299] Add index with links section for built-in functions

2010-11-06 Thread Éric Araujo

Éric Araujo  added the comment:

+1 on the general idea.  I applied the patch and built the documentation to see 
what the output looks like: The hotlinks are here and work, that’s cool, but I 
think the table wastes space.  You could use five columns without damaging 
usability (that is, summoning the hateful horizontal scrollbar), even in 
800×600 with an uncollapsed sidebar.

Alternative ideas like using a special unordered list with automatic CSS 3 
flowing or replacing the manual table with a new Sphinx directive would take a 
lot of time, so consider I’m +1 on whatever you decide best.

--
nosy: +eric.araujo

___
Python tracker 

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



[issue10334] Add new reST directive for links to source code

2010-11-06 Thread Georg Brandl

Georg Brandl  added the comment:

OK, I added a "source" role in r86256.  It can be used as Alex showed:

either like :source:`ast module Python source code `
(with an explicit link title)

or like :source:`Lib/ast.py`
(where the link title is the file name).

--
resolution:  -> accepted
status: open -> closed

___
Python tracker 

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



[issue8910] Write a text file explaining why Lib/test/data exists

2010-11-06 Thread Éric Araujo

Éric Araujo  added the comment:

By the way, is this file picked up by Tools/msi/msi.py?

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

___
Python tracker 

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



[issue5412] extend configparser to support mapping access(__*item__)

2010-11-06 Thread R. David Murray

R. David Murray  added the comment:

Email uses 'failobj' instead of 'default'.  I find that kind of odd, but oh 
well.

I'm not sure how useful a single data point is, but just last month I wrote an 
application that uses the DEFAULT section.  Each configfile section gives a set 
of parameters describing certain attributes of an input file, and the DEFAULT 
section gives the default values for each of those parameters.  A few years ago 
I had an application that made heavy use of interpolation and provided for 
config files that would override 'earlier' config files, and I used the 
'defaults' parameter to the constructor to achieve this easily.  I'm pretty 
sure I also added a few defaults programatically, but the memory is a bit hazy 
(I no longer maintain that application and I don't think it is in use any 
longer).

--
nosy: +r.david.murray

___
Python tracker 

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



[issue10273] Clean-up Unittest API

2010-11-06 Thread Raymond Hettinger

Raymond Hettinger  added the comment:

> people who are used to the current spelling 
> will have to notice the change, note that one 
> name is now deprecated

I haven't proposed any deprecations.
Just add the new names as aliases.
Change the docs list the new names
as primary and mention the old name for reference.

We don't have to sticking with crummy naming.

--

___
Python tracker 

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



[issue2931] optparse: various problems with unicode and gettext

2010-11-06 Thread Steven Bethard

Steven Bethard  added the comment:

Yep, argparse almost certainly has the same kind of problems - I basically 
copied the optparse gettext behavior into argparse because I don't really know 
how that stuff works but figured people must have wanted what was in there. ;-)

--

___
Python tracker 

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



[issue10324] Modules/binascii.c: simplify expressions

2010-11-06 Thread Nicolas Kaiser

Nicolas Kaiser  added the comment:

Sorry, found it - with patched builds of Python 2.6.5 and 3.1.2:

python2.6 test_binascii.py
test_base64invalid (__main__.BinASCIITest) ... ok
test_base64valid (__main__.BinASCIITest) ... ok
test_crc32 (__main__.BinASCIITest) ... ok
test_empty_string (__main__.BinASCIITest) ... ok
test_exceptions (__main__.BinASCIITest) ... ok
test_functions (__main__.BinASCIITest) ... ok
test_hex (__main__.BinASCIITest) ... ok
test_qp (__main__.BinASCIITest) ... ok
test_uu (__main__.BinASCIITest) ... ok

--
Ran 9 tests in 0.002s

OK

python3.1 test_binascii.py
test_base64invalid (__main__.BinASCIITest) ... ok
test_base64valid (__main__.BinASCIITest) ... ok
test_crc32 (__main__.BinASCIITest) ... ok
test_empty_string (__main__.BinASCIITest) ... ok
test_exceptions (__main__.BinASCIITest) ... ok
test_functions (__main__.BinASCIITest) ... ok
test_hex (__main__.BinASCIITest) ... ok
test_no_binary_strings (__main__.BinASCIITest) ... ok
test_qp (__main__.BinASCIITest) ... ok
test_uu (__main__.BinASCIITest) ... ok

--
Ran 10 tests in 0.006s

OK

--

___
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-06 Thread STINNER Victor

New submission from STINNER Victor :

In Python3, the following pattern becomes common:

with open(fullname, 'rb') as fp:
coding, line = tokenize.detect_encoding(fp.readline)
with open(fullname, 'r', encoding=coding) as fp:
...

It opens the file is opened twice, whereas it is unnecessary: it's possible to 
reuse the raw buffer to create a text file. And I don't like the 
detect_encoding() API: pass the readline function is not intuitive.

I propose to create tokenize.open_python() function with a very simple API: 
just one argument, the filename. This function calls detect_encoding() and only 
open the file once.

Attached python adds the function with an unit test and a patch on the 
documentation. It patchs also functions currently using detect_encoding().

open_python() only supports read mode. I suppose that it is enough.

--
components: Library (Lib), Unicode
files: open_python.patch
keywords: patch
messages: 120600
nosy: haypo
priority: normal
severity: normal
status: open
title: tokenize.open_python(): open a Python file with the right encoding
versions: Python 3.2
Added file: http://bugs.python.org/file19518/open_python.patch

___
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-06 Thread STINNER Victor

STINNER Victor  added the comment:

> 1. It opens the source file one more time.  This is probably acceptable
> because existing code already opens it at least four times when -m (show
> missing) option is selected.  (Twice in find_executable_linenos() and
> twice in linecache.getlines().  Fixing that would require refactoring of
> linecache code.

Create a function like linecache.getencoding() seems to be overkill.

I created issue #10335 to add a function tokenize.open_python(): open a Python 
script in read mode without opening the file twice and get the encoding with 
detect_encoding(). This issue is more generic than trying to optimize the 
trace module.

> 2. This will not work for source code not stored in a file, but provided by
> a __loader__.get_source() method.  However it looks like trace will not
> work at all in this case, so fixing that is a separate issue.

For this case, I think that we can add a try/except IOError with a fallback to 
encoding = 'utf-8'.

--

___
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-06 Thread Hirokazu Yamamoto

New submission from Hirokazu Yamamoto :

In test_xmlrpc.py,

def test_gsip_response(self):
# (sniP)
self.assertTrue(a>b)

last line can fail if gzip is not supported by client.
(gzip is not set in HTTP header's Accept-Encoding)

==
FAIL: test_gsip_response (__main__.GzipServerTestCase)
--
Traceback (most recent call last):
  File "e:\python-dev\py3k\lib\test\test_xmlrpc.py", line 722, in test_gsip_resp
onse
self.assertTrue(a>b)
AssertionError: False is not True

--
components: Library (Lib)
messages: 120602
nosy: ocean-city
priority: normal
severity: normal
status: open
title: test_xmlrpc fails if gzip is not supported by client
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



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

2010-11-06 Thread Hirokazu Yamamoto

Changes by Hirokazu Yamamoto :


--
Removed message: http://bugs.python.org/msg120602

___
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-06 Thread Hirokazu Yamamoto

New submission from Hirokazu Yamamoto :

In test_xmlrpc.py,

def test_gsip_response(self):
# (sniP)
self.assertTrue(a>b)

last line can fail if gzip is not supported by client.
(gzip is not set in HTTP header's Accept-Encoding)

--

___
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-06 Thread STINNER Victor

New submission from STINNER Victor :

On "NetBSD 5 i386 3.x" buildbot, testTanh() of test_math fails because the sign 
of wrong.

configure scripts has a test to check if tanh(-0.0) keeps the sign or no, and 
on this buildbot the result is "no". pyconfig.h contains a 
TANH_PRESERVES_ZERO_SIGN define, but it is not used in Modules/mathmodule.c. 
Extract of configure comment:

# On FreeBSD 6.2, it appears that tanh(-0.) returns 0. instead of
# -0. on some architectures.

---

http://www.python.org/dev/buildbot/builders/NetBSD%205%20i386%203.x/builds/237/steps/configure/logs/stdio
...
checking whether tanh preserves the sign of zero... no
...

http://www.python.org/dev/buildbot/builders/NetBSD%205%20i386%203.x/builds/237/steps/test/logs/stdio
==
FAIL: testTanh (test.test_math.MathTests)
--
Traceback (most recent call last):
  File 
"/home/buildbot/buildarea/3.x.smith-netbsd-i386/build/Lib/test/test_math.py", 
line 898, in testTanh
math.copysign(1., -0.))
AssertionError: 1.0 != -1.0

--

--
components: Library (Lib)
messages: 120604
nosy: haypo
priority: normal
severity: normal
status: open
title: testTanh() of test_math fails on "NetBSD 5 i386 3.x"
versions: Python 3.1, 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-06 Thread STINNER Victor

Changes by STINNER Victor :


--
nosy: +mark.dickinson

___
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-06 Thread STINNER Victor

STINNER Victor  added the comment:

test_cmath does also fail:

http://www.python.org/dev/buildbot/builders/NetBSD%205%20i386%203.x/builds/237/steps/test/logs/stdio
==
FAIL: test_specific_values (test.test_cmath.CMathTests)
--
Traceback (most recent call last):
  File 
"/home/buildbot/buildarea/3.x.smith-netbsd-i386/build/Lib/test/test_cmath.py", 
line 348, in test_specific_values
msg=error_message)
  File 
"/home/buildbot/buildarea/3.x.smith-netbsd-i386/build/Lib/test/test_cmath.py", 
line 94, in rAssertAlmostEqual
'got {!r}'.format(a, b))
AssertionError: tanh0002: tanh(complex(-0.0, 0.0))
Expected: complex(-0.0, 0.0)
Received: complex(0.0, 0.0)
Received value insufficiently close to expected value.

--

--

___
Python tracker 

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



[issue1926] NNTPS support in nntplib

2010-11-06 Thread Andrew Vant

Andrew Vant  added the comment:

Here's a second version of the previous patch taking into account the errors 
Antoine noticed and some odds and ends from the other comments. Specifically: 

Comments fixed and tabs (I think...I hope...) all removed.

Added explicit skip to test_nntplib when attempting to test starttls using a 
server that doesn't support it. 

Exceptions raised when issuing STARTTLS for: Authorization already done, TLS 
already active, server not advertising STARTTLS.

Method moving: I'm not sure why the first patch seemed to think I was e.g. 
moving getwelcome (I wasn't, as far as I knew), but this time I put the new 
functions at the end of the class and it's no longer doing it. (still a bit of 
a mess for the code moved from __init__ to login, starttls, and readermode 
though) 

Selftest cli option: I threw out what I did before (as pointed out, it didn't 
work anyway) and added a -l flag to use SSL. It uses port 563 for the test only 
if the user hasn't asked for a non-default port. 


I'd like to address some of the objections other users have to the way I 
implemented it the first time.


NNTPS and STARTTLS separation: 

One objection noted that nntps and STARTTLS support are really separate things 
and should be handled as such. Actually they're probably right. I did both at 
once because I view them as simply two ways of performing the same function, as 
someone mentioned earlier in the thread.


Unnecessary Method Separation: 

One objection noted that separating out login and starttls was unnecessary and 
the calling program shouldn't have to worry about these steps. I disagree; I 
think the caller should be able to choose when and if to log in or engage 
encryption. (in fact I think usenetrc should be false by default for this 
reason, but I figure that would break backwards compatibility for programs that 
rely on it being true by default, and I'm not sure what the rules are regarding 
this) 

More significant than my own potentially newbie-ish opinion is that the RFC 
suggests as a valid use case the idea of a client starting up TLS or 
authentication in reaction to a 483 command response, rather than right off the 
bat. I'm pretty sure this is impossible under the current setup, where 
login/encryption happens only at initialization and there's no method exposed 
to do it later. 

If I'm going to get overruled on this, I guess the other option is to add a 
starttls argument to the constructors. If so, I'd suggest it have settings to 
forbid starttls, use it if it's advertised, or insist on it (by raising an 
exception if it can't be used). Perhaps false/none/true respectively. 


Existing issue for AUTHINFO and MODE READER:

One objection noted there's already an issue open for them (#10287). Which is 
true, but the AUTHINFO and MODE READER changes were necessary to make STARTTLS 
work as intended. (in my opinion, I suppose) So I did them as I went along. I'm 
not sure if I violated custom there, but my apologies if so.

At least having them functioned out will make most of what's mentioned in 10287 
easier to fix, I suppose. 


Randomness:

BTW, I've been maintaining the readermode_afterauth thing because of the 
comment next to it, but it sounds from that other issue like it's not supposed 
to be there at all...which kind of restores my faith in the universe since it 
smelled bad from the start to me.

--
Added file: http://bugs.python.org/file19519/python_nntp_ssl_patch2.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-06 Thread STINNER Victor

Changes by STINNER Victor :


--
nosy: +gregory.p.smith

___
Python tracker 

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



[issue10338] test_lib2to3 failure on buildbot x86 debian parallel 3.x: node is None in find_root()

2010-11-06 Thread STINNER Victor

New submission from STINNER Victor :

http://www.python.org/dev/buildbot/builders/x86%20debian%20parallel%203.x/builds/806/steps/test/logs/stdio

test test_lib2to3 failed -- multiple errors occurred

==
ERROR: test_bom (lib2to3.tests.test_refactor.TestRefactoringTool)
--
Traceback (most recent call last):
  File 
"/home2/buildbot2/slave/3.x.loewis-parallel/build/Lib/lib2to3/tests/test_refactor.py",
 line 239, in test_bom
data = self.check_file_refactoring(fn)
  File 
"/home2/buildbot2/slave/3.x.loewis-parallel/build/Lib/lib2to3/tests/test_refactor.py",
 line 186, in check_file_refactoring
rt.refactor_file(test_file)
  File 
"/home2/buildbot2/slave/3.x.loewis-parallel/build/Lib/lib2to3/refactor.py", 
line 348, in refactor_file
tree = self.refactor_string(input, filename)
  File 
"/home2/buildbot2/slave/3.x.loewis-parallel/build/Lib/lib2to3/refactor.py", 
line 380, in refactor_string
self.refactor_tree(tree, name)
  File 
"/home2/buildbot2/slave/3.x.loewis-parallel/build/Lib/lib2to3/refactor.py", 
line 441, in refactor_tree
find_root(node)
  File 
"/home2/buildbot2/slave/3.x.loewis-parallel/build/Lib/lib2to3/fixer_util.py", 
line 276, in find_root
while node.type != syms.file_input:
AttributeError: 'NoneType' object has no attribute 'type'

==
ERROR: test_crlf_newlines (lib2to3.tests.test_refactor.TestRefactoringTool)
--
Traceback (most recent call last):
  File 
"/home2/buildbot2/slave/3.x.loewis-parallel/build/Lib/lib2to3/tests/test_refactor.py",
 line 248, in test_crlf_newlines
self.check_file_refactoring(fn, fixes)
  File 
"/home2/buildbot2/slave/3.x.loewis-parallel/build/Lib/lib2to3/tests/test_refactor.py",
 line 186, in check_file_refactoring
rt.refactor_file(test_file)
  File 
"/home2/buildbot2/slave/3.x.loewis-parallel/build/Lib/lib2to3/refactor.py", 
line 348, in refactor_file
tree = self.refactor_string(input, filename)
  File 
"/home2/buildbot2/slave/3.x.loewis-parallel/build/Lib/lib2to3/refactor.py", 
line 380, in refactor_string
self.refactor_tree(tree, name)
  File 
"/home2/buildbot2/slave/3.x.loewis-parallel/build/Lib/lib2to3/refactor.py", 
line 441, in refactor_tree
find_root(node)
  File 
"/home2/buildbot2/slave/3.x.loewis-parallel/build/Lib/lib2to3/fixer_util.py", 
line 276, in find_root
while node.type != syms.file_input:
AttributeError: 'NoneType' object has no attribute 'type'

==
ERROR: test_file_encoding (lib2to3.tests.test_refactor.TestRefactoringTool)
--
Traceback (most recent call last):
  File 
"/home2/buildbot2/slave/3.x.loewis-parallel/build/Lib/lib2to3/tests/test_refactor.py",
 line 235, in test_file_encoding
self.check_file_refactoring(fn)
  File 
"/home2/buildbot2/slave/3.x.loewis-parallel/build/Lib/lib2to3/tests/test_refactor.py",
 line 186, in check_file_refactoring
rt.refactor_file(test_file)
  File 
"/home2/buildbot2/slave/3.x.loewis-parallel/build/Lib/lib2to3/refactor.py", 
line 348, in refactor_file
tree = self.refactor_string(input, filename)
  File 
"/home2/buildbot2/slave/3.x.loewis-parallel/build/Lib/lib2to3/refactor.py", 
line 380, in refactor_string
self.refactor_tree(tree, name)
  File 
"/home2/buildbot2/slave/3.x.loewis-parallel/build/Lib/lib2to3/refactor.py", 
line 441, in refactor_tree
find_root(node)
  File 
"/home2/buildbot2/slave/3.x.loewis-parallel/build/Lib/lib2to3/fixer_util.py", 
line 276, in find_root
while node.type != syms.file_input:
AttributeError: 'NoneType' object has no attribute 'type'

==
ERROR: test_unencodable_diff (lib2to3.tests.test_main.TestMain)
--
Traceback (most recent call last):
  File 
"/home2/buildbot2/slave/3.x.loewis-parallel/build/Lib/lib2to3/tests/test_main.py",
 line 36, in test_unencodable_diff
ret = self.run_2to3_capture(["-"], input_stream, out_enc, err)
  File 
"/home2/buildbot2/slave/3.x.loewis-parallel/build/Lib/lib2to3/tests/test_main.py",
 line 25, in run_2to3_capture
return main.main("lib2to3.fixes", args)
  File "/home2/buildbot2/slave/3.x.loewis-parallel/build/Lib/lib2to3/main.py", 
line 168, in main
rt.refactor_stdin()
  File 
"/home2/buildbot2/slave/3.x.loewis-parallel/build/Lib/lib2to3/refactor.py", 
line 393, in refactor_stdin
tree = self.refactor_string(input, "")
  File 
"/home2/buildbot2/slave/3.x.loewis-parallel/build/Lib/lib2to3/refactor.py", 
line 380, in refactor_string
self.refactor_tree(tree, name)
  File 
"/home2/buildbot2/slave/3.x.loewis-parallel/build/Lib/lib2to3/refactor.py"

[issue10338] test_lib2to3 failure on buildbot x86 debian parallel 3.x: node is None in find_root()

2010-11-06 Thread STINNER Victor

Changes by STINNER Victor :


--
nosy: +loewis

___
Python tracker 

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



[issue1926] NNTPS support in nntplib

2010-11-06 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

Thanks for the patch, Andrew. It looks mostly good.

I would rename setreadermode to _setreadermode (there's no reason to
make it public IMO). Also, I would not explicitly check "STARTTLS" in
the capabilities. It the server doesn't support it, it will issue an
error anyway. Some servers might support it without advertising it, who
knows?

I can take care of all that when committing, you don't need to submit a
new patch (you can of course, if you want).

> (in fact I think usenetrc should be false by default for this reason,
> but I figure that would break backwards compatibility for programs
> that rely on it being true by default, and I'm not sure what the rules
> are regarding this) 

In 3.2, the reworked nntplib already breaks compatibility. It is
reasonable to switch the default for usenetrc to False; but I prefer to
do it in a separate commit for clarity.

--

___
Python tracker 

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



[issue10339] test_lib2to3 leaks

2010-11-06 Thread Antoine Pitrou

New submission from Antoine Pitrou :

This is only on 3.1:

$ ./python -m test.regrtest -R 3:3 test_lib2to3
test_lib2to3
beginning 6 repetitions
123456
No handlers could be found for logger "RefactoringTool"
..
test_lib2to3 leaked [32, 32, 32] references, sum=96

--
assignee: benjamin.peterson
components: 2to3 (2.x to 3.0 conversion tool), Tests
messages: 120609
nosy: benjamin.peterson, pitrou
priority: normal
severity: normal
stage: needs patch
status: open
title: test_lib2to3 leaks
type: resource usage
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



[issue1926] NNTPS support in nntplib

2010-11-06 Thread Julien ÉLIE

Julien ÉLIE  added the comment:

> More significant than my own potentially newbie-ish
> opinion is that the RFC suggests as a valid use case
> the idea of a client starting up TLS or authentication
> in reaction to a 483 command response, rather than right
> off the bat.

Yes.  (Currently, it would only be TLS with nntplib, because
SASL mechanisms which negotiate an encryption layer are not
implemented yet in nntplib.  But in case someone wishes to test,
I have the following capabilities on my news server,
news.trigofacile.com :
AUTHINFO USER SASL
SASL GSSAPI OTP PLAIN NTLM LOGIN DIGEST-MD5 CRAM-MD5
STARTTLS
)



> I'm pretty sure this is impossible under the current setup,
> where login/encryption happens only at initialization and
> there's no method exposed to do it later.

Absolutely.



> I've been maintaining the readermode_afterauth thing
[...]
> it smelled bad from the start to me.

Yep.  According to RFC 4643:

   Additionally, the client MUST NOT issue a MODE READER
   command after authentication, and a server MUST NOT advertise the
   MODE-READER capability.

--

___
Python tracker 

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



[issue4931] distutils does not show any error msg when can't build C module extensions due to a missing C compiler

2010-11-06 Thread Giampaolo Rodola'

Giampaolo Rodola'  added the comment:

I don't have the same setup I had at the time when I submitted the first 
message so maybe something has changed in meantime.
Below is what I get on Windows 2000 SP-3, no VS installed, python 2.7, before 
and after the patch.

C:\Documents and Settings\foo\Desktop\psutil>setup.py build
running build
running build_py
copying psutil\compat.py -> build\lib.win32-2.7\psutil
copying psutil\error.py -> build\lib.win32-2.7\psutil
copying psutil\_psbsd.py -> build\lib.win32-2.7\psutil
copying psutil\_pslinux.py -> build\lib.win32-2.7\psutil
copying psutil\_psmswindows.py -> build\lib.win32-2.7\psutil
copying psutil\_psosx.py -> build\lib.win32-2.7\psutil
copying psutil\_psposix.py -> build\lib.win32-2.7\psutil
copying psutil\__init__.py -> build\lib.win32-2.7\psutil
running build_ext
building '_psutil_mswindows' extension
error: Unable to find vcvarsall.bat


Although the message is improved ("Unable to find vcvarsall.bat" vs "None") it 
seems the patch had no effect.

--

___
Python tracker 

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



[issue1926] NNTPS support in nntplib

2010-11-06 Thread Andrew Vant

Andrew Vant  added the comment:

On 6 Nov 2010 at 11:48, Antoine Pitrou wrote:

> I would rename setreadermode to _setreadermode (there's no reason to
> make it public IMO). Also, I would not explicitly check "STARTTLS" in
> the capabilities. It the server doesn't support it, it will issue an
> error anyway. Some servers might support it without advertising it,
> who knows?
> 
> I can take care of all that when committing, you don't need to submit
> a new patch (you can of course, if you want).

I'd appreciate it if you took care of it, if you feel the patch is otherwise 
commit-worthy. It takes a pretty excessive amount of time to convince 
myself that it's really doing what I want it to (and only what I want it to).

I forgot to include a note for Misc/NEWS in the new patch version, 
by the way. 

> > (in fact I think usenetrc should be false by default for this
> > reason, but I figure that would break backwards compatibility for
> > programs that rely on it being true by default, and I'm not sure
> > what the rules are regarding this) 
> 
> In 3.2, the reworked nntplib already breaks compatibility. It is
> reasonable to switch the default for usenetrc to False; but I prefer
> to do it in a separate commit for clarity.

Okay. For the time being I left a note in the documentation pointing 
out that it had to be set False for starttls to be useful. 

--

Andrew

--

___
Python tracker 

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



[issue9508] python3.2 reversal of distutils reintrocud macos9 support

2010-11-06 Thread Benjamin Peterson

Benjamin Peterson  added the comment:

Fine.

2010/11/6 Éric Araujo :
>
> Éric Araujo  added the comment:
>
> Fixed in r86248, thanks.  BTW, my commit removes a bit more than yours 
> originally did.
>
> In 2.7, the unused distutils.sysconfig._init_mac function is still left over. 
>  I don’t know if killing dead code is acceptable in a stable version.  
> Benjamin?
>
> --
> assignee: tarek -> eric.araujo
> nosy: +benjamin.peterson, eric.araujo
> resolution:  -> fixed
> stage:  -> committed/rejected
> status: open -> closed
>
> ___
> Python tracker 
> 
> ___
>

--

___
Python tracker 

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



[issue10252] Fix resource warnings in distutils

2010-11-06 Thread Éric Araujo

Éric Araujo  added the comment:

The tests don’t pass on a Windows buildbot (thanks Antoine): I was mistaken 
about subprocess.Popen, it has no close method like os.popen objects.  Attached 
patch should fix it, can someone kindly review and/or test it?

--
nosy: +pitrou
Added file: http://bugs.python.org/file19520/fix-popen.diff

___
Python tracker 

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



[issue10252] Fix resource warnings in distutils

2010-11-06 Thread Éric Araujo

Changes by Éric Araujo :


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

___
Python tracker 

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



[issue9508] python3.2 reversal of distutils reintrocud macos9 support

2010-11-06 Thread Éric Araujo

Éric Araujo  added the comment:

Thanks for the reply.  r86264.

--

___
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-06 Thread Éric Araujo

Éric Araujo  added the comment:

Looks good.

In the test, do you have to remove the TESTFN file manually?  Isn’t that 
handled by unittest or regrtest?

I think the name of the function could be better but I don’t have a proposal.

--
nosy: +eric.araujo

___
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-06 Thread Éric Araujo

Éric Araujo  added the comment:

Do you want to make a patch?

--
nosy: +eric.araujo

___
Python tracker 

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



[issue8679] write a distutils to distutils2 converter

2010-11-06 Thread Éric Araujo

Éric Araujo  added the comment:

Rejected in http://hg.python.org/distutils2/rev/05f890cbd877: “Removing the 
converter. This is not going to work out. We have better ideas about d1 -> d2 
migration paths” (like mkpkg, now mkcfg, still to be given a better name :).

--
dependencies:  -add a metadata section in setup.cfg, add a resource+files 
section in setup.cfg, update mkpkg to latest coding standards
resolution:  -> rejected
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



[issue10340] asyncore doesn't properly handle EINVAL on OSX

2010-11-06 Thread Giampaolo Rodola'

New submission from Giampaolo Rodola' :

http://code.google.com/p/pyftpdlib/issues/detail?id=143
This comes from a user who sent me a report via e-mail. Unfortunately I don't 
have an OSX box to test against.

Code which should replicate the problem is this:

import socket, struct
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.setsockopt(socket.SOL_SOCKET, socket.SO_LINGER, struct.pack('ii', 1, 0))
s.connect(('localhost', 21))
s.close()

...while this is a fix I think it should work:

Index: Lib/asyncore.py
===
--- Lib/asyncore.py (revisione 86084)
+++ Lib/asyncore.py (copia locale)
@@ -242,7 +242,7 @@
 try:
 self.addr = sock.getpeername()
 except socket.error, err:
-if err.args[0] == ENOTCONN:
+if err.args[0] in (ENOTCONN, EINVAL):
 # To handle the case where we got an unconnected
 # socket.
 self.connected = False


Nosying ixokai as I know he has an OSX box to test against.
Setting "high" priority and type == "security" as asyncore-based servers are 
likely to crash because of this.
It might even make sense to backport the fix in Python 2.6 because of the 
security implications.

--
components: Library (Lib)
keywords: patch
messages: 120620
nosy: giampaolo.rodola, ixokai
priority: high
severity: normal
stage: patch review
status: open
title: asyncore doesn't properly handle EINVAL on OSX
type: security
versions: Python 2.6, Python 2.7, Python 3.1, Python 3.2

___
Python tracker 

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



[issue10341] Remove traces of setuptools

2010-11-06 Thread Éric Araujo

New submission from Éric Araujo :

There are some leftovers of the short-lived presence of setuptools in the 
CPython source tree, precisely in Tools/msi/msi.py and Makefile.pre.in.  
Attached patch removes them.

--
components: Build
files: remove-setuptools-leftovers.diff
keywords: patch
messages: 120621
nosy: eric.araujo, loewis
priority: normal
severity: normal
stage: patch review
status: open
title: Remove traces of setuptools
versions: Python 2.7, Python 3.1, Python 3.2
Added file: http://bugs.python.org/file19521/remove-setuptools-leftovers.diff

___
Python tracker 

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



[issue10334] Add new reST directive for links to source code

2010-11-06 Thread Ezio Melotti

Changes by Ezio Melotti :


--
nosy: +ezio.melotti
stage:  -> committed/rejected

___
Python tracker 

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



[issue8680] Add a sandbox in Distutils2

2010-11-06 Thread th3flyboy

th3flyboy  added the comment:

Hey, even if it's not perfect, it would be nice to at least see partial sand 
boxing in Python, rather than none at all. I'm working on an open source game 
project that uses Python, but recently the issue of security came up involving 
using python scripts with malicious intent or even just on accident that may 
cause security issues with user generated content. It would be great to be able 
to see even a built in sandbox that just covers python scripts, let alone calls 
to C/C++ code. Even if it's not perfect, some is better than none in my opinion.

--
nosy: +th3flyboy

___
Python tracker 

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



[issue8680] Add a sandbox in Distutils2

2010-11-06 Thread Éric Araujo

Éric Araujo  added the comment:

We’re saying the same thing :)  It all depends on the promise: If you’re making 
a best-effort sandbox, you’re trying to do the best you can, in cooperation 
with your users.  For a game, I think you want an iron-clad sandbox that is 
totally error-proof.  See https://pypi.python.org/pypi/pysandbox/1.0.3 for such 
a thing.

--

___
Python tracker 

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



[issue8680] Add a sandbox in Distutils2

2010-11-06 Thread th3flyboy

th3flyboy  added the comment:

Cool, thanks for that link, that should really help. One quick question 
however, do you or anyone else know if that will work under Python 3, we 
currently use 2, however it would be nice to be able to future proof for moving 
to 3.

--

___
Python tracker 

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



[issue10304] error in tutorial triple-string example

2010-11-06 Thread Malte Helmert

Malte Helmert  added the comment:

I see. (The tutorial really talks about the interactive interpreter though -- I 
don't think IDLE has been mentioned yet.)

--

___
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-06 Thread Alexander Belopolsky

New submission from Alexander Belopolsky :

Please run attached zip archive as a python script.  Note that the problem is 
not specific for using __main__.py - any module that comes from a zip archive 
or loaded by a custom loader would show the same bug. 

$ unzip -l test.zip 
Archive:  test.zip
  Length Date   TimeName
    
   79  10-24-08 18:26   __main__.py
    ---
   79   1 file
$ $ cat __main__.py
from trace import Trace

def traced(flag):
if flag:
return 1
else:
return 2

tracer = Trace()
tracer.runfunc(traced, False)
results = tracer.results()
results.write_results(coverdir='.')

$ python testtrace.zip 
 --- modulename: __main__, funcname: traced
Not printing coverage data for 'testtrace.zip/__main__.py': [Errno 20] Not a 
directory: 'testtrace.zip/__main__.py'
__main__.py(4): __main__.py(7): $

--
assignee: belopolsky
components: Library (Lib)
files: testtrace.zip
messages: 120626
nosy: belopolsky, haypo
priority: normal
severity: normal
stage: unit test needed
status: open
title: trace module cannot produce coverage reports for zipped modules
type: behavior
versions: Python 3.2
Added file: http://bugs.python.org/file19522/testtrace.zip

___
Python tracker 

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



[issue8680] Add a sandbox in Distutils2

2010-11-06 Thread Éric Araujo

Éric Araujo  added the comment:

I think there is some py3 support in pysandbox, but I’m not sure, and this 
discussion is off-topic for this bug tracker.  If you don’t find anything in 
the links on the pysandbox page, feel free to ask on the python-list mailing 
list.

--

___
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-06 Thread STINNER Victor

STINNER Victor  added the comment:

> In the test, do you have to remove the TESTFN file manually?  Isn’t that
> handled by unittest or regrtest?

The test uses TESTFN+'.py', not TESTFN ;-)

> I think the name of the function could be better but I don’t have a
> proposal.

Do you prefer a name like tokenize.open()?

--

___
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-06 Thread Éric Araujo

Éric Araujo  added the comment:

> The test uses TESTFN+'.py', not TESTFN ;-)
Ah, right.  You can use addCleanup then.

> Do you prefer a name like tokenize.open()?
Hm, tokenize being “Tokenization help for Python programs”, I think this name 
is rather good.  Or tokenize.open_source.

--

___
Python tracker 

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



[issue10341] Remove traces of setuptools

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

Martin v. Löwis  added the comment:

LGTM.

--

___
Python tracker 

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



[issue10252] Fix resource warnings in distutils

2010-11-06 Thread Éric Araujo

Éric Araujo  added the comment:

Committed to py3k in r86274, after “LGTM” from Brian on IRC.  Will backport if 
buildbots don’t scream at me.

--

___
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-06 Thread Alexander Belopolsky

Alexander Belopolsky  added the comment:

+1 on adding the function.

Note that it is useful for opening any text file with an encoding cookie, not 
only python source code, so "tokenize.open()" sounds attractive.

Once we are at it, I would like to factor out and document code that extracts 
the cookie from a decoded string.  This functionality is useful for tools that 
produce annotated source code and want to preserve source encoding in their 
output.  See issue10329.

Also, to answer Victor's comment on issue10329, msg120601, while using this 
function simplifies dealing with source files in trace module, it does not 
solve all the issues: source file will still be opened separately in 
linecache.gettines() and find_executable_linenos() and  
find_executable_linenos() still does not respect __loader__ interface.  See 
issue 10342.

--
nosy: +belopolsky

___
Python tracker 

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



[issue10341] Remove traces of setuptools

2010-11-06 Thread Éric Araujo

Éric Araujo  added the comment:

Thanks, committed to py3k in r86275.  Shall I backport to the stable branches?  
(On another bug, Benjamin told me it was acceptable to remove dead code in 
stable branches.)

--

___
Python tracker 

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



[issue10341] Remove traces of setuptools

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

Martin v. Löwis  added the comment:

In this case, backporting is ok (but IMO not needed).

--

___
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-06 Thread Éric Araujo

Éric Araujo  added the comment:

> Note that it is useful for opening any text file with an encoding
> cookie, not only python source code,
This is cool.  doctest could benefit from that, I think.

> so "tokenize.open()" sounds attractive.
Agreed, even though the docstring of tokenize does talk about Python code.

--

___
Python tracker 

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



[issue10340] asyncore doesn't properly handle EINVAL on OSX

2010-11-06 Thread Stephen Hansen

Stephen Hansen  added the comment:

I can verify the problem exists in asyncore at release27-maint on the mac, and 
that the below patch fixes it.

After applying, I ran a full regrtest and nothing new broke.

--

___
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-06 Thread Alexander Belopolsky

Alexander Belopolsky  added the comment:

On Sat, Nov 6, 2010 at 12:15 PM, Éric Araujo  wrote:
..
>> so "tokenize.open()" sounds attractive.
> Agreed, even though the docstring of tokenize does talk about Python code.

I still like "tokenize.open()" more, but for the sake of completeness
of discussion, what about open(.., encoding="fromcookie")?  (I know,
tokenize.detect_encoding() also looks for an utf-8 BOM, so
"fromcookie" can be improved.)

--

___
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-06 Thread Éric Araujo

Éric Araujo  added the comment:

I don’t know if it would be okay to depend on tokenize in io.  Anyway, I tend 
to prefer tokenize.open over builtins.open(..., encoding='fromcookie').

--
nosy: +pitrou

___
Python tracker 

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



[issue10340] asyncore doesn't properly handle EINVAL on OSX

2010-11-06 Thread Giampaolo Rodola'

Giampaolo Rodola'  added the comment:

While writing a test case for this I found out another problem in asyncore: 
handle_connect was erroneously called when the dispatcher delegates the 
connection to a handler resulting in ENOTCONN being raised.
Patch in attachment targeted for python 2.7 should fix both issues.

--

___
Python tracker 

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



[issue10340] asyncore doesn't properly handle EINVAL on OSX

2010-11-06 Thread Giampaolo Rodola'

Changes by Giampaolo Rodola' :


--
nosy: +josiah.carlson
versions: +Python 2.5

___
Python tracker 

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



[issue10340] asyncore doesn't properly handle EINVAL on OSX

2010-11-06 Thread Giampaolo Rodola'

Giampaolo Rodola'  added the comment:

Forgot to attach the patch.

--
Added file: http://bugs.python.org/file19523/asyncore.patch

___
Python tracker 

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



[issue1926] NNTPS support in nntplib

2010-11-06 Thread StevenJ

StevenJ  added the comment:

The only comment I have is, if the caller needs to organise when to auth and 
instigate tls then for completeness getcapabilities() should have an option to 
force a reget of the current capabilities, in line with rfc3977 5.2.2:

> An NNTP client MAY cache the results of this command, but MUST NOT 
> rely on the correctness of any cached results, whether from earlier
> in this session or from a previous session, MUST cope gracefully 
> with the cached status being out of date, and SHOULD (if caching
> results) provide a way to force the cached information to be
> refreshed.

As it stands, the nntplib can cause the cached capabilities to be refreshed at 
certain points automatically (as it should), but I 
think it should be possible for the caller of the method to also specify that 
fresh capabilities are required and not cached ones.

something like this perhaps? :

mynntp.getcapabilites(refresh=True)

--

___
Python tracker 

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



[issue10341] Remove traces of setuptools

2010-11-06 Thread Éric Araujo

Éric Araujo  added the comment:

Given your recent email on python-dev about backporting changes that don’t fix 
bugs, I will not backport this.  2.5 and 2.6 were fine with the unneeded lines, 
2.7 and 3.1 will be too.

--
assignee:  -> eric.araujo
resolution:  -> fixed
stage: patch review -> committed/rejected
status: open -> closed
versions:  -Python 2.7, Python 3.1

___
Python tracker 

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



[issue10252] Fix resource warnings in distutils

2010-11-06 Thread Brian Curtin

Changes by Brian Curtin :


Added file: http://bugs.python.org/file19524/fix_pipe_close.diff

___
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-06 Thread Georg Brandl

Georg Brandl  added the comment:

+1 for the feature.  However, tokenize.open() sounds a bit unspecific.  But I 
don't really have better suggestions; open_cookie() is wrong too, since it 
doesn't open cookies :)

--
nosy: +georg.brandl

___
Python tracker 

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



[issue10252] Fix resource warnings in distutils

2010-11-06 Thread Éric Araujo

Éric Araujo  added the comment:

Thanks for the patch.  r86276

--

___
Python tracker 

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



[issue1926] NNTPS support in nntplib

2010-11-06 Thread Andrew Vant

Andrew Vant  added the comment:

On 6 Nov 2010 at 17:23, StevenJ wrote:

> As it stands, the nntplib can cause the cached capabilities to be
> refreshed at certain points automatically (as it should), but I think
> it should be possible for the caller of the method to also specify
> that fresh capabilities are required and not cached ones.

I agree. I actually added a way to do this when I functioned out 
__init__, so that starttls could refresh it when required. 

It was ugly and not exposed to the caller though. 

> something like this perhaps? :
> 
> mynntp.getcapabilites(refresh=True)

My method sucked, this one doesn't. Might belong in a separate issue 
though. (I feel like a bit of a hypocrite saying that now) 

--

Andrew

--

___
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-06 Thread Hallvard B Furuseth

Hallvard B Furuseth  added the comment:

Mark Dickinson writes:
> Thanks for the report; I agree that there's a potential issue here, and
> I also think that all these definitions *should* be preprocessor
> defines.

Indeed, my suggestion to castify everything for uniformity was silly: My
own PY_TIMEOUT_MAX fix illustrates why that won't promote portability.
It breaks code which #ifdefs between using LONG_MAX and PY_LLONG_MAX.

> (Idle question: does C99 require that LONG_MAX and friends are
> usable in the preprocessor?  ...)

5.2.4.2.1p1: Sizes of integer types .

> Can you suggest a suitable fix for the PY_ULLONG_MAX and PY_LLONG_MAX
> defines?  (...)

As far as I can tell, PC/pyconfig.h already solves it for Windows.

For pyport.h, since you do #define SIZEOF_LONG_LONG:

#define PY_LLONG_MAX \
(1 + 2 * ((Py_LL(1) << (CHAR_BIT*SIZEOF_LONG_LONG-2)) - 1))
#define PY_ULLONG_MAX (PY_LLONG_MAX * 2ULL + 1)

You could check PY_ULLONG_MAX with a compile-time assertion if you want:

#ifndef __cplusplus /* this requires different magic in C++ */

/* Compile-time assertion -- max one per post-preprocessed line */
#define Py_static_assert(expr) Py_static_assert1_(expr, __LINE__)
#define Py_static_assert1_(expr, line) Py_static_assert2_(expr, line)
#define Py_static_assert2_(expr, line) struct Py_static_assert##line { \
int Assert1_[(expr) ? 9 : -9]; int Assert2_: (expr) ? 9 : -9; }

Py_static_assert(PY_ULLONG_MAX == (unsigned long long)-1);

#endif /* __cplusplus */

> BTW, do you know of any modern non-Windows platforms that don't define
> LLONG_MIN and LLONG_MAX?  It may well be that the "two's complement"
> fallback hasn't been exercised in recent years.

Anyting compiled with strict ANSI pre-C99 mode, e.g. gcc -ansi, which
you do have a workaround for.  But gcc isn't the only one to be slow in
upgrading to C99.

And unfortunately, even if Python is built without a compiler's
equivalent of -ansi, a user embedding Python might be compiling with it.

Beyond that: No, I know none, but I don't know many platforms anyway.

>> Incidentally, the "two's complement" comment is wrong.
>> It also relies on unsigned long long being widest type with no
>> padding bits, and -LLONG_MAX-1 not being a trap representation.
> 
> Agreed---that comment needs to be better.  I think it's fine, though,
> for practical purposes to assume an absence of padding bits and no trap
> representation; IIRC there are places internally (e.g., in the bitwise
> operators section of the 'int' type implementation) that already assume
> two's complement + no padding bits + no trap representation.

I expect so, yes.  It's easy to find breakage with non-two's complement,
just grep the C code for '~'.  I just get peeved when people get this
wrong, then document and promote the errors:)

--

___
Python tracker 

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



[issue10343] urllib.parse problems with bytes vs str

2010-11-06 Thread Hallvard B Furuseth

New submission from Hallvard B Furuseth :

urlunparse(url or params = bytes object) produces a result
with the repr of the bytes object.

urllib.parse.urlunparse(['http', 'host', '/dir', b'params', '', ''])
--> "http://host/dir;b'params'"

That's confusing since urllib/parse.py goes to a lot of trouble to
support both bytes and str.  Simplest fix is to only accept str:

Index: Lib/urllib/parse.py
@@ -219,5 +219,5 @@ def urlunparse(components):
 scheme, netloc, url, params, query, fragment = components
 if params:
-url = "%s;%s" % (url, params)
+url = ';'.join((url, params))
 return urlunsplit((scheme, netloc, url, query, fragment))
 
Some people at comp.lang.python tell me code shouldn't anyway do str()
just in case it is needed like urllib does, not that I can make much
sense of that discussion.  (Subject: harmful str(bytes)).

BTW, the str vs bytes code doesn't have to be quite as painful as in
urllib.parse, I enclose patch which just rearranges and factors out
some code.

--
components: Library (Lib)
files: parse.diff
keywords: patch
messages: 120647
nosy: hfuru
priority: normal
severity: normal
status: open
title: urllib.parse problems with bytes vs str
type: behavior
versions: Python 3.2
Added file: http://bugs.python.org/file19525/parse.diff

___
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-06 Thread Hallvard B Furuseth

Hallvard B Furuseth  added the comment:

I wrote:
> #define PY_LLONG_MAX \
> (1 + 2 * ((Py_LL(1) << (CHAR_BIT*SIZEOF_LONG_LONG-2)) - 1))
> #define PY_ULLONG_MAX (PY_LLONG_MAX * 2ULL + 1)

Eh, Py_ULL(2).

> (...)  I just get peeved when people get this
> wrong, then document and promote the errors:)

Just to be clear, I'm peeving at the comment, not the code.

--

___
Python tracker 

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



[issue10343] urllib.parse problems with bytes vs str

2010-11-06 Thread R. David Murray

R. David Murray  added the comment:

I believe this is effectively a duplicate of issue 9873.  If not, it is still 
probably more appropriate to add commentary there rather than have a separate 
bug here.

--
nosy: +r.david.murray
resolution:  -> duplicate
stage:  -> committed/rejected
status: open -> closed
superseder:  -> urllib.parse: Allow bytes in some APIs that use string literals 
internally

___
Python tracker 

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



[issue935117] pkgutil doesn't understand case-senseless filesystems

2010-11-06 Thread Éric Araujo

Changes by Éric Araujo :


--
versions: +Python 3.1, Python 3.2

___
Python tracker 

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



[issue850728] Semaphore.acquire() timeout parameter

2010-11-06 Thread Torsten Landschoff

Torsten Landschoff  added the comment:

Thanks for applying!

--

___
Python tracker 

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



[issue10344] codecs.readline doesn't care buffering=0

2010-11-06 Thread Santiago Piccinini

New submission from Santiago Piccinini :

codecs.readline has an internal buffer of 72 chars so calling codecs.open with 
buffering=0 doesn't work as expected although buffering is passed to the 
underlying __builtin__.open call.

Example session:

Python 3.2a3+ (py3k, Nov  6 2010, 16:17:14) 
[GCC 4.5.1] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import codecs
>>> f = codecs.open("foo.txt", "w", "utf-8")
>>> word = "bar\n"
>>> content = word * 1000
>>> f.write(content)
>>> f.close()
>>> f = codecs.open("foo.txt", "rb", "utf-8", buffering=0)
>>> f.readline()
'bar\n'
>>> f.tell()
72

--
components: Library (Lib)
messages: 120652
nosy: Santiago.Piccinini
priority: normal
severity: normal
status: open
title: codecs.readline doesn't care buffering=0
type: behavior
versions: Python 2.7, Python 3.1, Python 3.2

___
Python tracker 

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



[issue10344] codecs.readline doesn't care buffering=0

2010-11-06 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc  added the comment:

Antoine, should codecs.open() be removed or simply aliased to open()?

--
nosy: +amaury.forgeotdarc, pitrou

___
Python tracker 

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



[issue9857] SkipTest in tearDown is reported an as an error

2010-11-06 Thread Mark Roddy

Mark Roddy  added the comment:

Attaching patch which adds support for registering a skip when raised from 
tearDown.  Per Michael's point regarding failed tests, this is only handled if 
the test has been successful when SkipTest is raised from tearDown.

--
keywords: +patch
nosy: +MarkRoddy
Added file: http://bugs.python.org/file19526/python3k.skipteardown.patch

___
Python tracker 

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



[issue9857] SkipTest in tearDown is reported an as an error

2010-11-06 Thread Mark Roddy

Mark Roddy  added the comment:

Attaching patch which does the same as the previous for the release27-maint 
branch.

--
Added file: http://bugs.python.org/file19527/python27.skipteardown.patch

___
Python tracker 

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



[issue10344] codecs.readline doesn't care buffering=0

2010-11-06 Thread Marc-Andre Lemburg

Marc-Andre Lemburg  added the comment:

Amaury Forgeot d'Arc wrote:
> 
> Amaury Forgeot d'Arc  added the comment:
> 
> Antoine, should codecs.open() be removed or simply aliased to open()?

Both is not possible: codecs.open() provides a different API than
open(). Unlike open(), codecs.open() allow use of all available
codecs, not just ones that decode to Unicode.

Regarding the issue itself: I think this is a wrong interpretation of
what the buffering parameter does. File buffering is different
from .readline() buffering (which can be customized on a per-call
basis by specifying a size parameter).

Besides, switching buffering off in open() is only allowed for
binary files, so open() wouldn't "solve" the mentioned behavior.

The only way to implement "unbuffered" .readline() in the way
that Santiago appears to be after would be to set the size parameter
to 1 for all .readline() calls. That would result in very poor
performance, though.

I think we should close this issue as "won't fix".

--
nosy: +lemburg

___
Python tracker 

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



[issue10345] fcntl.ioctl always fails claiming an invalid fd

2010-11-06 Thread Ben Gamari

New submission from Ben Gamari :

Even the simple example included below fails in the following manner,

$ sudo python3.1 hi.py 
 3
Traceback (most recent call last):
  File "hi.py", line 13, in 
ioctl(a, EVIOCGID, buf, True)
TypeError: ioctl requires a file or file descriptor, an integer and optionally 
an integer or buffer argument

As the debugging output demonstrates, the fileno() is in fact a valid fd.


#!/usr/bin/python
from fcntl import ioctl
EVIOCGID = 1
f = open('/dev/input/mouse0', 'w')
buf = bytes([0]*128)
a = (f.fileno(),)
print(a.__class__, a)
ioctl(a, EVIOCGID, buf, True)
print(buf)

--
components: Extension Modules
messages: 120657
nosy: bgamari
priority: normal
severity: normal
status: open
title: fcntl.ioctl always fails claiming an invalid fd
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



[issue10345] fcntl.ioctl always fails claiming an invalid fd

2010-11-06 Thread Ben Gamari

Changes by Ben Gamari :


--
type:  -> behavior

___
Python tracker 

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



[issue10344] codecs.readline doesn't care buffering=0

2010-11-06 Thread Santiago Piccinini

Santiago Piccinini  added the comment:

Marc-Andre Lemburg wrote:
>Regarding the issue itself: I think this is a wrong interpretation of
>what the buffering parameter does. File buffering is different
>from .readline() buffering (which can be customized on a per-call
>basis by specifying a size parameter).

Ok. But builtin's readline buffering works like (I) expected. So there is a 
difference in behavior between builtins readline an codecs.readline (and it 
bite me). ¿Maybe it should be noted in documentation?

Python 3.2a3+ (py3k, Nov  6 2010, 16:17:14)
[GCC 4.5.1] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> f = open("foo.txt", "rb", buffering=0)
>>> f.readline()
b'bar\n'
>>> f.tell()
4

--

___
Python tracker 

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



[issue10345] fcntl.ioctl always fails claiming an invalid fd

2010-11-06 Thread Ben Gamari

Ben Gamari  added the comment:

The problem seems to have been that I tried passing mutate_flag. Things seem to 
work fine when the last parameter is omitted.

--

___
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-06 Thread Hirokazu Yamamoto

Hirokazu Yamamoto  added the comment:

I updated the patch. (I hope we can remove ANSI version
of Win32 API, though)

--
Added file: http://bugs.python.org/file19528/py3k_winsound_v2.patch

___
Python tracker 

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