[issue6511] zipfile: Invalid argument when opening zero-sized files

2009-07-29 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc amaur...@gmail.com added the comment:

Oh, this was done with r74246, I just forgot to mention it.
Anyway all changes in trunk are regularly merged into py3k.

--

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



[issue6595] Make Decimal constructor accept all unicode decimal digits in input.

2009-07-29 Thread Mark Dickinson

New submission from Mark Dickinson dicki...@gmail.com:

Ezio Melotti asked (on #python-dev) why the Decimal constructor doesn't 
accept decimal digits other than 0-9.  As far as I can tell there's no 
good reason for it not to.  Moreover, the standard on which the decimal 
module is based says[1]:

It is recommended that implementations also provide additional number 
formatting routines (including some which are locale-dependent), and if 
available should accept non-European decimal digits in strings.

All other builtin or standard library numeric types already accept such 
digits:

Python 3.2a0 (py3k:74247, Jul 29 2009, 09:28:12) 
[GCC 4.0.1 (Apple Inc. build 5493)] on darwin
Type help, copyright, credits or license for more information.
 from fractions import Fraction
 from decimal import Decimal
 x = '\uff11\uff10\uff15\uff18\uff15'
 x
'10585'
 int(x)
10585
 float(x)
10585.0
 complex(x)
(10585+0j)
 Fraction(x)
Fraction(10585, 1)
 Decimal(x)
Traceback (most recent call last):
  File stdin, line 1, in module
  File /Users/dickinsm/python/svn/py3k/Lib/decimal.py, line 548, in 
__new__
Invalid literal for Decimal: %r % value)
  File /Users/dickinsm/python/svn/py3k/Lib/decimal.py, line 3816, in 
_raise_error
raise error(explanation)
decimal.InvalidOperation: Invalid literal for Decimal: '10585'

I propose adding support for this in Python 3.2 and (possibly) 2.7.  The 
change would be for input only:  no record of the original form of the 
digits would be kept by the Decimal object itself, so that e.g.,
str(Decimal('10585')) would still be '10585'.

[1] See http://speleotrove.com/decimal/daconvs.html

--
assignee: marketdickinson
components: Library (Lib)
messages: 91030
nosy: ezio.melotti, marketdickinson
severity: normal
status: open
title: Make Decimal constructor accept all unicode decimal digits in input.
type: feature request
versions: Python 3.2

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



[issue6595] Make Decimal constructor accept all unicode decimal digits in input.

2009-07-29 Thread Mark Dickinson

Mark Dickinson dicki...@gmail.com added the comment:

Here's a patch

--
keywords: +patch
Added file: http://bugs.python.org/file14593/issue6595.patch

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



[issue6595] Make Decimal constructor accept all unicode decimal digits in input.

2009-07-29 Thread Eric Smith

Eric Smith e...@trueblade.com added the comment:

+1

The standard recommends it, and the other numeric types support it, so
Decimal should as well.

--
nosy: +eric.smith

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



[issue6595] Make Decimal constructor accept all unicode decimal digits in input.

2009-07-29 Thread Eric Smith

Eric Smith e...@trueblade.com added the comment:

Since you're calling int() on the result, can't this code:
self._int = str(int((intpart+fracpart).lstrip('0') or '0'))
just be:
self._int = str(int(intpart+fracpart))
?

And here, you already know diag is not None, so do you need the or '0'
part?
self._int = str(int(diag or '0')).lstrip('0')

And, in both calls to .lstrip('0'), what happens if you have a
non-European leading '0', like '\uff10'?

Otherwise, the patch looks good to me.

--

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



[issue6596] urllib2 bug on CentOS

2009-07-29 Thread Anton

New submission from Anton rk3...@gmail.com:

This code gives HTTP Error 500 on CentOS:
-
import urllib2
url = 'http://wm.exchanger.ru/asp/XMLWMList.asp?exchtype=1'
t = urllib2.urlopen(url).read()
-

tcpdump:
-
...
GET /asp/XMLWMList.asp?exchtype=1?3d2ebf80 HTTP/1.1
Accept-Encoding: identity
Host: wm.exchanger.ru
Connection: close
User-Agent: Python-urllib/2.6
...
-
?3d2ebf80 appended to request

% uname -a
Linux xxx.xxx 2.6.18-028stab062.3-ent #1 SMP Thu Mar 26 15:12:05 MSK 
2009 i686 i686 i386 GNU/Linux

The same problem with python 2.4.3. On other systems this code works 
nice.

--
components: Extension Modules
messages: 91034
nosy: rk3dov
severity: normal
status: open
title: urllib2 bug on CentOS
versions: Python 2.6

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



[issue6596] urllib2 bug on CentOS

2009-07-29 Thread Anton

Changes by Anton rk3...@gmail.com:


--
type:  - behavior

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



[issue2636] Regexp 2.7 (modifications to current re 2.2.2)

2009-07-29 Thread Matthew Barnett

Changes by Matthew Barnett pyt...@mrabarnett.plus.com:


Removed file: http://bugs.python.org/file14592/issue2636-20090729.zip

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



[issue2636] Regexp 2.7 (modifications to current re 2.2.2)

2009-07-29 Thread Matthew Barnett

Matthew Barnett pyt...@mrabarnett.plus.com added the comment:

Unfortunately I found a bug in regex.py, caused when I made it
compatible with Python 2.5. :-(

issue2636-20090729.zip is now corrected.

--
Added file: http://bugs.python.org/file14594/issue2636-20090729.zip

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



[issue1544339] _ctypes fails to build on Solaris x86 32-bit (Sun compiler)

2009-07-29 Thread Nick

Nick nick_bo...@fastmail.fm added the comment:

I've stumbled head-first into this bug trying to build ctypes 1.0.2, as 
required by the python Shapely GIS library for an important Zope project 
I've been working on.

It's a real surprise to see this bug even exists (since 2006!).  I don't 
understand the cause, but it's totally preventing me from deploying code 
using Shapely (and therefore ctypes) to a new Solaris x86 server that 
otherwise runs on Windows and Linux right now.

How come no progress - is it too hard to solve?

I'm using Sun Studio 12.1.  Out of a bunch of core libraries we're using 
(numpy, geos etc), this little package that has been accepted into the 
main Python distro seems to be the only one we've had problems with. :-(

Is there really no way around this?

--
components: +ctypes
nosy: +nick
versions: +Python 2.4
Added file: http://bugs.python.org/file14595/ffitarget-error.txt

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



[issue6550] asyncore incorrect failure when connection is refused and using async_chat channel

2009-07-29 Thread Nir Soffer

Nir Soffer nir...@gmail.com added the comment:

I'll check the patch this week.

The asyncore framework has low level events - handle_read_event, 
handle_write_event and 
handle_expt_event - these events are not used for reading, writing and OOB - 
they are just 
responsible to call the high level events.

The high level events - handle_connect, handle_accept, handle_read, 
handle_write, 
handle_close and handle_expt should be used only for specific events.

I don't see any problem in checking for errors in handle_expt_event, it works 
just like 
handle_read_event, that calls handle_connect.

This design allow you do replace the dispatcher with your own dispatcher class, 
implementing only the low level events.

--

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



[issue2636] Regexp 2.7 (modifications to current re 2.2.2)

2009-07-29 Thread Ezio Melotti

Ezio Melotti ezio.melo...@gmail.com added the comment:

Apparently Perl has a quite comprehensive set of tests at
http://perl5.git.perl.org/perl.git/blob/HEAD:/t/op/re_tests .
If we want the engine to be Perl-compatible, it might be a good idea to
reuse (part of) their tests (if their license allows it).

--

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



[issue1466065] base64 module ignores non-alphabet characters

2009-07-29 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc amaur...@gmail.com added the comment:

The new unit tests pass without modifying the library.
Could you include a case that fails with the current version?

--
nosy: +amaury.forgeotdarc

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



[issue6593] Documentation: gettext install link

2009-07-29 Thread Georg Brandl

Georg Brandl ge...@python.org added the comment:

Thanks, fixed in r74252.

--
resolution:  - fixed
status: open - closed

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



[issue6591] add reference to fcntl.ioctl in the socket module

2009-07-29 Thread Georg Brandl

Georg Brandl ge...@python.org added the comment:

Thanks, committed in r74253.

--
resolution:  - accepted
status: open - closed

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



[issue6586] Documentation of os.write and os.read are inaccurate.

2009-07-29 Thread Georg Brandl

Georg Brandl ge...@python.org added the comment:

Thanks, fixed in r74254.

--
resolution:  - fixed
status: open - closed

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



[issue1466065] base64 module ignores non-alphabet characters

2009-07-29 Thread Neil Tallim

Neil Tallim red.hamst...@gmail.com added the comment:

I can't add a test for that without changing unrelated behaviour in the
library that is already known to work fine or checking the string value
of the raised exception, which seems like a bad idea, even though it
would work.

If a character is ignored and this leads to a padding-length issue,
TypeError is raised in both 2.7 and 3.2: 2.7 because everything is a
TypeError, and 3.2 because binascii.Error is converted to TypeError for
legacy purposes.

If a character is ignored and the string's length is still acceptable,
then no error is reported because this was a silent problem.

Post-library-modification, both of these cases will uniformly produce
the proper error, although it is, through type-checking alone,
indistinguishable from the errors that would have existed before -- the
value is in the fact that it will tell the user the nature of the
failure, and it will be noisy when it may have been silent before.

--

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



[issue6336] nb_divide missing in docs

2009-07-29 Thread Georg Brandl

Georg Brandl ge...@python.org added the comment:

Thanks, fixed in r74256.

--
resolution:  - fixed
status: open - closed

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



[issue1466065] base64 module ignores non-alphabet characters

2009-07-29 Thread R. David Murray

R. David Murray rdmur...@bitdance.com added the comment:

If it may be noisy where it was silent before, then add one of those
cases and make sure the noise doesn't happen before your fix, and does
happen after.

If you have to check the value of the exception string for other tests,
then do so.  There are plenty of examples of this in the existing tests,
(see the pydoc tests, for example).  If you can limit what you test for
so that the test will be resitent to changes in the exact text, so much
the better.  You can use  assertRaisesRegexp for this in 2.7.

--
nosy: +r.david.murray

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



[issue1466065] base64 module ignores non-alphabet characters

2009-07-29 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc amaur...@gmail.com added the comment:

What is the correct behavior for something like this?
   base64.b64decode('!')
2.6 silently returns ''.

--

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



[issue1466065] base64 module ignores non-alphabet characters

2009-07-29 Thread Neil Tallim

Neil Tallim red.hamst...@gmail.com added the comment:

According to the documentation cited by Seo Sanghyeon in the first post,
A TypeError is raised if s were incorrectly padded or if there are
non-alphabet characters present in the string.

The valid range of characters is [A-Za-z0-9], and one or two '='s may
appear at the end of the input to signify dimension-padding. Therefore,
'!' should fail with a TypeError alerting the user to the presence of
unrecognized data, rather than being discarded.

(Additionally, it looks like newline characters in the input aren't
unheard of, and those are probably the reason behind the silent ignores)

--

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



[issue1466065] base64 module ignores non-alphabet characters

2009-07-29 Thread Neil Tallim

Neil Tallim red.hamst...@gmail.com added the comment:

R. David Murray, should I update the patches for both the pure-Python
solution and the C solution, or is one domain preferable here? The
Python-based solution keeps all of the invalid-character TypeErrors
collected in the same module, but the C-based solution allows this
problem to be caught more efficiently.

--

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



[issue1466065] base64 module ignores non-alphabet characters

2009-07-29 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc amaur...@gmail.com added the comment:

 Therefore, '!' should fail with a TypeError
Here is your test case!
Errors should never pass silently.

--

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



[issue1466065] base64 module ignores non-alphabet characters

2009-07-29 Thread R. David Murray

R. David Murray rdmur...@bitdance.com added the comment:

Amaury is probably better qualified to answer that question, but I would
think the C code version is preferable.

--

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



[issue1466065] base64 module ignores non-alphabet characters

2009-07-29 Thread Neil Tallim

Changes by Neil Tallim red.hamst...@gmail.com:


Removed file: http://bugs.python.org/file14586/1466065[2.7].diff

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



[issue1466065] base64 module ignores non-alphabet characters

2009-07-29 Thread Neil Tallim

Changes by Neil Tallim red.hamst...@gmail.com:


Removed file: http://bugs.python.org/file14587/1466065[3.2].diff

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



[issue1466065] base64 module ignores non-alphabet characters

2009-07-29 Thread Neil Tallim

Changes by Neil Tallim red.hamst...@gmail.com:


Removed file: http://bugs.python.org/file14588/1466065[2.7-pure-python].diff

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



[issue1466065] base64 module ignores non-alphabet characters

2009-07-29 Thread Neil Tallim

Changes by Neil Tallim red.hamst...@gmail.com:


Removed file: http://bugs.python.org/file14589/1466065[3.2-pure-python].diff

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



[issue6595] Make Decimal constructor accept all unicode decimal digits in input.

2009-07-29 Thread Raymond Hettinger

Raymond Hettinger rhettin...@users.sourceforge.net added the comment:

+1

Also, I would like to see this backported.  We've long promised that any
variance with the spec will be treated as a bugfix.  The change won't
break any existing code.

--
nosy: +rhettinger

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



[issue1466065] base64 module ignores non-alphabet characters

2009-07-29 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc amaur...@gmail.com added the comment:

I've dig into the history of the file and found this change:
http://svn.python.org/view?view=revrevision=13939
- Illegal padding is now ignored.  (Recommendation by GvR.)

The motivation at the time was based on the general Internet philosophy:
http://mail.python.org/pipermail/python-bugs-list/1999-October/000234.html

I don't know if this is still valid 10 years later, though.

--

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



[issue1466065] base64 module ignores non-alphabet characters

2009-07-29 Thread Antoine Pitrou

Antoine Pitrou pit...@free.fr added the comment:

Perhaps Guido remembers why the decision was made.

--
nosy: +gvanrossum, pitrou
versions: +Python 2.7, Python 3.2 -Python 2.6, Python 3.0

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



[issue1466065] base64 module ignores non-alphabet characters

2009-07-29 Thread Neil Tallim

Neil Tallim red.hamst...@gmail.com added the comment:

I'll hold off on uploading new patches until someone makes a decision, then.

It seems like, perhaps, simply amending the documentation would be
sufficient, since this behaviour shouldn't break any valid messages that
might reach this module. At worst, it'll just treat gibberish as valid,
and that's what it's been doing for a decade. (Although the other decode
routines are all strict by comparison)

--

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



[issue1466065] base64 module ignores non-alphabet characters

2009-07-29 Thread R. David Murray

R. David Murray rdmur...@bitdance.com added the comment:

It turns out that the RFC is unambiguous on this point.  Quoting the
base64 section of RFC 2045:

   The encoded output stream must be represented in lines of no more
   than 76 characters each.  All line breaks or other characters not
   found in Table 1 must be ignored by decoding software.  In base64
   data, characters other than those in Table 1, line breaks, and other
   white space probably indicate a transmission error, about which a
   warning message or even a message rejection might be appropriate
   under some circumstances.

Since some circumstances is not something the base64 decoder can
decide, that has to be left to a higher level ap.  So if unexpected
characters are to generate an error, it would need to be enabled via a
flag that defaults to not raising the error, IMO.  Unless someone has a
use case for rejecting an improperly encoded message, we should probably
just fix the docs (perhaps noting that this behavior is in accordance
with the RFC).

--

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



[issue1466065] base64 module ignores non-alphabet characters

2009-07-29 Thread Neil Tallim

Neil Tallim red.hamst...@gmail.com added the comment:

RFC 3548, referenced by the base64 module's docs, has a rather different
statement on how invalid characters should be treated.

From 2.3 Interpretation of non-alphabet characters in encoded data:
   Implementations MUST reject the encoding if it contains characters
   outside the base alphabet when interpreting base encoded data, unless
   the specification referring to this document explicitly states
   otherwise.  Such specifications may, as MIME does, instead state that
   characters outside the base encoding alphabet should simply be
   ignored when interpreting data (be liberal in what you accept).

So it looks like we can safely just say that invalid characters are
ignored in the docs, as long as it's explicit, but that's probably not
what people will expect.


I'll add doc patches in a moment, and someone who's actually a developer
(i.e., not me) can decide whether they're good enough.

--

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



[issue6550] asyncore incorrect failure when connection is refused and using async_chat channel

2009-07-29 Thread Josiah Carlson

Josiah Carlson josiahcarl...@users.sourceforge.net added the comment:

Originally, handle_expt_event() was described as handles OOB data or 
exceptions, but over-using handle_expt_event() as an error/close 
handler is a bad idea.  The function asyncore.readwrite() (called by 
asyncore.poll2()) does the right thing WRT handle_expt_event(), which it 
makes sense to apply to the standard select-based asyncore.poll().  
That's what this does (in addition to fixing the close case that you 
pointed out).

In terms of only implementing low-level stuff, this is still the case.  
You still only need to implement handle_*(), not handle_*_event() .  But 
now, handle_expt_event() isn't written to do more than it should have 
been doing in the first place.

I've updated the patch to include semantics for actually handling OOB 
data, which I've verified by using a slightly modified pyftpdlib (remove 
the socket option calls to set socket.SO_OOBINLINE) and it's tests on 
both Windows and Ubuntu 8.04 (I also ran the full Python test suite on 
my Ubuntu install, and any failures were obviously not asyncore/asynchat 
related).

--
Added file: http://bugs.python.org/file14596/asyncore_fix_refused-3.patch

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



[issue6550] asyncore incorrect failure when connection is refused and using async_chat channel

2009-07-29 Thread Josiah Carlson

Changes by Josiah Carlson josiahcarl...@users.sourceforge.net:


Removed file: http://bugs.python.org/file14581/asyncore_fix_refused.patch

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



[issue6550] asyncore incorrect failure when connection is refused and using async_chat channel

2009-07-29 Thread Josiah Carlson

Changes by Josiah Carlson josiahcarl...@users.sourceforge.net:


Removed file: http://bugs.python.org/file14585/asyncore_fix_refused-2.patch

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



[issue1466065] base64 module ignores non-alphabet characters

2009-07-29 Thread Neil Tallim

Neil Tallim red.hamst...@gmail.com added the comment:

Attached a documentation patch indicating that the
ignore-invalid-characters behaviour is intentional, citing relevant RFCs
for support.

Patch built against Python 2.7, r74261.

--
Added file: http://bugs.python.org/file14597/1466065[2.7].diff

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



[issue1466065] base64 module ignores non-alphabet characters

2009-07-29 Thread Neil Tallim

Neil Tallim red.hamst...@gmail.com added the comment:

Attached a documentation patch indicating that the
ignore-invalid-characters behaviour is intentional, citing relevant RFCs
for support.

Patch built against Python 3.2, r74261.

--
Added file: http://bugs.python.org/file14598/1466065[3.2].diff

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



[issue1466065] base64 module ignores non-alphabet characters

2009-07-29 Thread Raymond Hettinger

Changes by Raymond Hettinger rhettin...@users.sourceforge.net:


--

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



[issue1466065] base64 module ignores non-alphabet characters

2009-07-29 Thread R. David Murray

R. David Murray rdmur...@bitdance.com added the comment:

Hmm.  But if the module is used outside of MIME (which it can be, and in
fact is in the stdlib itself), then an error must be raised in order to
comply with that RFC.  So it sounds like we really ought to have that
flag.  And I was even wrong about the appropriate default.

--

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



[issue1466065] base64 module ignores non-alphabet characters

2009-07-29 Thread Neil Tallim

Neil Tallim red.hamst...@gmail.com added the comment:

It isn't written that only MIME may ignore such content. The key terms
there are 'may' and 'explicitly states otherwise'.

If the documentation is clear, then all future application developers
will know to check for validity using a regular expression like
'^[A-Za-z0-9+/\r\n]+={0,2}$'. Any existing applications in which
validity matters should already have a similar workaround.

While I do agree that standards are always good and that workarounds are
bad, Guido does have a very valid point: changing it to
insist on valid input would break some use cases, and I think we
already missed the 2.x - 3.x window where that would have been acceptable.

--

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



[issue6596] urllib2 bug on CentOS

2009-07-29 Thread Martin v . Löwis

Martin v. Löwis mar...@v.loewis.de added the comment:

What C compiler have you been using?

--
nosy: +loewis

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



[issue1466065] base64 module ignores non-alphabet characters

2009-07-29 Thread Antoine Pitrou

Antoine Pitrou pit...@free.fr added the comment:

 If the documentation is clear, then all future application developers
 will know to check for validity using a regular expression like
 '^[A-Za-z0-9+/\r\n]+={0,2}$'. Any existing applications in which
 validity matters should already have a similar workaround.

But having to validate input manually kinds of defeats the point of
having a decoder in the stdlib, therefore I agree with MRAB that a
validation flag would be useful.

--

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



[issue1466065] base64 module ignores non-alphabet characters

2009-07-29 Thread R. David Murray

R. David Murray rdmur...@bitdance.com added the comment:

And if the flag defaults to the current behavior that should satisfy the
backward compatiblity issues.

--

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



[issue6275] let unittest.assertRaises() return the exception object caught

2009-07-29 Thread Raghuram Devarakonda

Changes by Raghuram Devarakonda draghu...@gmail.com:


--
nosy: +draghuram

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



[issue1466065] base64 module ignores non-alphabet characters

2009-07-29 Thread Neil Tallim

Changes by Neil Tallim red.hamst...@gmail.com:


Removed file: http://bugs.python.org/file14597/1466065[2.7].diff

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



[issue1466065] base64 module ignores non-alphabet characters

2009-07-29 Thread Neil Tallim

Changes by Neil Tallim red.hamst...@gmail.com:


Removed file: http://bugs.python.org/file14598/1466065[3.2].diff

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



[issue5833] readline update

2009-07-29 Thread Dror Levin

Dror Levin sp...@psybear.com added the comment:

Arch Linux devs have split the patch and applied only the extra-space
fix, which is what I'm attaching now. I've compiled Python 2.6.2 on
Gentoo with this patch and can report it works well (I tested with ipython).

--
Added file: http://bugs.python.org/file14599/python-2.6-readline.patch

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



[issue1466065] base64 module ignores non-alphabet characters

2009-07-29 Thread Neil Tallim

Neil Tallim red.hamst...@gmail.com added the comment:

Attached a documentation/unit-test/solution patch that adds a
validate=False parameter to the b64decode function of Lib/base64.py,
which may be set to True to have invalid base64 content be rejected with
a TypeError.

Patch built against Python 2.7, r74261.


Note: Sorry this went on for so long. However, I think I understand the
patch-submission process a lot better now.

--
Added file: http://bugs.python.org/file14601/1466065[2.7-complete].diff

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



[issue6596] urllib2 bug on CentOS

2009-07-29 Thread Anton

Anton rk3...@gmail.com added the comment:

% gcc -v
Using built-in specs.
Target: i386-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --
infodir=/usr/share/info --enable-shared --enable-threads=posix --enable-
checking=release --with-system-zlib --enable-__cxa_atexit --disable-
libunwind-exceptions --enable-libgcj-multifile --enable-
languages=c,c++,objc,obj-c++,java,fortran,ada --enable-java-awt=gtk --
disable-dssi --enable-plugin --with-java-home=/usr/lib/jvm/java-1.4.2-
gcj-1.4.2.0/jre --with-cpu=generic --host=i386-redhat-linux
Thread model: posix
gcc version 4.1.2 20080704 (Red Hat 4.1.2-44)

--

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



[issue1975] signals not always delivered to main thread, since other threads have the signal unmasked

2009-07-29 Thread John Levon

John Levon movem...@users.sourceforge.net added the comment:

Any progress on this regression? A patch is available... thanks.

--

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



[issue5738] multiprocessing example wrong

2009-07-29 Thread Justin MacCallum

Justin MacCallum justin.maccal...@me.com added the comment:

I think this should either be fixed or removed from the documentation. It 
is very confusing as is. I have next to no idea what I'm doing, but I've 
attached a patch that allows this code to function, at least sort of. You 
can now create cluster and pool objects and run jobs using map or 
apply_async, for example. However, there are still problems with the 
shutdown of the pool.

I would very much like to see this functionality working correctly and 
robustly. A distributed Pool class would be very useful in, e.g. 
scientific programming.

--
keywords: +patch
nosy: +jlmaccal
Added file: http://bugs.python.org/file14602/mp_patch.diff

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



[issue6597] Deprecate iterable.next in Python 2.6.x when called with -3 option ?

2009-07-29 Thread Matthew Russell

Changes by Matthew Russell matt.horiz...@gmail.com:


--
title: Depricate iterable.next in Python  2.6.x when called with -3 option - 
Deprecate iterable.next in Python  2.6.x when called with -3 option ?

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



[issue6598] calling email.utils.make_msgid frequently has a non-trivial probability of generating colliding ids

2009-07-29 Thread Michael Hudson

New submission from Michael Hudson m...@users.sourceforge.net:

If you call email.utils.make_msgid a number of times within the same
second, the uniqueness of the results depends on random.randint(10)
returning different values each time.

A little mathematics proves that you don't have to call make_msgid
*that* often to get the same message id twice: if you call it 'n' times,
the probability of a collision is approximately 1 -
math.exp(-n*(n-1)/20.0), and for n == 100, that's about 5%.  For n
== 1000, it's over 99%.

These numbers are born out by experiment:

 def collisions(n):
... msgids = [make_msgid() for i in range(n)]
... return len(msgids) - len(set(msgids))
... 
 sum((collisions(100)0) for i in range(1000))
49
 sum((collisions(1000)0) for i in range(1000))
991

I think probably having a counter in addition to the randomness would be
a good fix for the problem, though I guess then you have to worry about
thread safety.

--
components: Library (Lib)
messages: 91073
nosy: mwh
severity: normal
status: open
title: calling email.utils.make_msgid frequently has a non-trivial probability 
of generating colliding ids
type: behavior
versions: 3rd party, Python 2.4, Python 2.5, Python 2.6, Python 2.7, Python 
3.0, Python 3.1, Python 3.2

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



[issue6598] calling email.utils.make_msgid frequently has a non-trivial probability of generating colliding ids

2009-07-29 Thread Michael Hudson

Michael Hudson m...@users.sourceforge.net added the comment:

A higher resolution timer would also help, of course.

(Thanks to James Knight for the prod).

--

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



[issue6599] 2to3 test_print_function_option fails on Windows

2009-07-29 Thread James Abbatiello

New submission from James Abbatiello abb...@gmail.com:

test_print_function_option is failing on Windows.  Patch attached. 
Output of failure:

C:python test.py
test_all_project_files (lib2to3.tests.test_all_fixers.Test_all) ...
snip\2to3\lib2to3\refactor.py:194: DeprecationWarning: the
'print_function' option is deprecated
  DeprecationWarning)
snip
==
FAIL: test_print_function_option
(lib2to3.tests.test_refactor.TestRefactoringTool)
--
Traceback (most recent call last):
  File snip\2to3\lib2to3\tests\test_refactor.py, line 51, in
test_print_function_option
self.assertEqual(len(w), 1)
AssertionError: 0 != 1

--


On my system test_all_fixers.py comes before test_refactor.py in the
output of os.listdir().  The warning gets fired by test_all_fixers and
then won't be retriggered in test_refactor.  Since the option doesn't do
anything anymore I've just removed its use.

--
components: 2to3 (2.x to 3.0 conversion tool)
files: print_function_option.patch
keywords: patch
messages: 91075
nosy: abbeyj, benjamin.peterson
severity: normal
status: open
title: 2to3 test_print_function_option fails on Windows
Added file: http://bugs.python.org/file14603/print_function_option.patch

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



[issue6600] MemoryError in AiX 64-bit build

2009-07-29 Thread Sridhar Ratnakumar

New submission from Sridhar Ratnakumar sridh...@activestate.com:

(currently investigating the root cause of this issue...)

bash-2.04$ build/py2_6_2-aix5-powerpc-apy26-rrun/python/python -c open
('/tmp/test', 'w')
Traceback (most recent call last):
  File string, line 1, in module
MemoryError

bash-2.04$ build/py2_6_2-aix5-powerpc-apy26-rrun/python/python -c 
import platform; print platform.uname()
('AIX', 'asaixv5152', '1', '5', '000C763E4C00', 'powerpc')

bash-2.04$ file build/py2_6_2-aix5-powerpc-apy26-rrun/python/python 
build/py2_6_2-aix5-powerpc-apy26-rrun/python/python:64-bit XCOFF 
executable or object module not stripped

--
components: Build, IO
messages: 91076
nosy: srid
severity: normal
status: open
title: MemoryError in AiX 64-bit build
type: crash
versions: Python 2.6

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



[issue5093] 2to3 with a pipe on non-ASCII script

2009-07-29 Thread James Abbatiello

James Abbatiello abb...@gmail.com added the comment:

The --no-diffs option was recently added which looks like a good workaround.

Here's an attempt at a solution.  If sys.stdout has an encoding set then
use that, just as is being done now.  If there is no encoding (implying
ascii) then use the encoding of the input file.

--
nosy: +abbeyj
Added file: http://bugs.python.org/file14604/output_encoding.patch

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



[issue6600] MemoryError in AiX 64-bit build

2009-07-29 Thread Sridhar Ratnakumar

Sridhar Ratnakumar sridh...@activestate.com added the comment:

I suspect this is related to http://mail.python.org/pipermail/python-
bugs-list/2003-November/021158.html

--

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



[issue6600] MemoryError in AiX 64-bit build

2009-07-29 Thread Sridhar Ratnakumar

Sridhar Ratnakumar sridh...@activestate.com added the comment:

I localized the error to line 248 in http://svn.python.org/view/python/
branches/release26-maint/Objects/fileobject.c?annotate=68135#248 
(brandl's change made 3 years ago)

  static PyObject *
  open_the_file(PyFileObject *f, char *name, char *mode)
  {
  [...]
/* probably need to replace 'U' by 'rb' */
newmode = PyMem_MALLOC(strlen(mode) + 3);
if (!newmode) {
  PyErr_NoMemory();
  return NULL;
}

--
nosy: +georg.brandl

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



[issue6600] MemoryError in AiX 64-bit build

2009-07-29 Thread Sridhar Ratnakumar

Sridhar Ratnakumar sridh...@activestate.com added the comment:

Interesting. If add the line:

  newmode = PyMem_MALLOC(4);

next to the existing line:

  newmode = PyMem_MALLOC(strlen(mode) + 3);

there is no MemoryError!

--

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



[issue6526] importlib.import_module affects permissions of .pyc files subsequently created by import

2009-07-29 Thread Brett Cannon

Changes by Brett Cannon br...@python.org:


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

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



[issue6600] MemoryError in AiX 64-bit build

2009-07-29 Thread Sridhar Ratnakumar

Sridhar Ratnakumar sridh...@activestate.com added the comment:

This is strange .. the attached patch (reverses operands to +) fixes 
the issue.

--
Added file: http://bugs.python.org/file14605/patch

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



[issue4606] Passing 'None' if argtype is set to POINTER(...) doesn't always result in NULL

2009-07-29 Thread Andrew McNabb

Andrew McNabb amcn...@mcnabbs.org added the comment:

I ran into this problem, too.  It took me a long time to track down the
segfaults.  It's really bad to pass in None and have the system pick
some random address instead of 0.

I looked at the attached patch, and it seems to me the only alternative
approach would be to use PyLong_FromLong instead of PyInt_FromLong. 
However, since ConvParam already handles None appropriately, I think the
fix in patch_ctypes_none_arg.diff really is the best way to do it.

This patch is a one-line fix (plus tests and documentation), and it
fixes a bug which crashes the interpreter.  The patch seems very
straightforward, and there is no way that code could depend on the
current behavior.  I'm not sure if my patch review counts for much, but
there you have it. :)

It would be great if this patch could be applied quickly and added to
the maintenance branch for 2.6.  Thanks.

--
nosy: +amcnabb
type: behavior - crash

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



[issue6526] importlib.import_module affects permissions of .pyc files subsequently created by import

2009-07-29 Thread Brett Cannon

Brett Cannon br...@python.org added the comment:

So removing the built-in, frozen, and extension importers did not stop the 
bug from happening. Calling importlib._bootstrap._PyFileFinder directly 
does not trigger the bug, even when trying with a finder for '.' first. 
And having sys.path be only '.' for fileinput still triggers the bug.

On another day, the next step is to start stripping out stuff in importlib 
to see what the minimal thing is that triggers the bug.

--

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