[issue1071] unicode.translate() doesn't error out on invalid translation table

2007-09-02 Thread Georg Brandl

Georg Brandl added the comment:

Marc-Andre Lemburg schrieb:
> Marc-Andre Lemburg added the comment:
> 
> Nice idea, but why don't you use a dictionary iterator (PyDict_Next())
> for the fixup ?

I thought that is unsafe to use when the dictionary is mutated while
iterating.

__
Tracker <[EMAIL PROTECTED]>

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



[issue1084] ''.find() gives wrong result in Python built with ICC

2007-09-02 Thread Martin v. Löwis

Martin v. Löwis added the comment:

It definitely sounds like a compiler bug. Unless you can provide further
details to the specific error in the C code of Python, it's likely that
we can do little about it.

If you want to analyze this further, here is a number of things you can try:
- compile Python at various optimization levels. A compiler bug often
manifests itself only at a specific set of optimization flags.
- try tracing this invocation of .find() in a debugger. Doing so at a
lower optimization level is easier, since the compiler may have inlined
the various functions that form .find() under optimization.
- if the debugger does not allow to pinpoint the erroneous function, add
printf statements.
Most of the code to study is in Objects/stringobject.c and
Objects/stringlib/find.h.

--
nosy: +loewis

__
Tracker <[EMAIL PROTECTED]>

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



[issue1085] OS X 10.5.x Build Problems

2007-09-02 Thread Martin v. Löwis

Martin v. Löwis added the comment:

This is a duplicate of #1078.

--
nosy: +loewis
resolution:  -> duplicate
status: open -> closed
superseder:  -> cachersrc.py using tuple unpacking args

__
Tracker <[EMAIL PROTECTED]>

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



[issue1084] ''.find() gives wrong result in Python built with ICC

2007-09-02 Thread Simon Anders

Simon Anders added the comment:

Martin, you are right: is is related to compiler optimization. I have
boiled it down to a call of stringlib_find (defined in
Python-2.5.1/Objects/stringlib/find.h) and this runs fine with 'icc -O2'
but incorrectly for 'icc -O3'. (The test code is attached.)

So, it seems that the lesson is simply once again: Do not use '-O3' with
Intel's C compiler. (At least, for me, it is not the first time that
this caused trouble.)

On the other hand, Python's ./configure script is quite clear in its
preference of GCC, anyway: It more or less ignores with option
'--without-gcc' and uses the content of the CC environment variable only
very occasionally.

__
Tracker <[EMAIL PROTECTED]>

__#define STRINGLIB_CHAR char

#define STRINGLIB_CMP memcmp
#define STRINGLIB_LEN PyString_GET_SIZE
#define STRINGLIB_NEW PyString_FromStringAndSize
#define STRINGLIB_STR PyString_AS_STRING

#define STRINGLIB_EMPTY nullstring

#include "/usr/site/hc-2.6/python/gnu/2.5.1/include/python2.5/Python.h"

#include "../Python-2.5.1/Objects/stringlib/fastsearch.h"
#include "../Python-2.5.1/Objects/stringlib/find.h"

int main ()
{
   STRINGLIB_CHAR* str = "foo2/**bar**/";
   Py_ssize_t str_len = strlen (str);
   STRINGLIB_CHAR* sub = "/**bar**/";
   Py_ssize_t sub_len = strlen (sub);
   Py_ssize_t offset = 0;
   Py_ssize_t res;

   res = stringlib_find(str, str_len, sub, sub_len, offset);

   printf ("%d\n", res);
   return 0;
}
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1084] ''.find() gives wrong result in Python built with ICC

2007-09-02 Thread Martin v. Löwis

Martin v. Löwis added the comment:

If you are curious, we could now try to find out what precisely goes
wrong. The procedure would be this

* after each step, check whether the problem still occurs

a) resolve the includes manually, then strip everything that isn't
needed. This could start with fastsearch.h and find.h; then
remove everything that refers to Python.h (i.e. replace Py_ssize_t
with ssize_t, Py_LOCAL_INLINE with static inline, and so on), then
remove Python.h

b) try simplifying the code, e.g. replace str_len and sub_len with
their (constant) values, drop the sub_len == 0 block, and so on.

c) when further simplification is not possible (while keeping the
actual error), start looking at the assembler code.

Alternatively, sent this or some further-simplified version to Intel
(assuming they have some kind of bug-reporting channel for icc). With my
compiler-vendor's hat on, I'd like to get a test case for bad code
generation that comes as a single file, with no includes; for gcc, the
request is to submit preprocessor output.

Assuming this is too much effort, I'll close this as "won't fix - third
party".

--
resolution:  -> wont fix
status: open -> closed
versions: +3rd party -Python 2.5

__
Tracker <[EMAIL PROTECTED]>

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



[issue1071] unicode.translate() doesn't error out on invalid translation table

2007-09-02 Thread Marc-Andre Lemburg

Marc-Andre Lemburg added the comment:

Ah, I hadn't noticed that you're actually manipulating the input
dictionary. You should create a copy and fix that instead of changing
the dict that the user passed in to the function.

You can then use PyDict_Next() for fast iteration over the original
dictionary.

__
Tracker <[EMAIL PROTECTED]>

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



[issue1084] ''.find() gives wrong result in Python built with ICC

2007-09-02 Thread Simon Anders

Simon Anders added the comment:

Martin: I've boiled down the test case a bit more and removed all
Python-specific types and macros, so that it can now be compiled
stand-alone. (Updated test case 'findtest.c' attached.) I didn't feel
like diving into the code much deeper, and so I have sent it to Intel
Premier Support as Issue #448807. Let's see if they bother to
investigate it further.

__
Tracker <[EMAIL PROTECTED]>

__/* 
Testcase for problem with 'icc -O3':

The function 'fastsearch' is taken from the source code of Python 2.5
and looks for the substring 'p' (of length 'm') within the string 's'
(of length 'n'). If 'mode' is 'FAST_COUNT' the number of occurences of
p in s is returned, and for 'FAST_SEARCH', the position of the first 
occurence.

For the specific values used in main() below, the function returns 
correctly '4', if compiled with at most optimization '-O2', but '-1'
for optimization level '-O3'.

I have just changed the Python-specific types to standard ones, otherwise
fastsearc() is as defined in file Objects/stringlib/fastsearch.h of
the Python 2.5.1 source code. It has been written by Fredrik Lundh and
is described in his blog here: http://effbot.org/zone/stringlib.htm

   Simon Anders, [EMAIL PROTECTED], 2007-09-02
*/

#include 
#include 
#define FAST_COUNT 0
#define FAST_SEARCH 1

inline int
fastsearch(const char* s, int n,
   const char* p, int m,
   int mode)
{
long mask;
int skip, count = 0;
int i, j, mlast, w;

w = n - m;

if (w < 0)
return -1;

/* look for special cases */
if (m <= 1) {
if (m <= 0)
return -1;
/* use special case for 1-character strings */
if (mode == FAST_COUNT) {
for (i = 0; i < n; i++)
if (s[i] == p[0])
count++;
return count;
} else {
for (i = 0; i < n; i++)
if (s[i] == p[0])
return i;
}
return -1;
}

mlast = m - 1;

/* create compressed boyer-moore delta 1 table */
skip = mlast - 1;
/* process pattern[:-1] */
for (mask = i = 0; i < mlast; i++) {
mask |= (1 << (p[i] & 0x1F));
if (p[i] == p[mlast])
skip = mlast - i - 1;
}
/* process pattern[-1] outside the loop */
mask |= (1 << (p[mlast] & 0x1F));

for (i = 0; i <= w; i++) {
/* note: using mlast in the skip path slows things down on x86 */
if (s[i+m-1] == p[m-1]) {
/* candidate match */
for (j = 0; j < mlast; j++)
if (s[i+j] != p[j])
break;
if (j == mlast) {
/* got a match! */
if (mode != FAST_COUNT)
return i;
count++;
i = i + mlast;
continue;
}
/* miss: check if next character is part of pattern */
if (!(mask & (1 << (s[i+m] & 0x1F
i = i + m;
else
i = i + skip;
} else {
/* skip: check if next character is part of pattern */
if (!(mask & (1 << (s[i+m] & 0x1F
i = i + m;
}
}

if (mode != FAST_COUNT)
return -1;
return count;
}


int main ()
{
   char* str = "foo2/**bar**/";
   int str_len = strlen (str);
   char* sub = "/**bar**/";
   int sub_len = strlen (sub);
   int offset = 0;
   int res;

   res = fastsearch (str, str_len, sub, sub_len, FAST_SEARCH);

   printf ("%d\n", res);
   return 0;
}
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1086] test_email failed

2007-09-02 Thread xyb

New submission from xyb:

test test_email failed -- Traceback (most recent call last):
  File "/home/xyb/Python-3.0a1/Lib/email/test/test_email.py", line 1445,
in test_same_boundary_inner_outer
msg = self._msgobj('msg_15.txt')
  File "/home/xyb/Python-3.0a1/Lib/email/test/test_email.py", line 67,
in _msgobj
return email.message_from_file(fp)
  File "/home/xyb/Python-3.0a1/Lib/email/__init__.py", line 46, in
message_from_file
return Parser(*args, **kws).parse(fp)
  File "/home/xyb/Python-3.0a1/Lib/email/parser.py", line 68, in parse
data = fp.read(8192)
  File "/home/xyb/Python-3.0a1/Lib/io.py", line 1231, in read
readahead, pending = self._read_chunk()
  File "/home/xyb/Python-3.0a1/Lib/io.py", line 1127, in _read_chunk
pending = self._decoder.decode(readahead, not readahead)
  File "/home/xyb/Python-3.0a1/Lib/codecs.py", line 291, in decode
(result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf8' codec can't decode byte 0xbe in position 86:
unexpected code byte

--
messages: 55583
nosy: xyb
severity: normal
status: open
title: test_email failed
versions: Python 3.0

__
Tracker <[EMAIL PROTECTED]>

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



[issue1086] test_email failed

2007-09-02 Thread Peter van Kampen

Peter van Kampen added the comment:

Attached is msg_15.txt encoded in utf-8.
>>> f = codecs.open('Lib/email/test/data/msg_15.txt', 'r',
encoding='iso-8859-1')
>>> s = f.read()
>>> f.close()
>>> f = open('Lib/email/test/data/msg_15.txt','w')
>>> f.write(s)
>>> f.close()

$ ./python Lib/test/regrtest.py test_email
test_email
1 test OK.

--
nosy: +pterk

__
Tracker <[EMAIL PROTECTED]>

__Return-Path: <[EMAIL PROTECTED]>
Received: from fepD.post.tele.dk (195.41.46.149) by mail.groupcare.dk (LSMTP 
for Windows NT v1.1b) with SMTP id <[EMAIL PROTECTED]>; Mon, 30 Apr 2001 
12:17:50 +0200
User-Agent: Microsoft-Outlook-Express-Macintosh-Edition/5.02.2106
Subject: XX
From: [EMAIL PROTECTED]
To: XX
Message-ID: 
Mime-version: 1.0
Content-type: multipart/mixed;
   boundary="MS_Mac_OE_3071477847_720252_MIME_Part"

> Denne meddelelse er i MIME-format. Da dit postl¾sningsprogram ikke forstŒr 
> dette format, kan del af eller hele meddelelsen v¾re ul¾selig.

--MS_Mac_OE_3071477847_720252_MIME_Part
Content-type: multipart/alternative;
   boundary="MS_Mac_OE_3071477847_720252_MIME_Part"


--MS_Mac_OE_3071477847_720252_MIME_Part
Content-type: text/plain; charset="ISO-8859-1"
Content-transfer-encoding: quoted-printable

Some removed test. 

--MS_Mac_OE_3071477847_720252_MIME_Part
Content-type: text/html; charset="ISO-8859-1"
Content-transfer-encoding: quoted-printable



Some removed HTML


Some removed text.




--MS_Mac_OE_3071477847_720252_MIME_Part--


--MS_Mac_OE_3071477847_720252_MIME_Part
Content-type: image/gif; name="xx.gif";
 x-mac-creator="6F676C65";
 x-mac-type="47494666"
Content-disposition: attachment
Content-transfer-encoding: base64

Some removed base64 encoded chars.

--MS_Mac_OE_3071477847_720252_MIME_Part--

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



[issue1673409] datetime module missing some important methods

2007-09-02 Thread Jon Ribbens

Jon Ribbens added the comment:

Almost everything you just said about time_t is wrong. time_t is signed,
and always has been (otherwise the 'end of time' for 32-bit time_t would
be 2106, not 2038). Also, time_t does not end at 2038 because nothing
says it must be 32 bits. Also, Python has 'long integers' which do not
overflow.

Also, I don't understand what you mean about use cases. The "use case"
is "dealing with anything which expects standard Unix time_t, for
example the Python standard library". The use case I have personally is
the program I was working on when I encountered the problem described in
this bug report. Also I think symmetry is a darn good argument. Why does
fromtimestamp exist if, as you claim, nobody uses time_t?

_
Tracker <[EMAIL PROTECTED]>

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



[issue1673409] datetime module missing some important methods

2007-09-02 Thread Skip Montanaro

Skip Montanaro added the comment:

Jon> Almost everything you just said about time_t is wrong. time_t is
Jon> signed, and always has been (otherwise the 'end of time' for 32-bit
Jon> time_t would be 2106, not 2038). Also, time_t does not end at 2038
Jon> because nothing says it must be 32 bits. Also, Python has 'long
Jon> integers' which do not overflow.

My apologies about goofing up on the signedness of time_t.  What are you
going to do with a long integer that you can't do with a datetime object?
You clearly can't pass it directly to any Unix library functions which
expect time_t.  Converting it can overflow.

Jon> Also, I don't understand what you mean about use cases. The "use
Jon> case" is "dealing with anything which expects standard Unix time_t,
Jon> for example the Python standard library". The use case I have
Jon> personally is the program I was working on when I encountered the
Jon> problem described in this bug report. Also I think symmetry is a
Jon> darn good argument. Why does fromtimestamp exist if, as you claim,
Jon> nobody uses time_t?

What should datetime.datetime(, 1, 1).totimestamp() return?  How would
you pass it to something which accepts a time_t?  The fromtimestamp
functions work simply because the range of time_t is a proper subset of the
range of Python's datetime objects.  Symmetry gets you little.  In
situations where you need Unix timestamps and you know your datetime objects
are within the bounds representable by time_t, you can define a convenience
function:

def totimestamp(dt):
return time.mktime(dt.timetuple()) + dt.microsecond/1e6

This will, of course, fail if the year is too big or too small (and will
fail in platform-dependent ways if the underlying platform's range of
representable dates has different bounds than Unix does).  Doing it without
resorting to calling time.mktime is also nontrivial.  Under the covers the
datetime module currently uses platform functions to get time information
anyway.  It doesn't do a lot of low-level time arithmethic itself.
Implementing fromtimestamp would require a fair amount of effort unless you
were willing to punt and just raise OverflowError for dates outside the
system's range.

Skip

_
Tracker <[EMAIL PROTECTED]>

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



[issue1078] cachersrc.py using tuple unpacking args

2007-09-02 Thread Georg Brandl

Changes by Georg Brandl:


--
assignee:  -> collinwinter
nosy: +collinwinter

__
Tracker <[EMAIL PROTECTED]>

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



[issue1087] py3k os.popen result is not iterable, patch attached

2007-09-02 Thread Carsten Haese

Changes by Carsten Haese:


--
components: Library (Lib)
severity: normal
status: open
title: py3k os.popen result is not iterable, patch attached
type: behavior
versions: Python 3.0

__
Tracker <[EMAIL PROTECTED]>

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



[issue1087] py3k os.popen result is not iterable, patch attached

2007-09-02 Thread Carsten Haese

Changes by Carsten Haese:


__
Tracker <[EMAIL PROTECTED]>

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



[issue1746880] AMD64 installer does not place python25.dll in system dir

2007-09-02 Thread Martin v. Löwis

Martin v. Löwis added the comment:

Mark Hammond has now confirmed it worked for 3.0a1, so closing it.

--
status: open -> closed

_
Tracker <[EMAIL PROTECTED]>

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



[issue1759169] clean up Solaris port and allow C99 extension modules

2007-09-02 Thread Martin v. Löwis

Martin v. Löwis added the comment:

I don't understand the problem. What Solaris version are you using?

Why do you want to remove _XOPEN_SOURCE? Solaris considers this as a
request for XPG 4.2 only _XOPEN_SOURCE_EXTENDED is defined, which it
shouldn't be on Solaris 10.

_
Tracker <[EMAIL PROTECTED]>

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



[issue1722225] Build on QNX

2007-09-02 Thread Martin v. Löwis

Martin v. Löwis added the comment:

A 2.5 patch would not be accepted; there won't be any new features 
for 2.5 , and new port would be a new feature.

Procedurally, are you willing to support a QNX port for the coming years
(say, 5 years)? Otherwise, there is little point in accepting such a
port if there is no maintenance to it.

In general, I would prefer if the things this patch corrects were
detected through autoconf, rather than being hard-coded by system name.

For example, if using TCGETA and TCSETA requires sys/termio.h to be
included, there should be an autoconf test that checks whether TCGETA
can be used without sys/termio.h being included, and, if not, defines a
macro that says so.

However, I don't understand this entire point: What do you mean by
"using TCGETA requires that struct termio be defined"? How is TCGETA
defined to produce such a dependency? TCGETA is a constant, right?

py_curses.h: Can you explain what stdlib.h and ncurses.h define to guard
definition of wchar_t? Why do you have two cases: _XOPEN_SOURCE_EXTENDED
and not? Surely only one of them applies to Python. Can you come up with
an autoconf test that checks whether stdlib.h defines wchar_t and has a
guard and that ncurses also defines wchar_t and fails to compile if it
is guarded differently?

stack size: it would be good if it was sized by default such that the
default recursion limit won't cause crashes (but proper stack
overflows). If 2MiB are sufficient for the default recursion limit, it's
fine - otherwise, either reserver more stack, or reduce the default
recursion limit.

malloc_closure should use _SC_PAGESIZE when it is defined, and fall back
to getpagesize only otherwise.

_
Tracker <[EMAIL PROTECTED]>

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



[issue1694155] Python 2.5 installer ended prematurely

2007-09-02 Thread Martin v. Löwis

Martin v. Löwis added the comment:

Closing because of lack of feedback. (it may be that I got feedback in
private mail off-tracker; I don't remember).

--
resolution:  -> works for me
status: open -> closed

_
Tracker <[EMAIL PROTECTED]>

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



[issue1654408] Installer should split tcl/tk and tkinter install options.

2007-09-02 Thread Martin v. Löwis

Changes by Martin v. Löwis:


--
severity: normal -> minor

_
Tracker <[EMAIL PROTECTED]>

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



[issue1752184] PyHeapTypeObject fix

2007-09-02 Thread Martin v. Löwis

Martin v. Löwis added the comment:

The source of make_type is in Parser/asdl_c.py.

--
nosy: +loewis

_
Tracker <[EMAIL PROTECTED]>

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



[issue1087] py3k os.popen result is not iterable, patch attached

2007-09-02 Thread Martin v. Löwis

Changes by Martin v. Löwis:


--
keywords: +patch

__
Tracker <[EMAIL PROTECTED]>

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



[issue1006] Refactor test_winreg.py to use unittest.

2007-09-02 Thread Martin v. Löwis

Changes by Martin v. Löwis:


--
keywords: +patch

__
Tracker <[EMAIL PROTECTED]>

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



[issue1007] [py3k] Fix dumbdbm, which fixes test_shelve (for me); instrument other tests so we catch this sooner (and more directly)

2007-09-02 Thread Martin v. Löwis

Changes by Martin v. Löwis:


--
keywords: +patch

__
Tracker <[EMAIL PROTECTED]>

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



[issue1012] Broken URL at Doc/install/index.rst

2007-09-02 Thread Martin v. Löwis

Changes by Martin v. Löwis:


--
keywords: +patch

__
Tracker <[EMAIL PROTECTED]>

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



[issue1015] [PATCH] Updated patch for rich dict view (dict().keys()) comparisons

2007-09-02 Thread Martin v. Löwis

Changes by Martin v. Löwis:


--
keywords: +patch

__
Tracker <[EMAIL PROTECTED]>

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



[issue1016] [PATCH] Updated fix for string to unicode fixes in time and datetime

2007-09-02 Thread Martin v. Löwis

Changes by Martin v. Löwis:


--
keywords: +patch

__
Tracker <[EMAIL PROTECTED]>

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



[issue1017] [PATCH] Add set operations (and, or, xor, subtract) to dict views

2007-09-02 Thread Martin v. Löwis

Changes by Martin v. Löwis:


--
keywords: +patch

__
Tracker <[EMAIL PROTECTED]>

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



[issue1023] [PATCH] Unicode fixes in floatobject and moduleobject

2007-09-02 Thread Martin v. Löwis

Changes by Martin v. Löwis:


--
keywords: +patch

__
Tracker <[EMAIL PROTECTED]>

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



[issue1029] py3k: io.StringIO.getvalue() returns \r\n

2007-09-02 Thread Martin v. Löwis

Changes by Martin v. Löwis:


--
keywords: +patch

__
Tracker <[EMAIL PROTECTED]>

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



[issue1030] py3k: Adapt _winreg.c to the new buffer API

2007-09-02 Thread Martin v. Löwis

Changes by Martin v. Löwis:


--
keywords: +patch

__
Tracker <[EMAIL PROTECTED]>

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



[issue1000] Patch to rename *Server modules to lower-case

2007-09-02 Thread Martin v. Löwis

Changes by Martin v. Löwis:


--
keywords: +patch

__
Tracker <[EMAIL PROTECTED]>

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



[issue1002] Patch to rename HTMLParser module to lower_case

2007-09-02 Thread Martin v. Löwis

Changes by Martin v. Löwis:


--
keywords: +patch

__
Tracker <[EMAIL PROTECTED]>

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



[issue1004] MultiMethods with type annotations in 3000

2007-09-02 Thread Martin v. Löwis

Changes by Martin v. Löwis:


--
keywords: +patch

__
Tracker <[EMAIL PROTECTED]>

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



[issue1005] Patches to rename Queue module to queue

2007-09-02 Thread Martin v. Löwis

Changes by Martin v. Löwis:


--
keywords: +patch

__
Tracker <[EMAIL PROTECTED]>

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



[issue1019] Cleanup pass on _curses and _curses_panel

2007-09-02 Thread Martin v. Löwis

Changes by Martin v. Löwis:


--
keywords: +patch

__
Tracker <[EMAIL PROTECTED]>

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



[issue1022] use bytes for code objects

2007-09-02 Thread Martin v. Löwis

Changes by Martin v. Löwis:


--
keywords: +patch

__
Tracker <[EMAIL PROTECTED]>

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



[issue1026] Backport ABC to 2.6

2007-09-02 Thread Martin v. Löwis

Changes by Martin v. Löwis:


--
keywords: +patch

__
Tracker <[EMAIL PROTECTED]>

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



[issue1027] uudecoding (uu.py) does not supprt base64, patch attached

2007-09-02 Thread Martin v. Löwis

Changes by Martin v. Löwis:


--
keywords: +patch

__
Tracker <[EMAIL PROTECTED]>

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



[issue1032] Improve the hackish runtime_library_dirs support for gcc

2007-09-02 Thread Martin v. Löwis

Changes by Martin v. Löwis:


--
keywords: +patch

__
Tracker <[EMAIL PROTECTED]>

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



[issue1034] [patch] Add 2to3 support for displaying warnings as Python comments

2007-09-02 Thread Martin v. Löwis

Changes by Martin v. Löwis:


--
keywords: +patch

__
Tracker <[EMAIL PROTECTED]>

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



[issue1043] test_builtin failure on Windows

2007-09-02 Thread Martin v. Löwis

Changes by Martin v. Löwis:


--
keywords: +patch

__
Tracker <[EMAIL PROTECTED]>

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



[issue1047] py3k: corrections for test_subprocess on windows

2007-09-02 Thread Martin v. Löwis

Changes by Martin v. Löwis:


--
keywords: +patch

__
Tracker <[EMAIL PROTECTED]>

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



[issue1061] ABC caches should use weak refs

2007-09-02 Thread Martin v. Löwis

Changes by Martin v. Löwis:


--
keywords: +patch

__
Tracker <[EMAIL PROTECTED]>

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



[issue1071] unicode.translate() doesn't error out on invalid translation table

2007-09-02 Thread Martin v. Löwis

Changes by Martin v. Löwis:


--
keywords: +patch

__
Tracker <[EMAIL PROTECTED]>

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



[issue1075] py3k: Unicode error in os.stat on Windows

2007-09-02 Thread Martin v. Löwis

Changes by Martin v. Löwis:


--
keywords: +patch

__
Tracker <[EMAIL PROTECTED]>

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



[issue1076] py3 patch: full Unicode version for winreg module

2007-09-02 Thread Martin v. Löwis

Changes by Martin v. Löwis:


--
keywords: +patch

__
Tracker <[EMAIL PROTECTED]>

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



[issue1086] test_email failed

2007-09-02 Thread Martin v. Löwis

Martin v. Löwis added the comment:

I don't think recoding the message is the right thing to do. Instead,
the email package should be fixed to not treat the bytes before the
first part of a multipart message as text, or else assume that it is
Latin-1 encoded (it's certainly not *meant* to be text to be shown to
the user - it's a fallback for MUAs which don't support MIME (whether it
then is a smart thing to Danish with Latin-1 is a different question))

--
assignee:  -> barry
nosy: +barry, loewis

__
Tracker <[EMAIL PROTECTED]>

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



[issue1088] News page broken link to 3.0a1

2007-09-02 Thread Graham Horler

New submission from Graham Horler:

The news page:
 http://www.python.org/news/

...has a relative link:
 first alpha release

...which resolves to:
 http://www.python.org/news/download/releases/3.0

...which does not exist.  It should be absolute:
 http://www.python.org/download/releases/3.0/

--
messages: 55593
nosy: grahamh
severity: normal
status: open
title: News page broken link to 3.0a1
type: behavior
versions: Python 3.0

__
Tracker <[EMAIL PROTECTED]>

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



[issue1088] News page broken link to 3.0a1

2007-09-02 Thread Martin v. Löwis

Martin v. Löwis added the comment:

Thanks for the report. This is now fixed.

--
nosy: +loewis
resolution:  -> fixed
status: open -> closed

__
Tracker <[EMAIL PROTECTED]>

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



[issue1089] ever considered adding static typing to python?

2007-09-02 Thread Adam Wieckowski

Changes by Adam Wieckowski:


--
components: Interpreter Core
severity: minor
status: open
title: ever considered adding static typing to python?
type: rfe
versions: 3rd party

__
Tracker <[EMAIL PROTECTED]>

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



[issue1089] ever considered adding static typing to python?

2007-09-02 Thread Adam Wieckowski

Changes by Adam Wieckowski:


--
type: rfe -> 

__
Tracker <[EMAIL PROTECTED]>

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



[issue1090] doctools/sphinx/web/application.py does not start on windows

2007-09-02 Thread Waldemar Osuch

New submission from Waldemar Osuch:

Loading pickles on windows without specifying 'rb' does not work in 
http://svn.python.org/projects/doctools/trunk/sphinx/web/application.py
A simple patch attached

--
components: Documentation tools (Sphinx)
files: sphinx_web_application.patch
messages: 55595
nosy: osuchw
severity: normal
status: open
title: doctools/sphinx/web/application.py does not start on windows
type: crash

__
Tracker <[EMAIL PROTECTED]>

__

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



[issue1091] [patch] py3k Mac installation errors

2007-09-02 Thread Humberto Diogenes

New submission from Humberto Diogenes:

This patch addresses 3 simple errors (1 syntax, 1 runtime, 1 import) when 
doing a "make altinstall" on Mac OS X, including the error listed in issue 
1078.

--
components: Installation, Macintosh
files: py3k-mac-install-1.patch
messages: 55596
nosy: hdiogenes
severity: normal
status: open
title: [patch] py3k Mac installation errors
type: compile error
versions: Python 3.0

__
Tracker <[EMAIL PROTECTED]>

__Index: Mac/scripts/cachersrc.py
===
--- Mac/scripts/cachersrc.py(revision 57880)
+++ Mac/scripts/cachersrc.py(working copy)
@@ -12,7 +12,8 @@
 class NoArgsError(Exception):
 pass
 
-def handler((verbose, force), dirname, fnames):
+def handler(arg1, dirname, fnames):
+verbose, force = arg1
 for fn in fnames:
 if fn[-5:] == '.rsrc' and fn[-13:] != '.rsrc.df.rsrc':
 if force:
Index: Lib/plat-mac/macresource.py
===
--- Lib/plat-mac/macresource.py (revision 57880)
+++ Lib/plat-mac/macresource.py (working copy)
@@ -76,15 +76,15 @@
 AppleSingle file"""
 try:
 refno = Res.FSpOpenResFile(pathname, 1)
-except Res.Error as arg:
-if arg[0] in (-37, -39):
+except Res.Error as error:
+if error.args[0] in (-37, -39):
 # No resource fork. We may be on OSX, and this may be either
 # a data-fork based resource file or a AppleSingle file
 # from the CVS repository.
 try:
 refno = Res.FSOpenResourceFile(pathname, '', 1)
-except Res.Error as arg:
-if arg[0] != -199:
+except Res.Error as error:
+if error.args[0] != -199:
 # -199 is "bad resource map"
 raise
 else:
@@ -103,15 +103,15 @@
 try:
 refno = Res.FSpOpenResFile(pathname, 1)
 Res.CloseResFile(refno)
-except Res.Error as arg:
-if arg[0] in (-37, -39):
+except Res.Error as error:
+if error.args[0] in (-37, -39):
 # No resource fork. We may be on OSX, and this may be either
 # a data-fork based resource file or a AppleSingle file
 # from the CVS repository.
 try:
 refno = Res.FSOpenResourceFile(pathname, '', 1)
-except Res.Error as arg:
-if arg[0] != -199:
+except Res.Error as error:
+if error.args[0] != -199:
 # -199 is "bad resource map"
 raise
 else:
Index: Lib/plat-mac/Carbon/ControlAccessor.py
===
--- Lib/plat-mac/Carbon/ControlAccessor.py  (revision 57880)
+++ Lib/plat-mac/Carbon/ControlAccessor.py  (working copy)
@@ -1,6 +1,6 @@
 # Accessor functions for control properties
 
-from Controls import *
+from Carbon.Controls import *
 import struct
 
 # These needn't go through this module, but are here for completeness
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1022] use bytes for code objects

2007-09-02 Thread Brett Cannon

Brett Cannon added the comment:

I have security/stability issues with code objects having mutable
bytecode.  This would allow someone to possibly crash the interpreter
with crappy bytecode.  I also have a worry that someone might come up
with some clever way of causing different code to execute through
manipulating what LOAD_GLOBALS or STORE_GLOBALS accesses/sets.

--
nosy: +brett.cannon

__
Tracker <[EMAIL PROTECTED]>

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



[issue1092] Unexpected results in Tutorial about Unicode

2007-09-02 Thread Vizcaynot

New submission from Vizcaynot:

When trying the tutorial example about unicode  I have:
>>> "Äpfel".encode('utf-8')
  File "", line 1
SyntaxError: (unicode error) unexpected code byte

I live in a latin american country so I need to do:
>>> "Äpfel".decode('latin-1).encode('utf-8')
  File "", line 1
>>>
but the indentation " >>>" is new for me, so I attempt the next:
>>> a="Äpfel".decode('latin-1).encode('utf-8')
  File "", line 1
>>> a
b'\xc3\x84pfel'
>>> print (a)
Äpfel
>>>

Is this necessary to do correction to the tutorial? is this normal the 
presence of "   >>>" that appears indented once I assign the value to 
variable a?
Thanks!!

--
components: Unicode
messages: 55598
nosy: Viscaynot
severity: normal
status: open
title: Unexpected results in Tutorial about Unicode
type: behavior
versions: Python 3.0

__
Tracker <[EMAIL PROTECTED]>

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



[issue1093] product function patch

2007-09-02 Thread Ryan Freckleton

New submission from Ryan Freckleton:

This is a patch to implement a product() builtin function. It works
behaves similarly to reduce(operator.mul,...) but is implemented in C.

Tests and documentation are included in this patch.

--
components: Documentation, Library (Lib), Tests
files: product_function.diff
messages: 55599
nosy: ryan.freckleton
severity: normal
status: open
title: product function patch
type: behavior
versions: Python 2.6

__
Tracker <[EMAIL PROTECTED]>

__Index: Python/bltinmodule.c
===
--- Python/bltinmodule.c	(revision 57913)
+++ Python/bltinmodule.c	(working copy)
@@ -2094,7 +2094,59 @@
 of parameter 'start' (which defaults to 0).  When the sequence is\n\
 empty, returns start.");
 
+static PyObject*
+builtin_product(PyObject *self, PyObject *args)
+{
+	PyObject *seq;
+	PyObject *result = NULL;
+	PyObject *temp, *item, *iter;
 
+	if (!PyArg_UnpackTuple(args, "product", 1, 2, &seq, &result))
+		return NULL;
+
+	iter = PyObject_GetIter(seq);
+	if (iter == NULL)
+		return NULL;
+
+	if (result == NULL) {
+		result = PyInt_FromLong(1);
+		if (result == NULL) {
+			Py_DECREF(iter);
+			return NULL;
+		}
+	} else {
+		Py_INCREF(result);
+	}
+
+	for(;;) {
+		item = PyIter_Next(iter);
+		if (item == NULL) {
+			/* error, or end-of-sequence */
+			if (PyErr_Occurred()) {
+Py_DECREF(result);
+result = NULL;
+			}
+			break;
+		}
+		temp = PyNumber_Multiply(result, item);
+		Py_DECREF(result);
+		Py_DECREF(item);
+		result = temp;
+		if (result == NULL)
+			break;
+	}
+	Py_DECREF(iter);
+	return result;
+}
+
+PyDoc_STRVAR(product_doc,
+"product(sequence[, start]) -> value\n\
+\n\
+Returns the product of a sequence of numbers times the value\n\
+of parameter 'start' (which defaults to 1).  When the sequence is\n\
+empty, returns start.");
+
+
 static PyObject *
 builtin_isinstance(PyObject *self, PyObject *args)
 {
@@ -2296,6 +2348,7 @@
  	{"open",	(PyCFunction)builtin_open,   METH_VARARGS | METH_KEYWORDS, open_doc},
  	{"ord",		builtin_ord,METH_O, ord_doc},
  	{"pow",		builtin_pow,METH_VARARGS, pow_doc},
+ 	{"product",	builtin_product,METH_VARARGS, product_doc},
  	{"range",	builtin_range,  METH_VARARGS, range_doc},
  	{"raw_input",	builtin_raw_input,  METH_VARARGS, raw_input_doc},
  	{"reduce",	builtin_reduce, METH_VARARGS, reduce_doc},
Index: Doc/library/functions.rst
===
--- Doc/library/functions.rst	(revision 57913)
+++ Doc/library/functions.rst	(working copy)
@@ -1104,7 +1104,15 @@
 
.. versionadded:: 2.3
 
+.. function:: product(iterable[, start])
+   Multiplies *start* and the items of an *iterable* from left to right and
+   returns the product. *start* defaults to ``1``. The *iterable*'s items are
+   normally numbers. Note that ``product(range(n), m)`` is equivalent to
+   ``reduce(operator.mul, range(n), m)``
 
+   .. versionadded:: 2.6
+
+
 .. function:: super(type[, object-or-type])
 
Return the superclass of *type*.  If the second argument is omitted the super
Index: Lib/test/test_builtin.py
===
--- Lib/test/test_builtin.py	(revision 57913)
+++ Lib/test/test_builtin.py	(working copy)
@@ -1697,6 +1697,19 @@
 raise ValueError
 self.assertRaises(ValueError, sum, BadSeq())
 
+def test_product(self):
+self.assertEqual(product([]), 1)
+self.assertEqual(product(range(2,8)), 5040)
+self.assertEqual(product(iter(range(2,8))), 5040)
+
+self.assertRaises(TypeError, product)
+self.assertRaises(TypeError, product, 42)
+self.assertRaises(TypeError, product, ['a', 'b', 'c'])
+self.assertRaises(TypeError, product, ['a', 'b', 'c'], '')
+self.assertRaises(TypeError, product, [[1], [2], [3]])
+self.assertRaises(TypeError, product, [{2:3}])
+self.assertRaises(TypeError, product, [{2:3}]*2, {2:3})
+
 def test_tuple(self):
 self.assertEqual(tuple(()), ())
 t0_3 = (0, 1, 2, 3)
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1093] product function patch

2007-09-02 Thread Martin v. Löwis

Martin v. Löwis added the comment:

-1. I doubt this is needed often enough to justify a builtin function.

--
nosy: +loewis

__
Tracker <[EMAIL PROTECTED]>

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



[issue1093] product function patch

2007-09-02 Thread Guido van Rossum

Guido van Rossum added the comment:

Thanks, but no thanks; I was quickly dissuaded from the need for this.

--
nosy: +gvanrossum
resolution:  -> rejected
status: open -> closed

__
Tracker <[EMAIL PROTECTED]>

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