python-dev Summary for 2006-07-16 through 2006-07-31

steven.bethard at steven.bethard at
Tue Aug 15 07:32:16 CEST 2006

python-dev Summary for 2006-07-16 through 2006-07-31

.. contents::

[The HTML version of this Summary is available at]


Python 2.5 schedule

After inserting a third beta release to allow some more time for testing the new features, Python continues to make progress towards the final Python 2.5 release. See `PEP 356`_ for more details and the full schedule.

.. _PEP 356:

Contributing threads:

- `outstanding bugs to fix for 2.5 <>`__
- `Py2.5 release schedule <>`__

How to submit a patch to Python

Just a few reminders for all those still new to python-dev. When submitting a new patch to SourceForge, don't assign it to anyone. Most python developers get email notifications for new patches and will assign it to themselves if appropriate. If you feel like the approach the patch takes might need discussion, it's alright to present it to python-dev and ask for some feedback. If you do, be sure to put the patch number and url (e.g.<sourceforge_id>) near the top of the message, so that developers can easily find it.

And if you don't want to wait for your patch to be looked at (which may take some time as all developers are volunteers), a few of the folks here, including Martin v. Lowis, have offered a five-for-one deal. Simply find five other patches, and check them for things like:

* Does the code look okay?
* Does Python build with it applied?
* Do all unit tests pass?
* Does the patch have tests?
* Does the patch have documentation?

Then post your notes to the five patch trackers and post a final message to python-dev indicating the patches you reviewed and the patch which you'd like to have someone look at for you.

Contributing threads:

- `new guy <>`__
- `first draft of bug guidelines for <>`__
- `Patch submitted, now what? <>`__

Demos of trackers to replace SourceForge

There are currently three potential trackers that have successfully imported the SourceForge data with demos online: roundup_, jira_ and launchpad_. Try 'em out, and send your discussions and comments to infrastructure at and put your reports and reviews `on the wiki`_.

.. _roundup:
.. _jira:
.. _launchpad:
.. _on the wiki:

Contributing thread:

- `More tracker demos online <>`__


Restricted execution in Python

Brett Cannon decided this fortnight to go for an all-out capabilities based restricted execution design, and posted a `new design document`_. As part of this work, Brett planned to rewrite most of the import machinery in pure Python code, hopefully cleaning up some of the idiosyncrasies of the current import.c mechanisms, and allowing him to do things like restrict imports to only .py files, not .pyc files. Armin Rigo pointed out that a good place to start would be the `PyPy import implementation`_.

On the restricted execution front, one of the things that is now likely to happen in Brett's sandboxing branch is that ``object.__subclasses__()`` and dangerous constructors like the one for the code object will be completely removed from the Python level. This means a few backwards incompatible changes, but Brett suggested that they should only break pretty advanced and esoteric Python code. Since it's for his Ph.D. dissertation, he didn't want to tie his hands by requiring full backwards compatibility, and he was fine with waiting to merge his branch until Python 3000.

.. _new design document:
.. _PyPy import implementation:

Contributing threads:

- `Capabilities / Restricted Execution <>`__
- `new security doc using object-capabilities <>`__

Character case and locales

Mihai Ibanescu asked about a `bug in the logging module`_ due to the fact that ``'INFO'.lower() != 'info'`` in some locales. Marc-Andre Lemburg and Martin v. Lowis explained that since in Unicode, nearly all case-conversions are only script-dependent, not language-dependent,  ``u'INFO'.lower() == u'info'`` should always be true.

.. _bug in the logging module:

Contributing thread:

- `logging module broken because of locale <>`__

Progress on the C version of the decimal module

After looking at the current progress in converting the decimal module to C, Raymond Hettinger suggested that rather than using the Python implementation as an outline of the C implementation, a separate C implementation should be developed and then later wrapped as necessary to provide the Python APIs. Tim Peters explained their incremental approach: leaving most of the module written in Python, and converting methods to C code one at a time. Raymond had originally supported this approach, but after viewing the current C code, thought that it would result in C code that was too complex and convoluted.

There was some extended discussion on the mechanism in the current decimal module for holding flags, which uses a dict mapping error types to the counts of their occurrences. Raymond in particular wanted the C decimal module to be able to change this API if it was too complex to implement. A number of others agreed that the API had been a bad decision, and it looked like there would at least be a note in the documentation for Python 2.5 suggesting that users should not rely on the counting feature.

Contributing thread:

- `Strategy for converting the decimal module to C <>`__

PEP 357: Integer clipping and __index__

Armin Rigo pointed out that the current implementation of ``__index__()`` was incorrectly truncating long integers::

    >>> (2**100).__index__()

As the original ``__index__()`` method was intended only to allow things other than plain Python ints as slice indices, truncating to the maximum value was fine. However, when ``__index__()`` also became the "can you faithfully act like an integer" check, this truncation was no longer acceptable. Nick Coghlan spent some time reworking the `PEP 357`_ C API so that all the use cases of ``__index__()`` were covered. His `patch for fixing __index__`_ changes the nb_index slot to return a PyInt or PyLong instead of a C int, and introduces the C API functions PyNumber_Index, PyNumber_AsSsize_t and PyNumber_AsClippedSsize_t(), all of which have an output variable signifying whether or not the object they received had an ``__index__`` method.

.. _PEP 357:
.. _patch for fixing __index__:

Contributing thread:

- `Bad interaction of __index__ and sequence repeat <>`__

PEP 302: Non-importer objects on sys.path_importer_cache

Phillip J. Eby asked about how to best fix the non-PEP-302 compliant changes to the import machinery made by the Need for Speed Sprint. `PEP 302`_ indicates that everything on sys.path_importer_cache should be either None or a valid importer object, but the Need for Speed changes added True and False values to that as well. After getting approval to make the appropriate changes necessary to stay PEP-302-compliant, Phillip added ``imp.NullImporter`` to replace False values, and kept ``None`` to mean that the builtin import machinery should be used.

.. _PEP 302:

Contributing threads:

- `Undocumented PEP 302 protocol change by need-for-speed sprint <>`__
- `Release manager pronouncement needed: PEP 302 Fix <>`__

Running the test suites of user projects when Python is updated

Grig Gheorghiu volunteered to do some of the work to get community buildbots running, that is, buildbots running the test suites of Python user projects whenever the Python core repository was updated. People were quite enthusiastic and Martin v. Lowis offered to set up a post-commit
hook on the python repository to trigger a build on Grig's buildbots if necessary.

Contributing threads:

- `Community buildbots <>`__
- `Community buildbots (was Re: User's complaints) <>`__
- `Community buildbots -- reprise <>`__

Safe dumper/loader using Python syntax

Sylvain Fourmanoit presented his miniconf_ module which is a safe and cross-version dumper/loader for simple objects using the Python syntax. People generally liked the module, and Phillip J. Eby helped Sylvain clean up the implementation a bit. There was some discussion of including it in the Python 2.6 stdlib and perhaps Bob Ippolito's simplejson_ module alongside it.

.. _miniconf:
.. _simplejson:

Contributing threads:

- `New miniconf module <>`__
- `JSON implementation in Python 2.6 <>`__

Programmatically sending Ctrl-C

In testing his `patch to make sockets and Ctrl-C play nicely`_, Tony Nelson found that he needed a portable way to send a Ctrl-C-like signal. For Unix, he was using ``signal.alarm``, but was wondering if there was a way to get something similar on Windows. Martin v. Lowis pointed out GenerateConsoleCtrlEvent, but also noted that this would send the Ctrl-C to all processes. In the end, Tony decided to punt on Windows, and just stick with the Unix tests. 

.. _patch to make sockets and Ctrl-C play nicely:

Contributing threads:

- `Socket Timeouts patch 1519025 <>`__
- `Testing Socket Timeouts patch 1519025 <>`__

Documenting performance of container types

Neal Becker asked about documentation the performance of the basic Python container types, e.g. that lookup in a dict is O(1) and deletion from the beginning of a list is O(N). A number of people agreed that having such information would be helpful, but there was some concern that Guido should be the one to decide what performances guarantees were made by the language, and not just the CPython implementation. The discussion trailed off before any final decisions on how to update the documentation were made.

Contributing thread:

- `Document performance requirements? <>`__

Running the uuid test suite

Georg Brandl fixed a bug that was causing the new uuid module's test suite not to run at all. The resulting tests indicated a number of problems in determining a MAC address.  Neal Norwitz patched the uuid module so that it should work at least on Linux, Tru64, Solaris, and HP-UX, and Tim Peters patched it so that test_uuid no longer thinks that the uuid module knows multiple ways of getting a well-defined MAC address (which it doesn't on Windows).

Contributing threads:

- `uuid test suite failing <>`__
- `how about adding ping's uuid module to the standard lib ? <>`__
- `Another uuid problem <>`__
- `test_uuid <>`__

CPython and checking for NULL values

Neal Norwitz took a look at some of the issues raised by the automatic analysis of Python's source code offered by Klocwork_. There was a fairly long discussion around a Py_XINCREF of a variable that was required by the documentation to be non-NULL (and thus the "X" is unnecessary). There was some suggestion of trying to check for NULL values anyway, but the rest of Python doesn't do such checks.

.. _Klocwork:

Contributing thread:

- `remaining issues from Klocwork static analysis <>`__

Excluding certain constructs from Python code

Boris Borcic suggested that to make changing version of Python easier, style sheets should be introduced such that you could allow or disallow particular constructs that you liked or didn't like.  People thought this was generally a very bad idea as it would essentially introduce a bunch of language variants, and coders might not be able to read each others' source code without first applying the appropriate transformation.

Contributing threads:

- `Python Style Sheets ? Re: User's complaints <>`__
- `Python Style Sheets ? Re: User's complaints <>`__

Making attributes with leading single underscores private

David Hopwood proposed enforcing the `PEP 8`_ convention that attributes with a single underscore are private to that object. His approach revolved around allowing only the first argument of a function to access attributes starting with '_', but Armin Rigo and others felt that this was not likely to be enforceable, giving an example where subclassing allowed access to supposedly private attributes. People generally felt that without an implementation to back up the proposal, there wasn't much to discuss.

.. _PEP 8:

Contributing thread:

- `Internal namespace proposal <>`__

Loading module attributes on demand

In order to reduce the memory consumption of GTK+ applications written in Python, Johan Dahlin was looking into dynamically generating module attributes so that they would only be loaded when the application actually accessed them. He was able to produce this behavior by subclassing ModuleType, overridding __getattribute__, and then putting this object onto sys.path, but he felt like this was kind of a hackish solution. Phillip J. Eby pointed out the importing_ package and said that the __getattribute__ approach was generally okay, though it would cause problems for pydoc and inspect which don't handle subclasses of ModuleType well. Andrew Bennetts pointed out mercurial's demandload_ which allows modules to be imported on demand, but this didn't really solve Johan's problem because all attributes of the modules themselves were still imported at the same time.

.. _importing:
.. _demandload:;file=mercurial/

Contributing thread:

- `Dynamic module namspaces <>`__

Improving the Python test suite

Matt Fleming has put together `a wiki page`_ indicating the tests that are currently missing from Python's test suite, as well as the tests that are incomplete. He plans on working his way through the list when he gets some time, but help for any of the tests is quite welcome.

.. _a wiki page:

Contributing thread:

- `Improving unit tests for the standard library <>`__

Improving the Python documentation

Georg Brandl, referring to `bug 469773`_, suggested that python gain a "Using Python" page containing the man page and how to invoke the interpreter. He also suggested that creating a list of frequently needed documentation sections that are hard to find for newbies could go a long way towards making the Python documentation more user-friendly.

.. _bug 469773:

Contributing thread:

- `Using Python docs <>`__

Deferred Threads
- `struct module and coercing floats to integers <>`__
- `Rounding float to int directly (Re: struct module and coercing floats to integers) <>`__

Previous Summaries
- `Support for PyGetSetDefs in pydoc <>`__

Skipped Threads
- `Problem with super() usage <>`__
- `Pronouncement on SF #1520294 sought <>`__
- `I have submitted a patch that implement IrDA socket support . <>`__
- `User's complaints <>`__
- `Pickling objects that return string from reduce <>`__
- `[Python-checkins] r50708 - in python/trunk: Lib/test/ Misc/NEWS Python/pystate.c <>`__
- `Python sprint in NY and CA, Aug. 21-24 <>`__
- `Weekly Python Patch/Bug Summary <>`__
- `os.utime and os.chmod failures (etc) Python 2.5b2 <>`__
- `FW: Bug? Certainly a new *behavior* from subprocess in 2.5 on Win32 <>`__
- `Behavior change in <>`__
- `segfault when using PyGILState_Ensure/Release in Python2.3.4 <>`__
- `Ireland PyPy sprint 21th-27th August 2006 <>`__
- `Python 2.4, VS 2005 & Profile Guided Optmization <>`__
- `Python sprint in Arlington July 29/30 <>`__
- ` and cross-compiling <>`__
- `2.5: uses of sys.exc_type, exc_value <>`__
- `[Windows, buildbot] kill_python.c mystery <>`__
- `patch for mbcs codec (again) <>`__
- `Which version of distutils to ship with Python 2.5? <>`__
- `Patch for building ctypes on more OpenBSD target platforms <>`__
- `Release manager: pdb bugfix incompatibility <>`__
- `patching pydoc? <>`__
- `Fwd: patching pydoc? <>`__
- `Patch Against shutil.copytree Bug <>`__
- `httplib and bad response chunking <>`__
- `cgi.FieldStorage DOS (sf bug #1112549) <>`__
- `Eliminating loops <>`__


This is a summary of traffic on the `python-dev mailing list`_ from
July 16, 2006 through July 31, 2006.
It is intended to inform the wider Python community of on-going
developments on the list on a semi-monthly basis.  An archive_ of
previous summaries is available online.

An `RSS feed`_ of the titles of the summaries is available.
You can also watch comp.lang.python or comp.lang.python.announce for
new summaries (or through their email gateways of python-list or
python-announce, respectively, as found at

This python-dev summary is the 9th written by Steve Bethard. 

To contact me, please send email:

- Steve Bethard (steven.bethard at

Do *not* post to comp.lang.python if you wish to reach me.

The `Python Software Foundation`_ is the non-profit organization that
holds the intellectual property for Python.  It also tries to advance 
the development and use of Python.  If you find the python-dev Summary
helpful please consider making a donation.  You can make a donation at .  Every cent counts so even a
small donation with a credit card, check, or by PayPal helps.  

Commenting on Topics

To comment on anything mentioned here, just post to
`comp.lang.python`_ (or email python-list at which is a
gateway to the newsgroup) with a subject line mentioning what you are
discussing.  All python-dev members are interested in seeing ideas
discussed by the community, so don't hesitate to take a stance on
something.  And if all of this really interests you then get involved
and join `python-dev`_!

How to Read the Summaries

That this summary is written using reStructuredText_. Any unfamiliar
punctuation is probably markup for reST_ (otherwise it is probably
regular expression syntax or a typo :); you can safely ignore it.  We
do suggest learning reST, though; it's simple and is accepted for
`PEP markup`_ and can be turned into many different formats like HTML
and LaTeX.

.. _python-dev:
.. _SourceForge:
.. _python-dev mailing list:
.. _comp.lang.python:
.. _PEP Markup:

.. _Docutils:
.. _reST:
.. _reStructuredText:
.. _PSF:
.. _Python Software Foundation:

.. _archive:
.. _RSS feed:

More information about the Python-announce-list mailing list