[stdlib-sig] Proposal: new "interpreter" module
Benjamin Peterson
musiccomposition at gmail.com
Sat Apr 5 16:58:04 CEST 2008
Here's an updated version:
- display_hook, stdout, stdin, and stderr
- flags and warn_options
- settrace, and setprofile
- traceback, excepthook
- etc...
2. Data and functions that affect the CPython interpreter.
- get/setrecursionlimit
- get/setcheckinterval
- _getframe and _current_frame
- getrefcount
- get/setdlopenflags
- settscdumps
- api_version
- winver
- dllhandle
- float_info
The second collections of items has been steadily increasing over the years
causing clutter in sys. Guido has even said he doesn't recognize some of
things
in it [#bug-1522]_!
Other implementations have clearly struggled with what to do about the
contents
of sys they can't implement but must to retain compatibility. For example,
Jython's sys module has dud set/getrecursionlimit functions. Moving these
items
items off to another module would send a clear message about what functions
need
and need not be implemented.
It has also been proposed that the contents of types module be distributed
across the standard library [#types-removal]_; the interpreter module would
provide an excellent resting place for internal types like frames and code
objects.
Specification
=============
A new builtin module named "interpreter" (see `Naming`_) will be added. The
functions mentioned in the second list above will be moved to it.
Transition Plan
===============
Once implemented in 3.x, the interpreter module will be back-ported to 2.6.
Py3k warnings will be added the the sys functions it replaces.
Open Issues
===========
Naming
------
The author proposes the name "interpreter" for the new module. "pyvm" has
also
been suggested [#pyvm-name]_.
References
==========
.. [#bug-1522]
http://bugs.python.org/issue1522
.. [#types-removal]
http://mail.python.org/pipermail/stdlib-sig/2008-April/000172.html
.. [#pyvm-name]
http://mail.python.org/pipermail/python-3000/2007-November/011351.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
coding: utf-8
End:
On Sat, Apr 5, 2008 at 9:18 AM, Benjamin Peterson <
musiccomposition at gmail.com> wrote:
>
>
> On Fri, Apr 4, 2008 at 4:09 PM, Steven Bethard <steven.bethard at gmail.com>
> wrote:
>
> > On Fri, Apr 4, 2008 at 10:51 AM, Benjamin Peterson
> > <musiccomposition at gmail.com> wrote:
> > > PEP: XXX
> > > Title: The interpreter module
> > > Version: $Revision$
> > > Last-Modified: $Date$
> > > Author: Benjamin Peterson
> > > Status: Draft
> > > Type: Standards Track
> > > Content-Type: text/x-rst
> > > Created: 4-April-2008
> > > Python-Version: 3.0
> > >
> > >
> > > Abstract
> > > ========
> > >
> > > This PEP proposes a new low-level module for CPython-specific
> > interpreter
> > > functions in order to clean out the sys module and separate general
> > Python
> > > functionality from implementation details.
> > >
> > >
> > > Rationale
> > > =========
> > >
> > > The sys module currently contains functions and data that can be put
> > into
> > > two
> > > major groups:
> > >
> > > 1. Data and functions that are available in all Python implementations
> > and
> > > deal
> > > with the general running of a Python VM.
> > >
> > > - display_hook, stdout, stdin, and stderr
> > > - flags and warn_options
> > > - settrace, and setprofile
> > > - traceback, excepthook
> > > - etc...
> > >
> > >
> > > 2. Data and function that affect the CPython interpreter.
> > >
> > > - get/setrecursionlimit
> > > - get/setcheckinterval
> > > - _getframe and _current_frame
> > > - getrefcount
> > > - getdlopenflags
> >
> > Why getdlopenflags? That seems general to any Python implementation
> > that opens dlls (though I believe the dl module is going away in
> > Python 3, so it may not matter).
>
> I don't think any other implementations do open dynamic libs. Those flags
> don't affect the dl module; they define how Python opens C shared libs.
>
> >
> >
> > Also, maybe settscdump should be moved as well? Its description says
> > to look at "Python/ceval.c"
> >
> Yes.
>
> >
> >
> > Otherwise, it looks pretty good to me.
> >
> > Steve
> > --
> > I'm not *in*-sane. Indeed, I am so far *out* of sane that you appear a
> > tiny blip on the distant coast of sanity.
> > --- Bucky Katt, Get Fuzzy
> >
>
>
>
> --
> Cheers,
> Benjamin Peterson
--
Cheers,
Benjamin Peterson
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/stdlib-sig/attachments/20080405/5c904aee/attachment-0001.htm
More information about the stdlib-sig
mailing list