]> granicus.if.org Git - python/commitdiff
Issue #19515: Remove identifiers duplicated in the same file.
authorVictor Stinner <victor.stinner@gmail.com>
Tue, 12 Nov 2013 20:39:02 +0000 (21:39 +0100)
committerVictor Stinner <victor.stinner@gmail.com>
Tue, 12 Nov 2013 20:39:02 +0000 (21:39 +0100)
Patch written by Andrei Dorian Duma.

Modules/_io/bufferedio.c
Modules/_io/iobase.c
Modules/cjkcodecs/multibytecodec.c
Objects/typeobject.c
Python/pythonrun.c

index 6fe5d586a9c01f7f6a0c2b1845f2c8038cc0e436..a04b48dd3a98be781973901f8f791deba130969c 100644 (file)
@@ -52,7 +52,6 @@ bufferediobase_readinto(PyObject *self, PyObject *args)
     Py_buffer buf;
     Py_ssize_t len;
     PyObject *data;
-    _Py_IDENTIFIER(read);
 
     if (!PyArg_ParseTuple(args, "w*:readinto", &buf)) {
         return NULL;
index 3da7e5d89c36c4e0474713c9a7a0afab1993fda0..1b7cb0ff702793487f7f4b52cce6b2be7f057dcb 100644 (file)
@@ -63,6 +63,8 @@ _Py_IDENTIFIER(__IOBase_closed);
 #define IS_CLOSED(self) \
     _PyObject_HasAttrId(self, &PyId___IOBase_closed)
 
+_Py_IDENTIFIER(read);
+
 /* Internal methods */
 static PyObject *
 iobase_unsupported(const char *message)
@@ -180,7 +182,6 @@ static PyObject *
 iobase_close(PyObject *self, PyObject *args)
 {
     PyObject *res;
-    _Py_IDENTIFIER(__IOBase_closed);
 
     if (IS_CLOSED(self))
         Py_RETURN_NONE;
@@ -454,7 +455,6 @@ iobase_readline(PyObject *self, PyObject *args)
     int has_peek = 0;
     PyObject *buffer, *result;
     Py_ssize_t old_size = -1;
-    _Py_IDENTIFIER(read);
     _Py_IDENTIFIER(peek);
 
     if (!PyArg_ParseTuple(args, "|O&:readline", &_PyIO_ConvertSsize_t, &limit)) {
@@ -848,7 +848,6 @@ rawiobase_readall(PyObject *self, PyObject *args)
         return NULL;
 
     while (1) {
-        _Py_IDENTIFIER(read);
         PyObject *data = _PyObject_CallMethodId(self, &PyId_read,
                                                 "i", DEFAULT_BUFFER_SIZE);
         if (!data) {
index 3c5173f68c844d012268fad7e8f0b40fef455a86..087ae9b1aff5eb6f7aa1032c91bccfb4afd28a7c 100644 (file)
@@ -51,6 +51,8 @@ static PyObject *multibytecodec_encode(MultibyteCodec *,
 
 #define MBENC_RESET     MBENC_MAX<<1 /* reset after an encoding session */
 
+_Py_IDENTIFIER(write);
+
 static PyObject *
 make_tuple(PyObject *object, Py_ssize_t len)
 {
@@ -1569,7 +1571,6 @@ mbstreamwriter_iwrite(MultibyteStreamWriterObject *self,
                       PyObject *unistr)
 {
     PyObject *str, *wr;
-    _Py_IDENTIFIER(write);
 
     str = encoder_encode_stateful(STATEFUL_ECTX(self), unistr, 0);
     if (str == NULL)
@@ -1639,7 +1640,6 @@ mbstreamwriter_reset(MultibyteStreamWriterObject *self)
     assert(PyBytes_Check(pwrt));
     if (PyBytes_Size(pwrt) > 0) {
         PyObject *wr;
-        _Py_IDENTIFIER(write);
 
         wr = _PyObject_CallMethodId(self->stream, &PyId_write, "O", pwrt);
         if (wr == NULL) {
index 0708d678e18a6dc10513033f8ecec6f001b863dd..09f77fa53d141b06e6e304c44b8fd17b0efa0ae3 100644 (file)
@@ -5633,7 +5633,6 @@ slot_tp_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
     PyObject *func;
     PyObject *newargs, *x;
     Py_ssize_t i, n;
-    _Py_IDENTIFIER(__new__);
 
     func = _PyObject_GetAttrId((PyObject *)type, &PyId___new__);
     if (func == NULL)
index 8a59169d4f05d9ca3ed7a1f2733c16ad69db3441..8ccf70dea979666f28b9a1fdcea5d86aa409f3dc 100644 (file)
 
 _Py_IDENTIFIER(builtins);
 _Py_IDENTIFIER(excepthook);
+_Py_IDENTIFIER(flush);
 _Py_IDENTIFIER(last_traceback);
 _Py_IDENTIFIER(last_type);
 _Py_IDENTIFIER(last_value);
+_Py_IDENTIFIER(name);
 _Py_IDENTIFIER(ps1);
 _Py_IDENTIFIER(ps2);
 _Py_IDENTIFIER(stdin);
@@ -215,7 +217,6 @@ get_codec_name(const char *encoding)
 {
     char *name_utf8, *name_str;
     PyObject *codec, *name = NULL;
-    _Py_IDENTIFIER(name);
 
     codec = _PyCodec_Lookup(encoding);
     if (!codec)
@@ -512,7 +513,6 @@ flush_std_files(void)
     PyObject *fout = _PySys_GetObjectId(&PyId_stdout);
     PyObject *ferr = _PySys_GetObjectId(&PyId_stderr);
     PyObject *tmp;
-    _Py_IDENTIFIER(flush);
 
     if (fout != NULL && fout != Py_None && !file_is_closed(fout)) {
         tmp = _PyObject_CallMethodId(fout, &PyId_flush, "");
@@ -1009,7 +1009,6 @@ create_stdio(PyObject* io,
     _Py_IDENTIFIER(open);
     _Py_IDENTIFIER(isatty);
     _Py_IDENTIFIER(TextIOWrapper);
-    _Py_IDENTIFIER(name);
     _Py_IDENTIFIER(mode);
 
     /* stdin is always opened in buffered mode, first because it shouldn't
@@ -2130,7 +2129,6 @@ flush_io(void)
 {
     PyObject *f, *r;
     PyObject *type, *value, *traceback;
-    _Py_IDENTIFIER(flush);
 
     /* Save the current exception */
     PyErr_Fetch(&type, &value, &traceback);