[Python-Dev] python-dev Summary for 2003-06-01 through 2003-06-30

Brett C. drifty@alum.berkeley.edu
Tue, 01 Jul 2003 00:50:55 -0700

Since I decided to just plough through my backlog of emails I figured I=20
might as well do the summary at the same time.  Since I managed to=20
actually finish it today I thought I would just send it out now instead=20
of making you guys wait until I got the links put into the summary.=20
This means I have no clue if this will go through reST without errors.

The biggest thing about this summary short of the new format for the=20
Quickies is what I discuss in the Summary Announcements: I am formally=20
announcing that I am willing to stop doing the summaries start in=20
September.  If no one comes forward to pick up where I left off then I=20
will continue to do a crippled version of the summaries.  Personally,=20
though, I would rather like to see some new person who wants to learn=20
about python-dev and hacking on Python come forward and take over.  Fail=20
that then just someone take over who is willing to do a good job since I=20
can do a crappy job myself regardless of how much free time I have when=20
I start school.  =3D)


python-dev Summary for 2003-06-01 through 2003-06-30
This is a summary of traffic on the `python-dev mailing list`_ from June=20
1, 2003 through June 30, 2003.  It is intended to inform the wider=20
Python community of on-going developments on the list and to have an=20
archived summary of each thread started on the list.  To comment on=20
anything mentioned here, just post to python-list@python.org or=20
`comp.lang.python`_ with a subject line mentioning what you are=20
discussing. All python-dev members are interested in seeing ideas=20
discussed by the community, so don't hesitate to take a stance on=20
something.  And if all of this really interests you then get involved=20
and join `python-dev`_!

This is the eighteenth/nineteenth summary written by Brett Cannon (has=20
his own room with a door for the first time in his life).

All summaries are archived at http://www.python.org/dev/summary/ .

Please note that this summary is written using reStructuredText_ which=20
can be found at http://docutils.sf.net/rst.html .  Any unfamiliar=20
punctuation is probably markup for reST_ (otherwise it is probably=20
regular expression syntax or a typo =3D); you can safely ignore it,=20
although I suggest learning reST; its simple and is accepted for `PEP=20
markup`__.  Also, because of the wonders of programs that like to=20
reformat text, I cannot guarantee you will be able to run the text=20
version of this summary through Docutils_ as-is unless it is from the=20
original text file.

__ http://www.python.org/peps/pep-0012.html

The in-development version of the documentation for Python can be found=20
at http://www.python.org/dev/doc/devel/ and should be used when wanting=20
to look up any documentation on something mentioned here.  Python PEPs=20
(Python Enhancement Proposals) are located at=20
http://www.python.org/peps/ .  To view files in the Python CVS online,=20
go to http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/python/ .

.. _python-dev: http://www.python.org/dev/
.. _python-dev mailing list:=20
.. _comp.lang.python: http://groups.google.com/groups?q=3Dcomp.lang.pytho=
.. _Docutils: http://docutils.sf.net/
.. _reST:
.. _reStructuredText: http://docutils.sf.net/rst.html

.. contents::

.. _last summary:=20

Summary Announcements
I lost Internet on the morning of June 18 and did not regain it until=20
June 29.  Since it was so close to the end of the month I decided to=20
just combine the next summary into this month-long summary.

During my Internet blackout that reminded me of the days back when I=20
spent my days playing video games and watching television, my future=20
life as a graduate student began to form.  Since I am going to have the=20
joy of taking three upper-division undergraduate courses this upcoming=20
fall semester I don't think I am going to have the time to do the=20
summaries when school starts.

At minimum I suspect I will have to cut back on the depth of them since=20
I refuse to put the summaries before hacking on the core (hacking is=20
more fun and I would like to think I can contribute more to Python that=20
way).  If you want this job I will be willing to give it up starting in=20
September (I want a full year's worth of summaries behind me before I am=20
willing to pass the torch).  But if no one takes it I can probably=20
continue to do them in a rather informal way by summarizing only big=20
threads that I find interesting until someone steps forward to do a=20
good, thorough job.

If you *really* want to do the summaries and are interested in taking=20
over starting in September, give me an email at brett@python.org .

`Descriptor write-up [Draft:  Please comment]`__

Related threads:
     - `Descriptor write-up [second draft]`__


Raymond Hettinger has written an paper on descriptors covering what they=20
are to how to write your own.  Since not only are properties class=20
methods, static methods, and 'super' object descriptors (more on the=20
last one later on in this summary) but descriptors are used throughout=20
Python now to create bound objects for functions, methods, etc.

It would behoove all serious Python programmers to read=20
http://users.rcn.com/python/download/Descriptor.htm .

`Where to put the interrupt module?`__

Not earth-shattering, but to make sure that people know when new things=20
are added to the stdlib I figured I should make this thread have a=20
full-blown summary.

Thanks to the development work on IDLEfork_, a new function in the=20
thread module called interrupt_main has been added.  It raises=20
KeyboardInterrupt in the main thread of a program.  The reason the=20
exception is KeyboardInterrupt and not some new exception is because=20
KeyboardInterrupt is the only asynchronous error in Python.

There was discussion of making it much more general, but for now it is=20
going to be kept simple since having a more general version, at this=20
moment, does not seem to be needed.

.. _IDLEfork: http://idlefork.sf.net/

`Can't compile _tkinter.c with Redhat 9`__

`Red Hat`_, apparently, modified their distribution of Tcl_ so as to=20
support `UCS-4`_ text encoding so that their distribution of Python 2.2=20
could be compiled with UCS-4 support.  Problem is that this does not=20
allow Python to compile with UCS-2 support; you **have** to compile with=20
UCS-4 support and not UCS-2 under Red Hat 9 with their custom version of=20

Thanks to Martin v. L=F6wis, 2.3 has been modified so that Python compile=
in either UCS-4 or UCS-2 will work with standard Tcl which is UCS-2=20

.. _Red Hat:
.. _UCS-4:


Splintered threads:
     - `Exception masking/chaining`__


A discussion of PEP 317 broke out on python-dev.  You can read the PEP=20
for details but it advocated removing string exceptions (they are going=20
to be gone in Python 3) and implicit exception instantiation (that is=20
not changing).  The PEP was eventually rejected and has the details of=20
why it was rejected in the end.

Part of this discussion forked off to discuss exception masking.  The=20
idea came up that it might be nice for an exception to keep a reference=20
to a previous exception that was still uncaught at that point.  An=20
example is an exception in the function passed to map; the function gets=20
returned without knowing that it was in map.  Masking it wouldn't work=20
though since you then wouldn't know about the error in the function=20
itself.  But if there was a way to raise an exception from map that=20
reference the original exception from the function then no information=20
would be lost.  Chaining the exceptions together would most likely just=20
be sticking the previous exception in an attribute of the new one.  This=20
was all originally discussed `in January=20
and `February=20
of this year.

There was also discussion of adding the traceback for an exception as an=20
attribute of the exception.  This would make getting respective=20
tracebacks easier period but also easier if exception chaining was=20
implemented.  The traceback would most likely be attached to the=20
exception when it is caught and not at instantiation.

Both of these ideas are just that, ideas.  They most likely won't occur=20
until exceptions are moved over to new-style classes which probably=20
won't be for a while.

`towards a faster Python`__

Related threads:
   - `problem with assignment shadows builtin warning`__


A new warning has been added to Python for when you inject an attribute=20
into a module to shadows a built-in::

     import os
     os.open =3D 42

This is in hopes of making this kind of thing illegal so as to allow the=20
bytecode to be optimized for accessing built-ins.  It also led to=20
package imports, such as ``import A.B.C`` to work directly on the=20
namespace dict instead of doing essentially ``setattr(A, 'B', A.B);=20
setattr(A.B, 'C', A.B.C)``.

`Sneaky 'super' instances`__

Splinter threads:
     - `PEP 246 and Protocols`__


Discovering that an instance to the 'super' type is both an instance of=20
a class *and* a non-data descriptor was causing issues for pydoc and=20
inspect led to the question of whether there was any definitive way to=20
tell whether an object was an instance of a class defined by using the=20
'class' statement in Python.  It turns out there is: if=20
object.__class__.__flags__ >> 9 & 1 is 1 (which is the=20
Py_TPFLAGS_HEAPTYPE in C) *and* its metaclass is or a subclass of type.

This then spawned a discussion about protocols and interfaces (which was=20
discussed once way back when under the title `type categories`_) since=20
protocols could supposedly allow one to define a protocol for what makes=20
up a 'super' instance.  None of this will get into the language (if it=20
ever gets in) until Guido can really think it through and that will be a=20

.. _type categories:

`Details on Python shutting down`__

What happens while Python is shutting down?  Well, it calls Py_Finalize=20
in Python/pythonrun.c .  This means that signals are turned off,=20
gc.collect is called, calls PyImport_Cleanup in Python/import.c, and=20
then calls. gc.collect one more time.

PyImport_Cleanup is where modules are torn down.  __main__ is deleted,=20
then everything but sys and __builtin__, and then sys and __builtin__=20
(in that order).  Now "deletion" as mentioned he is setting the module=20
to None in sys.modules, setting all names starting with a single=20
underscore to None in the module, and then all others sans __builtins__ .

This is why when you define a __del__ method you need to make sure that=20
all things referenced in it are local; global names in the module will=20
have been set to None by the time the code is called if the object is=20
collected during shutdown and raise an exception.

`Re: [Python-checkins] python/dist/src/Objectslistobject.c,2.15`__

list.index now has optional start and end arguments.

`RELEASED: Python 2.3b2`__

Related threads:
   - `2.3b2 this weekend`__
   - `Python 2.3b2 branch tag created`__


Title says it all.  Big thing with this beta release is the new version=20
of IDLE.  As with all betas, please download it and give it a whirl to=20
try to shake out any bugs that need fixing *ASAP*; we are going to aim=20
for an August 1 release date for final thanks to Apple planning to=20
incorporate Python 2.3 into Panther_.

.. _Panther: http://www.apple.com/macosx/panther/

`Re: Activating `-i' from inside a script?`__

Related threads:
   - `Delayed `-i'! :-)`__


Thanks to Skip Montanaro and someone curious at comp.lang.python_ you=20
can now set the PYTHONINSPECT environment variable to something and then=20
be started into an interactive interpreter if an exception propagates=20
all the way to the end of a program without being caught.

Weekly Python Bug/Patch Summary
     - `2003-06-01`__
     - `2003-06-08`__
     - `2003-06-15`__
     - `2003-06-22`__
     - `2003-06-29`__


Do Not Post Bugs to python-dev

Related threads:
   - `Doc issue http://python.org/doc/2.2/api/iterator.html`__
   - `"%%s %s"%"hi"%ho" works here and not there`__
   - `IDLE bug?`__
   - `Bug with ExtensionClass and __coerce__`__


A good rule-of-thumb to follow is to not post bugs to python-dev.  There=20
are exceptions, of course, but that exception pretty much only applies=20
to the Python core developers.

Do Not Ask for Help on python-dev

Related threads:
   - `Python Mega Widgets doubt`__


If you need help with Python, post to comp.lang.python_ (which can be=20
reached through python-list@python.org).

`BaseHTTPServer parsing`__

Code marked as internal to a module in the stdlib means you should not=20
directly reference it in your code lest you are willing to deal with=20
possible future breakage when a refactoring of that module is done.

`popen2.py strangeness`__

A race condition in popen2 was found and fixed in 2.3 but was not solved=20
in time for 2.2.3 .  It has been marked for backporting for 2.2.4 .


The new sorting algorithm for lists (known affectionately as "timsort"=20
since Tim Peters wrote that tricky piece of code) is a 2.3 feature.  But=20
if you would like it for older versions of Python you can get it from=20
http://py-stablesort.sourceforge.net/ .

`Mundane dict __setitem__...`__

The hash value for an object in a dictionary is not guaranteed to be=20
done based on identity; having two names set to equal tuples and used as=20
keys will overwrite each other.

`Meaning of trailing comma?`__

Improper for python-dev, but Michael Chermside was nice enough to answer=20
the question nonetheless.

`test_strptime failed`__

A failing test was reported.  Follow-up on the thread is still pending.

`IDLEfork Re-integration into Python`__

The new version of IDLE (being developed by the `IDLEfork`_ team) is=20
going to be kept in Lib/idlelib/ .

`On Syntax Extensibility (again)`__

Samuele Pedroni's thoughts on blocks (like thunks) in Python.  This goes=20
way back to the `2003-02-01 summary`_ and the `thunks=20

.. _2003-02-01 summary:=20

`The Python interpreter is not fully thread-safe.`__

It is going to be added to the documentation for threading in the Python=20
core that it does not support free threading.  For those of you who=20
aren't familiar with what free threading is (it apparently comes from=20
the Windows programming world), it means that something can be called at=20
any time from any thread.  In other words it is thread-safe without=20
requiring any special API.

`urllib2 proxy support broken?`__

This was initially covered in the `last summary`_.
The broken proxy support in urllib2 has been fixed.

`Re: [Python-checkins] python/dist/src/Lib  pprint.py`__...

A patch applied to pprint to try to notice if a type's __repr__ had=20
changed was backed out.


Now returns the empty list when there are no matching extensions.

`[OT] Thank you, python-dev`__

An email from me to python-dev thanking the list for everything they=20
have done since it helped get me into grad school.

`Re: [DB-SIG] API suggestion: expose 'quote' method`__

Email about adding an optional quote function to the Python `DB-API`_ spe=

.. _DB-API:

`Updated 2.3 Release Schedule`__

Don't expect 2.3 final to be released until some time after OSCON (it=20
ends on July 11).

`cPickle coredump with 2.3/cvs`__

Someone was having core dump on them thanks to cPickle, but with no one=20
else able to reproduce the problem so it's up to the OP to help solve=20
this one.

`Patch to remove eval from csv sniffer`__

A patch for the new csv package was questioned since 2.3 is in beta.=20
Guido gave the clear, though, since the chances of people's code being=20
dependent on the package were negligible.

`Proposal to drop f_tstate`__

A misunderstanding on the use of the f_tstate value in frames in C code.

`Caching of builtins and globals in action`__

Samuele Pedroni playing with caching accesses to globals and built-ins.

`Two useful patches involving tracebacks`__

After discussing a useful patch, the idea of refactoring the cgitb and=20
traceback module for 2.4 came up and seemed to be agreed upon to be a=20
good idea.

`PEP-311 operational?`__

Someone asking if PEP 311 has been applied.

`Can we switch different "byte code interpreters"?`__

Answer: no.
Lesson learned: when you want to start a new thread do not piggyback on=20
an existing one unless it is somehow related.

`Sporadic test failures in Lib/test/test_mimetools.py`__

When writing tests that base results on the time difference between time=20
measurements you *must* make sure that the difference is big enough to=20
be noticed by a platforms time.time function (Windows only measures 10=20
times a second).

`porting problems`__

Someone has gotten Python to run on an XBox and GameCube.  =3D)

`Python language standard; LSB`__

Python has no "standard"; CPython is as close as you are going to get.

`VC 7.1 compiler for key developers - last call!`__

Guido asked for people who wanted a free copy of VC 7.1 to speak up.

`PEP280 and my experiment`__

Taking cues from PEP 280, Samuele Pedroni experimented with caching=20
access to builtins and globals and got about a 15% increase.

`On the possibility of "optimizing" range() calls in for-loops`__

The idea of optimizing the bytecode for calls to range in 'for' loops is=20
still being thrown around.  Alex Martelli, though, pointed out that if=20
you just need to do something a set number of times nothing beats=20
itertools.repeat .

`Changes to IDLE`__

All new bugs and patches in regards to IDLE should go into the Python=20

`zipfile.py (SF #755031)`__

A bug with zipfile was found and subsequently patched.

`New PEP: 319`__

A new PEP on adding a keyword for synchronizing code has been put online.

`Py2.3 Todo List`__

Related threads:
   - `More work on SRE`__


Essentially a discussion as to whether to apply Gustavo Niemeyer's patch=20
to remove the recursion limit from the re module and to add=20
sys.(get|set)defaultsourceencoding functions.  The former is in (with=20
help of a coverage tool that comes with gcc and is talked about at=20
https://moin.conectiva.com.br/GustavoNiemeyer/2003-06-19 ) and the=20
latter is to be hashed out at EuroPython_.

.. _EuroPython:


Misunderstanding over how the method worked.

`No Net at home`__

I lost Internet, as you probably know from the `Summary Announcements`_=20
section, on June 18 and didn't get it back until June 29.

`SF CVS hosed?`__

Usual issues with cvs.  Some talk about Subversion_.

.. _Subversion:

`curses module has_key emulation`__

Problem with curses was found and a proposed patch at=20
http://www.python.org/sf/759208 has been created.

`A vote against dict(keyword=3Dvalue) sugar`__...

What the subject says.

`Python on dual-processor Macs?`__

Greg Ewing was worried about a bug he heard about on dual-processor=20
Macs.  Jack Jansen said it was solved, though.

`Patch  595601`__

A race condition with files and closing/reading is being worked on at=20
http://www.python.org/sf/595601 .

`cookie support for FancyURLopener?`__

Someone asking if a certain feature was under development.

`proposed Tkinter change; any likelihood of acceptance?`__

Not for 2.3.0, but maybe for 2.4 or 2.3.1 .

`Python hash function`__

Damien Morton continues to try to speed up Python, this time by trying=20
to speed up the hashing of strings.


Backporting a fix all the way to Python 2.1 is only needed if it is=20
really critical.

`deprecate dbm module & add bsddb185 module for 2.2`__

"No" and probably "if you put the effort into it yourself".

`OSCON Lightning Talk Proposals still being accepted`__

If you want to give a lightning talk at OSCON_, read this email.

.. _OSCON:

`[development doc updates]`__

Just what it says.

`Yet more SRE`__

Gustavo Niemeyer fiddles with the re module some more.

`Python 2.3b1, distutils and PEP 263`__

Bug in Distutils is squashed involving the shebang line.

`test_copy_reg failing in 2.3 CVS`__

Dealt with by a comment.

`socket timeouts and httplib`__

Dealt with by adding a specific exception for timeouts.

`Embedding Python, threading and scalability`__

David Abrahams redirecting a question to python-dev.

`[ANN] SciPy '03 -- The 2nd Annual Python for Scientific Computing=20

Title says it all.

`Proposed DNS query library`__

Take a look at dnspython_ if you need DNS stuff.

.. _dnspython: http://www.dnspython.org

`Problems in stdlib before 2.3b2`__

They are being/have been dealt with.

`Running tests on freebsd5`__

...had two failures.  They are being worked on.

`threads duplicated on fork() prevent child from terminating properly`__

Person was told to file a bug report.

`Meaty debugging mystery`__

... which Martin v. L=F6wis figured out the basic cause although how it i=
happening is still unknown.

`2.3b2 known bugs?`__

The bugs listed previously at http://www.python.org/2.3/bugs.html have=20
been fixed but two new ones take their place.

`Problem with 2.3b2 tarfile?`__

Solaris tar was choking on a *really* long pathname in the stdlib.  The=20
pathname will most likely end up being changed to be under 100=20
characters so as to meet the POSIX tarfile format specification.

`release candidate rules and timeit API question`__

For a release candidate you shouldn't even add new tests if you can help =

`A bit faster access to module attributes`__

Some suggestions on how to get what the subject says.

`String exceptions in the Tutorial`__

... are pretty much removed now.