[issue5020] Regex Expression Error

2009-01-21 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc  added the comment:

> the program crash
Well, it's not a crash, but a graceful exception:
sre_constants.error: bad character range

Your regular expression is invalid: the '-' has a special meaning inside
square brackets.
Please consult the documentation: http://docs.python.org/library/re.html

--
nosy: +amaury.forgeotdarc
resolution:  -> invalid
status: open -> closed

___
Python tracker 

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



[issue4972] let's equip ftplib.FTP with __enter__ and __exit__

2009-01-21 Thread Tarek Ziadé

Changes by Tarek Ziadé :


Removed file: http://bugs.python.org/file12792/smtplib.patch

___
Python tracker 

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



[issue4972] let's equip ftplib.FTP with __enter__ and __exit__

2009-01-21 Thread Tarek Ziadé

Tarek Ziadé  added the comment:

I've simplified the code
accordinglyhttp://bugs.python.org/issue49...@ok_message=issue%204972%20files%20edited%20ok&@template=item

about the name of the vars. while I agree with you, I have use those names
(errcode, errmsg) because they are used in getreply() so I thought it
was more homogeneous.

about the return code , i am wondering if it would be good to add in
ftplib all the constantes
(http://www.ftpplanet.com/ftpresources/ftp_codes.htm) so things are clearer

Added file: http://bugs.python.org/file12823/smtplib.diff

___
Python tracker 

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



[issue4972] let's equip ftplib.FTP with __enter__ and __exit__

2009-01-21 Thread Tarek Ziadé

Changes by Tarek Ziadé :


Removed file: http://bugs.python.org/file12811/smtplib.patch

___
Python tracker 

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



[issue5021] doctest.testfile should set __name__, can't use namedtuple

2009-01-21 Thread Tom Lynn

New submission from Tom Lynn :

This file fails when run with doctest.testfile::

  >>> print __name__
  __builtin__
  >>> print globals()['__name__']  # fails with KeyError: __name__
  __builtin__

"__builtin__" is probably not a good value, but more importantly, this 
means that you can't use namedtuples in text file doctests, since 
namedtuple() inspects the calling frame::

  >>> from namedtuple import namedtuple
  >>> t = namedtuple('fred', 'x')  # fails

(I presume this is the same for "from collections import namedtuple", 
but I've not tested with 2.6+.)

A workaround is to add this line at the start of the test::

   >>> __name__ = 'test'

--
components: Library (Lib)
messages: 80322
nosy: tlynn
severity: normal
status: open
title: doctest.testfile should set __name__, can't use namedtuple
type: feature request
versions: Python 2.5

___
Python tracker 

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



[issue5022] doctest should allow running tests with "python -m doctest"

2009-01-21 Thread Tom Lynn

New submission from Tom Lynn :

It would be good to be able to do something like::

  $ python -m doctest foo.py
  $ python -m doctest --text foo.txt bar.txt

(or preferably some command line options design which could handle 
both .py and .txt files).

--
components: Library (Lib)
messages: 80323
nosy: tlynn
severity: normal
status: open
title: doctest should allow running tests with "python -m doctest"
type: feature request
versions: Python 2.5

___
Python tracker 

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



[issue4753] Faster opcode dispatch on gcc

2009-01-21 Thread Stefan Ring

Stefan Ring  added the comment:

Hi,

I ported threadedceval6.patch to Python 2.5.4, in case anyone is
interested...

Note that you need to run autoconf and autoheader.

--
nosy: +Ringding
Added file: http://bugs.python.org/file12824/threadedceval6-py254.patch

___
Python tracker 

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



[issue2995] Idle, some Linuxes, cannot position Cursor by mouseclick

2009-01-21 Thread Michiel Overtoom

Michiel Overtoom  added the comment:

I experience the same, on FreeBSD 7.0-REL, with tkinter compiled to use
Tk8.5 instead of Tk8.4.  Tkinter compiled for Tk8.4 doesn't have the
problem.

Moving the mouse over the text widget changes the cursor to the I-beam
as expected, but click on text doesn't position the beam at the mouse
position.  It is also impossible to select text with the mouse. 
Selecting text with shift-arrow keys works, however.

The same bug has been reported on the OLPC wiki:

http://dev.laptop.org/ticket/7661
http://wiki.laptop.org/go/User:Rmyers/IDLE_on_the_XO

--
nosy: +michiel.overtoom

___
Python tracker 

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



[issue4774] threding, bsddb and double free or corruption (fasttop)

2009-01-21 Thread Jesús Cea Avión

Jesús Cea Avión  added the comment:

Closing the issue.

Python 2.5.x is only open for security patches. bsddb library in Python
2.6 doesn't have this issue.

People needing recent pybsddb in old python releases can download from
http://www.jcea.es/programacion/pybsddb.htm

--
resolution:  -> out of date
status: open -> closed

___
Python tracker 

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



[issue1391] Adds the .compact() method to bsddb db.DB objects

2009-01-21 Thread Jesús Cea Avión

Jesús Cea Avión  added the comment:

I committed this patch to the imminent pybsddb 4.6.4. This will be
available soon in http://www.jcea.es/programacion/pybsddb.htm, and in
future Python 2.7.

The function is only available if you are using Berkeley DB 4.7 or
newer, since 4.6 was very buggy.

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

___
Python tracker 

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



[issue5022] doctest should allow running tests with "python -m doctest"

2009-01-21 Thread Gabriel Genellina

Gabriel Genellina  added the comment:

Already implemented in Python 2.6; please upgrade.
2.5 only gets security fixes at this time.

--
nosy: +gagenellina

___
Python tracker 

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



[issue5021] doctest.testfile should set __name__, can't use namedtuple

2009-01-21 Thread Gabriel Genellina

Gabriel Genellina  added the comment:

After updating the import line, it still fails in 2.6, 3.0 and the 
current trunk.

--
nosy: +gagenellina
versions: +Python 2.6, Python 2.7, Python 3.0, Python 3.1 -Python 2.5

___
Python tracker 

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



[issue2980] Pickle stream for unicode object may contain non-ASCII characters.

2009-01-21 Thread Torsten Bronger

Torsten Bronger  added the comment:

I ran into this problem today when writing python data structures into a
database.  Only ASCII is safe in this situation.  I understood the
Python docs that protocol 0 was ASCII-only.

I use pickle+base64 now, however, this makes debugging more difficult.

Anyway, I think that the docs should clearly say that protocol 8 is not
ASCII-only because this is important in the Python world.  For example,
I saw this issue because Django makes an implicit unicode() conversion
with my input which fails with non-ASCII.

--
nosy: +bronger

___
Python tracker 

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



[issue2980] Pickle stream for unicode object may contain non-ASCII characters.

2009-01-21 Thread Torsten Bronger

Torsten Bronger  added the comment:

"protocol 8" --> "protocol 0" of course.

___
Python tracker 

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



[issue5023] Segfault in datetime.time.strftime("%z")

2009-01-21 Thread Eric Wald

New submission from Eric Wald :

Execution of "make test" for Python 2.6.1 halts with a segmentation 
fault on line 2198 of Python-2.6.1/Lib/test/test_datetime.py; also 
occurs using the attached script, narrowing it down to the %z sequence 
in the format argument to datetime.time.strftime(), but only when the 
time object has a non-None tzinfo.  The segfault disappears when I 
comment out line 1133 of Python-2.6.1/Modules/datetimemodule.c:

PyOS_snprintf(buf, buflen, "%c%02d%s%02d", sign, hours, sep, minutes);

Compiled with GCC 3.4.3 with Smashing Stack Protector on LFS 5.1.1 
(Linux 2.6.11.12 and glibc 2.3.5 with ssp patches).  Using BASECFLAGS=-
fno-stack-protector has no effect on the segfault.  All other Python 
tests pass.  HAVE_SNPRINTF has been defined to 1 in pyconfig.h by the 
config script.

I have not yet compiled gdb, but I can if requested.

--
components: Library (Lib)
files: zone_failure.py
messages: 80332
nosy: eswald
severity: normal
status: open
title: Segfault in datetime.time.strftime("%z")
type: crash
versions: Python 2.6
Added file: http://bugs.python.org/file12825/zone_failure.py

___
Python tracker 

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



[issue5024] sndhdr.whathdr returns -1 for WAV file frame count

2009-01-21 Thread Robert Pyle

New submission from Robert Pyle :

Seems like test_wav() could easily return the actual frame count by 
calling wave.py just as test_aifc() uses aifc.py.

--
components: Library (Lib)
messages: 80333
nosy: rpyle
severity: normal
status: open
title: sndhdr.whathdr returns -1 for WAV file frame count
type: feature request

___
Python tracker 

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



[issue2980] Pickle stream for unicode object may contain non-ASCII characters.

2009-01-21 Thread Marc-Andre Lemburg

Marc-Andre Lemburg  added the comment:

On 2009-01-21 16:43, Torsten Bronger wrote:
> Torsten Bronger  added the comment:
> 
> I ran into this problem today when writing python data structures into a
> database.  Only ASCII is safe in this situation.  I understood the
> Python docs that protocol 0 was ASCII-only.
> 
> I use pickle+base64 now, however, this makes debugging more difficult.

Databases can handle binary data just fine, so pickle protocol 2
should be better in your situation.

If you require ASCII-only data, you can also use pickle protocol 2,
zlib and base64 to get a compact version of a serialized Python object.

> Anyway, I think that the docs should clearly say that protocol 8 is not
> ASCII-only because this is important in the Python world.  For example,
> I saw this issue because Django makes an implicit unicode() conversion
> with my input which fails with non-ASCII.

That sounds like an issue with Django - it shouldn't try to convert
binary data to Unicode (which is reserved for text data).

___
Python tracker 

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



[issue5025] test_kqueue failure on OS X

2009-01-21 Thread Mark Dickinson

New submission from Mark Dickinson :

I just got a one-off, non-reproducible test_kqueue failure, during a 'make 
test' of the trunk, on OS X 10.5.6.  Here's the output:

test_kqueue
test test_kqueue failed -- Traceback (most recent call last):
  File "/Users/dickinsm/python_source/trunk/Lib/test/test_kqueue.py", line 
136, in test_queue_event
(server.fileno(), select.KQ_FILTER_READ, flags)])
AssertionError: [(5L, -2, 5L), (6L, -2, 5L), (6L, -1, 5L)] != [(5, -2, 5), 
(5, -1, 5), (6, -2, 5), (6, -1, 5)]

Looking at the test_queue.py file just before line 136, I see:

events = kq.control(None, 4, 1)
# We may need to call it several times
for i in range(5):
if len(events) == 4:
break
events = kq.control(None, 4, 1)

Would adding a time.sleep(1.0) to the for loop make this test more robust?

My first impression was that the '1' in 'kq.control(None, 4, 1)' already 
did this;  i.e., that it meant that the kq.control function would wait up 
to 1 second for a response, but that doesn't seem to be true.  I tried 
replacing the 1 with 100 and the test still runs nearly 
instantaneously, even in the case where the kq.control call doesn't get 4 
events first time around.

Out of curiosity, *why* is there a need to call this several times? I 
fully believe there *is* such a need;  I just don't know what it is.  
Something to do with waiting for the socket send calls to complete, I 
assume?

--
assignee: christian.heimes
components: Tests
messages: 80335
nosy: christian.heimes, marketdickinson
severity: normal
status: open
title: test_kqueue failure on OS X
versions: Python 2.6

___
Python tracker 

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



[issue5025] test_kqueue failure on OS X

2009-01-21 Thread Jean-Paul Calderone

Jean-Paul Calderone  added the comment:

> My first impression was that the '1' in 'kq.control(None, 4, 1)'
already did this;  i.e., that it meant that the kq.control function
would wait up to 1 second for a response, but that doesn't seem to be true.

Since there are events in the result, the call succeeds immediately. 
The timeout only defines an upper bound on how long control will block
before returning with *no* results.  Since the loop doesn't handle any
of the events, there's always some ready right away after the first call.

> Out of curiosity, *why* is there a need to call this several times?

It's out of the control of the test what the kernel does to deliver the
event notifications.  Since the test is waiting for multiple events, the
loop helps it get them all (although clearly it's not totally reliable).

--
nosy: +exarkun

___
Python tracker 

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



[issue2980] Pickle stream for unicode object may contain non-ASCII characters.

2009-01-21 Thread Torsten Bronger

Torsten Bronger  added the comment:

Well, Django doesn't story binary data at all but wants you to store
image files etc in the file system.  Whether this was a good design
decision, is beyond the scope of this issue.  My points actually are
only these:

a) the docs strongly suggest that protocol 0 is ASCII-only and this
should be clarified (one sentence would be fully sufficient I think)

b) currently, there is no way in the standard lib to serialise data in a
debuggable, ASCII-only format

Probably b) is not important.  *I* want to have it currently but this
doesn't mean much.

___
Python tracker 

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



[issue4954] native build of python win32 using msys under wine.

2009-01-21 Thread Luke Kenneth Casson Leighton

Luke Kenneth Casson Leighton  added the comment:

updated. incorporating roumen's work as well.

Added file: http://bugs.python.org/file12826/f

___
Python tracker 

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



[issue5026] [reopening] native build of python win32 using msys under wine.

2009-01-21 Thread Luke Kenneth Casson Leighton

New submission from Luke Kenneth Casson Leighton :

reopening a new bug with the exact same title due to #4954 having
been unilaterally closed without discussion, nor reasons specified.

simple courtesy would dictate that some sort of dialog is entered
into especially when someone is putting in significant amounts of
work in developing python, and has plans to forward-port the patch
to python2.6 and trunk, merge it with #3844 and much more.

--
components: Build
files: f
messages: 80339
nosy: lkcl
severity: normal
status: open
title: [reopening] native build of python win32 using msys under wine.
versions: Python 2.5
Added file: http://bugs.python.org/file12827/f

___
Python tracker 

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



[issue5026] [reopening] native build of python win32 using msys under both wine and native win32

2009-01-21 Thread Luke Kenneth Casson Leighton

Luke Kenneth Casson Leighton  added the comment:

so.

let me be clear.

this bug is a continuation of work to port python to mingw,
with a specific BUT NOT UNIQUE focus of ensuring that python
can be compiled under wine.

THE ATTACHED PATCH CAN ALSO BE USED TO COMPILE PYTHON UNDER WIN32.

--
title: [reopening] native build of python win32 using msys under wine. -> 
[reopening] native build of python win32 using msys under both wine and native 
win32

___
Python tracker 

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



[issue5025] test_kqueue failure on OS X

2009-01-21 Thread Mark Dickinson

Mark Dickinson  added the comment:

Here's a patch:

 - add a time.sleep(1.0) in between calls to kq.control
 - restructure for loop slightly: move initial kq.control call inside it 
 - bump number of trials from 5 to 10 (why not?!)
 - produce more meaningful error message in the unlikely event
   that we never get the 4 events we're waiting for

--
keywords: +patch
Added file: http://bugs.python.org/file12828/issue5025.patch

___
Python tracker 

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



[issue5026] [reopening] native build of python win32 using msys under both wine and native win32

2009-01-21 Thread Luke Kenneth Casson Leighton

Luke Kenneth Casson Leighton  added the comment:

attached also manifests and rc files for building on msvcr80

Added file: http://bugs.python.org/file12829/x

___
Python tracker 

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



[issue4954] native build of python win32 using msys under wine.

2009-01-21 Thread Luke Kenneth Casson Leighton

Luke Kenneth Casson Leighton  added the comment:

manifests and rc files for msvcr80 build

Added file: http://bugs.python.org/file12830/x

___
Python tracker 

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



[issue4954] native build of python win32 using msys under wine.

2009-01-21 Thread Luke Kenneth Casson Leighton

Luke Kenneth Casson Leighton  added the comment:

martin, so sorry, i didn't see your comments - no dang hell no i'm
not done yet.

regarding graminit.h: graminit.h isn't being removed - i keep editing it
out of the patch.
i'm not _submitting_ it as part of the patch because what happens is that
Parser/pgen.exe generates CRLF and EERY single line of graminit.h
gets replaced.

so it's a bit irritating to keep having to even see it, so i removed
it from my local repository.

if i accidentally submit its removal please ignore it, entirely.

people _are_ tracking the progress of this development, and assisting
in the work.  i'm using the bugtracker to communicate the progress.

closing the bug looks... like... i dunno - it's not very helpful,
though, i have to say.

___
Python tracker 

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



[issue5026] [reopening] native build of python win32 using msys under both wine and native win32

2009-01-21 Thread Luke Kenneth Casson Leighton

Luke Kenneth Casson Leighton  added the comment:

martin - apologies for shouting: i hadn't seen your explanations
of why #4954 was closed.  i'm not happy that it _was_ closed, but
that's another story.

yes of course i will be going on to python2.6 and up - first though
is to focus on python2.5 and get _that_ into shape, then moving
on to 2.6 and 2.7 is easy.

___
Python tracker 

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



[issue5027] xml namespace not understood by xml.sax.saxutils.XMLGenerator

2009-01-21 Thread Soren Roug

New submission from Soren Roug :

The 'xml' namespace in XML files is special in that it need not be
declared. When xml.sax.saxutils.XMLGenerator is used with the namespace
feature it does not know how to handle it.

Example. The code:

import xml.sax, xml.sax.saxutils
parser = xml.sax.make_parser()
parser.setFeature(xml.sax.handler.feature_namespaces, 1)
c = xml.sax.saxutils.XMLGenerator()
parser.setContentHandler(c)
parser.parse('testfile.xml')

executed on the testfile.xml with this content:


http://example.com/ns";>
  Hello world


will produce this error:
...
  File "/usr/lib/python2.5/xml/sax/saxutils.py", line 149, in startElementNS
self._write(' %s=%s' % (self._qname(name), quoteattr(value)))
  File "/usr/lib/python2.5/xml/sax/saxutils.py", line 107, in _qname
prefix = self._current_context[name[0]]
KeyError: u'http://www.w3.org/XML/1998/namespace'


It can be fixed by making an exception for the xml namespace (as
required by W3C - See http://www.w3.org/XML/1998/namespace) in
xml/sax/saxutils.py. The _qname method could then look like this:

def _qname(self, name):
"""Builds a qualified name from a (ns_url, localname) pair"""
if name[0]:
if name[0] == u'http://www.w3.org/XML/1998/namespace':
return u'xml' + ":" + name[1]
# The name is in a non-empty namespace
prefix = self._current_context[name[0]]
if prefix:
# If it is not the default namespace, prepend the prefix
return prefix + ":" + name[1]
# Return the unqualified name
return name[1]

--
components: Library (Lib), XML
messages: 80346
nosy: roug
severity: normal
status: open
title: xml namespace not understood by xml.sax.saxutils.XMLGenerator
type: behavior
versions: Python 2.5

___
Python tracker 

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



[issue3871] cross and native build of python for mingw32 with distutils

2009-01-21 Thread Terry J. Reedy

Terry J. Reedy  added the comment:

Does this supercede #3754? If so, please add this as superseder and
close it.

--
nosy: +tjreedy

___
Python tracker 

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



[issue4972] let's equip ftplib.FTP with __enter__ and __exit__

2009-01-21 Thread Tarek Ziadé

Tarek Ziadé  added the comment:

Feedback from my blog :

other places where a context manager could be good to have :

- gzip
- zipfile
- urllib2.urlopen and urllib.request.urlopen

___
Python tracker 

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



[issue3871] cross and native build of python for mingw32 with distutils

2009-01-21 Thread Roumen Petrov

Roumen Petrov  added the comment:

Does this supercede #3754?  - no.
The issue #3754 introduce macro AC_CANONICAL_HOST(add standardize "host
triplets") + fixes for cross-compilation.
Changes to configure script in this patch show how to use "host triplet"
for mingw builds.

___
Python tracker 

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



[issue2233] Makefile.pre.in contains extra slash before $(DESTDIR) which can cause Cygwin build to fail

2009-01-21 Thread Roumen Petrov

Roumen Petrov  added the comment:

No response from py-dev list :( . May be solution has to work in all cases.

___
Python tracker 

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



[issue4972] let's equip ftplib.FTP with __enter__ and __exit__

2009-01-21 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

Tarek: gzip and bz2 are already done
(http://code.python.org/hg/trunk/rev/d9555936ded9).

--
nosy: +pitrou

___
Python tracker 

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



[issue4972] let's equip ftplib.FTP with __enter__ and __exit__

2009-01-21 Thread Tarek Ziadé

Tarek Ziadé  added the comment:

Ah great, thanks for telling Antoine, I missed it on gzip. And the test
on bz2 makes me see that my tests are not sufficient (calling with on an
instance that has already been used and close)

___
Python tracker 

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



[issue5028] tokenize.generate_tokens doesn't always return logical line

2009-01-21 Thread Duncan Findlay

New submission from Duncan Findlay :

According to the documentation for tokenize.generate_tokens:

"The generator produces 5-tuples with these members: the token type; the
token string; a 2-tuple (srow, scol) of ints specifying the row and
column where the token begins in the source; a 2-tuple (erow, ecol) of
ints specifying the row and column where the token ends in the source;
and the line on which the token was found. The line passed (the last
tuple item) is the logical line; continuation lines are included."

It seems though that the "logical line" -- the last element of the tuple
is the physical line unless the token being returned spans beyond the
end of the line. As an example, consider a test file test.py:

foo = """
%s """ % 'bar'

>>> import pprint, tokenize
>>> pprint.pprint(list(tokenize.generate_tokens(open('test.py').readline)))
[(1, 'foo', (1, 0), (1, 3), 'foo = """\n'),
 (51, '=', (1, 4), (1, 5), 'foo = """\n'),
 (3, '"""\n%s """', (1, 6), (2, 6), 'foo = """\n%s """ % \'bar\'\n'),
 (51, '%', (2, 7), (2, 8), '%s """ % \'bar\'\n'),
 (3, "'bar'", (2, 9), (2, 14), '%s """ % \'bar\'\n'),
 (4, '\n', (2, 14), (2, 15), '%s """ % \'bar\'\n'),
 (0, '', (3, 0), (3, 0), '')]
>>> 

Since there is only one logical line, I would expect the first 6 tokens
to have the same 5th element.

--
components: Library (Lib)
messages: 80353
nosy: duncf
severity: normal
status: open
title: tokenize.generate_tokens doesn't always return logical line
type: behavior
versions: Python 2.6

___
Python tracker 

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



[issue5029] Odd slicing behaviour

2009-01-21 Thread Dinko Galetić

New submission from Dinko Galetić :

#the following code should return an empty list, but returns the 0th
member of the list

>>> foo = [1, 2, 3]
>>> foo[0::-1]
[1]

--
components: Regular Expressions
messages: 80354
nosy: dgaletic
severity: normal
status: open
title: Odd slicing behaviour
type: behavior
versions: Python 2.6

___
Python tracker 

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



[issue5030] Typo in class tkinter.filedialog.Directory prevents compilation

2009-01-21 Thread David Schultz

New submission from David Schultz :

class tkinter.filedialog.Directory incorrectly derives from Dialog instead 
of _Dialog.  Adding the "_" allows the code to compile and run as 
expected.

This also explains why tkinter.filedialog.askdirectory() doesn't work.

--
components: Tkinter
messages: 80355
nosy: ringhome
severity: normal
status: open
title: Typo in class tkinter.filedialog.Directory prevents compilation
type: compile error
versions: Python 3.0

___
Python tracker 

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



[issue5030] Typo in class tkinter.filedialog.Directory prevents compilation

2009-01-21 Thread Benjamin Peterson

Benjamin Peterson  added the comment:

Duplicate of #4406.

--
nosy: +benjamin.peterson
resolution:  -> out of date
status: open -> closed

___
Python tracker 

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



[issue5028] tokenize.generate_tokens doesn't always return logical line

2009-01-21 Thread David W. Lambert

Changes by David W. Lambert :


--
nosy: +LambertDW

___
Python tracker 

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



[issue5029] Odd slicing behaviour

2009-01-21 Thread David W. Lambert

Changes by David W. Lambert :


--
nosy: +LambertDW

___
Python tracker 

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



[issue1048820] Only "Overwrite" mode possible with curses.textpad.Textbox

2009-01-21 Thread dashing

dashing  added the comment:

I am getting
"RuntimeError: maximum recursion depth exceeded"

as soon as I type a character in a textbox made with insert_mode=True.

--
nosy: +dashing
type:  -> crash

___
Python tracker 

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



[issue5022] doctest should allow running tests with "python -m doctest"

2009-01-21 Thread Benjamin Peterson

Changes by Benjamin Peterson :


--
resolution:  -> out of date
status: open -> closed

___
Python tracker 

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



[issue4944] os.fsync() doesn't work as expect in Windows

2009-01-21 Thread Javen Wang

Javen Wang  added the comment:

I'm using Python2.5 in which close_fds is not available in Windows. And
I cannot use Python2.6 because I need to redirect the stdout and stderr
and there's performance concern.

I have questions on the root cause:

  a. why doesn't fopen() has sharing issue?
  b. why don't os.close() and FileObject.close() really close the file?

___
Python tracker 

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