[Python-3000-checkins] r55361 - in python/branches/p3yk: Lib/string.py Lib/test/regrtest.py Lib/test/test_strop.py Misc/BeOS-setup.py Misc/NEWS Modules/stropmodule.c setup.py

guido.van.rossum python-3000-checkins at python.org
Tue May 15 23:59:30 CEST 2007


Author: guido.van.rossum
Date: Tue May 15 23:59:18 2007
New Revision: 55361

Removed:
   python/branches/p3yk/Lib/test/test_strop.py
   python/branches/p3yk/Modules/stropmodule.c
Modified:
   python/branches/p3yk/Lib/string.py
   python/branches/p3yk/Lib/test/regrtest.py
   python/branches/p3yk/Misc/BeOS-setup.py
   python/branches/p3yk/Misc/NEWS
   python/branches/p3yk/setup.py
Log:
Get rid of strop module.


Modified: python/branches/p3yk/Lib/string.py
==============================================================================
--- python/branches/p3yk/Lib/string.py	(original)
+++ python/branches/p3yk/Lib/string.py	Tue May 15 23:59:18 2007
@@ -195,14 +195,3 @@
             raise ValueError('Unrecognized named group in pattern',
                              self.pattern)
         return self.pattern.sub(convert, self.template)
-
-
-# Try importing optional built-in module "strop" -- if it exists,
-# it redefines some string operations that are 100-1000 times faster.
-# It also defines values for whitespace, lowercase and uppercase
-# that match <ctype.h>'s definitions.
-
-try:
-    from strop import maketrans
-except ImportError:
-    pass                                          # Use the original versions

Modified: python/branches/p3yk/Lib/test/regrtest.py
==============================================================================
--- python/branches/p3yk/Lib/test/regrtest.py	(original)
+++ python/branches/p3yk/Lib/test/regrtest.py	Tue May 15 23:59:18 2007
@@ -987,7 +987,6 @@
         test_poll
         test_pty
         test_pwd
-        test_strop
         test_sqlite
         test_startfile
         test_sunaudiodev

Deleted: /python/branches/p3yk/Lib/test/test_strop.py
==============================================================================
--- /python/branches/p3yk/Lib/test/test_strop.py	Tue May 15 23:59:18 2007
+++ (empty file)
@@ -1,24 +0,0 @@
-import warnings
-warnings.filterwarnings("ignore", "strop functions are obsolete;",
-                        DeprecationWarning,
-                        r'test.test_strop|unittest')
-import strop
-import unittest
-from test import test_support
-
-
-class StropFunctionTestCase(unittest.TestCase):
-
-    def test_maketrans(self):
-        self.assert_(strop.maketrans("abc", "xyz") == transtable)
-        self.assertRaises(ValueError, strop.maketrans, "abc", "xyzq")
-
-
-transtable = '\000\001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037 !"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`xyzdefghijklmnopqrstuvwxyz{|}~\177\200\201\202\203\204\205\206\207\210\211\212\213\214\215\216\217\220\221\222\223\224\225\226\227\230\231\232\233\234\235\236\237\240\241\242\243\244\245\246\247\250\251\252\253\254\255\256\257\260\261\262\263\264\265\266\267\270\271\272\273\274\275\276\277\300\301\302\303\304\305\306\307\310\311\312\313\314\315\316\317\320\321\322\323\324\325\326\327\330\331\332\333\334\335\336\337\340\341\342\343\344\345\346\347\350\351\352\353\354\355\356\357\360\361\362\363\364\365\366\367\370\371\372\373\374\375\376\377'
-
-
-def test_main():
-    test_support.run_unittest(StropFunctionTestCase)
-
-if __name__ == "__main__":
-    test_main()

Modified: python/branches/p3yk/Misc/BeOS-setup.py
==============================================================================
--- python/branches/p3yk/Misc/BeOS-setup.py	(original)
+++ python/branches/p3yk/Misc/BeOS-setup.py	Tue May 15 23:59:18 2007
@@ -188,8 +188,6 @@
         # math library functions, e.g. sin()
         exts.append( Extension('math',  ['mathmodule.c'],
                                libraries=math_libs) )
-        # fast string operations implemented in C
-        exts.append( Extension('strop', ['stropmodule.c']) )
         # time operations and variables
         exts.append( Extension('time', ['timemodule.c'],
                                libraries=math_libs) )

Modified: python/branches/p3yk/Misc/NEWS
==============================================================================
--- python/branches/p3yk/Misc/NEWS	(original)
+++ python/branches/p3yk/Misc/NEWS	Tue May 15 23:59:18 2007
@@ -26,6 +26,8 @@
 Core and Builtins
 -----------------
 
+- Remove strop module.
+
 - Remove tuple parameter unpacking (PEP 3113).
 
 - Remove the f_restricted attribute from frames.  This naturally leads to teh

Deleted: /python/branches/p3yk/Modules/stropmodule.c
==============================================================================
--- /python/branches/p3yk/Modules/stropmodule.c	Tue May 15 23:59:18 2007
+++ (empty file)
@@ -1,64 +0,0 @@
-/* strop module */
-
-#define PY_SSIZE_T_CLEAN
-#include "Python.h"
-
-PyDoc_STRVAR(strop_module__doc__,
-"Common string manipulations, optimized for speed.\n"
-"\n"
-"Always use \"import string\" rather than referencing\n"
-"this module directly.");
-
-PyDoc_STRVAR(maketrans__doc__,
-"maketrans(frm, to) -> string\n"
-"\n"
-"Return a translation table (a string of 256 bytes long)\n"
-"suitable for use in string.translate.  The strings frm and to\n"
-"must be of the same length.");
-
-static PyObject *
-strop_maketrans(PyObject *self, PyObject *args)
-{
-	unsigned char *c, *from=NULL, *to=NULL;
-	Py_ssize_t i, fromlen=0, tolen=0;
-	PyObject *result;
-
-	if (!PyArg_ParseTuple(args, "t#t#:maketrans", &from, &fromlen, &to, &tolen))
-		return NULL;
-
-	if (fromlen != tolen) {
-		PyErr_SetString(PyExc_ValueError,
-				"maketrans arguments must have same length");
-		return NULL;
-	}
-
-	result = PyString_FromStringAndSize((char *)NULL, 256);
-	if (result == NULL)
-		return NULL;
-	c = (unsigned char *) PyString_AS_STRING((PyStringObject *)result);
-	for (i = 0; i < 256; i++)
-		c[i]=(unsigned char)i;
-	for (i = 0; i < fromlen; i++)
-		c[from[i]]=to[i];
-
-	return result;
-}
-
-/* List of functions defined in the module */
-
-static PyMethodDef
-strop_methods[] = {
-	{"maketrans",	strop_maketrans,   METH_VARARGS, maketrans__doc__},
-	{NULL,		NULL}	/* sentinel */
-};
-
-
-PyMODINIT_FUNC
-initstrop(void)
-{
-	PyObject *m;
-	m = Py_InitModule4("strop", strop_methods, strop_module__doc__,
-			   (PyObject*)NULL, PYTHON_API_VERSION);
-	if (m == NULL)
-		return;
-}

Modified: python/branches/p3yk/setup.py
==============================================================================
--- python/branches/p3yk/setup.py	(original)
+++ python/branches/p3yk/setup.py	Tue May 15 23:59:18 2007
@@ -391,8 +391,6 @@
         # math library functions, e.g. sin()
         exts.append( Extension('math',  ['mathmodule.c'],
                                libraries=math_libs) )
-        # fast string operations implemented in C
-        exts.append( Extension('strop', ['stropmodule.c']) )
         # time operations and variables
         exts.append( Extension('time', ['timemodule.c'],
                                libraries=math_libs) )


More information about the Python-3000-checkins mailing list