[Python-checkins] r67994 - in sandbox/trunk/io-c: _bufferedio.c _bytesio.c _fileio.c _iobase.c _iomodule.h _textio.c io.c

amaury.forgeotdarc python-checkins at python.org
Sun Dec 28 22:09:49 CET 2008


Author: amaury.forgeotdarc
Date: Sun Dec 28 22:09:48 2008
New Revision: 67994

Log:
Temporarily rename some symbols to avoid clashes with the ones in the main python executable.
They will be removed when this module becomes the official one.

Other bugfixes to make it work on Linux.


Modified:
   sandbox/trunk/io-c/_bufferedio.c
   sandbox/trunk/io-c/_bytesio.c
   sandbox/trunk/io-c/_fileio.c
   sandbox/trunk/io-c/_iobase.c
   sandbox/trunk/io-c/_iomodule.h
   sandbox/trunk/io-c/_textio.c
   sandbox/trunk/io-c/io.c

Modified: sandbox/trunk/io-c/_bufferedio.c
==============================================================================
--- sandbox/trunk/io-c/_bufferedio.c	(original)
+++ sandbox/trunk/io-c/_bufferedio.c	Sun Dec 28 22:09:48 2008
@@ -3,9 +3,6 @@
 #include "pythread.h"
 #include "_iomodule.h"
 
-extern PyObject *
-_PyIOBase_checkClosed(PyObject *self, PyObject *unused);
-
 /*
  * BufferedIOBase class, inherits from IOBase.
  */
@@ -329,9 +326,6 @@
 static PyObject *
 _BufferedReader_read_unlocked(BufferedObject *self, Py_ssize_t n)
 {
-    PyObject *nodata_val = NULL;
-    PyObject *empty_values = NULL;
-
     PyObject *buf = self->read_buf;
     Py_ssize_t pos = self->read_pos;
     PyObject *data, *chunks, *sep, *res;

Modified: sandbox/trunk/io-c/_bytesio.c
==============================================================================
--- sandbox/trunk/io-c/_bytesio.c	(original)
+++ sandbox/trunk/io-c/_bytesio.c	Sun Dec 28 22:09:48 2008
@@ -1,5 +1,6 @@
 #include "Python.h"
 #include "structmember.h"       /* for offsetof() */
+#include "_iomodule.h"
 
 typedef struct {
     PyObject_HEAD

Modified: sandbox/trunk/io-c/_fileio.c
==============================================================================
--- sandbox/trunk/io-c/_fileio.c	(original)
+++ sandbox/trunk/io-c/_fileio.c	Sun Dec 28 22:09:48 2008
@@ -142,7 +142,7 @@
 {
 	PyFileIOObject *self = (PyFileIOObject *) oself;
 	static char *kwlist[] = {"file", "mode", "closefd", NULL};
-	char *name = NULL;
+	const char *name = NULL;
 	PyObject *nameobj;
 	char *mode = "r";
 	char *s;
@@ -320,7 +320,6 @@
 	ret = -1;
 
  done:
-	PyMem_Free(name);
 	return ret;
 }
 

Modified: sandbox/trunk/io-c/_iobase.c
==============================================================================
--- sandbox/trunk/io-c/_iobase.c	(original)
+++ sandbox/trunk/io-c/_iobase.c	Sun Dec 28 22:09:48 2008
@@ -393,7 +393,7 @@
 }
 
 static PyObject *
-IOBase_iter(PyObject *self, PyObject *args)
+IOBase_iter(PyObject *self)
 {
     if (_PyIOBase_checkClosed(self, NULL) == NULL)
         return NULL;

Modified: sandbox/trunk/io-c/_iomodule.h
==============================================================================
--- sandbox/trunk/io-c/_iomodule.h	(original)
+++ sandbox/trunk/io-c/_iomodule.h	Sun Dec 28 22:09:48 2008
@@ -1,4 +1,20 @@
 /*
+ * Temporarily rename symbols, to avoid mismatches with the main executable
+ */
+#define PyRawIOBase_Type _newio_PyRawIOBase_Type
+#define PyFileIO_Type _newio_PyFileIO_Type
+#define PyBytesIO_Type _newio_PyBytesIO_Type
+#define PyIOBase_Type _newio_PyIOBase_Type
+#define PyRawIOBase_Type _newio_PyRawIOBase_Type
+#define PyBufferedIOBase_Type _newio_PyBufferedIOBase_Type
+#define PyBufferedReader_Type _newio_PyBufferedReader_Type
+#define PyBufferedWriter_Type _newio_PyBufferedWriter_Type
+#define PyBufferedRWPair_Type _newio_PyBufferedRWPair_Type
+#define PyBufferedRandom_Type _newio_PyBufferedRandom_Type
+#define PyTextIOWrapper_Type _newio_PyTextIOWrapper_Type
+#define PyIncrementalNewlineDecoder_Type _newio_PyIncrementalNewlineDecoder_Type
+
+/*
  * Declarations shared between the different parts of the io module
  */
 
@@ -17,6 +33,7 @@
 extern PyObject* _PyIOBase_checkReadable(PyObject *self, PyObject *unused);
 extern PyObject* _PyIOBase_checkWritable(PyObject *self, PyObject *unused);
 extern PyObject* _PyIOBase_checkSeekable(PyObject *self, PyObject *unused);
+extern PyObject* _PyIOBase_checkClosed(PyObject *self, PyObject *unused);
 
 extern PyObject* PyIOExc_UnsupportedOperation;
 

Modified: sandbox/trunk/io-c/_textio.c
==============================================================================
--- sandbox/trunk/io-c/_textio.c	(original)
+++ sandbox/trunk/io-c/_textio.c	Sun Dec 28 22:09:48 2008
@@ -2,9 +2,6 @@
 #include "structmember.h"
 #include "_iomodule.h"
 
-extern PyObject *
-_PyIOBase_checkClosed(PyObject *self, PyObject *unused);
-
 /* TextIOBase */
 
 PyDoc_STRVAR(TextIOBase_doc,

Modified: sandbox/trunk/io-c/io.c
==============================================================================
--- sandbox/trunk/io-c/io.c	(original)
+++ sandbox/trunk/io-c/io.c	Sun Dec 28 22:09:48 2008
@@ -501,7 +501,7 @@
 };
 
 PyMODINIT_FUNC
-PyInit__io()
+PyInit__io(void)
 {
     PyObject *m = PyModule_Create(&iomodule);
     PyTypeObject *base;


More information about the Python-checkins mailing list