[Python-Dev] try/except in io.py

2008-12-19 Thread Kristján Valur Jónsson
Greetings!

Yesterday, I committed revision r67843 to py3k.
Re-enablign the windows CRT runtime checks showed me that close() was beeing 
called with an invalid file descriptor.
Now, the problem was was in tokenizer.c, but the reason this wasn't caught 
earlier was,

1)  Incorrect error checking for close() in _fileio.c, which I fixed, and

2)  Line 384 in io.py, where all exceptions are caught for self.close().

Fixing 1 and patching 2 would bring the problem to light when running the 
test_imp.py part of the testsuite and, indeed, applying the fix to tokenizer.c 
would then remove it again.

I am a bit worried about 2) thoug.  I didn't modify that, but having a catch 
all clause just to be clean on system exit seems shaky to me.   I wonder, is 
there a way to make such behaviour, if it is indeed necessary, just to be 
active when exit is in progress?

Something like:
try:
self.close()
except:
try:
   if not sys.exiting(): raise
except:
   pass


Or better yet, do as we have done often here, just catch the particular problem 
that occurs during shutdown, most often name error:
try:
self.close()
except (AttributeError, NameError):
pass


What do you think?
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] try/except in io.py

2008-12-19 Thread Amaury Forgeot d'Arc
Hello,
Kristján Valur Jónsson wrote:
> Greetings!
>
> Yesterday, I committed revision r67843 to py3k.
>
> Re-enablign the windows CRT runtime checks showed me that close() was beeing
> called with an invalid file descriptor.
>
> Now, the problem was was in tokenizer.c, but the reason this wasn't caught
> earlier was,
>
> 1)  Incorrect error checking for close() in _fileio.c, which I fixed,
> and
>
> 2)  Line 384 in io.py, where all exceptions are caught for self.close().
>
>
>
> Fixing 1 and patching 2 would bring the problem to light when running the
> test_imp.py part of the testsuite and, indeed, applying the fix to
> tokenizer.c would then remove it again.
>
> I am a bit worried about 2) thoug.  I didn't modify that, but having a catch
> all clause just to be clean on system exit seems shaky to me.   I wonder, is
> there a way to make such behaviour, if it is indeed necessary, just to be
> active when exit is in progress?
>
> Something like:
>
> try:
> self.close()
> except:
> try:
>if not sys.exiting(): raise
> except:
>pass
>
>
> Or better yet, do as we have done often here, just catch the particular
> problem that occurs during shutdown, most often name error:
>
> try:
> self.close()
> except (AttributeError, NameError):
> pass

I suggest "except Exception": SystemExit and KeyboardInterrupt inherit
from BaseException, not from Exceptions
And close() is likely to raise IOErrors.


-- 
Amaury Forgeot d'Arc
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] try/except in io.py

2008-12-19 Thread Kristján Valur Jónsson


> > try:
> > self.close()
> > except:
> > try:
> >if not sys.exiting(): raise
> > except:
> >pass
> >
> >
> > Or better yet, do as we have done often here, just catch the particular
> > problem that occurs during shutdown, most often name error:
> >
> > try:
> > self.close()
> > except (AttributeError, NameError):
> > pass
>
> From: Amaury Forgeot d'Arc [mailto:amaur...@gmail.com]
> I suggest "except Exception": SystemExit and KeyboardInterrupt inherit
> from BaseException, not from Exceptions
> And close() is likely to raise IOErrors.

Ah, but that is not what the intent is to guard agains, according the comments.
During exit, modules have been deleted and all sorts of things have gone away.
It is therefore likely that code that executes during exit will encounter
NameErrors (when a module is being cleaned up and its globals removed)
And AttributeErrors.
ImportErrors too, in fact.

It would be good to see the actual repro case that caused this to be added in 
the first place, so that we could selectively catch those errors.

Kristján
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] try/except in io.py

2008-12-19 Thread Nick Coghlan
Kristján Valur Jónsson wrote:
> Ah, but that is not what the intent is to guard agains, according the
> comments. During exit, modules have been deleted and all sorts of
> things have gone away. It is therefore likely that code that executes
> during exit will encounter NameErrors (when a module is being cleaned
> up and its globals removed) And AttributeErrors. ImportErrors too, in
> fact.
> 
> It would be good to see the actual repro case that caused this to be
> added in the first place, so that we could selectively catch those
> errors.

Generally speaking, close() and __delete__() methods that can be invoked
during interpreter shutdown should avoid referencing module globals at
all. Necessary globals (including members of other modules) should
either be cached on the relevant class or captured in a closure.

Now, it may be that the relevant close() method in io.py touches too
much code for that to be practical, but it certainly isn't the case in
general that encountering Name/Attribute/ImportError during shutdown is
inevitable.

Cheers,
Nick.

-- 
Nick Coghlan   |   ncogh...@gmail.com   |   Brisbane, Australia
---
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


[Python-Dev] Py3k: magical dir()

2008-12-19 Thread Dmitry Vasiliev

Hello!

I think it's a strange behavior:

Python 3.1a0 (py3k:67851, Dec 19 2008, 16:50:32)
[GCC 4.0.3 (Ubuntu 4.0.3-1ubuntu5)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> hash(range(10))
Traceback (most recent call last):
  File "", line 1, in 
TypeError: unhashable type: 'range'
>>> dir(range(10))
['__class__', '__delattr__', '__doc__', '__eq__', '__format__', 
'__ge__', '__getattribute__', '__getitem__', '__gt__', '__hash__', 
'__init__', '__iter__', '__le__', '__len__', '__lt__', '__ne__', 
'__new__', '__reduce__', '__reduce_ex__', '__repr__', '__reversed__', 
'__setattr__', '__sizeof__', '__str__', '__subclasshook__']

>>> hash(range(10))
-1211318616
>>> hash(range(1000))
-1211318472

--
Dmitry Vasiliev (dima at hlabs.spb.ru)
  http://hlabs.spb.ru
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Py3k: magical dir()

2008-12-19 Thread Christian Heimes
Dmitry Vasiliev schrieb:
> Hello!
> 
> I think it's a strange behavior:
> 
> Python 3.1a0 (py3k:67851, Dec 19 2008, 16:50:32)
> [GCC 4.0.3 (Ubuntu 4.0.3-1ubuntu5)] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
 hash(range(10))
> Traceback (most recent call last):
>   File "", line 1, in 
> TypeError: unhashable type: 'range'
 dir(range(10))
> ['__class__', '__delattr__', '__doc__', '__eq__', '__format__',
> '__ge__', '__getattribute__', '__getitem__', '__gt__', '__hash__',
> '__init__', '__iter__', '__le__', '__len__', '__lt__', '__ne__',
> '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__reversed__',
> '__setattr__', '__sizeof__', '__str__', '__subclasshook__']
 hash(range(10))
> -1211318616
 hash(range(1000))
> -1211318472

Yes, it is. I'm able to reproduce the problem.

Christian

___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Py3k: magical dir()

2008-12-19 Thread Eric Smith

Christian Heimes wrote:

Dmitry Vasiliev schrieb:

Hello!

I think it's a strange behavior:

Python 3.1a0 (py3k:67851, Dec 19 2008, 16:50:32)
[GCC 4.0.3 (Ubuntu 4.0.3-1ubuntu5)] on linux2
Type "help", "copyright", "credits" or "license" for more information.

hash(range(10))

Traceback (most recent call last):
  File "", line 1, in 
TypeError: unhashable type: 'range'

dir(range(10))

['__class__', '__delattr__', '__doc__', '__eq__', '__format__',
'__ge__', '__getattribute__', '__getitem__', '__gt__', '__hash__',
'__init__', '__iter__', '__le__', '__len__', '__lt__', '__ne__',
'__new__', '__reduce__', '__reduce_ex__', '__repr__', '__reversed__',
'__setattr__', '__sizeof__', '__str__', '__subclasshook__']

hash(range(10))

-1211318616

hash(range(1000))

-1211318472


Yes, it is. I'm able to reproduce the problem.


It's not just dir(). Same behavior with help():

Python 3.1a0 (py3k:67856, Dec 19 2008, 10:18:03)
[GCC 4.0.1 (Apple Inc. build 5465)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> hash(range(10))
Traceback (most recent call last):
  File "", line 1, in 
TypeError: unhashable type: 'range'
[43173 refs]
>>> help(range(10))

[77213 refs]
>>> hash(range(10))
5041912
[77215 refs]
>>>
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Py3k: magical dir()

2008-12-19 Thread Guilherme Polo
On Fri, Dec 19, 2008 at 12:20 PM, Dmitry Vasiliev  wrote:
> Hello!
>
> I think it's a strange behavior:
>
> Python 3.1a0 (py3k:67851, Dec 19 2008, 16:50:32)
> [GCC 4.0.3 (Ubuntu 4.0.3-1ubuntu5)] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
 hash(range(10))
> Traceback (most recent call last):
>  File "", line 1, in 
> TypeError: unhashable type: 'range'
 dir(range(10))
> ['__class__', '__delattr__', '__doc__', '__eq__', '__format__', '__ge__',
> '__getattribute__', '__getitem__', '__gt__', '__hash__', '__init__',
> '__iter__', '__le__', '__len__', '__lt__', '__ne__', '__new__',
> '__reduce__', '__reduce_ex__', '__repr__', '__reversed__', '__setattr__',
> '__sizeof__', '__str__', '__subclasshook__']
 hash(range(10))
> -1211318616
 hash(range(1000))
> -1211318472
>

There are other ways to reproduce it without using dir, like
range(10).__class__; hash(range(10))

Is there some reason no set tp_hash for rangeobject to
PyObject_HashNotImplemented ?

> --
> Dmitry Vasiliev (dima at hlabs.spb.ru)
>  http://hlabs.spb.ru



-- 
-- Guilherme H. Polo Goncalves
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Py3k: magical dir()

2008-12-19 Thread Hagen Fürstenau
> Is there some reason no set tp_hash for rangeobject to
> PyObject_HashNotImplemented ?

http://bugs.python.org/issue4701

- Hagen

___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


[Python-Dev] Summary of Python tracker Issues

2008-12-19 Thread Python tracker

ACTIVITY SUMMARY (12/12/08 - 12/19/08)
Python tracker at http://bugs.python.org/

To view or respond to any of the issues listed below, click on the issue 
number.  Do NOT respond to this message.


 2266 open (+37) / 14258 closed (+20) / 16524 total (+57)

Open issues with patches:   762

Average duration of open issues: 704 days.
Median duration of open issues: 2530 days.

Open Issues Breakdown
   open  2248 (+37)
pending18 ( +0)

Issues Created Or Reopened (58)
___

Doctest module does not work with zipped packages12/15/08
CLOSED http://bugs.python.org/issue4197reopened ncoghlan  
   patch   

configparser DEFAULT 12/12/08
CLOSED http://bugs.python.org/issue4645created  shawn.ashlee  
   

distutils chokes on empty options arg in the setup function  12/12/08
   http://bugs.python.org/issue4646created  theller   
   patch, patch

Builtin parser module fails to parse relative imports12/12/08
CLOSED http://bugs.python.org/issue4647created  schluehk  
   

Fix n//x to n/x in the Docs  12/12/08
CLOSED http://bugs.python.org/issue4648created  Retro 
   

Fix a+b to a + b 12/13/08
CLOSED http://bugs.python.org/issue4649created  Retro 
   

getopt need re-factor... 12/13/08
   http://bugs.python.org/issue4650created  wangchun  
   

getopt need re-factor... 12/13/08
CLOSED http://bugs.python.org/issue4651created  wangchun  
   

IDLE does not work with Unicode  12/13/08
   http://bugs.python.org/issue4652created  zzyzx 
   

Patch to fix typos for Py3K  12/13/08
   http://bugs.python.org/issue4653created  typo.pl   
   

os.path.realpath() get the wrong result  12/13/08
   http://bugs.python.org/issue4654created  dirlt 
   

during Python installation, setup.py should not use .pydistutils 12/14/08
   http://bugs.python.org/issue4655created  jah   
   

Python 3 tutorial has old information about dicts12/14/08
CLOSED http://bugs.python.org/issue4656created  mdcowles  
   

Doctest gets line numbers wrongs with <> in name 12/14/08
   http://bugs.python.org/issue4657created  ncoghlan  
   

missing closing bracket in Functional Programming HOWTO  12/14/08
CLOSED http://bugs.python.org/issue4658created  bgeron
   

compilation warning in Modules/zipimport.c   12/14/08
   http://bugs.python.org/issue4659created  pitrou
   

multiprocessing.JoinableQueue task_done() issue  12/14/08
   http://bugs.python.org/issue4660created  merrellb  
   

email.parser: impossible to read messages encoded in a different 12/14/08
   http://bugs.python.org/issue4661created  dato  
   

posix module lacks several DeprecationWarning's  12/14/08
   http://bugs.python.org/issue4662created  mishok13  
   patch   

Increase TextIOWrapper._CHUNK_SIZE

[Python-Dev] Distutils maintenance

2008-12-19 Thread Tarek Ziadé
Hello

I would like to request a commit access to work specifically on
distutils maintenance.

Regards
Tarek

-- 
Tarek Ziadé | Association AfPy | www.afpy.org
Blog FR | http://programmation-python.org
Blog EN | http://tarekziade.wordpress.com/
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Distutils maintenance

2008-12-19 Thread Benjamin Peterson
On Fri, Dec 19, 2008 at 12:55 PM, Tarek Ziadé  wrote:
> Hello
>
> I would like to request a commit access to work specifically on
> distutils maintenance.

+1

We are currently without an active distutils maintainer, and many
stale distutil tickets are in need of attention I'm sure Tarek could
provide. Tarek has also been providing many useful patches of his own.



-- 
Cheers,
Benjamin
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


[Python-Dev] [ANN] Python 2.4.6 and 2.5.3 (final)

2008-12-19 Thread Martin v. Löwis
On behalf of the Python development team and the Python community, I'm
happy to announce the release of Python 2.4.6 and 2.5.3 (final).

2.5.3 is the last bug fix release of Python 2.5. Future 2.5.x releases
will only include security fixes. According to the release notes, about
80 bugs and patches have been addressed since Python 2.5.2, many of
them improving the stability of the interpreter, and improving its
portability.

Since the release candidate, the only change was an update to the
Macintosh packaging procedure.

2.4.6 includes only a small number of security fixes. Python 2.6 is
the latest version of Python, we're making this release for people who
are still running Python 2.4.

See the release notes at the website (also available as Misc/NEWS in
the source distribution) for details of bugs fixed; most of them prevent
interpreter crashes (and now cause proper Python exceptions in cases
where the interpreter may have crashed before).

For more information on Python 2.4.6 and 2.5.3, including download
links for various platforms, release notes, and known issues, please
see:

http://www.python.org/2.4.6
http://www.python.org/2.5.3

Highlights of the previous major Python releases are available
from the Python 2.5 page, at

http://www.python.org/2.4/highlights.html
http://www.python.org/2.5/highlights.html

Enjoy this release,
Martin

Martin v. Loewis
mar...@v.loewis.de
Python Release Manager
(on behalf of the entire python-dev team)
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] try/except in io.py

2008-12-19 Thread Kristján Valur Jónsson
Ok, in this case I move that we remove this try/except and see where it leads 
us.
If we see problems during teardown, we should deal with them in a more targeted 
manner.

Kristján

-Original Message-
From: Nick Coghlan [mailto:ncogh...@gmail.com] 
Sent: 19. desember 2008 13:51
To: Kristján Valur Jónsson
Cc: Amaury Forgeot d'Arc; Python-Dev
Subject: Re: [Python-Dev] try/except in io.py


Generally speaking, close() and __delete__() methods that can be invoked
during interpreter shutdown should avoid referencing module globals at
all. Necessary globals (including members of other modules) should
either be cached on the relevant class or captured in a closure.

Now, it may be that the relevant close() method in io.py touches too
much code for that to be practical, but it certainly isn't the case in
general that encountering Name/Attribute/ImportError during shutdown is
inevitable.

___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Please test OSX installer

2008-12-19 Thread Martin v. Löwis
> I got a "Problem Report for Python" pop-up.  Skip to "///" for
> "Problem Details".  Interestingly, the test completed with the
> following report:

Thanks for the report. I have tested that with 2.5.2, which fails
in the same way. So this is not a regression, and I have not attempted
to fix it.

Regards,
Martin
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


[Python-Dev] Can't have unbuffered text I/O in Python 3.0?

2008-12-19 Thread Fabio Zadrozny
Hi,

I'm currently having problems to get the output of Python 3.0 into the
Eclipse console (integrating it into Pydev).

The problem appears to be that stdout and stderr are not running
unbuffered (even passing -u or trying to set PYTHONUNBUFFERED), and
the content only appears to me when a flush() is done or when the
process finishes.

So, in the search of a solution, I found a suggestion from
http://stackoverflow.com/questions/107705/python-output-buffering

to use the following construct:

sys.stdout = os.fdopen(sys.stdout.fileno(), 'w', 0)

But that gives the error below in Python 3.0:

sys.stdout = os.fdopen(sys.stdout.fileno(), 'w', 0)
  File "D:\bin\Python30\lib\os.py", line 659, in fdopen
return io.open(fd, *args, **kwargs)
  File "D:\bin\Python30\lib\io.py", line 243, in open
raise ValueError("can't have unbuffered text I/O")
ValueError: can't have unbuffered text I/O

So, I'd like to know if there's some way I can make it run unbuffered
(to get the output contents without having to flush() after each
write).

Thanks,

Fabio
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Can't have unbuffered text I/O in Python 3.0?

2008-12-19 Thread Brett Cannon
On Fri, Dec 19, 2008 at 13:43, Fabio Zadrozny  wrote:
> Hi,
>
> I'm currently having problems to get the output of Python 3.0 into the
> Eclipse console (integrating it into Pydev).
>
> The problem appears to be that stdout and stderr are not running
> unbuffered (even passing -u or trying to set PYTHONUNBUFFERED), and
> the content only appears to me when a flush() is done or when the
> process finishes.
>
> So, in the search of a solution, I found a suggestion from
> http://stackoverflow.com/questions/107705/python-output-buffering
>
> to use the following construct:
>
> sys.stdout = os.fdopen(sys.stdout.fileno(), 'w', 0)
>
> But that gives the error below in Python 3.0:
>
>sys.stdout = os.fdopen(sys.stdout.fileno(), 'w', 0)
>  File "D:\bin\Python30\lib\os.py", line 659, in fdopen
>return io.open(fd, *args, **kwargs)
>  File "D:\bin\Python30\lib\io.py", line 243, in open
>raise ValueError("can't have unbuffered text I/O")
> ValueError: can't have unbuffered text I/O
>
> So, I'd like to know if there's some way I can make it run unbuffered
> (to get the output contents without having to flush() after each
> write).

Notice how the exception specifies test I/O cannot be unbuffered. This
restriction does not apply to bytes I/O. Simply open it as 'wb'
instead of 'w' and it works.

-Brett
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


[Python-Dev] Call PyType_Ready on builtin types during interpreter startup?

2008-12-19 Thread Nick Coghlan
Some strangeness was recently reported for the range() type in Py3k
where instances are unhashable until an attribute is retrieved from the
range type itself, and then they become hashable. [1]

While there is definitely an associated bug in the range implementation
(it doesn't block inheritance of the default object.__hash__
implementation), there's also the fact that when the interpreter
*starts* the hash implementation hasn't been inherited yet, but it does
get inherited later.

It turns out that _PyBuiltin_Init doesn't call PyType_Ready on any of
the builtin types - they're left to have it called implicitly when an
operation using them needs tp_dict filled in.

Such operations (which includes retrieving an attribute from the type
object) will implicitly call PyType_Ready to populate tp_dict, which
also has the side effect of inheriting slot implementations from base
classes.

Is there a specific reason for not fully initialising the builtin types?
Or should we be calling PyType_Ready on each of them from _PyBuiltin_Init?

Cheers,
Nick.

[1] http://bugs.python.org/issue4701

-- 
Nick Coghlan   |   ncogh...@gmail.com   |   Brisbane, Australia
---
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Can't have unbuffered text I/O in Python 3.0?

2008-12-19 Thread Nick Coghlan
Brett Cannon wrote:
> Notice how the exception specifies test I/O cannot be unbuffered. This
> restriction does not apply to bytes I/O. Simply open it as 'wb'
> instead of 'w' and it works.

s/test/text/ :)

(For anyone else that is like me and skipped over the exception detail
on first reading, thus becoming a little confused...)

Cheers,
Nick.

-- 
Nick Coghlan   |   ncogh...@gmail.com   |   Brisbane, Australia
---
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Can't have unbuffered text I/O in Python 3.0?

2008-12-19 Thread Fabio Zadrozny
You're right, thanks (guess I'll use that option then).

Now, is it a bug that Python 3.0 doesn't run unbuffered when
specifying -u or PYTHONUNBUFFERED, or was this support dropped?

Thanks,

Fabio

On Fri, Dec 19, 2008 at 8:03 PM, Brett Cannon  wrote:
> On Fri, Dec 19, 2008 at 13:43, Fabio Zadrozny  wrote:
>> Hi,
>>
>> I'm currently having problems to get the output of Python 3.0 into the
>> Eclipse console (integrating it into Pydev).
>>
>> The problem appears to be that stdout and stderr are not running
>> unbuffered (even passing -u or trying to set PYTHONUNBUFFERED), and
>> the content only appears to me when a flush() is done or when the
>> process finishes.
>>
>> So, in the search of a solution, I found a suggestion from
>> http://stackoverflow.com/questions/107705/python-output-buffering
>>
>> to use the following construct:
>>
>> sys.stdout = os.fdopen(sys.stdout.fileno(), 'w', 0)
>>
>> But that gives the error below in Python 3.0:
>>
>>sys.stdout = os.fdopen(sys.stdout.fileno(), 'w', 0)
>>  File "D:\bin\Python30\lib\os.py", line 659, in fdopen
>>return io.open(fd, *args, **kwargs)
>>  File "D:\bin\Python30\lib\io.py", line 243, in open
>>raise ValueError("can't have unbuffered text I/O")
>> ValueError: can't have unbuffered text I/O
>>
>> So, I'd like to know if there's some way I can make it run unbuffered
>> (to get the output contents without having to flush() after each
>> write).
>
> Notice how the exception specifies test I/O cannot be unbuffered. This
> restriction does not apply to bytes I/O. Simply open it as 'wb'
> instead of 'w' and it works.
>
> -Brett
>
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


[Python-Dev] Python 3.0.1

2008-12-19 Thread Barry Warsaw

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

I'd like to get Python 3.0.1 out before the end of the year.  There  
are no showstoppers, but I haven't yet looked at the deferred blockers  
or the buildbots.


Do you think we can get 3.0.1 out on December 24th?  Or should we wait  
until after Christmas and get it out, say on the 29th?  Do we need an  
rc?


This question goes mostly to Martin and Georg.  What would work for  
you guys?


- -Barry

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.9 (Darwin)

iQCVAwUBSUwgEXEjvBPtnXfVAQIthgP7BDS6xfBHhADKc50ANvZ5aAfWhGSU9GH/
DR+IRduVmvosu9gm92hupCOaLCN4IbtyFx27A8LQuPNVc4BVrhWfDKDSzpxO2MJu
xLJntkF2BRWODSbdrLGdZ6H6WDT0ZAhn6ZjlWXwxhGxQ5FwEJb7moMuY7jAIEeor
5n6Ag5zT+e8=
=oU/g
-END PGP SIGNATURE-
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Can't have unbuffered text I/O in Python 3.0?

2008-12-19 Thread bcannon

On Dec 19, 2008 2:20pm, Fabio Zadrozny  wrote:

You're right, thanks (guess I'll use that option then).



Now, is it a bug that Python 3.0 doesn't run unbuffered when

specifying -u or PYTHONUNBUFFERED, or was this support dropped?




Well, ``python -h`` still lists it. That means either the output for -h  
needs to be fixed or the feature needs to be supported.


-Brett
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Python 3.0.1

2008-12-19 Thread Nick Coghlan
Barry Warsaw wrote:
> I'd like to get Python 3.0.1 out before the end of the year.  There are
> no showstoppers, but I haven't yet looked at the deferred blockers or
> the buildbots.
> 
> Do you think we can get 3.0.1 out on December 24th?  Or should we wait
> until after Christmas and get it out, say on the 29th?  Do we need an rc?

There are some memoryview issues [1] I'd like to have fixed for 3.0.1 -
the 29th would be a much easier date to hit. A quick review pass through
the other 3.0 highs and criticals might also be worthwhile.

Cheers,
Nick.

http://bugs.python.org/issue4580

-- 
Nick Coghlan   |   ncogh...@gmail.com   |   Brisbane, Australia
---
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Python 3.0.1

2008-12-19 Thread Barry Warsaw

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On Dec 19, 2008, at 5:42 PM, Nick Coghlan wrote:


Barry Warsaw wrote:
I'd like to get Python 3.0.1 out before the end of the year.  There  
are

no showstoppers, but I haven't yet looked at the deferred blockers or
the buildbots.

Do you think we can get 3.0.1 out on December 24th?  Or should we  
wait
until after Christmas and get it out, say on the 29th?  Do we need  
an rc?


There are some memoryview issues [1] I'd like to have fixed for  
3.0.1 -
the 29th would be a much easier date to hit. A quick review pass  
through

the other 3.0 highs and criticals might also be worthwhile.


Thanks.  I've bumped that to release blocker for now.  If there are  
any other 'high' bugs that you want considered for 3.0.1, please make  
the release blockers too, for now.


- -Barry


-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.9 (Darwin)

iQCVAwUBSUwkRnEjvBPtnXfVAQKQ4QP/eRmWBgyuijbe9vnXkRkTkAmd4qyrAD2s
Forp4hKGvoc4A03Q4x2uVweI4oSdFrKIN2NlcM3JVlSrsU07DTElFoCEA/A8DB3N
+6Sp9bC98iVqGUmle54rFIm0F/iCoFQ59mp9jNGeiKVwjojUDkbJNXulHuYIb1co
RuICfsatRc0=
=zjQz
-END PGP SIGNATURE-
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Can't have unbuffered text I/O in Python 3.0?

2008-12-19 Thread Antoine Pitrou

> Well, ``python -h`` still lists it.

Precisely, it says:

-u : unbuffered binary stdout and stderr; also PYTHONUNBUFFERED=x
 see man page for details on internal buffering relating to '-u'

Note the "binary". And indeed:

./python -u
Python 3.1a0 (py3k:67839M, Dec 18 2008, 17:56:54) 
[GCC 4.3.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.stdout.buffer.write(b"y")
y1
>>> 

I don't know what it would take to enable unbuffered text IO while keeping the
current TextIOWrapper implementation...

Regards

Antoine.


___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Python 3.0.1

2008-12-19 Thread Antoine Pitrou
Nick Coghlan  gmail.com> writes:
> 
> There are some memoryview issues [1] I'd like to have fixed for 3.0.1 -
> the 29th would be a much easier date to hit. A quick review pass through
> the other 3.0 highs and criticals might also be worthwhile.

What about #1717 "Get rid of more refercenes to __cmp__"?
(although I like the typo a lot)


___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Can't have unbuffered text I/O in Python 3.0?

2008-12-19 Thread Guido van Rossum
Fror truly unbuffered text output you'd have to make changes to the
io.TextIOWrapper class to flush after each write() call. That's an API
change -- the constructor currently has a line_buffering option but no
option for completely unbuffered mode. It would also require some
changes to io.open() which currently rejects buffering=0 in text mode.
All that suggests that it should wait until 3.1.

However it might make sense to at least turn on line buffering when -u
or PYTHONUNBUFFERED is given; that doesn't require API changes and so
can be considered a bug fix.

--Guido van Rossum (home page: http://www.python.org/~guido/)



On Fri, Dec 19, 2008 at 2:47 PM, Antoine Pitrou  wrote:
>
>> Well, ``python -h`` still lists it.
>
> Precisely, it says:
>
> -u : unbuffered binary stdout and stderr; also PYTHONUNBUFFERED=x
> see man page for details on internal buffering relating to '-u'
>
> Note the "binary". And indeed:
>
> ./python -u
> Python 3.1a0 (py3k:67839M, Dec 18 2008, 17:56:54)
> [GCC 4.3.2] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
 import sys
 sys.stdout.buffer.write(b"y")
> y1

>
> I don't know what it would take to enable unbuffered text IO while keeping the
> current TextIOWrapper implementation...
>
> Regards
>
> Antoine.
>
>
> ___
> Python-Dev mailing list
> Python-Dev@python.org
> http://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe: 
> http://mail.python.org/mailman/options/python-dev/guido%40python.org
>
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Can't have unbuffered text I/O in Python 3.0?

2008-12-19 Thread Antoine Pitrou
Antoine Pitrou  pitrou.net> writes:
> 
> Note the "binary". And indeed:
[...]

And I realize I should have thought a bit before giving that "proof".
Sorry!



___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Distutils maintenance

2008-12-19 Thread Amaury Forgeot d'Arc
On Fri, Dec 19, 2008 at 19:59, Benjamin Peterson
 wrote:
> On Fri, Dec 19, 2008 at 12:55 PM, Tarek Ziadé  wrote:
>> Hello
>>
>> I would like to request a commit access to work specifically on
>> distutils maintenance.
>
> +1
>
> We are currently without an active distutils maintainer, and many
> stale distutil tickets are in need of attention I'm sure Tarek could
> provide. Tarek has also been providing many useful patches of his own.

+1 from me as well.

-- 
Amaury Forgeot d'Arc
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


[Python-Dev] extremely slow exit for program having huge (45G) dict (python 2.5.2)

2008-12-19 Thread Mike Coleman
I have a program that creates a huge (45GB) defaultdict.  (The keys
are short strings, the values are short lists of pairs (string, int).)
 Nothing but possibly the strings and ints is shared.

The program takes around 10 minutes to run, but longer than 20 minutes
to exit (I gave up at that point).  That is, after executing the final
statement (a print), it is apparently spending a huge amount of time
cleaning up before exiting.  I haven't installed any exit handlers or
anything like that, all files are already closed and stdout/stderr
flushed, and there's nothing special going on.  I have done
'gc.disable()' for performance (which is hideous without it)--I have
no reason to think there are any loops.

Currently I am working around this by doing an os._exit(), which is
immediate, but this seems like a bit of hack.  Is this something that
needs fixing, or that has already been fixed?

Mike
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Python 3.0.1

2008-12-19 Thread Martin v. Löwis
> Do you think we can get 3.0.1 out on December 24th?

I won't have physical access to my build machine from December 24th to
January 3rd.

> Or should we wait
> until after Christmas and get it out, say on the 29th?  Do we need an rc?

If you want to get it quickly, it should happen on December 23rd (my
time, meaning that the tag should be created on December 22nd). December
29th might work as well; I'd create the binaries remotely (in this case,
the tag would need to be created on December 28th).

Overall, I think a week more or less doesn't really matter, and would
prefer to see the release created in January. There are 13 release
blockers, and I'm skeptical that they can all get resolved within
the next few days.

Regards,
Martin
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


[Python-Dev] 2.6 and 3.0 buildbot slaves

2008-12-19 Thread Martin v. Löwis
I have now set up buildbot slaves for 2.6 and 3.0,
and turned off the 2.5 ones.

Regards,
Martin
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Call PyType_Ready on builtin types during interpreter startup?

2008-12-19 Thread Nick Coghlan
Nick Coghlan wrote:
> Is there a specific reason for not fully initialising the builtin types?
> Or should we be calling PyType_Ready on each of them from _PyBuiltin_Init?

I need to correct this slightly: some builtin types *are* initialised
properly by _Py_ReadyTypes.

So the question is actually whether or not the missing builtin types
should be added to that function.

Cheers,
Nick.

-- 
Nick Coghlan   |   ncogh...@gmail.com   |   Brisbane, Australia
---
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com