[issue4017] IDLE 2.6 broken on OSX (Leopard)

2008-10-14 Thread Joachim Strombergson

Joachim Strombergson [EMAIL PROTECTED] added the comment:

Aloha!

I followed the suggestions in msg74544 by Leo M and can confirm that
IDLE starts as OK.

*BUT* when I try to import Tkinter I get:

 import Tkinter
Traceback (most recent call last):
  File stdin, line 1, in module
  File
/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/lib-tk/Tkinter.py,
line 39, in module
import _tkinter # If this fails your Python may not be configured for Tk
ImportError:
dlopen(/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/lib-dynload/_tkinter.so,
2): Library not loaded: /Library/Frameworks/Tcl.framework/Versions/8.5/Tcl
  Referenced from:
/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/lib-dynload/_tkinter.so

It seems the fix is not 100%

--
nosy: +Watchman

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4017
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4120] Do not embed manifest files in *.pyd when compiling with MSVC

2008-10-14 Thread Andre Heider

New submission from Andre Heider [EMAIL PROTECTED]:

The MSVC build process currently embeds the .manifest file, which is
generated by the MS linker, in the following files:

- python.exe
- pythonXY.dll
- *.pyd

The latter is problematic on machines without the MS CRT redistributable
installed (No CRT files in %WINDIR%\WinSxS). While this error won't
occur when the python package is installed, it will in other cases like
in ours:

We use the python interpreter within our application and do ship
python25.dll. We also ship the MS CRT files and place them next to the
main application (MS calls this private assemblies and xcopy
deployment). We do not install the redistributable, because it needs
admin rights.
If a user tries to import socket on this setup it will fail, because
the Side by Side / Fusion loader expects the CRT next to the calling
Binary (%PYTHONHOME%\DLLs\_socket.pyd) because of the manifest.

The solution is to not embed the manifest in the *.pyd Modules. This way
the modules just link against msvc*.dll. This works because the windows
loader has already mapped the CRT into memory for the process (either
through python.exe or pythonXY.dll). This is also the only reliable way
i could find to fix the import on machines without redist.

Attached you'll find a patch for the MSVC90 build, apply with -p5. It
will only patch the release file, PCbuild8/pyd_d.vsprops requires the
same fix.

Trolltech also uses this approach for its plugins:
https://trolltech.com/developer/faqs/faq.2007-10-19.6185511205

--
components: Build
files: Python-2.5.2-no.manifest.in.pyd.diff
keywords: patch
messages: 74723
nosy: aheider
severity: normal
status: open
title: Do not embed manifest files in *.pyd when compiling with MSVC
versions: Python 2.5
Added file: 
http://bugs.python.org/file11783/Python-2.5.2-no.manifest.in.pyd.diff

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4120
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue2563] embed manifest in windows extensions

2008-10-14 Thread Andre Heider

Andre Heider [EMAIL PROTECTED] added the comment:

Note that this patch will break the loading of compiled modules on
machines without the MS CRT redistributable installed.

See Issue 4120

--
nosy: +aheider

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue2563
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3439] math.frexp and obtaining the bit size of a large integer

2008-10-14 Thread Fredrik Johansson

Fredrik Johansson [EMAIL PROTECTED] added the comment:

Some elaboration (that perhaps could be adapted into the documentation
or at least source comments).

There are two primary uses for numbits, both of which justify
(0).numbits() == 0.

The first is that for positive k, n = k.numbits() gives the minimum
width of a register that can hold k, where a register can hold the 2**n
integers 0, 1, ..., 2**n-1 (inclusive). This definition continues to
make sense for k = 0, n = 0 (the empty register holds the 2**0 = 1
values 0).

In Python terms, one could say that self.numbits() returns the smallest
n such that abs(self) is in range(2**n). Perhaps this would make a
clearer docstring?

Second, k.numbits() (plus/minus 1, or perhaps multiplied by a constant
factor) measures the number of steps required to solve a problem of size
k using various divide-and-conquer algorithms. The problem of size k = 0
is trivial and therefore requires (0).numbits() == 0 steps.

In particular, if L is a sorted list, then len(L).numbits() exactly
gives the maximum number of comparisons required to find an insertion
point in L using binary search.

Finally, the convention (-k).numbits() == k.numbits() is useful in
contexts where the number k itself is the input to a mathematical
function. For example, in a function for multiplying two integers, one
might want to choose a different algorithm depending on the sizes of the
inputs, and this choice is likely to be independent of signs (if not,
one probably needs to check signs anyway.)

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue3439
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4121] open(): use keyword only for arguments other than file and mode

2008-10-14 Thread STINNER Victor

New submission from STINNER Victor [EMAIL PROTECTED]:

In the C library, fopen() have two arguments: filename and the mode, 
and open() has three arguments: filename, mode and flags. In Python, 
open() has 7 arguments:
 - file
 - mode
 - buffering
 - encoding
 - errors
 - newline
 - closefd

Most programs only use the two first arguments, but buffering is 
sometimes set. Eg. open(filename, r) or open(filename, wb, 0).

I think that only the file and mode arguments are easy to understand, 
the others have to be specified using their name. Eg. 
open(filename, wb, buffering=0) or open(filename, r, 
encoding=GBK).

I wrote a patch to use keyword only arguments, and another to fix some 
libraries and the unit tests.

explicit_open.patch needs review. I don't know the best way to create 
a dictionary. Py_BuildValue() may be used to write a smaller patch.

--

open(file, mode, *, buffering, ...) may be replaced by open(file, 
mode, buffering, *, ...) to keep compatibility with Python2, but I 
read somewhere that Python3 breaks the compatibility and a 2to3 fixer 
can be used to fix open().

--
components: Library (Lib)
files: explicit_open.patch
keywords: needs review, patch, patch
messages: 74727
nosy: haypo
severity: normal
status: open
title: open(): use keyword only for arguments other than file and mode
versions: Python 3.0
Added file: http://bugs.python.org/file11784/explicit_open.patch

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4121
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4121] open(): use keyword only for arguments other than file and mode

2008-10-14 Thread STINNER Victor

Changes by STINNER Victor [EMAIL PROTECTED]:


Added file: http://bugs.python.org/file11785/explicit_open-fixtests.patch

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4121
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4120] Do not embed manifest files in *.pyd when compiling with MSVC

2008-10-14 Thread Martin v. Löwis

Martin v. Löwis [EMAIL PROTECTED] added the comment:

I'm skeptical about this patch. It seems like it could produce an
incompatibility with existing installations or deployment procedures. In
any case, the VS 2008 project files are not officially supported.

If VS 2005 is any similar with VS 2008 wrt. to manifests, I think you
can solve your problem by providing a CRT manifest in the directory that
has _socket.pyd.

I'd be rather interested in seeing the consequences of this approach for
Python 2.6.

--
nosy: +loewis

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4120
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3714] nntplib module broken by str to unicode conversion

2008-10-14 Thread STINNER Victor

STINNER Victor [EMAIL PROTECTED] added the comment:

Instead of ASCII, I think that it would be better to use ISO-8859-1 
since it's the most common charset.

New patch:
 - use ISO-8859-1 as the default charset
 - remove set_encoding() method: was it really needed
 - use makefile('r', encoding=self.encoding') to get a new 
TextIOWrapper with universal newline and automatic unicode decode = 
getline() is simplified and I removed CRLF

--
nosy: +haypo
Added file: http://bugs.python.org/file11787/nntplib_unicode.patch

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue3714
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3724] math.log(x, 10) gives different result than math.log10(x)

2008-10-14 Thread STINNER Victor

STINNER Victor [EMAIL PROTECTED] added the comment:

About the number of bits: I prefer an the implementation in int/long 
types proposed in issue #3439.

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue3724
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4120] Do not embed manifest files in *.pyd when compiling with MSVC

2008-10-14 Thread Andre Heider

Andre Heider [EMAIL PROTECTED] added the comment:

Yes, i know that v2.5 doesn't officially support MSVC9. But the same
problem applies to MSVC8 and its CRT. But in contrast to MSVC9, the CRT8
redist is installed on almost every machine, because alot of software
installs it. But thats basically just luck ;)

Placing just a .manifest next to *.pyd won't work either. If you're
going this route, you have to put the 3 CRT DLLs there too (and thats
actually the approach mentioned here:
http://msdn.microsoft.com/en-us/library/ms235291.aspx)
Then you've got 2 cases:
1) The user does have the redist installed
or
2) He does not

for 1) The WinSXS installation has a higher priority and the local files
are ignored
for 2) The files next to the binaries are used (eg c:\python and
c:\python\DLLs)

Sounds fine, but the latter raises another issue: Now you have 2 copies
of the DLLs. Based on these 2 unique file names, windows decides to load
2 copies into memory, one for python.exe|dll and one for *.pyd. As you
might see, this gets very nasty because you have 2 different heaps now.
Allocating memory from the one instance and freeing it in the other
makes the whole process crash.

This issue doesn't stop here, here's another situation:
Python is compiled with MSVC9. A user has it and MSVC9 SP1 installed,
which has a newer CRT version. If he builds site-packages, these files
have an embedded manifest with another CRT version than the python
interpreter itself. Importing these packages loads a second copy of a
CRT into the processes memory, just like described above.

I don't know if or for what version this should be addressed for python.
I'm just saying that this was a huge issue the last days at the company
i work for.

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4120
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4121] open(): use keyword only for arguments other than file and mode

2008-10-14 Thread STINNER Victor

STINNER Victor [EMAIL PROTECTED] added the comment:

 Do you suggest that 'buffering' should be allowed 
 as positional argument?

No, I would prefer to keep also two positional arguments: file and 
mode. I hate open(filename, 'r', s): I don't know what is s, the 
buffering or the encoding? And I think that beginner would also be 
distribed by this third argument. Sometimes, it's easy to understand 
the 3 arguments of a function, like re.match([a-z], t, 
re.IGNORECASE). But for open(), I would prefer explicit arguments.

And so socket.makefile() should also be fixed to keep only 2 
positional arguments.

It's my opinion and if you really want to keep compatibility with 
Python2, keep the 3 positional arguments.

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4121
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3439] math.frexp and obtaining the bit size of a large integer

2008-10-14 Thread STINNER Victor

STINNER Victor [EMAIL PROTECTED] added the comment:

See also issue #3724 which proposes to support long integers for 
math.log2().

--
nosy: +haypo

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue3439
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3439] create a numbits() method for int and long types

2008-10-14 Thread STINNER Victor

STINNER Victor [EMAIL PROTECTED] added the comment:

I changed the title since I agree that numbits() with long integer is 
not related to floats.

--
title: math.frexp and obtaining the bit size of a large integer - create a 
numbits() method for int and long types

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue3439
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3439] create a numbits() method for int and long types

2008-10-14 Thread Mark Dickinson

Changes by Mark Dickinson [EMAIL PROTECTED]:


___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue3439
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4122] undefined reference to _Py_ascii_whitespace

2008-10-14 Thread Ralf Schmitt

Ralf Schmitt [EMAIL PROTECTED] added the comment:

I hope someone else can test this, as I don't feel like setting up a
windows build environment...

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4122
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3439] create a numbits() method for int and long types

2008-10-14 Thread Mark Dickinson

Mark Dickinson [EMAIL PROTECTED] added the comment:

Accidentally removed the following message from Victor Stinner;  
apologies.  (Time to turn off tap-to-click on my trackpad, methinks.)

 See also issue #3724 which proposes to support long integers for 
 math.log2().

One other note:  in Fredrik's patch there's commented out code for a 
numbits *property* (rather than a method).  Is there any good reason to 
make this a property?  I don't have a good feeling for when something 
should be a method and when it should be a property, but in this case 
I'd be inclined to leave numbits as a method.

Are there general guidelines for making things properties?

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue3439
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3439] create a numbits() method for int and long types

2008-10-14 Thread STINNER Victor

STINNER Victor [EMAIL PROTECTED] added the comment:

 Accidentally removed the following message from Victor Stinner

No problem.

 Is there any good reason to make this a property?

Since numbits() cost is O(n) with n: number of digits. I prefer a 
method than a property because, IMHO, reading a property should be 
O(1) (*read* an attribute is different than *compute* a value).

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue3439
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1210] imaplib does not run under Python 3

2008-10-14 Thread Bill Janssen

Bill Janssen [EMAIL PROTECTED] added the comment:

Victor, what kind of content have you tried this with?  For instance, have
you passed unencoded (Content-Transfer-Encoding: binary) binary data through
it, by mailing a JPEG, for instance?  These things are strings really only
at the application level; the data is still bytes.  In addition, the use of
Latin-1 goes against the explicit directives of the IMAP group, doesn't it?
They're pushing UTF-8.

Bill

On Tue, Oct 14, 2008 at 4:27 AM, STINNER Victor [EMAIL PROTECTED]wrote:


 STINNER Victor [EMAIL PROTECTED] added the comment:

 Here is a patch for imaplib:
  - add encoding attribute to IMAP4 class (as ftplib and see also issue
 3727 for my poplib patch)
  - use makefile('r', encoding=self.encoding) instead of a binary file
 (mode='rb')
  - remove duplicate code in IMAP4_SSL

 I choosed ISO-8859-1 as the default charset. I tested the library on
 my local IMAP4 server using IMAP4 and IMAP4_SSL classes. But the
 library needs more unit tests as done for poplib.

 --
 keywords: +patch
 nosy: +haypo
 Added file: http://bugs.python.org/file11786/imaplib_unicode.patch

 ___
 Python tracker [EMAIL PROTECTED]
 http://bugs.python.org/issue1210
 ___


Added file: http://bugs.python.org/file11790/unnamed

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1210
___div dir=ltrVictor, what kind of content have you tried this with?nbsp; For 
instance, have you passed unencoded (Content-Transfer-Encoding: binary) binary 
data through it, by mailing a JPEG, for instance?nbsp; These things are 
strings really only at the application level; the data is still bytes.nbsp; In 
addition, the use of Latin-1 goes against the explicit directives of the IMAP 
group, doesn#39;t it?nbsp; They#39;re pushing UTF-8.br
brBillbrbrdiv class=gmail_quoteOn Tue, Oct 14, 2008 at 4:27 AM, 
STINNER Victor span dir=ltrlt;a href=mailto:[EMAIL PROTECTED][EMAIL 
PROTECTED]/agt;/span wrote:brblockquote class=gmail_quote 
style=border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; 
padding-left: 1ex;
br
STINNER Victor lt;a href=mailto:[EMAIL PROTECTED][EMAIL PROTECTED]/agt; 
added the comment:br
br
Here is a patch for imaplib:br
nbsp;- add encoding attribute to IMAP4 class (as ftplib and see also issuebr
3727 for my poplib patch)br
nbsp;- use makefile(#39;r#39;, encoding=self.encoding) instead of a binary 
filebr
(mode=#39;rb#39;)br
nbsp;- remove duplicate code in IMAP4_SSLbr
br
I choosed ISO-8859-1 as the default charset. I tested the library onbr
my local IMAP4 server using IMAP4 and IMAP4_SSL classes. But thebr
library needs more unit tests as done for poplib.br
br
--br
keywords: +patchbr
nosy: +haypobr
Added file: a href=http://bugs.python.org/file11786/imaplib_unicode.patch; 
target=_blankhttp://bugs.python.org/file11786/imaplib_unicode.patch/abr
divdiv/divdiv class=Wj3C7cbr
___br
Python tracker lt;a href=mailto:[EMAIL PROTECTED][EMAIL 
PROTECTED]/agt;br
lt;a href=http://bugs.python.org/issue1210; 
target=_blankhttp://bugs.python.org/issue1210/agt;br
___br
/div/div/blockquote/divbr/div
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3439] create a numbits() method for int and long types

2008-10-14 Thread STINNER Victor

STINNER Victor [EMAIL PROTECTED] added the comment:

 Unless I missed something, numbits() is O(1).

Ooops, you're right. I looked quickly at the patch and I 
read while(n) but n is a digit, not the number of digits! So it's 
very quick to compute number of bits.

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue3439
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4121] open(): use keyword only for arguments other than file and mode

2008-10-14 Thread STINNER Victor

STINNER Victor [EMAIL PROTECTED] added the comment:

socket.makefile() already uses keyword only argument, but buffering is 
not a keyword only argument:
def makefile(self, mode=r, buffering=None, *,
 encoding=None, newline=None):

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4121
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3439] create a numbits() method for int and long types

2008-10-14 Thread Terry J. Reedy

Terry J. Reedy [EMAIL PROTECTED] added the comment:

I consider .numbits to be an internal property of ints and would prefer
it accessed that way.  To me, this sort of thing is what property() is for.

Guido has said that the nuisance of tacking on otherwise unnecessary
empty parens is a warning to the user that getting the answer might take
a long time.  

Another tack is to notice that numbits is the length of the bit sequence
representation of an int (excepting 0) and give ints a .__len__ method
;-).  I would not expect that suggestion to fly very far, though.

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue3439
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3439] create a numbits() method for int and long types

2008-10-14 Thread Fredrik Johansson

Fredrik Johansson [EMAIL PROTECTED] added the comment:

 Another tack is to notice that numbits is the length of the bit sequence
 representation of an int (excepting 0) and give ints a .__len__ method
 ;-).  I would not expect that suggestion to fly very far, though.

FWIW, I'm one of the people who'd additionally find indexing and slicing
of the bits of integers very useful. It's not going to happen, though!

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue3439
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3439] create a numbits() method for int and long types

2008-10-14 Thread STINNER Victor

STINNER Victor [EMAIL PROTECTED] added the comment:

A property /looks/ like an attribute and an user might try to change 
its value: x=1; x.numbits = 2 (gives 3 or 4 ? :-))

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue3439
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1210] imaplib does not run under Python 3

2008-10-14 Thread STINNER Victor

Changes by STINNER Victor [EMAIL PROTECTED]:


Removed file: http://bugs.python.org/file11790/unnamed

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1210
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3863] 2.6rc1: test_threading hangs on FreeBSD 6.3 i386

2008-10-14 Thread Gregory P. Smith

Gregory P. Smith [EMAIL PROTECTED] added the comment:

looks like it already has been merged in py3k.

--
versions: +Python 2.5.3 -Python 3.0

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue3863
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4120] Do not embed manifest files in *.pyd when compiling with MSVC

2008-10-14 Thread Andre Heider

Andre Heider [EMAIL PROTECTED] added the comment:

Ok, point taken, so lets aim at v2.6. Should i open a new issue then?

Attached you'll find a new diff against v2.6. This time pyd_d.vsprops
gets patched too and the linker doesn't even generate a .manifest file.
So no, the *.pyd files do not get any manifest info, neither a loose
*.pyd.manifest nor an embedded one.

I checked a per-user v2.6 install with the CRT manifest pointing at
... I also tried this approach for our software, but i couldn't get it
working on w2k3.

The solution i am proposing doesn't need a CRT manifest file in
./DLLs. This approach works on w2k3, but i can not test this on vista SP1.

Added file: http://bugs.python.org/file11791/Python-2.6-no.manifest.in.pyd.diff

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4120
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3439] create a numbits() method for int and long types

2008-10-14 Thread Raymond Hettinger

Raymond Hettinger [EMAIL PROTECTED] added the comment:

Properties can be made read-only.  Also, there is a good precedent: 
c=4+5j; print c.real

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue3439
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1210] imaplib does not run under Python 3

2008-10-14 Thread STINNER Victor

STINNER Victor [EMAIL PROTECTED] added the comment:

IMAP_stream() is also broken because it uses os.popen2() which has 
been deprecated since long time and now replaced by subprocess.

Here is a patch replacing os.popen2() by subprocess, but also using 
transparent conversion from/to unicode using io.TextIOWrapper().

Added file: http://bugs.python.org/file11792/imaplib_stream.patch

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1210
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1210] imaplib does not run under Python 3

2008-10-14 Thread STINNER Victor

STINNER Victor [EMAIL PROTECTED] added the comment:

 what kind of content have you tried this with?

I only tried the most basic commands like capability(). I retried with 
search() and... hey, search() has a charset argument!? It should reuse 
self.encoding. Same for sort().

Then I tried to get the content of an email but fetch(num, '(RFC822)') 
fails with imaplib.abort: command: FETCH = unexpected 
response: 'Return-Path: [EMAIL PROTECTED]'. RFC822 is not 
supported by imaplib? The test also fails with Python 2.5.

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1210
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4120] Do not embed manifest files in *.pyd when compiling with MSVC

2008-10-14 Thread Martin v. Löwis

Martin v. Löwis [EMAIL PROTECTED] added the comment:

I'm just repurposing the issue (despite what I usually claim as a policy)

--
resolution: rejected - 
status: closed - open
versions: +Python 2.6 -Python 2.5

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4120
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4120] Do not embed manifest files in *.pyd when compiling with MSVC

2008-10-14 Thread Martin v. Löwis

Changes by Martin v. Löwis [EMAIL PROTECTED]:


Removed file: 
http://bugs.python.org/file11783/Python-2.5.2-no.manifest.in.pyd.diff

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4120
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4017] IDLE 2.6 broken on OSX (Leopard)

2008-10-14 Thread Don Braffitt

Don Braffitt [EMAIL PROTECTED] added the comment:

I've just installed Python 2.6 on Mac OS X 10.5.5 and IDLE won't start.

I have the same problem with Python 2.6 IDLE on Mac OS X 10.4.11.

--
nosy: +donbraffitt

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4017
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4017] IDLE 2.6 broken on OSX (Leopard)

2008-10-14 Thread Nat

Nat [EMAIL PROTECTED] added the comment:

If you look in /Library/Frameworks/Tcl.framework/Versions/, what's
there? How about in /Library/Frameworks/Tcl.framework/Versions/8.5/?

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4017
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4120] Do not embed manifest files in *.pyd when compiling with MSVC

2008-10-14 Thread Martin v. Löwis

Martin v. Löwis [EMAIL PROTECTED] added the comment:

 Yes, i know that v2.5 doesn't officially support MSVC9. But the same
 problem applies to MSVC8 and its CRT.

The point is that even the MSVC8 project files are not supported.
They have been included, but they are not actually used for anything.

 Yes, i know that v2.5 doesn't officially support MSVC9. But the same
 problem applies to MSVC8 and its CRT.

Not necessarily. Take a look at how I deploy Python 2.6. I use a single
copy of the DLL, but two copies of the manifest (both referring to the
same DLL image). AFAICT, this works fine on XP (but fails on Vista SP1,
which complains that the manifest is ill-formed).

I'm closing this for 2.5 as rejected; it might cause more problems than
it solves, and 2.5.3 will be the last release (i.e. with no release to
fix it if it breaks something badly).

If you can come up with a working patch for 2.6: that would be more
interesting. Would the many manifest files that get generated need to be
shipped as well?

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4120
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3714] nntplib module broken by str to unicode conversion

2008-10-14 Thread STINNER Victor

STINNER Victor [EMAIL PROTECTED] added the comment:

Ok for UTF-8 which is a superset of ASCII and raise an error when 
trying to decode Latin1 or KOI-8.

 You need to have a possibility to change encoding after object 
creation

If you share a connection for the different groups, you will have to 
take care of the side effets of set_encoding(). But if you consider 
that set_encoding() is a must-have, ok, forget my patch (because using 
makefile(), it's not possible to change the charset) ;-)

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue3714
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3439] create a numbits() method for int and long types

2008-10-14 Thread Mark Dickinson

Mark Dickinson [EMAIL PROTECTED] added the comment:

One more minor deficiency in the patch: it gives incorrect results for 
very large integers.  For example, on a 32-bit build of the trunk:

 x = 1  2**31-1
 x = 2**31-1
 x.numbits()  # expect 4294967295
4294967295L
 x = 2
 x.numbits()  # expect 4294967297
4294967295L

It would be nicer if the OverflowError from _PyLong_NumBits were 
propagated, so that the second case raises OverflowError instead of giving 
an incorrect result.

Alternatively, in case of OverflowError one could recompute numbits 
correctly, without overflow, by using Python longs instead of a C size_t;  
but this would mean adding little-used, and probably little-tested, extra 
code for what must be a very rare special case.  Probably not worth it.

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue3439
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1210] imaplib does not run under Python 3

2008-10-14 Thread Bill Janssen

Bill Janssen [EMAIL PROTECTED] added the comment:

Maybe the first thing to do is to expand the Lib/test/test_imaplib.py
file, which right now is pretty darn minimal.  We really need an IMAP
server somewhere to test against, with a standard library of varied
messages.

Perhaps Python.org is running an IMAP server?

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1210
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4075] Use WCHAR variant of OutputDebugString

2008-10-14 Thread Roumen Petrov

Roumen Petrov [EMAIL PROTECTED] added the comment:

May be OutputDebugStringA has to be part of wince-port library but if
is fine all win platforms to call *W what about patch to use function
MultiByteToWideChar() ?

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4075
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4120] Do not embed manifest files in *.pyd when compiling with MSVC

2008-10-14 Thread Martin v. Löwis

Changes by Martin v. Löwis [EMAIL PROTECTED]:


--
resolution:  - rejected
status: open - closed

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4120
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3725] telnetlib module broken by str to unicode conversion

2008-10-14 Thread STINNER Victor

STINNER Victor [EMAIL PROTECTED] added the comment:

I think that telnet should only use bytes (and not characters). For an 
HTTP connection, the charset is only known after parsing the HTTP 
headers. So telnet should use bytes, and your HTTP browser will 
convert bytes to characters using the charset from the HTTP headers. 
My patch only uses bytes for internal buffering and special codes 
(IAC, DONT, ENCRYPT, etc.).

Example to test the library (Starwars, telnet, ISO-8859-1):
from telnetlib import Telnet
from sys import stdout
ipv4 = towel.blinkenlights.nl
ipv6 = 2001:980:ffe:1::42
t = Telnet(ipv6, 23)
while True:
command = t.read_some()
command = str(command, ISO-8859-1)
stdout.write(command)

Example to test the library (Google, HTTP, ASCII):
from telnetlib import Telnet
t = Telnet(www.google.com, 80)
t.write(b'GET / HTTP/1.0\r\n\r\n')
answer = t.read_all()
answer = str(answer, ASCII)
print(answer)

--
keywords: +patch
nosy: +haypo
Added file: http://bugs.python.org/file11788/telnet_bytes.patch

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue3725
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4075] Use WCHAR variant of OutputDebugString

2008-10-14 Thread Martin v. Löwis

Martin v. Löwis [EMAIL PROTECTED] added the comment:

 May be OutputDebugStringA has to be part of wince-port library but if
 is fine all win platforms to call *W what about patch to use function
 MultiByteToWideChar() ?

Is there a problem with the proposed patch?

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4075
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1210] imaplib does not run under Python 3

2008-10-14 Thread STINNER Victor

STINNER Victor [EMAIL PROTECTED] added the comment:

Here is a patch for imaplib:
 - add encoding attribute to IMAP4 class (as ftplib and see also issue 
3727 for my poplib patch)
 - use makefile('r', encoding=self.encoding) instead of a binary file 
(mode='rb')
 - remove duplicate code in IMAP4_SSL

I choosed ISO-8859-1 as the default charset. I tested the library on 
my local IMAP4 server using IMAP4 and IMAP4_SSL classes. But the 
library needs more unit tests as done for poplib.

--
keywords: +patch
nosy: +haypo
Added file: http://bugs.python.org/file11786/imaplib_unicode.patch

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1210
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3725] telnetlib module broken by str to unicode conversion

2008-10-14 Thread Benjamin Peterson

Benjamin Peterson [EMAIL PROTECTED] added the comment:

The patch looks pretty straightforward to me. If somebody else gives
their nod, I'll apply it.

--
assignee:  - benjamin.peterson
nosy: +benjamin.peterson

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue3725
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3439] create a numbits() method for int and long types

2008-10-14 Thread Fredrik Johansson

Fredrik Johansson [EMAIL PROTECTED] added the comment:

 One other note:  in Fredrik's patch there's commented out code for a 
 numbits *property* (rather than a method).  Is there any good reason to 
 make this a property?

Aesthetically, I think numbits as a function would make more sense.
(Maybe if the hypothetical imath module comes along...)

 Since numbits() cost is O(n) with n: number of digits. I prefer a 
 method than a property because, IMHO, reading a property should be 
 O(1) (*read* an attribute is different than *compute* a value).

Unless I missed something, numbits() is O(1). Only the topmost word in a
number needs to be examined.

 reading a property should be O(1) (*read* an attribute is different
 than *compute* a value).

O(1) is necessary but not sufficient. My sense is that an attribute
should access an existing part of an object while an operation that
involves creating a new object should be a method. Compare
complex.real/.imag and complex.conjugate().

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue3439
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3724] math.log(x, 10) gives different result than math.log10(x)

2008-10-14 Thread Mark Dickinson

Mark Dickinson [EMAIL PROTECTED] added the comment:

Note that log2(int) - float wouldn't entirely replace
numbits, due to loss of precision in the result.

e.g.  log2(2**100), log2(2**100+1) and log2(2**100-1) would likely all
return exactly the same result (100.0), where numbits wants results of 
101, 101 and 100 respectively.

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue3724
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4121] open(): use keyword only for arguments other than file and mode

2008-10-14 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc [EMAIL PROTECTED] added the comment:

It's true that the order of arguments is difficult to remember
correctly. However I think this deserves Guido's approval.

About the implementation:
To build the kw dict, did you consider using Py_BuildValue?
Something like:
   kw = Py_BuildValue({si ss ss},
   buffering, buffering, 
   encoding, encoding,
   errors, errors,
   ...);
is simpler to write, if you consider error handling.

--
nosy: +amaury.forgeotdarc, gvanrossum

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4121
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4075] Use WCHAR variant of OutputDebugString

2008-10-14 Thread Ulrich Eckhardt

Ulrich Eckhardt [EMAIL PROTECTED] added the comment:

If this patch required for CE 5.0?

The patch I created is required for all CEs that I know of. I have
personally worked with 4.20, 5 and now 6, and had some exchange with
others who worked on 3.x variants to get STLport (C++ stdlibrary
implementation) to run. AFAIK, none of them support the *A functions, so
this patch or something similar is required for every CE flavor out there. 

Roumen, you mentioned the way that the PythonCE project did it, which
also works, but I'd say that that code is obsolete, because the emulated
functions actually create a win9x-like environment, while Python has
officially dropped support for that. The problem is that the *W
functions are badly supported on win9x while the *A functions are
unsupported on CE. The NT variants (NT, win2000..) support both APIs,
but the *A functions are wrappers around the *W functions and don't
provide the whole functionality that the OS actually supports.

So, what this path does is to help phase out the *A functions, gaining
more thorough Unicode support while at the same time easing porting to CE.

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4075
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1210] imaplib does not run under Python 3

2008-10-14 Thread STINNER Victor

Changes by STINNER Victor [EMAIL PROTECTED]:


Removed file: http://bugs.python.org/file11786/imaplib_unicode.patch

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1210
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4121] open(): use keyword only for arguments other than file and mode

2008-10-14 Thread Guido van Rossum

Guido van Rossum [EMAIL PROTECTED] added the comment:

This is certainly out of scope for 3.0.  Remember, for 3.0 we're trying
to get a release out of the door, not cram in new features, no matter
how small.

Beyond 3.0, I'm still rather reluctant -- I expect most users will be
wise and use keyword args anyway; I'm not sure what we buy by forcing this.

I'd be okay with documenting the recommendation to always use keyword
args for any argument added in 3.0 or later (which would leave buffering
a positional argument -- I don't even know its name since it has been a
positional argument since the 1.0 days).

--
priority:  - low
versions: +Python 3.1 -Python 3.0

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4121
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4122] undefined reference to _Py_ascii_whitespace

2008-10-14 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc [EMAIL PROTECTED] added the comment:

Committed r66891 (trunk) and r66892 (release26-maint).
Thanks for the report and the patch!

In the meantime, you may use _PyUnicode_IsWhitespace(ch), like the 2.5 
version did.

--
resolution:  - fixed
status: open - closed

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4122
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4123] random.shuffle slow on deque

2008-10-14 Thread paul rubin

New submission from paul rubin [EMAIL PROTECTED]:

This is observed in Python 2.5.1, I haven't tried any later versions.

d = collections.deque(xrange(10))
random.shuffle(d)

is quite slow.  Increasing the size to 200k, 300k, etc. shows that the
runtime increases quadratically or worse.  It's much faster to convert
the deque to a list, shuffle the list, and make a new deque from the
shuffled list.

--
components: Library (Lib)
messages: 74773
nosy: phr
severity: normal
status: open
title: random.shuffle slow on deque
versions: Python 2.5

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4123
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4121] open(): use keyword only for arguments other than file and mode

2008-10-14 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc [EMAIL PROTECTED] added the comment:

Do you suggest that 'buffering' should be allowed as positional argument?

This would help with migration from 2.x, where open() accepts 3
positional arguments:
  open(...)
  open(name[, mode[, buffering]]) - file object
And no need to 'fix' the tests.

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4121
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4122] undefined reference to _Py_ascii_whitespace

2008-10-14 Thread STINNER Victor

STINNER Victor [EMAIL PROTECTED] added the comment:

You can try this patch for Python.

--
keywords: +patch
nosy: +haypo
Added file: http://bugs.python.org/file11789/export_Py_ascii_whitespace.patch

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4122
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1210] imaplib does not run under Python 3

2008-10-14 Thread STINNER Victor

STINNER Victor [EMAIL PROTECTED] added the comment:

The server can send raw 8 bits email in any charset (charset is 
specified in the email headers). That's why I think that it's better 
to keep bytes instead of the unicode conversion using a fixed charset. 
Each email can use a different charset.

Types used in my new patch:
 - unicode:
   * IMAP commands (charset=ASCII)
   * untagged_responses keys (charset=ASCII)
 - bytes:
   * answer
   * regex
   * tagre attribute
   * untagged_responses values

I chooosed to keep unicode for some variables to minimize the changes 
in imaplib library and to keep readable code.

Patch TODO:
 - Remove the assert (added for quicker debugging)
 - Test more functions
 - Restore _checkquote() in _command() method or use 
_quote()/_checkquote() in method which need it. login() already quote 
the password (but why not the login?)

I also wrote a patch for a pure bytes string version, but the patch 
is complex, long and the resulting module source code is hard to read.

Added file: http://bugs.python.org/file11794/imaplib_bytes.patch

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1210
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue2046] patch to fix_import: UserDict - collections

2008-10-14 Thread Benjamin Peterson

Benjamin Peterson [EMAIL PROTECTED] added the comment:

Closing in favor of #2876.

--
nosy: +benjamin.peterson
resolution:  - duplicate
status: open - closed

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue2046
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1210] imaplib does not run under Python 3

2008-10-14 Thread STINNER Victor

Changes by STINNER Victor [EMAIL PROTECTED]:


Removed file: http://bugs.python.org/file11795/imaplib_bytes-2.patch

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1210
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1210] imaplib does not run under Python 3

2008-10-14 Thread STINNER Victor

STINNER Victor [EMAIL PROTECTED] added the comment:

Oops, my previous patch didn't include changes to the documentation. 
New patch changes:
 - fix the documentation: os.popen2() = subprocess.Popen(); no more 
ssl() method: use socket()
 - use a buffer of 4096 bytes in read() method (as suggested in socket 
documentation)
 - break read() loop if read() returns an empty bytes string

Added file: http://bugs.python.org/file11796/imaplib_bytes-3.patch

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1210
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3725] telnetlib module broken by str to unicode conversion

2008-10-14 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc [EMAIL PROTECTED] added the comment:

Yes, the patch is good.

I think that documentation (both Doc\library\telnetlib.rst and the 
docstrings in telnetlib.py) should reflect the change, at least the code 
samples.

--
nosy: +amaury.forgeotdarc

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue3725
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4125] runtests.sh: use -bb flag of Python

2008-10-14 Thread STINNER Victor

New submission from STINNER Victor [EMAIL PROTECTED]:

The -bb (raise ByteWarning error) is useful for debugging and needed 
to improve bytes/unicode distinction in Python3. Here is a small patch 
to always run Python with -bb option.

The patch helps issue3988 test.

--
files: runtests.patch
keywords: patch
messages: 74781
nosy: haypo
severity: normal
status: open
title: runtests.sh: use -bb flag of Python
versions: Python 3.0
Added file: http://bugs.python.org/file11797/runtests.patch

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4125
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3988] Byte warning mode and b'' != ''

2008-10-14 Thread STINNER Victor

Changes by STINNER Victor [EMAIL PROTECTED]:


Removed file: http://bugs.python.org/file11647/bytes_ne_warning-2.patch

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue3988
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3988] Byte warning mode and b'' != ''

2008-10-14 Thread STINNER Victor

Changes by STINNER Victor [EMAIL PROTECTED]:


Removed file: http://bugs.python.org/file11648/test_bytes.patch

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue3988
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3988] Byte warning mode and b'' != ''

2008-10-14 Thread STINNER Victor

STINNER Victor [EMAIL PROTECTED] added the comment:

New patch including the test. The test doesn't fail anymore if -bb is 
not set (test is just ignored). See also issue #4125 (force -bb option 
for runtests.sh).

Added file: http://bugs.python.org/file11798/bytes_ne_warning-3.patch

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue3988
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4034] traceback attribute error

2008-10-14 Thread STINNER Victor

STINNER Victor [EMAIL PROTECTED] added the comment:

My patch causes a crash with:

import sys
try:
raise Exception(hm!)
except:
t, v, tb = sys.exc_info()
tb.tb_frame = {}
raise t, v, tb

Change tb.tb_frame value is not a good idea. It's better to clear 
locals/globals: see msg74329.

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4034
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4126] remove not decodable environment variables

2008-10-14 Thread STINNER Victor

New submission from STINNER Victor [EMAIL PROTECTED]:

Python3 skips environment variables which can not be parsed and 
decoded as unicode strings. But exec*() functions keep the original 
environment and so the child process environment is different than the 
Python environement (than os.environ).

I propose to remove these variables to avoid strange behaviours, but 
also to avoid possible security issues.

The attached patch is an implementation of this idea using a custom 
implementation of unsetenv(): _Py_unsetenv() argument is not the name 
of the variable but the raw variable including the value (eg. a=b). 
So it's also possible to drop truncated variables like a (no value 
nor = character).

This issue also affects Python2 since Python2 does also skip variable 
with no value but the variables still exist in memory (and so child 
process get them).

--
components: Interpreter Core
files: unsetenv.patch
keywords: patch
messages: 74784
nosy: haypo
severity: normal
status: open
title: remove not decodable environment variables
type: security
versions: Python 3.0
Added file: http://bugs.python.org/file11799/unsetenv.patch

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4126
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4126] remove not decodable environment variables

2008-10-14 Thread STINNER Victor

STINNER Victor [EMAIL PROTECTED] added the comment:

Note: I don't have Windows at home to test my patch on Windows. At 
least, the patch works correctly on Ubuntu Gutsy/i386.

Example to demonstrate the issue:
$ env -i a=a b=$(echo -e '--\xff--') c=c ./python -c import os; 
os.execvp('/usr/bin/env', ['/usr/bin/env'])
a=a
b=--�--
c=c

Patched Python:
$ env -i a=a b=$(echo -e '--\xff--') c=c ./python -c import os; 
os.execvp('/usr/bin/env', ['/usr/bin/env'])
a=a
c=c

I tested Python 2.5: b is also removed, but Python 2.6 keeps the 
variable b.

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4126
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4126] remove not decodable environment variables

2008-10-14 Thread STINNER Victor

STINNER Victor [EMAIL PROTECTED] added the comment:

while+strcmp() in _Py_unsetenv() is useless since we already get the 
pointer to the evil variable. The new patch is shorter.

Added file: http://bugs.python.org/file11800/unsetenv-2.patch

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4126
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4126] remove not decodable environment variables

2008-10-14 Thread STINNER Victor

Changes by STINNER Victor [EMAIL PROTECTED]:


Removed file: http://bugs.python.org/file11799/unsetenv.patch

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4126
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4006] os.getenv silently discards env variables with non-UTF-8 values

2008-10-14 Thread STINNER Victor

STINNER Victor [EMAIL PROTECTED] added the comment:

See also issue #4126 which is the opposite :-)

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4006
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4126] remove not decodable environment variables

2008-10-14 Thread STINNER Victor

STINNER Victor [EMAIL PROTECTED] added the comment:

See also issue #4006 which asks the opposite (keep invalid variables, 
even in os.environ(b)) :-)

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4126
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4126] remove not decodable environment variables

2008-10-14 Thread Toshio Kuratomi

Toshio Kuratomi [EMAIL PROTECTED] added the comment:

Yep :-)  I am against throwing away valid data just because we can't
interpret it automatically.  Environment variables in Unix hold bytes. 
Those bytes are usually ASCii characters, however, they do not have to
be.  This is a case of being on the border between python and the
outside world so we need to be able to pass in bytes if the user
requests it.

Let's say that you have a local directory of: /home/\xff/username/bin in
your PATH environment variable and a command named my_app.sh in there. 
At the shell you can happily run myapp.sh and it will do it's thing. 
Now you open your python shell and do:
subprocess.call(['myapp.sh'])

and it doesn't work.  This is non-intuitive behaviour for people who are
used to how the shell works.  All this patch will do is take away the
work around of subprocess.call(['bash', 'myapp.sh'])


I tested Python 2.5: b is also removed, but Python 2.6 keeps the 
variable b.

I just tested python-2.5.1 and b is kept, not removed.

--
nosy: +a.badger

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4126
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4127] repr or reprlib?

2008-10-14 Thread David W. Lambert

New submission from David W. Lambert [EMAIL PROTECTED]:

http://docs.python.org/dev/3.0/library/reprlib.html#module-reprlib
names the module reprlib.
However, the example at bottom of page uses:

http://docs.python.org/dev/3.0/library/reprlib.html#subclassing-repr-
objects

import repr

--
assignee: georg.brandl
components: Documentation
messages: 74790
nosy: LambertDW, georg.brandl
severity: normal
status: open
title: repr or reprlib?
versions: Python 3.0

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4127
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4127] repr or reprlib?

2008-10-14 Thread Benjamin Peterson

Benjamin Peterson [EMAIL PROTECTED] added the comment:

Thanks for the report! Fixed in r66897.

--
nosy: +benjamin.peterson
resolution:  - fixed
status: open - closed

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4127
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4072] build_py support for lib2to3 is stale

2008-10-14 Thread Martin v. Löwis

Martin v. Löwis [EMAIL PROTECTED] added the comment:

Committed as r66901

--
status: open - closed

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4072
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com