DAGDA SEARCH | Back to results | Support

Mailman 3 November 2009 - Python-Dev - python.org

Source: https://mail.python.org/archives/list/python-dev@python.org/2009/11/

Keyboard Shortcuts

Thread View

Python-Dev

Download Threads by month python-dev@python.org

November 2009

PEP 1, PEP Purpose and Guidelines
by barry@zope.com May 18, 2021
May 18, 2021 It has been a while since I posted a copy of PEP 1 to the mailing lists and newsgroups. I've recently done some updating of a few sections, so in the interest of gaining wider community participation in the Python development process, I'm posting the latest revision of PEP 1 here. A version of the PEP is always available on-line at http://www.python.org/peps/pep-0001.html Enjoy, -Barry -------------------- snip snip -------------------- PEP: 1 Title: PEP Purpose and Guidelines Version: $Revision: 1.36 $ Last-Modified: $Date: 2002/07/29 18:34:59 $ Author: Barry A. Warsaw, Jeremy Hylton Status: Active Type: Informational Created: 13-Jun-2000 Post-History: 21-Mar-2001, 29-Jul-2002 What is a PEP? PEP stands for Python Enhancement Proposal. A PEP is a design document providing information to the Python community, or describing a new feature for Python. The PEP should provide a concise technical specification of the feature and a rationale for the feature. We intend PEPs to be the primary mechanisms for proposing new features, for collecting community input on an issue, and for documenting the design decisions that have gone into Python. The PEP author is responsible for building consensus within the community and documenting dissenting opinions. Because the PEPs are maintained as plain text files under CVS control, their revision history is the historical record of the feature proposal[1]. Kinds of PEPs There are two kinds of PEPs. A standards track PEP describes a new feature or implementation for Python. An informational PEP describes a Python design issue, or provides general guidelines or information to the Python community, but does not propose a new feature. Informational PEPs do not necessarily represent a Python community consensus or recommendation, so users and implementors are free to ignore informational PEPs or follow their advice. PEP Work Flow The PEP editor, Barry Warsaw <peps(a)python.org>, assigns numbers for each PEP and changes its status. The PEP process begins with a new idea for Python. It is highly recommended that a single PEP contain a single key proposal or new idea. The more focussed the PEP, the more successfully it tends to be. The PEP editor reserves the right to reject PEP proposals if they appear too unfocussed or too broad. If in doubt, split your PEP into several well-focussed ones. Each PEP must have a champion -- someone who writes the PEP using the style and format described below, shepherds the discussions in the appropriate forums, and attempts to build community consensus around the idea. The PEP champion (a.k.a. Author) should first attempt to ascertain whether the idea is PEP-able. Small enhancements or patches often don't need a PEP and can be injected into the Python development work flow with a patch submission to the SourceForge patch manager[2] or feature request tracker[3]. The PEP champion then emails the PEP editor <peps(a)python.org> with a proposed title and a rough, but fleshed out, draft of the PEP. This draft must be written in PEP style as described below. If the PEP editor approves, he will assign the PEP a number, label it as standards track or informational, give it status 'draft', and create and check-in the initial draft of the PEP. The PEP editor will not unreasonably deny a PEP. Reasons for denying PEP status include duplication of effort, being technically unsound, not providing proper motivation or addressing backwards compatibility, or not in keeping with the Python philosophy. The BDFL (Benevolent Dictator for Life, Guido van Rossum) can be consulted during the approval phase, and is the final arbitrator of the draft's PEP-ability. If a pre-PEP is rejected, the author may elect to take the pre-PEP to the comp.lang.python newsgroup (a.k.a. python-list(a)python.org mailing list) to help flesh it out, gain feedback and consensus from the community at large, and improve the PEP for re-submission. The author of the PEP is then responsible for posting the PEP to the community forums, and marshaling community support for it. As updates are necessary, the PEP author can check in new versions if they have CVS commit permissions, or can email new PEP versions to the PEP editor for committing. Standards track PEPs consists of two parts, a design document and a reference implementation. The PEP should be reviewed and accepted before a reference implementation is begun, unless a reference implementation will aid people in studying the PEP. Standards Track PEPs must include an implementation - in the form of code, patch, or URL to same - before it can be considered Final. PEP authors are responsible for collecting community feedback on a PEP before submitting it for review. A PEP that has not been discussed on python-list(a)python.org and/or python-dev(a)python.org will not be accepted. However, wherever possible, long open-ended discussions on public mailing lists should be avoided. Strategies to keep the discussions efficient include, setting up a separate SIG mailing list for the topic, having the PEP author accept private comments in the early design phases, etc. PEP authors should use their discretion here. Once the authors have completed a PEP, they must inform the PEP editor that it is ready for review. PEPs are reviewed by the BDFL and his chosen consultants, who may accept or reject a PEP or send it back to the author(s) for revision. Once a PEP has been accepted, the reference implementation must be completed. When the reference implementation is complete and accepted by the BDFL, the status will be changed to `Final.' A PEP can also be assigned status `Deferred.' The PEP author or editor can assign the PEP this status when no progress is being made on the PEP. Once a PEP is deferred, the PEP editor can re-assign it to draft status. A PEP can also be `Rejected'. Perhaps after all is said and done it was not a good idea. It is still important to have a record of this fact. PEPs can also be replaced by a different PEP, rendering the original obsolete. This is intended for Informational PEPs, where version 2 of an API can replace version 1. PEP work flow is as follows: Draft -> Accepted -> Final -> Replaced ^ +----> Rejected v Deferred Some informational PEPs may also have a status of `Active' if they are never meant to be completed. E.g. PEP 1. What belongs in a successful PEP? Each PEP should have the following parts: 1. Preamble -- RFC822 style headers containing meta-data about the PEP, including the PEP number, a short descriptive title (limited to a maximum of 44 characters), the names, and optionally the contact info for each author, etc. 2. Abstract -- a short (~200 word) description of the technical issue being addressed. 3. Copyright/public domain -- Each PEP must either be explicitly labelled as placed in the public domain (see this PEP as an example) or licensed under the Open Publication License[4]. 4. Specification -- The technical specification should describe the syntax and semantics of any new language feature. The specification should be detailed enough to allow competing, interoperable implementations for any of the current Python platforms (CPython, JPython, Python .NET). 5. Motivation -- The motivation is critical for PEPs that want to change the Python language. It should clearly explain why the existing language specification is inadequate to address the problem that the PEP solves. PEP submissions without sufficient motivation may be rejected outright. 6. Rationale -- The rationale fleshes out the specification by describing what motivated the design and why particular design decisions were made. It should describe alternate designs that were considered and related work, e.g. how the feature is supported in other languages. The rationale should provide evidence of consensus within the community and discuss important objections or concerns raised during discussion. 7. Backwards Compatibility -- All PEPs that introduce backwards incompatibilities must include a section describing these incompatibilities and their severity. The PEP must explain how the author proposes to deal with these incompatibilities. PEP submissions without a sufficient backwards compatibility treatise may be rejected outright. 8. Reference Implementation -- The reference implementation must be completed before any PEP is given status 'Final,' but it need not be completed before the PEP is accepted. It is better to finish the specification and rationale first and reach consensus on it before writing code. The final implementation must include test code and documentation appropriate for either the Python language reference or the standard library reference. PEP Template PEPs are written in plain ASCII text, and should adhere to a rigid style. There is a Python script that parses this style and converts the plain text PEP to HTML for viewing on the web[5]. PEP 9 contains a boilerplate[7] template you can use to get started writing your PEP. Each PEP must begin with an RFC822 style header preamble. The headers must appear in the following order. Headers marked with `*' are optional and are described below. All other headers are required. PEP: <pep number> Title: <pep title> Version: <cvs version string> Last-Modified: <cvs date string> Author: <list of authors' real names and optionally, email addrs> * Discussions-To: <email address> Status: <Draft | Active | Accepted | Deferred | Final | Replaced> Type: <Informational | Standards Track> * Requires: <pep numbers> Created: <date created on, in dd-mmm-yyyy format> * Python-Version: <version number> Post-History: <dates of postings to python-list and python-dev> * Replaces: <pep number> * Replaced-By: <pep number> The Author: header lists the names and optionally, the email addresses of all the authors/owners of the PEP. The format of the author entry should be address(a)dom.ain (Random J. User) if the email address is included, and just Random J. User if the address is not given. If there are multiple authors, each should be on a separate line following RFC 822 continuation line conventions. Note that personal email addresses in PEPs will be obscured as a defense against spam harvesters. Standards track PEPs must have a Python-Version: header which indicates the version of Python that the feature will be released with. Informational PEPs do not need a Python-Version: header. While a PEP is in private discussions (usually during the initial Draft phase), a Discussions-To: header will indicate the mailing list or URL where the PEP is being discussed. No Discussions-To: header is necessary if the PEP is being discussed privately with the author, or on the python-list or python-dev email mailing lists. Note that email addresses in the Discussions-To: header will not be obscured. Created: records the date that the PEP was assigned a number, while Post-History: is used to record the dates of when new versions of the PEP are posted to python-list and/or python-dev. Both headers should be in dd-mmm-yyyy format, e.g. 14-Aug-2001. PEPs may have a Requires: header, indicating the PEP numbers that this PEP depends on. PEPs may also have a Replaced-By: header indicating that a PEP has been rendered obsolete by a later document; the value is the number of the PEP that replaces the current document. The newer PEP must have a Replaces: header containing the number of the PEP that it rendered obsolete. PEP Formatting Requirements PEP headings must begin in column zero and the initial letter of each word must be capitalized as in book titles. Acronyms should be in all capitals. The body of each section must be indented 4 spaces. Code samples inside body sections should be indented a further 4 spaces, and other indentation can be used as required to make the text readable. You must use two blank lines between the last line of a section's body and the next section heading. You must adhere to the Emacs convention of adding two spaces at the end of every sentence. You should fill your paragraphs to column 70, but under no circumstances should your lines extend past column 79. If your code samples spill over column 79, you should rewrite them. Tab characters must never appear in the document at all. A PEP should include the standard Emacs stanza included by example at the bottom of this PEP. A PEP must contain a Copyright section, and it is strongly recommended to put the PEP in the public domain. When referencing an external web page in the body of a PEP, you should include the title of the page in the text, with a footnote reference to the URL. Do not include the URL in the body text of the PEP. E.g. Refer to the Python Language web site [1] for more details. ... [1] http://www.python.org When referring to another PEP, include the PEP number in the body text, such as "PEP 1". The title may optionally appear. Add a footnote reference that includes the PEP's title and author. It may optionally include the explicit URL on a separate line, but only in the References section. Note that the pep2html.py script will calculate URLs automatically, e.g.: ... Refer to PEP 1 [7] for more information about PEP style ... References [7] PEP 1, PEP Purpose and Guidelines, Warsaw, Hylton http://www.python.org/peps/pep-0001.html If you decide to provide an explicit URL for a PEP, please use this as the URL template: http://www.python.org/peps/pep-xxxx.html PEP numbers in URLs must be padded with zeros from the left, so as to be exactly 4 characters wide, however PEP numbers in text are never padded. Reporting PEP Bugs, or Submitting PEP Updates How you report a bug, or submit a PEP update depends on several factors, such as the maturity of the PEP, the preferences of the PEP author, and the nature of your comments. For the early draft stages of the PEP, it's probably best to send your comments and changes directly to the PEP author. For more mature, or finished PEPs you may want to submit corrections to the SourceForge bug manager[6] or better yet, the SourceForge patch manager[2] so that your changes don't get lost. If the PEP author is a SF developer, assign the bug/patch to him, otherwise assign it to the PEP editor. When in doubt about where to send your changes, please check first with the PEP author and/or PEP editor. PEP authors who are also SF committers, can update the PEPs themselves by using "cvs commit" to commit their changes. Remember to also push the formatted PEP text out to the web by doing the following: % python pep2html.py -i NUM where NUM is the number of the PEP you want to push out. See % python pep2html.py --help for details. Transferring PEP Ownership It occasionally becomes necessary to transfer ownership of PEPs to a new champion. In general, we'd like to retain the original author as a co-author of the transferred PEP, but that's really up to the original author. A good reason to transfer ownership is because the original author no longer has the time or interest in updating it or following through with the PEP process, or has fallen off the face of the 'net (i.e. is unreachable or not responding to email). A bad reason to transfer ownership is because you don't agree with the direction of the PEP. We try to build consensus around a PEP, but if that's not possible, you can always submit a competing PEP. If you are interested assuming ownership of a PEP, send a message asking to take over, addressed to both the original author and the PEP editor <peps(a)python.org>. If the original author doesn't respond to email in a timely manner, the PEP editor will make a unilateral decision (it's not like such decisions can be reversed. :). References and Footnotes [1] This historical record is available by the normal CVS commands for retrieving older revisions. For those without direct access to the CVS tree, you can browse the current and past PEP revisions via the SourceForge web site at http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/python/nondist/peps/?cvsroot=… [2] http://sourceforge.net/tracker/?group_id=5470&atid=305470 [3] http://sourceforge.net/tracker/?atid=355470&group_id=5470&func=browse [4] http://www.opencontent.org/openpub/ [5] The script referred to here is pep2html.py, which lives in the same directory in the CVS tree as the PEPs themselves. Try "pep2html.py --help" for details. The URL for viewing PEPs on the web is http://www.python.org/peps/ [6] http://sourceforge.net/tracker/?group_id=5470&atid=305470 [7] PEP 9, Sample PEP Template http://www.python.org/peps/pep-0009.html Copyright This document has been placed in the public domain. Local Variables: mode: indented-text indent-tabs-mode: nil sentence-end-double-space: t fill-column: 70 End: 8 14 Reviving restricted mode?
by Guido van Rossum Aug. 14, 2014

Aug. 14, 2014 I've received some enthusiastic emails from someone who wants to revive restricted mode. He started out with a bunch of patches to the CPython runtime using ctypes, which he attached to an App Engine bug: http://code.google.com/p/googleappengine/issues/detail?id=671 Based on his code (the file secure.py is all you need, included in secure.tar.gz) it seems he believes the only security leaks are __subclasses__, gi_frame and gi_code. (I have since convinced him that if we add "restricted" guards to these attributes, he doesn't need the functions added to sys.) I don't recall the exploits that Samuele once posted that caused the death of rexec.py -- does anyone recall, or have a pointer to the threads? -- --Guido van Rossum (home page: http://www.python.org/~guido/) 19 35 PEP 3145 (With Contents)
by Eric Pruitt Dec. 25, 2012

Dec. 25, 2012 Alright, I will re-submit with the contents pasted. I never use double backquotes as I think them rather ugly; that is the work of an editor or some automated program in the chain. Plus, it also messed up my line formatting and now I have lines with one word on them... Anyway, the contents of PEP 3145: PEP: 3145 Title: Asynchronous I/O For subprocess.Popen Author: (James) Eric Pruitt, Charles R. McCreary, Josiah Carlson Type: Standards Track Content-Type: text/plain Created: 04-Aug-2009 Python-Version: 3.2 Abstract: In its present form, the subprocess.Popen implementation is prone to dead-locking and blocking of the parent Python script while waiting on data from the child process. Motivation: A search for "python asynchronous subprocess" will turn up numerous accounts of people wanting to execute a child process and communicate with it from time to time reading only the data that is available instead of blocking to wait for the program to produce data [1] [2] [3]. The current behavior of the subprocess module is that when a user sends or receives data via the stdin, stderr and stdout file objects, dead locks are common and documented [4] [5]. While communicate can be used to alleviate some of the buffering issues, it will still cause the parent process to block while attempting to read data when none is available to be read from the child process. Rationale: There is a documented need for asynchronous, non-blocking functionality in subprocess.Popen [6] [7] [2] [3]. Inclusion of the code would improve the utility of the Python standard library that can be used on Unix based and Windows builds of Python. Practically every I/O object in Python has a file-like wrapper of some sort. Sockets already act as such and for strings there is StringIO. Popen can be made to act like a file by simply using the methods attached the the subprocess.Popen.stderr, stdout and stdin file-like objects. But when using the read and write methods of those options, you do not have the benefit of asynchronous I/O. In the proposed solution the wrapper wraps the asynchronous methods to mimic a file object. Reference Implementation: I have been maintaining a Google Code repository that contains all of my changes including tests and documentation [9] as well as blog detailing the problems I have come across in the development process [10]. I have been working on implementing non-blocking asynchronous I/O in the subprocess.Popen module as well as a wrapper class for subprocess.Popen that makes it so that an executed process can take the place of a file by duplicating all of the methods and attributes that file objects have. There are two base functions that have been added to the subprocess.Popen class: Popen.send and Popen._recv, each with two separate implementations, one for Windows and one for Unix based systems. The Windows implementation uses ctypes to access the functions needed to control pipes in the kernel 32 DLL in an asynchronous manner. On Unix based systems, the Python interface for file control serves the same purpose. The different implementations of Popen.send and Popen._recv have identical arguments to make code that uses these functions work across multiple platforms. When calling the Popen._recv function, it requires the pipe name be passed as an argument so there exists the Popen.recv function that passes selects stdout as the pipe for Popen._recv by default. Popen.recv_err selects stderr as the pipe by default. "Popen.recv" and "Popen.recv_err" are much easier to read and understand than "Popen._recv('stdout' ..." and "Popen._recv('stderr' ..." respectively. Since the Popen._recv function does not wait on data to be produced before returning a value, it may return empty bytes. Popen.asyncread handles this issue by returning all data read over a given time interval. The ProcessIOWrapper class uses the asyncread and asyncwrite functions to allow a process to act like a file so that there are no blocking issues that can arise from using the stdout and stdin file objects produced from a subprocess.Popen call. References: [1] [ python-Feature Requests-1191964 ] asynchronous Subprocess http://mail.python.org/pipermail/python-bugs-list/2006-December/ 036524.html [2] Daily Life in an Ivory Basement : /feb-07/problems-with-subprocess http://ivory.idyll.org/blog/feb-07/problems-with-subprocess [3] How can I run an external command asynchronously from Python? - Stack Overflow http://stackoverflow.com/questions/636561/how-can-i-run-an-external- command-asynchronously-from-python [4] 18.1. subprocess - Subprocess management - Python v2.6.2 documentation http://docs.python.org/library/subprocess.html#subprocess.Popen.wait [5] 18.1. subprocess - Subprocess management - Python v2.6.2 documentation http://docs.python.org/library/subprocess.html#subprocess.Popen.kill [6] Issue 1191964: asynchronous Subprocess - Python tracker http://bugs.python.org/issue1191964 [7] Module to allow Asynchronous subprocess use on Windows and Posix platforms - ActiveState Code http://code.activestate.com/recipes/440554/ [8] subprocess.rst - subprocdev - Project Hosting on Google Code http://code.google.com/p/subprocdev/source/browse/doc/subprocess.rst?spec=s… [9] subprocdev - Project Hosting on Google Code http://code.google.com/p/subprocdev [10] Python Subprocess Dev http://subdev.blogspot.com/ Copyright: This P.E.P. is licensed under the Open Publication License; http://www.opencontent.org/openpub/. On Tue, Sep 8, 2009 at 22:56, Benjamin Peterson <benjamin(a)python.org> wrote: > 2009/9/7 Eric Pruitt <eric.pruitt(a)gmail.com>: >> Hello all, >> >> I have been working on adding asynchronous I/O to the Python >> subprocess module as part of my Google Summer of Code project. Now >> that I have finished documenting and pruning the code, I present PEP >> 3145 for its inclusion into the Python core code. Any and all feedback >> on the PEP (http://www.python.org/dev/peps/pep-3145/) is appreciated. > > Hi Eric, > One of the reasons you're not getting many response is that you've not > pasted the contents of the PEP in this message. That makes it really > easy for people to comment on various sections. > > BTW, it seems like you were trying to use reST formatting with the > text PEP layout. Double backquotes only mean something in reST. > > > -- > Regards, > Benjamin > 10 26 http://www.pythonlabs.com/logos.html is gone
by Georg Brandl Feb. 8, 2011

Feb. 8, 2011 Which I noticed since it's cited in the BeOpen license we still refer to in LICENSE. Since pythonlabs.com itself is still up, it probably isn't much work to make the logos.html URI work again, but I don't know who maintains that page. cheer, Georg -- Thus spake the Lord: Thou shalt indent with four spaces. No more, no less. Four shall be the number of spaces thou shalt indent, and the number of thy indenting shall be four. Eight shalt thou not indent, nor either indent thou two, excepting that thou then proceed to four. Tabs are right out. 2 3 Problems with hex-conversion functions
by Ender Wiggin Oct. 2, 2010

Oct. 2, 2010 Hello everyone. I see several problems with the two hex-conversion function pairs that Python offers: 1. binascii.hexlify and binascii.unhexlify 2. bytes.fromhex and bytes.hex Problem #1: bytes.hex is not implemented, although it was specified in PEP 358. This means there is no symmetrical function to accompany bytes.fromhex. Problem #2: Both pairs perform the same function, although The Zen Of Python suggests that "There should be one-- and preferably only one --obvious way to do it." I do not understand why PEP 358 specified the bytes function pair although it mentioned the binascii pair... Problem #3: bytes.fromhex may receive spaces in the input string, although binascii.unhexlify may not. I see no good reason for these two functions to have different features. Problem #4: binascii.unhexlify may receive both input types: strings or bytes, whereas bytes.fromhex raises an exception when given a bytes parameter. Again there is no reason for these functions to be different. Problem #5: binascii.hexlify returns a bytes type - although ideally, converting to hex should always return string types and converting from hex should always return bytes. IMO there is no meaning of bytes as an output of hexlify, since the output is a representation of other bytes. This is also the suggested behavior of bytes.hex in PEP 358 Problems #4 and #5 call for a decision about the input and output of the functions being discussed: Option A : Strict input and output unhexlify (and bytes.fromhex) may only receives string and may only return bytes hexlify (and bytes.hex) may only receives bytes and may only return strings Option B : Robust input and strict output unhexlify (and bytes.fromhex) may receive bytes and strings and may only return bytes hexlify (and bytes.hex) may receive bytes or strings and may only return strings Of course we may also consider a third option, which will allow the return type of all functions to be robust (perhaps specified in a keyword argument), but as I wrote in the description of problem #5, I see no sense in that. Note that PEP 3137 describes: "... the more strict definitions of encoding and decoding in Python 3000: encoding always takes a Unicode string and returns a bytes sequence, and decoding always takes a bytes sequence and returns a Unicode string." - suggesting option A. To repeat problems #4 and #5, the current behavior does not match any option: * The return type of binascii.hexlify should be string, and this is not the current behavior. As for the input: * Option A is not the current behavior because binascii.unhexlify may receive both input types. * Option B is not the current behavior because bytes.fromhex does not allow bytes as input. To fix these issues, three changes should be applied: 1. Deprecate bytes.fromhex. This fixes the following problems: #4 (go with option B and remove the function that does not allow bytes input) #2 (the binascii functions will be the only way to "do it") #1 (bytes.hex should not be implemented) 2. In order to keep the functionality that bytes.fromhex has over unhexlify, the latter function should be able to handle spaces in its input (fix #3) 3. binascii.hexlify should return string as its return type (fix #5) 5 7 Making loggerClass an attribute of the logger manager?
by Georg Brandl Feb. 6, 2010

Feb. 6, 2010 Hi, recently I had a use case where I wanted to use logging in two completely separate parts of the same process. One of them needs to create instances a specific Logger subclass, while the other is fine with the default loggers. I got around the problem of the unique root node by using two Managers (and then using Manager.getLogger() instead of getLogger()), but I can only set the loggerClass globally. Making the loggerClass configurable per manager would solve the problem for me, and AFAICS since most applications don't use different managers anyway, there should not be any detrimental effects. What do you think? cheers, Georg 2 2 wpython is back
by Cesare Di Mauro Dec. 3, 2009

Dec. 3, 2009 Hi Mart I'm back with some news about wpython. I completed all the work that I was committed to do till the end of the year. I made a lot of changes to the code, that I'll report here. First, I added several conditional compilation sections that enable or disable almost every optimization I introduced into the project. Everything is controlled by a new include file, wpython.h, which holds a lot of #DEFINEs for each one of them. Every #DEFINE has a brief explanation, and some report an example with Python code disassembled, showing what happens. It can be useful both to document the code (also to access to the interested parts), and to let people test the effect of all optimizations. There are also a couple of #DEFINEs which are useful to enable or disable all superinstructions, or to make wpython work like CPython (with all new optimizations and superinstructions disabled). Full tracing support required a big effort, due to the missing SETUP_LOOP/POP_BLOCK instructions used in FOR_ITER blocks. It was a pain in the neck to let them work, but I think I have found a good solution fot it. If I remember correctly, Collin asked in the past about performance with testing enabled. I believe that speed is comparable to CPython, since I can trace FOR_ITER blocks enter/exit with very little time spent intercepting them; stack unrolling (for forward jumps cases) is fast too. Restoring Python object model required much of the work. I reverted all the changes that I made to many PyObjects, and just added some accessory code only to a few of them. There are no more hacks, and code is quite polite; only CodeObject required one line of code change in the hash function, to let it calculate hash correctly for the constants tuple (because it can hold lists and dictionaries now, which usally aren't hashable). Every file in Include/ and Objects/ that I modified has only 1 diff (except frameobject.c, for tracing code), so it's easy so see what is changed and the extra helper functions that I added to introduce lists and dictionaries in the consts tuple. In the meanwhile I've added a little optimization for lists and dictionaries used in for loops. Writing this: def f(): for x in ['a', 'b', 'c']: print x generates the following (word)code with the previous wpython: LOAD_CONST (['a', 'b', 'c']) DEEP_LIST_COPY GET_ITER FOR_ITER because ['a', 'b', 'c'] is a mutable object, and a copy must be made before using it. Now it'll be: LOAD_CONST (['a', 'b', 'c']) GET_ITER FOR_ITER So code is reduced and memory consumption too, because there's no need clone the list. The trick works only for lists and dictionaries that holds non-mutable objects, but I found it's a common pattern in Python code. I've also updated the source to the latest Python 2.x version, 2.6.4. All tests pass, both with Debug and Release code, on Visual Studio Express with 32 bit code (I can't compile 64 bits versions with it). There are only a few open issues. test_syntax.py required some changes in the doctest (adding full filesystem path) to let them pass correctly. It's really strange, but... works now! test_compile.py has 2 tests disabled in test_compile_ast: #['<forblock>', """for n in [1, 2, 3]:\n print n\n"""], #[fname, fcontents], that's because there's no support for constants (except Num_kind and Str_kind) in the current ASTs code. However code compiles well, except that it cannot make use of the new constant folding code. I haven't updated Doc/library/dis.rst, which is exactly the same of CPython. I'll do it when I stop introducing or changing opcodes. Right now wpython requires manual patching of Include/Python-ast.h, with the following lines: enum _expr_kind {BoolOp_kind=1, BinOp_kind=2, UnaryOp_kind=3, Lambda_kind=4, [...] List_kind=18, Tuple_kind=19, Const_kind=20}; enum _expr_const {no_const=0, mutable_const=1, content_const=3, pure_const=7}; struct _expr { enum _expr_kind kind; union { [...] struct { object c; enum _expr_const constant; } Const; } v; int lineno; int col_offset; }; They are need to let ast.c handle constants for the new constant folding code. I greatly appreciate any help to let it be generated automatically with ASDL grammar. That's all about the new code. Now the weird and stupid part. A few days I got a new gmail account, but accidentally I removed the google account that I've used to create the wpython at Google Code. I definitely lost project ownership, so I can't tag the old code and put the new one in trunk. I'll thank very much if someone that works or has contacts with Google can ask for moving ownership from my old account (cesare at pronto do it) to my new (the one which I've using now to write this mail), so I'll commit ASAP. Alternatively, I need to create a new project at Google Code. I hope that the community will appreciate the work (when I'll upload it :-). I know that it's a young project, but I think it's mature enough to take a look at it. Last but not least, think about it like a starting point. I have many ideas on how to optimize several other parts of Python, and the wordcode structure gives me rooms to do it in an elegant and efficient way thanks to the superinstructions (when needed). For the next release I plan to cleanup opcode.h and ceval.c, grouping some instructions into single superinstructions (CALL_FUNCTIONs and IMPORT_NAME), adding a few opcodes, and tweaking a bit the VM main loop (primarily targeted to reduce the jump-table that compilers produce for the big switch statement). Then I'll consider porting it to python 2.7 and/or python 3.1/3.2 if there'll be interest and feedbacks about it. I'm also at your disposal to discuss any detail about wpython source code, since I know that it isn't a simple patch to apply to some files. Cheers, Cesare 2009/11/4 Mart Sõmermaa <mrts.pydev(a)gmail.com> > Thanks for the recap and for the good work on wpython! > > Best, eagerly waiting for the results of your work to land in mainline > python, > MS > 4 6 PyCon 2010 registration open! (Early-bird Jan 6)
by Aahz Nov. 30, 2009

Nov. 30, 2009 PyCon 2010 registration has opened! Register by January 6 for the best rates! http://us.pycon.org/2010/registration/ Registering early gets you early-bird registration rates, guarantees you the tutorials you want, and helps the PyCon volunteers plan better. Scheduled talk and tutorial lists: http://us.pycon.org/2010/conference/talks/ http://us.pycon.org/2010/tutorials/ We'll see you in Atlanta! Spread the word! -- Aahz (aahz(a)pythoncraft.com) <*> http://www.pythoncraft.com/ The best way to get information on Usenet is not to ask a question, but to post the wrong information. 1 0 /trunk test_distutils failing on Mac OS X 10.5
by C. Titus Brown Nov. 29, 2009

Nov. 29, 2009 Hi all, /trunk test_distutils is failing with the following error on Mac OS X 10.5: Here's the error: test_distutils test test_distutils failed -- Traceback (most recent call last): File "/private/tmp/tmp8UfLPT/python27/Lib/distutils/tests/test_sdist.py", line 342, in test_make_distribution_owner_group self.assertEquals(member.gid, os.getgid()) AssertionError: 0 != 20 It has been a problem for over a week, perhaps longer. I've filed it as: http://bugs.python.org/issue7408 ... So why am I posting this to python-dev? I went to double-check this on the buildbots and noticed that there aren't any Mac OS X buildbots. I would be happy to give one or two people remote access to my Mac OS X 10.5 iMac if someone wanted to set up a buildbot and/or debug this issue further. Tarek, I can give you access immediately through your lyorn account, too. cheers, --titus -- C. Titus Brown, ctb(a)msu.edu 6 8 Summary of Python tracker Issues
by Python tracker Nov. 27, 2009

Nov. 27, 2009 ACTIVITY SUMMARY (11/20/09 - 11/27/09) 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. 2506 open (+19) / 16719 closed (+14) / 19225 total (+33) Open issues with patches: 999 Average duration of open issues: 689 days. Median duration of open issues: 444 days. Open Issues Breakdown open 2471 (+19) pending 34 ( +0) Issues Created Or Reopened (34) _______________________________ multiprocessing logging support test 11/24/09 http://bugs.python.org/issue6615 reopened jnoller patch Windows 64-bit build "skips" several projects in VS 2008 11/20/09 CLOSED http://bugs.python.org/issue7371 created srid Regression in pstats 11/21/09 http://bugs.python.org/issue7372 created belopolsky patch Use PyModule_AddIntMacro() in Modules/gcmodule.c 11/21/09 CLOSED http://bugs.python.org/issue7373 created jon patch Property accessor/getter called twice 11/22/09 CLOSED http://bugs.python.org/issue7374 created mliddle 2to3 - does not translate urllib2 to urllib.request correctly fo 11/22/09 CLOSED http://bugs.python.org/issue7375 created orsenthil "python -m doctest" results in FAIL: Doctest: __main__.DebugRunn 11/22/09 http://bugs.python.org/issue7376 created flox patch Slight difference: math.floor returns an Integral 11/22/09 CLOSED http://bugs.python.org/issue7377 created flox unexpected truncation of traceback 11/23/09 http://bugs.python.org/issue7378 created ghewgill patch Docstring for fractions.Fraction.limit_denominator fails 11/23/09 CLOSED http://bugs.python.org/issue7379 created flox uuid.UUID.bytes gives a bytearray() instead of bytes 11/23/09 http://bugs.python.org/issue7380 created flox patch subprocess.check_output: "docstring has inconsistent leading whi 11/23/09 http://bugs.python.org/issue7381 created flox patch bytes.__getnewargs__ is broken; copy.copy() therefore doesn't wo 11/23/09 http://bugs.python.org/issue7382 created sh patch, easy test_multiprocessing leaks 11/23/09 CLOSED http://bugs.python.org/issue7383 created pitrou test_curses crash on FreeBSD buildbots 11/23/09 http://bugs.python.org/issue7384 created mark.dickinson buildbot MemoryView_FromObject crashes if PyBuffer_GetBuffer fails 11/23/09 http://bugs.python.org/issue7385 created pv More precise document on os.path.normpath() 11/24/09 http://bugs.python.org/issue7386 created pengyu.ut More precise document on os.path.normpath() 11/24/09 CLOSED http://bugs.python.org/issue7387 created pengyu.ut Documentation: capitalizations of the word 'python' needed when 11/24/09 http://bugs.python.org/issue7388 created Retro easy Make decimal floating point be default, remove binary floating p 11/24/09 CLOSED http://bugs.python.org/issue7389 created Retro inconsistent type return 11/24/09 CLOSED http://bugs.python.org/issue7390 created surkamp Re-title the "Using Backslash to Continue Statements" anti-idiom 11/24/09 http://bugs.python.org/issue7391 created Horpner cPickle test failure on release26-maint branch 11/24/09 http://bugs.python.org/issue7392 created alexandre.vassalotti Executing Python program of sum of 2 nos. 11/25/09 CLOSED http://bugs.python.org/issue7393 created mayur78 sqlite3: some OperationalError exceptions should be ProgrammingE 11/25/09 http://bugs.python.org/issue7394 created dontbugme pstats add command raises unhandled exception 11/25/09 http://bugs.python.org/issue7395 created exarkun regrtest single: iterator not subscriptable 11/26/09 http://bugs.python.org/issue7396 created jgsack __import__ docs should reference importlib.import_module 11/26/09 http://bugs.python.org/issue7397 created ncoghlan easy Issue with _PyLong_Format while trying to build Python on HP-UX 11/26/09 CLOSED http://bugs.python.org/issue7398 created paulh_irl Possible bug in Python Tutorial 11/26/09 http://bugs.python.org/issue7399 created dh Small typo in Python's library documentation: set 11/26/09 CLOSED http://bugs.python.org/issue7400 created trovao patch os.write and os.close on pipe from separate threads hangs on Mac 11/26/09 http://bugs.python.org/issue7401 created hughsw reduce() is an anti-example in "Idioms and Anti-Idioms" 11/27/09 http://bugs.python.org/issue7402 created cito Race condition in logging._acquireLock()? 11/27/09 CLOSED http://bugs.python.org/issue7403 created allenap Issues Now Closed (34) ______________________ Traceback doesn't run back all the way 412 days http://bugs.python.org/issue4097 benjamin.peterson compilation of sqlite3 fails 400 days http://bugs.python.org/issue4158 brett.cannon urllib2 HTTPS connection failure (BadStatusLine Exception) 307 days http://bugs.python.org/issue5007 orsenthil easy multiprocessing example wrong 224 days http://bugs.python.org/issue5738 jnoller patch datetime.timedelta is inconvenient to use... 222 days http://bugs.python.org/issue5788 pitrou patch tarfile: opening an empty tar file fails 179 days http://bugs.python.org/issue6123 lars.gustaebel patch OS X: python3 from python-3.1.dmg crashes at startup 146 days http://bugs.python.org/issue6393 ronaldoussoren patch, needs review expose setresuid 133 days http://bugs.python.org/issue6508 loewis patch Restart support in binary upload for ftplib 83 days http://bugs.python.org/issue6845 pitrou patch Backport py3k float repr to trunk 43 days http://bugs.python.org/issue7117 mark.dickinson patch cPickle looking for non-existent package copyreg 41 days http://bugs.python.org/issue7128 alexandre.vassalotti patch, easy %lld for PyErr_Format (Modules/_io/bufferedio.c) 28 days http://bugs.python.org/issue7228 mark.dickinson patch global statements outside functions/methods should raise SyntaxE 6 days http://bugs.python.org/issue7329 rhettinger calendar.TextCalendar().formatyear wrong argument list 5 days http://bugs.python.org/issue7345 georg.brandl csv doesn't handle escaped characters properly 2 days http://bugs.python.org/issue7350 tjreedy Fibonacci example does not include 0; section 4.6 3 days http://bugs.python.org/issue7369 mark.dickinson Windows 64-bit build "skips" several projects in VS 2008 5 days http://bugs.python.org/issue7371 srid Use PyModule_AddIntMacro() in Modules/gcmodule.c 1 days http://bugs.python.org/issue7373 benjamin.peterson patch Property accessor/getter called twice 0 days http://bugs.python.org/issue7374 mliddle 2to3 - does not translate urllib2 to urllib.request correctly fo 0 days http://bugs.python.org/issue7375 benjamin.peterson Slight difference: math.floor returns an Integral 0 days http://bugs.python.org/issue7377 r.david.murray Docstring for fractions.Fraction.limit_denominator fails 0 days http://bugs.python.org/issue7379 mark.dickinson test_multiprocessing leaks 1 days http://bugs.python.org/issue7383 r.david.murray More precise document on os.path.normpath() 0 days http://bugs.python.org/issue7387 benjamin.peterson Make decimal floating point be default, remove binary floating p 0 days http://bugs.python.org/issue7389 mark.dickinson inconsistent type return 0 days http://bugs.python.org/issue7390 pitrou Executing Python program of sum of 2 nos. 0 days http://bugs.python.org/issue7393 rhettinger Issue with _PyLong_Format while trying to build Python on HP-UX 0 days http://bugs.python.org/issue7398 eric.smith Small typo in Python's library documentation: set 0 days http://bugs.python.org/issue7400 georg.brandl patch Race condition in logging._acquireLock()? 0 days http://bugs.python.org/issue7403 vinay.sajip Handle ungzipped man pages in rpm builds correctly 1705 days http://bugs.python.org/issue1169193 dmalcolm patch difflib.Differ() doesn't always add hints for tab characters 1288 days http://bugs.python.org/issue1488943 orsenthil patch urllib2 proxy does not work in 2.4.3 1233 days http://bugs.python.org/issue1519816 orsenthil csv module broken for unicode 1091 days http://bugs.python.org/issue1606092 r.david.murray Top Issues Most Discussed (10) ______________________________ 21 multiprocessing logging support test 3 days open http://bugs.python.org/issue6615 8 test_multiprocessing fails consistently with 'signal 12' on Fre 21 days open http://bugs.python.org/issue7272 6 test_multiprocessing leaks 1 days closed http://bugs.python.org/issue7383 6 Cython compiler run crashes CPython 3.1.1 and 3.2 38 days open http://bugs.python.org/issue7173 5 "python -m doctest" results in FAIL: Doctest: __main__.DebugRun 5 days open http://bugs.python.org/issue7376 5 Fibonacci example does not include 0; section 4.6 3 days closed http://bugs.python.org/issue7369 5 cPickle looking for non-existent package copyreg 41 days closed http://bugs.python.org/issue7128 5 Backport py3k float repr to trunk 43 days closed http://bugs.python.org/issue7117 5 bdist_rpm fails when installing man pages 2557 days open http://bugs.python.org/issue644744 5 deepcopy doesn't copy instance methods 730 days open http://bugs.python.org/issue1515 1 0