From 1681ce0a5824d6800972b69d7d8665e3bcfa0991 Mon Sep 17 00:00:00 2001 From: Benjamin Peterson Date: Tue, 6 May 2008 22:01:54 +0000 Subject: [PATCH] Add my old rejected PEP: Cleaning out sys and the interpreter module --- pep-0000.txt | 2 + pep-3139.txt | 194 +++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 196 insertions(+) create mode 100644 pep-3139.txt diff --git a/pep-0000.txt b/pep-0000.txt index 1a8e7b7d9..47dfd8bc4 100644 --- a/pep-0000.txt +++ b/pep-0000.txt @@ -517,6 +517,7 @@ Numerical Index SR 3136 Labeled break and continue Chisholm SA 3137 Immutable Bytes and Mutable Buffer GvR S 3138 String representation in Python 3000 Ishimoto + SR 3139 Cleaning out sys and the "interpreter" module Peterson SA 3141 A Type Hierarchy for Numbers Yasskin @@ -612,6 +613,7 @@ Owners Pedroni, Samuele pedronis@python.org Pelletier, Michel michel@users.sourceforge.net Peters, Tim tim@zope.com + Peterson, Benjamin musiccomposition@gmail.com Petrone, Jason jp@demonseed.net Prescod, Paul paul@prescod.net Reedy, Terry tjreedy@udel.edu diff --git a/pep-3139.txt b/pep-3139.txt new file mode 100644 index 000000000..053cac3cc --- /dev/null +++ b/pep-3139.txt @@ -0,0 +1,194 @@ +PEP: 3139 +Title: Cleaning out sys and the "interpreter" module +Version: $Revision$ +Last-Modified: $Date$ +Author: Benjamin Peterson +Status: Rejected +Type: Standards Track +Content-Type: text/x-rst +Created: 4-April-2008 +Python-Version: 3.0 + + +Rejection Notice +================ + +Guido's -0.5 put an end to this PEP. See +http://mail.python.org/pipermail/python-3000/2008-April/012977.html. + + +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 virtual machine. + + - argv + - byteorder + - path, path_hooks, meta_path, path_importer_cache, and modules + - copyright, hexversion, version, and version_info + - displayhook, __displayhook__ + - excepthook, __excepthook__, exc_info, and exc_clear + - exec_prefix and prefix + - executable + - exit + - flags, py3kwarning, dont_write_bytecode, and warn_options + - getfilesystemencoding + - get/setprofile + - get/settrace, call_tracing + - getwindowsversion + - maxint and maxunicode + - platform + - ps1 and ps2 + - stdin, stderr, stdout, __stdin__, __stderr__, __stdout__ + - tracebacklimit + + +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 + - _compact_freelists + - _clear_type_cache + - subversion + - builtin_module_names + - callstats + - intern + +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]_! + +Moving these items items off to another module would send a clear message to +other Python implementations 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 second list of items above will be split into the stdlib as follows: + +The interpreter module + - get/setrecursionlimit + - get/setcheckinterval + - _getframe and _current_frame + - get/setdlopenflags + - settscdumps + - api_version + - winver + - dllhandle + - float_info + - _clear_type_cache + - subversion + - builtin_module_names + - callstats + - intern + +The gc module: + - getrefcount + - _compact_freelists + + +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 +=========== + + +What should move? +----------------- + + +dont_write_bytecode +^^^^^^^^^^^^^^^^^^^^ + +Some believe that the writing of bytecode is an implementation detail and should +be moved [#bytecode-issue]_. The counterargument is that all current, complete +Python implementations do write some sort of bytecode, so it is valuable to be +able to disable it. Also, if it is moved, some wish to put it in the imp +module. + + +Move to some to imp? +-------------------- + +It was noted that dont_write_bytecode or maybe builtin_module_names might fit +nicely in the imp module. + + +Naming +------ + +The author proposes the name "interpreter" for the new module. "pyvm" has also +been suggested [#pyvm-name]_. The name "cpython" was well liked +[#cpython-name]_. + + +References +========== + +.. [#bug-1522] + + http://bugs.python.org/issue1522 + +.. [#types-removal] + + http://mail.python.org/pipermail/stdlib-sig/2008-April/000172.html + +.. [#bytecode-issue] + + http://mail.python.org/pipermail/stdlib-sig/2008-April/000217.html + +.. [#pyvm-name] + + http://mail.python.org/pipermail/python-3000/2007-November/011351.html + +.. [#cpython-name] + + http://mail.python.org/pipermail/stdlib-sig/2008-April/000223.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: